build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / sd / inc / stlpool.hxx
blobb016db6c489cc3d541199cf785730c0bc6de7ee8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_INC_STLPOOL_HXX
21 #define INCLUDED_SD_INC_STLPOOL_HXX
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>
31 #include <cppuhelper/implbase.hxx>
32 #include <map>
33 #include <vector>
35 #include <stlfamily.hxx>
36 #include <stlsheet.hxx>
38 #include <sddllapi.h>
40 class SdStyleSheet;
41 class SdDrawDocument;
42 class SdPage;
43 class SfxStyleSheetBase;
44 class SvxNumberFormat;
46 typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap;
48 typedef ::cppu::ImplInheritanceHelper< SfxStyleSheetPool,
49 css::lang::XServiceInfo,
50 css::container::XIndexAccess,
51 css::container::XNameAccess,
52 css::lang::XComponent > SdStyleSheetPoolBase;
54 class SdStyleSheetPool : public SdStyleSheetPoolBase, public SfxListener
56 friend class SdDrawDocument;
57 public:
58 SdStyleSheetPool(SfxItemPool const& rPool, SdDrawDocument* pDocument);
60 void SetActualStyleSheet(SfxStyleSheetBase* pActStyleSheet) { mpActualStyleSheet = pActStyleSheet; }
61 SfxStyleSheetBase* GetActualStyleSheet() { return mpActualStyleSheet; }
63 SfxStyleSheetBase* GetTitleSheet(const OUString& rLayoutName);
65 // Caller has to delete the list
66 void CreateOutlineSheetList(const OUString& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles);
68 /** creates all layout style sheets for the given layout name if they
69 don't exist yet.
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.
76 SD_DLLPUBLIC void CreateLayoutStyleSheets(const OUString& rLayoutName, bool bCheck = false );
77 static void CreateLayoutSheetNames(const OUString& rLayoutName, std::vector<OUString> &aNameList);
78 void CreateLayoutSheetList(const OUString& rLayoutName, SdStyleSheetVector& rLayoutSheets);
79 void CopyLayoutSheets(const OUString& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets );
80 void CopyGraphicSheets(SdStyleSheetPool& rSourcePool);
81 void CopyCellSheets(SdStyleSheetPool& rSourcePool);
82 void CopyTableStyles(SdStyleSheetPool& rSourcePool);
83 void CopyCellSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets);
84 void RenameAndCopyGraphicSheets(SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets, OUString &rRenameSuffix);
86 void CreatePseudosIfNecessary();
87 void UpdateStdNames();
88 static void PutNumBulletItem( SfxStyleSheetBase* pSheet, vcl::Font& rBulletFont );
89 static vcl::Font GetBulletFont();
91 SdDrawDocument* GetDoc() const { return mpDoc; }
93 static SdStyleSheetVector CreateChildList( SdStyleSheet* pSheet );
95 static void setDefaultOutlineNumberFormatBulletAndIndent(sal_uInt16 i, SvxNumberFormat &rNumberFormat);
97 public:
98 void throwIfDisposed() throw(css::uno::RuntimeException);
100 // XServiceInfo
101 virtual OUString SAL_CALL getImplementationName() throw(css::uno::RuntimeException, std::exception) override;
102 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(css::uno::RuntimeException, std::exception) override;
103 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException, std::exception) override;
105 // XNameAccess
106 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override;
107 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() throw(css::uno::RuntimeException, std::exception) override;
108 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(css::uno::RuntimeException, std::exception) override;
110 // XElementAccess
111 virtual css::uno::Type SAL_CALL getElementType() throw(css::uno::RuntimeException, std::exception) override;
112 virtual sal_Bool SAL_CALL hasElements() throw(css::uno::RuntimeException, std::exception) override;
114 // XIndexAccess
115 virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException, std::exception) override ;
116 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(css::lang::IndexOutOfBoundsException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override;
118 // XComponent
119 virtual void SAL_CALL dispose( ) throw (css::uno::RuntimeException, std::exception) override;
120 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException, std::exception) override;
121 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException, std::exception) override;
123 protected:
124 void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily );
125 void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets );
126 void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets, OUString &rRenameSuffix );
128 virtual SfxStyleSheetBase* Create(const OUString& rName, SfxStyleFamily eFamily, sal_uInt16 nMask) override;
130 using SfxStyleSheetPool::Create;
131 virtual ~SdStyleSheetPool() override;
133 void AddStyleFamily( const SdPage* pPage );
134 void RemoveStyleFamily( const SdPage* pPage );
136 private:
137 SfxStyleSheetBase* mpActualStyleSheet;
138 SdDrawDocument* mpDoc;
139 SdStyleFamilyRef mxGraphicFamily;
140 SdStyleFamilyRef mxCellFamily;
141 SdStyleFamilyMap maStyleFamilyMap;
142 css::uno::Reference< css::container::XNameAccess > mxTableFamily;
143 OUString msTableFamilyName;
146 #endif // INCLUDED_SD_INC_STLPOOL_HXX
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */