lok: avoid ILibreOfficeKitNotifier null ptr de-reference on shutdown.
[LibreOffice.git] / sd / inc / stlpool.hxx
blob3f60309813a27d52dc4d7b3f7844b6ea917ae5ee
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/lang/XComponent.hpp>
27 #include <cppuhelper/implbase.hxx>
28 #include <vcl/font.hxx>
29 #include <map>
30 #include <vector>
32 #include "stlfamily.hxx"
33 #include "stlsheet.hxx"
35 #include "sddllapi.h"
37 class SdDrawDocument;
38 class SdPage;
39 class SvxNumberFormat;
41 typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap;
43 typedef ::cppu::ImplInheritanceHelper< SfxStyleSheetPool,
44 css::lang::XServiceInfo,
45 css::container::XIndexAccess,
46 css::container::XNameAccess,
47 css::lang::XComponent > SdStyleSheetPoolBase;
49 class SAL_DLLPUBLIC_RTTI SdStyleSheetPool final : public SdStyleSheetPoolBase, public SfxListener
51 friend class SdDrawDocument;
52 public:
53 SdStyleSheetPool(SfxItemPool const& rPool, SdDrawDocument* pDocument);
55 void SetActualStyleSheet(SfxStyleSheetBase* pActStyleSheet) { mpActualStyleSheet = pActStyleSheet; }
56 SfxStyleSheetBase* GetActualStyleSheet() { return mpActualStyleSheet; }
58 SfxStyleSheetBase* GetTitleSheet(const OUString& rLayoutName);
60 // Caller has to delete the list
61 void CreateOutlineSheetList(const OUString& rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles);
63 /** creates all layout style sheets for the given layout name if they
64 don't exist yet.
66 @param rLayoutName Must be the name of a master page
67 @param bCheck If set to true, the debug version will assert if a style
68 had to be created. This is used to assert errors in documents
69 when styles are missing.
71 SD_DLLPUBLIC void CreateLayoutStyleSheets(const OUString& rLayoutName, bool bCheck = false );
72 static void CreateLayoutSheetNames(const OUString& rLayoutName, std::vector<OUString> &aNameList);
73 void CreateLayoutSheetList(const OUString& rLayoutName, SdStyleSheetVector& rLayoutSheets);
74 void CopyLayoutSheets(const OUString& rLayoutName, SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets);
75 void CopyGraphicSheets(SdStyleSheetPool& rSourcePool);
76 void CopyCellSheets(SdStyleSheetPool& rSourcePool);
77 void CopyTableStyles(SdStyleSheetPool const & rSourcePool);
78 void CopyCellSheets(SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets);
79 void RenameAndCopyGraphicSheets(SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets, OUString const &rRenameSuffix);
81 void CreatePseudosIfNecessary();
82 void UpdateStdNames();
83 static void PutNumBulletItem( SfxStyleSheetBase* pSheet, vcl::Font& rBulletFont );
84 static vcl::Font GetBulletFont();
86 SdDrawDocument* GetDoc() const { return mpDoc; }
88 static SdStyleSheetVector CreateChildList( SdStyleSheet const * pSheet );
90 static void setDefaultOutlineNumberFormatBulletAndIndent(sal_uInt16 i, SvxNumberFormat &rNumberFormat);
92 public:
93 /// @throws css::uno::RuntimeException
94 void throwIfDisposed();
96 // XServiceInfo
97 virtual OUString SAL_CALL getImplementationName() override;
98 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
99 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
101 // XNameAccess
102 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
103 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
104 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
106 // XElementAccess
107 virtual css::uno::Type SAL_CALL getElementType() override;
108 virtual sal_Bool SAL_CALL hasElements() override;
110 // XIndexAccess
111 virtual sal_Int32 SAL_CALL getCount() override ;
112 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
114 // XComponent
115 virtual void SAL_CALL dispose( ) override;
116 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
117 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
119 private:
120 void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily );
121 void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets );
122 void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets, const OUString &rRenameSuffix );
124 virtual SfxStyleSheetBase* Create(const OUString& rName, SfxStyleFamily eFamily, SfxStyleSearchBits nMask) override;
126 using SfxStyleSheetPool::Create;
127 virtual ~SdStyleSheetPool() override;
129 void AddStyleFamily( const SdPage* pPage );
130 void RemoveStyleFamily( const SdPage* pPage );
132 SfxStyleSheetBase* mpActualStyleSheet;
133 SdDrawDocument* mpDoc;
134 SdStyleFamilyRef mxGraphicFamily;
135 SdStyleFamilyRef mxCellFamily;
136 SdStyleFamilyMap maStyleFamilyMap;
137 css::uno::Reference< css::container::XNameAccess > mxTableFamily;
138 OUString msTableFamilyName;
141 #endif // INCLUDED_SD_INC_STLPOOL_HXX
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */