xref: /trunk/main/svx/inc/svx/rulritem.hxx (revision 3334a7e6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SVX_RULRITEM_HXX
24 #define _SVX_RULRITEM_HXX
25 
26 // include ---------------------------------------------------------------
27 
28 
29 #include <tools/gen.hxx>
30 #include <svl/poolitem.hxx>
31 #include "svx/svxdllapi.h"
32 
33 // class SvxLongLRSpaceItem ----------------------------------------------
34 
35 class SVX_DLLPUBLIC SvxLongLRSpaceItem : public SfxPoolItem
36 {
37 	long	lLeft;         // nLeft oder der neg. Erstzeileneinzug
38 	long	lRight;        // der unproblematische rechte Rand
39 
40   protected:
41 
42 	virtual int 			 operator==( const SfxPoolItem& ) const;
43 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
44 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
45 
46 	virtual String			 GetValueText() const;
47 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
48 									SfxMapUnit eCoreMetric,
49 									SfxMapUnit ePresMetric,
50                                     String &rText, const IntlWrapper * = 0 ) const;
51 
52 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
53 
54 private:
55 	SVX_DLLPRIVATE const SvxLongLRSpaceItem& operator=(const SvxLongLRSpaceItem &); // n.i.
56 
57 public:
58 	TYPEINFO();
59 	SvxLongLRSpaceItem(long lLeft, long lRight, sal_uInt16 nId);
60 	SvxLongLRSpaceItem(const SvxLongLRSpaceItem &);
61     SvxLongLRSpaceItem();
62 
GetLeft() const63 	long    GetLeft() const { return lLeft; }
GetRight() const64 	long    GetRight() const { return lRight; }
SetLeft(long lArgLeft)65 	void    SetLeft(long lArgLeft) {lLeft=lArgLeft;}
SetRight(long lArgRight)66 	void    SetRight(long lArgRight) {lRight=lArgRight;}
67 };
68 
69 // class SvxLongULSpaceItem ----------------------------------------------
70 
71 class SVX_DLLPUBLIC SvxLongULSpaceItem : public SfxPoolItem
72 {
73 	long	lLeft;         // nLeft oder der neg. Erstzeileneinzug
74 	long	lRight;        // der unproblematische rechte Rand
75 
76   protected:
77 
78 	virtual int 			 operator==( const SfxPoolItem& ) const;
79 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
80 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
81 
82 	virtual String			 GetValueText() const;
83 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
84 									SfxMapUnit eCoreMetric,
85 									SfxMapUnit ePresMetric,
86                                     String &rText, const IntlWrapper * = 0 ) const;
87 
88 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
89 
90 private:
91 	SVX_DLLPRIVATE const SvxLongULSpaceItem& operator=(const SvxLongULSpaceItem &); // n.i.
92 
93 public:
94 	TYPEINFO();
95 	SvxLongULSpaceItem(long lUpper, long lLower, sal_uInt16 nId);
96 	SvxLongULSpaceItem(const SvxLongULSpaceItem &);
97     SvxLongULSpaceItem();
98 
GetUpper() const99 	long    GetUpper() const { return lLeft; }
GetLower() const100 	long    GetLower() const { return lRight; }
SetUpper(long lArgLeft)101 	void    SetUpper(long lArgLeft) {lLeft=lArgLeft;}
SetLower(long lArgRight)102 	void    SetLower(long lArgRight) {lRight=lArgRight;}
103 };
104 
105 // class SvxPagePosSizeItem ----------------------------------------------
106 
107 class SVX_DLLPUBLIC SvxPagePosSizeItem : public SfxPoolItem
108 {
109 	Point aPos;
110 	long lWidth;
111 	long lHeight;
112 protected:
113 	virtual int 			 operator==( const SfxPoolItem& ) const;
114 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
115 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
116 
117 	virtual String			 GetValueText() const;
118 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
119 									SfxMapUnit eCoreMetric,
120 									SfxMapUnit ePresMetric,
121                                     String &rText, const IntlWrapper * = 0 ) const;
122 
123 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
124 
125 private:
126 	SVX_DLLPRIVATE const SvxPagePosSizeItem& operator=(const SvxPagePosSizeItem &); // n.i.
127 public:
128 	TYPEINFO();
129 	SvxPagePosSizeItem(const Point &rPos, long lWidth, long lHeight);
130 	SvxPagePosSizeItem(const SvxPagePosSizeItem &);
131     SvxPagePosSizeItem();
132 
GetPos() const133 	const Point &GetPos() const { return aPos; }
GetWidth() const134 	long    GetWidth() const { return lWidth; }
GetHeight() const135 	long    GetHeight() const { return lHeight; }
136 };
137 
138 // struct SvxColumnDescription -------------------------------------------
139 
140 struct SvxColumnDescription
141 {
142     long nStart;                    /* Spaltenbeginn */
143     long nEnd;                      /* Spaltenende */
144 	sal_Bool   bVisible;				   /* Sichtbarkeit */
145 
146     long nEndMin;         //min. possible position of end
147     long nEndMax;         //max. possible position of end
148 
SvxColumnDescriptionSvxColumnDescription149 	SvxColumnDescription():
150         nStart(0), nEnd(0), bVisible(sal_True), nEndMin(0), nEndMax(0) {}
151 
SvxColumnDescriptionSvxColumnDescription152 	SvxColumnDescription(const SvxColumnDescription &rCopy) :
153         nStart(rCopy.nStart), nEnd(rCopy.nEnd),
154         bVisible(rCopy.bVisible),
155         nEndMin(rCopy.nEndMin), nEndMax(rCopy.nEndMax)
156          {}
157 
SvxColumnDescriptionSvxColumnDescription158     SvxColumnDescription(long start, long end, sal_Bool bVis = sal_True):
159         nStart(start), nEnd(end),
160         bVisible(bVis),
161         nEndMin(0), nEndMax(0) {}
162 
SvxColumnDescriptionSvxColumnDescription163     SvxColumnDescription(long start, long end,
164                         long endMin, long endMax, sal_Bool bVis = sal_True):
165         nStart(start), nEnd(end),
166         bVisible(bVis),
167         nEndMin(endMin), nEndMax(endMax)
168          {}
169 
operator ==SvxColumnDescription170     int operator==(const SvxColumnDescription &rCmp) const {
171 		return nStart == rCmp.nStart &&
172             bVisible == rCmp.bVisible &&
173             nEnd == rCmp.nEnd &&
174             nEndMin == rCmp.nEndMin &&
175                 nEndMax == rCmp.nEndMax;
176     }
operator !=SvxColumnDescription177 	int operator!=(const SvxColumnDescription &rCmp) const {
178 		return !operator==(rCmp);
179 	}
GetWidthSvxColumnDescription180     long GetWidth() const { return nEnd - nStart; }
181 };
182 
183 // class SvxColumnItem ---------------------------------------------------
184 
185 typedef SvPtrarr SvxColumns;
186 
187 class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem
188 {
189 	SvxColumns aColumns;// Spaltenarray
190 	long	nLeft,		// Linker Rand bei Tabelle
191 		   nRight;		// Rechter Rand bei Tabelle; bei Spalten immer gleich
192 						// zum umgebenden Rahmen
193 	sal_uInt16 nActColumn;	// die aktuelle Spalte
194 	sal_Bool    bTable;		// Tabelle?
195 	sal_Bool	bOrtho;     // Gleichverteilte Spalten
196 
197 	void DeleteAndDestroyColumns();
198 
199 protected:
200 	virtual int 			 operator==( const SfxPoolItem& ) const;
201 
202 	virtual String			 GetValueText() const;
203 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
204 									SfxMapUnit eCoreMetric,
205 									SfxMapUnit ePresMetric,
206                                     String &rText, const IntlWrapper * = 0 ) const;
207 
208 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
209 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
210 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
211 public:
212 	TYPEINFO();
213 	// rechter Rand des umgebenden Rahmens
214 	// nLeft, nRight jeweils der Abstand zum umgebenden Rahmen
215 	SvxColumnItem(sal_uInt16 nAct = 0); // Spalten
216 	SvxColumnItem(sal_uInt16 nActCol,
217 				  sal_uInt16 nLeft, sal_uInt16 nRight = 0);	// Tabelle mit Raendern
218 	SvxColumnItem(const	SvxColumnItem &);
219 	~SvxColumnItem();
220 
221 	const SvxColumnItem &operator=(const SvxColumnItem &);
222 
Count() const223 	sal_uInt16 Count() const { return aColumns.Count(); }
operator [](sal_uInt16 i)224 	SvxColumnDescription &operator[](sal_uInt16 i)
225 		{ return *(SvxColumnDescription*)aColumns[i]; }
operator [](sal_uInt16 i) const226 	const SvxColumnDescription &operator[](sal_uInt16 i) const
227 		{ return *(SvxColumnDescription*)aColumns[i]; }
Insert(const SvxColumnDescription & rDesc,sal_uInt16 nPos)228 	void Insert(const SvxColumnDescription &rDesc, sal_uInt16 nPos) {
229 		SvxColumnDescription* pDesc = new SvxColumnDescription(rDesc);
230 		aColumns.Insert(pDesc, nPos);
231 	}
Append(const SvxColumnDescription & rDesc)232 	void   Append(const SvxColumnDescription &rDesc) { Insert(rDesc, Count()); }
SetLeft(long left)233 	void   SetLeft(long left) { nLeft = left; }
SetRight(long right)234 	void   SetRight(long right) { nRight = right; }
SetActColumn(sal_uInt16 nCol)235 	void   SetActColumn(sal_uInt16 nCol) { nActColumn = nCol; }
236 
GetActColumn() const237 	sal_uInt16 GetActColumn() const { return nActColumn; }
IsFirstAct() const238 	sal_Bool   IsFirstAct() const { return nActColumn == 0; }
IsLastAct() const239 	sal_Bool   IsLastAct() const { return nActColumn == Count()-1; }
GetLeft()240 	long GetLeft() { return nLeft; }
GetRight()241 	long GetRight() { return nRight; }
242 
IsTable() const243 	sal_Bool   IsTable() const { return bTable; }
244 
245 	sal_Bool   CalcOrtho() const;
SetOrtho(sal_Bool bVal)246 	void   SetOrtho(sal_Bool bVal) { bOrtho = bVal; }
IsOrtho() const247 	sal_Bool   IsOrtho () const { return sal_False ; }
248 
IsConsistent() const249 	sal_Bool IsConsistent() const  { return nActColumn < aColumns.Count(); }
250 	long   GetVisibleRight() const;// rechter sichtbare Rand der aktuellen Spalte
251 };
252 
253 // class SvxObjectItem ---------------------------------------------------
254 
255 class SVX_DLLPUBLIC SvxObjectItem : public SfxPoolItem
256 {
257 private:
258 	long   nStartX;					   /* Beginn in X-Richtung */
259 	long   nEndX;					   /* Ende in X-Richtung */
260 	long   nStartY;                    /* Beginn in Y-Richtung */
261 	long   nEndY;                      /* Ende in Y-Richtung */
262 	sal_Bool   bLimits;					   /* Grenzwertkontrolle durch die Applikation */
263 protected:
264 	virtual int 			 operator==( const SfxPoolItem& ) const;
265 
266 	virtual String			 GetValueText() const;
267 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
268 									SfxMapUnit eCoreMetric,
269 									SfxMapUnit ePresMetric,
270                                     String &rText, const IntlWrapper * = 0 ) const;
271 
272 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
273 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
274 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
275 private:
276 	SVX_DLLPRIVATE const SvxObjectItem &operator=(const SvxObjectItem &); // n.i.
277 public:
278 	TYPEINFO();
279 	SvxObjectItem(long nStartX, long nEndX,
280 				  long nStartY, long nEndY,
281 				  sal_Bool bLimits = sal_False);
282 	SvxObjectItem(const SvxObjectItem &);
283 
HasLimits() const284 	sal_Bool   HasLimits() const { return bLimits; }
285 
GetStartX() const286 	long   GetStartX() const { return nStartX; }
GetEndX() const287 	long   GetEndX() const { return nEndX; }
GetStartY() const288 	long   GetStartY() const { return nStartY; }
GetEndY() const289 	long   GetEndY() const { return nEndY; }
290 
SetStartX(long l)291 	void   SetStartX(long l) { nStartX = l; }
SetEndX(long l)292 	void   SetEndX(long l) { nEndX = l; }
SetStartY(long l)293 	void   SetStartY(long l) { nStartY = l; }
SetEndY(long l)294 	void   SetEndY(long l) { nEndY = l; }
295 };
296 
297 
298 #endif
299 
300