1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_chart2.hxx" 30*cdf0e10cSrcweir #include "GraphicPropertyItemConverter.hxx" 31*cdf0e10cSrcweir #include "SchWhichPairs.hxx" 32*cdf0e10cSrcweir #include "macros.hxx" 33*cdf0e10cSrcweir #include "ItemPropertyMap.hxx" 34*cdf0e10cSrcweir #include "PropertyHelper.hxx" 35*cdf0e10cSrcweir #include "CommonConverters.hxx" 36*cdf0e10cSrcweir #include <editeng/memberids.hrc> 37*cdf0e10cSrcweir #include <svx/xflclit.hxx> 38*cdf0e10cSrcweir #include <svx/xlnclit.hxx> 39*cdf0e10cSrcweir #include <svx/xflbmtit.hxx> 40*cdf0e10cSrcweir #include <svx/xflbstit.hxx> 41*cdf0e10cSrcweir #include <svx/xbtmpit.hxx> 42*cdf0e10cSrcweir #include <svx/xflftrit.hxx> 43*cdf0e10cSrcweir #include <svx/xlndsit.hxx> 44*cdf0e10cSrcweir #include <svx/xflhtit.hxx> 45*cdf0e10cSrcweir #include <svx/xflgrit.hxx> 46*cdf0e10cSrcweir #include <svx/xfltrit.hxx> 47*cdf0e10cSrcweir #include <svx/xlntrit.hxx> 48*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 49*cdf0e10cSrcweir // for SfxBoolItem 50*cdf0e10cSrcweir #include <svl/eitem.hxx> 51*cdf0e10cSrcweir // for XFillGradientStepCountItem 52*cdf0e10cSrcweir #include <svx/xgrscit.hxx> 53*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp> 54*cdf0e10cSrcweir #include <com/sun/star/chart2/FillBitmap.hpp> 55*cdf0e10cSrcweir #include <com/sun/star/awt/Gradient.hpp> 56*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir using namespace ::com::sun::star; 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir namespace 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir ::comphelper::ItemPropertyMapType & lcl_GetDataPointFilledPropertyMap() 63*cdf0e10cSrcweir { 64*cdf0e10cSrcweir static ::comphelper::ItemPropertyMapType aDataPointPropertyFilledMap( 65*cdf0e10cSrcweir ::comphelper::MakeItemPropertyMap 66*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLSTYLE, "FillStyle", 0 ) 67*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLCOLOR, "Color", 0 ) 68*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLTRANSPARENCE, "Transparency", 0 ) 69*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLGRADIENT, "Gradient", 0 ) 70*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLHATCH, "Hatch", 0 ) 71*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINECOLOR, "BorderColor", 0 ) 72*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINESTYLE, "BorderStyle", 0 ) 73*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINEWIDTH, "BorderWidth", 0 ) 74*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINEDASH, "BorderDash", 0 ) 75*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINETRANSPARENCE, "BorderTransparency", 0 ) 76*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBACKGROUND, "FillBackground", 0 ) 77*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POS, "FillBitmapRectanglePoint", 0 ) 78*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEX, "FillBitmapSizeX", 0 ) 79*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEY, "FillBitmapSizeY", 0 ) 80*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZELOG, "FillBitmapLogicalSize", 0 ) 81*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETX, "FillBitmapOffsetX", 0 ) 82*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETY, "FillBitmapOffsetY", 0 ) 83*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETX, "FillBitmapPositionOffsetX", 0 ) 84*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETY, "FillBitmapPositionOffsetY", 0 ) 85*cdf0e10cSrcweir ); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir return aDataPointPropertyFilledMap; 88*cdf0e10cSrcweir } 89*cdf0e10cSrcweir ::comphelper::ItemPropertyMapType & lcl_GetDataPointLinePropertyMap() 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir static ::comphelper::ItemPropertyMapType aDataPointPropertyLineMap( 92*cdf0e10cSrcweir ::comphelper::MakeItemPropertyMap 93*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINECOLOR, "Color", 0 ) 94*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINETRANSPARENCE, "Transparency", 0 ) 95*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINESTYLE, "LineStyle", 0 ) 96*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINEWIDTH, "LineWidth", 0 ) 97*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINEDASH, "LineDash", 0 ) 98*cdf0e10cSrcweir ); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir return aDataPointPropertyLineMap; 101*cdf0e10cSrcweir } 102*cdf0e10cSrcweir ::comphelper::ItemPropertyMapType & lcl_GetLinePropertyMap() 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir static ::comphelper::ItemPropertyMapType aLinePropertyMap( 105*cdf0e10cSrcweir ::comphelper::MakeItemPropertyMap 106*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINESTYLE, "LineStyle", 0 ) 107*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINEWIDTH, "LineWidth", 0 ) 108*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINEDASH, "LineDash", 0 ) 109*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINECOLOR, "LineColor", 0 ) 110*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINETRANSPARENCE, "LineTransparence", 0 ) 111*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINEJOINT, "LineJoint", 0 ) 112*cdf0e10cSrcweir ); 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir return aLinePropertyMap; 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir ::comphelper::ItemPropertyMapType & lcl_GetFillPropertyMap() 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir static ::comphelper::ItemPropertyMapType aFillPropertyMap( 119*cdf0e10cSrcweir ::comphelper::MakeItemPropertyMap 120*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLSTYLE, "FillStyle", 0 ) 121*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLCOLOR, "FillColor", 0 ) 122*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLTRANSPARENCE, "FillTransparence", 0 ) 123*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLBITMAP, "FillBitmapName", MID_NAME ) 124*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLGRADIENT, "FillGradient", 0 ) 125*cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLHATCH, "FillHatch", 0 ) 126*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBACKGROUND, "FillBackground", 0 ) 127*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POS, "FillBitmapRectanglePoint", 0 ) 128*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEX, "FillBitmapSizeX", 0 ) 129*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEY, "FillBitmapSizeY", 0 ) 130*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZELOG, "FillBitmapLogicalSize", 0 ) 131*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETX, "FillBitmapOffsetX", 0 ) 132*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETY, "FillBitmapOffsetY", 0 ) 133*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETX, "FillBitmapPositionOffsetX", 0 ) 134*cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETY, "FillBitmapPositionOffsetY", 0 ) 135*cdf0e10cSrcweir ); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir return aFillPropertyMap; 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir bool lcl_supportsFillProperties( ::chart::wrapper::GraphicPropertyItemConverter::eGraphicObjectType eType ) 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir return ( eType == ::chart::wrapper::GraphicPropertyItemConverter::FILLED_DATA_POINT || 143*cdf0e10cSrcweir eType == ::chart::wrapper::GraphicPropertyItemConverter::FILL_PROPERTIES || 144*cdf0e10cSrcweir eType == ::chart::wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES ); 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir bool lcl_supportsLineProperties( ::chart::wrapper::GraphicPropertyItemConverter::eGraphicObjectType eType ) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir return ( eType != ::chart::wrapper::GraphicPropertyItemConverter::FILL_PROPERTIES ); 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir bool lcl_SetContentForNamedProperty( 153*cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory > & xFactory, 154*cdf0e10cSrcweir const ::rtl::OUString & rTableName, 155*cdf0e10cSrcweir NameOrIndex & rItem, sal_uInt8 nMemberId ) 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir bool bResult = false; 158*cdf0e10cSrcweir if( xFactory.is()) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir ::rtl::OUString aPropertyValue( rItem.GetName()); 161*cdf0e10cSrcweir uno::Reference< container::XNameAccess > xNameAcc( 162*cdf0e10cSrcweir xFactory->createInstance( rTableName ), 163*cdf0e10cSrcweir uno::UNO_QUERY ); 164*cdf0e10cSrcweir if( xNameAcc.is() && 165*cdf0e10cSrcweir xNameAcc->hasByName( aPropertyValue )) 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir rItem.PutValue( xNameAcc->getByName( aPropertyValue ), nMemberId ); 168*cdf0e10cSrcweir bResult = true; 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir return bResult; 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir } // anonymous namespace 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir // ======================================== 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir namespace chart 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir namespace wrapper 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir GraphicPropertyItemConverter::GraphicPropertyItemConverter( 184*cdf0e10cSrcweir const uno::Reference< 185*cdf0e10cSrcweir beans::XPropertySet > & rPropertySet, 186*cdf0e10cSrcweir SfxItemPool& rItemPool, 187*cdf0e10cSrcweir SdrModel& rDrawModel, 188*cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory, 189*cdf0e10cSrcweir eGraphicObjectType eObjectType /* = FILL_PROPERTIES */ ) : 190*cdf0e10cSrcweir ItemConverter( rPropertySet, rItemPool ), 191*cdf0e10cSrcweir m_eGraphicObjectType( eObjectType ), 192*cdf0e10cSrcweir m_rDrawModel( rDrawModel ), 193*cdf0e10cSrcweir m_xNamedPropertyTableFactory( xNamedPropertyContainerFactory ) 194*cdf0e10cSrcweir {} 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir GraphicPropertyItemConverter::~GraphicPropertyItemConverter() 197*cdf0e10cSrcweir {} 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir const sal_uInt16 * GraphicPropertyItemConverter::GetWhichPairs() const 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir const sal_uInt16 * pResult = NULL; 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir switch( m_eGraphicObjectType ) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir case LINE_DATA_POINT: 206*cdf0e10cSrcweir case FILLED_DATA_POINT: 207*cdf0e10cSrcweir pResult = nRowWhichPairs; break; 208*cdf0e10cSrcweir case LINE_PROPERTIES: 209*cdf0e10cSrcweir pResult = nLinePropertyWhichPairs; break; 210*cdf0e10cSrcweir case FILL_PROPERTIES: 211*cdf0e10cSrcweir pResult = nFillPropertyWhichPairs; break; 212*cdf0e10cSrcweir case LINE_AND_FILL_PROPERTIES: 213*cdf0e10cSrcweir pResult = nLineAndFillPropertyWhichPairs; break; 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir return pResult; 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir bool GraphicPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir ::comphelper::ItemPropertyMapType::const_iterator aEndIt; 222*cdf0e10cSrcweir ::comphelper::ItemPropertyMapType::const_iterator aIt; 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir switch( m_eGraphicObjectType ) 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir case LINE_DATA_POINT: 227*cdf0e10cSrcweir aEndIt = lcl_GetDataPointLinePropertyMap().end(); 228*cdf0e10cSrcweir aIt = lcl_GetDataPointLinePropertyMap().find( nWhichId ); 229*cdf0e10cSrcweir break; 230*cdf0e10cSrcweir case FILLED_DATA_POINT: 231*cdf0e10cSrcweir aEndIt = lcl_GetDataPointFilledPropertyMap().end(); 232*cdf0e10cSrcweir aIt = lcl_GetDataPointFilledPropertyMap().find( nWhichId ); 233*cdf0e10cSrcweir break; 234*cdf0e10cSrcweir case LINE_PROPERTIES: 235*cdf0e10cSrcweir aEndIt = lcl_GetLinePropertyMap().end(); 236*cdf0e10cSrcweir aIt = lcl_GetLinePropertyMap().find( nWhichId ); 237*cdf0e10cSrcweir break; 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir case FILL_PROPERTIES: 240*cdf0e10cSrcweir aEndIt = lcl_GetFillPropertyMap().end(); 241*cdf0e10cSrcweir aIt = lcl_GetFillPropertyMap().find( nWhichId ); 242*cdf0e10cSrcweir break; 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir case LINE_AND_FILL_PROPERTIES: 245*cdf0e10cSrcweir // line 246*cdf0e10cSrcweir aEndIt = lcl_GetLinePropertyMap().end(); 247*cdf0e10cSrcweir aIt = lcl_GetLinePropertyMap().find( nWhichId ); 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir // not found => try fill 250*cdf0e10cSrcweir if( aIt == aEndIt ) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir aEndIt = lcl_GetFillPropertyMap().end(); 253*cdf0e10cSrcweir aIt = lcl_GetFillPropertyMap().find( nWhichId ); 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir break; 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir if( aIt == aEndIt ) 259*cdf0e10cSrcweir return false; 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir rOutProperty =(*aIt).second; 262*cdf0e10cSrcweir return true; 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir void GraphicPropertyItemConverter::FillSpecialItem( 266*cdf0e10cSrcweir sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const 267*cdf0e10cSrcweir throw( uno::Exception ) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir // if( m_eGraphicObjectType == LINE_DATA_POINT || 270*cdf0e10cSrcweir // m_eGraphicObjectType == LINE_PROPERTIES ) 271*cdf0e10cSrcweir // return; 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir switch( nWhichId ) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir // bitmap property 276*cdf0e10cSrcweir case XATTR_FILLBMP_TILE: 277*cdf0e10cSrcweir case XATTR_FILLBMP_STRETCH: 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir drawing::BitmapMode aMode = drawing::BitmapMode_REPEAT; 280*cdf0e10cSrcweir if( GetPropertySet()->getPropertyValue( C2U("FillBitmapMode")) >>= aMode ) 281*cdf0e10cSrcweir { 282*cdf0e10cSrcweir rOutItemSet.Put( XFillBmpTileItem( aMode == drawing::BitmapMode_REPEAT )); 283*cdf0e10cSrcweir rOutItemSet.Put( XFillBmpStretchItem( aMode == drawing::BitmapMode_STRETCH )); 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir break; 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir case XATTR_FILLFLOATTRANSPARENCE: 289*cdf0e10cSrcweir try 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir ::rtl::OUString aPropName = 294*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 295*cdf0e10cSrcweir ? C2U( "TransparencyGradientName" ) 296*cdf0e10cSrcweir : C2U( "FillTransparenceGradientName" ); 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir uno::Any aValue( GetPropertySet()->getPropertyValue( aPropName )); 299*cdf0e10cSrcweir if( aValue.hasValue()) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir XFillFloatTransparenceItem aItem; 302*cdf0e10cSrcweir aItem.PutValue( aValue, MID_NAME ); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir lcl_SetContentForNamedProperty( 305*cdf0e10cSrcweir m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.TransparencyGradientTable"), 306*cdf0e10cSrcweir aItem, MID_FILLGRADIENT ); 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir // this is important to enable the item 309*cdf0e10cSrcweir ::rtl::OUString aName; 310*cdf0e10cSrcweir if( (aValue >>= aName) && 311*cdf0e10cSrcweir aName.getLength()) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir aItem.SetEnabled( sal_True ); 314*cdf0e10cSrcweir rOutItemSet.Put( aItem ); 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir catch( beans::UnknownPropertyException ex ) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir break; 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir case XATTR_GRADIENTSTEPCOUNT: 326*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir ::rtl::OUString aPropName = 329*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 330*cdf0e10cSrcweir ? C2U( "GradientStepCount" ) 331*cdf0e10cSrcweir : C2U( "FillGradientStepCount" ); 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir sal_Int16 nStepCount = 0; 334*cdf0e10cSrcweir uno::Any aValue( GetPropertySet()->getPropertyValue( aPropName ) ); 335*cdf0e10cSrcweir if( hasLongOrShortValue(aValue) ) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir nStepCount = getShortForLongAlso(aValue); 338*cdf0e10cSrcweir rOutItemSet.Put( XGradientStepCountItem( nStepCount )); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir break; 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir case XATTR_LINEDASH: 344*cdf0e10cSrcweir if( lcl_supportsLineProperties( m_eGraphicObjectType )) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir ::rtl::OUString aPropName = 347*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 348*cdf0e10cSrcweir ? C2U( "BorderDashName" ) 349*cdf0e10cSrcweir : C2U( "LineDashName" ); 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir XLineDashItem aItem; 352*cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), MID_NAME ); 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir lcl_SetContentForNamedProperty( 355*cdf0e10cSrcweir m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.DashTable"), 356*cdf0e10cSrcweir aItem, MID_LINEDASH ); 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir // translate model name to UI-name for predefined entries, so 359*cdf0e10cSrcweir // that the correct entry is chosen in the list of UI-names 360*cdf0e10cSrcweir XLineDashItem * pItemToPut = & aItem; 361*cdf0e10cSrcweir pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel ); 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir rOutItemSet.Put( * pItemToPut ); 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir break; 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir case XATTR_FILLGRADIENT: 368*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir ::rtl::OUString aPropName = 371*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 372*cdf0e10cSrcweir ? C2U( "GradientName" ) 373*cdf0e10cSrcweir : C2U( "FillGradientName" ); 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir XFillGradientItem aItem; 376*cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), MID_NAME ); 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir lcl_SetContentForNamedProperty( 379*cdf0e10cSrcweir m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.GradientTable"), 380*cdf0e10cSrcweir aItem, MID_FILLGRADIENT ); 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir // translate model name to UI-name for predefined entries, so 383*cdf0e10cSrcweir // that the correct entry is chosen in the list of UI-names 384*cdf0e10cSrcweir XFillGradientItem * pItemToPut = & aItem; 385*cdf0e10cSrcweir pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel ); 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir rOutItemSet.Put( * pItemToPut ); 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir break; 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir case XATTR_FILLHATCH: 392*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir ::rtl::OUString aPropName = 395*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 396*cdf0e10cSrcweir ? C2U( "HatchName" ) 397*cdf0e10cSrcweir : C2U( "FillHatchName" ); 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir XFillHatchItem aItem; 400*cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), MID_NAME ); 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir lcl_SetContentForNamedProperty( 403*cdf0e10cSrcweir m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.HatchTable"), 404*cdf0e10cSrcweir aItem, MID_FILLHATCH ); 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir // translate model name to UI-name for predefined entries, so 407*cdf0e10cSrcweir // that the correct entry is chosen in the list of UI-names 408*cdf0e10cSrcweir XFillHatchItem * pItemToPut = & aItem; 409*cdf0e10cSrcweir pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel ); 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir rOutItemSet.Put( * pItemToPut ); 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir break; 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir case XATTR_FILLBITMAP: 416*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir XFillBitmapItem aItem; 419*cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "FillBitmapName" ) ), MID_NAME ); 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir lcl_SetContentForNamedProperty( 422*cdf0e10cSrcweir m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.BitmapTable"), 423*cdf0e10cSrcweir aItem, MID_GRAFURL ); 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir // translate model name to UI-name for predefined entries, so 426*cdf0e10cSrcweir // that the correct entry is chosen in the list of UI-names 427*cdf0e10cSrcweir XFillBitmapItem * pItemToPut = & aItem; 428*cdf0e10cSrcweir pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel ); 429*cdf0e10cSrcweir 430*cdf0e10cSrcweir rOutItemSet.Put( * pItemToPut ); 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir break; 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir // hack, because QueryValue of XLineTransparenceItem returns sal_Int32 435*cdf0e10cSrcweir // instead of sal_Int16 436*cdf0e10cSrcweir case XATTR_LINETRANSPARENCE: 437*cdf0e10cSrcweir if( lcl_supportsLineProperties( m_eGraphicObjectType )) 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir ::rtl::OUString aPropName = 440*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 441*cdf0e10cSrcweir ? C2U( "BorderTransparency" ) 442*cdf0e10cSrcweir : (m_eGraphicObjectType == LINE_DATA_POINT) 443*cdf0e10cSrcweir ? C2U( "Transparency" ) 444*cdf0e10cSrcweir : C2U( "LineTransparence" ); 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir XLineTransparenceItem aItem; 447*cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ) ); 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir rOutItemSet.Put( aItem ); 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir break; 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir // hack, because QueryValue of XFillTransparenceItem returns sal_Int32 454*cdf0e10cSrcweir // instead of sal_Int16 455*cdf0e10cSrcweir case XATTR_FILLTRANSPARENCE: 456*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 457*cdf0e10cSrcweir { 458*cdf0e10cSrcweir ::rtl::OUString aPropName = 459*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 460*cdf0e10cSrcweir ? C2U( "Transparency" ) 461*cdf0e10cSrcweir : C2U( "FillTransparence" ); 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir XFillTransparenceItem aItem; 464*cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ) ); 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir rOutItemSet.Put( aItem ); 467*cdf0e10cSrcweir } 468*cdf0e10cSrcweir break; 469*cdf0e10cSrcweir } 470*cdf0e10cSrcweir } 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir bool GraphicPropertyItemConverter::ApplySpecialItem( 473*cdf0e10cSrcweir sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) 474*cdf0e10cSrcweir throw( uno::Exception ) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir bool bChanged = false; 477*cdf0e10cSrcweir uno::Any aValue; 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir switch( nWhichId ) 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir // bitmap property 482*cdf0e10cSrcweir case XATTR_FILLBMP_STRETCH: 483*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 484*cdf0e10cSrcweir { 485*cdf0e10cSrcweir const ::rtl::OUString aModePropName = C2U("FillBitmapMode"); 486*cdf0e10cSrcweir bool bStretched = static_cast< const XFillBmpStretchItem & >( 487*cdf0e10cSrcweir rItemSet.Get( XATTR_FILLBMP_STRETCH )).GetValue(); 488*cdf0e10cSrcweir drawing::BitmapMode aMode = 489*cdf0e10cSrcweir (bStretched ? drawing::BitmapMode_STRETCH : drawing::BitmapMode_NO_REPEAT); 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir aValue <<= aMode; 492*cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aModePropName )) 493*cdf0e10cSrcweir { 494*cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aModePropName, aValue ); 495*cdf0e10cSrcweir bChanged = true; 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir break; 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir case XATTR_FILLBMP_TILE: 501*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 502*cdf0e10cSrcweir { 503*cdf0e10cSrcweir const ::rtl::OUString aModePropName = C2U("FillBitmapMode"); 504*cdf0e10cSrcweir bool bTiled = static_cast< const XFillBmpTileItem & >( 505*cdf0e10cSrcweir rItemSet.Get( XATTR_FILLBMP_TILE )).GetValue(); 506*cdf0e10cSrcweir drawing::BitmapMode aMode = 507*cdf0e10cSrcweir (bTiled ? drawing::BitmapMode_REPEAT : drawing::BitmapMode_NO_REPEAT); 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir aValue <<= aMode; 510*cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aModePropName )) 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aModePropName, aValue ); 513*cdf0e10cSrcweir bChanged = true; 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir } 516*cdf0e10cSrcweir break; 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir case XATTR_FILLFLOATTRANSPARENCE: 519*cdf0e10cSrcweir try 520*cdf0e10cSrcweir { 521*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 522*cdf0e10cSrcweir { 523*cdf0e10cSrcweir ::rtl::OUString aPropName = 524*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 525*cdf0e10cSrcweir ? C2U( "TransparencyGradientName" ) 526*cdf0e10cSrcweir : C2U( "FillTransparenceGradientName" ); 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir const XFillFloatTransparenceItem & rItem = 529*cdf0e10cSrcweir static_cast< const XFillFloatTransparenceItem & >( 530*cdf0e10cSrcweir rItemSet.Get( nWhichId )); 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir if( rItem.IsEnabled() && 533*cdf0e10cSrcweir rItem.QueryValue( aValue, MID_NAME )) 534*cdf0e10cSrcweir { 535*cdf0e10cSrcweir uno::Any aGradient; 536*cdf0e10cSrcweir rItem.QueryValue( aGradient, MID_FILLGRADIENT ); 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir // add TransparencyGradient to list if it does not already exist 539*cdf0e10cSrcweir ::rtl::OUString aPreferredName; 540*cdf0e10cSrcweir aValue >>= aPreferredName; 541*cdf0e10cSrcweir aValue <<= PropertyHelper::addTransparencyGradientUniqueNameToTable( 542*cdf0e10cSrcweir aGradient, m_xNamedPropertyTableFactory, aPreferredName ); 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aPropName )) 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue ); 547*cdf0e10cSrcweir bChanged = true; 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir else 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir ::rtl::OUString aName; 553*cdf0e10cSrcweir if( ( GetPropertySet()->getPropertyValue( aPropName ) >>= aName ) 554*cdf0e10cSrcweir && aName.getLength() > 0 ) 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir uno::Reference< beans::XPropertyState > xState( GetPropertySet(), uno::UNO_QUERY ); 557*cdf0e10cSrcweir if( xState.is()) 558*cdf0e10cSrcweir xState->setPropertyToDefault( aPropName ); 559*cdf0e10cSrcweir bChanged = true; 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir } 562*cdf0e10cSrcweir } 563*cdf0e10cSrcweir } 564*cdf0e10cSrcweir catch( beans::UnknownPropertyException ex ) 565*cdf0e10cSrcweir { 566*cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 567*cdf0e10cSrcweir } 568*cdf0e10cSrcweir break; 569*cdf0e10cSrcweir 570*cdf0e10cSrcweir case XATTR_GRADIENTSTEPCOUNT: 571*cdf0e10cSrcweir { 572*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 573*cdf0e10cSrcweir { 574*cdf0e10cSrcweir ::rtl::OUString aPropName = 575*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 576*cdf0e10cSrcweir ? C2U( "GradientStepCount" ) 577*cdf0e10cSrcweir : C2U( "FillGradientStepCount" ); 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir sal_Int16 nStepCount = ( static_cast< const XGradientStepCountItem & >( 580*cdf0e10cSrcweir rItemSet.Get( nWhichId ))).GetValue(); 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir aValue <<= nStepCount; 583*cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aPropName )) 584*cdf0e10cSrcweir { 585*cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue ); 586*cdf0e10cSrcweir bChanged = true; 587*cdf0e10cSrcweir } 588*cdf0e10cSrcweir } 589*cdf0e10cSrcweir } 590*cdf0e10cSrcweir break; 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir case XATTR_LINEDASH: 593*cdf0e10cSrcweir { 594*cdf0e10cSrcweir if( lcl_supportsLineProperties( m_eGraphicObjectType )) 595*cdf0e10cSrcweir { 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir ::rtl::OUString aPropName = 598*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 599*cdf0e10cSrcweir ? C2U( "BorderDashName" ) 600*cdf0e10cSrcweir : C2U( "LineDashName" ); 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir const XLineDashItem & rItem = 603*cdf0e10cSrcweir static_cast< const XLineDashItem & >( 604*cdf0e10cSrcweir rItemSet.Get( nWhichId )); 605*cdf0e10cSrcweir 606*cdf0e10cSrcweir if( rItem.QueryValue( aValue, MID_NAME )) 607*cdf0e10cSrcweir { 608*cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aPropName )) 609*cdf0e10cSrcweir { 610*cdf0e10cSrcweir // add LineDash to list 611*cdf0e10cSrcweir uno::Any aLineDash; 612*cdf0e10cSrcweir rItem.QueryValue( aLineDash, MID_LINEDASH ); 613*cdf0e10cSrcweir ::rtl::OUString aPreferredName; 614*cdf0e10cSrcweir aValue >>= aPreferredName; 615*cdf0e10cSrcweir aValue <<= PropertyHelper::addLineDashUniqueNameToTable( 616*cdf0e10cSrcweir aLineDash, m_xNamedPropertyTableFactory, aPreferredName ); 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue ); 619*cdf0e10cSrcweir bChanged = true; 620*cdf0e10cSrcweir } 621*cdf0e10cSrcweir } 622*cdf0e10cSrcweir } 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir break; 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir case XATTR_FILLGRADIENT: 627*cdf0e10cSrcweir { 628*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir ::rtl::OUString aPropName = 631*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 632*cdf0e10cSrcweir ? C2U( "GradientName" ) 633*cdf0e10cSrcweir : C2U( "FillGradientName" ); 634*cdf0e10cSrcweir 635*cdf0e10cSrcweir const XFillGradientItem & rItem = 636*cdf0e10cSrcweir static_cast< const XFillGradientItem & >( 637*cdf0e10cSrcweir rItemSet.Get( nWhichId )); 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir if( rItem.QueryValue( aValue, MID_NAME )) 640*cdf0e10cSrcweir { 641*cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aPropName )) 642*cdf0e10cSrcweir { 643*cdf0e10cSrcweir // add Gradient to list 644*cdf0e10cSrcweir uno::Any aGradient; 645*cdf0e10cSrcweir rItem.QueryValue( aGradient, MID_FILLGRADIENT ); 646*cdf0e10cSrcweir ::rtl::OUString aPreferredName; 647*cdf0e10cSrcweir aValue >>= aPreferredName; 648*cdf0e10cSrcweir aValue <<= PropertyHelper::addGradientUniqueNameToTable( 649*cdf0e10cSrcweir aGradient, m_xNamedPropertyTableFactory, aPreferredName ); 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue ); 652*cdf0e10cSrcweir bChanged = true; 653*cdf0e10cSrcweir } 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir break; 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir case XATTR_FILLHATCH: 660*cdf0e10cSrcweir { 661*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 662*cdf0e10cSrcweir { 663*cdf0e10cSrcweir ::rtl::OUString aPropName = 664*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 665*cdf0e10cSrcweir ? C2U( "HatchName" ) 666*cdf0e10cSrcweir : C2U( "FillHatchName" ); 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir const XFillHatchItem & rItem = 669*cdf0e10cSrcweir static_cast< const XFillHatchItem & >( 670*cdf0e10cSrcweir rItemSet.Get( nWhichId )); 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir if( rItem.QueryValue( aValue, MID_NAME )) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aPropName )) 675*cdf0e10cSrcweir { 676*cdf0e10cSrcweir // add Hatch to list 677*cdf0e10cSrcweir uno::Any aHatch; 678*cdf0e10cSrcweir rItem.QueryValue( aHatch, MID_FILLHATCH ); 679*cdf0e10cSrcweir ::rtl::OUString aPreferredName; 680*cdf0e10cSrcweir aValue >>= aPreferredName; 681*cdf0e10cSrcweir aValue <<= PropertyHelper::addHatchUniqueNameToTable( 682*cdf0e10cSrcweir aHatch, m_xNamedPropertyTableFactory, aPreferredName ); 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue ); 685*cdf0e10cSrcweir bChanged = true; 686*cdf0e10cSrcweir } 687*cdf0e10cSrcweir } 688*cdf0e10cSrcweir } 689*cdf0e10cSrcweir } 690*cdf0e10cSrcweir break; 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir case XATTR_FILLBITMAP: 693*cdf0e10cSrcweir { 694*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 695*cdf0e10cSrcweir { 696*cdf0e10cSrcweir const XFillBitmapItem & rItem = 697*cdf0e10cSrcweir static_cast< const XFillBitmapItem & >( 698*cdf0e10cSrcweir rItemSet.Get( nWhichId )); 699*cdf0e10cSrcweir 700*cdf0e10cSrcweir if( rItem.QueryValue( aValue, MID_NAME )) 701*cdf0e10cSrcweir { 702*cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( C2U( "FillBitmapName" ))) 703*cdf0e10cSrcweir { 704*cdf0e10cSrcweir // add Bitmap to list 705*cdf0e10cSrcweir uno::Any aBitmap; 706*cdf0e10cSrcweir rItem.QueryValue( aBitmap, MID_GRAFURL ); 707*cdf0e10cSrcweir ::rtl::OUString aPreferredName; 708*cdf0e10cSrcweir aValue >>= aPreferredName; 709*cdf0e10cSrcweir aValue <<= PropertyHelper::addBitmapUniqueNameToTable( 710*cdf0e10cSrcweir aBitmap, m_xNamedPropertyTableFactory, aPreferredName ); 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir GetPropertySet()->setPropertyValue( C2U( "FillBitmapName" ), aValue ); 713*cdf0e10cSrcweir bChanged = true; 714*cdf0e10cSrcweir } 715*cdf0e10cSrcweir } 716*cdf0e10cSrcweir } 717*cdf0e10cSrcweir } 718*cdf0e10cSrcweir break; 719*cdf0e10cSrcweir 720*cdf0e10cSrcweir // hack, because QueryValue of XLineTransparenceItem returns sal_Int32 721*cdf0e10cSrcweir // instead of sal_Int16 722*cdf0e10cSrcweir case XATTR_LINETRANSPARENCE: 723*cdf0e10cSrcweir if( lcl_supportsLineProperties( m_eGraphicObjectType )) 724*cdf0e10cSrcweir { 725*cdf0e10cSrcweir ::rtl::OUString aPropName = 726*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 727*cdf0e10cSrcweir ? C2U( "BorderTransparency" ) 728*cdf0e10cSrcweir : (m_eGraphicObjectType == LINE_DATA_POINT) 729*cdf0e10cSrcweir ? C2U( "Transparency" ) 730*cdf0e10cSrcweir : C2U( "LineTransparence" ); 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir const XLineTransparenceItem & rItem = 733*cdf0e10cSrcweir static_cast< const XLineTransparenceItem & >( 734*cdf0e10cSrcweir rItemSet.Get( nWhichId )); 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir if( rItem.QueryValue( aValue )) 737*cdf0e10cSrcweir { 738*cdf0e10cSrcweir OSL_ENSURE( ! aValue.isExtractableTo( 739*cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int16 * >(0))), 740*cdf0e10cSrcweir "TransparenceItem QueryValue bug is fixed. Remove hack." ); 741*cdf0e10cSrcweir sal_Int32 nValue = 0; 742*cdf0e10cSrcweir if( aValue >>= nValue ) 743*cdf0e10cSrcweir { 744*cdf0e10cSrcweir OSL_ENSURE( nValue < SAL_MAX_INT16, "Transparency value too large" ); 745*cdf0e10cSrcweir sal_Int16 nValueToSet( static_cast< sal_Int16 >( nValue )); 746*cdf0e10cSrcweir aValue <<= nValueToSet; 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue ); 749*cdf0e10cSrcweir bChanged = true; 750*cdf0e10cSrcweir } 751*cdf0e10cSrcweir else 752*cdf0e10cSrcweir { 753*cdf0e10cSrcweir OSL_ENSURE( false, "Wrong type in Transparency Any" ); 754*cdf0e10cSrcweir } 755*cdf0e10cSrcweir } 756*cdf0e10cSrcweir } 757*cdf0e10cSrcweir break; 758*cdf0e10cSrcweir 759*cdf0e10cSrcweir // hack, because QueryValue of XFillTransparenceItem returns sal_Int32 760*cdf0e10cSrcweir // instead of sal_Int16 761*cdf0e10cSrcweir case XATTR_FILLTRANSPARENCE: 762*cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType )) 763*cdf0e10cSrcweir { 764*cdf0e10cSrcweir ::rtl::OUString aPropName = 765*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 766*cdf0e10cSrcweir ? C2U( "Transparency" ) 767*cdf0e10cSrcweir : C2U( "FillTransparence" ); 768*cdf0e10cSrcweir 769*cdf0e10cSrcweir const XFillTransparenceItem & rItem = 770*cdf0e10cSrcweir static_cast< const XFillTransparenceItem & >( 771*cdf0e10cSrcweir rItemSet.Get( nWhichId )); 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir if( rItem.QueryValue( aValue )) 774*cdf0e10cSrcweir { 775*cdf0e10cSrcweir OSL_ENSURE( ! aValue.isExtractableTo( 776*cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int16 * >(0))), 777*cdf0e10cSrcweir "TransparenceItem QueryValue bug is fixed. Remove hack." ); 778*cdf0e10cSrcweir sal_Int32 nValue = 0; 779*cdf0e10cSrcweir if( aValue >>= nValue ) 780*cdf0e10cSrcweir { 781*cdf0e10cSrcweir OSL_ENSURE( nValue < SAL_MAX_INT16, "Transparency value too large" ); 782*cdf0e10cSrcweir sal_Int16 nValueToSet( static_cast< sal_Int16 >( nValue )); 783*cdf0e10cSrcweir aValue <<= nValueToSet; 784*cdf0e10cSrcweir 785*cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue ); 786*cdf0e10cSrcweir // if linear or no transparence is set, delete the gradient 787*cdf0e10cSrcweir ::rtl::OUString aTransGradPropName = 788*cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT) 789*cdf0e10cSrcweir ? C2U( "TransparencyGradientName" ) 790*cdf0e10cSrcweir : C2U( "FillTransparenceGradientName" ); 791*cdf0e10cSrcweir GetPropertySet()->setPropertyValue( 792*cdf0e10cSrcweir aTransGradPropName, uno::makeAny( ::rtl::OUString() )); 793*cdf0e10cSrcweir 794*cdf0e10cSrcweir bChanged = true; 795*cdf0e10cSrcweir } 796*cdf0e10cSrcweir else 797*cdf0e10cSrcweir { 798*cdf0e10cSrcweir OSL_ENSURE( false, "Wrong type in Transparency Any" ); 799*cdf0e10cSrcweir } 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir } 802*cdf0e10cSrcweir break; 803*cdf0e10cSrcweir } 804*cdf0e10cSrcweir 805*cdf0e10cSrcweir return bChanged; 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir } // namespace wrapper 809*cdf0e10cSrcweir } // namespace chart 810