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_FMTFTN_HXX
20 #define INCLUDED_SW_INC_FMTFTN_HXX
22 #include <rtl/ustring.hxx>
23 #include <cppuhelper/weakref.hxx>
24 #include <svl/poolitem.hxx>
29 namespace com::sun::star::text
{
40 class SW_DLLPUBLIC SwFormatFootnote final
42 , public sw::BroadcastingModify
44 friend class SwTextFootnote
;
45 SwTextFootnote
* m_pTextAttr
; ///< My TextAttribute.
46 OUString m_aNumber
; ///< User-defined 'Number'.
47 sal_uInt16 m_nNumber
; ///< automatic sequence number
48 sal_uInt16 m_nNumberRLHidden
; ///< automatic sequence number (hidden redlines)
49 bool m_bEndNote
; ///< Is it an End note?
51 css::uno::WeakReference
<css::text::XFootnote
> m_wXFootnote
;
53 SwFormatFootnote
& operator=(const SwFormatFootnote
& rFootnote
) = delete;
54 SwFormatFootnote( const SwFormatFootnote
& ) = delete;
57 SwFormatFootnote( bool bEndNote
= false );
58 virtual ~SwFormatFootnote() override
;
60 /// "Pure virtual methods" of SfxPoolItem.
61 virtual bool operator==( const SfxPoolItem
& ) const override
;
62 virtual SwFormatFootnote
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
65 virtual void Modify(SfxPoolItem
const* pOld
, SfxPoolItem
const* pNew
)
68 void InvalidateFootnote();
70 const OUString
& GetNumStr() const { return m_aNumber
; }
71 sal_uInt16
GetNumber() const { return m_nNumber
; }
72 sal_uInt16
GetNumberRLHidden() const { return m_nNumberRLHidden
; }
73 bool IsEndNote() const { return m_bEndNote
;}
75 void SetNumStr( const OUString
& rStr
) { m_aNumber
= rStr
; }
76 void SetEndNote( bool b
);
78 void SetNumber( const SwFormatFootnote
& rFootnote
)
80 m_nNumber
= rFootnote
.m_nNumber
;
81 m_nNumberRLHidden
= rFootnote
.m_nNumberRLHidden
;
82 m_aNumber
= rFootnote
.m_aNumber
;
85 const SwTextFootnote
*GetTextFootnote() const { return m_pTextAttr
; }
86 SwTextFootnote
*GetTextFootnote() { return m_pTextAttr
; }
88 OUString
GetFootnoteText(SwRootFrame
const& rLayout
) const;
90 /// Returns string to be displayed of footnote / endnote.
91 OUString
GetViewNumStr(const SwDoc
& rDoc
, SwRootFrame
const* pLayout
,
92 bool bInclStrings
= false) const;
94 css::uno::Reference
<css::text::XTextRange
> getAnchor(SwDoc
& rDoc
) const;
96 css::uno::WeakReference
<css::text::XFootnote
> const& GetXFootnote() const
97 { return m_wXFootnote
; }
98 void SetXFootnote(css::uno::Reference
<css::text::XFootnote
> const& xNote
)
99 { m_wXFootnote
= xNote
; }
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */