Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/format.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
#ifndef INCLUDED_SW_INC_FORMAT_HXX
20
#define INCLUDED_SW_INC_FORMAT_HXX
21
22
#include "swdllapi.h"
23
24
#include "BorderCacheOwner.hxx"
25
#include "calbck.hxx"
26
#include "hintids.hxx"
27
#include "swatrset.hxx"
28
#include "names.hxx"
29
#include <memory>
30
31
class IDocumentSettingAccess;
32
class IDocumentDrawModelAccess;
33
class IDocumentLayoutAccess;
34
class IDocumentTimerAccess;
35
class IDocumentFieldsAccess;
36
class IDocumentChartDataProviderAccess;
37
class SwDoc;
38
class SfxGrabBagItem;
39
class SwTextGridItem;
40
enum class SwPoolFormatId : sal_uInt16;
41
42
namespace drawinglayer::attribute {
43
    class SdrAllFillAttributesHelper;
44
    typedef std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr;
45
}
46
47
/// Base class for various Writer styles.
48
class SW_DLLPUBLIC SwFormat : public sw::BorderCacheOwner, public sw::BroadcastingModify
49
{
50
    friend class SwFrameFormat;
51
52
    UIName m_aFormatName;
53
    SwAttrSet m_aSet;
54
55
    sal_uInt16 m_nWhichId;
56
    SwPoolFormatId m_nPoolFormatId;        /**< Id for "automatically" created formats.
57
                                       (is not hard attribution!!!) */
58
    sal_uInt32 m_nPoolHelpId;       ///< HelpId for this Pool-style.
59
    sal_uInt8 m_nPoolHlpFileId;     ///< FilePos to Doc to these style helps.
60
    bool   m_bAutoFormat : 1;      /**< FALSE: it is a template.
61
                                       default is true! */
62
    bool   m_bFormatInDTOR : 1;    /**< TRUE: Format becomes deleted. In order to be able
63
                                       to recognize this in FormatChg-message!! */
64
    bool   m_bAutoUpdateOnDirectFormat : 1;/**< TRUE: Set attributes of a whole paragraph
65
                                       at format (UI-side!). */
66
    bool m_bHidden : 1;
67
    bool m_bIsFavourite : 1;        ///< Show in the basic UI
68
    std::shared_ptr<SfxGrabBagItem> m_pGrabBagItem; ///< Style InteropGrabBag.
69
18.5M
    virtual void InvalidateInSwFntCache(sal_uInt16) {};
70
15.7M
    virtual void InvalidateInSwFntCache() {};
71
72
protected:
73
    SwFormat( SwAttrPool& rPool, const UIName& rFormatNm,
74
            const WhichRangesContainer& pWhichRanges, SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich );
75
    SwFormat( const SwFormat& rFormat );
76
    virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
77
    void Destr();
78
    void ParseFavourites();
79
80
public:
81
82
    virtual ~SwFormat() override;
83
    SwFormat &operator=(const SwFormat&);
84
85
    /// for Querying of Writer-functions.
86
213M
    sal_uInt16 Which() const { return m_nWhichId; };
87
88
    /// Copy attributes even among documents.
89
    void CopyAttrs( const SwFormat& );
90
91
    /// Delete all attributes that are not in rFormat.
92
    void DelDiffs( const SfxItemSet& rSet );
93
0
    void DelDiffs( const SwFormat& rFormat ) { DelDiffs( rFormat.GetAttrSet() ); }
94
95
    /// 0 is Default.
96
    bool SetDerivedFrom(SwFormat *pDerivedFrom = nullptr);
97
98
    /// If bInParents is FALSE, search only in this format for attribute.
99
    const SfxPoolItem& GetFormatAttr( sal_uInt16 nWhich,
100
                                   bool bInParents = true ) const;
101
    template<class T> const T& GetFormatAttr( TypedWhichId<T> nWhich, bool bInParents = true ) const
102
3.91M
    {
103
3.91M
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
3.91M
    }
Unexecuted instantiation: SfxInt16Item const& SwFormat::GetFormatAttr<SfxInt16Item>(TypedWhichId<SfxInt16Item>, bool) const
Unexecuted instantiation: SwFormatPageDesc const& SwFormat::GetFormatAttr<SwFormatPageDesc>(TypedWhichId<SwFormatPageDesc>, bool) const
SwFormatContent const& SwFormat::GetFormatAttr<SwFormatContent>(TypedWhichId<SwFormatContent>, bool) const
Line
Count
Source
102
31.2k
    {
103
31.2k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
31.2k
    }
SvxFirstLineIndentItem const& SwFormat::GetFormatAttr<SvxFirstLineIndentItem>(TypedWhichId<SvxFirstLineIndentItem>, bool) const
Line
Count
Source
102
127k
    {
103
127k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
127k
    }
SvxTextLeftMarginItem const& SwFormat::GetFormatAttr<SvxTextLeftMarginItem>(TypedWhichId<SvxTextLeftMarginItem>, bool) const
Line
Count
Source
102
127k
    {
103
127k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
127k
    }
SfxUInt16Item const& SwFormat::GetFormatAttr<SfxUInt16Item>(TypedWhichId<SfxUInt16Item>, bool) const
Line
Count
Source
102
2.26M
    {
103
2.26M
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
2.26M
    }
Unexecuted instantiation: SwFormatFrameSize const& SwFormat::GetFormatAttr<SwFormatFrameSize>(TypedWhichId<SwFormatFrameSize>, bool) const
Unexecuted instantiation: SwTableBoxNumFormat const& SwFormat::GetFormatAttr<SwTableBoxNumFormat>(TypedWhichId<SwTableBoxNumFormat>, bool) const
SvxFrameDirectionItem const& SwFormat::GetFormatAttr<SvxFrameDirectionItem>(TypedWhichId<SvxFrameDirectionItem>, bool) const
Line
Count
Source
102
129k
    {
103
129k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
129k
    }
Unexecuted instantiation: SvxCharHiddenItem const& SwFormat::GetFormatAttr<SvxCharHiddenItem>(TypedWhichId<SvxCharHiddenItem>, bool) const
Unexecuted instantiation: SvxMacroItem const& SwFormat::GetFormatAttr<SvxMacroItem>(TypedWhichId<SvxMacroItem>, bool) const
Unexecuted instantiation: SwNumRuleItem const& SwFormat::GetFormatAttr<SwNumRuleItem>(TypedWhichId<SwNumRuleItem>, bool) const
SvxFontHeightItem const& SwFormat::GetFormatAttr<SvxFontHeightItem>(TypedWhichId<SvxFontHeightItem>, bool) const
Line
Count
Source
102
926k
    {
103
926k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
926k
    }
Unexecuted instantiation: SwFormatFollowTextFlow const& SwFormat::GetFormatAttr<SwFormatFollowTextFlow>(TypedWhichId<SwFormatFollowTextFlow>, bool) const
Unexecuted instantiation: SwFormatVertOrient const& SwFormat::GetFormatAttr<SwFormatVertOrient>(TypedWhichId<SwFormatVertOrient>, bool) const
Unexecuted instantiation: SwFormatHoriOrient const& SwFormat::GetFormatAttr<SwFormatHoriOrient>(TypedWhichId<SwFormatHoriOrient>, bool) const
Unexecuted instantiation: SvxBrushItem const& SwFormat::GetFormatAttr<SvxBrushItem>(TypedWhichId<SvxBrushItem>, bool) const
SvxBoxItem const& SwFormat::GetFormatAttr<SvxBoxItem>(TypedWhichId<SvxBoxItem>, bool) const
Line
Count
Source
102
51.7k
    {
103
51.7k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
51.7k
    }
Unexecuted instantiation: SwFormatHeader const& SwFormat::GetFormatAttr<SwFormatHeader>(TypedWhichId<SwFormatHeader>, bool) const
Unexecuted instantiation: SwFormatFooter const& SwFormat::GetFormatAttr<SwFormatFooter>(TypedWhichId<SwFormatFooter>, bool) const
SwTextGridItem const& SwFormat::GetFormatAttr<SwTextGridItem>(TypedWhichId<SwTextGridItem>, bool) const
Line
Count
Source
102
76.8k
    {
103
76.8k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
76.8k
    }
Unexecuted instantiation: SvxLanguageItem const& SwFormat::GetFormatAttr<SvxLanguageItem>(TypedWhichId<SvxLanguageItem>, bool) const
Unexecuted instantiation: SwHeaderAndFooterEatSpacingItem const& SwFormat::GetFormatAttr<SwHeaderAndFooterEatSpacingItem>(TypedWhichId<SwHeaderAndFooterEatSpacingItem>, bool) const
Unexecuted instantiation: SvxFontItem const& SwFormat::GetFormatAttr<SvxFontItem>(TypedWhichId<SvxFontItem>, bool) const
Unexecuted instantiation: SwFormatCol const& SwFormat::GetFormatAttr<SwFormatCol>(TypedWhichId<SwFormatCol>, bool) const
SvxLRSpaceItem const& SwFormat::GetFormatAttr<SvxLRSpaceItem>(TypedWhichId<SvxLRSpaceItem>, bool) const
Line
Count
Source
102
19.3k
    {
103
19.3k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
19.3k
    }
SvxTabStopItem const& SwFormat::GetFormatAttr<SvxTabStopItem>(TypedWhichId<SvxTabStopItem>, bool) const
Line
Count
Source
102
3.19k
    {
103
3.19k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
3.19k
    }
SvxRightMarginItem const& SwFormat::GetFormatAttr<SvxRightMarginItem>(TypedWhichId<SvxRightMarginItem>, bool) const
Line
Count
Source
102
127k
    {
103
127k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
127k
    }
SvxULSpaceItem const& SwFormat::GetFormatAttr<SvxULSpaceItem>(TypedWhichId<SvxULSpaceItem>, bool) const
Line
Count
Source
102
19.3k
    {
103
19.3k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
19.3k
    }
SfxGrabBagItem const& SwFormat::GetFormatAttr<SfxGrabBagItem>(TypedWhichId<SfxGrabBagItem>, bool) const
Line
Count
Source
102
7.20k
    {
103
7.20k
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
7.20k
    }
SvxFormatBreakItem const& SwFormat::GetFormatAttr<SvxFormatBreakItem>(TypedWhichId<SvxFormatBreakItem>, bool) const
Line
Count
Source
102
44
    {
103
44
        return static_cast<const T&>(GetFormatAttr(sal_uInt16(nWhich), bInParents));
104
44
    }
105
106
    SfxItemState GetItemState( sal_uInt16 nWhich, bool bSrchInParent = true,
107
                                    const SfxPoolItem **ppItem = nullptr ) const;
108
    template<class T>
109
    SfxItemState GetItemState( TypedWhichId<T> nWhich, bool bSrchInParent = true,
110
                                    const T **ppItem = nullptr ) const
111
1.28M
    { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<const SfxPoolItem **>(ppItem)); }
