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 SwFtnEndPosEnum
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 0 : class SW_DLLPUBLIC SwFmtFtnEndAtTxtEnd : public SfxEnumItem
38 : {
39 : OUString sPrefix;
40 : OUString sSuffix;
41 : SvxNumberType aFmt;
42 : sal_uInt16 nOffset;
43 :
44 : protected:
45 0 : SwFmtFtnEndAtTxtEnd( sal_uInt16 nWhichL, SwFtnEndPosEnum ePos )
46 0 : : SfxEnumItem( nWhichL, sal::static_int_cast< sal_uInt16 >(ePos) ), nOffset( 0 )
47 0 : {}
48 : SwFmtFtnEndAtTxtEnd( const SwFmtFtnEndAtTxtEnd& rAttr )
49 : : SfxEnumItem( rAttr ), sPrefix( rAttr.sPrefix ),
50 : sSuffix( rAttr.sSuffix ), aFmt( rAttr.aFmt ),
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 SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
63 : SfxMapUnit eCoreMetric,
64 : SfxMapUnit ePresMetric,
65 : OUString &rText,
66 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
67 :
68 0 : inline sal_Bool IsAtEnd() const { return FTNEND_ATPGORDOCEND != GetValue(); }
69 :
70 : SwFmtFtnEndAtTxtEnd & operator=( const SwFmtFtnEndAtTxtEnd & rAttr );
71 :
72 0 : sal_Int16 GetNumType() const { return aFmt.GetNumberingType(); }
73 0 : void SetNumType( sal_Int16 eType ) { aFmt.SetNumberingType(eType); }
74 :
75 0 : const SvxNumberType& GetSwNumType() const { return aFmt; }
76 :
77 0 : 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 0 : class SW_DLLPUBLIC SwFmtFtnAtTxtEnd : public SwFmtFtnEndAtTxtEnd
88 : {
89 : public:
90 0 : SwFmtFtnAtTxtEnd( SwFtnEndPosEnum ePos = FTNEND_ATPGORDOCEND )
91 0 : : SwFmtFtnEndAtTxtEnd( RES_FTN_AT_TXTEND, ePos )
92 0 : {}
93 :
94 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
95 : };
96 :
97 0 : class SW_DLLPUBLIC SwFmtEndAtTxtEnd : public SwFmtFtnEndAtTxtEnd
98 : {
99 : public:
100 0 : SwFmtEndAtTxtEnd( SwFtnEndPosEnum ePos = FTNEND_ATPGORDOCEND )
101 0 : : SwFmtFtnEndAtTxtEnd( RES_END_AT_TXTEND, ePos )
102 : {
103 0 : SetNumType( SVX_NUM_ROMAN_LOWER );
104 0 : }
105 :
106 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
107 : };
108 :
109 0 : inline const SwFmtFtnAtTxtEnd &SwAttrSet::GetFtnAtTxtEnd(sal_Bool bInP) const
110 0 : { return (const SwFmtFtnAtTxtEnd&)Get( RES_FTN_AT_TXTEND, bInP); }
111 0 : inline const SwFmtEndAtTxtEnd &SwAttrSet::GetEndAtTxtEnd(sal_Bool bInP) const
112 0 : { return (const SwFmtEndAtTxtEnd&)Get( RES_END_AT_TXTEND, bInP); }
113 :
114 0 : inline const SwFmtFtnAtTxtEnd &SwFmt::GetFtnAtTxtEnd(sal_Bool bInP) const
115 0 : { return aSet.GetFtnAtTxtEnd(bInP); }
116 0 : inline const SwFmtEndAtTxtEnd &SwFmt::GetEndAtTxtEnd(sal_Bool bInP) const
117 0 : { return aSet.GetEndAtTxtEnd(bInP); }
118 :
119 : #endif
120 :
121 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|