LCOV - code coverage report
Current view: top level - cui/source/tabpages - backgrnd.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 892 0.0 %
Date: 2012-08-25 Functions: 0 55 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1519 0.0 %

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

Generated by: LCOV version 1.10