SfxItemState SwFormat::GetItemState<SwNumRuleItem>(TypedWhichId<SwNumRuleItem>, bool, SwNumRuleItem const**) const
Line
Count
Source
111
8.05k
    { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<const SfxPoolItem **>(ppItem)); }
SfxItemState SwFormat::GetItemState<SwFormatAnchor>(TypedWhichId<SwFormatAnchor>, bool, SwFormatAnchor const**) const
Line
Count
Source
111
52.6k
    { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<const SfxPoolItem **>(ppItem)); }
Unexecuted instantiation: SfxItemState SwFormat::GetItemState<SwFormatPageDesc>(TypedWhichId<SwFormatPageDesc>, bool, SwFormatPageDesc const**) const
Unexecuted instantiation: SfxItemState SwFormat::GetItemState<SvxFormatBreakItem>(TypedWhichId<SvxFormatBreakItem>, bool, SvxFormatBreakItem const**) const
SfxItemState SwFormat::GetItemState<SwTableBoxNumFormat>(TypedWhichId<SwTableBoxNumFormat>, bool, SwTableBoxNumFormat const**) const
Line
Count
Source
111
56.3k
    { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<const SfxPoolItem **>(ppItem)); }
SfxItemState SwFormat::GetItemState<SfxUInt16Item>(TypedWhichId<SfxUInt16Item>, bool, SfxUInt16Item const**) const
Line
Count
Source
111
8.05k
    { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<const SfxPoolItem **>(ppItem)); }
