1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
31 #include "stlfamily.hxx"
32 #include "stlsheet.hxx"
38 class SvxNumberFormat
;
40 typedef std::map
< const SdPage
*, SdStyleFamilyRef
> SdStyleFamilyMap
;
42 typedef ::cppu::ImplInheritanceHelper
< SfxStyleSheetPool
,
43 css::lang::XServiceInfo
,
44 css::container::XIndexAccess
,
45 css::container::XNameAccess
,
46 css::lang::XComponent
> SdStyleSheetPoolBase
;
48 class SAL_DLLPUBLIC_RTTI SdStyleSheetPool final
: public SdStyleSheetPoolBase
, public SfxListener
50 friend class SdDrawDocument
;
52 SdStyleSheetPool(SfxItemPool
const& rPool
, SdDrawDocument
* pDocument
);
54 void SetActualStyleSheet(SfxStyleSheetBase
* pActStyleSheet
) { mpActualStyleSheet
= pActStyleSheet
; }
55 SfxStyleSheetBase
* GetActualStyleSheet() { return mpActualStyleSheet
; }
57 SfxStyleSheetBase
* GetTitleSheet(const OUString
& rLayoutName
);
59 // Caller has to delete the list
60 void CreateOutlineSheetList(const OUString
& rLayoutName
, std::vector
<SfxStyleSheetBase
*> &rOutlineStyles
);
62 /** creates all layout style sheets for the given layout name if they
65 @param rLayoutName Must be the name of a master page
66 @param bCheck If set to true, the debug version will assert if a style
67 had to be created. This is used to assert errors in documents
68 when styles are missing.
70 SD_DLLPUBLIC
void CreateLayoutStyleSheets(const OUString
& rLayoutName
, bool bCheck
= false );
71 static void CreateLayoutSheetNames(const OUString
& rLayoutName
, std::vector
<OUString
> &aNameList
);
72 void CreateLayoutSheetList(const OUString
& rLayoutName
, SdStyleSheetVector
& rLayoutSheets
);
73 void CopyLayoutSheets(const OUString
& rLayoutName
, SdStyleSheetPool
& rSourcePool
, StyleSheetCopyResultVector
& rCreatedSheets
);
74 void CopyGraphicSheets(SdStyleSheetPool
& rSourcePool
);
75 void CopyCellSheets(SdStyleSheetPool
& rSourcePool
);
76 void CopyTableStyles(SdStyleSheetPool
const & rSourcePool
);
77 void CopyCellSheets(SdStyleSheetPool
& rSourcePool
, StyleSheetCopyResultVector
& rCreatedSheets
);
78 void RenameAndCopyGraphicSheets(SdStyleSheetPool
& rSourcePool
, StyleSheetCopyResultVector
& rCreatedSheets
, OUString
const &rRenameSuffix
);
80 void CreatePseudosIfNecessary();
81 void UpdateStdNames();
82 static void PutNumBulletItem( SfxStyleSheetBase
* pSheet
, vcl::Font
& rBulletFont
);
83 static vcl::Font
GetBulletFont();
85 SdDrawDocument
* GetDoc() const { return mpDoc
; }
87 static SdStyleSheetVector
CreateChildList( SdStyleSheet
const * pSheet
);
89 static void setDefaultOutlineNumberFormatBulletAndIndent(sal_uInt16 i
, SvxNumberFormat
&rNumberFormat
);
92 /// @throws css::uno::RuntimeException
93 void throwIfDisposed();
96 virtual OUString SAL_CALL
getImplementationName() override
;
97 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
98 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
101 virtual css::uno::Any SAL_CALL
getByName( const OUString
& aName
) override
;
102 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
103 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) override
;
106 virtual css::uno::Type SAL_CALL
getElementType() override
;
107 virtual sal_Bool SAL_CALL
hasElements() override
;
110 virtual sal_Int32 SAL_CALL
getCount() override
;
111 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
114 virtual void SAL_CALL
dispose( ) override
;
115 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
116 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
119 void CopySheets(SdStyleSheetPool
& rSourcePool
, SfxStyleFamily eFamily
);
120 void CopySheets(SdStyleSheetPool
& rSourcePool
, SfxStyleFamily eFamily
, StyleSheetCopyResultVector
& rCreatedSheets
);
121 void CopySheets(SdStyleSheetPool
& rSourcePool
, SfxStyleFamily eFamily
, StyleSheetCopyResultVector
& rCreatedSheets
, const OUString
&rRenameSuffix
);
123 virtual SfxStyleSheetBase
* Create(const OUString
& rName
, SfxStyleFamily eFamily
, SfxStyleSearchBits nMask
) override
;
125 using SfxStyleSheetPool::Create
;
126 virtual ~SdStyleSheetPool() override
;
128 void AddStyleFamily( const SdPage
* pPage
);
129 void RemoveStyleFamily( const SdPage
* pPage
);
131 SfxStyleSheetBase
* mpActualStyleSheet
;
132 SdDrawDocument
* mpDoc
;
133 SdStyleFamilyRef mxGraphicFamily
;
134 SdStyleFamilyRef mxCellFamily
;
135 SdStyleFamilyMap maStyleFamilyMap
;
136 css::uno::Reference
< css::container::XNameAccess
> mxTableFamily
;
137 OUString msTableFamilyName
;
140 #endif // INCLUDED_SD_INC_STLPOOL_HXX
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */