1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10f6e50924SAndrew Rist * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12f6e50924SAndrew Rist * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19f6e50924SAndrew Rist * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew 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 425*70d3707aSArmin Le Grand XBitmapEntry* pEntry = new XBitmapEntry(pBitmapItem->GetGraphicObject(), aTmpStr); 426cdf0e10cSrcweir XBitmapList aBitmapList( String::CreateFromAscii("TmpList") ); 427cdf0e10cSrcweir aBitmapList.Insert( pEntry ); 428cdf0e10cSrcweir aBitmapList.SetDirty( sal_False ); 429cdf0e10cSrcweir pFillAttrLB->Fill( &aBitmapList ); 430cdf0e10cSrcweir pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); 431cdf0e10cSrcweir aBitmapList.Remove( 0 ); 432cdf0e10cSrcweir delete pEntry; 433cdf0e10cSrcweir } 434cdf0e10cSrcweir // NEU 435cdf0e10cSrcweir } 436cdf0e10cSrcweir else 437cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 438cdf0e10cSrcweir } 439cdf0e10cSrcweir break; 440cdf0e10cSrcweir 441cdf0e10cSrcweir default: 442cdf0e10cSrcweir DBG_ERROR( "Nicht unterstuetzter Flaechentyp" ); 443cdf0e10cSrcweir break; 444cdf0e10cSrcweir } 445cdf0e10cSrcweir } 446cdf0e10cSrcweir 447cdf0e10cSrcweir if( pState && pStyleItem ) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle) pStyleItem->GetValue(); 450cdf0e10cSrcweir 451cdf0e10cSrcweir // Die Listen haben sich geaendert ? 452cdf0e10cSrcweir if( pState->ISA( SvxColorTableItem ) && 453cdf0e10cSrcweir eXFS == XFILL_SOLID ) 454cdf0e10cSrcweir { 455cdf0e10cSrcweir ::Color aTmpColor( pFillAttrLB->GetSelectEntryColor() ); 456cdf0e10cSrcweir pFillAttrLB->Clear(); 457cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxColorTableItem*)pState )->GetColorTable() ); 458cdf0e10cSrcweir pFillAttrLB->SelectEntry( aTmpColor ); 459cdf0e10cSrcweir } 460cdf0e10cSrcweir if( pState->ISA( SvxGradientListItem ) && 461cdf0e10cSrcweir eXFS == XFILL_GRADIENT ) 462cdf0e10cSrcweir { 463cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() ); 464cdf0e10cSrcweir pFillAttrLB->Clear(); 465cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxGradientListItem*)pState )->GetGradientList() ); 466cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 467cdf0e10cSrcweir } 468cdf0e10cSrcweir if( pState->ISA( SvxHatchListItem ) && 469cdf0e10cSrcweir eXFS == XFILL_HATCH ) 470cdf0e10cSrcweir { 471cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() ); 472cdf0e10cSrcweir pFillAttrLB->Clear(); 473cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxHatchListItem*)pState )->GetHatchList() ); 474cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 475cdf0e10cSrcweir } 476cdf0e10cSrcweir if( pState->ISA( SvxBitmapListItem ) && 477cdf0e10cSrcweir eXFS == XFILL_BITMAP ) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() ); 480cdf0e10cSrcweir pFillAttrLB->Clear(); 481cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxBitmapListItem*)pState )->GetBitmapList() ); 482cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 483cdf0e10cSrcweir } 484cdf0e10cSrcweir } 485cdf0e10cSrcweir } 486cdf0e10cSrcweir 487cdf0e10cSrcweir //======================================================================== 488cdf0e10cSrcweir 489cdf0e10cSrcweir Window* SvxFillToolBoxControl::CreateItemWindow( Window *pParent ) 490cdf0e10cSrcweir { 491cdf0e10cSrcweir if ( GetSlotId() == SID_ATTR_FILL_STYLE ) 492cdf0e10cSrcweir { 493cdf0e10cSrcweir pFillControl = new FillControl( pParent ); 494cdf0e10cSrcweir // Damit dem FillControl das SvxFillToolBoxControl bekannt ist 495cdf0e10cSrcweir // (und um kompatibel zu bleiben) 496cdf0e10cSrcweir pFillControl->SetData( this ); 497cdf0e10cSrcweir 498cdf0e10cSrcweir pFillAttrLB = (SvxFillAttrBox*)pFillControl->pLbFillAttr; 499cdf0e10cSrcweir pFillTypeLB = (SvxFillTypeBox*)pFillControl->pLbFillType; 500cdf0e10cSrcweir 501cdf0e10cSrcweir pFillAttrLB->SetUniqueId( HID_FILL_ATTR_LISTBOX ); 502cdf0e10cSrcweir pFillTypeLB->SetUniqueId( HID_FILL_TYPE_LISTBOX ); 503cdf0e10cSrcweir 504cdf0e10cSrcweir return pFillControl; 505cdf0e10cSrcweir } 506cdf0e10cSrcweir return NULL; 507cdf0e10cSrcweir } 508cdf0e10cSrcweir 509cdf0e10cSrcweir /************************************************************************* 510cdf0e10cSrcweir |* 511cdf0e10cSrcweir |* FillControl 512cdf0e10cSrcweir |* 513cdf0e10cSrcweir \************************************************************************/ 514cdf0e10cSrcweir 515cdf0e10cSrcweir FillControl::FillControl( Window* pParent, WinBits nStyle ) : 516cdf0e10cSrcweir Window( pParent, nStyle | WB_DIALOGCONTROL ), 517cdf0e10cSrcweir pLbFillType(new SvxFillTypeBox( this )), 518cdf0e10cSrcweir aLogicalFillSize(40,80), 519cdf0e10cSrcweir aLogicalAttrSize(50,80) 520cdf0e10cSrcweir { 521cdf0e10cSrcweir pLbFillAttr = new SvxFillAttrBox( this ); 522cdf0e10cSrcweir Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT)); 523cdf0e10cSrcweir Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT)); 524cdf0e10cSrcweir pLbFillType->SetSizePixel(aTypeSize); 525cdf0e10cSrcweir pLbFillAttr->SetSizePixel(aAttrSize); 526cdf0e10cSrcweir //to get the base height 527cdf0e10cSrcweir aTypeSize = pLbFillType->GetSizePixel(); 528cdf0e10cSrcweir aAttrSize = pLbFillAttr->GetSizePixel(); 529cdf0e10cSrcweir Point aAttrPnt = pLbFillAttr->GetPosPixel(); 530cdf0e10cSrcweir SetSizePixel( 531cdf0e10cSrcweir Size( aAttrPnt.X() + aAttrSize.Width(), 532cdf0e10cSrcweir Max( aAttrSize.Height(), aTypeSize.Height() ) ) ); 533cdf0e10cSrcweir 534cdf0e10cSrcweir pLbFillType->SetSelectHdl( LINK( this, FillControl, SelectFillTypeHdl ) ); 535cdf0e10cSrcweir pLbFillAttr->SetSelectHdl( LINK( this, FillControl, SelectFillAttrHdl ) ); 536cdf0e10cSrcweir 537cdf0e10cSrcweir aDelayTimer.SetTimeout( DELAY_TIMEOUT ); 538cdf0e10cSrcweir aDelayTimer.SetTimeoutHdl( LINK( this, FillControl, DelayHdl ) ); 539cdf0e10cSrcweir aDelayTimer.Start(); 540cdf0e10cSrcweir } 541cdf0e10cSrcweir 542cdf0e10cSrcweir //------------------------------------------------------------------------ 543cdf0e10cSrcweir 544cdf0e10cSrcweir FillControl::~FillControl() 545cdf0e10cSrcweir { 546cdf0e10cSrcweir delete pLbFillType; 547cdf0e10cSrcweir delete pLbFillAttr; 548cdf0e10cSrcweir } 549cdf0e10cSrcweir 550cdf0e10cSrcweir //------------------------------------------------------------------------ 551cdf0e10cSrcweir 552cdf0e10cSrcweir IMPL_LINK_INLINE_START( FillControl, DelayHdl, Timer *, EMPTYARG ) 553cdf0e10cSrcweir { 554cdf0e10cSrcweir SelectFillTypeHdl( NULL ); 555cdf0e10cSrcweir ( (SvxFillToolBoxControl*)GetData() )->updateStatus( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" ))); 556cdf0e10cSrcweir // ( (SvxFillToolBoxControl*)GetData() )->GetBindings().Invalidate( SID_ATTR_FILL_STYLE ); 557cdf0e10cSrcweir return 0; 558cdf0e10cSrcweir } 559cdf0e10cSrcweir IMPL_LINK_INLINE_END( FillControl, DelayHdl, Timer *, pTimer ) 560cdf0e10cSrcweir 561cdf0e10cSrcweir //------------------------------------------------------------------------ 562cdf0e10cSrcweir 563cdf0e10cSrcweir IMPL_LINK( FillControl, SelectFillTypeHdl, ListBox *, pBox ) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos(); 566cdf0e10cSrcweir 567cdf0e10cSrcweir // Spaeter sollte eine Optimierung derart erfolgen, dass die 568cdf0e10cSrcweir // Listen, bzw. Tables nur dann geloescht und wieder aufgebaut 569cdf0e10cSrcweir // werden, wenn sich die Listen, bzw. Tables tatsaechlich geaendert 570cdf0e10cSrcweir // haben (in den LBs natuerlich). 571cdf0e10cSrcweir 572cdf0e10cSrcweir if ( ( pBox && !pBox->IsTravelSelect() ) || !pBox ) 573cdf0e10cSrcweir { 574cdf0e10cSrcweir // Damit wir in folgendem Fall einen Status anzeigen koennen: 575cdf0e10cSrcweir // Ein Typ wurde ausgewaehlt aber kein Attribut. 576cdf0e10cSrcweir // Die Selektion hat genau die gleichen Attribute wie die vorherige. 577cdf0e10cSrcweir // SvxFillToolBoxControl* pControlerItem = (SvxFillToolBoxControl*)GetData(); 578cdf0e10cSrcweir // if( pControlerItem ) 579cdf0e10cSrcweir // pControlerItem->ClearCache(); 580cdf0e10cSrcweir 581cdf0e10cSrcweir pLbFillAttr->Clear(); 582cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::Current(); 583cdf0e10cSrcweir 584cdf0e10cSrcweir switch( eXFS ) 585cdf0e10cSrcweir { 586cdf0e10cSrcweir case XFILL_NONE: 587cdf0e10cSrcweir { 588cdf0e10cSrcweir pLbFillType->Selected(); 589cdf0e10cSrcweir SelectFillAttrHdl( pBox ); 590cdf0e10cSrcweir pLbFillAttr->Disable(); 591cdf0e10cSrcweir } 592cdf0e10cSrcweir break; 593cdf0e10cSrcweir 594cdf0e10cSrcweir case XFILL_SOLID: 595cdf0e10cSrcweir { 596cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_COLOR_TABLE ) ) 597cdf0e10cSrcweir { 598cdf0e10cSrcweir SvxColorTableItem aItem( *(const SvxColorTableItem*)( 599cdf0e10cSrcweir pSh->GetItem( SID_COLOR_TABLE ) ) ); 600cdf0e10cSrcweir pLbFillAttr->Enable(); 601cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetColorTable() ); 602cdf0e10cSrcweir } 603cdf0e10cSrcweir else 604cdf0e10cSrcweir pLbFillAttr->Disable(); 605cdf0e10cSrcweir } 606cdf0e10cSrcweir break; 607cdf0e10cSrcweir 608cdf0e10cSrcweir case XFILL_GRADIENT: 609cdf0e10cSrcweir { 610cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 611cdf0e10cSrcweir { 612cdf0e10cSrcweir SvxGradientListItem aItem( *(const SvxGradientListItem*)( 613cdf0e10cSrcweir pSh->GetItem( SID_GRADIENT_LIST ) ) ); 614cdf0e10cSrcweir pLbFillAttr->Enable(); 615cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetGradientList() ); 616cdf0e10cSrcweir } 617cdf0e10cSrcweir else 618cdf0e10cSrcweir pLbFillAttr->Disable(); 619cdf0e10cSrcweir } 620cdf0e10cSrcweir break; 621cdf0e10cSrcweir 622cdf0e10cSrcweir case XFILL_HATCH: 623cdf0e10cSrcweir { 624cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) 625cdf0e10cSrcweir { 626cdf0e10cSrcweir SvxHatchListItem aItem( *(const SvxHatchListItem*)( 627cdf0e10cSrcweir pSh->GetItem( SID_HATCH_LIST ) ) ); 628cdf0e10cSrcweir pLbFillAttr->Enable(); 629cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetHatchList() ); 630cdf0e10cSrcweir } 631cdf0e10cSrcweir else 632cdf0e10cSrcweir pLbFillAttr->Disable(); 633cdf0e10cSrcweir } 634cdf0e10cSrcweir break; 635cdf0e10cSrcweir 636cdf0e10cSrcweir case XFILL_BITMAP: 637cdf0e10cSrcweir { 638cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 639cdf0e10cSrcweir { 640cdf0e10cSrcweir SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( 641cdf0e10cSrcweir pSh->GetItem( SID_BITMAP_LIST ) ) ); 642cdf0e10cSrcweir pLbFillAttr->Enable(); 643cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetBitmapList() ); 644cdf0e10cSrcweir } 645cdf0e10cSrcweir else 646cdf0e10cSrcweir pLbFillAttr->Disable(); 647cdf0e10cSrcweir } 648cdf0e10cSrcweir break; 649cdf0e10cSrcweir } 650cdf0e10cSrcweir 651cdf0e10cSrcweir if( eXFS != XFILL_NONE ) // Wurde schon erledigt 652cdf0e10cSrcweir { 653cdf0e10cSrcweir if ( pBox ) 654cdf0e10cSrcweir pLbFillType->Selected(); 655cdf0e10cSrcweir 656cdf0e10cSrcweir // release focus 657cdf0e10cSrcweir if ( pBox && pLbFillType->IsRelease() ) 658cdf0e10cSrcweir { 659cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::Current(); 660cdf0e10cSrcweir if( pViewShell && pViewShell->GetWindow() ) 661cdf0e10cSrcweir pViewShell->GetWindow()->GrabFocus(); 662cdf0e10cSrcweir } 663cdf0e10cSrcweir } 664cdf0e10cSrcweir } 665cdf0e10cSrcweir return 0; 666cdf0e10cSrcweir } 667cdf0e10cSrcweir 668cdf0e10cSrcweir //------------------------------------------------------------------------ 669cdf0e10cSrcweir 670cdf0e10cSrcweir IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox ) 671cdf0e10cSrcweir { 672cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos(); 673cdf0e10cSrcweir XFillStyleItem aXFillStyleItem( eXFS ); 674cdf0e10cSrcweir sal_Bool bAction = pBox && !pLbFillAttr->IsTravelSelect(); 675cdf0e10cSrcweir 676cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::Current(); 677cdf0e10cSrcweir if ( bAction ) 678cdf0e10cSrcweir { 679cdf0e10cSrcweir Any a; 680cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 681cdf0e10cSrcweir 682cdf0e10cSrcweir // First set the style 683cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" )); 684cdf0e10cSrcweir aXFillStyleItem.QueryValue( a ); 685cdf0e10cSrcweir aArgs[0].Value = a; 686cdf0e10cSrcweir ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_True ); 687cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( 688cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" )), aArgs ); 689cdf0e10cSrcweir ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_False ); 690cdf0e10cSrcweir 691cdf0e10cSrcweir switch( eXFS ) 692cdf0e10cSrcweir { 693cdf0e10cSrcweir case XFILL_NONE: 694cdf0e10cSrcweir { 695cdf0e10cSrcweir } 696cdf0e10cSrcweir break; 697cdf0e10cSrcweir 698cdf0e10cSrcweir case XFILL_SOLID: 699cdf0e10cSrcweir { 700cdf0e10cSrcweir // NEU 701cdf0e10cSrcweir //Eintrag wird auf temporaere Farbe geprueft 702cdf0e10cSrcweir String aTmpStr = pLbFillAttr->GetSelectEntry(); 703cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) 704cdf0e10cSrcweir { 705cdf0e10cSrcweir aTmpStr.Erase( aTmpStr.Len()-1, 1 ); 706cdf0e10cSrcweir aTmpStr.Erase( 0, 1 ); 707cdf0e10cSrcweir } 708cdf0e10cSrcweir 709cdf0e10cSrcweir XFillColorItem aXFillColorItem( aTmpStr, pLbFillAttr->GetSelectEntryColor() ); 710cdf0e10cSrcweir 711cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillColor" )); 712cdf0e10cSrcweir aXFillColorItem.QueryValue( a ); 713cdf0e10cSrcweir aArgs[0].Value = a; 714cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" )), 715cdf0e10cSrcweir aArgs ); 716cdf0e10cSrcweir } 717cdf0e10cSrcweir break; 718cdf0e10cSrcweir case XFILL_GRADIENT: 719cdf0e10cSrcweir { 720cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); 721cdf0e10cSrcweir 722cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 723cdf0e10cSrcweir { 724cdf0e10cSrcweir SvxGradientListItem aItem( 725cdf0e10cSrcweir *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); 726cdf0e10cSrcweir 727cdf0e10cSrcweir if ( nPos < aItem.GetGradientList()->Count() ) // kein temp. Eintrag ? 728cdf0e10cSrcweir { 729cdf0e10cSrcweir XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient(); 730cdf0e10cSrcweir XFillGradientItem aXFillGradientItem( pLbFillAttr->GetSelectEntry(), aGradient ); 731cdf0e10cSrcweir 732cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" )); 733cdf0e10cSrcweir aXFillGradientItem.QueryValue( a ); 734cdf0e10cSrcweir aArgs[0].Value = a; 735cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillGradient" )), 736cdf0e10cSrcweir aArgs ); 737cdf0e10cSrcweir } 738cdf0e10cSrcweir } 739cdf0e10cSrcweir } 740cdf0e10cSrcweir break; 741cdf0e10cSrcweir 742cdf0e10cSrcweir case XFILL_HATCH: 743cdf0e10cSrcweir { 744cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); 745cdf0e10cSrcweir 746cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) ) 747cdf0e10cSrcweir { 748cdf0e10cSrcweir SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); 749cdf0e10cSrcweir 750cdf0e10cSrcweir if ( nPos < aItem.GetHatchList()->Count() ) // kein temp. Eintrag ? 751cdf0e10cSrcweir { 752cdf0e10cSrcweir XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch(); 753cdf0e10cSrcweir XFillHatchItem aXFillHatchItem( pLbFillAttr->GetSelectEntry(), aHatch ); 754cdf0e10cSrcweir 755cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" )); 756cdf0e10cSrcweir aXFillHatchItem.QueryValue( a ); 757cdf0e10cSrcweir aArgs[0].Value = a; 758cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillHatch" )), 759cdf0e10cSrcweir aArgs ); 760cdf0e10cSrcweir } 761cdf0e10cSrcweir } 762cdf0e10cSrcweir } 763cdf0e10cSrcweir break; 764cdf0e10cSrcweir 765cdf0e10cSrcweir case XFILL_BITMAP: 766cdf0e10cSrcweir { 767cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); 768cdf0e10cSrcweir 769cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 770cdf0e10cSrcweir { 771cdf0e10cSrcweir SvxBitmapListItem aItem( 772cdf0e10cSrcweir *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); 773cdf0e10cSrcweir 774cdf0e10cSrcweir if ( nPos < aItem.GetBitmapList()->Count() ) // kein temp. Eintrag ? 775cdf0e10cSrcweir { 776*70d3707aSArmin Le Grand const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos); 777*70d3707aSArmin Le Grand const XFillBitmapItem aXFillBitmapItem(pLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject()); 778cdf0e10cSrcweir 779cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillBitmap" )); 780cdf0e10cSrcweir aXFillBitmapItem.QueryValue( a ); 781cdf0e10cSrcweir aArgs[0].Value = a; 782*70d3707aSArmin Le Grand ((SvxFillToolBoxControl*)GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillBitmap")), aArgs); 783cdf0e10cSrcweir } 784cdf0e10cSrcweir } 785cdf0e10cSrcweir } 786cdf0e10cSrcweir break; 787cdf0e10cSrcweir } 788cdf0e10cSrcweir 789cdf0e10cSrcweir // release focus 790cdf0e10cSrcweir if ( pLbFillAttr->IsRelease() && pBox ) 791cdf0e10cSrcweir { 792cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::Current(); 793cdf0e10cSrcweir if( pViewShell && pViewShell->GetWindow() ) 794cdf0e10cSrcweir { 795cdf0e10cSrcweir pViewShell->GetWindow()->GrabFocus(); 796cdf0e10cSrcweir } 797cdf0e10cSrcweir } 798cdf0e10cSrcweir } 799cdf0e10cSrcweir 800cdf0e10cSrcweir return 0; 801cdf0e10cSrcweir } 802cdf0e10cSrcweir 803cdf0e10cSrcweir //------------------------------------------------------------------------ 804cdf0e10cSrcweir 805cdf0e10cSrcweir void FillControl::Resize() 806cdf0e10cSrcweir { 807cdf0e10cSrcweir // Breite der beiden ListBoxen nicht 1/2 : 1/2, sondern 2/5 : 3/5 808cdf0e10cSrcweir long nW = GetOutputSizePixel().Width() / 5; 809cdf0e10cSrcweir long nH = 180; 810cdf0e10cSrcweir long nSep = 0; // war vorher 4 811cdf0e10cSrcweir 812cdf0e10cSrcweir pLbFillType->SetSizePixel( Size( nW * 2 - nSep, nH ) ); 813cdf0e10cSrcweir pLbFillAttr->SetPosSizePixel( Point( nW * 2 + nSep, 0 ), Size( nW * 3 - nSep, nH ) ); 814cdf0e10cSrcweir } 815cdf0e10cSrcweir /* -----------------------------08.03.2002 15:04------------------------------ 816cdf0e10cSrcweir 817cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 818cdf0e10cSrcweir 819cdf0e10cSrcweir void FillControl::DataChanged( const DataChangedEvent& rDCEvt ) 820cdf0e10cSrcweir { 821cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 822cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 823cdf0e10cSrcweir { 824cdf0e10cSrcweir Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT)); 825cdf0e10cSrcweir Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT)); 826cdf0e10cSrcweir pLbFillType->SetSizePixel(aTypeSize); 827cdf0e10cSrcweir pLbFillAttr->SetSizePixel(aAttrSize); 828cdf0e10cSrcweir //to get the base height 829cdf0e10cSrcweir aTypeSize = pLbFillType->GetSizePixel(); 830cdf0e10cSrcweir aAttrSize = pLbFillAttr->GetSizePixel(); 831cdf0e10cSrcweir Point aAttrPnt = pLbFillAttr->GetPosPixel(); 832cdf0e10cSrcweir 833cdf0e10cSrcweir SetSizePixel( 834cdf0e10cSrcweir Size( aAttrPnt.X() + aAttrSize.Width(), 835cdf0e10cSrcweir Max( aAttrSize.Height(), aTypeSize.Height() ) ) ); 836cdf0e10cSrcweir } 837cdf0e10cSrcweir Window::DataChanged( rDCEvt ); 838cdf0e10cSrcweir } 839cdf0e10cSrcweir 840