xref: /AOO41X/main/svx/source/xoutdev/xattr.cxx (revision 5443dcac4da55ae8863c5c80e8907938642a7f1b)
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 
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 
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 
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 
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 
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 
178 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 
194 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 
210 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 
225 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 */
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 
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 
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 
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 
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 
426 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 
437 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 
449 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 
460 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 
478 const Color& XColorItem::GetColorValue() const
479 {
480     if(!IsIndex())
481     {
482         return aColor;
483     }
484 
485     OSL_ENSURE(false, "Acces to Indexed XColorItem needs to use the call which hands over a XColorListSharedPtr (!)");
486 
487     return aColor;
488 }
489 
490 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 
500 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 
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 
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 
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 
565 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 
580 SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
581 {
582     return new XLineStyleItem(rIn);
583 }
584 
585 //------------------------------------------------------------------------
586 
587 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 
625 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 
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 
650 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 
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 
690 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);
704 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 
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 
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 
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 
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 
975 XLineDashItem::XLineDashItem(SfxItemPool* /*pPool*/, const XDash& rTheDash)
976 :   NameOrIndex( XATTR_LINEDASH, -1 ),
977     aDash(rTheDash)
978 {
979 }
980 
981 //*************************************************************************
982 
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 
998 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 
1013 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 
1029 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 
1044 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 
1071 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 
1081 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 
1105 FASTBOOL XLineDashItem::HasMetrics() const
1106 {
1107     return sal_True;
1108 }
1109 
1110 //------------------------------------------------------------------------
1111 
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 
1120 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 
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 
1370 sal_Bool XLineDashItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
1371 {
1372     return ((XLineDashItem*)p1)->GetDashValue() == ((XLineDashItem*)p2)->GetDashValue();
1373 }
1374 
1375 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 
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 
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 
1442 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 
1457 SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
1458 {
1459     return new XLineWidthItem(rIn);
1460 }
1461 
1462 //------------------------------------------------------------------------
1463 
1464 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 += SVX_RESSTR( GetMetricId( ePresUnit) );
1482             return ePres;
1483         default:
1484             return SFX_ITEM_PRESENTATION_NONE;
1485     }
1486 }
1487 
1488 sal_Bool XLineWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
1489 {
1490     sal_Int32 nValue = GetValue();
1491     if( 0 != (nMemberId&CONVERT_TWIPS) )
1492         nValue = TWIP_TO_MM100(nValue);
1493 
1494     rVal <<= nValue;
1495     return sal_True;
1496 }
1497 
1498 sal_Bool XLineWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
1499 {
1500     sal_Int32 nValue = 0;
1501     rVal >>= nValue;
1502     if( 0 != (nMemberId&CONVERT_TWIPS) )
1503         nValue = MM100_TO_TWIP(nValue);
1504 
1505     SetValue( nValue );
1506     return sal_True;
1507 }
1508 
1509 // -------------------
1510 // class XLineColorItem
1511 // -------------------
1512 TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem);
1513 
1514 /*************************************************************************
1515 |*
1516 |*    XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor)
1517 |*
1518 |*    Beschreibung
1519 |*    Ersterstellung    15.11.94
1520 |*    Letzte Aenderung  15.11.94
1521 |*
1522 *************************************************************************/
1523 
1524 XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor) :
1525     XColorItem(XATTR_LINECOLOR, nIndex, rTheColor)
1526 {
1527 }
1528 
1529 /*************************************************************************
1530 |*
1531 |*    XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor)
1532 |*
1533 |*    Beschreibung
1534 |*    Ersterstellung    15.11.94
1535 |*    Letzte Aenderung  15.11.94
1536 |*
1537 *************************************************************************/
1538 
1539 XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor) :
1540     XColorItem(XATTR_LINECOLOR, rName, rTheColor)
1541 {
1542 }
1543 
1544 /*************************************************************************
1545 |*
1546 |*    XLineColorItem::XLineColorItem(SvStream& rIn)
1547 |*
1548 |*    Beschreibung
1549 |*    Ersterstellung    15.11.94
1550 |*    Letzte Aenderung  15.11.94
1551 |*
1552 *************************************************************************/
1553 
1554 XLineColorItem::XLineColorItem(SvStream& rIn) :
1555     XColorItem(XATTR_LINECOLOR, rIn)
1556 {
1557 }
1558 
1559 /*************************************************************************
1560 |*
1561 |*    XLineColorItem::Clone(SfxItemPool* pPool) const
1562 |*
1563 |*    Beschreibung
1564 |*    Ersterstellung    15.11.94
1565 |*    Letzte Aenderung  15.11.94
1566 |*
1567 *************************************************************************/
1568 
1569 SfxPoolItem* XLineColorItem::Clone(SfxItemPool* /*pPool*/) const
1570 {
1571     return new XLineColorItem(*this);
1572 }
1573 
1574 /*************************************************************************
1575 |*
1576 |*    SfxPoolItem* XLineColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
1577 |*
1578 |*    Beschreibung
1579 |*    Ersterstellung    15.11.94
1580 |*    Letzte Aenderung  15.11.94
1581 |*
1582 *************************************************************************/
1583 
1584 SfxPoolItem* XLineColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
1585 {
1586     return new XLineColorItem(rIn);
1587 }
1588 
1589 //------------------------------------------------------------------------
1590 
1591 SfxItemPresentation XLineColorItem::GetPresentation
1592 (
1593     SfxItemPresentation ePres,
1594     SfxMapUnit          /*eCoreUnit*/,
1595     SfxMapUnit          /*ePresUnit*/,
1596     XubString&          rText, const IntlWrapper *
1597 )   const
1598 {
1599     switch ( ePres )
1600     {
1601         case SFX_ITEM_PRESENTATION_NONE:
1602             rText.Erase();
1603             return ePres;
1604         case SFX_ITEM_PRESENTATION_NAMELESS:
1605         case SFX_ITEM_PRESENTATION_COMPLETE:
1606             rText = GetName();
1607             return ePres;
1608         default:
1609             return SFX_ITEM_PRESENTATION_NONE;
1610     }
1611 }
1612 
1613 sal_Bool XLineColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
1614 {
1615     rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
1616     return sal_True;
1617 }
1618 
1619 sal_Bool XLineColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
1620 {
1621     sal_Int32 nValue = 0;
1622     if(!(rVal >>= nValue))
1623         return sal_False;
1624 
1625     SetColorValue( nValue );
1626     return sal_True;
1627 }
1628 
1629 //////////////////////////////////////////////////////////////////////////////
1630 // tooling for simple spooling B2DPolygon to file and back
1631 
1632 namespace
1633 {
1634     void streamOutB2DPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, SvStream& rOut)
1635     {
1636         const sal_uInt32 nPolygonCount(rPolyPolygon.count());
1637         rOut << nPolygonCount;
1638 
1639         for(sal_uInt32 a(0L); a < nPolygonCount; a++)
1640         {
1641             const basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(a));
1642             const sal_uInt32 nPointCount(aCandidate.count());
1643             const sal_uInt8 bClosed(aCandidate.isClosed() ? 1 : 0);
1644             const sal_uInt8 bControlPoints(aCandidate.areControlPointsUsed() ? 1 : 0);
1645             rOut << nPointCount;
1646             rOut << bClosed;
1647             rOut << bControlPoints;
1648 
1649             for(sal_uInt32 b(0L); b < nPointCount; b++)
1650             {
1651                 const basegfx::B2DPoint aPoint(aCandidate.getB2DPoint(b));
1652                 rOut << aPoint.getX();
1653                 rOut << aPoint.getY();
1654 
1655                 if(bControlPoints)
1656                 {
1657                     const sal_uInt8 bEdgeIsCurve(aCandidate.isPrevControlPointUsed(b) || aCandidate.isNextControlPointUsed(b) ? 1 : 0);
1658                     rOut << bEdgeIsCurve;
1659 
1660                     if(bEdgeIsCurve)
1661                     {
1662                         const basegfx::B2DVector aControlVectorA(aCandidate.getPrevControlPoint(b));
1663                         rOut << aControlVectorA.getX();
1664                         rOut << aControlVectorA.getY();
1665 
1666                         const basegfx::B2DVector aControlVectorB(aCandidate.getNextControlPoint(b));
1667                         rOut << aControlVectorB.getX();
1668                         rOut << aControlVectorB.getY();
1669                     }
1670                 }
1671             }
1672         }
1673     }
1674 
1675     basegfx::B2DPolyPolygon streamInB2DPolyPolygon(SvStream& rIn)
1676     {
1677         basegfx::B2DPolyPolygon aRetval;
1678         sal_uInt32 nPolygonCount;
1679         rIn >> nPolygonCount;
1680 
1681         for(sal_uInt32 a(0L); a < nPolygonCount; a++)
1682         {
1683             sal_uInt32 nPointCount;
1684             sal_uInt8 bClosed;
1685             sal_uInt8 bControlPoints;
1686 
1687             rIn >> nPointCount;
1688             rIn >> bClosed;
1689             rIn >> bControlPoints;
1690 
1691             basegfx::B2DPolygon aCandidate;
1692             aCandidate.setClosed(0 != bClosed);
1693 
1694             for(sal_uInt32 b(0L); b < nPointCount; b++)
1695             {
1696                 double fX, fY;
1697                 rIn >> fX;
1698                 rIn >> fY;
1699                 aCandidate.append(basegfx::B2DPoint(fX, fY));
1700 
1701                 if(0 != bControlPoints)
1702                 {
1703                     sal_uInt8 bEdgeIsCurve;
1704                     rIn >> bEdgeIsCurve;
1705 
1706                     if(0 != bEdgeIsCurve)
1707                     {
1708                         rIn >> fX;
1709                         rIn >> fY;
1710                         aCandidate.setPrevControlPoint(b, basegfx::B2DVector(fX, fY));
1711 
1712                         rIn >> fX;
1713                         rIn >> fY;
1714                         aCandidate.setNextControlPoint(b, basegfx::B2DVector(fX, fY));
1715                     }
1716                 }
1717             }
1718 
1719             aRetval.append(aCandidate);
1720         }
1721 
1722         return aRetval;
1723     }
1724 }
1725 
1726 //////////////////////////////////////////////////////////////////////////////
1727 
1728 // -----------------------
1729 // class XLineStartItem
1730 // -----------------------
1731 TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex);
1732 
1733 /*************************************************************************
1734 |*
1735 |*    XLineStartItem::XLineStartItem(sal_Int32 nIndex)
1736 |*
1737 |*    Beschreibung
1738 |*    Ersterstellung    15.11.94
1739 |*    Letzte Aenderung  18.11.94
1740 |*
1741 *************************************************************************/
1742 
1743 XLineStartItem::XLineStartItem(sal_Int32 nIndex)
1744 :   NameOrIndex(XATTR_LINESTART, nIndex)
1745 {
1746 }
1747 
1748 /*************************************************************************
1749 |*
1750 |*    XLineStartItem::XLineStartItem(const XubString& rName,
1751 |*                                   const basegfx::B2DPolyPolygon& rXPolygon)
1752 |*
1753 |*    Beschreibung
1754 |*    Ersterstellung    15.11.94
1755 |*    Letzte Aenderung  18.11.94
1756 |*
1757 *************************************************************************/
1758 
1759 XLineStartItem::XLineStartItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
1760 :   NameOrIndex(XATTR_LINESTART, rName),
1761     maPolyPolygon(rPolyPolygon)
1762 {
1763 }
1764 
1765 /*************************************************************************
1766 |*
1767 |*    XLineStartItem::XLineStartItem(const XLineStartItem& rItem)
1768 |*
1769 |*    Beschreibung
1770 |*    Ersterstellung    15.11.94
1771 |*    Letzte Aenderung  17.11.94
1772 |*
1773 *************************************************************************/
1774 
1775 XLineStartItem::XLineStartItem(const XLineStartItem& rItem)
1776 :   NameOrIndex(rItem),
1777     maPolyPolygon(rItem.maPolyPolygon)
1778 {
1779 }
1780 
1781 /*************************************************************************
1782 |*
1783 |*    XLineStartItem::XLineStartItem(SvStream& rIn)
1784 |*
1785 |*    Beschreibung
1786 |*    Ersterstellung    15.11.94
1787 |*    Letzte Aenderung  17.11.94
1788 |*
1789 *************************************************************************/
1790 
1791 XLineStartItem::XLineStartItem(SvStream& rIn) :
1792     NameOrIndex(XATTR_LINESTART, rIn)
1793 {
1794     if (!IsIndex())
1795     {
1796         maPolyPolygon = streamInB2DPolyPolygon(rIn);
1797     }
1798 }
1799 
1800 //*************************************************************************
1801 
1802 XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
1803 :   NameOrIndex( XATTR_LINESTART, -1 ),
1804     maPolyPolygon(rPolyPolygon)
1805 {
1806 }
1807 
1808 //*************************************************************************
1809 
1810 XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/)
1811 :   NameOrIndex(XATTR_LINESTART, -1 )
1812 {
1813 }
1814 
1815 /*************************************************************************
1816 |*
1817 |*    XLineStartItem::Clone(SfxItemPool* pPool) const
1818 |*
1819 |*    Beschreibung
1820 |*    Ersterstellung    15.11.94
1821 |*    Letzte Aenderung  15.11.94
1822 |*
1823 *************************************************************************/
1824 
1825 SfxPoolItem* XLineStartItem::Clone(SfxItemPool* /*pPool*/) const
1826 {
1827     return new XLineStartItem(*this);
1828 }
1829 
1830 /*************************************************************************
1831 |*
1832 |*    int XLineStartItem::operator==(const SfxPoolItem& rItem) const
1833 |*
1834 |*    Beschreibung
1835 |*    Ersterstellung    15.11.94
1836 |*    Letzte Aenderung  18.11.94
1837 |*
1838 *************************************************************************/
1839 
1840 int XLineStartItem::operator==(const SfxPoolItem& rItem) const
1841 {
1842     return ( NameOrIndex::operator==(rItem) && ((const XLineStartItem&) rItem).maPolyPolygon == maPolyPolygon );
1843 }
1844 
1845 /*************************************************************************
1846 |*
1847 |*    SfxPoolItem* XLineStartItem::Create(SvStream& rIn, sal_uInt16 nVer) const
1848 |*
1849 |*    Beschreibung
1850 |*    Ersterstellung    15.11.94
1851 |*    Letzte Aenderung  15.11.94
1852 |*
1853 *************************************************************************/
1854 
1855 SfxPoolItem* XLineStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
1856 {
1857     return new XLineStartItem(rIn);
1858 }
1859 
1860 /*************************************************************************
1861 |*
1862 |*    SfxPoolItem* XLineStartItem::Store(SvStream& rOut) const
1863 |*
1864 |*    Beschreibung
1865 |*    Ersterstellung    15.11.94
1866 |*    Letzte Aenderung  18.11.94
1867 |*
1868 *************************************************************************/
1869 
1870 SvStream& XLineStartItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
1871 {
1872     NameOrIndex::Store( rOut, nItemVersion );
1873 
1874     if (!IsIndex())
1875     {
1876         streamOutB2DPolyPolygon(maPolyPolygon, rOut);
1877     }
1878 
1879     return rOut;
1880 }
1881 
1882 /*************************************************************************
1883 |*
1884 |*    const basegfx::B2DPolyPolygon& XLineStartItem::GetValue(const XLineEndList* pTable)
1885 |*                                             const
1886 |*
1887 |*    Beschreibung
1888 |*    Ersterstellung    15.11.94
1889 |*    Letzte Aenderung  18.11.94
1890 |*
1891 *************************************************************************/
1892 
1893 basegfx::B2DPolyPolygon XLineStartItem::GetLineStartValue(const XLineEndList* pTable) const
1894 {
1895     if (!IsIndex())
1896     {
1897         return maPolyPolygon;
1898     }
1899     else
1900     {
1901         return pTable->GetLineEnd(GetIndex())->GetLineEnd();
1902     }
1903 }
1904 
1905 //------------------------------------------------------------------------
1906 
1907 SfxItemPresentation XLineStartItem::GetPresentation
1908 (
1909     SfxItemPresentation ePres,
1910     SfxMapUnit          /*eCoreUnit*/,
1911     SfxMapUnit          /*ePresUnit*/,
1912     XubString&          rText, const IntlWrapper *
1913 )   const
1914 {
1915     switch ( ePres )
1916     {
1917         case SFX_ITEM_PRESENTATION_NONE:
1918             rText.Erase();
1919             return ePres;
1920         case SFX_ITEM_PRESENTATION_NAMELESS:
1921         case SFX_ITEM_PRESENTATION_COMPLETE:
1922             rText = GetName();
1923             return ePres;
1924         default:
1925         return SFX_ITEM_PRESENTATION_NONE;
1926     }
1927 }
1928 
1929 sal_Bool XLineStartItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
1930 {
1931 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1932     nMemberId &= ~CONVERT_TWIPS;
1933     if( nMemberId == MID_NAME )
1934     {
1935         rtl::OUString aApiName;
1936         SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
1937         rVal <<= aApiName;
1938     }
1939     else
1940     {
1941         com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
1942         SvxConvertB2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
1943         rVal <<= aBezier;
1944     }
1945 
1946     return sal_True;
1947 }
1948 
1949 sal_Bool XLineStartItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
1950 {
1951 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1952     nMemberId &= ~CONVERT_TWIPS;
1953     if( nMemberId == MID_NAME )
1954     {
1955         return sal_False;
1956     }
1957     else
1958     {
1959         maPolyPolygon.clear();
1960 
1961         if( rVal.hasValue() && rVal.getValue() )
1962         {
1963             if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
1964                 return sal_False;
1965 
1966             com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
1967             if( pCoords->Coordinates.getLength() > 0 )
1968             {
1969                 maPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords );
1970                 // #i72807# close line start/end polygons hard
1971                 // maPolyPolygon.setClosed(true);
1972             }
1973         }
1974     }
1975 
1976     return sal_True;
1977 }
1978 
1979 /** this function searches in both the models pool and the styles pool for XLineStartItem
1980     and XLineEndItem with the same value or name and returns an item with the value of
1981     this item and a unique name for an item with this value. */
1982 XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
1983 {
1984     if( pModel )
1985     {
1986         XLineStartItem* pTempItem = NULL;
1987         const XLineStartItem* pLineStartItem = this;
1988 
1989         String aUniqueName( GetName() );
1990 
1991         if( !maPolyPolygon.count() )
1992         {
1993             // if the polygon is empty, check if the name is empty
1994             if( aUniqueName.Len() == 0 )
1995                 return (XLineStartItem*)this;
1996 
1997             // force empty name for empty polygons
1998             return new XLineStartItem( String(), maPolyPolygon );
1999         }
2000 
2001         if( maPolyPolygon.count() > 1L )
2002         {
2003             // check if the polygon is closed
2004             if(!maPolyPolygon.isClosed())
2005             {
2006                 // force a closed polygon
2007                 basegfx::B2DPolyPolygon aNew(maPolyPolygon);
2008                 aNew.setClosed(true);
2009                 pTempItem = new XLineStartItem( aUniqueName, aNew );
2010                 pLineStartItem = pTempItem;
2011             }
2012         }
2013 
2014         sal_Bool bForceNew = sal_False;
2015 
2016         // 2. if we have a name check if there is already an item with the
2017         // same name in the documents pool with a different line end or start
2018 
2019         sal_uInt32 nCount, nSurrogate;
2020 
2021         const SfxItemPool* pPool1 = &pModel->GetItemPool();
2022         if( aUniqueName.Len() && pPool1 )
2023         {
2024             nCount = pPool1->GetItemCount2( XATTR_LINESTART );
2025 
2026             for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2027             {
2028                 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
2029 
2030                 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2031                 {
2032                     // if there is already an item with the same name and the same
2033                     // value its ok to set it
2034                     if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
2035                     {
2036                         // same name but different value, we need a new name for this item
2037                         aUniqueName = String();
2038                         bForceNew = sal_True;
2039                     }
2040                     break;
2041                 }
2042             }
2043 
2044             if( !bForceNew )
2045             {
2046                 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
2047 
2048                 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2049                 {
2050                     const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
2051 
2052                     if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2053                     {
2054                         // if there is already an item with the same name and the same
2055                         // value its ok to set it
2056                         if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
2057                         {
2058                             // same name but different value, we need a new name for this item
2059                             aUniqueName = String();
2060                             bForceNew = sal_True;
2061                         }
2062                         break;
2063                     }
2064                 }
2065             }
2066         }
2067 
2068         const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
2069         if( aUniqueName.Len() && pPool2)
2070         {
2071             nCount = pPool2->GetItemCount2( XATTR_LINESTART );
2072             for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2073             {
2074                 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate );
2075 
2076                 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2077                 {
2078                     // if there is already an item with the same name and the same
2079                     // value its ok to set it
2080                     if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
2081                     {
2082                         // same name but different value, we need a new name for this item
2083                         aUniqueName = String();
2084                         bForceNew = sal_True;
2085                     }
2086                     break;
2087                 }
2088             }
2089 
2090             if( !bForceNew )
2091             {
2092                 nCount = pPool2->GetItemCount2( XATTR_LINEEND );
2093                 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2094                 {
2095                     const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate );
2096 
2097                     if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
2098                     {
2099                         // if there is already an item with the same name and the same
2100                         // value its ok to set it
2101                         if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
2102                         {
2103                             // same name but different value, we need a new name for this item
2104                             aUniqueName = String();
2105                             bForceNew = sal_True;
2106                         }
2107                         break;
2108                     }
2109                 }
2110             }
2111         }
2112 
2113         // if we have no name yet, find existing item with same conent or
2114         // create a unique name
2115         if( aUniqueName.Len() == 0 )
2116         {
2117             sal_Bool bFoundExisting = sal_False;
2118 
2119             sal_Int32 nUserIndex = 1;
2120             const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
2121             const String aUser( aRes );
2122 
2123             if( pPool1 )
2124             {
2125                 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
2126                 sal_uInt32 nSurrogate2;
2127 
2128                 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2129                 {
2130                     const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
2131 
2132                     if( pItem && pItem->GetName().Len() )
2133                     {
2134                         if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() )
2135                         {
2136                             aUniqueName = pItem->GetName();
2137                             bFoundExisting = sal_True;
2138                             break;
2139                         }
2140 
2141                         if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2142                         {
2143                             sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2144                             if( nThisIndex >= nUserIndex )
2145                                 nUserIndex = nThisIndex + 1;
2146                         }
2147                     }
2148                 }
2149 
2150                 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
2151                 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2152                 {
2153                     const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
2154 
2155                     if( pItem && pItem->GetName().Len() )
2156                     {
2157                         if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() )
2158                         {
2159                             aUniqueName = pItem->GetName();
2160                             bFoundExisting = sal_True;
2161                             break;
2162                         }
2163 
2164                         if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2165                         {
2166                             sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2167                             if( nThisIndex >= nUserIndex )
2168                                 nUserIndex = nThisIndex + 1;
2169                         }
2170                     }
2171                 }
2172             }
2173 
2174             if( !bFoundExisting )
2175             {
2176                 aUniqueName = aUser;
2177                 aUniqueName += sal_Unicode(' ');
2178                 aUniqueName += String::CreateFromInt32( nUserIndex );
2179             }
2180         }
2181 
2182         // if the given name is not valid, replace it!
2183         if( aUniqueName != GetName() || pTempItem )
2184         {
2185             if( pTempItem )
2186             {
2187                 pTempItem->SetName( aUniqueName );
2188                 return pTempItem;
2189             }
2190             else
2191             {
2192                 return new XLineStartItem( aUniqueName, maPolyPolygon );
2193             }
2194         }
2195     }
2196 
2197     return (XLineStartItem*)this;
2198 }
2199 
2200 // ---------------------
2201 // class XLineEndItem
2202 // ---------------------
2203 TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex);
2204 
2205 /*************************************************************************
2206 |*
2207 |*    XLineEndItem::XLineEndItem(sal_Int32 nIndex)
2208 |*
2209 |*    Beschreibung
2210 |*    Ersterstellung    15.11.94
2211 |*    Letzte Aenderung  18.11.94
2212 |*
2213 *************************************************************************/
2214 
2215 XLineEndItem::XLineEndItem(sal_Int32 nIndex)
2216 :   NameOrIndex(XATTR_LINEEND, nIndex)
2217 {
2218 }
2219 
2220 /*************************************************************************
2221 |*
2222 |*    XLineEndItem::XLineEndItem(const XubString& rName,
2223 |*                               const basegfx::B2DPolyPolygon& rXPolygon)
2224 |*
2225 |*    Beschreibung
2226 |*    Ersterstellung    15.11.94
2227 |*    Letzte Aenderung  18.11.94
2228 |*
2229 *************************************************************************/
2230 
2231 XLineEndItem::XLineEndItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
2232 :   NameOrIndex(XATTR_LINEEND, rName),
2233     maPolyPolygon(rPolyPolygon)
2234 {
2235 }
2236 
2237 /*************************************************************************
2238 |*
2239 |*    XLineEndItem::XLineEndItem(const XLineEndItem& rItem)
2240 |*
2241 |*    Beschreibung
2242 |*    Ersterstellung    15.11.94
2243 |*    Letzte Aenderung  18.11.94
2244 |*
2245 *************************************************************************/
2246 
2247 XLineEndItem::XLineEndItem(const XLineEndItem& rItem)
2248 :   NameOrIndex(rItem),
2249     maPolyPolygon(rItem.maPolyPolygon)
2250 {
2251 }
2252 
2253 /*************************************************************************
2254 |*
2255 |*    XLineEndItem::XLineEndItem(SvStream& rIn)
2256 |*
2257 |*    Beschreibung
2258 |*    Ersterstellung    15.11.94
2259 |*    Letzte Aenderung  17.11.94
2260 |*
2261 *************************************************************************/
2262 
2263 XLineEndItem::XLineEndItem(SvStream& rIn) :
2264     NameOrIndex(XATTR_LINEEND, rIn)
2265 {
2266     if (!IsIndex())
2267     {
2268         maPolyPolygon = streamInB2DPolyPolygon(rIn);
2269     }
2270 }
2271 
2272 //*************************************************************************
2273 
2274 XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
2275 :   NameOrIndex( XATTR_LINEEND, -1 ),
2276     maPolyPolygon(rPolyPolygon)
2277 {
2278 }
2279 
2280 //*************************************************************************
2281 
2282 XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/)
2283 :   NameOrIndex(XATTR_LINEEND, -1 )
2284 {
2285 }
2286 
2287 /*************************************************************************
2288 |*
2289 |*    XLineEndItem::Clone(SfxItemPool* pPool) const
2290 |*
2291 |*    Beschreibung
2292 |*    Ersterstellung    15.11.94
2293 |*    Letzte Aenderung  15.11.94
2294 |*
2295 *************************************************************************/
2296 
2297 SfxPoolItem* XLineEndItem::Clone(SfxItemPool* /*pPool*/) const
2298 {
2299     return new XLineEndItem(*this);
2300 }
2301 
2302 /*************************************************************************
2303 |*
2304 |*    int XLineEndItem::operator==(const SfxPoolItem& rItem) const
2305 |*
2306 |*    Beschreibung
2307 |*    Ersterstellung    15.11.94
2308 |*    Letzte Aenderung  17.11.94
2309 |*
2310 *************************************************************************/
2311 
2312 int XLineEndItem::operator==(const SfxPoolItem& rItem) const
2313 {
2314     return ( NameOrIndex::operator==(rItem) && ((const XLineEndItem&) rItem).maPolyPolygon == maPolyPolygon );
2315 }
2316 
2317 /*************************************************************************
2318 |*
2319 |*    SfxPoolItem* XLineEndItem::Create(SvStream& rIn, sal_uInt16 nVer) const
2320 |*
2321 |*    Beschreibung
2322 |*    Ersterstellung    15.11.94
2323 |*    Letzte Aenderung  15.11.94
2324 |*
2325 *************************************************************************/
2326 
2327 SfxPoolItem* XLineEndItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2328 {
2329     return new XLineEndItem(rIn);
2330 }
2331 
2332 /*************************************************************************
2333 |*
2334 |*    SfxPoolItem* XLineEndItem::Store(SvStream& rOut) const
2335 |*
2336 |*    Beschreibung
2337 |*    Ersterstellung    15.11.94
2338 |*    Letzte Aenderung  17.11.94
2339 |*
2340 *************************************************************************/
2341 
2342 SvStream& XLineEndItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
2343 {
2344     NameOrIndex::Store( rOut, nItemVersion );
2345 
2346     if (!IsIndex())
2347     {
2348         streamOutB2DPolyPolygon(maPolyPolygon, rOut);
2349     }
2350 
2351     return rOut;
2352 }
2353 
2354 /*************************************************************************
2355 |*
2356 |*    const basegfx::B2DPolyPolygon& XLineEndItem::GetValue(const XLineEndList* pTable) const
2357 |*
2358 |*    Beschreibung
2359 |*    Ersterstellung    15.11.94
2360 |*    Letzte Aenderung  18.11.94
2361 |*
2362 *************************************************************************/
2363 
2364 basegfx::B2DPolyPolygon XLineEndItem::GetLineEndValue(const XLineEndList* pTable) const
2365 {
2366     if (!IsIndex())
2367     {
2368         return maPolyPolygon;
2369     }
2370     else
2371     {
2372         return pTable->GetLineEnd(GetIndex())->GetLineEnd();
2373     }
2374 }
2375 
2376 
2377 /** this function searches in both the models pool and the styles pool for XLineStartItem
2378     and XLineEndItem with the same value or name and returns an item with the value of
2379     this item and a unique name for an item with this value. */
2380 XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
2381 {
2382     if( pModel )
2383     {
2384         XLineEndItem* pTempItem = NULL;
2385         const XLineEndItem* pLineEndItem = this;
2386 
2387         String aUniqueName( GetName() );
2388 
2389         if( !maPolyPolygon.count() )
2390         {
2391             // if the polygon is empty, check if the name is empty
2392             if( aUniqueName.Len() == 0 )
2393                 return (XLineEndItem*)this;
2394 
2395             // force empty name for empty polygons
2396             return new XLineEndItem( String(), maPolyPolygon );
2397         }
2398 
2399         if( maPolyPolygon.count() > 1L )
2400         {
2401             // check if the polygon is closed
2402             if(!maPolyPolygon.isClosed())
2403             {
2404                 // force a closed polygon
2405                 basegfx::B2DPolyPolygon aNew(maPolyPolygon);
2406                 aNew.setClosed(true);
2407                 pTempItem = new XLineEndItem( aUniqueName, aNew );
2408                 pLineEndItem = pTempItem;
2409             }
2410         }
2411 
2412         sal_Bool bForceNew = sal_False;
2413 
2414         // 2. if we have a name check if there is already an item with the
2415         // same name in the documents pool with a different line end or start
2416 
2417         sal_uInt16 nCount, nSurrogate;
2418 
2419         const SfxItemPool* pPool1 = &pModel->GetItemPool();
2420         if( aUniqueName.Len() && pPool1 )
2421         {
2422             nCount = pPool1->GetItemCount2( XATTR_LINESTART );
2423 
2424             for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2425             {
2426                 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
2427 
2428                 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2429                 {
2430                     // if there is already an item with the same name and the same
2431                     // value its ok to set it
2432                     if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
2433                     {
2434                         // same name but different value, we need a new name for this item
2435                         aUniqueName = String();
2436                         bForceNew = sal_True;
2437                     }
2438                     break;
2439                 }
2440             }
2441 
2442             if( !bForceNew )
2443             {
2444                 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
2445 
2446                 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2447                 {
2448                     const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
2449 
2450                     if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2451                     {
2452                         // if there is already an item with the same name and the same
2453                         // value its ok to set it
2454                         if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
2455                         {
2456                             // same name but different value, we need a new name for this item
2457                             aUniqueName = String();
2458                             bForceNew = sal_True;
2459                         }
2460                         break;
2461                     }
2462                 }
2463             }
2464         }
2465 
2466         const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
2467         if( aUniqueName.Len() && pPool2)
2468         {
2469             nCount = pPool2->GetItemCount2( XATTR_LINESTART );
2470             for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2471             {
2472                 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate );
2473 
2474                 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2475                 {
2476                     // if there is already an item with the same name and the same
2477                     // value its ok to set it
2478                     if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
2479                     {
2480                         // same name but different value, we need a new name for this item
2481                         aUniqueName = String();
2482                         bForceNew = sal_True;
2483                     }
2484                     break;
2485                 }
2486             }
2487 
2488             if( !bForceNew )
2489             {
2490                 nCount = pPool2->GetItemCount2( XATTR_LINEEND );
2491                 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
2492                 {
2493                     const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate );
2494 
2495                     if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
2496                     {
2497                         // if there is already an item with the same name and the same
2498                         // value its ok to set it
2499                         if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
2500                         {
2501                             // same name but different value, we need a new name for this item
2502                             aUniqueName = String();
2503                             bForceNew = sal_True;
2504                         }
2505                         break;
2506                     }
2507                 }
2508             }
2509         }
2510 
2511         // if we have no name yet, find existing item with same conent or
2512         // create a unique name
2513         if( aUniqueName.Len() == 0 )
2514         {
2515             sal_Bool bFoundExisting = sal_False;
2516 
2517             sal_Int32 nUserIndex = 1;
2518             const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
2519             const String aUser( aRes );
2520 
2521             if( pPool1 )
2522             {
2523                 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
2524                 sal_uInt32 nSurrogate2;
2525 
2526                 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2527                 {
2528                     const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
2529 
2530                     if( pItem && pItem->GetName().Len() )
2531                     {
2532                         if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() )
2533                         {
2534                             aUniqueName = pItem->GetName();
2535                             bFoundExisting = sal_True;
2536                             break;
2537                         }
2538 
2539                         if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2540                         {
2541                             sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2542                             if( nThisIndex >= nUserIndex )
2543                                 nUserIndex = nThisIndex + 1;
2544                         }
2545                     }
2546                 }
2547 
2548                 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
2549                 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
2550                 {
2551                     const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
2552 
2553                     if( pItem && pItem->GetName().Len() )
2554                     {
2555                         if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() )
2556                         {
2557                             aUniqueName = pItem->GetName();
2558                             bFoundExisting = sal_True;
2559                             break;
2560                         }
2561 
2562                         if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
2563                         {
2564                             sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
2565                             if( nThisIndex >= nUserIndex )
2566                                 nUserIndex = nThisIndex + 1;
2567                         }
2568                     }
2569                 }
2570             }
2571 
2572             if( !bFoundExisting )
2573             {
2574                 aUniqueName = aUser;
2575                 aUniqueName += sal_Unicode(' ');
2576                 aUniqueName += String::CreateFromInt32( nUserIndex );
2577             }
2578         }
2579 
2580         // if the given name is not valid, replace it!
2581         if( aUniqueName != GetName() || pTempItem )
2582         {
2583             if( pTempItem )
2584             {
2585                 pTempItem->SetName( aUniqueName );
2586                 return pTempItem;
2587             }
2588             else
2589             {
2590                 return new XLineEndItem( aUniqueName, maPolyPolygon );
2591             }
2592         }
2593     }
2594 
2595     return (XLineEndItem*)this;
2596 }
2597 
2598 
2599 //------------------------------------------------------------------------
2600 
2601 SfxItemPresentation XLineEndItem::GetPresentation
2602 (
2603     SfxItemPresentation ePres,
2604     SfxMapUnit          /*eCoreUnit*/,
2605     SfxMapUnit          /*ePresUnit*/,
2606     XubString&          rText, const IntlWrapper *
2607 )   const
2608 {
2609     switch ( ePres )
2610     {
2611         case SFX_ITEM_PRESENTATION_NONE:
2612             rText.Erase();
2613             return ePres;
2614         case SFX_ITEM_PRESENTATION_NAMELESS:
2615         case SFX_ITEM_PRESENTATION_COMPLETE:
2616             rText = GetName();
2617             return ePres;
2618         default:
2619             return SFX_ITEM_PRESENTATION_NONE;
2620     }
2621 }
2622 
2623 sal_Bool XLineEndItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
2624 {
2625 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2626     nMemberId &= ~CONVERT_TWIPS;
2627     if( nMemberId == MID_NAME )
2628     {
2629         rtl::OUString aApiName;
2630         SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
2631         rVal <<= aApiName;
2632     }
2633     else
2634     {
2635         com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
2636         SvxConvertB2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
2637         rVal <<= aBezier;
2638     }
2639     return sal_True;
2640 }
2641 
2642 sal_Bool XLineEndItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
2643 {
2644 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2645     nMemberId &= ~CONVERT_TWIPS;
2646     if( nMemberId == MID_NAME )
2647     {
2648         return sal_False;
2649     }
2650     else
2651     {
2652         maPolyPolygon.clear();
2653 
2654         if( rVal.hasValue() && rVal.getValue() )
2655         {
2656             if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
2657                 return sal_False;
2658 
2659             com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
2660             if( pCoords->Coordinates.getLength() > 0 )
2661             {
2662                 maPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords );
2663                 // #i72807# close line start/end polygons hard
2664                 // maPolyPolygon.setClosed(true);
2665             }
2666         }
2667     }
2668 
2669     return sal_True;
2670 }
2671 
2672 // ----------------------------
2673 // class XLineStartWidthItem
2674 // ----------------------------
2675 TYPEINIT1_AUTOFACTORY(XLineStartWidthItem, SfxMetricItem);
2676 
2677 /*************************************************************************
2678 |*
2679 |*    XLineStartWidthItem::XLineStartWidthItem(sal_Int32 nWidth)
2680 |*
2681 |*    Beschreibung
2682 |*    Ersterstellung    15.11.94
2683 |*    Letzte Aenderung  18.11.94
2684 |*
2685 *************************************************************************/
2686 
2687 XLineStartWidthItem::XLineStartWidthItem(long nWidth) :
2688     SfxMetricItem(XATTR_LINESTARTWIDTH, nWidth)
2689 {
2690 }
2691 
2692 /*************************************************************************
2693 |*
2694 |*    XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn)
2695 |*
2696 |*    Beschreibung
2697 |*    Ersterstellung    15.11.94
2698 |*    Letzte Aenderung  15.11.94
2699 |*
2700 *************************************************************************/
2701 
2702 XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn) :
2703     SfxMetricItem(XATTR_LINESTARTWIDTH, rIn)
2704 {
2705 }
2706 
2707 /*************************************************************************
2708 |*
2709 |*    XLineStartWidthItem::Clone(SfxItemPool* pPool) const
2710 |*
2711 |*    Beschreibung
2712 |*    Ersterstellung    15.11.94
2713 |*    Letzte Aenderung  15.11.94
2714 |*
2715 *************************************************************************/
2716 
2717 SfxPoolItem* XLineStartWidthItem::Clone(SfxItemPool* /*pPool*/) const
2718 {
2719     return new XLineStartWidthItem(*this);
2720 }
2721 
2722 /*************************************************************************
2723 |*
2724 |*    SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, sal_uInt16 nVer)
2725 |*                                              const
2726 |*
2727 |*    Beschreibung
2728 |*    Ersterstellung    15.11.94
2729 |*    Letzte Aenderung  15.11.94
2730 |*
2731 *************************************************************************/
2732 
2733 SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2734 {
2735     return new XLineStartWidthItem(rIn);
2736 }
2737 
2738 //------------------------------------------------------------------------
2739 
2740 SfxItemPresentation XLineStartWidthItem::GetPresentation
2741 (
2742     SfxItemPresentation ePres,
2743     SfxMapUnit          eCoreUnit,
2744     SfxMapUnit          ePresUnit,
2745     XubString&          rText, const IntlWrapper * pIntl
2746 )   const
2747 {
2748     switch ( ePres )
2749     {
2750         case SFX_ITEM_PRESENTATION_NONE:
2751             rText.Erase();
2752             return ePres;
2753         case SFX_ITEM_PRESENTATION_NAMELESS:
2754         case SFX_ITEM_PRESENTATION_COMPLETE:
2755             rText = GetMetricText( (long) GetValue(),
2756                                     eCoreUnit, ePresUnit, pIntl);
2757             rText += SVX_RESSTR( GetMetricId( ePresUnit) );
2758             return ePres;
2759         default:
2760             return SFX_ITEM_PRESENTATION_NONE;
2761     }
2762 }
2763 
2764 sal_Bool XLineStartWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2765 {
2766     rVal <<= (sal_Int32)GetValue();
2767     return sal_True;
2768 }
2769 
2770 sal_Bool XLineStartWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2771 {
2772     sal_Int32 nValue = 0;
2773     rVal >>= nValue;
2774     SetValue( nValue );
2775     return sal_True;
2776 }
2777 
2778 
2779 
2780 // --------------------------
2781 // class XLineEndWidthItem
2782 // --------------------------
2783 TYPEINIT1_AUTOFACTORY(XLineEndWidthItem, SfxMetricItem);
2784 
2785 /*************************************************************************
2786 |*
2787 |*    XLineEndWidthItem::XLineEndWidthItem(long nWidth)
2788 |*
2789 |*    Beschreibung
2790 |*    Ersterstellung    15.11.94
2791 |*    Letzte Aenderung  15.11.94
2792 |*
2793 *************************************************************************/
2794 
2795 XLineEndWidthItem::XLineEndWidthItem(long nWidth) :
2796    SfxMetricItem(XATTR_LINEENDWIDTH, nWidth)
2797 {
2798 }
2799 
2800 /*************************************************************************
2801 |*
2802 |*    XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn)
2803 |*
2804 |*    Beschreibung
2805 |*    Ersterstellung    15.11.94
2806 |*    Letzte Aenderung  15.11.94
2807 |*
2808 *************************************************************************/
2809 
2810 XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn) :
2811     SfxMetricItem(XATTR_LINEENDWIDTH, rIn)
2812 {
2813 }
2814 
2815 /*************************************************************************
2816 |*
2817 |*    XLineEndWidthItem::Clone(SfxItemPool* pPool) const
2818 |*
2819 |*    Beschreibung
2820 |*    Ersterstellung    15.11.94
2821 |*    Letzte Aenderung  15.11.94
2822 |*
2823 *************************************************************************/
2824 
2825 SfxPoolItem* XLineEndWidthItem::Clone(SfxItemPool* /*pPool*/) const
2826 {
2827     return new XLineEndWidthItem(*this);
2828 }
2829 
2830 /*************************************************************************
2831 |*
2832 |*    SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, sal_uInt16 nVer) const
2833 |*
2834 |*    Beschreibung
2835 |*    Ersterstellung    15.11.94
2836 |*    Letzte Aenderung  15.11.94
2837 |*
2838 *************************************************************************/
2839 
2840 SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2841 {
2842     return new XLineEndWidthItem(rIn);
2843 }
2844 
2845 //------------------------------------------------------------------------
2846 
2847 SfxItemPresentation XLineEndWidthItem::GetPresentation
2848 (
2849     SfxItemPresentation ePres,
2850     SfxMapUnit          eCoreUnit,
2851     SfxMapUnit          ePresUnit,
2852     XubString&          rText, const IntlWrapper *pIntl
2853 )   const
2854 {
2855     switch ( ePres )
2856     {
2857         case SFX_ITEM_PRESENTATION_NONE:
2858             rText.Erase();
2859             return ePres;
2860         case SFX_ITEM_PRESENTATION_NAMELESS:
2861         case SFX_ITEM_PRESENTATION_COMPLETE:
2862             rText = GetMetricText( (long) GetValue(),
2863                                     eCoreUnit, ePresUnit, pIntl);
2864             rText += SVX_RESSTR( GetMetricId( ePresUnit) );
2865             return ePres;
2866         default:
2867             return SFX_ITEM_PRESENTATION_NONE;
2868     }
2869 }
2870 
2871 sal_Bool XLineEndWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2872 {
2873     rVal <<= (sal_Int32)GetValue();
2874     return sal_True;
2875 }
2876 
2877 sal_Bool XLineEndWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2878 {
2879     sal_Int32 nValue = 0;
2880     rVal >>= nValue;
2881     SetValue( nValue );
2882     return sal_True;
2883 }
2884 
2885 
2886 // -----------------------------
2887 // class XLineStartCenterItem
2888 // -----------------------------
2889 TYPEINIT1_AUTOFACTORY(XLineStartCenterItem, SfxBoolItem);
2890 
2891 /*************************************************************************
2892 |*
2893 |*    XLineStartCenterItem::XLineStartCenterItem(sal_Bool bStartCenter)
2894 |*
2895 |*    Beschreibung
2896 |*    Ersterstellung    15.11.94
2897 |*    Letzte Aenderung  15.11.94
2898 |*
2899 *************************************************************************/
2900 
2901 XLineStartCenterItem::XLineStartCenterItem(sal_Bool bStartCenter) :
2902     SfxBoolItem(XATTR_LINESTARTCENTER, bStartCenter)
2903 {
2904 }
2905 
2906 /*************************************************************************
2907 |*
2908 |*    XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn)
2909 |*
2910 |*    Beschreibung
2911 |*    Ersterstellung    15.11.94
2912 |*    Letzte Aenderung  15.11.94
2913 |*
2914 *************************************************************************/
2915 
2916 XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn) :
2917     SfxBoolItem(XATTR_LINESTARTCENTER, rIn)
2918 {
2919 }
2920 
2921 /*************************************************************************
2922 |*
2923 |*    XLineStartCenterItem::Clone(SfxItemPool* pPool) const
2924 |*
2925 |*    Beschreibung
2926 |*    Ersterstellung    15.11.94
2927 |*    Letzte Aenderung  15.11.94
2928 |*
2929 *************************************************************************/
2930 
2931 SfxPoolItem* XLineStartCenterItem::Clone(SfxItemPool* /*pPool*/) const
2932 {
2933     return new XLineStartCenterItem(*this);
2934 }
2935 
2936 /*************************************************************************
2937 |*
2938 |*    SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, sal_uInt16 nVer)
2939 |*                                              const
2940 |*
2941 |*    Beschreibung
2942 |*    Ersterstellung    15.11.94
2943 |*    Letzte Aenderung  15.11.94
2944 |*
2945 *************************************************************************/
2946 
2947 SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
2948 {
2949     return new XLineStartCenterItem(rIn);
2950 }
2951 
2952 //------------------------------------------------------------------------
2953 
2954 SfxItemPresentation XLineStartCenterItem::GetPresentation
2955 (
2956     SfxItemPresentation ePres,
2957     SfxMapUnit          /*eCoreUnit*/,
2958     SfxMapUnit          /*ePresUnit*/,
2959     XubString&          rText, const IntlWrapper *
2960 )   const
2961 {
2962     switch ( ePres )
2963     {
2964         case SFX_ITEM_PRESENTATION_NONE:
2965             rText.Erase();
2966             return ePres;
2967         case SFX_ITEM_PRESENTATION_NAMELESS:
2968         case SFX_ITEM_PRESENTATION_COMPLETE:
2969             rText = XubString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
2970                             RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
2971             return ePres;
2972         default:
2973             return SFX_ITEM_PRESENTATION_NONE;
2974     }
2975 }
2976 
2977 sal_Bool XLineStartCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2978 {
2979     sal_Bool bValue = GetValue();
2980     rVal.setValue( &bValue, ::getCppuBooleanType()  );
2981     return sal_True;
2982 }
2983 
2984 sal_Bool XLineStartCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2985 {
2986     if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
2987         return sal_False;
2988 
2989     SetValue( *(sal_Bool*)rVal.getValue() );
2990     return sal_True;
2991 }
2992 
2993 
2994 // ---------------------------
2995 // class XLineEndCenterItem
2996 // ---------------------------
2997 TYPEINIT1_AUTOFACTORY(XLineEndCenterItem, SfxBoolItem);
2998 
2999 /*************************************************************************
3000 |*
3001 |*    XLineEndCenterItem::XLineEndCenterItem(sal_Bool bEndCenter)
3002 |*
3003 |*    Beschreibung
3004 |*    Ersterstellung    15.11.94
3005 |*    Letzte Aenderung  15.11.94
3006 |*
3007 *************************************************************************/
3008 
3009 XLineEndCenterItem::XLineEndCenterItem(sal_Bool bEndCenter) :
3010     SfxBoolItem(XATTR_LINEENDCENTER, bEndCenter)
3011 {
3012 }
3013 
3014 /*************************************************************************
3015 |*
3016 |*    XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn)
3017 |*
3018 |*    Beschreibung
3019 |*    Ersterstellung    15.11.94
3020 |*    Letzte Aenderung  15.11.94
3021 |*
3022 *************************************************************************/
3023 
3024 XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn) :
3025     SfxBoolItem(XATTR_LINEENDCENTER, rIn)
3026 {
3027 }
3028 
3029 /*************************************************************************
3030 |*
3031 |*    XLineEndCenterItem::Clone(SfxItemPool* pPool) const
3032 |*
3033 |*    Beschreibung
3034 |*    Ersterstellung    15.11.94
3035 |*    Letzte Aenderung  15.11.94
3036 |*
3037 *************************************************************************/
3038 
3039 SfxPoolItem* XLineEndCenterItem::Clone(SfxItemPool* /*pPool*/) const
3040 {
3041     return new XLineEndCenterItem(*this);
3042 }
3043 
3044 /*************************************************************************
3045 |*
3046 |*    SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, sal_uInt16 nVer)
3047 |*                                              const
3048 |*
3049 |*    Beschreibung
3050 |*    Ersterstellung    15.11.94
3051 |*    Letzte Aenderung  15.11.94
3052 |*
3053 *************************************************************************/
3054 
3055 SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
3056 {
3057     return new XLineEndCenterItem(rIn);
3058 }
3059 
3060 //------------------------------------------------------------------------
3061 
3062 SfxItemPresentation XLineEndCenterItem::GetPresentation
3063 (
3064     SfxItemPresentation ePres,
3065     SfxMapUnit          /*eCoreUnit*/,
3066     SfxMapUnit          /*ePresUnit*/,
3067     XubString&          rText, const IntlWrapper *
3068 )   const
3069 {
3070     switch ( ePres )
3071     {
3072         case SFX_ITEM_PRESENTATION_NONE:
3073             rText.Erase();
3074             return ePres;
3075         case SFX_ITEM_PRESENTATION_NAMELESS:
3076         case SFX_ITEM_PRESENTATION_COMPLETE:
3077             rText = XubString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
3078                             RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
3079             return ePres;
3080         default:
3081             return SFX_ITEM_PRESENTATION_NONE;
3082     }
3083 }
3084 
3085 sal_Bool XLineEndCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
3086 {
3087     sal_Bool bValue = GetValue();
3088     rVal.setValue( &bValue, ::getCppuBooleanType()  );
3089     return sal_True;
3090 }
3091 
3092 sal_Bool XLineEndCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
3093 {
3094     if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
3095         return sal_False;
3096 
3097     SetValue( *(sal_Bool*)rVal.getValue() );
3098     return sal_True;
3099 }
3100 
3101 
3102 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3103 //                           Fuellattribute
3104 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3105 
3106 // --------------------
3107 // class XFillStyleItem
3108 // --------------------
3109 TYPEINIT1_AUTOFACTORY(XFillStyleItem, SfxEnumItem);
3110 
3111 /*************************************************************************
3112 |*
3113 |*    XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle)
3114 |*
3115 |*    Beschreibung
3116 |*    Ersterstellung    15.11.94
3117 |*    Letzte Aenderung  15.11.94
3118 |*
3119 *************************************************************************/
3120 
3121 XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle) :
3122     SfxEnumItem(XATTR_FILLSTYLE, sal::static_int_cast< sal_uInt16 >(eFillStyle))
3123 {
3124 }
3125 
3126 /*************************************************************************
3127 |*
3128 |*    XFillStyleItem::XFillStyleItem(SvStream& rIn)
3129 |*
3130 |*    Beschreibung
3131 |*    Ersterstellung    15.11.94
3132 |*    Letzte Aenderung  15.11.94
3133 |*
3134 *************************************************************************/
3135 
3136 XFillStyleItem::XFillStyleItem(SvStream& rIn) :
3137     SfxEnumItem(XATTR_FILLSTYLE, rIn)
3138 {
3139 }
3140 
3141 /*************************************************************************
3142 |*
3143 |*    XFillStyleItem::Clone(SfxItemPool* pPool) const
3144 |*
3145 |*    Beschreibung
3146 |*    Ersterstellung    09.11.94
3147 |*    Letzte Aenderung  09.11.94
3148 |*
3149 *************************************************************************/
3150 
3151 SfxPoolItem* XFillStyleItem::Clone(SfxItemPool* /*pPool*/) const
3152 {
3153     return new XFillStyleItem( *this );
3154 }
3155 
3156 /*************************************************************************
3157 |*
3158 |*    SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const
3159 |*
3160 |*    Beschreibung
3161 |*    Ersterstellung    15.11.94
3162 |*    Letzte Aenderung  15.11.94
3163 |*
3164 *************************************************************************/
3165 
3166 SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
3167 {
3168     return new XFillStyleItem(rIn);
3169 }
3170 
3171 //------------------------------------------------------------------------
3172 
3173 SfxItemPresentation XFillStyleItem::GetPresentation
3174 (
3175     SfxItemPresentation ePres,
3176     SfxMapUnit          /*eCoreUnit*/,
3177     SfxMapUnit          /*ePresUnit*/,
3178     XubString&          rText, const IntlWrapper *
3179 )   const
3180 {
3181     rText.Erase();
3182 
3183     switch ( ePres )
3184     {
3185         case SFX_ITEM_PRESENTATION_NONE:
3186             return ePres;
3187 
3188         case SFX_ITEM_PRESENTATION_NAMELESS:
3189         case SFX_ITEM_PRESENTATION_COMPLETE:
3190         {
3191             sal_uInt16 nId = 0;
3192 
3193             switch( (sal_uInt16)GetValue() )
3194             {
3195                 case XFILL_NONE:
3196                     nId = RID_SVXSTR_INVISIBLE;
3197                     break;
3198                 case XFILL_SOLID:
3199                     nId = RID_SVXSTR_SOLID;
3200                     break;
3201                 case XFILL_GRADIENT:
3202                     nId = RID_SVXSTR_GRADIENT;
3203                     break;
3204                 case XFILL_HATCH:
3205                     nId = RID_SVXSTR_HATCH;
3206                     break;
3207                 case XFILL_BITMAP:
3208                     nId = RID_SVXSTR_BITMAP;
3209                     break;
3210             }
3211 
3212             if ( nId )
3213                 rText = SVX_RESSTR( nId );
3214             return ePres;
3215         }
3216         default:
3217             return SFX_ITEM_PRESENTATION_NONE;
3218     }
3219 }
3220 
3221 //------------------------------------------------------------------------
3222 
3223 sal_uInt16 XFillStyleItem::GetValueCount() const
3224 {
3225     return 5;
3226 }
3227 
3228 // -----------------------------------------------------------------------
3229 sal_Bool XFillStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
3230 {
3231     ::com::sun::star::drawing::FillStyle eFS = (::com::sun::star::drawing::FillStyle)GetValue();
3232 
3233     rVal <<= eFS;
3234 
3235     return sal_True;
3236 }
3237 
3238 // -----------------------------------------------------------------------
3239 sal_Bool XFillStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
3240 {
3241     ::com::sun::star::drawing::FillStyle eFS;
3242     if(!(rVal >>= eFS))
3243     {
3244         // also try an int (for Basic)
3245         sal_Int32 nFS = 0;
3246         if(!(rVal >>= nFS))
3247             return sal_False;
3248         eFS = (::com::sun::star::drawing::FillStyle)nFS;
3249     }
3250 
3251     SetValue( sal::static_int_cast< sal_uInt16 >( eFS ) );
3252 
3253     return sal_True;
3254 }
3255 
3256 
3257 // -------------------
3258 // class XFillColorItem
3259 // -------------------
3260 TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem);
3261 
3262 /*************************************************************************
3263 |*
3264 |*    XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor)
3265 |*
3266 |*    Beschreibung
3267 |*    Ersterstellung    15.11.94
3268 |*    Letzte Aenderung  15.11.94
3269 |*
3270 *************************************************************************/
3271 
3272 XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor) :
3273     XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor)
3274 {
3275 }
3276 
3277 /*************************************************************************
3278 |*
3279 |*    XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor)
3280 |*
3281 |*    Beschreibung
3282 |*    Ersterstellung    15.11.94
3283 |*    Letzte Aenderung  15.11.94
3284 |*
3285 *************************************************************************/
3286 
3287 XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor) :
3288     XColorItem(XATTR_FILLCOLOR, rName, rTheColor)
3289 {
3290 }
3291 
3292 /*************************************************************************
3293 |*
3294 |*    XFillColorItem::XFillColorItem(SvStream& rIn)
3295 |*
3296 |*    Beschreibung
3297 |*    Ersterstellung    15.11.94
3298 |*    Letzte Aenderung  15.11.94
3299 |*
3300 *************************************************************************/
3301 
3302 XFillColorItem::XFillColorItem(SvStream& rIn) :
3303     XColorItem(XATTR_FILLCOLOR, rIn)
3304 {
3305 }
3306 
3307 /*************************************************************************
3308 |*
3309 |*    XFillColorItem::Clone(SfxItemPool* pPool) const
3310 |*
3311 |*    Beschreibung
3312 |*    Ersterstellung    15.11.94
3313 |*    Letzte Aenderung  15.11.94
3314 |*
3315 *************************************************************************/
3316 
3317 SfxPoolItem* XFillColorItem::Clone(SfxItemPool* /*pPool*/) const
3318 {
3319     return new XFillColorItem(*this);
3320 }
3321 
3322 /*************************************************************************
3323 |*
3324 |*    SfxPoolItem* XFillColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
3325 |*
3326 |*    Beschreibung
3327 |*    Ersterstellung    15.11.94
3328 |*    Letzte Aenderung  15.11.94
3329 |*
3330 *************************************************************************/
3331 
3332 SfxPoolItem* XFillColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
3333 {
3334     return new XFillColorItem(rIn);
3335 }
3336 
3337 //------------------------------------------------------------------------
3338 
3339 SfxItemPresentation XFillColorItem::GetPresentation
3340 (
3341     SfxItemPresentation ePres,
3342     SfxMapUnit          /*eCoreUnit*/,
3343     SfxMapUnit          /*ePresUnit*/,
3344     XubString&          rText, const IntlWrapper *
3345 )   const
3346 {
3347     switch ( ePres )
3348     {
3349         case SFX_ITEM_PRESENTATION_NONE:
3350             rText.Erase();
3351             return ePres;
3352         case SFX_ITEM_PRESENTATION_NAMELESS:
3353         case SFX_ITEM_PRESENTATION_COMPLETE:
3354             rText = GetName();
3355             return ePres;
3356         default:
3357             return SFX_ITEM_PRESENTATION_NONE;
3358     }
3359 }
3360 
3361 // -----------------------------------------------------------------------
3362 
3363 sal_Bool XFillColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
3364 {
3365     rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
3366 
3367     return sal_True;
3368 }
3369 
3370 // -----------------------------------------------------------------------
3371 
3372 sal_Bool XFillColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
3373 {
3374     sal_Int32 nValue = 0;
3375     if(!(rVal >>= nValue ))
3376         return sal_False;
3377 
3378     SetColorValue( nValue );
3379     return sal_True;
3380 }
3381 
3382 // -----------------------------
3383 // class XSecondaryFillColorItem
3384 // -----------------------------
3385 TYPEINIT1_AUTOFACTORY(XSecondaryFillColorItem, XColorItem);
3386 
3387 XSecondaryFillColorItem::XSecondaryFillColorItem(sal_Int32 nIndex, const Color& rTheColor) :
3388     XColorItem(XATTR_SECONDARYFILLCOLOR, nIndex, rTheColor)
3389 {
3390 }
3391 
3392 XSecondaryFillColorItem::XSecondaryFillColorItem(const XubString& rName, const Color& rTheColor) :
3393     XColorItem(XATTR_SECONDARYFILLCOLOR, rName, rTheColor)
3394 {
3395 }
3396 
3397 XSecondaryFillColorItem::XSecondaryFillColorItem( SvStream& rIn ) :
3398     XColorItem(XATTR_SECONDARYFILLCOLOR, rIn)
3399 {
3400 }
3401 
3402 SfxPoolItem* XSecondaryFillColorItem::Clone(SfxItemPool* /*pPool*/) const
3403 {
3404     return new XSecondaryFillColorItem(*this);
3405 }
3406 
3407 SfxPoolItem* XSecondaryFillColorItem::Create( SvStream& rIn, sal_uInt16 nVer ) const
3408 {
3409     if ( nVer >= 2 )
3410         return new XSecondaryFillColorItem( rIn );
3411     else
3412         return new XSecondaryFillColorItem( String(), Color(0,184,255) );
3413 }
3414 sal_uInt16 XSecondaryFillColorItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const
3415 {
3416     return 2;
3417 }
3418 SfxItemPresentation XSecondaryFillColorItem::GetPresentation
3419 (
3420     SfxItemPresentation ePres,
3421     SfxMapUnit          /*eCoreUnit*/,
3422     SfxMapUnit          /*ePresUnit*/,
3423     XubString&          rText, const IntlWrapper *
3424 )   const
3425 {
3426     switch ( ePres )
3427     {
3428         case SFX_ITEM_PRESENTATION_NONE:
3429             rText.Erase();
3430             return ePres;
3431         case SFX_ITEM_PRESENTATION_NAMELESS:
3432         case SFX_ITEM_PRESENTATION_COMPLETE:
3433             rText = GetName();
3434             return ePres;
3435         default:
3436             return SFX_ITEM_PRESENTATION_NONE;
3437     }
3438 }
3439 
3440 // ----------------
3441 // class XGradient
3442 // ----------------
3443 
3444 /*************************************************************************
3445 |*
3446 |*    XGradient::XGradient()
3447 |*
3448 *************************************************************************/
3449 
3450 XGradient::XGradient() :
3451     eStyle( XGRAD_LINEAR ),
3452     aStartColor( Color( COL_BLACK ) ),
3453     aEndColor( Color( COL_WHITE ) ),
3454     nAngle( 0 ),
3455     nBorder( 0 ),
3456     nOfsX( 50 ),
3457     nOfsY( 50 ),
3458     nIntensStart( 100 ),
3459     nIntensEnd( 100 ),
3460     nStepCount( 0 )
3461 {
3462 }
3463 
3464 /*************************************************************************
3465 |*
3466 |*    XGradient::XGradient(XGradientStyle, const Color&, const Color&,
3467 |*                         long, sal_uInt16, sal_uInt16, sal_uInt16)
3468 |*
3469 |*    Beschreibung
3470 |*    Ersterstellung    21.11.94
3471 |*    Letzte Aenderung  21.11.94
3472 |*
3473 *************************************************************************/
3474 
3475 XGradient::XGradient(const Color& rStart, const Color& rEnd,
3476                      XGradientStyle eTheStyle, long nTheAngle, sal_uInt16 nXOfs,
3477                      sal_uInt16 nYOfs, sal_uInt16 nTheBorder,
3478                      sal_uInt16 nStartIntens, sal_uInt16 nEndIntens,
3479                      sal_uInt16 nSteps) :
3480     eStyle(eTheStyle),
3481     aStartColor(rStart),
3482     aEndColor(rEnd),
3483     nAngle(nTheAngle),
3484     nBorder(nTheBorder),
3485     nOfsX(nXOfs),
3486     nOfsY(nYOfs),
3487     nIntensStart(nStartIntens),
3488     nIntensEnd(nEndIntens),
3489     nStepCount(nSteps)
3490 {
3491 }
3492 
3493 /*************************************************************************
3494 |*
3495 |*    int XGradient::operator==(const SfxPoolItem& rItem) const
3496 |*
3497 |*    Beschreibung
3498 |*    Ersterstellung    29.11.94
3499 |*    Letzte Aenderung  29.11.94
3500 |*
3501 *************************************************************************/
3502 
3503 bool XGradient::operator==(const XGradient& rGradient) const
3504 {
3505     return ( eStyle         == rGradient.eStyle         &&
3506              aStartColor    == rGradient.aStartColor    &&
3507              aEndColor      == rGradient.aEndColor      &&
3508              nAngle         == rGradient.nAngle         &&
3509              nBorder        == rGradient.nBorder        &&
3510              nOfsX          == rGradient.nOfsX          &&
3511              nOfsY          == rGradient.nOfsY          &&
3512              nIntensStart   == rGradient.nIntensStart   &&
3513              nIntensEnd     == rGradient.nIntensEnd     &&
3514              nStepCount     == rGradient.nStepCount );
3515 }
3516 
3517 
3518 // -----------------------
3519 // class XFillGradientItem
3520 // -----------------------
3521 TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex);
3522 
3523 /*************************************************************************
3524 |*
3525 |*    XFillGradientItem::XFillGradientItem(sal_Int32 nIndex,
3526 |*                                       const XGradient& rTheGradient)
3527 |*
3528 |*    Beschreibung
3529 |*    Ersterstellung    15.11.94
3530 |*    Letzte Aenderung  15.11.94
3531 |*
3532 *************************************************************************/
3533 
3534 XFillGradientItem::XFillGradientItem(sal_Int32 nIndex,
3535                                    const XGradient& rTheGradient) :
3536     NameOrIndex(XATTR_FILLGRADIENT, nIndex),
3537     aGradient(rTheGradient)
3538 {
3539 }
3540 
3541 /*************************************************************************
3542 |*
3543 |*    XFillGradientItem::XFillGradientItem(const XubString& rName,
3544 |*                                       const XGradient& rTheGradient)
3545 |*
3546 |*    Beschreibung
3547 |*    Ersterstellung    15.11.94
3548 |*    Letzte Aenderung  15.11.94
3549 |*
3550 *************************************************************************/
3551 
3552 XFillGradientItem::XFillGradientItem(const XubString& rName,
3553                                    const XGradient& rTheGradient) :
3554     NameOrIndex(XATTR_FILLGRADIENT, rName),
3555     aGradient(rTheGradient)
3556 {
3557 }
3558 
3559 /*************************************************************************
3560 |*
3561 |*    XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem)
3562 |*
3563 |*    Beschreibung
3564 |*    Ersterstellung    15.11.94
3565 |*    Letzte Aenderung  15.11.94
3566 |*
3567 *************************************************************************/
3568 
3569 XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem) :
3570     NameOrIndex(rItem),
3571     aGradient(rItem.aGradient)
3572 {
3573 }
3574 
3575 /*************************************************************************
3576 |*
3577 |*    XFillGradientItem::XFillGradientItem(SvStream& rIn)
3578 |*
3579 |*    Beschreibung
3580 |*    Ersterstellung    15.11.94
3581 |*    Letzte Aenderung  15.11.94
3582 |*
3583 *************************************************************************/
3584 
3585 XFillGradientItem::XFillGradientItem(SvStream& rIn, sal_uInt16 nVer) :
3586     NameOrIndex(XATTR_FILLGRADIENT, rIn),
3587     aGradient(COL_BLACK, COL_WHITE)
3588 {
3589     if (!IsIndex())
3590     {
3591         sal_uInt16 nUSTemp;
3592         sal_uInt16 nRed;
3593         sal_uInt16 nGreen;
3594         sal_uInt16 nBlue;
3595         sal_Int16  nITemp;
3596         sal_Int32  nLTemp;
3597 
3598         rIn >> nITemp; aGradient.SetGradientStyle((XGradientStyle)nITemp);
3599         rIn >> nRed;
3600         rIn >> nGreen;
3601         rIn >> nBlue;
3602         Color aCol;
3603         aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
3604         aGradient.SetStartColor( aCol );
3605 
3606         rIn >> nRed;
3607         rIn >> nGreen;
3608         rIn >> nBlue;
3609         aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
3610         aGradient.SetEndColor(aCol);
3611         rIn >> nLTemp; aGradient.SetAngle(nLTemp);
3612         rIn >> nUSTemp; aGradient.SetBorder(nUSTemp);
3613         rIn >> nUSTemp; aGradient.SetXOffset(nUSTemp);
3614         rIn >> nUSTemp; aGradient.SetYOffset(nUSTemp);
3615         rIn >> nUSTemp; aGradient.SetStartIntens(nUSTemp);
3616         rIn >> nUSTemp; aGradient.SetEndIntens(nUSTemp);
3617 
3618         // bei neueren Versionen wird zusaetzlich
3619         // die Schrittweite mit eingelesen
3620         if (nVer >= 1)
3621         {
3622             rIn >> nUSTemp; aGradient.SetSteps(nUSTemp);
3623         }
3624     }
3625 }
3626 
3627 //*************************************************************************
3628 
3629 XFillGradientItem::XFillGradientItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient)
3630 :   NameOrIndex( XATTR_FILLGRADIENT, -1 ),
3631     aGradient(rTheGradient)
3632 {
3633 }
3634 
3635 //*************************************************************************
3636 
3637 XFillGradientItem::XFillGradientItem(SfxItemPool* /*pPool*/)
3638 : NameOrIndex(XATTR_FILLGRADIENT, -1 )
3639 {
3640 }
3641 
3642 /*************************************************************************
3643 |*
3644 |*    XFillGradientItem::Clone(SfxItemPool* pPool) const
3645 |*
3646 |*    Beschreibung
3647 |*    Ersterstellung    15.11.94
3648 |*    Letzte Aenderung  15.11.94
3649 |*
3650 *************************************************************************/
3651 
3652 SfxPoolItem* XFillGradientItem::Clone(SfxItemPool* /*pPool*/) const
3653 {
3654     return new XFillGradientItem(*this);
3655 }
3656 
3657 /*************************************************************************
3658 |*
3659 |*    int XFillGradientItem::operator==(const SfxPoolItem& rItem) const
3660 |*
3661 |*    Beschreibung
3662 |*    Ersterstellung    15.11.94
3663 |*    Letzte Aenderung  15.11.94
3664 |*
3665 *************************************************************************/
3666 
3667 int XFillGradientItem::operator==(const SfxPoolItem& rItem) const
3668 {
3669     return ( NameOrIndex::operator==(rItem) &&
3670              aGradient == ((const XFillGradientItem&) rItem).aGradient );
3671 }
3672 
3673 /*************************************************************************
3674 |*
3675 |*    SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, sal_uInt16 nVer) const
3676 |*
3677 |*    Beschreibung
3678 |*    Ersterstellung    15.11.94
3679 |*    Letzte Aenderung  15.11.94
3680 |*
3681 *************************************************************************/
3682 
3683 SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, sal_uInt16 nVer) const
3684 {
3685     return new XFillGradientItem(rIn, nVer);
3686 }
3687 
3688 /*************************************************************************
3689 |*
3690 |*    SfxPoolItem* XFillGradientItem::Store(SvStream& rOut) const
3691 |*
3692 |*    Beschreibung
3693 |*    Ersterstellung    15.11.94
3694 |*    Letzte Aenderung  15.11.94
3695 |*
3696 *************************************************************************/
3697 
3698 SvStream& XFillGradientItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
3699 {
3700     NameOrIndex::Store( rOut, nItemVersion );
3701 
3702     if (!IsIndex())
3703     {
3704         rOut << (sal_Int16)aGradient.GetGradientStyle();
3705 
3706         sal_uInt16 nTmp;
3707 
3708         nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetRed() ); rOut << nTmp;
3709         nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetGreen() ); rOut << nTmp;
3710         nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetBlue() ); rOut << nTmp;
3711         nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetRed() ); rOut << nTmp;
3712         nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetGreen() ); rOut << nTmp;
3713         nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetBlue() ); rOut << nTmp;
3714 
3715         rOut << (sal_Int32) aGradient.GetAngle();
3716         rOut << aGradient.GetBorder();
3717         rOut << aGradient.GetXOffset();
3718         rOut << aGradient.GetYOffset();
3719         rOut << aGradient.GetStartIntens();
3720         rOut << aGradient.GetEndIntens();
3721         rOut << aGradient.GetSteps();
3722     }
3723 
3724     return rOut;
3725 }
3726 
3727 /*************************************************************************
3728 |*
3729 |*    const XGradient& XFillGradientItem::GetValue(const XGradientList* pTable)
3730 |*                                                                 const
3731 |*
3732 |*    Beschreibung
3733 |*    Ersterstellung    15.11.94
3734 |*    Letzte Aenderung  18.11.94
3735 |*
3736 *************************************************************************/
3737 
3738 const XGradient& XFillGradientItem::GetGradientValue(const XGradientList* pTable) const // GetValue -> GetGradientValue
3739 {
3740     if (!IsIndex())
3741         return aGradient;
3742     else
3743         return pTable->GetGradient(GetIndex())->GetGradient();
3744 }
3745 
3746 
3747 /*************************************************************************
3748 |*
3749 |*    sal_uInt16 XFillGradientItem::GetVersion() const
3750 |*
3751 |*    Beschreibung
3752 |*    Ersterstellung    01.11.95
3753 |*    Letzte Aenderung  01.11.95
3754 |*
3755 *************************************************************************/
3756 
3757 sal_uInt16 XFillGradientItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const
3758 {
3759     // !!! this version number also represents the version number of superclasses
3760     // !!! (e.g. XFillFloatTransparenceItem); if you make any changes here,
3761     // !!! the superclass is also affected
3762     return 1;
3763 }
3764 
3765 //------------------------------------------------------------------------
3766 
3767 SfxItemPresentation XFillGradientItem::GetPresentation
3768 (
3769     SfxItemPresentation ePres,
3770     SfxMapUnit          /*eCoreUnit*/,
3771     SfxMapUnit          /*ePresUnit*/,
3772     XubString&          rText, const IntlWrapper *
3773 )   const
3774 {
3775     switch ( ePres )
3776     {
3777         case SFX_ITEM_PRESENTATION_NONE:
3778             rText.Erase();
3779             return ePres;
3780         case SFX_ITEM_PRESENTATION_NAMELESS:
3781         case SFX_ITEM_PRESENTATION_COMPLETE:
3782             rText = GetName();
3783             return ePres;
3784         default:
3785             return SFX_ITEM_PRESENTATION_NONE;
3786     }
3787 }
3788 
3789 // -----------------------------------------------------------------------
3790 sal_Bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
3791 {
3792     //sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3793     nMemberId &= ~CONVERT_TWIPS;
3794     switch ( nMemberId )
3795     {
3796         case 0:
3797         {
3798             uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
3799 
3800             ::com::sun::star::awt::Gradient aGradient2;
3801 
3802             const XGradient& aXGradient = GetGradientValue();
3803             aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
3804             aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
3805             aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
3806             aGradient2.Angle = (short)aXGradient.GetAngle();
3807             aGradient2.Border = aXGradient.GetBorder();
3808             aGradient2.XOffset = aXGradient.GetXOffset();
3809             aGradient2.YOffset = aXGradient.GetYOffset();
3810             aGradient2.StartIntensity = aXGradient.GetStartIntens();
3811             aGradient2.EndIntensity = aXGradient.GetEndIntens();
3812             aGradient2.StepCount = aXGradient.GetSteps();
3813 
3814             rtl::OUString aApiName;
3815             SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
3816             aPropSeq[0].Name    = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
3817             aPropSeq[0].Value   = uno::makeAny( aApiName );
3818             aPropSeq[1].Name    = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ));
3819             aPropSeq[1].Value   = uno::makeAny( aGradient2 );
3820             rVal = uno::makeAny( aPropSeq );
3821             break;
3822         }
3823 
3824         case MID_FILLGRADIENT:
3825         {
3826             const XGradient& aXGradient = GetGradientValue();
3827             ::com::sun::star::awt::Gradient aGradient2;
3828 
3829             aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
3830             aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
3831             aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
3832             aGradient2.Angle = (short)aXGradient.GetAngle();
3833             aGradient2.Border = aXGradient.GetBorder();
3834             aGradient2.XOffset = aXGradient.GetXOffset();
3835             aGradient2.YOffset = aXGradient.GetYOffset();
3836             aGradient2.StartIntensity = aXGradient.GetStartIntens();
3837             aGradient2.EndIntensity = aXGradient.GetEndIntens();
3838             aGradient2.StepCount = aXGradient.GetSteps();
3839 
3840             rVal <<= aGradient2;
3841             break;
3842         }
3843 
3844         case MID_NAME:
3845         {
3846             rtl::OUString aApiName;
3847             SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
3848             rVal <<= aApiName;
3849             break;
3850         }
3851 
3852         case MID_GRADIENT_STYLE: rVal <<= (sal_Int16)GetGradientValue().GetGradientStyle(); break;
3853         case MID_GRADIENT_STARTCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetStartColor().GetColor(); break;
3854         case MID_GRADIENT_ENDCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetEndColor().GetColor(); break;
3855         case MID_GRADIENT_ANGLE: rVal <<= (sal_Int16)GetGradientValue().GetAngle(); break;
3856         case MID_GRADIENT_BORDER: rVal <<= GetGradientValue().GetBorder(); break;
3857         case MID_GRADIENT_XOFFSET: rVal <<= GetGradientValue().GetXOffset(); break;
3858         case MID_GRADIENT_YOFFSET: rVal <<= GetGradientValue().GetYOffset(); break;
3859         case MID_GRADIENT_STARTINTENSITY: rVal <<= GetGradientValue().GetStartIntens(); break;
3860         case MID_GRADIENT_ENDINTENSITY: rVal <<= GetGradientValue().GetEndIntens(); break;
3861         case MID_GRADIENT_STEPCOUNT: rVal <<= GetGradientValue().GetSteps(); break;
3862 
3863         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
3864     }
3865 
3866     return sal_True;
3867 }
3868 
3869 // -----------------------------------------------------------------------
3870 sal_Bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
3871 {
3872 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3873     nMemberId &= ~CONVERT_TWIPS;
3874 
3875     switch ( nMemberId )
3876     {
3877         case 0:
3878         {
3879             uno::Sequence< beans::PropertyValue >   aPropSeq;
3880             ::com::sun::star::awt::Gradient         aGradient2;
3881             rtl::OUString                           aName;
3882             bool                                    bGradient( false );
3883 
3884             if ( rVal >>= aPropSeq )
3885             {
3886                 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
3887                 {
3888                     if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" )))
3889                         aPropSeq[n].Value >>= aName;
3890                     else if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillGradient" )))
3891                     {
3892                         if ( aPropSeq[n].Value >>= aGradient2 )
3893                             bGradient = true;
3894                     }
3895                 }
3896 
3897                 SetName( aName );
3898                 if ( bGradient )
3899                 {
3900                     XGradient aXGradient;
3901 
3902                     aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
3903                     aXGradient.SetStartColor( aGradient2.StartColor );
3904                     aXGradient.SetEndColor( aGradient2.EndColor );
3905                     aXGradient.SetAngle( aGradient2.Angle );
3906                     aXGradient.SetBorder( aGradient2.Border );
3907                     aXGradient.SetXOffset( aGradient2.XOffset );
3908                     aXGradient.SetYOffset( aGradient2.YOffset );
3909                     aXGradient.SetStartIntens( aGradient2.StartIntensity );
3910                     aXGradient.SetEndIntens( aGradient2.EndIntensity );
3911                     aXGradient.SetSteps( aGradient2.StepCount );
3912 
3913                     SetGradientValue( aXGradient );
3914                 }
3915 
3916                 return sal_True;
3917             }
3918 
3919             return sal_False;
3920         }
3921 
3922         case MID_NAME:
3923         {
3924             rtl::OUString aName;
3925             if (!(rVal >>= aName ))
3926                 return sal_False;
3927             SetName( aName );
3928             break;
3929         }
3930 
3931         case MID_FILLGRADIENT:
3932         {
3933             ::com::sun::star::awt::Gradient aGradient2;
3934             if(!(rVal >>= aGradient2))
3935                 return sal_False;
3936 
3937             XGradient aXGradient;
3938 
3939             aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
3940             aXGradient.SetStartColor( aGradient2.StartColor );
3941             aXGradient.SetEndColor( aGradient2.EndColor );
3942             aXGradient.SetAngle( aGradient2.Angle );
3943             aXGradient.SetBorder( aGradient2.Border );
3944             aXGradient.SetXOffset( aGradient2.XOffset );
3945             aXGradient.SetYOffset( aGradient2.YOffset );
3946             aXGradient.SetStartIntens( aGradient2.StartIntensity );
3947             aXGradient.SetEndIntens( aGradient2.EndIntensity );
3948             aXGradient.SetSteps( aGradient2.StepCount );
3949 
3950             SetGradientValue( aXGradient );
3951             break;
3952         }
3953 
3954         case MID_GRADIENT_STARTCOLOR:
3955         case MID_GRADIENT_ENDCOLOR:
3956         {
3957             sal_Int32 nVal = 0;
3958             if(!(rVal >>= nVal ))
3959                 return sal_False;
3960 
3961             XGradient aXGradient = GetGradientValue();
3962 
3963             if ( nMemberId == MID_GRADIENT_STARTCOLOR )
3964                 aXGradient.SetStartColor( nVal );
3965             else
3966                 aXGradient.SetEndColor( nVal );
3967             SetGradientValue( aXGradient );
3968             break;
3969         }
3970 
3971         case MID_GRADIENT_STYLE:
3972         case MID_GRADIENT_ANGLE:
3973         case MID_GRADIENT_BORDER:
3974         case MID_GRADIENT_STARTINTENSITY:
3975         case MID_GRADIENT_ENDINTENSITY:
3976         case MID_GRADIENT_STEPCOUNT:
3977         case MID_GRADIENT_XOFFSET:
3978         case MID_GRADIENT_YOFFSET:
3979         {
3980             sal_Int16 nVal = sal_Int16();
3981             if(!(rVal >>= nVal ))
3982                 return sal_False;
3983 
3984             XGradient aXGradient = GetGradientValue();
3985 
3986             switch ( nMemberId )
3987             {
3988                 case MID_GRADIENT_STYLE:
3989                     aXGradient.SetGradientStyle( (XGradientStyle)nVal ); break;
3990                 case MID_GRADIENT_ANGLE:
3991                     aXGradient.SetAngle( nVal ); break;
3992                 case MID_GRADIENT_BORDER:
3993                     aXGradient.SetBorder( nVal ); break;
3994                 case MID_GRADIENT_STARTINTENSITY:
3995                     aXGradient.SetStartIntens( nVal ); break;
3996                 case MID_GRADIENT_ENDINTENSITY:
3997                     aXGradient.SetEndIntens( nVal ); break;
3998                 case MID_GRADIENT_STEPCOUNT:
3999                     aXGradient.SetSteps( nVal ); break;
4000                 case MID_GRADIENT_XOFFSET:
4001                     aXGradient.SetXOffset( nVal ); break;
4002                 case MID_GRADIENT_YOFFSET:
4003                     aXGradient.SetYOffset( nVal ); break;
4004             }
4005 
4006             SetGradientValue( aXGradient );
4007             break;
4008         }
4009     }
4010 
4011     return sal_True;
4012 }
4013 
4014 sal_Bool XFillGradientItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
4015 {
4016     return ((XFillGradientItem*)p1)->GetGradientValue() == ((XFillGradientItem*)p2)->GetGradientValue();
4017 }
4018 
4019 XFillGradientItem* XFillGradientItem::checkForUniqueItem( SdrModel* pModel ) const
4020 {
4021     if( pModel )
4022     {
4023         const String aUniqueName = NameOrIndex::CheckNamedItem( this,
4024                                                                 XATTR_FILLGRADIENT,
4025                                                                 &pModel->GetItemPool(),
4026                                                                 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
4027                                                                 XFillGradientItem::CompareValueFunc,
4028                                                                 RID_SVXSTR_GRADIENT,
4029                                                                 pModel->GetGradientListFromSdrModel().get() );
4030 
4031         // if the given name is not valid, replace it!
4032         if( aUniqueName != GetName() )
4033         {
4034             return new XFillGradientItem( aUniqueName, aGradient );
4035         }
4036     }
4037 
4038     return (XFillGradientItem*)this;
4039 }
4040 
4041 // ----------------------------------
4042 // class XFillFloatTransparenceItem -
4043 // ----------------------------------
4044 
4045 TYPEINIT1_AUTOFACTORY( XFillFloatTransparenceItem, XFillGradientItem );
4046 
4047 // -----------------------------------------------------------------------------
4048 
4049 XFillFloatTransparenceItem::XFillFloatTransparenceItem() :
4050     bEnabled( sal_False )
4051 {
4052     SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4053 }
4054 
4055 //------------------------------------------------------------------------
4056 
4057 XFillFloatTransparenceItem::XFillFloatTransparenceItem( sal_Int32 nIndex, const XGradient& rGradient, sal_Bool bEnable ) :
4058     XFillGradientItem   ( nIndex, rGradient ),
4059     bEnabled            ( bEnable )
4060 {
4061     SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4062 }
4063 
4064 //------------------------------------------------------------------------
4065 
4066 XFillFloatTransparenceItem::XFillFloatTransparenceItem(const XubString& rName, const XGradient& rGradient, sal_Bool bEnable ) :
4067     XFillGradientItem   ( rName, rGradient ),
4068     bEnabled            ( bEnable )
4069 {
4070     SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4071 }
4072 
4073 //------------------------------------------------------------------------
4074 
4075 XFillFloatTransparenceItem::XFillFloatTransparenceItem( const XFillFloatTransparenceItem& rItem ) :
4076     XFillGradientItem   ( rItem ),
4077     bEnabled            ( rItem.bEnabled )
4078 {
4079     SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4080 }
4081 
4082 //------------------------------------------------------------------------
4083 
4084 //XFillFloatTransparenceItem::XFillFloatTransparenceItem( SvStream& rIn, sal_uInt16 nVer ) :
4085 //  XFillGradientItem   ( rIn, nVer )
4086 //{
4087 //  SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4088 //  rIn >> bEnabled;
4089 //}
4090 
4091 //*************************************************************************
4092 
4093 XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient, sal_Bool bEnable )
4094 :   XFillGradientItem   ( -1, rTheGradient ),
4095     bEnabled            ( bEnable )
4096 {
4097     SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4098 }
4099 
4100 //*************************************************************************
4101 
4102 XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/)
4103 {
4104     SetWhich( XATTR_FILLFLOATTRANSPARENCE );
4105 }
4106 
4107 //------------------------------------------------------------------------
4108 
4109 int XFillFloatTransparenceItem::operator==( const SfxPoolItem& rItem ) const
4110 {
4111     return ( NameOrIndex::operator==(rItem) ) &&
4112             ( GetGradientValue() == ((const XFillGradientItem&)rItem).GetGradientValue() ) &&
4113              ( bEnabled == ( (XFillFloatTransparenceItem&) rItem ).bEnabled );
4114 }
4115 
4116 //------------------------------------------------------------------------
4117 
4118 SfxPoolItem* XFillFloatTransparenceItem::Clone( SfxItemPool* /*pPool*/) const
4119 {
4120     return new XFillFloatTransparenceItem( *this );
4121 }
4122 
4123 //------------------------------------------------------------------------
4124 
4125 //SfxPoolItem* XFillFloatTransparenceItem::Create( SvStream& rIn, sal_uInt16 nVer ) const
4126 //{
4127 //  return( ( 0 == nVer ) ? Clone( NULL ) : new XFillFloatTransparenceItem( rIn, nVer ) );
4128 //}
4129 
4130 //------------------------------------------------------------------------
4131 
4132 //SvStream& XFillFloatTransparenceItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
4133 //{
4134 //  XFillGradientItem::Store( rOut, nItemVersion );
4135 //  rOut << bEnabled;
4136 //  return rOut;
4137 //}
4138 
4139 //------------------------------------------------------------------------
4140 
4141 sal_uInt16 XFillFloatTransparenceItem::GetVersion( sal_uInt16 nFileFormatVersion ) const
4142 {
4143     // !!! if version number of this object must be increased, please   !!!
4144     // !!! increase version number of base class XFillGradientItem      !!!
4145     return XFillGradientItem::GetVersion( nFileFormatVersion );
4146 }
4147 
4148 //------------------------------------------------------------------------
4149 
4150 sal_Bool XFillFloatTransparenceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
4151 {
4152     return XFillGradientItem::QueryValue( rVal, nMemberId );
4153 }
4154 
4155 //------------------------------------------------------------------------
4156 
4157 sal_Bool XFillFloatTransparenceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
4158 {
4159     return XFillGradientItem::PutValue( rVal, nMemberId );
4160 }
4161 
4162 //------------------------------------------------------------------------
4163 
4164 SfxItemPresentation XFillFloatTransparenceItem::GetPresentation(    SfxItemPresentation ePres,
4165                                                                     SfxMapUnit eCoreUnit, SfxMapUnit ePresUnit,
4166                                                                     XubString& rText,
4167                                                                     const IntlWrapper * pIntlWrapper ) const
4168 {
4169     return XFillGradientItem::GetPresentation( ePres, eCoreUnit, ePresUnit, rText, pIntlWrapper );
4170 }
4171 
4172 sal_Bool XFillFloatTransparenceItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
4173 {
4174     return  ((XFillFloatTransparenceItem*)p1)->IsEnabled() == ((XFillFloatTransparenceItem*)p2)->IsEnabled() &&
4175             ((XFillFloatTransparenceItem*)p1)->GetGradientValue()  == ((XFillFloatTransparenceItem*)p2)->GetGradientValue();
4176 }
4177 
4178 XFillFloatTransparenceItem* XFillFloatTransparenceItem::checkForUniqueItem( SdrModel* pModel ) const
4179 {
4180     // #85953# unique name only necessary when enabled
4181     if(IsEnabled())
4182     {
4183         if( pModel )
4184         {
4185             const String aUniqueName = NameOrIndex::CheckNamedItem( this,
4186                                                                     XATTR_FILLFLOATTRANSPARENCE,
4187                                                                     &pModel->GetItemPool(),
4188                                                                     pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
4189                                                                     XFillFloatTransparenceItem::CompareValueFunc,
4190                                                                     RID_SVXSTR_TRASNGR0,
4191                                                                     NULL );
4192 
4193             // if the given name is not valid, replace it!
4194             if( aUniqueName != GetName() )
4195             {
4196                 return new XFillFloatTransparenceItem( aUniqueName, GetGradientValue(), sal_True );
4197             }
4198         }
4199     }
4200     else
4201     {
4202         // #85953# if disabled, force name to empty string
4203         if(GetName().Len())
4204         {
4205             return new XFillFloatTransparenceItem(String(), GetGradientValue(), sal_False);
4206         }
4207     }
4208 
4209     return (XFillFloatTransparenceItem*)this;
4210 }
4211 
4212 // -------------
4213 // class XHatch
4214 // -------------
4215 
4216 /*************************************************************************
4217 |*
4218 |*    XHatch::XHatch(XHatchStyle, const Color&, long, long)
4219 |*
4220 |*    Beschreibung
4221 |*    Ersterstellung    21.11.94
4222 |*    Letzte Aenderung  21.11.94
4223 |*
4224 *************************************************************************/
4225 
4226 XHatch::XHatch(const Color& rCol, XHatchStyle eTheStyle, long nTheDistance,
4227                long nTheAngle) :
4228     eStyle(eTheStyle),
4229     aColor(rCol),
4230     nDistance(nTheDistance),
4231     nAngle(nTheAngle)
4232 {
4233 }
4234 
4235 /*************************************************************************
4236 |*
4237 |*    int XHatch::operator==(const SfxPoolItem& rItem) const
4238 |*
4239 |*    Beschreibung
4240 |*    Ersterstellung    29.11.94
4241 |*    Letzte Aenderung  29.11.94
4242 |*
4243 *************************************************************************/
4244 
4245 bool XHatch::operator==(const XHatch& rHatch) const
4246 {
4247     return ( eStyle     == rHatch.eStyle    &&
4248              aColor     == rHatch.aColor    &&
4249              nDistance  == rHatch.nDistance &&
4250              nAngle     == rHatch.nAngle );
4251 }
4252 
4253 
4254 // -----------------------
4255 // class XFillHatchItem
4256 // -----------------------
4257 TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex);
4258 
4259 /*************************************************************************
4260 |*
4261 |*    XFillHatchItem::XFillHatchItem(sal_Int32 nIndex,
4262 |*                                 const XHatch& rTheHatch)
4263 |*
4264 |*    Beschreibung
4265 |*    Ersterstellung    15.11.94
4266 |*    Letzte Aenderung  15.11.94
4267 |*
4268 *************************************************************************/
4269 
4270 XFillHatchItem::XFillHatchItem(sal_Int32 nIndex,
4271                              const XHatch& rTheHatch) :
4272     NameOrIndex(XATTR_FILLHATCH, nIndex),
4273     aHatch(rTheHatch)
4274 {
4275 }
4276 
4277 /*************************************************************************
4278 |*
4279 |*    XFillHatchItem::XFillHatchItem(const XubString& rName,
4280 |*                                 const XHatch& rTheHatch)
4281 |*
4282 |*    Beschreibung
4283 |*    Ersterstellung    15.11.94
4284 |*    Letzte Aenderung  15.11.94
4285 |*
4286 *************************************************************************/
4287 
4288 XFillHatchItem::XFillHatchItem(const XubString& rName,
4289                              const XHatch& rTheHatch) :
4290     NameOrIndex(XATTR_FILLHATCH, rName),
4291     aHatch(rTheHatch)
4292 {
4293 }
4294 
4295 /*************************************************************************
4296 |*
4297 |*    XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem)
4298 |*
4299 |*    Beschreibung
4300 |*    Ersterstellung    15.11.94
4301 |*    Letzte Aenderung  15.11.94
4302 |*
4303 *************************************************************************/
4304 
4305 XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem) :
4306     NameOrIndex(rItem),
4307     aHatch(rItem.aHatch)
4308 {
4309 }
4310 
4311 /*************************************************************************
4312 |*
4313 |*    XFillHatchItem::XFillHatchItem(SvStream& rIn)
4314 |*
4315 |*    Beschreibung
4316 |*    Ersterstellung    15.11.94
4317 |*    Letzte Aenderung  15.11.94
4318 |*
4319 *************************************************************************/
4320 
4321 XFillHatchItem::XFillHatchItem(SvStream& rIn) :
4322     NameOrIndex(XATTR_FILLHATCH, rIn),
4323     aHatch(COL_BLACK)
4324 {
4325     if (!IsIndex())
4326     {
4327         sal_uInt16 nRed;
4328         sal_uInt16 nGreen;
4329         sal_uInt16 nBlue;
4330         sal_Int16  nITemp;
4331         sal_Int32  nLTemp;
4332 
4333         rIn >> nITemp; aHatch.SetHatchStyle((XHatchStyle)nITemp);
4334         rIn >> nRed;
4335         rIn >> nGreen;
4336         rIn >> nBlue;
4337 
4338         Color aCol;
4339         aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
4340         aHatch.SetColor(aCol);
4341         rIn >> nLTemp; aHatch.SetDistance(nLTemp);
4342         rIn >> nLTemp; aHatch.SetAngle(nLTemp);
4343     }
4344 }
4345 
4346 //*************************************************************************
4347 
4348 XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/, const XHatch& rTheHatch)
4349 :   NameOrIndex( XATTR_FILLHATCH, -1 ),
4350     aHatch(rTheHatch)
4351 {
4352 }
4353 
4354 //*************************************************************************
4355 
4356 XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/)
4357 : NameOrIndex(XATTR_FILLHATCH, -1 )
4358 {
4359 }
4360 
4361 /*************************************************************************
4362 |*
4363 |*    XFillHatchItem::Clone(SfxItemPool* pPool) const
4364 |*
4365 |*    Beschreibung
4366 |*    Ersterstellung    15.11.94
4367 |*    Letzte Aenderung  15.11.94
4368 |*
4369 *************************************************************************/
4370 
4371 SfxPoolItem* XFillHatchItem::Clone(SfxItemPool* /*pPool*/) const
4372 {
4373     return new XFillHatchItem(*this);
4374 }
4375 
4376 /*************************************************************************
4377 |*
4378 |*    int XFillHatchItem::operator==(const SfxPoolItem& rItem) const
4379 |*
4380 |*    Beschreibung
4381 |*    Ersterstellung    15.11.94
4382 |*    Letzte Aenderung  15.11.94
4383 |*
4384 *************************************************************************/
4385 
4386 int XFillHatchItem::operator==(const SfxPoolItem& rItem) const
4387 {
4388     return ( NameOrIndex::operator==(rItem) &&
4389              aHatch == ((const XFillHatchItem&) rItem).aHatch );
4390 }
4391 
4392 /*************************************************************************
4393 |*
4394 |*    SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4395 |*
4396 |*    Beschreibung
4397 |*    Ersterstellung    15.11.94
4398 |*    Letzte Aenderung  15.11.94
4399 |*
4400 *************************************************************************/
4401 
4402 SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4403 {
4404     return new XFillHatchItem(rIn);
4405 }
4406 
4407 /*************************************************************************
4408 |*
4409 |*    SfxPoolItem* XFillHatchItem::Store(SvStream& rOut) const
4410 |*
4411 |*    Beschreibung
4412 |*    Ersterstellung    15.11.94
4413 |*    Letzte Aenderung  15.11.94
4414 |*
4415 *************************************************************************/
4416 
4417 SvStream& XFillHatchItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
4418 {
4419     NameOrIndex::Store( rOut, nItemVersion );
4420 
4421     if (!IsIndex())
4422     {
4423         rOut << (sal_Int16)aHatch.GetHatchStyle();
4424 
4425         sal_uInt16 nTmp;
4426         nTmp = VCLTOSVCOL( aHatch.GetColor().GetRed() ); rOut << nTmp;
4427         nTmp = VCLTOSVCOL( aHatch.GetColor().GetGreen() ); rOut << nTmp;
4428         nTmp = VCLTOSVCOL( aHatch.GetColor().GetBlue() ); rOut << nTmp;
4429 
4430         rOut << (sal_Int32) aHatch.GetDistance();
4431         rOut << (sal_Int32) aHatch.GetAngle();
4432     }
4433 
4434     return rOut;
4435 }
4436 
4437 /*************************************************************************
4438 |*
4439 |*    const XHatch& XFillHatchItem::GetValue(const XHatchList* pTable) const
4440 |*
4441 |*    Beschreibung
4442 |*    Ersterstellung    15.11.94
4443 |*    Letzte Aenderung  18.11.94
4444 |*
4445 *************************************************************************/
4446 
4447 const XHatch& XFillHatchItem::GetHatchValue(const XHatchList* pTable) const // GetValue -> GetHatchValue
4448 {
4449     if (!IsIndex())
4450         return aHatch;
4451     else
4452         return pTable->GetHatch(GetIndex())->GetHatch();
4453 }
4454 
4455 //------------------------------------------------------------------------
4456 
4457 SfxItemPresentation XFillHatchItem::GetPresentation
4458 (
4459     SfxItemPresentation ePres,
4460     SfxMapUnit          /*eCoreUnit*/,
4461     SfxMapUnit          /*ePresUnit*/,
4462     XubString&          rText, const IntlWrapper *
4463 )   const
4464 {
4465     switch ( ePres )
4466     {
4467         case SFX_ITEM_PRESENTATION_NONE:
4468             rText.Erase();
4469             return ePres;
4470         case SFX_ITEM_PRESENTATION_NAMELESS:
4471         case SFX_ITEM_PRESENTATION_COMPLETE:
4472             rText = GetName();
4473             return ePres;
4474         default:
4475             return SFX_ITEM_PRESENTATION_NONE;
4476     }
4477 }
4478 
4479 //------------------------------------------------------------------------
4480 
4481 FASTBOOL XFillHatchItem::HasMetrics() const
4482 {
4483     return sal_True;
4484 }
4485 
4486 //------------------------------------------------------------------------
4487 
4488 FASTBOOL XFillHatchItem::ScaleMetrics(long nMul, long nDiv)
4489 {
4490     aHatch.SetDistance( ScaleMetricValue( aHatch.GetDistance(), nMul, nDiv ) );
4491     return sal_True;
4492 }
4493 
4494 // -----------------------------------------------------------------------
4495 sal_Bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
4496 {
4497 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
4498     nMemberId &= ~CONVERT_TWIPS;
4499 
4500     switch ( nMemberId )
4501     {
4502         case 0:
4503         {
4504             uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
4505 
4506             ::com::sun::star::drawing::Hatch aUnoHatch;
4507 
4508             aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
4509             aUnoHatch.Color = aHatch.GetColor().GetColor();
4510             aUnoHatch.Distance = aHatch.GetDistance();
4511             aUnoHatch.Angle = aHatch.GetAngle();
4512 
4513             rtl::OUString aApiName;
4514             SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
4515             aPropSeq[0].Name    = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
4516             aPropSeq[0].Value   = uno::makeAny( aApiName );
4517             aPropSeq[1].Name    = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ));
4518             aPropSeq[1].Value   = uno::makeAny( aUnoHatch );
4519             rVal = uno::makeAny( aPropSeq );
4520             break;
4521         }
4522 
4523         case MID_FILLHATCH:
4524         {
4525             ::com::sun::star::drawing::Hatch aUnoHatch;
4526 
4527             aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
4528             aUnoHatch.Color = aHatch.GetColor().GetColor();
4529             aUnoHatch.Distance = aHatch.GetDistance();
4530             aUnoHatch.Angle = aHatch.GetAngle();
4531             rVal <<= aUnoHatch;
4532             break;
4533         }
4534 
4535         case MID_NAME:
4536         {
4537             rtl::OUString aApiName;
4538             SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
4539             rVal <<= aApiName;
4540             break;
4541         }
4542 
4543         case MID_HATCH_STYLE:
4544             rVal <<= (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); break;
4545         case MID_HATCH_COLOR:
4546             rVal <<= (sal_Int32)aHatch.GetColor().GetColor(); break;
4547         case MID_HATCH_DISTANCE:
4548             rVal <<= aHatch.GetDistance(); break;
4549         case MID_HATCH_ANGLE:
4550             rVal <<= aHatch.GetAngle(); break;
4551 
4552         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
4553     }
4554 
4555     return sal_True;
4556 }
4557 
4558 // -----------------------------------------------------------------------
4559 sal_Bool XFillHatchItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
4560 {
4561 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
4562     nMemberId &= ~CONVERT_TWIPS;
4563 
4564     switch ( nMemberId )
4565     {
4566         case 0:
4567         {
4568             uno::Sequence< beans::PropertyValue >   aPropSeq;
4569             ::com::sun::star::drawing::Hatch        aUnoHatch;
4570             rtl::OUString                           aName;
4571             bool                                    bHatch( false );
4572 
4573             if ( rVal >>= aPropSeq )
4574             {
4575                 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
4576                 {
4577                     if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" )))
4578                         aPropSeq[n].Value >>= aName;
4579                     else if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillHatch" )))
4580                     {
4581                         if ( aPropSeq[n].Value >>= aUnoHatch )
4582                             bHatch = true;
4583                     }
4584                 }
4585 
4586                 SetName( aName );
4587                 if ( bHatch )
4588                 {
4589                     aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
4590                     aHatch.SetColor( aUnoHatch.Color );
4591                     aHatch.SetDistance( aUnoHatch.Distance );
4592                     aHatch.SetAngle( aUnoHatch.Angle );
4593                 }
4594 
4595                 return sal_True;
4596             }
4597 
4598             return sal_False;
4599         }
4600 
4601         case MID_FILLHATCH:
4602         {
4603             ::com::sun::star::drawing::Hatch aUnoHatch;
4604             if(!(rVal >>= aUnoHatch))
4605                 return sal_False;
4606 
4607             aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
4608             aHatch.SetColor( aUnoHatch.Color );
4609             aHatch.SetDistance( aUnoHatch.Distance );
4610             aHatch.SetAngle( aUnoHatch.Angle );
4611             break;
4612         }
4613 
4614         case MID_NAME:
4615         {
4616             rtl::OUString aName;
4617             if (!(rVal >>= aName ))
4618                 return sal_False;
4619             SetName( aName );
4620             break;
4621         }
4622 
4623         case MID_HATCH_STYLE:
4624         {
4625             sal_Int16 nVal = sal_Int16();
4626             if (!(rVal >>= nVal ))
4627                 return sal_False;
4628             aHatch.SetHatchStyle( (XHatchStyle)nVal );
4629             break;
4630         }
4631 
4632         case MID_HATCH_COLOR:
4633         case MID_HATCH_DISTANCE:
4634         case MID_HATCH_ANGLE:
4635         {
4636             sal_Int32 nVal = 0;
4637             if (!(rVal >>= nVal ))
4638                 return sal_False;
4639 
4640             if ( nMemberId == MID_HATCH_COLOR )
4641                 aHatch.SetColor( nVal );
4642             else if ( nMemberId == MID_HATCH_DISTANCE )
4643                 aHatch.SetDistance( nVal );
4644             else
4645                 aHatch.SetAngle( nVal );
4646             break;
4647         }
4648 
4649         default: DBG_ERROR("Wrong MemberId!"); return sal_False;
4650     }
4651 
4652     return sal_True;
4653 }
4654 
4655 sal_Bool XFillHatchItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
4656 {
4657     return ((XFillHatchItem*)p1)->GetHatchValue() == ((XFillHatchItem*)p2)->GetHatchValue();
4658 }
4659 
4660 XFillHatchItem* XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const
4661 {
4662     if( pModel )
4663     {
4664         const String aUniqueName = NameOrIndex::CheckNamedItem( this,
4665                                                                 XATTR_FILLHATCH,
4666                                                                 &pModel->GetItemPool(),
4667                                                                 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
4668                                                                 XFillHatchItem::CompareValueFunc,
4669                                                                 RID_SVXSTR_HATCH10,
4670                                                                 pModel->GetHatchListFromSdrModel().get() );
4671 
4672         // if the given name is not valid, replace it!
4673         if( aUniqueName != GetName() )
4674         {
4675             return new XFillHatchItem( aUniqueName, aHatch );
4676         }
4677     }
4678 
4679     return (XFillHatchItem*)this;
4680 }
4681 
4682 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4683 //                          FormText-Attribute
4684 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4685 
4686 //-------------------------
4687 // class XFormTextStyleItem
4688 //-------------------------
4689 TYPEINIT1_AUTOFACTORY(XFormTextStyleItem, SfxEnumItem);
4690 
4691 /*************************************************************************
4692 |*
4693 |*    XFormTextStyleItem::XFormTextStyleItem()
4694 |*
4695 |*    Beschreibung
4696 |*    Ersterstellung    02.02.95 ESO
4697 |*    Letzte Aenderung  02.02.95 ESO
4698 |*
4699 *************************************************************************/
4700 
4701 XFormTextStyleItem::XFormTextStyleItem(XFormTextStyle eTheStyle) :
4702     SfxEnumItem(XATTR_FORMTXTSTYLE, sal::static_int_cast< sal_uInt16 >(eTheStyle))
4703 {
4704 }
4705 
4706 /*************************************************************************
4707 |*
4708 |*    XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn)
4709 |*
4710 |*    Beschreibung
4711 |*    Ersterstellung    02.02.95 ESO
4712 |*    Letzte Aenderung  02.02.95 ESO
4713 |*
4714 *************************************************************************/
4715 
4716 XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn) :
4717     SfxEnumItem(XATTR_FORMTXTSTYLE, rIn)
4718 {
4719 }
4720 
4721 /*************************************************************************
4722 |*
4723 |*    XFormTextStyleItem::Clone(SfxItemPool* pPool) const
4724 |*
4725 |*    Beschreibung
4726 |*    Ersterstellung    02.02.95 ESO
4727 |*    Letzte Aenderung  02.02.95 ESO
4728 |*
4729 *************************************************************************/
4730 
4731 SfxPoolItem* XFormTextStyleItem::Clone(SfxItemPool* /*pPool*/) const
4732 {
4733     return new XFormTextStyleItem( *this );
4734 }
4735 
4736 /*************************************************************************
4737 |*
4738 |*    SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4739 |*
4740 |*    Beschreibung
4741 |*    Ersterstellung    02.02.95 ESO
4742 |*    Letzte Aenderung  02.02.95 ESO
4743 |*
4744 *************************************************************************/
4745 
4746 SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4747 {
4748     return new XFormTextStyleItem(rIn);
4749 }
4750 
4751 /*************************************************************************
4752 |*
4753 |*
4754 |*
4755 \*************************************************************************/
4756 
4757 sal_uInt16 XFormTextStyleItem::GetValueCount() const
4758 {
4759     return 5;
4760 }
4761 
4762 /*************************************************************************
4763 |*
4764 |*
4765 |*
4766 \*************************************************************************/
4767 
4768 // #FontWork#
4769 sal_Bool XFormTextStyleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
4770 {
4771     rVal <<= (sal_Int32)GetValue();
4772     return sal_True;
4773 }
4774 
4775 /*************************************************************************
4776 |*
4777 |*
4778 |*
4779 \*************************************************************************/
4780 
4781 // #FontWork#
4782 sal_Bool XFormTextStyleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
4783 {
4784     sal_Int32 nValue = 0;
4785     rVal >>= nValue;
4786     SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
4787 
4788     return sal_True;
4789 }
4790 
4791 //-------------------------
4792 // class XFormTextAdjustItem
4793 //-------------------------
4794 TYPEINIT1_AUTOFACTORY(XFormTextAdjustItem, SfxEnumItem);
4795 
4796 /*************************************************************************
4797 |*
4798 |*    XFormTextAdjustItem::XFormTextAdjustItem()
4799 |*
4800 |*    Beschreibung
4801 |*    Ersterstellung    02.02.95 ESO
4802 |*    Letzte Aenderung  02.02.95 ESO
4803 |*
4804 *************************************************************************/
4805 
4806 XFormTextAdjustItem::XFormTextAdjustItem(XFormTextAdjust eTheAdjust) :
4807     SfxEnumItem(XATTR_FORMTXTADJUST, sal::static_int_cast< sal_uInt16 >(eTheAdjust))
4808 {
4809 }
4810 
4811 /*************************************************************************
4812 |*
4813 |*    XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn)
4814 |*
4815 |*    Beschreibung
4816 |*    Ersterstellung    02.02.95 ESO
4817 |*    Letzte Aenderung  02.02.95 ESO
4818 |*
4819 *************************************************************************/
4820 
4821 XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn) :
4822     SfxEnumItem(XATTR_FORMTXTADJUST, rIn)
4823 {
4824 }
4825 
4826 /*************************************************************************
4827 |*
4828 |*    XFormTextAdjustItem::Clone(SfxItemPool* pPool) const
4829 |*
4830 |*    Beschreibung
4831 |*    Ersterstellung    02.02.95 ESO
4832 |*    Letzte Aenderung  02.02.95 ESO
4833 |*
4834 *************************************************************************/
4835 
4836 SfxPoolItem* XFormTextAdjustItem::Clone(SfxItemPool* /*pPool*/) const
4837 {
4838     return new XFormTextAdjustItem( *this );
4839 }
4840 
4841 /*************************************************************************
4842 |*
4843 |*    SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4844 |*
4845 |*    Beschreibung
4846 |*    Ersterstellung    02.02.95 ESO
4847 |*    Letzte Aenderung  02.02.95 ESO
4848 |*
4849 *************************************************************************/
4850 
4851 SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4852 {
4853     return new XFormTextAdjustItem(rIn);
4854 }
4855 
4856 /*************************************************************************
4857 |*
4858 |*
4859 |*
4860 \*************************************************************************/
4861 
4862 sal_uInt16 XFormTextAdjustItem::GetValueCount() const
4863 {
4864     return 4;
4865 }
4866 
4867 /*************************************************************************
4868 |*
4869 |*
4870 |*
4871 \*************************************************************************/
4872 
4873 // #FontWork#
4874 sal_Bool XFormTextAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
4875 {
4876     rVal <<= (sal_Int32)GetValue();
4877     return sal_True;
4878 }
4879 
4880 /*************************************************************************
4881 |*
4882 |*
4883 |*
4884 \*************************************************************************/
4885 
4886 // #FontWork#
4887 sal_Bool XFormTextAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
4888 {
4889     sal_Int32 nValue = 0;
4890     rVal >>= nValue;
4891     SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
4892 
4893     return sal_True;
4894 }
4895 
4896 //----------------------------
4897 // class XFormTextDistanceItem
4898 //----------------------------
4899 TYPEINIT1_AUTOFACTORY(XFormTextDistanceItem, SfxMetricItem);
4900 
4901 /*************************************************************************
4902 |*
4903 |*    XFormTextDistanceItem::XFormTextDistanceItem()
4904 |*
4905 |*    Beschreibung
4906 |*    Ersterstellung    02.02.95 ESO
4907 |*    Letzte Aenderung  02.02.95 ESO
4908 |*
4909 *************************************************************************/
4910 
4911 XFormTextDistanceItem::XFormTextDistanceItem(long nDist) :
4912     SfxMetricItem(XATTR_FORMTXTDISTANCE, nDist)
4913 {
4914 }
4915 
4916 /*************************************************************************
4917 |*
4918 |*    XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn)
4919 |*
4920 |*    Beschreibung
4921 |*    Ersterstellung    02.02.95 ESO
4922 |*    Letzte Aenderung  02.02.95 ESO
4923 |*
4924 *************************************************************************/
4925 
4926 XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn) :
4927     SfxMetricItem(XATTR_FORMTXTDISTANCE, rIn)
4928 {
4929 }
4930 
4931 /*************************************************************************
4932 |*
4933 |*    XFormTextDistanceItem::Clone(SfxItemPool* pPool) const
4934 |*
4935 |*    Beschreibung
4936 |*    Ersterstellung    02.02.95 ESO
4937 |*    Letzte Aenderung  02.02.95 ESO
4938 |*
4939 *************************************************************************/
4940 
4941 SfxPoolItem* XFormTextDistanceItem::Clone(SfxItemPool* /*pPool*/) const
4942 {
4943     return new XFormTextDistanceItem(*this);
4944 }
4945 
4946 /*************************************************************************
4947 |*
4948 |*    SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, sal_uInt16 nVer) const
4949 |*
4950 |*    Beschreibung
4951 |*    Ersterstellung    02.02.95 ESO
4952 |*    Letzte Aenderung  02.02.95 ESO
4953 |*
4954 *************************************************************************/
4955 
4956 SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
4957 {
4958     return new XFormTextDistanceItem(rIn);
4959 }
4960 
4961 //-------------------------
4962 // class XFormTextStartItem
4963 //-------------------------
4964 TYPEINIT1_AUTOFACTORY(XFormTextStartItem, SfxMetricItem);
4965 
4966 /*************************************************************************
4967 |*
4968 |*    XFormTextStartItem::XFormTextStartItem(long nStart)
4969 |*
4970 |*    Beschreibung
4971 |*    Ersterstellung    02.02.95 ESO
4972 |*    Letzte Aenderung  02.02.95 ESO
4973 |*
4974 *************************************************************************/
4975 
4976 XFormTextStartItem::XFormTextStartItem(long nStart) :
4977     SfxMetricItem(XATTR_FORMTXTSTART, nStart)
4978 {
4979 }
4980 
4981 /*************************************************************************
4982 |*
4983 |*    XFormTextStartItem::XFormTextStartItem(SvStream& rIn)
4984 |*
4985 |*    Beschreibung
4986 |*    Ersterstellung    02.02.95 ESO
4987 |*    Letzte Aenderung  02.02.95 ESO
4988 |*
4989 *************************************************************************/
4990 
4991 XFormTextStartItem::XFormTextStartItem(SvStream& rIn) :
4992     SfxMetricItem(XATTR_FORMTXTSTART, rIn)
4993 {
4994 }
4995 
4996 /*************************************************************************
4997 |*
4998 |*    XFormTextStartItem::Clone(SfxItemPool* pPool) const
4999 |*
5000 |*    Beschreibung
5001 |*    Ersterstellung    02.02.95 ESO
5002 |*    Letzte Aenderung  02.02.95 ESO
5003 |*
5004 *************************************************************************/
5005 
5006 SfxPoolItem* XFormTextStartItem::Clone(SfxItemPool* /*pPool*/) const
5007 {
5008     return new XFormTextStartItem(*this);
5009 }
5010 
5011 /*************************************************************************
5012 |*
5013 |*    SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, sal_uInt16 nVer) const
5014 |*
5015 |*    Beschreibung
5016 |*    Ersterstellung    02.02.95 ESO
5017 |*    Letzte Aenderung  02.02.95 ESO
5018 |*
5019 *************************************************************************/
5020 
5021 SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5022 {
5023     return new XFormTextStartItem(rIn);
5024 }
5025 
5026 // -------------------------
5027 // class XFormTextMirrorItem
5028 // -------------------------
5029 TYPEINIT1_AUTOFACTORY(XFormTextMirrorItem, SfxBoolItem);
5030 
5031 /*************************************************************************
5032 |*
5033 |*    XFormTextMirrorItem::XFormTextMirrorItem(sal_Bool bMirror)
5034 |*
5035 |*    Ersterstellung    06.02.95 ESO
5036 |*    Letzte Aenderung  06.02.95 ESO
5037 |*
5038 *************************************************************************/
5039 
5040 XFormTextMirrorItem::XFormTextMirrorItem(sal_Bool bMirror) :
5041     SfxBoolItem(XATTR_FORMTXTMIRROR, bMirror)
5042 {
5043 }
5044 
5045 /*************************************************************************
5046 |*
5047 |*    XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn)
5048 |*
5049 |*    Ersterstellung    06.02.95 ESO
5050 |*    Letzte Aenderung  06.02.95 ESO
5051 |*
5052 *************************************************************************/
5053 
5054 XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn) :
5055     SfxBoolItem(XATTR_FORMTXTMIRROR, rIn)
5056 {
5057 }
5058 
5059 /*************************************************************************
5060 |*
5061 |*    XFormTextMirrorItem::Clone(SfxItemPool* pPool) const
5062 |*
5063 |*    Ersterstellung    06.02.95 ESO
5064 |*    Letzte Aenderung  06.02.95 ESO
5065 |*
5066 *************************************************************************/
5067 
5068 SfxPoolItem* XFormTextMirrorItem::Clone(SfxItemPool* /*pPool*/) const
5069 {
5070     return new XFormTextMirrorItem(*this);
5071 }
5072 
5073 /*************************************************************************
5074 |*
5075 |*    SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, sal_uInt16 nVer)
5076 |*                                              const
5077 |*
5078 |*    Ersterstellung    06.02.95 ESO
5079 |*    Letzte Aenderung  06.02.95 ESO
5080 |*
5081 *************************************************************************/
5082 
5083 SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5084 {
5085     return new XFormTextMirrorItem(rIn);
5086 }
5087 
5088 
5089 // --------------------------
5090 // class XFormTextOutlineItem
5091 // --------------------------
5092 TYPEINIT1_AUTOFACTORY(XFormTextOutlineItem, SfxBoolItem);
5093 
5094 /*************************************************************************
5095 |*
5096 |*    XFormTextOutlineItem::XFormTextOutlineItem()
5097 |*
5098 |*    Ersterstellung    27.06.95 ESO
5099 |*    Letzte Aenderung  27.06.95 ESO
5100 |*
5101 *************************************************************************/
5102 
5103 XFormTextOutlineItem::XFormTextOutlineItem(sal_Bool bOutline) :
5104     SfxBoolItem(XATTR_FORMTXTOUTLINE, bOutline)
5105 {
5106 }
5107 
5108 /*************************************************************************
5109 |*
5110 |*    XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn)
5111 |*
5112 |*    Ersterstellung    27.06.95 ESO
5113 |*    Letzte Aenderung  27.06.95 ESO
5114 |*
5115 *************************************************************************/
5116 
5117 XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn) :
5118     SfxBoolItem(XATTR_FORMTXTOUTLINE, rIn)
5119 {
5120 }
5121 
5122 /*************************************************************************
5123 |*
5124 |*    XFormTextOutlineItem::Clone(SfxItemPool* pPool) const
5125 |*
5126 |*    Ersterstellung    27.06.95 ESO
5127 |*    Letzte Aenderung  27.06.95 ESO
5128 |*
5129 *************************************************************************/
5130 
5131 SfxPoolItem* XFormTextOutlineItem::Clone(SfxItemPool* /*pPool*/) const
5132 {
5133     return new XFormTextOutlineItem(*this);
5134 }
5135 
5136 /*************************************************************************
5137 |*
5138 |*    SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 nVer)
5139 |*                                              const
5140 |*
5141 |*    Ersterstellung    27.06.95 ESO
5142 |*    Letzte Aenderung  27.06.95 ESO
5143 |*
5144 *************************************************************************/
5145 
5146 SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5147 {
5148     return new XFormTextOutlineItem(rIn);
5149 }
5150 
5151 //--------------------------
5152 // class XFormTextShadowItem
5153 //--------------------------
5154 TYPEINIT1_AUTOFACTORY(XFormTextShadowItem, SfxEnumItem);
5155 
5156 /*************************************************************************
5157 |*
5158 |*    XFormTextShadowItem::XFormTextShadowItem()
5159 |*
5160 |*    Beschreibung
5161 |*    Ersterstellung    27.06.95
5162 |*    Letzte Aenderung  27.06.95
5163 |*
5164 *************************************************************************/
5165 
5166 XFormTextShadowItem::XFormTextShadowItem(XFormTextShadow eFormTextShadow) :
5167     SfxEnumItem(
5168         XATTR_FORMTXTSHADOW, sal::static_int_cast< sal_uInt16 >(eFormTextShadow))
5169 {
5170 }
5171 
5172 /*************************************************************************
5173 |*
5174 |*    XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn)
5175 |*
5176 |*    Beschreibung
5177 |*    Ersterstellung    27.06.95
5178 |*    Letzte Aenderung  27.06.95
5179 |*
5180 *************************************************************************/
5181 
5182 XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn) :
5183     SfxEnumItem(XATTR_FORMTXTSHADOW, rIn)
5184 {
5185 }
5186 
5187 /*************************************************************************
5188 |*
5189 |*    XFormTextShadowItem::Clone(SfxItemPool* pPool) const
5190 |*
5191 |*    Beschreibung
5192 |*    Ersterstellung    27.06.95
5193 |*    Letzte Aenderung  27.06.95
5194 |*
5195 *************************************************************************/
5196 
5197 SfxPoolItem* XFormTextShadowItem::Clone(SfxItemPool* /*pPool*/) const
5198 {
5199     return new XFormTextShadowItem( *this );
5200 }
5201 
5202 /*************************************************************************
5203 |*
5204 |*    SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, sal_uInt16 nVer) const
5205 |*
5206 |*    Beschreibung
5207 |*    Ersterstellung    27.06.95
5208 |*    Letzte Aenderung  27.06.95
5209 |*
5210 *************************************************************************/
5211 
5212 SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5213 {
5214     return new XFormTextShadowItem(rIn);
5215 }
5216 
5217 
5218 /*************************************************************************
5219 |*
5220 |*
5221 |*
5222 \*************************************************************************/
5223 
5224 sal_uInt16 XFormTextShadowItem::GetValueCount() const
5225 {
5226     return 3;
5227 }
5228 
5229 /*************************************************************************
5230 |*
5231 |*
5232 |*
5233 \*************************************************************************/
5234 
5235 // #FontWork#
5236 sal_Bool XFormTextShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
5237 {
5238     rVal <<= (sal_Int32)GetValue();
5239     return sal_True;
5240 }
5241 
5242 /*************************************************************************
5243 |*
5244 |*
5245 |*
5246 \*************************************************************************/
5247 
5248 // #FontWork#
5249 sal_Bool XFormTextShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
5250 {
5251     sal_Int32 nValue = 0;
5252     rVal >>= nValue;
5253     SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
5254 
5255     return sal_True;
5256 }
5257 
5258 // -------------------------------
5259 // class XFormTextShadowColorItem
5260 // -------------------------------
5261 TYPEINIT1_AUTOFACTORY(XFormTextShadowColorItem, XColorItem);
5262 
5263 /*************************************************************************
5264 |*
5265 |*    XFormTextShadowColorItem::XFormTextShadowColorItem()
5266 |*
5267 |*    Beschreibung
5268 |*    Ersterstellung    27.06.95
5269 |*    Letzte Aenderung  27.06.95
5270 |*
5271 *************************************************************************/
5272 
5273 XFormTextShadowColorItem::XFormTextShadowColorItem(sal_Int32 nIndex,
5274                                                      const Color& rTheColor) :
5275     XColorItem(XATTR_FORMTXTSHDWCOLOR, nIndex, rTheColor)
5276 {
5277 }
5278 
5279 /*************************************************************************
5280 |*
5281 |*    XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName, const Color& rTheColor)
5282 |*
5283 |*    Beschreibung
5284 |*    Ersterstellung    27.06.95
5285 |*    Letzte Aenderung  27.06.95
5286 |*
5287 *************************************************************************/
5288 
5289 XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName,
5290                                                      const Color& rTheColor) :
5291     XColorItem(XATTR_FORMTXTSHDWCOLOR, rName, rTheColor)
5292 {
5293 }
5294 
5295 /*************************************************************************
5296 |*
5297 |*    XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn)
5298 |*
5299 |*    Beschreibung
5300 |*    Ersterstellung    27.06.95
5301 |*    Letzte Aenderung  27.06.95
5302 |*
5303 *************************************************************************/
5304 
5305 XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn) :
5306     XColorItem(XATTR_FORMTXTSHDWCOLOR, rIn)
5307 {
5308 }
5309 
5310 /*************************************************************************
5311 |*
5312 |*    XFormTextShadowColorItem::Clone(SfxItemPool* pPool) const
5313 |*
5314 |*    Beschreibung
5315 |*    Ersterstellung    27.06.95
5316 |*    Letzte Aenderung  27.06.95
5317 |*
5318 *************************************************************************/
5319 
5320 SfxPoolItem* XFormTextShadowColorItem::Clone(SfxItemPool* /*pPool*/) const
5321 {
5322     return new XFormTextShadowColorItem(*this);
5323 }
5324 
5325 /*************************************************************************
5326 |*
5327 |*    SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
5328 |*
5329 |*    Beschreibung
5330 |*    Ersterstellung    27.06.95
5331 |*    Letzte Aenderung  27.06.95
5332 |*
5333 *************************************************************************/
5334 
5335 SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5336 {
5337     return new XFormTextShadowColorItem(rIn);
5338 }
5339 
5340 //------------------------------
5341 // class XFormTextShadowXValItem
5342 //------------------------------
5343 TYPEINIT1_AUTOFACTORY(XFormTextShadowXValItem, SfxMetricItem);
5344 
5345 /*************************************************************************
5346 |*
5347 |*    XFormTextShadowXValItem::XFormTextShadowXValItem(long)
5348 |*
5349 |*    Beschreibung
5350 |*    Ersterstellung    28.06.95 ESO
5351 |*    Letzte Aenderung  28.06.95 ESO
5352 |*
5353 *************************************************************************/
5354 
5355 XFormTextShadowXValItem::XFormTextShadowXValItem(long nVal) :
5356     SfxMetricItem(XATTR_FORMTXTSHDWXVAL, nVal)
5357 {
5358 }
5359 
5360 /*************************************************************************
5361 |*
5362 |*    XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn)
5363 |*
5364 |*    Beschreibung
5365 |*    Ersterstellung    28.06.95 ESO
5366 |*    Letzte Aenderung  28.06.95 ESO
5367 |*
5368 *************************************************************************/
5369 
5370 XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn) :
5371     SfxMetricItem(XATTR_FORMTXTSHDWXVAL, rIn)
5372 {
5373 }
5374 
5375 /*************************************************************************
5376 |*
5377 |*    XFormTextShadowXValItem::Clone(SfxItemPool* pPool) const
5378 |*
5379 |*    Beschreibung
5380 |*    Ersterstellung    28.06.95 ESO
5381 |*    Letzte Aenderung  28.06.95 ESO
5382 |*
5383 *************************************************************************/
5384 
5385 SfxPoolItem* XFormTextShadowXValItem::Clone(SfxItemPool* /*pPool*/) const
5386 {
5387     return new XFormTextShadowXValItem(*this);
5388 }
5389 
5390 /*************************************************************************
5391 |*
5392 |*    SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, sal_uInt16 nVer) const
5393 |*
5394 |*    Beschreibung
5395 |*    Ersterstellung    28.06.95 ESO
5396 |*    Letzte Aenderung  28.06.95 ESO
5397 |*
5398 *************************************************************************/
5399 
5400 SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5401 {
5402     return new XFormTextShadowXValItem(rIn);
5403 }
5404 
5405 //------------------------------
5406 // class XFormTextShadowYValItem
5407 //------------------------------
5408 TYPEINIT1_AUTOFACTORY(XFormTextShadowYValItem, SfxMetricItem);
5409 
5410 /*************************************************************************
5411 |*
5412 |*    XFormTextShadowYValItem::XFormTextShadowYValItem(long)
5413 |*
5414 |*    Beschreibung
5415 |*    Ersterstellung    28.06.95 ESO
5416 |*    Letzte Aenderung  28.06.95 ESO
5417 |*
5418 *************************************************************************/
5419 
5420 XFormTextShadowYValItem::XFormTextShadowYValItem(long nVal) :
5421     SfxMetricItem(XATTR_FORMTXTSHDWYVAL, nVal)
5422 {
5423 }
5424 
5425 /*************************************************************************
5426 |*
5427 |*    XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn)
5428 |*
5429 |*    Beschreibung
5430 |*    Ersterstellung    28.06.95 ESO
5431 |*    Letzte Aenderung  28.06.95 ESO
5432 |*
5433 *************************************************************************/
5434 
5435 XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn) :
5436     SfxMetricItem(XATTR_FORMTXTSHDWYVAL, rIn)
5437 {
5438 }
5439 
5440 /*************************************************************************
5441 |*
5442 |*    XFormTextShadowYValItem::Clone(SfxItemPool* pPool) const
5443 |*
5444 |*    Beschreibung
5445 |*    Ersterstellung    28.06.95 ESO
5446 |*    Letzte Aenderung  28.06.95 ESO
5447 |*
5448 *************************************************************************/
5449 
5450 SfxPoolItem* XFormTextShadowYValItem::Clone(SfxItemPool* /*pPool*/) const
5451 {
5452     return new XFormTextShadowYValItem(*this);
5453 }
5454 
5455 /*************************************************************************
5456 |*
5457 |*    SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, sal_uInt16 nVer) const
5458 |*
5459 |*    Beschreibung
5460 |*    Ersterstellung    28.06.95 ESO
5461 |*    Letzte Aenderung  28.06.95 ESO
5462 |*
5463 *************************************************************************/
5464 
5465 SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5466 {
5467     return new XFormTextShadowYValItem(rIn);
5468 }
5469 
5470 // --------------------------
5471 // class XFormTextHideFormItem
5472 // --------------------------
5473 TYPEINIT1_AUTOFACTORY(XFormTextHideFormItem, SfxBoolItem);
5474 
5475 /*************************************************************************
5476 |*
5477 |*    XFormTextHideFormItem::XFormTextHideFormItem()
5478 |*
5479 |*    Ersterstellung    27.06.95 ESO
5480 |*    Letzte Aenderung  27.06.95 ESO
5481 |*
5482 *************************************************************************/
5483 
5484 XFormTextHideFormItem::XFormTextHideFormItem(sal_Bool bHide) :
5485     SfxBoolItem(XATTR_FORMTXTHIDEFORM, bHide)
5486 {
5487 }
5488 
5489 /*************************************************************************
5490 |*
5491 |*    XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn)
5492 |*
5493 |*    Ersterstellung    27.06.95 ESO
5494 |*    Letzte Aenderung  27.06.95 ESO
5495 |*
5496 *************************************************************************/
5497 
5498 XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn) :
5499     SfxBoolItem(XATTR_FORMTXTHIDEFORM, rIn)
5500 {
5501 }
5502 
5503 /*************************************************************************
5504 |*
5505 |*    XFormTextHideFormItem::Clone(SfxItemPool* pPool) const
5506 |*
5507 |*    Ersterstellung    27.06.95 ESO
5508 |*    Letzte Aenderung  27.06.95 ESO
5509 |*
5510 *************************************************************************/
5511 
5512 SfxPoolItem* XFormTextHideFormItem::Clone(SfxItemPool* /*pPool*/) const
5513 {
5514     return new XFormTextHideFormItem(*this);
5515 }
5516 
5517 /*************************************************************************
5518 |*
5519 |*    SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 nVer)
5520 |*                                              const
5521 |*
5522 |*    Ersterstellung    27.06.95 ESO
5523 |*    Letzte Aenderung  27.06.95 ESO
5524 |*
5525 *************************************************************************/
5526 
5527 SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
5528 {
5529     return new XFormTextHideFormItem(rIn);
5530 }
5531 
5532 
5533 
5534 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5535 //                              SetItems
5536 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5537 
5538 TYPEINIT1(XLineAttrSetItem, SfxSetItem);
5539 
5540 /*************************************************************************
5541 |*
5542 |* Konstruktoren fuer Linienattribute-SetItem
5543 |*
5544 \************************************************************************/
5545 
5546 XLineAttrSetItem::XLineAttrSetItem( SfxItemSet* pItemSet ) :
5547     SfxSetItem( XATTRSET_LINE, pItemSet)
5548 {
5549 }
5550 
5551 /************************************************************************/
5552 
5553 XLineAttrSetItem::XLineAttrSetItem( SfxItemPool* pItemPool ) :
5554     SfxSetItem( XATTRSET_LINE,
5555         new SfxItemSet( *pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST))
5556 {
5557 }
5558 
5559 /************************************************************************/
5560 
5561 XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr ) :
5562     SfxSetItem( rLineAttr )
5563 {
5564 }
5565 
5566 /************************************************************************/
5567 
5568 XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr,
5569                                     SfxItemPool* pItemPool) :
5570     SfxSetItem( rLineAttr, pItemPool )
5571 {
5572 }
5573 
5574 /*************************************************************************
5575 |*
5576 |* Clone-Funktion
5577 |*
5578 \************************************************************************/
5579 
5580 SfxPoolItem* XLineAttrSetItem::Clone( SfxItemPool* pPool ) const
5581 {
5582     return new XLineAttrSetItem( *this, pPool );
5583 }
5584 
5585 /*************************************************************************
5586 |*
5587 |* SetItem aus Stream erzeugen
5588 |*
5589 \************************************************************************/
5590 
5591 SfxPoolItem* XLineAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
5592 {
5593     SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
5594                                     XATTR_LINE_FIRST, XATTR_LINE_LAST);
5595     pSet2->Load( rStream );
5596     return new XLineAttrSetItem( pSet2 );
5597 }
5598 
5599 /*************************************************************************
5600 |*
5601 |* SetItem in Stream speichern
5602 |*
5603 \************************************************************************/
5604 
5605 SvStream& XLineAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const
5606 {
5607     return SfxSetItem::Store( rStream, nItemVersion );
5608 }
5609 
5610 
5611 TYPEINIT1(XFillAttrSetItem, SfxSetItem);
5612 
5613 /*************************************************************************
5614 |*
5615 |* Konstruktoren fuer Fuellattribute-SetItem
5616 |*
5617 \************************************************************************/
5618 
5619 XFillAttrSetItem::XFillAttrSetItem( SfxItemSet* pItemSet ) :
5620     SfxSetItem( XATTRSET_FILL, pItemSet)
5621 {
5622 }
5623 
5624 /************************************************************************/
5625 
5626 XFillAttrSetItem::XFillAttrSetItem( SfxItemPool* pItemPool ) :
5627     SfxSetItem( XATTRSET_FILL,
5628         new SfxItemSet( *pItemPool, XATTR_FILL_FIRST, XATTR_FILL_LAST))
5629 {
5630 }
5631 
5632 /************************************************************************/
5633 
5634 XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr ) :
5635     SfxSetItem( rFillAttr )
5636 {
5637 }
5638 
5639 /************************************************************************/
5640 
5641 XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr,
5642                                     SfxItemPool* pItemPool ) :
5643     SfxSetItem( rFillAttr, pItemPool )
5644 {
5645 }
5646 
5647 /*************************************************************************
5648 |*
5649 |* Clone-Funktion
5650 |*
5651 \************************************************************************/
5652 
5653 SfxPoolItem* XFillAttrSetItem::Clone( SfxItemPool* pPool ) const
5654 {
5655     return new XFillAttrSetItem( *this, pPool );
5656 }
5657 
5658 /*************************************************************************
5659 |*
5660 |* SetItem aus Stream erzeugen
5661 |*
5662 \************************************************************************/
5663 
5664 SfxPoolItem* XFillAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
5665 {
5666     SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
5667                                     XATTR_FILL_FIRST, XATTR_FILL_LAST);
5668     pSet2->Load( rStream );
5669     return new XFillAttrSetItem( pSet2 );
5670 }
5671 
5672 /*************************************************************************
5673 |*
5674 |* SetItem in Stream speichern
5675 |*
5676 \************************************************************************/
5677 
5678 SvStream& XFillAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const
5679 {
5680     return SfxSetItem::Store( rStream, nItemVersion );
5681 }
5682 
5683 // eof
5684 
5685