SfxItemState SwFormat::GetItemState<SwTableBoxValue>(TypedWhichId<SwTableBoxValue>, bool, SwTableBoxValue const**) const
Line
Count
Source
111
548k
    { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<const SfxPoolItem **>(ppItem)); }
Unexecuted instantiation: SfxItemState SwFormat::GetItemState<SvxBrushItem>(TypedWhichId<SvxBrushItem>, bool, SvxBrushItem const**) const
SfxItemState SwFormat::GetItemState<SwTableBoxFormula>(TypedWhichId<SwTableBoxFormula>, bool, SwTableBoxFormula const**) const
Line
Count
Source
111
459k
    { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<const SfxPoolItem **>(ppItem)); }
SfxItemState SwFormat::GetItemState<SvxCharHiddenItem>(TypedWhichId<SvxCharHiddenItem>, bool, SvxCharHiddenItem const**) const
Line
Count
Source
111
148k
    { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<const SfxPoolItem **>(ppItem)); }
Unexecuted instantiation: SfxItemState SwFormat::GetItemState<SwFormatFootnoteAtTextEnd>(TypedWhichId<SwFormatFootnoteAtTextEnd>, bool, SwFormatFootnoteAtTextEnd const**) const
Unexecuted instantiation: SfxItemState SwFormat::GetItemState<SwFormatEndAtTextEnd>(TypedWhichId<SwFormatEndAtTextEnd>, bool, SwFormatEndAtTextEnd const**) const
Unexecuted instantiation: SfxItemState SwFormat::GetItemState<SvxFirstLineIndentItem>(TypedWhichId<SvxFirstLineIndentItem>, bool, SvxFirstLineIndentItem const**) const
Unexecuted instantiation: SfxItemState SwFormat::GetItemState<SvxTextLeftMarginItem>(TypedWhichId<SvxTextLeftMarginItem>, bool, SvxTextLeftMarginItem const**) const
SfxItemState SwFormat::GetItemState<SvxHyphenZoneItem>(TypedWhichId<SvxHyphenZoneItem>, bool, SvxHyphenZoneItem const**) const
Line
Count
Source
111
1.18k
    { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<const SfxPoolItem **>(ppItem)); }
