Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SD_STLPOOL_HXX
21 : #define _SD_STLPOOL_HXX
22 :
23 : #include <com/sun/star/lang/XServiceInfo.hpp>
24 : #include <com/sun/star/container/XIndexAccess.hpp>
25 : #include <com/sun/star/container/XNameContainer.hpp>
26 : #include <com/sun/star/container/XNamed.hpp>
27 : #include <com/sun/star/beans/XPropertySet.hpp>
28 : #include <com/sun/star/lang/XComponent.hpp>
29 : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
30 :
31 : #include <cppuhelper/implbase4.hxx>
32 : #include <cppuhelper/implbase7.hxx>
33 : #include <map>
34 : #include <vector>
35 :
36 : #include <stlfamily.hxx>
37 : #include <stlsheet.hxx>
38 :
39 : #include <sddllapi.h>
40 :
41 : class SdStyleSheet;
42 : class SdDrawDocument;
43 : class SdPage;
44 : class SfxStyleSheetBase;
45 :
46 : typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap;
47 :
48 : typedef ::cppu::ImplInheritanceHelper4< SfxStyleSheetPool,
49 : ::com::sun::star::lang::XServiceInfo,
50 : ::com::sun::star::container::XIndexAccess,
51 : ::com::sun::star::container::XNameAccess,
52 : ::com::sun::star::lang::XComponent > SdStyleSheetPoolBase;
53 :
54 : class SdStyleSheetPool : public SdStyleSheetPoolBase, public SfxListener
55 : {
56 : friend class SdDrawDocument;
57 : public:
58 : SdStyleSheetPool(SfxItemPool const& rPool, SdDrawDocument* pDocument);
59 :
60 0 : void SetActualStyleSheet(SfxStyleSheetBase* pActStyleSheet) { mpActualStyleSheet = pActStyleSheet; }
61 0 : SfxStyleSheetBase* GetActualStyleSheet() { return mpActualStyleSheet; }
62 :
63 : SfxStyleSheetBase* GetTitleSheet(const String& rLayoutName);
64 :
65 : // Caller has to delete the list
66 : void CreateOutlineSheetList(const String& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles);
67 :
68 : /** creates all layout style sheets for the givin layout name if they
69 : don't exist yet.
70 :
71 : @param rLayoutName Must be the name of a master page
72 : @param bCheck If set to true, the debug version will assert if a style
73 : had to be created. This is used to assert errors in documents
74 : when styles are missing.
75 : */
76 : SD_DLLPUBLIC void CreateLayoutStyleSheets(const String& rLayoutName, sal_Bool bCheck = sal_False );
77 : void CreateLayoutSheetNames(const String& rLayoutName, std::vector<String> &aNameList) const;
78 : void CreateLayoutSheetList(const String& rLayoutName, SdStyleSheetVector& rLayoutSheets);
79 : void CopyLayoutSheets(const String& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets );
80 : void CopyGraphicSheets(SdStyleSheetPool& rSourcePool);
81 : void CopyCellSheets(SdStyleSheetPool& rSourcePool);
82 : void CopyTableStyles(SdStyleSheetPool& rSourcePool);
83 : void CopyGraphicSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets);
84 : void CopyCellSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets);
85 :
86 : void CreatePseudosIfNecessary();
87 : void UpdateStdNames();
88 : static void PutNumBulletItem( SfxStyleSheetBase* pSheet, Font& rBulletFont );
89 : Font GetBulletFont() const;
90 :
91 796 : SdDrawDocument* GetDoc() const { return mpDoc; }
92 :
93 : static SdStyleSheetVector CreateChildList( SdStyleSheet* pSheet );
94 :
95 :
96 : public:
97 : void throwIfDisposed() throw(::com::sun::star::uno::RuntimeException);
98 :
99 : // XServiceInfo
100 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
101 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
102 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
103 :
104 : // XNameAccess
105 : virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
106 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException);
107 : virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
108 :
109 : // XElementAccess
110 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
111 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
112 :
113 : // XIndexAccess
114 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
115 : 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);
116 :
117 : // XComponent
118 : virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
119 : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
120 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
121 :
122 : virtual void SAL_CALL acquire (void) throw ();
123 : virtual void SAL_CALL release (void) throw ();
124 : protected:
125 : void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily );
126 : void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets );
127 :
128 : virtual SfxStyleSheetBase* Create(const OUString& rName, SfxStyleFamily eFamily, sal_uInt16 nMask);
129 : virtual SfxStyleSheetBase* Create(const SdStyleSheet& rStyle);
130 :
131 : using SfxStyleSheetPool::Create;
132 : virtual ~SdStyleSheetPool();
133 :
134 : void AddStyleFamily( const SdPage* pPage );
135 : void RemoveStyleFamily( const SdPage* pPage );
136 :
137 : private:
138 : SfxStyleSheetBase* mpActualStyleSheet;
139 : SdDrawDocument* mpDoc;
140 : SdStyleFamilyRef mxGraphicFamily;
141 : SdStyleFamilyRef mxCellFamily;
142 : SdStyleFamilyMap maStyleFamilyMap;
143 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxTableFamily;
144 : OUString msTableFamilyName;
145 : };
146 :
147 : #endif // _SD_STLPOOL_HXX
148 :
149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|