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 _SVX_RULRITEM_HXX
20 : #define _SVX_RULRITEM_HXX
21 :
22 : #include <tools/gen.hxx>
23 : #include <svl/poolitem.hxx>
24 : #include "svx/svxdllapi.h"
25 : #include <vector>
26 :
27 2513 : class SVX_DLLPUBLIC SvxLongLRSpaceItem : public SfxPoolItem
28 : {
29 : long lLeft; // nLeft or the negativ first-line indentation
30 : long lRight; // the unproblematic right edge
31 :
32 : protected:
33 :
34 : virtual int operator==( const SfxPoolItem& ) const;
35 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
36 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
37 :
38 : virtual OUString GetValueText() const;
39 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
40 : SfxMapUnit eCoreMetric,
41 : SfxMapUnit ePresMetric,
42 : OUString &rText, const IntlWrapper * = 0 ) const;
43 :
44 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
45 :
46 : private:
47 : SVX_DLLPRIVATE const SvxLongLRSpaceItem& operator=(const SvxLongLRSpaceItem &); // n.i.
48 :
49 : public:
50 : TYPEINFO();
51 : SvxLongLRSpaceItem(long lLeft, long lRight, sal_uInt16 nId);
52 : SvxLongLRSpaceItem(const SvxLongLRSpaceItem &);
53 : SvxLongLRSpaceItem();
54 :
55 360 : long GetLeft() const { return lLeft; }
56 1050 : long GetRight() const { return lRight; }
57 2 : void SetLeft(long lArgLeft) {lLeft=lArgLeft;}
58 2 : void SetRight(long lArgRight) {lRight=lArgRight;}
59 : };
60 :
61 2517 : class SVX_DLLPUBLIC SvxLongULSpaceItem : public SfxPoolItem
62 : {
63 : long lLeft; // nLeft or the negative first-line indentation
64 : long lRight; // the unproblematic right edge
65 :
66 : protected:
67 :
68 : virtual int operator==( const SfxPoolItem& ) const;
69 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
70 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
71 :
72 : virtual OUString GetValueText() const;
73 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
74 : SfxMapUnit eCoreMetric,
75 : SfxMapUnit ePresMetric,
76 : OUString &rText, const IntlWrapper * = 0 ) const;
77 :
78 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
79 :
80 : private:
81 : SVX_DLLPRIVATE const SvxLongULSpaceItem& operator=(const SvxLongULSpaceItem &); // n.i.
82 :
83 : public:
84 : TYPEINFO();
85 : SvxLongULSpaceItem(long lUpper, long lLower, sal_uInt16 nId);
86 : SvxLongULSpaceItem(const SvxLongULSpaceItem &);
87 : SvxLongULSpaceItem();
88 :
89 360 : long GetUpper() const { return lLeft; }
90 360 : long GetLower() const { return lRight; }
91 2 : void SetUpper(long lArgLeft) {lLeft=lArgLeft;}
92 2 : void SetLower(long lArgRight) {lRight=lArgRight;}
93 : };
94 :
95 3091 : class SVX_DLLPUBLIC SvxPagePosSizeItem : public SfxPoolItem
96 : {
97 : Point aPos;
98 : long lWidth;
99 : long lHeight;
100 : protected:
101 : virtual int operator==( const SfxPoolItem& ) const;
102 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
103 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
104 :
105 : virtual OUString GetValueText() const;
106 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
107 : SfxMapUnit eCoreMetric,
108 : SfxMapUnit ePresMetric,
109 : OUString &rText, const IntlWrapper * = 0 ) const;
110 :
111 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
112 :
113 : private:
114 : SVX_DLLPRIVATE const SvxPagePosSizeItem& operator=(const SvxPagePosSizeItem &); // n.i.
115 : public:
116 : TYPEINFO();
117 : SvxPagePosSizeItem(const Point &rPos, long lWidth, long lHeight);
118 : SvxPagePosSizeItem(const SvxPagePosSizeItem &);
119 : SvxPagePosSizeItem();
120 :
121 722 : const Point &GetPos() const { return aPos; }
122 2022 : long GetWidth() const { return lWidth; }
123 722 : long GetHeight() const { return lHeight; }
124 : };
125 :
126 : struct SvxColumnDescription
127 : {
128 : long nStart; /* Start of the column */
129 : long nEnd; /* End of the column */
130 : sal_Bool bVisible; /* Visibility */
131 :
132 : long nEndMin; //min. possible position of end
133 : long nEndMax; //max. possible position of end
134 :
135 : SvxColumnDescription():
136 : nStart(0), nEnd(0), bVisible(sal_True), nEndMin(0), nEndMax(0) {}
137 :
138 42 : SvxColumnDescription(const SvxColumnDescription &rCopy) :
139 : nStart(rCopy.nStart), nEnd(rCopy.nEnd),
140 : bVisible(rCopy.bVisible),
141 42 : nEndMin(rCopy.nEndMin), nEndMax(rCopy.nEndMax)
142 42 : {}
143 :
144 0 : SvxColumnDescription(long start, long end, sal_Bool bVis = sal_True):
145 : nStart(start), nEnd(end),
146 : bVisible(bVis),
147 0 : nEndMin(0), nEndMax(0) {}
148 :
149 8 : SvxColumnDescription(long start, long end,
150 : long endMin, long endMax, sal_Bool bVis = sal_True):
151 : nStart(start), nEnd(end),
152 : bVisible(bVis),
153 8 : nEndMin(endMin), nEndMax(endMax)
154 8 : {}
155 :
156 4 : int operator==(const SvxColumnDescription &rCmp) const {
157 8 : return nStart == rCmp.nStart &&
158 8 : bVisible == rCmp.bVisible &&
159 8 : nEnd == rCmp.nEnd &&
160 12 : nEndMin == rCmp.nEndMin &&
161 8 : nEndMax == rCmp.nEndMax;
162 : }
163 4 : int operator!=(const SvxColumnDescription &rCmp) const {
164 4 : return !operator==(rCmp);
165 : }
166 0 : long GetWidth() const { return nEnd - nStart; }
167 : };
168 :
169 : class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem
170 : {
171 : std::vector<SvxColumnDescription> aColumns;// Column array
172 : long nLeft, // Left edge for the table
173 : nRight; // Right edge for the table; for columns always
174 : // equal to the surrounding frame
175 : sal_uInt16 nActColumn; // the current column
176 : sal_uInt8 bTable; // table?
177 : sal_uInt8 bOrtho; // evenly spread columns
178 :
179 : protected:
180 : virtual int operator==( const SfxPoolItem& ) const;
181 :
182 : virtual OUString GetValueText() const;
183 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
184 : SfxMapUnit eCoreMetric,
185 : SfxMapUnit ePresMetric,
186 : OUString &rText, const IntlWrapper * = 0 ) const;
187 :
188 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
189 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
190 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
191 : public:
192 : TYPEINFO();
193 : // right edge of the surrounding frame
194 : // nLeft, nRight each the distance to the surrounding frame
195 : SvxColumnItem(sal_uInt16 nAct = 0); // columns
196 : SvxColumnItem(sal_uInt16 nActCol,
197 : sal_uInt16 nLeft, sal_uInt16 nRight = 0); // Table with borders
198 : SvxColumnItem(const SvxColumnItem &);
199 : ~SvxColumnItem();
200 :
201 : const SvxColumnItem &operator=(const SvxColumnItem &);
202 :
203 69 : sal_uInt16 Count() const { return aColumns.size(); }
204 28 : SvxColumnDescription &operator[](sal_uInt16 i)
205 28 : { return aColumns[i]; }
206 28 : const SvxColumnDescription &operator[](sal_uInt16 i) const
207 28 : { return aColumns[i]; }
208 8 : void Insert(const SvxColumnDescription &rDesc, sal_uInt16 nPos) {
209 8 : aColumns.insert(aColumns.begin() + nPos, rDesc);
210 8 : }
211 8 : void Append(const SvxColumnDescription &rDesc) { Insert(rDesc, Count()); }
212 0 : void SetLeft(long left) { nLeft = left; }
213 0 : void SetRight(long right) { nRight = right; }
214 : void SetActColumn(sal_uInt16 nCol) { nActColumn = nCol; }
215 :
216 12 : sal_uInt16 GetActColumn() const { return nActColumn; }
217 0 : sal_Bool IsFirstAct() const { return nActColumn == 0; }
218 0 : sal_Bool IsLastAct() const { return nActColumn == Count()-1; }
219 4 : long GetLeft() { return nLeft; }
220 4 : long GetRight() { return nRight; }
221 :
222 9 : sal_Bool IsTable() const { return bTable; }
223 :
224 : sal_Bool CalcOrtho() const;
225 0 : void SetOrtho(sal_Bool bVal) { bOrtho = bVal; }
226 : sal_Bool IsOrtho () const { return sal_False ; }
227 :
228 : sal_Bool IsConsistent() const { return nActColumn < aColumns.size(); }
229 : };
230 :
231 : // class SvxObjectItem ---------------------------------------------------
232 :
233 0 : class SVX_DLLPUBLIC SvxObjectItem : public SfxPoolItem
234 : {
235 : private:
236 : long nStartX; /* Start in x direction */
237 : long nEndX; /* End in x direction */
238 : long nStartY; /* Start in y direction */
239 : long nEndY; /* Ende in y direction */
240 : sal_Bool bLimits; /* boundary limit control by the application */
241 : protected:
242 : virtual int operator==( const SfxPoolItem& ) const;
243 :
244 : virtual OUString GetValueText() const;
245 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
246 : SfxMapUnit eCoreMetric,
247 : SfxMapUnit ePresMetric,
248 : OUString &rText, const IntlWrapper * = 0 ) const;
249 :
250 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
251 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
252 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
253 : private:
254 : SVX_DLLPRIVATE const SvxObjectItem &operator=(const SvxObjectItem &); // n.i.
255 : public:
256 : TYPEINFO();
257 : SvxObjectItem(long nStartX, long nEndX,
258 : long nStartY, long nEndY,
259 : sal_Bool bLimits = sal_False);
260 : SvxObjectItem(const SvxObjectItem &);
261 :
262 0 : sal_Bool HasLimits() const { return bLimits; }
263 :
264 0 : long GetStartX() const { return nStartX; }
265 0 : long GetEndX() const { return nEndX; }
266 0 : long GetStartY() const { return nStartY; }
267 0 : long GetEndY() const { return nEndY; }
268 :
269 0 : void SetStartX(long l) { nStartX = l; }
270 0 : void SetEndX(long l) { nEndX = l; }
271 0 : void SetStartY(long l) { nStartY = l; }
272 0 : void SetEndY(long l) { nEndY = l; }
273 : };
274 :
275 :
276 : #endif
277 :
278 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|