update emoji autocorrect entries from po-files
[LibreOffice.git] / include / editeng / tstpitem.hxx
blob2d7384c696b4592528890e89a2997bb270d97b6d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_EDITENG_TSTPITEM_HXX
20 #define INCLUDED_EDITENG_TSTPITEM_HXX
22 #include <svl/poolitem.hxx>
23 #include <editeng/svxenum.hxx>
24 #include <editeng/editengdllapi.h>
25 #include <o3tl/sorted_vector.hxx>
27 // class SvxTabStop ------------------------------------------------------
29 #define SVX_TAB_DEFCOUNT 10
30 #define SVX_TAB_DEFDIST 1134 // 2cm in twips
31 #define SVX_TAB_NOTFOUND USHRT_MAX
32 #define cDfltDecimalChar (sal_Unicode(0x00)) // Get from IntlWrapper
33 #define cDfltFillChar (sal_Unicode(' '))
35 class EDITENG_DLLPUBLIC SvxTabStop
37 private:
38 sal_Int32 nTabPos;
40 SvxTabAdjust eAdjustment;
41 mutable sal_Unicode m_cDecimal;
42 sal_Unicode cFill;
44 EDITENG_DLLPRIVATE friend SvStream& WriteSvxTabStop( SvStream&, SvxTabStop& );
46 void fillDecimal() const;
48 public:
49 SvxTabStop();
50 explicit SvxTabStop( const sal_Int32 nPos,
51 const SvxTabAdjust eAdjst = SVX_TAB_ADJUST_LEFT,
52 const sal_Unicode cDec = cDfltDecimalChar,
53 const sal_Unicode cFil = cDfltFillChar );
55 sal_Int32& GetTabPos() { return nTabPos; }
56 sal_Int32 GetTabPos() const { return nTabPos; }
58 SvxTabAdjust& GetAdjustment() { return eAdjustment; }
59 SvxTabAdjust GetAdjustment() const { return eAdjustment; }
61 sal_Unicode& GetDecimal() { fillDecimal(); return m_cDecimal; }
62 sal_Unicode GetDecimal() const { fillDecimal(); return m_cDecimal; }
64 sal_Unicode& GetFill() { return cFill; }
65 sal_Unicode GetFill() const { return cFill; }
67 OUString GetValueString() const;
69 // the "old" operator==()
70 bool IsEqual( const SvxTabStop& rTS ) const
72 return ( nTabPos == rTS.nTabPos &&
73 eAdjustment == rTS.eAdjustment &&
74 m_cDecimal == rTS.m_cDecimal &&
75 cFill == rTS.cFill );
78 // For the SortedArray:
79 bool operator==( const SvxTabStop& rTS ) const
80 { return nTabPos == rTS.nTabPos; }
81 bool operator <( const SvxTabStop& rTS ) const
82 { return nTabPos < rTS.nTabPos; }
84 SvxTabStop& operator=( const SvxTabStop& rTS )
86 nTabPos = rTS.nTabPos;
87 eAdjustment = rTS.eAdjustment;
88 m_cDecimal = rTS.m_cDecimal;
89 cFill = rTS.cFill;
90 return *this;
94 // class SvxTabStopItem --------------------------------------------------
96 typedef o3tl::sorted_vector<SvxTabStop> SvxTabStopArr;
98 /* [Description]
100 This item describes a list of TabStops.
103 class EDITENG_DLLPUBLIC SvxTabStopItem : public SfxPoolItem
105 SvxTabStopArr maTabStops;
107 public:
108 TYPEINFO_OVERRIDE();
110 explicit SvxTabStopItem( sal_uInt16 nWhich );
111 SvxTabStopItem( const sal_uInt16 nTabs,
112 const sal_uInt16 nDist,
113 const SvxTabAdjust eAdjst /*= SVX_TAB_ADJUST_DEFAULT*/,
114 sal_uInt16 nWhich );
115 SvxTabStopItem( const SvxTabStopItem& rTSI );
117 // Returns index of the tab or TAB_NOTFOUND
118 sal_uInt16 GetPos( const SvxTabStop& rTab ) const;
120 // Returns index of the tab at nPos, or TAB_NOTFOUND
121 sal_uInt16 GetPos( const sal_Int32 nPos ) const;
123 // unprivatized:
124 sal_uInt16 Count() const { return maTabStops.size(); }
125 bool Insert( const SvxTabStop& rTab );
126 void Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart = 0,
127 sal_uInt16 nEnd = USHRT_MAX );
128 void Remove( SvxTabStop& rTab )
129 { maTabStops.erase( rTab ); }
130 void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 )
131 { maTabStops.erase( maTabStops.begin() + nPos, maTabStops.begin() + nPos + nLen ); }
133 // Assignment operator, equality operator (caution: expensive!)
134 SvxTabStopItem& operator=( const SvxTabStopItem& rTSI );
136 // this is already included in SfxPoolItem declaration
137 //int operator!=( const SvxTabStopItem& rTSI ) const
138 // { return !( operator==( rTSI ) ); }
140 const SvxTabStop& operator[]( const sal_uInt16 nPos ) const
141 { return maTabStops[nPos]; }
143 const SvxTabStop& At( const sal_uInt16 nPos ) const
145 return maTabStops[nPos];
148 // "pure virtual Methods" from SfxPoolItem
149 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
150 virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
151 virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
153 virtual bool GetPresentation( SfxItemPresentation ePres,
154 SfxMapUnit eCoreMetric,
155 SfxMapUnit ePresMetric,
156 OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE;
158 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
159 virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const SAL_OVERRIDE;
160 virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const SAL_OVERRIDE;
164 #endif
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */