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