LibreOffice Module editeng (master) 1
tstpitem.hxx
Go to the documentation of this file.
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_EDITENG_TSTPITEM_HXX
20#define INCLUDED_EDITENG_TSTPITEM_HXX
21
22#include <svl/poolitem.hxx>
23#include <editeng/svxenum.hxx>
26
27// class SvxTabStop ------------------------------------------------------
28
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 u'\0' // Get from IntlWrapper
33#define cDfltFillChar u' '
34
36{
37private:
38 sal_Int32 nTabPos;
40 mutable sal_Unicode
43
44 void fillDecimal() const;
45
46public:
47 SvxTabStop();
48 explicit SvxTabStop( const sal_Int32 nPos,
49 const SvxTabAdjust eAdjst = SvxTabAdjust::Left,
50 const sal_Unicode cDec = cDfltDecimalChar,
51 const sal_Unicode cFil = cDfltFillChar );
52
53 sal_Int32& GetTabPos() { return nTabPos; }
54 sal_Int32 GetTabPos() const { return nTabPos; }
55
56 SvxTabAdjust& GetAdjustment() { return eAdjustment; }
57 SvxTabAdjust GetAdjustment() const { return eAdjustment; }
58
59 sal_Unicode& GetDecimal() { fillDecimal(); return m_cDecimal; }
60 sal_Unicode GetDecimal() const { fillDecimal(); return m_cDecimal; }
61
62 sal_Unicode& GetFill() { return cFill; }
63 sal_Unicode GetFill() const { return cFill; }
64
65 bool operator==( const SvxTabStop& rTS ) const
66 {
67 return ( nTabPos == rTS.nTabPos &&
68 eAdjustment == rTS.eAdjustment &&
69 m_cDecimal == rTS.m_cDecimal &&
70 cFill == rTS.cFill );
71 }
72 bool operator!=( const SvxTabStop& rTS ) const
73 {
74 return !operator==(rTS);
75 }
76 // For the SortedArray:
77 bool operator <( const SvxTabStop& rTS ) const
78 { return nTabPos < rTS.nTabPos; }
79
80 void dumpAsXml(xmlTextWriterPtr pWriter) const;
81};
82
83// class SvxTabStopItem --------------------------------------------------
84
86
87/* [Description]
88
89 This item describes a list of TabStops.
90*/
91
93{
96 sal_Int32 mnDefaultDistance = 0;
97
98public:
99 static SfxPoolItem* CreateDefault();
100
101 explicit SvxTabStopItem( sal_uInt16 nWhich );
102 SvxTabStopItem( const sal_uInt16 nTabs,
103 const sal_uInt16 nDist,
104 const SvxTabAdjust eAdjst /*= SvxTabAdjust::Default*/,
105 sal_uInt16 nWhich );
106
107 // Returns index of the tab or TAB_NOTFOUND
108 sal_uInt16 GetPos( const SvxTabStop& rTab ) const;
109
110 // Returns index of the tab at nPos, or TAB_NOTFOUND
111 sal_uInt16 GetPos( const sal_Int32 nPos ) const;
112 void SetDefaultDistance(sal_Int32 nDefaultDistancenDefTabSize);
113 sal_Int32 GetDefaultDistance() const;
114
115 // unprivatized:
116 sal_uInt16 Count() const { return maTabStops.size(); }
117 bool Insert( const SvxTabStop& rTab );
118 void Insert( const SvxTabStopItem* pTabs );
119 void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 )
120 { maTabStops.erase( maTabStops.begin() + nPos, maTabStops.begin() + nPos + nLen ); }
121
122 // Assignment operator, equality operator (caution: expensive!)
123
124 // this is already included in SfxPoolItem declaration
125 //int operator!=( const SvxTabStopItem& rTSI ) const
126 // { return !( operator==( rTSI ) ); }
127
128 const SvxTabStop& operator[]( const sal_uInt16 nPos ) const
129 { return maTabStops[nPos]; }
130
131 const SvxTabStop& At( const sal_uInt16 nPos ) const
132 {
133 return maTabStops[nPos];
134 }
135
136 // "pure virtual Methods" from SfxPoolItem
137 virtual bool operator==( const SfxPoolItem& ) const override;
138 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
139 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
140
141 virtual bool GetPresentation( SfxItemPresentation ePres,
142 MapUnit eCoreMetric,
143 MapUnit ePresMetric,
144 OUString &rText, const IntlWrapper& ) const override;
145
146 virtual SvxTabStopItem* Clone( SfxItemPool *pPool = nullptr ) const override;
147
148 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
149};
150
151#endif
152
153/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 Count() const
Definition: tstpitem.hxx:116
const SvxTabStop & At(const sal_uInt16 nPos) const
Definition: tstpitem.hxx:131
const SvxTabStop & operator[](const sal_uInt16 nPos) const
Definition: tstpitem.hxx:128
void Remove(const sal_uInt16 nPos, const sal_uInt16 nLen=1)
Definition: tstpitem.hxx:119
SvxTabStopArr maTabStops
Definition: tstpitem.hxx:94
sal_Unicode GetDecimal() const
Definition: tstpitem.hxx:60
sal_Int32 GetTabPos() const
Definition: tstpitem.hxx:54
sal_Unicode GetFill() const
Definition: tstpitem.hxx:63
sal_Unicode & GetFill()
Definition: tstpitem.hxx:62
sal_Unicode m_cDecimal
Definition: tstpitem.hxx:41
sal_Int32 & GetTabPos()
Definition: tstpitem.hxx:53
sal_Unicode & GetDecimal()
Definition: tstpitem.hxx:59
bool operator!=(const SvxTabStop &rTS) const
Definition: tstpitem.hxx:72
sal_Unicode cFill
Definition: tstpitem.hxx:42
SvxTabAdjust eAdjustment
Definition: tstpitem.hxx:39
bool operator==(const SvxTabStop &rTS) const
Definition: tstpitem.hxx:65
SvxTabAdjust & GetAdjustment()
Definition: tstpitem.hxx:56
sal_Int32 nTabPos
Definition: tstpitem.hxx:38
SvxTabAdjust GetAdjustment() const
Definition: tstpitem.hxx:57
const_iterator begin() const
size_type erase(const Value &x)
size_type size() const
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName) override
bool operator==(const EditLine &r1, const EditLine &r2)
Definition: editdoc.cxx:978
#define EDITENG_DLLPUBLIC
Definition: editengdllapi.h:28
struct _xmlTextWriter * xmlTextWriterPtr
sal_uInt16 nPos
MapUnit
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
SfxItemPresentation
SvxTabAdjust
Definition: svxenum.hxx:53
#define cDfltFillChar
Definition: tstpitem.hxx:33
o3tl::sorted_vector< SvxTabStop > SvxTabStopArr
Definition: tstpitem.hxx:85
#define cDfltDecimalChar
Definition: tstpitem.hxx:32
unsigned char sal_uInt8
sal_uInt16 sal_Unicode