SfxItemState SwFormat::GetItemState<SvxUnderlineItem>(TypedWhichId<SvxUnderlineItem>, bool, SvxUnderlineItem const**) const
Line
Count
Source
111
14
    { return GetItemState(sal_uInt16(nWhich), bSrchInParent, reinterpret_cast<const SfxPoolItem **>(ppItem)); }
112
113
    /// Templatized version of GetItemState() to directly return the correct type.
114
    template<class T>
115
    const T *                   GetItemIfSet(   TypedWhichId<T> nWhich,
116
                                                bool bSrchInParent = true ) const
117
15.7M
    {
118
15.7M
        const SfxPoolItem * pItem = nullptr;
119
15.7M
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
868k
            return static_cast<const T*>(pItem);
121
14.8M
        return nullptr;
122
15.7M
    }
SwNumRuleItem const* SwFormat::GetItemIfSet<SwNumRuleItem>(TypedWhichId<SwNumRuleItem>, bool) const
Line
Count
Source
117
123k
    {
118
123k
        const SfxPoolItem * pItem = nullptr;
119
123k
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
83.5k
            return static_cast<const T*>(pItem);
121
40.3k
        return nullptr;
122
123k
    }
SwFormatAnchor const* SwFormat::GetItemIfSet<SwFormatAnchor>(TypedWhichId<SwFormatAnchor>, bool) const
Line
Count
Source
117
352k
    {
118
352k
        const SfxPoolItem * pItem = nullptr;
119
352k
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
352k
            return static_cast<const T*>(pItem);
121
0
        return nullptr;
122
352k
    }
SvxFirstLineIndentItem const* SwFormat::GetItemIfSet<SvxFirstLineIndentItem>(TypedWhichId<SvxFirstLineIndentItem>, bool) const
Line
Count
Source
117
4.98M
    {
118
4.98M
        const SfxPoolItem * pItem = nullptr;
119
4.98M
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
104k
            return static_cast<const T*>(pItem);
121
4.87M
        return nullptr;
122
4.98M
    }
SvxTextLeftMarginItem const* SwFormat::GetItemIfSet<SvxTextLeftMarginItem>(TypedWhichId<SvxTextLeftMarginItem>, bool) const
Line
Count
Source
117
4.98M
    {
118
4.98M
        const SfxPoolItem * pItem = nullptr;
119
4.98M
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
103k
            return static_cast<const T*>(pItem);
121
4.87M
        return nullptr;
122
4.98M
    }
SvxRightMarginItem const* SwFormat::GetItemIfSet<SvxRightMarginItem>(TypedWhichId<SvxRightMarginItem>, bool) const
Line
Count
Source
117
4.98M
    {
118
4.98M
        const SfxPoolItem * pItem = nullptr;
119
4.98M
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
100k
            return static_cast<const T*>(pItem);
121
4.88M
        return nullptr;
122
4.98M
    }
SvxULSpaceItem const* SwFormat::GetItemIfSet<SvxULSpaceItem>(TypedWhichId<SvxULSpaceItem>, bool) const
Line
Count
Source
117
247k
    {
118
247k
        const SfxPoolItem * pItem = nullptr;
119
247k
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
118k
            return static_cast<const T*>(pItem);
121
128k
        return nullptr;
122
247k
    }
SwTableBoxFormula const* SwFormat::GetItemIfSet<SwTableBoxFormula>(TypedWhichId<SwTableBoxFormula>, bool) const
Line
Count
Source
117
18.5k
    {
118
18.5k
        const SfxPoolItem * pItem = nullptr;
119
18.5k
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
0
            return static_cast<const T*>(pItem);
121
18.5k
        return nullptr;
122
18.5k
    }
