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