xref: /aoo42x/main/svx/source/dialog/rulritem.cxx (revision f6e50924)
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 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 #include <tools/string.hxx>
27 
28 #include <svx/dialogs.hrc>
29 #include "svx/rulritem.hxx"
30 #include <com/sun/star/awt/Rectangle.hpp>
31 #include <com/sun/star/frame/status/LeftRightMargin.hpp>
32 #include <com/sun/star/frame/status/UpperLowerMargin.hpp>
33 
34 //------------------------------------------------------------------------
35 
36 TYPEINIT1_AUTOFACTORY(SvxPagePosSizeItem, SfxPoolItem);
37 TYPEINIT1_AUTOFACTORY(SvxLongLRSpaceItem, SfxPoolItem);
38 TYPEINIT1_AUTOFACTORY(SvxLongULSpaceItem, SfxPoolItem);
39 TYPEINIT1(SvxColumnItem, SfxPoolItem);
40 TYPEINIT1(SvxObjectItem, SfxPoolItem);
41 
42 //------------------------------------------------------------------------
43 
operator ==(const SfxPoolItem & rCmp) const44 int SvxLongLRSpaceItem::operator==( const SfxPoolItem& rCmp) const
45 {
46 	return SfxPoolItem::operator==(rCmp) &&
47 		lLeft==((const SvxLongLRSpaceItem &)rCmp).lLeft &&
48 		lRight==((const SvxLongLRSpaceItem &)rCmp).lRight;
49 }
50 
51 
52 //------------------------------------------------------------------------
53 
GetValueText() const54 String SvxLongLRSpaceItem::GetValueText() const
55 {
56 	return String();
57 }
58 
59 #define TWIP_TO_MM100(TWIP) 	((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
60 #define MM100_TO_TWIP(MM100)	((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
61 
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const62 sal_Bool SvxLongLRSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
63 {
64 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
65 	nMemberId &= ~CONVERT_TWIPS;
66 
67     sal_Int32 nVal;
68     switch( nMemberId )
69 	{
70         case 0:
71         {
72             ::com::sun::star::frame::status::LeftRightMargin aLeftRightMargin;
73             aLeftRightMargin.Left = bConvert ? TWIP_TO_MM100( lLeft ) : lLeft;
74             aLeftRightMargin.Right = bConvert ? TWIP_TO_MM100( lRight ) : lRight;
75             rVal <<= aLeftRightMargin;
76             return sal_True;
77         }
78 
79         case MID_LEFT: nVal = lLeft; break;
80         case MID_RIGHT: nVal = lRight; break;
81         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
82 	}
83 
84     if ( bConvert )
85         nVal = TWIP_TO_MM100( nVal );
86 
87     rVal <<= nVal;
88     return sal_True;
89 }
90 
91 // -----------------------------------------------------------------------
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)92 sal_Bool SvxLongLRSpaceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
93 {
94 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
95 	nMemberId &= ~CONVERT_TWIPS;
96 
97     sal_Int32 nVal = 0;
98     if ( nMemberId == 0 )
99     {
100         ::com::sun::star::frame::status::LeftRightMargin aLeftRightMargin;
101         if ( rVal >>= aLeftRightMargin )
102         {
103             lLeft    = bConvert ? MM100_TO_TWIP( aLeftRightMargin.Left ) : aLeftRightMargin.Left;
104             lRight   = bConvert ? MM100_TO_TWIP( aLeftRightMargin.Right ) : aLeftRightMargin.Right;
105             return sal_True;
106         }
107     }
108     else if ( rVal >>= nVal )
109     {
110         if ( bConvert )
111             nVal = MM100_TO_TWIP( nVal );
112 
113         switch( nMemberId )
114         {
115             case MID_LEFT: lLeft = nVal; break;
116             case MID_RIGHT: lRight = nVal; break;
117             default: DBG_ERROR("Wrong MemberId!"); return sal_False;
118         }
119 
120         return sal_True;
121     }
122 
123     return sal_False;
124 }
125 
126 //------------------------------------------------------------------------
127 
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,String &,const IntlWrapper *) const128 SfxItemPresentation SvxLongLRSpaceItem::GetPresentation
129 (
130     SfxItemPresentation /*ePres*/,
131     SfxMapUnit          /*eCoreUnit*/,
132     SfxMapUnit          /*ePresUnit*/,
133     String&             /*rText*/, const IntlWrapper *
134 )	const
135 {
136 
137 	return SFX_ITEM_PRESENTATION_NONE;
138 }
139 
140 //------------------------------------------------------------------------
141 
Clone(SfxItemPool *) const142 SfxPoolItem* SvxLongLRSpaceItem::Clone(SfxItemPool *) const
143 {
144 	return new SvxLongLRSpaceItem(*this);
145 }
146 
147 //------------------------------------------------------------------------
148 
SvxLongLRSpaceItem(long lL,long lR,sal_uInt16 nId)149 SvxLongLRSpaceItem::SvxLongLRSpaceItem(long lL, long lR, sal_uInt16 nId)
150 	: SfxPoolItem(nId),
151 	lLeft(lL),
152 	lRight(lR)
153 {}
154 
155 //------------------------------------------------------------------------
156 
SvxLongLRSpaceItem()157 SvxLongLRSpaceItem::SvxLongLRSpaceItem() :
158     SfxPoolItem( 0 ),
159     lLeft( 0 ),
160     lRight( 0 )
161 {}
162 
163 //------------------------------------------------------------------------
164 
SvxLongLRSpaceItem(const SvxLongLRSpaceItem & rCpy)165 SvxLongLRSpaceItem::SvxLongLRSpaceItem(const SvxLongLRSpaceItem &rCpy)
166 	: SfxPoolItem(rCpy),
167 	lLeft(rCpy.lLeft),
168 	lRight(rCpy.lRight)
169 		{}
170 
171 //------------------------------------------------------------------------
172 
operator ==(const SfxPoolItem & rCmp) const173 int SvxLongULSpaceItem::operator==( const SfxPoolItem& rCmp) const
174 {
175 	return SfxPoolItem::operator==(rCmp) &&
176 		lLeft==((const SvxLongULSpaceItem &)rCmp).lLeft &&
177 		lRight==((const SvxLongULSpaceItem &)rCmp).lRight;
178 }
179 
180 
181 //------------------------------------------------------------------------
182 
GetValueText() const183 String SvxLongULSpaceItem::GetValueText() const
184 {
185 	return String();
186 }
187 
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const188 sal_Bool SvxLongULSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
189 {
190 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
191 	nMemberId &= ~CONVERT_TWIPS;
192 
193     sal_Int32 nVal;
194     switch( nMemberId )
195 	{
196         case 0:
197         {
198             ::com::sun::star::frame::status::UpperLowerMargin aUpperLowerMargin;
199             aUpperLowerMargin.Upper = bConvert ? TWIP_TO_MM100( lLeft ) : lLeft;
200             aUpperLowerMargin.Lower = bConvert ? TWIP_TO_MM100( lRight ) : lRight;
201             rVal <<= aUpperLowerMargin;
202             return sal_True;
203         }
204 
205         case MID_UPPER: nVal = lLeft; break;
206         case MID_LOWER: nVal = lRight; break;
207         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
208 	}
209 
210     if ( bConvert )
211         nVal = TWIP_TO_MM100( nVal );
212 
213     rVal <<= nVal;
214     return sal_True;
215 }
216 
217 // -----------------------------------------------------------------------
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)218 sal_Bool SvxLongULSpaceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
219 {
220 	sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
221 	nMemberId &= ~CONVERT_TWIPS;
222 
223     sal_Int32 nVal = 0;
224     if ( nMemberId == 0 )
225     {
226         ::com::sun::star::frame::status::UpperLowerMargin aUpperLowerMargin;
227         if ( rVal >>= aUpperLowerMargin )
228         {
229             lLeft    = bConvert ? MM100_TO_TWIP( aUpperLowerMargin.Upper ) : aUpperLowerMargin.Upper;
230             lRight   = bConvert ? MM100_TO_TWIP( aUpperLowerMargin.Lower ) : aUpperLowerMargin.Lower;
231             return sal_True;
232         }
233     }
234     else if ( rVal >>= nVal )
235     {
236         if ( bConvert )
237             nVal = MM100_TO_TWIP( nVal );
238 
239         switch( nMemberId )
240         {
241             case MID_UPPER: lLeft = nVal; break;
242             case MID_LOWER: lRight = nVal; break;
243             default: DBG_ERROR("Wrong MemberId!"); return sal_False;
244         }
245 
246         return sal_True;
247     }
248 
249     return sal_False;
250 }
251 
252 //------------------------------------------------------------------------
253 
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,String &,const IntlWrapper *) const254 SfxItemPresentation SvxLongULSpaceItem::GetPresentation
255 (
256     SfxItemPresentation /*ePres*/,
257     SfxMapUnit          /*eCoreUnit*/,
258     SfxMapUnit          /*ePresUnit*/,
259     String&             /*rText*/, const IntlWrapper *
260 )   const
261 {
262 	return SFX_ITEM_PRESENTATION_NONE;
263 }
264 
265 //------------------------------------------------------------------------
266 
Clone(SfxItemPool *) const267 SfxPoolItem* SvxLongULSpaceItem::Clone(SfxItemPool *) const
268 {
269 	return new SvxLongULSpaceItem(*this);
270 }
271 
272 //------------------------------------------------------------------------
273 
SvxLongULSpaceItem(long lL,long lR,sal_uInt16 nId)274 SvxLongULSpaceItem::SvxLongULSpaceItem(long lL, long lR, sal_uInt16 nId)
275 	: SfxPoolItem(nId),
276 	lLeft(lL),
277 	lRight(lR)
278 {}
279 
280 //------------------------------------------------------------------------
281 
SvxLongULSpaceItem(const SvxLongULSpaceItem & rCpy)282 SvxLongULSpaceItem::SvxLongULSpaceItem(const SvxLongULSpaceItem &rCpy)
283 	: SfxPoolItem(rCpy),
284 	lLeft(rCpy.lLeft),
285 	lRight(rCpy.lRight)
286 		{}
287 
288 //------------------------------------------------------------------------
289 
SvxLongULSpaceItem()290 SvxLongULSpaceItem::SvxLongULSpaceItem() :
291     SfxPoolItem( 0 ),
292     lLeft( 0 ),
293     lRight( 0 )
294 {}
295 
296 //------------------------------------------------------------------------
297 
operator ==(const SfxPoolItem & rCmp) const298 int SvxPagePosSizeItem::operator==( const SfxPoolItem& rCmp) const
299 {
300 	return SfxPoolItem::operator==(rCmp) &&
301 		aPos == ((const SvxPagePosSizeItem &)rCmp).aPos &&
302 			lWidth == ((const SvxPagePosSizeItem &)rCmp).lWidth  &&
303 			lHeight == ((const SvxPagePosSizeItem &)rCmp).lHeight;
304 }
305 
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const306 sal_Bool SvxPagePosSizeItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
307 {
308 	nMemberId &= ~CONVERT_TWIPS;
309 
310     sal_Int32 nVal;
311     switch ( nMemberId )
312     {
313         case 0 :
314         {
315             com::sun::star::awt::Rectangle aPagePosSize;
316             aPagePosSize.X = aPos.X();
317             aPagePosSize.Y = aPos.Y();
318             aPagePosSize.Width = lWidth;
319             aPagePosSize.Height = lHeight;
320             rVal <<= aPagePosSize;
321             return sal_True;
322         }
323 
324         case MID_X: nVal = aPos.X(); break;
325         case MID_Y: nVal = aPos.Y(); break;
326         case MID_WIDTH: nVal = lWidth; break;
327         case MID_HEIGHT: nVal = lHeight; break;
328 
329         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
330     }
331 
332     rVal <<= nVal;
333     return sal_True;
334 }
335 
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)336 sal_Bool SvxPagePosSizeItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
337 {
338 	nMemberId &= ~CONVERT_TWIPS;
339 
340     sal_Int32 nVal = 0;
341     if ( nMemberId == 0 )
342     {
343         com::sun::star::awt::Rectangle aPagePosSize;
344         if ( rVal >>= aPagePosSize )
345         {
346             aPos.X() = aPagePosSize.X;
347             aPos.Y() = aPagePosSize.Y;
348             lWidth   = aPagePosSize.Width;
349             lHeight  = aPagePosSize.Height;
350             return sal_True;
351         }
352         else
353             return sal_False;
354     }
355     else if ( rVal >>= nVal )
356     {
357         switch ( nMemberId )
358         {
359             case MID_X: aPos.X() = nVal; break;
360             case MID_Y: aPos.Y() = nVal; break;
361             case MID_WIDTH: lWidth = nVal; break;
362             case MID_HEIGHT: lHeight = nVal; break;
363 
364             default: DBG_ERROR("Wrong MemberId!"); return sal_False;
365         }
366 
367         return sal_True;
368     }
369 
370     return sal_False;
371 }
372 
373 //------------------------------------------------------------------------
374 
GetValueText() const375 String SvxPagePosSizeItem::GetValueText() const
376 {
377 	return String();
378 }
379 
380 //------------------------------------------------------------------------
381 
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,String &,const IntlWrapper *) const382 SfxItemPresentation SvxPagePosSizeItem::GetPresentation
383 (
384     SfxItemPresentation /*ePres*/,
385     SfxMapUnit          /*eCoreUnit*/,
386     SfxMapUnit          /*ePresUnit*/,
387     String&             /*rText*/, const IntlWrapper *
388 )   const
389 {
390 	return SFX_ITEM_PRESENTATION_NONE;
391 }
392 
393 //------------------------------------------------------------------------
394 
Clone(SfxItemPool *) const395 SfxPoolItem* SvxPagePosSizeItem::Clone(SfxItemPool *) const
396 {
397 	return new SvxPagePosSizeItem(*this);
398 }
399 
400 //------------------------------------------------------------------------
401 
SvxPagePosSizeItem(const Point & rP,long lW,long lH)402 SvxPagePosSizeItem::SvxPagePosSizeItem(const Point &rP, long lW, long lH)
403 	: SfxPoolItem(SID_RULER_PAGE_POS),
404 	aPos(rP),
405 	lWidth(lW),
406 	lHeight(lH)
407 {}
408 
409 //------------------------------------------------------------------------
410 
SvxPagePosSizeItem(const SvxPagePosSizeItem & rCpy)411 SvxPagePosSizeItem::SvxPagePosSizeItem(const SvxPagePosSizeItem &rCpy)
412 	: SfxPoolItem(rCpy),
413 	aPos(rCpy.aPos),
414 	lWidth(rCpy.lWidth),
415 	lHeight(rCpy.lHeight)
416 		{}
417 
418 //------------------------------------------------------------------------
419 
SvxPagePosSizeItem()420 SvxPagePosSizeItem::SvxPagePosSizeItem()
421 	: SfxPoolItem( 0 ),
422 	aPos( 0, 0 ),
423 	lWidth( 0 ),
424 	lHeight( 0 )
425 {}
426 
427 //------------------------------------------------------------------------
428 
DeleteAndDestroyColumns()429 void SvxColumnItem::DeleteAndDestroyColumns()
430 {
431 	for( sal_uInt16 i = aColumns.Count(); i>0; )
432 	{
433 		SvxColumnDescription *pTmp = (SvxColumnDescription *)aColumns[--i];
434 		aColumns.Remove( i );
435 		delete pTmp;
436 	}
437 }
438 
439 //------------------------------------------------------------------------
440 
operator ==(const SfxPoolItem & rCmp) const441 int SvxColumnItem::operator==(const SfxPoolItem& rCmp) const
442 {
443 	if(!SfxPoolItem::operator==(rCmp) ||
444 	   nActColumn != ((const SvxColumnItem&)rCmp).nActColumn ||
445 	   nLeft != ((const SvxColumnItem&)rCmp).nLeft ||
446 	   nRight != ((const SvxColumnItem&)rCmp).nRight ||
447 	   bTable != ((const SvxColumnItem&)rCmp).bTable ||
448 	   Count() != ((const SvxColumnItem&)rCmp).Count())
449 		return sal_False;
450 
451 	const sal_uInt16 nCount = ((const SvxColumnItem&)rCmp).Count();
452 	for(sal_uInt16 i = 0; i < nCount;++i) {
453 #if OSL_DEBUG_LEVEL > 1
454 		SvxColumnDescription *p1, *p2;
455         p1 = (SvxColumnDescription *)aColumns[i];
456         p2 = (SvxColumnDescription *)((const SvxColumnItem&)rCmp).aColumns[i];
457 #endif
458 		if( (*this)[i] != ((const SvxColumnItem&)rCmp)[i] )
459 			return sal_False;
460 	}
461 	return sal_True;
462 }
463 
464 //------------------------------------------------------------------------
465 
GetValueText() const466 String SvxColumnItem::GetValueText() const
467 {
468 	return String();
469 }
470 
471 //------------------------------------------------------------------------
472 
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,String &,const IntlWrapper *) const473 SfxItemPresentation SvxColumnItem::GetPresentation
474 (
475     SfxItemPresentation /*ePres*/,
476     SfxMapUnit          /*eCoreUnit*/,
477     SfxMapUnit          /*ePresUnit*/,
478     String&             /*rText*/, const IntlWrapper *
479 )	const
480 {
481 	return SFX_ITEM_PRESENTATION_NONE;
482 }
483 
484 //------------------------------------------------------------------------
485 
Clone(SfxItemPool *) const486 SfxPoolItem* SvxColumnItem::Clone( SfxItemPool * ) const
487 {
488 	return new SvxColumnItem(*this);
489 }
490 
491 //------------------------------------------------------------------------
492 
SvxColumnItem(sal_uInt16 nAct)493 SvxColumnItem::SvxColumnItem( sal_uInt16 nAct ) :
494 
495 	SfxPoolItem( SID_RULER_BORDERS ),
496 
497     nLeft       ( 0 ),
498 	nRight		( 0 ),
499     nActColumn  ( nAct ),
500     bTable      ( sal_False ),
501     bOrtho      (sal_True )
502 
503 {
504 }
505 
506 //------------------------------------------------------------------------
507 
SvxColumnItem(sal_uInt16 nActCol,sal_uInt16 left,sal_uInt16 right)508 SvxColumnItem::SvxColumnItem( sal_uInt16 nActCol, sal_uInt16 left, sal_uInt16 right ) :
509 
510 	SfxPoolItem( SID_RULER_BORDERS ),
511 
512     nLeft       ( left ),
513 	nRight		( right ),
514     nActColumn  ( nActCol ),
515     bTable      ( sal_True ),
516     bOrtho      ( sal_True )
517 {
518 }
519 
520 //------------------------------------------------------------------------
521 
SvxColumnItem(const SvxColumnItem & rCopy)522 SvxColumnItem::SvxColumnItem( const SvxColumnItem& rCopy ) :
523 
524 	SfxPoolItem( rCopy ),
525 
526       aColumns  ( (sal_uInt8)rCopy.Count() ),
527       nLeft     ( rCopy.nLeft ),
528 	  nRight	( rCopy.nRight ),
529       nActColumn( rCopy.nActColumn ),
530       bTable    ( rCopy.bTable ),
531       bOrtho    ( rCopy.bOrtho )
532 
533 {
534 	const sal_uInt16 nCount = rCopy.Count();
535 
536 	for ( sal_uInt16 i = 0; i < nCount; ++i )
537 		Append( rCopy[i] );
538 }
539 
540 //------------------------------------------------------------------------
541 
~SvxColumnItem()542 SvxColumnItem::~SvxColumnItem()
543 {
544 	DeleteAndDestroyColumns();
545 }
546 
547 //------------------------------------------------------------------------
548 
operator =(const SvxColumnItem & rCopy)549 const SvxColumnItem &SvxColumnItem::operator=(const SvxColumnItem &rCopy)
550 {
551 	nLeft = rCopy.nLeft;
552 	nRight = rCopy.nRight;
553 	bTable = rCopy.bTable;
554 	nActColumn = rCopy.nActColumn;
555 	DeleteAndDestroyColumns();
556 	const sal_uInt16 nCount = rCopy.Count();
557 	for(sal_uInt16 i = 0; i < nCount;++i)
558 		Insert(rCopy[i], i);
559 	return *this;
560 }
561 
562 //------------------------------------------------------------------------
563 
CalcOrtho() const564 sal_Bool SvxColumnItem::CalcOrtho() const
565 {
566 	const sal_uInt16 nCount = Count();
567 	DBG_ASSERT(nCount >= 2, "keine Spalten");
568 	if(nCount < 2)
569 		return sal_False;
570 
571 	long nColWidth = (*this)[0].GetWidth();
572 	for(sal_uInt16 i = 1; i < nCount; ++i) {
573 		if( (*this)[i].GetWidth() != nColWidth)
574 			return sal_False;
575 	}
576 	//!! Breite Trenner
577 	return sal_True;
578 }
579 
580 //------------------------------------------------------------------------
581 
GetVisibleRight() const582 long SvxColumnItem::GetVisibleRight() const
583 {
584 	sal_uInt16 nIdx = 0;
585 
586 	for ( sal_uInt16 i = 0; i < nActColumn; ++i )
587 	{
588 		if ( (*this)[i].bVisible )
589 			++nIdx;
590 	}
591 	return (*this)[nIdx].nEnd;
592 }
593 
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const594 sal_Bool SvxColumnItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
595 {
596 	nMemberId &= ~CONVERT_TWIPS;
597     switch ( nMemberId )
598     {
599         case MID_COLUMNARRAY:
600         {
601             return sal_False;
602         }
603         case MID_RIGHT: rVal <<= nRight; break;
604         case MID_LEFT: rVal <<= nLeft; break;
605         case MID_ORTHO: rVal <<= (sal_Bool) bOrtho; break;
606         case MID_ACTUAL: rVal <<= (sal_Int32) nActColumn; break;
607         case MID_TABLE: rVal <<= (sal_Bool) bTable; break;
608         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
609     }
610 
611     return sal_True;
612 }
613 
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)614 sal_Bool SvxColumnItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
615 {
616 	nMemberId &= ~CONVERT_TWIPS;
617     sal_Int32 nVal = 0;
618     switch ( nMemberId )
619     {
620         case MID_COLUMNARRAY:
621         {
622             return sal_False;
623         }
624         case MID_RIGHT: rVal >>= nRight; break;
625         case MID_LEFT: rVal >>= nLeft; break;
626         case MID_ORTHO: rVal >>= nVal; bOrtho = (sal_Bool) nVal; break;
627         case MID_ACTUAL: rVal >>= nVal; nActColumn = (sal_uInt16) nVal; break;
628         case MID_TABLE: rVal >>= nVal; bTable = (sal_Bool) nVal; break;
629         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
630     }
631 
632     return sal_True;
633 }
634 
635 //------------------------------------------------------------------------
636 
operator ==(const SfxPoolItem & rCmp) const637 int SvxObjectItem::operator==( const SfxPoolItem& rCmp ) const
638 {
639 	return SfxPoolItem::operator==(rCmp) &&
640 	   nStartX == ((const SvxObjectItem&)rCmp).nStartX &&
641 	   nEndX == ((const SvxObjectItem&)rCmp).nEndX &&
642 	   nStartY == ((const SvxObjectItem&)rCmp).nStartY &&
643 	   nEndY == ((const SvxObjectItem&)rCmp).nEndY &&
644 	   bLimits == ((const SvxObjectItem&)rCmp).bLimits;
645 }
646 
647 //------------------------------------------------------------------------
648 
GetValueText() const649 String SvxObjectItem::GetValueText() const
650 {
651 	return String();
652 }
653 
654 //------------------------------------------------------------------------
655 
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,String &,const IntlWrapper *) const656 SfxItemPresentation SvxObjectItem::GetPresentation
657 (
658     SfxItemPresentation /*ePres*/,
659     SfxMapUnit          /*eCoreUnit*/,
660     SfxMapUnit          /*ePresUnit*/,
661     String&             /*rText*/, const IntlWrapper *
662 )   const
663 {
664 	return SFX_ITEM_PRESENTATION_NONE;
665 }
666 
667 //------------------------------------------------------------------------
668 
Clone(SfxItemPool *) const669 SfxPoolItem* SvxObjectItem::Clone(SfxItemPool *) const
670 {
671 	return new SvxObjectItem(*this);
672 }
673 
674 //------------------------------------------------------------------------
675 
SvxObjectItem(long nSX,long nEX,long nSY,long nEY,sal_Bool limits)676 SvxObjectItem::SvxObjectItem( long nSX, long nEX,
677 							  long nSY, long nEY, sal_Bool limits ) :
678 
679 	SfxPoolItem( SID_RULER_OBJECT ),
680 
681 	nStartX	( nSX ),
682 	nEndX	( nEX ),
683 	nStartY	( nSY ),
684 	nEndY	( nEY ),
685 	bLimits	( limits )
686 
687 {
688 }
689 
690 //------------------------------------------------------------------------
691 
SvxObjectItem(const SvxObjectItem & rCopy)692 SvxObjectItem::SvxObjectItem( const SvxObjectItem& rCopy ) :
693 
694 	SfxPoolItem( rCopy ),
695 
696 	nStartX	( rCopy.nStartX ),
697 	nEndX	( rCopy.nEndX ),
698 	nStartY	( rCopy.nStartY ),
699 	nEndY	( rCopy.nEndY ),
700 	bLimits	( rCopy.bLimits )
701 
702 {
703 }
704 
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const705 sal_Bool SvxObjectItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
706 {
707     nMemberId &= ~CONVERT_TWIPS;
708     switch ( nMemberId )
709     {
710         case MID_START_X : rVal <<= nStartX; break;
711         case MID_START_Y : rVal <<= nStartY; break;
712         case MID_END_X : rVal <<= nEndX; break;
713         case MID_END_Y : rVal <<= nEndY; break;
714         case MID_LIMIT : rVal <<= bLimits; break;
715         default:
716             DBG_ERROR( "Wrong MemberId" );
717             return sal_False;
718     }
719 
720     return sal_True;
721 }
722 
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)723 sal_Bool SvxObjectItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
724 {
725     nMemberId &= ~CONVERT_TWIPS;
726     sal_Bool bRet=sal_False;
727     switch ( nMemberId )
728     {
729         case MID_START_X : bRet = (rVal >>= nStartX); break;
730         case MID_START_Y : bRet = (rVal >>= nStartY); break;
731         case MID_END_X : bRet = (rVal >>= nEndX); break;
732         case MID_END_Y : bRet = (rVal >>= nEndY); break;
733         case MID_LIMIT : bRet = (rVal >>= bLimits); break;
734         default: DBG_ERROR( "Wrong MemberId" );
735     }
736 
737     return bRet;
738 }
739 
740