SwTableBoxNumFormat const* SwFormat::GetItemIfSet<SwTableBoxNumFormat>(TypedWhichId<SwTableBoxNumFormat>, bool) const
Line
Count
Source
117
10.9k
    {
118
10.9k
        const SfxPoolItem * pItem = nullptr;
119
10.9k
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
5.31k
            return static_cast<const T*>(pItem);
121
5.64k
        return nullptr;
122
10.9k
    }
SwFormatFootnoteAtTextEnd const* SwFormat::GetItemIfSet<SwFormatFootnoteAtTextEnd>(TypedWhichId<SwFormatFootnoteAtTextEnd>, bool) const
Line
Count
Source
117
1.70k
    {
118
1.70k
        const SfxPoolItem * pItem = nullptr;
119
1.70k
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
0
            return static_cast<const T*>(pItem);
121
1.70k
        return nullptr;
122
1.70k
    }
SwFormatEndAtTextEnd const* SwFormat::GetItemIfSet<SwFormatEndAtTextEnd>(TypedWhichId<SwFormatEndAtTextEnd>, bool) const
Line
Count
Source
117
1.70k
    {
118
1.70k
        const SfxPoolItem * pItem = nullptr;
119
1.70k
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
79
            return static_cast<const T*>(pItem);
121
1.62k
        return nullptr;
122
1.70k
    }
SvxFormatBreakItem const* SwFormat::GetItemIfSet<SvxFormatBreakItem>(TypedWhichId<SvxFormatBreakItem>, bool) const
Line
Count
Source
117
25
    {
118
25
        const SfxPoolItem * pItem = nullptr;
119
25
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
0
            return static_cast<const T*>(pItem);
121
25
        return nullptr;
122
25
    }
SwFormatPageDesc const* SwFormat::GetItemIfSet<SwFormatPageDesc>(TypedWhichId<SwFormatPageDesc>, bool) const
Line
Count
Source
117
25
    {
118
25
        const SfxPoolItem * pItem = nullptr;
119
25
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
0
            return static_cast<const T*>(pItem);
121
25
        return nullptr;
122
25
    }
SwTableBoxValue const* SwFormat::GetItemIfSet<SwTableBoxValue>(TypedWhichId<SwTableBoxValue>, bool) const
Line
Count
Source
117
16.8k
    {
118
16.8k
        const SfxPoolItem * pItem = nullptr;
119
16.8k
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
35
            return static_cast<const T*>(pItem);
121
16.8k
        return nullptr;
122
16.8k
    }
Unexecuted instantiation: SvxBoxItem const* SwFormat::GetItemIfSet<SvxBoxItem>(TypedWhichId<SvxBoxItem>, bool) const
SvxFrameDirectionItem const* SwFormat::GetItemIfSet<SvxFrameDirectionItem>(TypedWhichId<SvxFrameDirectionItem>, bool) const
Line
Count
Source
117
9.75k
    {
118
9.75k
        const SfxPoolItem * pItem = nullptr;
119
9.75k
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
26
            return static_cast<const T*>(pItem);
121
9.72k
        return nullptr;
122
9.75k
    }
Unexecuted instantiation: SwFormatFrameSize const* SwFormat::GetItemIfSet<SwFormatFrameSize>(TypedWhichId<SwFormatFrameSize>, bool) const
Unexecuted instantiation: SwFormatVertOrient const* SwFormat::GetItemIfSet<SwFormatVertOrient>(TypedWhichId<SwFormatVertOrient>, bool) const
SvxColorItem const* SwFormat::GetItemIfSet<SvxColorItem>(TypedWhichId<SvxColorItem>, bool) const
Line
Count
Source
117
22
    {
118
22
        const SfxPoolItem * pItem = nullptr;
119
22
        if( SfxItemState::SET == GetItemState(sal_uInt16(nWhich), bSrchInParent, &pItem) )
120
22
            return static_cast<const T*>(pItem);
121
0
        return nullptr;
122
22
    }
