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 .
19 #ifndef INCLUDED_SW_INC_FMTFTNTX_HXX
20 #define INCLUDED_SW_INC_FMTFTNTX_HXX
22 #include <svl/eitem.hxx>
23 #include <editeng/numitem.hxx>
24 #include "hintids.hxx"
28 enum SwFootnoteEndPosEnum
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
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.
42 class SW_DLLPUBLIC SwFormatFootnoteEndAtTextEnd
: public SfxEnumItem
<SwFootnoteEndPosEnum
>
46 SvxNumberType m_aFormat
;
50 SwFormatFootnoteEndAtTextEnd( sal_uInt16 nWhichL
, SwFootnoteEndPosEnum ePos
)
51 : SfxEnumItem( nWhichL
, ePos
), m_nOffset( 0 )
55 virtual sal_uInt16
GetValueCount() const override
;
57 virtual bool operator==( const SfxPoolItem
& ) const override
;
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
;
62 virtual bool GetPresentation( SfxItemPresentation ePres
,
66 const IntlWrapper
& rIntl
) const override
;
68 bool IsAtEnd() const { return FTNEND_ATPGORDOCEND
!= GetValue(); }
70 SwFormatFootnoteEndAtTextEnd
& operator=( const SwFormatFootnoteEndAtTextEnd
& rAttr
);
71 SwFormatFootnoteEndAtTextEnd(SwFormatFootnoteEndAtTextEnd
const &) = default;
72 // SfxPoolItem copy function dichotomy
74 SvxNumType
GetNumType() const { return m_aFormat
.GetNumberingType(); }
75 void SetNumType( SvxNumType eType
) { m_aFormat
.SetNumberingType(eType
); }
77 const SvxNumberType
& GetSwNumType() const { return m_aFormat
; }
79 sal_uInt16
GetOffset() const { return m_nOffset
; }
80 void SetOffset( sal_uInt16 nOff
) { m_nOffset
= nOff
; }
82 const OUString
& GetPrefix() const { return m_sPrefix
; }
83 void SetPrefix(const OUString
& rSet
) { m_sPrefix
= rSet
; }
85 const OUString
& GetSuffix() const { return m_sSuffix
; }
86 void SetSuffix(const OUString
& rSet
) { m_sSuffix
= rSet
; }
89 class SW_DLLPUBLIC SwFormatFootnoteAtTextEnd final
: public SwFormatFootnoteEndAtTextEnd
92 SwFormatFootnoteAtTextEnd( SwFootnoteEndPosEnum ePos
= FTNEND_ATPGORDOCEND
)
93 : SwFormatFootnoteEndAtTextEnd( RES_FTN_AT_TXTEND
, ePos
)
96 virtual SwFormatFootnoteAtTextEnd
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
99 class SW_DLLPUBLIC SwFormatEndAtTextEnd final
: public SwFormatFootnoteEndAtTextEnd
102 SwFormatEndAtTextEnd( SwFootnoteEndPosEnum ePos
= FTNEND_ATPGORDOCEND
)
103 : SwFormatFootnoteEndAtTextEnd( RES_END_AT_TXTEND
, ePos
)
105 SetNumType( SVX_NUM_ROMAN_LOWER
);
108 virtual SwFormatEndAtTextEnd
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
111 inline const SwFormatFootnoteAtTextEnd
&SwAttrSet::GetFootnoteAtTextEnd(bool bInP
) const
112 { return Get( RES_FTN_AT_TXTEND
, bInP
); }
113 inline const SwFormatEndAtTextEnd
&SwAttrSet::GetEndAtTextEnd(bool bInP
) const
114 { return Get( RES_END_AT_TXTEND
, bInP
); }
116 inline const SwFormatFootnoteAtTextEnd
&SwFormat::GetFootnoteAtTextEnd(bool bInP
) const
117 { return m_aSet
.GetFootnoteAtTextEnd(bInP
); }
118 inline const SwFormatEndAtTextEnd
&SwFormat::GetEndAtTextEnd(bool bInP
) const
119 { return m_aSet
.GetEndAtTextEnd(bInP
); }
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */