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