Unexecuted instantiation: SwFormatChain const* SwFormat::GetItemIfSet<SwFormatChain>(TypedWhichId<SwFormatChain>, bool) const
Unexecuted instantiation: SvxProtectItem const* SwFormat::GetItemIfSet<SvxProtectItem>(TypedWhichId<SvxProtectItem>, bool) const
Unexecuted instantiation: SfxBoolItem const* SwFormat::GetItemIfSet<SfxBoolItem>(TypedWhichId<SfxBoolItem>, bool) const
Unexecuted instantiation: SvxWeightItem const* SwFormat::GetItemIfSet<SvxWeightItem>(TypedWhichId<SvxWeightItem>, bool) const
Unexecuted instantiation: SvxPostureItem const* SwFormat::GetItemIfSet<SvxPostureItem>(TypedWhichId<SvxPostureItem>, bool) const
Unexecuted instantiation: SvxShadowedItem const* SwFormat::GetItemIfSet<SvxShadowedItem>(TypedWhichId<SvxShadowedItem>, bool) const
Unexecuted instantiation: SvxFontHeightItem const* SwFormat::GetItemIfSet<SvxFontHeightItem>(TypedWhichId<SvxFontHeightItem>, bool) const
Unexecuted instantiation: SvxFontItem const* SwFormat::GetItemIfSet<SvxFontItem>(TypedWhichId<SvxFontItem>, bool) const
Unexecuted instantiation: SvxEmphasisMarkItem const* SwFormat::GetItemIfSet<SvxEmphasisMarkItem>(TypedWhichId<SvxEmphasisMarkItem>, bool) const
Unexecuted instantiation: SvxUnderlineItem const* SwFormat::GetItemIfSet<SvxUnderlineItem>(TypedWhichId<SvxUnderlineItem>, bool) const
Unexecuted instantiation: SvxOverlineItem const* SwFormat::GetItemIfSet<SvxOverlineItem>(TypedWhichId<SvxOverlineItem>, bool) const
Unexecuted instantiation: SvxCrossedOutItem const* SwFormat::GetItemIfSet<SvxCrossedOutItem>(TypedWhichId<SvxCrossedOutItem>, bool) const
Unexecuted instantiation: SvxCharReliefItem const* SwFormat::GetItemIfSet<SvxCharReliefItem>(TypedWhichId<SvxCharReliefItem>, bool) const
Unexecuted instantiation: SvxContourItem const* SwFormat::GetItemIfSet<SvxContourItem>(TypedWhichId<SvxContourItem>, bool) const
Unexecuted instantiation: SvxNoHyphenItem const* SwFormat::GetItemIfSet<SvxNoHyphenItem>(TypedWhichId<SvxNoHyphenItem>, bool) const
Unexecuted instantiation: SwFormatURL const* SwFormat::GetItemIfSet<SwFormatURL>(TypedWhichId<SwFormatURL>, bool) const
Unexecuted instantiation: SvxLRSpaceItem const* SwFormat::GetItemIfSet<SvxLRSpaceItem>(TypedWhichId<SvxLRSpaceItem>, bool) const
Unexecuted instantiation: SvxBrushItem const* SwFormat::GetItemIfSet<SvxBrushItem>(TypedWhichId<SvxBrushItem>, bool) const
Unexecuted instantiation: SwFormatHeader const* SwFormat::GetItemIfSet<SwFormatHeader>(TypedWhichId<SwFormatHeader>, bool) const
Unexecuted instantiation: SwFormatFooter const* SwFormat::GetItemIfSet<SwFormatFooter>(TypedWhichId<SwFormatFooter>, bool) const
Unexecuted instantiation: SvxHyphenZoneItem const* SwFormat::GetItemIfSet<SvxHyphenZoneItem>(TypedWhichId<SvxHyphenZoneItem>, bool) const
123
    SfxItemState GetBackgroundState(std::unique_ptr<SvxBrushItem>& rItem) const;
124
    virtual bool SetFormatAttr( const SfxPoolItem& rAttr );
125
    virtual bool SetFormatAttr( const SfxItemSet& rSet );
126
    virtual bool ResetFormatAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 );
127
128
    /** Takes all hints from Delta-Array,
129
        @return count of deleted hints. */
130
    virtual sal_uInt16 ResetAllFormatAttr();
131
132
20.6M
    SwFormat* DerivedFrom() const { return const_cast<SwFormat*>(static_cast<const SwFormat*>(GetRegisteredIn())); }
133
9.32M
    bool IsDefault() const { return DerivedFrom() == nullptr; }
134
135
199M
    const UIName& GetName() const                  { return m_aFormatName; }
136
54.2M
    bool HasName(std::u16string_view rName) const { return m_aFormatName == rName; }
137
    virtual void SetFormatName( const UIName& rNewName, bool bBroadcast=false );
138
139
    /// For querying the attribute array.
140
82.6M
    const SwAttrSet& GetAttrSet() const { return m_aSet; }
141
142
    /** The document is set in SwAttrPool now, therefore you always can access it. */
143
3.15M
    const SwDoc &GetDoc() const         { return m_aSet.GetDoc(); }
144
22.8M
          SwDoc &GetDoc()               { return m_aSet.GetDoc(); }
145
146
    /// Provides access to the document settings interface.
147
    const IDocumentSettingAccess& getIDocumentSettingAccess() const;
148
149
    /// Provides access to the document draw model interface.
150
    const IDocumentDrawModelAccess& getIDocumentDrawModelAccess() const;
