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 6670d3707aSArmin Le Grand #include <svtools/grfmgr.hxx> 6770d3707aSArmin 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) ); 404*28bcfa49SArmin Le Grand aBackgroundColorSet.SetStyle(aBackgroundColorSet.GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD); 405*28bcfa49SArmin Le Grand aBackgroundColorSet.SetText(SVX_RESSTR(RID_SVXSTR_TRANSPARENT)); 406*28bcfa49SArmin Le Grand aBackgroundColorSet.SetAccessibleName(aBackgroundColorBox.GetText()); 407cdf0e10cSrcweir FreeResource(); 408cdf0e10cSrcweir 409cdf0e10cSrcweir aBtnBrowse.SetAccessibleRelationMemberOf(&aGbFile); 410cdf0e10cSrcweir aWndPosition.SetAccessibleRelationMemberOf(&aGbPosition); 411cdf0e10cSrcweir aWndPosition.SetAccessibleRelationLabeledBy(&aBtnPosition); 412cdf0e10cSrcweir aBackgroundColorSet.SetAccessibleRelationLabeledBy(&aBackgroundColorBox); 413cdf0e10cSrcweir } 414cdf0e10cSrcweir 415cdf0e10cSrcweir //------------------------------------------------------------------------ 416cdf0e10cSrcweir 417cdf0e10cSrcweir SvxBackgroundTabPage::~SvxBackgroundTabPage() 418cdf0e10cSrcweir 419cdf0e10cSrcweir /* [Beschreibung] 420cdf0e10cSrcweir 421cdf0e10cSrcweir */ 422cdf0e10cSrcweir 423cdf0e10cSrcweir { 424cdf0e10cSrcweir delete pPreviewWin1; 425cdf0e10cSrcweir delete pPreviewWin2; 426cdf0e10cSrcweir delete pPageImpl->pLoadTimer; 427cdf0e10cSrcweir delete pPageImpl; 428cdf0e10cSrcweir delete pImportDlg; 429cdf0e10cSrcweir 430cdf0e10cSrcweir if( pTableBck_Impl) 431cdf0e10cSrcweir { 432cdf0e10cSrcweir delete pTableBck_Impl->pCellBrush; 433cdf0e10cSrcweir delete pTableBck_Impl->pRowBrush; 434cdf0e10cSrcweir delete pTableBck_Impl->pTableBrush; 435cdf0e10cSrcweir delete pTableBck_Impl; 436cdf0e10cSrcweir } 437cdf0e10cSrcweir 438cdf0e10cSrcweir if(pParaBck_Impl) 439cdf0e10cSrcweir { 440cdf0e10cSrcweir delete pParaBck_Impl->pParaBrush; 441cdf0e10cSrcweir delete pParaBck_Impl->pCharBrush; 442cdf0e10cSrcweir delete pParaBck_Impl; 443cdf0e10cSrcweir } 444cdf0e10cSrcweir } 445cdf0e10cSrcweir 446cdf0e10cSrcweir //------------------------------------------------------------------------ 447cdf0e10cSrcweir 448cdf0e10cSrcweir sal_uInt16* SvxBackgroundTabPage::GetRanges() 449cdf0e10cSrcweir 450cdf0e10cSrcweir /* [Beschreibung] 451cdf0e10cSrcweir 452cdf0e10cSrcweir gibt den Bereich der Which-Werte zur"uck 453cdf0e10cSrcweir */ 454cdf0e10cSrcweir 455cdf0e10cSrcweir { 456cdf0e10cSrcweir return pRanges; 457cdf0e10cSrcweir } 458cdf0e10cSrcweir 459cdf0e10cSrcweir //------------------------------------------------------------------------ 460cdf0e10cSrcweir 461cdf0e10cSrcweir SfxTabPage* SvxBackgroundTabPage::Create( Window* pParent, 462cdf0e10cSrcweir const SfxItemSet& rAttrSet ) 463cdf0e10cSrcweir 464cdf0e10cSrcweir /* [Beschreibung] 465cdf0e10cSrcweir 466cdf0e10cSrcweir Create-Methode f"ur den TabDialog 467cdf0e10cSrcweir */ 468cdf0e10cSrcweir 469cdf0e10cSrcweir { 470cdf0e10cSrcweir return ( new SvxBackgroundTabPage( pParent, rAttrSet ) ); 471cdf0e10cSrcweir } 472cdf0e10cSrcweir 473cdf0e10cSrcweir //------------------------------------------------------------------------ 474cdf0e10cSrcweir 475cdf0e10cSrcweir void SvxBackgroundTabPage::Reset( const SfxItemSet& rSet ) 476cdf0e10cSrcweir 477cdf0e10cSrcweir /* [Beschreibung] 478cdf0e10cSrcweir 479cdf0e10cSrcweir */ 480cdf0e10cSrcweir 481cdf0e10cSrcweir { 482cdf0e10cSrcweir // os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden, 483cdf0e10cSrcweir // es muss aber im rSet vorhanden sein! 484cdf0e10cSrcweir // const SfxPoolItem* pX = GetOldItem( rSet, SID_VIEW_FLD_PIC ); 485cdf0e10cSrcweir // if( pX && pX->ISA(SfxWallpaperItem)) 486cdf0e10cSrcweir if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), sal_False)) 487cdf0e10cSrcweir { 488cdf0e10cSrcweir ResetFromWallpaperItem( rSet ); 489cdf0e10cSrcweir return; 490cdf0e10cSrcweir } 491cdf0e10cSrcweir 492cdf0e10cSrcweir // Zustand des Vorschau-Buttons durch UserData persistent 493cdf0e10cSrcweir String aUserData = GetUserData(); 494cdf0e10cSrcweir aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) ); 495cdf0e10cSrcweir 496cdf0e10cSrcweir // nach Reset kein ShowSelector() mehr aufrufen d"urfen 497cdf0e10cSrcweir bAllowShowSelector = sal_False; 498cdf0e10cSrcweir 499cdf0e10cSrcweir 500cdf0e10cSrcweir // Input-BrushItem besorgen und auswerten 501cdf0e10cSrcweir const SvxBrushItem* pBgdAttr = NULL; 502cdf0e10cSrcweir sal_uInt16 nSlot = SID_ATTR_BRUSH; 503cdf0e10cSrcweir const SfxPoolItem* pItem; 504cdf0e10cSrcweir sal_uInt16 nDestValue = USHRT_MAX; 505cdf0e10cSrcweir 506cdf0e10cSrcweir if ( SFX_ITEM_SET == rSet.GetItemState( SID_BACKGRND_DESTINATION, 507cdf0e10cSrcweir sal_False, &pItem ) ) 508cdf0e10cSrcweir { 509cdf0e10cSrcweir nDestValue = ((const SfxUInt16Item*)pItem)->GetValue(); 510cdf0e10cSrcweir aTblLBox.SelectEntryPos(nDestValue); 511cdf0e10cSrcweir 512cdf0e10cSrcweir switch ( nDestValue ) 513cdf0e10cSrcweir { 514cdf0e10cSrcweir case TBL_DEST_CELL: 515cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH; 516cdf0e10cSrcweir break; 517cdf0e10cSrcweir case TBL_DEST_ROW: 518cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_ROW; 519cdf0e10cSrcweir break; 520cdf0e10cSrcweir case TBL_DEST_TBL: 521cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_TABLE; 522cdf0e10cSrcweir break; 523cdf0e10cSrcweir } 524cdf0e10cSrcweir } 525cdf0e10cSrcweir else if( SFX_ITEM_SET == rSet.GetItemState( 526cdf0e10cSrcweir SID_PARA_BACKGRND_DESTINATION, sal_False, &pItem ) ) 527cdf0e10cSrcweir { 528cdf0e10cSrcweir nDestValue = ((const SfxUInt16Item*)pItem)->GetValue(); 529cdf0e10cSrcweir // ist gerade Zeichen aktiviert? 530cdf0e10cSrcweir sal_uInt16 nParaSel = aParaLBox.GetSelectEntryPos(); 531cdf0e10cSrcweir if(1 == nParaSel) 532cdf0e10cSrcweir { 533cdf0e10cSrcweir // dann war das ein "Standard" - Aufruf 534cdf0e10cSrcweir nDestValue = nParaSel; 535cdf0e10cSrcweir } 536cdf0e10cSrcweir aParaLBox.SelectEntryPos(nDestValue); 537cdf0e10cSrcweir 538cdf0e10cSrcweir switch ( nDestValue ) 539cdf0e10cSrcweir { 540cdf0e10cSrcweir case PARA_DEST_PARA: 541cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH; 542cdf0e10cSrcweir break; 543cdf0e10cSrcweir case PARA_DEST_CHAR: 544cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_CHAR; 545cdf0e10cSrcweir break; 546cdf0e10cSrcweir } 547cdf0e10cSrcweir } 548cdf0e10cSrcweir //#111173# the destination item is missing when the parent style has been changed 549cdf0e10cSrcweir if(USHRT_MAX == nDestValue && (aParaLBox.IsVisible()||aTblLBox.IsVisible())) 550cdf0e10cSrcweir nDestValue = 0; 551cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( nSlot ); 552cdf0e10cSrcweir 553cdf0e10cSrcweir if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) 554cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); 555cdf0e10cSrcweir 556cdf0e10cSrcweir aBtnTile.Check(); 557cdf0e10cSrcweir 558cdf0e10cSrcweir if ( pBgdAttr ) 559cdf0e10cSrcweir { 560cdf0e10cSrcweir FillControls_Impl(*pBgdAttr, aUserData); 561cdf0e10cSrcweir aBgdColor = ( (SvxBrushItem*)pBgdAttr )->GetColor(); 562cdf0e10cSrcweir } 563cdf0e10cSrcweir else 564cdf0e10cSrcweir { 565cdf0e10cSrcweir aSelectTxt.Hide(); 566cdf0e10cSrcweir aLbSelect.Hide(); 567cdf0e10cSrcweir aLbSelect.SelectEntryPos( 0 ); 568cdf0e10cSrcweir ShowColorUI_Impl(); 569cdf0e10cSrcweir 570cdf0e10cSrcweir const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_BRUSH ); 571cdf0e10cSrcweir 572cdf0e10cSrcweir if ( pOld ) 573cdf0e10cSrcweir aBgdColor = ( (SvxBrushItem*)pOld )->GetColor(); 574cdf0e10cSrcweir } 575cdf0e10cSrcweir 576cdf0e10cSrcweir if ( nDestValue != USHRT_MAX ) 577cdf0e10cSrcweir { 578cdf0e10cSrcweir if(aTblLBox.IsVisible()) 579cdf0e10cSrcweir { 580cdf0e10cSrcweir sal_uInt16 nValue = aTblLBox.GetSelectEntryPos(); 581cdf0e10cSrcweir 582cdf0e10cSrcweir if ( pTableBck_Impl ) 583cdf0e10cSrcweir { 584cdf0e10cSrcweir DELETEZ( pTableBck_Impl->pCellBrush); 585cdf0e10cSrcweir DELETEZ( pTableBck_Impl->pRowBrush); 586cdf0e10cSrcweir DELETEZ( pTableBck_Impl->pTableBrush); 587cdf0e10cSrcweir } 588cdf0e10cSrcweir else 589cdf0e10cSrcweir pTableBck_Impl = new SvxBackgroundTable_Impl(); 590cdf0e10cSrcweir 591cdf0e10cSrcweir pTableBck_Impl->nActPos = nValue; 592cdf0e10cSrcweir 593cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_BRUSH ); 594cdf0e10cSrcweir if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) 595cdf0e10cSrcweir { 596cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); 597cdf0e10cSrcweir pTableBck_Impl->pCellBrush = new SvxBrushItem(*pBgdAttr); 598cdf0e10cSrcweir } 599cdf0e10cSrcweir pTableBck_Impl->nCellWhich = nWhich; 600cdf0e10cSrcweir 601cdf0e10cSrcweir if ( rSet.GetItemState( SID_ATTR_BRUSH_ROW, sal_False ) >= SFX_ITEM_AVAILABLE ) 602cdf0e10cSrcweir { 603cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_ROW ) ); 604cdf0e10cSrcweir pTableBck_Impl->pRowBrush = new SvxBrushItem(*pBgdAttr); 605cdf0e10cSrcweir } 606cdf0e10cSrcweir pTableBck_Impl->nRowWhich = SID_ATTR_BRUSH_ROW; 607cdf0e10cSrcweir 608cdf0e10cSrcweir if ( rSet.GetItemState( SID_ATTR_BRUSH_TABLE, sal_False ) >= SFX_ITEM_AVAILABLE ) 609cdf0e10cSrcweir { 610cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_TABLE ) ); 611cdf0e10cSrcweir pTableBck_Impl->pTableBrush = new SvxBrushItem(*pBgdAttr); 612cdf0e10cSrcweir } 613cdf0e10cSrcweir pTableBck_Impl->nTableWhich = SID_ATTR_BRUSH_TABLE; 614cdf0e10cSrcweir 615cdf0e10cSrcweir TblDestinationHdl_Impl(&aTblLBox); 616cdf0e10cSrcweir aTblLBox.SaveValue(); 617cdf0e10cSrcweir } 618cdf0e10cSrcweir else 619cdf0e10cSrcweir { 620cdf0e10cSrcweir sal_uInt16 nValue = aParaLBox.GetSelectEntryPos(); 621cdf0e10cSrcweir 622cdf0e10cSrcweir if ( pParaBck_Impl ) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir delete pParaBck_Impl->pParaBrush; 625cdf0e10cSrcweir delete pParaBck_Impl->pCharBrush; 626cdf0e10cSrcweir } 627cdf0e10cSrcweir else 628cdf0e10cSrcweir pParaBck_Impl = new SvxBackgroundPara_Impl(); 629cdf0e10cSrcweir 630cdf0e10cSrcweir pParaBck_Impl->nActPos = nValue; 631cdf0e10cSrcweir 632cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_BRUSH ); 633cdf0e10cSrcweir if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); 636cdf0e10cSrcweir pParaBck_Impl->pParaBrush = new SvxBrushItem(*pBgdAttr); 637cdf0e10cSrcweir } 638cdf0e10cSrcweir 639cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_BRUSH_CHAR ); 640cdf0e10cSrcweir SfxItemState eState = rSet.GetItemState( nWhich, sal_True ); 641cdf0e10cSrcweir eState = rSet.GetItemState( nWhich, sal_False ); 642cdf0e10cSrcweir if ( rSet.GetItemState( nWhich, sal_True ) > SFX_ITEM_AVAILABLE ) 643cdf0e10cSrcweir { 644cdf0e10cSrcweir pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); 645cdf0e10cSrcweir pParaBck_Impl->pCharBrush = new SvxBrushItem(*pBgdAttr); 646cdf0e10cSrcweir } 647cdf0e10cSrcweir else 648cdf0e10cSrcweir pParaBck_Impl->pCharBrush = new SvxBrushItem(SID_ATTR_BRUSH_CHAR); 649cdf0e10cSrcweir 650cdf0e10cSrcweir ParaDestinationHdl_Impl(&aParaLBox); 651cdf0e10cSrcweir aParaLBox.SaveValue(); 652cdf0e10cSrcweir } 653cdf0e10cSrcweir } 654cdf0e10cSrcweir if(!bResized) 655cdf0e10cSrcweir { 656cdf0e10cSrcweir if(!aLbSelect.IsVisible() && !aTblLBox.IsVisible() && !aParaLBox.IsVisible()) 657cdf0e10cSrcweir { 658cdf0e10cSrcweir long nY(LogicToPixel(Point(11,14), MAP_APPFONT).X()); 659cdf0e10cSrcweir long nX(LogicToPixel(Point(11,14), MAP_APPFONT).Y()); 660cdf0e10cSrcweir Point aPos(aBorderWin.GetPosPixel()); 661cdf0e10cSrcweir aPos.X() = nX; 662cdf0e10cSrcweir aPos.Y() = nY; 663cdf0e10cSrcweir aBorderWin.SetPosPixel(aPos); 664cdf0e10cSrcweir aPos = pPreviewWin1->GetPosPixel(); 665cdf0e10cSrcweir aPos.Y() = nY; 666cdf0e10cSrcweir pPreviewWin1->SetPosPixel(aPos); 667cdf0e10cSrcweir aBackgroundColorBox.Hide(); 668cdf0e10cSrcweir aBackgroundColorSet.SetAccessibleRelationLabeledBy(&aBackgroundColorSet); 669cdf0e10cSrcweir } 670cdf0e10cSrcweir } 671cdf0e10cSrcweir } 672cdf0e10cSrcweir 673cdf0e10cSrcweir void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet ) 674cdf0e10cSrcweir { 675cdf0e10cSrcweir ShowSelector(); 676cdf0e10cSrcweir 677cdf0e10cSrcweir // Zustand des Vorschau-Buttons durch UserData persistent 678cdf0e10cSrcweir String aUserData = GetUserData(); 679cdf0e10cSrcweir aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) ); 680cdf0e10cSrcweir 681cdf0e10cSrcweir // Input-BrushItem besorgen und auswerten 682cdf0e10cSrcweir const SvxBrushItem* pBgdAttr = NULL; 683cdf0e10cSrcweir sal_uInt16 nSlot = SID_VIEW_FLD_PIC; 684cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( nSlot ); 685cdf0e10cSrcweir SvxBrushItem* pTemp = 0; 686cdf0e10cSrcweir const CntWallpaperItem* pItem = 0; 687cdf0e10cSrcweir 688cdf0e10cSrcweir if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) 689cdf0e10cSrcweir { 690cdf0e10cSrcweir pItem = (const CntWallpaperItem*)&rSet.Get( nWhich ); 691cdf0e10cSrcweir pTemp = new SvxBrushItem( *pItem, nWhich ); 692cdf0e10cSrcweir pBgdAttr = pTemp; 693cdf0e10cSrcweir } 694cdf0e10cSrcweir 695cdf0e10cSrcweir aBtnTile.Check(); 696cdf0e10cSrcweir 697cdf0e10cSrcweir if ( pBgdAttr ) 698cdf0e10cSrcweir { 699cdf0e10cSrcweir FillControls_Impl(*pBgdAttr, aUserData); 700cdf0e10cSrcweir // Auch bei Anzeige der Grafik, soll die Brush erhalten bleiben 701cdf0e10cSrcweir if( aBgdColor != pBgdAttr->GetColor() ) 702cdf0e10cSrcweir { 703cdf0e10cSrcweir aBgdColor = pBgdAttr->GetColor(); 704cdf0e10cSrcweir sal_uInt16 nCol = GetItemId_Impl( aBackgroundColorSet, aBgdColor ); 705cdf0e10cSrcweir aBackgroundColorSet.SelectItem( nCol ); 706cdf0e10cSrcweir pPreviewWin1->NotifyChange( aBgdColor ); 707cdf0e10cSrcweir } 708cdf0e10cSrcweir } 709cdf0e10cSrcweir else 710cdf0e10cSrcweir { 711cdf0e10cSrcweir aLbSelect.SelectEntryPos( 0 ); 712cdf0e10cSrcweir ShowColorUI_Impl(); 713cdf0e10cSrcweir 714cdf0e10cSrcweir const SfxPoolItem* pOld = GetOldItem( rSet, SID_VIEW_FLD_PIC ); 715cdf0e10cSrcweir if ( pOld ) 716cdf0e10cSrcweir aBgdColor = Color( ((CntWallpaperItem*)pOld)->GetColor() ); 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir // We now have always a link to the background 720cdf0e10cSrcweir bLinkOnly = sal_True; 721cdf0e10cSrcweir aBtnLink.Check( sal_True ); 722cdf0e10cSrcweir aBtnLink.Show( sal_False ); 723cdf0e10cSrcweir // if( !pItem || !pItem->GetWallpaper(sal_False).IsBitmap() ) 724cdf0e10cSrcweir // aBtnLink.Check(); 725cdf0e10cSrcweir 726cdf0e10cSrcweir delete pTemp; 727cdf0e10cSrcweir } 728cdf0e10cSrcweir 729cdf0e10cSrcweir 730cdf0e10cSrcweir 731cdf0e10cSrcweir //------------------------------------------------------------------------ 732cdf0e10cSrcweir 733cdf0e10cSrcweir void SvxBackgroundTabPage::FillUserData() 734cdf0e10cSrcweir 735cdf0e10cSrcweir /* [Beschreibung] 736cdf0e10cSrcweir 737cdf0e10cSrcweir Beim Destruieren einer SfxTabPage wird diese virtuelle Methode gerufen, 738cdf0e10cSrcweir damit die TabPage interne Informationen sichern kann. 739cdf0e10cSrcweir 740cdf0e10cSrcweir In diesem Fall wird der Zustand des Vorschau-Buttons gesichert. 741cdf0e10cSrcweir */ 742cdf0e10cSrcweir 743cdf0e10cSrcweir { 744cdf0e10cSrcweir SetUserData( String( aBtnPreview.IsChecked() ? sal_Unicode('1') : sal_Unicode('0') ) ); 745cdf0e10cSrcweir } 746cdf0e10cSrcweir 747cdf0e10cSrcweir //------------------------------------------------------------------------ 748cdf0e10cSrcweir 749cdf0e10cSrcweir sal_Bool SvxBackgroundTabPage::FillItemSet( SfxItemSet& rCoreSet ) 750cdf0e10cSrcweir 751cdf0e10cSrcweir /* [Beschreibung] 752cdf0e10cSrcweir 753cdf0e10cSrcweir */ 754cdf0e10cSrcweir 755cdf0e10cSrcweir { 756cdf0e10cSrcweir if ( pPageImpl->pLoadTimer && pPageImpl->pLoadTimer->IsActive() ) 757cdf0e10cSrcweir { 758cdf0e10cSrcweir pPageImpl->pLoadTimer->Stop(); 759cdf0e10cSrcweir LoadTimerHdl_Impl( pPageImpl->pLoadTimer ); 760cdf0e10cSrcweir } 761cdf0e10cSrcweir // os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden, 762cdf0e10cSrcweir // es muss aber im rSet vorhanden sein! 763cdf0e10cSrcweir 764cdf0e10cSrcweir // const SfxPoolItem* pX = GetOldItem( rCoreSet, SID_VIEW_FLD_PIC ); 765cdf0e10cSrcweir // if( pX && pX->ISA(SfxWallpaperItem)) 766cdf0e10cSrcweir if(SFX_ITEM_AVAILABLE <= rCoreSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), sal_False)) 767cdf0e10cSrcweir return FillItemSetWithWallpaperItem( rCoreSet, SID_VIEW_FLD_PIC ); 768cdf0e10cSrcweir 769cdf0e10cSrcweir sal_Bool bModified = sal_False; 770cdf0e10cSrcweir sal_uInt16 nSlot = SID_ATTR_BRUSH; 771cdf0e10cSrcweir 772cdf0e10cSrcweir if ( aTblLBox.IsVisible() ) 773cdf0e10cSrcweir { 774cdf0e10cSrcweir switch( aTblLBox.GetSelectEntryPos() ) 775cdf0e10cSrcweir { 776cdf0e10cSrcweir case TBL_DEST_CELL: 777cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH; 778cdf0e10cSrcweir break; 779cdf0e10cSrcweir case TBL_DEST_ROW: 780cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_ROW; 781cdf0e10cSrcweir break; 782cdf0e10cSrcweir case TBL_DEST_TBL: 783cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_TABLE; 784cdf0e10cSrcweir break; 785cdf0e10cSrcweir } 786cdf0e10cSrcweir } 787cdf0e10cSrcweir else if(aParaLBox.GetData() == &aParaLBox) 788cdf0e10cSrcweir { 789cdf0e10cSrcweir switch(aParaLBox.GetSelectEntryPos()) 790cdf0e10cSrcweir { 791cdf0e10cSrcweir case PARA_DEST_PARA: 792cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH; 793cdf0e10cSrcweir break; 794cdf0e10cSrcweir case PARA_DEST_CHAR: 795cdf0e10cSrcweir nSlot = SID_ATTR_BRUSH_CHAR; 796cdf0e10cSrcweir break; 797cdf0e10cSrcweir } 798cdf0e10cSrcweir } 799cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( nSlot ); 800cdf0e10cSrcweir 801cdf0e10cSrcweir const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot ); 802cdf0e10cSrcweir SfxItemState eOldItemState = rCoreSet.GetItemState(nSlot, sal_False); 803cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet(); 804cdf0e10cSrcweir 805cdf0e10cSrcweir sal_Bool bGraphTransparencyChanged = bGraphTransparency && (aGraphTransMF.GetText() != aGraphTransMF.GetSavedValue()); 806cdf0e10cSrcweir if ( pOld ) 807cdf0e10cSrcweir { 808cdf0e10cSrcweir const SvxBrushItem& rOldItem = (const SvxBrushItem&)*pOld; 809cdf0e10cSrcweir SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos(); 810cdf0e10cSrcweir const sal_Bool bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() ); 811cdf0e10cSrcweir 812cdf0e10cSrcweir // transparency has to be set if enabled, the color not already set to "No fill" and 813cdf0e10cSrcweir if( bColTransparency && 814cdf0e10cSrcweir aBgdColor.GetTransparency() < 0xff) 815cdf0e10cSrcweir { 816cdf0e10cSrcweir aBgdColor.SetTransparency(lcl_PercentToTransparency(static_cast<long>(aColTransMF.GetValue()))); 817cdf0e10cSrcweir } 818cdf0e10cSrcweir if ( ( (GPOS_NONE == eOldPos) && bIsBrush ) 819cdf0e10cSrcweir || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt? 820cdf0e10cSrcweir { 821cdf0e10cSrcweir // Hintergrund-Art wurde nicht gewechselt: 822cdf0e10cSrcweir 823cdf0e10cSrcweir if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() ) 824cdf0e10cSrcweir { 825cdf0e10cSrcweir // Brush-Behandlung: 826cdf0e10cSrcweir if ( rOldItem.GetColor() != aBgdColor || 827cdf0e10cSrcweir (SFX_ITEM_AVAILABLE >= eOldItemState && !aBackgroundColorSet.IsNoSelection())) 828cdf0e10cSrcweir { 829cdf0e10cSrcweir bModified = sal_True; 830cdf0e10cSrcweir rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); 831cdf0e10cSrcweir } 832cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 833cdf0e10cSrcweir rCoreSet.ClearItem( nWhich ); 834cdf0e10cSrcweir } 835cdf0e10cSrcweir else 836cdf0e10cSrcweir { 837cdf0e10cSrcweir // Bitmap-Behandlung: 838cdf0e10cSrcweir 839cdf0e10cSrcweir SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); 840cdf0e10cSrcweir const sal_Bool bIsLink = aBtnLink.IsChecked(); 841cdf0e10cSrcweir const sal_Bool bWasLink = (NULL != rOldItem.GetGraphicLink() ); 842cdf0e10cSrcweir 843cdf0e10cSrcweir 844cdf0e10cSrcweir if ( !bIsLink && !bIsGraphicValid ) 845cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 846cdf0e10cSrcweir 847cdf0e10cSrcweir if ( bGraphTransparencyChanged || 848cdf0e10cSrcweir eNewPos != eOldPos 849cdf0e10cSrcweir || bIsLink != bWasLink 850cdf0e10cSrcweir || ( bWasLink && *rOldItem.GetGraphicLink() 851cdf0e10cSrcweir != aBgdGraphicPath ) 852cdf0e10cSrcweir || ( !bWasLink && rOldItem.GetGraphic()->GetBitmap() 853cdf0e10cSrcweir != aBgdGraphic.GetBitmap() ) 854cdf0e10cSrcweir ) 855cdf0e10cSrcweir { 856cdf0e10cSrcweir bModified = sal_True; 857cdf0e10cSrcweir 858cdf0e10cSrcweir SvxBrushItem aTmpBrush(nWhich); 859cdf0e10cSrcweir if ( bIsLink ) 860cdf0e10cSrcweir { 861cdf0e10cSrcweir aTmpBrush = SvxBrushItem( aBgdGraphicPath, 862cdf0e10cSrcweir aBgdGraphicFilter, 863cdf0e10cSrcweir eNewPos, 864cdf0e10cSrcweir nWhich ); 865cdf0e10cSrcweir } 866cdf0e10cSrcweir else 867cdf0e10cSrcweir aTmpBrush = SvxBrushItem( aBgdGraphic, 868cdf0e10cSrcweir eNewPos, 869cdf0e10cSrcweir nWhich ); 870cdf0e10cSrcweir lcl_SetTransparency(aTmpBrush, static_cast<long>(aGraphTransMF.GetValue())); 871cdf0e10cSrcweir 872cdf0e10cSrcweir rCoreSet.Put(aTmpBrush); 873cdf0e10cSrcweir } 874cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 875cdf0e10cSrcweir rCoreSet.ClearItem( nWhich ); 876cdf0e10cSrcweir } 877cdf0e10cSrcweir } 878cdf0e10cSrcweir else // Brush <-> Bitmap gewechselt! 879cdf0e10cSrcweir { 880cdf0e10cSrcweir if ( bIsBrush ) 881cdf0e10cSrcweir rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); 882cdf0e10cSrcweir else 883cdf0e10cSrcweir { 884cdf0e10cSrcweir SvxBrushItem* pTmpBrush = 0; 885cdf0e10cSrcweir if ( aBtnLink.IsChecked() ) 886cdf0e10cSrcweir { 887cdf0e10cSrcweir pTmpBrush = new SvxBrushItem( aBgdGraphicPath, 888cdf0e10cSrcweir aBgdGraphicFilter, 889cdf0e10cSrcweir GetGraphicPosition_Impl(), 890cdf0e10cSrcweir nWhich ); 891cdf0e10cSrcweir } 892cdf0e10cSrcweir else 893cdf0e10cSrcweir { 894cdf0e10cSrcweir if ( !bIsGraphicValid ) 895cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 896cdf0e10cSrcweir 897cdf0e10cSrcweir if ( bIsGraphicValid ) 898cdf0e10cSrcweir pTmpBrush = new SvxBrushItem( aBgdGraphic, 899cdf0e10cSrcweir GetGraphicPosition_Impl(), 900cdf0e10cSrcweir nWhich ); 901cdf0e10cSrcweir } 902cdf0e10cSrcweir if(pTmpBrush) 903cdf0e10cSrcweir { 904cdf0e10cSrcweir lcl_SetTransparency(*pTmpBrush, static_cast<long>(aGraphTransMF.GetValue())); 905cdf0e10cSrcweir rCoreSet.Put(*pTmpBrush); 906cdf0e10cSrcweir delete pTmpBrush; 907cdf0e10cSrcweir } 908cdf0e10cSrcweir } 909cdf0e10cSrcweir bModified = ( bIsBrush || aBtnLink.IsChecked() || bIsGraphicValid ); 910cdf0e10cSrcweir } 911cdf0e10cSrcweir } 912cdf0e10cSrcweir else if ( SID_ATTR_BRUSH_CHAR == nSlot && aBgdColor != Color( COL_WHITE ) ) 913cdf0e10cSrcweir { 914cdf0e10cSrcweir rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); 915cdf0e10cSrcweir bModified = sal_True; 916cdf0e10cSrcweir } 917cdf0e10cSrcweir 918cdf0e10cSrcweir if( aTblLBox.IsVisible() ) 919cdf0e10cSrcweir { 920cdf0e10cSrcweir // Der aktuelle Zustand wurde bereits geputtet 921cdf0e10cSrcweir if( nSlot != SID_ATTR_BRUSH && pTableBck_Impl->pCellBrush) 922cdf0e10cSrcweir { 923cdf0e10cSrcweir const SfxPoolItem* pOldCell = 924cdf0e10cSrcweir GetOldItem( rCoreSet, SID_ATTR_BRUSH ); 925cdf0e10cSrcweir 926cdf0e10cSrcweir if ( *pTableBck_Impl->pCellBrush != *pOldCell ) 927cdf0e10cSrcweir { 928cdf0e10cSrcweir rCoreSet.Put( *pTableBck_Impl->pCellBrush ); 929cdf0e10cSrcweir bModified |= sal_True; 930cdf0e10cSrcweir } 931cdf0e10cSrcweir } 932cdf0e10cSrcweir 933cdf0e10cSrcweir if( nSlot != SID_ATTR_BRUSH_ROW && pTableBck_Impl->pRowBrush) 934cdf0e10cSrcweir { 935cdf0e10cSrcweir const SfxPoolItem* pOldRow = 936cdf0e10cSrcweir GetOldItem( rCoreSet, SID_ATTR_BRUSH_ROW ); 937cdf0e10cSrcweir 938cdf0e10cSrcweir if ( *pTableBck_Impl->pRowBrush != *pOldRow ) 939cdf0e10cSrcweir { 940cdf0e10cSrcweir rCoreSet.Put( *pTableBck_Impl->pRowBrush ); 941cdf0e10cSrcweir bModified |= sal_True; 942cdf0e10cSrcweir } 943cdf0e10cSrcweir } 944cdf0e10cSrcweir 945cdf0e10cSrcweir if( nSlot != SID_ATTR_BRUSH_TABLE && pTableBck_Impl->pTableBrush) 946cdf0e10cSrcweir { 947cdf0e10cSrcweir const SfxPoolItem* pOldTable = 948cdf0e10cSrcweir GetOldItem( rCoreSet, SID_ATTR_BRUSH_TABLE ); 949cdf0e10cSrcweir 950cdf0e10cSrcweir if ( *pTableBck_Impl->pTableBrush != *pOldTable ) 951cdf0e10cSrcweir { 952cdf0e10cSrcweir rCoreSet.Put( *pTableBck_Impl->pTableBrush ); 953cdf0e10cSrcweir bModified |= sal_True; 954cdf0e10cSrcweir } 955cdf0e10cSrcweir } 956cdf0e10cSrcweir 957cdf0e10cSrcweir if( aTblLBox.GetSavedValue() != aTblLBox.GetSelectEntryPos() ) 958cdf0e10cSrcweir { 959cdf0e10cSrcweir rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION, 960cdf0e10cSrcweir aTblLBox.GetSelectEntryPos() ) ); 961cdf0e10cSrcweir bModified |= sal_True; 962cdf0e10cSrcweir } 963cdf0e10cSrcweir } 964cdf0e10cSrcweir else if(aParaLBox.GetData() == &aParaLBox) 965cdf0e10cSrcweir { 966cdf0e10cSrcweir // Der aktuelle Zustand wurde bereits geputtet 967cdf0e10cSrcweir if( nSlot != SID_ATTR_BRUSH && aParaLBox.IsVisible()) // nicht im Suchen-Format-Dialog 968cdf0e10cSrcweir { 969cdf0e10cSrcweir const SfxPoolItem* pOldPara = 970cdf0e10cSrcweir GetOldItem( rCoreSet, SID_ATTR_BRUSH ); 971cdf0e10cSrcweir 972cdf0e10cSrcweir if ( *pParaBck_Impl->pParaBrush != *pOldPara ) 973cdf0e10cSrcweir { 974cdf0e10cSrcweir rCoreSet.Put( *pParaBck_Impl->pParaBrush ); 975cdf0e10cSrcweir bModified |= sal_True; 976cdf0e10cSrcweir } 977cdf0e10cSrcweir } 978cdf0e10cSrcweir 979cdf0e10cSrcweir if( nSlot != SID_ATTR_BRUSH_CHAR ) 980cdf0e10cSrcweir { 981cdf0e10cSrcweir const SfxPoolItem* pOldChar = 982cdf0e10cSrcweir GetOldItem( rCoreSet, SID_ATTR_BRUSH_CHAR ); 983cdf0e10cSrcweir DBG_ASSERT(pParaBck_Impl, "pParaBck_Impl == NULL ?"); 984cdf0e10cSrcweir if ( pOldChar && 985cdf0e10cSrcweir //#111173# crash report shows that pParaBck_Impl can be NULL, the cause is unknown 986cdf0e10cSrcweir pParaBck_Impl && 987cdf0e10cSrcweir (*pParaBck_Impl->pCharBrush != *pOldChar || 988cdf0e10cSrcweir *pParaBck_Impl->pCharBrush != SvxBrushItem(SID_ATTR_BRUSH_CHAR))) 989cdf0e10cSrcweir { 990cdf0e10cSrcweir rCoreSet.Put( *pParaBck_Impl->pCharBrush ); 991cdf0e10cSrcweir bModified |= sal_True; 992cdf0e10cSrcweir } 993cdf0e10cSrcweir } 994cdf0e10cSrcweir 995cdf0e10cSrcweir if( aParaLBox.GetSavedValue() != aParaLBox.GetSelectEntryPos() ) 996cdf0e10cSrcweir { 997cdf0e10cSrcweir rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION, 998cdf0e10cSrcweir aParaLBox.GetSelectEntryPos() ) ); 999cdf0e10cSrcweir bModified |= sal_True; 1000cdf0e10cSrcweir } 1001cdf0e10cSrcweir } 1002cdf0e10cSrcweir return bModified; 1003cdf0e10cSrcweir } 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir sal_Bool SvxBackgroundTabPage::FillItemSetWithWallpaperItem( SfxItemSet& rCoreSet, sal_uInt16 nSlot) 1006cdf0e10cSrcweir { 1007cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( nSlot ); 1008cdf0e10cSrcweir const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot ); 1009cdf0e10cSrcweir const SfxItemSet& rOldSet = GetItemSet(); 1010cdf0e10cSrcweir DBG_ASSERT(pOld,"FillItemSetWithWallpaperItem: Item not found"); 1011cdf0e10cSrcweir 1012cdf0e10cSrcweir SvxBrushItem rOldItem( (const CntWallpaperItem&)*pOld, nWhich ); 1013cdf0e10cSrcweir SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos(); 1014cdf0e10cSrcweir const sal_Bool bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() ); 1015cdf0e10cSrcweir sal_Bool bModified = sal_False; 1016cdf0e10cSrcweir 1017cdf0e10cSrcweir if ( ( (GPOS_NONE == eOldPos) && bIsBrush ) 1018cdf0e10cSrcweir || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt? 1019cdf0e10cSrcweir { 1020cdf0e10cSrcweir // Hintergrund-Art wurde nicht gewechselt: 1021cdf0e10cSrcweir 1022cdf0e10cSrcweir if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() ) 1023cdf0e10cSrcweir { 1024cdf0e10cSrcweir // Brush-Behandlung: 1025cdf0e10cSrcweir if ( rOldItem.GetColor() != aBgdColor ) 1026cdf0e10cSrcweir { 1027cdf0e10cSrcweir bModified = sal_True; 1028cdf0e10cSrcweir CntWallpaperItem aItem( nWhich ); 1029cdf0e10cSrcweir aItem.SetColor( aBgdColor ); 1030cdf0e10cSrcweir rCoreSet.Put( aItem ); 1031cdf0e10cSrcweir } 1032cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 1033cdf0e10cSrcweir rCoreSet.ClearItem( nWhich ); 1034cdf0e10cSrcweir } 1035cdf0e10cSrcweir else 1036cdf0e10cSrcweir { 1037cdf0e10cSrcweir // Bitmap-Behandlung: 1038cdf0e10cSrcweir SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir int bBitmapChanged = ( ( eNewPos != eOldPos ) || 1041cdf0e10cSrcweir ( *rOldItem.GetGraphicLink() != aBgdGraphicPath ) ); 1042cdf0e10cSrcweir int bBrushChanged = ( rOldItem.GetColor() != aBgdColor ); 1043cdf0e10cSrcweir if( bBitmapChanged || bBrushChanged ) 1044cdf0e10cSrcweir { 1045cdf0e10cSrcweir bModified = sal_True; 1046cdf0e10cSrcweir 1047cdf0e10cSrcweir CntWallpaperItem aItem( nWhich ); 1048cdf0e10cSrcweir WallpaperStyle eWallStyle = SvxBrushItem::GraphicPos2WallpaperStyle(eNewPos); 1049cdf0e10cSrcweir aItem.SetStyle( sal::static_int_cast< sal_uInt16 >( eWallStyle ) ); 1050cdf0e10cSrcweir aItem.SetColor( aBgdColor ); 1051cdf0e10cSrcweir aItem.SetBitmapURL( aBgdGraphicPath ); 1052cdf0e10cSrcweir rCoreSet.Put( aItem ); 1053cdf0e10cSrcweir } 1054cdf0e10cSrcweir else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) 1055cdf0e10cSrcweir rCoreSet.ClearItem( nWhich ); 1056cdf0e10cSrcweir } 1057cdf0e10cSrcweir } 1058cdf0e10cSrcweir else // Brush <-> Bitmap gewechselt! 1059cdf0e10cSrcweir { 1060cdf0e10cSrcweir CntWallpaperItem aItem( nWhich ); 1061cdf0e10cSrcweir if ( bIsBrush ) 1062cdf0e10cSrcweir { 1063cdf0e10cSrcweir aItem.SetColor( aBgdColor ); 1064cdf0e10cSrcweir rCoreSet.Put( aItem ); 1065cdf0e10cSrcweir } 1066cdf0e10cSrcweir else 1067cdf0e10cSrcweir { 1068cdf0e10cSrcweir WallpaperStyle eWallStyle = 1069cdf0e10cSrcweir SvxBrushItem::GraphicPos2WallpaperStyle( GetGraphicPosition_Impl() ); 1070cdf0e10cSrcweir aItem.SetStyle( sal::static_int_cast< sal_uInt16 >( eWallStyle ) ); 1071cdf0e10cSrcweir aItem.SetColor( aBgdColor ); 1072cdf0e10cSrcweir aItem.SetBitmapURL( aBgdGraphicPath ); 1073cdf0e10cSrcweir rCoreSet.Put( aItem ); 1074cdf0e10cSrcweir } 1075cdf0e10cSrcweir 1076cdf0e10cSrcweir bModified = sal_True; 1077cdf0e10cSrcweir } 1078cdf0e10cSrcweir return bModified; 1079cdf0e10cSrcweir } 1080cdf0e10cSrcweir 1081cdf0e10cSrcweir //----------------------------------------------------------------------- 1082cdf0e10cSrcweir 1083cdf0e10cSrcweir int SvxBackgroundTabPage::DeactivatePage( SfxItemSet* _pSet ) 1084cdf0e10cSrcweir 1085cdf0e10cSrcweir /* [Beschreibung] 1086cdf0e10cSrcweir 1087cdf0e10cSrcweir virtuelle Methode, wird beim Deaktivieren gerufen 1088cdf0e10cSrcweir */ 1089cdf0e10cSrcweir 1090cdf0e10cSrcweir { 1091cdf0e10cSrcweir if ( pPageImpl->bIsImportDlgInExecute ) 1092cdf0e10cSrcweir return KEEP_PAGE; 1093cdf0e10cSrcweir 1094cdf0e10cSrcweir if ( _pSet ) 1095cdf0e10cSrcweir FillItemSet( *_pSet ); 1096cdf0e10cSrcweir 1097cdf0e10cSrcweir return LEAVE_PAGE; 1098cdf0e10cSrcweir } 1099cdf0e10cSrcweir 1100cdf0e10cSrcweir //----------------------------------------------------------------------- 1101cdf0e10cSrcweir 1102cdf0e10cSrcweir void SvxBackgroundTabPage::PointChanged( Window* , RECT_POINT ) 1103cdf0e10cSrcweir 1104cdf0e10cSrcweir /* [Beschreibung] 1105cdf0e10cSrcweir 1106cdf0e10cSrcweir */ 1107cdf0e10cSrcweir 1108cdf0e10cSrcweir { 1109cdf0e10cSrcweir // muss implementiert werden, damit Position-Control funktioniert 1110cdf0e10cSrcweir } 1111cdf0e10cSrcweir 1112cdf0e10cSrcweir //----------------------------------------------------------------------- 1113cdf0e10cSrcweir 1114cdf0e10cSrcweir void SvxBackgroundTabPage::ShowSelector() 1115cdf0e10cSrcweir 1116cdf0e10cSrcweir /* [Beschreibung] 1117cdf0e10cSrcweir 1118cdf0e10cSrcweir */ 1119cdf0e10cSrcweir 1120cdf0e10cSrcweir { 1121cdf0e10cSrcweir if( bAllowShowSelector) 1122cdf0e10cSrcweir { 1123cdf0e10cSrcweir aSelectTxt.Show(); 1124cdf0e10cSrcweir aLbSelect.Show(); 1125cdf0e10cSrcweir aLbSelect.SetSelectHdl( HDL(SelectHdl_Impl) ); 1126cdf0e10cSrcweir aBtnLink.SetClickHdl( HDL(FileClickHdl_Impl) ); 1127cdf0e10cSrcweir aBtnPreview.SetClickHdl( HDL(FileClickHdl_Impl) ); 1128cdf0e10cSrcweir aBtnBrowse.SetClickHdl( HDL(BrowseHdl_Impl) ); 1129cdf0e10cSrcweir aBtnArea.SetClickHdl( HDL(RadioClickHdl_Impl) ); 1130cdf0e10cSrcweir aBtnTile.SetClickHdl( HDL(RadioClickHdl_Impl) ); 1131cdf0e10cSrcweir aBtnPosition.SetClickHdl( HDL(RadioClickHdl_Impl) ); 1132cdf0e10cSrcweir 1133cdf0e10cSrcweir // Verz"ogertes Laden "uber Timer (wg. UI-Update) 1134cdf0e10cSrcweir pPageImpl->pLoadTimer = new Timer; 1135cdf0e10cSrcweir pPageImpl->pLoadTimer->SetTimeout( 500 ); // 500ms verz"ogern 1136cdf0e10cSrcweir pPageImpl->pLoadTimer->SetTimeoutHdl( 1137cdf0e10cSrcweir LINK( this, SvxBackgroundTabPage, LoadTimerHdl_Impl ) ); 1138cdf0e10cSrcweir 1139cdf0e10cSrcweir bAllowShowSelector = sal_False; 1140cdf0e10cSrcweir 1141cdf0e10cSrcweir if(nHtmlMode & HTMLMODE_ON) 1142cdf0e10cSrcweir { 1143cdf0e10cSrcweir if(!(nHtmlMode & HTMLMODE_GRAPH_POS)) 1144cdf0e10cSrcweir aBtnPosition.Enable(sal_False); 1145cdf0e10cSrcweir aBtnArea.Enable(sal_False); 1146cdf0e10cSrcweir } 1147cdf0e10cSrcweir } 1148cdf0e10cSrcweir } 1149cdf0e10cSrcweir 1150cdf0e10cSrcweir //------------------------------------------------------------------------ 1151cdf0e10cSrcweir 1152cdf0e10cSrcweir 1153cdf0e10cSrcweir void SvxBackgroundTabPage::RaiseLoadError_Impl() 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir /* [Beschreibung] 1156cdf0e10cSrcweir 1157cdf0e10cSrcweir */ 1158cdf0e10cSrcweir 1159cdf0e10cSrcweir { 1160cdf0e10cSrcweir SfxErrorContext aContext( ERRCTX_SVX_BACKGROUND, 1161cdf0e10cSrcweir String(), 1162cdf0e10cSrcweir this, 1163cdf0e10cSrcweir RID_SVXERRCTX, 1164cdf0e10cSrcweir &CUI_MGR() ); 1165cdf0e10cSrcweir 1166cdf0e10cSrcweir ErrorHandler::HandleError( 1167cdf0e10cSrcweir *new StringErrorInfo( ERRCODE_SVX_GRAPHIC_NOTREADABLE, 1168cdf0e10cSrcweir aBgdGraphicPath ) ); 1169cdf0e10cSrcweir } 1170cdf0e10cSrcweir 1171cdf0e10cSrcweir //------------------------------------------------------------------------ 1172cdf0e10cSrcweir 1173cdf0e10cSrcweir sal_Bool SvxBackgroundTabPage::LoadLinkedGraphic_Impl() 1174cdf0e10cSrcweir 1175cdf0e10cSrcweir /* [Beschreibung] 1176cdf0e10cSrcweir 1177cdf0e10cSrcweir */ 1178cdf0e10cSrcweir 1179cdf0e10cSrcweir { 1180cdf0e10cSrcweir sal_Bool bResult = ( aBgdGraphicPath.Len() > 0 ) && 1181cdf0e10cSrcweir ( GRFILTER_OK == GraphicFilter::LoadGraphic( aBgdGraphicPath, 1182cdf0e10cSrcweir aBgdGraphicFilter, 1183cdf0e10cSrcweir aBgdGraphic ) ); 1184cdf0e10cSrcweir return bResult; 1185cdf0e10cSrcweir } 1186cdf0e10cSrcweir 1187cdf0e10cSrcweir //------------------------------------------------------------------------ 1188cdf0e10cSrcweir 1189cdf0e10cSrcweir 1190cdf0e10cSrcweir void SvxBackgroundTabPage::FillColorValueSets_Impl() 1191cdf0e10cSrcweir 1192cdf0e10cSrcweir /* [Beschreibung] 1193cdf0e10cSrcweir 1194cdf0e10cSrcweir F"ullen des Farb-Sets 1195cdf0e10cSrcweir */ 1196cdf0e10cSrcweir 1197cdf0e10cSrcweir { 1198cdf0e10cSrcweir SfxObjectShell* pDocSh = SfxObjectShell::Current(); 1199cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 120097e8a929SArmin Le Grand XColorList* pColorTable = NULL; 1201*28bcfa49SArmin Le Grand bool bOwn(false); 1202*28bcfa49SArmin Le Grand long nColorCount(0); 1203cdf0e10cSrcweir 1204cdf0e10cSrcweir if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) ) 1205*28bcfa49SArmin Le Grand { 1206cdf0e10cSrcweir pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); 1207*28bcfa49SArmin Le Grand } 1208cdf0e10cSrcweir 1209cdf0e10cSrcweir if ( !pColorTable ) 1210cdf0e10cSrcweir { 1211*28bcfa49SArmin Le Grand bOwn = true; 121297e8a929SArmin Le Grand pColorTable = new XColorList( SvtPathOptions().GetPalettePath() ); 1213cdf0e10cSrcweir } 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir if ( pColorTable ) 1216cdf0e10cSrcweir { 1217*28bcfa49SArmin Le Grand nColorCount = pColorTable->Count(); 1218*28bcfa49SArmin Le Grand aBackgroundColorSet.Clear(); 1219*28bcfa49SArmin Le Grand aBackgroundColorSet.addEntriesForXColorList(*pColorTable); 1220cdf0e10cSrcweir 1221*28bcfa49SArmin Le Grand if(bOwn) 1222*28bcfa49SArmin Le Grand { 1223*28bcfa49SArmin Le Grand delete pColorTable; 1224*28bcfa49SArmin Le Grand } 1225*28bcfa49SArmin Le Grand } 1226cdf0e10cSrcweir 1227*28bcfa49SArmin Le Grand const WinBits nBits(aBackgroundColorSet.GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD); 1228*28bcfa49SArmin Le Grand aBackgroundColorSet.SetStyle(nBits); 1229*28bcfa49SArmin Le Grand aBackgroundColorSet.SetColCount(aBackgroundColorSet.getColumnCount()); 1230*28bcfa49SArmin Le Grand 1231*28bcfa49SArmin Le Grand // here we have enough space to the left, so layout with fixed column size 1232*28bcfa49SArmin Le Grand // and fixed height, adapt width. Apply the adapted width by moving the left 1233*28bcfa49SArmin Le Grand // edge of the control to the left, keeping the right edge aligned 1234*28bcfa49SArmin Le Grand // with the original position 1235*28bcfa49SArmin Le Grand const Point aCurrentPosContainer(aBorderWin.GetPosPixel()); 1236*28bcfa49SArmin Le Grand const Size aCurrentSizeContainer(aBorderWin.GetOutputSizePixel()); 1237*28bcfa49SArmin Le Grand const Size aCurrentSizeContent(aBackgroundColorSet.GetOutputSizePixel()); 1238*28bcfa49SArmin Le Grand const Size aNewSizeContent(aBackgroundColorSet.layoutToGivenHeight(aCurrentSizeContent.Height() - 4, nColorCount)); 1239*28bcfa49SArmin Le Grand const Size aNewSizeContainer(aNewSizeContent.Width() + 4, aNewSizeContent.Height() + 4); 1240*28bcfa49SArmin Le Grand const Point aNewPos((aCurrentPosContainer.X() + aCurrentSizeContainer.Width()) - aNewSizeContainer.Width(), aCurrentPosContainer.Y()); 1241*28bcfa49SArmin Le Grand 1242*28bcfa49SArmin Le Grand aBorderWin.SetOutputSizePixel(aNewSizeContainer); 1243*28bcfa49SArmin Le Grand aBackgroundColorSet.SetOutputSizePixel(aNewSizeContent); 1244*28bcfa49SArmin Le Grand aBorderWin.SetPosSizePixel(aNewPos, aNewSizeContainer); 1245cdf0e10cSrcweir } 1246cdf0e10cSrcweir 1247cdf0e10cSrcweir //------------------------------------------------------------------------ 1248cdf0e10cSrcweir 1249cdf0e10cSrcweir 1250cdf0e10cSrcweir 1251cdf0e10cSrcweir //------------------------------------------------------------------------ 1252cdf0e10cSrcweir 1253cdf0e10cSrcweir void SvxBackgroundTabPage::ShowColorUI_Impl() 1254cdf0e10cSrcweir 1255cdf0e10cSrcweir /* [Beschreibung] 1256cdf0e10cSrcweir 1257cdf0e10cSrcweir Die Controls f"ur das Einstellen der Grafik ausblenden und die 1258cdf0e10cSrcweir Controls f"ur die Farbeinstellung einblenden. 1259cdf0e10cSrcweir */ 1260cdf0e10cSrcweir 1261cdf0e10cSrcweir { 1262cdf0e10cSrcweir if( !aBackgroundColorSet.IsVisible() ) 1263cdf0e10cSrcweir { 1264cdf0e10cSrcweir aBackgroundColorSet.Show(); 1265cdf0e10cSrcweir aBackgroundColorBox.Show(); 1266cdf0e10cSrcweir aBorderWin.Show(); 1267cdf0e10cSrcweir pPreviewWin1->Show(); 1268cdf0e10cSrcweir aBtnBrowse.Hide(); 1269cdf0e10cSrcweir aFtFile.Hide(); 1270cdf0e10cSrcweir aBtnLink.Hide(); 1271cdf0e10cSrcweir aBtnPreview.Hide(); 1272cdf0e10cSrcweir aGbFile.Hide(); 1273cdf0e10cSrcweir aBtnPosition.Hide(); 1274cdf0e10cSrcweir aBtnArea.Hide(); 1275cdf0e10cSrcweir aBtnTile.Hide(); 1276cdf0e10cSrcweir aWndPosition.Hide(); 1277cdf0e10cSrcweir aGbPosition.Hide(); 1278cdf0e10cSrcweir pPreviewWin2->Hide(); 1279cdf0e10cSrcweir aGraphTransFL.Show(sal_False); 1280cdf0e10cSrcweir aGraphTransMF.Show(sal_False); 1281cdf0e10cSrcweir if(bColTransparency) 1282cdf0e10cSrcweir { 1283cdf0e10cSrcweir aColTransFT.Show(); 1284cdf0e10cSrcweir aColTransMF.Show(); 1285cdf0e10cSrcweir } 1286cdf0e10cSrcweir } 1287cdf0e10cSrcweir } 1288cdf0e10cSrcweir 1289cdf0e10cSrcweir //------------------------------------------------------------------------ 1290cdf0e10cSrcweir 1291cdf0e10cSrcweir void SvxBackgroundTabPage::ShowBitmapUI_Impl() 1292cdf0e10cSrcweir 1293cdf0e10cSrcweir /* [Beschreibung] 1294cdf0e10cSrcweir 1295cdf0e10cSrcweir Die Controls f"ur die Farbeinstellung ausblenden und die 1296cdf0e10cSrcweir Controls f"ur das Einstellen der Grafik einblenden. 1297cdf0e10cSrcweir */ 1298cdf0e10cSrcweir 1299cdf0e10cSrcweir { 1300cdf0e10cSrcweir if ( aLbSelect.IsVisible() && 1301cdf0e10cSrcweir ( 1302cdf0e10cSrcweir aBackgroundColorSet.IsVisible() 1303cdf0e10cSrcweir || !aBtnBrowse.IsVisible() ) ) 1304cdf0e10cSrcweir { 1305cdf0e10cSrcweir aBackgroundColorSet.Hide(); 1306cdf0e10cSrcweir aBackgroundColorBox.Hide(); 1307cdf0e10cSrcweir aBorderWin.Hide(); 1308cdf0e10cSrcweir pPreviewWin1->Hide(); 1309cdf0e10cSrcweir aBtnBrowse.Show(); 1310cdf0e10cSrcweir aFtFile.Show(); 1311cdf0e10cSrcweir 1312cdf0e10cSrcweir if ( !bLinkOnly && ! nHtmlMode & HTMLMODE_ON ) 1313cdf0e10cSrcweir aBtnLink.Show(); 1314cdf0e10cSrcweir aBtnPreview.Show(); 1315cdf0e10cSrcweir aGbFile.Show(); 1316cdf0e10cSrcweir aBtnPosition.Show(); 1317cdf0e10cSrcweir aBtnArea.Show(); 1318cdf0e10cSrcweir aBtnTile.Show(); 1319cdf0e10cSrcweir aWndPosition.Show(); 1320cdf0e10cSrcweir aGbPosition.Show(); 1321cdf0e10cSrcweir pPreviewWin2->Show(); 1322cdf0e10cSrcweir if(bGraphTransparency) 1323cdf0e10cSrcweir { 1324cdf0e10cSrcweir aGraphTransFL.Show(); 1325cdf0e10cSrcweir aGraphTransMF.Show(); 1326cdf0e10cSrcweir } 1327cdf0e10cSrcweir aColTransFT.Show(sal_False); 1328cdf0e10cSrcweir aColTransMF.Show(sal_False); 1329cdf0e10cSrcweir } 1330cdf0e10cSrcweir } 1331cdf0e10cSrcweir 1332cdf0e10cSrcweir //------------------------------------------------------------------------ 1333cdf0e10cSrcweir 1334cdf0e10cSrcweir void SvxBackgroundTabPage::SetGraphicPosition_Impl( SvxGraphicPosition ePos ) 1335cdf0e10cSrcweir 1336cdf0e10cSrcweir /* [Beschreibung] 1337cdf0e10cSrcweir 1338cdf0e10cSrcweir Die Controls f"ur die Grafikposition einstellen. 1339cdf0e10cSrcweir */ 1340cdf0e10cSrcweir 1341cdf0e10cSrcweir { 1342cdf0e10cSrcweir switch ( ePos ) 1343cdf0e10cSrcweir { 1344cdf0e10cSrcweir case GPOS_AREA: 1345cdf0e10cSrcweir { 1346cdf0e10cSrcweir aBtnArea.Check(); 1347cdf0e10cSrcweir aWndPosition.Disable(); 1348cdf0e10cSrcweir } 1349cdf0e10cSrcweir break; 1350cdf0e10cSrcweir 1351cdf0e10cSrcweir case GPOS_TILED: 1352cdf0e10cSrcweir { 1353cdf0e10cSrcweir aBtnTile.Check(); 1354cdf0e10cSrcweir aWndPosition.Disable(); 1355cdf0e10cSrcweir } 1356cdf0e10cSrcweir break; 1357cdf0e10cSrcweir 1358cdf0e10cSrcweir default: 1359cdf0e10cSrcweir { 1360cdf0e10cSrcweir aBtnPosition.Check(); 1361cdf0e10cSrcweir aWndPosition.Enable(); 1362cdf0e10cSrcweir RECT_POINT eNewPos = RP_MM; 1363cdf0e10cSrcweir 1364cdf0e10cSrcweir switch ( ePos ) 1365cdf0e10cSrcweir { 1366cdf0e10cSrcweir case GPOS_MM: break; 1367cdf0e10cSrcweir case GPOS_LT: eNewPos = RP_LT; break; 1368cdf0e10cSrcweir case GPOS_MT: eNewPos = RP_MT; break; 1369cdf0e10cSrcweir case GPOS_RT: eNewPos = RP_RT; break; 1370cdf0e10cSrcweir case GPOS_LM: eNewPos = RP_LM; break; 1371cdf0e10cSrcweir case GPOS_RM: eNewPos = RP_RM; break; 1372cdf0e10cSrcweir case GPOS_LB: eNewPos = RP_LB; break; 1373cdf0e10cSrcweir case GPOS_MB: eNewPos = RP_MB; break; 1374cdf0e10cSrcweir case GPOS_RB: eNewPos = RP_RB; break; 1375cdf0e10cSrcweir default: ;//prevent warning 1376cdf0e10cSrcweir } 1377cdf0e10cSrcweir aWndPosition.SetActualRP( eNewPos ); 1378cdf0e10cSrcweir } 1379cdf0e10cSrcweir break; 1380cdf0e10cSrcweir } 1381cdf0e10cSrcweir aWndPosition.Invalidate(); 1382cdf0e10cSrcweir } 1383cdf0e10cSrcweir 1384cdf0e10cSrcweir //------------------------------------------------------------------------ 1385cdf0e10cSrcweir 1386cdf0e10cSrcweir SvxGraphicPosition SvxBackgroundTabPage::GetGraphicPosition_Impl() 1387cdf0e10cSrcweir 1388cdf0e10cSrcweir /* [Beschreibung] 1389cdf0e10cSrcweir 1390cdf0e10cSrcweir Die Position der Grafik zur"uckgeben. 1391cdf0e10cSrcweir */ 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir { 1394cdf0e10cSrcweir if ( aBtnTile.IsChecked() ) 1395cdf0e10cSrcweir return GPOS_TILED; 1396cdf0e10cSrcweir else if ( aBtnArea.IsChecked() ) 1397cdf0e10cSrcweir return GPOS_AREA; 1398cdf0e10cSrcweir else 1399cdf0e10cSrcweir { 1400cdf0e10cSrcweir switch ( aWndPosition.GetActualRP() ) 1401cdf0e10cSrcweir { 1402cdf0e10cSrcweir case RP_LT: return GPOS_LT; 1403cdf0e10cSrcweir case RP_MT: return GPOS_MT; 1404cdf0e10cSrcweir case RP_RT: return GPOS_RT; 1405cdf0e10cSrcweir case RP_LM: return GPOS_LM; 1406cdf0e10cSrcweir case RP_MM: return GPOS_MM; 1407cdf0e10cSrcweir case RP_RM: return GPOS_RM; 1408cdf0e10cSrcweir case RP_LB: return GPOS_LB; 1409cdf0e10cSrcweir case RP_MB: return GPOS_MB; 1410cdf0e10cSrcweir case RP_RB: return GPOS_RB; 1411cdf0e10cSrcweir } 1412cdf0e10cSrcweir } 1413cdf0e10cSrcweir return GPOS_MM; 1414cdf0e10cSrcweir } 1415cdf0e10cSrcweir 1416cdf0e10cSrcweir //----------------------------------------------------------------------- 1417cdf0e10cSrcweir // Handler 1418cdf0e10cSrcweir //----------------------------------------------------------------------- 1419cdf0e10cSrcweir 1420cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, BackgroundColorHdl_Impl, ValueSet*, EMPTYARG ) 1421cdf0e10cSrcweir /* 1422cdf0e10cSrcweir Handler, called when color selection is changed 1423cdf0e10cSrcweir */ 1424cdf0e10cSrcweir { 1425cdf0e10cSrcweir sal_uInt16 nItemId = aBackgroundColorSet.GetSelectItemId(); 1426cdf0e10cSrcweir Color aColor = nItemId ? ( aBackgroundColorSet.GetItemColor( nItemId ) ) : Color( COL_TRANSPARENT ); 1427cdf0e10cSrcweir aBgdColor = aColor; 1428cdf0e10cSrcweir pPreviewWin1->NotifyChange( aBgdColor ); 1429cdf0e10cSrcweir sal_Bool bEnableTransp = aBgdColor.GetTransparency() < 0xff; 1430cdf0e10cSrcweir aColTransFT.Enable(bEnableTransp); 1431cdf0e10cSrcweir aColTransMF.Enable(bEnableTransp); 1432cdf0e10cSrcweir return 0; 1433cdf0e10cSrcweir } 1434cdf0e10cSrcweir 1435cdf0e10cSrcweir //------------------------------------------------------------------------ 1436cdf0e10cSrcweir 1437cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, SelectHdl_Impl, ListBox*, EMPTYARG ) 1438cdf0e10cSrcweir 1439cdf0e10cSrcweir /* [Beschreibung] 1440cdf0e10cSrcweir 1441cdf0e10cSrcweir */ 1442cdf0e10cSrcweir 1443cdf0e10cSrcweir { 1444cdf0e10cSrcweir if ( 0 == aLbSelect.GetSelectEntryPos() ) 1445cdf0e10cSrcweir { 1446cdf0e10cSrcweir ShowColorUI_Impl(); 1447cdf0e10cSrcweir aParaLBox.Enable(); // Zeichenhintergrund kann keine Bitmap sein 1448cdf0e10cSrcweir } 1449cdf0e10cSrcweir else 1450cdf0e10cSrcweir { 1451cdf0e10cSrcweir ShowBitmapUI_Impl(); 1452cdf0e10cSrcweir aParaLBox.Enable(sal_False);// Zeichenhintergrund kann keine Bitmap sein 1453cdf0e10cSrcweir } 1454cdf0e10cSrcweir return 0; 1455cdf0e10cSrcweir } 1456cdf0e10cSrcweir 1457cdf0e10cSrcweir //------------------------------------------------------------------------ 1458cdf0e10cSrcweir 1459cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, FileClickHdl_Impl, CheckBox*, pBox ) 1460cdf0e10cSrcweir 1461cdf0e10cSrcweir /* [Beschreibung] 1462cdf0e10cSrcweir 1463cdf0e10cSrcweir */ 1464cdf0e10cSrcweir 1465cdf0e10cSrcweir { 1466cdf0e10cSrcweir if ( &aBtnLink == pBox ) 1467cdf0e10cSrcweir { 1468cdf0e10cSrcweir if ( aBtnLink.IsChecked() ) 1469cdf0e10cSrcweir { 1470cdf0e10cSrcweir INetURLObject aObj( aBgdGraphicPath ); 1471cdf0e10cSrcweir String aFilePath; 1472cdf0e10cSrcweir if ( aObj.GetProtocol() == INET_PROT_FILE ) 1473cdf0e10cSrcweir aFilePath = aObj.getFSysPath( INetURLObject::FSYS_DETECT ); 1474cdf0e10cSrcweir else 1475cdf0e10cSrcweir aFilePath = aBgdGraphicPath; 1476cdf0e10cSrcweir aFtFile.SetText( aFilePath ); 1477cdf0e10cSrcweir } 1478cdf0e10cSrcweir else 1479cdf0e10cSrcweir aFtFile.SetText( aStrUnlinked ); 1480cdf0e10cSrcweir } 1481cdf0e10cSrcweir else if ( &aBtnPreview == pBox ) 1482cdf0e10cSrcweir { 1483cdf0e10cSrcweir if ( aBtnPreview.IsChecked() ) 1484cdf0e10cSrcweir { 1485cdf0e10cSrcweir if ( !bIsGraphicValid ) 1486cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 1487cdf0e10cSrcweir 1488cdf0e10cSrcweir if ( bIsGraphicValid ) 1489cdf0e10cSrcweir { 1490cdf0e10cSrcweir Bitmap aBmp = aBgdGraphic.GetBitmap(); 1491cdf0e10cSrcweir pPreviewWin2->NotifyChange( &aBmp ); 1492cdf0e10cSrcweir } 1493cdf0e10cSrcweir else 1494cdf0e10cSrcweir { 1495cdf0e10cSrcweir if ( aBgdGraphicPath.Len() > 0 ) // nur bei gelinkter Grafik 1496cdf0e10cSrcweir RaiseLoadError_Impl(); // ein Fehler 1497cdf0e10cSrcweir pPreviewWin2->NotifyChange( NULL ); 1498cdf0e10cSrcweir } 1499cdf0e10cSrcweir } 1500cdf0e10cSrcweir else 1501cdf0e10cSrcweir pPreviewWin2->NotifyChange( NULL ); 1502cdf0e10cSrcweir } 1503cdf0e10cSrcweir return 0; 1504cdf0e10cSrcweir } 1505cdf0e10cSrcweir 1506cdf0e10cSrcweir //------------------------------------------------------------------------ 1507cdf0e10cSrcweir 1508cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, RadioClickHdl_Impl, RadioButton*, pBtn ) 1509cdf0e10cSrcweir 1510cdf0e10cSrcweir /* [Beschreibung] 1511cdf0e10cSrcweir 1512cdf0e10cSrcweir */ 1513cdf0e10cSrcweir 1514cdf0e10cSrcweir { 1515cdf0e10cSrcweir if ( pBtn == &aBtnPosition ) 1516cdf0e10cSrcweir { 1517cdf0e10cSrcweir if ( !aWndPosition.IsEnabled() ) 1518cdf0e10cSrcweir { 1519cdf0e10cSrcweir aWndPosition.Enable(); 1520cdf0e10cSrcweir aWndPosition.Invalidate(); 1521cdf0e10cSrcweir } 1522cdf0e10cSrcweir } 1523cdf0e10cSrcweir else if ( aWndPosition.IsEnabled() ) 1524cdf0e10cSrcweir { 1525cdf0e10cSrcweir aWndPosition.Disable(); 1526cdf0e10cSrcweir aWndPosition.Invalidate(); 1527cdf0e10cSrcweir } 1528cdf0e10cSrcweir return 0; 1529cdf0e10cSrcweir } 1530cdf0e10cSrcweir 1531cdf0e10cSrcweir //------------------------------------------------------------------------ 1532cdf0e10cSrcweir 1533cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, BrowseHdl_Impl, PushButton* , EMPTYARG ) 1534cdf0e10cSrcweir 1535cdf0e10cSrcweir /* [Beschreibung] 1536cdf0e10cSrcweir 1537cdf0e10cSrcweir Handler, gerufen durch das Dr"ucken des Durchsuchen-Buttons. 1538cdf0e10cSrcweir Grafik/Einf"ugen-Dialog erzeugen, Pfad setzen und starten. 1539cdf0e10cSrcweir */ 1540cdf0e10cSrcweir 1541cdf0e10cSrcweir { 1542cdf0e10cSrcweir if ( pPageImpl->pLoadTimer->IsActive() ) 1543cdf0e10cSrcweir return 0; 1544cdf0e10cSrcweir sal_Bool bHtml = 0 != ( nHtmlMode & HTMLMODE_ON ); 1545cdf0e10cSrcweir 1546cdf0e10cSrcweir pImportDlg = new SvxOpenGraphicDialog( aStrBrowse ); 1547cdf0e10cSrcweir if ( bHtml || bLinkOnly ) 1548cdf0e10cSrcweir pImportDlg->EnableLink(sal_False); 1549cdf0e10cSrcweir pImportDlg->SetPath( aBgdGraphicPath, aBtnLink.IsChecked() ); 1550cdf0e10cSrcweir 1551cdf0e10cSrcweir pPageImpl->bIsImportDlgInExecute = sal_True; 1552cdf0e10cSrcweir short nErr = pImportDlg->Execute(); 1553cdf0e10cSrcweir pPageImpl->bIsImportDlgInExecute = sal_False; 1554cdf0e10cSrcweir 1555cdf0e10cSrcweir if( !nErr ) 1556cdf0e10cSrcweir { 1557cdf0e10cSrcweir if ( bHtml ) 1558cdf0e10cSrcweir aBtnLink.Check(); 1559cdf0e10cSrcweir // wenn Verkn"upfen nicht gecheckt ist und die Vorschau auch nicht, 1560cdf0e10cSrcweir // dann die Vorschau aktivieren, damit der Anwender sieht, 1561cdf0e10cSrcweir // welche Grafik er ausgew"ahlt hat 1562cdf0e10cSrcweir if ( !aBtnLink.IsChecked() && !aBtnPreview.IsChecked() ) 1563cdf0e10cSrcweir aBtnPreview.Check( sal_True ); 1564cdf0e10cSrcweir // timer-verz"ogertes Laden der Grafik 1565cdf0e10cSrcweir pPageImpl->pLoadTimer->Start(); 1566cdf0e10cSrcweir } 1567cdf0e10cSrcweir else 1568cdf0e10cSrcweir DELETEZ( pImportDlg ); 1569cdf0e10cSrcweir return 0; 1570cdf0e10cSrcweir } 1571cdf0e10cSrcweir 1572cdf0e10cSrcweir //----------------------------------------------------------------------- 1573cdf0e10cSrcweir 1574cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, LoadTimerHdl_Impl, Timer* , pTimer ) 1575cdf0e10cSrcweir 1576cdf0e10cSrcweir /* [Beschreibung] 1577cdf0e10cSrcweir 1578cdf0e10cSrcweir Verz"ogertes Laden der Grafik. 1579cdf0e10cSrcweir Grafik wird nur dann geladen, wenn sie unterschiedlich zur 1580cdf0e10cSrcweir aktuellen Grafik ist. 1581cdf0e10cSrcweir */ 1582cdf0e10cSrcweir 1583cdf0e10cSrcweir { 1584cdf0e10cSrcweir if ( pTimer == pPageImpl->pLoadTimer ) 1585cdf0e10cSrcweir { 1586cdf0e10cSrcweir pPageImpl->pLoadTimer->Stop(); 1587cdf0e10cSrcweir 1588cdf0e10cSrcweir if ( pImportDlg ) 1589cdf0e10cSrcweir { 1590cdf0e10cSrcweir INetURLObject aOld( aBgdGraphicPath ); 1591cdf0e10cSrcweir INetURLObject aNew( pImportDlg->GetPath() ); 1592cdf0e10cSrcweir if ( !aBgdGraphicPath.Len() || aNew != aOld ) 1593cdf0e10cSrcweir { 1594cdf0e10cSrcweir // neue Datei gew"ahlt 1595cdf0e10cSrcweir aBgdGraphicPath = pImportDlg->GetPath(); 1596cdf0e10cSrcweir aBgdGraphicFilter = pImportDlg->GetCurrentFilter(); 1597cdf0e10cSrcweir sal_Bool bLink = ( nHtmlMode & HTMLMODE_ON ) || bLinkOnly ? sal_True : pImportDlg->IsAsLink(); 1598cdf0e10cSrcweir aBtnLink.Check( bLink ); 1599cdf0e10cSrcweir aBtnLink.Enable(); 1600cdf0e10cSrcweir 1601cdf0e10cSrcweir if ( aBtnPreview.IsChecked() ) 1602cdf0e10cSrcweir { 1603cdf0e10cSrcweir if( !pImportDlg->GetGraphic(aBgdGraphic) ) 1604cdf0e10cSrcweir { 1605cdf0e10cSrcweir bIsGraphicValid = sal_True; 1606cdf0e10cSrcweir } 1607cdf0e10cSrcweir else 1608cdf0e10cSrcweir { 1609cdf0e10cSrcweir aBgdGraphicFilter.Erase(); 1610cdf0e10cSrcweir aBgdGraphicPath.Erase(); 1611cdf0e10cSrcweir bIsGraphicValid = sal_False; 1612cdf0e10cSrcweir } 1613cdf0e10cSrcweir } 1614cdf0e10cSrcweir else 1615cdf0e10cSrcweir bIsGraphicValid = sal_False; // Grafik erst beim Preview-Click laden 1616cdf0e10cSrcweir 1617cdf0e10cSrcweir if ( aBtnPreview.IsChecked() && bIsGraphicValid ) 1618cdf0e10cSrcweir { 1619cdf0e10cSrcweir Bitmap aBmp = aBgdGraphic.GetBitmap(); 1620cdf0e10cSrcweir pPreviewWin2->NotifyChange( &aBmp ); 1621cdf0e10cSrcweir } 1622cdf0e10cSrcweir else 1623cdf0e10cSrcweir pPreviewWin2->NotifyChange( NULL ); 1624cdf0e10cSrcweir } 1625cdf0e10cSrcweir 1626cdf0e10cSrcweir FileClickHdl_Impl( &aBtnLink ); 1627cdf0e10cSrcweir DELETEZ( pImportDlg ); 1628cdf0e10cSrcweir } 1629cdf0e10cSrcweir } 1630cdf0e10cSrcweir return 0; 1631cdf0e10cSrcweir } 1632cdf0e10cSrcweir 1633cdf0e10cSrcweir //----------------------------------------------------------------------- 1634cdf0e10cSrcweir 1635cdf0e10cSrcweir void SvxBackgroundTabPage::ShowTblControl() 1636cdf0e10cSrcweir 1637cdf0e10cSrcweir /* [Beschreibung] 1638cdf0e10cSrcweir 1639cdf0e10cSrcweir */ 1640cdf0e10cSrcweir 1641cdf0e10cSrcweir { 1642cdf0e10cSrcweir aTblLBox .SetSelectHdl( HDL(TblDestinationHdl_Impl) ); 1643cdf0e10cSrcweir aTblLBox .SelectEntryPos(0); 1644cdf0e10cSrcweir aTblDesc.Show(); 1645cdf0e10cSrcweir aTblLBox.Show(); 1646cdf0e10cSrcweir } 1647cdf0e10cSrcweir 1648cdf0e10cSrcweir //----------------------------------------------------------------------- 1649cdf0e10cSrcweir 1650cdf0e10cSrcweir void SvxBackgroundTabPage::ShowParaControl(sal_Bool bCharOnly) 1651cdf0e10cSrcweir { 1652cdf0e10cSrcweir aParaLBox.SetSelectHdl(HDL(ParaDestinationHdl_Impl)); 1653cdf0e10cSrcweir aParaLBox.SelectEntryPos(0); 1654cdf0e10cSrcweir if(!bCharOnly) 1655cdf0e10cSrcweir { 1656cdf0e10cSrcweir aTblDesc.Show(); 1657cdf0e10cSrcweir aParaLBox.Show(); 1658cdf0e10cSrcweir } 1659cdf0e10cSrcweir aParaLBox.SetData(&aParaLBox); // hier erkennt man, dass dieser Mode eingeschaltet ist 1660cdf0e10cSrcweir } 1661cdf0e10cSrcweir //----------------------------------------------------------------------- 1662cdf0e10cSrcweir 1663cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox ) 1664cdf0e10cSrcweir 1665cdf0e10cSrcweir /* [Beschreibung] 1666cdf0e10cSrcweir 1667cdf0e10cSrcweir */ 1668cdf0e10cSrcweir 1669cdf0e10cSrcweir { 1670cdf0e10cSrcweir sal_uInt16 nSelPos = pBox->GetSelectEntryPos(); 1671cdf0e10cSrcweir if( pTableBck_Impl && pTableBck_Impl->nActPos != nSelPos) 1672cdf0e10cSrcweir { 1673cdf0e10cSrcweir SvxBrushItem** pActItem = new (SvxBrushItem*); 1674cdf0e10cSrcweir sal_uInt16 nWhich = 0; 1675cdf0e10cSrcweir switch(pTableBck_Impl->nActPos) 1676cdf0e10cSrcweir { 1677cdf0e10cSrcweir case TBL_DEST_CELL: 1678cdf0e10cSrcweir *pActItem = pTableBck_Impl->pCellBrush; 1679cdf0e10cSrcweir nWhich = pTableBck_Impl->nCellWhich; 1680cdf0e10cSrcweir break; 1681cdf0e10cSrcweir case TBL_DEST_ROW: 1682cdf0e10cSrcweir *pActItem = pTableBck_Impl->pRowBrush; 1683cdf0e10cSrcweir nWhich = pTableBck_Impl->nRowWhich; 1684cdf0e10cSrcweir break; 1685cdf0e10cSrcweir case TBL_DEST_TBL: 1686cdf0e10cSrcweir *pActItem = pTableBck_Impl->pTableBrush; 1687cdf0e10cSrcweir nWhich = pTableBck_Impl->nTableWhich; 1688cdf0e10cSrcweir break; 1689cdf0e10cSrcweir } 1690cdf0e10cSrcweir pTableBck_Impl->nActPos = nSelPos; 1691cdf0e10cSrcweir if(!*pActItem) 1692cdf0e10cSrcweir *pActItem = new SvxBrushItem(nWhich); 1693cdf0e10cSrcweir if(0 == aLbSelect.GetSelectEntryPos()) // Brush ausgewaehlt 1694cdf0e10cSrcweir { 1695cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdColor, nWhich ); 1696cdf0e10cSrcweir } 1697cdf0e10cSrcweir else 1698cdf0e10cSrcweir { 1699cdf0e10cSrcweir SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); 1700cdf0e10cSrcweir const sal_Bool bIsLink = aBtnLink.IsChecked(); 1701cdf0e10cSrcweir 1702cdf0e10cSrcweir if ( !bIsLink && !bIsGraphicValid ) 1703cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 1704cdf0e10cSrcweir 1705cdf0e10cSrcweir if ( bIsLink ) 1706cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdGraphicPath, 1707cdf0e10cSrcweir aBgdGraphicFilter, 1708cdf0e10cSrcweir eNewPos, 1709cdf0e10cSrcweir (*pActItem)->Which() ); 1710cdf0e10cSrcweir else 1711cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdGraphic, 1712cdf0e10cSrcweir eNewPos, 1713cdf0e10cSrcweir (*pActItem)->Which() ); 1714cdf0e10cSrcweir } 1715cdf0e10cSrcweir switch(nSelPos) 1716cdf0e10cSrcweir { 1717cdf0e10cSrcweir case TBL_DEST_CELL: 1718cdf0e10cSrcweir *pActItem = pTableBck_Impl->pCellBrush; 1719cdf0e10cSrcweir aLbSelect.Enable(); 1720cdf0e10cSrcweir nWhich = pTableBck_Impl->nCellWhich; 1721cdf0e10cSrcweir break; 1722cdf0e10cSrcweir case TBL_DEST_ROW: 1723cdf0e10cSrcweir { 1724cdf0e10cSrcweir if((nHtmlMode & HTMLMODE_ON) && !(nHtmlMode & HTMLMODE_SOME_STYLES)) 1725cdf0e10cSrcweir aLbSelect.Disable(); 1726cdf0e10cSrcweir *pActItem = pTableBck_Impl->pRowBrush; 1727cdf0e10cSrcweir nWhich = pTableBck_Impl->nRowWhich; 1728cdf0e10cSrcweir } 1729cdf0e10cSrcweir break; 1730cdf0e10cSrcweir case TBL_DEST_TBL: 1731cdf0e10cSrcweir *pActItem = pTableBck_Impl->pTableBrush; 1732cdf0e10cSrcweir aLbSelect.Enable(); 1733cdf0e10cSrcweir nWhich = pTableBck_Impl->nTableWhich; 1734cdf0e10cSrcweir break; 1735cdf0e10cSrcweir } 1736cdf0e10cSrcweir String aUserData = GetUserData(); 1737cdf0e10cSrcweir if(!*pActItem) 1738cdf0e10cSrcweir *pActItem = new SvxBrushItem(nWhich); 1739cdf0e10cSrcweir FillControls_Impl(**pActItem, aUserData); 1740cdf0e10cSrcweir delete pActItem; 1741cdf0e10cSrcweir } 1742cdf0e10cSrcweir return 0; 1743cdf0e10cSrcweir } 1744cdf0e10cSrcweir 1745cdf0e10cSrcweir //----------------------------------------------------------------------- 1746cdf0e10cSrcweir 1747cdf0e10cSrcweir IMPL_LINK( SvxBackgroundTabPage, ParaDestinationHdl_Impl, ListBox*, pBox ) 1748cdf0e10cSrcweir { 1749cdf0e10cSrcweir sal_uInt16 nSelPos = pBox->GetSelectEntryPos(); 1750cdf0e10cSrcweir if( pParaBck_Impl && pParaBck_Impl->nActPos != nSelPos) 1751cdf0e10cSrcweir { 1752cdf0e10cSrcweir SvxBrushItem** pActItem = new (SvxBrushItem*); 1753cdf0e10cSrcweir switch(pParaBck_Impl->nActPos) 1754cdf0e10cSrcweir { 1755cdf0e10cSrcweir case PARA_DEST_PARA: 1756cdf0e10cSrcweir *pActItem = pParaBck_Impl->pParaBrush; 1757cdf0e10cSrcweir break; 1758cdf0e10cSrcweir case PARA_DEST_CHAR: 1759cdf0e10cSrcweir *pActItem = pParaBck_Impl->pCharBrush; 1760cdf0e10cSrcweir break; 1761cdf0e10cSrcweir } 1762cdf0e10cSrcweir pParaBck_Impl->nActPos = nSelPos; 1763cdf0e10cSrcweir if(0 == aLbSelect.GetSelectEntryPos()) // Brush ausgewaehlt 1764cdf0e10cSrcweir { 1765cdf0e10cSrcweir sal_uInt16 nWhich = (*pActItem)->Which(); 1766cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdColor, nWhich ); 1767cdf0e10cSrcweir } 1768cdf0e10cSrcweir else 1769cdf0e10cSrcweir { 1770cdf0e10cSrcweir SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); 1771cdf0e10cSrcweir const sal_Bool bIsLink = aBtnLink.IsChecked(); 1772cdf0e10cSrcweir 1773cdf0e10cSrcweir if ( !bIsLink && !bIsGraphicValid ) 1774cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 1775cdf0e10cSrcweir 1776cdf0e10cSrcweir if ( bIsLink ) 1777cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdGraphicPath, 1778cdf0e10cSrcweir aBgdGraphicFilter, 1779cdf0e10cSrcweir eNewPos, 1780cdf0e10cSrcweir (*pActItem)->Which() ); 1781cdf0e10cSrcweir else 1782cdf0e10cSrcweir **pActItem = SvxBrushItem( aBgdGraphic, 1783cdf0e10cSrcweir eNewPos, 1784cdf0e10cSrcweir (*pActItem)->Which() ); 1785cdf0e10cSrcweir } 1786cdf0e10cSrcweir switch(nSelPos) 1787cdf0e10cSrcweir { 1788cdf0e10cSrcweir case PARA_DEST_PARA: 1789cdf0e10cSrcweir *pActItem = pParaBck_Impl->pParaBrush; 1790cdf0e10cSrcweir aLbSelect.Enable(); 1791cdf0e10cSrcweir break; 1792cdf0e10cSrcweir case PARA_DEST_CHAR: 1793cdf0e10cSrcweir { 1794cdf0e10cSrcweir *pActItem = pParaBck_Impl->pCharBrush; 1795cdf0e10cSrcweir aLbSelect.Enable(sal_False); 1796cdf0e10cSrcweir } 1797cdf0e10cSrcweir break; 1798cdf0e10cSrcweir } 1799cdf0e10cSrcweir String aUserData = GetUserData(); 1800cdf0e10cSrcweir FillControls_Impl(**pActItem, aUserData); 1801cdf0e10cSrcweir delete pActItem; 1802cdf0e10cSrcweir } 1803cdf0e10cSrcweir return 0; 1804cdf0e10cSrcweir } 1805cdf0e10cSrcweir 1806cdf0e10cSrcweir //----------------------------------------------------------------------- 1807cdf0e10cSrcweir 1808cdf0e10cSrcweir void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr, 1809cdf0e10cSrcweir const String& rUserData ) 1810cdf0e10cSrcweir 1811cdf0e10cSrcweir /* [Beschreibung] 1812cdf0e10cSrcweir 1813cdf0e10cSrcweir */ 1814cdf0e10cSrcweir 1815cdf0e10cSrcweir { 1816cdf0e10cSrcweir SvxGraphicPosition ePos = rBgdAttr.GetGraphicPos(); 1817cdf0e10cSrcweir const Color& rColor = rBgdAttr.GetColor(); 1818cdf0e10cSrcweir if(bColTransparency) 1819cdf0e10cSrcweir { 1820cdf0e10cSrcweir aColTransMF.SetValue(lcl_TransparencyToPercent(rColor.GetTransparency())); 1821cdf0e10cSrcweir aColTransMF.SaveValue(); 1822cdf0e10cSrcweir sal_Bool bEnableTransp = rColor.GetTransparency() < 0xff; 1823cdf0e10cSrcweir aColTransFT.Enable(bEnableTransp); 1824cdf0e10cSrcweir aColTransMF.Enable(bEnableTransp); 1825cdf0e10cSrcweir //the default setting should be "no transparency" 1826cdf0e10cSrcweir if(!bEnableTransp) 1827cdf0e10cSrcweir aColTransMF.SetValue(0); 1828cdf0e10cSrcweir } 1829cdf0e10cSrcweir 1830cdf0e10cSrcweir if ( GPOS_NONE == ePos || !aLbSelect.IsVisible() ) 1831cdf0e10cSrcweir { 1832cdf0e10cSrcweir aLbSelect.SelectEntryPos( 0 ); 1833cdf0e10cSrcweir ShowColorUI_Impl(); 1834cdf0e10cSrcweir Color aTrColor( COL_TRANSPARENT ); 1835cdf0e10cSrcweir aBgdColor = rColor; 1836cdf0e10cSrcweir 1837cdf0e10cSrcweir sal_uInt16 nCol = ( aTrColor != aBgdColor ) ? 1838cdf0e10cSrcweir GetItemId_Impl( aBackgroundColorSet, aBgdColor ) : 0; 1839cdf0e10cSrcweir 1840cdf0e10cSrcweir if( aTrColor != aBgdColor && nCol == 0) 1841cdf0e10cSrcweir { 1842cdf0e10cSrcweir aBackgroundColorSet.SetNoSelection(); 1843cdf0e10cSrcweir } 1844cdf0e10cSrcweir else 1845cdf0e10cSrcweir { 1846cdf0e10cSrcweir aBackgroundColorSet.SelectItem( nCol ); 1847cdf0e10cSrcweir } 1848cdf0e10cSrcweir 1849cdf0e10cSrcweir pPreviewWin1->NotifyChange( aBgdColor ); 1850cdf0e10cSrcweir if ( aLbSelect.IsVisible() ) // Grafikteil initialisieren 1851cdf0e10cSrcweir { 1852cdf0e10cSrcweir aBgdGraphicFilter.Erase(); 1853cdf0e10cSrcweir aBgdGraphicPath.Erase(); 1854cdf0e10cSrcweir 1855cdf0e10cSrcweir if ( !rUserData.Len() ) 1856cdf0e10cSrcweir aBtnPreview.Check( sal_False ); 1857cdf0e10cSrcweir aBtnLink.Check( sal_False ); 1858cdf0e10cSrcweir aBtnLink.Disable(); 1859cdf0e10cSrcweir pPreviewWin2->NotifyChange( NULL ); 1860cdf0e10cSrcweir SetGraphicPosition_Impl( GPOS_TILED ); // Kacheln als Default 1861cdf0e10cSrcweir } 1862cdf0e10cSrcweir } 1863cdf0e10cSrcweir else 1864cdf0e10cSrcweir { 1865cdf0e10cSrcweir const String* pStrLink = rBgdAttr.GetGraphicLink(); 1866cdf0e10cSrcweir const String* pStrFilter = rBgdAttr.GetGraphicFilter(); 1867cdf0e10cSrcweir 1868cdf0e10cSrcweir aLbSelect.SelectEntryPos( 1 ); 1869cdf0e10cSrcweir ShowBitmapUI_Impl(); 1870cdf0e10cSrcweir 1871cdf0e10cSrcweir if ( pStrLink ) 1872cdf0e10cSrcweir { 1873cdf0e10cSrcweir #ifdef DBG_UTIL 1874cdf0e10cSrcweir INetURLObject aObj( *pStrLink ); 1875cdf0e10cSrcweir DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" ); 1876cdf0e10cSrcweir #endif 1877cdf0e10cSrcweir aBgdGraphicPath = *pStrLink; 1878cdf0e10cSrcweir aBtnLink.Check( sal_True ); 1879cdf0e10cSrcweir aBtnLink.Enable(); 1880cdf0e10cSrcweir } 1881cdf0e10cSrcweir else 1882cdf0e10cSrcweir { 1883cdf0e10cSrcweir aBgdGraphicPath.Erase(); 1884cdf0e10cSrcweir aBtnLink.Check( sal_False ); 1885cdf0e10cSrcweir aBtnLink.Disable(); 1886cdf0e10cSrcweir } 1887cdf0e10cSrcweir 1888cdf0e10cSrcweir if(bGraphTransparency) 1889cdf0e10cSrcweir { 1890cdf0e10cSrcweir const GraphicObject* pObject = rBgdAttr.GetGraphicObject(); 1891cdf0e10cSrcweir if(pObject) 1892cdf0e10cSrcweir aGraphTransMF.SetValue(lcl_TransparencyToPercent(pObject->GetAttr().GetTransparency())); 1893cdf0e10cSrcweir else 1894cdf0e10cSrcweir aGraphTransMF.SetValue(0); 1895cdf0e10cSrcweir aGraphTransMF.SaveValue(); 1896cdf0e10cSrcweir } 1897cdf0e10cSrcweir 1898cdf0e10cSrcweir FileClickHdl_Impl( &aBtnLink ); 1899cdf0e10cSrcweir 1900cdf0e10cSrcweir if ( pStrFilter ) 1901cdf0e10cSrcweir aBgdGraphicFilter = *pStrFilter; 1902cdf0e10cSrcweir else 1903cdf0e10cSrcweir aBgdGraphicFilter.Erase(); 1904cdf0e10cSrcweir 1905cdf0e10cSrcweir if ( !pStrLink || aBtnPreview.IsChecked() ) 1906cdf0e10cSrcweir { 1907cdf0e10cSrcweir // Grafik ist im Item vorhanden und muss nicht 1908cdf0e10cSrcweir // geladen werden: 1909cdf0e10cSrcweir 1910cdf0e10cSrcweir const Graphic* pGraphic = rBgdAttr.GetGraphic(); 1911cdf0e10cSrcweir 1912cdf0e10cSrcweir if ( !pGraphic && aBtnPreview.IsChecked() ) 1913cdf0e10cSrcweir bIsGraphicValid = LoadLinkedGraphic_Impl(); 1914cdf0e10cSrcweir else if ( pGraphic ) 1915cdf0e10cSrcweir { 1916cdf0e10cSrcweir aBgdGraphic = *pGraphic; 1917cdf0e10cSrcweir bIsGraphicValid = sal_True; 1918cdf0e10cSrcweir 1919cdf0e10cSrcweir if ( !rUserData.Len() ) 1920cdf0e10cSrcweir aBtnPreview.Check(); 1921cdf0e10cSrcweir } 1922cdf0e10cSrcweir else 1923cdf0e10cSrcweir { 1924cdf0e10cSrcweir RaiseLoadError_Impl(); 1925cdf0e10cSrcweir bIsGraphicValid = sal_False; 1926cdf0e10cSrcweir 1927cdf0e10cSrcweir if ( !rUserData.Len() ) 1928cdf0e10cSrcweir aBtnPreview.Check( sal_False ); 1929cdf0e10cSrcweir } 1930cdf0e10cSrcweir } 1931cdf0e10cSrcweir 1932cdf0e10cSrcweir if ( aBtnPreview.IsChecked() && bIsGraphicValid ) 1933cdf0e10cSrcweir { 1934cdf0e10cSrcweir Bitmap aBmp = aBgdGraphic.GetBitmap(); 1935cdf0e10cSrcweir pPreviewWin2->NotifyChange( &aBmp ); 1936cdf0e10cSrcweir } 1937cdf0e10cSrcweir else 1938cdf0e10cSrcweir pPreviewWin2->NotifyChange( NULL ); 1939cdf0e10cSrcweir 1940cdf0e10cSrcweir SetGraphicPosition_Impl( ePos ); 1941cdf0e10cSrcweir } 1942cdf0e10cSrcweir } 1943cdf0e10cSrcweir /* -----------------------------09.08.2002 14:04------------------------------ 1944cdf0e10cSrcweir 1945cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1946cdf0e10cSrcweir void SvxBackgroundTabPage::EnableTransparency(sal_Bool bColor, sal_Bool bGraphic) 1947cdf0e10cSrcweir { 1948cdf0e10cSrcweir bColTransparency = bColor; 1949cdf0e10cSrcweir bGraphTransparency = bGraphic; 1950cdf0e10cSrcweir if(bColor) 1951cdf0e10cSrcweir { 1952cdf0e10cSrcweir aColTransFT.Show(); 1953cdf0e10cSrcweir aColTransMF.Show(); 1954cdf0e10cSrcweir } 1955cdf0e10cSrcweir if(bGraphic) 1956cdf0e10cSrcweir { 1957cdf0e10cSrcweir Size aRectSize(aWndPosition.GetSizePixel()); 1958cdf0e10cSrcweir Point aRectPos(aWndPosition.GetPosPixel()); 1959cdf0e10cSrcweir Point aFLPos(aGraphTransFL.GetPosPixel()); 1960cdf0e10cSrcweir Size aTmp(LogicToPixel(Size(RSC_SP_FLGR_SPACE_Y, RSC_SP_FLGR_SPACE_Y), MAP_APPFONT)); 1961cdf0e10cSrcweir long nRectHeight = aFLPos.Y() - aRectPos.Y() - aTmp.Height(); 1962cdf0e10cSrcweir aRectSize.Height() = nRectHeight; 1963cdf0e10cSrcweir aWndPosition.SetSizePixel(aRectSize); 1964cdf0e10cSrcweir aWndPosition.Invalidate(); 1965cdf0e10cSrcweir } 1966cdf0e10cSrcweir } 1967cdf0e10cSrcweir 1968cdf0e10cSrcweir void SvxBackgroundTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 1969cdf0e10cSrcweir { 1970cdf0e10cSrcweir SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); 1971cdf0e10cSrcweir if (pFlagItem) 1972cdf0e10cSrcweir { 1973cdf0e10cSrcweir sal_uInt32 nFlags=pFlagItem->GetValue(); 1974cdf0e10cSrcweir if ( ( nFlags & SVX_SHOW_TBLCTL ) == SVX_SHOW_TBLCTL ) 1975cdf0e10cSrcweir ShowTblControl(); 1976cdf0e10cSrcweir if ( ( nFlags & SVX_SHOW_PARACTL ) == SVX_SHOW_PARACTL ) 1977cdf0e10cSrcweir ShowParaControl(); 1978cdf0e10cSrcweir if ( ( nFlags & SVX_SHOW_SELECTOR ) == SVX_SHOW_SELECTOR ) 1979cdf0e10cSrcweir ShowSelector(); 1980cdf0e10cSrcweir if ( ( nFlags & SVX_ENABLE_TRANSPARENCY ) == SVX_ENABLE_TRANSPARENCY ) 1981cdf0e10cSrcweir EnableTransparency(sal_True, sal_True); 1982cdf0e10cSrcweir } 1983cdf0e10cSrcweir } 1984