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