151
          IDocumentDrawModelAccess& getIDocumentDrawModelAccess();
152
153
    /// Provides access to the document layout interface.
154
    const IDocumentLayoutAccess& getIDocumentLayoutAccess() const;
155
          IDocumentLayoutAccess& getIDocumentLayoutAccess();
156
157
     /// Provides access to the document idle timer interface.
158
     IDocumentTimerAccess& getIDocumentTimerAccess();
159
160
     /// Provides access to the document idle timer interface.
161
    IDocumentFieldsAccess& getIDocumentFieldsAccess();
162
163
     /// Gives access to the chart data-provider.
164
    IDocumentChartDataProviderAccess& getIDocumentChartDataProviderAccess();
165
166
    /// Get and set Pool style IDs.
167
98.1M
    SwPoolFormatId GetPoolFormatId() const { return m_nPoolFormatId; }
168
2.48M
    void SetPoolFormatId( SwPoolFormatId nId ) { m_nPoolFormatId = nId; }
169
170
    /// Get and set Help-IDs for document templates.
171
4.89M
    sal_uInt32 GetPoolHelpId() const { return m_nPoolHelpId; }
172
1.59M
    void SetPoolHelpId( sal_uInt32 nId ) { m_nPoolHelpId = nId; }
173
4.79M
    sal_uInt8 GetPoolHlpFileId() const { return m_nPoolHlpFileId; }
174
1.59M
    void SetPoolHlpFileId( sal_uInt8 nId ) { m_nPoolHlpFileId = nId; }
175
176
    /// Get attribute-description. Returns passed string.
177
    void GetPresentation( SfxItemPresentation ePres,
178
        MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText ) const
179
0
        { m_aSet.GetPresentation( ePres, eCoreMetric, ePresMetric, rText ); }
180
181
    /// Query / set AutoFormat-flag.
182
22.0k
    bool IsAuto() const                 { return m_bAutoFormat; }
183
1.47M
    void SetAuto( bool bNew )           { m_bAutoFormat = bNew; }
184
185
332
    bool IsFavourite() const            { return m_bIsFavourite; }
186
11.9k
    void SetFavourite(bool bValue)      { m_bIsFavourite = bValue; }
187
188
332
    bool IsHidden() const               { return m_bHidden; }
189
21.1k
    void SetHidden( bool bValue )       { m_bHidden = bValue; }
190
191
    void GetGrabBagItem(css::uno::Any& rVal) const;
192
    void SetGrabBagItem(const css::uno::Any& rVal);
193
194
    /// Query / set m_bAutoUpdateOnDirectFormat-flag.
195
688k
    bool IsAutoUpdateOnDirectFormat() const                { return m_bAutoUpdateOnDirectFormat; }
196
204k
    void SetAutoUpdateOnDirectFormat( bool bNew = true )   { m_bAutoUpdateOnDirectFormat = bNew; }
197
198
1.71k
    bool IsFormatInDTOR() const { return m_bFormatInDTOR; }
199
200
    /** GetMethods: Bool indicates whether to search only in Set (FALSE)
201
     or also in Parents.
202
     If nothing is found the defaulted attribute is returned. */
203
204
    /// Character-attributes - implemented in charatr.hxx
205
    inline const SvxUnderlineItem    &GetUnderline( bool = true ) const;
206
    inline const SvxFontHeightItem   &GetSize( bool = true ) const;
207
    inline const SvxFontItem         &GetFont( bool = true ) const;
208
    inline const SvxColorItem        &GetColor( bool = true ) const;
209
    inline const SvxFontItem         &GetCJKFont( bool = true ) const;
210
    inline const SvxFontItem         &GetCTLFont( bool = true ) const;
211
212
    /// Frame-attributes - implemented in frmatr.hxx.
213
    inline const SwFormatFillOrder           &GetFillOrder( bool = true ) const;
214
    inline const SwFormatFrameSize             &GetFrameSize( bool = true ) const;
215
    inline const SwFormatHeader          &GetHeader( bool = true ) const;
216
    inline const SwFormatFooter          &GetFooter( bool = true ) const;
217
    inline const SwFormatSurround            &GetSurround( bool = true ) const;
218
    inline const SwFormatHoriOrient      &GetHoriOrient( bool = true ) const;
219
    inline const SwFormatAnchor          &GetAnchor( bool = true ) const;
220
    inline const SwFormatCol                 &GetCol( bool = true ) const;
221
    inline const SvxPaperBinItem      &GetPaperBin( bool = true ) const;
222
    inline const SvxLeftMarginItem &    GetLeftMargin(bool = true) const;
223
    inline const SvxTextLeftMarginItem &GetTextLeftMargin(bool = true) const;
