1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_cui.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir // include --------------------------------------------------------------- 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir //svdraw.hxx 34*cdf0e10cSrcweir #define _SVDRAW_HXX 35*cdf0e10cSrcweir #define _SDR_NOITEMS 36*cdf0e10cSrcweir #define _SDR_NOTOUCH 37*cdf0e10cSrcweir #define _SDR_NOTRANSFORM 38*cdf0e10cSrcweir #define _SDR_NOOBJECTS 39*cdf0e10cSrcweir #define _SDR_NOVIEWS 40*cdf0e10cSrcweir #define _SDR_NOVIEWMARKER 41*cdf0e10cSrcweir #define _SDR_NODRAGMETHODS 42*cdf0e10cSrcweir #define _SDR_NOUNDO 43*cdf0e10cSrcweir #define _SDR_NOXOUTDEV 44*cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 45*cdf0e10cSrcweir #include <tools/shl.hxx> 46*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 47*cdf0e10cSrcweir #include <tools/urlobj.hxx> 48*cdf0e10cSrcweir #include <unotools/ucbstreamhelper.hxx> 49*cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 50*cdf0e10cSrcweir #include <sfx2/app.hxx> 51*cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx> 52*cdf0e10cSrcweir #include <unotools/localfilehelper.hxx> 53*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/TemplateDescription.hpp" 54*cdf0e10cSrcweir #include <svx/dialmgr.hxx> 55*cdf0e10cSrcweir #include <vcl/bmpacc.hxx> 56*cdf0e10cSrcweir #include <svx/dialogs.hrc> 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir #define _SVX_TPBITMAP_CXX 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir #include <cuires.hrc> 61*cdf0e10cSrcweir #include "helpid.hrc" 62*cdf0e10cSrcweir #include "svx/xattr.hxx" 63*cdf0e10cSrcweir #include <svx/xpool.hxx> 64*cdf0e10cSrcweir #include <svx/xtable.hxx> 65*cdf0e10cSrcweir #include "svx/xoutbmp.hxx" 66*cdf0e10cSrcweir #include "svx/drawitem.hxx" 67*cdf0e10cSrcweir #include "cuitabarea.hxx" 68*cdf0e10cSrcweir #include "tabarea.hrc" 69*cdf0e10cSrcweir #include "defdlgname.hxx" //CHINA001 #include "dlgname.hxx" 70*cdf0e10cSrcweir //#include "dlgname.hrc" 71*cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001 72*cdf0e10cSrcweir #include <dialmgr.hxx> 73*cdf0e10cSrcweir #include "sfx2/opengrf.hxx" 74*cdf0e10cSrcweir #include "paragrph.hrc" 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir #define DLGWIN this->GetParent()->GetParent() 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir /************************************************************************* 79*cdf0e10cSrcweir |* 80*cdf0e10cSrcweir |* Dialog zum Aendern und Definieren der Bitmaps 81*cdf0e10cSrcweir |* 82*cdf0e10cSrcweir \************************************************************************/ 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir SvxBitmapTabPage::SvxBitmapTabPage 85*cdf0e10cSrcweir ( 86*cdf0e10cSrcweir Window* pParent, 87*cdf0e10cSrcweir const SfxItemSet& rInAttrs 88*cdf0e10cSrcweir ) : 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_BITMAP ), rInAttrs ), 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir aCtlPixel ( this, CUI_RES( CTL_PIXEL ) ), 93*cdf0e10cSrcweir aFtPixelEdit ( this, CUI_RES( FT_PIXEL_EDIT ) ), 94*cdf0e10cSrcweir aFtColor ( this, CUI_RES( FT_COLOR ) ), 95*cdf0e10cSrcweir aLbColor ( this, CUI_RES( LB_COLOR ) ), 96*cdf0e10cSrcweir aFtBackgroundColor ( this, CUI_RES( FT_BACKGROUND_COLOR ) ), 97*cdf0e10cSrcweir aLbBackgroundColor ( this, CUI_RES( LB_BACKGROUND_COLOR ) ), 98*cdf0e10cSrcweir // This fix text is used only to provide the name for the following 99*cdf0e10cSrcweir // bitmap list box. The fixed text is not displayed. 100*cdf0e10cSrcweir aLbBitmapsHidden ( this, CUI_RES( FT_BITMAPS_HIDDEN ) ), 101*cdf0e10cSrcweir aLbBitmaps ( this, CUI_RES( LB_BITMAPS ) ), 102*cdf0e10cSrcweir aFlProp ( this, CUI_RES( FL_PROP ) ), 103*cdf0e10cSrcweir aCtlPreview ( this, CUI_RES( CTL_PREVIEW ) ), 104*cdf0e10cSrcweir aBtnAdd ( this, CUI_RES( BTN_ADD ) ), 105*cdf0e10cSrcweir aBtnModify ( this, CUI_RES( BTN_MODIFY ) ), 106*cdf0e10cSrcweir aBtnImport ( this, CUI_RES( BTN_IMPORT ) ), 107*cdf0e10cSrcweir aBtnDelete ( this, CUI_RES( BTN_DELETE ) ), 108*cdf0e10cSrcweir aBtnLoad ( this, CUI_RES( BTN_LOAD ) ), 109*cdf0e10cSrcweir aBtnSave ( this, CUI_RES( BTN_SAVE ) ), 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir aBitmapCtl ( this, aCtlPreview.GetSizePixel() ), 112*cdf0e10cSrcweir rOutAttrs ( rInAttrs ), 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir pColorTab( NULL ), 115*cdf0e10cSrcweir pBitmapList( NULL ), 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), 118*cdf0e10cSrcweir aXFStyleItem ( XFILL_BITMAP ), 119*cdf0e10cSrcweir aXBitmapItem ( String(), XOBitmap() ), 120*cdf0e10cSrcweir aXFillAttr ( pXPool ), 121*cdf0e10cSrcweir rXFSet ( aXFillAttr.GetItemSet() ) 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir aBtnLoad.SetModeImage( Image( CUI_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST ); 124*cdf0e10cSrcweir aBtnSave.SetModeImage( Image( CUI_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST ); 125*cdf0e10cSrcweir FreeResource(); 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir // diese Page braucht ExchangeSupport 128*cdf0e10cSrcweir SetExchangeSupport(); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir // Setzen des Output-Devices 131*cdf0e10cSrcweir rXFSet.Put( aXFStyleItem ); 132*cdf0e10cSrcweir rXFSet.Put( aXBitmapItem ); 133*cdf0e10cSrcweir //aCtlPreview.SetAttributes( aXFillAttr ); 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir aBtnAdd.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickAddHdl_Impl ) ); 136*cdf0e10cSrcweir aBtnImport.SetClickHdl( 137*cdf0e10cSrcweir LINK( this, SvxBitmapTabPage, ClickImportHdl_Impl ) ); 138*cdf0e10cSrcweir aBtnModify.SetClickHdl( 139*cdf0e10cSrcweir LINK( this, SvxBitmapTabPage, ClickModifyHdl_Impl ) ); 140*cdf0e10cSrcweir aBtnDelete.SetClickHdl( 141*cdf0e10cSrcweir LINK( this, SvxBitmapTabPage, ClickDeleteHdl_Impl ) ); 142*cdf0e10cSrcweir aBtnLoad.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickLoadHdl_Impl ) ); 143*cdf0e10cSrcweir aBtnSave.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickSaveHdl_Impl ) ); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir aLbBitmaps.SetSelectHdl( 146*cdf0e10cSrcweir LINK( this, SvxBitmapTabPage, ChangeBitmapHdl_Impl ) ); 147*cdf0e10cSrcweir aLbColor.SetSelectHdl( 148*cdf0e10cSrcweir LINK( this, SvxBitmapTabPage, ChangePixelColorHdl_Impl ) ); 149*cdf0e10cSrcweir aLbBackgroundColor.SetSelectHdl( 150*cdf0e10cSrcweir LINK( this, SvxBitmapTabPage, ChangeBackgrndColorHdl_Impl ) ); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir String accName = String(SVX_RES(STR_EXAMPLE)); 153*cdf0e10cSrcweir aCtlPreview.SetAccessibleName(accName); 154*cdf0e10cSrcweir aCtlPixel.SetAccessibleRelationMemberOf( &aFlProp ); 155*cdf0e10cSrcweir aCtlPixel.SetAccessibleRelationLabeledBy( &aFtPixelEdit ); 156*cdf0e10cSrcweir aLbBitmaps.SetAccessibleRelationLabeledBy(&aLbBitmaps); 157*cdf0e10cSrcweir aBtnAdd.SetAccessibleRelationMemberOf( &aFlProp ); 158*cdf0e10cSrcweir aBtnModify.SetAccessibleRelationMemberOf( &aFlProp ); 159*cdf0e10cSrcweir aBtnImport.SetAccessibleRelationMemberOf( &aFlProp ); 160*cdf0e10cSrcweir aBtnDelete.SetAccessibleRelationMemberOf( &aFlProp ); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir // ----------------------------------------------------------------------- 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir void SvxBitmapTabPage::Construct() 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir // Farbtabellen 169*cdf0e10cSrcweir aLbColor.Fill( pColorTab ); 170*cdf0e10cSrcweir aLbBackgroundColor.CopyEntries( aLbColor ); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir // Bitmaptabelle 173*cdf0e10cSrcweir aLbBitmaps.Fill( pBitmapList ); 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir // ----------------------------------------------------------------------- 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir void SvxBitmapTabPage::ActivatePage( const SfxItemSet& ) 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir sal_uInt16 nPos; 181*cdf0e10cSrcweir sal_uInt16 nCount; 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir if( *pDlgType == 0 ) // Flaechen-Dialog 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir *pbAreaTP = sal_False; 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir if( pColorTab ) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir // ColorTable 190*cdf0e10cSrcweir if( *pnColorTableState & CT_CHANGED || 191*cdf0e10cSrcweir *pnColorTableState & CT_MODIFIED ) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir if( *pnColorTableState & CT_CHANGED ) 194*cdf0e10cSrcweir pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable(); 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir // LbColor 197*cdf0e10cSrcweir nPos = aLbColor.GetSelectEntryPos(); 198*cdf0e10cSrcweir aLbColor.Clear(); 199*cdf0e10cSrcweir aLbColor.Fill( pColorTab ); 200*cdf0e10cSrcweir nCount = aLbColor.GetEntryCount(); 201*cdf0e10cSrcweir if( nCount == 0 ) 202*cdf0e10cSrcweir ; // Dieser Fall sollte nicht auftreten 203*cdf0e10cSrcweir else if( nCount <= nPos ) 204*cdf0e10cSrcweir aLbColor.SelectEntryPos( 0 ); 205*cdf0e10cSrcweir else 206*cdf0e10cSrcweir aLbColor.SelectEntryPos( nPos ); 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir // LbColorBackground 209*cdf0e10cSrcweir nPos = aLbBackgroundColor.GetSelectEntryPos(); 210*cdf0e10cSrcweir aLbBackgroundColor.Clear(); 211*cdf0e10cSrcweir aLbBackgroundColor.CopyEntries( aLbColor ); 212*cdf0e10cSrcweir nCount = aLbBackgroundColor.GetEntryCount(); 213*cdf0e10cSrcweir if( nCount == 0 ) 214*cdf0e10cSrcweir ; // Dieser Fall sollte nicht auftreten 215*cdf0e10cSrcweir else if( nCount <= nPos ) 216*cdf0e10cSrcweir aLbBackgroundColor.SelectEntryPos( 0 ); 217*cdf0e10cSrcweir else 218*cdf0e10cSrcweir aLbBackgroundColor.SelectEntryPos( nPos ); 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir ChangePixelColorHdl_Impl( this ); 221*cdf0e10cSrcweir ChangeBackgrndColorHdl_Impl( this ); 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir // Ermitteln (evtl. abschneiden) des Namens und in 225*cdf0e10cSrcweir // der GroupBox darstellen 226*cdf0e10cSrcweir String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); 227*cdf0e10cSrcweir INetURLObject aURL( pBitmapList->GetPath() ); 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir aURL.Append( pBitmapList->GetName() ); 230*cdf0e10cSrcweir DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir if( aURL.getBase().getLength() > 18 ) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir aString += String(aURL.getBase()).Copy( 0, 15 ); 235*cdf0e10cSrcweir aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir else 238*cdf0e10cSrcweir aString += String(aURL.getBase()); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir if( *pPageType == PT_BITMAP && *pPos != LISTBOX_ENTRY_NOTFOUND ) 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir aLbBitmaps.SelectEntryPos( *pPos ); 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir // Farben koennten geloescht worden sein 245*cdf0e10cSrcweir ChangeBitmapHdl_Impl( this ); 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir *pPageType = PT_BITMAP; 248*cdf0e10cSrcweir *pPos = LISTBOX_ENTRY_NOTFOUND; 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir // ----------------------------------------------------------------------- 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir int SvxBitmapTabPage::DeactivatePage( SfxItemSet* _pSet) 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir if ( CheckChanges_Impl() == -1L ) 258*cdf0e10cSrcweir return KEEP_PAGE; 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir if( _pSet ) 261*cdf0e10cSrcweir FillItemSet( *_pSet ); 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir return LEAVE_PAGE; 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir // ----------------------------------------------------------------------- 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir sal_Bool SvxBitmapTabPage::FillItemSet( SfxItemSet& _rOutAttrs ) 269*cdf0e10cSrcweir { 270*cdf0e10cSrcweir if( *pDlgType == 0 && *pbAreaTP == sal_False ) // Flaechen-Dialog 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir if( *pPageType == PT_BITMAP ) 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir // CheckChanges_Impl(); <-- doppelte Abfrage ? 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir XOBitmap aXOBitmap; 277*cdf0e10cSrcweir String aString; 278*cdf0e10cSrcweir sal_uInt16 nPos = aLbBitmaps.GetSelectEntryPos(); 279*cdf0e10cSrcweir if( nPos != LISTBOX_ENTRY_NOTFOUND ) 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir aXOBitmap = pBitmapList->GetBitmap( nPos )->GetXBitmap(); 282*cdf0e10cSrcweir aString = aLbBitmaps.GetSelectEntry(); 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir else 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir aXOBitmap = aBitmapCtl.GetXBitmap(); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir // #85339# if it's an array, force conversion to bitmap before using it. 290*cdf0e10cSrcweir if(aXOBitmap.GetBitmapType() == XBITMAP_8X8) 291*cdf0e10cSrcweir aXOBitmap.GetBitmap(); 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir _rOutAttrs.Put( XFillStyleItem( XFILL_BITMAP ) ); 295*cdf0e10cSrcweir _rOutAttrs.Put( XFillBitmapItem( aString, aXOBitmap ) ); 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir return sal_True; 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir // ----------------------------------------------------------------------- 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir void SvxBitmapTabPage::Reset( const SfxItemSet& ) 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir // aLbBitmaps.SelectEntryPos( 0 ); 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir aBitmapCtl.SetLines( aCtlPixel.GetLineCount() ); 308*cdf0e10cSrcweir aBitmapCtl.SetPixelColor( aLbColor.GetSelectEntryColor() ); 309*cdf0e10cSrcweir aBitmapCtl.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() ); 310*cdf0e10cSrcweir aBitmapCtl.SetBmpArray( aCtlPixel.GetBitmapPixelPtr() ); 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir // Bitmap holen und darstellen 313*cdf0e10cSrcweir XFillBitmapItem aBmpItem( (const String &) String(), aBitmapCtl.GetXBitmap() ); 314*cdf0e10cSrcweir rXFSet.Put( aBmpItem ); 315*cdf0e10cSrcweir aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); 316*cdf0e10cSrcweir aCtlPreview.Invalidate(); 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir ChangeBitmapHdl_Impl( this ); 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir // Status der Buttons ermitteln 321*cdf0e10cSrcweir if( pBitmapList->Count() ) 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir aBtnAdd.Enable(); 324*cdf0e10cSrcweir aBtnModify.Enable(); 325*cdf0e10cSrcweir aBtnDelete.Enable(); 326*cdf0e10cSrcweir aBtnSave.Enable(); 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir else 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir aBtnModify.Disable(); 331*cdf0e10cSrcweir aBtnDelete.Disable(); 332*cdf0e10cSrcweir aBtnSave.Disable(); 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir // ----------------------------------------------------------------------- 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir SfxTabPage* SvxBitmapTabPage::Create( Window* pWindow, 339*cdf0e10cSrcweir const SfxItemSet& rSet ) 340*cdf0e10cSrcweir { 341*cdf0e10cSrcweir return new SvxBitmapTabPage( pWindow, rSet ); 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir //------------------------------------------------------------------------ 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir IMPL_LINK( SvxBitmapTabPage, ChangeBitmapHdl_Impl, void *, EMPTYARG ) 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir XOBitmap* pXOBitmap = NULL; 349*cdf0e10cSrcweir int nPos = aLbBitmaps.GetSelectEntryPos(); 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir if( nPos != LISTBOX_ENTRY_NOTFOUND ) 352*cdf0e10cSrcweir pXOBitmap = new XOBitmap( ( (XBitmapEntry*) pBitmapList->GetBitmap( nPos ) )->GetXBitmap() ); 353*cdf0e10cSrcweir else 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir const SfxPoolItem* pPoolItem = NULL; 356*cdf0e10cSrcweir if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), sal_True, &pPoolItem ) ) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle) ( ( const XFillStyleItem* ) pPoolItem )->GetValue(); 359*cdf0e10cSrcweir if( ( XFILL_BITMAP == eXFS ) && 360*cdf0e10cSrcweir ( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), sal_True, &pPoolItem ) ) ) 361*cdf0e10cSrcweir { 362*cdf0e10cSrcweir pXOBitmap = new XOBitmap( ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() ); 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir if( !pXOBitmap ) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir aLbBitmaps.SelectEntryPos( 0 ); 368*cdf0e10cSrcweir nPos = aLbBitmaps.GetSelectEntryPos(); 369*cdf0e10cSrcweir if( nPos != LISTBOX_ENTRY_NOTFOUND ) 370*cdf0e10cSrcweir pXOBitmap = new XOBitmap( ( (XBitmapEntry*) pBitmapList->GetBitmap( nPos ) )->GetXBitmap() ); 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir if( pXOBitmap ) 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir //WorkWindow aTmpWW( DLGWIN ); 376*cdf0e10cSrcweir //VirtualDevice aVD( aTmpWW ); 377*cdf0e10cSrcweir //sal_uInt16 nLines = aCtlPixel.GetLineCount(); 378*cdf0e10cSrcweir //Color aPixelColor, aBackColor; 379*cdf0e10cSrcweir //sal_Bool bPixelColor = sal_False; 380*cdf0e10cSrcweir //sal_uInt16 nWidth = pBitmap->GetSizePixel().Width(); 381*cdf0e10cSrcweir //sal_uInt16 nHeight = pBitmap->GetSizePixel().Height(); 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir // #85339# try to convert bitmapped item to array item. 384*cdf0e10cSrcweir if(pXOBitmap->GetBitmapType() == XBITMAP_IMPORT) 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir Bitmap aBitmap(pXOBitmap->GetBitmap()); 387*cdf0e10cSrcweir Size aSizePixel(aBitmap.GetSizePixel()); 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir if(8 == aSizePixel.Width() && 8 == aSizePixel.Height()) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir sal_uInt16* pPixelArray = new sal_uInt16[64]; 392*cdf0e10cSrcweir sal_uInt32 nCol1(0xffffffff); // background 393*cdf0e10cSrcweir sal_uInt32 nCol2(0xffffffff); // pixel 394*cdf0e10cSrcweir BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess(); 395*cdf0e10cSrcweir sal_Bool bValid(sal_True); 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir if(pAccess) 398*cdf0e10cSrcweir { 399*cdf0e10cSrcweir for(sal_uInt32 a(0); bValid && a < 64; a++) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir const BitmapColor aBmCol = pAccess->GetColor(a>>3, a%8); 402*cdf0e10cSrcweir Color aRgbCol(aBmCol.GetRed(), aBmCol.GetGreen(), aBmCol.GetBlue()); 403*cdf0e10cSrcweir sal_uInt32 nColVal = aRgbCol.GetRGBColor(); 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir // test with nCol1 406*cdf0e10cSrcweir if(nCol1 != nColVal) 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir if(0xffffffff == nCol1) 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir // nCol1 is used first time 411*cdf0e10cSrcweir nCol1 = nColVal; 412*cdf0e10cSrcweir pPixelArray[a] = 0; 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir else 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir // test with nCol2 417*cdf0e10cSrcweir if(nCol2 != nColVal) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir if(0xffffffff == nCol2) 420*cdf0e10cSrcweir { 421*cdf0e10cSrcweir // nCol2 used first time 422*cdf0e10cSrcweir nCol2 = nColVal; 423*cdf0e10cSrcweir pPixelArray[a] = 1; 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir else 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir // Third color detected 428*cdf0e10cSrcweir bValid = sal_False; 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir } 431*cdf0e10cSrcweir else 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir // color is pixel color 434*cdf0e10cSrcweir pPixelArray[a] = 1; 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir else 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir // color is background color 441*cdf0e10cSrcweir pPixelArray[a] = 0; 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir // release ReadAccess 446*cdf0e10cSrcweir aBitmap.ReleaseAccess(pAccess); 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir else 449*cdf0e10cSrcweir { 450*cdf0e10cSrcweir // no access -> no success 451*cdf0e10cSrcweir bValid = sal_False; 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir if(bValid) 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir Color aCol1(nCol1); 457*cdf0e10cSrcweir Color aCol2(nCol2); 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir // no pixel color found? Use opposite od background color. 460*cdf0e10cSrcweir if(0xffffffff == nCol2) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir aCol2 = Color( 463*cdf0e10cSrcweir 0xff - aCol1.GetRed(), 464*cdf0e10cSrcweir 0xff - aCol1.GetGreen(), 465*cdf0e10cSrcweir 0xff - aCol1.GetBlue()); 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir // transformation did work, create a new Item 469*cdf0e10cSrcweir delete pXOBitmap; 470*cdf0e10cSrcweir pXOBitmap = new XOBitmap(pPixelArray, aCol2, aCol1); 471*cdf0e10cSrcweir } 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir // cleanup 474*cdf0e10cSrcweir delete[] pPixelArray; 475*cdf0e10cSrcweir } 476*cdf0e10cSrcweir } 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir aLbColor.SetNoSelection(); 479*cdf0e10cSrcweir aLbBackgroundColor.SetNoSelection(); 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir if( pXOBitmap->GetBitmapType() == XBITMAP_IMPORT ) 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir aCtlPixel.Reset(); 484*cdf0e10cSrcweir aCtlPixel.SetPaintable( sal_False ); 485*cdf0e10cSrcweir aCtlPixel.Disable(); 486*cdf0e10cSrcweir aFtPixelEdit.Disable(); 487*cdf0e10cSrcweir aFtColor.Disable(); 488*cdf0e10cSrcweir aLbColor.Disable(); 489*cdf0e10cSrcweir aFtBackgroundColor.Disable(); 490*cdf0e10cSrcweir aLbBackgroundColor.Disable(); 491*cdf0e10cSrcweir aBtnModify.Disable(); 492*cdf0e10cSrcweir aBtnAdd.Disable(); 493*cdf0e10cSrcweir } 494*cdf0e10cSrcweir else if( pXOBitmap->GetBitmapType() == XBITMAP_8X8 ) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir aCtlPixel.SetPaintable( sal_True ); 497*cdf0e10cSrcweir aCtlPixel.Enable(); 498*cdf0e10cSrcweir aFtPixelEdit.Enable(); 499*cdf0e10cSrcweir aFtColor.Enable(); 500*cdf0e10cSrcweir aLbColor.Enable(); 501*cdf0e10cSrcweir aFtBackgroundColor.Enable(); 502*cdf0e10cSrcweir aLbBackgroundColor.Enable(); 503*cdf0e10cSrcweir aBtnModify.Enable(); 504*cdf0e10cSrcweir aBtnAdd.Enable(); 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir // Setzen des PixelControls 507*cdf0e10cSrcweir aCtlPixel.SetXBitmap( *pXOBitmap ); 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir Color aPixelColor = pXOBitmap->GetPixelColor(); 510*cdf0e10cSrcweir Color aBackColor = pXOBitmap->GetBackgroundColor(); 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir aBitmapCtl.SetPixelColor( aPixelColor ); 513*cdf0e10cSrcweir aBitmapCtl.SetBackgroundColor( aBackColor ); 514*cdf0e10cSrcweir 515*cdf0e10cSrcweir // Wenn der Eintrag nicht in der Listbox ist, wird die Farbe 516*cdf0e10cSrcweir // temporaer hinzugenommen 517*cdf0e10cSrcweir if( 0 == aLbBitmaps.GetSelectEntryPos() ) 518*cdf0e10cSrcweir { 519*cdf0e10cSrcweir aLbColor.SelectEntry( Color( COL_BLACK ) ); 520*cdf0e10cSrcweir ChangePixelColorHdl_Impl( this ); 521*cdf0e10cSrcweir } 522*cdf0e10cSrcweir else 523*cdf0e10cSrcweir aLbColor.SelectEntry( aPixelColor ); 524*cdf0e10cSrcweir if( aLbColor.GetSelectEntryCount() == 0 ) 525*cdf0e10cSrcweir { 526*cdf0e10cSrcweir aLbColor.InsertEntry( aPixelColor, String() ); 527*cdf0e10cSrcweir aLbColor.SelectEntry( aPixelColor ); 528*cdf0e10cSrcweir } 529*cdf0e10cSrcweir aLbBackgroundColor.SelectEntry( aBackColor ); 530*cdf0e10cSrcweir if( aLbBackgroundColor.GetSelectEntryCount() == 0 ) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir aLbBackgroundColor.InsertEntry( aBackColor, String() ); 533*cdf0e10cSrcweir aLbBackgroundColor.SelectEntry( aBackColor ); 534*cdf0e10cSrcweir } 535*cdf0e10cSrcweir } 536*cdf0e10cSrcweir aCtlPixel.Invalidate(); 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir // Bitmap darstellen 539*cdf0e10cSrcweir XFillBitmapItem aXBmpItem( (const String &) String(), *pXOBitmap ); 540*cdf0e10cSrcweir rXFSet.Put( aXBmpItem ); 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); 543*cdf0e10cSrcweir aCtlPreview.Invalidate(); 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir bBmpChanged = sal_False; 546*cdf0e10cSrcweir delete pXOBitmap; 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir return 0L; 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir 551*cdf0e10cSrcweir // ----------------------------------------------------------------------- 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir long SvxBitmapTabPage::CheckChanges_Impl() 554*cdf0e10cSrcweir { 555*cdf0e10cSrcweir sal_uInt16 nPos = aLbBitmaps.GetSelectEntryPos(); 556*cdf0e10cSrcweir if( nPos != LISTBOX_ENTRY_NOTFOUND ) 557*cdf0e10cSrcweir { 558*cdf0e10cSrcweir String aString = aLbBitmaps.GetSelectEntry(); 559*cdf0e10cSrcweir 560*cdf0e10cSrcweir if( bBmpChanged ) 561*cdf0e10cSrcweir { 562*cdf0e10cSrcweir ResMgr& rMgr = CUI_MGR(); 563*cdf0e10cSrcweir Image aWarningBoxImage = WarningBox::GetStandardImage(); 564*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 565*cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 566*cdf0e10cSrcweir AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX, 567*cdf0e10cSrcweir String( SVX_RES( RID_SVXSTR_BITMAP ) ), 568*cdf0e10cSrcweir String( CUI_RES( RID_SVXSTR_ASK_CHANGE_BITMAP ) ), 569*cdf0e10cSrcweir &aWarningBoxImage ); 570*cdf0e10cSrcweir DBG_ASSERT(aMessDlg, "Dialogdiet fail!");//CHINA001 571*cdf0e10cSrcweir aMessDlg->SetButtonText( MESS_BTN_1, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_1, 572*cdf0e10cSrcweir String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) ); 573*cdf0e10cSrcweir aMessDlg->SetButtonText( MESS_BTN_2, //CHINA001 aMessDlg.SetButtonText( MESS_BTN_2, 574*cdf0e10cSrcweir String( ResId( RID_SVXSTR_ADD, rMgr ) ) ); 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir short nRet = aMessDlg->Execute(); //CHINA001 short nRet = aMessDlg.Execute(); 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir switch( nRet ) 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir case RET_BTN_1: // Aendern 581*cdf0e10cSrcweir { 582*cdf0e10cSrcweir ClickModifyHdl_Impl( this ); 583*cdf0e10cSrcweir } 584*cdf0e10cSrcweir break; 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir case RET_BTN_2: // Hinzufuegen 587*cdf0e10cSrcweir { 588*cdf0e10cSrcweir ClickAddHdl_Impl( this ); 589*cdf0e10cSrcweir nPos = aLbBitmaps.GetSelectEntryPos(); 590*cdf0e10cSrcweir } 591*cdf0e10cSrcweir break; 592*cdf0e10cSrcweir 593*cdf0e10cSrcweir case RET_CANCEL: 594*cdf0e10cSrcweir // return( -1L ); 595*cdf0e10cSrcweir break; 596*cdf0e10cSrcweir // return( sal_True ); // Abbruch 597*cdf0e10cSrcweir } 598*cdf0e10cSrcweir delete aMessDlg; //add by CHINA001 599*cdf0e10cSrcweir } 600*cdf0e10cSrcweir } 601*cdf0e10cSrcweir nPos = aLbBitmaps.GetSelectEntryPos(); 602*cdf0e10cSrcweir if( nPos != LISTBOX_ENTRY_NOTFOUND ) 603*cdf0e10cSrcweir *pPos = nPos; 604*cdf0e10cSrcweir return 0L; 605*cdf0e10cSrcweir } 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir //------------------------------------------------------------------------ 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir IMPL_LINK( SvxBitmapTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) 610*cdf0e10cSrcweir { 611*cdf0e10cSrcweir ResMgr& rMgr = CUI_MGR(); 612*cdf0e10cSrcweir String aNewName( SVX_RES( RID_SVXSTR_BITMAP ) ); 613*cdf0e10cSrcweir String aDesc( CUI_RES( RID_SVXSTR_DESC_NEW_BITMAP ) ); 614*cdf0e10cSrcweir String aName; 615*cdf0e10cSrcweir 616*cdf0e10cSrcweir long nCount = pBitmapList->Count(); 617*cdf0e10cSrcweir long j = 1; 618*cdf0e10cSrcweir sal_Bool bDifferent = sal_False; 619*cdf0e10cSrcweir 620*cdf0e10cSrcweir while( !bDifferent ) 621*cdf0e10cSrcweir { 622*cdf0e10cSrcweir aName = aNewName; 623*cdf0e10cSrcweir aName += sal_Unicode(' '); 624*cdf0e10cSrcweir aName += UniString::CreateFromInt32( j++ ); 625*cdf0e10cSrcweir bDifferent = sal_True; 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir for( long i = 0; i < nCount && bDifferent; i++ ) 628*cdf0e10cSrcweir if( aName == pBitmapList->GetBitmap( i )->GetName() ) 629*cdf0e10cSrcweir bDifferent = sal_False; 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir 632*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 633*cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 634*cdf0e10cSrcweir AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); 635*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 636*cdf0e10cSrcweir WarningBox* pWarnBox = NULL; 637*cdf0e10cSrcweir sal_uInt16 nError = RID_SVXSTR_WARN_NAME_DUPLICATE; 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir while( pDlg->Execute() == RET_OK ) 640*cdf0e10cSrcweir { 641*cdf0e10cSrcweir pDlg->GetName( aName ); 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir bDifferent = sal_True; 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir for( long i = 0; i < nCount && bDifferent; i++ ) 646*cdf0e10cSrcweir if( aName == pBitmapList->GetBitmap( i )->GetName() ) 647*cdf0e10cSrcweir bDifferent = sal_False; 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir if( bDifferent ) { 650*cdf0e10cSrcweir nError = 0; 651*cdf0e10cSrcweir break; 652*cdf0e10cSrcweir } 653*cdf0e10cSrcweir 654*cdf0e10cSrcweir if( !pWarnBox ) 655*cdf0e10cSrcweir { 656*cdf0e10cSrcweir pWarnBox = new WarningBox( DLGWIN, 657*cdf0e10cSrcweir WinBits( WB_OK_CANCEL ), 658*cdf0e10cSrcweir String( ResId( nError, rMgr ) ) ); 659*cdf0e10cSrcweir pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE ); 660*cdf0e10cSrcweir } 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir if( pWarnBox->Execute() != RET_OK ) 663*cdf0e10cSrcweir break; 664*cdf0e10cSrcweir } 665*cdf0e10cSrcweir //Rectangle aDlgRect( pDlg->GetPosPixel(), pDlg->GetSizePixel() ); 666*cdf0e10cSrcweir delete pDlg; 667*cdf0e10cSrcweir delete pWarnBox; 668*cdf0e10cSrcweir 669*cdf0e10cSrcweir if( !nError ) 670*cdf0e10cSrcweir { 671*cdf0e10cSrcweir XBitmapEntry* pEntry = 0; 672*cdf0e10cSrcweir if( aCtlPixel.IsEnabled() ) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir XOBitmap aXOBitmap = aBitmapCtl.GetXBitmap(); 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir // #85339# if it's an array, force conversion to bitmap before using it. 677*cdf0e10cSrcweir if(aXOBitmap.GetBitmapType() == XBITMAP_8X8) 678*cdf0e10cSrcweir aXOBitmap.GetBitmap(); 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir pEntry = new XBitmapEntry( aXOBitmap, aName ); 681*cdf0e10cSrcweir } 682*cdf0e10cSrcweir else // Es muss sich um eine nicht vorhandene importierte Bitmap handeln 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir const SfxPoolItem* pPoolItem = NULL; 685*cdf0e10cSrcweir if( SFX_ITEM_SET == rOutAttrs.GetItemState( XATTR_FILLBITMAP, sal_True, &pPoolItem ) ) 686*cdf0e10cSrcweir { 687*cdf0e10cSrcweir XOBitmap aXOBitmap( ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() ); 688*cdf0e10cSrcweir pEntry = new XBitmapEntry( aXOBitmap, aName ); 689*cdf0e10cSrcweir } 690*cdf0e10cSrcweir } 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir DBG_ASSERT( pEntry, "SvxBitmapTabPage::ClickAddHdl_Impl(), pEntry == 0 ?" ); 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir if( pEntry ) 695*cdf0e10cSrcweir { 696*cdf0e10cSrcweir pBitmapList->Insert( pEntry ); 697*cdf0e10cSrcweir 698*cdf0e10cSrcweir aLbBitmaps.Append( pEntry ); 699*cdf0e10cSrcweir aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 ); 700*cdf0e10cSrcweir 701*cdf0e10cSrcweir #ifdef WNT 702*cdf0e10cSrcweir // hack: #31355# W.P. 703*cdf0e10cSrcweir Rectangle aRect( aLbBitmaps.GetPosPixel(), aLbBitmaps.GetSizePixel() ); 704*cdf0e10cSrcweir if( sal_True ) { // ??? overlapped with pDlg 705*cdf0e10cSrcweir // and srolling 706*cdf0e10cSrcweir Invalidate( aRect ); 707*cdf0e10cSrcweir //aLbBitmaps.Invalidate(); 708*cdf0e10cSrcweir } 709*cdf0e10cSrcweir #endif 710*cdf0e10cSrcweir 711*cdf0e10cSrcweir // Flag fuer modifiziert setzen 712*cdf0e10cSrcweir *pnBitmapListState |= CT_MODIFIED; 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir ChangeBitmapHdl_Impl( this ); 715*cdf0e10cSrcweir } 716*cdf0e10cSrcweir } 717*cdf0e10cSrcweir 718*cdf0e10cSrcweir // Status der Buttons ermitteln 719*cdf0e10cSrcweir if( pBitmapList->Count() ) 720*cdf0e10cSrcweir { 721*cdf0e10cSrcweir aBtnModify.Enable(); 722*cdf0e10cSrcweir aBtnDelete.Enable(); 723*cdf0e10cSrcweir aBtnSave.Enable(); 724*cdf0e10cSrcweir } 725*cdf0e10cSrcweir return 0L; 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir 728*cdf0e10cSrcweir 729*cdf0e10cSrcweir /******************************************************************************/ 730*cdf0e10cSrcweir /******************************************************************************/ 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir //------------------------------------------------------------------------ 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir #ifdef _MSC_VER 736*cdf0e10cSrcweir #pragma optimize ( "", off ) 737*cdf0e10cSrcweir #endif 738*cdf0e10cSrcweir 739*cdf0e10cSrcweir IMPL_LINK( SvxBitmapTabPage, ClickImportHdl_Impl, void *, EMPTYARG ) 740*cdf0e10cSrcweir { 741*cdf0e10cSrcweir ResMgr& rMgr = CUI_MGR(); 742*cdf0e10cSrcweir SvxOpenGraphicDialog aDlg( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Import" ) ) ); 743*cdf0e10cSrcweir aDlg.EnableLink(sal_False); 744*cdf0e10cSrcweir 745*cdf0e10cSrcweir if( !aDlg.Execute() ) 746*cdf0e10cSrcweir { 747*cdf0e10cSrcweir Graphic aGraphic; 748*cdf0e10cSrcweir int nError = 1; 749*cdf0e10cSrcweir 750*cdf0e10cSrcweir EnterWait(); 751*cdf0e10cSrcweir nError = aDlg.GetGraphic( aGraphic ); 752*cdf0e10cSrcweir LeaveWait(); 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir if( !nError ) 755*cdf0e10cSrcweir { 756*cdf0e10cSrcweir String aDesc( ResId(RID_SVXSTR_DESC_EXT_BITMAP, rMgr) ); 757*cdf0e10cSrcweir WarningBox* pWarnBox = NULL; 758*cdf0e10cSrcweir 759*cdf0e10cSrcweir // convert file URL to UI name 760*cdf0e10cSrcweir String aName; 761*cdf0e10cSrcweir INetURLObject aURL( aDlg.GetPath() ); 762*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 763*cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 764*cdf0e10cSrcweir AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, String(aURL.GetName()).GetToken( 0, '.' ), aDesc ); 765*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 766*cdf0e10cSrcweir nError = RID_SVXSTR_WARN_NAME_DUPLICATE; 767*cdf0e10cSrcweir 768*cdf0e10cSrcweir while( pDlg->Execute() == RET_OK ) 769*cdf0e10cSrcweir { 770*cdf0e10cSrcweir pDlg->GetName( aName ); 771*cdf0e10cSrcweir 772*cdf0e10cSrcweir sal_Bool bDifferent = sal_True; 773*cdf0e10cSrcweir long nCount = pBitmapList->Count(); 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir for( long i = 0; i < nCount && bDifferent; i++ ) 776*cdf0e10cSrcweir if( aName == pBitmapList->GetBitmap( i )->GetName() ) 777*cdf0e10cSrcweir bDifferent = sal_False; 778*cdf0e10cSrcweir 779*cdf0e10cSrcweir if( bDifferent ) { 780*cdf0e10cSrcweir nError = 0; 781*cdf0e10cSrcweir break; 782*cdf0e10cSrcweir } 783*cdf0e10cSrcweir 784*cdf0e10cSrcweir if( !pWarnBox ) 785*cdf0e10cSrcweir { 786*cdf0e10cSrcweir pWarnBox = new WarningBox( DLGWIN, 787*cdf0e10cSrcweir WinBits( WB_OK_CANCEL ), 788*cdf0e10cSrcweir String( ResId( nError, rMgr ) ) ); 789*cdf0e10cSrcweir pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE ); 790*cdf0e10cSrcweir } 791*cdf0e10cSrcweir 792*cdf0e10cSrcweir 793*cdf0e10cSrcweir if( pWarnBox->Execute() != RET_OK ) 794*cdf0e10cSrcweir break; 795*cdf0e10cSrcweir } 796*cdf0e10cSrcweir //Rectangle aDlgRect( pDlg->GetPosPixel(), pDlg->GetSizePixel() ); 797*cdf0e10cSrcweir delete pDlg; 798*cdf0e10cSrcweir delete pWarnBox; 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir if( !nError ) 801*cdf0e10cSrcweir { 802*cdf0e10cSrcweir Bitmap aBmp( aGraphic.GetBitmap() ); 803*cdf0e10cSrcweir XBitmapEntry* pEntry = 804*cdf0e10cSrcweir new XBitmapEntry( XOBitmap( aBmp ), aName ); 805*cdf0e10cSrcweir pBitmapList->Insert( pEntry ); 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir aLbBitmaps.Append( pEntry ); 808*cdf0e10cSrcweir aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 ); 809*cdf0e10cSrcweir 810*cdf0e10cSrcweir #ifdef WNT 811*cdf0e10cSrcweir // hack: #31355# W.P. 812*cdf0e10cSrcweir Rectangle aRect( aLbBitmaps.GetPosPixel(), aLbBitmaps.GetSizePixel() ); 813*cdf0e10cSrcweir if( sal_True ) { // ??? overlapped with pDlg 814*cdf0e10cSrcweir // and srolling 815*cdf0e10cSrcweir Invalidate( aRect ); 816*cdf0e10cSrcweir //aLbBitmaps.Invalidate(); 817*cdf0e10cSrcweir } 818*cdf0e10cSrcweir #endif 819*cdf0e10cSrcweir 820*cdf0e10cSrcweir // Flag fuer modifiziert setzen 821*cdf0e10cSrcweir *pnBitmapListState |= CT_MODIFIED; 822*cdf0e10cSrcweir 823*cdf0e10cSrcweir ChangeBitmapHdl_Impl( this ); 824*cdf0e10cSrcweir } 825*cdf0e10cSrcweir } 826*cdf0e10cSrcweir else 827*cdf0e10cSrcweir // Graphik konnte nicht geladen werden 828*cdf0e10cSrcweir ErrorBox( DLGWIN, 829*cdf0e10cSrcweir WinBits( WB_OK ), 830*cdf0e10cSrcweir String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); 831*cdf0e10cSrcweir } 832*cdf0e10cSrcweir 833*cdf0e10cSrcweir return 0L; 834*cdf0e10cSrcweir } 835*cdf0e10cSrcweir 836*cdf0e10cSrcweir #ifdef _MSC_VER 837*cdf0e10cSrcweir #pragma optimize ( "", on ) 838*cdf0e10cSrcweir #endif 839*cdf0e10cSrcweir 840*cdf0e10cSrcweir //------------------------------------------------------------------------ 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir IMPL_LINK( SvxBitmapTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) 843*cdf0e10cSrcweir { 844*cdf0e10cSrcweir sal_uInt16 nPos = aLbBitmaps.GetSelectEntryPos(); 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND ) 847*cdf0e10cSrcweir { 848*cdf0e10cSrcweir ResMgr& rMgr = CUI_MGR(); 849*cdf0e10cSrcweir String aNewName( SVX_RES( RID_SVXSTR_BITMAP ) ); 850*cdf0e10cSrcweir String aDesc( ResId( RID_SVXSTR_DESC_NEW_BITMAP, rMgr ) ); 851*cdf0e10cSrcweir String aName( pBitmapList->GetBitmap( nPos )->GetName() ); 852*cdf0e10cSrcweir String aOldName = aName; 853*cdf0e10cSrcweir 854*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 855*cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 856*cdf0e10cSrcweir AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); 857*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 858*cdf0e10cSrcweir 859*cdf0e10cSrcweir long nCount = pBitmapList->Count(); 860*cdf0e10cSrcweir sal_Bool bDifferent = sal_False; 861*cdf0e10cSrcweir sal_Bool bLoop = sal_True; 862*cdf0e10cSrcweir 863*cdf0e10cSrcweir while( bLoop && pDlg->Execute() == RET_OK ) 864*cdf0e10cSrcweir { 865*cdf0e10cSrcweir pDlg->GetName( aName ); 866*cdf0e10cSrcweir bDifferent = sal_True; 867*cdf0e10cSrcweir 868*cdf0e10cSrcweir for( long i = 0; i < nCount && bDifferent; i++ ) 869*cdf0e10cSrcweir { 870*cdf0e10cSrcweir if( aName == pBitmapList->GetBitmap( i )->GetName() && 871*cdf0e10cSrcweir aName != aOldName ) 872*cdf0e10cSrcweir bDifferent = sal_False; 873*cdf0e10cSrcweir } 874*cdf0e10cSrcweir 875*cdf0e10cSrcweir if( bDifferent ) 876*cdf0e10cSrcweir { 877*cdf0e10cSrcweir bLoop = sal_False; 878*cdf0e10cSrcweir XBitmapEntry* pEntry = pBitmapList->GetBitmap( nPos ); 879*cdf0e10cSrcweir 880*cdf0e10cSrcweir pEntry->SetName( aName ); 881*cdf0e10cSrcweir 882*cdf0e10cSrcweir XOBitmap aXOBitmap = aBitmapCtl.GetXBitmap(); 883*cdf0e10cSrcweir 884*cdf0e10cSrcweir // #85339# if it's an array, force conversion to bitmap before using it. 885*cdf0e10cSrcweir if(aXOBitmap.GetBitmapType() == XBITMAP_8X8) 886*cdf0e10cSrcweir aXOBitmap.GetBitmap(); 887*cdf0e10cSrcweir 888*cdf0e10cSrcweir pEntry->SetXBitmap( aXOBitmap ); 889*cdf0e10cSrcweir 890*cdf0e10cSrcweir aLbBitmaps.Modify( pEntry, nPos ); 891*cdf0e10cSrcweir aLbBitmaps.SelectEntryPos( nPos ); 892*cdf0e10cSrcweir 893*cdf0e10cSrcweir // Flag fuer modifiziert setzen 894*cdf0e10cSrcweir *pnBitmapListState |= CT_MODIFIED; 895*cdf0e10cSrcweir 896*cdf0e10cSrcweir bBmpChanged = sal_False; 897*cdf0e10cSrcweir } 898*cdf0e10cSrcweir else 899*cdf0e10cSrcweir { 900*cdf0e10cSrcweir WarningBox aBox( DLGWIN, WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); 901*cdf0e10cSrcweir aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); 902*cdf0e10cSrcweir aBox.Execute(); 903*cdf0e10cSrcweir } 904*cdf0e10cSrcweir } 905*cdf0e10cSrcweir delete pDlg; 906*cdf0e10cSrcweir } 907*cdf0e10cSrcweir return 0L; 908*cdf0e10cSrcweir } 909*cdf0e10cSrcweir 910*cdf0e10cSrcweir //------------------------------------------------------------------------ 911*cdf0e10cSrcweir 912*cdf0e10cSrcweir IMPL_LINK( SvxBitmapTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) 913*cdf0e10cSrcweir { 914*cdf0e10cSrcweir sal_uInt16 nPos = aLbBitmaps.GetSelectEntryPos(); 915*cdf0e10cSrcweir 916*cdf0e10cSrcweir if( nPos != LISTBOX_ENTRY_NOTFOUND ) 917*cdf0e10cSrcweir { 918*cdf0e10cSrcweir QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), 919*cdf0e10cSrcweir String( CUI_RES( RID_SVXSTR_ASK_DEL_BITMAP ) ) ); 920*cdf0e10cSrcweir 921*cdf0e10cSrcweir if( aQueryBox.Execute() == RET_YES ) 922*cdf0e10cSrcweir { 923*cdf0e10cSrcweir delete pBitmapList->Remove( nPos ); 924*cdf0e10cSrcweir aLbBitmaps.RemoveEntry( nPos ); 925*cdf0e10cSrcweir aLbBitmaps.SelectEntryPos( 0 ); 926*cdf0e10cSrcweir 927*cdf0e10cSrcweir aCtlPreview.Invalidate(); 928*cdf0e10cSrcweir aCtlPixel.Invalidate(); 929*cdf0e10cSrcweir 930*cdf0e10cSrcweir ChangeBitmapHdl_Impl( this ); 931*cdf0e10cSrcweir 932*cdf0e10cSrcweir // Flag fuer modifiziert setzen 933*cdf0e10cSrcweir *pnBitmapListState |= CT_MODIFIED; 934*cdf0e10cSrcweir } 935*cdf0e10cSrcweir } 936*cdf0e10cSrcweir // Status der Buttons ermitteln 937*cdf0e10cSrcweir if( !pBitmapList->Count() ) 938*cdf0e10cSrcweir { 939*cdf0e10cSrcweir aBtnModify.Disable(); 940*cdf0e10cSrcweir aBtnDelete.Disable(); 941*cdf0e10cSrcweir aBtnSave.Disable(); 942*cdf0e10cSrcweir } 943*cdf0e10cSrcweir return 0L; 944*cdf0e10cSrcweir } 945*cdf0e10cSrcweir 946*cdf0e10cSrcweir // ----------------------------------------------------------------------- 947*cdf0e10cSrcweir 948*cdf0e10cSrcweir IMPL_LINK( SvxBitmapTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) 949*cdf0e10cSrcweir { 950*cdf0e10cSrcweir sal_uInt16 nReturn = RET_YES; 951*cdf0e10cSrcweir ResMgr& rMgr = CUI_MGR(); 952*cdf0e10cSrcweir 953*cdf0e10cSrcweir if ( *pnBitmapListState & CT_MODIFIED ) 954*cdf0e10cSrcweir { 955*cdf0e10cSrcweir nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), 956*cdf0e10cSrcweir String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); 957*cdf0e10cSrcweir 958*cdf0e10cSrcweir if ( nReturn == RET_YES ) 959*cdf0e10cSrcweir pBitmapList->Save(); 960*cdf0e10cSrcweir } 961*cdf0e10cSrcweir 962*cdf0e10cSrcweir if ( nReturn != RET_CANCEL ) 963*cdf0e10cSrcweir { 964*cdf0e10cSrcweir ::sfx2::FileDialogHelper aDlg( 965*cdf0e10cSrcweir com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 966*cdf0e10cSrcweir 0 ); 967*cdf0e10cSrcweir String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sob" ) ); 968*cdf0e10cSrcweir aDlg.AddFilter( aStrFilterType, aStrFilterType ); 969*cdf0e10cSrcweir INetURLObject aFile( SvtPathOptions().GetPalettePath() ); 970*cdf0e10cSrcweir aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); 971*cdf0e10cSrcweir 972*cdf0e10cSrcweir if ( aDlg.Execute() == ERRCODE_NONE ) 973*cdf0e10cSrcweir { 974*cdf0e10cSrcweir EnterWait(); 975*cdf0e10cSrcweir INetURLObject aURL( aDlg.GetPath() ); 976*cdf0e10cSrcweir INetURLObject aPathURL( aURL ); 977*cdf0e10cSrcweir 978*cdf0e10cSrcweir aPathURL.removeSegment(); 979*cdf0e10cSrcweir aPathURL.removeFinalSlash(); 980*cdf0e10cSrcweir 981*cdf0e10cSrcweir // Tabelle speichern 982*cdf0e10cSrcweir XBitmapList* pBmpList = new XBitmapList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); 983*cdf0e10cSrcweir pBmpList->SetName( aURL.getName() ); 984*cdf0e10cSrcweir if( pBmpList->Load() ) 985*cdf0e10cSrcweir { 986*cdf0e10cSrcweir if( pBmpList ) 987*cdf0e10cSrcweir { 988*cdf0e10cSrcweir // Pruefen, ob Tabelle geloescht werden darf: 989*cdf0e10cSrcweir if( pBitmapList != ( (SvxAreaTabDialog*) DLGWIN )->GetBitmapList() ) 990*cdf0e10cSrcweir delete pBitmapList; 991*cdf0e10cSrcweir 992*cdf0e10cSrcweir pBitmapList = pBmpList; 993*cdf0e10cSrcweir ( (SvxAreaTabDialog*) DLGWIN )->SetNewBitmapList( pBitmapList ); 994*cdf0e10cSrcweir 995*cdf0e10cSrcweir aLbBitmaps.Clear(); 996*cdf0e10cSrcweir aLbBitmaps.Fill( pBitmapList ); 997*cdf0e10cSrcweir Reset( rOutAttrs ); 998*cdf0e10cSrcweir 999*cdf0e10cSrcweir pBitmapList->SetName( aURL.getName() ); 1000*cdf0e10cSrcweir 1001*cdf0e10cSrcweir // Ermitteln (evtl. abschneiden) des Namens und in 1002*cdf0e10cSrcweir // der GroupBox darstellen 1003*cdf0e10cSrcweir String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); 1004*cdf0e10cSrcweir aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); 1005*cdf0e10cSrcweir 1006*cdf0e10cSrcweir if ( aURL.getBase().getLength() > 18 ) 1007*cdf0e10cSrcweir { 1008*cdf0e10cSrcweir aString += String(aURL.getBase()).Copy( 0, 15 ); 1009*cdf0e10cSrcweir aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); 1010*cdf0e10cSrcweir } 1011*cdf0e10cSrcweir else 1012*cdf0e10cSrcweir aString += String(aURL.getBase()); 1013*cdf0e10cSrcweir 1014*cdf0e10cSrcweir // Flag fuer gewechselt setzen 1015*cdf0e10cSrcweir *pnBitmapListState |= CT_CHANGED; 1016*cdf0e10cSrcweir // Flag fuer modifiziert entfernen 1017*cdf0e10cSrcweir *pnBitmapListState &= ~CT_MODIFIED; 1018*cdf0e10cSrcweir } 1019*cdf0e10cSrcweir LeaveWait(); 1020*cdf0e10cSrcweir } 1021*cdf0e10cSrcweir else 1022*cdf0e10cSrcweir { 1023*cdf0e10cSrcweir LeaveWait(); 1024*cdf0e10cSrcweir ErrorBox( DLGWIN, WinBits( WB_OK ), 1025*cdf0e10cSrcweir String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); 1026*cdf0e10cSrcweir } 1027*cdf0e10cSrcweir } 1028*cdf0e10cSrcweir } 1029*cdf0e10cSrcweir 1030*cdf0e10cSrcweir // Status der Buttons ermitteln 1031*cdf0e10cSrcweir if( pBitmapList->Count() ) 1032*cdf0e10cSrcweir { 1033*cdf0e10cSrcweir aBtnModify.Enable(); 1034*cdf0e10cSrcweir aBtnDelete.Enable(); 1035*cdf0e10cSrcweir aBtnSave.Enable(); 1036*cdf0e10cSrcweir } 1037*cdf0e10cSrcweir else 1038*cdf0e10cSrcweir { 1039*cdf0e10cSrcweir aBtnModify.Disable(); 1040*cdf0e10cSrcweir aBtnDelete.Disable(); 1041*cdf0e10cSrcweir aBtnSave.Disable(); 1042*cdf0e10cSrcweir } 1043*cdf0e10cSrcweir return 0L; 1044*cdf0e10cSrcweir } 1045*cdf0e10cSrcweir 1046*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1047*cdf0e10cSrcweir 1048*cdf0e10cSrcweir IMPL_LINK( SvxBitmapTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) 1049*cdf0e10cSrcweir { 1050*cdf0e10cSrcweir ::sfx2::FileDialogHelper aDlg( 1051*cdf0e10cSrcweir com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); 1052*cdf0e10cSrcweir String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sob" ) ); 1053*cdf0e10cSrcweir aDlg.AddFilter( aStrFilterType, aStrFilterType ); 1054*cdf0e10cSrcweir 1055*cdf0e10cSrcweir INetURLObject aFile( SvtPathOptions().GetPalettePath() ); 1056*cdf0e10cSrcweir DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); 1057*cdf0e10cSrcweir 1058*cdf0e10cSrcweir if( pBitmapList->GetName().Len() ) 1059*cdf0e10cSrcweir { 1060*cdf0e10cSrcweir aFile.Append( pBitmapList->GetName() ); 1061*cdf0e10cSrcweir 1062*cdf0e10cSrcweir if( !aFile.getExtension().getLength() ) 1063*cdf0e10cSrcweir aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "sob" ) ) ); 1064*cdf0e10cSrcweir } 1065*cdf0e10cSrcweir 1066*cdf0e10cSrcweir aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); 1067*cdf0e10cSrcweir if ( aDlg.Execute() == ERRCODE_NONE ) 1068*cdf0e10cSrcweir { 1069*cdf0e10cSrcweir INetURLObject aURL( aDlg.GetPath() ); 1070*cdf0e10cSrcweir INetURLObject aPathURL( aURL ); 1071*cdf0e10cSrcweir 1072*cdf0e10cSrcweir aPathURL.removeSegment(); 1073*cdf0e10cSrcweir aPathURL.removeFinalSlash(); 1074*cdf0e10cSrcweir 1075*cdf0e10cSrcweir pBitmapList->SetName( aURL.getName() ); 1076*cdf0e10cSrcweir pBitmapList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); 1077*cdf0e10cSrcweir 1078*cdf0e10cSrcweir if( pBitmapList->Save() ) 1079*cdf0e10cSrcweir { 1080*cdf0e10cSrcweir // Ermitteln (evtl. abschneiden) des Namens und in 1081*cdf0e10cSrcweir // der GroupBox darstellen 1082*cdf0e10cSrcweir String aString( CUI_RES( RID_SVXSTR_TABLE ) ); 1083*cdf0e10cSrcweir aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); 1084*cdf0e10cSrcweir 1085*cdf0e10cSrcweir if ( aURL.getBase().getLength() > 18 ) 1086*cdf0e10cSrcweir { 1087*cdf0e10cSrcweir aString += String(aURL.getBase()).Copy( 0, 15 ); 1088*cdf0e10cSrcweir aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); 1089*cdf0e10cSrcweir } 1090*cdf0e10cSrcweir else 1091*cdf0e10cSrcweir aString += String(aURL.getBase()); 1092*cdf0e10cSrcweir 1093*cdf0e10cSrcweir // Flag fuer gespeichert setzen 1094*cdf0e10cSrcweir *pnBitmapListState |= CT_SAVED; 1095*cdf0e10cSrcweir // Flag fuer modifiziert entfernen 1096*cdf0e10cSrcweir *pnBitmapListState &= ~CT_MODIFIED; 1097*cdf0e10cSrcweir } 1098*cdf0e10cSrcweir else 1099*cdf0e10cSrcweir { 1100*cdf0e10cSrcweir ErrorBox( DLGWIN, WinBits( WB_OK ), 1101*cdf0e10cSrcweir String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute(); 1102*cdf0e10cSrcweir } 1103*cdf0e10cSrcweir } 1104*cdf0e10cSrcweir 1105*cdf0e10cSrcweir return 0L; 1106*cdf0e10cSrcweir } 1107*cdf0e10cSrcweir 1108*cdf0e10cSrcweir //------------------------------------------------------------------------ 1109*cdf0e10cSrcweir 1110*cdf0e10cSrcweir IMPL_LINK( SvxBitmapTabPage, ChangePixelColorHdl_Impl, void *, EMPTYARG ) 1111*cdf0e10cSrcweir { 1112*cdf0e10cSrcweir aCtlPixel.SetPixelColor( aLbColor.GetSelectEntryColor() ); 1113*cdf0e10cSrcweir aCtlPixel.Invalidate(); 1114*cdf0e10cSrcweir 1115*cdf0e10cSrcweir aBitmapCtl.SetPixelColor( aLbColor.GetSelectEntryColor() ); 1116*cdf0e10cSrcweir 1117*cdf0e10cSrcweir // Bitmap holen und darstellen 1118*cdf0e10cSrcweir rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) ); 1119*cdf0e10cSrcweir aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); 1120*cdf0e10cSrcweir aCtlPreview.Invalidate(); 1121*cdf0e10cSrcweir 1122*cdf0e10cSrcweir bBmpChanged = sal_True; 1123*cdf0e10cSrcweir 1124*cdf0e10cSrcweir return 0L; 1125*cdf0e10cSrcweir } 1126*cdf0e10cSrcweir 1127*cdf0e10cSrcweir //------------------------------------------------------------------------ 1128*cdf0e10cSrcweir 1129*cdf0e10cSrcweir IMPL_LINK( SvxBitmapTabPage, ChangeBackgrndColorHdl_Impl, void *, EMPTYARG ) 1130*cdf0e10cSrcweir { 1131*cdf0e10cSrcweir aCtlPixel.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() ); 1132*cdf0e10cSrcweir aCtlPixel.Invalidate(); 1133*cdf0e10cSrcweir 1134*cdf0e10cSrcweir aBitmapCtl.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() ); 1135*cdf0e10cSrcweir 1136*cdf0e10cSrcweir // Bitmap holen und darstellen 1137*cdf0e10cSrcweir rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) ); 1138*cdf0e10cSrcweir aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); 1139*cdf0e10cSrcweir aCtlPreview.Invalidate(); 1140*cdf0e10cSrcweir 1141*cdf0e10cSrcweir bBmpChanged = sal_True; 1142*cdf0e10cSrcweir 1143*cdf0e10cSrcweir return 0L; 1144*cdf0e10cSrcweir } 1145*cdf0e10cSrcweir 1146*cdf0e10cSrcweir //------------------------------------------------------------------------ 1147*cdf0e10cSrcweir 1148*cdf0e10cSrcweir void SvxBitmapTabPage::PointChanged( Window* pWindow, RECT_POINT ) 1149*cdf0e10cSrcweir { 1150*cdf0e10cSrcweir if( pWindow == &aCtlPixel ) 1151*cdf0e10cSrcweir { 1152*cdf0e10cSrcweir aBitmapCtl.SetBmpArray( aCtlPixel.GetBitmapPixelPtr() ); 1153*cdf0e10cSrcweir 1154*cdf0e10cSrcweir // Bitmap holen und darstellen 1155*cdf0e10cSrcweir rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) ); 1156*cdf0e10cSrcweir aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); 1157*cdf0e10cSrcweir aCtlPreview.Invalidate(); 1158*cdf0e10cSrcweir 1159*cdf0e10cSrcweir bBmpChanged = sal_True; 1160*cdf0e10cSrcweir } 1161*cdf0e10cSrcweir } 1162*cdf0e10cSrcweir 1163*cdf0e10cSrcweir 1164*cdf0e10cSrcweir 1165*cdf0e10cSrcweir 1166*cdf0e10cSrcweir Window* SvxBitmapTabPage::GetParentLabeledBy( const Window* pLabeled ) const 1167*cdf0e10cSrcweir { 1168*cdf0e10cSrcweir if (pLabeled == &aLbBitmaps) 1169*cdf0e10cSrcweir return const_cast<FixedText*>(&aLbBitmapsHidden); 1170*cdf0e10cSrcweir else 1171*cdf0e10cSrcweir return SvxTabPage::GetParentLabeledBy (pLabeled); 1172*cdf0e10cSrcweir } 1173