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
27 // include ---------------------------------------------------------------
28 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
29 #include <com/sun/star/drawing/Hatch.hpp>
30 #include <com/sun/star/drawing/LineStyle.hpp>
31 #include <com/sun/star/drawing/LineDash.hpp>
32 #include <com/sun/star/drawing/DashStyle.hpp>
33 #include <com/sun/star/awt/Point.hpp>
34 #include <com/sun/star/drawing/PointSequence.hpp>
35 #include <com/sun/star/drawing/FillStyle.hpp>
36 #include <com/sun/star/awt/Gradient.hpp>
37 #include <com/sun/star/uno/Sequence.hxx>
38 #include <com/sun/star/beans/PropertyValue.hpp>
39 #include <svl/itempool.hxx>
40 #include <editeng/memberids.hrc>
41 #include <tools/stream.hxx>
42
43 #include "svx/unoapi.hxx"
44 #include <svl/style.hxx>
45 #include "unopolyhelper.hxx"
46
47 #include <tools/bigint.hxx>
48 #include <svl/itemset.hxx>
49 #include <svx/dialogs.hrc>
50 #include "svx/svdstr.hrc"
51 #include "svx/xattr.hxx"
52 #include <svx/xtable.hxx>
53 #include <svx/dialmgr.hxx>
54 #include <editeng/itemtype.hxx>
55 #include <svx/xdef.hxx>
56 #include <svx/unomid.hxx>
57 #include <svx/svdmodel.hxx>
58 #include <basegfx/polygon/b2dpolygon.hxx>
59 #include <basegfx/point/b2dpoint.hxx>
60 #include <basegfx/vector/b2dvector.hxx>
61
62 #include <stdio.h>
63
64 using namespace ::rtl;
65 using namespace ::com::sun::star;
66
67 #define GLOBALOVERFLOW
68
69 #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
70 #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
71
72 /************************************************************************/
73
74 #define VCLTOSVCOL( rCol ) (sal_uInt16)((((sal_uInt16)(rCol))<<8)|(rCol))
75
76 /************************************************************************/
77
78 XubString aNameOrIndexEmptyString;
79
80 TYPEINIT1_AUTOFACTORY(NameOrIndex, SfxStringItem);
81
82 /*************************************************************************
83 |*
84 |*
85 |*
86 \*************************************************************************/
87
ScaleMetricValue(long nVal,long nMul,long nDiv)88 long ScaleMetricValue( long nVal, long nMul, long nDiv )
89 {
90 BigInt aVal( nVal );
91
92 aVal *= nMul;
93
94 if ( aVal.IsNeg() != ( nDiv < 0 ) )
95 aVal-=nDiv/2; // fuer korrektes Runden
96 else
97 aVal+=nDiv/2; // fuer korrektes Runden
98
99 aVal/=nDiv;
100
101 return long( aVal );
102 }
103
104 /*************************************************************************
105 |*
106 |* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, sal_Int32 nIndex)
107 |*
108 |* Beschreibung
109 |* Ersterstellung 14.11.94
110 |* Letzte Aenderung 14.11.94
111 |*
112 *************************************************************************/
113
NameOrIndex(sal_uInt16 _nWhich,sal_Int32 nIndex)114 NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, sal_Int32 nIndex) :
115 SfxStringItem(_nWhich, aNameOrIndexEmptyString),
116 nPalIndex(nIndex)
117 {
118 }
119
120 /*************************************************************************
121 |*
122 |* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, const String& rName)
123 |*
124 |* Beschreibung
125 |* Ersterstellung 14.11.94
126 |* Letzte Aenderung 14.11.94
127 |*
128 *************************************************************************/
129
NameOrIndex(sal_uInt16 _nWhich,const XubString & rName)130 NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, const XubString& rName) :
131 SfxStringItem(_nWhich, rName),
132 nPalIndex(-1)
133 {
134 }
135
136 /*************************************************************************
137 |*
138 |* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, SvStream& rIn)
139 |*
140 |* Beschreibung
141 |* Ersterstellung 14.11.94
142 |* Letzte Aenderung 14.11.94
143 |*
144 *************************************************************************/
145
NameOrIndex(sal_uInt16 _nWhich,SvStream & rIn)146 NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, SvStream& rIn) :
147 SfxStringItem(_nWhich, rIn)
148 {
149 rIn >> nPalIndex;
150 }
151
152 /*************************************************************************
153 |*
154 |* NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex)
155 |*
156 |* Beschreibung
157 |* Ersterstellung 14.11.94
158 |* Letzte Aenderung 14.11.94
159 |*
160 *************************************************************************/
161
NameOrIndex(const NameOrIndex & rNameOrIndex)162 NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex) :
163 SfxStringItem(rNameOrIndex),
164 nPalIndex(rNameOrIndex.nPalIndex)
165 {
166 }
167
168 /*************************************************************************
169 |*
170 |* int NameOrIndex::operator==(const SfxPoolItem& rItem) const
171 |*
172 |* Beschreibung
173 |* Ersterstellung 14.11.94
174 |* Letzte Aenderung 14.11.94
175 |*
176 *************************************************************************/
177
operator ==(const SfxPoolItem & rItem) const178 int NameOrIndex::operator==(const SfxPoolItem& rItem) const
179 {
180 return ( SfxStringItem::operator==(rItem) &&
181 ((const NameOrIndex&) rItem).nPalIndex == nPalIndex );
182 }
183
184 /*************************************************************************
185 |*
186 |* SfxPoolItem* NameOrIndex::Clone(SfxItemPool* pPool) const
187 |*
188 |* Beschreibung
189 |* Ersterstellung 14.11.94
190 |* Letzte Aenderung 14.11.94
191 |*
192 *************************************************************************/
193
Clone(SfxItemPool *) const194 SfxPoolItem* NameOrIndex::Clone(SfxItemPool* /*pPool*/) const
195 {
196
197 return new NameOrIndex(*this);
198 }
199
200 /*************************************************************************
201 |*
202 |* SfxPoolItem* NameOrIndex::Create(SvStream& rIn, sal_uInt16 nVer) const
203 |*
204 |* Beschreibung
205 |* Ersterstellung 14.11.94
206 |* Letzte Aenderung 14.11.94
207 |*
208 *************************************************************************/
209
Create(SvStream & rIn,sal_uInt16) const210 SfxPoolItem* NameOrIndex::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
211 {
212 return new NameOrIndex(Which(), rIn);
213 }
214
215 /*************************************************************************
216 |*
217 |* SvStream* NameOrIndex::Store(SvStream& rIn) const
218 |*
219 |* Beschreibung
220 |* Ersterstellung 14.11.94
221 |* Letzte Aenderung 14.11.94
222 |*
223 *************************************************************************/
224
Store(SvStream & rOut,sal_uInt16 nItemVersion) const225 SvStream& NameOrIndex::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
226 {
227 SfxStringItem::Store( rOut, nItemVersion );
228 rOut << nPalIndex;
229 return rOut;
230 }
231
232 /** this static checks if the given NameOrIndex item has a unique name for its value.
233 The returned String is a unique name for an item with this value in both given pools.
234 Argument pPool2 can be null.
235 If returned string equals NameOrIndex->GetName(), the name was already unique.
236 */
CheckNamedItem(const NameOrIndex * pCheckItem,const sal_uInt16 nWhich,const SfxItemPool * pPool1,const SfxItemPool *,SvxCompareValueFunc pCompareValueFunc,sal_uInt16 nPrefixResId,XPropertyList * pDefaults)237 String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* /*pPool2*/, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, XPropertyList* pDefaults )
238 {
239 sal_Bool bForceNew = sal_False;
240
241 String aUniqueName;
242 SvxUnogetInternalNameForItem( nWhich, pCheckItem->GetName(), aUniqueName );
243
244 // 2. if we have a name check if there is already an item with the
245 // same name in the documents pool with a different line end or start
246
247 if( aUniqueName.Len() && pPool1 )
248 {
249 const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich );
250
251 const NameOrIndex *pItem;
252 for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
253 {
254 pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate );
255
256 if( pItem && ( pItem->GetName() == pCheckItem->GetName() ) )
257 {
258 // if there is already an item with the same name and the same
259 // value its ok to set it
260 if( !pCompareValueFunc( pItem, pCheckItem ) )
261 {
262 // same name but different value, we need a new name for this item
263 aUniqueName = String();
264 bForceNew = sal_True;
265 }
266 break;
267 }
268 }
269 }
270
271 // if we have no name yet, find existing item with same conent or
272 // create a unique name
273 if( aUniqueName.Len() == 0 )
274 {
275 sal_Int32 nUserIndex = 1;
276 const ResId aRes(SVX_RES(nPrefixResId));
277 String aUser( aRes );
278 aUser += sal_Unicode( ' ' );
279
280 if( pDefaults )
281 {
282 const int nCount = pDefaults->Count();
283 int nIndex;
284 for( nIndex = 0; nIndex < nCount; nIndex++ )
285 {
286 XPropertyEntry* pEntry = pDefaults->Get( nIndex );
287 if( pEntry )
288 {
289 bool bFound = false;
290
291 switch( nWhich )
292 {
293 case XATTR_FILLBITMAP:
294 {
295 const GraphicObject& rGraphicObjectA(((XFillBitmapItem*)pCheckItem)->GetGraphicObject());
296 const GraphicObject& rGraphicObjectB(((XBitmapEntry*)pEntry)->GetGraphicObject());
297
298 bFound = (rGraphicObjectA == rGraphicObjectB);
299 break;
300 }
301 case XATTR_LINEDASH:
302 bFound = (((XLineDashItem*)pCheckItem)->GetDashValue() == ((XDashEntry*)pEntry) ->GetDash());
303 break;
304 case XATTR_LINESTART:
305 bFound = (((XLineStartItem*)pCheckItem)->GetLineStartValue() == ((XLineEndEntry*)pEntry)->GetLineEnd());
306 break;
307 case XATTR_LINEEND:
308 bFound = (((XLineEndItem*)pCheckItem)->GetLineEndValue() == ((XLineEndEntry*)pEntry)->GetLineEnd());
309 break;
310 case XATTR_FILLGRADIENT:
311 bFound = (((XFillGradientItem*)pCheckItem)->GetGradientValue() == ((XGradientEntry*)pEntry)->GetGradient());
312 break;
313 case XATTR_FILLHATCH:
314 bFound = (((XFillHatchItem*)pCheckItem)->GetHatchValue() == ((XHatchEntry*)pEntry)->GetHatch());
315 break;
316 }
317
318 if( bFound )
319 {
320 aUniqueName = pEntry->GetName();
321 break;
322 }
323 else
324 {
325 sal_Int32 nThisIndex = pEntry->GetName().Copy( aUser.Len() ).ToInt32();
326 if( nThisIndex >= nUserIndex )
327 nUserIndex = nThisIndex + 1;
328 }
329 }
330 }
331 }
332
333 if( (aUniqueName.Len() == 0) && pPool1 )
334 {
335 const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich );
336 const NameOrIndex *pItem;
337 for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
338 {
339 pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate );
340
341 if( pItem && pItem->GetName().Len() )
342 {
343 if( !bForceNew && pCompareValueFunc( pItem, pCheckItem ) )
344 return pItem->GetName();
345
346 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
347 {
348 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
349 if( nThisIndex >= nUserIndex )
350 nUserIndex = nThisIndex + 1;
351 }
352 }
353 }
354 aUniqueName = aUser;
355 aUniqueName += String::CreateFromInt32( nUserIndex );
356 }
357 }
358
359 return aUniqueName;
360 }
361
362 //*************************************************************************
363
364 // -------------------
365 // class XColorItem
366 // -------------------
367 TYPEINIT1_AUTOFACTORY(XColorItem, NameOrIndex);
368
369 /*************************************************************************
370 |*
371 |* XColorItem::XColorItem(sal_uInt16 nWhich, sal_Int32 nIndex, const Color& rTheColor)
372 |*
373 \************************************************************************/
374
XColorItem(sal_uInt16 _nWhich,sal_Int32 nIndex,const Color & rTheColor)375 XColorItem::XColorItem(sal_uInt16 _nWhich, sal_Int32 nIndex, const Color& rTheColor) :
376 NameOrIndex(_nWhich, nIndex),
377 aColor(rTheColor)
378 {
379 }
380
381 /*************************************************************************
382 |*
383 |* XColorItem::XColorItem(sal_uInt16 nWhich, const String& rName, const Color& rTheColor)
384 |*
385 \************************************************************************/
386
XColorItem(sal_uInt16 _nWhich,const XubString & rName,const Color & rTheColor)387 XColorItem::XColorItem(sal_uInt16 _nWhich, const XubString& rName, const Color& rTheColor) :
388 NameOrIndex(_nWhich, rName),
389 aColor(rTheColor)
390 {
391 }
392
393 /*************************************************************************
394 |*
395 |* XColorItem::XColorItem(const XColorItem& rItem)
396 |*
397 \************************************************************************/
398
XColorItem(const XColorItem & rItem)399 XColorItem::XColorItem(const XColorItem& rItem) :
400 NameOrIndex(rItem),
401 aColor(rItem.aColor)
402 {
403 }
404
405 /*************************************************************************
406 |*
407 |* XColorItem::XColorItem(sal_uInt16 nWhich, SvStream& rIn)
408 |*
409 \************************************************************************/
410
XColorItem(sal_uInt16 _nWhich,SvStream & rIn)411 XColorItem::XColorItem(sal_uInt16 _nWhich, SvStream& rIn) :
412 NameOrIndex(_nWhich, rIn)
413 {
414 if (!IsIndex())
415 {
416 rIn >> aColor;
417 }
418 }
419
420 /*************************************************************************
421 |*
422 |* XColorItem::Clone(SfxItemPool* pPool) const
423 |*
424 \************************************************************************/
425
Clone(SfxItemPool *) const426 SfxPoolItem* XColorItem::Clone(SfxItemPool* /*pPool*/) const
427 {
428 return new XColorItem(*this);
429 }
430
431 /*************************************************************************
432 |*
433 |* int XColorItem::operator==(const SfxPoolItem& rItem) const
434 |*
435 \************************************************************************/
436
operator ==(const SfxPoolItem & rItem) const437 int XColorItem::operator==(const SfxPoolItem& rItem) const
438 {
439 return ( NameOrIndex::operator==(rItem) &&
440 ((const XColorItem&) rItem).aColor == aColor );
441 }
442
443 /*************************************************************************
444 |*
445 |* SfxPoolItem* XColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
446 |*
447 \************************************************************************/
448
Create(SvStream & rIn,sal_uInt16) const449 SfxPoolItem* XColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
450 {
451 return new XColorItem(Which(), rIn);
452 }
453
454 /*************************************************************************
455 |*
456 |* SfxPoolItem* XColorItem::Store(SvStream& rOut) const
457 |*
458 \************************************************************************/
459
Store(SvStream & rOut,sal_uInt16 nItemVersion) const460 SvStream& XColorItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
461 {
462 NameOrIndex::Store( rOut, nItemVersion );
463
464 if ( !IsIndex() )
465 {
466 rOut << aColor;
467 }
468
469 return rOut;
470 }
471
472 /*************************************************************************
473 |*
474 |* const XColor& XColorItem::GetColorValue(const XColorList* pTable) const
475 |*
476 \************************************************************************/
477
GetColorValue() const478 const Color& XColorItem::GetColorValue() const
479 {
480 if(!IsIndex())
481 {
482 return aColor;
483 }
484
485 OSL_ENSURE(false, "Access to Indexed XColorItem needs to use the call which hands over a XColorListSharedPtr (!)");
486
487 return aColor;
488 }
489
GetColorValue(const XColorListSharedPtr aTable) const490 const Color& XColorItem::GetColorValue(const XColorListSharedPtr aTable) const
491 {
492 if(!IsIndex())
493 {
494 return aColor;
495 }
496
497 return aTable->GetColor(GetIndex())->GetColor();
498 }
499
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8) const500 sal_Bool XColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
501 {
502 rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
503 return sal_True;
504 }
505
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8)506 sal_Bool XColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
507 {
508 sal_Int32 nValue = 0;
509 rVal >>= nValue;
510 SetColorValue( nValue );
511
512 return sal_True;
513 }
514
515
516 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
517 // Linienattribute
518 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
519
520 //---------------------
521 // class XLineStyleItem
522 //---------------------
523 TYPEINIT1_AUTOFACTORY(XLineStyleItem, SfxEnumItem);
524
525 /*************************************************************************
526 |*
527 |* XLineStyleItem::XLineStyleItem(XLineStyle eTheLineStyle)
528 |*
529 |* Beschreibung
530 |* Ersterstellung 15.11.94
531 |* Letzte Aenderung 18.11.94
532 |*
533 *************************************************************************/
534
XLineStyleItem(XLineStyle eTheLineStyle)535 XLineStyleItem::XLineStyleItem(XLineStyle eTheLineStyle) :
536 SfxEnumItem(XATTR_LINESTYLE, sal::static_int_cast< sal_uInt16 >(eTheLineStyle))
537 {
538 }
539
540 /*************************************************************************
541 |*
542 |* XLineStyleItem::XLineStyleItem(SvStream& rIn)
543 |*
544 |* Beschreibung
545 |* Ersterstellung 15.11.94
546 |* Letzte Aenderung 15.11.94
547 |*
548 *************************************************************************/
549
XLineStyleItem(SvStream & rIn)550 XLineStyleItem::XLineStyleItem(SvStream& rIn) :
551 SfxEnumItem(XATTR_LINESTYLE, rIn)
552 {
553 }
554
555 /*************************************************************************
556 |*
557 |* XLineStyleItem::Clone(SfxItemPool* pPool) const
558 |*
559 |* Beschreibung
560 |* Ersterstellung 09.11.94
561 |* Letzte Aenderung 09.11.94
562 |*
563 *************************************************************************/
564
Clone(SfxItemPool *) const565 SfxPoolItem* XLineStyleItem::Clone(SfxItemPool* /*pPool*/) const
566 {
567 return new XLineStyleItem( *this );
568 }
569
570 /*************************************************************************
571 |*
572 |* SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const
573 |*
574 |* Beschreibung
575 |* Ersterstellung 15.11.94
576 |* Letzte Aenderung 15.11.94
577 |*
578 *************************************************************************/
579
Create(SvStream & rIn,sal_uInt16) const580 SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
581 {
582 return new XLineStyleItem(rIn);
583 }
584
585 //------------------------------------------------------------------------
586
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const587 SfxItemPresentation XLineStyleItem::GetPresentation
588 (
589 SfxItemPresentation ePres,
590 SfxMapUnit /*eCoreUnit*/,
591 SfxMapUnit /*ePresUnit*/,
592 XubString& rText, const IntlWrapper *
593 ) const
594 {
595 rText.Erase();
596
597 switch ( ePres )
598 {
599 case SFX_ITEM_PRESENTATION_NONE:
600 return ePres;
601 case SFX_ITEM_PRESENTATION_COMPLETE:
602 case SFX_ITEM_PRESENTATION_NAMELESS:
603 {
604 sal_uInt16 nId = 0;
605
606 switch( (sal_uInt16)GetValue() )
607 {
608 case XLINE_NONE:
609 nId = RID_SVXSTR_INVISIBLE;
610 break;
611 case XLINE_SOLID:
612 nId = RID_SVXSTR_SOLID;
613 break;
614 }
615
616 if ( nId )
617 rText = SVX_RESSTR( nId );
618 return ePres;
619 }
620 default:
621 return SFX_ITEM_PRESENTATION_NONE;
622 }
623 }
624
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8) const625 sal_Bool XLineStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
626 {
627 ::com::sun::star::drawing::LineStyle eLS = (::com::sun::star::drawing::LineStyle)GetValue();
628 rVal <<= eLS;
629 return sal_True;
630 }
631
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8)632 sal_Bool XLineStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
633 {
634 ::com::sun::star::drawing::LineStyle eLS;
635 if(!(rVal >>= eLS ))
636 {
637 // also try an int (for Basic)
638 sal_Int32 nLS = 0;
639 if(!(rVal >>= nLS))
640 return sal_False;
641 eLS = (::com::sun::star::drawing::LineStyle)nLS;
642 }
643
644 SetValue( sal::static_int_cast< sal_uInt16 >( eLS ) );
645 return sal_True;
646 }
647
648 //------------------------------------------------------------------------
649
GetValueCount() const650 sal_uInt16 XLineStyleItem::GetValueCount() const
651 {
652 return 3;
653 }
654
655
656 // ------------
657 // class XDash
658 // ------------
659 /*************************************************************************
660 |*
661 |* XDash::XDash(XDashStyle, sal_uInt16, sal_uIntPtr, sal_uInt16, sal_uIntPtr, sal_uIntPtr)
662 |*
663 |* Beschreibung
664 |* Ersterstellung 21.11.94
665 |* Letzte Aenderung 21.11.94
666 |*
667 *************************************************************************/
668
XDash(XDashStyle eTheDash,sal_uInt16 nTheDots,sal_uIntPtr nTheDotLen,sal_uInt16 nTheDashes,sal_uIntPtr nTheDashLen,sal_uIntPtr nTheDistance)669 XDash::XDash(XDashStyle eTheDash, sal_uInt16 nTheDots, sal_uIntPtr nTheDotLen,
670 sal_uInt16 nTheDashes, sal_uIntPtr nTheDashLen, sal_uIntPtr nTheDistance) :
671 eDash(eTheDash),
672 nDots(nTheDots),
673 nDotLen(nTheDotLen),
674 nDashes(nTheDashes),
675 nDashLen(nTheDashLen),
676 nDistance(nTheDistance)
677 {
678 }
679
680 /*************************************************************************
681 |*
682 |* int XDash::operator==(const SfxPoolItem& rItem) const
683 |*
684 |* Beschreibung
685 |* Ersterstellung 29.11.94
686 |* Letzte Aenderung 29.11.94
687 |*
688 *************************************************************************/
689
operator ==(const XDash & rDash) const690 bool XDash::operator==(const XDash& rDash) const
691 {
692 return ( eDash == rDash.eDash &&
693 nDots == rDash.nDots &&
694 nDotLen == rDash.nDotLen &&
695 nDashes == rDash.nDashes &&
696 nDashLen == rDash.nDashLen &&
697 nDistance == rDash.nDistance );
698 }
699
700 // XDash is translated into an array of doubles which describe the lengths of the
701 // dashes, dots and empty passages. It returns the complete length of the full DashDot
702 // sequence and fills the given vetor of doubles accordingly (also resizing, so deleting it).
703 static double SMALLEST_DASH_WIDTH(26.95);
CreateDotDashArray(::std::vector<double> & rDotDashArray,double fLineWidth) const704 double XDash::CreateDotDashArray(::std::vector< double >& rDotDashArray, double fLineWidth) const
705 {
706 double fFullDotDashLen(0.0);
707 const sal_uInt16 nNumDotDashArray = (GetDots() + GetDashes()) * 2;
708 rDotDashArray.resize( nNumDotDashArray, 0.0 );
709 sal_uInt16 a;
710 sal_uInt16 nIns(0);
711 double fDashDotDistance = (double)GetDistance();
712 double fSingleDashLen = (double)GetDashLen();
713 double fSingleDotLen = (double)GetDotLen();
714
715 if(GetDashStyle() == XDASH_RECTRELATIVE || GetDashStyle() == XDASH_ROUNDRELATIVE)
716 {
717 if(fLineWidth != 0.0)
718 {
719 double fFactor = fLineWidth / 100.0;
720
721 if(GetDashes())
722 {
723 if(GetDashLen())
724 {
725 // is a dash
726 fSingleDashLen *= fFactor;
727 }
728 else
729 {
730 // is a dot
731 fSingleDashLen = fLineWidth;
732 }
733 }
734
735 if(GetDots())
736 {
737 if(GetDotLen())
738 {
739 // is a dash
740 fSingleDotLen *= fFactor;
741 }
742 else
743 {
744 // is a dot
745 fSingleDotLen = fLineWidth;
746 }
747 }
748
749 if(GetDashes() || GetDots())
750 {
751 if(GetDistance())
752 {
753 fDashDotDistance *= fFactor;
754 }
755 else
756 {
757 fDashDotDistance = fLineWidth;
758 }
759 }
760 }
761 else
762 {
763 if(GetDashes())
764 {
765 if(GetDashLen())
766 {
767 // is a dash
768 fSingleDashLen = (SMALLEST_DASH_WIDTH * fSingleDashLen) / 100.0;
769 }
770 else
771 {
772 // is a dot
773 fSingleDashLen = SMALLEST_DASH_WIDTH;
774 }
775 }
776
777 if(GetDots())
778 {
779 if(GetDotLen())
780 {
781 // is a dash
782 fSingleDotLen = (SMALLEST_DASH_WIDTH * fSingleDotLen) / 100.0;
783 }
784 else
785 {
786 // is a dot
787 fSingleDotLen = SMALLEST_DASH_WIDTH;
788 }
789 }
790
791 if(GetDashes() || GetDots())
792 {
793 if(GetDistance())
794 {
795 // dash as distance
796 fDashDotDistance = (SMALLEST_DASH_WIDTH * fDashDotDistance) / 100.0;
797 }
798 else
799 {
800 // dot as distance
801 fDashDotDistance = SMALLEST_DASH_WIDTH;
802 }
803 }
804 }
805 }
806 else
807 {
808 // smallest dot size compare value
809 double fDotCompVal(fLineWidth != 0.0 ? fLineWidth : SMALLEST_DASH_WIDTH);
810
811 // absolute values
812 if(GetDashes())
813 {
814 if(GetDashLen())
815 {
816 // is a dash
817 if(fSingleDashLen < SMALLEST_DASH_WIDTH)
818 {
819 fSingleDashLen = SMALLEST_DASH_WIDTH;
820 }
821 }
822 else
823 {
824 // is a dot
825 if(fSingleDashLen < fDotCompVal)
826 {
827 fSingleDashLen = fDotCompVal;
828 }
829 }
830 }
831
832 if(GetDots())
833 {
834 if(GetDotLen())
835 {
836 // is a dash
837 if(fSingleDotLen < SMALLEST_DASH_WIDTH)
838 {
839 fSingleDotLen = SMALLEST_DASH_WIDTH;
840 }
841 }
842 else
843 {
844 // is a dot
845 if(fSingleDotLen < fDotCompVal)
846 {
847 fSingleDotLen = fDotCompVal;
848 }
849 }
850 }
851
852 if(GetDashes() || GetDots())
853 {
854 if(GetDistance())
855 {
856 // dash as distance
857 if(fDashDotDistance < SMALLEST_DASH_WIDTH)
858 {
859 fDashDotDistance = SMALLEST_DASH_WIDTH;
860 }
861 }
862 else
863 {
864 // dot as distance
865 if(fDashDotDistance < fDotCompVal)
866 {
867 fDashDotDistance = fDotCompVal;
868 }
869 }
870 }
871 }
872
873 for(a=0;a<GetDots();a++)
874 {
875 rDotDashArray[nIns++] = fSingleDotLen;
876 fFullDotDashLen += fSingleDotLen;
877 rDotDashArray[nIns++] = fDashDotDistance;
878 fFullDotDashLen += fDashDotDistance;
879 }
880
881 for(a=0;a<GetDashes();a++)
882 {
883 rDotDashArray[nIns++] = fSingleDashLen;
884 fFullDotDashLen += fSingleDashLen;
885 rDotDashArray[nIns++] = fDashDotDistance;
886 fFullDotDashLen += fDashDotDistance;
887 }
888
889 return fFullDotDashLen;
890 }
891
892 // -------------------
893 // class XLineDashItem
894 // -------------------
895 TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex);
896
897 /*************************************************************************
898 |*
899 |* XLineDashItem::XLineDashItem(sal_Int32 nIndex, const XDash& rTheDash)
900 |*
901 |* Beschreibung
902 |* Ersterstellung 15.11.94
903 |* Letzte Aenderung 15.11.94
904 |*
905 *************************************************************************/
906
XLineDashItem(sal_Int32 nIndex,const XDash & rTheDash)907 XLineDashItem::XLineDashItem(sal_Int32 nIndex, const XDash& rTheDash) :
908 NameOrIndex(XATTR_LINEDASH, nIndex),
909 aDash(rTheDash)
910 {
911 }
912
913 /*************************************************************************
914 |*
915 |* XLineDashItem::XLineDashItem(const String& rName, const XDash& rTheDash)
916 |*
917 |* Beschreibung
918 |* Ersterstellung 15.11.94
919 |* Letzte Aenderung 15.11.94
920 |*
921 *************************************************************************/
922
XLineDashItem(const XubString & rName,const XDash & rTheDash)923 XLineDashItem::XLineDashItem(const XubString& rName, const XDash& rTheDash) :
924 NameOrIndex(XATTR_LINEDASH, rName),
925 aDash(rTheDash)
926 {
927 }
928
929 /*************************************************************************
930 |*
931 |* XLineDashItem::XLineDashItem(const XLineDashItem& rItem)
932 |*
933 |* Beschreibung
934 |* Ersterstellung 15.11.94
935 |* Letzte Aenderung 15.11.94
936 |*
937 *************************************************************************/
938
XLineDashItem(const XLineDashItem & rItem)939 XLineDashItem::XLineDashItem(const XLineDashItem& rItem) :
940 NameOrIndex(rItem),
941 aDash(rItem.aDash)
942 {
943 }
944
945 /*************************************************************************
946 |*
947 |* XLineDashItem::XLineDashItem(SvStream& rIn)
948 |*
949 |* Beschreibung
950 |* Ersterstellung 15.11.94
951 |* Letzte Aenderung 15.11.94
952 |*
953 *************************************************************************/
954
XLineDashItem(SvStream & rIn)955 XLineDashItem::XLineDashItem(SvStream& rIn) :
956 NameOrIndex(XATTR_LINEDASH, rIn)
957 {
958 if (!IsIndex())
959 {
960 sal_uInt16 nSTemp;
961 sal_uInt32 nLTemp;
962 sal_Int32 nITemp;
963
964 rIn >> nITemp; aDash.SetDashStyle((XDashStyle)nITemp);
965 rIn >> nSTemp; aDash.SetDots(nSTemp);
966 rIn >> nLTemp; aDash.SetDotLen(nLTemp);
967 rIn >> nSTemp; aDash.SetDashes(nSTemp);
968 rIn >> nLTemp; aDash.SetDashLen(nLTemp);
969 rIn >> nLTemp; aDash.SetDistance(nLTemp);
970 }
971 }
972
973 //*************************************************************************
974
XLineDashItem(SfxItemPool *,const XDash & rTheDash)975 XLineDashItem::XLineDashItem(SfxItemPool* /*pPool*/, const XDash& rTheDash)
976 : NameOrIndex( XATTR_LINEDASH, -1 ),
977 aDash(rTheDash)
978 {
979 }
980
981 //*************************************************************************
982
XLineDashItem(SfxItemPool *)983 XLineDashItem::XLineDashItem(SfxItemPool* /*pPool*/)
984 : NameOrIndex(XATTR_LINEDASH, -1 )
985 {
986 }
987
988 /*************************************************************************
989 |*
990 |* XLineDashItem::Clone(SfxItemPool* pPool) const
991 |*
992 |* Beschreibung
993 |* Ersterstellung 15.11.94
994 |* Letzte Aenderung 15.11.94
995 |*
996 *************************************************************************/
997
Clone(SfxItemPool *) const998 SfxPoolItem* XLineDashItem::Clone(SfxItemPool* /*pPool*/) const
999 {
1000 return new XLineDashItem(*this);
1001 }
1002
1003 /*************************************************************************
1004 |*
1005 |* int XLineDashItem::operator==(const SfxPoolItem& rItem) const
1006 |*
1007 |* Beschreibung
1008 |* Ersterstellung 15.11.94
1009 |* Letzte Aenderung 15.11.94
1010 |*
1011 *************************************************************************/
1012
operator ==(const SfxPoolItem & rItem) const1013 int XLineDashItem::operator==(const SfxPoolItem& rItem) const
1014 {
1015 return ( NameOrIndex::operator==(rItem) &&
1016 aDash == ((const XLineDashItem&) rItem).aDash );
1017 }
1018
1019 /*************************************************************************
1020 |*
1021 |* SfxPoolItem* XLineDashItem::Create(SvStream& rIn, sal_uInt16 nVer) const
1022 |*
1023 |* Beschreibung
1024 |* Ersterstellung 15.11.94
1025 |* Letzte Aenderung 15.11.94
1026 |*
1027 *************************************************************************/
1028
Create(SvStream & rIn,sal_uInt16) const1029 SfxPoolItem* XLineDashItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
1030 {
1031 return new XLineDashItem(rIn);
1032 }
1033
1034 /*************************************************************************
1035 |*
1036 |* SfxPoolItem* XLineDashItem::Store(SvStream& rOut) const
1037 |*
1038 |* Beschreibung
1039 |* Ersterstellung 15.11.94
1040 |* Letzte Aenderung 15.11.94
1041 |*
1042 *************************************************************************/
1043
Store(SvStream & rOut,sal_uInt16 nItemVersion) const1044 SvStream& XLineDashItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
1045 {
1046 NameOrIndex::Store( rOut, nItemVersion );
1047
1048 if (!IsIndex())
1049 {
1050 rOut << (sal_Int32) aDash.GetDashStyle();
1051 rOut << aDash.GetDots();
1052 rOut << (sal_uInt32) aDash.GetDotLen();
1053 rOut << aDash.GetDashes();
1054 rOut << (sal_uInt32) aDash.GetDashLen();
1055 rOut << (sal_uInt32) aDash.GetDistance();
1056 }
1057
1058 return rOut;
1059 }
1060
1061 /*************************************************************************
1062 |*
1063 |* const XDash& XLineDashItem::GetValue(const XDashList* pTable) const
1064 |*
1065 |* Beschreibung
1066 |* Ersterstellung 15.11.94
1067 |* Letzte Aenderung 18.11.94
1068 |*
1069 *************************************************************************/
1070
GetDashValue(const XDashList * pTable) const1071 const XDash& XLineDashItem::GetDashValue(const XDashList* pTable) const // GetValue -> GetDashValue
1072 {
1073 if (!IsIndex())
1074 return aDash;
1075 else
1076 return pTable->GetDash(GetIndex())->GetDash();
1077 }
1078
1079 //------------------------------------------------------------------------
1080
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const1081 SfxItemPresentation XLineDashItem::GetPresentation
1082 (
1083 SfxItemPresentation ePres,
1084 SfxMapUnit /*eCoreUnit*/,
1085 SfxMapUnit /*ePresUnit*/,
1086 XubString& rText, const IntlWrapper *
1087 ) const
1088 {
1089 switch ( ePres )
1090 {
1091 case SFX_ITEM_PRESENTATION_NONE:
1092 rText.Erase();
1093 return ePres;
1094 case SFX_ITEM_PRESENTATION_NAMELESS:
1095 case SFX_ITEM_PRESENTATION_COMPLETE:
1096 rText = GetName();
1097 return ePres;
1098 default:
1099 return SFX_ITEM_PRESENTATION_NONE;
1100 }
1101 }
1102
1103 //------------------------------------------------------------------------
1104
HasMetrics() const1105 FASTBOOL XLineDashItem::HasMetrics() const
1106 {
1107 return sal_True;
1108 }
1109
1110 //------------------------------------------------------------------------
1111
ScaleMetrics(long nMul,long nDiv)1112 FASTBOOL XLineDashItem::ScaleMetrics(long nMul, long nDiv)
1113 {
1114 aDash.SetDotLen( ScaleMetricValue( aDash.GetDotLen(), nMul, nDiv ) );
1115 aDash.SetDashLen( ScaleMetricValue( aDash.GetDashLen(), nMul, nDiv ) );
1116 aDash.SetDistance( ScaleMetricValue( aDash.GetDistance(), nMul, nDiv ) );
1117 return sal_True;
1118 }
1119
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const1120 sal_Bool XLineDashItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
1121 {
1122 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1123 nMemberId &= ~CONVERT_TWIPS;
1124
1125 switch ( nMemberId )
1126 {
1127 case 0:
1128 {
1129 uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
1130
1131 ::com::sun::star::drawing::LineDash aLineDash;
1132
1133 const XDash& rXD = GetDashValue();
1134 aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle());
1135 aLineDash.Dots = rXD.GetDots();
1136 aLineDash.DotLen = rXD.GetDotLen();
1137 aLineDash.Dashes = rXD.GetDashes();
1138 aLineDash.DashLen = rXD.GetDashLen();
1139 aLineDash.Distance = rXD.GetDistance();
1140
1141 rtl::OUString aApiName;
1142 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
1143 aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
1144 aPropSeq[0].Value = uno::makeAny( aApiName );
1145 aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineDash" ));
1146 aPropSeq[1].Value = uno::makeAny( aLineDash );
1147 rVal = uno::makeAny( aPropSeq );
1148 break;
1149 }
1150
1151 case MID_NAME:
1152 {
1153 rtl::OUString aApiName;
1154 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
1155 rVal <<= aApiName;
1156 break;
1157 }
1158
1159 case MID_LINEDASH:
1160 {
1161 const XDash& rXD = GetDashValue();
1162
1163 ::com::sun::star::drawing::LineDash aLineDash;
1164
1165 aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle());
1166 aLineDash.Dots = rXD.GetDots();
1167 aLineDash.DotLen = rXD.GetDotLen();
1168 aLineDash.Dashes = rXD.GetDashes();
1169 aLineDash.DashLen = rXD.GetDashLen();
1170 aLineDash.Distance = rXD.GetDistance();
1171
1172 rVal <<= aLineDash;
1173 break;
1174 }
1175
1176 case MID_LINEDASH_STYLE:
1177 {
1178 const XDash& rXD = GetDashValue();
1179 rVal <<= (::com::sun::star::drawing::DashStyle)((sal_Int16)rXD.GetDashStyle());
1180 break;
1181 }
1182
1183 case MID_LINEDASH_DOTS:
1184 {
1185 const XDash& rXD = GetDashValue();
1186 rVal <<= rXD.GetDots();
1187 break;
1188 }
1189
1190 case MID_LINEDASH_DOTLEN:
1191 {
1192 const XDash& rXD = GetDashValue();
1193 rVal <<= rXD.GetDotLen();
1194 break;
1195 }
1196
1197 case MID_LINEDASH_DASHES:
1198 {
1199 const XDash& rXD = GetDashValue();
1200 rVal <<= rXD.GetDashes();
1201 break;
1202 }
1203
1204 case MID_LINEDASH_DASHLEN:
1205 {
1206 const XDash& rXD = GetDashValue();
1207 rVal <<= rXD.GetDashLen();
1208 break;
1209 }
1210
1211 case MID_LINEDASH_DISTANCE:
1212 {
1213 const XDash& rXD = GetDashValue();
1214 rVal <<= rXD.GetDistance();
1215 break;
1216 }
1217
1218 default: DBG_ERROR("Wrong MemberId!"); return sal_False;
1219 }
1220
1221 return sal_True;
1222 }
1223
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)1224 sal_Bool XLineDashItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
1225 {
1226 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1227 nMemberId &= ~CONVERT_TWIPS;
1228
1229 switch ( nMemberId )
1230 {
1231 case 0:
1232 {
1233 uno::Sequence< beans::PropertyValue > aPropSeq;
1234 ::com::sun::star::drawing::LineDash aLineDash;
1235 rtl::OUString aName;
1236 sal_Bool bLineDash( sal_False );
1237
1238 if ( rVal >>= aPropSeq )
1239 {
1240 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
1241 {
1242 if ( aPropSeq[n].Name.equalsAsciiL( "Name", 4 ))
1243 aPropSeq[n].Value >>= aName;
1244 else if ( aPropSeq[n].Name.equalsAsciiL( "LineDash", 8 ))
1245 {
1246 if ( aPropSeq[n].Value >>= aLineDash )
1247 bLineDash = sal_True;
1248 }
1249 }
1250
1251 SetName( aName );
1252 if ( bLineDash )
1253 {
1254 XDash aXDash;
1255
1256 aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style)));
1257 aXDash.SetDots(aLineDash.Dots);
1258 aXDash.SetDotLen(aLineDash.DotLen);
1259 aXDash.SetDashes(aLineDash.Dashes);
1260 aXDash.SetDashLen(aLineDash.DashLen);
1261 aXDash.SetDistance(aLineDash.Distance);
1262
1263 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1264 aXDash.SetDots(1);
1265
1266 SetDashValue( aXDash );
1267 }
1268
1269 return sal_True;
1270 }
1271
1272 return sal_False;
1273 }
1274
1275 case MID_NAME:
1276 {
1277 rtl::OUString aName;
1278 if (!(rVal >>= aName))
1279 return sal_False;
1280 SetName( aName );
1281 break;
1282 }
1283
1284 case MID_LINEDASH:
1285 {
1286 ::com::sun::star::drawing::LineDash aLineDash;
1287 if(!(rVal >>= aLineDash))
1288 return sal_False;
1289
1290 XDash aXDash;
1291
1292 aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style)));
1293 aXDash.SetDots(aLineDash.Dots);
1294 aXDash.SetDotLen(aLineDash.DotLen);
1295 aXDash.SetDashes(aLineDash.Dashes);
1296 aXDash.SetDashLen(aLineDash.DashLen);
1297 aXDash.SetDistance(aLineDash.Distance);
1298
1299 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1300 aXDash.SetDots(1);
1301
1302 SetDashValue( aXDash );
1303 break;
1304 }
1305
1306 case MID_LINEDASH_STYLE:
1307 {
1308 sal_Int16 nVal = sal_Int16();
1309 if(!(rVal >>= nVal))
1310 return sal_False;
1311
1312 XDash aXDash = GetDashValue();
1313 aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(nVal)));
1314
1315 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1316 aXDash.SetDots(1);
1317
1318 SetDashValue( aXDash );
1319
1320 break;
1321 }
1322
1323 case MID_LINEDASH_DOTS:
1324 case MID_LINEDASH_DASHES:
1325 {
1326 sal_Int16 nVal = sal_Int16();
1327 if(!(rVal >>= nVal))
1328 return sal_False;
1329
1330 XDash aXDash = GetDashValue();
1331 if ( nMemberId == MID_LINEDASH_DOTS )
1332 aXDash.SetDots( nVal );
1333 else
1334 aXDash.SetDashes( nVal );
1335
1336 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1337 aXDash.SetDots(1);
1338
1339 SetDashValue( aXDash );
1340 break;
1341 }
1342
1343 case MID_LINEDASH_DOTLEN:
1344 case MID_LINEDASH_DASHLEN:
1345 case MID_LINEDASH_DISTANCE:
1346 {
1347 sal_Int32 nVal = 0;
1348 if(!(rVal >>= nVal))
1349 return sal_False;
1350
1351 XDash aXDash = GetDashValue();
1352 if ( nMemberId == MID_LINEDASH_DOTLEN )
1353 aXDash.SetDotLen( nVal );
1354 else if ( nMemberId == MID_LINEDASH_DASHLEN )
1355 aXDash.SetDashLen( nVal );
1356 else
1357 aXDash.SetDistance( nVal );
1358
1359 if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
1360 aXDash.SetDots(1);
1361
1362 SetDashValue( aXDash );
1363 break;
1364 }
1365 }
1366
1367 return sal_True;
1368 }
1369
CompareValueFunc(const NameOrIndex * p1,const NameOrIndex * p2)1370 sal_Bool XLineDashItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
1371 {
1372 return ((XLineDashItem*)p1)->GetDashValue() == ((XLineDashItem*)p2)->GetDashValue();
1373 }
1374
checkForUniqueItem(SdrModel * pModel) const1375 XLineDashItem* XLineDashItem::checkForUniqueItem( SdrModel* pModel ) const
1376 {
1377 if( pModel )
1378 {
1379 const String aUniqueName = NameOrIndex::CheckNamedItem( this,
1380 XATTR_LINEDASH,
1381 &pModel->GetItemPool(),
1382 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
1383 XLineDashItem::CompareValueFunc,
1384 RID_SVXSTR_DASH11,
1385 pModel->GetDashListFromSdrModel().get() );
1386
1387 // if the given name is not valid, replace it!
1388 if( aUniqueName != GetName() )
1389 {
1390 return new XLineDashItem( aUniqueName, aDash );
1391 }
1392 }
1393
1394 return (XLineDashItem*)this;
1395 }
1396
1397 // -------------------
1398 // class XLineWidthItem
1399 // -------------------
1400 TYPEINIT1_AUTOFACTORY(XLineWidthItem, SfxMetricItem);
1401
1402 /*************************************************************************
1403 |*
1404 |* XLineWidthItem::XLineWidthItem(long nWidth)
1405 |*
1406 |* Beschreibung
1407 |* Ersterstellung 15.11.94
1408 |* Letzte Aenderung 18.11.94
1409 |*
1410 *************************************************************************/
1411
XLineWidthItem(long nWidth)1412 XLineWidthItem::XLineWidthItem(long nWidth) :
1413 SfxMetricItem(XATTR_LINEWIDTH, nWidth)
1414 {
1415 }
1416
1417 /*************************************************************************
1418 |*
1419 |* XLineWidthItem::XLineWidthItem(SvStream& rIn)
1420 |*
1421 |* Beschreibung
1422 |* Ersterstellung 15.11.94
1423 |* Letzte Aenderung 15.11.94
1424 |*
1425 *************************************************************************/
1426
XLineWidthItem(SvStream & rIn)1427 XLineWidthItem::XLineWidthItem(SvStream& rIn) :
1428 SfxMetricItem(XATTR_LINEWIDTH, rIn)
1429 {
1430 }
1431
1432 /*************************************************************************
1433 |*
1434 |* XLineWidthItem::Clone(SfxItemPool* pPool) const
1435 |*
1436 |* Beschreibung
1437 |* Ersterstellung 15.11.94
1438 |* Letzte Aenderung 15.11.94
1439 |*
1440 *************************************************************************/
1441
Clone(SfxItemPool *) const1442 SfxPoolItem* XLineWidthItem::Clone(SfxItemPool* /*pPool*/) const
1443 {
1444 return new XLineWidthItem(*this);
1445 }
1446
1447 /*************************************************************************
1448 |*
1449 |* SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, sal_uInt16 nVer) const
1450 |*
1451 |* Beschreibung
1452 |* Ersterstellung 15.11.94
1453 |* Letzte Aenderung 15.11.94
1454 |*
1455 *************************************************************************/
1456
Create(SvStream & rIn,sal_uInt16) const1457 SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
1458 {
1459 return new XLineWidthItem(rIn);
1460 }
1461
1462 //------------------------------------------------------------------------
1463
GetPresentation(SfxItemPresentation ePres,SfxMapUnit eCoreUnit,SfxMapUnit ePresUnit,XubString & rText,const IntlWrapper * pIntl) const1464 SfxItemPresentation XLineWidthItem::GetPresentation
1465 (
1466 SfxItemPresentation ePres,
1467 SfxMapUnit eCoreUnit,
1468 SfxMapUnit ePresUnit,
1469 XubString& rText, const IntlWrapper * pIntl
1470 ) const
1471 {
1472 switch ( ePres )
1473 {
1474 case SFX_ITEM_PRESENTATION_NONE:
1475 rText.Erase();
1476 return ePres;
1477 case SFX_ITEM_PRESENTATION_NAMELESS:
1478 case SFX_ITEM_PRESENTATION_COMPLETE:
1479 rText = GetMetricText( (long) GetValue(),
1480 eCoreUnit, ePresUnit, pIntl);
1481 rText += sal_Unicode(' ');
1482 rText += SVX_RESSTR( GetMetricId( ePresUnit) );
1483 return ePres;
1484 default:
1485 return SFX_ITEM_PRESENTATION_NONE;
1486 }
1487 }
1488
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const1489 sal_Bool XLineWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
1490 {
1491 sal_Int32 nValue = GetValue();
1492 if( 0 != (nMemberId&CONVERT_TWIPS) )
1493 nValue = TWIP_TO_MM100(nValue);
1494
1495 rVal <<= nValue;
1496 return sal_True;
1497 }
1498
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)1499 sal_Bool XLineWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
1500 {
1501 sal_Int32 nValue = 0;
1502 rVal >>= nValue;
1503 if( 0 != (nMemberId&CONVERT_TWIPS) )
1504 nValue = MM100_TO_TWIP(nValue);
1505
1506 SetValue( nValue );
1507 return sal_True;
1508 }
1509
1510 // -------------------
1511 // class XLineColorItem
1512 // -------------------
1513 TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem);
1514
1515 /*************************************************************************
1516 |*
1517 |* XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor)
1518 |*
1519 |* Beschreibung
1520 |* Ersterstellung 15.11.94
1521 |* Letzte Aenderung 15.11.94
1522 |*
1523 *************************************************************************/
1524
XLineColorItem(sal_Int32 nIndex,const Color & rTheColor)1525 XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor) :
1526 XColorItem(XATTR_LINECOLOR, nIndex, rTheColor)
1527 {
1528 }
1529
1530 /*************************************************************************
1531 |*
1532 |* XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor)
1533 |*
1534 |* Beschreibung
1535 |* Ersterstellung 15.11.94
1536 |* Letzte Aenderung 15.11.94
1537 |*
1538 *************************************************************************/
1539
XLineColorItem(const XubString & rName,const Color & rTheColor)1540 XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor) :
1541 XColorItem(XATTR_LINECOLOR, rName, rTheColor)
1542 {
1543 }
1544
1545 /*************************************************************************
1546 |*
1547 |* XLineColorItem::XLineColorItem(SvStream& rIn)
1548 |*
1549 |* Beschreibung
1550 |* Ersterstellung 15.11.94
1551 |* Letzte Aenderung 15.11.94
1552 |*
1553 *************************************************************************/
1554
XLineColorItem(SvStream & rIn)1555 XLineColorItem::XLineColorItem(SvStream& rIn) :
1556 XColorItem(XATTR_LINECOLOR, rIn)
1557 {
1558 }
1559
1560 /*************************************************************************
1561 |*
1562 |* XLineColorItem::Clone(SfxItemPool* pPool) const
1563 |*
1564 |* Beschreibung
1565 |* Ersterstellung 15.11.94
1566 |* Letzte Aenderung 15.11.94
1567 |*
1568 *************************************************************************/
1569
Clone(SfxItemPool *) const1570 SfxPoolItem* XLineColorItem::Clone(SfxItemPool* /*pPool*/) const
1571 {
1572 return new XLineColorItem(*this);
1573 }
1574
1575 /*************************************************************************
1576 |*
1577 |* SfxPoolItem* XLineColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
1578 |*
1579 |* Beschreibung
1580 |* Ersterstellung 15.11.94
1581 |* Letzte Aenderung 15.11.94
1582 |*
1583 *************************************************************************/
1584
Create(SvStream & rIn,sal_uInt16) const1585 SfxPoolItem* XLineColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
1586 {
1587 return new XLineColorItem(rIn);
1588 }
1589
1590 //------------------------------------------------------------------------
1591
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const1592 SfxItemPresentation XLineColorItem::GetPresentation
1593 (
1594 SfxItemPresentation ePres,
1595 SfxMapUnit /*eCoreUnit*/,
1596 SfxMapUnit /*ePresUnit*/,
1597 XubString& rText, const IntlWrapper *
1598 ) const
1599 {
1600 switch ( ePres )
1601 {
1602 case SFX_ITEM_PRESENTATION_NONE:
1603 rText.Erase();
1604 return ePres;
1605 case SFX_ITEM_PRESENTATION_NAMELESS:
1606 case SFX_ITEM_PRESENTATION_COMPLETE:
1607 rText = GetName();
1608 return ePres;
1609 default:
1610 return SFX_ITEM_PRESENTATION_NONE;
1611 }
1612 }
1613
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8) const1614 sal_Bool XLineColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
1615 {
1616 rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
1617 return sal_True;
1618 }
1619
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8)1620 sal_Bool XLineColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
1621 {
1622 sal_Int32 nValue = 0;
1623 if(!(rVal >>= nValue))
1624 return sal_False;
1625
1626 SetColorValue( nValue );
1627 return sal_True;
1628 }
1629
1630 //////////////////////////////////////////////////////////////////////////////
1631 // tooling for simple spooling B2DPolygon to file and back
1632
1633 namespace
1634 {
streamOutB2DPolyPolygon(const basegfx::B2DPolyPolygon & rPolyPolygon,SvStream & rOut)1635 void streamOutB2DPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, SvStream& rOut)
1636 {
1637 const sal_uInt32 nPolygonCount(rPolyPolygon.count());
1638 rOut << nPolygonCount;
1639
1640 for(sal_uInt32 a(0L); a < nPolygonCount; a++)
1641 {
1642 const basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(a));
1643 const sal_uInt32 nPointCount(aCandidate.count());
1644 const sal_uInt8 bClosed(aCandidate.isClosed() ? 1 : 0);
1645 const sal_uInt8 bControlPoints(aCandidate.areControlPointsUsed() ? 1 : 0);
1646 rOut << nPointCount;
1647 rOut << bClosed;
1648 rOut << bControlPoints;
1649
1650 for(sal_uInt32 b(0L); b < nPointCount; b++)
1651 {
1652 const basegfx::B2DPoint aPoint(aCandidate.getB2DPoint(b));
1653 rOut << aPoint.getX();
1654 rOut << aPoint.getY();
1655
1656 if(bControlPoints)
1657 {
1658 const sal_uInt8 bEdgeIsCurve(aCandidate.isPrevControlPointUsed(b) || aCandidate.isNextControlPointUsed(b) ? 1 : 0);
1659 rOut << bEdgeIsCurve;
1660
1661 if(bEdgeIsCurve)
1662 {
1663 const basegfx::B2DVector aControlVectorA(aCandidate.getPrevControlPoint(b));
1664 rOut << aControlVectorA.getX();
1665 rOut << aControlVectorA.getY();
1666
1667 const basegfx::B2DVector aControlVectorB(aCandidate.getNextControlPoint(b));
1668 rOut << aControlVectorB.getX();
1669 rOut << aControlVectorB.getY();
1670 }
1671 }
1672 }
1673 }
1674 }
1675
streamInB2DPolyPolygon(SvStream & rIn)1676 basegfx::B2DPolyPolygon streamInB2DPolyPolygon(SvStream& rIn)
1677 {
1678 basegfx::B2DPolyPolygon aRetval;
1679 sal_uInt32 nPolygonCount;
1680 rIn >> nPolygonCount;
1681
1682 for(sal_uInt32 a(0L); a < nPolygonCount; a++)
1683 {
1684 sal_uInt32 nPointCount;
1685 sal_uInt8 bClosed;
1686 sal_uInt8 bControlPoints;
1687
1688 rIn >> nPointCount;
1689 rIn >> bClosed;
1690 rIn >> bControlPoints;
1691
1692 basegfx::B2DPolygon aCandidate;
1693 aCandidate.setClosed(0 != bClosed);
1694
1695 for(sal_uInt32 b(0L); b < nPointCount; b++)
1696 {
1697 double fX, fY;
1698 rIn >> fX;
1699 rIn >> fY;
1700 aCandidate.append(basegfx::B2DPoint(fX, fY));
1701
1702 if(0 != bControlPoints)
1703 {
1704 sal_uInt8 bEdgeIsCurve;
1705 rIn >> bEdgeIsCurve;
1706
1707 if(0 != bEdgeIsCurve)
1708 {
1709 rIn >> fX;
1710 rIn >> fY;
1711 aCandidate.setPrevControlPoint(b, basegfx::B2DVector(fX, fY));
1712
1713 rIn >> fX;
1714 rIn >> fY;
1715 aCandidate.setNextControlPoint(b, basegfx::B2DVector(fX, fY));
1716 }
1717 }
1718 }
1719
1720 aRetval.append(aCandidate);
1721 }
1722
1723 return aRetval;
1724 }
1725 }
1726
1727 //////////////////////////////////////////////////////////////////////////////
1728
1729 // -----------------------
1730 // class XLineStartItem
1731 // -----------------------
1732 TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex);
1733
1734 /*************************************************************************
1735 |*
1736 |* XLineStartItem::XLineStartItem(sal_Int32 nIndex)
1737 |*
1738 |* Beschreibung
1739 |* Ersterstellung 15.11.94
1740 |* Letzte Aenderung 18.11.94
1741 |*
1742 *************************************************************************/
1743
XLineStartItem(sal_Int32 nIndex)1744 XLineStartItem::XLineStartItem(sal_Int32 nIndex)
1745 : NameOrIndex(XATTR_LINESTART, nIndex)
1746 {
1747 }
1748
1749 /*************************************************************************
1750 |*
1751 |* XLineStartItem::XLineStartItem(const XubString& rName,
1752 |* const basegfx::B2DPolyPolygon& rXPolygon)
1753 |*
1754 |* Beschreibung
1755 |* Ersterstellung 15.11.94
1756 |* Letzte Aenderung 18.11.94
1757 |*
1758 *************************************************************************/
1759
XLineStartItem(const XubString & rName,const basegfx::B2DPolyPolygon & rPolyPolygon)1760 XLineStartItem::XLineStartItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
1761 : NameOrIndex(XATTR_LINESTART, rName),
1762 maPolyPolygon(rPolyPolygon)
1763 {
1764 }
1765
1766 /*************************************************************************
1767 |*
1768 |* XLineStartItem::XLineStartItem(const XLineStartItem& rItem)
1769 |*
1770 |* Beschreibung
1771 |* Ersterstellung 15.11.94
1772 |* Letzte Aenderung 17.11.94
1773 |*
1774 *************************************************************************/
1775
XLineStartItem(const XLineStartItem & rItem)1776 XLineStartItem::XLineStartItem(const XLineStartItem& rItem)
1777 : NameOrIndex(rItem),
1778 maPolyPolygon(rItem.maPolyPolygon)
1779 {
1780 }
1781
1782 /*************************************************************************
1783 |*
1784 |* XLineStartItem::XLineStartItem(SvStream& rIn)
1785 |*
1786 |* Beschreibung
1787 |* Ersterstellung 15.11.94
1788 |* Letzte Aenderung 17.11.94
1789 |*
1790 *************************************************************************/
1791
XLineStartItem(SvStream & rIn)1792 XLineStartItem::XLineStartItem(SvStream& rIn) :
1793 NameOrIndex(XATTR_LINESTART, rIn)
1794 {
1795 if (!IsIndex())
1796 {
1797 maPolyPolygon = streamInB2DPolyPolygon(rIn);
1798 }
1799 }
1800
1801 //*************************************************************************
1802
XLineStartItem(SfxItemPool *,const basegfx::B2DPolyPolygon & rPolyPolygon)1803 XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
1804 : NameOrIndex( XATTR_LINESTART, -1 ),
1805 maPolyPolygon(rPolyPolygon)
1806 {
1807 }
1808
1809 //*************************************************************************
1810
XLineStartItem(SfxItemPool *)1811 XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/)
1812 : NameOrIndex(XATTR_LINESTART, -1 )
1813 {
1814 }
1815
1816 /*************************************************************************
1817 |*
1818 |* XLineStartItem::Clone(SfxItemPool* pPool) const
1819 |*
1820 |* Beschreibung
1821 |* Ersterstellung 15.11.94
1822 |* Letzte Aenderung 15.11.94
1823 |*
1824 *************************************************************************/
1825
Clone(SfxItemPool *) const1826 SfxPoolItem* XLineStartItem::Clone(SfxItemPool* /*pPool*/) const
1827 {
1828 return new XLineStartItem(*this);
1829 }
1830
1831 /*************************************************************************
1832 |*
1833 |* int XLineStartItem::operator==(const SfxPoolItem& rItem) const
1834 |*
1835 |* Beschreibung
1836 |* Ersterstellung 15.11.94
1837 |* Letzte Aenderung 18.11.94
1838 |*
1839 *************************************************************************/
1840
operator ==(const SfxPoolItem & rItem) const1841 int XLineStartItem::operator==(const SfxPoolItem& rItem) const
1842 {
1843 return ( NameOrIndex::operator==(rItem) && ((const XLineStartItem&) rItem).maPolyPolygon == maPolyPolygon );
1844 }
1845
1846 /*************************************************************************
1847 |*
1848 |* SfxPoolItem* XLineStartItem::Create(SvStream& rIn, sal_uInt16 nVer) const
1849 |*
1850 |* Beschreibung
1851 |* Ersterstellung 15.11.94
1852 |* Letzte Aenderung 15.11.94
1853 |*
1854 *************************************************************************/
1855
Create(SvStream & rIn,sal_uInt16) const1856 SfxPoolItem* XLineStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
1857 {
1858 return new XLineStartItem(rIn);
1859 }
1860
1861 /*************************************************************************
1862 |*
1863 |* SfxPoolItem* XLineStartItem::Store(SvStream& rOut) const
1864 |*
1865 |* Beschreibung
1866 |* Ersterstellung 15.11.94
1867 |* Letzte Aenderung 18.11.94
1868 |*
1869 *************************************************************************/
1870
Store(SvStream & rOut,sal_uInt16 nItemVersion) const1871 SvStream& XLineStartItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
1872 {
1873 NameOrIndex::Store( rOut, nItemVersion );
1874
1875 if (!IsIndex())
1876 {
1877 streamOutB2DPolyPolygon(maPolyPolygon, rOut);
1878 }
1879
1880 return rOut;
1881 }
1882
1883 /*************************************************************************
1884 |*
1885 |* const basegfx::B2DPolyPolygon& XLineStartItem::GetValue(const XLineEndList* pTable)
1886 |* const
1887 |*
1888 |* Beschreibung
1889 |* Ersterstellung 15.11.94
1890 |* Letzte Aenderung 18.11.94
1891 |*
1892 *************************************************************************/
1893
GetLineStartValue(const XLineEndList * pTable) const1894 basegfx::B2DPolyPolygon XLineStartItem::GetLineStartValue(const XLineEndList* pTable) const
1895 {
1896 if (!IsIndex())
1897 {
1898 return maPolyPolygon;
1899 }
1900 else
1901 {
1902 return pTable->GetLineEnd(GetIndex())->GetLineEnd();
1903 }
1904 }
1905
1906 //------------------------------------------------------------------------
1907
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const1908 SfxItemPresentation XLineStartItem::GetPresentation
1909 (
1910 SfxItemPresentation ePres,
1911 SfxMapUnit /*eCoreUnit*/,
1912 SfxMapUnit /*ePresUnit*/,
1913 XubString& rText, const IntlWrapper *
1914 ) const
1915 {
1916 switch ( ePres )
1917 {
1918 case SFX_ITEM_PRESENTATION_NONE:
1919 rText.Erase();
1920 return ePres;
1921 case SFX_ITEM_PRESENTATION_NAMELESS:
1922 case SFX_ITEM_PRESENTATION_COMPLETE:
1923 rText = GetName();
1924 return ePres;
1925 default:
1926 return SFX_ITEM_PRESENTATION_NONE;
1927 }
1928 }
1929
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const1930 sal_Bool XLineStartItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
1931 {
1932 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1933 nMemberId &= ~CONVERT_TWIPS;
1934 if( nMemberId == MID_NAME )
1935 {
1936 rtl::OUString aApiName;
1937 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
1938 rVal <<= aApiName;
1939 }
1940 else
1941 {
1942 com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
1943 SvxConvertB2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
1944 rVal <<= aBezier;
1945 }
1946
1947 return sal_True;
1948 }
1949
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)1950 sal_Bool XLineStartItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
1951 {
1952 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1953 nMemberId &= ~CONVERT_TWIPS;
1954 if( nMemberId == MID_NAME )
1955 {
1956 return sal_False;
1957 }
1958 else
1959 {
1960 maPolyPolygon.clear();
1961
1962 if( rVal.hasValue() && rVal.getValue() )
1963 {
1964 if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
1965 return sal_False;
1966
1967 com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
1968 if( pCoords->Coordinates.getLength() > 0 )
1969 {
1970 maPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords );
1971 // #i72807# close line start/end polygons hard
1972 // maPolyPolygon.setClosed(true);
1973 }
1974 }
1975 }
1976
1977 return sal_True;
1978 }
1979
1980 /** this function searches in both the models pool and the styles pool for XLineStartItem
1981 and XLineEndItem with the same value or name and returns an item with the value of
1982 this item and a unique name for an item with this value. */
checkForUniqueItem(SdrModel * pModel) const1983 XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
1984 {
1985 if( pModel )
1986 {
1987 XLineStartItem* pTempItem = NULL;
1988 const XLineStartItem* pLineStartItem = this;
1989
1990 String aUniqueName( GetName() );
1991
1992 if( !maPolyPolygon.count() )
1993 {
1994 // if the polygon is empty, check if the name is empty
1995 if( aUniqueName.Len() == 0 )
1996 return (XLineStartItem*)this;
1997
1998 // force empty name for empty polygons
1999 return new XLineStartItem( String(), maPolyPolygon );
2000 }
2001
2002 if( maPolyPolygon.count() > 1L )
2003 {
2004 // check if the polygon is closed
2005 if(!maPolyPolygon.isClosed())
2006 {
2007 // force a closed polygon
2008 basegfx::B2DPolyPolygon aNew(maPolyPolygon);
2009 aNew.setClosed(true);
2010 pTempItem = new XLineStartItem( aUniqueName, aNew );
2011 pLineStartItem = pTempItem;
2012 }
2013 }
2014
2015 sal_Bool bForceNew = sal_False;
2016
2017 // 2. if we have a name check if there is already an item with the
2018 // same name in the documents pool with a different line end or start
2019
2020 sal_uInt32 nCount, nSurrogate;
2021
2022 const SfxItemPool* pPool1 = &pModel->GetItemPool();
2023 if( aUniqueName.Len() && pPool1 )
2024 {
2025 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
2026
2027 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2028 {
2029 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
2030
2031 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2032 {
2033 // if there is already an item with the same name and the same
2034 // value its ok to set it
2035 if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
2036 {
2037 // same name but different value, we need a new name for this item
2038 aUniqueName = String();
2039 bForceNew = sal_True;
2040 }
2041 break;
2042 }
2043 }
2044
2045 if( !bForceNew )
2046 {
2047 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
2048
2049 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2050 {
2051 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
2052
2053 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2054 {
2055 // if there is already an item with the same name and the same
2056 // value its ok to set it
2057 if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
2058 {
2059 // same name but different value, we need a new name for this item
2060 aUniqueName = String();
2061 bForceNew = sal_True;
2062 }
2063 break;
2064 }
2065 }
2066 }
2067 }
2068
2069 const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
2070 if( aUniqueName.Len() && pPool2)
2071 {
2072 nCount = pPool2->GetItemCount2( XATTR_LINESTART );
2073 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2074 {
2075 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate );
2076
2077 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2078 {
2079 // if there is already an item with the same name and the same
2080 // value its ok to set it
2081 if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
2082 {
2083 // same name but different value, we need a new name for this item
2084 aUniqueName = String();
2085 bForceNew = sal_True;
2086 }
2087 break;
2088 }
2089 }
2090
2091 if( !bForceNew )
2092 {
2093 nCount = pPool2->GetItemCount2( XATTR_LINEEND );
2094 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2095 {
2096 const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate );
2097
2098 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2099 {
2100 // if there is already an item with the same name and the same
2101 // value its ok to set it
2102 if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
2103 {
2104 // same name but different value, we need a new name for this item
2105 aUniqueName = String();
2106 bForceNew = sal_True;
2107 }
2108 break;
2109 }
2110 }
2111 }
2112 }
2113
2114 // if we have no name yet, find existing item with same conent or
2115 // create a unique name
2116 if( aUniqueName.Len() == 0 )
2117 {
2118 sal_Bool bFoundExisting = sal_False;
2119
2120 sal_Int32 nUserIndex = 1;
2121 const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
2122 const String aUser( aRes );
2123
2124 if( pPool1 )
2125 {
2126 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
2127 sal_uInt32 nSurrogate2;
2128
2129 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2130 {
2131 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
2132
2133 if( pItem && pItem->GetName().Len() )
2134 {
2135 if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() )
2136 {
2137 aUniqueName = pItem->GetName();
2138 bFoundExisting = sal_True;
2139 break;
2140 }
2141
2142 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2143 {
2144 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2145 if( nThisIndex >= nUserIndex )
2146 nUserIndex = nThisIndex + 1;
2147 }
2148 }
2149 }
2150
2151 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
2152 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2153 {
2154 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
2155
2156 if( pItem && pItem->GetName().Len() )
2157 {
2158 if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() )
2159 {
2160 aUniqueName = pItem->GetName();
2161 bFoundExisting = sal_True;
2162 break;
2163 }
2164
2165 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2166 {
2167 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2168 if( nThisIndex >= nUserIndex )
2169 nUserIndex = nThisIndex + 1;
2170 }
2171 }
2172 }
2173 }
2174
2175 if( !bFoundExisting )
2176 {
2177 aUniqueName = aUser;
2178 aUniqueName += sal_Unicode(' ');
2179 aUniqueName += String::CreateFromInt32( nUserIndex );
2180 }
2181 }
2182
2183 // if the given name is not valid, replace it!
2184 if( aUniqueName != GetName() || pTempItem )
2185 {
2186 if( pTempItem )
2187 {
2188 pTempItem->SetName( aUniqueName );
2189 return pTempItem;
2190 }
2191 else
2192 {
2193 return new XLineStartItem( aUniqueName, maPolyPolygon );
2194 }
2195 }
2196 }
2197
2198 return (XLineStartItem*)this;
2199 }
2200
2201 // ---------------------
2202 // class XLineEndItem
2203 // ---------------------
2204 TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex);
2205
2206 /*************************************************************************
2207 |*
2208 |* XLineEndItem::XLineEndItem(sal_Int32 nIndex)
2209 |*
2210 |* Beschreibung
2211 |* Ersterstellung 15.11.94
2212 |* Letzte Aenderung 18.11.94
2213 |*
2214 *************************************************************************/
2215
XLineEndItem(sal_Int32 nIndex)2216 XLineEndItem::XLineEndItem(sal_Int32 nIndex)
2217 : NameOrIndex(XATTR_LINEEND, nIndex)
2218 {
2219 }
2220
2221 /*************************************************************************
2222 |*
2223 |* XLineEndItem::XLineEndItem(const XubString& rName,
2224 |* const basegfx::B2DPolyPolygon& rXPolygon)
2225 |*
2226 |* Beschreibung
2227 |* Ersterstellung 15.11.94
2228 |* Letzte Aenderung 18.11.94
2229 |*
2230 *************************************************************************/
2231
XLineEndItem(const XubString & rName,const basegfx::B2DPolyPolygon & rPolyPolygon)2232 XLineEndItem::XLineEndItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
2233 : NameOrIndex(XATTR_LINEEND, rName),
2234 maPolyPolygon(rPolyPolygon)
2235 {
2236 }
2237
2238 /*************************************************************************
2239 |*
2240 |* XLineEndItem::XLineEndItem(const XLineEndItem& rItem)
2241 |*
2242 |* Beschreibung
2243 |* Ersterstellung 15.11.94
2244 |* Letzte Aenderung 18.11.94
2245 |*
2246 *************************************************************************/
2247
XLineEndItem(const XLineEndItem & rItem)2248 XLineEndItem::XLineEndItem(const XLineEndItem& rItem)
2249 : NameOrIndex(rItem),
2250 maPolyPolygon(rItem.maPolyPolygon)
2251 {
2252 }
2253
2254 /*************************************************************************
2255 |*
2256 |* XLineEndItem::XLineEndItem(SvStream& rIn)
2257 |*
2258 |* Beschreibung
2259 |* Ersterstellung 15.11.94
2260 |* Letzte Aenderung 17.11.94
2261 |*
2262 *************************************************************************/
2263
XLineEndItem(SvStream & rIn)2264 XLineEndItem::XLineEndItem(SvStream& rIn) :
2265 NameOrIndex(XATTR_LINEEND, rIn)
2266 {
2267 if (!IsIndex())
2268 {
2269 maPolyPolygon = streamInB2DPolyPolygon(rIn);
2270 }
2271 }
2272
2273 //*************************************************************************
2274
XLineEndItem(SfxItemPool *,const basegfx::B2DPolyPolygon & rPolyPolygon)2275 XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
2276 : NameOrIndex( XATTR_LINEEND, -1 ),
2277 maPolyPolygon(rPolyPolygon)
2278 {
2279 }
2280
2281 //*************************************************************************
2282
XLineEndItem(SfxItemPool *)2283 XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/)
2284 : NameOrIndex(XATTR_LINEEND, -1 )
2285 {
2286 }
2287
2288 /*************************************************************************
2289 |*
2290 |* XLineEndItem::Clone(SfxItemPool* pPool) const
2291 |*
2292 |* Beschreibung
2293 |* Ersterstellung 15.11.94
2294 |* Letzte Aenderung 15.11.94
2295 |*
2296 *************************************************************************/
2297
Clone(SfxItemPool *) const2298 SfxPoolItem* XLineEndItem::Clone(SfxItemPool* /*pPool*/) const
2299 {
2300 return new XLineEndItem(*this);
2301 }
2302
2303 /*************************************************************************
2304 |*
2305 |* int XLineEndItem::operator==(const SfxPoolItem& rItem) const
2306 |*
2307 |* Beschreibung
2308 |* Ersterstellung 15.11.94
2309 |* Letzte Aenderung 17.11.94
2310 |*
2311 *************************************************************************/
2312
operator ==(const SfxPoolItem & rItem) const2313 int XLineEndItem::operator==(const SfxPoolItem& rItem) const
2314 {
2315 return ( NameOrIndex::operator==(rItem) && ((const XLineEndItem&) rItem).maPolyPolygon == maPolyPolygon );
2316 }
2317
2318 /*************************************************************************
2319 |*
2320 |* SfxPoolItem* XLineEndItem::Create(SvStream& rIn, sal_uInt16 nVer) const
2321 |*
2322 |* Beschreibung
2323 |* Ersterstellung 15.11.94
2324 |* Letzte Aenderung 15.11.94
2325 |*
2326 *************************************************************************/
2327
Create(SvStream & rIn,sal_uInt16) const2328 SfxPoolItem* XLineEndItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2329 {
2330 return new XLineEndItem(rIn);
2331 }
2332
2333 /*************************************************************************
2334 |*
2335 |* SfxPoolItem* XLineEndItem::Store(SvStream& rOut) const
2336 |*
2337 |* Beschreibung
2338 |* Ersterstellung 15.11.94
2339 |* Letzte Aenderung 17.11.94
2340 |*
2341 *************************************************************************/
2342
Store(SvStream & rOut,sal_uInt16 nItemVersion) const2343 SvStream& XLineEndItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
2344 {
2345 NameOrIndex::Store( rOut, nItemVersion );
2346
2347 if (!IsIndex())
2348 {
2349 streamOutB2DPolyPolygon(maPolyPolygon, rOut);
2350 }
2351
2352 return rOut;
2353 }
2354
2355 /*************************************************************************
2356 |*
2357 |* const basegfx::B2DPolyPolygon& XLineEndItem::GetValue(const XLineEndList* pTable) const
2358 |*
2359 |* Beschreibung
2360 |* Ersterstellung 15.11.94
2361 |* Letzte Aenderung 18.11.94
2362 |*
2363 *************************************************************************/
2364
GetLineEndValue(const XLineEndList * pTable) const2365 basegfx::B2DPolyPolygon XLineEndItem::GetLineEndValue(const XLineEndList* pTable) const
2366 {
2367 if (!IsIndex())
2368 {
2369 return maPolyPolygon;
2370 }
2371 else
2372 {
2373 return pTable->GetLineEnd(GetIndex())->GetLineEnd();
2374 }
2375 }
2376
2377
2378 /** this function searches in both the models pool and the styles pool for XLineStartItem
2379 and XLineEndItem with the same value or name and returns an item with the value of
2380 this item and a unique name for an item with this value. */
checkForUniqueItem(SdrModel * pModel) const2381 XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
2382 {
2383 if( pModel )
2384 {
2385 XLineEndItem* pTempItem = NULL;
2386 const XLineEndItem* pLineEndItem = this;
2387
2388 String aUniqueName( GetName() );
2389
2390 if( !maPolyPolygon.count() )
2391 {
2392 // if the polygon is empty, check if the name is empty
2393 if( aUniqueName.Len() == 0 )
2394 return (XLineEndItem*)this;
2395
2396 // force empty name for empty polygons
2397 return new XLineEndItem( String(), maPolyPolygon );
2398 }
2399
2400 if( maPolyPolygon.count() > 1L )
2401 {
2402 // check if the polygon is closed
2403 if(!maPolyPolygon.isClosed())
2404 {
2405 // force a closed polygon
2406 basegfx::B2DPolyPolygon aNew(maPolyPolygon);
2407 aNew.setClosed(true);
2408 pTempItem = new XLineEndItem( aUniqueName, aNew );
2409 pLineEndItem = pTempItem;
2410 }
2411 }
2412
2413 sal_Bool bForceNew = sal_False;
2414
2415 // 2. if we have a name check if there is already an item with the
2416 // same name in the documents pool with a different line end or start
2417
2418 sal_uInt16 nCount, nSurrogate;
2419
2420 const SfxItemPool* pPool1 = &pModel->GetItemPool();
2421 if( aUniqueName.Len() && pPool1 )
2422 {
2423 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
2424
2425 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2426 {
2427 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
2428
2429 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2430 {
2431 // if there is already an item with the same name and the same
2432 // value its ok to set it
2433 if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
2434 {
2435 // same name but different value, we need a new name for this item
2436 aUniqueName = String();
2437 bForceNew = sal_True;
2438 }
2439 break;
2440 }
2441 }
2442
2443 if( !bForceNew )
2444 {
2445 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
2446
2447 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2448 {
2449 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
2450
2451 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2452 {
2453 // if there is already an item with the same name and the same
2454 // value its ok to set it
2455 if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
2456 {
2457 // same name but different value, we need a new name for this item
2458 aUniqueName = String();
2459 bForceNew = sal_True;
2460 }
2461 break;
2462 }
2463 }
2464 }
2465 }
2466
2467 const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
2468 if( aUniqueName.Len() && pPool2)
2469 {
2470 nCount = pPool2->GetItemCount2( XATTR_LINESTART );
2471 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2472 {
2473 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate );
2474
2475 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2476 {
2477 // if there is already an item with the same name and the same
2478 // value its ok to set it
2479 if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
2480 {
2481 // same name but different value, we need a new name for this item
2482 aUniqueName = String();
2483 bForceNew = sal_True;
2484 }
2485 break;
2486 }
2487 }
2488
2489 if( !bForceNew )
2490 {
2491 nCount = pPool2->GetItemCount2( XATTR_LINEEND );
2492 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2493 {
2494 const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate );
2495
2496 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2497 {
2498 // if there is already an item with the same name and the same
2499 // value its ok to set it
2500 if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
2501 {
2502 // same name but different value, we need a new name for this item
2503 aUniqueName = String();
2504 bForceNew = sal_True;
2505 }
2506 break;
2507 }
2508 }
2509 }
2510 }
2511
2512 // if we have no name yet, find existing item with same conent or
2513 // create a unique name
2514 if( aUniqueName.Len() == 0 )
2515 {
2516 sal_Bool bFoundExisting = sal_False;
2517
2518 sal_Int32 nUserIndex = 1;
2519 const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
2520 const String aUser( aRes );
2521
2522 if( pPool1 )
2523 {
2524 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
2525 sal_uInt32 nSurrogate2;
2526
2527 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2528 {
2529 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
2530
2531 if( pItem && pItem->GetName().Len() )
2532 {
2533 if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() )
2534 {
2535 aUniqueName = pItem->GetName();
2536 bFoundExisting = sal_True;
2537 break;
2538 }
2539
2540 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2541 {
2542 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2543 if( nThisIndex >= nUserIndex )
2544 nUserIndex = nThisIndex + 1;
2545 }
2546 }
2547 }
2548
2549 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
2550 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2551 {
2552 const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
2553
2554 if( pItem && pItem->GetName().Len() )
2555 {
2556 if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() )
2557 {
2558 aUniqueName = pItem->GetName();
2559 bFoundExisting = sal_True;
2560 break;
2561 }
2562
2563 if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2564 {
2565 sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2566 if( nThisIndex >= nUserIndex )
2567 nUserIndex = nThisIndex + 1;
2568 }
2569 }
2570 }
2571 }
2572
2573 if( !bFoundExisting )
2574 {
2575 aUniqueName = aUser;
2576 aUniqueName += sal_Unicode(' ');
2577 aUniqueName += String::CreateFromInt32( nUserIndex );
2578 }
2579 }
2580
2581 // if the given name is not valid, replace it!
2582 if( aUniqueName != GetName() || pTempItem )
2583 {
2584 if( pTempItem )
2585 {
2586 pTempItem->SetName( aUniqueName );
2587 return pTempItem;
2588 }
2589 else
2590 {
2591 return new XLineEndItem( aUniqueName, maPolyPolygon );
2592 }
2593 }
2594 }
2595
2596 return (XLineEndItem*)this;
2597 }
2598
2599
2600 //------------------------------------------------------------------------
2601
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const2602 SfxItemPresentation XLineEndItem::GetPresentation
2603 (
2604 SfxItemPresentation ePres,
2605 SfxMapUnit /*eCoreUnit*/,
2606 SfxMapUnit /*ePresUnit*/,
2607 XubString& rText, const IntlWrapper *
2608 ) const
2609 {
2610 switch ( ePres )
2611 {
2612 case SFX_ITEM_PRESENTATION_NONE:
2613 rText.Erase();
2614 return ePres;
2615 case SFX_ITEM_PRESENTATION_NAMELESS:
2616 case SFX_ITEM_PRESENTATION_COMPLETE:
2617 rText = GetName();
2618 return ePres;
2619 default:
2620 return SFX_ITEM_PRESENTATION_NONE;
2621 }
2622 }
2623
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const2624 sal_Bool XLineEndItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
2625 {
2626 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2627 nMemberId &= ~CONVERT_TWIPS;
2628 if( nMemberId == MID_NAME )
2629 {
2630 rtl::OUString aApiName;
2631 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
2632 rVal <<= aApiName;
2633 }
2634 else
2635 {
2636 com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
2637 SvxConvertB2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
2638 rVal <<= aBezier;
2639 }
2640 return sal_True;
2641 }
2642
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)2643 sal_Bool XLineEndItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
2644 {
2645 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2646 nMemberId &= ~CONVERT_TWIPS;
2647 if( nMemberId == MID_NAME )
2648 {
2649 return sal_False;
2650 }
2651 else
2652 {
2653 maPolyPolygon.clear();
2654
2655 if( rVal.hasValue() && rVal.getValue() )
2656 {
2657 if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
2658 return sal_False;
2659
2660 com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
2661 if( pCoords->Coordinates.getLength() > 0 )
2662 {
2663 maPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords );
2664 // #i72807# close line start/end polygons hard
2665 // maPolyPolygon.setClosed(true);
2666 }
2667 }
2668 }
2669
2670 return sal_True;
2671 }
2672
2673 // ----------------------------
2674 // class XLineStartWidthItem
2675 // ----------------------------
2676 TYPEINIT1_AUTOFACTORY(XLineStartWidthItem, SfxMetricItem);
2677
2678 /*************************************************************************
2679 |*
2680 |* XLineStartWidthItem::XLineStartWidthItem(sal_Int32 nWidth)
2681 |*
2682 |* Beschreibung
2683 |* Ersterstellung 15.11.94
2684 |* Letzte Aenderung 18.11.94
2685 |*
2686 *************************************************************************/
2687
XLineStartWidthItem(long nWidth)2688 XLineStartWidthItem::XLineStartWidthItem(long nWidth) :
2689 SfxMetricItem(XATTR_LINESTARTWIDTH, nWidth)
2690 {
2691 }
2692
2693 /*************************************************************************
2694 |*
2695 |* XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn)
2696 |*
2697 |* Beschreibung
2698 |* Ersterstellung 15.11.94
2699 |* Letzte Aenderung 15.11.94
2700 |*
2701 *************************************************************************/
2702
XLineStartWidthItem(SvStream & rIn)2703 XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn) :
2704 SfxMetricItem(XATTR_LINESTARTWIDTH, rIn)
2705 {
2706 }
2707
2708 /*************************************************************************
2709 |*
2710 |* XLineStartWidthItem::Clone(SfxItemPool* pPool) const
2711 |*
2712 |* Beschreibung
2713 |* Ersterstellung 15.11.94
2714 |* Letzte Aenderung 15.11.94
2715 |*
2716 *************************************************************************/
2717
Clone(SfxItemPool *) const2718 SfxPoolItem* XLineStartWidthItem::Clone(SfxItemPool* /*pPool*/) const
2719 {
2720 return new XLineStartWidthItem(*this);
2721 }
2722
2723 /*************************************************************************
2724 |*
2725 |* SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, sal_uInt16 nVer)
2726 |* const
2727 |*
2728 |* Beschreibung
2729 |* Ersterstellung 15.11.94
2730 |* Letzte Aenderung 15.11.94
2731 |*
2732 *************************************************************************/
2733
Create(SvStream & rIn,sal_uInt16) const2734 SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2735 {
2736 return new XLineStartWidthItem(rIn);
2737 }
2738
2739 //------------------------------------------------------------------------
2740
GetPresentation(SfxItemPresentation ePres,SfxMapUnit eCoreUnit,SfxMapUnit ePresUnit,XubString & rText,const IntlWrapper * pIntl) const2741 SfxItemPresentation XLineStartWidthItem::GetPresentation
2742 (
2743 SfxItemPresentation ePres,
2744 SfxMapUnit eCoreUnit,
2745 SfxMapUnit ePresUnit,
2746 XubString& rText, const IntlWrapper * pIntl
2747 ) const
2748 {
2749 switch ( ePres )
2750 {
2751 case SFX_ITEM_PRESENTATION_NONE:
2752 rText.Erase();
2753 return ePres;
2754 case SFX_ITEM_PRESENTATION_NAMELESS:
2755 case SFX_ITEM_PRESENTATION_COMPLETE:
2756 rText = GetMetricText( (long) GetValue(),
2757 eCoreUnit, ePresUnit, pIntl);
2758 rText += sal_Unicode(' ');
2759 rText += SVX_RESSTR( GetMetricId( ePresUnit) );
2760 return ePres;
2761 default:
2762 return SFX_ITEM_PRESENTATION_NONE;
2763 }
2764 }
2765
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8) const2766 sal_Bool XLineStartWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2767 {
2768 rVal <<= (sal_Int32)GetValue();
2769 return sal_True;
2770 }
2771
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8)2772 sal_Bool XLineStartWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2773 {
2774 sal_Int32 nValue = 0;
2775 rVal >>= nValue;
2776 SetValue( nValue );
2777 return sal_True;
2778 }
2779
2780
2781
2782 // --------------------------
2783 // class XLineEndWidthItem
2784 // --------------------------
2785 TYPEINIT1_AUTOFACTORY(XLineEndWidthItem, SfxMetricItem);
2786
2787 /*************************************************************************
2788 |*
2789 |* XLineEndWidthItem::XLineEndWidthItem(long nWidth)
2790 |*
2791 |* Beschreibung
2792 |* Ersterstellung 15.11.94
2793 |* Letzte Aenderung 15.11.94
2794 |*
2795 *************************************************************************/
2796
XLineEndWidthItem(long nWidth)2797 XLineEndWidthItem::XLineEndWidthItem(long nWidth) :
2798 SfxMetricItem(XATTR_LINEENDWIDTH, nWidth)
2799 {
2800 }
2801
2802 /*************************************************************************
2803 |*
2804 |* XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn)
2805 |*
2806 |* Beschreibung
2807 |* Ersterstellung 15.11.94
2808 |* Letzte Aenderung 15.11.94
2809 |*
2810 *************************************************************************/
2811
XLineEndWidthItem(SvStream & rIn)2812 XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn) :
2813 SfxMetricItem(XATTR_LINEENDWIDTH, rIn)
2814 {
2815 }
2816
2817 /*************************************************************************
2818 |*
2819 |* XLineEndWidthItem::Clone(SfxItemPool* pPool) const
2820 |*
2821 |* Beschreibung
2822 |* Ersterstellung 15.11.94
2823 |* Letzte Aenderung 15.11.94
2824 |*
2825 *************************************************************************/
2826
Clone(SfxItemPool *) const2827 SfxPoolItem* XLineEndWidthItem::Clone(SfxItemPool* /*pPool*/) const
2828 {
2829 return new XLineEndWidthItem(*this);
2830 }
2831
2832 /*************************************************************************
2833 |*
2834 |* SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, sal_uInt16 nVer) const
2835 |*
2836 |* Beschreibung
2837 |* Ersterstellung 15.11.94
2838 |* Letzte Aenderung 15.11.94
2839 |*
2840 *************************************************************************/
2841
Create(SvStream & rIn,sal_uInt16) const2842 SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2843 {
2844 return new XLineEndWidthItem(rIn);
2845 }
2846
2847 //------------------------------------------------------------------------
2848
GetPresentation(SfxItemPresentation ePres,SfxMapUnit eCoreUnit,SfxMapUnit ePresUnit,XubString & rText,const IntlWrapper * pIntl) const2849 SfxItemPresentation XLineEndWidthItem::GetPresentation
2850 (
2851 SfxItemPresentation ePres,
2852 SfxMapUnit eCoreUnit,
2853 SfxMapUnit ePresUnit,
2854 XubString& rText, const IntlWrapper *pIntl
2855 ) const
2856 {
2857 switch ( ePres )
2858 {
2859 case SFX_ITEM_PRESENTATION_NONE:
2860 rText.Erase();
2861 return ePres;
2862 case SFX_ITEM_PRESENTATION_NAMELESS:
2863 case SFX_ITEM_PRESENTATION_COMPLETE:
2864 rText = GetMetricText( (long) GetValue(),
2865 eCoreUnit, ePresUnit, pIntl);
2866 rText += sal_Unicode(' ');
2867 rText += SVX_RESSTR( GetMetricId( ePresUnit) );
2868 return ePres;
2869 default:
2870 return SFX_ITEM_PRESENTATION_NONE;
2871 }
2872 }
2873
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8) const2874 sal_Bool XLineEndWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2875 {
2876 rVal <<= (sal_Int32)GetValue();
2877 return sal_True;
2878 }
2879
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8)2880 sal_Bool XLineEndWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2881 {
2882 sal_Int32 nValue = 0;
2883 rVal >>= nValue;
2884 SetValue( nValue );
2885 return sal_True;
2886 }
2887
2888
2889 // -----------------------------
2890 // class XLineStartCenterItem
2891 // -----------------------------
2892 TYPEINIT1_AUTOFACTORY(XLineStartCenterItem, SfxBoolItem);
2893
2894 /*************************************************************************
2895 |*
2896 |* XLineStartCenterItem::XLineStartCenterItem(sal_Bool bStartCenter)
2897 |*
2898 |* Beschreibung
2899 |* Ersterstellung 15.11.94
2900 |* Letzte Aenderung 15.11.94
2901 |*
2902 *************************************************************************/
2903
XLineStartCenterItem(sal_Bool bStartCenter)2904 XLineStartCenterItem::XLineStartCenterItem(sal_Bool bStartCenter) :
2905 SfxBoolItem(XATTR_LINESTARTCENTER, bStartCenter)
2906 {
2907 }
2908
2909 /*************************************************************************
2910 |*
2911 |* XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn)
2912 |*
2913 |* Beschreibung
2914 |* Ersterstellung 15.11.94
2915 |* Letzte Aenderung 15.11.94
2916 |*
2917 *************************************************************************/
2918
XLineStartCenterItem(SvStream & rIn)2919 XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn) :
2920 SfxBoolItem(XATTR_LINESTARTCENTER, rIn)
2921 {
2922 }
2923
2924 /*************************************************************************
2925 |*
2926 |* XLineStartCenterItem::Clone(SfxItemPool* pPool) const
2927 |*
2928 |* Beschreibung
2929 |* Ersterstellung 15.11.94
2930 |* Letzte Aenderung 15.11.94
2931 |*
2932 *************************************************************************/
2933
Clone(SfxItemPool *) const2934 SfxPoolItem* XLineStartCenterItem::Clone(SfxItemPool* /*pPool*/) const
2935 {
2936 return new XLineStartCenterItem(*this);
2937 }
2938
2939 /*************************************************************************
2940 |*
2941 |* SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, sal_uInt16 nVer)
2942 |* const
2943 |*
2944 |* Beschreibung
2945 |* Ersterstellung 15.11.94
2946 |* Letzte Aenderung 15.11.94
2947 |*
2948 *************************************************************************/
2949
Create(SvStream & rIn,sal_uInt16) const2950 SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2951 {
2952 return new XLineStartCenterItem(rIn);
2953 }
2954
2955 //------------------------------------------------------------------------
2956
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const2957 SfxItemPresentation XLineStartCenterItem::GetPresentation
2958 (
2959 SfxItemPresentation ePres,
2960 SfxMapUnit /*eCoreUnit*/,
2961 SfxMapUnit /*ePresUnit*/,
2962 XubString& rText, const IntlWrapper *
2963 ) const
2964 {
2965 switch ( ePres )
2966 {
2967 case SFX_ITEM_PRESENTATION_NONE:
2968 rText.Erase();
2969 return ePres;
2970 case SFX_ITEM_PRESENTATION_NAMELESS:
2971 case SFX_ITEM_PRESENTATION_COMPLETE:
2972 rText = XubString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
2973 RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
2974 return ePres;
2975 default:
2976 return SFX_ITEM_PRESENTATION_NONE;
2977 }
2978 }
2979
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8) const2980 sal_Bool XLineStartCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2981 {
2982 sal_Bool bValue = GetValue();
2983 rVal.setValue( &bValue, ::getCppuBooleanType() );
2984 return sal_True;
2985 }
2986
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8)2987 sal_Bool XLineStartCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2988 {
2989 if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
2990 return sal_False;
2991
2992 SetValue( *(sal_Bool*)rVal.getValue() );
2993 return sal_True;
2994 }
2995
2996
2997 // ---------------------------
2998 // class XLineEndCenterItem
2999 // ---------------------------
3000 TYPEINIT1_AUTOFACTORY(XLineEndCenterItem, SfxBoolItem);
3001
3002 /*************************************************************************
3003 |*
3004 |* XLineEndCenterItem::XLineEndCenterItem(sal_Bool bEndCenter)
3005 |*
3006 |* Beschreibung
3007 |* Ersterstellung 15.11.94
3008 |* Letzte Aenderung 15.11.94
3009 |*
3010 *************************************************************************/
3011
XLineEndCenterItem(sal_Bool bEndCenter)3012 XLineEndCenterItem::XLineEndCenterItem(sal_Bool bEndCenter) :
3013 SfxBoolItem(XATTR_LINEENDCENTER, bEndCenter)
3014 {
3015 }
3016
3017 /*************************************************************************
3018 |*
3019 |* XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn)
3020 |*
3021 |* Beschreibung
3022 |* Ersterstellung 15.11.94
3023 |* Letzte Aenderung 15.11.94
3024 |*
3025 *************************************************************************/
3026
XLineEndCenterItem(SvStream & rIn)3027 XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn) :
3028 SfxBoolItem(XATTR_LINEENDCENTER, rIn)
3029 {
3030 }
3031
3032 /*************************************************************************
3033 |*
3034 |* XLineEndCenterItem::Clone(SfxItemPool* pPool) const
3035 |*
3036 |* Beschreibung
3037 |* Ersterstellung 15.11.94
3038 |* Letzte Aenderung 15.11.94
3039 |*
3040 *************************************************************************/
3041
Clone(SfxItemPool *) const3042 SfxPoolItem* XLineEndCenterItem::Clone(SfxItemPool* /*pPool*/) const
3043 {
3044 return new XLineEndCenterItem(*this);
3045 }
3046
3047 /*************************************************************************
3048 |*
3049 |* SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, sal_uInt16 nVer)
3050 |* const
3051 |*
3052 |* Beschreibung
3053 |* Ersterstellung 15.11.94
3054 |* Letzte Aenderung 15.11.94
3055 |*
3056 *************************************************************************/
3057
Create(SvStream & rIn,sal_uInt16) const3058 SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
3059 {
3060 return new XLineEndCenterItem(rIn);
3061 }
3062
3063 //------------------------------------------------------------------------
3064
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const3065 SfxItemPresentation XLineEndCenterItem::GetPresentation
3066 (
3067 SfxItemPresentation ePres,
3068 SfxMapUnit /*eCoreUnit*/,
3069 SfxMapUnit /*ePresUnit*/,
3070 XubString& rText, const IntlWrapper *
3071 ) const
3072 {
3073 switch ( ePres )
3074 {
3075 case SFX_ITEM_PRESENTATION_NONE:
3076 rText.Erase();
3077 return ePres;
3078 case SFX_ITEM_PRESENTATION_NAMELESS:
3079 case SFX_ITEM_PRESENTATION_COMPLETE:
3080 rText = XubString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
3081 RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
3082 return ePres;
3083 default:
3084 return SFX_ITEM_PRESENTATION_NONE;
3085 }
3086 }
3087
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8) const3088 sal_Bool XLineEndCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
3089 {
3090 sal_Bool bValue = GetValue();
3091 rVal.setValue( &bValue, ::getCppuBooleanType() );
3092 return sal_True;
3093 }
3094
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8)3095 sal_Bool XLineEndCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
3096 {
3097 if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
3098 return sal_False;
3099
3100 SetValue( *(sal_Bool*)rVal.getValue() );
3101 return sal_True;
3102 }
3103
3104
3105 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3106 // Fuellattribute
3107 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3108
3109 // --------------------
3110 // class XFillStyleItem
3111 // --------------------
3112 TYPEINIT1_AUTOFACTORY(XFillStyleItem, SfxEnumItem);
3113
3114 /*************************************************************************
3115 |*
3116 |* XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle)
3117 |*
3118 |* Beschreibung
3119 |* Ersterstellung 15.11.94
3120 |* Letzte Aenderung 15.11.94
3121 |*
3122 *************************************************************************/
3123
XFillStyleItem(XFillStyle eFillStyle)3124 XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle) :
3125 SfxEnumItem(XATTR_FILLSTYLE, sal::static_int_cast< sal_uInt16 >(eFillStyle))
3126 {
3127 }
3128
3129 /*************************************************************************
3130 |*
3131 |* XFillStyleItem::XFillStyleItem(SvStream& rIn)
3132 |*
3133 |* Beschreibung
3134 |* Ersterstellung 15.11.94
3135 |* Letzte Aenderung 15.11.94
3136 |*
3137 *************************************************************************/
3138
XFillStyleItem(SvStream & rIn)3139 XFillStyleItem::XFillStyleItem(SvStream& rIn) :
3140 SfxEnumItem(XATTR_FILLSTYLE, rIn)
3141 {
3142 }
3143
3144 /*************************************************************************
3145 |*
3146 |* XFillStyleItem::Clone(SfxItemPool* pPool) const
3147 |*
3148 |* Beschreibung
3149 |* Ersterstellung 09.11.94
3150 |* Letzte Aenderung 09.11.94
3151 |*
3152 *************************************************************************/
3153
Clone(SfxItemPool *) const3154 SfxPoolItem* XFillStyleItem::Clone(SfxItemPool* /*pPool*/) const
3155 {
3156 return new XFillStyleItem( *this );
3157 }
3158
3159 /*************************************************************************
3160 |*
3161 |* SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const
3162 |*
3163 |* Beschreibung
3164 |* Ersterstellung 15.11.94
3165 |* Letzte Aenderung 15.11.94
3166 |*
3167 *************************************************************************/
3168
Create(SvStream & rIn,sal_uInt16) const3169 SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
3170 {
3171 return new XFillStyleItem(rIn);
3172 }
3173
3174 //------------------------------------------------------------------------
3175
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const3176 SfxItemPresentation XFillStyleItem::GetPresentation
3177 (
3178 SfxItemPresentation ePres,
3179 SfxMapUnit /*eCoreUnit*/,
3180 SfxMapUnit /*ePresUnit*/,
3181 XubString& rText, const IntlWrapper *
3182 ) const
3183 {
3184 rText.Erase();
3185
3186 switch ( ePres )
3187 {
3188 case SFX_ITEM_PRESENTATION_NONE:
3189 return ePres;
3190
3191 case SFX_ITEM_PRESENTATION_NAMELESS:
3192 case SFX_ITEM_PRESENTATION_COMPLETE:
3193 {
3194 sal_uInt16 nId = 0;
3195
3196 switch( (sal_uInt16)GetValue() )
3197 {
3198 case XFILL_NONE:
3199 nId = RID_SVXSTR_INVISIBLE;
3200 break;
3201 case XFILL_SOLID:
3202 nId = RID_SVXSTR_SOLID;
3203 break;
3204 case XFILL_GRADIENT:
3205 nId = RID_SVXSTR_GRADIENT;
3206 break;
3207 case XFILL_HATCH:
3208 nId = RID_SVXSTR_HATCH;
3209 break;
3210 case XFILL_BITMAP:
3211 nId = RID_SVXSTR_BITMAP;
3212 break;
3213 }
3214
3215 if ( nId )
3216 rText = SVX_RESSTR( nId );
3217 return ePres;
3218 }
3219 default:
3220 return SFX_ITEM_PRESENTATION_NONE;
3221 }
3222 }
3223
3224 //------------------------------------------------------------------------
3225
GetValueCount() const3226 sal_uInt16 XFillStyleItem::GetValueCount() const
3227 {
3228 return 5;
3229 }
3230
3231 // -----------------------------------------------------------------------
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8) const3232 sal_Bool XFillStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
3233 {
3234 ::com::sun::star::drawing::FillStyle eFS = (::com::sun::star::drawing::FillStyle)GetValue();
3235
3236 rVal <<= eFS;
3237
3238 return sal_True;
3239 }
3240
3241 // -----------------------------------------------------------------------
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8)3242 sal_Bool XFillStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
3243 {
3244 ::com::sun::star::drawing::FillStyle eFS;
3245 if(!(rVal >>= eFS))
3246 {
3247 // also try an int (for Basic)
3248 sal_Int32 nFS = 0;
3249 if(!(rVal >>= nFS))
3250 return sal_False;
3251 eFS = (::com::sun::star::drawing::FillStyle)nFS;
3252 }
3253
3254 SetValue( sal::static_int_cast< sal_uInt16 >( eFS ) );
3255
3256 return sal_True;
3257 }
3258
3259
3260 // -------------------
3261 // class XFillColorItem
3262 // -------------------
3263 TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem);
3264
3265 /*************************************************************************
3266 |*
3267 |* XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor)
3268 |*
3269 |* Beschreibung
3270 |* Ersterstellung 15.11.94
3271 |* Letzte Aenderung 15.11.94
3272 |*
3273 *************************************************************************/
3274
XFillColorItem(sal_Int32 nIndex,const Color & rTheColor)3275 XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor) :
3276 XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor)
3277 {
3278 }
3279
3280 /*************************************************************************
3281 |*
3282 |* XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor)
3283 |*
3284 |* Beschreibung
3285 |* Ersterstellung 15.11.94
3286 |* Letzte Aenderung 15.11.94
3287 |*
3288 *************************************************************************/
3289
XFillColorItem(const XubString & rName,const Color & rTheColor)3290 XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor) :
3291 XColorItem(XATTR_FILLCOLOR, rName, rTheColor)
3292 {
3293 }
3294
3295 /*************************************************************************
3296 |*
3297 |* XFillColorItem::XFillColorItem(SvStream& rIn)
3298 |*
3299 |* Beschreibung
3300 |* Ersterstellung 15.11.94
3301 |* Letzte Aenderung 15.11.94
3302 |*
3303 *************************************************************************/
3304
XFillColorItem(SvStream & rIn)3305 XFillColorItem::XFillColorItem(SvStream& rIn) :
3306 XColorItem(XATTR_FILLCOLOR, rIn)
3307 {
3308 }
3309
3310 /*************************************************************************
3311 |*
3312 |* XFillColorItem::Clone(SfxItemPool* pPool) const
3313 |*
3314 |* Beschreibung
3315 |* Ersterstellung 15.11.94
3316 |* Letzte Aenderung 15.11.94
3317 |*
3318 *************************************************************************/
3319
Clone(SfxItemPool *) const3320 SfxPoolItem* XFillColorItem::Clone(SfxItemPool* /*pPool*/) const
3321 {
3322 return new XFillColorItem(*this);
3323 }
3324
3325 /*************************************************************************
3326 |*
3327 |* SfxPoolItem* XFillColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
3328 |*
3329 |* Beschreibung
3330 |* Ersterstellung 15.11.94
3331 |* Letzte Aenderung 15.11.94
3332 |*
3333 *************************************************************************/
3334
Create(SvStream & rIn,sal_uInt16) const3335 SfxPoolItem* XFillColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
3336 {
3337 return new XFillColorItem(rIn);
3338 }
3339
3340 //------------------------------------------------------------------------
3341
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const3342 SfxItemPresentation XFillColorItem::GetPresentation
3343 (
3344 SfxItemPresentation ePres,
3345 SfxMapUnit /*eCoreUnit*/,
3346 SfxMapUnit /*ePresUnit*/,
3347 XubString& rText, const IntlWrapper *
3348 ) const
3349 {
3350 switch ( ePres )
3351 {
3352 case SFX_ITEM_PRESENTATION_NONE:
3353 rText.Erase();
3354 return ePres;
3355 case SFX_ITEM_PRESENTATION_NAMELESS:
3356 case SFX_ITEM_PRESENTATION_COMPLETE:
3357 rText = GetName();
3358 return ePres;
3359 default:
3360 return SFX_ITEM_PRESENTATION_NONE;
3361 }
3362 }
3363
3364 // -----------------------------------------------------------------------
3365
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8) const3366 sal_Bool XFillColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
3367 {
3368 rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
3369
3370 return sal_True;
3371 }
3372
3373 // -----------------------------------------------------------------------
3374
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8)3375 sal_Bool XFillColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
3376 {
3377 sal_Int32 nValue = 0;
3378 if(!(rVal >>= nValue ))
3379 return sal_False;
3380
3381 SetColorValue( nValue );
3382 return sal_True;
3383 }
3384
3385 // -----------------------------
3386 // class XSecondaryFillColorItem
3387 // -----------------------------
3388 TYPEINIT1_AUTOFACTORY(XSecondaryFillColorItem, XColorItem);
3389
XSecondaryFillColorItem(sal_Int32 nIndex,const Color & rTheColor)3390 XSecondaryFillColorItem::XSecondaryFillColorItem(sal_Int32 nIndex, const Color& rTheColor) :
3391 XColorItem(XATTR_SECONDARYFILLCOLOR, nIndex, rTheColor)
3392 {
3393 }
3394
XSecondaryFillColorItem(const XubString & rName,const Color & rTheColor)3395 XSecondaryFillColorItem::XSecondaryFillColorItem(const XubString& rName, const Color& rTheColor) :
3396 XColorItem(XATTR_SECONDARYFILLCOLOR, rName, rTheColor)
3397 {
3398 }
3399
XSecondaryFillColorItem(SvStream & rIn)3400 XSecondaryFillColorItem::XSecondaryFillColorItem( SvStream& rIn ) :
3401 XColorItem(XATTR_SECONDARYFILLCOLOR, rIn)
3402 {
3403 }
3404
Clone(SfxItemPool *) const3405 SfxPoolItem* XSecondaryFillColorItem::Clone(SfxItemPool* /*pPool*/) const
3406 {
3407 return new XSecondaryFillColorItem(*this);
3408 }
3409
Create(SvStream & rIn,sal_uInt16 nVer) const3410 SfxPoolItem* XSecondaryFillColorItem::Create( SvStream& rIn, sal_uInt16 nVer ) const
3411 {
3412 if ( nVer >= 2 )
3413 return new XSecondaryFillColorItem( rIn );
3414 else
3415 return new XSecondaryFillColorItem( String(), Color(0,184,255) );
3416 }
GetVersion(sal_uInt16) const3417 sal_uInt16 XSecondaryFillColorItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const
3418 {
3419 return 2;
3420 }
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const3421 SfxItemPresentation XSecondaryFillColorItem::GetPresentation
3422 (
3423 SfxItemPresentation ePres,
3424 SfxMapUnit /*eCoreUnit*/,
3425 SfxMapUnit /*ePresUnit*/,
3426 XubString& rText, const IntlWrapper *
3427 ) const
3428 {
3429 switch ( ePres )
3430 {
3431 case SFX_ITEM_PRESENTATION_NONE:
3432 rText.Erase();
3433 return ePres;
3434 case SFX_ITEM_PRESENTATION_NAMELESS:
3435 case SFX_ITEM_PRESENTATION_COMPLETE:
3436 rText = GetName();
3437 return ePres;
3438 default:
3439 return SFX_ITEM_PRESENTATION_NONE;
3440 }
3441 }
3442
3443 // ----------------
3444 // class XGradient
3445 // ----------------
3446
3447 /*************************************************************************
3448 |*
3449 |* XGradient::XGradient()
3450 |*
3451 *************************************************************************/
3452
XGradient()3453 XGradient::XGradient() :
3454 eStyle( XGRAD_LINEAR ),
3455 aStartColor( Color( COL_BLACK ) ),
3456 aEndColor( Color( COL_WHITE ) ),
3457 nAngle( 0 ),
3458 nBorder( 0 ),
3459 nOfsX( 50 ),
3460 nOfsY( 50 ),
3461 nIntensStart( 100 ),
3462 nIntensEnd( 100 ),
3463 nStepCount( 0 )
3464 {
3465 }
3466
3467 /*************************************************************************
3468 |*
3469 |* XGradient::XGradient(XGradientStyle, const Color&, const Color&,
3470 |* long, sal_uInt16, sal_uInt16, sal_uInt16)
3471 |*
3472 |* Beschreibung
3473 |* Ersterstellung 21.11.94
3474 |* Letzte Aenderung 21.11.94
3475 |*
3476 *************************************************************************/
3477
XGradient(const Color & rStart,const Color & rEnd,XGradientStyle eTheStyle,long nTheAngle,sal_uInt16 nXOfs,sal_uInt16 nYOfs,sal_uInt16 nTheBorder,sal_uInt16 nStartIntens,sal_uInt16 nEndIntens,sal_uInt16 nSteps)3478 XGradient::XGradient(const Color& rStart, const Color& rEnd,
3479 XGradientStyle eTheStyle, long nTheAngle, sal_uInt16 nXOfs,
3480 sal_uInt16 nYOfs, sal_uInt16 nTheBorder,
3481 sal_uInt16 nStartIntens, sal_uInt16 nEndIntens,
3482 sal_uInt16 nSteps) :
3483 eStyle(eTheStyle),
3484 aStartColor(rStart),
3485 aEndColor(rEnd),
3486 nAngle(nTheAngle),
3487 nBorder(nTheBorder),
3488 nOfsX(nXOfs),
3489 nOfsY(nYOfs),
3490 nIntensStart(nStartIntens),
3491 nIntensEnd(nEndIntens),
3492 nStepCount(nSteps)
3493 {
3494 }
3495
3496 /*************************************************************************
3497 |*
3498 |* int XGradient::operator==(const SfxPoolItem& rItem) const
3499 |*
3500 |* Beschreibung
3501 |* Ersterstellung 29.11.94
3502 |* Letzte Aenderung 29.11.94
3503 |*
3504 *************************************************************************/
3505
operator ==(const XGradient & rGradient) const3506 bool XGradient::operator==(const XGradient& rGradient) const
3507 {
3508 return ( eStyle == rGradient.eStyle &&
3509 aStartColor == rGradient.aStartColor &&
3510 aEndColor == rGradient.aEndColor &&
3511 nAngle == rGradient.nAngle &&
3512 nBorder == rGradient.nBorder &&
3513 nOfsX == rGradient.nOfsX &&
3514 nOfsY == rGradient.nOfsY &&
3515 nIntensStart == rGradient.nIntensStart &&
3516 nIntensEnd == rGradient.nIntensEnd &&
3517 nStepCount == rGradient.nStepCount );
3518 }
3519
3520
3521 // -----------------------
3522 // class XFillGradientItem
3523 // -----------------------
3524 TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex);
3525
3526 /*************************************************************************
3527 |*
3528 |* XFillGradientItem::XFillGradientItem(sal_Int32 nIndex,
3529 |* const XGradient& rTheGradient)
3530 |*
3531 |* Beschreibung
3532 |* Ersterstellung 15.11.94
3533 |* Letzte Aenderung 15.11.94
3534 |*
3535 *************************************************************************/
3536
XFillGradientItem(sal_Int32 nIndex,const XGradient & rTheGradient)3537 XFillGradientItem::XFillGradientItem(sal_Int32 nIndex,
3538 const XGradient& rTheGradient) :
3539 NameOrIndex(XATTR_FILLGRADIENT, nIndex),
3540 aGradient(rTheGradient)
3541 {
3542 }
3543
3544 /*************************************************************************
3545 |*
3546 |* XFillGradientItem::XFillGradientItem(const XubString& rName,
3547 |* const XGradient& rTheGradient)
3548 |*
3549 |* Beschreibung
3550 |* Ersterstellung 15.11.94
3551 |* Letzte Aenderung 15.11.94
3552 |*
3553 *************************************************************************/
3554
XFillGradientItem(const XubString & rName,const XGradient & rTheGradient)3555 XFillGradientItem::XFillGradientItem(const XubString& rName,
3556 const XGradient& rTheGradient) :
3557 NameOrIndex(XATTR_FILLGRADIENT, rName),
3558 aGradient(rTheGradient)
3559 {
3560 }
3561
3562 /*************************************************************************
3563 |*
3564 |* XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem)
3565 |*
3566 |* Beschreibung
3567 |* Ersterstellung 15.11.94
3568 |* Letzte Aenderung 15.11.94
3569 |*
3570 *************************************************************************/
3571
XFillGradientItem(const XFillGradientItem & rItem)3572 XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem) :
3573 NameOrIndex(rItem),
3574 aGradient(rItem.aGradient)
3575 {
3576 }
3577
3578 /*************************************************************************
3579 |*
3580 |* XFillGradientItem::XFillGradientItem(SvStream& rIn)
3581 |*
3582 |* Beschreibung
3583 |* Ersterstellung 15.11.94
3584 |* Letzte Aenderung 15.11.94
3585 |*
3586 *************************************************************************/
3587
XFillGradientItem(SvStream & rIn,sal_uInt16 nVer)3588 XFillGradientItem::XFillGradientItem(SvStream& rIn, sal_uInt16 nVer) :
3589 NameOrIndex(XATTR_FILLGRADIENT, rIn),
3590 aGradient(COL_BLACK, COL_WHITE)
3591 {
3592 if (!IsIndex())
3593 {
3594 sal_uInt16 nUSTemp;
3595 sal_uInt16 nRed;
3596 sal_uInt16 nGreen;
3597 sal_uInt16 nBlue;
3598 sal_Int16 nITemp;
3599 sal_Int32 nLTemp;
3600
3601 rIn >> nITemp; aGradient.SetGradientStyle((XGradientStyle)nITemp);
3602 rIn >> nRed;
3603 rIn >> nGreen;
3604 rIn >> nBlue;
3605 Color aCol;
3606 aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
3607 aGradient.SetStartColor( aCol );
3608
3609 rIn >> nRed;
3610 rIn >> nGreen;
3611 rIn >> nBlue;
3612 aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
3613 aGradient.SetEndColor(aCol);
3614 rIn >> nLTemp; aGradient.SetAngle(nLTemp);
3615 rIn >> nUSTemp; aGradient.SetBorder(nUSTemp);
3616 rIn >> nUSTemp; aGradient.SetXOffset(nUSTemp);
3617 rIn >> nUSTemp; aGradient.SetYOffset(nUSTemp);
3618 rIn >> nUSTemp; aGradient.SetStartIntens(nUSTemp);
3619 rIn >> nUSTemp; aGradient.SetEndIntens(nUSTemp);
3620
3621 // bei neueren Versionen wird zusaetzlich
3622 // die Schrittweite mit eingelesen
3623 if (nVer >= 1)
3624 {
3625 rIn >> nUSTemp; aGradient.SetSteps(nUSTemp);
3626 }
3627 }
3628 }
3629
3630 //*************************************************************************
3631
XFillGradientItem(SfxItemPool *,const XGradient & rTheGradient)3632 XFillGradientItem::XFillGradientItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient)
3633 : NameOrIndex( XATTR_FILLGRADIENT, -1 ),
3634 aGradient(rTheGradient)
3635 {
3636 }
3637
3638 //*************************************************************************
3639
XFillGradientItem(SfxItemPool *)3640 XFillGradientItem::XFillGradientItem(SfxItemPool* /*pPool*/)
3641 : NameOrIndex(XATTR_FILLGRADIENT, -1 )
3642 {
3643 }
3644
3645 /*************************************************************************
3646 |*
3647 |* XFillGradientItem::Clone(SfxItemPool* pPool) const
3648 |*
3649 |* Beschreibung
3650 |* Ersterstellung 15.11.94
3651 |* Letzte Aenderung 15.11.94
3652 |*
3653 *************************************************************************/
3654
Clone(SfxItemPool *) const3655 SfxPoolItem* XFillGradientItem::Clone(SfxItemPool* /*pPool*/) const
3656 {
3657 return new XFillGradientItem(*this);
3658 }
3659
3660 /*************************************************************************
3661 |*
3662 |* int XFillGradientItem::operator==(const SfxPoolItem& rItem) const
3663 |*
3664 |* Beschreibung
3665 |* Ersterstellung 15.11.94
3666 |* Letzte Aenderung 15.11.94
3667 |*
3668 *************************************************************************/
3669
operator ==(const SfxPoolItem & rItem) const3670 int XFillGradientItem::operator==(const SfxPoolItem& rItem) const
3671 {
3672 return ( NameOrIndex::operator==(rItem) &&
3673 aGradient == ((const XFillGradientItem&) rItem).aGradient );
3674 }
3675
3676 /*************************************************************************
3677 |*
3678 |* SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, sal_uInt16 nVer) const
3679 |*
3680 |* Beschreibung
3681 |* Ersterstellung 15.11.94
3682 |* Letzte Aenderung 15.11.94
3683 |*
3684 *************************************************************************/
3685
Create(SvStream & rIn,sal_uInt16 nVer) const3686 SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, sal_uInt16 nVer) const
3687 {
3688 return new XFillGradientItem(rIn, nVer);
3689 }
3690
3691 /*************************************************************************
3692 |*
3693 |* SfxPoolItem* XFillGradientItem::Store(SvStream& rOut) const
3694 |*
3695 |* Beschreibung
3696 |* Ersterstellung 15.11.94
3697 |* Letzte Aenderung 15.11.94
3698 |*
3699 *************************************************************************/
3700
Store(SvStream & rOut,sal_uInt16 nItemVersion) const3701 SvStream& XFillGradientItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
3702 {
3703 NameOrIndex::Store( rOut, nItemVersion );
3704
3705 if (!IsIndex())
3706 {
3707 rOut << (sal_Int16)aGradient.GetGradientStyle();
3708
3709 sal_uInt16 nTmp;
3710
3711 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetRed() ); rOut << nTmp;
3712 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetGreen() ); rOut << nTmp;
3713 nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetBlue() ); rOut << nTmp;
3714 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetRed() ); rOut << nTmp;
3715 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetGreen() ); rOut << nTmp;
3716 nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetBlue() ); rOut << nTmp;
3717
3718 rOut << (sal_Int32) aGradient.GetAngle();
3719 rOut << aGradient.GetBorder();
3720 rOut << aGradient.GetXOffset();
3721 rOut << aGradient.GetYOffset();
3722 rOut << aGradient.GetStartIntens();
3723 rOut << aGradient.GetEndIntens();
3724 rOut << aGradient.GetSteps();
3725 }
3726
3727 return rOut;
3728 }
3729
3730 /*************************************************************************
3731 |*
3732 |* const XGradient& XFillGradientItem::GetValue(const XGradientList* pTable)
3733 |* const
3734 |*
3735 |* Beschreibung
3736 |* Ersterstellung 15.11.94
3737 |* Letzte Aenderung 18.11.94
3738 |*
3739 *************************************************************************/
3740
GetGradientValue(const XGradientList * pTable) const3741 const XGradient& XFillGradientItem::GetGradientValue(const XGradientList* pTable) const // GetValue -> GetGradientValue
3742 {
3743 if (!IsIndex())
3744 return aGradient;
3745 else
3746 return pTable->GetGradient(GetIndex())->GetGradient();
3747 }
3748
3749
3750 /*************************************************************************
3751 |*
3752 |* sal_uInt16 XFillGradientItem::GetVersion() const
3753 |*
3754 |* Beschreibung
3755 |* Ersterstellung 01.11.95
3756 |* Letzte Aenderung 01.11.95
3757 |*
3758 *************************************************************************/
3759
GetVersion(sal_uInt16) const3760 sal_uInt16 XFillGradientItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const
3761 {
3762 // !!! this version number also represents the version number of superclasses
3763 // !!! (e.g. XFillFloatTransparenceItem); if you make any changes here,
3764 // !!! the superclass is also affected
3765 return 1;
3766 }
3767
3768 //------------------------------------------------------------------------
3769
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const3770 SfxItemPresentation XFillGradientItem::GetPresentation
3771 (
3772 SfxItemPresentation ePres,
3773 SfxMapUnit /*eCoreUnit*/,
3774 SfxMapUnit /*ePresUnit*/,
3775 XubString& rText, const IntlWrapper *
3776 ) const
3777 {
3778 switch ( ePres )
3779 {
3780 case SFX_ITEM_PRESENTATION_NONE:
3781 rText.Erase();
3782 return ePres;
3783 case SFX_ITEM_PRESENTATION_NAMELESS:
3784 case SFX_ITEM_PRESENTATION_COMPLETE:
3785 rText = GetName();
3786 return ePres;
3787 default:
3788 return SFX_ITEM_PRESENTATION_NONE;
3789 }
3790 }
3791
3792 // -----------------------------------------------------------------------
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const3793 sal_Bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
3794 {
3795 //sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3796 nMemberId &= ~CONVERT_TWIPS;
3797 switch ( nMemberId )
3798 {
3799 case 0:
3800 {
3801 uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
3802
3803 ::com::sun::star::awt::Gradient aGradient2;
3804
3805 const XGradient& aXGradient = GetGradientValue();
3806 aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
3807 aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
3808 aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
3809 aGradient2.Angle = (short)aXGradient.GetAngle();
3810 aGradient2.Border = aXGradient.GetBorder();
3811 aGradient2.XOffset = aXGradient.GetXOffset();
3812 aGradient2.YOffset = aXGradient.GetYOffset();
3813 aGradient2.StartIntensity = aXGradient.GetStartIntens();
3814 aGradient2.EndIntensity = aXGradient.GetEndIntens();
3815 aGradient2.StepCount = aXGradient.GetSteps();
3816
3817 rtl::OUString aApiName;
3818 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
3819 aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
3820 aPropSeq[0].Value = uno::makeAny( aApiName );
3821 aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ));
3822 aPropSeq[1].Value = uno::makeAny( aGradient2 );
3823 rVal = uno::makeAny( aPropSeq );
3824 break;
3825 }
3826
3827 case MID_FILLGRADIENT:
3828 {
3829 const XGradient& aXGradient = GetGradientValue();
3830 ::com::sun::star::awt::Gradient aGradient2;
3831
3832 aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
3833 aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
3834 aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
3835 aGradient2.Angle = (short)aXGradient.GetAngle();
3836 aGradient2.Border = aXGradient.GetBorder();
3837 aGradient2.XOffset = aXGradient.GetXOffset();
3838 aGradient2.YOffset = aXGradient.GetYOffset();
3839 aGradient2.StartIntensity = aXGradient.GetStartIntens();
3840 aGradient2.EndIntensity = aXGradient.GetEndIntens();
3841 aGradient2.StepCount = aXGradient.GetSteps();
3842
3843 rVal <<= aGradient2;
3844 break;
3845 }
3846
3847 case MID_NAME:
3848 {
3849 rtl::OUString aApiName;
3850 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
3851 rVal <<= aApiName;
3852 break;
3853 }
3854
3855 case MID_GRADIENT_STYLE: rVal <<= (sal_Int16)GetGradientValue().GetGradientStyle(); break;
3856 case MID_GRADIENT_STARTCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetStartColor().GetColor(); break;
3857 case MID_GRADIENT_ENDCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetEndColor().GetColor(); break;
3858 case MID_GRADIENT_ANGLE: rVal <<= (sal_Int16)GetGradientValue().GetAngle(); break;
3859 case MID_GRADIENT_BORDER: rVal <<= GetGradientValue().GetBorder(); break;
3860 case MID_GRADIENT_XOFFSET: rVal <<= GetGradientValue().GetXOffset(); break;
3861 case MID_GRADIENT_YOFFSET: rVal <<= GetGradientValue().GetYOffset(); break;
3862 case MID_GRADIENT_STARTINTENSITY: rVal <<= GetGradientValue().GetStartIntens(); break;
3863 case MID_GRADIENT_ENDINTENSITY: rVal <<= GetGradientValue().GetEndIntens(); break;
3864 case MID_GRADIENT_STEPCOUNT: rVal <<= GetGradientValue().GetSteps(); break;
3865
3866 default: DBG_ERROR("Wrong MemberId!"); return sal_False;
3867 }
3868
3869 return sal_True;
3870 }
3871
3872 // -----------------------------------------------------------------------
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)3873 sal_Bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
3874 {
3875 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3876 nMemberId &= ~CONVERT_TWIPS;
3877
3878 switch ( nMemberId )
3879 {
3880 case 0:
3881 {
3882 uno::Sequence< beans::PropertyValue > aPropSeq;
3883 ::com::sun::star::awt::Gradient aGradient2;
3884 rtl::OUString aName;
3885 bool bGradient( false );
3886
3887 if ( rVal >>= aPropSeq )
3888 {
3889 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
3890 {
3891 if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" )))
3892 aPropSeq[n].Value >>= aName;
3893 else if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillGradient" )))
3894 {
3895 if ( aPropSeq[n].Value >>= aGradient2 )
3896 bGradient = true;
3897 }
3898 }
3899
3900 SetName( aName );
3901 if ( bGradient )
3902 {
3903 XGradient aXGradient;
3904
3905 aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
3906 aXGradient.SetStartColor( aGradient2.StartColor );
3907 aXGradient.SetEndColor( aGradient2.EndColor );
3908 aXGradient.SetAngle( aGradient2.Angle );
3909 aXGradient.SetBorder( aGradient2.Border );
3910 aXGradient.SetXOffset( aGradient2.XOffset );
3911 aXGradient.SetYOffset( aGradient2.YOffset );
3912 aXGradient.SetStartIntens( aGradient2.StartIntensity );
3913 aXGradient.SetEndIntens( aGradient2.EndIntensity );
3914 aXGradient.SetSteps( aGradient2.StepCount );
3915
3916 SetGradientValue( aXGradient );
3917 }
3918
3919 return sal_True;
3920 }
3921
3922 return sal_False;
3923 }
3924
3925 case MID_NAME:
3926 {
3927 rtl::OUString aName;
3928 if (!(rVal >>= aName ))
3929 return sal_False;
3930 SetName( aName );
3931 break;
3932 }
3933
3934 case MID_FILLGRADIENT:
3935 {
3936 ::com::sun::star::awt::Gradient aGradient2;
3937 if(!(rVal >>= aGradient2))
3938 return sal_False;
3939
3940 XGradient aXGradient;
3941
3942 aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
3943 aXGradient.SetStartColor( aGradient2.StartColor );
3944 aXGradient.SetEndColor( aGradient2.EndColor );
3945 aXGradient.SetAngle( aGradient2.Angle );
3946 aXGradient.SetBorder( aGradient2.Border );
3947 aXGradient.SetXOffset( aGradient2.XOffset );
3948 aXGradient.SetYOffset( aGradient2.YOffset );
3949 aXGradient.SetStartIntens( aGradient2.StartIntensity );
3950 aXGradient.SetEndIntens( aGradient2.EndIntensity );
3951 aXGradient.SetSteps( aGradient2.StepCount );
3952
3953 SetGradientValue( aXGradient );
3954 break;
3955 }
3956
3957 case MID_GRADIENT_STARTCOLOR:
3958 case MID_GRADIENT_ENDCOLOR:
3959 {
3960 sal_Int32 nVal = 0;
3961 if(!(rVal >>= nVal ))
3962 return sal_False;
3963
3964 XGradient aXGradient = GetGradientValue();
3965
3966 if ( nMemberId == MID_GRADIENT_STARTCOLOR )
3967 aXGradient.SetStartColor( nVal );
3968 else
3969 aXGradient.SetEndColor( nVal );
3970 SetGradientValue( aXGradient );
3971 break;
3972 }
3973
3974 case MID_GRADIENT_STYLE:
3975 case MID_GRADIENT_ANGLE:
3976 case MID_GRADIENT_BORDER:
3977 case MID_GRADIENT_STARTINTENSITY:
3978 case MID_GRADIENT_ENDINTENSITY:
3979 case MID_GRADIENT_STEPCOUNT:
3980 case MID_GRADIENT_XOFFSET:
3981 case MID_GRADIENT_YOFFSET:
3982 {
3983 sal_Int16 nVal = sal_Int16();
3984 if(!(rVal >>= nVal ))
3985 return sal_False;
3986
3987 XGradient aXGradient = GetGradientValue();
3988
3989 switch ( nMemberId )
3990 {
3991 case MID_GRADIENT_STYLE:
3992 aXGradient.SetGradientStyle( (XGradientStyle)nVal ); break;
3993 case MID_GRADIENT_ANGLE:
3994 aXGradient.SetAngle( nVal ); break;
3995 case MID_GRADIENT_BORDER:
3996 aXGradient.SetBorder( nVal ); break;
3997 case MID_GRADIENT_STARTINTENSITY:
3998 aXGradient.SetStartIntens( nVal ); break;
3999 case MID_GRADIENT_ENDINTENSITY:
4000 aXGradient.SetEndIntens( nVal ); break;
4001 case MID_GRADIENT_STEPCOUNT:
4002 aXGradient.SetSteps( nVal ); break;
4003 case MID_GRADIENT_XOFFSET:
4004 aXGradient.SetXOffset( nVal ); break;
4005 case MID_GRADIENT_YOFFSET:
4006 aXGradient.SetYOffset( nVal ); break;
4007 }
4008
4009 SetGradientValue( aXGradient );
4010 break;
4011 }
4012 }
4013
4014 return sal_True;
4015 }
4016
CompareValueFunc(const NameOrIndex * p1,const NameOrIndex * p2)4017 sal_Bool XFillGradientItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
4018 {
4019 return ((XFillGradientItem*)p1)->GetGradientValue() == ((XFillGradientItem*)p2)->GetGradientValue();
4020 }
4021
checkForUniqueItem(SdrModel * pModel) const4022 XFillGradientItem* XFillGradientItem::checkForUniqueItem( SdrModel* pModel ) const
4023 {
4024 if( pModel )
4025 {
4026 const String aUniqueName = NameOrIndex::CheckNamedItem( this,
4027 XATTR_FILLGRADIENT,
4028 &pModel->GetItemPool(),
4029 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
4030 XFillGradientItem::CompareValueFunc,
4031 RID_SVXSTR_GRADIENT,
4032 pModel->GetGradientListFromSdrModel().get() );
4033
4034 // if the given name is not valid, replace it!
4035 if( aUniqueName != GetName() )
4036 {
4037 return new XFillGradientItem( aUniqueName, aGradient );
4038 }
4039 }
4040
4041 return (XFillGradientItem*)this;
4042 }
4043
4044 // ----------------------------------
4045 // class XFillFloatTransparenceItem -
4046 // ----------------------------------
4047
4048 TYPEINIT1_AUTOFACTORY( XFillFloatTransparenceItem, XFillGradientItem );
4049
4050 // -----------------------------------------------------------------------------
4051
XFillFloatTransparenceItem()4052 XFillFloatTransparenceItem::XFillFloatTransparenceItem() :
4053 bEnabled( sal_False )
4054 {
4055 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4056 }
4057
4058 //------------------------------------------------------------------------
4059
XFillFloatTransparenceItem(sal_Int32 nIndex,const XGradient & rGradient,sal_Bool bEnable)4060 XFillFloatTransparenceItem::XFillFloatTransparenceItem( sal_Int32 nIndex, const XGradient& rGradient, sal_Bool bEnable ) :
4061 XFillGradientItem ( nIndex, rGradient ),
4062 bEnabled ( bEnable )
4063 {
4064 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4065 }
4066
4067 //------------------------------------------------------------------------
4068
XFillFloatTransparenceItem(const XubString & rName,const XGradient & rGradient,sal_Bool bEnable)4069 XFillFloatTransparenceItem::XFillFloatTransparenceItem(const XubString& rName, const XGradient& rGradient, sal_Bool bEnable ) :
4070 XFillGradientItem ( rName, rGradient ),
4071 bEnabled ( bEnable )
4072 {
4073 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4074 }
4075
4076 //------------------------------------------------------------------------
4077
XFillFloatTransparenceItem(const XFillFloatTransparenceItem & rItem)4078 XFillFloatTransparenceItem::XFillFloatTransparenceItem( const XFillFloatTransparenceItem& rItem ) :
4079 XFillGradientItem ( rItem ),
4080 bEnabled ( rItem.bEnabled )
4081 {
4082 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4083 }
4084
4085 //------------------------------------------------------------------------
4086
4087 //XFillFloatTransparenceItem::XFillFloatTransparenceItem( SvStream& rIn, sal_uInt16 nVer ) :
4088 // XFillGradientItem ( rIn, nVer )
4089 //{
4090 // SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4091 // rIn >> bEnabled;
4092 //}
4093
4094 //*************************************************************************
4095
XFillFloatTransparenceItem(SfxItemPool *,const XGradient & rTheGradient,sal_Bool bEnable)4096 XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient, sal_Bool bEnable )
4097 : XFillGradientItem ( -1, rTheGradient ),
4098 bEnabled ( bEnable )
4099 {
4100 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4101 }
4102
4103 //*************************************************************************
4104
XFillFloatTransparenceItem(SfxItemPool *)4105 XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/)
4106 {
4107 SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4108 }
4109
4110 //------------------------------------------------------------------------
4111
operator ==(const SfxPoolItem & rItem) const4112 int XFillFloatTransparenceItem::operator==( const SfxPoolItem& rItem ) const
4113 {
4114 return ( NameOrIndex::operator==(rItem) ) &&
4115 ( GetGradientValue() == ((const XFillGradientItem&)rItem).GetGradientValue() ) &&
4116 ( bEnabled == ( (XFillFloatTransparenceItem&) rItem ).bEnabled );
4117 }
4118
4119 //------------------------------------------------------------------------
4120
Clone(SfxItemPool *) const4121 SfxPoolItem* XFillFloatTransparenceItem::Clone( SfxItemPool* /*pPool*/) const
4122 {
4123 return new XFillFloatTransparenceItem( *this );
4124 }
4125
4126 //------------------------------------------------------------------------
4127
4128 //SfxPoolItem* XFillFloatTransparenceItem::Create( SvStream& rIn, sal_uInt16 nVer ) const
4129 //{
4130 // return( ( 0 == nVer ) ? Clone( NULL ) : new XFillFloatTransparenceItem( rIn, nVer ) );
4131 //}
4132
4133 //------------------------------------------------------------------------
4134
4135 //SvStream& XFillFloatTransparenceItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
4136 //{
4137 // XFillGradientItem::Store( rOut, nItemVersion );
4138 // rOut << bEnabled;
4139 // return rOut;
4140 //}
4141
4142 //------------------------------------------------------------------------
4143
GetVersion(sal_uInt16 nFileFormatVersion) const4144 sal_uInt16 XFillFloatTransparenceItem::GetVersion( sal_uInt16 nFileFormatVersion ) const
4145 {
4146 // !!! if version number of this object must be increased, please !!!
4147 // !!! increase version number of base class XFillGradientItem !!!
4148 return XFillGradientItem::GetVersion( nFileFormatVersion );
4149 }
4150
4151 //------------------------------------------------------------------------
4152
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const4153 sal_Bool XFillFloatTransparenceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
4154 {
4155 return XFillGradientItem::QueryValue( rVal, nMemberId );
4156 }
4157
4158 //------------------------------------------------------------------------
4159
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)4160 sal_Bool XFillFloatTransparenceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
4161 {
4162 return XFillGradientItem::PutValue( rVal, nMemberId );
4163 }
4164
4165 //------------------------------------------------------------------------
4166
GetPresentation(SfxItemPresentation ePres,SfxMapUnit eCoreUnit,SfxMapUnit ePresUnit,XubString & rText,const IntlWrapper * pIntlWrapper) const4167 SfxItemPresentation XFillFloatTransparenceItem::GetPresentation( SfxItemPresentation ePres,
4168 SfxMapUnit eCoreUnit, SfxMapUnit ePresUnit,
4169 XubString& rText,
4170 const IntlWrapper * pIntlWrapper ) const
4171 {
4172 return XFillGradientItem::GetPresentation( ePres, eCoreUnit, ePresUnit, rText, pIntlWrapper );
4173 }
4174
CompareValueFunc(const NameOrIndex * p1,const NameOrIndex * p2)4175 sal_Bool XFillFloatTransparenceItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
4176 {
4177 return ((XFillFloatTransparenceItem*)p1)->IsEnabled() == ((XFillFloatTransparenceItem*)p2)->IsEnabled() &&
4178 ((XFillFloatTransparenceItem*)p1)->GetGradientValue() == ((XFillFloatTransparenceItem*)p2)->GetGradientValue();
4179 }
4180
checkForUniqueItem(SdrModel * pModel) const4181 XFillFloatTransparenceItem* XFillFloatTransparenceItem::checkForUniqueItem( SdrModel* pModel ) const
4182 {
4183 // #85953# unique name only necessary when enabled
4184 if(IsEnabled())
4185 {
4186 if( pModel )
4187 {
4188 const String aUniqueName = NameOrIndex::CheckNamedItem( this,
4189 XATTR_FILLFLOATTRANSPARENCE,
4190 &pModel->GetItemPool(),
4191 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
4192 XFillFloatTransparenceItem::CompareValueFunc,
4193 RID_SVXSTR_TRASNGR0,
4194 NULL );
4195
4196 // if the given name is not valid, replace it!
4197 if( aUniqueName != GetName() )
4198 {
4199 return new XFillFloatTransparenceItem( aUniqueName, GetGradientValue(), sal_True );
4200 }
4201 }
4202 }
4203 else
4204 {
4205 // #85953# if disabled, force name to empty string
4206 if(GetName().Len())
4207 {
4208 return new XFillFloatTransparenceItem(String(), GetGradientValue(), sal_False);
4209 }
4210 }
4211
4212 return (XFillFloatTransparenceItem*)this;
4213 }
4214
4215 // -------------
4216 // class XHatch
4217 // -------------
4218
4219 /*************************************************************************
4220 |*
4221 |* XHatch::XHatch(XHatchStyle, const Color&, long, long)
4222 |*
4223 |* Beschreibung
4224 |* Ersterstellung 21.11.94
4225 |* Letzte Aenderung 21.11.94
4226 |*
4227 *************************************************************************/
4228
XHatch(const Color & rCol,XHatchStyle eTheStyle,long nTheDistance,long nTheAngle)4229 XHatch::XHatch(const Color& rCol, XHatchStyle eTheStyle, long nTheDistance,
4230 long nTheAngle) :
4231 eStyle(eTheStyle),
4232 aColor(rCol),
4233 nDistance(nTheDistance),
4234 nAngle(nTheAngle)
4235 {
4236 }
4237
4238 /*************************************************************************
4239 |*
4240 |* int XHatch::operator==(const SfxPoolItem& rItem) const
4241 |*
4242 |* Beschreibung
4243 |* Ersterstellung 29.11.94
4244 |* Letzte Aenderung 29.11.94
4245 |*
4246 *************************************************************************/
4247
operator ==(const XHatch & rHatch) const4248 bool XHatch::operator==(const XHatch& rHatch) const
4249 {
4250 return ( eStyle == rHatch.eStyle &&
4251 aColor == rHatch.aColor &&
4252 nDistance == rHatch.nDistance &&
4253 nAngle == rHatch.nAngle );
4254 }
4255
4256
4257 // -----------------------
4258 // class XFillHatchItem
4259 // -----------------------
4260 TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex);
4261
4262 /*************************************************************************
4263 |*
4264 |* XFillHatchItem::XFillHatchItem(sal_Int32 nIndex,
4265 |* const XHatch& rTheHatch)
4266 |*
4267 |* Beschreibung
4268 |* Ersterstellung 15.11.94
4269 |* Letzte Aenderung 15.11.94
4270 |*
4271 *************************************************************************/
4272
XFillHatchItem(sal_Int32 nIndex,const XHatch & rTheHatch)4273 XFillHatchItem::XFillHatchItem(sal_Int32 nIndex,
4274 const XHatch& rTheHatch) :
4275 NameOrIndex(XATTR_FILLHATCH, nIndex),
4276 aHatch(rTheHatch)
4277 {
4278 }
4279
4280 /*************************************************************************
4281 |*
4282 |* XFillHatchItem::XFillHatchItem(const XubString& rName,
4283 |* const XHatch& rTheHatch)
4284 |*
4285 |* Beschreibung
4286 |* Ersterstellung 15.11.94
4287 |* Letzte Aenderung 15.11.94
4288 |*
4289 *************************************************************************/
4290
XFillHatchItem(const XubString & rName,const XHatch & rTheHatch)4291 XFillHatchItem::XFillHatchItem(const XubString& rName,
4292 const XHatch& rTheHatch) :
4293 NameOrIndex(XATTR_FILLHATCH, rName),
4294 aHatch(rTheHatch)
4295 {
4296 }
4297
4298 /*************************************************************************
4299 |*
4300 |* XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem)
4301 |*
4302 |* Beschreibung
4303 |* Ersterstellung 15.11.94
4304 |* Letzte Aenderung 15.11.94
4305 |*
4306 *************************************************************************/
4307
XFillHatchItem(const XFillHatchItem & rItem)4308 XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem) :
4309 NameOrIndex(rItem),
4310 aHatch(rItem.aHatch)
4311 {
4312 }
4313
4314 /*************************************************************************
4315 |*
4316 |* XFillHatchItem::XFillHatchItem(SvStream& rIn)
4317 |*
4318 |* Beschreibung
4319 |* Ersterstellung 15.11.94
4320 |* Letzte Aenderung 15.11.94
4321 |*
4322 *************************************************************************/
4323
XFillHatchItem(SvStream & rIn)4324 XFillHatchItem::XFillHatchItem(SvStream& rIn) :
4325 NameOrIndex(XATTR_FILLHATCH, rIn),
4326 aHatch(COL_BLACK)
4327 {
4328 if (!IsIndex())
4329 {
4330 sal_uInt16 nRed;
4331 sal_uInt16 nGreen;
4332 sal_uInt16 nBlue;
4333 sal_Int16 nITemp;
4334 sal_Int32 nLTemp;
4335
4336 rIn >> nITemp; aHatch.SetHatchStyle((XHatchStyle)nITemp);
4337 rIn >> nRed;
4338 rIn >> nGreen;
4339 rIn >> nBlue;
4340
4341 Color aCol;
4342 aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
4343 aHatch.SetColor(aCol);
4344 rIn >> nLTemp; aHatch.SetDistance(nLTemp);
4345 rIn >> nLTemp; aHatch.SetAngle(nLTemp);
4346 }
4347 }
4348
4349 //*************************************************************************
4350
XFillHatchItem(SfxItemPool *,const XHatch & rTheHatch)4351 XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/, const XHatch& rTheHatch)
4352 : NameOrIndex( XATTR_FILLHATCH, -1 ),
4353 aHatch(rTheHatch)
4354 {
4355 }
4356
4357 //*************************************************************************
4358
XFillHatchItem(SfxItemPool *)4359 XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/)
4360 : NameOrIndex(XATTR_FILLHATCH, -1 )
4361 {
4362 }
4363
4364 /*************************************************************************
4365 |*
4366 |* XFillHatchItem::Clone(SfxItemPool* pPool) const
4367 |*
4368 |* Beschreibung
4369 |* Ersterstellung 15.11.94
4370 |* Letzte Aenderung 15.11.94
4371 |*
4372 *************************************************************************/
4373
Clone(SfxItemPool *) const4374 SfxPoolItem* XFillHatchItem::Clone(SfxItemPool* /*pPool*/) const
4375 {
4376 return new XFillHatchItem(*this);
4377 }
4378
4379 /*************************************************************************
4380 |*
4381 |* int XFillHatchItem::operator==(const SfxPoolItem& rItem) const
4382 |*
4383 |* Beschreibung
4384 |* Ersterstellung 15.11.94
4385 |* Letzte Aenderung 15.11.94
4386 |*
4387 *************************************************************************/
4388
operator ==(const SfxPoolItem & rItem) const4389 int XFillHatchItem::operator==(const SfxPoolItem& rItem) const
4390 {
4391 return ( NameOrIndex::operator==(rItem) &&
4392 aHatch == ((const XFillHatchItem&) rItem).aHatch );
4393 }
4394
4395 /*************************************************************************
4396 |*
4397 |* SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4398 |*
4399 |* Beschreibung
4400 |* Ersterstellung 15.11.94
4401 |* Letzte Aenderung 15.11.94
4402 |*
4403 *************************************************************************/
4404
Create(SvStream & rIn,sal_uInt16) const4405 SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4406 {
4407 return new XFillHatchItem(rIn);
4408 }
4409
4410 /*************************************************************************
4411 |*
4412 |* SfxPoolItem* XFillHatchItem::Store(SvStream& rOut) const
4413 |*
4414 |* Beschreibung
4415 |* Ersterstellung 15.11.94
4416 |* Letzte Aenderung 15.11.94
4417 |*
4418 *************************************************************************/
4419
Store(SvStream & rOut,sal_uInt16 nItemVersion) const4420 SvStream& XFillHatchItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
4421 {
4422 NameOrIndex::Store( rOut, nItemVersion );
4423
4424 if (!IsIndex())
4425 {
4426 rOut << (sal_Int16)aHatch.GetHatchStyle();
4427
4428 sal_uInt16 nTmp;
4429 nTmp = VCLTOSVCOL( aHatch.GetColor().GetRed() ); rOut << nTmp;
4430 nTmp = VCLTOSVCOL( aHatch.GetColor().GetGreen() ); rOut << nTmp;
4431 nTmp = VCLTOSVCOL( aHatch.GetColor().GetBlue() ); rOut << nTmp;
4432
4433 rOut << (sal_Int32) aHatch.GetDistance();
4434 rOut << (sal_Int32) aHatch.GetAngle();
4435 }
4436
4437 return rOut;
4438 }
4439
4440 /*************************************************************************
4441 |*
4442 |* const XHatch& XFillHatchItem::GetValue(const XHatchList* pTable) const
4443 |*
4444 |* Beschreibung
4445 |* Ersterstellung 15.11.94
4446 |* Letzte Aenderung 18.11.94
4447 |*
4448 *************************************************************************/
4449
GetHatchValue(const XHatchList * pTable) const4450 const XHatch& XFillHatchItem::GetHatchValue(const XHatchList* pTable) const // GetValue -> GetHatchValue
4451 {
4452 if (!IsIndex())
4453 return aHatch;
4454 else
4455 return pTable->GetHatch(GetIndex())->GetHatch();
4456 }
4457
4458 //------------------------------------------------------------------------
4459
GetPresentation(SfxItemPresentation ePres,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const4460 SfxItemPresentation XFillHatchItem::GetPresentation
4461 (
4462 SfxItemPresentation ePres,
4463 SfxMapUnit /*eCoreUnit*/,
4464 SfxMapUnit /*ePresUnit*/,
4465 XubString& rText, const IntlWrapper *
4466 ) const
4467 {
4468 switch ( ePres )
4469 {
4470 case SFX_ITEM_PRESENTATION_NONE:
4471 rText.Erase();
4472 return ePres;
4473 case SFX_ITEM_PRESENTATION_NAMELESS:
4474 case SFX_ITEM_PRESENTATION_COMPLETE:
4475 rText = GetName();
4476 return ePres;
4477 default:
4478 return SFX_ITEM_PRESENTATION_NONE;
4479 }
4480 }
4481
4482 //------------------------------------------------------------------------
4483
HasMetrics() const4484 FASTBOOL XFillHatchItem::HasMetrics() const
4485 {
4486 return sal_True;
4487 }
4488
4489 //------------------------------------------------------------------------
4490
ScaleMetrics(long nMul,long nDiv)4491 FASTBOOL XFillHatchItem::ScaleMetrics(long nMul, long nDiv)
4492 {
4493 aHatch.SetDistance( ScaleMetricValue( aHatch.GetDistance(), nMul, nDiv ) );
4494 return sal_True;
4495 }
4496
4497 // -----------------------------------------------------------------------
QueryValue(::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const4498 sal_Bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
4499 {
4500 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
4501 nMemberId &= ~CONVERT_TWIPS;
4502
4503 switch ( nMemberId )
4504 {
4505 case 0:
4506 {
4507 uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
4508
4509 ::com::sun::star::drawing::Hatch aUnoHatch;
4510
4511 aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
4512 aUnoHatch.Color = aHatch.GetColor().GetColor();
4513 aUnoHatch.Distance = aHatch.GetDistance();
4514 aUnoHatch.Angle = aHatch.GetAngle();
4515
4516 rtl::OUString aApiName;
4517 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
4518 aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
4519 aPropSeq[0].Value = uno::makeAny( aApiName );
4520 aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ));
4521 aPropSeq[1].Value = uno::makeAny( aUnoHatch );
4522 rVal = uno::makeAny( aPropSeq );
4523 break;
4524 }
4525
4526 case MID_FILLHATCH:
4527 {
4528 ::com::sun::star::drawing::Hatch aUnoHatch;
4529
4530 aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
4531 aUnoHatch.Color = aHatch.GetColor().GetColor();
4532 aUnoHatch.Distance = aHatch.GetDistance();
4533 aUnoHatch.Angle = aHatch.GetAngle();
4534 rVal <<= aUnoHatch;
4535 break;
4536 }
4537
4538 case MID_NAME:
4539 {
4540 rtl::OUString aApiName;
4541 SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
4542 rVal <<= aApiName;
4543 break;
4544 }
4545
4546 case MID_HATCH_STYLE:
4547 rVal <<= (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); break;
4548 case MID_HATCH_COLOR:
4549 rVal <<= (sal_Int32)aHatch.GetColor().GetColor(); break;
4550 case MID_HATCH_DISTANCE:
4551 rVal <<= aHatch.GetDistance(); break;
4552 case MID_HATCH_ANGLE:
4553 rVal <<= aHatch.GetAngle(); break;
4554
4555 default: DBG_ERROR("Wrong MemberId!"); return sal_False;
4556 }
4557
4558 return sal_True;
4559 }
4560
4561 // -----------------------------------------------------------------------
PutValue(const::com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)4562 sal_Bool XFillHatchItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
4563 {
4564 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
4565 nMemberId &= ~CONVERT_TWIPS;
4566
4567 switch ( nMemberId )
4568 {
4569 case 0:
4570 {
4571 uno::Sequence< beans::PropertyValue > aPropSeq;
4572 ::com::sun::star::drawing::Hatch aUnoHatch;
4573 rtl::OUString aName;
4574 bool bHatch( false );
4575
4576 if ( rVal >>= aPropSeq )
4577 {
4578 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
4579 {
4580 if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" )))
4581 aPropSeq[n].Value >>= aName;
4582 else if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillHatch" )))
4583 {
4584 if ( aPropSeq[n].Value >>= aUnoHatch )
4585 bHatch = true;
4586 }
4587 }
4588
4589 SetName( aName );
4590 if ( bHatch )
4591 {
4592 aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
4593 aHatch.SetColor( aUnoHatch.Color );
4594 aHatch.SetDistance( aUnoHatch.Distance );
4595 aHatch.SetAngle( aUnoHatch.Angle );
4596 }
4597
4598 return sal_True;
4599 }
4600
4601 return sal_False;
4602 }
4603
4604 case MID_FILLHATCH:
4605 {
4606 ::com::sun::star::drawing::Hatch aUnoHatch;
4607 if(!(rVal >>= aUnoHatch))
4608 return sal_False;
4609
4610 aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
4611 aHatch.SetColor( aUnoHatch.Color );
4612 aHatch.SetDistance( aUnoHatch.Distance );
4613 aHatch.SetAngle( aUnoHatch.Angle );
4614 break;
4615 }
4616
4617 case MID_NAME:
4618 {
4619 rtl::OUString aName;
4620 if (!(rVal >>= aName ))
4621 return sal_False;
4622 SetName( aName );
4623 break;
4624 }
4625
4626 case MID_HATCH_STYLE:
4627 {
4628 sal_Int16 nVal = sal_Int16();
4629 if (!(rVal >>= nVal ))
4630 return sal_False;
4631 aHatch.SetHatchStyle( (XHatchStyle)nVal );
4632 break;
4633 }
4634
4635 case MID_HATCH_COLOR:
4636 case MID_HATCH_DISTANCE:
4637 case MID_HATCH_ANGLE:
4638 {
4639 sal_Int32 nVal = 0;
4640 if (!(rVal >>= nVal ))
4641 return sal_False;
4642
4643 if ( nMemberId == MID_HATCH_COLOR )
4644 aHatch.SetColor( nVal );
4645 else if ( nMemberId == MID_HATCH_DISTANCE )
4646 aHatch.SetDistance( nVal );
4647 else
4648 aHatch.SetAngle( nVal );
4649 break;
4650 }
4651
4652 default: DBG_ERROR("Wrong MemberId!"); return sal_False;
4653 }
4654
4655 return sal_True;
4656 }
4657
CompareValueFunc(const NameOrIndex * p1,const NameOrIndex * p2)4658 sal_Bool XFillHatchItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
4659 {
4660 return ((XFillHatchItem*)p1)->GetHatchValue() == ((XFillHatchItem*)p2)->GetHatchValue();
4661 }
4662
checkForUniqueItem(SdrModel * pModel) const4663 XFillHatchItem* XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const
4664 {
4665 if( pModel )
4666 {
4667 const String aUniqueName = NameOrIndex::CheckNamedItem( this,
4668 XATTR_FILLHATCH,
4669 &pModel->GetItemPool(),
4670 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
4671 XFillHatchItem::CompareValueFunc,
4672 RID_SVXSTR_HATCH10,
4673 pModel->GetHatchListFromSdrModel().get() );
4674
4675 // if the given name is not valid, replace it!
4676 if( aUniqueName != GetName() )
4677 {
4678 return new XFillHatchItem( aUniqueName, aHatch );
4679 }
4680 }
4681
4682 return (XFillHatchItem*)this;
4683 }
4684
4685 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4686 // FormText-Attribute
4687 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4688
4689 //-------------------------
4690 // class XFormTextStyleItem
4691 //-------------------------
4692 TYPEINIT1_AUTOFACTORY(XFormTextStyleItem, SfxEnumItem);
4693
4694 /*************************************************************************
4695 |*
4696 |* XFormTextStyleItem::XFormTextStyleItem()
4697 |*
4698 |* Beschreibung
4699 |* Ersterstellung 02.02.95 ESO
4700 |* Letzte Aenderung 02.02.95 ESO
4701 |*
4702 *************************************************************************/
4703
XFormTextStyleItem(XFormTextStyle eTheStyle)4704 XFormTextStyleItem::XFormTextStyleItem(XFormTextStyle eTheStyle) :
4705 SfxEnumItem(XATTR_FORMTXTSTYLE, sal::static_int_cast< sal_uInt16 >(eTheStyle))
4706 {
4707 }
4708
4709 /*************************************************************************
4710 |*
4711 |* XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn)
4712 |*
4713 |* Beschreibung
4714 |* Ersterstellung 02.02.95 ESO
4715 |* Letzte Aenderung 02.02.95 ESO
4716 |*
4717 *************************************************************************/
4718
XFormTextStyleItem(SvStream & rIn)4719 XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn) :
4720 SfxEnumItem(XATTR_FORMTXTSTYLE, rIn)
4721 {
4722 }
4723
4724 /*************************************************************************
4725 |*
4726 |* XFormTextStyleItem::Clone(SfxItemPool* pPool) const
4727 |*
4728 |* Beschreibung
4729 |* Ersterstellung 02.02.95 ESO
4730 |* Letzte Aenderung 02.02.95 ESO
4731 |*
4732 *************************************************************************/
4733
Clone(SfxItemPool *) const4734 SfxPoolItem* XFormTextStyleItem::Clone(SfxItemPool* /*pPool*/) const
4735 {
4736 return new XFormTextStyleItem( *this );
4737 }
4738
4739 /*************************************************************************
4740 |*
4741 |* SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4742 |*
4743 |* Beschreibung
4744 |* Ersterstellung 02.02.95 ESO
4745 |* Letzte Aenderung 02.02.95 ESO
4746 |*
4747 *************************************************************************/
4748
Create(SvStream & rIn,sal_uInt16) const4749 SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4750 {
4751 return new XFormTextStyleItem(rIn);
4752 }
4753
4754 /*************************************************************************
4755 |*
4756 |*
4757 |*
4758 \*************************************************************************/
4759
GetValueCount() const4760 sal_uInt16 XFormTextStyleItem::GetValueCount() const
4761 {
4762 return 5;
4763 }
4764
4765 /*************************************************************************
4766 |*
4767 |*
4768 |*
4769 \*************************************************************************/
4770
4771 // #FontWork#
QueryValue(uno::Any & rVal,sal_uInt8) const4772 sal_Bool XFormTextStyleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
4773 {
4774 rVal <<= (sal_Int32)GetValue();
4775 return sal_True;
4776 }
4777
4778 /*************************************************************************
4779 |*
4780 |*
4781 |*
4782 \*************************************************************************/
4783
4784 // #FontWork#
PutValue(const uno::Any & rVal,sal_uInt8)4785 sal_Bool XFormTextStyleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
4786 {
4787 sal_Int32 nValue = 0;
4788 rVal >>= nValue;
4789 SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
4790
4791 return sal_True;
4792 }
4793
4794 //-------------------------
4795 // class XFormTextAdjustItem
4796 //-------------------------
4797 TYPEINIT1_AUTOFACTORY(XFormTextAdjustItem, SfxEnumItem);
4798
4799 /*************************************************************************
4800 |*
4801 |* XFormTextAdjustItem::XFormTextAdjustItem()
4802 |*
4803 |* Beschreibung
4804 |* Ersterstellung 02.02.95 ESO
4805 |* Letzte Aenderung 02.02.95 ESO
4806 |*
4807 *************************************************************************/
4808
XFormTextAdjustItem(XFormTextAdjust eTheAdjust)4809 XFormTextAdjustItem::XFormTextAdjustItem(XFormTextAdjust eTheAdjust) :
4810 SfxEnumItem(XATTR_FORMTXTADJUST, sal::static_int_cast< sal_uInt16 >(eTheAdjust))
4811 {
4812 }
4813
4814 /*************************************************************************
4815 |*
4816 |* XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn)
4817 |*
4818 |* Beschreibung
4819 |* Ersterstellung 02.02.95 ESO
4820 |* Letzte Aenderung 02.02.95 ESO
4821 |*
4822 *************************************************************************/
4823
XFormTextAdjustItem(SvStream & rIn)4824 XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn) :
4825 SfxEnumItem(XATTR_FORMTXTADJUST, rIn)
4826 {
4827 }
4828
4829 /*************************************************************************
4830 |*
4831 |* XFormTextAdjustItem::Clone(SfxItemPool* pPool) const
4832 |*
4833 |* Beschreibung
4834 |* Ersterstellung 02.02.95 ESO
4835 |* Letzte Aenderung 02.02.95 ESO
4836 |*
4837 *************************************************************************/
4838
Clone(SfxItemPool *) const4839 SfxPoolItem* XFormTextAdjustItem::Clone(SfxItemPool* /*pPool*/) const
4840 {
4841 return new XFormTextAdjustItem( *this );
4842 }
4843
4844 /*************************************************************************
4845 |*
4846 |* SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4847 |*
4848 |* Beschreibung
4849 |* Ersterstellung 02.02.95 ESO
4850 |* Letzte Aenderung 02.02.95 ESO
4851 |*
4852 *************************************************************************/
4853
Create(SvStream & rIn,sal_uInt16) const4854 SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4855 {
4856 return new XFormTextAdjustItem(rIn);
4857 }
4858
4859 /*************************************************************************
4860 |*
4861 |*
4862 |*
4863 \*************************************************************************/
4864
GetValueCount() const4865 sal_uInt16 XFormTextAdjustItem::GetValueCount() const
4866 {
4867 return 4;
4868 }
4869
4870 /*************************************************************************
4871 |*
4872 |*
4873 |*
4874 \*************************************************************************/
4875
4876 // #FontWork#
QueryValue(uno::Any & rVal,sal_uInt8) const4877 sal_Bool XFormTextAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
4878 {
4879 rVal <<= (sal_Int32)GetValue();
4880 return sal_True;
4881 }
4882
4883 /*************************************************************************
4884 |*
4885 |*
4886 |*
4887 \*************************************************************************/
4888
4889 // #FontWork#
PutValue(const uno::Any & rVal,sal_uInt8)4890 sal_Bool XFormTextAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
4891 {
4892 sal_Int32 nValue = 0;
4893 rVal >>= nValue;
4894 SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
4895
4896 return sal_True;
4897 }
4898
4899 //----------------------------
4900 // class XFormTextDistanceItem
4901 //----------------------------
4902 TYPEINIT1_AUTOFACTORY(XFormTextDistanceItem, SfxMetricItem);
4903
4904 /*************************************************************************
4905 |*
4906 |* XFormTextDistanceItem::XFormTextDistanceItem()
4907 |*
4908 |* Beschreibung
4909 |* Ersterstellung 02.02.95 ESO
4910 |* Letzte Aenderung 02.02.95 ESO
4911 |*
4912 *************************************************************************/
4913
XFormTextDistanceItem(long nDist)4914 XFormTextDistanceItem::XFormTextDistanceItem(long nDist) :
4915 SfxMetricItem(XATTR_FORMTXTDISTANCE, nDist)
4916 {
4917 }
4918
4919 /*************************************************************************
4920 |*
4921 |* XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn)
4922 |*
4923 |* Beschreibung
4924 |* Ersterstellung 02.02.95 ESO
4925 |* Letzte Aenderung 02.02.95 ESO
4926 |*
4927 *************************************************************************/
4928
XFormTextDistanceItem(SvStream & rIn)4929 XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn) :
4930 SfxMetricItem(XATTR_FORMTXTDISTANCE, rIn)
4931 {
4932 }
4933
4934 /*************************************************************************
4935 |*
4936 |* XFormTextDistanceItem::Clone(SfxItemPool* pPool) const
4937 |*
4938 |* Beschreibung
4939 |* Ersterstellung 02.02.95 ESO
4940 |* Letzte Aenderung 02.02.95 ESO
4941 |*
4942 *************************************************************************/
4943
Clone(SfxItemPool *) const4944 SfxPoolItem* XFormTextDistanceItem::Clone(SfxItemPool* /*pPool*/) const
4945 {
4946 return new XFormTextDistanceItem(*this);
4947 }
4948
4949 /*************************************************************************
4950 |*
4951 |* SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4952 |*
4953 |* Beschreibung
4954 |* Ersterstellung 02.02.95 ESO
4955 |* Letzte Aenderung 02.02.95 ESO
4956 |*
4957 *************************************************************************/
4958
Create(SvStream & rIn,sal_uInt16) const4959 SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4960 {
4961 return new XFormTextDistanceItem(rIn);
4962 }
4963
4964 //-------------------------
4965 // class XFormTextStartItem
4966 //-------------------------
4967 TYPEINIT1_AUTOFACTORY(XFormTextStartItem, SfxMetricItem);
4968
4969 /*************************************************************************
4970 |*
4971 |* XFormTextStartItem::XFormTextStartItem(long nStart)
4972 |*
4973 |* Beschreibung
4974 |* Ersterstellung 02.02.95 ESO
4975 |* Letzte Aenderung 02.02.95 ESO
4976 |*
4977 *************************************************************************/
4978
XFormTextStartItem(long nStart)4979 XFormTextStartItem::XFormTextStartItem(long nStart) :
4980 SfxMetricItem(XATTR_FORMTXTSTART, nStart)
4981 {
4982 }
4983
4984 /*************************************************************************
4985 |*
4986 |* XFormTextStartItem::XFormTextStartItem(SvStream& rIn)
4987 |*
4988 |* Beschreibung
4989 |* Ersterstellung 02.02.95 ESO
4990 |* Letzte Aenderung 02.02.95 ESO
4991 |*
4992 *************************************************************************/
4993
XFormTextStartItem(SvStream & rIn)4994 XFormTextStartItem::XFormTextStartItem(SvStream& rIn) :
4995 SfxMetricItem(XATTR_FORMTXTSTART, rIn)
4996 {
4997 }
4998
4999 /*************************************************************************
5000 |*
5001 |* XFormTextStartItem::Clone(SfxItemPool* pPool) const
5002 |*
5003 |* Beschreibung
5004 |* Ersterstellung 02.02.95 ESO
5005 |* Letzte Aenderung 02.02.95 ESO
5006 |*
5007 *************************************************************************/
5008
Clone(SfxItemPool *) const5009 SfxPoolItem* XFormTextStartItem::Clone(SfxItemPool* /*pPool*/) const
5010 {
5011 return new XFormTextStartItem(*this);
5012 }
5013
5014 /*************************************************************************
5015 |*
5016 |* SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, sal_uInt16 nVer) const
5017 |*
5018 |* Beschreibung
5019 |* Ersterstellung 02.02.95 ESO
5020 |* Letzte Aenderung 02.02.95 ESO
5021 |*
5022 *************************************************************************/
5023
Create(SvStream & rIn,sal_uInt16) const5024 SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5025 {
5026 return new XFormTextStartItem(rIn);
5027 }
5028
5029 // -------------------------
5030 // class XFormTextMirrorItem
5031 // -------------------------
5032 TYPEINIT1_AUTOFACTORY(XFormTextMirrorItem, SfxBoolItem);
5033
5034 /*************************************************************************
5035 |*
5036 |* XFormTextMirrorItem::XFormTextMirrorItem(sal_Bool bMirror)
5037 |*
5038 |* Ersterstellung 06.02.95 ESO
5039 |* Letzte Aenderung 06.02.95 ESO
5040 |*
5041 *************************************************************************/
5042
XFormTextMirrorItem(sal_Bool bMirror)5043 XFormTextMirrorItem::XFormTextMirrorItem(sal_Bool bMirror) :
5044 SfxBoolItem(XATTR_FORMTXTMIRROR, bMirror)
5045 {
5046 }
5047
5048 /*************************************************************************
5049 |*
5050 |* XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn)
5051 |*
5052 |* Ersterstellung 06.02.95 ESO
5053 |* Letzte Aenderung 06.02.95 ESO
5054 |*
5055 *************************************************************************/
5056
XFormTextMirrorItem(SvStream & rIn)5057 XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn) :
5058 SfxBoolItem(XATTR_FORMTXTMIRROR, rIn)
5059 {
5060 }
5061
5062 /*************************************************************************
5063 |*
5064 |* XFormTextMirrorItem::Clone(SfxItemPool* pPool) const
5065 |*
5066 |* Ersterstellung 06.02.95 ESO
5067 |* Letzte Aenderung 06.02.95 ESO
5068 |*
5069 *************************************************************************/
5070
Clone(SfxItemPool *) const5071 SfxPoolItem* XFormTextMirrorItem::Clone(SfxItemPool* /*pPool*/) const
5072 {
5073 return new XFormTextMirrorItem(*this);
5074 }
5075
5076 /*************************************************************************
5077 |*
5078 |* SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, sal_uInt16 nVer)
5079 |* const
5080 |*
5081 |* Ersterstellung 06.02.95 ESO
5082 |* Letzte Aenderung 06.02.95 ESO
5083 |*
5084 *************************************************************************/
5085
Create(SvStream & rIn,sal_uInt16) const5086 SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5087 {
5088 return new XFormTextMirrorItem(rIn);
5089 }
5090
5091
5092 // --------------------------
5093 // class XFormTextOutlineItem
5094 // --------------------------
5095 TYPEINIT1_AUTOFACTORY(XFormTextOutlineItem, SfxBoolItem);
5096
5097 /*************************************************************************
5098 |*
5099 |* XFormTextOutlineItem::XFormTextOutlineItem()
5100 |*
5101 |* Ersterstellung 27.06.95 ESO
5102 |* Letzte Aenderung 27.06.95 ESO
5103 |*
5104 *************************************************************************/
5105
XFormTextOutlineItem(sal_Bool bOutline)5106 XFormTextOutlineItem::XFormTextOutlineItem(sal_Bool bOutline) :
5107 SfxBoolItem(XATTR_FORMTXTOUTLINE, bOutline)
5108 {
5109 }
5110
5111 /*************************************************************************
5112 |*
5113 |* XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn)
5114 |*
5115 |* Ersterstellung 27.06.95 ESO
5116 |* Letzte Aenderung 27.06.95 ESO
5117 |*
5118 *************************************************************************/
5119
XFormTextOutlineItem(SvStream & rIn)5120 XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn) :
5121 SfxBoolItem(XATTR_FORMTXTOUTLINE, rIn)
5122 {
5123 }
5124
5125 /*************************************************************************
5126 |*
5127 |* XFormTextOutlineItem::Clone(SfxItemPool* pPool) const
5128 |*
5129 |* Ersterstellung 27.06.95 ESO
5130 |* Letzte Aenderung 27.06.95 ESO
5131 |*
5132 *************************************************************************/
5133
Clone(SfxItemPool *) const5134 SfxPoolItem* XFormTextOutlineItem::Clone(SfxItemPool* /*pPool*/) const
5135 {
5136 return new XFormTextOutlineItem(*this);
5137 }
5138
5139 /*************************************************************************
5140 |*
5141 |* SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 nVer)
5142 |* const
5143 |*
5144 |* Ersterstellung 27.06.95 ESO
5145 |* Letzte Aenderung 27.06.95 ESO
5146 |*
5147 *************************************************************************/
5148
Create(SvStream & rIn,sal_uInt16) const5149 SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5150 {
5151 return new XFormTextOutlineItem(rIn);
5152 }
5153
5154 //--------------------------
5155 // class XFormTextShadowItem
5156 //--------------------------
5157 TYPEINIT1_AUTOFACTORY(XFormTextShadowItem, SfxEnumItem);
5158
5159 /*************************************************************************
5160 |*
5161 |* XFormTextShadowItem::XFormTextShadowItem()
5162 |*
5163 |* Beschreibung
5164 |* Ersterstellung 27.06.95
5165 |* Letzte Aenderung 27.06.95
5166 |*
5167 *************************************************************************/
5168
XFormTextShadowItem(XFormTextShadow eFormTextShadow)5169 XFormTextShadowItem::XFormTextShadowItem(XFormTextShadow eFormTextShadow) :
5170 SfxEnumItem(
5171 XATTR_FORMTXTSHADOW, sal::static_int_cast< sal_uInt16 >(eFormTextShadow))
5172 {
5173 }
5174
5175 /*************************************************************************
5176 |*
5177 |* XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn)
5178 |*
5179 |* Beschreibung
5180 |* Ersterstellung 27.06.95
5181 |* Letzte Aenderung 27.06.95
5182 |*
5183 *************************************************************************/
5184
XFormTextShadowItem(SvStream & rIn)5185 XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn) :
5186 SfxEnumItem(XATTR_FORMTXTSHADOW, rIn)
5187 {
5188 }
5189
5190 /*************************************************************************
5191 |*
5192 |* XFormTextShadowItem::Clone(SfxItemPool* pPool) const
5193 |*
5194 |* Beschreibung
5195 |* Ersterstellung 27.06.95
5196 |* Letzte Aenderung 27.06.95
5197 |*
5198 *************************************************************************/
5199
Clone(SfxItemPool *) const5200 SfxPoolItem* XFormTextShadowItem::Clone(SfxItemPool* /*pPool*/) const
5201 {
5202 return new XFormTextShadowItem( *this );
5203 }
5204
5205 /*************************************************************************
5206 |*
5207 |* SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, sal_uInt16 nVer) const
5208 |*
5209 |* Beschreibung
5210 |* Ersterstellung 27.06.95
5211 |* Letzte Aenderung 27.06.95
5212 |*
5213 *************************************************************************/
5214
Create(SvStream & rIn,sal_uInt16) const5215 SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5216 {
5217 return new XFormTextShadowItem(rIn);
5218 }
5219
5220
5221 /*************************************************************************
5222 |*
5223 |*
5224 |*
5225 \*************************************************************************/
5226
GetValueCount() const5227 sal_uInt16 XFormTextShadowItem::GetValueCount() const
5228 {
5229 return 3;
5230 }
5231
5232 /*************************************************************************
5233 |*
5234 |*
5235 |*
5236 \*************************************************************************/
5237
5238 // #FontWork#
QueryValue(uno::Any & rVal,sal_uInt8) const5239 sal_Bool XFormTextShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
5240 {
5241 rVal <<= (sal_Int32)GetValue();
5242 return sal_True;
5243 }
5244
5245 /*************************************************************************
5246 |*
5247 |*
5248 |*
5249 \*************************************************************************/
5250
5251 // #FontWork#
PutValue(const uno::Any & rVal,sal_uInt8)5252 sal_Bool XFormTextShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
5253 {
5254 sal_Int32 nValue = 0;
5255 rVal >>= nValue;
5256 SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
5257
5258 return sal_True;
5259 }
5260
5261 // -------------------------------
5262 // class XFormTextShadowColorItem
5263 // -------------------------------
5264 TYPEINIT1_AUTOFACTORY(XFormTextShadowColorItem, XColorItem);
5265
5266 /*************************************************************************
5267 |*
5268 |* XFormTextShadowColorItem::XFormTextShadowColorItem()
5269 |*
5270 |* Beschreibung
5271 |* Ersterstellung 27.06.95
5272 |* Letzte Aenderung 27.06.95
5273 |*
5274 *************************************************************************/
5275
XFormTextShadowColorItem(sal_Int32 nIndex,const Color & rTheColor)5276 XFormTextShadowColorItem::XFormTextShadowColorItem(sal_Int32 nIndex,
5277 const Color& rTheColor) :
5278 XColorItem(XATTR_FORMTXTSHDWCOLOR, nIndex, rTheColor)
5279 {
5280 }
5281
5282 /*************************************************************************
5283 |*
5284 |* XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName, const Color& rTheColor)
5285 |*
5286 |* Beschreibung
5287 |* Ersterstellung 27.06.95
5288 |* Letzte Aenderung 27.06.95
5289 |*
5290 *************************************************************************/
5291
XFormTextShadowColorItem(const XubString & rName,const Color & rTheColor)5292 XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName,
5293 const Color& rTheColor) :
5294 XColorItem(XATTR_FORMTXTSHDWCOLOR, rName, rTheColor)
5295 {
5296 }
5297
5298 /*************************************************************************
5299 |*
5300 |* XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn)
5301 |*
5302 |* Beschreibung
5303 |* Ersterstellung 27.06.95
5304 |* Letzte Aenderung 27.06.95
5305 |*
5306 *************************************************************************/
5307
XFormTextShadowColorItem(SvStream & rIn)5308 XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn) :
5309 XColorItem(XATTR_FORMTXTSHDWCOLOR, rIn)
5310 {
5311 }
5312
5313 /*************************************************************************
5314 |*
5315 |* XFormTextShadowColorItem::Clone(SfxItemPool* pPool) const
5316 |*
5317 |* Beschreibung
5318 |* Ersterstellung 27.06.95
5319 |* Letzte Aenderung 27.06.95
5320 |*
5321 *************************************************************************/
5322
Clone(SfxItemPool *) const5323 SfxPoolItem* XFormTextShadowColorItem::Clone(SfxItemPool* /*pPool*/) const
5324 {
5325 return new XFormTextShadowColorItem(*this);
5326 }
5327
5328 /*************************************************************************
5329 |*
5330 |* SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
5331 |*
5332 |* Beschreibung
5333 |* Ersterstellung 27.06.95
5334 |* Letzte Aenderung 27.06.95
5335 |*
5336 *************************************************************************/
5337
Create(SvStream & rIn,sal_uInt16) const5338 SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5339 {
5340 return new XFormTextShadowColorItem(rIn);
5341 }
5342
5343 //------------------------------
5344 // class XFormTextShadowXValItem
5345 //------------------------------
5346 TYPEINIT1_AUTOFACTORY(XFormTextShadowXValItem, SfxMetricItem);
5347
5348 /*************************************************************************
5349 |*
5350 |* XFormTextShadowXValItem::XFormTextShadowXValItem(long)
5351 |*
5352 |* Beschreibung
5353 |* Ersterstellung 28.06.95 ESO
5354 |* Letzte Aenderung 28.06.95 ESO
5355 |*
5356 *************************************************************************/
5357
XFormTextShadowXValItem(long nVal)5358 XFormTextShadowXValItem::XFormTextShadowXValItem(long nVal) :
5359 SfxMetricItem(XATTR_FORMTXTSHDWXVAL, nVal)
5360 {
5361 }
5362
5363 /*************************************************************************
5364 |*
5365 |* XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn)
5366 |*
5367 |* Beschreibung
5368 |* Ersterstellung 28.06.95 ESO
5369 |* Letzte Aenderung 28.06.95 ESO
5370 |*
5371 *************************************************************************/
5372
XFormTextShadowXValItem(SvStream & rIn)5373 XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn) :
5374 SfxMetricItem(XATTR_FORMTXTSHDWXVAL, rIn)
5375 {
5376 }
5377
5378 /*************************************************************************
5379 |*
5380 |* XFormTextShadowXValItem::Clone(SfxItemPool* pPool) const
5381 |*
5382 |* Beschreibung
5383 |* Ersterstellung 28.06.95 ESO
5384 |* Letzte Aenderung 28.06.95 ESO
5385 |*
5386 *************************************************************************/
5387
Clone(SfxItemPool *) const5388 SfxPoolItem* XFormTextShadowXValItem::Clone(SfxItemPool* /*pPool*/) const
5389 {
5390 return new XFormTextShadowXValItem(*this);
5391 }
5392
5393 /*************************************************************************
5394 |*
5395 |* SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, sal_uInt16 nVer) const
5396 |*
5397 |* Beschreibung
5398 |* Ersterstellung 28.06.95 ESO
5399 |* Letzte Aenderung 28.06.95 ESO
5400 |*
5401 *************************************************************************/
5402
Create(SvStream & rIn,sal_uInt16) const5403 SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5404 {
5405 return new XFormTextShadowXValItem(rIn);
5406 }
5407
5408 //------------------------------
5409 // class XFormTextShadowYValItem
5410 //------------------------------
5411 TYPEINIT1_AUTOFACTORY(XFormTextShadowYValItem, SfxMetricItem);
5412
5413 /*************************************************************************
5414 |*
5415 |* XFormTextShadowYValItem::XFormTextShadowYValItem(long)
5416 |*
5417 |* Beschreibung
5418 |* Ersterstellung 28.06.95 ESO
5419 |* Letzte Aenderung 28.06.95 ESO
5420 |*
5421 *************************************************************************/
5422
XFormTextShadowYValItem(long nVal)5423 XFormTextShadowYValItem::XFormTextShadowYValItem(long nVal) :
5424 SfxMetricItem(XATTR_FORMTXTSHDWYVAL, nVal)
5425 {
5426 }
5427
5428 /*************************************************************************
5429 |*
5430 |* XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn)
5431 |*
5432 |* Beschreibung
5433 |* Ersterstellung 28.06.95 ESO
5434 |* Letzte Aenderung 28.06.95 ESO
5435 |*
5436 *************************************************************************/
5437
XFormTextShadowYValItem(SvStream & rIn)5438 XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn) :
5439 SfxMetricItem(XATTR_FORMTXTSHDWYVAL, rIn)
5440 {
5441 }
5442
5443 /*************************************************************************
5444 |*
5445 |* XFormTextShadowYValItem::Clone(SfxItemPool* pPool) const
5446 |*
5447 |* Beschreibung
5448 |* Ersterstellung 28.06.95 ESO
5449 |* Letzte Aenderung 28.06.95 ESO
5450 |*
5451 *************************************************************************/
5452
Clone(SfxItemPool *) const5453 SfxPoolItem* XFormTextShadowYValItem::Clone(SfxItemPool* /*pPool*/) const
5454 {
5455 return new XFormTextShadowYValItem(*this);
5456 }
5457
5458 /*************************************************************************
5459 |*
5460 |* SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, sal_uInt16 nVer) const
5461 |*
5462 |* Beschreibung
5463 |* Ersterstellung 28.06.95 ESO
5464 |* Letzte Aenderung 28.06.95 ESO
5465 |*
5466 *************************************************************************/
5467
Create(SvStream & rIn,sal_uInt16) const5468 SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5469 {
5470 return new XFormTextShadowYValItem(rIn);
5471 }
5472
5473 // --------------------------
5474 // class XFormTextHideFormItem
5475 // --------------------------
5476 TYPEINIT1_AUTOFACTORY(XFormTextHideFormItem, SfxBoolItem);
5477
5478 /*************************************************************************
5479 |*
5480 |* XFormTextHideFormItem::XFormTextHideFormItem()
5481 |*
5482 |* Ersterstellung 27.06.95 ESO
5483 |* Letzte Aenderung 27.06.95 ESO
5484 |*
5485 *************************************************************************/
5486
XFormTextHideFormItem(sal_Bool bHide)5487 XFormTextHideFormItem::XFormTextHideFormItem(sal_Bool bHide) :
5488 SfxBoolItem(XATTR_FORMTXTHIDEFORM, bHide)
5489 {
5490 }
5491
5492 /*************************************************************************
5493 |*
5494 |* XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn)
5495 |*
5496 |* Ersterstellung 27.06.95 ESO
5497 |* Letzte Aenderung 27.06.95 ESO
5498 |*
5499 *************************************************************************/
5500
XFormTextHideFormItem(SvStream & rIn)5501 XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn) :
5502 SfxBoolItem(XATTR_FORMTXTHIDEFORM, rIn)
5503 {
5504 }
5505
5506 /*************************************************************************
5507 |*
5508 |* XFormTextHideFormItem::Clone(SfxItemPool* pPool) const
5509 |*
5510 |* Ersterstellung 27.06.95 ESO
5511 |* Letzte Aenderung 27.06.95 ESO
5512 |*
5513 *************************************************************************/
5514
Clone(SfxItemPool *) const5515 SfxPoolItem* XFormTextHideFormItem::Clone(SfxItemPool* /*pPool*/) const
5516 {
5517 return new XFormTextHideFormItem(*this);
5518 }
5519
5520 /*************************************************************************
5521 |*
5522 |* SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 nVer)
5523 |* const
5524 |*
5525 |* Ersterstellung 27.06.95 ESO
5526 |* Letzte Aenderung 27.06.95 ESO
5527 |*
5528 *************************************************************************/
5529
Create(SvStream & rIn,sal_uInt16) const5530 SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5531 {
5532 return new XFormTextHideFormItem(rIn);
5533 }
5534
5535
5536
5537 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5538 // SetItems
5539 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5540
5541 TYPEINIT1(XLineAttrSetItem, SfxSetItem);
5542
5543 /*************************************************************************
5544 |*
5545 |* Konstruktoren fuer Linienattribute-SetItem
5546 |*
5547 \************************************************************************/
5548
XLineAttrSetItem(SfxItemSet * pItemSet)5549 XLineAttrSetItem::XLineAttrSetItem( SfxItemSet* pItemSet ) :
5550 SfxSetItem( XATTRSET_LINE, pItemSet)
5551 {
5552 }
5553
5554 /************************************************************************/
5555
XLineAttrSetItem(SfxItemPool * pItemPool)5556 XLineAttrSetItem::XLineAttrSetItem( SfxItemPool* pItemPool ) :
5557 SfxSetItem( XATTRSET_LINE,
5558 new SfxItemSet( *pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST))
5559 {
5560 }
5561
5562 /************************************************************************/
5563
XLineAttrSetItem(const XLineAttrSetItem & rLineAttr)5564 XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr ) :
5565 SfxSetItem( rLineAttr )
5566 {
5567 }
5568
5569 /************************************************************************/
5570
XLineAttrSetItem(const XLineAttrSetItem & rLineAttr,SfxItemPool * pItemPool)5571 XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr,
5572 SfxItemPool* pItemPool) :
5573 SfxSetItem( rLineAttr, pItemPool )
5574 {
5575 }
5576
5577 /*************************************************************************
5578 |*
5579 |* Clone-Funktion
5580 |*
5581 \************************************************************************/
5582
Clone(SfxItemPool * pPool) const5583 SfxPoolItem* XLineAttrSetItem::Clone( SfxItemPool* pPool ) const
5584 {
5585 return new XLineAttrSetItem( *this, pPool );
5586 }
5587
5588 /*************************************************************************
5589 |*
5590 |* SetItem aus Stream erzeugen
5591 |*
5592 \************************************************************************/
5593
Create(SvStream & rStream,sal_uInt16) const5594 SfxPoolItem* XLineAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
5595 {
5596 SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
5597 XATTR_LINE_FIRST, XATTR_LINE_LAST);
5598 pSet2->Load( rStream );
5599 return new XLineAttrSetItem( pSet2 );
5600 }
5601
5602 /*************************************************************************
5603 |*
5604 |* SetItem in Stream speichern
5605 |*
5606 \************************************************************************/
5607
Store(SvStream & rStream,sal_uInt16 nItemVersion) const5608 SvStream& XLineAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const
5609 {
5610 return SfxSetItem::Store( rStream, nItemVersion );
5611 }
5612
5613
5614 TYPEINIT1(XFillAttrSetItem, SfxSetItem);
5615
5616 /*************************************************************************
5617 |*
5618 |* Konstruktoren fuer Fuellattribute-SetItem
5619 |*
5620 \************************************************************************/
5621
XFillAttrSetItem(SfxItemSet * pItemSet)5622 XFillAttrSetItem::XFillAttrSetItem( SfxItemSet* pItemSet ) :
5623 SfxSetItem( XATTRSET_FILL, pItemSet)
5624 {
5625 }
5626
5627 /************************************************************************/
5628
XFillAttrSetItem(SfxItemPool * pItemPool)5629 XFillAttrSetItem::XFillAttrSetItem( SfxItemPool* pItemPool ) :
5630 SfxSetItem( XATTRSET_FILL,
5631 new SfxItemSet( *pItemPool, XATTR_FILL_FIRST, XATTR_FILL_LAST))
5632 {
5633 }
5634
5635 /************************************************************************/
5636
XFillAttrSetItem(const XFillAttrSetItem & rFillAttr)5637 XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr ) :
5638 SfxSetItem( rFillAttr )
5639 {
5640 }
5641
5642 /************************************************************************/
5643
XFillAttrSetItem(const XFillAttrSetItem & rFillAttr,SfxItemPool * pItemPool)5644 XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr,
5645 SfxItemPool* pItemPool ) :
5646 SfxSetItem( rFillAttr, pItemPool )
5647 {
5648 }
5649
5650 /*************************************************************************
5651 |*
5652 |* Clone-Funktion
5653 |*
5654 \************************************************************************/
5655
Clone(SfxItemPool * pPool) const5656 SfxPoolItem* XFillAttrSetItem::Clone( SfxItemPool* pPool ) const
5657 {
5658 return new XFillAttrSetItem( *this, pPool );
5659 }
5660
5661 /*************************************************************************
5662 |*
5663 |* SetItem aus Stream erzeugen
5664 |*
5665 \************************************************************************/
5666
Create(SvStream & rStream,sal_uInt16) const5667 SfxPoolItem* XFillAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
5668 {
5669 SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
5670 XATTR_FILL_FIRST, XATTR_FILL_LAST);
5671 pSet2->Load( rStream );
5672 return new XFillAttrSetItem( pSet2 );
5673 }
5674
5675 /*************************************************************************
5676 |*
5677 |* SetItem in Stream speichern
5678 |*
5679 \************************************************************************/
5680
Store(SvStream & rStream,sal_uInt16 nItemVersion) const5681 SvStream& XFillAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const
5682 {
5683 return SfxSetItem::Store( rStream, nItemVersion );
5684 }
5685
5686 // eof
5687
5688