224
    inline const SvxFirstLineIndentItem &GetFirstLineIndent(bool = true) const;
225
    inline const SvxRightMarginItem &   GetRightMargin(bool = true) const;
226
    inline const SvxGutterLeftMarginItem &GetGutterLeftMargin(bool = true) const;
227
    inline const SvxGutterRightMarginItem &GetGutterRightMargin(bool = true) const;
228
    inline const SvxLRSpaceItem           &GetLRSpace( bool = true ) const;
229
    inline const SvxULSpaceItem           &GetULSpace( bool = true ) const;
230
    inline const SwFormatContent           &GetContent( bool = true ) const;
231
    inline const SvxPrintItem             &GetPrint( bool = true ) const;
232
    inline const SvxOpaqueItem            &GetOpaque( bool = true ) const;
233
    inline const SvxProtectItem           &GetProtect( bool = true ) const;
234
    inline const SwFormatVertOrient      &GetVertOrient( bool = true ) const;
235
    inline const SvxBoxItem               &GetBox( bool = true ) const;
236
    inline const SvxFormatKeepItem         &GetKeep( bool = true ) const;
237
238
    // Create SvxBrushItem for Background fill (partially for backwards compatibility)
239
    std::unique_ptr<SvxBrushItem> makeBackgroundBrushItem( bool = true ) const;
240
241
    inline const SvxShadowItem            &GetShadow( bool = true ) const;
242
    inline const SwFormatPageDesc            &GetPageDesc( bool = true ) const;
243
    inline const SvxFormatBreakItem      &GetBreak( bool = true ) const;
244
    inline const SvxMacroItem             &GetMacro( bool = true ) const;
245
    inline const SwFormatURL             &GetURL( bool = true ) const;
246
    inline const SwFormatEditInReadonly  &GetEditInReadonly( bool = true ) const;
247
    inline const SwFormatLayoutSplit     &GetLayoutSplit( bool = true ) const;
248
    inline const SwFormatRowSplit          &GetRowSplit( bool = true ) const;
249
    inline const SwFormatFlySplit          &GetFlySplit( bool = true ) const;
250
    inline const SwFormatWrapTextAtFlyStart &GetWrapTextAtFlyStart( bool = true ) const;
251
    inline const SwFormatChain               &GetChain( bool = true ) const;
252
    inline const SwFormatFootnoteAtTextEnd     &GetFootnoteAtTextEnd( bool = true ) const;
253
    inline const SwFormatEndAtTextEnd     &GetEndAtTextEnd( bool = true ) const;
254
    inline const SwFormatNoBalancedColumns &GetBalancedColumns( bool = true ) const;
255
    inline const SvxFrameDirectionItem    &GetFrameDir( bool = true ) const;
256
    inline const SwTextGridItem         &GetTextGrid( bool = true ) const;
257
    inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( bool = true ) const;
258
    // #i18732#
259
    inline const SwFormatFollowTextFlow    &GetFollowTextFlow(bool = true) const;
260
    // #i28701#
261
    inline const SwFormatWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(bool = true) const;
262
    inline const SdrTextVertAdjustItem& GetTextVertAdjust(bool = true) const;
263
264
    /// Paragraph-attributes - implemented in paratr.hxx.
265
    inline const SvxLineSpacingItem       &GetLineSpacing( bool = true ) const;
266
    inline const SwNumRuleItem            &GetNumRule( bool = true ) const;
267
    inline const SvxTabStopItem           &GetTabStops( bool = true ) const;
268
    inline const SwFormatDrop                &GetDrop( bool = true ) const;
269
270
    /// TableBox attributes - implemented in cellatr.hxx.
271
    inline  const SwTableBoxNumFormat     &GetTableBoxNumFormat( bool = true ) const;
272
    inline  const SwTableBoxFormula       &GetTableBoxFormula( bool = true ) const;
273
    inline  const SwTableBoxValue         &GetTableBoxValue( bool = true ) const;
274
275
    void SetPageFormatToDefault();
276
277
    /** SwFormat::IsBackgroundTransparent
278
279
        Virtual method to determine, if background of format is transparent.
280
        Default implementation returns false. Thus, subclasses have to override
281
        method, if the specific subclass can have a transparent background.
282
283
        @return false, default implementation
284
    */
285
    virtual bool IsBackgroundTransparent() const;
286
287
    // Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage
288
    virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const;
289
    virtual bool supportsFullDrawingLayerFillAttributeSet() const;
290
    void RemoveAllUnos();
291
    bool IsUsed() const;
292
    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
293
294
};
295
296
#endif // INCLUDED_SW_INC_FORMAT_HXX
297
298
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */