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 INCLUDED_SD_INC_STLPOOL_HXX
21 : #define INCLUDED_SD_INC_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 : class SvxNumberFormat;
46 :
47 : typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap;
48 :
49 : typedef ::cppu::ImplInheritanceHelper4< SfxStyleSheetPool,
50 : ::com::sun::star::lang::XServiceInfo,
51 : ::com::sun::star::container::XIndexAccess,
52 : ::com::sun::star::container::XNameAccess,
53 : ::com::sun::star::lang::XComponent > SdStyleSheetPoolBase;
54 :
55 : class SdStyleSheetPool : public SdStyleSheetPoolBase, public SfxListener
56 : {
57 : friend class SdDrawDocument;
58 : public:
59 : SdStyleSheetPool(SfxItemPool const& rPool, SdDrawDocument* pDocument);
60 :
61 0 : void SetActualStyleSheet(SfxStyleSheetBase* pActStyleSheet) { mpActualStyleSheet = pActStyleSheet; }
62 0 : SfxStyleSheetBase* GetActualStyleSheet() { return mpActualStyleSheet; }
63 :
64 : SfxStyleSheetBase* GetTitleSheet(const OUString& rLayoutName);
65 :
66 : // Caller has to delete the list
67 : void CreateOutlineSheetList(const OUString& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles);
68 :
69 : /** creates all layout style sheets for the given layout name if they
70 : don't exist yet.
71 :
72 : @param rLayoutName Must be the name of a master page
73 : @param bCheck If set to true, the debug version will assert if a style
74 : had to be created. This is used to assert errors in documents
75 : when styles are missing.
76 : */
77 : SD_DLLPUBLIC void CreateLayoutStyleSheets(const OUString& rLayoutName, bool bCheck = false );
78 : void CreateLayoutSheetNames(const OUString& rLayoutName, std::vector<OUString> &aNameList) const;
79 : void CreateLayoutSheetList(const OUString& rLayoutName, SdStyleSheetVector& rLayoutSheets);
80 : void CopyLayoutSheets(const OUString& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets );
81 : void CopyGraphicSheets(SdStyleSheetPool& rSourcePool);
82 : void CopyCellSheets(SdStyleSheetPool& rSourcePool);
83 : void CopyTableStyles(SdStyleSheetPool& rSourcePool);
84 : void CopyCellSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets);
85 : void RenameAndCopyGraphicSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets, OUString &rRenameSuffix);
86 :
87 : void CreatePseudosIfNecessary();
88 : void UpdateStdNames();
89 : static void PutNumBulletItem( SfxStyleSheetBase* pSheet, vcl::Font& rBulletFont );
90 : static vcl::Font GetBulletFont();
91 :
92 1920 : SdDrawDocument* GetDoc() const { return mpDoc; }
93 :
94 : static SdStyleSheetVector CreateChildList( SdStyleSheet* pSheet );
95 :
96 : static void setDefaultOutlineNumberFormatBulletAndIndent(sal_uInt16 i, SvxNumberFormat &rNumberFormat);
97 :
98 : public:
99 : void throwIfDisposed() throw(::com::sun::star::uno::RuntimeException);
100 :
101 : // XServiceInfo
102 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 :
106 : // XNameAccess
107 : 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, std::exception) SAL_OVERRIDE;
108 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 : virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 :
111 : // XElementAccess
112 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 :
115 : // XIndexAccess
116 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
117 : 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, std::exception) SAL_OVERRIDE;
118 :
119 : // XComponent
120 : virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 :
124 : virtual void SAL_CALL acquire (void) throw () SAL_OVERRIDE;
125 : virtual void SAL_CALL release (void) throw () SAL_OVERRIDE;
126 : protected:
127 : void RenameAndCopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets, OUString &rRenameSuffix);
128 : void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily );
129 : void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets );
130 : void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets, OUString &rRenameSuffix );
131 :
132 : virtual SfxStyleSheetBase* Create(const OUString& rName, SfxStyleFamily eFamily, sal_uInt16 nMask) SAL_OVERRIDE;
133 : virtual SfxStyleSheetBase* Create(const SdStyleSheet& rStyle);
134 :
135 : using SfxStyleSheetPool::Create;
136 : virtual ~SdStyleSheetPool();
137 :
138 : void AddStyleFamily( const SdPage* pPage );
139 : void RemoveStyleFamily( const SdPage* pPage );
140 :
141 : private:
142 : SfxStyleSheetBase* mpActualStyleSheet;
143 : SdDrawDocument* mpDoc;
144 : SdStyleFamilyRef mxGraphicFamily;
145 : SdStyleFamilyRef mxCellFamily;
146 : SdStyleFamilyMap maStyleFamilyMap;
147 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxTableFamily;
148 : OUString msTableFamilyName;
149 : };
150 :
151 : #endif // INCLUDED_SD_INC_STLPOOL_HXX
152 :
153 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|