LibreOffice Module sd (master) 1
stlpool.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <com/sun/star/lang/XServiceInfo.hpp>
23#include <com/sun/star/container/XIndexAccess.hpp>
24#include <com/sun/star/lang/XComponent.hpp>
25
27#include <vcl/font.hxx>
28#include <map>
29#include <string_view>
30#include <vector>
31
32#include "stlfamily.hxx"
33#include "stlsheet.hxx"
34
35#include "sddllapi.h"
36
37class SdDrawDocument;
38class SdPage;
39class SvxNumberFormat;
40
41typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap;
42
43typedef ::cppu::ImplInheritanceHelper< SfxStyleSheetPool,
44 css::lang::XServiceInfo,
45 css::container::XIndexAccess,
46 css::container::XNameAccess,
47 css::lang::XComponent > SdStyleSheetPoolBase;
48
49class SAL_DLLPUBLIC_RTTI SdStyleSheetPool final : public SdStyleSheetPoolBase, public SfxListener
50{
51 friend class SdDrawDocument;
52public:
53 SdStyleSheetPool(SfxItemPool const& rPool, SdDrawDocument* pDocument);
54
55 void SetActualStyleSheet(SfxStyleSheetBase* pActStyleSheet) { mpActualStyleSheet = pActStyleSheet; }
56 SfxStyleSheetBase* GetActualStyleSheet() { return mpActualStyleSheet; }
57
58 SfxStyleSheetBase* GetTitleSheet(std::u16string_view rLayoutName);
59
60 // Caller has to delete the list
61 void CreateOutlineSheetList(std::u16string_view rLayoutName, std::vector<SfxStyleSheetBase*> &rOutlineStyles);
62
71 SD_DLLPUBLIC void CreateLayoutStyleSheets(std::u16string_view rLayoutName, bool bCheck = false );
72 static void CreateLayoutSheetNames(std::u16string_view rLayoutName, std::vector<OUString> &aNameList);
73 void CreateLayoutSheetList(std::u16string_view rLayoutName, SdStyleSheetVector& rLayoutSheets);
74 void CopyLayoutSheets(std::u16string_view rLayoutName, SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets);
75 void CopyGraphicSheets(SdStyleSheetPool& rSourcePool);
76 void CopyCellSheets(SdStyleSheetPool& rSourcePool);
77 void CopyTableStyles(SdStyleSheetPool const & rSourcePool);
78 void CopyTableStyles(SdStyleSheetPool const & rSourcePool, XStyleVector& rCreatedSheets);
79 void CopyCellSheets(SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets);
80 void RenameAndCopyGraphicSheets(SdStyleSheetPool& rSourcePool, StyleSheetCopyResultVector& rCreatedSheets, std::u16string_view rRenameSuffix);
81
82 void CreatePseudosIfNecessary();
83 void UpdateStdNames();
84 static void PutNumBulletItem( SfxStyleSheetBase* pSheet, vcl::Font& rBulletFont );
85 static vcl::Font GetBulletFont();
86
87 SdDrawDocument* GetDoc() const { return mpDoc; }
88
89 static SdStyleSheetVector CreateChildList( SdStyleSheet const * pSheet );
90
91 static void setDefaultOutlineNumberFormatBulletAndIndent(sal_uInt16 i, SvxNumberFormat &rNumberFormat);
92
93public:
95 void throwIfDisposed();
96
97 // XServiceInfo
98 virtual OUString SAL_CALL getImplementationName() override;
99 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
100 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
101
102 // XNameAccess
103 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
104 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
105 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
106
107 // XElementAccess
108 virtual css::uno::Type SAL_CALL getElementType() override;
109 virtual sal_Bool SAL_CALL hasElements() override;
110
111 // XIndexAccess
112 virtual sal_Int32 SAL_CALL getCount() override ;
113 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
114
115 // XComponent
116 virtual void SAL_CALL dispose( ) override;
117 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
118 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
119
120private:
121 void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily );
122 void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets );
123 void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, StyleSheetCopyResultVector& rCreatedSheets, std::u16string_view rRenameSuffix );
124
125 virtual rtl::Reference<SfxStyleSheetBase> Create(const OUString& rName, SfxStyleFamily eFamily, SfxStyleSearchBits nMask) override;
126
128 virtual ~SdStyleSheetPool() override;
129
130 void AddStyleFamily( const SdPage* pPage );
131 void RemoveStyleFamily( const SdPage* pPage );
132
138 css::uno::Reference< css::container::XNameAccess > mxTableFamily;
140};
141
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
SfxStyleSheetBase * mpActualStyleSheet
Definition: stlpool.hxx:133
css::uno::Reference< css::container::XNameAccess > mxTableFamily
Definition: stlpool.hxx:138
SdDrawDocument * mpDoc
Definition: stlpool.hxx:134
SfxStyleSheetBase * GetActualStyleSheet()
Definition: stlpool.hxx:56
SdStyleFamilyRef mxCellFamily
Definition: stlpool.hxx:136
SdStyleFamilyMap maStyleFamilyMap
Definition: stlpool.hxx:137
SdStyleFamilyRef mxGraphicFamily
Definition: stlpool.hxx:135
void SetActualStyleSheet(SfxStyleSheetBase *pActStyleSheet)
Definition: stlpool.hxx:55
SdDrawDocument * GetDoc() const
Definition: stlpool.hxx:87
OUString msTableFamilyName
Definition: stlpool.hxx:139
virtual rtl::Reference< SfxStyleSheetBase > Create(const OUString &, SfxStyleFamily, SfxStyleSearchBits mask) override
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
void dispose()
#define SD_DLLPUBLIC
Definition: sddllapi.h:27
std::map< const SdPage *, SdStyleFamilyRef > SdStyleFamilyMap
Definition: stlpool.hxx:39
::cppu::ImplInheritanceHelper< SfxStyleSheetPool, css::lang::XServiceInfo, css::container::XIndexAccess, css::container::XNameAccess, css::lang::XComponent > SdStyleSheetPoolBase
Definition: stlpool.hxx:47
std::vector< css::uno::Reference< css::style::XStyle > > XStyleVector
Definition: stlsheet.hxx:171
std::vector< rtl::Reference< SdStyleSheet > > SdStyleSheetVector
Definition: stlsheet.hxx:170
std::vector< StyleSheetCopyResult > StyleSheetCopyResultVector
Definition: stlsheet.hxx:184
SfxStyleFamily
SfxStyleSearchBits
unsigned char sal_Bool