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 class SW_DLLPUBLIC SwFormatFootnoteEndAtTextEnd : public SfxEnumItem<SwFootnoteEndPosEnum>
38 {
39 OUString m_sPrefix;
40 OUString m_sSuffix;
41 SvxNumberType m_aFormat;
42 sal_uInt16 m_nOffset;
43
44 protected:
SwFormatFootnoteEndAtTextEnd(sal_uInt16 nWhichL,SwFootnoteEndPosEnum ePos)45 SwFormatFootnoteEndAtTextEnd( sal_uInt16 nWhichL, SwFootnoteEndPosEnum ePos )
46 : SfxEnumItem( nWhichL, ePos ), m_nOffset( 0 )
47 {}
48
49 public:
50 virtual sal_uInt16 GetValueCount() const override;
51
52 virtual bool operator==( const SfxPoolItem& ) const override;
53
54 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
55 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
56
57 virtual bool GetPresentation( SfxItemPresentation ePres,
58 MapUnit eCoreMetric,
59 MapUnit ePresMetric,
60 OUString &rText,
61 const IntlWrapper& rIntl ) const override;
62
IsAtEnd() const63 bool IsAtEnd() const { return FTNEND_ATPGORDOCEND != GetValue(); }
64
65 SwFormatFootnoteEndAtTextEnd & operator=( const SwFormatFootnoteEndAtTextEnd & rAttr );
66 SwFormatFootnoteEndAtTextEnd(SwFormatFootnoteEndAtTextEnd const &) = default;
67 // SfxPoolItem copy function dichotomy
68
GetNumType() const69 SvxNumType GetNumType() const { return m_aFormat.GetNumberingType(); }
SetNumType(SvxNumType eType)70 void SetNumType( SvxNumType eType ) { m_aFormat.SetNumberingType(eType); }
71
GetSwNumType() const72 const SvxNumberType& GetSwNumType() const { return m_aFormat; }
73
GetOffset() const74 sal_uInt16 GetOffset() const { return m_nOffset; }
SetOffset(sal_uInt16 nOff)75 void SetOffset( sal_uInt16 nOff ) { m_nOffset = nOff; }
76
GetPrefix() const77 const OUString& GetPrefix() const { return m_sPrefix; }
SetPrefix(const OUString & rSet)78 void SetPrefix(const OUString& rSet) { m_sPrefix = rSet; }
79
GetSuffix() const80 const OUString& GetSuffix() const { return m_sSuffix; }
SetSuffix(const OUString & rSet)81 void SetSuffix(const OUString& rSet) { m_sSuffix = rSet; }
82 };
83
84 class SW_DLLPUBLIC SwFormatFootnoteAtTextEnd : public SwFormatFootnoteEndAtTextEnd
85 {
86 public:
SwFormatFootnoteAtTextEnd(SwFootnoteEndPosEnum ePos=FTNEND_ATPGORDOCEND)87 SwFormatFootnoteAtTextEnd( SwFootnoteEndPosEnum ePos = FTNEND_ATPGORDOCEND )
88 : SwFormatFootnoteEndAtTextEnd( RES_FTN_AT_TXTEND, ePos )
89 {}
90
91 virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
92 };
93
94 class SW_DLLPUBLIC SwFormatEndAtTextEnd : public SwFormatFootnoteEndAtTextEnd
95 {
96 public:
SwFormatEndAtTextEnd(SwFootnoteEndPosEnum ePos=FTNEND_ATPGORDOCEND)97 SwFormatEndAtTextEnd( SwFootnoteEndPosEnum ePos = FTNEND_ATPGORDOCEND )
98 : SwFormatFootnoteEndAtTextEnd( RES_END_AT_TXTEND, ePos )
99 {
100 SetNumType( SVX_NUM_ROMAN_LOWER );
101 }
102
103 virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
104 };
105
GetFootnoteAtTextEnd(bool bInP) const106 inline const SwFormatFootnoteAtTextEnd &SwAttrSet::GetFootnoteAtTextEnd(bool bInP) const
107 { return Get( RES_FTN_AT_TXTEND, bInP); }
GetEndAtTextEnd(bool bInP) const108 inline const SwFormatEndAtTextEnd &SwAttrSet::GetEndAtTextEnd(bool bInP) const
109 { return Get( RES_END_AT_TXTEND, bInP); }
110
GetFootnoteAtTextEnd(bool bInP) const111 inline const SwFormatFootnoteAtTextEnd &SwFormat::GetFootnoteAtTextEnd(bool bInP) const
112 { return m_aSet.GetFootnoteAtTextEnd(bInP); }
GetEndAtTextEnd(bool bInP) const113 inline const SwFormatEndAtTextEnd &SwFormat::GetEndAtTextEnd(bool bInP) const
114 { return m_aSet.GetEndAtTextEnd(bInP); }
115
116 #endif
117
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
119