12ee96f1cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 32ee96f1cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 42ee96f1cSAndrew Rist * or more contributor license agreements. See the NOTICE file 52ee96f1cSAndrew Rist * distributed with this work for additional information 62ee96f1cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 72ee96f1cSAndrew Rist * to you under the Apache License, Version 2.0 (the 82ee96f1cSAndrew Rist * "License"); you may not use this file except in compliance 92ee96f1cSAndrew Rist * with the License. You may obtain a copy of the License at 102ee96f1cSAndrew Rist * 112ee96f1cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 122ee96f1cSAndrew Rist * 132ee96f1cSAndrew Rist * Unless required by applicable law or agreed to in writing, 142ee96f1cSAndrew Rist * software distributed under the License is distributed on an 152ee96f1cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 162ee96f1cSAndrew Rist * KIND, either express or implied. See the License for the 172ee96f1cSAndrew Rist * specific language governing permissions and limitations 182ee96f1cSAndrew Rist * under the License. 192ee96f1cSAndrew Rist * 202ee96f1cSAndrew Rist *************************************************************/ 212ee96f1cSAndrew Rist 222ee96f1cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_cui.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir // include --------------------------------------------------------------- 28cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 29cdf0e10cSrcweir #include <svl/intitem.hxx> 30cdf0e10cSrcweir #include <vcl/msgbox.hxx> 31cdf0e10cSrcweir #include <tools/urlobj.hxx> 32cdf0e10cSrcweir #include <sfx2/objsh.hxx> 33cdf0e10cSrcweir #include <sfx2/docfile.hxx> 34cdf0e10cSrcweir #include <svtools/wallitem.hxx> 35cdf0e10cSrcweir #include <svl/cntwall.hxx> 36cdf0e10cSrcweir #include <sfx2/cntids.hrc> 37cdf0e10cSrcweir #include <svx/dialogs.hrc> 38cdf0e10cSrcweir 39cdf0e10cSrcweir #define _SVX_BACKGRND_CXX 40cdf0e10cSrcweir 41cdf0e10cSrcweir #include <cuires.hrc> 42cdf0e10cSrcweir #include "backgrnd.hrc" 43cdf0e10cSrcweir #include <svx/dialmgr.hxx> 44cdf0e10cSrcweir #include <editeng/memberids.hrc> 45cdf0e10cSrcweir #include <editeng/editrids.hrc> 46cdf0e10cSrcweir #include <editeng/eerdll.hxx> 47cdf0e10cSrcweir 48cdf0e10cSrcweir // Tabellenhintergrund 49cdf0e10cSrcweir #define TBL_DEST_CELL 0 50cdf0e10cSrcweir #define TBL_DEST_ROW 1 51cdf0e10cSrcweir #define TBL_DEST_TBL 2 52cdf0e10cSrcweir 53cdf0e10cSrcweir #include <editeng/brshitem.hxx> 54cdf0e10cSrcweir #include "backgrnd.hxx" 55cdf0e10cSrcweir 56cdf0e10cSrcweir #include <svx/xtable.hxx> 57cdf0e10cSrcweir #include <sfx2/opengrf.hxx> 58cdf0e10cSrcweir #include <svx/svxerr.hxx> 59cdf0e10cSrcweir #include <svx/drawitem.hxx> 60cdf0e10cSrcweir #include <dialmgr.hxx> 61cdf0e10cSrcweir #include <svx/htmlmode.hxx> 62cdf0e10cSrcweir #include <svtools/controldims.hrc> 63cdf0e10cSrcweir #include <svx/flagsdef.hxx> //CHINA001 64cdf0e10cSrcweir #include <svl/intitem.hxx> //CHINA001 65cdf0e10cSrcweir #include <sfx2/request.hxx> //CHINA001 66*70d3707aSArmin Le Grand #include <svtools/grfmgr.hxx> 67*70d3707aSArmin Le Grand 68cdf0e10cSrcweir using namespace ::com::sun::star; 69cdf0e10cSrcweir // static ---------------------------------------------------------------- 70cdf0e10cSrcweir 71cdf0e10cSrcweir static sal_uInt16 pRanges[] = 72cdf0e10cSrcweir { 73cdf0e10cSrcweir SID_VIEW_FLD_PIC, SID_VIEW_FLD_PIC, 74cdf0e10cSrcweir SID_ATTR_BRUSH, SID_ATTR_BRUSH, 75cdf0e10cSrcweir SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR, 76cdf0e10cSrcweir 0 77cdf0e10cSrcweir }; 78cdf0e10cSrcweir 79cdf0e10cSrcweir struct SvxBackgroundTable_Impl 80cdf0e10cSrcweir { 81cdf0e10cSrcweir SvxBrushItem* pCellBrush; 82cdf0e10cSrcweir SvxBrushItem* pRowBrush; 83cdf0e10cSrcweir SvxBrushItem* pTableBrush; 84cdf0e10cSrcweir sal_uInt16 nCellWhich; 85cdf0e10cSrcweir sal_uInt16 nRowWhich; 86cdf0e10cSrcweir sal_uInt16 nTableWhich; 87cdf0e10cSrcweir sal_uInt16 nActPos; 88cdf0e10cSrcweir 89cdf0e10cSrcweir SvxBackgroundTable_Impl() : 90cdf0e10cSrcweir pCellBrush(NULL), pRowBrush(NULL), pTableBrush(NULL), 91cdf0e10cSrcweir nCellWhich(0), nRowWhich(0), nTableWhich(0) {} 92cdf0e10cSrcweir }; 93cdf0e10cSrcweir 94cdf0e10cSrcweir struct SvxBackgroundPara_Impl 95cdf0e10cSrcweir { 96cdf0e10cSrcweir SvxBrushItem* pParaBrush; 97cdf0e10cSrcweir SvxBrushItem* pCharBrush; 98cdf0e10cSrcweir 99cdf0e10cSrcweir sal_uInt16 nActPos; 100cdf0e10cSrcweir 101cdf0e10cSrcweir SvxBackgroundPara_Impl() : 102cdf0e10cSrcweir pParaBrush(NULL), pCharBrush(NULL) {} 103cdf0e10cSrcweir }; 104cdf0e10cSrcweir 105cdf0e10cSrcweir struct SvxBackgroundPage_Impl 106cdf0e10cSrcweir { 107cdf0e10cSrcweir Timer* pLoadTimer; 108cdf0e10cSrcweir sal_Bool bIsImportDlgInExecute; 109cdf0e10cSrcweir 110cdf0e10cSrcweir SvxBackgroundPage_Impl() : 111cdf0e10cSrcweir pLoadTimer(NULL), bIsImportDlgInExecute(sal_False) {} 112cdf0e10cSrcweir }; 113cdf0e10cSrcweir /* -----------------------------15.08.2002 12:21------------------------------ 114cdf0e10cSrcweir 115cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 116cdf0e10cSrcweir inline sal_uInt8 lcl_PercentToTransparency(long nPercent) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir //0xff must not be returned! 119cdf0e10cSrcweir return sal_uInt8(nPercent ? (50 + 0xfe * nPercent) / 100 : 0); 120cdf0e10cSrcweir } 121cdf0e10cSrcweir inline sal_uInt8 lcl_TransparencyToPercent(sal_uInt8 nTrans) 122cdf0e10cSrcweir { 123cdf0e10cSrcweir return (nTrans * 100 + 127) / 254; 124cdf0e10cSrcweir } 125cdf0e10cSrcweir void lcl_SetTransparency(SvxBrushItem& rBrush, long nTransparency) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir uno::Any aTransparency; 128cdf0e10cSrcweir aTransparency <<= (sal_Int8)nTransparency; 129cdf0e10cSrcweir rBrush.PutValue(aTransparency, MID_GRAPHIC_TRANSPARENCY); 130cdf0e10cSrcweir } 131cdf0e10cSrcweir //------------------------------------------------------------------------- 132cdf0e10cSrcweir 133cdf0e10cSrcweir /* [Beschreibung] 134cdf0e10cSrcweir 135cdf0e10cSrcweir */ 136cdf0e10cSrcweir 137cdf0e10cSrcweir sal_uInt16 GetItemId_Impl( ValueSet& rValueSet, const Color& rCol ) 138cdf0e10cSrcweir { 139cdf0e10cSrcweir sal_Bool bFound = sal_False; 140cdf0e10cSrcweir sal_uInt16 nCount = rValueSet.GetItemCount(); 141cdf0e10cSrcweir sal_uInt16 n = 1; 142cdf0e10cSrcweir 143cdf0e10cSrcweir while ( !bFound && n <= nCount ) 144cdf0e10cSrcweir { 145cdf0e10cSrcweir Color aValCol = rValueSet.GetItemColor(n); 146cdf0e10cSrcweir 147cdf0e10cSrcweir bFound = ( aValCol.GetRed() == rCol.GetRed() 148cdf0e10cSrcweir && aValCol.GetGreen() == rCol.GetGreen() 149cdf0e10cSrcweir && aValCol.GetBlue() == rCol.GetBlue() ); 150cdf0e10cSrcweir 151cdf0e10cSrcweir if ( !bFound ) 152cdf0e10cSrcweir n++; 153cdf0e10cSrcweir } 154cdf0e10cSrcweir return bFound ? n : 0; 155cdf0e10cSrcweir } 156cdf0e10cSrcweir 157cdf0e10cSrcweir // class BackgroundPreview ----------------------------------------------- 158cdf0e10cSrcweir 159cdf0e10cSrcweir /* [Beschreibung] 160cdf0e10cSrcweir 161cdf0e10cSrcweir Vorschaufenster f"ur Brush oder Bitmap 162cdf0e10cSrcweir */ 163cdf0e10cSrcweir 164cdf0e10cSrcweir class BackgroundPreviewImpl : public Window 165cdf0e10cSrcweir { 166cdf0e10cSrcweir public: 167cdf0e10cSrcweir BackgroundPreviewImpl( Window* pParent, 168cdf0e10cSrcweir const ResId& rResId, sal_Bool bIsBmpPreview ); 169cdf0e10cSrcweir ~BackgroundPreviewImpl(); 170cdf0e10cSrcweir 171cdf0e10cSrcweir void NotifyChange( const Color& rColor ); 172cdf0e10cSrcweir void NotifyChange( const Bitmap* pBitmap ); 173cdf0e10cSrcweir 174cdf0e10cSrcweir protected: 175cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 176cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 177cdf0e10cSrcweir 178cdf0e10cSrcweir private: 179cdf0e10cSrcweir const sal_Bool bIsBmp; 180cdf0e10cSrcweir Bitmap* pBitmap; 181cdf0e10cSrcweir Point aDrawPos; 182cdf0e10cSrcweir Size aDrawSize; 183cdf0e10cSrcweir Rectangle aDrawRect; 184cdf0e10cSrcweir sal_uInt8 nTransparency; 185cdf0e10cSrcweir }; 186cdf0e10cSrcweir 187cdf0e10cSrcweir //----------------------------------------------------------------------- 188cdf0e10cSrcweir 189cdf0e10cSrcweir BackgroundPreviewImpl::BackgroundPreviewImpl 190cdf0e10cSrcweir ( 191cdf0e10cSrcweir Window* pParent, 192cdf0e10cSrcweir const ResId& rResId, 193cdf0e10cSrcweir sal_Bool bIsBmpPreview 194cdf0e10cSrcweir ) : 195cdf0e10cSrcweir 196cdf0e10cSrcweir /* [Beschreibung] 197cdf0e10cSrcweir 198cdf0e10cSrcweir */ 199cdf0e10cSrcweir 200cdf0e10cSrcweir Window( pParent, rResId ), 201cdf0e10cSrcweir 202cdf0e10cSrcweir bIsBmp ( bIsBmpPreview ), 203cdf0e10cSrcweir pBitmap ( NULL ), 204cdf0e10cSrcweir aDrawRect( Point(0,0), GetOutputSizePixel() ), 205cdf0e10cSrcweir nTransparency(0) 206cdf0e10cSrcweir 207cdf0e10cSrcweir { 208cdf0e10cSrcweir SetBorderStyle(WINDOW_BORDER_MONO); 209cdf0e10cSrcweir Paint( aDrawRect ); 210cdf0e10cSrcweir } 211cdf0e10cSrcweir 212cdf0e10cSrcweir //----------------------------------------------------------------------- 213cdf0e10cSrcweir 214cdf0e10cSrcweir BackgroundPreviewImpl::~BackgroundPreviewImpl() 215cdf0e10cSrcweir 216cdf0e10cSrcweir /* [Beschreibung] 217cdf0e10cSrcweir 218cdf0e10cSrcweir */ 219cdf0e10cSrcweir 220cdf0e10cSrcweir { 221cdf0e10cSrcweir delete pBitmap; 222cdf0e10cSrcweir } 223cdf0e10cSrcweir 224cdf0e10cSrcweir //----------------------------------------------------------------------- 225cdf0e10cSrcweir void BackgroundPreviewImpl::NotifyChange( const Color& rColor ) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir if ( !bIsBmp ) 228cdf0e10cSrcweir { 229cdf0e10cSrcweir const static Color aTranspCol( COL_TRANSPARENT ); 230cdf0e10cSrcweir 231cdf0e10cSrcweir nTransparency = lcl_TransparencyToPercent( rColor.GetTransparency() ); 232cdf0e10cSrcweir 233cdf0e10cSrcweir SetFillColor( rColor == aTranspCol ? GetSettings().GetStyleSettings().GetFieldColor() : (Color) rColor.GetRGBColor() ); 234cdf0e10cSrcweir Paint( aDrawRect ); 235cdf0e10cSrcweir } 236cdf0e10cSrcweir } 237cdf0e10cSrcweir 238cdf0e10cSrcweir //----------------------------------------------------------------------- 239cdf0e10cSrcweir 240cdf0e10cSrcweir void BackgroundPreviewImpl::NotifyChange( const Bitmap* pNewBitmap ) 241cdf0e10cSrcweir /* [Beschreibung] 242cdf0e10cSrcweir 243cdf0e10cSrcweir */ 244cdf0e10cSrcweir 245cdf0e10cSrcweir { 246cdf0e10cSrcweir if ( bIsBmp && (pNewBitmap || pBitmap) ) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir if ( pNewBitmap && pBitmap ) 249cdf0e10cSrcweir *pBitmap = *pNewBitmap; 250cdf0e10cSrcweir else if ( pNewBitmap && !pBitmap ) 251cdf0e10cSrcweir pBitmap = new Bitmap( *pNewBitmap ); 252cdf0e10cSrcweir else if ( !pNewBitmap ) 253cdf0e10cSrcweir DELETEZ( pBitmap ); 254cdf0e10cSrcweir 255cdf0e10cSrcweir if ( pBitmap ) 256cdf0e10cSrcweir { 257cdf0e10cSrcweir Size aSize = GetOutputSizePixel(); 258cdf0e10cSrcweir // InnerSize == Size without one pixel border 259cdf0e10cSrcweir Size aInnerSize = aSize; 260cdf0e10cSrcweir aInnerSize.Width() -= 2; 261cdf0e10cSrcweir aInnerSize.Height() -= 2; 262cdf0e10cSrcweir aDrawSize = pBitmap->GetSizePixel(); 263cdf0e10cSrcweir 264cdf0e10cSrcweir // bitmap bigger than preview window? 265cdf0e10cSrcweir if ( aDrawSize.Width() > aInnerSize.Width() ) 266cdf0e10cSrcweir { 267cdf0e10cSrcweir aDrawSize.Height() = aDrawSize.Height() * aInnerSize.Width() / aDrawSize.Width(); 268cdf0e10cSrcweir if ( aDrawSize.Height() > aInnerSize.Height() ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir aDrawSize.Width() = aDrawSize.Height(); 271cdf0e10cSrcweir aDrawSize.Height() = aInnerSize.Height(); 272cdf0e10cSrcweir } 273cdf0e10cSrcweir else 274cdf0e10cSrcweir aDrawSize.Width() = aInnerSize.Width(); 275cdf0e10cSrcweir } 276cdf0e10cSrcweir else if ( aDrawSize.Height() > aInnerSize.Height() ) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir aDrawSize.Width() = aDrawSize.Width() * aInnerSize.Height() / aDrawSize.Height(); 279cdf0e10cSrcweir if ( aDrawSize.Width() > aInnerSize.Width() ) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir aDrawSize.Height() = aDrawSize.Width(); 282cdf0e10cSrcweir aDrawSize.Width() = aInnerSize.Width(); 283cdf0e10cSrcweir } 284cdf0e10cSrcweir else 285cdf0e10cSrcweir aDrawSize.Height() = aInnerSize.Height(); 286cdf0e10cSrcweir } 287cdf0e10cSrcweir 288cdf0e10cSrcweir aDrawPos.X() = (aSize.Width() - aDrawSize.Width()) / 2; 289cdf0e10cSrcweir aDrawPos.Y() = (aSize.Height() - aDrawSize.Height()) / 2; 290cdf0e10cSrcweir } 291cdf0e10cSrcweir Invalidate( aDrawRect ); 292cdf0e10cSrcweir Update(); 293cdf0e10cSrcweir } 294cdf0e10cSrcweir } 295cdf0e10cSrcweir 296cdf0e10cSrcweir //----------------------------------------------------------------------- 297cdf0e10cSrcweir 298cdf0e10cSrcweir void BackgroundPreviewImpl::Paint( const Rectangle& ) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 301cdf0e10cSrcweir SetBackground(Wallpaper(rStyleSettings.GetWindowColor())); 302cdf0e10cSrcweir SetLineColor(); 303cdf0e10cSrcweir if(bIsBmp) 304cdf0e10cSrcweir SetFillColor( Color(COL_TRANSPARENT) ); 305cdf0e10cSrcweir DrawRect( aDrawRect ); 306cdf0e10cSrcweir if ( bIsBmp ) 307cdf0e10cSrcweir { 308cdf0e10cSrcweir if ( pBitmap ) 309cdf0e10cSrcweir DrawBitmap( aDrawPos, aDrawSize, *pBitmap ); 310cdf0e10cSrcweir else 311cdf0e10cSrcweir { 312cdf0e10cSrcweir Size aSize = GetOutputSizePixel(); 313cdf0e10cSrcweir DrawLine( Point(0,0), Point(aSize.Width(),aSize.Height()) ); 314cdf0e10cSrcweir DrawLine( Point(0,aSize.Height()), Point(aSize.Width(),0) ); 315cdf0e10cSrcweir } 316cdf0e10cSrcweir } 317cdf0e10cSrcweir } 318cdf0e10cSrcweir /* -----------------------------27.02.2002 11:07------------------------------ 319cdf0e10cSrcweir 320cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 321cdf0e10cSrcweir void BackgroundPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt ) 322cdf0e10cSrcweir { 323cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && 324cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 325cdf0e10cSrcweir { 326cdf0e10cSrcweir Invalidate(); 327cdf0e10cSrcweir } 328cdf0e10cSrcweir Window::DataChanged( rDCEvt ); 329cdf0e10cSrcweir } 330cdf0e10cSrcweir 331cdf0e10cSrcweir // class SvxBackgroundTabPage -------------------------------------------- 332cdf0e10cSrcweir 333cdf0e10cSrcweir #define HDL(hdl) LINK(this,SvxBackgroundTabPage,hdl) 334cdf0e10cSrcweir 335cdf0e10cSrcweir SvxBackgroundTabPage::SvxBackgroundTabPage( Window* pParent, 336cdf0e10cSrcweir const SfxItemSet& rCoreSet ) : 337cdf0e10cSrcweir 338cdf0e10cSrcweir /* [Beschreibung] 339cdf0e10cSrcweir 340cdf0e10cSrcweir */ 341cdf0e10cSrcweir 342cdf0e10cSrcweir SvxTabPage( pParent, CUI_RES( RID_SVXPAGE_BACKGROUND ), rCoreSet ), 343cdf0e10cSrcweir 344cdf0e10cSrcweir aSelectTxt ( this, CUI_RES( FT_SELECTOR ) ), 345cdf0e10cSrcweir aLbSelect ( this, CUI_RES( LB_SELECTOR ) ), 346cdf0e10cSrcweir aStrBrowse ( CUI_RES( STR_BROWSE ) ), 347cdf0e10cSrcweir aStrUnlinked ( CUI_RES( STR_UNLINKED ) ), 348cdf0e10cSrcweir aTblDesc ( this, CUI_RES( FT_TBL_DESC ) ), 349cdf0e10cSrcweir aTblLBox ( this, CUI_RES( LB_TBL_BOX ) ), 350cdf0e10cSrcweir aParaLBox ( this, CUI_RES( LB_PARA_BOX ) ), 351cdf0e10cSrcweir 352cdf0e10cSrcweir aBorderWin ( this, CUI_RES(CT_BORDER) ), 353cdf0e10cSrcweir aBackgroundColorSet ( &aBorderWin, CUI_RES( SET_BGDCOLOR ) ), 354cdf0e10cSrcweir aBackgroundColorBox ( this, CUI_RES( GB_BGDCOLOR ) ), 355cdf0e10cSrcweir pPreviewWin1 ( new BackgroundPreviewImpl( this, CUI_RES( WIN_PREVIEW1 ), sal_False ) ), 356cdf0e10cSrcweir 357cdf0e10cSrcweir aColTransFT ( this, CUI_RES( FT_COL_TRANS ) ), 358cdf0e10cSrcweir aColTransMF ( this, CUI_RES( MF_COL_TRANS ) ), 359cdf0e10cSrcweir aBtnPreview ( this, CUI_RES( BTN_PREVIEW ) ), 360cdf0e10cSrcweir aGbFile ( this, CUI_RES( GB_FILE ) ), 361cdf0e10cSrcweir aBtnBrowse ( this, CUI_RES( BTN_BROWSE ) ), 362cdf0e10cSrcweir aBtnLink ( this, CUI_RES( BTN_LINK ) ), 363cdf0e10cSrcweir aGbPosition ( this, CUI_RES( GB_POSITION ) ), 364cdf0e10cSrcweir aBtnPosition ( this, CUI_RES( BTN_POSITION ) ), 365cdf0e10cSrcweir aBtnArea ( this, CUI_RES( BTN_AREA ) ), 366cdf0e10cSrcweir aBtnTile ( this, CUI_RES( BTN_TILE ) ), 367cdf0e10cSrcweir aWndPosition ( this, CUI_RES( WND_POSITION ), RP_MM ), 368cdf0e10cSrcweir aFtFile ( this, CUI_RES( FT_FILE ) ), 369cdf0e10cSrcweir aGraphTransFL ( this, CUI_RES( FL_GRAPH_TRANS ) ), 370cdf0e10cSrcweir aGraphTransMF ( this, CUI_RES( MF_GRAPH_TRANS ) ), 371cdf0e10cSrcweir pPreviewWin2 ( new BackgroundPreviewImpl( 372cdf0e10cSrcweir this, CUI_RES( WIN_PREVIEW2 ), sal_True ) ), 373cdf0e10cSrcweir 374cdf0e10cSrcweir nHtmlMode ( 0 ), 375cdf0e10cSrcweir bAllowShowSelector ( sal_True ), 376cdf0e10cSrcweir bIsGraphicValid ( sal_False ), 377cdf0e10cSrcweir bLinkOnly ( sal_False ), 378cdf0e10cSrcweir bResized ( sal_False ), 379cdf0e10cSrcweir bColTransparency ( sal_False ), 380cdf0e10cSrcweir bGraphTransparency ( sal_False ), 381cdf0e10cSrcweir 382cdf0e10cSrcweir pPageImpl ( new SvxBackgroundPage_Impl ), 383cdf0e10cSrcweir pImportDlg ( NULL ), 384cdf0e10cSrcweir pTableBck_Impl ( NULL ), 385cdf0e10cSrcweir pParaBck_Impl ( NULL ) 386cdf0e10cSrcweir 387cdf0e10cSrcweir { 388cdf0e10cSrcweir // diese Page braucht ExchangeSupport 389cdf0e10cSrcweir SetExchangeSupport(); 390cdf0e10cSrcweir 391cdf0e10cSrcweir const SfxPoolItem* pItem; 392cdf0e10cSrcweir SfxObjectShell* pShell; 393cdf0e10cSrcweir 394cdf0e10cSrcweir if ( SFX_ITEM_SET == rCoreSet.GetItemState( SID_HTML_MODE, sal_False, &pItem ) 395cdf0e10cSrcweir || ( 0 != ( pShell = SfxObjectShell::Current()) && 396cdf0e10cSrcweir 0 != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) ) 397cdf0e10cSrcweir { 398cdf0e10cSrcweir nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); 399cdf0e10cSrcweir } 400cdf0e10cSrcweir 401cdf0e10cSrcweir FillColorValueSets_Impl(); 402cdf0e10cSrcweir 403cdf0e10cSrcweir aBackgroundColorSet.SetSelectHdl( HDL(BackgroundColorHdl_Impl) ); 404cdf0e10cSrcweir FreeResource(); 405cdf0e10cSrcweir 406cdf0e10cSrcweir aBtnBrowse.SetAccessibleRelationMemberOf(&aGbFile); 407cdf0e10cSrcweir aWndPosition.SetAccessibleRelationMemberOf(&aGbPosition); 408cdf0e10cSrcweir aWndPosition.SetAccessibleRelationLabeledBy(&aBtnPosition); 409cdf0e10cSrcweir aBackgroundColorSet.SetAccessibleRelationLabeledBy(&aBackgroundColorBox); 410cdf0e10cSrcweir } 411cdf0e10cSrcweir 412cdf0e10cSrcweir //------------------------------------------------------------------------ 413cdf0e10cSrcweir 414cdf0e10cSrcweir SvxBackgroundTabPage::~SvxBackgroundTabPage() 415cdf0e10cSrcweir 416cdf0e10cSrcweir /* [Beschreibung] 417cdf0e10cSrcweir 418cdf0e10cSrcweir */ 419cdf0e10cSrcweir 420cdf0e10cSrcweir { 421cdf0e10cSrcweir delete pPreviewWin1; 422cdf0e10cSrcweir delete pPreviewWin2; 423cdf0e10cSrcweir delete pPageImpl->pLoadTimer; 424cdf0e10cSrcweir delete pPageImpl; 425cdf0e10cSrcweir delete pImportDlg; 426cdf0e10cSrcweir 427cdf0e10cSrcweir if( pTableBck_Impl) 428cdf0e10cSrcweir { 429cdf0e10cSrcweir delete pTableBck_Impl->pCellBrush; 430cdf0e10cSrcweir delete pTableBck_Impl->pRowBrush; 431cdf0e10cSrcweir delete pTableBck_Impl->pTableBrush; 432cdf0e10cSrcweir delete pTableBck_Impl; 433cdf0e10cSrcweir } 434cdf0e10cSrcweir 435cdf0e10cSrcweir if(pParaBck_Impl) 436cdf0e10cSrcweir { 437cdf0e10cSrcweir delete pParaBck_Impl->pParaBrush; 438cdf0e10cSrcweir delete pParaBck_Impl->pCharBrush; 439cdf0e10cSrcweir delete pParaBck_Impl; 440cdf0e10cSrcweir } 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir //------------------------------------------------------------------------ 444cdf0e10cSrcweir 445cdf0e10cSrcweir sal_uInt16* SvxBackgroundTabPage::GetRanges() 446cdf0e10cSrcweir 447cdf0e10cSrcweir /* [Beschreibung] 448cdf0e10cSrcweir 449cdf0e10cSrcweir gibt den Bereich der Which-Werte zur"uck 450cdf0e10cSrcweir */ 451cdf0e10cSrcweir 452cdf0e10cSrcweir { 453cdf0e10cSrcweir return pRanges; 454cdf0e10cSrcweir } 455cdf0e10cSrcweir 456cdf0e10cSrcweir //------------------------------------------------------------------------ 457cdf0e10cSrcweir 458cdf0e10cSrcweir SfxTabPage* SvxBackgroundTabPage::Create( Window* pParent, 459cdf0e10cSrcweir const SfxItemSet& rAttrSet ) 460cdf0e10cSrcweir 461cdf0e10cSrcweir /* [Beschreibung] 462cdf0e10cSrcweir 463cdf0e10cSrcweir Create-Methode f"ur den TabDialog 464cdf0e10cSrcweir */ 465cdf0e10cSrcweir 466cdf0e10cSrcweir { 467cdf0e10cSrcweir return ( new SvxBackgroundTabPage( pParent, rAttrSet ) ); 468cdf0e10cSrcweir } 469cdf0e10cSrcweir 470cdf0e10cSrcweir //------------------------------------------------------------------------ 471cdf0e10cSrcweir 472cdf0e10cSrcweir void SvxBackgroundTabPage::Reset( const SfxItemSet& rSet ) 473cdf0e10cSrcweir 474cdf0e10cSrcweir /* [Beschreibung] 475cdf0e10cSrcweir 476cdf0e10cSrcweir */ 477cdf0e10cSrcweir 478cdf0e10cSrcweir { 479cdf0e10cSrcweir // os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden, 480cdf0e10cSrcweir // es muss aber im rSet vorhanden sein! 481cdf0e10cSrcweir // const SfxPoolItem* pX = GetOldItem( rSet, SID_VIEW_FLD_PIC ); 482cdf0e10cSrcweir // if( pX && pX->ISA(SfxWallpaperItem)) 483cdf0e10cSrcweir if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), sal_False)) 484cdf0e10cSrcweir { 485cdf0e10cSrcweir ResetFromWallpaperItem( rSet ); 486cdf0e10cSrcweir return; 487cdf0e10cSrcweir } 488cdf0e10cSrcweir 489cdf0e10cSrcweir // Zustand des Vorschau-Buttons durch UserData persistent 490cdf0e10cSrcweir String aUserData = GetUserData(); 491cdf0e10cSrcweir aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) ); 492cdf0e10cSrcweir 493cdf0e10cSrcweir // nach Reset kein ShowSelector() mehr aufrufen d"urfen 494cdf0e10cSrcweir bAllowShowSelector = sal_False; 495cdf0e10cSrcweir 496cdf0e10cSrcweir 497cdf0e10cSrcweir // Input-BrushItem besorgen und auswerten 498cdf0e10cSrcweir const SvxBrushItem* pBgdAttr = NULL; 499cdf0e10cSrcweir sal_uInt16 nSlot = SID_ATTR_BRUSH; 500cdf0e10cSrcweir const SfxPoolItem* pItem; 501cdf0e10cSrcweir sal_uInt16 nDestValue = USHRT_MAX; 502cdf0e10cSrcweir 503cdf0e10cSrcweir if ( SFX_ITEM_SET == rSet.GetItemState( SID_BACKGRND_DESTINATION, 504cdf0e10cSrcweir sal_False, &pItem ) ) 505cdf0e10cSrcweir { 506cdf0e10cSrcweir nDestValue = ((const SfxUInt16Item*)pItem)->GetValue(); 507cdf0e10cSrcweir aTblLBox.SelectEntryPos(nDestValue); 508cdf0e10cSrcweir 509cdf0e10cSrcweir switch ( nDestValue ) 510cdf0e10cSrcweir { 511cdf0e10cSrcweir case TBL_DEST_CELL: 512cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH; 513cdf0e10cSrcweir break; 514cdf0e10cSrcweir case TBL_DEST_ROW: 515cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_ROW; 516cdf0e10cSrcweir break; 517cdf0e10cSrcweir case TBL_DEST_TBL: 518cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_TABLE; 519cdf0e10cSrcweir break; 520cdf0e10cSrcweir } 521cdf0e10cSrcweir } 522cdf0e10cSrcweir else if( SFX_ITEM_SET == rSet.GetItemState( 523cdf0e10cSrcweir SID_PARA_BACKGRND_DESTINATION, sal_False, &pItem ) ) 524cdf0e10cSrcweir { 525cdf0e10cSrcweir nDestValue = ((const SfxUInt16Item*)pItem)->GetValue(); 526cdf0e10cSrcweir // ist gerade Zeichen aktiviert? 527cdf0e10cSrcweir sal_uInt16 nParaSel = aParaLBox.GetSelectEntryPos(); 528cdf0e10cSrcweir if(1 == nParaSel) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir // dann war das ein "Standard" - Aufruf 531cdf0e10cSrcweir nDestValue = nParaSel; 532cdf0e10cSrcweir } 533cdf0e10cSrcweir aParaLBox.SelectEntryPos(nDestValue); 534cdf0e10cSrcweir 535cdf0e10cSrcweir switch ( nDestValue ) 536cdf0e10cSrcweir { 537cdf0e10cSrcweir case PARA_DEST_PARA: 538cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH; 539cdf0e10cSrcweir break; 540cdf0e10cSrcweir case PARA_DEST_CHAR: 541cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_CHAR; 542cdf0e10cSrcweir break; 543cdf0e10cSrcweir } 544cdf0e10cSrcweir } 545cdf0e10cSrcweir //#111173# the destination item is missing when the parent style has been changed 546cdf0e10cSrcweir if(USHRT_MAX == nDestValue && (aParaLBox.IsVisible()||aTblLBox.IsVisible())) 547cdf0e10cSrcweir nDestValue = 0; 548cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( nSlot ); 549cdf0e10cSrcweir 550cdf0e10cSrcweir if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) 551cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); 552cdf0e10cSrcweir 553cdf0e10cSrcweir aBtnTile.Check(); 554cdf0e10cSrcweir 555cdf0e10cSrcweir if ( pBgdAttr ) 556cdf0e10cSrcweir { 557cdf0e10cSrcweir FillControls_Impl(*pBgdAttr, aUserData); 558cdf0e10cSrcweir aBgdColor = ( (SvxBrushItem*)pBgdAttr )->GetColor(); 559cdf0e10cSrcweir } 560cdf0e10cSrcweir else 561cdf0e10cSrcweir { 562cdf0e10cSrcweir aSelectTxt.Hide(); 563cdf0e10cSrcweir aLbSelect.Hide(); 564cdf0e10cSrcweir aLbSelect.SelectEntryPos( 0 ); 565cdf0e10cSrcweir ShowColorUI_Impl(); 566cdf0e10cSrcweir 567cdf0e10cSrcweir const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_BRUSH ); 568cdf0e10cSrcweir 569cdf0e10cSrcweir if ( pOld ) 570cdf0e10cSrcweir aBgdColor = ( (SvxBrushItem*)pOld )->GetColor(); 571cdf0e10cSrcweir } 572cdf0e10cSrcweir 573cdf0e10cSrcweir if ( nDestValue != USHRT_MAX ) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir if(aTblLBox.IsVisible()) 576cdf0e10cSrcweir { 577cdf0e10cSrcweir sal_uInt16 nValue = aTblLBox.GetSelectEntryPos(); 578cdf0e10cSrcweir 579cdf0e10cSrcweir if ( pTableBck_Impl ) 580cdf0e10cSrcweir { 581cdf0e10cSrcweir DELETEZ( pTableBck_Impl->pCellBrush); 582cdf0e10cSrcweir DELETEZ( pTableBck_Impl->pRowBrush); 583cdf0e10cSrcweir DELETEZ( pTableBck_Impl->pTableBrush); 584cdf0e10cSrcweir } 585cdf0e10cSrcweir else 586cdf0e10cSrcweir pTableBck_Impl = new SvxBackgroundTable_Impl(); 587cdf0e10cSrcweir 588cdf0e10cSrcweir pTableBck_Impl->nActPos = nValue; 589cdf0e10cSrcweir 590cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_BRUSH ); 591cdf0e10cSrcweir if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) 592cdf0e10cSrcweir { 593cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); 594cdf0e10cSrcweir pTableBck_Impl->pCellBrush = new SvxBrushItem(*pBgdAttr); 595cdf0e10cSrcweir } 596cdf0e10cSrcweir pTableBck_Impl->nCellWhich = nWhich; 597cdf0e10cSrcweir 598cdf0e10cSrcweir if ( rSet.GetItemState( SID_ATTR_BRUSH_ROW, sal_False ) >= SFX_ITEM_AVAILABLE ) 599cdf0e10cSrcweir { 600cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_ROW ) ); 601cdf0e10cSrcweir pTableBck_Impl->pRowBrush = new SvxBrushItem(*pBgdAttr); 602cdf0e10cSrcweir } 603cdf0e10cSrcweir pTableBck_Impl->nRowWhich = SID_ATTR_BRUSH_ROW; 604cdf0e10cSrcweir 605cdf0e10cSrcweir if ( rSet.GetItemState( SID_ATTR_BRUSH_TABLE, sal_False ) >= SFX_ITEM_AVAILABLE ) 606cdf0e10cSrcweir { 607cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_TABLE ) ); 608cdf0e10cSrcweir pTableBck_Impl->pTableBrush = new SvxBrushItem(*pBgdAttr); 609cdf0e10cSrcweir } 610cdf0e10cSrcweir pTableBck_Impl->nTableWhich = SID_ATTR_BRUSH_TABLE; 611cdf0e10cSrcweir 612cdf0e10cSrcweir TblDestinationHdl_Impl(&aTblLBox); 613cdf0e10cSrcweir aTblLBox.SaveValue(); 614cdf0e10cSrcweir } 615cdf0e10cSrcweir else 616cdf0e10cSrcweir { 617cdf0e10cSrcweir sal_uInt16 nValue = aParaLBox.GetSelectEntryPos(); 618cdf0e10cSrcweir 619cdf0e10cSrcweir if ( pParaBck_Impl ) 620cdf0e10cSrcweir { 621cdf0e10cSrcweir delete pParaBck_Impl->pParaBrush; 622cdf0e10cSrcweir delete pParaBck_Impl->pCharBrush; 623cdf0e10cSrcweir } 624cdf0e10cSrcweir else 625cdf0e10cSrcweir pParaBck_Impl = new SvxBackgroundPara_Impl(); 626cdf0e10cSrcweir 627cdf0e10cSrcweir pParaBck_Impl->nActPos = nValue; 628cdf0e10cSrcweir 629cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_BRUSH ); 630cdf0e10cSrcweir if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) 631cdf0e10cSrcweir { 632cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); 633cdf0e10cSrcweir pParaBck_Impl->pParaBrush = new SvxBrushItem(*pBgdAttr); 634cdf0e10cSrcweir } 635cdf0e10cSrcweir 636cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_BRUSH_CHAR ); 637cdf0e10cSrcweir SfxItemState eState = rSet.GetItemState( nWhich, sal_True ); 638cdf0e10cSrcweir eState = rSet.GetItemState( nWhich, sal_False ); 639cdf0e10cSrcweir if ( rSet.GetItemState( nWhich, sal_True ) > SFX_ITEM_AVAILABLE ) 640cdf0e10cSrcweir { 641cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); 642cdf0e10cSrcweir pParaBck_Impl->pCharBrush = new SvxBrushItem(*pBgdAttr); 643cdf0e10cSrcweir } 644cdf0e10cSrcweir else 645cdf0e10cSrcweir pParaBck_Impl->pCharBrush = new SvxBrushItem(SID_ATTR_BRUSH_CHAR); 646cdf0e10cSrcweir 647cdf0e10cSrcweir ParaDestinationHdl_Impl(&aParaLBox); 648cdf0e10cSrcweir aParaLBox.SaveValue(); 649cdf0e10cSrcweir } 650cdf0e10cSrcweir } 651cdf0e10cSrcweir if(!bResized) 652cdf0e10cSrcweir { 653cdf0e10cSrcweir if(!aLbSelect.IsVisible() && !aTblLBox.IsVisible() && !aParaLBox.IsVisible()) 654cdf0e10cSrcweir { 655cdf0e10cSrcweir long nY(LogicToPixel(Point(11,14), MAP_APPFONT).X()); 656cdf0e10cSrcweir long nX(LogicToPixel(Point(11,14), MAP_APPFONT).Y()); 657cdf0e10cSrcweir Point aPos(aBorderWin.GetPosPixel()); 658cdf0e10cSrcweir aPos.X() = nX; 659cdf0e10cSrcweir aPos.Y() = nY; 660cdf0e10cSrcweir aBorderWin.SetPosPixel(aPos); 661cdf0e10cSrcweir aPos = pPreviewWin1->GetPosPixel(); 662cdf0e10cSrcweir aPos.Y() = nY; 663cdf0e10cSrcweir pPreviewWin1->SetPosPixel(aPos); 664cdf0e10cSrcweir aBackgroundColorBox.Hide(); 665cdf0e10cSrcweir aBackgroundColorSet.SetAccessibleRelationLabeledBy(&aBackgroundColorSet); 666cdf0e10cSrcweir } 667cdf0e10cSrcweir } 668cdf0e10cSrcweir } 669cdf0e10cSrcweir 670cdf0e10cSrcweir void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet ) 671cdf0e10cSrcweir { 672cdf0e10cSrcweir ShowSelector(); 673cdf0e10cSrcweir 674cdf0e10cSrcweir // Zustand des Vorschau-Buttons durch UserData persistent 675cdf0e10cSrcweir String aUserData = GetUserData(); 676cdf0e10cSrcweir aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) ); 677cdf0e10cSrcweir 678cdf0e10cSrcweir // Input-BrushItem besorgen und auswerten 679cdf0e10cSrcweir const SvxBrushItem* pBgdAttr = NULL; 680cdf0e10cSrcweir sal_uInt16 nSlot = SID_VIEW_FLD_PIC; 681cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( nSlot ); 682cdf0e10cSrcweir SvxBrushItem* pTemp = 0; 683cdf0e10cSrcweir const CntWallpaperItem* pItem = 0; 684cdf0e10cSrcweir 685cdf0e10cSrcweir if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) 686cdf0e10cSrcweir { 687cdf0e10cSrcweir pItem = (const CntWallpaperItem*)&rSet.Get( nWhich ); 688cdf0e10cSrcweir pTemp = new SvxBrushItem( *pItem, nWhich ); 689cdf0e10cSrcweir pBgdAttr = pTemp; 690cdf0e10cSrcweir } 691cdf0e10cSrcweir 692cdf0e10cSrcweir aBtnTile.Check(); 693cdf0e10cSrcweir 694cdf0e10cSrcweir if ( pBgdAttr ) 695cdf0e10cSrcweir { 696cdf0e10cSrcweir FillControls_Impl(*pBgdAttr, aUserData); 697cdf0e10cSrcweir // Auch bei Anzeige der Grafik, soll die Brush erhalten bleiben 698cdf0e10cSrcweir if( aBgdColor != pBgdAttr->GetColor() ) 699cdf0e10cSrcweir { 700cdf0e10cSrcweir aBgdColor = pBgdAttr->GetColor(); 701cdf0e10cSrcweir sal_uInt16 nCol = GetItemId_Impl( aBackgroundColorSet, aBgdColor ); 702cdf0e10cSrcweir aBackgroundColorSet.SelectItem( nCol ); 703cdf0e10cSrcweir pPreviewWin1->NotifyChange( aBgdColor ); 704cdf0e10cSrcweir } 705cdf0e10cSrcweir } 706cdf0e10cSrcweir else 707cdf0e10cSrcweir { 708cdf0e10cSrcweir aLbSelect.SelectEntryPos( 0 ); 709cdf0e10cSrcweir ShowColorUI_Impl(); 710cdf0e10cSrcweir 711cdf0e10cSrcweir const SfxPoolItem* pOld = GetOldItem( rSet, SID_VIEW_FLD_PIC ); 712cdf0e10cSrcweir if ( pOld ) 713cdf0e10cSrcweir aBgdColor = Color( ((CntWallpaperItem*)pOld)->GetColor() ); 714cdf0e10cSrcweir } 715cdf0e10cSrcweir 716cdf0e10cSrcweir // We now have always a link to the background 717cdf0e10cSrcweir bLinkOnly = sal_True; 718cdf0e10cSrcweir aBtnLink.Check( sal_True ); 719cdf0e10cSrcweir aBtnLink.Show( sal_False ); 720cdf0e10cSrcweir // if( !pItem || !pItem->GetWallpaper(sal_False).IsBitmap() ) 721cdf0e10cSrcweir // aBtnLink.Check(); 722cdf0e10cSrcweir 723cdf0e10cSrcweir delete pTemp; 724cdf0e10cSrcweir } 725cdf0e10cSrcweir 726cdf0e10cSrcweir 727cdf0e10cSrcweir 728cdf0e10cSrcweir //------------------------------------------------------------------------ 729cdf0e10cSrcweir 730cdf0e10cSrcweir void SvxBackgroundTabPage::FillUserData() 731cdf0e10cSrcweir 732cdf0e10cSrcweir /* [Beschreibung] 733cdf0e10cSrcweir 734cdf0e10cSrcweir Beim Destruieren einer SfxTabPage wird diese virtuelle Methode gerufen, 735cdf0e10cSrcweir damit die TabPage interne Informationen sichern kann. 736cdf0e10cSrcweir 737cdf0e10cSrcweir In diesem Fall wird der Zustand des Vorschau-Buttons gesichert. 738cdf0e10cSrcweir */ 739cdf0e10cSrcweir 740cdf0e10cSrcweir { 741cdf0e10cSrcweir SetUserData( String( aBtnPreview.IsChecked() ? sal_Unicode('1') : sal_Unicode('0') ) ); 742cdf0e10cSrcweir } 743cdf0e10cSrcweir 744cdf0e10cSrcweir //------------------------------------------------------------------------ 745cdf0e10cSrcweir 746cdf0e10cSrcweir sal_Bool SvxBackgroundTabPage::FillItemSet( SfxItemSet& rCoreSet ) 747cdf0e10cSrcweir 748cdf0e10cSrcweir /* [Beschreibung] 749cdf0e10cSrcweir 750cdf0e10cSrcweir */ 751cdf0e10cSrcweir 752cdf0e10cSrcweir { 753cdf0e10cSrcweir if ( pPageImpl->pLoadTimer && pPageImpl->pLoadTimer->IsActive() ) 754cdf0e10cSrcweir { 755cdf0e10cSrcweir pPageImpl->pLoadTimer->Stop(); 756cdf0e10cSrcweir LoadTimerHdl_Impl( pPageImpl->pLoadTimer ); 757cdf0e10cSrcweir } 758cdf0e10cSrcweir // os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden, 759cdf0e10cSrcweir // es muss aber im rSet vorhanden sein! 760cdf0e10cSrcweir 761cdf0e10cSrcweir // const SfxPoolItem* pX = GetOldItem( rCoreSet, SID_VIEW_FLD_PIC ); 762cdf0e10cSrcweir // if( pX && pX->ISA(SfxWallpaperItem)) 763cdf0e10cSrcweir if(SFX_ITEM_AVAILABLE <= rCoreSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), sal_False)) 764cdf0e10cSrcweir return FillItemSetWithWallpaperItem( rCoreSet, SID_VIEW_FLD_PIC ); 765cdf0e10cSrcweir 766cdf0e10cSrcweir sal_Bool bModified = sal_False; 767cdf0e10cSrcweir sal_uInt16 nSlot = SID_ATTR_BRUSH; 768cdf0e10cSrcweir 769cdf0e10cSrcweir if ( aTblLBox.IsVisible() ) 770cdf0e10cSrcweir { 771cdf0e10cSrcweir switch( aTblLBox.GetSelectEntryPos() ) 772cdf0e10cSrcweir { 773cdf0e10cSrcweir case TBL_DEST_CELL: 774cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH; 775cdf0e10cSrcweir break; 776cdf0e10cSrcweir case TBL_DEST_ROW: 777cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_ROW; 778cdf0e10cSrcweir break; 779cdf0e10cSrcweir case TBL_DEST_TBL: 780cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_TABLE; 781cdf0e10cSrcweir break; 782cdf0e10cSrcweir } 783cdf0e10cSrcweir } 784cdf0e10cSrcweir else if(aParaLBox.GetData() == &aParaLBox) 785cdf0e10cSrcweir { 786cdf0e10cSrcweir switch(aParaLBox.GetSelectEntryPos()) 787cdf0e10cSrcweir { 788cdf0e10cSrcweir case PARA_DEST_PARA: 789cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH; 790cdf0e10cSrcweir break; 791cdf0e10cSrcweir case PARA_DEST_CHAR: 792cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_CHAR; 793cdf0e10cSrcweir break; 794cdf0e10cSrcweir } 795cdf0e10cSrcweir } 796cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( nSlot ); 797cdf0e10cSrcweir 798cdf0e10cSrcweir const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot ); 799cdf0e10cSrcweir SfxItemState eOldItemState = rCoreSet.GetItemState(nSlot, sal_False); 800cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet(); 801cdf0e10cSrcweir 802cdf0e10cSrcweir sal_Bool bGraphTransparencyChanged = bGraphTransparency && (aGraphTransMF.GetText() != aGraphTransMF.GetSavedValue()); 803cdf0e10cSrcweir if ( pOld ) 804cdf0e10cSrcweir { 805cdf0e10cSrcweir const SvxBrushItem& rOldItem = (const SvxBrushItem&)*pOld; 806cdf0e10cSrcweir SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos(); 807cdf0e10cSrcweir const sal_Bool bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() ); 808cdf0e10cSrcweir 809cdf0e10cSrcweir // transparency has to be set if enabled, the color not already set to "No fill" and 810cdf0e10cSrcweir if( bColTransparency && 811cdf0e10cSrcweir aBgdColor.GetTransparency() < 0xff) 812cdf0e10cSrcweir { 813cdf0e10cSrcweir aBgdColor.SetTransparency(lcl_PercentToTransparency(static_cast<long>(aColTransMF.GetValue()))); 814cdf0e10cSrcweir } 815cdf0e10cSrcweir if ( ( (GPOS_NONE == eOldPos) && bIsBrush ) 816cdf0e10cSrcweir || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt? 817cdf0e10cSrcweir { 818cdf0e10cSrcweir // Hintergrund-Art wurde nicht gewechselt: 819cdf0e10cSrcweir 820cdf0e10cSrcweir if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() ) 821cdf0e10cSrcweir { 822cdf0e10cSrcweir // Brush-Behandlung: 823cdf0e10cSrcweir if ( rOldItem.GetColor() != aBgdColor || 824cdf0e10cSrcweir (SFX_ITEM_AVAILABLE >= eOldItemState && !aBackgroundColorSet.IsNoSelection())) 825cdf0e10cSrcweir { 826cdf0e10cSrcweir bModified = sal_True; 827cdf0e10cSrcweir rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); 828cdf0e10cSrcweir } 829cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 830cdf0e10cSrcweir rCoreSet.ClearItem( nWhich ); 831cdf0e10cSrcweir } 832cdf0e10cSrcweir else 833cdf0e10cSrcweir { 834cdf0e10cSrcweir // Bitmap-Behandlung: 835cdf0e10cSrcweir 836cdf0e10cSrcweir SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); 837cdf0e10cSrcweir const sal_Bool bIsLink = aBtnLink.IsChecked(); 838cdf0e10cSrcweir const sal_Bool bWasLink = (NULL != rOldItem.GetGraphicLink() ); 839cdf0e10cSrcweir 840cdf0e10cSrcweir 841cdf0e10cSrcweir if ( !bIsLink && !bIsGraphicValid ) 842cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 843cdf0e10cSrcweir 844cdf0e10cSrcweir if ( bGraphTransparencyChanged || 845cdf0e10cSrcweir eNewPos != eOldPos 846cdf0e10cSrcweir || bIsLink != bWasLink 847cdf0e10cSrcweir || ( bWasLink && *rOldItem.GetGraphicLink() 848cdf0e10cSrcweir != aBgdGraphicPath ) 849cdf0e10cSrcweir || ( !bWasLink && rOldItem.GetGraphic()->GetBitmap() 850cdf0e10cSrcweir != aBgdGraphic.GetBitmap() ) 851cdf0e10cSrcweir ) 852cdf0e10cSrcweir { 853cdf0e10cSrcweir bModified = sal_True; 854cdf0e10cSrcweir 855cdf0e10cSrcweir SvxBrushItem aTmpBrush(nWhich); 856cdf0e10cSrcweir if ( bIsLink ) 857cdf0e10cSrcweir { 858cdf0e10cSrcweir aTmpBrush = SvxBrushItem( aBgdGraphicPath, 859cdf0e10cSrcweir aBgdGraphicFilter, 860cdf0e10cSrcweir eNewPos, 861cdf0e10cSrcweir nWhich ); 862cdf0e10cSrcweir } 863cdf0e10cSrcweir else 864cdf0e10cSrcweir aTmpBrush = SvxBrushItem( aBgdGraphic, 865cdf0e10cSrcweir eNewPos, 866cdf0e10cSrcweir nWhich ); 867cdf0e10cSrcweir lcl_SetTransparency(aTmpBrush, static_cast<long>(aGraphTransMF.GetValue())); 868cdf0e10cSrcweir 869cdf0e10cSrcweir rCoreSet.Put(aTmpBrush); 870cdf0e10cSrcweir } 871cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 872cdf0e10cSrcweir rCoreSet.ClearItem( nWhich ); 873cdf0e10cSrcweir } 874cdf0e10cSrcweir } 875cdf0e10cSrcweir else // Brush <-> Bitmap gewechselt! 876cdf0e10cSrcweir { 877cdf0e10cSrcweir if ( bIsBrush ) 878cdf0e10cSrcweir rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); 879cdf0e10cSrcweir else 880cdf0e10cSrcweir { 881cdf0e10cSrcweir SvxBrushItem* pTmpBrush = 0; 882cdf0e10cSrcweir if ( aBtnLink.IsChecked() ) 883cdf0e10cSrcweir { 884cdf0e10cSrcweir pTmpBrush = new SvxBrushItem( aBgdGraphicPath, 885cdf0e10cSrcweir aBgdGraphicFilter, 886cdf0e10cSrcweir GetGraphicPosition_Impl(), 887cdf0e10cSrcweir nWhich ); 888cdf0e10cSrcweir } 889cdf0e10cSrcweir else 890cdf0e10cSrcweir { 891cdf0e10cSrcweir if ( !bIsGraphicValid ) 892cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 893cdf0e10cSrcweir 894cdf0e10cSrcweir if ( bIsGraphicValid ) 895cdf0e10cSrcweir pTmpBrush = new SvxBrushItem( aBgdGraphic, 896cdf0e10cSrcweir GetGraphicPosition_Impl(), 897cdf0e10cSrcweir nWhich ); 898cdf0e10cSrcweir } 899cdf0e10cSrcweir if(pTmpBrush) 900cdf0e10cSrcweir { 901cdf0e10cSrcweir lcl_SetTransparency(*pTmpBrush, static_cast<long>(aGraphTransMF.GetValue())); 902cdf0e10cSrcweir rCoreSet.Put(*pTmpBrush); 903cdf0e10cSrcweir delete pTmpBrush; 904cdf0e10cSrcweir } 905cdf0e10cSrcweir } 906cdf0e10cSrcweir bModified = ( bIsBrush || aBtnLink.IsChecked() || bIsGraphicValid ); 907cdf0e10cSrcweir } 908cdf0e10cSrcweir } 909cdf0e10cSrcweir else if ( SID_ATTR_BRUSH_CHAR == nSlot && aBgdColor != Color( COL_WHITE ) ) 910cdf0e10cSrcweir { 911cdf0e10cSrcweir rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); 912cdf0e10cSrcweir bModified = sal_True; 913cdf0e10cSrcweir } 914cdf0e10cSrcweir 915cdf0e10cSrcweir if( aTblLBox.IsVisible() ) 916cdf0e10cSrcweir { 917cdf0e10cSrcweir // Der aktuelle Zustand wurde bereits geputtet 918cdf0e10cSrcweir if( nSlot != SID_ATTR_BRUSH && pTableBck_Impl->pCellBrush) 919cdf0e10cSrcweir { 920cdf0e10cSrcweir const SfxPoolItem* pOldCell = 921cdf0e10cSrcweir GetOldItem( rCoreSet, SID_ATTR_BRUSH ); 922cdf0e10cSrcweir 923cdf0e10cSrcweir if ( *pTableBck_Impl->pCellBrush != *pOldCell ) 924cdf0e10cSrcweir { 925cdf0e10cSrcweir rCoreSet.Put( *pTableBck_Impl->pCellBrush ); 926cdf0e10cSrcweir bModified |= sal_True; 927cdf0e10cSrcweir } 928cdf0e10cSrcweir } 929cdf0e10cSrcweir 930cdf0e10cSrcweir if( nSlot != SID_ATTR_BRUSH_ROW && pTableBck_Impl->pRowBrush) 931cdf0e10cSrcweir { 932cdf0e10cSrcweir const SfxPoolItem* pOldRow = 933cdf0e10cSrcweir GetOldItem( rCoreSet, SID_ATTR_BRUSH_ROW ); 934cdf0e10cSrcweir 935cdf0e10cSrcweir if ( *pTableBck_Impl->pRowBrush != *pOldRow ) 936cdf0e10cSrcweir { 937cdf0e10cSrcweir rCoreSet.Put( *pTableBck_Impl->pRowBrush ); 938cdf0e10cSrcweir bModified |= sal_True; 939cdf0e10cSrcweir } 940cdf0e10cSrcweir } 941cdf0e10cSrcweir 942cdf0e10cSrcweir if( nSlot != SID_ATTR_BRUSH_TABLE && pTableBck_Impl->pTableBrush) 943cdf0e10cSrcweir { 944cdf0e10cSrcweir const SfxPoolItem* pOldTable = 945cdf0e10cSrcweir GetOldItem( rCoreSet, SID_ATTR_BRUSH_TABLE ); 946cdf0e10cSrcweir 947cdf0e10cSrcweir if ( *pTableBck_Impl->pTableBrush != *pOldTable ) 948cdf0e10cSrcweir { 949cdf0e10cSrcweir rCoreSet.Put( *pTableBck_Impl->pTableBrush ); 950cdf0e10cSrcweir bModified |= sal_True; 951cdf0e10cSrcweir } 952cdf0e10cSrcweir } 953cdf0e10cSrcweir 954cdf0e10cSrcweir if( aTblLBox.GetSavedValue() != aTblLBox.GetSelectEntryPos() ) 955cdf0e10cSrcweir { 956cdf0e10cSrcweir rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION, 957cdf0e10cSrcweir aTblLBox.GetSelectEntryPos() ) ); 958cdf0e10cSrcweir bModified |= sal_True; 959cdf0e10cSrcweir } 960cdf0e10cSrcweir } 961cdf0e10cSrcweir else if(aParaLBox.GetData() == &aParaLBox) 962cdf0e10cSrcweir { 963cdf0e10cSrcweir // Der aktuelle Zustand wurde bereits geputtet 964cdf0e10cSrcweir if( nSlot != SID_ATTR_BRUSH && aParaLBox.IsVisible()) // nicht im Suchen-Format-Dialog 965cdf0e10cSrcweir { 966cdf0e10cSrcweir const SfxPoolItem* pOldPara = 967cdf0e10cSrcweir GetOldItem( rCoreSet, SID_ATTR_BRUSH ); 968cdf0e10cSrcweir 969cdf0e10cSrcweir if ( *pParaBck_Impl->pParaBrush != *pOldPara ) 970cdf0e10cSrcweir { 971cdf0e10cSrcweir rCoreSet.Put( *pParaBck_Impl->pParaBrush ); 972cdf0e10cSrcweir bModified |= sal_True; 973cdf0e10cSrcweir } 974cdf0e10cSrcweir } 975cdf0e10cSrcweir 976cdf0e10cSrcweir if( nSlot != SID_ATTR_BRUSH_CHAR ) 977cdf0e10cSrcweir { 978cdf0e10cSrcweir const SfxPoolItem* pOldChar = 979cdf0e10cSrcweir GetOldItem( rCoreSet, SID_ATTR_BRUSH_CHAR ); 980cdf0e10cSrcweir DBG_ASSERT(pParaBck_Impl, "pParaBck_Impl == NULL ?"); 981cdf0e10cSrcweir if ( pOldChar && 982cdf0e10cSrcweir //#111173# crash report shows that pParaBck_Impl can be NULL, the cause is unknown 983cdf0e10cSrcweir pParaBck_Impl && 984cdf0e10cSrcweir (*pParaBck_Impl->pCharBrush != *pOldChar || 985cdf0e10cSrcweir *pParaBck_Impl->pCharBrush != SvxBrushItem(SID_ATTR_BRUSH_CHAR))) 986cdf0e10cSrcweir { 987cdf0e10cSrcweir rCoreSet.Put( *pParaBck_Impl->pCharBrush ); 988cdf0e10cSrcweir bModified |= sal_True; 989cdf0e10cSrcweir } 990cdf0e10cSrcweir } 991cdf0e10cSrcweir 992cdf0e10cSrcweir if( aParaLBox.GetSavedValue() != aParaLBox.GetSelectEntryPos() ) 993cdf0e10cSrcweir { 994cdf0e10cSrcweir rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION, 995cdf0e10cSrcweir aParaLBox.GetSelectEntryPos() ) ); 996cdf0e10cSrcweir bModified |= sal_True; 997cdf0e10cSrcweir } 998cdf0e10cSrcweir } 999cdf0e10cSrcweir return bModified; 1000cdf0e10cSrcweir } 1001cdf0e10cSrcweir 1002cdf0e10cSrcweir sal_Bool SvxBackgroundTabPage::FillItemSetWithWallpaperItem( SfxItemSet& rCoreSet, sal_uInt16 nSlot) 1003cdf0e10cSrcweir { 1004cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( nSlot ); 1005cdf0e10cSrcweir const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot ); 1006cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet(); 1007cdf0e10cSrcweir DBG_ASSERT(pOld,"FillItemSetWithWallpaperItem: Item not found"); 1008cdf0e10cSrcweir 1009cdf0e10cSrcweir SvxBrushItem rOldItem( (const CntWallpaperItem&)*pOld, nWhich ); 1010cdf0e10cSrcweir SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos(); 1011cdf0e10cSrcweir const sal_Bool bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() ); 1012cdf0e10cSrcweir sal_Bool bModified = sal_False; 1013cdf0e10cSrcweir 1014cdf0e10cSrcweir if ( ( (GPOS_NONE == eOldPos) && bIsBrush ) 1015cdf0e10cSrcweir || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt? 1016cdf0e10cSrcweir { 1017cdf0e10cSrcweir // Hintergrund-Art wurde nicht gewechselt: 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() ) 1020cdf0e10cSrcweir { 1021cdf0e10cSrcweir // Brush-Behandlung: 1022cdf0e10cSrcweir if ( rOldItem.GetColor() != aBgdColor ) 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir bModified = sal_True; 1025cdf0e10cSrcweir CntWallpaperItem aItem( nWhich ); 1026cdf0e10cSrcweir aItem.SetColor( aBgdColor ); 1027cdf0e10cSrcweir rCoreSet.Put( aItem ); 1028cdf0e10cSrcweir } 1029cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 1030cdf0e10cSrcweir rCoreSet.ClearItem( nWhich ); 1031cdf0e10cSrcweir } 1032cdf0e10cSrcweir else 1033cdf0e10cSrcweir { 1034cdf0e10cSrcweir // Bitmap-Behandlung: 1035cdf0e10cSrcweir SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir int bBitmapChanged = ( ( eNewPos != eOldPos ) || 1038cdf0e10cSrcweir ( *rOldItem.GetGraphicLink() != aBgdGraphicPath ) ); 1039cdf0e10cSrcweir int bBrushChanged = ( rOldItem.GetColor() != aBgdColor ); 1040cdf0e10cSrcweir if( bBitmapChanged || bBrushChanged ) 1041cdf0e10cSrcweir { 1042cdf0e10cSrcweir bModified = sal_True; 1043cdf0e10cSrcweir 1044cdf0e10cSrcweir CntWallpaperItem aItem( nWhich ); 1045cdf0e10cSrcweir WallpaperStyle eWallStyle = SvxBrushItem::GraphicPos2WallpaperStyle(eNewPos); 1046cdf0e10cSrcweir aItem.SetStyle( sal::static_int_cast< sal_uInt16 >( eWallStyle ) ); 1047cdf0e10cSrcweir aItem.SetColor( aBgdColor ); 1048cdf0e10cSrcweir aItem.SetBitmapURL( aBgdGraphicPath ); 1049cdf0e10cSrcweir rCoreSet.Put( aItem ); 1050cdf0e10cSrcweir } 1051cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 1052cdf0e10cSrcweir rCoreSet.ClearItem( nWhich ); 1053cdf0e10cSrcweir } 1054cdf0e10cSrcweir } 1055cdf0e10cSrcweir else // Brush <-> Bitmap gewechselt! 1056cdf0e10cSrcweir { 1057cdf0e10cSrcweir CntWallpaperItem aItem( nWhich ); 1058cdf0e10cSrcweir if ( bIsBrush ) 1059cdf0e10cSrcweir { 1060cdf0e10cSrcweir aItem.SetColor( aBgdColor ); 1061cdf0e10cSrcweir rCoreSet.Put( aItem ); 1062cdf0e10cSrcweir } 1063cdf0e10cSrcweir else 1064cdf0e10cSrcweir { 1065cdf0e10cSrcweir WallpaperStyle eWallStyle = 1066cdf0e10cSrcweir SvxBrushItem::GraphicPos2WallpaperStyle( GetGraphicPosition_Impl() ); 1067cdf0e10cSrcweir aItem.SetStyle( sal::static_int_cast< sal_uInt16 >( eWallStyle ) ); 1068cdf0e10cSrcweir aItem.SetColor( aBgdColor ); 1069cdf0e10cSrcweir aItem.SetBitmapURL( aBgdGraphicPath ); 1070cdf0e10cSrcweir rCoreSet.Put( aItem ); 1071cdf0e10cSrcweir } 1072cdf0e10cSrcweir 1073cdf0e10cSrcweir bModified = sal_True; 1074cdf0e10cSrcweir } 1075cdf0e10cSrcweir return bModified; 1076cdf0e10cSrcweir } 1077cdf0e10cSrcweir 1078cdf0e10cSrcweir //----------------------------------------------------------------------- 1079cdf0e10cSrcweir 1080cdf0e10cSrcweir int SvxBackgroundTabPage::DeactivatePage( SfxItemSet* _pSet ) 1081cdf0e10cSrcweir 1082cdf0e10cSrcweir /* [Beschreibung] 1083cdf0e10cSrcweir 1084cdf0e10cSrcweir virtuelle Methode, wird beim Deaktivieren gerufen 1085cdf0e10cSrcweir */ 1086cdf0e10cSrcweir 1087cdf0e10cSrcweir { 1088cdf0e10cSrcweir if ( pPageImpl->bIsImportDlgInExecute ) 1089cdf0e10cSrcweir return KEEP_PAGE; 1090cdf0e10cSrcweir 1091cdf0e10cSrcweir if ( _pSet ) 1092cdf0e10cSrcweir FillItemSet( *_pSet ); 1093cdf0e10cSrcweir 1094cdf0e10cSrcweir return LEAVE_PAGE; 1095cdf0e10cSrcweir } 1096cdf0e10cSrcweir 1097cdf0e10cSrcweir //----------------------------------------------------------------------- 1098cdf0e10cSrcweir 1099cdf0e10cSrcweir void SvxBackgroundTabPage::PointChanged( Window* , RECT_POINT ) 1100cdf0e10cSrcweir 1101cdf0e10cSrcweir /* [Beschreibung] 1102cdf0e10cSrcweir 1103cdf0e10cSrcweir */ 1104cdf0e10cSrcweir 1105cdf0e10cSrcweir { 1106cdf0e10cSrcweir // muss implementiert werden, damit Position-Control funktioniert 1107cdf0e10cSrcweir } 1108cdf0e10cSrcweir 1109cdf0e10cSrcweir //----------------------------------------------------------------------- 1110cdf0e10cSrcweir 1111cdf0e10cSrcweir void SvxBackgroundTabPage::ShowSelector() 1112cdf0e10cSrcweir 1113cdf0e10cSrcweir /* [Beschreibung] 1114cdf0e10cSrcweir 1115cdf0e10cSrcweir */ 1116cdf0e10cSrcweir 1117cdf0e10cSrcweir { 1118cdf0e10cSrcweir if( bAllowShowSelector) 1119cdf0e10cSrcweir { 1120cdf0e10cSrcweir aSelectTxt.Show(); 1121cdf0e10cSrcweir aLbSelect.Show(); 1122cdf0e10cSrcweir aLbSelect.SetSelectHdl( HDL(SelectHdl_Impl) ); 1123cdf0e10cSrcweir aBtnLink.SetClickHdl( HDL(FileClickHdl_Impl) ); 1124cdf0e10cSrcweir aBtnPreview.SetClickHdl( HDL(FileClickHdl_Impl) ); 1125cdf0e10cSrcweir aBtnBrowse.SetClickHdl( HDL(BrowseHdl_Impl) ); 1126cdf0e10cSrcweir aBtnArea.SetClickHdl( HDL(RadioClickHdl_Impl) ); 1127cdf0e10cSrcweir aBtnTile.SetClickHdl( HDL(RadioClickHdl_Impl) ); 1128cdf0e10cSrcweir aBtnPosition.SetClickHdl( HDL(RadioClickHdl_Impl) ); 1129cdf0e10cSrcweir 1130cdf0e10cSrcweir // Verz"ogertes Laden "uber Timer (wg. UI-Update) 1131cdf0e10cSrcweir pPageImpl->pLoadTimer = new Timer; 1132cdf0e10cSrcweir pPageImpl->pLoadTimer->SetTimeout( 500 ); // 500ms verz"ogern 1133cdf0e10cSrcweir pPageImpl->pLoadTimer->SetTimeoutHdl( 1134cdf0e10cSrcweir LINK( this, SvxBackgroundTabPage, LoadTimerHdl_Impl ) ); 1135cdf0e10cSrcweir 1136cdf0e10cSrcweir bAllowShowSelector = sal_False; 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir if(nHtmlMode & HTMLMODE_ON) 1139cdf0e10cSrcweir { 1140cdf0e10cSrcweir if(!(nHtmlMode & HTMLMODE_GRAPH_POS)) 1141cdf0e10cSrcweir aBtnPosition.Enable(sal_False); 1142cdf0e10cSrcweir aBtnArea.Enable(sal_False); 1143cdf0e10cSrcweir } 1144cdf0e10cSrcweir } 1145cdf0e10cSrcweir } 1146cdf0e10cSrcweir 1147cdf0e10cSrcweir //------------------------------------------------------------------------ 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir 1150cdf0e10cSrcweir void SvxBackgroundTabPage::RaiseLoadError_Impl() 1151cdf0e10cSrcweir 1152cdf0e10cSrcweir /* [Beschreibung] 1153cdf0e10cSrcweir 1154cdf0e10cSrcweir */ 1155cdf0e10cSrcweir 1156cdf0e10cSrcweir { 1157cdf0e10cSrcweir SfxErrorContext aContext( ERRCTX_SVX_BACKGROUND, 1158cdf0e10cSrcweir String(), 1159cdf0e10cSrcweir this, 1160cdf0e10cSrcweir RID_SVXERRCTX, 1161cdf0e10cSrcweir &CUI_MGR() ); 1162cdf0e10cSrcweir 1163cdf0e10cSrcweir ErrorHandler::HandleError( 1164cdf0e10cSrcweir *new StringErrorInfo( ERRCODE_SVX_GRAPHIC_NOTREADABLE, 1165cdf0e10cSrcweir aBgdGraphicPath ) ); 1166cdf0e10cSrcweir } 1167cdf0e10cSrcweir 1168cdf0e10cSrcweir //------------------------------------------------------------------------ 1169cdf0e10cSrcweir 1170cdf0e10cSrcweir sal_Bool SvxBackgroundTabPage::LoadLinkedGraphic_Impl() 1171cdf0e10cSrcweir 1172cdf0e10cSrcweir /* [Beschreibung] 1173cdf0e10cSrcweir 1174cdf0e10cSrcweir */ 1175cdf0e10cSrcweir 1176cdf0e10cSrcweir { 1177cdf0e10cSrcweir sal_Bool bResult = ( aBgdGraphicPath.Len() > 0 ) && 1178cdf0e10cSrcweir ( GRFILTER_OK == GraphicFilter::LoadGraphic( aBgdGraphicPath, 1179cdf0e10cSrcweir aBgdGraphicFilter, 1180cdf0e10cSrcweir aBgdGraphic ) ); 1181cdf0e10cSrcweir return bResult; 1182cdf0e10cSrcweir } 1183cdf0e10cSrcweir 1184cdf0e10cSrcweir //------------------------------------------------------------------------ 1185cdf0e10cSrcweir 1186cdf0e10cSrcweir 1187cdf0e10cSrcweir void SvxBackgroundTabPage::FillColorValueSets_Impl() 1188cdf0e10cSrcweir 1189cdf0e10cSrcweir /* [Beschreibung] 1190cdf0e10cSrcweir 1191cdf0e10cSrcweir F"ullen des Farb-Sets 1192cdf0e10cSrcweir */ 1193cdf0e10cSrcweir 1194cdf0e10cSrcweir { 1195cdf0e10cSrcweir SfxObjectShell* pDocSh = SfxObjectShell::Current(); 1196cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 1197cdf0e10cSrcweir XColorTable* pColorTable = NULL; 1198cdf0e10cSrcweir const Size aSize15x15 = Size( 15, 15 ); 1199cdf0e10cSrcweir FASTBOOL bOwn = sal_False; 1200cdf0e10cSrcweir 1201cdf0e10cSrcweir if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) ) 1202cdf0e10cSrcweir pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); 1203cdf0e10cSrcweir 1204cdf0e10cSrcweir if ( !pColorTable ) 1205cdf0e10cSrcweir { 1206cdf0e10cSrcweir bOwn = sal_True; 1207cdf0e10cSrcweir pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); 1208cdf0e10cSrcweir } 1209cdf0e10cSrcweir 1210cdf0e10cSrcweir if ( pColorTable ) 1211cdf0e10cSrcweir { 1212cdf0e10cSrcweir short i = 0; 1213cdf0e10cSrcweir long nCount = pColorTable->Count(); 1214cdf0e10cSrcweir XColorEntry* pEntry = NULL; 1215cdf0e10cSrcweir Color aColWhite( COL_WHITE ); 1216cdf0e10cSrcweir String aStrWhite( EditResId( RID_SVXITEMS_COLOR_WHITE ) ); 1217cdf0e10cSrcweir WinBits nBits = ( aBackgroundColorSet.GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD ); 1218cdf0e10cSrcweir aBackgroundColorSet.SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) ); 1219cdf0e10cSrcweir aBackgroundColorSet.SetStyle( nBits ); 1220cdf0e10cSrcweir aBackgroundColorSet.SetAccessibleName(aBackgroundColorBox.GetText()); 1221cdf0e10cSrcweir for ( i = 0; i < nCount; i++ ) 1222cdf0e10cSrcweir { 1223cdf0e10cSrcweir pEntry = pColorTable->GetColor(i); 1224cdf0e10cSrcweir aBackgroundColorSet.InsertItem( i + 1, pEntry->GetColor(), pEntry->GetName() ); 1225cdf0e10cSrcweir } 1226cdf0e10cSrcweir 1227cdf0e10cSrcweir while ( i < 80 ) 1228cdf0e10cSrcweir { 1229cdf0e10cSrcweir aBackgroundColorSet.InsertItem( i + 1, aColWhite, aStrWhite ); 1230cdf0e10cSrcweir i++; 1231cdf0e10cSrcweir } 1232cdf0e10cSrcweir 1233cdf0e10cSrcweir if ( nCount > 80 ) 1234cdf0e10cSrcweir { 1235cdf0e10cSrcweir aBackgroundColorSet.SetStyle( nBits | WB_VSCROLL ); 1236cdf0e10cSrcweir } 1237cdf0e10cSrcweir } 1238cdf0e10cSrcweir 1239cdf0e10cSrcweir if ( bOwn ) 1240cdf0e10cSrcweir delete pColorTable; 1241cdf0e10cSrcweir 1242cdf0e10cSrcweir aBackgroundColorSet.SetColCount( 10 ); 1243cdf0e10cSrcweir aBackgroundColorSet.SetLineCount( 10 ); 1244cdf0e10cSrcweir aBackgroundColorSet.CalcWindowSizePixel( aSize15x15 ); 1245cdf0e10cSrcweir 1246cdf0e10cSrcweir } 1247cdf0e10cSrcweir 1248cdf0e10cSrcweir //------------------------------------------------------------------------ 1249cdf0e10cSrcweir 1250cdf0e10cSrcweir 1251cdf0e10cSrcweir 1252cdf0e10cSrcweir //------------------------------------------------------------------------ 1253cdf0e10cSrcweir 1254cdf0e10cSrcweir void SvxBackgroundTabPage::ShowColorUI_Impl() 1255cdf0e10cSrcweir 1256cdf0e10cSrcweir /* [Beschreibung] 1257cdf0e10cSrcweir 1258cdf0e10cSrcweir Die Controls f"ur das Einstellen der Grafik ausblenden und die 1259cdf0e10cSrcweir Controls f"ur die Farbeinstellung einblenden. 1260cdf0e10cSrcweir */ 1261cdf0e10cSrcweir 1262cdf0e10cSrcweir { 1263cdf0e10cSrcweir if( !aBackgroundColorSet.IsVisible() ) 1264cdf0e10cSrcweir { 1265cdf0e10cSrcweir aBackgroundColorSet.Show(); 1266cdf0e10cSrcweir aBackgroundColorBox.Show(); 1267cdf0e10cSrcweir aBorderWin.Show(); 1268cdf0e10cSrcweir pPreviewWin1->Show(); 1269cdf0e10cSrcweir aBtnBrowse.Hide(); 1270cdf0e10cSrcweir aFtFile.Hide(); 1271cdf0e10cSrcweir aBtnLink.Hide(); 1272cdf0e10cSrcweir aBtnPreview.Hide(); 1273cdf0e10cSrcweir aGbFile.Hide(); 1274cdf0e10cSrcweir aBtnPosition.Hide(); 1275cdf0e10cSrcweir aBtnArea.Hide(); 1276cdf0e10cSrcweir aBtnTile.Hide(); 1277cdf0e10cSrcweir aWndPosition.Hide(); 1278cdf0e10cSrcweir aGbPosition.Hide(); 1279cdf0e10cSrcweir pPreviewWin2->Hide(); 1280cdf0e10cSrcweir aGraphTransFL.Show(sal_False); 1281cdf0e10cSrcweir aGraphTransMF.Show(sal_False); 1282cdf0e10cSrcweir if(bColTransparency) 1283cdf0e10cSrcweir { 1284cdf0e10cSrcweir aColTransFT.Show(); 1285cdf0e10cSrcweir aColTransMF.Show(); 1286cdf0e10cSrcweir } 1287cdf0e10cSrcweir } 1288cdf0e10cSrcweir } 1289cdf0e10cSrcweir 1290cdf0e10cSrcweir //------------------------------------------------------------------------ 1291cdf0e10cSrcweir 1292cdf0e10cSrcweir void SvxBackgroundTabPage::ShowBitmapUI_Impl() 1293cdf0e10cSrcweir 1294cdf0e10cSrcweir /* [Beschreibung] 1295cdf0e10cSrcweir 1296cdf0e10cSrcweir Die Controls f"ur die Farbeinstellung ausblenden und die 1297cdf0e10cSrcweir Controls f"ur das Einstellen der Grafik einblenden. 1298cdf0e10cSrcweir */ 1299cdf0e10cSrcweir 1300cdf0e10cSrcweir { 1301cdf0e10cSrcweir if ( aLbSelect.IsVisible() && 1302cdf0e10cSrcweir ( 1303cdf0e10cSrcweir aBackgroundColorSet.IsVisible() 1304cdf0e10cSrcweir || !aBtnBrowse.IsVisible() ) ) 1305cdf0e10cSrcweir { 1306cdf0e10cSrcweir aBackgroundColorSet.Hide(); 1307cdf0e10cSrcweir aBackgroundColorBox.Hide(); 1308cdf0e10cSrcweir aBorderWin.Hide(); 1309cdf0e10cSrcweir pPreviewWin1->Hide(); 1310cdf0e10cSrcweir aBtnBrowse.Show(); 1311cdf0e10cSrcweir aFtFile.Show(); 1312cdf0e10cSrcweir 1313cdf0e10cSrcweir if ( !bLinkOnly && ! nHtmlMode & HTMLMODE_ON ) 1314cdf0e10cSrcweir aBtnLink.Show(); 1315cdf0e10cSrcweir aBtnPreview.Show(); 1316cdf0e10cSrcweir aGbFile.Show(); 1317cdf0e10cSrcweir aBtnPosition.Show(); 1318cdf0e10cSrcweir aBtnArea.Show(); 1319cdf0e10cSrcweir aBtnTile.Show(); 1320cdf0e10cSrcweir aWndPosition.Show(); 1321cdf0e10cSrcweir aGbPosition.Show(); 1322cdf0e10cSrcweir pPreviewWin2->Show(); 1323cdf0e10cSrcweir if(bGraphTransparency) 1324cdf0e10cSrcweir { 1325cdf0e10cSrcweir aGraphTransFL.Show(); 1326cdf0e10cSrcweir aGraphTransMF.Show(); 1327cdf0e10cSrcweir } 1328cdf0e10cSrcweir aColTransFT.Show(sal_False); 1329cdf0e10cSrcweir aColTransMF.Show(sal_False); 1330cdf0e10cSrcweir } 1331cdf0e10cSrcweir } 1332cdf0e10cSrcweir 1333cdf0e10cSrcweir //------------------------------------------------------------------------ 1334cdf0e10cSrcweir 1335cdf0e10cSrcweir void SvxBackgroundTabPage::SetGraphicPosition_Impl( SvxGraphicPosition ePos ) 1336cdf0e10cSrcweir 1337cdf0e10cSrcweir /* [Beschreibung] 1338cdf0e10cSrcweir 1339cdf0e10cSrcweir Die Controls f"ur die Grafikposition einstellen. 1340cdf0e10cSrcweir */ 1341cdf0e10cSrcweir 1342cdf0e10cSrcweir { 1343cdf0e10cSrcweir switch ( ePos ) 1344cdf0e10cSrcweir { 1345cdf0e10cSrcweir case GPOS_AREA: 1346cdf0e10cSrcweir { 1347cdf0e10cSrcweir aBtnArea.Check(); 1348cdf0e10cSrcweir aWndPosition.Disable(); 1349cdf0e10cSrcweir } 1350cdf0e10cSrcweir break; 1351cdf0e10cSrcweir 1352cdf0e10cSrcweir case GPOS_TILED: 1353cdf0e10cSrcweir { 1354cdf0e10cSrcweir aBtnTile.Check(); 1355cdf0e10cSrcweir aWndPosition.Disable(); 1356cdf0e10cSrcweir } 1357cdf0e10cSrcweir break; 1358cdf0e10cSrcweir 1359cdf0e10cSrcweir default: 1360cdf0e10cSrcweir { 1361cdf0e10cSrcweir aBtnPosition.Check(); 1362cdf0e10cSrcweir aWndPosition.Enable(); 1363cdf0e10cSrcweir RECT_POINT eNewPos = RP_MM; 1364cdf0e10cSrcweir 1365cdf0e10cSrcweir switch ( ePos ) 1366cdf0e10cSrcweir { 1367cdf0e10cSrcweir case GPOS_MM: break; 1368cdf0e10cSrcweir case GPOS_LT: eNewPos = RP_LT; break; 1369cdf0e10cSrcweir case GPOS_MT: eNewPos = RP_MT; break; 1370cdf0e10cSrcweir case GPOS_RT: eNewPos = RP_RT; break; 1371cdf0e10cSrcweir case GPOS_LM: eNewPos = RP_LM; break; 1372cdf0e10cSrcweir case GPOS_RM: eNewPos = RP_RM; break; 1373cdf0e10cSrcweir case GPOS_LB: eNewPos = RP_LB; break; 1374cdf0e10cSrcweir case GPOS_MB: eNewPos = RP_MB; break; 1375cdf0e10cSrcweir case GPOS_RB: eNewPos = RP_RB; break; 1376cdf0e10cSrcweir default: ;//prevent warning 1377cdf0e10cSrcweir } 1378cdf0e10cSrcweir aWndPosition.SetActualRP( eNewPos ); 1379cdf0e10cSrcweir } 1380cdf0e10cSrcweir break; 1381cdf0e10cSrcweir } 1382cdf0e10cSrcweir aWndPosition.Invalidate(); 1383cdf0e10cSrcweir } 1384cdf0e10cSrcweir 1385cdf0e10cSrcweir //------------------------------------------------------------------------ 1386cdf0e10cSrcweir 1387cdf0e10cSrcweir SvxGraphicPosition SvxBackgroundTabPage::GetGraphicPosition_Impl() 1388cdf0e10cSrcweir 1389cdf0e10cSrcweir /* [Beschreibung] 1390cdf0e10cSrcweir 1391cdf0e10cSrcweir Die Position der Grafik zur"uckgeben. 1392cdf0e10cSrcweir */ 1393cdf0e10cSrcweir 1394cdf0e10cSrcweir { 1395cdf0e10cSrcweir if ( aBtnTile.IsChecked() ) 1396cdf0e10cSrcweir return GPOS_TILED; 1397cdf0e10cSrcweir else if ( aBtnArea.IsChecked() ) 1398cdf0e10cSrcweir return GPOS_AREA; 1399cdf0e10cSrcweir else 1400cdf0e10cSrcweir { 1401cdf0e10cSrcweir switch ( aWndPosition.GetActualRP() ) 1402cdf0e10cSrcweir { 1403cdf0e10cSrcweir case RP_LT: return GPOS_LT; 1404cdf0e10cSrcweir case RP_MT: return GPOS_MT; 1405cdf0e10cSrcweir case RP_RT: return GPOS_RT; 1406cdf0e10cSrcweir case RP_LM: return GPOS_LM; 1407cdf0e10cSrcweir case RP_MM: return GPOS_MM; 1408cdf0e10cSrcweir case RP_RM: return GPOS_RM; 1409cdf0e10cSrcweir case RP_LB: return GPOS_LB; 1410cdf0e10cSrcweir case RP_MB: return GPOS_MB; 1411cdf0e10cSrcweir case RP_RB: return GPOS_RB; 1412cdf0e10cSrcweir } 1413cdf0e10cSrcweir } 1414cdf0e10cSrcweir return GPOS_MM; 1415cdf0e10cSrcweir } 1416cdf0e10cSrcweir 1417cdf0e10cSrcweir //----------------------------------------------------------------------- 1418cdf0e10cSrcweir // Handler 1419cdf0e10cSrcweir //----------------------------------------------------------------------- 1420cdf0e10cSrcweir 1421cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, BackgroundColorHdl_Impl, ValueSet*, EMPTYARG ) 1422cdf0e10cSrcweir /* 1423cdf0e10cSrcweir Handler, called when color selection is changed 1424cdf0e10cSrcweir */ 1425cdf0e10cSrcweir { 1426cdf0e10cSrcweir sal_uInt16 nItemId = aBackgroundColorSet.GetSelectItemId(); 1427cdf0e10cSrcweir Color aColor = nItemId ? ( aBackgroundColorSet.GetItemColor( nItemId ) ) : Color( COL_TRANSPARENT ); 1428cdf0e10cSrcweir aBgdColor = aColor; 1429cdf0e10cSrcweir pPreviewWin1->NotifyChange( aBgdColor ); 1430cdf0e10cSrcweir sal_Bool bEnableTransp = aBgdColor.GetTransparency() < 0xff; 1431cdf0e10cSrcweir aColTransFT.Enable(bEnableTransp); 1432cdf0e10cSrcweir aColTransMF.Enable(bEnableTransp); 1433cdf0e10cSrcweir return 0; 1434cdf0e10cSrcweir } 1435cdf0e10cSrcweir 1436cdf0e10cSrcweir //------------------------------------------------------------------------ 1437cdf0e10cSrcweir 1438cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, SelectHdl_Impl, ListBox*, EMPTYARG ) 1439cdf0e10cSrcweir 1440cdf0e10cSrcweir /* [Beschreibung] 1441cdf0e10cSrcweir 1442cdf0e10cSrcweir */ 1443cdf0e10cSrcweir 1444cdf0e10cSrcweir { 1445cdf0e10cSrcweir if ( 0 == aLbSelect.GetSelectEntryPos() ) 1446cdf0e10cSrcweir { 1447cdf0e10cSrcweir ShowColorUI_Impl(); 1448cdf0e10cSrcweir aParaLBox.Enable(); // Zeichenhintergrund kann keine Bitmap sein 1449cdf0e10cSrcweir } 1450cdf0e10cSrcweir else 1451cdf0e10cSrcweir { 1452cdf0e10cSrcweir ShowBitmapUI_Impl(); 1453cdf0e10cSrcweir aParaLBox.Enable(sal_False);// Zeichenhintergrund kann keine Bitmap sein 1454cdf0e10cSrcweir } 1455cdf0e10cSrcweir return 0; 1456cdf0e10cSrcweir } 1457cdf0e10cSrcweir 1458cdf0e10cSrcweir //------------------------------------------------------------------------ 1459cdf0e10cSrcweir 1460cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, FileClickHdl_Impl, CheckBox*, pBox ) 1461cdf0e10cSrcweir 1462cdf0e10cSrcweir /* [Beschreibung] 1463cdf0e10cSrcweir 1464cdf0e10cSrcweir */ 1465cdf0e10cSrcweir 1466cdf0e10cSrcweir { 1467cdf0e10cSrcweir if ( &aBtnLink == pBox ) 1468cdf0e10cSrcweir { 1469cdf0e10cSrcweir if ( aBtnLink.IsChecked() ) 1470cdf0e10cSrcweir { 1471cdf0e10cSrcweir INetURLObject aObj( aBgdGraphicPath ); 1472cdf0e10cSrcweir String aFilePath; 1473cdf0e10cSrcweir if ( aObj.GetProtocol() == INET_PROT_FILE ) 1474cdf0e10cSrcweir aFilePath = aObj.getFSysPath( INetURLObject::FSYS_DETECT ); 1475cdf0e10cSrcweir else 1476cdf0e10cSrcweir aFilePath = aBgdGraphicPath; 1477cdf0e10cSrcweir aFtFile.SetText( aFilePath ); 1478cdf0e10cSrcweir } 1479cdf0e10cSrcweir else 1480cdf0e10cSrcweir aFtFile.SetText( aStrUnlinked ); 1481cdf0e10cSrcweir } 1482cdf0e10cSrcweir else if ( &aBtnPreview == pBox ) 1483cdf0e10cSrcweir { 1484cdf0e10cSrcweir if ( aBtnPreview.IsChecked() ) 1485cdf0e10cSrcweir { 1486cdf0e10cSrcweir if ( !bIsGraphicValid ) 1487cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 1488cdf0e10cSrcweir 1489cdf0e10cSrcweir if ( bIsGraphicValid ) 1490cdf0e10cSrcweir { 1491cdf0e10cSrcweir Bitmap aBmp = aBgdGraphic.GetBitmap(); 1492cdf0e10cSrcweir pPreviewWin2->NotifyChange( &aBmp ); 1493cdf0e10cSrcweir } 1494cdf0e10cSrcweir else 1495cdf0e10cSrcweir { 1496cdf0e10cSrcweir if ( aBgdGraphicPath.Len() > 0 ) // nur bei gelinkter Grafik 1497cdf0e10cSrcweir RaiseLoadError_Impl(); // ein Fehler 1498cdf0e10cSrcweir pPreviewWin2->NotifyChange( NULL ); 1499cdf0e10cSrcweir } 1500cdf0e10cSrcweir } 1501cdf0e10cSrcweir else 1502cdf0e10cSrcweir pPreviewWin2->NotifyChange( NULL ); 1503cdf0e10cSrcweir } 1504cdf0e10cSrcweir return 0; 1505cdf0e10cSrcweir } 1506cdf0e10cSrcweir 1507cdf0e10cSrcweir //------------------------------------------------------------------------ 1508cdf0e10cSrcweir 1509cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, RadioClickHdl_Impl, RadioButton*, pBtn ) 1510cdf0e10cSrcweir 1511cdf0e10cSrcweir /* [Beschreibung] 1512cdf0e10cSrcweir 1513cdf0e10cSrcweir */ 1514cdf0e10cSrcweir 1515cdf0e10cSrcweir { 1516cdf0e10cSrcweir if ( pBtn == &aBtnPosition ) 1517cdf0e10cSrcweir { 1518cdf0e10cSrcweir if ( !aWndPosition.IsEnabled() ) 1519cdf0e10cSrcweir { 1520cdf0e10cSrcweir aWndPosition.Enable(); 1521cdf0e10cSrcweir aWndPosition.Invalidate(); 1522cdf0e10cSrcweir } 1523cdf0e10cSrcweir } 1524cdf0e10cSrcweir else if ( aWndPosition.IsEnabled() ) 1525cdf0e10cSrcweir { 1526cdf0e10cSrcweir aWndPosition.Disable(); 1527cdf0e10cSrcweir aWndPosition.Invalidate(); 1528cdf0e10cSrcweir } 1529cdf0e10cSrcweir return 0; 1530cdf0e10cSrcweir } 1531cdf0e10cSrcweir 1532cdf0e10cSrcweir //------------------------------------------------------------------------ 1533cdf0e10cSrcweir 1534cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, BrowseHdl_Impl, PushButton* , EMPTYARG ) 1535cdf0e10cSrcweir 1536cdf0e10cSrcweir /* [Beschreibung] 1537cdf0e10cSrcweir 1538cdf0e10cSrcweir Handler, gerufen durch das Dr"ucken des Durchsuchen-Buttons. 1539cdf0e10cSrcweir Grafik/Einf"ugen-Dialog erzeugen, Pfad setzen und starten. 1540cdf0e10cSrcweir */ 1541cdf0e10cSrcweir 1542cdf0e10cSrcweir { 1543cdf0e10cSrcweir if ( pPageImpl->pLoadTimer->IsActive() ) 1544cdf0e10cSrcweir return 0; 1545cdf0e10cSrcweir sal_Bool bHtml = 0 != ( nHtmlMode & HTMLMODE_ON ); 1546cdf0e10cSrcweir 1547cdf0e10cSrcweir pImportDlg = new SvxOpenGraphicDialog( aStrBrowse ); 1548cdf0e10cSrcweir if ( bHtml || bLinkOnly ) 1549cdf0e10cSrcweir pImportDlg->EnableLink(sal_False); 1550cdf0e10cSrcweir pImportDlg->SetPath( aBgdGraphicPath, aBtnLink.IsChecked() ); 1551cdf0e10cSrcweir 1552cdf0e10cSrcweir pPageImpl->bIsImportDlgInExecute = sal_True; 1553cdf0e10cSrcweir short nErr = pImportDlg->Execute(); 1554cdf0e10cSrcweir pPageImpl->bIsImportDlgInExecute = sal_False; 1555cdf0e10cSrcweir 1556cdf0e10cSrcweir if( !nErr ) 1557cdf0e10cSrcweir { 1558cdf0e10cSrcweir if ( bHtml ) 1559cdf0e10cSrcweir aBtnLink.Check(); 1560cdf0e10cSrcweir // wenn Verkn"upfen nicht gecheckt ist und die Vorschau auch nicht, 1561cdf0e10cSrcweir // dann die Vorschau aktivieren, damit der Anwender sieht, 1562cdf0e10cSrcweir // welche Grafik er ausgew"ahlt hat 1563cdf0e10cSrcweir if ( !aBtnLink.IsChecked() && !aBtnPreview.IsChecked() ) 1564cdf0e10cSrcweir aBtnPreview.Check( sal_True ); 1565cdf0e10cSrcweir // timer-verz"ogertes Laden der Grafik 1566cdf0e10cSrcweir pPageImpl->pLoadTimer->Start(); 1567cdf0e10cSrcweir } 1568cdf0e10cSrcweir else 1569cdf0e10cSrcweir DELETEZ( pImportDlg ); 1570cdf0e10cSrcweir return 0; 1571cdf0e10cSrcweir } 1572cdf0e10cSrcweir 1573cdf0e10cSrcweir //----------------------------------------------------------------------- 1574cdf0e10cSrcweir 1575cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, LoadTimerHdl_Impl, Timer* , pTimer ) 1576cdf0e10cSrcweir 1577cdf0e10cSrcweir /* [Beschreibung] 1578cdf0e10cSrcweir 1579cdf0e10cSrcweir Verz"ogertes Laden der Grafik. 1580cdf0e10cSrcweir Grafik wird nur dann geladen, wenn sie unterschiedlich zur 1581cdf0e10cSrcweir aktuellen Grafik ist. 1582cdf0e10cSrcweir */ 1583cdf0e10cSrcweir 1584cdf0e10cSrcweir { 1585cdf0e10cSrcweir if ( pTimer == pPageImpl->pLoadTimer ) 1586cdf0e10cSrcweir { 1587cdf0e10cSrcweir pPageImpl->pLoadTimer->Stop(); 1588cdf0e10cSrcweir 1589cdf0e10cSrcweir if ( pImportDlg ) 1590cdf0e10cSrcweir { 1591cdf0e10cSrcweir INetURLObject aOld( aBgdGraphicPath ); 1592cdf0e10cSrcweir INetURLObject aNew( pImportDlg->GetPath() ); 1593cdf0e10cSrcweir if ( !aBgdGraphicPath.Len() || aNew != aOld ) 1594cdf0e10cSrcweir { 1595cdf0e10cSrcweir // neue Datei gew"ahlt 1596cdf0e10cSrcweir aBgdGraphicPath = pImportDlg->GetPath(); 1597cdf0e10cSrcweir aBgdGraphicFilter = pImportDlg->GetCurrentFilter(); 1598cdf0e10cSrcweir sal_Bool bLink = ( nHtmlMode & HTMLMODE_ON ) || bLinkOnly ? sal_True : pImportDlg->IsAsLink(); 1599cdf0e10cSrcweir aBtnLink.Check( bLink ); 1600cdf0e10cSrcweir aBtnLink.Enable(); 1601cdf0e10cSrcweir 1602cdf0e10cSrcweir if ( aBtnPreview.IsChecked() ) 1603cdf0e10cSrcweir { 1604cdf0e10cSrcweir if( !pImportDlg->GetGraphic(aBgdGraphic) ) 1605cdf0e10cSrcweir { 1606cdf0e10cSrcweir bIsGraphicValid = sal_True; 1607cdf0e10cSrcweir } 1608cdf0e10cSrcweir else 1609cdf0e10cSrcweir { 1610cdf0e10cSrcweir aBgdGraphicFilter.Erase(); 1611cdf0e10cSrcweir aBgdGraphicPath.Erase(); 1612cdf0e10cSrcweir bIsGraphicValid = sal_False; 1613cdf0e10cSrcweir } 1614cdf0e10cSrcweir } 1615cdf0e10cSrcweir else 1616cdf0e10cSrcweir bIsGraphicValid = sal_False; // Grafik erst beim Preview-Click laden 1617cdf0e10cSrcweir 1618cdf0e10cSrcweir if ( aBtnPreview.IsChecked() && bIsGraphicValid ) 1619cdf0e10cSrcweir { 1620cdf0e10cSrcweir Bitmap aBmp = aBgdGraphic.GetBitmap(); 1621cdf0e10cSrcweir pPreviewWin2->NotifyChange( &aBmp ); 1622cdf0e10cSrcweir } 1623cdf0e10cSrcweir else 1624cdf0e10cSrcweir pPreviewWin2->NotifyChange( NULL ); 1625cdf0e10cSrcweir } 1626cdf0e10cSrcweir 1627cdf0e10cSrcweir FileClickHdl_Impl( &aBtnLink ); 1628cdf0e10cSrcweir DELETEZ( pImportDlg ); 1629cdf0e10cSrcweir } 1630cdf0e10cSrcweir } 1631cdf0e10cSrcweir return 0; 1632cdf0e10cSrcweir } 1633cdf0e10cSrcweir 1634cdf0e10cSrcweir //----------------------------------------------------------------------- 1635cdf0e10cSrcweir 1636cdf0e10cSrcweir void SvxBackgroundTabPage::ShowTblControl() 1637cdf0e10cSrcweir 1638cdf0e10cSrcweir /* [Beschreibung] 1639cdf0e10cSrcweir 1640cdf0e10cSrcweir */ 1641cdf0e10cSrcweir 1642cdf0e10cSrcweir { 1643cdf0e10cSrcweir aTblLBox .SetSelectHdl( HDL(TblDestinationHdl_Impl) ); 1644cdf0e10cSrcweir aTblLBox .SelectEntryPos(0); 1645cdf0e10cSrcweir aTblDesc.Show(); 1646cdf0e10cSrcweir aTblLBox.Show(); 1647cdf0e10cSrcweir } 1648cdf0e10cSrcweir 1649cdf0e10cSrcweir //----------------------------------------------------------------------- 1650cdf0e10cSrcweir 1651cdf0e10cSrcweir void SvxBackgroundTabPage::ShowParaControl(sal_Bool bCharOnly) 1652cdf0e10cSrcweir { 1653cdf0e10cSrcweir aParaLBox.SetSelectHdl(HDL(ParaDestinationHdl_Impl)); 1654cdf0e10cSrcweir aParaLBox.SelectEntryPos(0); 1655cdf0e10cSrcweir if(!bCharOnly) 1656cdf0e10cSrcweir { 1657cdf0e10cSrcweir aTblDesc.Show(); 1658cdf0e10cSrcweir aParaLBox.Show(); 1659cdf0e10cSrcweir } 1660cdf0e10cSrcweir aParaLBox.SetData(&aParaLBox); // hier erkennt man, dass dieser Mode eingeschaltet ist 1661cdf0e10cSrcweir } 1662cdf0e10cSrcweir //----------------------------------------------------------------------- 1663cdf0e10cSrcweir 1664cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox ) 1665cdf0e10cSrcweir 1666cdf0e10cSrcweir /* [Beschreibung] 1667cdf0e10cSrcweir 1668cdf0e10cSrcweir */ 1669cdf0e10cSrcweir 1670cdf0e10cSrcweir { 1671cdf0e10cSrcweir sal_uInt16 nSelPos = pBox->GetSelectEntryPos(); 1672cdf0e10cSrcweir if( pTableBck_Impl && pTableBck_Impl->nActPos != nSelPos) 1673cdf0e10cSrcweir { 1674cdf0e10cSrcweir SvxBrushItem** pActItem = new (SvxBrushItem*); 1675cdf0e10cSrcweir sal_uInt16 nWhich = 0; 1676cdf0e10cSrcweir switch(pTableBck_Impl->nActPos) 1677cdf0e10cSrcweir { 1678cdf0e10cSrcweir case TBL_DEST_CELL: 1679cdf0e10cSrcweir *pActItem = pTableBck_Impl->pCellBrush; 1680cdf0e10cSrcweir nWhich = pTableBck_Impl->nCellWhich; 1681cdf0e10cSrcweir break; 1682cdf0e10cSrcweir case TBL_DEST_ROW: 1683cdf0e10cSrcweir *pActItem = pTableBck_Impl->pRowBrush; 1684cdf0e10cSrcweir nWhich = pTableBck_Impl->nRowWhich; 1685cdf0e10cSrcweir break; 1686cdf0e10cSrcweir case TBL_DEST_TBL: 1687cdf0e10cSrcweir *pActItem = pTableBck_Impl->pTableBrush; 1688cdf0e10cSrcweir nWhich = pTableBck_Impl->nTableWhich; 1689cdf0e10cSrcweir break; 1690cdf0e10cSrcweir } 1691cdf0e10cSrcweir pTableBck_Impl->nActPos = nSelPos; 1692cdf0e10cSrcweir if(!*pActItem) 1693cdf0e10cSrcweir *pActItem = new SvxBrushItem(nWhich); 1694cdf0e10cSrcweir if(0 == aLbSelect.GetSelectEntryPos()) // Brush ausgewaehlt 1695cdf0e10cSrcweir { 1696cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdColor, nWhich ); 1697cdf0e10cSrcweir } 1698cdf0e10cSrcweir else 1699cdf0e10cSrcweir { 1700cdf0e10cSrcweir SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); 1701cdf0e10cSrcweir const sal_Bool bIsLink = aBtnLink.IsChecked(); 1702cdf0e10cSrcweir 1703cdf0e10cSrcweir if ( !bIsLink && !bIsGraphicValid ) 1704cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 1705cdf0e10cSrcweir 1706cdf0e10cSrcweir if ( bIsLink ) 1707cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdGraphicPath, 1708cdf0e10cSrcweir aBgdGraphicFilter, 1709cdf0e10cSrcweir eNewPos, 1710cdf0e10cSrcweir (*pActItem)->Which() ); 1711cdf0e10cSrcweir else 1712cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdGraphic, 1713cdf0e10cSrcweir eNewPos, 1714cdf0e10cSrcweir (*pActItem)->Which() ); 1715cdf0e10cSrcweir } 1716cdf0e10cSrcweir switch(nSelPos) 1717cdf0e10cSrcweir { 1718cdf0e10cSrcweir case TBL_DEST_CELL: 1719cdf0e10cSrcweir *pActItem = pTableBck_Impl->pCellBrush; 1720cdf0e10cSrcweir aLbSelect.Enable(); 1721cdf0e10cSrcweir nWhich = pTableBck_Impl->nCellWhich; 1722cdf0e10cSrcweir break; 1723cdf0e10cSrcweir case TBL_DEST_ROW: 1724cdf0e10cSrcweir { 1725cdf0e10cSrcweir if((nHtmlMode & HTMLMODE_ON) && !(nHtmlMode & HTMLMODE_SOME_STYLES)) 1726cdf0e10cSrcweir aLbSelect.Disable(); 1727cdf0e10cSrcweir *pActItem = pTableBck_Impl->pRowBrush; 1728cdf0e10cSrcweir nWhich = pTableBck_Impl->nRowWhich; 1729cdf0e10cSrcweir } 1730cdf0e10cSrcweir break; 1731cdf0e10cSrcweir case TBL_DEST_TBL: 1732cdf0e10cSrcweir *pActItem = pTableBck_Impl->pTableBrush; 1733cdf0e10cSrcweir aLbSelect.Enable(); 1734cdf0e10cSrcweir nWhich = pTableBck_Impl->nTableWhich; 1735cdf0e10cSrcweir break; 1736cdf0e10cSrcweir } 1737cdf0e10cSrcweir String aUserData = GetUserData(); 1738cdf0e10cSrcweir if(!*pActItem) 1739cdf0e10cSrcweir *pActItem = new SvxBrushItem(nWhich); 1740cdf0e10cSrcweir FillControls_Impl(**pActItem, aUserData); 1741cdf0e10cSrcweir delete pActItem; 1742cdf0e10cSrcweir } 1743cdf0e10cSrcweir return 0; 1744cdf0e10cSrcweir } 1745cdf0e10cSrcweir 1746cdf0e10cSrcweir //----------------------------------------------------------------------- 1747cdf0e10cSrcweir 1748cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, ParaDestinationHdl_Impl, ListBox*, pBox ) 1749cdf0e10cSrcweir { 1750cdf0e10cSrcweir sal_uInt16 nSelPos = pBox->GetSelectEntryPos(); 1751cdf0e10cSrcweir if( pParaBck_Impl && pParaBck_Impl->nActPos != nSelPos) 1752cdf0e10cSrcweir { 1753cdf0e10cSrcweir SvxBrushItem** pActItem = new (SvxBrushItem*); 1754cdf0e10cSrcweir switch(pParaBck_Impl->nActPos) 1755cdf0e10cSrcweir { 1756cdf0e10cSrcweir case PARA_DEST_PARA: 1757cdf0e10cSrcweir *pActItem = pParaBck_Impl->pParaBrush; 1758cdf0e10cSrcweir break; 1759cdf0e10cSrcweir case PARA_DEST_CHAR: 1760cdf0e10cSrcweir *pActItem = pParaBck_Impl->pCharBrush; 1761cdf0e10cSrcweir break; 1762cdf0e10cSrcweir } 1763cdf0e10cSrcweir pParaBck_Impl->nActPos = nSelPos; 1764cdf0e10cSrcweir if(0 == aLbSelect.GetSelectEntryPos()) // Brush ausgewaehlt 1765cdf0e10cSrcweir { 1766cdf0e10cSrcweir sal_uInt16 nWhich = (*pActItem)->Which(); 1767cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdColor, nWhich ); 1768cdf0e10cSrcweir } 1769cdf0e10cSrcweir else 1770cdf0e10cSrcweir { 1771cdf0e10cSrcweir SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); 1772cdf0e10cSrcweir const sal_Bool bIsLink = aBtnLink.IsChecked(); 1773cdf0e10cSrcweir 1774cdf0e10cSrcweir if ( !bIsLink && !bIsGraphicValid ) 1775cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 1776cdf0e10cSrcweir 1777cdf0e10cSrcweir if ( bIsLink ) 1778cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdGraphicPath, 1779cdf0e10cSrcweir aBgdGraphicFilter, 1780cdf0e10cSrcweir eNewPos, 1781cdf0e10cSrcweir (*pActItem)->Which() ); 1782cdf0e10cSrcweir else 1783cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdGraphic, 1784cdf0e10cSrcweir eNewPos, 1785cdf0e10cSrcweir (*pActItem)->Which() ); 1786cdf0e10cSrcweir } 1787cdf0e10cSrcweir switch(nSelPos) 1788cdf0e10cSrcweir { 1789cdf0e10cSrcweir case PARA_DEST_PARA: 1790cdf0e10cSrcweir *pActItem = pParaBck_Impl->pParaBrush; 1791cdf0e10cSrcweir aLbSelect.Enable(); 1792cdf0e10cSrcweir break; 1793cdf0e10cSrcweir case PARA_DEST_CHAR: 1794cdf0e10cSrcweir { 1795cdf0e10cSrcweir *pActItem = pParaBck_Impl->pCharBrush; 1796cdf0e10cSrcweir aLbSelect.Enable(sal_False); 1797cdf0e10cSrcweir } 1798cdf0e10cSrcweir break; 1799cdf0e10cSrcweir } 1800cdf0e10cSrcweir String aUserData = GetUserData(); 1801cdf0e10cSrcweir FillControls_Impl(**pActItem, aUserData); 1802cdf0e10cSrcweir delete pActItem; 1803cdf0e10cSrcweir } 1804cdf0e10cSrcweir return 0; 1805cdf0e10cSrcweir } 1806cdf0e10cSrcweir 1807cdf0e10cSrcweir //----------------------------------------------------------------------- 1808cdf0e10cSrcweir 1809cdf0e10cSrcweir void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr, 1810cdf0e10cSrcweir const String& rUserData ) 1811cdf0e10cSrcweir 1812cdf0e10cSrcweir /* [Beschreibung] 1813cdf0e10cSrcweir 1814cdf0e10cSrcweir */ 1815cdf0e10cSrcweir 1816cdf0e10cSrcweir { 1817cdf0e10cSrcweir SvxGraphicPosition ePos = rBgdAttr.GetGraphicPos(); 1818cdf0e10cSrcweir const Color& rColor = rBgdAttr.GetColor(); 1819cdf0e10cSrcweir if(bColTransparency) 1820cdf0e10cSrcweir { 1821cdf0e10cSrcweir aColTransMF.SetValue(lcl_TransparencyToPercent(rColor.GetTransparency())); 1822cdf0e10cSrcweir aColTransMF.SaveValue(); 1823cdf0e10cSrcweir sal_Bool bEnableTransp = rColor.GetTransparency() < 0xff; 1824cdf0e10cSrcweir aColTransFT.Enable(bEnableTransp); 1825cdf0e10cSrcweir aColTransMF.Enable(bEnableTransp); 1826cdf0e10cSrcweir //the default setting should be "no transparency" 1827cdf0e10cSrcweir if(!bEnableTransp) 1828cdf0e10cSrcweir aColTransMF.SetValue(0); 1829cdf0e10cSrcweir } 1830cdf0e10cSrcweir 1831cdf0e10cSrcweir if ( GPOS_NONE == ePos || !aLbSelect.IsVisible() ) 1832cdf0e10cSrcweir { 1833cdf0e10cSrcweir aLbSelect.SelectEntryPos( 0 ); 1834cdf0e10cSrcweir ShowColorUI_Impl(); 1835cdf0e10cSrcweir Color aTrColor( COL_TRANSPARENT ); 1836cdf0e10cSrcweir aBgdColor = rColor; 1837cdf0e10cSrcweir 1838cdf0e10cSrcweir sal_uInt16 nCol = ( aTrColor != aBgdColor ) ? 1839cdf0e10cSrcweir GetItemId_Impl( aBackgroundColorSet, aBgdColor ) : 0; 1840cdf0e10cSrcweir 1841cdf0e10cSrcweir if( aTrColor != aBgdColor && nCol == 0) 1842cdf0e10cSrcweir { 1843cdf0e10cSrcweir aBackgroundColorSet.SetNoSelection(); 1844cdf0e10cSrcweir } 1845cdf0e10cSrcweir else 1846cdf0e10cSrcweir { 1847cdf0e10cSrcweir aBackgroundColorSet.SelectItem( nCol ); 1848cdf0e10cSrcweir } 1849cdf0e10cSrcweir 1850cdf0e10cSrcweir pPreviewWin1->NotifyChange( aBgdColor ); 1851cdf0e10cSrcweir if ( aLbSelect.IsVisible() ) // Grafikteil initialisieren 1852cdf0e10cSrcweir { 1853cdf0e10cSrcweir aBgdGraphicFilter.Erase(); 1854cdf0e10cSrcweir aBgdGraphicPath.Erase(); 1855cdf0e10cSrcweir 1856cdf0e10cSrcweir if ( !rUserData.Len() ) 1857cdf0e10cSrcweir aBtnPreview.Check( sal_False ); 1858cdf0e10cSrcweir aBtnLink.Check( sal_False ); 1859cdf0e10cSrcweir aBtnLink.Disable(); 1860cdf0e10cSrcweir pPreviewWin2->NotifyChange( NULL ); 1861cdf0e10cSrcweir SetGraphicPosition_Impl( GPOS_TILED ); // Kacheln als Default 1862cdf0e10cSrcweir } 1863cdf0e10cSrcweir } 1864cdf0e10cSrcweir else 1865cdf0e10cSrcweir { 1866cdf0e10cSrcweir const String* pStrLink = rBgdAttr.GetGraphicLink(); 1867cdf0e10cSrcweir const String* pStrFilter = rBgdAttr.GetGraphicFilter(); 1868cdf0e10cSrcweir 1869cdf0e10cSrcweir aLbSelect.SelectEntryPos( 1 ); 1870cdf0e10cSrcweir ShowBitmapUI_Impl(); 1871cdf0e10cSrcweir 1872cdf0e10cSrcweir if ( pStrLink ) 1873cdf0e10cSrcweir { 1874cdf0e10cSrcweir #ifdef DBG_UTIL 1875cdf0e10cSrcweir INetURLObject aObj( *pStrLink ); 1876cdf0e10cSrcweir DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" ); 1877cdf0e10cSrcweir #endif 1878cdf0e10cSrcweir aBgdGraphicPath = *pStrLink; 1879cdf0e10cSrcweir aBtnLink.Check( sal_True ); 1880cdf0e10cSrcweir aBtnLink.Enable(); 1881cdf0e10cSrcweir } 1882cdf0e10cSrcweir else 1883cdf0e10cSrcweir { 1884cdf0e10cSrcweir aBgdGraphicPath.Erase(); 1885cdf0e10cSrcweir aBtnLink.Check( sal_False ); 1886cdf0e10cSrcweir aBtnLink.Disable(); 1887cdf0e10cSrcweir } 1888cdf0e10cSrcweir 1889cdf0e10cSrcweir if(bGraphTransparency) 1890cdf0e10cSrcweir { 1891cdf0e10cSrcweir const GraphicObject* pObject = rBgdAttr.GetGraphicObject(); 1892cdf0e10cSrcweir if(pObject) 1893cdf0e10cSrcweir aGraphTransMF.SetValue(lcl_TransparencyToPercent(pObject->GetAttr().GetTransparency())); 1894cdf0e10cSrcweir else 1895cdf0e10cSrcweir aGraphTransMF.SetValue(0); 1896cdf0e10cSrcweir aGraphTransMF.SaveValue(); 1897cdf0e10cSrcweir } 1898cdf0e10cSrcweir 1899cdf0e10cSrcweir FileClickHdl_Impl( &aBtnLink ); 1900cdf0e10cSrcweir 1901cdf0e10cSrcweir if ( pStrFilter ) 1902cdf0e10cSrcweir aBgdGraphicFilter = *pStrFilter; 1903cdf0e10cSrcweir else 1904cdf0e10cSrcweir aBgdGraphicFilter.Erase(); 1905cdf0e10cSrcweir 1906cdf0e10cSrcweir if ( !pStrLink || aBtnPreview.IsChecked() ) 1907cdf0e10cSrcweir { 1908cdf0e10cSrcweir // Grafik ist im Item vorhanden und muss nicht 1909cdf0e10cSrcweir // geladen werden: 1910cdf0e10cSrcweir 1911cdf0e10cSrcweir const Graphic* pGraphic = rBgdAttr.GetGraphic(); 1912cdf0e10cSrcweir 1913cdf0e10cSrcweir if ( !pGraphic && aBtnPreview.IsChecked() ) 1914cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 1915cdf0e10cSrcweir else if ( pGraphic ) 1916cdf0e10cSrcweir { 1917cdf0e10cSrcweir aBgdGraphic = *pGraphic; 1918cdf0e10cSrcweir bIsGraphicValid = sal_True; 1919cdf0e10cSrcweir 1920cdf0e10cSrcweir if ( !rUserData.Len() ) 1921cdf0e10cSrcweir aBtnPreview.Check(); 1922cdf0e10cSrcweir } 1923cdf0e10cSrcweir else 1924cdf0e10cSrcweir { 1925cdf0e10cSrcweir RaiseLoadError_Impl(); 1926cdf0e10cSrcweir bIsGraphicValid = sal_False; 1927cdf0e10cSrcweir 1928cdf0e10cSrcweir if ( !rUserData.Len() ) 1929cdf0e10cSrcweir aBtnPreview.Check( sal_False ); 1930cdf0e10cSrcweir } 1931cdf0e10cSrcweir } 1932cdf0e10cSrcweir 1933cdf0e10cSrcweir if ( aBtnPreview.IsChecked() && bIsGraphicValid ) 1934cdf0e10cSrcweir { 1935cdf0e10cSrcweir Bitmap aBmp = aBgdGraphic.GetBitmap(); 1936cdf0e10cSrcweir pPreviewWin2->NotifyChange( &aBmp ); 1937cdf0e10cSrcweir } 1938cdf0e10cSrcweir else 1939cdf0e10cSrcweir pPreviewWin2->NotifyChange( NULL ); 1940cdf0e10cSrcweir 1941cdf0e10cSrcweir SetGraphicPosition_Impl( ePos ); 1942cdf0e10cSrcweir } 1943cdf0e10cSrcweir } 1944cdf0e10cSrcweir /* -----------------------------09.08.2002 14:04------------------------------ 1945cdf0e10cSrcweir 1946cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1947cdf0e10cSrcweir void SvxBackgroundTabPage::EnableTransparency(sal_Bool bColor, sal_Bool bGraphic) 1948cdf0e10cSrcweir { 1949cdf0e10cSrcweir bColTransparency = bColor; 1950cdf0e10cSrcweir bGraphTransparency = bGraphic; 1951cdf0e10cSrcweir if(bColor) 1952cdf0e10cSrcweir { 1953cdf0e10cSrcweir aColTransFT.Show(); 1954cdf0e10cSrcweir aColTransMF.Show(); 1955cdf0e10cSrcweir } 1956cdf0e10cSrcweir if(bGraphic) 1957cdf0e10cSrcweir { 1958cdf0e10cSrcweir Size aRectSize(aWndPosition.GetSizePixel()); 1959cdf0e10cSrcweir Point aRectPos(aWndPosition.GetPosPixel()); 1960cdf0e10cSrcweir Point aFLPos(aGraphTransFL.GetPosPixel()); 1961cdf0e10cSrcweir Size aTmp(LogicToPixel(Size(RSC_SP_FLGR_SPACE_Y, RSC_SP_FLGR_SPACE_Y), MAP_APPFONT)); 1962cdf0e10cSrcweir long nRectHeight = aFLPos.Y() - aRectPos.Y() - aTmp.Height(); 1963cdf0e10cSrcweir aRectSize.Height() = nRectHeight; 1964cdf0e10cSrcweir aWndPosition.SetSizePixel(aRectSize); 1965cdf0e10cSrcweir aWndPosition.Invalidate(); 1966cdf0e10cSrcweir } 1967cdf0e10cSrcweir } 1968cdf0e10cSrcweir 1969cdf0e10cSrcweir void SvxBackgroundTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 1970cdf0e10cSrcweir { 1971cdf0e10cSrcweir SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); 1972cdf0e10cSrcweir if (pFlagItem) 1973cdf0e10cSrcweir { 1974cdf0e10cSrcweir sal_uInt32 nFlags=pFlagItem->GetValue(); 1975cdf0e10cSrcweir if ( ( nFlags & SVX_SHOW_TBLCTL ) == SVX_SHOW_TBLCTL ) 1976cdf0e10cSrcweir ShowTblControl(); 1977cdf0e10cSrcweir if ( ( nFlags & SVX_SHOW_PARACTL ) == SVX_SHOW_PARACTL ) 1978cdf0e10cSrcweir ShowParaControl(); 1979cdf0e10cSrcweir if ( ( nFlags & SVX_SHOW_SELECTOR ) == SVX_SHOW_SELECTOR ) 1980cdf0e10cSrcweir ShowSelector(); 1981cdf0e10cSrcweir if ( ( nFlags & SVX_ENABLE_TRANSPARENCY ) == SVX_ENABLE_TRANSPARENCY ) 1982cdf0e10cSrcweir EnableTransparency(sal_True, sal_True); 1983cdf0e10cSrcweir } 1984cdf0e10cSrcweir } 1985