2004-07-13 08:47:50 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 00:43:19 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-07-13 08:47:50 -05:00
|
|
|
*
|
2005-09-09 00:43:19 -05:00
|
|
|
* $RCSfile: RecentlyUsedMasterPages.hxx,v $
|
2004-07-13 08:47:50 -05:00
|
|
|
*
|
2005-09-09 00:43:19 -05:00
|
|
|
* $Revision: 1.6 $
|
2004-07-13 08:47:50 -05:00
|
|
|
*
|
2005-09-09 00:43:19 -05:00
|
|
|
* last change: $Author: rt $ $Date: 2005-09-09 06:43:19 $
|
2004-07-13 08:47:50 -05:00
|
|
|
*
|
2005-09-09 00:43:19 -05:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2004-07-13 08:47:50 -05:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 00:43:19 -05:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2004-07-13 08:47:50 -05:00
|
|
|
*
|
2005-09-09 00:43:19 -05:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2004-07-13 08:47:50 -05:00
|
|
|
*
|
2005-09-09 00:43:19 -05:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2004-07-13 08:47:50 -05:00
|
|
|
*
|
2005-09-09 00:43:19 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2004-07-13 08:47:50 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef SD_TOOLPANEL_CONTROLS_RECENTLY_USED_MASTER_PAGES_HXX
|
|
|
|
#define SD_TOOLPANEL_CONTROLS_RECENTLY_USED_MASTER_PAGES_HXX
|
|
|
|
|
2004-08-04 02:59:59 -05:00
|
|
|
#include "tools/SdGlobalResourceContainer.hxx"
|
2004-07-13 08:47:50 -05:00
|
|
|
#include <osl/mutex.hxx>
|
|
|
|
#include <tools/link.hxx>
|
|
|
|
#include <vcl/image.hxx>
|
|
|
|
#include <vector>
|
|
|
|
#include <tools/string.hxx>
|
|
|
|
|
|
|
|
#include "DrawDocShell.hxx"
|
|
|
|
#include "MasterPageContainer.hxx"
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
|
|
|
|
#include <com/sun/star/uno/XInterface.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class SdPage;
|
|
|
|
|
|
|
|
namespace sd {
|
|
|
|
class MasterPageObserverEvent;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace sd { namespace toolpanel { namespace controls {
|
|
|
|
|
|
|
|
/** This singleton holds a list of the most recently used master pages.
|
|
|
|
*/
|
|
|
|
class RecentlyUsedMasterPages
|
2004-08-04 02:59:59 -05:00
|
|
|
: public SdGlobalResource
|
2004-07-13 08:47:50 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Return the single instance of this class.
|
|
|
|
*/
|
|
|
|
static RecentlyUsedMasterPages& Instance (void);
|
|
|
|
|
|
|
|
void AddEventListener (const Link& rEventListener);
|
|
|
|
void RemoveEventListener (const Link& rEventListener);
|
|
|
|
|
|
|
|
int GetMasterPageCount (void) const;
|
|
|
|
String GetURL (int nIndex) const;
|
|
|
|
String GetMasterPageName (int nIndex) const;
|
2005-02-16 10:01:37 -06:00
|
|
|
String GetMasterPageStyleName (int nIndex) const;
|
2004-07-13 08:47:50 -05:00
|
|
|
SdPage* GetSlide (int nIndex) const;
|
|
|
|
SdPage* GetMasterPage (int nIndex) const;
|
|
|
|
Image GetMasterPagePreview (int nIndex, int nWidth) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
/** The single instance of this class. It is created on demand when
|
|
|
|
Instance() is called for the first time.
|
|
|
|
*/
|
|
|
|
static RecentlyUsedMasterPages* mpInstance;
|
|
|
|
|
|
|
|
::std::vector<Link> maListeners;
|
|
|
|
|
|
|
|
typedef ::std::vector<MasterPageContainer::Token> MasterPageList;
|
|
|
|
class PageByNameFinder;
|
|
|
|
MasterPageList maMasterPages;
|
|
|
|
unsigned long int mnMaxListSize;
|
|
|
|
|
|
|
|
RecentlyUsedMasterPages (void);
|
2004-08-04 02:59:59 -05:00
|
|
|
virtual ~RecentlyUsedMasterPages (void);
|
|
|
|
|
2004-07-13 08:47:50 -05:00
|
|
|
/** Call this method after a new object has been created.
|
|
|
|
*/
|
|
|
|
void LateInit (void);
|
|
|
|
|
|
|
|
/// The copy constructor is not implemented. Do not use!
|
|
|
|
RecentlyUsedMasterPages (const RecentlyUsedMasterPages&);
|
|
|
|
|
|
|
|
/// The assignment operator is not implemented. Do not use!
|
|
|
|
RecentlyUsedMasterPages& operator= (const RecentlyUsedMasterPages&);
|
|
|
|
|
|
|
|
void SendEvent (void);
|
|
|
|
DECL_LINK(MasterPageChangeListener, MasterPageObserverEvent*);
|
|
|
|
|
|
|
|
/** Add a descriptor for the specified master page to the end of the
|
|
|
|
list of most recently used master pages. When the page is already a
|
|
|
|
member of that list the associated descriptor is moved to the end of
|
|
|
|
the list to make it the most recently used entry.
|
|
|
|
@param bMakePersistent
|
|
|
|
When <TRUE/> is given then the new list of recently used master
|
|
|
|
pages is written back into the configuration to make it
|
|
|
|
persistent. Giving <FALSE/> to ommit this is used while loading
|
|
|
|
the persistent list from the configuration.
|
|
|
|
*/
|
|
|
|
void AddMasterPage (
|
2004-11-26 08:10:00 -06:00
|
|
|
MasterPageContainer::Token aToken,
|
2004-07-13 08:47:50 -05:00
|
|
|
bool bMakePersistent = true);
|
|
|
|
|
|
|
|
/** Load the list of recently used master pages from the registry where
|
|
|
|
it was saved to make it persistent.
|
|
|
|
*/
|
|
|
|
void LoadPersistentValues (void);
|
|
|
|
|
|
|
|
/** Save the list of recently used master pages to the registry to make
|
|
|
|
it presistent.
|
|
|
|
*/
|
|
|
|
void SavePersistentValues (void);
|
|
|
|
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>
|
|
|
|
OpenConfiguration (
|
|
|
|
const ::rtl::OUString& rsRootName,
|
|
|
|
bool bReadOnly);
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>
|
|
|
|
GetConfigurationNode (
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::uno::XInterface>& xRoot,
|
|
|
|
const ::rtl::OUString& sPathToNode);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} } } // end of namespace ::sd::toolpanel::controls
|
|
|
|
|
|
|
|
#endif
|