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 _FMTFTNTX_HXX
20 : #define _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 :
38 120 : class SW_DLLPUBLIC SwFmtFtnEndAtTxtEnd : public SfxEnumItem
39 : {
40 : OUString sPrefix;
41 : OUString sSuffix;
42 : SvxNumberType aFmt;
43 : sal_uInt16 nOffset;
44 :
45 : protected:
46 120 : SwFmtFtnEndAtTxtEnd( sal_uInt16 nWhichL, SwFtnEndPosEnum ePos )
47 120 : : SfxEnumItem( nWhichL, sal::static_int_cast< sal_uInt16 >(ePos) ), nOffset( 0 )
48 120 : {}
49 : SwFmtFtnEndAtTxtEnd( const SwFmtFtnEndAtTxtEnd& rAttr )
50 : : SfxEnumItem( rAttr ), sPrefix( rAttr.sPrefix ),
51 : sSuffix( rAttr.sSuffix ), aFmt( rAttr.aFmt ),
52 : nOffset( rAttr.nOffset )
53 : {}
54 :
55 : public:
56 : virtual sal_uInt16 GetValueCount() const;
57 :
58 : virtual int operator==( const SfxPoolItem& ) const;
59 :
60 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
61 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
62 :
63 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
64 : SfxMapUnit eCoreMetric,
65 : SfxMapUnit ePresMetric,
66 : OUString &rText,
67 : const IntlWrapper* pIntl = 0 ) const;
68 :
69 197 : inline sal_Bool IsAtEnd() const { return FTNEND_ATPGORDOCEND != GetValue(); }
70 :
71 : SwFmtFtnEndAtTxtEnd & operator=( const SwFmtFtnEndAtTxtEnd & rAttr );
72 :
73 0 : sal_Int16 GetNumType() const { return aFmt.GetNumberingType(); }
74 61 : void SetNumType( sal_Int16 eType ) { aFmt.SetNumberingType(eType); }
75 :
76 0 : const SvxNumberType& GetSwNumType() const { return aFmt; }
77 :
78 0 : sal_uInt16 GetOffset() const { return nOffset; }
79 0 : void SetOffset( sal_uInt16 nOff ) { nOffset = nOff; }
80 :
81 0 : const OUString& GetPrefix() const { return sPrefix; }
82 0 : void SetPrefix(const OUString& rSet) { sPrefix = rSet; }
83 :
84 0 : const OUString& GetSuffix() const { return sSuffix; }
85 0 : void SetSuffix(const OUString& rSet) { sSuffix = rSet; }
86 : };
87 :
88 144 : class SW_DLLPUBLIC SwFmtFtnAtTxtEnd : public SwFmtFtnEndAtTxtEnd
89 : {
90 : public:
91 59 : SwFmtFtnAtTxtEnd( SwFtnEndPosEnum ePos = FTNEND_ATPGORDOCEND )
92 59 : : SwFmtFtnEndAtTxtEnd( RES_FTN_AT_TXTEND, ePos )
93 59 : {}
94 :
95 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
96 : };
97 :
98 150 : class SW_DLLPUBLIC SwFmtEndAtTxtEnd : public SwFmtFtnEndAtTxtEnd
99 : {
100 : public:
101 61 : SwFmtEndAtTxtEnd( SwFtnEndPosEnum ePos = FTNEND_ATPGORDOCEND )
102 61 : : SwFmtFtnEndAtTxtEnd( RES_END_AT_TXTEND, ePos )
103 : {
104 61 : SetNumType( SVX_NUM_ROMAN_LOWER );
105 61 : }
106 :
107 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
108 : };
109 :
110 153 : inline const SwFmtFtnAtTxtEnd &SwAttrSet::GetFtnAtTxtEnd(sal_Bool bInP) const
111 153 : { return (const SwFmtFtnAtTxtEnd&)Get( RES_FTN_AT_TXTEND, bInP); }
112 197 : inline const SwFmtEndAtTxtEnd &SwAttrSet::GetEndAtTxtEnd(sal_Bool bInP) const
113 197 : { return (const SwFmtEndAtTxtEnd&)Get( RES_END_AT_TXTEND, bInP); }
114 :
115 :
116 153 : inline const SwFmtFtnAtTxtEnd &SwFmt::GetFtnAtTxtEnd(sal_Bool bInP) const
117 153 : { return aSet.GetFtnAtTxtEnd(bInP); }
118 197 : inline const SwFmtEndAtTxtEnd &SwFmt::GetEndAtTxtEnd(sal_Bool bInP) const
119 197 : { return aSet.GetEndAtTxtEnd(bInP); }
120 :
121 : #endif
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|