Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sd/inc/stlpool.hxx
Line
Count
Source
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
26
#include <cppuhelper/implbase.hxx>
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
37
class SdDrawDocument;
38
class SdPage;
39
class SvxNumberFormat;
40
41
typedef std::map< const SdPage*, SdStyleFamilyRef > SdStyleFamilyMap;
42
43
typedef ::cppu::ImplInheritanceHelper< SfxStyleSheetPool,
44
                                        css::lang::XServiceInfo,
45
                                        css::container::XIndexAccess,
46
                                        css::container::XNameAccess,
47
                                        css::lang::XComponent > SdStyleSheetPoolBase;
48
49
class SAL_DLLPUBLIC_RTTI SdStyleSheetPool final : public SdStyleSheetPoolBase, public SfxListener
50
{
51
    friend class SdDrawDocument;
52
public:
53
                        SdStyleSheetPool(SfxItemPool const& rPool, SdDrawDocument* pDocument);
54
55
0
    void                SetActualStyleSheet(SfxStyleSheetBase* pActStyleSheet)  { mpActualStyleSheet = pActStyleSheet; }
56
0
    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
63
    /** creates all layout style sheets for the given layout name if they
64
        don't exist yet.
65
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.
70
    */
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
0
    SdDrawDocument*     GetDoc() const { return mpDoc; }
88
89
    static  SdStyleSheetVector CreateChildList( SdStyleSheet const * pSheet );
90
91
    static void setDefaultOutlineNumberFormatBulletAndIndent(sal_uInt16 i, SvxNumberFormat &rNumberFormat);
92
93
public:
94
    /// @throws css::uno::RuntimeException
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
120
private:
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,
126
                      SfxStyleSearchBits nMask, const OUString& rParentStyleSheetName) override;
127
128
    using  SfxStyleSheetPool::Create;
129
    virtual ~SdStyleSheetPool() override;
130
131
    void AddStyleFamily( const SdPage* pPage );
132
    void RemoveStyleFamily( const SdPage* pPage );
133
134
    SfxStyleSheetBase*      mpActualStyleSheet;
135
    SdDrawDocument*         mpDoc;
136
    SdStyleFamilyRef        mxGraphicFamily;
137
    SdStyleFamilyRef        mxCellFamily;
138
    SdStyleFamilyMap        maStyleFamilyMap;
139
    css::uno::Reference< css::container::XNameAccess > mxTableFamily;
140
    OUString                msTableFamilyName;
141
};
142
143
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */