merge the formfield patch from ooo-build
[ooovba.git] / sd / inc / stlpool.hxx
blob68dba1dbf1b6320bad818c60b7c9744be6875bf6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: stlpool.hxx,v $
10 * $Revision: 1.7.34.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SD_STLPOOL_HXX
32 #define _SD_STLPOOL_HXX
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/container/XIndexAccess.hpp>
36 #include <com/sun/star/container/XNameContainer.hpp>
37 #include <com/sun/star/container/XNamed.hpp>
38 #include <com/sun/star/beans/XPropertySet.hpp>
39 #include <com/sun/star/lang/XComponent.hpp>
40 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
42 #include <cppuhelper/implbase4.hxx>
43 #include <cppuhelper/implbase7.hxx>
44 #include <map>
45 #include <vector>
47 #include <stlfamily.hxx>
48 #include <stlsheet.hxx>
50 #include <sddllapi.h>
52 class SdStyleSheet;
53 class SdDrawDocument;
54 class SdPage;
56 typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap;
58 typedef ::cppu::ImplInheritanceHelper4< SfxStyleSheetPool,
59 ::com::sun::star::lang::XServiceInfo,
60 ::com::sun::star::container::XIndexAccess,
61 ::com::sun::star::container::XNameAccess,
62 ::com::sun::star::lang::XComponent > SdStyleSheetPoolBase;
64 class SdStyleSheetPool : public SdStyleSheetPoolBase, public SfxListener
66 friend class SdDrawDocument;
67 public:
68 SdStyleSheetPool(SfxItemPool const& rPool, SdDrawDocument* pDocument);
70 void SetActualStyleSheet(SfxStyleSheetBase* pActStyleSheet) { mpActualStyleSheet = pActStyleSheet; }
71 SfxStyleSheetBase* GetActualStyleSheet() { return mpActualStyleSheet; }
73 SfxStyleSheetBase* GetTitleSheet(const String& rLayoutName);
74 String GetLayoutName() const;
76 // Caller muss Liste loeschen
77 List* CreateOutlineSheetList(const String& rLayoutName);
79 /** creates all layout style sheets for the givin layout name if they
80 don't exist yet.
82 @param rLayoutName Must be the name of a master page
83 @param bCheck If set to true, the debug version will assert if a style
84 had to be created. This is used to assert errors in documents
85 when styles are missing.
87 SD_DLLPUBLIC void CreateLayoutStyleSheets(const String& rLayoutName, sal_Bool bCheck = sal_False );
88 void EraseLayoutStyleSheets(const String& rLayoutName);
89 List* CreateLayoutSheetNames(const String& rLayoutName) const;
90 void CreateLayoutSheetList(const String& rLayoutName, SdStyleSheetVector& rLayoutSheets);
91 void CopyLayoutSheets(const String& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets );
92 void CopyGraphicSheets(SdStyleSheetPool& rSourcePool);
93 void CopyCellSheets(SdStyleSheetPool& rSourcePool);
94 void CopyTableStyles(SdStyleSheetPool& rSourcePool);
96 void CreatePseudosIfNecessary();
97 void UpdateStdNames();
98 static void PutNumBulletItem( SfxStyleSheetBase* pSheet, Font& rBulletFont );
99 Font GetBulletFont() const;
101 SdDrawDocument* GetDoc() const { return mpDoc; }
103 static SdStyleSheetVector CreateChildList( SdStyleSheet* pSheet );
106 public:
107 void throwIfDisposed() throw(::com::sun::star::uno::RuntimeException);
109 // XServiceInfo
110 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
111 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
112 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
114 // XNameAccess
115 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
116 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException);
117 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
119 // XElementAccess
120 virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
121 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
123 // XIndexAccess
124 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
125 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
127 // XComponent
128 virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
129 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
130 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
132 protected:
133 void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily );
135 virtual SfxStyleSheetBase* Create(const String& rName, SfxStyleFamily eFamily, USHORT nMask);
136 virtual SfxStyleSheetBase* Create(const SdStyleSheet& rStyle);
138 using SfxStyleSheetPool::Create;
139 virtual ~SdStyleSheetPool();
141 void AddStyleFamily( const SdPage* pPage );
142 void RemoveStyleFamily( const SdPage* pPage );
144 private:
145 SfxStyleSheetBase* mpActualStyleSheet;
146 SdDrawDocument* mpDoc;
147 SdStyleFamilyRef mxGraphicFamily;
148 SdStyleFamilyRef mxCellFamily;
149 SdStyleFamilyMap maStyleFamilyMap;
150 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxTableFamily;
151 rtl::OUString msTableFamilyName;
154 #endif // _SD_STLPOOL_HXX