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