/src/libreoffice/sw/inc/fmtftntx.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_FMTFTNTX_HXX |
20 | | #define INCLUDED_SW_INC_FMTFTNTX_HXX |
21 | | |
22 | | #include <svl/eitem.hxx> |
23 | | #include <editeng/numitem.hxx> |
24 | | #include "hintids.hxx" |
25 | | #include "format.hxx" |
26 | | #include "swdllapi.h" |
27 | | |
28 | | enum SwFootnoteEndPosEnum |
29 | | { |
30 | | FTNEND_ATPGORDOCEND, ///< at page or document end |
31 | | FTNEND_ATTXTEND, ///< at end of the current text end |
32 | | FTNEND_ATTXTEND_OWNNUMSEQ, ///< -""- and with own number sequence |
33 | | FTNEND_ATTXTEND_OWNNUMANDFMT, ///< -""- and with own numberformat |
34 | | FTNEND_ATTXTEND_END |
35 | | }; |
36 | | |
37 | | /** |
38 | | * SfxPoolItem subclass that is a wrapper around an SwFootnoteEndPosEnum, i.e. to decide where |
39 | | * footnotes or endnotes should be collected. Available on the UI as Format -> Sections -> <Name> -> |
40 | | * Options -> Footnotes/Endnotes. This is the shared base class for both footnotes and endnotes. |
41 | | */ |
42 | | class SW_DLLPUBLIC SwFormatFootnoteEndAtTextEnd : public SfxEnumItem<SwFootnoteEndPosEnum> |
43 | | { |
44 | | OUString m_sPrefix; |
45 | | OUString m_sSuffix; |
46 | | SvxNumberType m_aFormat; |
47 | | sal_uInt16 m_nOffset; |
48 | | |
49 | | protected: |
50 | | SwFormatFootnoteEndAtTextEnd( sal_uInt16 nWhichL, SwFootnoteEndPosEnum ePos ) |
51 | 6.89k | : SfxEnumItem( nWhichL, ePos ), m_nOffset( 0 ) |
52 | 6.89k | {} |
53 | | |
54 | | virtual SfxItemType ItemType() const override = 0; |
55 | | |
56 | | public: |
57 | | virtual bool operator==( const SfxPoolItem& ) const override; |
58 | | |
59 | | virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; |
60 | | virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; |
61 | | |
62 | | virtual bool GetPresentation( SfxItemPresentation ePres, |
63 | | MapUnit eCoreMetric, |
64 | | MapUnit ePresMetric, |
65 | | OUString &rText, |
66 | | const IntlWrapper& rIntl ) const override; |
67 | | |
68 | 353 | bool IsAtEnd() const { return FTNEND_ATPGORDOCEND != GetValue(); } |
69 | | |
70 | | SwFormatFootnoteEndAtTextEnd & operator=( const SwFormatFootnoteEndAtTextEnd & rAttr ); |
71 | 6.87k | SwFormatFootnoteEndAtTextEnd(SwFormatFootnoteEndAtTextEnd const &) = default; |
72 | | // SfxPoolItem copy function dichotomy |
73 | | |
74 | 0 | SvxNumType GetNumType() const { return m_aFormat.GetNumberingType(); } |
75 | 5.27k | void SetNumType( SvxNumType eType ) { m_aFormat.SetNumberingType(eType); } |
76 | | |
77 | 0 | const SvxNumberType& GetSwNumType() const { return m_aFormat; } |
78 | | |
79 | 0 | sal_uInt16 GetOffset() const { return m_nOffset; } |
80 | 0 | void SetOffset( sal_uInt16 nOff ) { m_nOffset = nOff; } |
81 | | |
82 | 0 | const OUString& GetPrefix() const { return m_sPrefix; } |
83 | 0 | void SetPrefix(const OUString& rSet) { m_sPrefix = rSet; } |
84 | | |
85 | 0 | const OUString& GetSuffix() const { return m_sSuffix; } |
86 | 0 | void SetSuffix(const OUString& rSet) { m_sSuffix = rSet; } |
87 | | }; |
88 | | |
89 | | /// SwFormatFootnoteEndAtTextEnd subclass, specific to footnotes, placed in the item set of an |
90 | | /// SwSectionFormat. |
91 | | class SW_DLLPUBLIC SwFormatFootnoteAtTextEnd final : public SwFormatFootnoteEndAtTextEnd |
92 | | { |
93 | | public: |
94 | | DECLARE_ITEM_TYPE_FUNCTION(SwFormatFootnoteAtTextEnd) |
95 | | SwFormatFootnoteAtTextEnd( SwFootnoteEndPosEnum ePos = FTNEND_ATPGORDOCEND ) |
96 | 1.62k | : SwFormatFootnoteEndAtTextEnd( RES_FTN_AT_TXTEND, ePos ) |
97 | 1.62k | {} |
98 | | |
99 | | virtual SwFormatFootnoteAtTextEnd* Clone( SfxItemPool *pPool = nullptr ) const override; |
100 | | }; |
101 | | |
102 | | /// SwFormatFootnoteEndAtTextEnd subclass, specific to endnotes, placed in the item set of an |
103 | | /// SwSectionFormat. |
104 | | class SW_DLLPUBLIC SwFormatEndAtTextEnd final : public SwFormatFootnoteEndAtTextEnd |
105 | | { |
106 | | public: |
107 | | DECLARE_ITEM_TYPE_FUNCTION(SwFormatEndAtTextEnd) |
108 | | SwFormatEndAtTextEnd( SwFootnoteEndPosEnum ePos = FTNEND_ATPGORDOCEND ) |
109 | 5.27k | : SwFormatFootnoteEndAtTextEnd( RES_END_AT_TXTEND, ePos ) |
110 | 5.27k | { |
111 | 5.27k | SetNumType( SVX_NUM_ROMAN_LOWER ); |
112 | 5.27k | } |
113 | | |
114 | | virtual SwFormatEndAtTextEnd* Clone( SfxItemPool *pPool = nullptr ) const override; |
115 | | void dumpAsXml(xmlTextWriterPtr pWriter) const override; |
116 | | }; |
117 | | |
118 | | inline const SwFormatFootnoteAtTextEnd &SwAttrSet::GetFootnoteAtTextEnd(bool bInP) const |
119 | 68 | { return Get( RES_FTN_AT_TXTEND, bInP); } |
120 | | inline const SwFormatEndAtTextEnd &SwAttrSet::GetEndAtTextEnd(bool bInP) const |
121 | 353 | { return Get( RES_END_AT_TXTEND, bInP); } |
122 | | |
123 | | inline const SwFormatFootnoteAtTextEnd &SwFormat::GetFootnoteAtTextEnd(bool bInP) const |
124 | 68 | { return m_aSet.GetFootnoteAtTextEnd(bInP); } |
125 | | inline const SwFormatEndAtTextEnd &SwFormat::GetEndAtTextEnd(bool bInP) const |
126 | 353 | { return m_aSet.GetEndAtTextEnd(bInP); } |
127 | | |
128 | | #endif |
129 | | |
130 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |