1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <svx/dialogs.hrc>
#include "svx/rulritem.hxx"
#include <tools/mapunit.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/frame/status/LeftRightMargin.hpp>
#include <com/sun/star/frame/status/UpperLowerMargin.hpp>
SfxPoolItem* SvxPagePosSizeItem::CreateDefault() { return new SvxPagePosSizeItem; }
SfxPoolItem* SvxLongLRSpaceItem::CreateDefault() { return new SvxLongLRSpaceItem; }
SfxPoolItem* SvxLongULSpaceItem::CreateDefault() { return new SvxLongULSpaceItem; }
SfxPoolItem* SvxColumnItem::CreateDefault() { return new SvxColumnItem; }
SfxPoolItem* SvxObjectItem::CreateDefault() { SAL_WARN( "svx", "No SvxObjectItem factory available"); return nullptr; }
/* SvxLongLRSpaceItem */
bool SvxLongLRSpaceItem::operator==( const SfxPoolItem& rCmp) const
{
return SfxPoolItem::operator==(rCmp) &&
mlLeft == static_cast<const SvxLongLRSpaceItem &>(rCmp).mlLeft &&
mlRight == static_cast<const SvxLongLRSpaceItem &>(rCmp).mlRight;
}
bool SvxLongLRSpaceItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
{
bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
nMemberId &= ~CONVERT_TWIPS;
sal_Int32 nVal;
switch( nMemberId )
{
case 0:
{
css::frame::status::LeftRightMargin aLeftRightMargin;
aLeftRightMargin.Left = bConvert ? convertTwipToMm100( mlLeft ) : mlLeft;
aLeftRightMargin.Right = bConvert ? convertTwipToMm100( mlRight ) : mlRight;
rVal <<= aLeftRightMargin;
return true;
}
case MID_LEFT:
nVal = mlLeft;
break;
case MID_RIGHT:
nVal = mlRight;
break;
default:
OSL_FAIL("Wrong MemberId!");
return false;
}
if ( bConvert )
nVal = convertTwipToMm100( nVal );
rVal <<= nVal;
return true;
}
bool SvxLongLRSpaceItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
{
bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
nMemberId &= ~CONVERT_TWIPS;
sal_Int32 nVal = 0;
if ( nMemberId == 0 )
{
css::frame::status::LeftRightMargin aLeftRightMargin;
if ( rVal >>= aLeftRightMargin )
{
mlLeft = bConvert ? convertMm100ToTwip(aLeftRightMargin.Left) : aLeftRightMargin.Left;
mlRight = bConvert ? convertMm100ToTwip(aLeftRightMargin.Right) : aLeftRightMargin.Right;
return true;
}
}
else if ( rVal >>= nVal )
{
if ( bConvert )
nVal = convertMm100ToTwip( nVal );
switch( nMemberId )
{
case MID_LEFT:
mlLeft = nVal;
break;
case MID_RIGHT:
mlRight = nVal;
break;
default:
OSL_FAIL("Wrong MemberId!");
return false;
}
return true;
}
return false;
}
bool SvxLongLRSpaceItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreUnit*/,
MapUnit /*ePresUnit*/,
OUString& /*rText*/,
const IntlWrapper* /*pWrapper*/) const
{
return false;
}
SfxPoolItem* SvxLongLRSpaceItem::Clone(SfxItemPool *) const
{
return new SvxLongLRSpaceItem(*this);
}
SvxLongLRSpaceItem::SvxLongLRSpaceItem(long lLeft, long lRight, sal_uInt16 nId) :
SfxPoolItem (nId),
mlLeft (lLeft),
mlRight (lRight)
{}
SvxLongLRSpaceItem::SvxLongLRSpaceItem() :
SfxPoolItem (0),
mlLeft (0),
mlRight (0)
{}
SvxLongLRSpaceItem::SvxLongLRSpaceItem(const SvxLongLRSpaceItem &rCpy) :
SfxPoolItem (rCpy),
mlLeft (rCpy.mlLeft),
mlRight (rCpy.mlRight)
{}
void SvxLongLRSpaceItem::SetLeft(long lArgLeft)
{
mlLeft = lArgLeft;
}
void SvxLongLRSpaceItem::SetRight(long lArgRight)
{
mlRight = lArgRight;
}
/* SvxLongULSpaceItem */
bool SvxLongULSpaceItem::operator==( const SfxPoolItem& rCmp) const
{
return SfxPoolItem::operator==(rCmp) &&
mlLeft == static_cast<const SvxLongULSpaceItem&>(rCmp).mlLeft &&
mlRight == static_cast<const SvxLongULSpaceItem&>(rCmp).mlRight;
}
bool SvxLongULSpaceItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
{
bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
nMemberId &= ~CONVERT_TWIPS;
sal_Int32 nVal;
switch( nMemberId )
{
case 0:
{
css::frame::status::UpperLowerMargin aUpperLowerMargin;
aUpperLowerMargin.Upper = bConvert ? convertTwipToMm100( mlLeft ) : mlLeft;
aUpperLowerMargin.Lower = bConvert ? convertTwipToMm100( mlRight ) : mlRight;
rVal <<= aUpperLowerMargin;
return true;
}
case MID_UPPER:
nVal = mlLeft;
break;
case MID_LOWER:
nVal = mlRight;
break;
default: OSL_FAIL("Wrong MemberId!"); return false;
}
if ( bConvert )
nVal = convertTwipToMm100( nVal );
rVal <<= nVal;
return true;
}
bool SvxLongULSpaceItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
{
bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
nMemberId &= ~CONVERT_TWIPS;
sal_Int32 nVal = 0;
if ( nMemberId == 0 )
{
css::frame::status::UpperLowerMargin aUpperLowerMargin;
if ( rVal >>= aUpperLowerMargin )
{
mlLeft = bConvert ? convertMm100ToTwip( aUpperLowerMargin.Upper ) : aUpperLowerMargin.Upper;
mlRight = bConvert ? convertMm100ToTwip( aUpperLowerMargin.Lower ) : aUpperLowerMargin.Lower;
return true;
}
}
else if ( rVal >>= nVal )
{
if ( bConvert )
nVal = convertMm100ToTwip( nVal );
switch( nMemberId )
{
case MID_UPPER:
mlLeft = nVal;
break;
case MID_LOWER:
mlRight = nVal;
break;
default:
OSL_FAIL("Wrong MemberId!");
return false;
}
return true;
}
return false;
}
bool SvxLongULSpaceItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreUnit*/,
MapUnit /*ePresUnit*/,
OUString& /*rText*/,
const IntlWrapper* /*pWrapper*/ ) const
{
return false;
}
SfxPoolItem* SvxLongULSpaceItem::Clone(SfxItemPool *) const
{
return new SvxLongULSpaceItem(*this);
}
SvxLongULSpaceItem::SvxLongULSpaceItem(long lLeft, long lRight, sal_uInt16 nId) :
SfxPoolItem (nId),
mlLeft (lLeft),
mlRight (lRight)
{}
SvxLongULSpaceItem::SvxLongULSpaceItem(const SvxLongULSpaceItem &rCpy) :
SfxPoolItem (rCpy),
mlLeft (rCpy.mlLeft),
mlRight (rCpy.mlRight)
{}
SvxLongULSpaceItem::SvxLongULSpaceItem() :
SfxPoolItem (0),
mlLeft (0),
mlRight (0)
{}
void SvxLongULSpaceItem::SetUpper(long lArgLeft)
{
mlLeft = lArgLeft;
}
void SvxLongULSpaceItem::SetLower(long lArgRight)
{
mlRight = lArgRight;
}
/* SvxPagePosSizeItem */
bool SvxPagePosSizeItem::operator==( const SfxPoolItem& rCmp) const
{
return SfxPoolItem::operator==(rCmp) &&
aPos == static_cast<const SvxPagePosSizeItem &>(rCmp).aPos &&
lWidth == static_cast<const SvxPagePosSizeItem &>(rCmp).lWidth &&
lHeight == static_cast<const SvxPagePosSizeItem &>(rCmp).lHeight;
}
bool SvxPagePosSizeItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
{
nMemberId &= ~CONVERT_TWIPS;
sal_Int32 nVal;
switch ( nMemberId )
{
case 0 :
{
css::awt::Rectangle aPagePosSize;
aPagePosSize.X = aPos.X();
aPagePosSize.Y = aPos.Y();
aPagePosSize.Width = lWidth;
aPagePosSize.Height = lHeight;
rVal <<= aPagePosSize;
return true;
}
case MID_X: nVal = aPos.X(); break;
case MID_Y: nVal = aPos.Y(); break;
case MID_WIDTH: nVal = lWidth; break;
case MID_HEIGHT: nVal = lHeight; break;
default: OSL_FAIL("Wrong MemberId!"); return false;
}
rVal <<= nVal;
return true;
}
bool SvxPagePosSizeItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
{
nMemberId &= ~CONVERT_TWIPS;
sal_Int32 nVal = 0;
if ( nMemberId == 0 )
{
css::awt::Rectangle aPagePosSize;
if ( rVal >>= aPagePosSize )
{
aPos.X() = aPagePosSize.X;
aPos.Y() = aPagePosSize.Y;
lWidth = aPagePosSize.Width;
lHeight = aPagePosSize.Height;
return true;
}
else
return false;
}
else if ( rVal >>= nVal )
{
switch ( nMemberId )
{
case MID_X: aPos.X() = nVal; break;
case MID_Y: aPos.Y() = nVal; break;
case MID_WIDTH: lWidth = nVal; break;
case MID_HEIGHT: lHeight = nVal; break;
default: OSL_FAIL("Wrong MemberId!"); return false;
}
return true;
}
return false;
}
bool SvxPagePosSizeItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreUnit*/,
MapUnit /*ePresUnit*/,
OUString& /*rText*/,
const IntlWrapper* /*pWrapper*/ ) const
{
return false;
}
SfxPoolItem* SvxPagePosSizeItem::Clone(SfxItemPool *) const
{
return new SvxPagePosSizeItem(*this);
}
SvxPagePosSizeItem::SvxPagePosSizeItem(const Point &rP, long lW, long lH) :
SfxPoolItem (SID_RULER_PAGE_POS),
aPos (rP),
lWidth (lW),
lHeight (lH)
{}
SvxPagePosSizeItem::SvxPagePosSizeItem(const SvxPagePosSizeItem &rCpy) :
SfxPoolItem (rCpy),
aPos (rCpy.aPos),
lWidth (rCpy.lWidth),
lHeight (rCpy.lHeight)
{}
SvxPagePosSizeItem::SvxPagePosSizeItem() :
SfxPoolItem (0),
aPos (0, 0),
lWidth (0),
lHeight (0)
{}
/* SvxColumnItem */
bool SvxColumnItem::operator==(const SfxPoolItem& rCmp) const
{
if(!SfxPoolItem::operator==(rCmp) ||
nActColumn != static_cast<const SvxColumnItem&>(rCmp).nActColumn ||
nLeft != static_cast<const SvxColumnItem&>(rCmp).nLeft ||
nRight != static_cast<const SvxColumnItem&>(rCmp).nRight ||
bTable != static_cast<const SvxColumnItem&>(rCmp).bTable ||
Count() != static_cast<const SvxColumnItem&>(rCmp).Count())
return false;
const sal_uInt16 nCount = static_cast<const SvxColumnItem&>(rCmp).Count();
for(sal_uInt16 i = 0; i < nCount;++i)
{
if( (*this)[i] != static_cast<const SvxColumnItem&>(rCmp)[i] )
return false;
}
return true;
}
SvxColumnItem::SvxColumnItem( sal_uInt16 nAct ) :
SfxPoolItem (SID_RULER_BORDERS),
nLeft (0),
nRight (0),
nActColumn (nAct),
bTable (false),
bOrtho (true)
{}
SvxColumnItem::SvxColumnItem( sal_uInt16 nActCol, sal_uInt16 left, sal_uInt16 right ) :
SfxPoolItem (SID_RULER_BORDERS),
nLeft (left),
nRight (right),
nActColumn (nActCol),
bTable (true),
bOrtho (true)
{}
SvxColumnItem::SvxColumnItem( const SvxColumnItem& rCopy ) :
SfxPoolItem (rCopy),
nLeft (rCopy.nLeft),
nRight (rCopy.nRight),
nActColumn (rCopy.nActColumn),
bTable (rCopy.bTable),
bOrtho (rCopy.bOrtho)
{
aColumns.resize(rCopy.aColumns.size());
std::copy(rCopy.aColumns.begin(), rCopy.aColumns.end(), aColumns.begin());
}
SvxColumnItem::~SvxColumnItem()
{}
bool SvxColumnItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreUnit*/,
MapUnit /*ePresUnit*/,
OUString& /*rText*/,
const IntlWrapper* /*pWrapper*/ ) const
{
return false;
}
SfxPoolItem* SvxColumnItem::Clone(SfxItemPool* /*pPool*/) const
{
return new SvxColumnItem(*this);
}
SvxColumnItem& SvxColumnItem::operator=(const SvxColumnItem& rCopy)
{
nLeft = rCopy.nLeft;
nRight = rCopy.nRight;
bTable = rCopy.bTable;
nActColumn = rCopy.nActColumn;
aColumns.resize(rCopy.aColumns.size());
std::copy(rCopy.aColumns.begin(), rCopy.aColumns.end(), aColumns.begin());
return *this;
}
bool SvxColumnItem::CalcOrtho() const
{
const sal_uInt16 nCount = Count();
DBG_ASSERT(nCount >= 2, "no columns");
if(nCount < 2)
return false;
long nColWidth = (*this)[0].GetWidth();
for(sal_uInt16 i = 1; i < nCount; ++i) {
if( (*this)[i].GetWidth() != nColWidth)
return false;
}
//!! Wide divider
return true;
}
bool SvxColumnItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
{
nMemberId &= ~CONVERT_TWIPS;
switch ( nMemberId )
{
case MID_COLUMNARRAY:
return false;
case MID_RIGHT:
rVal <<= nRight;
break;
case MID_LEFT:
rVal <<= nLeft;
break;
case MID_ORTHO:
rVal <<= bOrtho;
break;
case MID_ACTUAL:
rVal <<= (sal_Int32) nActColumn;
break;
case MID_TABLE:
rVal <<= bTable;
break;
default:
// SfxDispatchController_Impl::StateChanged calls this with hardcoded 0 triggering this;
OSL_FAIL("Wrong MemberId!");
return false;
}
return true;
}
bool SvxColumnItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
{
nMemberId &= ~CONVERT_TWIPS;
sal_Int32 nVal = 0;
switch ( nMemberId )
{
case MID_COLUMNARRAY:
{
return false;
}
case MID_RIGHT:
rVal >>= nRight;
break;
case MID_LEFT:
rVal >>= nLeft;
break;
case MID_ORTHO:
rVal >>= nVal;
bOrtho = (bool) nVal;
break;
case MID_ACTUAL:
rVal >>= nVal;
nActColumn = (sal_uInt16) nVal;
break;
case MID_TABLE:
rVal >>= nVal;
bTable = (bool) nVal;
break;
default:
OSL_FAIL("Wrong MemberId!");
return false;
}
return true;
}
sal_uInt16 SvxColumnItem::Count() const
{
return aColumns.size();
}
SvxColumnDescription& SvxColumnItem::At(sal_uInt16 index)
{
return aColumns[index];
}
SvxColumnDescription& SvxColumnItem::GetActiveColumnDescription()
{
return aColumns[GetActColumn()];
}
SvxColumnDescription& SvxColumnItem::operator[](sal_uInt16 index)
{
return aColumns[index];
}
const SvxColumnDescription& SvxColumnItem::operator[](sal_uInt16 index) const
{
return aColumns[index];
}
void SvxColumnItem::Insert(const SvxColumnDescription &rDesc, sal_uInt16 nPos)
{
aColumns.insert(aColumns.begin() + nPos, rDesc);
}
void SvxColumnItem::Append(const SvxColumnDescription &rDesc)
{
Insert(rDesc, Count());
}
void SvxColumnItem::SetLeft(long left)
{
nLeft = left;
}
void SvxColumnItem::SetRight(long right)
{
nRight = right;
}
bool SvxColumnItem::IsFirstAct() const
{
return nActColumn == 0;
}
bool SvxColumnItem::IsLastAct() const
{
return nActColumn == Count() - 1;
}
SvxColumnDescription::SvxColumnDescription() :
nStart (0),
nEnd (0),
bVisible (true),
nEndMin (0),
nEndMax (0)
{}
SvxColumnDescription::SvxColumnDescription(const SvxColumnDescription &rCopy) :
nStart (rCopy.nStart),
nEnd (rCopy.nEnd),
bVisible (rCopy.bVisible),
nEndMin (rCopy.nEndMin),
nEndMax (rCopy.nEndMax)
{}
SvxColumnDescription::SvxColumnDescription(long start, long end, bool bVis) :
nStart (start),
nEnd (end),
bVisible (bVis),
nEndMin (0),
nEndMax (0)
{}
SvxColumnDescription::SvxColumnDescription(long start, long end, long endMin, long endMax, bool bVis) :
nStart (start),
nEnd (end),
bVisible (bVis),
// fdo#85858 hack: clamp these to smaller value to prevent overflow
nEndMin(std::min<long>(endMin, std::numeric_limits<unsigned short>::max())),
nEndMax(std::min<long>(endMax, std::numeric_limits<unsigned short>::max()))
{}
bool SvxColumnDescription::operator==(const SvxColumnDescription& rCmp) const
{
return nStart == rCmp.nStart
&& bVisible == rCmp.bVisible
&& nEnd == rCmp.nEnd
&& nEndMin == rCmp.nEndMin
&& nEndMax == rCmp.nEndMax;
}
bool SvxColumnDescription::operator!=(const SvxColumnDescription& rCmp) const
{
return !operator==(rCmp);
}
long SvxColumnDescription::GetWidth() const
{
return nEnd - nStart;
}
/* SvxColumnItem */
void SvxColumnItem::SetOrtho(bool bVal)
{
bOrtho = bVal;
}
bool SvxColumnItem::IsConsistent() const
{
return nActColumn < aColumns.size();
}
bool SvxObjectItem::operator==( const SfxPoolItem& rCmp ) const
{
return SfxPoolItem::operator==(rCmp) &&
nStartX == static_cast<const SvxObjectItem&>(rCmp).nStartX &&
nEndX == static_cast<const SvxObjectItem&>(rCmp).nEndX &&
nStartY == static_cast<const SvxObjectItem&>(rCmp).nStartY &&
nEndY == static_cast<const SvxObjectItem&>(rCmp).nEndY &&
bLimits == static_cast<const SvxObjectItem&>(rCmp).bLimits;
}
bool SvxObjectItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreUnit*/,
MapUnit /*ePresUnit*/,
OUString& /*rText*/,
const IntlWrapper* /*pWrapper*/ ) const
{
return false;
}
SfxPoolItem* SvxObjectItem::Clone(SfxItemPool *) const
{
return new SvxObjectItem(*this);
}
SvxObjectItem::SvxObjectItem( long nSX, long nEX,
long nSY, long nEY ) :
SfxPoolItem (SID_RULER_OBJECT),
nStartX (nSX),
nEndX (nEX),
nStartY (nSY),
nEndY (nEY),
bLimits (false)
{}
SvxObjectItem::SvxObjectItem( const SvxObjectItem& rCopy ) :
SfxPoolItem (rCopy),
nStartX (rCopy.nStartX),
nEndX (rCopy.nEndX),
nStartY (rCopy.nStartY),
nEndY (rCopy.nEndY),
bLimits (rCopy.bLimits)
{}
bool SvxObjectItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
{
nMemberId &= ~CONVERT_TWIPS;
switch (nMemberId)
{
case MID_START_X:
rVal <<= nStartX;
break;
case MID_START_Y:
rVal <<= nStartY;
break;
case MID_END_X:
rVal <<= nEndX;
break;
case MID_END_Y:
rVal <<= nEndY;
break;
case MID_LIMIT:
rVal <<= bLimits;
break;
default:
OSL_FAIL( "Wrong MemberId" );
return false;
}
return true;
}
bool SvxObjectItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
{
nMemberId &= ~CONVERT_TWIPS;
bool bRet = false;
switch (nMemberId)
{
case MID_START_X:
bRet = (rVal >>= nStartX);
break;
case MID_START_Y:
bRet = (rVal >>= nStartY);
break;
case MID_END_X:
bRet = (rVal >>= nEndX);
break;
case MID_END_Y:
bRet = (rVal >>= nEndY);
break;
case MID_LIMIT:
bRet = (rVal >>= bLimits);
break;
default: OSL_FAIL( "Wrong MemberId" );
}
return bRet;
}
void SvxObjectItem::SetStartX(long lValue)
{
nStartX = lValue;
}
void SvxObjectItem::SetEndX(long lValue)
{
nEndX = lValue;
}
void SvxObjectItem::SetStartY(long lValue)
{
nStartY = lValue;
}
void SvxObjectItem::SetEndY(long lValue)
{
nEndY = lValue;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|