Line data Source code
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 <hintids.hxx>
24 : #include <format.hxx>
25 : #include <numrule.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 126 : class SW_DLLPUBLIC SwFormatFootnoteEndAtTextEnd : public SfxEnumItem
38 : {
39 : OUString sPrefix;
40 : OUString sSuffix;
41 : SvxNumberType aFormat;
42 : sal_uInt16 nOffset;
43 :
44 : protected:
45 126 : SwFormatFootnoteEndAtTextEnd( sal_uInt16 nWhichL, SwFootnoteEndPosEnum ePos )
46 126 : : SfxEnumItem( nWhichL, sal::static_int_cast< sal_uInt16 >(ePos) ), nOffset( 0 )
47 126 : {}
48 : SwFormatFootnoteEndAtTextEnd( const SwFormatFootnoteEndAtTextEnd& rAttr )
49 : : SfxEnumItem( rAttr ), sPrefix( rAttr.sPrefix ),
50 : sSuffix( rAttr.sSuffix ), aFormat( rAttr.aFormat ),
51 : nOffset( rAttr.nOffset )
52 : {}
53 :
54 : public:
55 : virtual sal_uInt16 GetValueCount() const SAL_OVERRIDE;
56 :
57 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
58 :
59 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
60 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
61 :
62 : virtual bool GetPresentation( SfxItemPresentation ePres,
63 : SfxMapUnit eCoreMetric,
64 : SfxMapUnit ePresMetric,
65 : OUString &rText,
66 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
67 :
68 485 : inline bool IsAtEnd() const { return FTNEND_ATPGORDOCEND != GetValue(); }
69 :
70 : SwFormatFootnoteEndAtTextEnd & operator=( const SwFormatFootnoteEndAtTextEnd & rAttr );
71 :
72 0 : sal_Int16 GetNumType() const { return aFormat.GetNumberingType(); }
73 63 : void SetNumType( sal_Int16 eType ) { aFormat.SetNumberingType(eType); }
74 :
75 0 : const SvxNumberType& GetSwNumType() const { return aFormat; }
76 :
77 4 : sal_uInt16 GetOffset() const { return nOffset; }
78 0 : void SetOffset( sal_uInt16 nOff ) { nOffset = nOff; }
79 :
80 0 : const OUString& GetPrefix() const { return sPrefix; }
81 0 : void SetPrefix(const OUString& rSet) { sPrefix = rSet; }
82 :
83 0 : const OUString& GetSuffix() const { return sSuffix; }
84 0 : void SetSuffix(const OUString& rSet) { sSuffix = rSet; }
85 : };
86 :
87 128 : class SW_DLLPUBLIC SwFormatFootnoteAtTextEnd : public SwFormatFootnoteEndAtTextEnd
88 : {
89 : public:
90 63 : SwFormatFootnoteAtTextEnd( SwFootnoteEndPosEnum ePos = FTNEND_ATPGORDOCEND )
91 63 : : SwFormatFootnoteEndAtTextEnd( RES_FTN_AT_TXTEND, ePos )
92 63 : {}
93 :
94 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
95 : };
96 :
97 128 : class SW_DLLPUBLIC SwFormatEndAtTextEnd : public SwFormatFootnoteEndAtTextEnd
98 : {
99 : public:
100 63 : SwFormatEndAtTextEnd( SwFootnoteEndPosEnum ePos = FTNEND_ATPGORDOCEND )
101 63 : : SwFormatFootnoteEndAtTextEnd( RES_END_AT_TXTEND, ePos )
102 : {
103 63 : SetNumType( SVX_NUM_ROMAN_LOWER );
104 63 : }
105 :
106 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
107 : };
108 :
109 426 : inline const SwFormatFootnoteAtTextEnd &SwAttrSet::GetFootnoteAtTextEnd(bool bInP) const
110 426 : { return static_cast<const SwFormatFootnoteAtTextEnd&>(Get( RES_FTN_AT_TXTEND, bInP)); }
111 485 : inline const SwFormatEndAtTextEnd &SwAttrSet::GetEndAtTextEnd(bool bInP) const
112 485 : { return static_cast<const SwFormatEndAtTextEnd&>(Get( RES_END_AT_TXTEND, bInP)); }
113 :
114 426 : inline const SwFormatFootnoteAtTextEnd &SwFormat::GetFootnoteAtTextEnd(bool bInP) const
115 426 : { return m_aSet.GetFootnoteAtTextEnd(bInP); }
116 485 : inline const SwFormatEndAtTextEnd &SwFormat::GetEndAtTextEnd(bool bInP) const
117 485 : { return m_aSet.GetEndAtTextEnd(bInP); }
118 :
119 : #endif
120 :
121 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|