1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SD_SIDEBAR_PANELS_RECENTLY_USED_MASTER_PAGES_HXX
21 #define SD_SIDEBAR_PANELS_RECENTLY_USED_MASTER_PAGES_HXX
23 #include "tools/SdGlobalResourceContainer.hxx"
24 #include <osl/mutex.hxx>
25 #include <tools/link.hxx>
26 #include <vcl/image.hxx>
29 #include "DrawDocShell.hxx"
30 #include "MasterPageContainer.hxx"
31 #include <com/sun/star/uno/XInterface.hpp>
34 class MasterPageObserverEvent
;
38 namespace sd
{ namespace sidebar
{
40 /** This singleton holds a list of the most recently used master pages.
42 class RecentlyUsedMasterPages
43 : public SdGlobalResource
46 /** Return the single instance of this class.
48 static RecentlyUsedMasterPages
& Instance (void);
50 void AddEventListener (const Link
& rEventListener
);
51 void RemoveEventListener (const Link
& rEventListener
);
53 int GetMasterPageCount (void) const;
54 MasterPageContainer::Token
GetTokenForIndex (sal_uInt32 nIndex
) const;
57 /** The single instance of this class. It is created on demand when
58 Instance() is called for the first time.
60 static RecentlyUsedMasterPages
* mpInstance
;
62 ::std::vector
<Link
> maListeners
;
65 ::std::auto_ptr
<MasterPageList
> mpMasterPages
;
66 unsigned long int mnMaxListSize
;
67 ::boost::shared_ptr
<MasterPageContainer
> mpContainer
;
69 RecentlyUsedMasterPages (void);
70 virtual ~RecentlyUsedMasterPages (void);
72 /** Call this method after a new object has been created.
76 /// The copy constructor is not implemented. Do not use!
77 RecentlyUsedMasterPages (const RecentlyUsedMasterPages
&);
79 /// The assignment operator is not implemented. Do not use!
80 RecentlyUsedMasterPages
& operator= (const RecentlyUsedMasterPages
&);
82 void SendEvent (void);
83 DECL_LINK(MasterPageChangeListener
, MasterPageObserverEvent
*);
84 DECL_LINK(MasterPageContainerChangeListener
, MasterPageContainerChangeEvent
*);
86 /** Add a descriptor for the specified master page to the end of the
87 list of most recently used master pages. When the page is already a
88 member of that list the associated descriptor is moved to the end of
89 the list to make it the most recently used entry.
90 @param bMakePersistent
91 When <TRUE/> is given then the new list of recently used master
92 pages is written back into the configuration to make it
93 persistent. Giving <FALSE/> to ommit this is used while loading
94 the persistent list from the configuration.
97 MasterPageContainer::Token aToken
,
98 bool bMakePersistent
= true);
100 /** Load the list of recently used master pages from the registry where
101 it was saved to make it persistent.
103 void LoadPersistentValues (void);
105 /** Save the list of recently used master pages to the registry to make
108 void SavePersistentValues (void);
110 void ResolveList (void);
115 } } // end of namespace sd::sidebar
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */