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