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_svx.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir // include --------------------------------------------------------------- 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include <string> // HACK: prevent conflict between STLPORT and Workshop headers 34*cdf0e10cSrcweir #include <sfx2/app.hxx> 35*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 36*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 37*cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 38*cdf0e10cSrcweir #include <rtl/ustring.hxx> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include <svx/dialogs.hrc> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #define DELAY_TIMEOUT 300 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir #define TMP_STR_BEGIN '[' 45*cdf0e10cSrcweir #define TMP_STR_END ']' 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #include "svx/drawitem.hxx" 48*cdf0e10cSrcweir #include "svx/xattr.hxx" 49*cdf0e10cSrcweir #include <svx/xtable.hxx> 50*cdf0e10cSrcweir #include <svx/fillctrl.hxx> 51*cdf0e10cSrcweir #include <svx/itemwin.hxx> 52*cdf0e10cSrcweir #include <svx/dialmgr.hxx> 53*cdf0e10cSrcweir #include "helpid.hrc" 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 56*cdf0e10cSrcweir using namespace ::com::sun::star::util; 57*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 58*cdf0e10cSrcweir using namespace ::com::sun::star::frame; 59*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFillToolBoxControl, XFillStyleItem ); 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir /************************************************************************* 64*cdf0e10cSrcweir |* 65*cdf0e10cSrcweir |* SvxFillToolBoxControl 66*cdf0e10cSrcweir |* 67*cdf0e10cSrcweir \************************************************************************/ 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir SvxFillToolBoxControl::SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : 70*cdf0e10cSrcweir SfxToolBoxControl( nSlotId, nId, rTbx ), 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir pStyleItem ( NULL ), 73*cdf0e10cSrcweir pColorItem ( NULL ), 74*cdf0e10cSrcweir pGradientItem ( NULL ), 75*cdf0e10cSrcweir pHatchItem ( NULL ), 76*cdf0e10cSrcweir pBitmapItem ( NULL ), 77*cdf0e10cSrcweir pFillControl ( NULL ), 78*cdf0e10cSrcweir pFillTypeLB ( NULL ), 79*cdf0e10cSrcweir pFillAttrLB ( NULL ), 80*cdf0e10cSrcweir bUpdate ( sal_False ), 81*cdf0e10cSrcweir bIgnoreStatusUpdate( sal_False ), 82*cdf0e10cSrcweir eLastXFS ( XFILL_NONE ) 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" ))); 85*cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillGradient" ))); 86*cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillHatch" ))); 87*cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillBitmap" ))); 88*cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColorTableState" ))); 89*cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GradientListState" ))); 90*cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HatchListState" ))); 91*cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:BitmapListState" ))); 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir //======================================================================== 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir SvxFillToolBoxControl::~SvxFillToolBoxControl() 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir delete pStyleItem; 99*cdf0e10cSrcweir delete pColorItem; 100*cdf0e10cSrcweir delete pGradientItem; 101*cdf0e10cSrcweir delete pHatchItem; 102*cdf0e10cSrcweir delete pBitmapItem; 103*cdf0e10cSrcweir } 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir //======================================================================== 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir void SvxFillToolBoxControl::StateChanged( 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir bool bEnableControls = sal_False; 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir if ( bIgnoreStatusUpdate ) 115*cdf0e10cSrcweir return; 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir if( eState == SFX_ITEM_DISABLED ) 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir if( nSID == SID_ATTR_FILL_STYLE ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir pFillTypeLB->Disable(); 122*cdf0e10cSrcweir pFillTypeLB->SetNoSelection(); 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir pFillAttrLB->Disable(); 125*cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir else 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir if ( SFX_ITEM_AVAILABLE == eState ) 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir if( nSID == SID_ATTR_FILL_STYLE ) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir delete pStyleItem; 134*cdf0e10cSrcweir pStyleItem = (XFillStyleItem*) pState->Clone(); 135*cdf0e10cSrcweir pFillTypeLB->Enable(); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir eLastXFS = pFillTypeLB->GetSelectEntryPos(); 138*cdf0e10cSrcweir bUpdate = sal_True; 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); 141*cdf0e10cSrcweir pFillTypeLB->SelectEntryPos( 142*cdf0e10cSrcweir sal::static_int_cast< sal_uInt16 >( eXFS ) ); 143*cdf0e10cSrcweir pFillAttrLB->Enable(); 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir else if( pStyleItem ) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir if( nSID == SID_ATTR_FILL_COLOR ) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir delete pColorItem; 152*cdf0e10cSrcweir pColorItem = (XFillColorItem*) pState->Clone(); 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir if( eXFS == XFILL_SOLID ) 155*cdf0e10cSrcweir bEnableControls = sal_True; 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir else if( nSID == SID_ATTR_FILL_GRADIENT ) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir delete pGradientItem; 160*cdf0e10cSrcweir pGradientItem = (XFillGradientItem*) pState->Clone(); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir if( eXFS == XFILL_GRADIENT ) 163*cdf0e10cSrcweir bEnableControls = sal_True; 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir else if( nSID == SID_ATTR_FILL_HATCH ) 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir delete pHatchItem; 168*cdf0e10cSrcweir pHatchItem = (XFillHatchItem*) pState->Clone(); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir if( eXFS == XFILL_HATCH ) 171*cdf0e10cSrcweir bEnableControls = sal_True; 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir else if( nSID == SID_ATTR_FILL_BITMAP ) 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir delete pBitmapItem; 176*cdf0e10cSrcweir pBitmapItem = (XFillBitmapItem*) pState->Clone(); 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir if( eXFS == XFILL_BITMAP ) 179*cdf0e10cSrcweir bEnableControls = sal_True; 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir if( bEnableControls ) 183*cdf0e10cSrcweir { 184*cdf0e10cSrcweir //pFillTypeLB->Enable(); 185*cdf0e10cSrcweir pFillAttrLB->Enable(); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir bUpdate = sal_True; 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir Update( pState ); 191*cdf0e10cSrcweir } 192*cdf0e10cSrcweir else 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir // leerer oder uneindeutiger Status 195*cdf0e10cSrcweir if( nSID == SID_ATTR_FILL_STYLE ) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir pFillTypeLB->SetNoSelection(); 198*cdf0e10cSrcweir pFillAttrLB->Disable(); 199*cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 200*cdf0e10cSrcweir bUpdate = sal_False; 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir else 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir XFillStyle eXFS = XFILL_NONE; 205*cdf0e10cSrcweir if( pStyleItem ) 206*cdf0e10cSrcweir eXFS = (XFillStyle)pStyleItem->GetValue(); 207*cdf0e10cSrcweir if( !pStyleItem || 208*cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_COLOR && eXFS == XFILL_SOLID ) || 209*cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_GRADIENT && eXFS == XFILL_GRADIENT ) || 210*cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_HATCH && eXFS == XFILL_HATCH ) || 211*cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_BITMAP && eXFS == XFILL_BITMAP ) ) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 214*cdf0e10cSrcweir //bUpdate = sal_False; 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir //======================================================================== 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir void SvxFillToolBoxControl::IgnoreStatusUpdate( sal_Bool bSet ) 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir bIgnoreStatusUpdate = bSet; 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir //======================================================================== 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir void SvxFillToolBoxControl::Update( const SfxPoolItem* pState ) 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir if ( pStyleItem && pState && bUpdate ) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir bUpdate = sal_False; 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir // Pruefen, ob Fuellstil schon vorher aktiv war 239*cdf0e10cSrcweir //if( eTmpXFS != eXFS ) 240*cdf0e10cSrcweir if( (XFillStyle) eLastXFS != eXFS ) 241*cdf0e10cSrcweir pFillControl->SelectFillTypeHdl( NULL ); 242*cdf0e10cSrcweir //eLastXFS = eXFS; 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir switch( eXFS ) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir case XFILL_NONE: 247*cdf0e10cSrcweir break; 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir case XFILL_SOLID: 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir if ( pColorItem ) 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir String aString( pColorItem->GetName() ); 254*cdf0e10cSrcweir ::Color aColor = pColorItem->GetColorValue(); 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir if ( pFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND || 259*cdf0e10cSrcweir pFillAttrLB->GetSelectEntryColor() != aColor ) 260*cdf0e10cSrcweir pFillAttrLB->SelectEntry( aColor ); 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir // NEU 263*cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist 264*cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntryPos() == 265*cdf0e10cSrcweir LISTBOX_ENTRY_NOTFOUND || 266*cdf0e10cSrcweir pFillAttrLB->GetSelectEntryColor() != aColor ) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); 269*cdf0e10cSrcweir String aTmpStr; 270*cdf0e10cSrcweir if( nCount > 0 ) 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir //Letzter Eintrag wird auf temporaere Farbe geprueft 273*cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); 274*cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && 275*cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 ); 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN; 281*cdf0e10cSrcweir aTmpStr += aString; 282*cdf0e10cSrcweir aTmpStr += TMP_STR_END; 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir //pFillAttrLB->SetUpdateMode( sal_False ); 285*cdf0e10cSrcweir sal_uInt16 nPos = pFillAttrLB->InsertEntry( aColor, aTmpStr ); 286*cdf0e10cSrcweir //pFillAttrLB->SetUpdateMode( sal_True ); 287*cdf0e10cSrcweir pFillAttrLB->SelectEntryPos( nPos ); 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir // NEU 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir else 292*cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir break; 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir case XFILL_GRADIENT: 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir if ( pGradientItem ) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir String aString( pGradientItem->GetName() ); 301*cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 302*cdf0e10cSrcweir // NEU 303*cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist 304*cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntry() != aString ) 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); 307*cdf0e10cSrcweir String aTmpStr; 308*cdf0e10cSrcweir if( nCount > 0 ) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir //Letzter Eintrag wird auf temporaeren Eintrag geprueft 311*cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); 312*cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && 313*cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 ); 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN; 319*cdf0e10cSrcweir aTmpStr += aString; 320*cdf0e10cSrcweir aTmpStr += TMP_STR_END; 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir XGradientEntry* pEntry = new XGradientEntry( pGradientItem->GetGradientValue(), aTmpStr ); 323*cdf0e10cSrcweir String aEmptyString = String(); 324*cdf0e10cSrcweir XGradientList aGradientList( aEmptyString ); 325*cdf0e10cSrcweir aGradientList.Insert( pEntry ); 326*cdf0e10cSrcweir aGradientList.SetDirty( sal_False ); 327*cdf0e10cSrcweir Bitmap* pBmp = aGradientList.CreateBitmapForUI( 0 ); 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir if( pBmp ) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp ); 332*cdf0e10cSrcweir pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); 333*cdf0e10cSrcweir delete pBmp; 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir aGradientList.Remove( 0 ); 337*cdf0e10cSrcweir delete pEntry; 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir // NEU 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir else 342*cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir break; 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir case XFILL_HATCH: 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir if ( pHatchItem ) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir String aString( pHatchItem->GetName() ); 351*cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 352*cdf0e10cSrcweir // NEU 353*cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist 354*cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntry() != aString ) 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); 357*cdf0e10cSrcweir String aTmpStr; 358*cdf0e10cSrcweir if( nCount > 0 ) 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir //Letzter Eintrag wird auf temporaeren Eintrag geprueft 361*cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); 362*cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && 363*cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 ); 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN; 369*cdf0e10cSrcweir aTmpStr += aString; 370*cdf0e10cSrcweir aTmpStr += TMP_STR_END; 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir XHatchEntry* pEntry = new XHatchEntry( pHatchItem->GetHatchValue(), aTmpStr ); 373*cdf0e10cSrcweir String aEmptyString = String(); 374*cdf0e10cSrcweir XHatchList aHatchList( aEmptyString ); 375*cdf0e10cSrcweir aHatchList.Insert( pEntry ); 376*cdf0e10cSrcweir aHatchList.SetDirty( sal_False ); 377*cdf0e10cSrcweir Bitmap* pBmp = aHatchList.CreateBitmapForUI( 0 ); 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir if( pBmp ) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp ); 382*cdf0e10cSrcweir pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); 383*cdf0e10cSrcweir delete pBmp; 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir aHatchList.Remove( 0 ); 387*cdf0e10cSrcweir delete pEntry; 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir // NEU 390*cdf0e10cSrcweir } 391*cdf0e10cSrcweir else 392*cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 393*cdf0e10cSrcweir } 394*cdf0e10cSrcweir break; 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir case XFILL_BITMAP: 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir if ( pBitmapItem ) 399*cdf0e10cSrcweir // && 400*cdf0e10cSrcweir // SfxObjectShell::Current() && 401*cdf0e10cSrcweir // SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) ) 402*cdf0e10cSrcweir { 403*cdf0e10cSrcweir String aString( pBitmapItem->GetName() ); 404*cdf0e10cSrcweir // Bitmap aBitmap( pBitmapItem->GetValue() ); 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir // SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( 407*cdf0e10cSrcweir // SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) ) ); 408*cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 409*cdf0e10cSrcweir // NEU 410*cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist 411*cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntry() != aString ) 412*cdf0e10cSrcweir { 413*cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); 414*cdf0e10cSrcweir String aTmpStr; 415*cdf0e10cSrcweir if( nCount > 0 ) 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir //Letzter Eintrag wird auf temporaeren Eintrag geprueft 418*cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); 419*cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && 420*cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 ); 423*cdf0e10cSrcweir } 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN; 426*cdf0e10cSrcweir aTmpStr += aString; 427*cdf0e10cSrcweir aTmpStr += TMP_STR_END; 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir XBitmapEntry* pEntry = new XBitmapEntry( pBitmapItem->GetBitmapValue(), aTmpStr ); 430*cdf0e10cSrcweir XBitmapList aBitmapList( String::CreateFromAscii("TmpList") ); 431*cdf0e10cSrcweir aBitmapList.Insert( pEntry ); 432*cdf0e10cSrcweir aBitmapList.SetDirty( sal_False ); 433*cdf0e10cSrcweir //Bitmap* pBmp = aBitmapList.GetBitmap( 0 ); 434*cdf0e10cSrcweir //( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp ); 435*cdf0e10cSrcweir pFillAttrLB->Fill( &aBitmapList ); 436*cdf0e10cSrcweir pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); 437*cdf0e10cSrcweir aBitmapList.Remove( 0 ); 438*cdf0e10cSrcweir delete pEntry; 439*cdf0e10cSrcweir } 440*cdf0e10cSrcweir // NEU 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir else 443*cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 444*cdf0e10cSrcweir } 445*cdf0e10cSrcweir break; 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir default: 448*cdf0e10cSrcweir DBG_ERROR( "Nicht unterstuetzter Flaechentyp" ); 449*cdf0e10cSrcweir break; 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir if( pState && pStyleItem ) 454*cdf0e10cSrcweir { 455*cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle) pStyleItem->GetValue(); 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir // Die Listen haben sich geaendert ? 458*cdf0e10cSrcweir if( pState->ISA( SvxColorTableItem ) && 459*cdf0e10cSrcweir eXFS == XFILL_SOLID ) 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir ::Color aTmpColor( pFillAttrLB->GetSelectEntryColor() ); 462*cdf0e10cSrcweir pFillAttrLB->Clear(); 463*cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxColorTableItem*)pState )->GetColorTable() ); 464*cdf0e10cSrcweir pFillAttrLB->SelectEntry( aTmpColor ); 465*cdf0e10cSrcweir } 466*cdf0e10cSrcweir if( pState->ISA( SvxGradientListItem ) && 467*cdf0e10cSrcweir eXFS == XFILL_GRADIENT ) 468*cdf0e10cSrcweir { 469*cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() ); 470*cdf0e10cSrcweir pFillAttrLB->Clear(); 471*cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxGradientListItem*)pState )->GetGradientList() ); 472*cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir if( pState->ISA( SvxHatchListItem ) && 475*cdf0e10cSrcweir eXFS == XFILL_HATCH ) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() ); 478*cdf0e10cSrcweir pFillAttrLB->Clear(); 479*cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxHatchListItem*)pState )->GetHatchList() ); 480*cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 481*cdf0e10cSrcweir } 482*cdf0e10cSrcweir if( pState->ISA( SvxBitmapListItem ) && 483*cdf0e10cSrcweir eXFS == XFILL_BITMAP ) 484*cdf0e10cSrcweir { 485*cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() ); 486*cdf0e10cSrcweir pFillAttrLB->Clear(); 487*cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxBitmapListItem*)pState )->GetBitmapList() ); 488*cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir } 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir //======================================================================== 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir Window* SvxFillToolBoxControl::CreateItemWindow( Window *pParent ) 496*cdf0e10cSrcweir { 497*cdf0e10cSrcweir if ( GetSlotId() == SID_ATTR_FILL_STYLE ) 498*cdf0e10cSrcweir { 499*cdf0e10cSrcweir pFillControl = new FillControl( pParent ); 500*cdf0e10cSrcweir // Damit dem FillControl das SvxFillToolBoxControl bekannt ist 501*cdf0e10cSrcweir // (und um kompatibel zu bleiben) 502*cdf0e10cSrcweir pFillControl->SetData( this ); 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir pFillAttrLB = (SvxFillAttrBox*)pFillControl->pLbFillAttr; 505*cdf0e10cSrcweir pFillTypeLB = (SvxFillTypeBox*)pFillControl->pLbFillType; 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir pFillAttrLB->SetUniqueId( HID_FILL_ATTR_LISTBOX ); 508*cdf0e10cSrcweir pFillTypeLB->SetUniqueId( HID_FILL_TYPE_LISTBOX ); 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir return pFillControl; 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir return NULL; 513*cdf0e10cSrcweir } 514*cdf0e10cSrcweir 515*cdf0e10cSrcweir /************************************************************************* 516*cdf0e10cSrcweir |* 517*cdf0e10cSrcweir |* FillControl 518*cdf0e10cSrcweir |* 519*cdf0e10cSrcweir \************************************************************************/ 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir FillControl::FillControl( Window* pParent, WinBits nStyle ) : 522*cdf0e10cSrcweir Window( pParent, nStyle | WB_DIALOGCONTROL ), 523*cdf0e10cSrcweir pLbFillType(new SvxFillTypeBox( this )), 524*cdf0e10cSrcweir aLogicalFillSize(40,80), 525*cdf0e10cSrcweir aLogicalAttrSize(50,80) 526*cdf0e10cSrcweir { 527*cdf0e10cSrcweir pLbFillAttr = new SvxFillAttrBox( this ); 528*cdf0e10cSrcweir Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT)); 529*cdf0e10cSrcweir Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT)); 530*cdf0e10cSrcweir pLbFillType->SetSizePixel(aTypeSize); 531*cdf0e10cSrcweir pLbFillAttr->SetSizePixel(aAttrSize); 532*cdf0e10cSrcweir //to get the base height 533*cdf0e10cSrcweir aTypeSize = pLbFillType->GetSizePixel(); 534*cdf0e10cSrcweir aAttrSize = pLbFillAttr->GetSizePixel(); 535*cdf0e10cSrcweir Point aAttrPnt = pLbFillAttr->GetPosPixel(); 536*cdf0e10cSrcweir SetSizePixel( 537*cdf0e10cSrcweir Size( aAttrPnt.X() + aAttrSize.Width(), 538*cdf0e10cSrcweir Max( aAttrSize.Height(), aTypeSize.Height() ) ) ); 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir pLbFillType->SetSelectHdl( LINK( this, FillControl, SelectFillTypeHdl ) ); 541*cdf0e10cSrcweir pLbFillAttr->SetSelectHdl( LINK( this, FillControl, SelectFillAttrHdl ) ); 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir aDelayTimer.SetTimeout( DELAY_TIMEOUT ); 544*cdf0e10cSrcweir aDelayTimer.SetTimeoutHdl( LINK( this, FillControl, DelayHdl ) ); 545*cdf0e10cSrcweir aDelayTimer.Start(); 546*cdf0e10cSrcweir } 547*cdf0e10cSrcweir 548*cdf0e10cSrcweir //------------------------------------------------------------------------ 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir FillControl::~FillControl() 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir delete pLbFillType; 553*cdf0e10cSrcweir delete pLbFillAttr; 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir //------------------------------------------------------------------------ 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir IMPL_LINK_INLINE_START( FillControl, DelayHdl, Timer *, EMPTYARG ) 559*cdf0e10cSrcweir { 560*cdf0e10cSrcweir SelectFillTypeHdl( NULL ); 561*cdf0e10cSrcweir ( (SvxFillToolBoxControl*)GetData() )->updateStatus( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" ))); 562*cdf0e10cSrcweir // ( (SvxFillToolBoxControl*)GetData() )->GetBindings().Invalidate( SID_ATTR_FILL_STYLE ); 563*cdf0e10cSrcweir return 0; 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir IMPL_LINK_INLINE_END( FillControl, DelayHdl, Timer *, pTimer ) 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir //------------------------------------------------------------------------ 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir IMPL_LINK( FillControl, SelectFillTypeHdl, ListBox *, pBox ) 570*cdf0e10cSrcweir { 571*cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos(); 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir // Spaeter sollte eine Optimierung derart erfolgen, dass die 574*cdf0e10cSrcweir // Listen, bzw. Tables nur dann geloescht und wieder aufgebaut 575*cdf0e10cSrcweir // werden, wenn sich die Listen, bzw. Tables tatsaechlich geaendert 576*cdf0e10cSrcweir // haben (in den LBs natuerlich). 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir if ( ( pBox && !pBox->IsTravelSelect() ) || !pBox ) 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir // Damit wir in folgendem Fall einen Status anzeigen koennen: 581*cdf0e10cSrcweir // Ein Typ wurde ausgewaehlt aber kein Attribut. 582*cdf0e10cSrcweir // Die Selektion hat genau die gleichen Attribute wie die vorherige. 583*cdf0e10cSrcweir // SvxFillToolBoxControl* pControlerItem = (SvxFillToolBoxControl*)GetData(); 584*cdf0e10cSrcweir // if( pControlerItem ) 585*cdf0e10cSrcweir // pControlerItem->ClearCache(); 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir pLbFillAttr->Clear(); 588*cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::Current(); 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir switch( eXFS ) 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir case XFILL_NONE: 593*cdf0e10cSrcweir { 594*cdf0e10cSrcweir pLbFillType->Selected(); 595*cdf0e10cSrcweir SelectFillAttrHdl( pBox ); 596*cdf0e10cSrcweir pLbFillAttr->Disable(); 597*cdf0e10cSrcweir } 598*cdf0e10cSrcweir break; 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir case XFILL_SOLID: 601*cdf0e10cSrcweir { 602*cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_COLOR_TABLE ) ) 603*cdf0e10cSrcweir { 604*cdf0e10cSrcweir SvxColorTableItem aItem( *(const SvxColorTableItem*)( 605*cdf0e10cSrcweir pSh->GetItem( SID_COLOR_TABLE ) ) ); 606*cdf0e10cSrcweir pLbFillAttr->Enable(); 607*cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetColorTable() ); 608*cdf0e10cSrcweir } 609*cdf0e10cSrcweir else 610*cdf0e10cSrcweir pLbFillAttr->Disable(); 611*cdf0e10cSrcweir } 612*cdf0e10cSrcweir break; 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir case XFILL_GRADIENT: 615*cdf0e10cSrcweir { 616*cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 617*cdf0e10cSrcweir { 618*cdf0e10cSrcweir SvxGradientListItem aItem( *(const SvxGradientListItem*)( 619*cdf0e10cSrcweir pSh->GetItem( SID_GRADIENT_LIST ) ) ); 620*cdf0e10cSrcweir pLbFillAttr->Enable(); 621*cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetGradientList() ); 622*cdf0e10cSrcweir } 623*cdf0e10cSrcweir else 624*cdf0e10cSrcweir pLbFillAttr->Disable(); 625*cdf0e10cSrcweir } 626*cdf0e10cSrcweir break; 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir case XFILL_HATCH: 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) 631*cdf0e10cSrcweir { 632*cdf0e10cSrcweir SvxHatchListItem aItem( *(const SvxHatchListItem*)( 633*cdf0e10cSrcweir pSh->GetItem( SID_HATCH_LIST ) ) ); 634*cdf0e10cSrcweir pLbFillAttr->Enable(); 635*cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetHatchList() ); 636*cdf0e10cSrcweir } 637*cdf0e10cSrcweir else 638*cdf0e10cSrcweir pLbFillAttr->Disable(); 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir break; 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir case XFILL_BITMAP: 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 645*cdf0e10cSrcweir { 646*cdf0e10cSrcweir SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( 647*cdf0e10cSrcweir pSh->GetItem( SID_BITMAP_LIST ) ) ); 648*cdf0e10cSrcweir pLbFillAttr->Enable(); 649*cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetBitmapList() ); 650*cdf0e10cSrcweir } 651*cdf0e10cSrcweir else 652*cdf0e10cSrcweir pLbFillAttr->Disable(); 653*cdf0e10cSrcweir } 654*cdf0e10cSrcweir break; 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir if( eXFS != XFILL_NONE ) // Wurde schon erledigt 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir if ( pBox ) 660*cdf0e10cSrcweir pLbFillType->Selected(); 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir // release focus 663*cdf0e10cSrcweir if ( pBox && pLbFillType->IsRelease() ) 664*cdf0e10cSrcweir { 665*cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::Current(); 666*cdf0e10cSrcweir if( pViewShell && pViewShell->GetWindow() ) 667*cdf0e10cSrcweir pViewShell->GetWindow()->GrabFocus(); 668*cdf0e10cSrcweir } 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir } 671*cdf0e10cSrcweir return 0; 672*cdf0e10cSrcweir } 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir //------------------------------------------------------------------------ 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox ) 677*cdf0e10cSrcweir { 678*cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos(); 679*cdf0e10cSrcweir XFillStyleItem aXFillStyleItem( eXFS ); 680*cdf0e10cSrcweir sal_Bool bAction = pBox && !pLbFillAttr->IsTravelSelect(); 681*cdf0e10cSrcweir 682*cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::Current(); 683*cdf0e10cSrcweir if ( bAction ) 684*cdf0e10cSrcweir { 685*cdf0e10cSrcweir Any a; 686*cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir // First set the style 689*cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" )); 690*cdf0e10cSrcweir aXFillStyleItem.QueryValue( a ); 691*cdf0e10cSrcweir aArgs[0].Value = a; 692*cdf0e10cSrcweir ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_True ); 693*cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( 694*cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" )), aArgs ); 695*cdf0e10cSrcweir ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_False ); 696*cdf0e10cSrcweir 697*cdf0e10cSrcweir switch( eXFS ) 698*cdf0e10cSrcweir { 699*cdf0e10cSrcweir case XFILL_NONE: 700*cdf0e10cSrcweir { 701*cdf0e10cSrcweir } 702*cdf0e10cSrcweir break; 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir case XFILL_SOLID: 705*cdf0e10cSrcweir { 706*cdf0e10cSrcweir // NEU 707*cdf0e10cSrcweir //Eintrag wird auf temporaere Farbe geprueft 708*cdf0e10cSrcweir String aTmpStr = pLbFillAttr->GetSelectEntry(); 709*cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir aTmpStr.Erase( aTmpStr.Len()-1, 1 ); 712*cdf0e10cSrcweir aTmpStr.Erase( 0, 1 ); 713*cdf0e10cSrcweir } 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir XFillColorItem aXFillColorItem( aTmpStr, pLbFillAttr->GetSelectEntryColor() ); 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillColor" )); 718*cdf0e10cSrcweir aXFillColorItem.QueryValue( a ); 719*cdf0e10cSrcweir aArgs[0].Value = a; 720*cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" )), 721*cdf0e10cSrcweir aArgs ); 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir break; 724*cdf0e10cSrcweir case XFILL_GRADIENT: 725*cdf0e10cSrcweir { 726*cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); 727*cdf0e10cSrcweir 728*cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 729*cdf0e10cSrcweir { 730*cdf0e10cSrcweir SvxGradientListItem aItem( 731*cdf0e10cSrcweir *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir if ( nPos < aItem.GetGradientList()->Count() ) // kein temp. Eintrag ? 734*cdf0e10cSrcweir { 735*cdf0e10cSrcweir XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient(); 736*cdf0e10cSrcweir XFillGradientItem aXFillGradientItem( pLbFillAttr->GetSelectEntry(), aGradient ); 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" )); 739*cdf0e10cSrcweir aXFillGradientItem.QueryValue( a ); 740*cdf0e10cSrcweir aArgs[0].Value = a; 741*cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillGradient" )), 742*cdf0e10cSrcweir aArgs ); 743*cdf0e10cSrcweir } 744*cdf0e10cSrcweir } 745*cdf0e10cSrcweir } 746*cdf0e10cSrcweir break; 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir case XFILL_HATCH: 749*cdf0e10cSrcweir { 750*cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); 751*cdf0e10cSrcweir 752*cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) ) 753*cdf0e10cSrcweir { 754*cdf0e10cSrcweir SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir if ( nPos < aItem.GetHatchList()->Count() ) // kein temp. Eintrag ? 757*cdf0e10cSrcweir { 758*cdf0e10cSrcweir XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch(); 759*cdf0e10cSrcweir XFillHatchItem aXFillHatchItem( pLbFillAttr->GetSelectEntry(), aHatch ); 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" )); 762*cdf0e10cSrcweir aXFillHatchItem.QueryValue( a ); 763*cdf0e10cSrcweir aArgs[0].Value = a; 764*cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillHatch" )), 765*cdf0e10cSrcweir aArgs ); 766*cdf0e10cSrcweir } 767*cdf0e10cSrcweir } 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir break; 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir case XFILL_BITMAP: 772*cdf0e10cSrcweir { 773*cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 776*cdf0e10cSrcweir { 777*cdf0e10cSrcweir SvxBitmapListItem aItem( 778*cdf0e10cSrcweir *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); 779*cdf0e10cSrcweir 780*cdf0e10cSrcweir if ( nPos < aItem.GetBitmapList()->Count() ) // kein temp. Eintrag ? 781*cdf0e10cSrcweir { 782*cdf0e10cSrcweir XOBitmap aXOBitmap = aItem.GetBitmapList()->GetBitmap( nPos )->GetXBitmap(); 783*cdf0e10cSrcweir XFillBitmapItem aXFillBitmapItem( pLbFillAttr->GetSelectEntry(), aXOBitmap ); 784*cdf0e10cSrcweir 785*cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillBitmap" )); 786*cdf0e10cSrcweir aXFillBitmapItem.QueryValue( a ); 787*cdf0e10cSrcweir aArgs[0].Value = a; 788*cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillBitmap" )), 789*cdf0e10cSrcweir aArgs ); 790*cdf0e10cSrcweir } 791*cdf0e10cSrcweir } 792*cdf0e10cSrcweir } 793*cdf0e10cSrcweir break; 794*cdf0e10cSrcweir } 795*cdf0e10cSrcweir 796*cdf0e10cSrcweir // release focus 797*cdf0e10cSrcweir if ( pLbFillAttr->IsRelease() && pBox ) 798*cdf0e10cSrcweir { 799*cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::Current(); 800*cdf0e10cSrcweir if( pViewShell && pViewShell->GetWindow() ) 801*cdf0e10cSrcweir { 802*cdf0e10cSrcweir pViewShell->GetWindow()->GrabFocus(); 803*cdf0e10cSrcweir } 804*cdf0e10cSrcweir } 805*cdf0e10cSrcweir } 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir return 0; 808*cdf0e10cSrcweir } 809*cdf0e10cSrcweir 810*cdf0e10cSrcweir //------------------------------------------------------------------------ 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir void FillControl::Resize() 813*cdf0e10cSrcweir { 814*cdf0e10cSrcweir // Breite der beiden ListBoxen nicht 1/2 : 1/2, sondern 2/5 : 3/5 815*cdf0e10cSrcweir long nW = GetOutputSizePixel().Width() / 5; 816*cdf0e10cSrcweir long nH = 180; 817*cdf0e10cSrcweir long nSep = 0; // war vorher 4 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir pLbFillType->SetSizePixel( Size( nW * 2 - nSep, nH ) ); 820*cdf0e10cSrcweir pLbFillAttr->SetPosSizePixel( Point( nW * 2 + nSep, 0 ), Size( nW * 3 - nSep, nH ) ); 821*cdf0e10cSrcweir } 822*cdf0e10cSrcweir /* -----------------------------08.03.2002 15:04------------------------------ 823*cdf0e10cSrcweir 824*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 825*cdf0e10cSrcweir 826*cdf0e10cSrcweir void FillControl::DataChanged( const DataChangedEvent& rDCEvt ) 827*cdf0e10cSrcweir { 828*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 829*cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 830*cdf0e10cSrcweir { 831*cdf0e10cSrcweir Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT)); 832*cdf0e10cSrcweir Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT)); 833*cdf0e10cSrcweir pLbFillType->SetSizePixel(aTypeSize); 834*cdf0e10cSrcweir pLbFillAttr->SetSizePixel(aAttrSize); 835*cdf0e10cSrcweir //to get the base height 836*cdf0e10cSrcweir aTypeSize = pLbFillType->GetSizePixel(); 837*cdf0e10cSrcweir aAttrSize = pLbFillAttr->GetSizePixel(); 838*cdf0e10cSrcweir Point aAttrPnt = pLbFillAttr->GetPosPixel(); 839*cdf0e10cSrcweir 840*cdf0e10cSrcweir SetSizePixel( 841*cdf0e10cSrcweir Size( aAttrPnt.X() + aAttrSize.Width(), 842*cdf0e10cSrcweir Max( aAttrSize.Height(), aTypeSize.Height() ) ) ); 843*cdf0e10cSrcweir } 844*cdf0e10cSrcweir Window::DataChanged( rDCEvt ); 845*cdf0e10cSrcweir } 846*cdf0e10cSrcweir 847