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 else if( pStyleItem ) 134cdf0e10cSrcweir { 135cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); 136cdf0e10cSrcweir 137cdf0e10cSrcweir if( nSID == SID_ATTR_FILL_COLOR ) 138cdf0e10cSrcweir { 139cdf0e10cSrcweir delete pColorItem; 140cdf0e10cSrcweir pColorItem = (XFillColorItem*) pState->Clone(); 141cdf0e10cSrcweir 142cdf0e10cSrcweir if( eXFS == XFILL_SOLID ) 143cdf0e10cSrcweir bEnableControls = sal_True; 144cdf0e10cSrcweir } 145cdf0e10cSrcweir else if( nSID == SID_ATTR_FILL_GRADIENT ) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir delete pGradientItem; 148cdf0e10cSrcweir pGradientItem = (XFillGradientItem*) pState->Clone(); 149cdf0e10cSrcweir 150cdf0e10cSrcweir if( eXFS == XFILL_GRADIENT ) 151cdf0e10cSrcweir bEnableControls = sal_True; 152cdf0e10cSrcweir } 153cdf0e10cSrcweir else if( nSID == SID_ATTR_FILL_HATCH ) 154cdf0e10cSrcweir { 155cdf0e10cSrcweir delete pHatchItem; 156cdf0e10cSrcweir pHatchItem = (XFillHatchItem*) pState->Clone(); 157cdf0e10cSrcweir 158cdf0e10cSrcweir if( eXFS == XFILL_HATCH ) 159cdf0e10cSrcweir bEnableControls = sal_True; 160cdf0e10cSrcweir } 161cdf0e10cSrcweir else if( nSID == SID_ATTR_FILL_BITMAP ) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir delete pBitmapItem; 164cdf0e10cSrcweir pBitmapItem = (XFillBitmapItem*) pState->Clone(); 165cdf0e10cSrcweir 166cdf0e10cSrcweir if( eXFS == XFILL_BITMAP ) 167cdf0e10cSrcweir bEnableControls = sal_True; 168cdf0e10cSrcweir } 169cdf0e10cSrcweir } 1708f1fbbb1SArmin Le Grand 1718f1fbbb1SArmin Le Grand if( pStyleItem ) 1728f1fbbb1SArmin Le Grand { 1738f1fbbb1SArmin Le Grand // ensure that the correct entry is selected in pFillTypeLB. It 1748f1fbbb1SArmin Le Grand // might have been changed by nSID == SID_ATTR_FILL_STYLE, but 1758f1fbbb1SArmin Le Grand // it might also be in an in-between state when user had started to 1768f1fbbb1SArmin Le Grand // change fillstyle, but not yet changed fillvalue for new style 1778f1fbbb1SArmin Le Grand // and when nSID == SID_ATTR_FILL_COLOR/SID_ATTR_FILL_GRADIENT/ 1788f1fbbb1SArmin Le Grand // SID_ATTR_FILL_HATCH/SID_ATTR_FILL_BITMAP value change is triggered 1798f1fbbb1SArmin Le Grand eLastXFS = pFillTypeLB->GetSelectEntryPos(); 1808f1fbbb1SArmin Le Grand XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); 1818f1fbbb1SArmin Le Grand 1828f1fbbb1SArmin Le Grand if(eLastXFS != eXFS) 1838f1fbbb1SArmin Le Grand { 1848f1fbbb1SArmin Le Grand bUpdate = sal_True; 1858f1fbbb1SArmin Le Grand pFillTypeLB->SelectEntryPos( sal::static_int_cast< sal_uInt16 >( eXFS ) ); 1868f1fbbb1SArmin Le Grand } 1878f1fbbb1SArmin Le Grand 1888f1fbbb1SArmin Le Grand pFillAttrLB->Enable(); 1898f1fbbb1SArmin Le Grand } 1908f1fbbb1SArmin Le Grand 1918f1fbbb1SArmin Le Grand if( bEnableControls ) 192cdf0e10cSrcweir { 193cdf0e10cSrcweir //pFillTypeLB->Enable(); 194cdf0e10cSrcweir pFillAttrLB->Enable(); 195cdf0e10cSrcweir 196cdf0e10cSrcweir bUpdate = sal_True; 197cdf0e10cSrcweir } 198cdf0e10cSrcweir 199cdf0e10cSrcweir Update( pState ); 200cdf0e10cSrcweir } 201cdf0e10cSrcweir else 202cdf0e10cSrcweir { 203cdf0e10cSrcweir // leerer oder uneindeutiger Status 204cdf0e10cSrcweir if( nSID == SID_ATTR_FILL_STYLE ) 205cdf0e10cSrcweir { 206cdf0e10cSrcweir pFillTypeLB->SetNoSelection(); 207cdf0e10cSrcweir pFillAttrLB->Disable(); 208cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 209cdf0e10cSrcweir bUpdate = sal_False; 210cdf0e10cSrcweir } 211cdf0e10cSrcweir else 212cdf0e10cSrcweir { 213cdf0e10cSrcweir XFillStyle eXFS = XFILL_NONE; 214cdf0e10cSrcweir if( pStyleItem ) 215cdf0e10cSrcweir eXFS = (XFillStyle)pStyleItem->GetValue(); 216cdf0e10cSrcweir if( !pStyleItem || 217cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_COLOR && eXFS == XFILL_SOLID ) || 218cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_GRADIENT && eXFS == XFILL_GRADIENT ) || 219cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_HATCH && eXFS == XFILL_HATCH ) || 220cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_BITMAP && eXFS == XFILL_BITMAP ) ) 221cdf0e10cSrcweir { 222cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 223cdf0e10cSrcweir //bUpdate = sal_False; 224cdf0e10cSrcweir } 225cdf0e10cSrcweir } 226cdf0e10cSrcweir } 227cdf0e10cSrcweir } 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir //======================================================================== 231cdf0e10cSrcweir 232cdf0e10cSrcweir void SvxFillToolBoxControl::IgnoreStatusUpdate( sal_Bool bSet ) 233cdf0e10cSrcweir { 234cdf0e10cSrcweir bIgnoreStatusUpdate = bSet; 235cdf0e10cSrcweir } 236cdf0e10cSrcweir 237cdf0e10cSrcweir //======================================================================== 238cdf0e10cSrcweir 239cdf0e10cSrcweir void SvxFillToolBoxControl::Update( const SfxPoolItem* pState ) 240cdf0e10cSrcweir { 241cdf0e10cSrcweir if ( pStyleItem && pState && bUpdate ) 242cdf0e10cSrcweir { 243cdf0e10cSrcweir bUpdate = sal_False; 244cdf0e10cSrcweir 245cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); 246cdf0e10cSrcweir 247cdf0e10cSrcweir // Pruefen, ob Fuellstil schon vorher aktiv war 248cdf0e10cSrcweir //if( eTmpXFS != eXFS ) 249cdf0e10cSrcweir if( (XFillStyle) eLastXFS != eXFS ) 250cdf0e10cSrcweir pFillControl->SelectFillTypeHdl( NULL ); 251cdf0e10cSrcweir //eLastXFS = eXFS; 252cdf0e10cSrcweir 253cdf0e10cSrcweir switch( eXFS ) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir case XFILL_NONE: 256cdf0e10cSrcweir break; 257cdf0e10cSrcweir 258cdf0e10cSrcweir case XFILL_SOLID: 259cdf0e10cSrcweir { 260cdf0e10cSrcweir if ( pColorItem ) 261cdf0e10cSrcweir { 262cdf0e10cSrcweir String aString( pColorItem->GetName() ); 263cdf0e10cSrcweir ::Color aColor = pColorItem->GetColorValue(); 264cdf0e10cSrcweir 265cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 266cdf0e10cSrcweir 267cdf0e10cSrcweir if ( pFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND || 268cdf0e10cSrcweir pFillAttrLB->GetSelectEntryColor() != aColor ) 269cdf0e10cSrcweir pFillAttrLB->SelectEntry( aColor ); 270cdf0e10cSrcweir 271cdf0e10cSrcweir // NEU 272cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist 273cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntryPos() == 274cdf0e10cSrcweir LISTBOX_ENTRY_NOTFOUND || 275cdf0e10cSrcweir pFillAttrLB->GetSelectEntryColor() != aColor ) 276cdf0e10cSrcweir { 277cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); 278cdf0e10cSrcweir String aTmpStr; 279cdf0e10cSrcweir if( nCount > 0 ) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir //Letzter Eintrag wird auf temporaere Farbe geprueft 282cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); 283cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && 284cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) 285cdf0e10cSrcweir { 286cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 ); 287cdf0e10cSrcweir } 288cdf0e10cSrcweir } 289cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN; 290cdf0e10cSrcweir aTmpStr += aString; 291cdf0e10cSrcweir aTmpStr += TMP_STR_END; 292cdf0e10cSrcweir 293cdf0e10cSrcweir //pFillAttrLB->SetUpdateMode( sal_False ); 294cdf0e10cSrcweir sal_uInt16 nPos = pFillAttrLB->InsertEntry( aColor, aTmpStr ); 295cdf0e10cSrcweir //pFillAttrLB->SetUpdateMode( sal_True ); 296cdf0e10cSrcweir pFillAttrLB->SelectEntryPos( nPos ); 297cdf0e10cSrcweir } 298cdf0e10cSrcweir // NEU 299cdf0e10cSrcweir } 300cdf0e10cSrcweir else 301cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 302cdf0e10cSrcweir } 303cdf0e10cSrcweir break; 304cdf0e10cSrcweir 305cdf0e10cSrcweir case XFILL_GRADIENT: 306cdf0e10cSrcweir { 307cdf0e10cSrcweir if ( pGradientItem ) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir String aString( pGradientItem->GetName() ); 310cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 311cdf0e10cSrcweir // NEU 312cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist 313cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntry() != aString ) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); 316cdf0e10cSrcweir String aTmpStr; 317cdf0e10cSrcweir if( nCount > 0 ) 318cdf0e10cSrcweir { 319cdf0e10cSrcweir //Letzter Eintrag wird auf temporaeren Eintrag geprueft 320cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); 321cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && 322cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 ); 325cdf0e10cSrcweir } 326cdf0e10cSrcweir } 327cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN; 328cdf0e10cSrcweir aTmpStr += aString; 329cdf0e10cSrcweir aTmpStr += TMP_STR_END; 330cdf0e10cSrcweir 331cdf0e10cSrcweir XGradientEntry* pEntry = new XGradientEntry( pGradientItem->GetGradientValue(), aTmpStr ); 332*c7be74b1SArmin Le Grand XGradientListSharedPtr aGradientList(XPropertyListFactory::CreateSharedXGradientList(String::CreateFromAscii("TmpList"))); 333*c7be74b1SArmin Le Grand 334*c7be74b1SArmin Le Grand aGradientList->Insert(pEntry); 335*c7be74b1SArmin Le Grand aGradientList->SetDirty(false); 336*c7be74b1SArmin Le Grand const Bitmap aBmp = aGradientList->GetUiBitmap( 0 ); 337cdf0e10cSrcweir 33897e8a929SArmin Le Grand if( !aBmp.IsEmpty() ) 339cdf0e10cSrcweir { 34097e8a929SArmin Le Grand ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp ); 341cdf0e10cSrcweir pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); 342cdf0e10cSrcweir } 343cdf0e10cSrcweir } 344cdf0e10cSrcweir // NEU 345cdf0e10cSrcweir } 346cdf0e10cSrcweir else 347cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir break; 350cdf0e10cSrcweir 351cdf0e10cSrcweir case XFILL_HATCH: 352cdf0e10cSrcweir { 353cdf0e10cSrcweir if ( pHatchItem ) 354cdf0e10cSrcweir { 355cdf0e10cSrcweir String aString( pHatchItem->GetName() ); 356cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 357cdf0e10cSrcweir // NEU 358cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist 359cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntry() != aString ) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); 362cdf0e10cSrcweir String aTmpStr; 363cdf0e10cSrcweir if( nCount > 0 ) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir //Letzter Eintrag wird auf temporaeren Eintrag geprueft 366cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); 367cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && 368cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) 369cdf0e10cSrcweir { 370cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 ); 371cdf0e10cSrcweir } 372cdf0e10cSrcweir } 373cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN; 374cdf0e10cSrcweir aTmpStr += aString; 375cdf0e10cSrcweir aTmpStr += TMP_STR_END; 376cdf0e10cSrcweir 377cdf0e10cSrcweir XHatchEntry* pEntry = new XHatchEntry( pHatchItem->GetHatchValue(), aTmpStr ); 378*c7be74b1SArmin Le Grand XHatchListSharedPtr aHatchList(XPropertyListFactory::CreateSharedXHatchList(String::CreateFromAscii("TmpList"))); 379*c7be74b1SArmin Le Grand 380*c7be74b1SArmin Le Grand aHatchList->Insert( pEntry ); 381*c7be74b1SArmin Le Grand aHatchList->SetDirty( sal_False ); 382*c7be74b1SArmin Le Grand const Bitmap aBmp = aHatchList->GetUiBitmap( 0 ); 383cdf0e10cSrcweir 38497e8a929SArmin Le Grand if( !aBmp.IsEmpty() ) 385cdf0e10cSrcweir { 38697e8a929SArmin Le Grand ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp ); 387cdf0e10cSrcweir pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); 388cdf0e10cSrcweir } 389cdf0e10cSrcweir } 390cdf0e10cSrcweir // NEU 391cdf0e10cSrcweir } 392cdf0e10cSrcweir else 393cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 394cdf0e10cSrcweir } 395cdf0e10cSrcweir break; 396cdf0e10cSrcweir 397cdf0e10cSrcweir case XFILL_BITMAP: 398cdf0e10cSrcweir { 399cdf0e10cSrcweir if ( pBitmapItem ) 400cdf0e10cSrcweir // && 401cdf0e10cSrcweir // SfxObjectShell::Current() && 402cdf0e10cSrcweir // SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) ) 403cdf0e10cSrcweir { 404cdf0e10cSrcweir String aString( pBitmapItem->GetName() ); 405cdf0e10cSrcweir // Bitmap aBitmap( pBitmapItem->GetValue() ); 406cdf0e10cSrcweir 407cdf0e10cSrcweir // SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( 408cdf0e10cSrcweir // SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) ) ); 409cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 410cdf0e10cSrcweir // NEU 411cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist 412cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntry() != aString ) 413cdf0e10cSrcweir { 414cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); 415cdf0e10cSrcweir String aTmpStr; 416cdf0e10cSrcweir if( nCount > 0 ) 417cdf0e10cSrcweir { 418cdf0e10cSrcweir //Letzter Eintrag wird auf temporaeren Eintrag geprueft 419cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); 420cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && 421cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 ); 424cdf0e10cSrcweir } 425cdf0e10cSrcweir } 426cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN; 427cdf0e10cSrcweir aTmpStr += aString; 428cdf0e10cSrcweir aTmpStr += TMP_STR_END; 429cdf0e10cSrcweir 430*c7be74b1SArmin Le Grand XBitmapListSharedPtr aNew(XPropertyListFactory::CreateSharedXBitmapList(String::CreateFromAscii("TmpList"))); 431*c7be74b1SArmin Le Grand aNew->Insert(new XBitmapEntry(pBitmapItem->GetGraphicObject(), aTmpStr)); 432*c7be74b1SArmin Le Grand aNew->SetDirty(false); 433*c7be74b1SArmin Le Grand 434*c7be74b1SArmin Le Grand pFillAttrLB->Fill( aNew ); 435*c7be74b1SArmin Le Grand pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); 436cdf0e10cSrcweir } 437cdf0e10cSrcweir // NEU 438cdf0e10cSrcweir } 439cdf0e10cSrcweir else 440cdf0e10cSrcweir pFillAttrLB->SetNoSelection(); 441cdf0e10cSrcweir } 442cdf0e10cSrcweir break; 443cdf0e10cSrcweir 444cdf0e10cSrcweir default: 445cdf0e10cSrcweir DBG_ERROR( "Nicht unterstuetzter Flaechentyp" ); 446cdf0e10cSrcweir break; 447cdf0e10cSrcweir } 448cdf0e10cSrcweir } 449cdf0e10cSrcweir 450cdf0e10cSrcweir if( pState && pStyleItem ) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle) pStyleItem->GetValue(); 453cdf0e10cSrcweir 454cdf0e10cSrcweir // Die Listen haben sich geaendert ? 455cdf0e10cSrcweir if( pState->ISA( SvxColorTableItem ) && 456cdf0e10cSrcweir eXFS == XFILL_SOLID ) 457cdf0e10cSrcweir { 458cdf0e10cSrcweir ::Color aTmpColor( pFillAttrLB->GetSelectEntryColor() ); 459cdf0e10cSrcweir pFillAttrLB->Clear(); 460cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxColorTableItem*)pState )->GetColorTable() ); 461cdf0e10cSrcweir pFillAttrLB->SelectEntry( aTmpColor ); 462cdf0e10cSrcweir } 463cdf0e10cSrcweir if( pState->ISA( SvxGradientListItem ) && 464cdf0e10cSrcweir eXFS == XFILL_GRADIENT ) 465cdf0e10cSrcweir { 466cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() ); 467cdf0e10cSrcweir pFillAttrLB->Clear(); 468cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxGradientListItem*)pState )->GetGradientList() ); 469cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 470cdf0e10cSrcweir } 471cdf0e10cSrcweir if( pState->ISA( SvxHatchListItem ) && 472cdf0e10cSrcweir eXFS == XFILL_HATCH ) 473cdf0e10cSrcweir { 474cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() ); 475cdf0e10cSrcweir pFillAttrLB->Clear(); 476cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxHatchListItem*)pState )->GetHatchList() ); 477cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 478cdf0e10cSrcweir } 479cdf0e10cSrcweir if( pState->ISA( SvxBitmapListItem ) && 480cdf0e10cSrcweir eXFS == XFILL_BITMAP ) 481cdf0e10cSrcweir { 482cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() ); 483cdf0e10cSrcweir pFillAttrLB->Clear(); 484cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxBitmapListItem*)pState )->GetBitmapList() ); 485cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString ); 486cdf0e10cSrcweir } 487cdf0e10cSrcweir } 488cdf0e10cSrcweir } 489cdf0e10cSrcweir 490cdf0e10cSrcweir //======================================================================== 491cdf0e10cSrcweir 492cdf0e10cSrcweir Window* SvxFillToolBoxControl::CreateItemWindow( Window *pParent ) 493cdf0e10cSrcweir { 494cdf0e10cSrcweir if ( GetSlotId() == SID_ATTR_FILL_STYLE ) 495cdf0e10cSrcweir { 496cdf0e10cSrcweir pFillControl = new FillControl( pParent ); 497cdf0e10cSrcweir // Damit dem FillControl das SvxFillToolBoxControl bekannt ist 498cdf0e10cSrcweir // (und um kompatibel zu bleiben) 499cdf0e10cSrcweir pFillControl->SetData( this ); 500cdf0e10cSrcweir 501cdf0e10cSrcweir pFillAttrLB = (SvxFillAttrBox*)pFillControl->pLbFillAttr; 502cdf0e10cSrcweir pFillTypeLB = (SvxFillTypeBox*)pFillControl->pLbFillType; 503cdf0e10cSrcweir 504cdf0e10cSrcweir pFillAttrLB->SetUniqueId( HID_FILL_ATTR_LISTBOX ); 505cdf0e10cSrcweir pFillTypeLB->SetUniqueId( HID_FILL_TYPE_LISTBOX ); 506cdf0e10cSrcweir 507cdf0e10cSrcweir return pFillControl; 508cdf0e10cSrcweir } 509cdf0e10cSrcweir return NULL; 510cdf0e10cSrcweir } 511cdf0e10cSrcweir 512cdf0e10cSrcweir /************************************************************************* 513cdf0e10cSrcweir |* 514cdf0e10cSrcweir |* FillControl 515cdf0e10cSrcweir |* 516cdf0e10cSrcweir \************************************************************************/ 517cdf0e10cSrcweir 518cdf0e10cSrcweir FillControl::FillControl( Window* pParent, WinBits nStyle ) : 519cdf0e10cSrcweir Window( pParent, nStyle | WB_DIALOGCONTROL ), 520cdf0e10cSrcweir pLbFillType(new SvxFillTypeBox( this )), 521cdf0e10cSrcweir aLogicalFillSize(40,80), 522cdf0e10cSrcweir aLogicalAttrSize(50,80) 523cdf0e10cSrcweir { 524cdf0e10cSrcweir pLbFillAttr = new SvxFillAttrBox( this ); 525cdf0e10cSrcweir Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT)); 526cdf0e10cSrcweir Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT)); 527cdf0e10cSrcweir pLbFillType->SetSizePixel(aTypeSize); 528cdf0e10cSrcweir pLbFillAttr->SetSizePixel(aAttrSize); 529cdf0e10cSrcweir //to get the base height 530cdf0e10cSrcweir aTypeSize = pLbFillType->GetSizePixel(); 531cdf0e10cSrcweir aAttrSize = pLbFillAttr->GetSizePixel(); 532cdf0e10cSrcweir Point aAttrPnt = pLbFillAttr->GetPosPixel(); 533cdf0e10cSrcweir SetSizePixel( 534cdf0e10cSrcweir Size( aAttrPnt.X() + aAttrSize.Width(), 535cdf0e10cSrcweir Max( aAttrSize.Height(), aTypeSize.Height() ) ) ); 536cdf0e10cSrcweir 537cdf0e10cSrcweir pLbFillType->SetSelectHdl( LINK( this, FillControl, SelectFillTypeHdl ) ); 538cdf0e10cSrcweir pLbFillAttr->SetSelectHdl( LINK( this, FillControl, SelectFillAttrHdl ) ); 539cdf0e10cSrcweir 540cdf0e10cSrcweir aDelayTimer.SetTimeout( DELAY_TIMEOUT ); 541cdf0e10cSrcweir aDelayTimer.SetTimeoutHdl( LINK( this, FillControl, DelayHdl ) ); 542cdf0e10cSrcweir aDelayTimer.Start(); 543cdf0e10cSrcweir } 544cdf0e10cSrcweir 545cdf0e10cSrcweir //------------------------------------------------------------------------ 546cdf0e10cSrcweir 547cdf0e10cSrcweir FillControl::~FillControl() 548cdf0e10cSrcweir { 549cdf0e10cSrcweir delete pLbFillType; 550cdf0e10cSrcweir delete pLbFillAttr; 551cdf0e10cSrcweir } 552cdf0e10cSrcweir 553cdf0e10cSrcweir //------------------------------------------------------------------------ 554cdf0e10cSrcweir 555cdf0e10cSrcweir IMPL_LINK_INLINE_START( FillControl, DelayHdl, Timer *, EMPTYARG ) 556cdf0e10cSrcweir { 557cdf0e10cSrcweir SelectFillTypeHdl( NULL ); 558cdf0e10cSrcweir ( (SvxFillToolBoxControl*)GetData() )->updateStatus( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" ))); 559cdf0e10cSrcweir // ( (SvxFillToolBoxControl*)GetData() )->GetBindings().Invalidate( SID_ATTR_FILL_STYLE ); 560cdf0e10cSrcweir return 0; 561cdf0e10cSrcweir } 562cdf0e10cSrcweir IMPL_LINK_INLINE_END( FillControl, DelayHdl, Timer *, pTimer ) 563cdf0e10cSrcweir 564cdf0e10cSrcweir //------------------------------------------------------------------------ 565cdf0e10cSrcweir 566cdf0e10cSrcweir IMPL_LINK( FillControl, SelectFillTypeHdl, ListBox *, pBox ) 567cdf0e10cSrcweir { 568cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos(); 569cdf0e10cSrcweir 570cdf0e10cSrcweir // Spaeter sollte eine Optimierung derart erfolgen, dass die 571cdf0e10cSrcweir // Listen, bzw. Tables nur dann geloescht und wieder aufgebaut 572cdf0e10cSrcweir // werden, wenn sich die Listen, bzw. Tables tatsaechlich geaendert 573cdf0e10cSrcweir // haben (in den LBs natuerlich). 574cdf0e10cSrcweir 575cdf0e10cSrcweir if ( ( pBox && !pBox->IsTravelSelect() ) || !pBox ) 576cdf0e10cSrcweir { 577cdf0e10cSrcweir // Damit wir in folgendem Fall einen Status anzeigen koennen: 578cdf0e10cSrcweir // Ein Typ wurde ausgewaehlt aber kein Attribut. 579cdf0e10cSrcweir // Die Selektion hat genau die gleichen Attribute wie die vorherige. 580cdf0e10cSrcweir // SvxFillToolBoxControl* pControlerItem = (SvxFillToolBoxControl*)GetData(); 581cdf0e10cSrcweir // if( pControlerItem ) 582cdf0e10cSrcweir // pControlerItem->ClearCache(); 583cdf0e10cSrcweir 584cdf0e10cSrcweir pLbFillAttr->Clear(); 585cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::Current(); 586cdf0e10cSrcweir 587cdf0e10cSrcweir switch( eXFS ) 588cdf0e10cSrcweir { 589cdf0e10cSrcweir case XFILL_NONE: 590cdf0e10cSrcweir { 591cdf0e10cSrcweir pLbFillType->Selected(); 592cdf0e10cSrcweir SelectFillAttrHdl( pBox ); 593cdf0e10cSrcweir pLbFillAttr->Disable(); 594cdf0e10cSrcweir } 595cdf0e10cSrcweir break; 596cdf0e10cSrcweir 597cdf0e10cSrcweir case XFILL_SOLID: 598cdf0e10cSrcweir { 599cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_COLOR_TABLE ) ) 600cdf0e10cSrcweir { 601cdf0e10cSrcweir SvxColorTableItem aItem( *(const SvxColorTableItem*)( 602cdf0e10cSrcweir pSh->GetItem( SID_COLOR_TABLE ) ) ); 603cdf0e10cSrcweir pLbFillAttr->Enable(); 604cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetColorTable() ); 605cdf0e10cSrcweir } 606cdf0e10cSrcweir else 607cdf0e10cSrcweir pLbFillAttr->Disable(); 608cdf0e10cSrcweir } 609cdf0e10cSrcweir break; 610cdf0e10cSrcweir 611cdf0e10cSrcweir case XFILL_GRADIENT: 612cdf0e10cSrcweir { 613cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 614cdf0e10cSrcweir { 615cdf0e10cSrcweir SvxGradientListItem aItem( *(const SvxGradientListItem*)( 616cdf0e10cSrcweir pSh->GetItem( SID_GRADIENT_LIST ) ) ); 617cdf0e10cSrcweir pLbFillAttr->Enable(); 618cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetGradientList() ); 619cdf0e10cSrcweir } 620cdf0e10cSrcweir else 621cdf0e10cSrcweir pLbFillAttr->Disable(); 622cdf0e10cSrcweir } 623cdf0e10cSrcweir break; 624cdf0e10cSrcweir 625cdf0e10cSrcweir case XFILL_HATCH: 626cdf0e10cSrcweir { 627cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) 628cdf0e10cSrcweir { 629cdf0e10cSrcweir SvxHatchListItem aItem( *(const SvxHatchListItem*)( 630cdf0e10cSrcweir pSh->GetItem( SID_HATCH_LIST ) ) ); 631cdf0e10cSrcweir pLbFillAttr->Enable(); 632cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetHatchList() ); 633cdf0e10cSrcweir } 634cdf0e10cSrcweir else 635cdf0e10cSrcweir pLbFillAttr->Disable(); 636cdf0e10cSrcweir } 637cdf0e10cSrcweir break; 638cdf0e10cSrcweir 639cdf0e10cSrcweir case XFILL_BITMAP: 640cdf0e10cSrcweir { 641cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 642cdf0e10cSrcweir { 643cdf0e10cSrcweir SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( 644cdf0e10cSrcweir pSh->GetItem( SID_BITMAP_LIST ) ) ); 645cdf0e10cSrcweir pLbFillAttr->Enable(); 646cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetBitmapList() ); 647cdf0e10cSrcweir } 648cdf0e10cSrcweir else 649cdf0e10cSrcweir pLbFillAttr->Disable(); 650cdf0e10cSrcweir } 651cdf0e10cSrcweir break; 652cdf0e10cSrcweir } 653cdf0e10cSrcweir 654cdf0e10cSrcweir if( eXFS != XFILL_NONE ) // Wurde schon erledigt 655cdf0e10cSrcweir { 656cdf0e10cSrcweir if ( pBox ) 657cdf0e10cSrcweir pLbFillType->Selected(); 658cdf0e10cSrcweir 659cdf0e10cSrcweir // release focus 660cdf0e10cSrcweir if ( pBox && pLbFillType->IsRelease() ) 661cdf0e10cSrcweir { 662cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::Current(); 663cdf0e10cSrcweir if( pViewShell && pViewShell->GetWindow() ) 664cdf0e10cSrcweir pViewShell->GetWindow()->GrabFocus(); 665cdf0e10cSrcweir } 666cdf0e10cSrcweir } 667cdf0e10cSrcweir } 668cdf0e10cSrcweir return 0; 669cdf0e10cSrcweir } 670cdf0e10cSrcweir 671cdf0e10cSrcweir //------------------------------------------------------------------------ 672cdf0e10cSrcweir 673cdf0e10cSrcweir IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox ) 674cdf0e10cSrcweir { 675cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos(); 676cdf0e10cSrcweir XFillStyleItem aXFillStyleItem( eXFS ); 677cdf0e10cSrcweir sal_Bool bAction = pBox && !pLbFillAttr->IsTravelSelect(); 678cdf0e10cSrcweir 679cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::Current(); 680cdf0e10cSrcweir if ( bAction ) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir Any a; 683cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 ); 684cdf0e10cSrcweir 685cdf0e10cSrcweir // First set the style 686cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" )); 687cdf0e10cSrcweir aXFillStyleItem.QueryValue( a ); 688cdf0e10cSrcweir aArgs[0].Value = a; 689cdf0e10cSrcweir ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_True ); 690cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( 691cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" )), aArgs ); 692cdf0e10cSrcweir ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_False ); 693cdf0e10cSrcweir 694cdf0e10cSrcweir switch( eXFS ) 695cdf0e10cSrcweir { 696cdf0e10cSrcweir case XFILL_NONE: 697cdf0e10cSrcweir { 698cdf0e10cSrcweir } 699cdf0e10cSrcweir break; 700cdf0e10cSrcweir 701cdf0e10cSrcweir case XFILL_SOLID: 702cdf0e10cSrcweir { 703cdf0e10cSrcweir // NEU 704cdf0e10cSrcweir //Eintrag wird auf temporaere Farbe geprueft 705cdf0e10cSrcweir String aTmpStr = pLbFillAttr->GetSelectEntry(); 706cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) 707cdf0e10cSrcweir { 708cdf0e10cSrcweir aTmpStr.Erase( aTmpStr.Len()-1, 1 ); 709cdf0e10cSrcweir aTmpStr.Erase( 0, 1 ); 710cdf0e10cSrcweir } 711cdf0e10cSrcweir 712cdf0e10cSrcweir XFillColorItem aXFillColorItem( aTmpStr, pLbFillAttr->GetSelectEntryColor() ); 713cdf0e10cSrcweir 714cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillColor" )); 715cdf0e10cSrcweir aXFillColorItem.QueryValue( a ); 716cdf0e10cSrcweir aArgs[0].Value = a; 717cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" )), 718cdf0e10cSrcweir aArgs ); 719cdf0e10cSrcweir } 720cdf0e10cSrcweir break; 721cdf0e10cSrcweir case XFILL_GRADIENT: 722cdf0e10cSrcweir { 723cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); 724cdf0e10cSrcweir 725cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 726cdf0e10cSrcweir { 727cdf0e10cSrcweir SvxGradientListItem aItem( 728cdf0e10cSrcweir *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); 729cdf0e10cSrcweir 730cdf0e10cSrcweir if ( nPos < aItem.GetGradientList()->Count() ) // kein temp. Eintrag ? 731cdf0e10cSrcweir { 732cdf0e10cSrcweir XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient(); 733cdf0e10cSrcweir XFillGradientItem aXFillGradientItem( pLbFillAttr->GetSelectEntry(), aGradient ); 734cdf0e10cSrcweir 735cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" )); 736cdf0e10cSrcweir aXFillGradientItem.QueryValue( a ); 737cdf0e10cSrcweir aArgs[0].Value = a; 738cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillGradient" )), 739cdf0e10cSrcweir aArgs ); 740cdf0e10cSrcweir } 741cdf0e10cSrcweir } 742cdf0e10cSrcweir } 743cdf0e10cSrcweir break; 744cdf0e10cSrcweir 745cdf0e10cSrcweir case XFILL_HATCH: 746cdf0e10cSrcweir { 747cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); 748cdf0e10cSrcweir 749cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) ) 750cdf0e10cSrcweir { 751cdf0e10cSrcweir SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); 752cdf0e10cSrcweir 753cdf0e10cSrcweir if ( nPos < aItem.GetHatchList()->Count() ) // kein temp. Eintrag ? 754cdf0e10cSrcweir { 755cdf0e10cSrcweir XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch(); 756cdf0e10cSrcweir XFillHatchItem aXFillHatchItem( pLbFillAttr->GetSelectEntry(), aHatch ); 757cdf0e10cSrcweir 758cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" )); 759cdf0e10cSrcweir aXFillHatchItem.QueryValue( a ); 760cdf0e10cSrcweir aArgs[0].Value = a; 761cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillHatch" )), 762cdf0e10cSrcweir aArgs ); 763cdf0e10cSrcweir } 764cdf0e10cSrcweir } 765cdf0e10cSrcweir } 766cdf0e10cSrcweir break; 767cdf0e10cSrcweir 768cdf0e10cSrcweir case XFILL_BITMAP: 769cdf0e10cSrcweir { 770cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); 771cdf0e10cSrcweir 772cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 773cdf0e10cSrcweir { 774cdf0e10cSrcweir SvxBitmapListItem aItem( 775cdf0e10cSrcweir *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); 776cdf0e10cSrcweir 777cdf0e10cSrcweir if ( nPos < aItem.GetBitmapList()->Count() ) // kein temp. Eintrag ? 778cdf0e10cSrcweir { 77970d3707aSArmin Le Grand const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos); 78070d3707aSArmin Le Grand const XFillBitmapItem aXFillBitmapItem(pLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject()); 781cdf0e10cSrcweir 782cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillBitmap" )); 783cdf0e10cSrcweir aXFillBitmapItem.QueryValue( a ); 784cdf0e10cSrcweir aArgs[0].Value = a; 78570d3707aSArmin Le Grand ((SvxFillToolBoxControl*)GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillBitmap")), 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