LCOV - code coverage report
Current view: top level - svx/source/xoutdev - xattr.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 966 1724 56.0 %
Date: 2014-04-11 Functions: 265 417 63.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
      21             : #include <com/sun/star/drawing/Hatch.hpp>
      22             : #include <com/sun/star/drawing/LineStyle.hpp>
      23             : #include <com/sun/star/drawing/LineDash.hpp>
      24             : #include <com/sun/star/drawing/DashStyle.hpp>
      25             : #include <com/sun/star/awt/Point.hpp>
      26             : #include <com/sun/star/drawing/PointSequence.hpp>
      27             : #include <com/sun/star/drawing/FillStyle.hpp>
      28             : #include <com/sun/star/awt/Gradient.hpp>
      29             : #include <com/sun/star/uno/Sequence.hxx>
      30             : #include <com/sun/star/beans/PropertyValue.hpp>
      31             : #include <svl/itempool.hxx>
      32             : #include <editeng/memberids.hrc>
      33             : #include <tools/stream.hxx>
      34             : 
      35             : #include "svx/unoapi.hxx"
      36             : #include <svl/style.hxx>
      37             : 
      38             : #include <tools/bigint.hxx>
      39             : #include <svl/itemset.hxx>
      40             : #include <svx/dialogs.hrc>
      41             : #include "svx/svdstr.hrc"
      42             : #include "svx/xattr.hxx"
      43             : #include <svx/xtable.hxx>
      44             : #include <svx/dialmgr.hxx>
      45             : #include <editeng/itemtype.hxx>
      46             : #include <svx/xdef.hxx>
      47             : #include <svx/unomid.hxx>
      48             : #include <svx/svdmodel.hxx>
      49             : #include <basegfx/polygon/b2dpolygon.hxx>
      50             : #include <basegfx/point/b2dpoint.hxx>
      51             : #include <basegfx/vector/b2dvector.hxx>
      52             : #include <basegfx/tools/unotools.hxx>
      53             : #include <vcl/gradient.hxx>
      54             : 
      55             : #include <stdio.h>
      56             : 
      57             : using namespace ::rtl;
      58             : using namespace ::com::sun::star;
      59             : 
      60             : #define TWIP_TO_MM100(TWIP)     ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
      61             : #define MM100_TO_TWIP(MM100)    ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
      62             : 
      63             : #define VCLTOSVCOL( rCol ) (sal_uInt16)((((sal_uInt16)(rCol))<<8)|(rCol))
      64             : 
      65       66168 : TYPEINIT1_AUTOFACTORY(NameOrIndex, SfxStringItem);
      66             : 
      67           0 : long ScaleMetricValue( long nVal, long nMul, long nDiv )
      68             : {
      69           0 :     BigInt aVal( nVal );
      70             : 
      71           0 :     aVal *= nMul;
      72             : 
      73           0 :     if ( aVal.IsNeg() != ( nDiv < 0 ) )
      74           0 :         aVal-=nDiv/2; // for correct rounding
      75             :     else
      76           0 :         aVal+=nDiv/2; // for correct rounding
      77             : 
      78           0 :     aVal/=nDiv;
      79             : 
      80           0 :     return long( aVal );
      81             : }
      82             : 
      83       21764 : NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, sal_Int32 nIndex) :
      84             :     SfxStringItem(_nWhich, OUString()),
      85       21764 :     nPalIndex(nIndex)
      86             : {
      87       21764 : }
      88             : 
      89       42147 : NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, const OUString& rName) :
      90             :     SfxStringItem(_nWhich, rName),
      91       42147 :     nPalIndex(-1)
      92             : {
      93       42147 : }
      94             : 
      95           0 : NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, SvStream& rIn) :
      96           0 :     SfxStringItem(_nWhich, rIn)
      97             : {
      98           0 :     rIn.ReadInt32( nPalIndex );
      99           0 : }
     100             : 
     101       75973 : NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex) :
     102             :     SfxStringItem(rNameOrIndex),
     103       75973 :     nPalIndex(rNameOrIndex.nPalIndex)
     104             : {
     105       75973 : }
     106             : 
     107      356502 : bool NameOrIndex::operator==(const SfxPoolItem& rItem) const
     108             : {
     109      706787 :     return ( SfxStringItem::operator==(rItem) &&
     110      706787 :             ((const NameOrIndex&) rItem).nPalIndex == nPalIndex );
     111             : }
     112             : 
     113           0 : SfxPoolItem* NameOrIndex::Clone(SfxItemPool* /*pPool*/) const
     114             : {
     115             : 
     116           0 :     return new NameOrIndex(*this);
     117             : }
     118             : 
     119           0 : SfxPoolItem* NameOrIndex::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
     120             : {
     121           0 :     return new NameOrIndex(Which(), rIn);
     122             : }
     123             : 
     124           0 : SvStream& NameOrIndex::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
     125             : {
     126           0 :     SfxStringItem::Store( rOut, nItemVersion );
     127           0 :     rOut.WriteInt32( nPalIndex );
     128           0 :     return rOut;
     129             : }
     130             : 
     131             : /** this static checks if the given NameOrIndex item has a unique name for its value.
     132             :     The returned String is a unique name for an item with this value in both given pools.
     133             :     Argument pPool2 can be null.
     134             :     If returned string equals NameOrIndex->GetName(), the name was already unique.
     135             : */
     136        5668 : OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* /*pPool2*/, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, const XPropertyListRef &pDefaults )
     137             : {
     138        5668 :     bool bForceNew = false;
     139             : 
     140        5668 :     OUString aUniqueName = SvxUnogetInternalNameForItem(nWhich, pCheckItem->GetName());
     141             : 
     142             :     // 2. if we have a name check if there is already an item with the
     143             :     // same name in the documents pool with a different line end or start
     144             : 
     145        5668 :     if (!aUniqueName.isEmpty() && pPool1)
     146             :     {
     147        5427 :         const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich );
     148             : 
     149             :         const NameOrIndex *pItem;
     150        8689 :         for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
     151             :         {
     152        8689 :             pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate );
     153             : 
     154        8689 :             if( pItem && ( pItem->GetName() == pCheckItem->GetName() ) )
     155             :             {
     156             :                 // if there is already an item with the same name and the same
     157             :                 // value its ok to set it
     158        5427 :                 if( !pCompareValueFunc( pItem, pCheckItem ) )
     159             :                 {
     160             :                     // same name but different value, we need a new name for this item
     161           0 :                     aUniqueName = "";
     162           0 :                     bForceNew = true;
     163             :                 }
     164        5427 :                 break;
     165             :             }
     166             :         }
     167             :     }
     168             : 
     169             :     // if we have no name yet, find existing item with same conent or
     170             :     // create a unique name
     171        5668 :     if (aUniqueName.isEmpty())
     172             :     {
     173         241 :         sal_Int32 nUserIndex = 1;
     174         241 :         const ResId aRes(SVX_RES(nPrefixResId));
     175         241 :         OUString aUser( aRes.toString() );
     176         241 :         aUser += " ";
     177             : 
     178         241 :         if( pDefaults.get() )
     179             :         {
     180         241 :             const int nCount = pDefaults->Count();
     181             :             int nIndex;
     182        1198 :             for( nIndex = 0; nIndex < nCount; nIndex++ )
     183             :             {
     184         958 :                 XPropertyEntry* pEntry = pDefaults->Get(nIndex);
     185         958 :                 if( pEntry )
     186             :                 {
     187         958 :                     bool bFound = false;
     188             : 
     189         958 :                     switch( nWhich )
     190             :                     {
     191             :                     case XATTR_FILLBITMAP:
     192             :                     {
     193           0 :                         const GraphicObject& rGraphicObjectA(((XFillBitmapItem*)pCheckItem)->GetGraphicObject());
     194           0 :                         const GraphicObject& rGraphicObjectB(((XBitmapEntry*)pEntry)->GetGraphicObject());
     195             : 
     196           0 :                         bFound = (rGraphicObjectA == rGraphicObjectB);
     197           0 :                         break;
     198             :                     }
     199             :                     case XATTR_LINEDASH:
     200         198 :                         bFound = (((XLineDashItem*)pCheckItem)->GetDashValue() == ((XDashEntry*)pEntry) ->GetDash());
     201         198 :                         break;
     202             :                     case XATTR_LINESTART:
     203           0 :                         bFound = (((XLineStartItem*)pCheckItem)->GetLineStartValue() == ((XLineEndEntry*)pEntry)->GetLineEnd());
     204           0 :                         break;
     205             :                     case XATTR_LINEEND:
     206           0 :                         bFound = (((XLineEndItem*)pCheckItem)->GetLineEndValue() == ((XLineEndEntry*)pEntry)->GetLineEnd());
     207           0 :                         break;
     208             :                     case XATTR_FILLGRADIENT:
     209         474 :                         bFound = (((XFillGradientItem*)pCheckItem)->GetGradientValue() == ((XGradientEntry*)pEntry)->GetGradient());
     210         474 :                         break;
     211             :                     case XATTR_FILLHATCH:
     212         286 :                         bFound = (((XFillHatchItem*)pCheckItem)->GetHatchValue() == ((XHatchEntry*)pEntry)->GetHatch());
     213         286 :                         break;
     214             :                     }
     215             : 
     216         958 :                     if( bFound )
     217             :                     {
     218           1 :                         aUniqueName = pEntry->GetName();
     219           1 :                         break;
     220             :                     }
     221             :                     else
     222             :                     {
     223         957 :                         OUString aEntryName = pEntry->GetName();
     224         957 :                         if(aEntryName.getLength() >= aUser.getLength())
     225             :                         {
     226         957 :                             sal_Int32 nThisIndex = aEntryName.copy( aUser.getLength() ).toInt32();
     227         957 :                             if( nThisIndex >= nUserIndex )
     228         759 :                                 nUserIndex = nThisIndex + 1;
     229         957 :                         }
     230             :                     }
     231             :                 }
     232             :             }
     233             :         }
     234             : 
     235         241 :         if (aUniqueName.isEmpty() && pPool1)
     236             :         {
     237         240 :             const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich );
     238             :             const NameOrIndex *pItem;
     239        1836 :             for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
     240             :             {
     241        1701 :                 pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate );
     242             : 
     243        1701 :                 if( pItem && !pItem->GetName().isEmpty() )
     244             :                 {
     245        1279 :                     if( !bForceNew && pCompareValueFunc( pItem, pCheckItem ) )
     246         105 :                         return pItem->GetName();
     247             : 
     248        1174 :                     if( pItem->GetName().startsWith( aUser ) )
     249             :                     {
     250        1174 :                         sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
     251        1174 :                         if( nThisIndex >= nUserIndex )
     252        1159 :                             nUserIndex = nThisIndex + 1;
     253             :                     }
     254             :                 }
     255             :             }
     256         135 :             aUniqueName = aUser;
     257         135 :             aUniqueName += OUString::number( nUserIndex );
     258         136 :         }
     259             :     }
     260             : 
     261        5563 :     return aUniqueName;
     262             : }
     263             : 
     264             : // class XColorItem
     265             : 
     266       33623 : TYPEINIT1_AUTOFACTORY(XColorItem, NameOrIndex);
     267             : 
     268           0 : XColorItem::XColorItem(sal_uInt16 _nWhich, sal_Int32 nIndex, const Color& rTheColor) :
     269             :     NameOrIndex(_nWhich, nIndex),
     270           0 :     aColor(rTheColor)
     271             : {
     272           0 : }
     273             : 
     274       35639 : XColorItem::XColorItem(sal_uInt16 _nWhich, const OUString& rName, const Color& rTheColor) :
     275             :     NameOrIndex(_nWhich, rName),
     276       35639 :     aColor(rTheColor)
     277             : {
     278       35639 : }
     279             : 
     280        5505 : XColorItem::XColorItem(sal_uInt16 _nWhich, const Color& rTheColor)
     281             :     : NameOrIndex(_nWhich, OUString())
     282        5505 :     , aColor(rTheColor)
     283             : {
     284        5505 : }
     285             : 
     286       70921 : XColorItem::XColorItem(const XColorItem& rItem) :
     287             :     NameOrIndex(rItem),
     288       70921 :     aColor(rItem.aColor)
     289             : {
     290       70921 : }
     291             : 
     292           0 : XColorItem::XColorItem(sal_uInt16 _nWhich, SvStream& rIn) :
     293           0 :     NameOrIndex(_nWhich, rIn)
     294             : {
     295           0 :     if (!IsIndex())
     296             :     {
     297           0 :         ReadColor( rIn, aColor );
     298             :     }
     299           0 : }
     300             : 
     301         612 : SfxPoolItem* XColorItem::Clone(SfxItemPool* /*pPool*/) const
     302             : {
     303         612 :     return new XColorItem(*this);
     304             : }
     305             : 
     306      347762 : bool XColorItem::operator==(const SfxPoolItem& rItem) const
     307             : {
     308      695524 :     return ( NameOrIndex::operator==(rItem) &&
     309      695524 :             ((const XColorItem&) rItem).aColor == aColor );
     310             : }
     311             : 
     312           0 : SfxPoolItem* XColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
     313             : {
     314           0 :     return new XColorItem(Which(), rIn);
     315             : }
     316             : 
     317           0 : SvStream& XColorItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
     318             : {
     319           0 :     NameOrIndex::Store( rOut, nItemVersion );
     320             : 
     321           0 :     if ( !IsIndex() )
     322             :     {
     323           0 :         WriteColor( rOut, aColor );
     324             :     }
     325             : 
     326           0 :     return rOut;
     327             : }
     328             : 
     329       44793 : const Color& XColorItem::GetColorValue(const XColorList* pTable) const
     330             : {
     331       44793 :     if (!IsIndex())
     332       44793 :         return aColor;
     333             :     else
     334           0 :         return pTable->GetColor(GetIndex())->GetColor();
     335             : 
     336             : }
     337             : 
     338         123 : bool XColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
     339             : {
     340         123 :     rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
     341         123 :     return true;
     342             : }
     343             : 
     344         178 : bool XColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
     345             : {
     346         178 :     sal_Int32 nValue = 0;
     347         178 :     rVal >>= nValue;
     348         178 :     SetColorValue( nValue );
     349             : 
     350         178 :     return true;
     351             : }
     352             : 
     353             : // --- line attributes ---
     354             : 
     355             : // class XLineStyleItem
     356             : 
     357      194714 : TYPEINIT1_AUTOFACTORY(XLineStyleItem, SfxEnumItem);
     358             : 
     359       24069 : XLineStyleItem::XLineStyleItem(XLineStyle eTheLineStyle) :
     360       24069 :     SfxEnumItem(XATTR_LINESTYLE, sal::static_int_cast< sal_uInt16 >(eTheLineStyle))
     361             : {
     362       24069 : }
     363             : 
     364           0 : XLineStyleItem::XLineStyleItem(SvStream& rIn) :
     365           0 :     SfxEnumItem(XATTR_LINESTYLE, rIn)
     366             : {
     367           0 : }
     368             : 
     369       43719 : SfxPoolItem* XLineStyleItem::Clone(SfxItemPool* /*pPool*/) const
     370             : {
     371       43719 :     return new XLineStyleItem( *this );
     372             : }
     373             : 
     374           0 : SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
     375             : {
     376           0 :     return new XLineStyleItem(rIn);
     377             : }
     378             : 
     379           0 : SfxItemPresentation XLineStyleItem::GetPresentation
     380             : (
     381             :     SfxItemPresentation ePres,
     382             :     SfxMapUnit          /*eCoreUnit*/,
     383             :     SfxMapUnit          /*ePresUnit*/,
     384             :     OUString&           rText, const IntlWrapper *
     385             : )   const
     386             : {
     387           0 :     rText = OUString();
     388             : 
     389           0 :     switch ( ePres )
     390             :     {
     391             :         case SFX_ITEM_PRESENTATION_NONE:
     392           0 :             return ePres;
     393             :         case SFX_ITEM_PRESENTATION_COMPLETE:
     394             :         case SFX_ITEM_PRESENTATION_NAMELESS:
     395             :         {
     396           0 :             sal_uInt16 nId = 0;
     397             : 
     398           0 :             switch( (sal_uInt16)GetValue() )
     399             :             {
     400             :                 case XLINE_NONE:
     401           0 :                     nId = RID_SVXSTR_INVISIBLE;
     402           0 :                     break;
     403             :                 case XLINE_SOLID:
     404           0 :                     nId = RID_SVXSTR_SOLID;
     405           0 :                     break;
     406             :             }
     407             : 
     408           0 :             if ( nId )
     409           0 :                 rText = SVX_RESSTR( nId );
     410           0 :             return ePres;
     411             :         }
     412             :         default:
     413           0 :             return SFX_ITEM_PRESENTATION_NONE;
     414             :     }
     415             : }
     416             : 
     417        1461 : bool XLineStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
     418             : {
     419        1461 :     ::com::sun::star::drawing::LineStyle eLS = (::com::sun::star::drawing::LineStyle)GetValue();
     420        1461 :     rVal <<= eLS;
     421        1461 :     return true;
     422             : }
     423             : 
     424       32496 : bool XLineStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
     425             : {
     426             :     ::com::sun::star::drawing::LineStyle eLS;
     427       32496 :     if(!(rVal >>= eLS ))
     428             :     {
     429             :         // also try an int (for Basic)
     430           0 :         sal_Int32 nLS = 0;
     431           0 :         if(!(rVal >>= nLS))
     432           0 :             return false;
     433           0 :         eLS = (::com::sun::star::drawing::LineStyle)nLS;
     434             :     }
     435             : 
     436       32496 :     SetValue( sal::static_int_cast< sal_uInt16 >( eLS ) );
     437       32496 :     return true;
     438             : }
     439             : 
     440           0 : sal_uInt16 XLineStyleItem::GetValueCount() const
     441             : {
     442           0 :     return 3;
     443             : }
     444             : 
     445             : // class XDash
     446             : 
     447        4076 : XDash::XDash(XDashStyle eTheDash, sal_uInt16 nTheDots, sal_uIntPtr nTheDotLen,
     448             :              sal_uInt16 nTheDashes, sal_uIntPtr nTheDashLen, sal_uIntPtr nTheDistance) :
     449             :     eDash(eTheDash),
     450             :     nDots(nTheDots),
     451             :     nDotLen(nTheDotLen),
     452             :     nDashes(nTheDashes),
     453             :     nDashLen(nTheDashLen),
     454        4076 :     nDistance(nTheDistance)
     455             : {
     456        4076 : }
     457             : 
     458         496 : bool XDash::operator==(const XDash& rDash) const
     459             : {
     460         948 :     return ( eDash      == rDash.eDash      &&
     461         734 :              nDots      == rDash.nDots      &&
     462         500 :              nDotLen    == rDash.nDotLen    &&
     463         436 :              nDashes    == rDash.nDashes    &&
     464         930 :              nDashLen   == rDash.nDashLen   &&
     465         712 :              nDistance  == rDash.nDistance );
     466             : }
     467             : 
     468             : // XDash is translated into an array of doubles which describe the lengths of the
     469             : // dashes, dots and empty passages. It returns the complete length of the full DashDot
     470             : // sequence and fills the given vetor of doubles accordingly (also resizing, so deleting it).
     471             : static double SMALLEST_DASH_WIDTH(26.95);
     472             : 
     473         705 : double XDash::CreateDotDashArray(::std::vector< double >& rDotDashArray, double fLineWidth) const
     474             : {
     475         705 :     double fFullDotDashLen(0.0);
     476         705 :     const sal_uInt16 nNumDotDashArray = (GetDots() + GetDashes()) * 2;
     477         705 :     rDotDashArray.resize( nNumDotDashArray, 0.0 );
     478             :     sal_uInt16 a;
     479         705 :     sal_uInt16 nIns(0);
     480         705 :     double fDashDotDistance = (double)GetDistance();
     481         705 :     double fSingleDashLen = (double)GetDashLen();
     482         705 :     double fSingleDotLen = (double)GetDotLen();
     483             : 
     484         705 :     if(GetDashStyle() == XDASH_RECTRELATIVE || GetDashStyle() == XDASH_ROUNDRELATIVE)
     485             :     {
     486         330 :         if(fLineWidth != 0.0)
     487             :         {
     488         330 :             double fFactor = fLineWidth / 100.0;
     489             : 
     490         330 :             if(GetDashes())
     491             :             {
     492          82 :                 if(GetDashLen())
     493             :                 {
     494             :                     // is a dash
     495          20 :                     fSingleDashLen *= fFactor;
     496             :                 }
     497             :                 else
     498             :                 {
     499             :                     // is a dot
     500          62 :                     fSingleDashLen = fLineWidth;
     501             :                 }
     502             :             }
     503             : 
     504         330 :             if(GetDots())
     505             :             {
     506         310 :                 if(GetDotLen())
     507             :                 {
     508             :                     // is a dash
     509         248 :                     fSingleDotLen *= fFactor;
     510             :                 }
     511             :                 else
     512             :                 {
     513             :                     // is a dot
     514          62 :                     fSingleDotLen = fLineWidth;
     515             :                 }
     516             :             }
     517             : 
     518         330 :             if(GetDashes() || GetDots())
     519             :             {
     520         330 :                 if(GetDistance())
     521             :                 {
     522         330 :                     fDashDotDistance *= fFactor;
     523             :                 }
     524             :                 else
     525             :                 {
     526           0 :                     fDashDotDistance = fLineWidth;
     527             :                 }
     528             :             }
     529             :         }
     530             :         else
     531             :         {
     532           0 :             if(GetDashes())
     533             :             {
     534           0 :                 if(GetDashLen())
     535             :                 {
     536             :                     // is a dash
     537           0 :                     fSingleDashLen = (SMALLEST_DASH_WIDTH * fSingleDashLen) / 100.0;
     538             :                 }
     539             :                 else
     540             :                 {
     541             :                     // is a dot
     542           0 :                     fSingleDashLen = SMALLEST_DASH_WIDTH;
     543             :                 }
     544             :             }
     545             : 
     546           0 :             if(GetDots())
     547             :             {
     548           0 :                 if(GetDotLen())
     549             :                 {
     550             :                     // is a dash
     551           0 :                     fSingleDotLen = (SMALLEST_DASH_WIDTH * fSingleDotLen) / 100.0;
     552             :                 }
     553             :                 else
     554             :                 {
     555             :                     // is a dot
     556           0 :                     fSingleDotLen = SMALLEST_DASH_WIDTH;
     557             :                 }
     558             :             }
     559             : 
     560           0 :             if(GetDashes() || GetDots())
     561             :             {
     562           0 :                 if(GetDistance())
     563             :                 {
     564             :                     // dash as distance
     565           0 :                     fDashDotDistance = (SMALLEST_DASH_WIDTH * fDashDotDistance) / 100.0;
     566             :                 }
     567             :                 else
     568             :                 {
     569             :                     // dot as distance
     570           0 :                     fDashDotDistance = SMALLEST_DASH_WIDTH;
     571             :                 }
     572             :             }
     573             :         }
     574             :     }
     575             :     else
     576             :     {
     577             :         // smallest dot size compare value
     578         375 :         double fDotCompVal(fLineWidth != 0.0 ? fLineWidth : SMALLEST_DASH_WIDTH);
     579             : 
     580             :         // absolute values
     581         375 :         if(GetDashes())
     582             :         {
     583         289 :             if(GetDashLen())
     584             :             {
     585             :                 // is a dash
     586         227 :                 if(fSingleDashLen < SMALLEST_DASH_WIDTH)
     587             :                 {
     588           0 :                     fSingleDashLen = SMALLEST_DASH_WIDTH;
     589             :                 }
     590             :             }
     591             :             else
     592             :             {
     593             :                 // is a dot
     594          62 :                 if(fSingleDashLen < fDotCompVal)
     595             :                 {
     596          62 :                     fSingleDashLen = fDotCompVal;
     597             :                 }
     598             :             }
     599             :         }
     600             : 
     601         375 :         if(GetDots())
     602             :         {
     603         341 :             if(GetDotLen())
     604             :             {
     605             :                 // is a dash
     606         217 :                 if(fSingleDotLen < SMALLEST_DASH_WIDTH)
     607             :                 {
     608          22 :                     fSingleDotLen = SMALLEST_DASH_WIDTH;
     609             :                 }
     610             :             }
     611             :             else
     612             :             {
     613             :                 // is a dot
     614         124 :                 if(fSingleDotLen < fDotCompVal)
     615             :                 {
     616         124 :                     fSingleDotLen = fDotCompVal;
     617             :                 }
     618             :             }
     619             :         }
     620             : 
     621         375 :         if(GetDashes() || GetDots())
     622             :         {
     623         375 :             if(GetDistance())
     624             :             {
     625             :                 // dash as distance
     626         375 :                 if(fDashDotDistance < SMALLEST_DASH_WIDTH)
     627             :                 {
     628          22 :                     fDashDotDistance = SMALLEST_DASH_WIDTH;
     629             :                 }
     630             :             }
     631             :             else
     632             :             {
     633             :                 // dot as distance
     634           0 :                 if(fDashDotDistance < fDotCompVal)
     635             :                 {
     636           0 :                     fDashDotDistance = fDotCompVal;
     637             :                 }
     638             :             }
     639             :         }
     640             :     }
     641             : 
     642        1611 :     for(a=0;a<GetDots();a++)
     643             :     {
     644         906 :         rDotDashArray[nIns++] = fSingleDotLen;
     645         906 :         fFullDotDashLen += fSingleDotLen;
     646         906 :         rDotDashArray[nIns++] = fDashDotDistance;
     647         906 :         fFullDotDashLen += fDashDotDistance;
     648             :     }
     649             : 
     650        1882 :     for(a=0;a<GetDashes();a++)
     651             :     {
     652        1177 :         rDotDashArray[nIns++] = fSingleDashLen;
     653        1177 :         fFullDotDashLen += fSingleDashLen;
     654        1177 :         rDotDashArray[nIns++] = fDashDotDistance;
     655        1177 :         fFullDotDashLen += fDashDotDistance;
     656             :     }
     657             : 
     658         705 :     return fFullDotDashLen;
     659             : }
     660             : 
     661             : // class XLineDashItem
     662             : 
     663        9422 : TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex);
     664             : 
     665         116 : XLineDashItem::XLineDashItem(const OUString& rName, const XDash& rTheDash) :
     666             :     NameOrIndex(XATTR_LINEDASH, rName),
     667         116 :     aDash(rTheDash)
     668             : {
     669         116 : }
     670             : 
     671         437 : XLineDashItem::XLineDashItem(const XLineDashItem& rItem) :
     672             :     NameOrIndex(rItem),
     673         437 :     aDash(rItem.aDash)
     674             : {
     675         437 : }
     676             : 
     677           0 : XLineDashItem::XLineDashItem(SvStream& rIn) :
     678           0 :     NameOrIndex(XATTR_LINEDASH, rIn)
     679             : {
     680           0 :     if (!IsIndex())
     681             :     {
     682             :         sal_uInt16  nSTemp;
     683             :         sal_uInt32  nLTemp;
     684             :         sal_Int32   nITemp;
     685             : 
     686           0 :         rIn.ReadInt32( nITemp ); aDash.SetDashStyle((XDashStyle)nITemp);
     687           0 :         rIn.ReadUInt16( nSTemp ); aDash.SetDots(nSTemp);
     688           0 :         rIn.ReadUInt32( nLTemp ); aDash.SetDotLen(nLTemp);
     689           0 :         rIn.ReadUInt16( nSTemp ); aDash.SetDashes(nSTemp);
     690           0 :         rIn.ReadUInt32( nLTemp ); aDash.SetDashLen(nLTemp);
     691           0 :         rIn.ReadUInt32( nLTemp ); aDash.SetDistance(nLTemp);
     692             :     }
     693           0 : }
     694             : 
     695        2975 : XLineDashItem::XLineDashItem(SfxItemPool* /*pPool*/, const XDash& rTheDash)
     696             : :   NameOrIndex( XATTR_LINEDASH, -1 ),
     697        2975 :     aDash(rTheDash)
     698             : {
     699        2975 : }
     700             : 
     701         437 : SfxPoolItem* XLineDashItem::Clone(SfxItemPool* /*pPool*/) const
     702             : {
     703         437 :     return new XLineDashItem(*this);
     704             : }
     705             : 
     706         378 : bool XLineDashItem::operator==(const SfxPoolItem& rItem) const
     707             : {
     708         595 :     return ( NameOrIndex::operator==(rItem) &&
     709         595 :              aDash == ((const XLineDashItem&) rItem).aDash );
     710             : }
     711             : 
     712           0 : SfxPoolItem* XLineDashItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
     713             : {
     714           0 :     return new XLineDashItem(rIn);
     715             : }
     716             : 
     717           0 : SvStream& XLineDashItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
     718             : {
     719           0 :     NameOrIndex::Store( rOut, nItemVersion );
     720             : 
     721           0 :     if (!IsIndex())
     722             :     {
     723           0 :         rOut.WriteInt32( (sal_Int32) aDash.GetDashStyle() );
     724           0 :         rOut.WriteUInt16( aDash.GetDots() );
     725           0 :         rOut.WriteUInt32( (sal_uInt32) aDash.GetDotLen() );
     726           0 :         rOut.WriteUInt16( aDash.GetDashes() );
     727           0 :         rOut.WriteUInt32( (sal_uInt32) aDash.GetDashLen() );
     728           0 :         rOut.WriteUInt32( (sal_uInt32) aDash.GetDistance() );
     729             :     }
     730             : 
     731           0 :     return rOut;
     732             : }
     733             : 
     734         796 : const XDash& XLineDashItem::GetDashValue() const
     735             : {
     736         796 :     return aDash;
     737             : }
     738             : 
     739           0 : SfxItemPresentation XLineDashItem::GetPresentation
     740             : (
     741             :     SfxItemPresentation ePres,
     742             :     SfxMapUnit          /*eCoreUnit*/,
     743             :     SfxMapUnit          /*ePresUnit*/,
     744             :     OUString&           rText, const IntlWrapper *
     745             : )   const
     746             : {
     747           0 :     switch ( ePres )
     748             :     {
     749             :         case SFX_ITEM_PRESENTATION_NONE:
     750           0 :             rText = OUString();
     751           0 :             return ePres;
     752             :         case SFX_ITEM_PRESENTATION_NAMELESS:
     753             :         case SFX_ITEM_PRESENTATION_COMPLETE:
     754           0 :             rText = GetName();
     755           0 :             return ePres;
     756             :         default:
     757           0 :             return SFX_ITEM_PRESENTATION_NONE;
     758             :     }
     759             : }
     760             : 
     761           0 : bool XLineDashItem::HasMetrics() const
     762             : {
     763           0 :     return true;
     764             : }
     765             : 
     766           0 : bool XLineDashItem::ScaleMetrics(long nMul, long nDiv)
     767             : {
     768           0 :     aDash.SetDotLen( ScaleMetricValue( aDash.GetDotLen(), nMul, nDiv ) );
     769           0 :     aDash.SetDashLen( ScaleMetricValue( aDash.GetDashLen(), nMul, nDiv ) );
     770           0 :     aDash.SetDistance( ScaleMetricValue( aDash.GetDistance(), nMul, nDiv ) );
     771           0 :     return true;
     772             : }
     773             : 
     774         605 : bool XLineDashItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
     775             : {
     776         605 :     nMemberId &= ~CONVERT_TWIPS;
     777             : 
     778         605 :     switch ( nMemberId )
     779             :     {
     780             :         case 0:
     781             :         {
     782          66 :             uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
     783             : 
     784          66 :             ::com::sun::star::drawing::LineDash aLineDash;
     785             : 
     786          66 :             const XDash& rXD = GetDashValue();
     787          66 :             aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle());
     788          66 :             aLineDash.Dots = rXD.GetDots();
     789          66 :             aLineDash.DotLen = rXD.GetDotLen();
     790          66 :             aLineDash.Dashes = rXD.GetDashes();
     791          66 :             aLineDash.DashLen = rXD.GetDashLen();
     792          66 :             aLineDash.Distance = rXD.GetDistance();
     793             : 
     794         132 :             OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
     795          66 :             aPropSeq[0].Name    = "Name";
     796          66 :             aPropSeq[0].Value   = uno::makeAny( aApiName );
     797          66 :             aPropSeq[1].Name    = "LineDash";
     798          66 :             aPropSeq[1].Value   = uno::makeAny( aLineDash );
     799          66 :             rVal = uno::makeAny( aPropSeq );
     800         132 :             break;
     801             :         }
     802             : 
     803             :         case MID_NAME:
     804             :         {
     805         254 :             OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
     806         254 :             rVal <<= aApiName;
     807         254 :             break;
     808             :         }
     809             : 
     810             :         case MID_LINEDASH:
     811             :         {
     812         285 :             const XDash& rXD = GetDashValue();
     813             : 
     814         285 :             ::com::sun::star::drawing::LineDash aLineDash;
     815             : 
     816         285 :             aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle());
     817         285 :             aLineDash.Dots = rXD.GetDots();
     818         285 :             aLineDash.DotLen = rXD.GetDotLen();
     819         285 :             aLineDash.Dashes = rXD.GetDashes();
     820         285 :             aLineDash.DashLen = rXD.GetDashLen();
     821         285 :             aLineDash.Distance = rXD.GetDistance();
     822             : 
     823         285 :             rVal <<= aLineDash;
     824         285 :             break;
     825             :         }
     826             : 
     827             :         case MID_LINEDASH_STYLE:
     828             :         {
     829           0 :             const XDash& rXD = GetDashValue();
     830           0 :             rVal <<= (::com::sun::star::drawing::DashStyle)((sal_Int16)rXD.GetDashStyle());
     831           0 :             break;
     832             :         }
     833             : 
     834             :         case MID_LINEDASH_DOTS:
     835             :         {
     836           0 :             const XDash& rXD = GetDashValue();
     837           0 :             rVal <<= rXD.GetDots();
     838           0 :             break;
     839             :         }
     840             : 
     841             :         case MID_LINEDASH_DOTLEN:
     842             :         {
     843           0 :             const XDash& rXD = GetDashValue();
     844           0 :             rVal <<= rXD.GetDotLen();
     845           0 :             break;
     846             :         }
     847             : 
     848             :         case MID_LINEDASH_DASHES:
     849             :         {
     850           0 :             const XDash& rXD = GetDashValue();
     851           0 :             rVal <<= rXD.GetDashes();
     852           0 :             break;
     853             :         }
     854             : 
     855             :         case MID_LINEDASH_DASHLEN:
     856             :         {
     857           0 :             const XDash& rXD = GetDashValue();
     858           0 :             rVal <<= rXD.GetDashLen();
     859           0 :             break;
     860             :         }
     861             : 
     862             :         case MID_LINEDASH_DISTANCE:
     863             :         {
     864           0 :             const XDash& rXD = GetDashValue();
     865           0 :             rVal <<= rXD.GetDistance();
     866           0 :             break;
     867             :         }
     868             : 
     869           0 :         default: OSL_FAIL("Wrong MemberId!"); return false;
     870             :     }
     871             : 
     872         605 :     return true;
     873             : }
     874             : 
     875          96 : bool XLineDashItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
     876             : {
     877          96 :     nMemberId &= ~CONVERT_TWIPS;
     878             : 
     879          96 :     switch ( nMemberId )
     880             :     {
     881             :         case 0:
     882             :         {
     883          66 :             uno::Sequence< beans::PropertyValue >   aPropSeq;
     884          66 :             ::com::sun::star::drawing::LineDash     aLineDash;
     885         132 :             OUString                           aName;
     886          66 :             bool                               bLineDash( false );
     887             : 
     888          66 :             if ( rVal >>= aPropSeq )
     889             :             {
     890         198 :                 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
     891             :                 {
     892         132 :                     if ( aPropSeq[n].Name == "Name" )
     893          66 :                         aPropSeq[n].Value >>= aName;
     894          66 :                     else if ( aPropSeq[n].Name == "LineDash" )
     895             :                     {
     896          66 :                         if ( aPropSeq[n].Value >>= aLineDash )
     897          66 :                             bLineDash = true;
     898             :                     }
     899             :                 }
     900             : 
     901          66 :                 SetName( aName );
     902          66 :                 if ( bLineDash )
     903             :                 {
     904          66 :                     XDash aXDash;
     905             : 
     906          66 :                     aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style)));
     907          66 :                     aXDash.SetDots(aLineDash.Dots);
     908          66 :                     aXDash.SetDotLen(aLineDash.DotLen);
     909          66 :                     aXDash.SetDashes(aLineDash.Dashes);
     910          66 :                     aXDash.SetDashLen(aLineDash.DashLen);
     911          66 :                     aXDash.SetDistance(aLineDash.Distance);
     912             : 
     913          66 :                     if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
     914           0 :                         aXDash.SetDots(1);
     915             : 
     916          66 :                     SetDashValue( aXDash );
     917             :                 }
     918             : 
     919          66 :                 return true;
     920             :             }
     921             : 
     922          66 :             return false;
     923             :         }
     924             : 
     925             :         case MID_NAME:
     926             :         {
     927           0 :             OUString aName;
     928           0 :             if (!(rVal >>= aName))
     929           0 :                 return false;
     930           0 :             SetName( aName );
     931           0 :             break;
     932             :         }
     933             : 
     934             :         case MID_LINEDASH:
     935             :         {
     936          30 :             ::com::sun::star::drawing::LineDash aLineDash;
     937          30 :             if(!(rVal >>= aLineDash))
     938           0 :                 return false;
     939             : 
     940          30 :             XDash aXDash;
     941             : 
     942          30 :             aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style)));
     943          30 :             aXDash.SetDots(aLineDash.Dots);
     944          30 :             aXDash.SetDotLen(aLineDash.DotLen);
     945          30 :             aXDash.SetDashes(aLineDash.Dashes);
     946          30 :             aXDash.SetDashLen(aLineDash.DashLen);
     947          30 :             aXDash.SetDistance(aLineDash.Distance);
     948             : 
     949          30 :             if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
     950           0 :                 aXDash.SetDots(1);
     951             : 
     952          30 :             SetDashValue( aXDash );
     953          30 :             break;
     954             :         }
     955             : 
     956             :         case MID_LINEDASH_STYLE:
     957             :         {
     958           0 :             sal_Int16 nVal = sal_Int16();
     959           0 :             if(!(rVal >>= nVal))
     960           0 :                 return false;
     961             : 
     962           0 :             XDash aXDash = GetDashValue();
     963           0 :             aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(nVal)));
     964             : 
     965           0 :             if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
     966           0 :                 aXDash.SetDots(1);
     967             : 
     968           0 :             SetDashValue( aXDash );
     969             : 
     970           0 :             break;
     971             :         }
     972             : 
     973             :         case MID_LINEDASH_DOTS:
     974             :         case MID_LINEDASH_DASHES:
     975             :         {
     976           0 :             sal_Int16 nVal = sal_Int16();
     977           0 :             if(!(rVal >>= nVal))
     978           0 :                 return false;
     979             : 
     980           0 :             XDash aXDash = GetDashValue();
     981           0 :             if ( nMemberId == MID_LINEDASH_DOTS )
     982           0 :                 aXDash.SetDots( nVal );
     983             :             else
     984           0 :                 aXDash.SetDashes( nVal );
     985             : 
     986           0 :             if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
     987           0 :                 aXDash.SetDots(1);
     988             : 
     989           0 :             SetDashValue( aXDash );
     990           0 :             break;
     991             :         }
     992             : 
     993             :         case MID_LINEDASH_DOTLEN:
     994             :         case MID_LINEDASH_DASHLEN:
     995             :         case MID_LINEDASH_DISTANCE:
     996             :         {
     997           0 :             sal_Int32 nVal = 0;
     998           0 :             if(!(rVal >>= nVal))
     999           0 :                 return false;
    1000             : 
    1001           0 :             XDash aXDash = GetDashValue();
    1002           0 :             if ( nMemberId == MID_LINEDASH_DOTLEN )
    1003           0 :                 aXDash.SetDotLen( nVal );
    1004           0 :             else if ( nMemberId == MID_LINEDASH_DASHLEN )
    1005           0 :                 aXDash.SetDashLen( nVal );
    1006             :             else
    1007           0 :                 aXDash.SetDistance( nVal );
    1008             : 
    1009           0 :             if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
    1010           0 :                 aXDash.SetDots(1);
    1011             : 
    1012           0 :             SetDashValue( aXDash );
    1013           0 :             break;
    1014             :         }
    1015             :     }
    1016             : 
    1017          30 :     return true;
    1018             : }
    1019             : 
    1020          81 : bool XLineDashItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
    1021             : {
    1022          81 :     return ((XLineDashItem*)p1)->GetDashValue() == ((XLineDashItem*)p2)->GetDashValue();
    1023             : }
    1024             : 
    1025         142 : XLineDashItem* XLineDashItem::checkForUniqueItem( SdrModel* pModel ) const
    1026             : {
    1027         142 :     if( pModel )
    1028             :     {
    1029             :         const OUString aUniqueName = NameOrIndex::CheckNamedItem(
    1030          90 :                 this, XATTR_LINEDASH, &pModel->GetItemPool(),
    1031          94 :                 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
    1032             :                 XLineDashItem::CompareValueFunc, RID_SVXSTR_DASH11,
    1033         274 :                 pModel->GetPropertyList( XDASH_LIST ) );
    1034             : 
    1035             :         // if the given name is not valid, replace it!
    1036          90 :         if( aUniqueName != GetName() )
    1037          66 :             return new XLineDashItem( aUniqueName, aDash );
    1038             :     }
    1039             : 
    1040          76 :     return (XLineDashItem*)this;
    1041             : }
    1042             : 
    1043             : // class XLineWidthItem
    1044             : 
    1045      101170 : TYPEINIT1_AUTOFACTORY(XLineWidthItem, SfxMetricItem);
    1046             : 
    1047        4207 : XLineWidthItem::XLineWidthItem(long nWidth) :
    1048        4207 :     SfxMetricItem(XATTR_LINEWIDTH, nWidth)
    1049             : {
    1050        4207 : }
    1051             : 
    1052           0 : XLineWidthItem::XLineWidthItem(SvStream& rIn) :
    1053           0 :     SfxMetricItem(XATTR_LINEWIDTH, rIn)
    1054             : {
    1055           0 : }
    1056             : 
    1057       20697 : SfxPoolItem* XLineWidthItem::Clone(SfxItemPool* /*pPool*/) const
    1058             : {
    1059       20697 :     return new XLineWidthItem(*this);
    1060             : }
    1061             : 
    1062           0 : SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    1063             : {
    1064           0 :     return new XLineWidthItem(rIn);
    1065             : }
    1066             : 
    1067           0 : SfxItemPresentation XLineWidthItem::GetPresentation
    1068             : (
    1069             :     SfxItemPresentation ePres,
    1070             :     SfxMapUnit          eCoreUnit,
    1071             :     SfxMapUnit          ePresUnit,
    1072             :     OUString&           rText, const IntlWrapper * pIntl
    1073             : )   const
    1074             : {
    1075           0 :     switch ( ePres )
    1076             :     {
    1077             :         case SFX_ITEM_PRESENTATION_NONE:
    1078           0 :             rText = OUString();
    1079           0 :             return ePres;
    1080             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    1081             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    1082           0 :             rText = GetMetricText( (long) GetValue(),
    1083           0 :                                     eCoreUnit, ePresUnit, pIntl) +
    1084           0 :                     " " + EE_RESSTR( GetMetricId( ePresUnit) );
    1085           0 :             return ePres;
    1086             :         default:
    1087           0 :             return SFX_ITEM_PRESENTATION_NONE;
    1088             :     }
    1089             : }
    1090             : 
    1091        1184 : bool XLineWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
    1092             : {
    1093        1184 :     sal_Int32 nValue = GetValue();
    1094        1184 :     if( 0 != (nMemberId&CONVERT_TWIPS) )
    1095           0 :         nValue = TWIP_TO_MM100(nValue);
    1096             : 
    1097        1184 :     rVal <<= nValue;
    1098        1184 :     return true;
    1099             : }
    1100             : 
    1101       17515 : bool XLineWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
    1102             : {
    1103       17515 :     sal_Int32 nValue = 0;
    1104       17515 :     rVal >>= nValue;
    1105       17515 :     if( 0 != (nMemberId&CONVERT_TWIPS) )
    1106           0 :         nValue = MM100_TO_TWIP(nValue);
    1107             : 
    1108       17515 :     SetValue( nValue );
    1109       17515 :     return true;
    1110             : }
    1111             : 
    1112             : // class XLineColorItem
    1113             : 
    1114       96999 : TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem);
    1115             : 
    1116           0 : XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor) :
    1117           0 :     XColorItem(XATTR_LINECOLOR, nIndex, rTheColor)
    1118             : {
    1119           0 : }
    1120             : 
    1121        4289 : XLineColorItem::XLineColorItem(const OUString& rName, const Color& rTheColor) :
    1122        4289 :     XColorItem(XATTR_LINECOLOR, rName, rTheColor)
    1123             : {
    1124        4289 : }
    1125             : 
    1126           0 : XLineColorItem::XLineColorItem(SvStream& rIn) :
    1127           0 :     XColorItem(XATTR_LINECOLOR, rIn)
    1128             : {
    1129           0 : }
    1130             : 
    1131       36135 : SfxPoolItem* XLineColorItem::Clone(SfxItemPool* /*pPool*/) const
    1132             : {
    1133       36135 :     return new XLineColorItem(*this);
    1134             : }
    1135             : 
    1136           0 : SfxPoolItem* XLineColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    1137             : {
    1138           0 :     return new XLineColorItem(rIn);
    1139             : }
    1140             : 
    1141           0 : SfxItemPresentation XLineColorItem::GetPresentation
    1142             : (
    1143             :     SfxItemPresentation ePres,
    1144             :     SfxMapUnit          /*eCoreUnit*/,
    1145             :     SfxMapUnit          /*ePresUnit*/,
    1146             :     OUString&           rText, const IntlWrapper *
    1147             : )   const
    1148             : {
    1149           0 :     switch ( ePres )
    1150             :     {
    1151             :         case SFX_ITEM_PRESENTATION_NONE:
    1152           0 :             rText = OUString();
    1153           0 :             return ePres;
    1154             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    1155             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    1156           0 :             rText = GetName();
    1157           0 :             return ePres;
    1158             :         default:
    1159           0 :             return SFX_ITEM_PRESENTATION_NONE;
    1160             :     }
    1161             : }
    1162             : 
    1163        1125 : bool XLineColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
    1164             : {
    1165        1125 :     rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
    1166        1125 :     return true;
    1167             : }
    1168             : 
    1169       16920 : bool XLineColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
    1170             : {
    1171       16920 :     sal_Int32 nValue = 0;
    1172       16920 :     if(!(rVal >>= nValue))
    1173           0 :         return false;
    1174             : 
    1175       16920 :     SetColorValue( nValue );
    1176       16920 :     return true;
    1177             : }
    1178             : 
    1179             : // --- tooling for simple spooling B2DPolygon to file and back ---
    1180             : 
    1181             : namespace
    1182             : {
    1183           0 :     void streamOutB2DPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, SvStream& rOut)
    1184             :     {
    1185           0 :         const sal_uInt32 nPolygonCount(rPolyPolygon.count());
    1186           0 :         rOut.WriteUInt32( nPolygonCount );
    1187             : 
    1188           0 :         for(sal_uInt32 a(0L); a < nPolygonCount; a++)
    1189             :         {
    1190           0 :             const basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(a));
    1191           0 :             const sal_uInt32 nPointCount(aCandidate.count());
    1192           0 :             const sal_uInt8 bClosed(aCandidate.isClosed() ? 1 : 0);
    1193           0 :             const sal_uInt8 bControlPoints(aCandidate.areControlPointsUsed() ? 1 : 0);
    1194           0 :             rOut.WriteUInt32( nPointCount );
    1195           0 :             rOut.WriteUChar( bClosed );
    1196           0 :             rOut.WriteUChar( bControlPoints );
    1197             : 
    1198           0 :             for(sal_uInt32 b(0L); b < nPointCount; b++)
    1199             :             {
    1200           0 :                 const basegfx::B2DPoint aPoint(aCandidate.getB2DPoint(b));
    1201           0 :                 rOut.WriteDouble( aPoint.getX() );
    1202           0 :                 rOut.WriteDouble( aPoint.getY() );
    1203             : 
    1204           0 :                 if(bControlPoints)
    1205             :                 {
    1206           0 :                     const sal_uInt8 bEdgeIsCurve(aCandidate.isPrevControlPointUsed(b) || aCandidate.isNextControlPointUsed(b) ? 1 : 0);
    1207           0 :                     rOut.WriteUChar( bEdgeIsCurve );
    1208             : 
    1209           0 :                     if(bEdgeIsCurve)
    1210             :                     {
    1211           0 :                         const basegfx::B2DVector aControlVectorA(aCandidate.getPrevControlPoint(b));
    1212           0 :                         rOut.WriteDouble( aControlVectorA.getX() );
    1213           0 :                         rOut.WriteDouble( aControlVectorA.getY() );
    1214             : 
    1215           0 :                         const basegfx::B2DVector aControlVectorB(aCandidate.getNextControlPoint(b));
    1216           0 :                         rOut.WriteDouble( aControlVectorB.getX() );
    1217           0 :                         rOut.WriteDouble( aControlVectorB.getY() );
    1218             :                     }
    1219             :                 }
    1220           0 :             }
    1221           0 :         }
    1222           0 :     }
    1223             : 
    1224           0 :     basegfx::B2DPolyPolygon streamInB2DPolyPolygon(SvStream& rIn)
    1225             :     {
    1226           0 :         basegfx::B2DPolyPolygon aRetval;
    1227             :         sal_uInt32 nPolygonCount;
    1228           0 :         rIn.ReadUInt32( nPolygonCount );
    1229             : 
    1230           0 :         for(sal_uInt32 a(0L); a < nPolygonCount; a++)
    1231             :         {
    1232             :             sal_uInt32 nPointCount;
    1233             :             sal_uInt8 bClosed;
    1234             :             sal_uInt8 bControlPoints;
    1235             : 
    1236           0 :             rIn.ReadUInt32( nPointCount );
    1237           0 :             rIn.ReadUChar( bClosed );
    1238           0 :             rIn.ReadUChar( bControlPoints );
    1239             : 
    1240           0 :             basegfx::B2DPolygon aCandidate;
    1241           0 :             aCandidate.setClosed(0 != bClosed);
    1242             : 
    1243           0 :             for(sal_uInt32 b(0L); b < nPointCount; b++)
    1244             :             {
    1245             :                 double fX, fY;
    1246           0 :                 rIn.ReadDouble( fX );
    1247           0 :                 rIn.ReadDouble( fY );
    1248           0 :                 aCandidate.append(basegfx::B2DPoint(fX, fY));
    1249             : 
    1250           0 :                 if(0 != bControlPoints)
    1251             :                 {
    1252             :                     sal_uInt8 bEdgeIsCurve;
    1253           0 :                     rIn.ReadUChar( bEdgeIsCurve );
    1254             : 
    1255           0 :                     if(0 != bEdgeIsCurve)
    1256             :                     {
    1257           0 :                         rIn.ReadDouble( fX );
    1258           0 :                         rIn.ReadDouble( fY );
    1259           0 :                         aCandidate.setPrevControlPoint(b, basegfx::B2DVector(fX, fY));
    1260             : 
    1261           0 :                         rIn.ReadDouble( fX );
    1262           0 :                         rIn.ReadDouble( fY );
    1263           0 :                         aCandidate.setNextControlPoint(b, basegfx::B2DVector(fX, fY));
    1264             :                     }
    1265             :                 }
    1266             :             }
    1267             : 
    1268           0 :             aRetval.append(aCandidate);
    1269           0 :         }
    1270             : 
    1271           0 :         return aRetval;
    1272             :     }
    1273             : }
    1274             : 
    1275             : // class XLineStartItem
    1276             : 
    1277        9737 : TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex);
    1278             : 
    1279          61 : XLineStartItem::XLineStartItem(sal_Int32 nIndex)
    1280          61 : :   NameOrIndex(XATTR_LINESTART, nIndex)
    1281             : {
    1282          61 : }
    1283             : 
    1284         416 : XLineStartItem::XLineStartItem(const OUString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
    1285             : :   NameOrIndex(XATTR_LINESTART, rName),
    1286         416 :     maPolyPolygon(rPolyPolygon)
    1287             : {
    1288         416 : }
    1289             : 
    1290        1066 : XLineStartItem::XLineStartItem(const XLineStartItem& rItem)
    1291             : :   NameOrIndex(rItem),
    1292        1066 :     maPolyPolygon(rItem.maPolyPolygon)
    1293             : {
    1294        1066 : }
    1295             : 
    1296           0 : XLineStartItem::XLineStartItem(SvStream& rIn) :
    1297           0 :     NameOrIndex(XATTR_LINESTART, rIn)
    1298             : {
    1299           0 :     if (!IsIndex())
    1300             :     {
    1301           0 :         maPolyPolygon = streamInB2DPolyPolygon(rIn);
    1302             :     }
    1303           0 : }
    1304             : 
    1305        2975 : XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
    1306             : :   NameOrIndex( XATTR_LINESTART, -1 ),
    1307        2975 :     maPolyPolygon(rPolyPolygon)
    1308             : {
    1309        2975 : }
    1310             : 
    1311        1066 : SfxPoolItem* XLineStartItem::Clone(SfxItemPool* /*pPool*/) const
    1312             : {
    1313        1066 :     return new XLineStartItem(*this);
    1314             : }
    1315             : 
    1316        1210 : bool XLineStartItem::operator==(const SfxPoolItem& rItem) const
    1317             : {
    1318        1210 :     return ( NameOrIndex::operator==(rItem) && ((const XLineStartItem&) rItem).maPolyPolygon == maPolyPolygon );
    1319             : }
    1320             : 
    1321           0 : SfxPoolItem* XLineStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    1322             : {
    1323           0 :     return new XLineStartItem(rIn);
    1324             : }
    1325             : 
    1326           0 : SvStream& XLineStartItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
    1327             : {
    1328           0 :     NameOrIndex::Store( rOut, nItemVersion );
    1329             : 
    1330           0 :     if (!IsIndex())
    1331             :     {
    1332           0 :         streamOutB2DPolyPolygon(maPolyPolygon, rOut);
    1333             :     }
    1334             : 
    1335           0 :     return rOut;
    1336             : }
    1337             : 
    1338       13726 : basegfx::B2DPolyPolygon XLineStartItem::GetLineStartValue() const
    1339             : {
    1340       13726 :     return maPolyPolygon;
    1341             : }
    1342             : 
    1343           0 : SfxItemPresentation XLineStartItem::GetPresentation
    1344             : (
    1345             :     SfxItemPresentation ePres,
    1346             :     SfxMapUnit          /*eCoreUnit*/,
    1347             :     SfxMapUnit          /*ePresUnit*/,
    1348             :     OUString&           rText, const IntlWrapper *
    1349             : )   const
    1350             : {
    1351           0 :     switch ( ePres )
    1352             :     {
    1353             :         case SFX_ITEM_PRESENTATION_NONE:
    1354           0 :             rText = OUString();
    1355           0 :             return ePres;
    1356             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    1357             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    1358           0 :             rText = GetName();
    1359           0 :             return ePres;
    1360             :         default:
    1361           0 :         return SFX_ITEM_PRESENTATION_NONE;
    1362             :     }
    1363             : }
    1364             : 
    1365        1261 : bool XLineStartItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
    1366             : {
    1367        1261 :     nMemberId &= ~CONVERT_TWIPS;
    1368        1261 :     if( nMemberId == MID_NAME )
    1369             :     {
    1370         324 :         OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
    1371         324 :         rVal <<= aApiName;
    1372             :     }
    1373             :     else
    1374             :     {
    1375         937 :         com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
    1376         937 :         basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
    1377         937 :         rVal <<= aBezier;
    1378             :     }
    1379             : 
    1380        1261 :     return true;
    1381             : }
    1382             : 
    1383          75 : bool XLineStartItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
    1384             : {
    1385          75 :     nMemberId &= ~CONVERT_TWIPS;
    1386          75 :     if( nMemberId == MID_NAME )
    1387             :     {
    1388           0 :         return false;
    1389             :     }
    1390             :     else
    1391             :     {
    1392          75 :         maPolyPolygon.clear();
    1393             : 
    1394          75 :         if( rVal.hasValue() && rVal.getValue() )
    1395             :         {
    1396          75 :             if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
    1397           0 :                 return false;
    1398             : 
    1399          75 :             com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
    1400          75 :             if( pCoords->Coordinates.getLength() > 0 )
    1401             :             {
    1402          75 :                 maPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords );
    1403             :                 // #i72807# close line start/end polygons hard
    1404             :                 // maPolyPolygon.setClosed(true);
    1405             :             }
    1406             :         }
    1407             :     }
    1408             : 
    1409          75 :     return true;
    1410             : }
    1411             : 
    1412             : /** this function searches in both the models pool and the styles pool for XLineStartItem
    1413             :     and XLineEndItem with the same value or name and returns an item with the value of
    1414             :     this item and a unique name for an item with this value. */
    1415         238 : XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
    1416             : {
    1417         238 :     if( pModel )
    1418             :     {
    1419         165 :         XLineStartItem* pTempItem = NULL;
    1420         165 :         const XLineStartItem* pLineStartItem = this;
    1421             : 
    1422         165 :         OUString aUniqueName( GetName() );
    1423             : 
    1424         165 :         if( !maPolyPolygon.count() )
    1425             :         {
    1426             :             // if the polygon is empty, check if the name is empty
    1427           0 :             if( aUniqueName.isEmpty() )
    1428           0 :                 return (XLineStartItem*)this;
    1429             : 
    1430             :             // force empty name for empty polygons
    1431           0 :             return new XLineStartItem( "", maPolyPolygon );
    1432             :         }
    1433             : 
    1434         165 :         if( maPolyPolygon.count() > 1L )
    1435             :         {
    1436             :             // check if the polygon is closed
    1437           0 :             if(!maPolyPolygon.isClosed())
    1438             :             {
    1439             :                 // force a closed polygon
    1440           0 :                 basegfx::B2DPolyPolygon aNew(maPolyPolygon);
    1441           0 :                 aNew.setClosed(true);
    1442           0 :                 pTempItem = new XLineStartItem( aUniqueName, aNew );
    1443           0 :                 pLineStartItem = pTempItem;
    1444             :             }
    1445             :         }
    1446             : 
    1447         165 :         bool bForceNew = false;
    1448             : 
    1449             :         // 2. if we have a name check if there is already an item with the
    1450             :         // same name in the documents pool with a different line end or start
    1451             : 
    1452             :         sal_uInt32 nCount, nSurrogate;
    1453             : 
    1454         165 :         const SfxItemPool* pPool1 = &pModel->GetItemPool();
    1455         165 :         if( !aUniqueName.isEmpty() && pPool1 )
    1456             :         {
    1457         120 :             nCount = pPool1->GetItemCount2( XATTR_LINESTART );
    1458             : 
    1459         150 :             for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
    1460             :             {
    1461         146 :                 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
    1462             : 
    1463         146 :                 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
    1464             :                 {
    1465             :                     // if there is already an item with the same name and the same
    1466             :                     // value its ok to set it
    1467         116 :                     if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
    1468             :                     {
    1469             :                         // same name but different value, we need a new name for this item
    1470           0 :                         aUniqueName = "";
    1471           0 :                         bForceNew = true;
    1472             :                     }
    1473         116 :                     break;
    1474             :                 }
    1475             :             }
    1476             : 
    1477         120 :             if( !bForceNew )
    1478             :             {
    1479         120 :                 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
    1480             : 
    1481         153 :                 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
    1482             :                 {
    1483         137 :                     const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
    1484             : 
    1485         137 :                     if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
    1486             :                     {
    1487             :                         // if there is already an item with the same name and the same
    1488             :                         // value its ok to set it
    1489         104 :                         if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
    1490             :                         {
    1491             :                             // same name but different value, we need a new name for this item
    1492           0 :                             aUniqueName = "";
    1493           0 :                             bForceNew = true;
    1494             :                         }
    1495         104 :                         break;
    1496             :                     }
    1497             :                 }
    1498             :             }
    1499             :         }
    1500             : 
    1501         165 :         const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
    1502         165 :         if( !aUniqueName.isEmpty() && pPool2)
    1503             :         {
    1504          12 :             nCount = pPool2->GetItemCount2( XATTR_LINESTART );
    1505          39 :             for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
    1506             :             {
    1507          38 :                 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate );
    1508             : 
    1509          38 :                 if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
    1510             :                 {
    1511             :                     // if there is already an item with the same name and the same
    1512             :                     // value its ok to set it
    1513          11 :                     if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
    1514             :                     {
    1515             :                         // same name but different value, we need a new name for this item
    1516           0 :                         aUniqueName = "";
    1517           0 :                         bForceNew = true;
    1518             :                     }
    1519          11 :                     break;
    1520             :                 }
    1521             :             }
    1522             : 
    1523          12 :             if( !bForceNew )
    1524             :             {
    1525          12 :                 nCount = pPool2->GetItemCount2( XATTR_LINEEND );
    1526          42 :                 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
    1527             :                 {
    1528          35 :                     const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate );
    1529             : 
    1530          35 :                     if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
    1531             :                     {
    1532             :                         // if there is already an item with the same name and the same
    1533             :                         // value its ok to set it
    1534           5 :                         if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
    1535             :                         {
    1536             :                             // same name but different value, we need a new name for this item
    1537           0 :                             aUniqueName = "";
    1538           0 :                             bForceNew = true;
    1539             :                         }
    1540           5 :                         break;
    1541             :                     }
    1542             :                 }
    1543             :             }
    1544             :         }
    1545             : 
    1546             :         // if we have no name yet, find existing item with same conent or
    1547             :         // create a unique name
    1548         165 :         if( aUniqueName.isEmpty() )
    1549             :         {
    1550          45 :             bool bFoundExisting = false;
    1551             : 
    1552          45 :             sal_Int32 nUserIndex = 1;
    1553          45 :             const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
    1554          45 :             const OUString aUser( aRes.toString() );
    1555             : 
    1556          45 :             if( pPool1 )
    1557             :             {
    1558          45 :                 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
    1559             :                 sal_uInt32 nSurrogate2;
    1560             : 
    1561         103 :                 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
    1562             :                 {
    1563          93 :                     const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
    1564             : 
    1565          93 :                     if( pItem && !pItem->GetName().isEmpty() )
    1566             :                     {
    1567          49 :                         if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() )
    1568             :                         {
    1569          35 :                             aUniqueName = pItem->GetName();
    1570          35 :                             bFoundExisting = true;
    1571          35 :                             break;
    1572             :                         }
    1573             : 
    1574          14 :                         if( pItem->GetName().startsWith( aUser ) )
    1575             :                         {
    1576          13 :                             sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
    1577          13 :                             if( nThisIndex >= nUserIndex )
    1578          13 :                                 nUserIndex = nThisIndex + 1;
    1579             :                         }
    1580             :                     }
    1581             :                 }
    1582             : 
    1583          45 :                 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
    1584          87 :                 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
    1585             :                 {
    1586          57 :                     const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
    1587             : 
    1588          57 :                     if( pItem && !pItem->GetName().isEmpty() )
    1589             :                     {
    1590          29 :                         if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() )
    1591             :                         {
    1592          15 :                             aUniqueName = pItem->GetName();
    1593          15 :                             bFoundExisting = true;
    1594          15 :                             break;
    1595             :                         }
    1596             : 
    1597          14 :                         if( pItem->GetName().startsWith( aUser ) )
    1598             :                         {
    1599          13 :                             sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
    1600          13 :                             if( nThisIndex >= nUserIndex )
    1601          13 :                                 nUserIndex = nThisIndex + 1;
    1602             :                         }
    1603             :                     }
    1604             :                 }
    1605             :             }
    1606             : 
    1607          45 :             if( !bFoundExisting )
    1608             :             {
    1609          10 :                 aUniqueName = aUser;
    1610          10 :                 aUniqueName += " ";
    1611          10 :                 aUniqueName += OUString::number( nUserIndex );
    1612          45 :             }
    1613             :         }
    1614             : 
    1615             :         // if the given name is not valid, replace it!
    1616         165 :         if( aUniqueName != GetName() || pTempItem )
    1617             :         {
    1618          45 :             if( pTempItem )
    1619             :             {
    1620           0 :                 pTempItem->SetName( aUniqueName );
    1621           0 :                 return pTempItem;
    1622             :             }
    1623             :             else
    1624             :             {
    1625          45 :                 return new XLineStartItem( aUniqueName, maPolyPolygon );
    1626             :             }
    1627         120 :         }
    1628             :     }
    1629             : 
    1630         193 :     return (XLineStartItem*)this;
    1631             : }
    1632             : 
    1633             : // class XLineEndItem
    1634             : 
    1635        9790 : TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex);
    1636             : 
    1637          61 : XLineEndItem::XLineEndItem(sal_Int32 nIndex)
    1638          61 : :   NameOrIndex(XATTR_LINEEND, nIndex)
    1639             : {
    1640          61 : }
    1641             : 
    1642         228 : XLineEndItem::XLineEndItem(const OUString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
    1643             : :   NameOrIndex(XATTR_LINEEND, rName),
    1644         228 :     maPolyPolygon(rPolyPolygon)
    1645             : {
    1646         228 : }
    1647             : 
    1648        1129 : XLineEndItem::XLineEndItem(const XLineEndItem& rItem)
    1649             : :   NameOrIndex(rItem),
    1650        1129 :     maPolyPolygon(rItem.maPolyPolygon)
    1651             : {
    1652        1129 : }
    1653             : 
    1654           0 : XLineEndItem::XLineEndItem(SvStream& rIn) :
    1655           0 :     NameOrIndex(XATTR_LINEEND, rIn)
    1656             : {
    1657           0 :     if (!IsIndex())
    1658             :     {
    1659           0 :         maPolyPolygon = streamInB2DPolyPolygon(rIn);
    1660             :     }
    1661           0 : }
    1662             : 
    1663        2975 : XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
    1664             : :   NameOrIndex( XATTR_LINEEND, -1 ),
    1665        2975 :     maPolyPolygon(rPolyPolygon)
    1666             : {
    1667        2975 : }
    1668             : 
    1669        1129 : SfxPoolItem* XLineEndItem::Clone(SfxItemPool* /*pPool*/) const
    1670             : {
    1671        1129 :     return new XLineEndItem(*this);
    1672             : }
    1673             : 
    1674        1037 : bool XLineEndItem::operator==(const SfxPoolItem& rItem) const
    1675             : {
    1676        1037 :     return ( NameOrIndex::operator==(rItem) && ((const XLineEndItem&) rItem).maPolyPolygon == maPolyPolygon );
    1677             : }
    1678             : 
    1679           0 : SfxPoolItem* XLineEndItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    1680             : {
    1681           0 :     return new XLineEndItem(rIn);
    1682             : }
    1683             : 
    1684           0 : SvStream& XLineEndItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
    1685             : {
    1686           0 :     NameOrIndex::Store( rOut, nItemVersion );
    1687             : 
    1688           0 :     if (!IsIndex())
    1689             :     {
    1690           0 :         streamOutB2DPolyPolygon(maPolyPolygon, rOut);
    1691             :     }
    1692             : 
    1693           0 :     return rOut;
    1694             : }
    1695             : 
    1696       13760 : basegfx::B2DPolyPolygon XLineEndItem::GetLineEndValue() const
    1697             : {
    1698       13760 :     return maPolyPolygon;
    1699             : }
    1700             : 
    1701             : /** this function searches in both the models pool and the styles pool for XLineStartItem
    1702             :     and XLineEndItem with the same value or name and returns an item with the value of
    1703             :     this item and a unique name for an item with this value. */
    1704         391 : XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
    1705             : {
    1706         391 :     if( pModel )
    1707             :     {
    1708         168 :         XLineEndItem* pTempItem = NULL;
    1709         168 :         const XLineEndItem* pLineEndItem = this;
    1710             : 
    1711         168 :         OUString aUniqueName( GetName() );
    1712             : 
    1713         168 :         if( !maPolyPolygon.count() )
    1714             :         {
    1715             :             // if the polygon is empty, check if the name is empty
    1716           0 :             if( aUniqueName.isEmpty() )
    1717           0 :                 return (XLineEndItem*)this;
    1718             : 
    1719             :             // force empty name for empty polygons
    1720           0 :             return new XLineEndItem( "", maPolyPolygon );
    1721             :         }
    1722             : 
    1723         168 :         if( maPolyPolygon.count() > 1L )
    1724             :         {
    1725             :             // check if the polygon is closed
    1726           0 :             if(!maPolyPolygon.isClosed())
    1727             :             {
    1728             :                 // force a closed polygon
    1729           0 :                 basegfx::B2DPolyPolygon aNew(maPolyPolygon);
    1730           0 :                 aNew.setClosed(true);
    1731           0 :                 pTempItem = new XLineEndItem( aUniqueName, aNew );
    1732           0 :                 pLineEndItem = pTempItem;
    1733             :             }
    1734             :         }
    1735             : 
    1736         168 :         bool bForceNew = false;
    1737             : 
    1738             :         // 2. if we have a name check if there is already an item with the
    1739             :         // same name in the documents pool with a different line end or start
    1740             : 
    1741             :         sal_uInt16 nCount, nSurrogate;
    1742             : 
    1743         168 :         const SfxItemPool* pPool1 = &pModel->GetItemPool();
    1744         168 :         if( !aUniqueName.isEmpty() && pPool1 )
    1745             :         {
    1746         153 :             nCount = pPool1->GetItemCount2( XATTR_LINESTART );
    1747             : 
    1748         227 :             for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
    1749             :             {
    1750         221 :                 const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
    1751             : 
    1752         221 :                 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
    1753             :                 {
    1754             :                     // if there is already an item with the same name and the same
    1755             :                     // value its ok to set it
    1756         147 :                     if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
    1757             :                     {
    1758             :                         // same name but different value, we need a new name for this item
    1759           2 :                         aUniqueName = "";
    1760           2 :                         bForceNew = true;
    1761             :                     }
    1762         147 :                     break;
    1763             :                 }
    1764             :             }
    1765             : 
    1766         153 :             if( !bForceNew )
    1767             :             {
    1768         151 :                 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
    1769             : 
    1770         224 :                 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
    1771             :                 {
    1772         223 :                     const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
    1773             : 
    1774         223 :                     if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
    1775             :                     {
    1776             :                         // if there is already an item with the same name and the same
    1777             :                         // value its ok to set it
    1778         150 :                         if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
    1779             :                         {
    1780             :                             // same name but different value, we need a new name for this item
    1781           0 :                             aUniqueName = "";
    1782           0 :                             bForceNew = true;
    1783             :                         }
    1784         150 :                         break;
    1785             :                     }
    1786             :                 }
    1787             :             }
    1788             :         }
    1789             : 
    1790         168 :         const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
    1791         168 :         if( !aUniqueName.isEmpty() && pPool2)
    1792             :         {
    1793          29 :             nCount = pPool2->GetItemCount2( XATTR_LINESTART );
    1794          96 :             for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
    1795             :             {
    1796          90 :                 const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate );
    1797             : 
    1798          90 :                 if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
    1799             :                 {
    1800             :                     // if there is already an item with the same name and the same
    1801             :                     // value its ok to set it
    1802          23 :                     if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
    1803             :                     {
    1804             :                         // same name but different value, we need a new name for this item
    1805           0 :                         aUniqueName = "";
    1806           0 :                         bForceNew = true;
    1807             :                     }
    1808          23 :                     break;
    1809             :                 }
    1810             :             }
    1811             : 
    1812          29 :             if( !bForceNew )
    1813             :             {
    1814          29 :                 nCount = pPool2->GetItemCount2( XATTR_LINEEND );
    1815          98 :                 for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
    1816             :                 {
    1817          98 :                     const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate );
    1818             : 
    1819          98 :                     if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
    1820             :                     {
    1821             :                         // if there is already an item with the same name and the same
    1822             :                         // value its ok to set it
    1823          29 :                         if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
    1824             :                         {
    1825             :                             // same name but different value, we need a new name for this item
    1826           0 :                             aUniqueName = "";
    1827           0 :                             bForceNew = true;
    1828             :                         }
    1829          29 :                         break;
    1830             :                     }
    1831             :                 }
    1832             :             }
    1833             :         }
    1834             : 
    1835             :         // if we have no name yet, find existing item with same conent or
    1836             :         // create a unique name
    1837         168 :         if( aUniqueName.isEmpty() )
    1838             :         {
    1839          17 :             bool bFoundExisting = false;
    1840             : 
    1841          17 :             sal_Int32 nUserIndex = 1;
    1842          17 :             const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
    1843          17 :             const OUString aUser( aRes.toString() );
    1844             : 
    1845          17 :             if( pPool1 )
    1846             :             {
    1847          17 :                 nCount = pPool1->GetItemCount2( XATTR_LINESTART );
    1848             :                 sal_uInt32 nSurrogate2;
    1849             : 
    1850          81 :                 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
    1851             :                 {
    1852          65 :                     const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
    1853             : 
    1854          65 :                     if( pItem && !pItem->GetName().isEmpty() )
    1855             :                     {
    1856          34 :                         if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() )
    1857             :                         {
    1858           1 :                             aUniqueName = pItem->GetName();
    1859           1 :                             bFoundExisting = true;
    1860           1 :                             break;
    1861             :                         }
    1862             : 
    1863          33 :                         if( pItem->GetName().startsWith( aUser ) )
    1864             :                         {
    1865          27 :                             sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
    1866          27 :                             if( nThisIndex >= nUserIndex )
    1867          27 :                                 nUserIndex = nThisIndex + 1;
    1868             :                         }
    1869             :                     }
    1870             :                 }
    1871             : 
    1872          17 :                 nCount = pPool1->GetItemCount2( XATTR_LINEEND );
    1873          57 :                 for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
    1874             :                 {
    1875          53 :                     const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
    1876             : 
    1877          53 :                     if( pItem && !pItem->GetName().isEmpty() )
    1878             :                     {
    1879          22 :                         if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() )
    1880             :                         {
    1881          13 :                             aUniqueName = pItem->GetName();
    1882          13 :                             bFoundExisting = true;
    1883          13 :                             break;
    1884             :                         }
    1885             : 
    1886           9 :                         if( pItem->GetName().startsWith( aUser ) )
    1887             :                         {
    1888           0 :                             sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
    1889           0 :                             if( nThisIndex >= nUserIndex )
    1890           0 :                                 nUserIndex = nThisIndex + 1;
    1891             :                         }
    1892             :                     }
    1893             :                 }
    1894             :             }
    1895             : 
    1896          17 :             if( !bFoundExisting )
    1897             :             {
    1898           3 :                 aUniqueName = aUser;
    1899           3 :                 aUniqueName += " ";
    1900           3 :                 aUniqueName += OUString::number( nUserIndex );
    1901          17 :             }
    1902             :         }
    1903             : 
    1904             :         // if the given name is not valid, replace it!
    1905         168 :         if( aUniqueName != GetName() || pTempItem )
    1906             :         {
    1907          17 :             if( pTempItem )
    1908             :             {
    1909           0 :                 pTempItem->SetName( aUniqueName );
    1910           0 :                 return pTempItem;
    1911             :             }
    1912             :             else
    1913             :             {
    1914          17 :                 return new XLineEndItem( aUniqueName, maPolyPolygon );
    1915             :             }
    1916         151 :         }
    1917             :     }
    1918             : 
    1919         374 :     return (XLineEndItem*)this;
    1920             : }
    1921             : 
    1922           0 : SfxItemPresentation XLineEndItem::GetPresentation
    1923             : (
    1924             :     SfxItemPresentation ePres,
    1925             :     SfxMapUnit          /*eCoreUnit*/,
    1926             :     SfxMapUnit          /*ePresUnit*/,
    1927             :     OUString&           rText, const IntlWrapper *
    1928             : )   const
    1929             : {
    1930           0 :     switch ( ePres )
    1931             :     {
    1932             :         case SFX_ITEM_PRESENTATION_NONE:
    1933           0 :             rText = OUString();
    1934           0 :             return ePres;
    1935             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    1936             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    1937           0 :             rText = GetName();
    1938           0 :             return ePres;
    1939             :         default:
    1940           0 :             return SFX_ITEM_PRESENTATION_NONE;
    1941             :     }
    1942             : }
    1943             : 
    1944        1236 : bool XLineEndItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
    1945             : {
    1946        1236 :     nMemberId &= ~CONVERT_TWIPS;
    1947        1236 :     if( nMemberId == MID_NAME )
    1948             :     {
    1949         322 :         OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
    1950         322 :         rVal <<= aApiName;
    1951             :     }
    1952             :     else
    1953             :     {
    1954         914 :         com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
    1955         914 :         basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
    1956         914 :         rVal <<= aBezier;
    1957             :     }
    1958        1236 :     return true;
    1959             : }
    1960             : 
    1961          75 : bool XLineEndItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
    1962             : {
    1963          75 :     nMemberId &= ~CONVERT_TWIPS;
    1964          75 :     if( nMemberId == MID_NAME )
    1965             :     {
    1966           0 :         return false;
    1967             :     }
    1968             :     else
    1969             :     {
    1970          75 :         maPolyPolygon.clear();
    1971             : 
    1972          75 :         if( rVal.hasValue() && rVal.getValue() )
    1973             :         {
    1974          75 :             if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
    1975           0 :                 return false;
    1976             : 
    1977          75 :             com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
    1978          75 :             if( pCoords->Coordinates.getLength() > 0 )
    1979             :             {
    1980          75 :                 maPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords );
    1981             :                 // #i72807# close line start/end polygons hard
    1982             :                 // maPolyPolygon.setClosed(true);
    1983             :             }
    1984             :         }
    1985             :     }
    1986             : 
    1987          75 :     return true;
    1988             : }
    1989             : 
    1990             : // class XLineStartWidthItem
    1991             : 
    1992        8945 : TYPEINIT1_AUTOFACTORY(XLineStartWidthItem, SfxMetricItem);
    1993             : 
    1994        3346 : XLineStartWidthItem::XLineStartWidthItem(long nWidth) :
    1995        3346 :     SfxMetricItem(XATTR_LINESTARTWIDTH, nWidth)
    1996             : {
    1997        3346 : }
    1998             : 
    1999           0 : XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn) :
    2000           0 :     SfxMetricItem(XATTR_LINESTARTWIDTH, rIn)
    2001             : {
    2002           0 : }
    2003             : 
    2004         506 : SfxPoolItem* XLineStartWidthItem::Clone(SfxItemPool* /*pPool*/) const
    2005             : {
    2006         506 :     return new XLineStartWidthItem(*this);
    2007             : }
    2008             : 
    2009           0 : SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    2010             : {
    2011           0 :     return new XLineStartWidthItem(rIn);
    2012             : }
    2013             : 
    2014           0 : SfxItemPresentation XLineStartWidthItem::GetPresentation
    2015             : (
    2016             :     SfxItemPresentation ePres,
    2017             :     SfxMapUnit          eCoreUnit,
    2018             :     SfxMapUnit          ePresUnit,
    2019             :     OUString&           rText, const IntlWrapper * pIntl
    2020             : )   const
    2021             : {
    2022           0 :     switch ( ePres )
    2023             :     {
    2024             :         case SFX_ITEM_PRESENTATION_NONE:
    2025           0 :             rText = OUString();
    2026           0 :             return ePres;
    2027             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    2028             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    2029           0 :             rText = GetMetricText( (long) GetValue(),
    2030           0 :                                     eCoreUnit, ePresUnit, pIntl) +
    2031           0 :                     " " + EE_RESSTR( GetMetricId( ePresUnit) );
    2032           0 :             return ePres;
    2033             :         default:
    2034           0 :             return SFX_ITEM_PRESENTATION_NONE;
    2035             :     }
    2036             : }
    2037             : 
    2038         322 : bool XLineStartWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
    2039             : {
    2040         322 :     rVal <<= (sal_Int32)GetValue();
    2041         322 :     return true;
    2042             : }
    2043             : 
    2044         100 : bool XLineStartWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
    2045             : {
    2046         100 :     sal_Int32 nValue = 0;
    2047         100 :     rVal >>= nValue;
    2048         100 :     SetValue( nValue );
    2049         100 :     return true;
    2050             : }
    2051             : 
    2052             : // class XLineEndWidthItem
    2053             : 
    2054        9268 : TYPEINIT1_AUTOFACTORY(XLineEndWidthItem, SfxMetricItem);
    2055             : 
    2056        3320 : XLineEndWidthItem::XLineEndWidthItem(long nWidth) :
    2057        3320 :    SfxMetricItem(XATTR_LINEENDWIDTH, nWidth)
    2058             : {
    2059        3320 : }
    2060             : 
    2061           0 : XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn) :
    2062           0 :     SfxMetricItem(XATTR_LINEENDWIDTH, rIn)
    2063             : {
    2064           0 : }
    2065             : 
    2066         712 : SfxPoolItem* XLineEndWidthItem::Clone(SfxItemPool* /*pPool*/) const
    2067             : {
    2068         712 :     return new XLineEndWidthItem(*this);
    2069             : }
    2070             : 
    2071           0 : SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    2072             : {
    2073           0 :     return new XLineEndWidthItem(rIn);
    2074             : }
    2075             : 
    2076           0 : SfxItemPresentation XLineEndWidthItem::GetPresentation
    2077             : (
    2078             :     SfxItemPresentation ePres,
    2079             :     SfxMapUnit          eCoreUnit,
    2080             :     SfxMapUnit          ePresUnit,
    2081             :     OUString&           rText, const IntlWrapper *pIntl
    2082             : )   const
    2083             : {
    2084           0 :     switch ( ePres )
    2085             :     {
    2086             :         case SFX_ITEM_PRESENTATION_NONE:
    2087           0 :             rText = OUString();
    2088           0 :             return ePres;
    2089             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    2090             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    2091           0 :             rText = GetMetricText( (long) GetValue(),
    2092           0 :                                     eCoreUnit, ePresUnit, pIntl) +
    2093           0 :                     " " + EE_RESSTR( GetMetricId( ePresUnit) );
    2094           0 :             return ePres;
    2095             :         default:
    2096           0 :             return SFX_ITEM_PRESENTATION_NONE;
    2097             :     }
    2098             : }
    2099             : 
    2100         320 : bool XLineEndWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
    2101             : {
    2102         320 :     rVal <<= (sal_Int32)GetValue();
    2103         320 :     return true;
    2104             : }
    2105             : 
    2106         141 : bool XLineEndWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
    2107             : {
    2108         141 :     sal_Int32 nValue = 0;
    2109         141 :     rVal >>= nValue;
    2110         141 :     SetValue( nValue );
    2111         141 :     return true;
    2112             : }
    2113             : 
    2114             : // class XLineStartCenterItem
    2115             : 
    2116        8843 : TYPEINIT1_AUTOFACTORY(XLineStartCenterItem, SfxBoolItem);
    2117             : 
    2118        3211 : XLineStartCenterItem::XLineStartCenterItem(bool bStartCenter) :
    2119        3211 :     SfxBoolItem(XATTR_LINESTARTCENTER, bStartCenter)
    2120             : {
    2121        3211 : }
    2122             : 
    2123           0 : XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn) :
    2124           0 :     SfxBoolItem(XATTR_LINESTARTCENTER, rIn)
    2125             : {
    2126           0 : }
    2127             : 
    2128         459 : SfxPoolItem* XLineStartCenterItem::Clone(SfxItemPool* /*pPool*/) const
    2129             : {
    2130         459 :     return new XLineStartCenterItem(*this);
    2131             : }
    2132             : 
    2133           0 : SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    2134             : {
    2135           0 :     return new XLineStartCenterItem(rIn);
    2136             : }
    2137             : 
    2138           0 : SfxItemPresentation XLineStartCenterItem::GetPresentation
    2139             : (
    2140             :     SfxItemPresentation ePres,
    2141             :     SfxMapUnit          /*eCoreUnit*/,
    2142             :     SfxMapUnit          /*ePresUnit*/,
    2143             :     OUString&           rText, const IntlWrapper *
    2144             : )   const
    2145             : {
    2146           0 :     switch ( ePres )
    2147             :     {
    2148             :         case SFX_ITEM_PRESENTATION_NONE:
    2149           0 :             rText = OUString();
    2150           0 :             return ePres;
    2151             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    2152             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    2153           0 :             rText = OUString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
    2154           0 :                             RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
    2155           0 :             return ePres;
    2156             :         default:
    2157           0 :             return SFX_ITEM_PRESENTATION_NONE;
    2158             :     }
    2159             : }
    2160             : 
    2161         300 : bool XLineStartCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
    2162             : {
    2163         300 :     sal_Bool bValue = GetValue();
    2164         300 :     rVal.setValue( &bValue, ::getCppuBooleanType()  );
    2165         300 :     return true;
    2166             : }
    2167             : 
    2168          85 : bool XLineStartCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
    2169             : {
    2170          85 :     if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
    2171           0 :         return false;
    2172             : 
    2173          85 :     SetValue( *(sal_Bool*)rVal.getValue() );
    2174          85 :     return true;
    2175             : }
    2176             : 
    2177             : // class XLineEndCenterItem
    2178             : 
    2179        9053 : TYPEINIT1_AUTOFACTORY(XLineEndCenterItem, SfxBoolItem);
    2180             : 
    2181        3051 : XLineEndCenterItem::XLineEndCenterItem(bool bEndCenter) :
    2182        3051 :     SfxBoolItem(XATTR_LINEENDCENTER, bEndCenter)
    2183             : {
    2184        3051 : }
    2185             : 
    2186           0 : XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn) :
    2187           0 :     SfxBoolItem(XATTR_LINEENDCENTER, rIn)
    2188             : {
    2189           0 : }
    2190             : 
    2191         446 : SfxPoolItem* XLineEndCenterItem::Clone(SfxItemPool* /*pPool*/) const
    2192             : {
    2193         446 :     return new XLineEndCenterItem(*this);
    2194             : }
    2195             : 
    2196           0 : SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    2197             : {
    2198           0 :     return new XLineEndCenterItem(rIn);
    2199             : }
    2200             : 
    2201           0 : SfxItemPresentation XLineEndCenterItem::GetPresentation
    2202             : (
    2203             :     SfxItemPresentation ePres,
    2204             :     SfxMapUnit          /*eCoreUnit*/,
    2205             :     SfxMapUnit          /*ePresUnit*/,
    2206             :     OUString&           rText, const IntlWrapper *
    2207             : )   const
    2208             : {
    2209           0 :     switch ( ePres )
    2210             :     {
    2211             :         case SFX_ITEM_PRESENTATION_NONE:
    2212           0 :             rText = OUString();
    2213           0 :             return ePres;
    2214             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    2215             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    2216           0 :             rText = OUString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
    2217           0 :                             RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
    2218           0 :             return ePres;
    2219             :         default:
    2220           0 :             return SFX_ITEM_PRESENTATION_NONE;
    2221             :     }
    2222             : }
    2223             : 
    2224         276 : bool XLineEndCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
    2225             : {
    2226         276 :     sal_Bool bValue = GetValue();
    2227         276 :     rVal.setValue( &bValue, ::getCppuBooleanType()  );
    2228         276 :     return true;
    2229             : }
    2230             : 
    2231         109 : bool XLineEndCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
    2232             : {
    2233         109 :     if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
    2234           0 :         return false;
    2235             : 
    2236         109 :     SetValue( *(sal_Bool*)rVal.getValue() );
    2237         109 :     return true;
    2238             : }
    2239             : 
    2240             : // --- fill attributes ---
    2241             : 
    2242             : // class XFillStyleItem
    2243             : 
    2244      128510 : TYPEINIT1_AUTOFACTORY(XFillStyleItem, SfxEnumItem);
    2245             : 
    2246       68058 : XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle) :
    2247       68058 :     SfxEnumItem(XATTR_FILLSTYLE, sal::static_int_cast< sal_uInt16 >(eFillStyle))
    2248             : {
    2249       68058 : }
    2250             : 
    2251           0 : XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle, sal_uInt16 nWhich_) :
    2252           0 :     SfxEnumItem(nWhich_, sal::static_int_cast< sal_uInt16 >(eFillStyle))
    2253             : {
    2254           0 : }
    2255             : 
    2256           0 : XFillStyleItem::XFillStyleItem(SvStream& rIn) :
    2257           0 :     SfxEnumItem(XATTR_FILLSTYLE, rIn)
    2258             : {
    2259           0 : }
    2260             : 
    2261       25193 : SfxPoolItem* XFillStyleItem::Clone(SfxItemPool* /*pPool*/) const
    2262             : {
    2263       25193 :     return new XFillStyleItem( *this );
    2264             : }
    2265             : 
    2266           0 : SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    2267             : {
    2268           0 :     return new XFillStyleItem(rIn);
    2269             : }
    2270             : 
    2271           0 : SfxItemPresentation XFillStyleItem::GetPresentation
    2272             : (
    2273             :     SfxItemPresentation ePres,
    2274             :     SfxMapUnit          /*eCoreUnit*/,
    2275             :     SfxMapUnit          /*ePresUnit*/,
    2276             :     OUString&           rText, const IntlWrapper *
    2277             : )   const
    2278             : {
    2279           0 :     rText = OUString();
    2280             : 
    2281           0 :     switch ( ePres )
    2282             :     {
    2283             :         case SFX_ITEM_PRESENTATION_NONE:
    2284           0 :             return ePres;
    2285             : 
    2286             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    2287             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    2288             :         {
    2289           0 :             sal_uInt16 nId = 0;
    2290             : 
    2291           0 :             switch( (sal_uInt16)GetValue() )
    2292             :             {
    2293             :                 case XFILL_NONE:
    2294           0 :                     nId = RID_SVXSTR_INVISIBLE;
    2295           0 :                     break;
    2296             :                 case XFILL_SOLID:
    2297           0 :                     nId = RID_SVXSTR_SOLID;
    2298           0 :                     break;
    2299             :                 case XFILL_GRADIENT:
    2300           0 :                     nId = RID_SVXSTR_GRADIENT;
    2301           0 :                     break;
    2302             :                 case XFILL_HATCH:
    2303           0 :                     nId = RID_SVXSTR_HATCH;
    2304           0 :                     break;
    2305             :                 case XFILL_BITMAP:
    2306           0 :                     nId = RID_SVXSTR_BITMAP;
    2307           0 :                     break;
    2308             :             }
    2309             : 
    2310           0 :             if ( nId )
    2311           0 :                 rText = SVX_RESSTR( nId );
    2312           0 :             return ePres;
    2313             :         }
    2314             :         default:
    2315           0 :             return SFX_ITEM_PRESENTATION_NONE;
    2316             :     }
    2317             : }
    2318             : 
    2319           0 : sal_uInt16 XFillStyleItem::GetValueCount() const
    2320             : {
    2321           0 :     return 5;
    2322             : }
    2323             : 
    2324        1837 : bool XFillStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
    2325             : {
    2326        1837 :     ::com::sun::star::drawing::FillStyle eFS = (::com::sun::star::drawing::FillStyle)GetValue();
    2327             : 
    2328        1837 :     rVal <<= eFS;
    2329             : 
    2330        1837 :     return true;
    2331             : }
    2332             : 
    2333       18223 : bool XFillStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
    2334             : {
    2335             :     ::com::sun::star::drawing::FillStyle eFS;
    2336       18223 :     if(!(rVal >>= eFS))
    2337             :     {
    2338             :         // also try an int (for Basic)
    2339           2 :         sal_Int32 nFS = 0;
    2340           2 :         if(!(rVal >>= nFS))
    2341           2 :             return false;
    2342           0 :         eFS = (::com::sun::star::drawing::FillStyle)nFS;
    2343             :     }
    2344             : 
    2345       18221 :     SetValue( sal::static_int_cast< sal_uInt16 >( eFS ) );
    2346             : 
    2347       18221 :     return true;
    2348             : }
    2349             : 
    2350             : // class XFillColorItem
    2351             : 
    2352       94077 : TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem);
    2353             : 
    2354           0 : XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor) :
    2355           0 :     XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor)
    2356             : {
    2357           0 : }
    2358             : 
    2359       25668 : XFillColorItem::XFillColorItem(const OUString& rName, const Color& rTheColor) :
    2360       25668 :     XColorItem(XATTR_FILLCOLOR, rName, rTheColor)
    2361             : {
    2362       25668 : }
    2363             : 
    2364           0 : XFillColorItem::XFillColorItem(SvStream& rIn) :
    2365           0 :     XColorItem(XATTR_FILLCOLOR, rIn)
    2366             : {
    2367           0 : }
    2368             : 
    2369       34150 : SfxPoolItem* XFillColorItem::Clone(SfxItemPool* /*pPool*/) const
    2370             : {
    2371       34150 :     return new XFillColorItem(*this);
    2372             : }
    2373             : 
    2374           0 : SfxPoolItem* XFillColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    2375             : {
    2376           0 :     return new XFillColorItem(rIn);
    2377             : }
    2378             : 
    2379           0 : SfxItemPresentation XFillColorItem::GetPresentation
    2380             : (
    2381             :     SfxItemPresentation ePres,
    2382             :     SfxMapUnit          /*eCoreUnit*/,
    2383             :     SfxMapUnit          /*ePresUnit*/,
    2384             :     OUString&           rText, const IntlWrapper *
    2385             : )   const
    2386             : {
    2387           0 :     switch ( ePres )
    2388             :     {
    2389             :         case SFX_ITEM_PRESENTATION_NONE:
    2390           0 :             rText = OUString();
    2391           0 :             return ePres;
    2392             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    2393             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    2394           0 :             rText = GetName();
    2395           0 :             return ePres;
    2396             :         default:
    2397           0 :             return SFX_ITEM_PRESENTATION_NONE;
    2398             :     }
    2399             : }
    2400             : 
    2401         884 : bool XFillColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
    2402             : {
    2403         884 :     rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
    2404             : 
    2405         884 :     return true;
    2406             : }
    2407             : 
    2408       13007 : bool XFillColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
    2409             : {
    2410       13007 :     sal_Int32 nValue = 0;
    2411       13007 :     if(!(rVal >>= nValue ))
    2412           0 :         return false;
    2413             : 
    2414       13007 :     SetColorValue( nValue );
    2415       13007 :     return true;
    2416             : }
    2417             : 
    2418             : // class XSecondaryFillColorItem
    2419             : 
    2420        7865 : TYPEINIT1_AUTOFACTORY(XSecondaryFillColorItem, XColorItem);
    2421             : 
    2422        2841 : XSecondaryFillColorItem::XSecondaryFillColorItem(const OUString& rName, const Color& rTheColor) :
    2423        2841 :     XColorItem(XATTR_SECONDARYFILLCOLOR, rName, rTheColor)
    2424             : {
    2425        2841 : }
    2426             : 
    2427           0 : XSecondaryFillColorItem::XSecondaryFillColorItem( SvStream& rIn ) :
    2428           0 :     XColorItem(XATTR_SECONDARYFILLCOLOR, rIn)
    2429             : {
    2430           0 : }
    2431             : 
    2432          12 : SfxPoolItem* XSecondaryFillColorItem::Clone(SfxItemPool* /*pPool*/) const
    2433             : {
    2434          12 :     return new XSecondaryFillColorItem(*this);
    2435             : }
    2436             : 
    2437           0 : SfxPoolItem* XSecondaryFillColorItem::Create( SvStream& rIn, sal_uInt16 nVer ) const
    2438             : {
    2439           0 :     if ( nVer >= 2 )
    2440           0 :         return new XSecondaryFillColorItem( rIn );
    2441             :     else
    2442           0 :         return new XSecondaryFillColorItem( "", Color(0,184,255) );
    2443             : }
    2444             : 
    2445           0 : sal_uInt16 XSecondaryFillColorItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const
    2446             : {
    2447           0 :     return 2;
    2448             : }
    2449             : 
    2450           0 : SfxItemPresentation XSecondaryFillColorItem::GetPresentation
    2451             : (
    2452             :     SfxItemPresentation ePres,
    2453             :     SfxMapUnit          /*eCoreUnit*/,
    2454             :     SfxMapUnit          /*ePresUnit*/,
    2455             :     OUString&           rText, const IntlWrapper *
    2456             : )   const
    2457             : {
    2458           0 :     switch ( ePres )
    2459             :     {
    2460             :         case SFX_ITEM_PRESENTATION_NONE:
    2461           0 :             rText = OUString();
    2462           0 :             return ePres;
    2463             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    2464             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    2465           0 :             rText = GetName();
    2466           0 :             return ePres;
    2467             :         default:
    2468           0 :             return SFX_ITEM_PRESENTATION_NONE;
    2469             :     }
    2470             : }
    2471             : 
    2472             : // class XGradient
    2473             : 
    2474         924 : XGradient::XGradient() :
    2475             :     eStyle( XGRAD_LINEAR ),
    2476             :     aStartColor( Color( COL_BLACK ) ),
    2477             :     aEndColor( Color( COL_WHITE ) ),
    2478             :     nAngle( 0 ),
    2479             :     nBorder( 0 ),
    2480             :     nOfsX( 50 ),
    2481             :     nOfsY( 50 ),
    2482             :     nIntensStart( 100 ),
    2483             :     nIntensEnd( 100 ),
    2484         924 :     nStepCount( 0 )
    2485             : {
    2486         924 : }
    2487             : 
    2488        3235 : XGradient::XGradient(const Color& rStart, const Color& rEnd,
    2489             :                      XGradientStyle eTheStyle, long nTheAngle, sal_uInt16 nXOfs,
    2490             :                      sal_uInt16 nYOfs, sal_uInt16 nTheBorder,
    2491             :                      sal_uInt16 nStartIntens, sal_uInt16 nEndIntens,
    2492             :                      sal_uInt16 nSteps) :
    2493             :     eStyle(eTheStyle),
    2494             :     aStartColor(rStart),
    2495             :     aEndColor(rEnd),
    2496             :     nAngle(nTheAngle),
    2497             :     nBorder(nTheBorder),
    2498             :     nOfsX(nXOfs),
    2499             :     nOfsY(nYOfs),
    2500             :     nIntensStart(nStartIntens),
    2501             :     nIntensEnd(nEndIntens),
    2502        3235 :     nStepCount(nSteps)
    2503             : {
    2504        3235 : }
    2505             : 
    2506        3543 : bool XGradient::operator==(const XGradient& rGradient) const
    2507             : {
    2508        6609 :     return ( eStyle         == rGradient.eStyle         &&
    2509        5997 :              aStartColor    == rGradient.aStartColor    &&
    2510        5860 :              aEndColor      == rGradient.aEndColor      &&
    2511        5773 :              nAngle         == rGradient.nAngle         &&
    2512        5688 :              nBorder        == rGradient.nBorder        &&
    2513        5688 :              nOfsX          == rGradient.nOfsX          &&
    2514        5688 :              nOfsY          == rGradient.nOfsY          &&
    2515        5688 :              nIntensStart   == rGradient.nIntensStart   &&
    2516        9231 :              nIntensEnd     == rGradient.nIntensEnd     &&
    2517        6387 :              nStepCount     == rGradient.nStepCount );
    2518             : }
    2519             : 
    2520           0 : Gradient XGradient::VclGradient() const
    2521             : {
    2522           0 :     Gradient aGradient;
    2523           0 :     aGradient.SetStyle((GradientStyle)eStyle);
    2524           0 :     aGradient.SetStartColor(aStartColor);
    2525           0 :     aGradient.SetEndColor(aEndColor);
    2526           0 :     aGradient.SetAngle(nAngle);
    2527           0 :     aGradient.SetBorder(nBorder);
    2528           0 :     aGradient.SetOfsX(nOfsX);
    2529           0 :     aGradient.SetOfsY(nOfsY);
    2530           0 :     aGradient.SetStartIntensity(nIntensStart);
    2531           0 :     aGradient.SetEndIntensity(nIntensEnd);
    2532           0 :     aGradient.SetSteps(nStepCount);
    2533           0 :     return aGradient;
    2534             : }
    2535             : 
    2536             : // class XFillGradientItem
    2537             : 
    2538       16765 : TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex);
    2539             : 
    2540        2841 : XFillGradientItem::XFillGradientItem(sal_Int32 nIndex,
    2541             :                                    const XGradient& rTheGradient) :
    2542             :     NameOrIndex(XATTR_FILLGRADIENT, nIndex),
    2543        2841 :     aGradient(rTheGradient)
    2544             : {
    2545        2841 : }
    2546             : 
    2547          94 : XFillGradientItem::XFillGradientItem(const OUString& rName,
    2548             :                                    const XGradient& rTheGradient, sal_uInt16 nWhich)
    2549             :     : NameOrIndex(nWhich, rName)
    2550          94 :     , aGradient(rTheGradient)
    2551             : {
    2552          94 : }
    2553             : 
    2554        1314 : XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem) :
    2555             :     NameOrIndex(rItem),
    2556        1314 :     aGradient(rItem.aGradient)
    2557             : {
    2558        1314 : }
    2559             : 
    2560           0 : XFillGradientItem::XFillGradientItem(SvStream& rIn, sal_uInt16 nVer) :
    2561             :     NameOrIndex(XATTR_FILLGRADIENT, rIn),
    2562           0 :     aGradient(COL_BLACK, COL_WHITE)
    2563             : {
    2564           0 :     if (!IsIndex())
    2565             :     {
    2566             :         sal_uInt16 nUSTemp;
    2567             :         sal_uInt16 nRed;
    2568             :         sal_uInt16 nGreen;
    2569             :         sal_uInt16 nBlue;
    2570             :         sal_Int16  nITemp;
    2571             :         sal_Int32  nLTemp;
    2572             : 
    2573           0 :         rIn.ReadInt16( nITemp ); aGradient.SetGradientStyle((XGradientStyle)nITemp);
    2574           0 :         rIn.ReadUInt16( nRed );
    2575           0 :         rIn.ReadUInt16( nGreen );
    2576           0 :         rIn.ReadUInt16( nBlue );
    2577           0 :         Color aCol;
    2578           0 :         aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
    2579           0 :         aGradient.SetStartColor( aCol );
    2580             : 
    2581           0 :         rIn.ReadUInt16( nRed );
    2582           0 :         rIn.ReadUInt16( nGreen );
    2583           0 :         rIn.ReadUInt16( nBlue );
    2584           0 :         aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
    2585           0 :         aGradient.SetEndColor(aCol);
    2586           0 :         rIn.ReadInt32( nLTemp ); aGradient.SetAngle(nLTemp);
    2587           0 :         rIn.ReadUInt16( nUSTemp ); aGradient.SetBorder(nUSTemp);
    2588           0 :         rIn.ReadUInt16( nUSTemp ); aGradient.SetXOffset(nUSTemp);
    2589           0 :         rIn.ReadUInt16( nUSTemp ); aGradient.SetYOffset(nUSTemp);
    2590           0 :         rIn.ReadUInt16( nUSTemp ); aGradient.SetStartIntens(nUSTemp);
    2591           0 :         rIn.ReadUInt16( nUSTemp ); aGradient.SetEndIntens(nUSTemp);
    2592             : 
    2593             :         // for newer versions consider the step width as well
    2594           0 :         if (nVer >= 1)
    2595             :         {
    2596           0 :             rIn.ReadUInt16( nUSTemp ); aGradient.SetSteps(nUSTemp);
    2597             :         }
    2598             :     }
    2599           0 : }
    2600             : 
    2601        3014 : XFillGradientItem::XFillGradientItem( const XGradient& rTheGradient )
    2602             : :   NameOrIndex( XATTR_FILLGRADIENT, -1 ),
    2603        3014 :     aGradient(rTheGradient)
    2604             : {
    2605        3014 : }
    2606             : 
    2607         593 : SfxPoolItem* XFillGradientItem::Clone(SfxItemPool* /*pPool*/) const
    2608             : {
    2609         593 :     return new XFillGradientItem(*this);
    2610             : }
    2611             : 
    2612         619 : bool XFillGradientItem::operator==(const SfxPoolItem& rItem) const
    2613             : {
    2614         923 :     return ( NameOrIndex::operator==(rItem) &&
    2615         923 :              aGradient == ((const XFillGradientItem&) rItem).aGradient );
    2616             : }
    2617             : 
    2618           0 : SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, sal_uInt16 nVer) const
    2619             : {
    2620           0 :     return new XFillGradientItem(rIn, nVer);
    2621             : }
    2622             : 
    2623           0 : SvStream& XFillGradientItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
    2624             : {
    2625           0 :     NameOrIndex::Store( rOut, nItemVersion );
    2626             : 
    2627           0 :     if (!IsIndex())
    2628             :     {
    2629           0 :         rOut.WriteInt16( (sal_Int16)aGradient.GetGradientStyle() );
    2630             : 
    2631             :         sal_uInt16 nTmp;
    2632             : 
    2633           0 :         nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetRed() ); rOut.WriteUInt16( nTmp );
    2634           0 :         nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetGreen() ); rOut.WriteUInt16( nTmp );
    2635           0 :         nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetBlue() ); rOut.WriteUInt16( nTmp );
    2636           0 :         nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetRed() ); rOut.WriteUInt16( nTmp );
    2637           0 :         nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetGreen() ); rOut.WriteUInt16( nTmp );
    2638           0 :         nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetBlue() ); rOut.WriteUInt16( nTmp );
    2639             : 
    2640           0 :         rOut.WriteInt32( (sal_Int32) aGradient.GetAngle() );
    2641           0 :         rOut.WriteUInt16( aGradient.GetBorder() );
    2642           0 :         rOut.WriteUInt16( aGradient.GetXOffset() );
    2643           0 :         rOut.WriteUInt16( aGradient.GetYOffset() );
    2644           0 :         rOut.WriteUInt16( aGradient.GetStartIntens() );
    2645           0 :         rOut.WriteUInt16( aGradient.GetEndIntens() );
    2646           0 :         rOut.WriteUInt16( aGradient.GetSteps() );
    2647             :     }
    2648             : 
    2649           0 :     return rOut;
    2650             : }
    2651             : 
    2652       12071 : const XGradient& XFillGradientItem::GetGradientValue() const // GetValue -> GetGradientValue
    2653             : {
    2654       12071 :     if (!IsIndex())
    2655       12071 :         return aGradient;
    2656             :     // ToDo: This should fail. We never called this code with a table so this should always
    2657             :     // have failed. Thus, I'm thinking that XFillGradientItem can't be an Index.
    2658           0 :     return aGradient;
    2659             : }
    2660             : 
    2661           0 : sal_uInt16 XFillGradientItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const
    2662             : {
    2663             :     // !!! this version number also represents the version number of superclasses
    2664             :     // !!! (e.g. XFillFloatTransparenceItem); if you make any changes here,
    2665             :     // !!! the superclass is also affected
    2666           0 :     return 1;
    2667             : }
    2668             : 
    2669           0 : SfxItemPresentation XFillGradientItem::GetPresentation
    2670             : (
    2671             :     SfxItemPresentation ePres,
    2672             :     SfxMapUnit          /*eCoreUnit*/,
    2673             :     SfxMapUnit          /*ePresUnit*/,
    2674             :     OUString&           rText, const IntlWrapper *
    2675             : )   const
    2676             : {
    2677           0 :     switch ( ePres )
    2678             :     {
    2679             :         case SFX_ITEM_PRESENTATION_NONE:
    2680           0 :             rText = OUString();
    2681           0 :             return ePres;
    2682             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    2683             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    2684           0 :             rText = GetName();
    2685           0 :             return ePres;
    2686             :         default:
    2687           0 :             return SFX_ITEM_PRESENTATION_NONE;
    2688             :     }
    2689             : }
    2690             : 
    2691        1121 : bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
    2692             : {
    2693        1121 :     nMemberId &= ~CONVERT_TWIPS;
    2694        1121 :     switch ( nMemberId )
    2695             :     {
    2696             :         case 0:
    2697             :         {
    2698          66 :             uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
    2699             : 
    2700          66 :             ::com::sun::star::awt::Gradient aGradient2;
    2701             : 
    2702          66 :             const XGradient& aXGradient = GetGradientValue();
    2703          66 :             aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
    2704          66 :             aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
    2705          66 :             aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
    2706          66 :             aGradient2.Angle = (short)aXGradient.GetAngle();
    2707          66 :             aGradient2.Border = aXGradient.GetBorder();
    2708          66 :             aGradient2.XOffset = aXGradient.GetXOffset();
    2709          66 :             aGradient2.YOffset = aXGradient.GetYOffset();
    2710          66 :             aGradient2.StartIntensity = aXGradient.GetStartIntens();
    2711          66 :             aGradient2.EndIntensity = aXGradient.GetEndIntens();
    2712          66 :             aGradient2.StepCount = aXGradient.GetSteps();
    2713             : 
    2714         132 :             OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
    2715          66 :             aPropSeq[0].Name    = "Name";
    2716          66 :             aPropSeq[0].Value   = uno::makeAny( aApiName );
    2717          66 :             aPropSeq[1].Name    = "FillGradient";
    2718          66 :             aPropSeq[1].Value   = uno::makeAny( aGradient2 );
    2719          66 :             rVal = uno::makeAny( aPropSeq );
    2720         132 :             break;
    2721             :         }
    2722             : 
    2723             :         case MID_FILLGRADIENT:
    2724             :         {
    2725         551 :             const XGradient& aXGradient = GetGradientValue();
    2726         551 :             ::com::sun::star::awt::Gradient aGradient2;
    2727             : 
    2728         551 :             aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
    2729         551 :             aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
    2730         551 :             aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
    2731         551 :             aGradient2.Angle = (short)aXGradient.GetAngle();
    2732         551 :             aGradient2.Border = aXGradient.GetBorder();
    2733         551 :             aGradient2.XOffset = aXGradient.GetXOffset();
    2734         551 :             aGradient2.YOffset = aXGradient.GetYOffset();
    2735         551 :             aGradient2.StartIntensity = aXGradient.GetStartIntens();
    2736         551 :             aGradient2.EndIntensity = aXGradient.GetEndIntens();
    2737         551 :             aGradient2.StepCount = aXGradient.GetSteps();
    2738             : 
    2739         551 :             rVal <<= aGradient2;
    2740         551 :             break;
    2741             :         }
    2742             : 
    2743             :         case MID_NAME:
    2744             :         {
    2745         504 :             OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
    2746         504 :             rVal <<= aApiName;
    2747         504 :             break;
    2748             :         }
    2749             : 
    2750           0 :         case MID_GRADIENT_STYLE: rVal <<= (sal_Int16)GetGradientValue().GetGradientStyle(); break;
    2751           0 :         case MID_GRADIENT_STARTCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetStartColor().GetColor(); break;
    2752           0 :         case MID_GRADIENT_ENDCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetEndColor().GetColor(); break;
    2753           0 :         case MID_GRADIENT_ANGLE: rVal <<= (sal_Int16)GetGradientValue().GetAngle(); break;
    2754           0 :         case MID_GRADIENT_BORDER: rVal <<= GetGradientValue().GetBorder(); break;
    2755           0 :         case MID_GRADIENT_XOFFSET: rVal <<= GetGradientValue().GetXOffset(); break;
    2756           0 :         case MID_GRADIENT_YOFFSET: rVal <<= GetGradientValue().GetYOffset(); break;
    2757           0 :         case MID_GRADIENT_STARTINTENSITY: rVal <<= GetGradientValue().GetStartIntens(); break;
    2758           0 :         case MID_GRADIENT_ENDINTENSITY: rVal <<= GetGradientValue().GetEndIntens(); break;
    2759           0 :         case MID_GRADIENT_STEPCOUNT: rVal <<= GetGradientValue().GetSteps(); break;
    2760             : 
    2761           0 :         default: OSL_FAIL("Wrong MemberId!"); return false;
    2762             :     }
    2763             : 
    2764        1121 :     return true;
    2765             : }
    2766             : 
    2767         242 : bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
    2768             : {
    2769         242 :     nMemberId &= ~CONVERT_TWIPS;
    2770             : 
    2771         242 :     switch ( nMemberId )
    2772             :     {
    2773             :         case 0:
    2774             :         {
    2775          66 :             uno::Sequence< beans::PropertyValue >   aPropSeq;
    2776          66 :             ::com::sun::star::awt::Gradient         aGradient2;
    2777         132 :             OUString                           aName;
    2778          66 :             bool                                    bGradient( false );
    2779             : 
    2780          66 :             if ( rVal >>= aPropSeq )
    2781             :             {
    2782         198 :                 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
    2783             :                 {
    2784         132 :                     if ( aPropSeq[n].Name == "Name" )
    2785          66 :                         aPropSeq[n].Value >>= aName;
    2786          66 :                     else if ( aPropSeq[n].Name == "FillGradient" )
    2787             :                     {
    2788          66 :                         if ( aPropSeq[n].Value >>= aGradient2 )
    2789          66 :                             bGradient = true;
    2790             :                     }
    2791             :                 }
    2792             : 
    2793          66 :                 SetName( aName );
    2794          66 :                 if ( bGradient )
    2795             :                 {
    2796          66 :                     XGradient aXGradient;
    2797             : 
    2798          66 :                     aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
    2799          66 :                     aXGradient.SetStartColor( aGradient2.StartColor );
    2800          66 :                     aXGradient.SetEndColor( aGradient2.EndColor );
    2801          66 :                     aXGradient.SetAngle( aGradient2.Angle );
    2802          66 :                     aXGradient.SetBorder( aGradient2.Border );
    2803          66 :                     aXGradient.SetXOffset( aGradient2.XOffset );
    2804          66 :                     aXGradient.SetYOffset( aGradient2.YOffset );
    2805          66 :                     aXGradient.SetStartIntens( aGradient2.StartIntensity );
    2806          66 :                     aXGradient.SetEndIntens( aGradient2.EndIntensity );
    2807          66 :                     aXGradient.SetSteps( aGradient2.StepCount );
    2808             : 
    2809          66 :                     SetGradientValue( aXGradient );
    2810             :                 }
    2811             : 
    2812          66 :                 return true;
    2813             :             }
    2814             : 
    2815          66 :             return false;
    2816             :         }
    2817             : 
    2818             :         case MID_NAME:
    2819             :         {
    2820           0 :             OUString aName;
    2821           0 :             if (!(rVal >>= aName ))
    2822           0 :                 return false;
    2823           0 :             SetName( aName );
    2824           0 :             break;
    2825             :         }
    2826             : 
    2827             :         case MID_FILLGRADIENT:
    2828             :         {
    2829         176 :             ::com::sun::star::awt::Gradient aGradient2;
    2830         176 :             if(!(rVal >>= aGradient2))
    2831           0 :                 return false;
    2832             : 
    2833         176 :             XGradient aXGradient;
    2834             : 
    2835         176 :             aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
    2836         176 :             aXGradient.SetStartColor( aGradient2.StartColor );
    2837         176 :             aXGradient.SetEndColor( aGradient2.EndColor );
    2838         176 :             aXGradient.SetAngle( aGradient2.Angle );
    2839         176 :             aXGradient.SetBorder( aGradient2.Border );
    2840         176 :             aXGradient.SetXOffset( aGradient2.XOffset );
    2841         176 :             aXGradient.SetYOffset( aGradient2.YOffset );
    2842         176 :             aXGradient.SetStartIntens( aGradient2.StartIntensity );
    2843         176 :             aXGradient.SetEndIntens( aGradient2.EndIntensity );
    2844         176 :             aXGradient.SetSteps( aGradient2.StepCount );
    2845             : 
    2846         176 :             SetGradientValue( aXGradient );
    2847         176 :             break;
    2848             :         }
    2849             : 
    2850             :         case MID_GRADIENT_STARTCOLOR:
    2851             :         case MID_GRADIENT_ENDCOLOR:
    2852             :         {
    2853           0 :             sal_Int32 nVal = 0;
    2854           0 :             if(!(rVal >>= nVal ))
    2855           0 :                 return false;
    2856             : 
    2857           0 :             XGradient aXGradient = GetGradientValue();
    2858             : 
    2859           0 :             if ( nMemberId == MID_GRADIENT_STARTCOLOR )
    2860           0 :                 aXGradient.SetStartColor( nVal );
    2861             :             else
    2862           0 :                 aXGradient.SetEndColor( nVal );
    2863           0 :             SetGradientValue( aXGradient );
    2864           0 :             break;
    2865             :         }
    2866             : 
    2867             :         case MID_GRADIENT_STYLE:
    2868             :         case MID_GRADIENT_ANGLE:
    2869             :         case MID_GRADIENT_BORDER:
    2870             :         case MID_GRADIENT_STARTINTENSITY:
    2871             :         case MID_GRADIENT_ENDINTENSITY:
    2872             :         case MID_GRADIENT_STEPCOUNT:
    2873             :         case MID_GRADIENT_XOFFSET:
    2874             :         case MID_GRADIENT_YOFFSET:
    2875             :         {
    2876           0 :             sal_Int16 nVal = sal_Int16();
    2877           0 :             if(!(rVal >>= nVal ))
    2878           0 :                 return false;
    2879             : 
    2880           0 :             XGradient aXGradient = GetGradientValue();
    2881             : 
    2882           0 :             switch ( nMemberId )
    2883             :             {
    2884             :                 case MID_GRADIENT_STYLE:
    2885           0 :                     aXGradient.SetGradientStyle( (XGradientStyle)nVal ); break;
    2886             :                 case MID_GRADIENT_ANGLE:
    2887           0 :                     aXGradient.SetAngle( nVal ); break;
    2888             :                 case MID_GRADIENT_BORDER:
    2889           0 :                     aXGradient.SetBorder( nVal ); break;
    2890             :                 case MID_GRADIENT_STARTINTENSITY:
    2891           0 :                     aXGradient.SetStartIntens( nVal ); break;
    2892             :                 case MID_GRADIENT_ENDINTENSITY:
    2893           0 :                     aXGradient.SetEndIntens( nVal ); break;
    2894             :                 case MID_GRADIENT_STEPCOUNT:
    2895           0 :                     aXGradient.SetSteps( nVal ); break;
    2896             :                 case MID_GRADIENT_XOFFSET:
    2897           0 :                     aXGradient.SetXOffset( nVal ); break;
    2898             :                 case MID_GRADIENT_YOFFSET:
    2899           0 :                     aXGradient.SetYOffset( nVal ); break;
    2900             :             }
    2901             : 
    2902           0 :             SetGradientValue( aXGradient );
    2903           0 :             break;
    2904             :         }
    2905             :     }
    2906             : 
    2907         176 :     return true;
    2908             : }
    2909             : 
    2910         625 : bool XFillGradientItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
    2911             : {
    2912         625 :     return ((XFillGradientItem*)p1)->GetGradientValue() == ((XFillGradientItem*)p2)->GetGradientValue();
    2913             : }
    2914             : 
    2915         659 : XFillGradientItem* XFillGradientItem::checkForUniqueItem( SdrModel* pModel ) const
    2916             : {
    2917         659 :     if( pModel )
    2918             :     {
    2919             :         const OUString aUniqueName = NameOrIndex::CheckNamedItem(
    2920         624 :                 this, Which(), &pModel->GetItemPool(),
    2921         697 :                 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
    2922             :                 XFillGradientItem::CompareValueFunc, RID_SVXSTR_GRADIENT,
    2923        1945 :                 pModel->GetPropertyList( XGRADIENT_LIST ) );
    2924             : 
    2925             :         // if the given name is not valid, replace it!
    2926         624 :         if( aUniqueName != GetName() )
    2927          79 :             return new XFillGradientItem( aUniqueName, aGradient, Which() );
    2928             :     }
    2929             : 
    2930         580 :     return (XFillGradientItem*)this;
    2931             : }
    2932             : 
    2933             : // class XFillFloatTransparenceItem -
    2934             : 
    2935       17429 : TYPEINIT1_AUTOFACTORY( XFillFloatTransparenceItem, XFillGradientItem );
    2936             : 
    2937         545 : XFillFloatTransparenceItem::XFillFloatTransparenceItem() :
    2938         545 :     bEnabled( false )
    2939             : {
    2940         545 :     SetWhich( XATTR_FILLFLOATTRANSPARENCE );
    2941         545 : }
    2942             : 
    2943           0 : XFillFloatTransparenceItem::XFillFloatTransparenceItem(const OUString& rName, const XGradient& rGradient, bool bEnable ) :
    2944             :     XFillGradientItem   ( rName, rGradient ),
    2945           0 :     bEnabled            ( bEnable )
    2946             : {
    2947           0 :     SetWhich( XATTR_FILLFLOATTRANSPARENCE );
    2948           0 : }
    2949             : 
    2950         721 : XFillFloatTransparenceItem::XFillFloatTransparenceItem( const XFillFloatTransparenceItem& rItem ) :
    2951             :     XFillGradientItem   ( rItem ),
    2952         721 :     bEnabled            ( rItem.bEnabled )
    2953             : {
    2954         721 :     SetWhich( XATTR_FILLFLOATTRANSPARENCE );
    2955         721 : }
    2956             : 
    2957        2841 : XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient, bool bEnable )
    2958             : :   XFillGradientItem   ( -1, rTheGradient ),
    2959        2841 :     bEnabled            ( bEnable )
    2960             : {
    2961        2841 :     SetWhich( XATTR_FILLFLOATTRANSPARENCE );
    2962        2841 : }
    2963             : 
    2964        1468 : bool XFillFloatTransparenceItem::operator==( const SfxPoolItem& rItem ) const
    2965             : {
    2966        1810 :     return ( NameOrIndex::operator==(rItem) ) &&
    2967        1810 :             ( GetGradientValue() == ((const XFillGradientItem&)rItem).GetGradientValue() ) &&
    2968        1810 :              ( bEnabled == ( (XFillFloatTransparenceItem&) rItem ).bEnabled );
    2969             : }
    2970             : 
    2971         721 : SfxPoolItem* XFillFloatTransparenceItem::Clone( SfxItemPool* /*pPool*/) const
    2972             : {
    2973         721 :     return new XFillFloatTransparenceItem( *this );
    2974             : }
    2975             : 
    2976           0 : sal_uInt16 XFillFloatTransparenceItem::GetVersion( sal_uInt16 nFileFormatVersion ) const
    2977             : {
    2978             :     // !!! if version number of this object must be increased, please   !!!
    2979             :     // !!! increase version number of base class XFillGradientItem      !!!
    2980           0 :     return XFillGradientItem::GetVersion( nFileFormatVersion );
    2981             : }
    2982             : 
    2983         500 : bool XFillFloatTransparenceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
    2984             : {
    2985         500 :     return XFillGradientItem::QueryValue( rVal, nMemberId );
    2986             : }
    2987             : 
    2988          28 : bool XFillFloatTransparenceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
    2989             : {
    2990          28 :     return XFillGradientItem::PutValue( rVal, nMemberId );
    2991             : }
    2992             : 
    2993           0 : SfxItemPresentation XFillFloatTransparenceItem::GetPresentation(    SfxItemPresentation ePres,
    2994             :                                                                     SfxMapUnit eCoreUnit, SfxMapUnit ePresUnit,
    2995             :                                                                     OUString& rText,
    2996             :                                                                     const IntlWrapper * pIntlWrapper ) const
    2997             : {
    2998           0 :     return XFillGradientItem::GetPresentation( ePres, eCoreUnit, ePresUnit, rText, pIntlWrapper );
    2999             : }
    3000             : 
    3001        1798 : bool XFillFloatTransparenceItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
    3002             : {
    3003        3596 :     return  ((XFillFloatTransparenceItem*)p1)->IsEnabled() == ((XFillFloatTransparenceItem*)p2)->IsEnabled() &&
    3004        3596 :             ((XFillFloatTransparenceItem*)p1)->GetGradientValue()  == ((XFillFloatTransparenceItem*)p2)->GetGradientValue();
    3005             : }
    3006             : 
    3007        2321 : XFillFloatTransparenceItem* XFillFloatTransparenceItem::checkForUniqueItem( SdrModel* pModel ) const
    3008             : {
    3009             :     // #85953# unique name only necessary when enabled
    3010        2321 :     if(IsEnabled())
    3011             :     {
    3012        1804 :         if( pModel )
    3013             :         {
    3014             :             const OUString aUniqueName = NameOrIndex::CheckNamedItem( this,
    3015             :                                                                     XATTR_FILLFLOATTRANSPARENCE,
    3016        1798 :                                                                     &pModel->GetItemPool(),
    3017        1801 :                                                                     pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
    3018             :                                                                     XFillFloatTransparenceItem::CompareValueFunc,
    3019             :                                                                     RID_SVXSTR_TRASNGR0,
    3020        5397 :                                                                     XPropertyListRef() );
    3021             : 
    3022             :             // if the given name is not valid, replace it!
    3023        1798 :             if( aUniqueName != GetName() )
    3024             :             {
    3025           0 :                 return new XFillFloatTransparenceItem( aUniqueName, GetGradientValue(), true );
    3026        1798 :             }
    3027             :         }
    3028             :     }
    3029             :     else
    3030             :     {
    3031             :         // #85953# if disabled, force name to empty string
    3032         517 :         if( !GetName().isEmpty() )
    3033             :         {
    3034           0 :             return new XFillFloatTransparenceItem(OUString(), GetGradientValue(), false);
    3035             :         }
    3036             :     }
    3037             : 
    3038        2321 :     return (XFillFloatTransparenceItem*)this;
    3039             : }
    3040             : 
    3041             : // class XHatch
    3042             : 
    3043        3148 : XHatch::XHatch(const Color& rCol, XHatchStyle eTheStyle, long nTheDistance,
    3044             :                long nTheAngle) :
    3045             :     eStyle(eTheStyle),
    3046             :     aColor(rCol),
    3047             :     nDistance(nTheDistance),
    3048        3148 :     nAngle(nTheAngle)
    3049             : {
    3050        3148 : }
    3051             : 
    3052        3990 : bool XHatch::operator==(const XHatch& rHatch) const
    3053             : {
    3054        6842 :     return ( eStyle     == rHatch.eStyle    &&
    3055        5518 :              aColor     == rHatch.aColor    &&
    3056        8853 :              nDistance  == rHatch.nDistance &&
    3057        6187 :              nAngle     == rHatch.nAngle );
    3058             : }
    3059             : 
    3060             : // class XFillHatchItem
    3061             : 
    3062       14229 : TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex);
    3063             : 
    3064         149 : XFillHatchItem::XFillHatchItem(const OUString& rName,
    3065             :                              const XHatch& rTheHatch) :
    3066             :     NameOrIndex(XATTR_FILLHATCH, rName),
    3067         149 :     aHatch(rTheHatch)
    3068             : {
    3069         149 : }
    3070             : 
    3071         738 : XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem) :
    3072             :     NameOrIndex(rItem),
    3073         738 :     aHatch(rItem.aHatch)
    3074             : {
    3075         738 : }
    3076             : 
    3077           0 : XFillHatchItem::XFillHatchItem(SvStream& rIn) :
    3078             :     NameOrIndex(XATTR_FILLHATCH, rIn),
    3079           0 :     aHatch(COL_BLACK)
    3080             : {
    3081           0 :     if (!IsIndex())
    3082             :     {
    3083             :         sal_uInt16 nRed;
    3084             :         sal_uInt16 nGreen;
    3085             :         sal_uInt16 nBlue;
    3086             :         sal_Int16  nITemp;
    3087             :         sal_Int32  nLTemp;
    3088             : 
    3089           0 :         rIn.ReadInt16( nITemp ); aHatch.SetHatchStyle((XHatchStyle)nITemp);
    3090           0 :         rIn.ReadUInt16( nRed );
    3091           0 :         rIn.ReadUInt16( nGreen );
    3092           0 :         rIn.ReadUInt16( nBlue );
    3093             : 
    3094           0 :         Color aCol;
    3095           0 :         aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
    3096           0 :         aHatch.SetColor(aCol);
    3097           0 :         rIn.ReadInt32( nLTemp ); aHatch.SetDistance(nLTemp);
    3098           0 :         rIn.ReadInt32( nLTemp ); aHatch.SetAngle(nLTemp);
    3099             :     }
    3100           0 : }
    3101             : 
    3102        2975 : XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/, const XHatch& rTheHatch)
    3103             : :   NameOrIndex( XATTR_FILLHATCH, -1 ),
    3104        2975 :     aHatch(rTheHatch)
    3105             : {
    3106        2975 : }
    3107             : 
    3108         738 : SfxPoolItem* XFillHatchItem::Clone(SfxItemPool* /*pPool*/) const
    3109             : {
    3110         738 :     return new XFillHatchItem(*this);
    3111             : }
    3112             : 
    3113        3827 : bool XFillHatchItem::operator==(const SfxPoolItem& rItem) const
    3114             : {
    3115        4605 :     return ( NameOrIndex::operator==(rItem) &&
    3116        4605 :              aHatch == ((const XFillHatchItem&) rItem).aHatch );
    3117             : }
    3118             : 
    3119           0 : SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3120             : {
    3121           0 :     return new XFillHatchItem(rIn);
    3122             : }
    3123             : 
    3124           0 : SvStream& XFillHatchItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
    3125             : {
    3126           0 :     NameOrIndex::Store( rOut, nItemVersion );
    3127             : 
    3128           0 :     if (!IsIndex())
    3129             :     {
    3130           0 :         rOut.WriteInt16( (sal_Int16)aHatch.GetHatchStyle() );
    3131             : 
    3132             :         sal_uInt16 nTmp;
    3133           0 :         nTmp = VCLTOSVCOL( aHatch.GetColor().GetRed() ); rOut.WriteUInt16( nTmp );
    3134           0 :         nTmp = VCLTOSVCOL( aHatch.GetColor().GetGreen() ); rOut.WriteUInt16( nTmp );
    3135           0 :         nTmp = VCLTOSVCOL( aHatch.GetColor().GetBlue() ); rOut.WriteUInt16( nTmp );
    3136             : 
    3137           0 :         rOut.WriteInt32( (sal_Int32) aHatch.GetDistance() );
    3138           0 :         rOut.WriteInt32( (sal_Int32) aHatch.GetAngle() );
    3139             :     }
    3140             : 
    3141           0 :     return rOut;
    3142             : }
    3143             : 
    3144        7558 : const XHatch& XFillHatchItem::GetHatchValue() const // GetValue -> GetHatchValue
    3145             : {
    3146        7558 :     return aHatch;
    3147             : }
    3148             : 
    3149           0 : SfxItemPresentation XFillHatchItem::GetPresentation
    3150             : (
    3151             :     SfxItemPresentation ePres,
    3152             :     SfxMapUnit          /*eCoreUnit*/,
    3153             :     SfxMapUnit          /*ePresUnit*/,
    3154             :     OUString&           rText, const IntlWrapper *
    3155             : )   const
    3156             : {
    3157           0 :     switch ( ePres )
    3158             :     {
    3159             :         case SFX_ITEM_PRESENTATION_NONE:
    3160           0 :             rText = OUString();
    3161           0 :             return ePres;
    3162             :         case SFX_ITEM_PRESENTATION_NAMELESS:
    3163             :         case SFX_ITEM_PRESENTATION_COMPLETE:
    3164           0 :             rText = GetName();
    3165           0 :             return ePres;
    3166             :         default:
    3167           0 :             return SFX_ITEM_PRESENTATION_NONE;
    3168             :     }
    3169             : }
    3170             : 
    3171           0 : bool XFillHatchItem::HasMetrics() const
    3172             : {
    3173           0 :     return true;
    3174             : }
    3175             : 
    3176           0 : bool XFillHatchItem::ScaleMetrics(long nMul, long nDiv)
    3177             : {
    3178           0 :     aHatch.SetDistance( ScaleMetricValue( aHatch.GetDistance(), nMul, nDiv ) );
    3179           0 :     return true;
    3180             : }
    3181             : 
    3182         621 : bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
    3183             : {
    3184         621 :     nMemberId &= ~CONVERT_TWIPS;
    3185             : 
    3186         621 :     switch ( nMemberId )
    3187             :     {
    3188             :         case 0:
    3189             :         {
    3190          66 :             uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
    3191             : 
    3192          66 :             ::com::sun::star::drawing::Hatch aUnoHatch;
    3193             : 
    3194          66 :             aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
    3195          66 :             aUnoHatch.Color = aHatch.GetColor().GetColor();
    3196          66 :             aUnoHatch.Distance = aHatch.GetDistance();
    3197          66 :             aUnoHatch.Angle = aHatch.GetAngle();
    3198             : 
    3199         132 :             OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
    3200          66 :             aPropSeq[0].Name    = "Name";
    3201          66 :             aPropSeq[0].Value   = uno::makeAny( aApiName );
    3202          66 :             aPropSeq[1].Name    = "FillHatch";
    3203          66 :             aPropSeq[1].Value   = uno::makeAny( aUnoHatch );
    3204          66 :             rVal = uno::makeAny( aPropSeq );
    3205         132 :             break;
    3206             :         }
    3207             : 
    3208             :         case MID_FILLHATCH:
    3209             :         {
    3210         305 :             ::com::sun::star::drawing::Hatch aUnoHatch;
    3211             : 
    3212         305 :             aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
    3213         305 :             aUnoHatch.Color = aHatch.GetColor().GetColor();
    3214         305 :             aUnoHatch.Distance = aHatch.GetDistance();
    3215         305 :             aUnoHatch.Angle = aHatch.GetAngle();
    3216         305 :             rVal <<= aUnoHatch;
    3217         305 :             break;
    3218             :         }
    3219             : 
    3220             :         case MID_NAME:
    3221             :         {
    3222         250 :             OUString aApiName = SvxUnogetApiNameForItem(Which(), GetName());
    3223         250 :             rVal <<= aApiName;
    3224         250 :             break;
    3225             :         }
    3226             : 
    3227             :         case MID_HATCH_STYLE:
    3228           0 :             rVal <<= (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); break;
    3229             :         case MID_HATCH_COLOR:
    3230           0 :             rVal <<= (sal_Int32)aHatch.GetColor().GetColor(); break;
    3231             :         case MID_HATCH_DISTANCE:
    3232           0 :             rVal <<= aHatch.GetDistance(); break;
    3233             :         case MID_HATCH_ANGLE:
    3234           0 :             rVal <<= aHatch.GetAngle(); break;
    3235             : 
    3236           0 :         default: OSL_FAIL("Wrong MemberId!"); return false;
    3237             :     }
    3238             : 
    3239         621 :     return true;
    3240             : }
    3241             : 
    3242         183 : bool XFillHatchItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
    3243             : {
    3244         183 :     nMemberId &= ~CONVERT_TWIPS;
    3245             : 
    3246         183 :     switch ( nMemberId )
    3247             :     {
    3248             :         case 0:
    3249             :         {
    3250          66 :             uno::Sequence< beans::PropertyValue >   aPropSeq;
    3251          66 :             ::com::sun::star::drawing::Hatch        aUnoHatch;
    3252         132 :             OUString                           aName;
    3253          66 :             bool                                    bHatch( false );
    3254             : 
    3255          66 :             if ( rVal >>= aPropSeq )
    3256             :             {
    3257         198 :                 for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
    3258             :                 {
    3259         132 :                     if ( aPropSeq[n].Name == "Name" )
    3260          66 :                         aPropSeq[n].Value >>= aName;
    3261          66 :                     else if ( aPropSeq[n].Name == "FillHatch" )
    3262             :                     {
    3263          66 :                         if ( aPropSeq[n].Value >>= aUnoHatch )
    3264          66 :                             bHatch = true;
    3265             :                     }
    3266             :                 }
    3267             : 
    3268          66 :                 SetName( aName );
    3269          66 :                 if ( bHatch )
    3270             :                 {
    3271          66 :                     aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
    3272          66 :                     aHatch.SetColor( aUnoHatch.Color );
    3273          66 :                     aHatch.SetDistance( aUnoHatch.Distance );
    3274          66 :                     aHatch.SetAngle( aUnoHatch.Angle );
    3275             :                 }
    3276             : 
    3277          66 :                 return true;
    3278             :             }
    3279             : 
    3280          66 :             return false;
    3281             :         }
    3282             : 
    3283             :         case MID_FILLHATCH:
    3284             :         {
    3285         117 :             ::com::sun::star::drawing::Hatch aUnoHatch;
    3286         117 :             if(!(rVal >>= aUnoHatch))
    3287           0 :                 return false;
    3288             : 
    3289         117 :             aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
    3290         117 :             aHatch.SetColor( aUnoHatch.Color );
    3291         117 :             aHatch.SetDistance( aUnoHatch.Distance );
    3292         117 :             aHatch.SetAngle( aUnoHatch.Angle );
    3293         117 :             break;
    3294             :         }
    3295             : 
    3296             :         case MID_NAME:
    3297             :         {
    3298           0 :             OUString aName;
    3299           0 :             if (!(rVal >>= aName ))
    3300           0 :                 return false;
    3301           0 :             SetName( aName );
    3302           0 :             break;
    3303             :         }
    3304             : 
    3305             :         case MID_HATCH_STYLE:
    3306             :         {
    3307           0 :             sal_Int16 nVal = sal_Int16();
    3308           0 :             if (!(rVal >>= nVal ))
    3309           0 :                 return false;
    3310           0 :             aHatch.SetHatchStyle( (XHatchStyle)nVal );
    3311           0 :             break;
    3312             :         }
    3313             : 
    3314             :         case MID_HATCH_COLOR:
    3315             :         case MID_HATCH_DISTANCE:
    3316             :         case MID_HATCH_ANGLE:
    3317             :         {
    3318           0 :             sal_Int32 nVal = 0;
    3319           0 :             if (!(rVal >>= nVal ))
    3320           0 :                 return false;
    3321             : 
    3322           0 :             if ( nMemberId == MID_HATCH_COLOR )
    3323           0 :                 aHatch.SetColor( nVal );
    3324           0 :             else if ( nMemberId == MID_HATCH_DISTANCE )
    3325           0 :                 aHatch.SetDistance( nVal );
    3326             :             else
    3327           0 :                 aHatch.SetAngle( nVal );
    3328           0 :             break;
    3329             :         }
    3330             : 
    3331           0 :         default: OSL_FAIL("Wrong MemberId!"); return false;
    3332             :     }
    3333             : 
    3334         117 :     return true;
    3335             : }
    3336             : 
    3337        2926 : bool XFillHatchItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
    3338             : {
    3339        2926 :     return ((XFillHatchItem*)p1)->GetHatchValue() == ((XFillHatchItem*)p2)->GetHatchValue();
    3340             : }
    3341             : 
    3342        2039 : XFillHatchItem* XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const
    3343             : {
    3344        2039 :     if( pModel )
    3345             :     {
    3346             :         const OUString aUniqueName = NameOrIndex::CheckNamedItem(
    3347        1880 :                 this, XATTR_FILLHATCH, &pModel->GetItemPool(),
    3348        1939 :                 pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
    3349             :                 XFillHatchItem::CompareValueFunc, RID_SVXSTR_HATCH10,
    3350        5699 :                 pModel->GetPropertyList( XHATCH_LIST ) );
    3351             : 
    3352             :         // if the given name is not valid, replace it!
    3353        1880 :         if( aUniqueName != GetName() )
    3354          96 :             return new XFillHatchItem( aUniqueName, aHatch );
    3355             :     }
    3356             : 
    3357        1943 :     return (XFillHatchItem*)this;
    3358             : }
    3359             : 
    3360             : // --- form text attributes ---
    3361             : 
    3362             : // class XFormTextStyleItem
    3363             : 
    3364        7941 : TYPEINIT1_AUTOFACTORY(XFormTextStyleItem, SfxEnumItem);
    3365             : 
    3366        2841 : XFormTextStyleItem::XFormTextStyleItem(XFormTextStyle eTheStyle) :
    3367        2841 :     SfxEnumItem(XATTR_FORMTXTSTYLE, sal::static_int_cast< sal_uInt16 >(eTheStyle))
    3368             : {
    3369        2841 : }
    3370             : 
    3371           0 : XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn) :
    3372           0 :     SfxEnumItem(XATTR_FORMTXTSTYLE, rIn)
    3373             : {
    3374           0 : }
    3375             : 
    3376          12 : SfxPoolItem* XFormTextStyleItem::Clone(SfxItemPool* /*pPool*/) const
    3377             : {
    3378          12 :     return new XFormTextStyleItem( *this );
    3379             : }
    3380             : 
    3381           0 : SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3382             : {
    3383           0 :     return new XFormTextStyleItem(rIn);
    3384             : }
    3385             : 
    3386           0 : sal_uInt16 XFormTextStyleItem::GetValueCount() const
    3387             : {
    3388           0 :     return 5;
    3389             : }
    3390             : 
    3391           0 : bool XFormTextStyleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
    3392             : {
    3393           0 :     rVal <<= (sal_Int32)GetValue();
    3394           0 :     return true;
    3395             : }
    3396             : 
    3397           0 : bool XFormTextStyleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
    3398             : {
    3399           0 :     sal_Int32 nValue = 0;
    3400           0 :     rVal >>= nValue;
    3401           0 :     SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
    3402             : 
    3403           0 :     return true;
    3404             : }
    3405             : 
    3406             : // class XFormTextAdjustItem
    3407             : 
    3408        7941 : TYPEINIT1_AUTOFACTORY(XFormTextAdjustItem, SfxEnumItem);
    3409             : 
    3410        2841 : XFormTextAdjustItem::XFormTextAdjustItem(XFormTextAdjust eTheAdjust) :
    3411        2841 :     SfxEnumItem(XATTR_FORMTXTADJUST, sal::static_int_cast< sal_uInt16 >(eTheAdjust))
    3412             : {
    3413        2841 : }
    3414             : 
    3415           0 : XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn) :
    3416           0 :     SfxEnumItem(XATTR_FORMTXTADJUST, rIn)
    3417             : {
    3418           0 : }
    3419             : 
    3420          12 : SfxPoolItem* XFormTextAdjustItem::Clone(SfxItemPool* /*pPool*/) const
    3421             : {
    3422          12 :     return new XFormTextAdjustItem( *this );
    3423             : }
    3424             : 
    3425           0 : SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3426             : {
    3427           0 :     return new XFormTextAdjustItem(rIn);
    3428             : }
    3429             : 
    3430           0 : sal_uInt16 XFormTextAdjustItem::GetValueCount() const
    3431             : {
    3432           0 :     return 4;
    3433             : }
    3434             : 
    3435           0 : bool XFormTextAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
    3436             : {
    3437           0 :     rVal <<= (sal_Int32)GetValue();
    3438           0 :     return true;
    3439             : }
    3440             : 
    3441           0 : bool XFormTextAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
    3442             : {
    3443           0 :     sal_Int32 nValue = 0;
    3444           0 :     rVal >>= nValue;
    3445           0 :     SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
    3446             : 
    3447           0 :     return true;
    3448             : }
    3449             : 
    3450             : // class XFormTextDistanceItem
    3451             : 
    3452        7941 : TYPEINIT1_AUTOFACTORY(XFormTextDistanceItem, SfxMetricItem);
    3453             : 
    3454        2841 : XFormTextDistanceItem::XFormTextDistanceItem(long nDist) :
    3455        2841 :     SfxMetricItem(XATTR_FORMTXTDISTANCE, nDist)
    3456             : {
    3457        2841 : }
    3458             : 
    3459           0 : XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn) :
    3460           0 :     SfxMetricItem(XATTR_FORMTXTDISTANCE, rIn)
    3461             : {
    3462           0 : }
    3463             : 
    3464          12 : SfxPoolItem* XFormTextDistanceItem::Clone(SfxItemPool* /*pPool*/) const
    3465             : {
    3466          12 :     return new XFormTextDistanceItem(*this);
    3467             : }
    3468             : 
    3469           0 : SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3470             : {
    3471           0 :     return new XFormTextDistanceItem(rIn);
    3472             : }
    3473             : 
    3474             : // class XFormTextStartItem
    3475             : 
    3476        7941 : TYPEINIT1_AUTOFACTORY(XFormTextStartItem, SfxMetricItem);
    3477             : 
    3478        2841 : XFormTextStartItem::XFormTextStartItem(long nStart) :
    3479        2841 :     SfxMetricItem(XATTR_FORMTXTSTART, nStart)
    3480             : {
    3481        2841 : }
    3482             : 
    3483           0 : XFormTextStartItem::XFormTextStartItem(SvStream& rIn) :
    3484           0 :     SfxMetricItem(XATTR_FORMTXTSTART, rIn)
    3485             : {
    3486           0 : }
    3487             : 
    3488          12 : SfxPoolItem* XFormTextStartItem::Clone(SfxItemPool* /*pPool*/) const
    3489             : {
    3490          12 :     return new XFormTextStartItem(*this);
    3491             : }
    3492             : 
    3493           0 : SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3494             : {
    3495           0 :     return new XFormTextStartItem(rIn);
    3496             : }
    3497             : 
    3498             : // class XFormTextMirrorItem
    3499             : 
    3500        7941 : TYPEINIT1_AUTOFACTORY(XFormTextMirrorItem, SfxBoolItem);
    3501             : 
    3502        2841 : XFormTextMirrorItem::XFormTextMirrorItem(bool bMirror) :
    3503        2841 :     SfxBoolItem(XATTR_FORMTXTMIRROR, bMirror)
    3504             : {
    3505        2841 : }
    3506             : 
    3507           0 : XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn) :
    3508           0 :     SfxBoolItem(XATTR_FORMTXTMIRROR, rIn)
    3509             : {
    3510           0 : }
    3511             : 
    3512          12 : SfxPoolItem* XFormTextMirrorItem::Clone(SfxItemPool* /*pPool*/) const
    3513             : {
    3514          12 :     return new XFormTextMirrorItem(*this);
    3515             : }
    3516             : 
    3517           0 : SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3518             : {
    3519           0 :     return new XFormTextMirrorItem(rIn);
    3520             : }
    3521             : 
    3522             : // class XFormTextOutlineItem
    3523             : 
    3524        7941 : TYPEINIT1_AUTOFACTORY(XFormTextOutlineItem, SfxBoolItem);
    3525             : 
    3526        2841 : XFormTextOutlineItem::XFormTextOutlineItem(bool bOutline) :
    3527        2841 :     SfxBoolItem(XATTR_FORMTXTOUTLINE, bOutline)
    3528             : {
    3529        2841 : }
    3530             : 
    3531           0 : XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn) :
    3532           0 :     SfxBoolItem(XATTR_FORMTXTOUTLINE, rIn)
    3533             : {
    3534           0 : }
    3535             : 
    3536          12 : SfxPoolItem* XFormTextOutlineItem::Clone(SfxItemPool* /*pPool*/) const
    3537             : {
    3538          12 :     return new XFormTextOutlineItem(*this);
    3539             : }
    3540             : 
    3541           0 : SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3542             : {
    3543           0 :     return new XFormTextOutlineItem(rIn);
    3544             : }
    3545             : 
    3546             : // class XFormTextShadowItem
    3547             : 
    3548        7941 : TYPEINIT1_AUTOFACTORY(XFormTextShadowItem, SfxEnumItem);
    3549             : 
    3550        2841 : XFormTextShadowItem::XFormTextShadowItem(XFormTextShadow eFormTextShadow) :
    3551             :     SfxEnumItem(
    3552        2841 :         XATTR_FORMTXTSHADOW, sal::static_int_cast< sal_uInt16 >(eFormTextShadow))
    3553             : {
    3554        2841 : }
    3555             : 
    3556           0 : XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn) :
    3557           0 :     SfxEnumItem(XATTR_FORMTXTSHADOW, rIn)
    3558             : {
    3559           0 : }
    3560             : 
    3561          12 : SfxPoolItem* XFormTextShadowItem::Clone(SfxItemPool* /*pPool*/) const
    3562             : {
    3563          12 :     return new XFormTextShadowItem( *this );
    3564             : }
    3565             : 
    3566           0 : SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3567             : {
    3568           0 :     return new XFormTextShadowItem(rIn);
    3569             : }
    3570             : 
    3571           0 : sal_uInt16 XFormTextShadowItem::GetValueCount() const
    3572             : {
    3573           0 :     return 3;
    3574             : }
    3575             : 
    3576           0 : bool XFormTextShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
    3577             : {
    3578           0 :     rVal <<= (sal_Int32)GetValue();
    3579           0 :     return true;
    3580             : }
    3581             : 
    3582           0 : bool XFormTextShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
    3583             : {
    3584           0 :     sal_Int32 nValue = 0;
    3585           0 :     rVal >>= nValue;
    3586           0 :     SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
    3587             : 
    3588           0 :     return true;
    3589             : }
    3590             : 
    3591             : // class XFormTextShadowColorItem
    3592             : 
    3593        7941 : TYPEINIT1_AUTOFACTORY(XFormTextShadowColorItem, XColorItem);
    3594             : 
    3595        2841 : XFormTextShadowColorItem::XFormTextShadowColorItem(const OUString& rName,
    3596             :                                                      const Color& rTheColor) :
    3597        2841 :     XColorItem(XATTR_FORMTXTSHDWCOLOR, rName, rTheColor)
    3598             : {
    3599        2841 : }
    3600             : 
    3601           0 : XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn) :
    3602           0 :     XColorItem(XATTR_FORMTXTSHDWCOLOR, rIn)
    3603             : {
    3604           0 : }
    3605             : 
    3606          12 : SfxPoolItem* XFormTextShadowColorItem::Clone(SfxItemPool* /*pPool*/) const
    3607             : {
    3608          12 :     return new XFormTextShadowColorItem(*this);
    3609             : }
    3610             : 
    3611           0 : SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3612             : {
    3613           0 :     return new XFormTextShadowColorItem(rIn);
    3614             : }
    3615             : 
    3616             : // class XFormTextShadowXValItem
    3617             : 
    3618        7941 : TYPEINIT1_AUTOFACTORY(XFormTextShadowXValItem, SfxMetricItem);
    3619             : 
    3620        2841 : XFormTextShadowXValItem::XFormTextShadowXValItem(long nVal) :
    3621        2841 :     SfxMetricItem(XATTR_FORMTXTSHDWXVAL, nVal)
    3622             : {
    3623        2841 : }
    3624             : 
    3625           0 : XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn) :
    3626           0 :     SfxMetricItem(XATTR_FORMTXTSHDWXVAL, rIn)
    3627             : {
    3628           0 : }
    3629             : 
    3630          12 : SfxPoolItem* XFormTextShadowXValItem::Clone(SfxItemPool* /*pPool*/) const
    3631             : {
    3632          12 :     return new XFormTextShadowXValItem(*this);
    3633             : }
    3634             : 
    3635           0 : SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3636             : {
    3637           0 :     return new XFormTextShadowXValItem(rIn);
    3638             : }
    3639             : 
    3640             : // class XFormTextShadowYValItem
    3641             : 
    3642        7941 : TYPEINIT1_AUTOFACTORY(XFormTextShadowYValItem, SfxMetricItem);
    3643             : 
    3644        2841 : XFormTextShadowYValItem::XFormTextShadowYValItem(long nVal) :
    3645        2841 :     SfxMetricItem(XATTR_FORMTXTSHDWYVAL, nVal)
    3646             : {
    3647        2841 : }
    3648             : 
    3649           0 : XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn) :
    3650           0 :     SfxMetricItem(XATTR_FORMTXTSHDWYVAL, rIn)
    3651             : {
    3652           0 : }
    3653             : 
    3654          12 : SfxPoolItem* XFormTextShadowYValItem::Clone(SfxItemPool* /*pPool*/) const
    3655             : {
    3656          12 :     return new XFormTextShadowYValItem(*this);
    3657             : }
    3658             : 
    3659           0 : SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3660             : {
    3661           0 :     return new XFormTextShadowYValItem(rIn);
    3662             : }
    3663             : 
    3664             : // class XFormTextHideFormItem
    3665             : 
    3666        7941 : TYPEINIT1_AUTOFACTORY(XFormTextHideFormItem, SfxBoolItem);
    3667             : 
    3668        2841 : XFormTextHideFormItem::XFormTextHideFormItem(bool bHide) :
    3669        2841 :     SfxBoolItem(XATTR_FORMTXTHIDEFORM, bHide)
    3670             : {
    3671        2841 : }
    3672             : 
    3673           0 : XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn) :
    3674           0 :     SfxBoolItem(XATTR_FORMTXTHIDEFORM, rIn)
    3675             : {
    3676           0 : }
    3677             : 
    3678          12 : SfxPoolItem* XFormTextHideFormItem::Clone(SfxItemPool* /*pPool*/) const
    3679             : {
    3680          12 :     return new XFormTextHideFormItem(*this);
    3681             : }
    3682             : 
    3683           0 : SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
    3684             : {
    3685           0 :     return new XFormTextHideFormItem(rIn);
    3686             : }
    3687             : 
    3688             : // --- SetItems ---
    3689             : 
    3690        7865 : TYPEINIT1(XLineAttrSetItem, SfxSetItem);
    3691             : 
    3692             : /// a line attribute set item
    3693        2841 : XLineAttrSetItem::XLineAttrSetItem( SfxItemSet* pItemSet ) :
    3694        2841 :     SfxSetItem( XATTRSET_LINE, pItemSet)
    3695             : {
    3696        2841 : }
    3697             : 
    3698           0 : XLineAttrSetItem::XLineAttrSetItem( SfxItemPool* pItemPool ) :
    3699             :     SfxSetItem( XATTRSET_LINE,
    3700           0 :         new SfxItemSet( *pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST))
    3701             : {
    3702           0 : }
    3703             : 
    3704           0 : XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr ) :
    3705           0 :     SfxSetItem( rLineAttr )
    3706             : {
    3707           0 : }
    3708             : 
    3709          12 : XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr,
    3710             :                                     SfxItemPool* pItemPool) :
    3711          12 :     SfxSetItem( rLineAttr, pItemPool )
    3712             : {
    3713          12 : }
    3714             : 
    3715          12 : SfxPoolItem* XLineAttrSetItem::Clone( SfxItemPool* pPool ) const
    3716             : {
    3717          12 :     return new XLineAttrSetItem( *this, pPool );
    3718             : }
    3719             : 
    3720             : /// create a set item out of a stream
    3721           0 : SfxPoolItem* XLineAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
    3722             : {
    3723           0 :     SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
    3724           0 :                                     XATTR_LINE_FIRST, XATTR_LINE_LAST);
    3725           0 :     pSet2->Load( rStream );
    3726           0 :     return new XLineAttrSetItem( pSet2 );
    3727             : }
    3728             : 
    3729             : /// save a set item in a stream
    3730           0 : SvStream& XLineAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const
    3731             : {
    3732           0 :     return SfxSetItem::Store( rStream, nItemVersion );
    3733             : }
    3734             : 
    3735             : 
    3736        7854 : TYPEINIT1(XFillAttrSetItem, SfxSetItem);
    3737             : 
    3738             : /// fill attribute set item
    3739        2841 : XFillAttrSetItem::XFillAttrSetItem( SfxItemSet* pItemSet ) :
    3740        2841 :     SfxSetItem( XATTRSET_FILL, pItemSet)
    3741             : {
    3742        2841 : }
    3743             : 
    3744           0 : XFillAttrSetItem::XFillAttrSetItem( SfxItemPool* pItemPool ) :
    3745             :     SfxSetItem( XATTRSET_FILL,
    3746           0 :         new SfxItemSet( *pItemPool, XATTR_FILL_FIRST, XATTR_FILL_LAST))
    3747             : {
    3748           0 : }
    3749             : 
    3750           0 : XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr ) :
    3751           0 :     SfxSetItem( rFillAttr )
    3752             : {
    3753           0 : }
    3754             : 
    3755          12 : XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr,
    3756             :                                     SfxItemPool* pItemPool ) :
    3757          12 :     SfxSetItem( rFillAttr, pItemPool )
    3758             : {
    3759          12 : }
    3760             : 
    3761          12 : SfxPoolItem* XFillAttrSetItem::Clone( SfxItemPool* pPool ) const
    3762             : {
    3763          12 :     return new XFillAttrSetItem( *this, pPool );
    3764             : }
    3765             : 
    3766             : /// create a set item out of a stream
    3767           0 : SfxPoolItem* XFillAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
    3768             : {
    3769           0 :     SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
    3770           0 :                                     XATTR_FILL_FIRST, XATTR_FILL_LAST);
    3771           0 :     pSet2->Load( rStream );
    3772           0 :     return new XFillAttrSetItem( pSet2 );
    3773             : }
    3774             : 
    3775             : /// save a set item in a stream
    3776           0 : SvStream& XFillAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const
    3777             : {
    3778           0 :     return SfxSetItem::Store( rStream, nItemVersion );
    3779             : }
    3780             : 
    3781             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10