LCOV - code coverage report
Current view: top level - cui/source/tabpages - border.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 558 0.0 %
Date: 2012-08-25 Functions: 0 36 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1209 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 <sfx2/app.hxx>
      30                 :            : #include <sfx2/objsh.hxx>
      31                 :            : #include <sfx2/module.hxx>
      32                 :            : #include <svx/dialogs.hrc>
      33                 :            : #include <svx/dialmgr.hxx>
      34                 :            : #define _SVX_BORDER_CXX
      35                 :            : 
      36                 :            : #include <cuires.hrc>
      37                 :            : #include "border.hrc"
      38                 :            : #include "helpid.hrc"
      39                 :            : 
      40                 :            : #include <svx/xtable.hxx>               // XColorList
      41                 :            : #include <svx/drawitem.hxx>
      42                 :            : #include <editeng/boxitem.hxx>
      43                 :            : #include <editeng/shaditem.hxx>
      44                 :            : #include "border.hxx"
      45                 :            : #include <svx/dlgutil.hxx>
      46                 :            : #include <dialmgr.hxx>
      47                 :            : #include "svx/htmlmode.hxx"
      48                 :            : #include <vcl/msgbox.hxx>
      49                 :            : #include "svx/flagsdef.hxx"
      50                 :            : #include <sfx2/request.hxx>
      51                 :            : #include <svl/intitem.hxx>
      52                 :            : #include <sfx2/itemconnect.hxx>
      53                 :            : #include <sal/macros.h>
      54                 :            : #include "borderconn.hxx"
      55                 :            : 
      56                 :            : using namespace ::editeng;
      57                 :            : 
      58                 :            : // -----------------------------------------------------------------------
      59                 :            : 
      60                 :            : /*
      61                 :            :  * [Description:]
      62                 :            :  * TabPage for setting the border attributes.
      63                 :            :  * Needs
      64                 :            :  *      a SvxShadowItem: shadow
      65                 :            :  *      a SvxBoxItem:    lines left, right, top, bottom,
      66                 :            :  *      a SvxBoxInfo:    lines vertical, horizontal, distance, flags
      67                 :            :  *
      68                 :            :  * Lines can have three conditions:
      69                 :            :  *      1. Show     ( -> valid values )
      70                 :            :  *      2. Hide     ( -> NULL-Pointer )
      71                 :            :  *      3. DontCare ( -> special Valid-Flags in the InfoItem )
      72                 :            :  */
      73                 :            : 
      74                 :            : // static ----------------------------------------------------------------
      75                 :            : 
      76                 :            : static sal_uInt16 pRanges[] =
      77                 :            : {
      78                 :            :     SID_ATTR_BORDER_INNER,      SID_ATTR_BORDER_SHADOW,
      79                 :            :     SID_ATTR_ALIGN_MARGIN,      SID_ATTR_ALIGN_MARGIN,
      80                 :            :     SID_ATTR_BORDER_CONNECT,    SID_ATTR_BORDER_CONNECT,
      81                 :            :     SID_SW_COLLAPSING_BORDERS,  SID_SW_COLLAPSING_BORDERS,
      82                 :            :     SID_ATTR_BORDER_DIAG_TLBR,  SID_ATTR_BORDER_DIAG_BLTR,
      83                 :            :     0
      84                 :            : };
      85                 :            : 
      86                 :            : // -----------------------------------------------------------------------
      87                 :          0 : void lcl_SetDecimalDigitsTo1(MetricField& rField)
      88                 :            : {
      89                 :          0 :     sal_Int64 nMin = rField.Denormalize( rField.GetMin( FUNIT_TWIP ) );
      90                 :          0 :     rField.SetDecimalDigits(1);
      91                 :          0 :     rField.SetMin( rField.Normalize( nMin ), FUNIT_TWIP );
      92                 :          0 : }
      93                 :            : // -----------------------------------------------------------------------
      94                 :            : 
      95                 :          0 : SvxBorderTabPage::SvxBorderTabPage( Window* pParent,
      96                 :            :                                     const SfxItemSet& rCoreAttrs )
      97                 :            : 
      98                 :          0 :     :   SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_BORDER ), rCoreAttrs ),
      99                 :            : 
     100         [ #  # ]:          0 :         aFlBorder       ( this, CUI_RES( FL_BORDER ) ),
     101         [ #  # ]:          0 :         aDefaultFT      ( this, CUI_RES( FT_DEFAULT ) ),
     102         [ #  # ]:          0 :         aWndPresets     ( this, CUI_RES( WIN_PRESETS ) ),
     103         [ #  # ]:          0 :         aUserDefFT      ( this, CUI_RES( FT_USERDEF ) ),
     104         [ #  # ]:          0 :         aFrameSel       ( this, CUI_RES( WIN_FRAMESEL ) ),
     105                 :            : 
     106         [ #  # ]:          0 :         aFlSep1         ( this, CUI_RES( FL_SEPARATOR1 ) ),
     107         [ #  # ]:          0 :         aFlLine         ( this, CUI_RES( FL_LINE ) ),
     108         [ #  # ]:          0 :         aStyleFT        ( this, CUI_RES( FT_STYLE ) ),
     109         [ #  # ]:          0 :         aLbLineStyle    ( this, CUI_RES( LB_LINESTYLE ) ),
     110         [ #  # ]:          0 :         aColorFT        ( this, CUI_RES( FT_COLOR ) ),
     111         [ #  # ]:          0 :         aLbLineColor    ( this, CUI_RES( LB_LINECOLOR ) ),
     112         [ #  # ]:          0 :         aWidthFT        ( this, CUI_RES( FT_WIDTH ) ),
     113         [ #  # ]:          0 :         aLineWidthMF    ( this, CUI_RES( MF_LINEWIDTH ) ),
     114                 :            : 
     115         [ #  # ]:          0 :         aFlSep2         ( this, CUI_RES( FL_SEPARATOR2 ) ),
     116         [ #  # ]:          0 :         aDistanceFL     ( this, CUI_RES( FL_DISTANCE ) ),
     117         [ #  # ]:          0 :         aLeftFT         ( this, CUI_RES( FT_LEFT ) ),
     118         [ #  # ]:          0 :         aLeftMF         ( this, CUI_RES( MF_LEFT ) ),
     119         [ #  # ]:          0 :         aRightFT        ( this, CUI_RES( FT_RIGHT ) ),
     120         [ #  # ]:          0 :         aRightMF        ( this, CUI_RES( MF_RIGHT ) ),
     121         [ #  # ]:          0 :         aTopFT          ( this, CUI_RES( FT_TOP ) ),
     122         [ #  # ]:          0 :         aTopMF          ( this, CUI_RES( MF_TOP ) ),
     123         [ #  # ]:          0 :         aBottomFT       ( this, CUI_RES( FT_BOTTOM ) ),
     124         [ #  # ]:          0 :         aBottomMF       ( this, CUI_RES( MF_BOTTOM ) ),
     125         [ #  # ]:          0 :         aSynchronizeCB  ( this, CUI_RES( CB_SYNC ) ),
     126                 :            : 
     127         [ #  # ]:          0 :         aFlShadow       ( this, CUI_RES( FL_SHADOW ) ),
     128         [ #  # ]:          0 :         aFtShadowPos    ( this, CUI_RES( FT_SHADOWPOS ) ),
     129         [ #  # ]:          0 :         aWndShadows     ( this, CUI_RES( WIN_SHADOWS ) ),
     130         [ #  # ]:          0 :         aFtShadowSize   ( this, CUI_RES( FT_SHADOWSIZE ) ),
     131         [ #  # ]:          0 :         aEdShadowSize   ( this, CUI_RES( ED_SHADOWSIZE ) ),
     132         [ #  # ]:          0 :         aFtShadowColor  ( this, CUI_RES( FT_SHADOWCOLOR ) ),
     133         [ #  # ]:          0 :         aLbShadowColor  ( this, CUI_RES( LB_SHADOWCOLOR ) ),
     134         [ #  # ]:          0 :         aPropertiesFL   ( this, CUI_RES( FL_PROPERTIES ) ),
     135         [ #  # ]:          0 :         aMergeWithNextCB( this, CUI_RES( CB_MERGEWITHNEXT ) ),
     136         [ #  # ]:          0 :         aMergeAdjacentBordersCB( this, CUI_RES( CB_MERGEADJACENTBORDERS ) ),
     137         [ #  # ]:          0 :         aShadowImgLst( CUI_RES(IL_SDW_BITMAPS)),
     138         [ #  # ]:          0 :         aBorderImgLst( CUI_RES(IL_PRE_BITMAPS)),
     139                 :            :         nMinValue(0),
     140                 :            :         nSWMode(0),
     141                 :            :         mbHorEnabled( false ),
     142                 :            :         mbVerEnabled( false ),
     143                 :            :         mbTLBREnabled( false ),
     144                 :            :         mbBLTREnabled( false ),
     145                 :            :         mbUseMarginItem( false ),
     146 [ #  # ][ #  # ]:          0 :         mbSync(true)
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     147                 :            : 
     148                 :            : {
     149                 :            :     // this page needs ExchangeSupport
     150                 :          0 :     SetExchangeSupport();
     151                 :            : 
     152                 :            :     /*  Use SvxMarginItem instead of margins from SvxBoxItem, if present.
     153                 :            :         ->  Remember this state in mbUseMarginItem, because other special handling
     154                 :            :             is needed across various functions... */
     155 [ #  # ][ #  # ]:          0 :     mbUseMarginItem = rCoreAttrs.GetItemState(GetWhich(SID_ATTR_ALIGN_MARGIN),sal_True) != SFX_ITEM_UNKNOWN;
     156                 :            : 
     157                 :            :     // set metric
     158         [ #  # ]:          0 :     FieldUnit eFUnit = GetModuleFieldUnit( rCoreAttrs );
     159                 :            : 
     160         [ #  # ]:          0 :     if( mbUseMarginItem )
     161                 :            :     {
     162                 :            :         // copied from SvxAlignmentTabPage
     163      [ #  #  # ]:          0 :         switch ( eFUnit )
     164                 :            :         {
     165                 :            :             //  #103396# the default value (1pt) can't be accurately represented in
     166                 :            :             //  inches or pica with two decimals, so point is used instead.
     167                 :            :             case FUNIT_PICA:
     168                 :            :             case FUNIT_INCH:
     169                 :            :             case FUNIT_FOOT:
     170                 :            :             case FUNIT_MILE:
     171                 :          0 :                 eFUnit = FUNIT_POINT;
     172                 :          0 :                 break;
     173                 :            : 
     174                 :            :             case FUNIT_CM:
     175                 :            :             case FUNIT_M:
     176                 :            :             case FUNIT_KM:
     177                 :          0 :                 eFUnit = FUNIT_MM;
     178                 :          0 :                 break;
     179                 :            :             default: ;//prevent warning
     180                 :            :         }
     181                 :            :     }
     182                 :            :     else
     183                 :            :     {
     184         [ #  # ]:          0 :         switch ( eFUnit )
     185                 :            :         {
     186                 :            :             case FUNIT_M:
     187                 :            :             case FUNIT_KM:
     188                 :          0 :                 eFUnit = FUNIT_MM;
     189                 :          0 :                 break;
     190                 :            :             default: ; //prevent warning
     191                 :            :         }
     192                 :            :     }
     193                 :            : 
     194         [ #  # ]:          0 :     SetFieldUnit( aEdShadowSize, eFUnit );
     195                 :            : 
     196         [ #  # ]:          0 :     sal_uInt16 nWhich = GetWhich( SID_ATTR_BORDER_INNER, sal_False );
     197                 :          0 :     sal_Bool bIsDontCare = sal_True;
     198                 :            : 
     199 [ #  # ][ #  # ]:          0 :     if ( rCoreAttrs.GetItemState( nWhich, sal_True ) >= SFX_ITEM_AVAILABLE )
     200                 :            :     {
     201                 :            :         // paragraph or table
     202                 :            :         const SvxBoxInfoItem* pBoxInfo =
     203         [ #  # ]:          0 :             (const SvxBoxInfoItem*)&( rCoreAttrs.Get( nWhich ) );
     204                 :            : 
     205                 :          0 :         mbHorEnabled = pBoxInfo->IsHorEnabled();
     206                 :          0 :         mbVerEnabled = pBoxInfo->IsVerEnabled();
     207         [ #  # ]:          0 :         mbTLBREnabled = sfx::ItemWrapperHelper::IsKnownItem( rCoreAttrs, SID_ATTR_BORDER_DIAG_TLBR );
     208         [ #  # ]:          0 :         mbBLTREnabled = sfx::ItemWrapperHelper::IsKnownItem( rCoreAttrs, SID_ATTR_BORDER_DIAG_BLTR );
     209                 :            : 
     210         [ #  # ]:          0 :         if(pBoxInfo->IsDist())
     211                 :            :         {
     212         [ #  # ]:          0 :             SetFieldUnit(aLeftMF, eFUnit);
     213         [ #  # ]:          0 :             SetFieldUnit(aRightMF, eFUnit);
     214         [ #  # ]:          0 :             SetFieldUnit(aTopMF, eFUnit);
     215         [ #  # ]:          0 :             SetFieldUnit(aBottomMF, eFUnit);
     216         [ #  # ]:          0 :             aSynchronizeCB.SetClickHdl(LINK(this, SvxBorderTabPage, SyncHdl_Impl));
     217         [ #  # ]:          0 :             aLeftMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
     218         [ #  # ]:          0 :             aRightMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
     219         [ #  # ]:          0 :             aTopMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
     220         [ #  # ]:          0 :             aBottomMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl));
     221                 :            :         }
     222                 :            :         else
     223                 :            :         {
     224         [ #  # ]:          0 :             aFlSep2.Hide();
     225         [ #  # ]:          0 :             aDistanceFL.Hide();
     226         [ #  # ]:          0 :             aLeftFT.Hide();
     227         [ #  # ]:          0 :             aLeftMF.Hide();
     228         [ #  # ]:          0 :             aRightFT.Hide();
     229         [ #  # ]:          0 :             aRightMF.Hide();
     230         [ #  # ]:          0 :             aTopFT.Hide();
     231         [ #  # ]:          0 :             aTopMF.Hide();
     232         [ #  # ]:          0 :             aBottomFT.Hide();
     233         [ #  # ]:          0 :             aBottomMF.Hide();
     234         [ #  # ]:          0 :             aSynchronizeCB.Hide();
     235                 :            :         }
     236                 :          0 :         bIsDontCare = !pBoxInfo->IsValid( VALID_DISABLE );
     237                 :            :     }
     238 [ #  # ][ #  # ]:          0 :     if(!mbUseMarginItem && eFUnit == FUNIT_MM && SFX_MAPUNIT_TWIP == rCoreAttrs.GetPool()->GetMetric( GetWhich( SID_ATTR_BORDER_INNER ) ))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     239                 :            :     {
     240                 :            :         //#i91548# changing the number of decimal digits changes the minimum values, too
     241         [ #  # ]:          0 :         lcl_SetDecimalDigitsTo1(aLeftMF);
     242         [ #  # ]:          0 :         lcl_SetDecimalDigitsTo1(aRightMF);
     243         [ #  # ]:          0 :         lcl_SetDecimalDigitsTo1(aTopMF);
     244         [ #  # ]:          0 :         lcl_SetDecimalDigitsTo1(aBottomMF);
     245         [ #  # ]:          0 :         lcl_SetDecimalDigitsTo1(aEdShadowSize);
     246                 :            :     }
     247                 :            : 
     248                 :          0 :     svx::FrameSelFlags nFlags = svx::FRAMESEL_OUTER;
     249         [ #  # ]:          0 :     if( mbHorEnabled )
     250                 :          0 :         nFlags |= svx::FRAMESEL_INNER_HOR;
     251         [ #  # ]:          0 :     if( mbVerEnabled )
     252                 :          0 :         nFlags |= svx::FRAMESEL_INNER_VER;
     253         [ #  # ]:          0 :     if( mbTLBREnabled )
     254                 :          0 :         nFlags |= svx::FRAMESEL_DIAG_TLBR;
     255         [ #  # ]:          0 :     if( mbBLTREnabled )
     256                 :          0 :         nFlags |= svx::FRAMESEL_DIAG_BLTR;
     257         [ #  # ]:          0 :     if( bIsDontCare )
     258                 :          0 :         nFlags |= svx::FRAMESEL_DONTCARE;
     259         [ #  # ]:          0 :     aFrameSel.Initialize( nFlags );
     260                 :            : 
     261 [ #  # ][ #  # ]:          0 :     aFrameSel.SetSelectHdl(LINK(this, SvxBorderTabPage, LinesChanged_Impl));
     262         [ #  # ]:          0 :     aLbLineStyle.SetSelectHdl( LINK( this, SvxBorderTabPage, SelStyleHdl_Impl ) );
     263         [ #  # ]:          0 :     aLbLineColor.SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) );
     264         [ #  # ]:          0 :     aLineWidthMF.SetModifyHdl( LINK( this, SvxBorderTabPage, ModifyWidthHdl_Impl ) );
     265         [ #  # ]:          0 :     aLbShadowColor.SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) );
     266         [ #  # ]:          0 :     aWndPresets.SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) );
     267         [ #  # ]:          0 :     aWndShadows.SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) );
     268                 :            : 
     269         [ #  # ]:          0 :     FillValueSets();
     270         [ #  # ]:          0 :     FillLineListBox_Impl();
     271                 :            : 
     272                 :            :     // fill ColorBox out of the XColorList
     273         [ #  # ]:          0 :     SfxObjectShell*     pDocSh      = SfxObjectShell::Current();
     274                 :          0 :     const SfxPoolItem*  pItem       = NULL;
     275                 :          0 :     XColorListRef       pColorTable;
     276                 :            : 
     277                 :            :     DBG_ASSERT( pDocSh, "DocShell not found!" );
     278                 :            : 
     279         [ #  # ]:          0 :     if ( pDocSh )
     280                 :            :     {
     281         [ #  # ]:          0 :         pItem = pDocSh->GetItem( SID_COLOR_TABLE );
     282         [ #  # ]:          0 :         if ( pItem != NULL )
     283 [ #  # ][ #  # ]:          0 :             pColorTable = ( (SvxColorListItem*)pItem )->GetColorList();
     284                 :            :     }
     285                 :            : 
     286                 :            :     DBG_ASSERT( pColorTable.is(), "ColorTable not found!" );
     287                 :            : 
     288         [ #  # ]:          0 :     if ( pColorTable.is() )
     289                 :            :     {
     290                 :            :         // filling the line color box
     291         [ #  # ]:          0 :         aLbLineColor.SetUpdateMode( sal_False );
     292                 :            : 
     293 [ #  # ][ #  # ]:          0 :         for ( long i = 0; i < pColorTable->Count(); ++i )
     294                 :            :         {
     295         [ #  # ]:          0 :             XColorEntry* pEntry = pColorTable->GetColor(i);
     296         [ #  # ]:          0 :             aLbLineColor.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
     297                 :            :         }
     298         [ #  # ]:          0 :         aLbLineColor.SetUpdateMode( sal_True );
     299                 :            : 
     300         [ #  # ]:          0 :         aLbShadowColor.CopyEntries( aLbLineColor );
     301                 :            :     }
     302         [ #  # ]:          0 :     FreeResource();
     303                 :            : 
     304                 :            :     // connections
     305                 :            : 
     306         [ #  # ]:          0 :     bool bSupportsShadow = !SfxItemPool::IsSlot( GetWhich( SID_ATTR_BORDER_SHADOW ) );
     307         [ #  # ]:          0 :     if( bSupportsShadow )
     308 [ #  # ][ #  # ]:          0 :         AddItemConnection( svx::CreateShadowConnection( rCoreAttrs, aWndShadows, aEdShadowSize, aLbShadowColor ) );
     309                 :            :     else
     310         [ #  # ]:          0 :         HideShadowControls();
     311                 :            : 
     312         [ #  # ]:          0 :     if( mbUseMarginItem )
     313 [ #  # ][ #  # ]:          0 :         AddItemConnection( svx::CreateMarginConnection( rCoreAttrs, aLeftMF, aRightMF, aTopMF, aBottomMF ) );
     314 [ #  # ][ #  # ]:          0 :     if( aFrameSel.IsBorderEnabled( svx::FRAMEBORDER_TLBR ) )
     315 [ #  # ][ #  # ]:          0 :         AddItemConnection( svx::CreateFrameLineConnection( SID_ATTR_BORDER_DIAG_TLBR, aFrameSel, svx::FRAMEBORDER_TLBR ) );
     316 [ #  # ][ #  # ]:          0 :     if( aFrameSel.IsBorderEnabled( svx::FRAMEBORDER_BLTR ) )
     317 [ #  # ][ #  # ]:          0 :         AddItemConnection( svx::CreateFrameLineConnection( SID_ATTR_BORDER_DIAG_BLTR, aFrameSel, svx::FRAMEBORDER_BLTR ) );
     318                 :            :     // #i43593# - item connection doesn't work for Writer,
     319                 :            :     // because the Writer item sets contain these items
     320                 :            :     // checkbox "Merge with next paragraph" only visible for Writer dialog format.paragraph
     321 [ #  # ][ #  # ]:          0 :     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_BORDER_CONNECT, aMergeWithNextCB, sfx::ITEMCONN_DEFAULT ) );
                 [ #  # ]
     322         [ #  # ]:          0 :     aMergeWithNextCB.Hide();
     323                 :            :     // checkbox "Merge adjacent line styles" only visible for Writer dialog format.table
     324 [ #  # ][ #  # ]:          0 :     AddItemConnection( new sfx::CheckBoxConnection( SID_SW_COLLAPSING_BORDERS, aMergeAdjacentBordersCB, sfx::ITEMCONN_DEFAULT ) );
                 [ #  # ]
     325         [ #  # ]:          0 :     aMergeAdjacentBordersCB.Hide();
     326                 :          0 : }
     327                 :            : 
     328                 :            : // -----------------------------------------------------------------------
     329                 :            : 
     330 [ #  # ][ #  # ]:          0 : SvxBorderTabPage::~SvxBorderTabPage()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     331                 :            : {
     332         [ #  # ]:          0 : }
     333                 :            : 
     334                 :            : // -----------------------------------------------------------------------
     335                 :            : 
     336                 :          0 : sal_uInt16* SvxBorderTabPage::GetRanges()
     337                 :            : {
     338                 :          0 :     return pRanges;
     339                 :            : }
     340                 :            : 
     341                 :            : // -----------------------------------------------------------------------
     342                 :            : 
     343                 :          0 : SfxTabPage* SvxBorderTabPage::Create( Window* pParent,
     344                 :            :                                       const SfxItemSet& rAttrSet )
     345                 :            : {
     346         [ #  # ]:          0 :     return ( new SvxBorderTabPage( pParent, rAttrSet ) );
     347                 :            : }
     348                 :            : 
     349                 :            : // -----------------------------------------------------------------------
     350                 :            : 
     351                 :          0 : void SvxBorderTabPage::ResetFrameLine_Impl( svx::FrameBorderType eBorder, const SvxBorderLine* pCoreLine, bool bValid )
     352                 :            : {
     353         [ #  # ]:          0 :     if( aFrameSel.IsBorderEnabled( eBorder ) )
     354                 :            :     {
     355         [ #  # ]:          0 :         if( bValid )
     356                 :          0 :             aFrameSel.ShowBorder( eBorder, pCoreLine );
     357                 :            :         else
     358                 :          0 :             aFrameSel.SetBorderDontCare( eBorder );
     359                 :            :     }
     360                 :          0 : }
     361                 :            : 
     362                 :            : // -----------------------------------------------------------------------
     363                 :            : 
     364                 :          0 : void SvxBorderTabPage::Reset( const SfxItemSet& rSet )
     365                 :            : {
     366         [ #  # ]:          0 :     SfxTabPage::Reset( rSet );
     367                 :            : 
     368                 :            :     const SvxBoxItem*       pBoxItem;
     369                 :            :     const SvxBoxInfoItem*   pBoxInfoItem;
     370         [ #  # ]:          0 :     sal_uInt16                  nWhichBox       = GetWhich(SID_ATTR_BORDER_OUTER);
     371                 :            :     SfxMapUnit              eCoreUnit;
     372                 :            : 
     373         [ #  # ]:          0 :     pBoxItem  = (const SvxBoxItem*)GetItem( rSet, SID_ATTR_BORDER_OUTER );
     374                 :            : 
     375         [ #  # ]:          0 :     pBoxInfoItem = (const SvxBoxInfoItem*)GetItem( rSet, SID_ATTR_BORDER_INNER, sal_False );
     376                 :            : 
     377         [ #  # ]:          0 :     eCoreUnit = rSet.GetPool()->GetMetric( nWhichBox );
     378                 :            : 
     379 [ #  # ][ #  # ]:          0 :     if ( pBoxItem && pBoxInfoItem ) // -> Don't Care
     380                 :            :     {
     381         [ #  # ]:          0 :         ResetFrameLine_Impl( svx::FRAMEBORDER_LEFT,   pBoxItem->GetLeft(),     pBoxInfoItem->IsValid( VALID_LEFT ) );
     382         [ #  # ]:          0 :         ResetFrameLine_Impl( svx::FRAMEBORDER_RIGHT,  pBoxItem->GetRight(),    pBoxInfoItem->IsValid( VALID_RIGHT ) );
     383         [ #  # ]:          0 :         ResetFrameLine_Impl( svx::FRAMEBORDER_TOP,    pBoxItem->GetTop(),      pBoxInfoItem->IsValid( VALID_TOP ) );
     384         [ #  # ]:          0 :         ResetFrameLine_Impl( svx::FRAMEBORDER_BOTTOM, pBoxItem->GetBottom(),   pBoxInfoItem->IsValid( VALID_BOTTOM ) );
     385         [ #  # ]:          0 :         ResetFrameLine_Impl( svx::FRAMEBORDER_VER,    pBoxInfoItem->GetVert(), pBoxInfoItem->IsValid( VALID_VERT ) );
     386         [ #  # ]:          0 :         ResetFrameLine_Impl( svx::FRAMEBORDER_HOR,    pBoxInfoItem->GetHori(), pBoxInfoItem->IsValid( VALID_HORI ) );
     387                 :            : 
     388                 :            :         //-------------------
     389                 :            :         // distance inside
     390                 :            :         //-------------------
     391         [ #  # ]:          0 :         if( !mbUseMarginItem )
     392                 :            :         {
     393 [ #  # ][ #  # ]:          0 :             if ( aLeftMF.IsVisible() )
     394                 :            :             {
     395         [ #  # ]:          0 :                 SetMetricValue( aLeftMF,    pBoxInfoItem->GetDefDist(), eCoreUnit );
     396         [ #  # ]:          0 :                 SetMetricValue( aRightMF,   pBoxInfoItem->GetDefDist(), eCoreUnit );
     397         [ #  # ]:          0 :                 SetMetricValue( aTopMF,     pBoxInfoItem->GetDefDist(), eCoreUnit );
     398         [ #  # ]:          0 :                 SetMetricValue( aBottomMF,  pBoxInfoItem->GetDefDist(), eCoreUnit );
     399                 :            : 
     400         [ #  # ]:          0 :                 nMinValue = static_cast<long>(aLeftMF.GetValue());
     401                 :            : 
     402         [ #  # ]:          0 :                 if ( pBoxInfoItem->IsMinDist() )
     403                 :            :                 {
     404         [ #  # ]:          0 :                     aLeftMF.SetFirst( nMinValue );
     405         [ #  # ]:          0 :                     aRightMF.SetFirst( nMinValue );
     406         [ #  # ]:          0 :                     aTopMF.SetFirst( nMinValue );
     407         [ #  # ]:          0 :                     aBottomMF.SetFirst( nMinValue );
     408                 :            :                 }
     409                 :            : 
     410         [ #  # ]:          0 :                 if ( pBoxInfoItem->IsDist() )
     411                 :            :                 {
     412 [ #  # ][ #  # ]:          0 :                     if( rSet.GetItemState( nWhichBox, sal_True ) >= SFX_ITEM_DEFAULT )
     413                 :            :                     {
     414         [ #  # ]:          0 :                         sal_Bool bIsAnyBorderVisible = aFrameSel.IsAnyBorderVisible();
     415 [ #  # ][ #  # ]:          0 :                         if( !bIsAnyBorderVisible || !pBoxInfoItem->IsMinDist() )
                 [ #  # ]
     416                 :            :                         {
     417         [ #  # ]:          0 :                             aLeftMF.SetMin( 0 );
     418         [ #  # ]:          0 :                             aLeftMF.SetFirst( 0 );
     419         [ #  # ]:          0 :                             aRightMF.SetMin( 0 );
     420         [ #  # ]:          0 :                             aRightMF.SetFirst( 0 );
     421         [ #  # ]:          0 :                             aTopMF.SetMin( 0 );
     422         [ #  # ]:          0 :                             aTopMF.SetFirst( 0 );
     423         [ #  # ]:          0 :                             aBottomMF.SetMin( 0 );
     424         [ #  # ]:          0 :                             aBottomMF.SetFirst( 0 );
     425                 :            :                         }
     426         [ #  # ]:          0 :                         long nLeftDist = pBoxItem->GetDistance( BOX_LINE_LEFT);
     427         [ #  # ]:          0 :                         SetMetricValue( aLeftMF, nLeftDist, eCoreUnit );
     428         [ #  # ]:          0 :                         long nRightDist = pBoxItem->GetDistance( BOX_LINE_RIGHT);
     429         [ #  # ]:          0 :                         SetMetricValue( aRightMF, nRightDist, eCoreUnit );
     430         [ #  # ]:          0 :                         long nTopDist = pBoxItem->GetDistance( BOX_LINE_TOP);
     431         [ #  # ]:          0 :                         SetMetricValue( aTopMF, nTopDist, eCoreUnit );
     432         [ #  # ]:          0 :                         long nBottomDist = pBoxItem->GetDistance( BOX_LINE_BOTTOM);
     433         [ #  # ]:          0 :                         SetMetricValue( aBottomMF, nBottomDist, eCoreUnit );
     434                 :            : 
     435                 :            :                         // if the distance is set with no active border line
     436                 :            :                         // or it is null with an active border line
     437                 :            :                         // no automatic changes should be made
     438         [ #  # ]:          0 :                         const long nDefDist = bIsAnyBorderVisible ? pBoxInfoItem->GetDefDist() : 0;
     439                 :            :                         sal_Bool bDiffDist = (nDefDist != nLeftDist ||
     440                 :            :                                     nDefDist != nRightDist ||
     441                 :            :                                     nDefDist != nTopDist   ||
     442 [ #  # ][ #  # ]:          0 :                                     nDefDist != nBottomDist);
         [ #  # ][ #  # ]
     443 [ #  # ][ #  # ]:          0 :                         if((pBoxItem->GetDistance() ||
         [ #  # ][ #  # ]
                 [ #  # ]
     444                 :            :                                 bIsAnyBorderVisible) && bDiffDist )
     445                 :            :                         {
     446         [ #  # ]:          0 :                             aLeftMF.SetModifyFlag();
     447         [ #  # ]:          0 :                             aRightMF.SetModifyFlag();
     448         [ #  # ]:          0 :                             aTopMF.SetModifyFlag();
     449         [ #  # ]:          0 :                             aBottomMF.SetModifyFlag();
     450                 :            :                         }
     451                 :            :                     }
     452                 :            :                     else
     453                 :            :                     {
     454                 :            :                         // #106224# different margins -> do not fill the edits
     455 [ #  # ][ #  # ]:          0 :                         aLeftMF.SetText( String() );
                 [ #  # ]
     456 [ #  # ][ #  # ]:          0 :                         aRightMF.SetText( String() );
                 [ #  # ]
     457 [ #  # ][ #  # ]:          0 :                         aTopMF.SetText( String() );
                 [ #  # ]
     458 [ #  # ][ #  # ]:          0 :                         aBottomMF.SetText( String() );
                 [ #  # ]
     459                 :            :                     }
     460                 :            :                 }
     461         [ #  # ]:          0 :                 aLeftMF.SaveValue();
     462         [ #  # ]:          0 :                 aRightMF.SaveValue();
     463         [ #  # ]:          0 :                 aTopMF.SaveValue();
     464         [ #  # ]:          0 :                 aBottomMF.SaveValue();
     465                 :            :             }
     466                 :          0 :         }
     467                 :            :     }
     468                 :            :     else
     469                 :            :     {
     470                 :            :         // avoid ResetFrameLine-calls:
     471         [ #  # ]:          0 :         aFrameSel.HideAllBorders();
     472                 :            :     }
     473                 :            : 
     474                 :            :     //-------------------------------------------------------------
     475                 :            :     // depict line (color) in controllers if unambiguous:
     476                 :            :     //-------------------------------------------------------------
     477                 :            :     {
     478                 :            :         // Do all visible lines show the same line widths?
     479                 :            :         long nWidth;
     480                 :            :         SvxBorderStyle nStyle;
     481         [ #  # ]:          0 :         bool bWidthEq = aFrameSel.GetVisibleWidth( nWidth, nStyle );
     482         [ #  # ]:          0 :         if( bWidthEq )
     483                 :            :         {
     484                 :            :             // Determine the width first as some styles can be missing depending on it
     485                 :            :             sal_Int64 nWidthPt =  static_cast<sal_Int64>(MetricField::ConvertDoubleValue(
     486         [ #  # ]:          0 :                         sal_Int64( nWidth ), aLineWidthMF.GetDecimalDigits( ),
     487         [ #  # ]:          0 :                         MAP_TWIP,aLineWidthMF.GetUnit() ));
     488         [ #  # ]:          0 :             aLineWidthMF.SetValue( nWidthPt );
     489         [ #  # ]:          0 :             aLbLineStyle.SetWidth( nWidth );
     490                 :            : 
     491                 :            :             // then set the style
     492         [ #  # ]:          0 :             aLbLineStyle.SelectEntry( nStyle );
     493                 :            :         }
     494                 :            :         else
     495         [ #  # ]:          0 :             aLbLineStyle.SelectEntryPos( 1 );
     496                 :            : 
     497                 :            :         // Do all visible lines show the same line color?
     498                 :          0 :         Color aColor;
     499         [ #  # ]:          0 :         bool bColorEq = aFrameSel.GetVisibleColor( aColor );
     500         [ #  # ]:          0 :         if( !bColorEq )
     501                 :          0 :             aColor.SetColor( COL_BLACK );
     502                 :            : 
     503         [ #  # ]:          0 :         sal_uInt16 nSelPos = aLbLineColor.GetEntryPos( aColor );
     504         [ #  # ]:          0 :         if( nSelPos == LISTBOX_ENTRY_NOTFOUND )
     505 [ #  # ][ #  # ]:          0 :             nSelPos = aLbLineColor.InsertEntry( aColor, SVX_RESSTR( RID_SVXSTR_COLOR_USER ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     506                 :            : 
     507         [ #  # ]:          0 :         aLbLineColor.SelectEntryPos( nSelPos );
     508         [ #  # ]:          0 :         aLbLineStyle.SetColor( aColor );
     509                 :            : 
     510                 :            :         // Select all visible lines, if they are all equal.
     511 [ #  # ][ #  # ]:          0 :         if( bWidthEq && bColorEq )
     512         [ #  # ]:          0 :             aFrameSel.SelectAllVisibleBorders();
     513                 :            : 
     514                 :            :         // set the current style and color (caches style in control even if nothing is selected)
     515         [ #  # ]:          0 :         SelStyleHdl_Impl( &aLbLineStyle );
     516         [ #  # ]:          0 :         SelColHdl_Impl( &aLbLineColor );
     517                 :            :     }
     518                 :            : 
     519                 :          0 :     sal_Bool bEnable = aWndShadows.GetSelectItemId() > 1 ;
     520         [ #  # ]:          0 :     aFtShadowSize.Enable(bEnable);
     521         [ #  # ]:          0 :     aEdShadowSize.Enable(bEnable);
     522         [ #  # ]:          0 :     aFtShadowColor.Enable(bEnable);
     523         [ #  # ]:          0 :     aLbShadowColor.Enable(bEnable);
     524                 :            : 
     525         [ #  # ]:          0 :     aWndPresets.SetNoSelection();
     526                 :            : 
     527                 :            :     // - no line - should not be selected
     528                 :            : 
     529 [ #  # ][ #  # ]:          0 :     if ( aLbLineStyle.GetSelectEntryPos() == 0 )
     530                 :            :     {
     531         [ #  # ]:          0 :         aLbLineStyle.SelectEntryPos( 1 );
     532         [ #  # ]:          0 :         SelStyleHdl_Impl( &aLbLineStyle );
     533                 :            :     }
     534                 :            : 
     535                 :            :     const SfxPoolItem* pItem;
     536                 :            :     SfxObjectShell* pShell;
     537 [ #  # ][ #  # ]:          0 :     if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     538                 :            :         ( 0 != (pShell = SfxObjectShell::Current()) &&
     539         [ #  # ]:          0 :                     0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
     540                 :            :     {
     541                 :          0 :         sal_uInt16 nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
     542         [ #  # ]:          0 :         if(nHtmlMode & HTMLMODE_ON)
     543                 :            :         {
     544                 :            :             // there are no shadows in Html-mode and only complete borders
     545         [ #  # ]:          0 :             aFtShadowPos  .Disable();
     546         [ #  # ]:          0 :             aWndShadows   .Disable();
     547         [ #  # ]:          0 :             aFtShadowSize .Disable();
     548         [ #  # ]:          0 :             aEdShadowSize .Disable();
     549         [ #  # ]:          0 :             aFtShadowColor.Disable();
     550         [ #  # ]:          0 :             aLbShadowColor.Disable();
     551         [ #  # ]:          0 :             aFlShadow     .Disable();
     552                 :            : 
     553         [ #  # ]:          0 :             if( !(nSWMode & SW_BORDER_MODE_TABLE) )
     554                 :            :             {
     555         [ #  # ]:          0 :                 aUserDefFT.Disable();
     556         [ #  # ]:          0 :                 aFrameSel.Disable();
     557         [ #  # ]:          0 :                 aWndPresets.RemoveItem(3);
     558         [ #  # ]:          0 :                 aWndPresets.RemoveItem(4);
     559         [ #  # ]:          0 :                 aWndPresets.RemoveItem(5);
     560                 :            :             }
     561                 :            :         }
     562                 :            :     }
     563                 :            : 
     564         [ #  # ]:          0 :     LinesChanged_Impl( 0 );
     565 [ #  # ][ #  # ]:          0 :     if(aLeftMF.GetValue() == aRightMF.GetValue() && aTopMF.GetValue() == aBottomMF.GetValue() && aTopMF.GetValue() == aLeftMF.GetValue())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     566                 :          0 :         mbSync = true;
     567                 :            :     else
     568                 :          0 :         mbSync = false;
     569         [ #  # ]:          0 :     aSynchronizeCB.Check(mbSync);
     570                 :          0 : }
     571                 :            : 
     572                 :            : // -----------------------------------------------------------------------
     573                 :            : 
     574                 :          0 : int SvxBorderTabPage::DeactivatePage( SfxItemSet* _pSet )
     575                 :            : {
     576         [ #  # ]:          0 :     if ( _pSet )
     577                 :          0 :         FillItemSet( *_pSet );
     578                 :            : 
     579                 :          0 :     return LEAVE_PAGE;
     580                 :            : }
     581                 :            : 
     582                 :            : // -----------------------------------------------------------------------
     583                 :            : 
     584                 :          0 : sal_Bool SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs )
     585                 :            : {
     586         [ #  # ]:          0 :     bool bAttrsChanged = SfxTabPage::FillItemSet( rCoreAttrs );
     587                 :            : 
     588                 :          0 :     sal_Bool                  bPut          = sal_True;
     589         [ #  # ]:          0 :     sal_uInt16                nBoxWhich     = GetWhich( SID_ATTR_BORDER_OUTER );
     590         [ #  # ]:          0 :     sal_uInt16                nBoxInfoWhich = rCoreAttrs.GetPool()->GetWhich( SID_ATTR_BORDER_INNER, sal_False );
     591                 :          0 :     const SfxItemSet&     rOldSet       = GetItemSet();
     592         [ #  # ]:          0 :     SvxBoxItem            aBoxItem      ( nBoxWhich );
     593         [ #  # ]:          0 :     SvxBoxInfoItem        aBoxInfoItem  ( nBoxInfoWhich );
     594         [ #  # ]:          0 :     SvxBoxItem* pOldBoxItem = (SvxBoxItem*)GetOldItem( rCoreAttrs, SID_ATTR_BORDER_OUTER );
     595                 :            : 
     596         [ #  # ]:          0 :     SfxMapUnit eCoreUnit = rOldSet.GetPool()->GetMetric( nBoxWhich );
     597                 :          0 :     const SfxPoolItem* pOld = 0;
     598                 :            : 
     599                 :            :     //------------------
     600                 :            :     // outer border:
     601                 :            :     //------------------
     602                 :            :     typedef ::std::pair<svx::FrameBorderType,sal_uInt16> TBorderPair;
     603                 :            :     TBorderPair eTypes1[] = {
     604                 :            :                                 TBorderPair(svx::FRAMEBORDER_TOP,BOX_LINE_TOP),
     605                 :            :                                 TBorderPair(svx::FRAMEBORDER_BOTTOM,BOX_LINE_BOTTOM),
     606                 :            :                                 TBorderPair(svx::FRAMEBORDER_LEFT,BOX_LINE_LEFT),
     607                 :            :                                 TBorderPair(svx::FRAMEBORDER_RIGHT,BOX_LINE_RIGHT),
     608 [ #  # ][ #  # ]:          0 :                             };
         [ #  # ][ #  # ]
     609                 :            : 
     610         [ #  # ]:          0 :     for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(eTypes1); ++i)
     611 [ #  # ][ #  # ]:          0 :         aBoxItem.SetLine( aFrameSel.GetFrameBorderStyle( eTypes1[i].first ), eTypes1[i].second );
     612                 :            : 
     613                 :            :     //--------------------------------
     614                 :            :     // border hor/ver and TableFlag
     615                 :            :     //--------------------------------
     616                 :            :     TBorderPair eTypes2[] = {
     617                 :            :                                 TBorderPair(svx::FRAMEBORDER_HOR,BOXINFO_LINE_HORI),
     618                 :            :                                 TBorderPair(svx::FRAMEBORDER_VER,BOXINFO_LINE_VERT)
     619 [ #  # ][ #  # ]:          0 :                             };
     620         [ #  # ]:          0 :     for (sal_uInt32 j=0; j < SAL_N_ELEMENTS(eTypes2); ++j)
     621 [ #  # ][ #  # ]:          0 :         aBoxInfoItem.SetLine( aFrameSel.GetFrameBorderStyle( eTypes2[j].first ), eTypes2[j].second );
     622                 :            : 
     623                 :          0 :     aBoxInfoItem.EnableHor( mbHorEnabled );
     624                 :          0 :     aBoxInfoItem.EnableVer( mbVerEnabled );
     625                 :            : 
     626                 :            :     //-------------------
     627                 :            :     // inner distance
     628                 :            :     //-------------------
     629 [ #  # ][ #  # ]:          0 :     if( aLeftMF.IsVisible() )
     630                 :            :     {
     631                 :            :         // #i40405# enable distance controls for next dialog call
     632                 :          0 :         aBoxInfoItem.SetDist( sal_True );
     633                 :            : 
     634         [ #  # ]:          0 :         if( !mbUseMarginItem )
     635                 :            :         {
     636                 :            :             // #106224# all edits empty: do nothing
     637 [ #  # ][ #  # ]:          0 :             if( aLeftMF.GetText().Len() || aRightMF.GetText().Len() ||
         [ #  # ][ #  #  
             #  #  #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
     638 [ #  # ][ #  # ]:          0 :                 aTopMF.GetText().Len() || aBottomMF.GetText().Len() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     639                 :            :             {
     640 [ #  # ][ #  # ]:          0 :                 if ( ((mbHorEnabled || mbVerEnabled || (nSWMode & SW_BORDER_MODE_TABLE)) &&
           [ #  #  #  #  
          #  #  #  #  #  
              # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     641                 :          0 :                         (aLeftMF.IsModified()||aRightMF.IsModified()||
     642                 :          0 :                             aTopMF.IsModified()||aBottomMF.IsModified()) )||
     643         [ #  # ]:          0 :                      aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP ) != svx::FRAMESTATE_HIDE
     644         [ #  # ]:          0 :                      || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM ) != svx::FRAMESTATE_HIDE
     645         [ #  # ]:          0 :                      || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT ) != svx::FRAMESTATE_HIDE
     646         [ #  # ]:          0 :                      || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT ) != svx::FRAMESTATE_HIDE )
     647                 :            :                 {
     648                 :            :                     SvxBoxInfoItem* pOldBoxInfoItem = (SvxBoxInfoItem*)GetOldItem(
     649         [ #  # ]:          0 :                                                         rCoreAttrs, SID_ATTR_BORDER_INNER );
     650 [ #  # ][ #  # ]:          0 :                     if (
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     651                 :            :                         !pOldBoxItem ||
     652 [ #  # ][ #  # ]:          0 :                         aLeftMF  .GetText() != aLeftMF  .GetSavedValue() ||
         [ #  # ][ #  # ]
                 [ #  # ]
     653 [ #  # ][ #  # ]:          0 :                         aRightMF .GetText() != aRightMF .GetSavedValue() ||
         [ #  # ][ #  # ]
                 [ #  # ]
     654 [ #  # ][ #  # ]:          0 :                         aTopMF   .GetText() != aTopMF   .GetSavedValue() ||
         [ #  # ][ #  # ]
                 [ #  # ]
     655 [ #  # ][ #  # ]:          0 :                         aBottomMF.GetText() != aBottomMF.GetSavedValue() ||
         [ #  # ][ #  # ]
                 [ #  # ]
     656         [ #  # ]:          0 :                         nMinValue == aLeftMF  .GetValue() ||
     657         [ #  # ]:          0 :                         nMinValue == aRightMF .GetValue() ||
     658         [ #  # ]:          0 :                         nMinValue == aTopMF   .GetValue() ||
     659         [ #  # ]:          0 :                         nMinValue == aBottomMF.GetValue() ||
     660                 :          0 :                         (pOldBoxInfoItem && !pOldBoxInfoItem->IsValid(VALID_DISTANCE))
     661                 :            :                        )
     662                 :            :                     {
     663 [ #  # ][ #  # ]:          0 :                         aBoxItem.SetDistance( (sal_uInt16)GetCoreValue( aLeftMF, eCoreUnit ), BOX_LINE_LEFT  );
     664 [ #  # ][ #  # ]:          0 :                         aBoxItem.SetDistance( (sal_uInt16)GetCoreValue( aRightMF, eCoreUnit ), BOX_LINE_RIGHT );
     665 [ #  # ][ #  # ]:          0 :                         aBoxItem.SetDistance( (sal_uInt16)GetCoreValue( aTopMF, eCoreUnit ), BOX_LINE_TOP   );
     666 [ #  # ][ #  # ]:          0 :                         aBoxItem.SetDistance( (sal_uInt16)GetCoreValue( aBottomMF, eCoreUnit ), BOX_LINE_BOTTOM);
     667                 :            :                     }
     668                 :            :                     else
     669                 :            :                     {
     670 [ #  # ][ #  # ]:          0 :                         aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_LEFT ), BOX_LINE_LEFT);
     671 [ #  # ][ #  # ]:          0 :                         aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_RIGHT),  BOX_LINE_RIGHT);
     672 [ #  # ][ #  # ]:          0 :                         aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_TOP  ), BOX_LINE_TOP);
     673 [ #  # ][ #  # ]:          0 :                         aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_BOTTOM), BOX_LINE_BOTTOM);
     674                 :            :                     }
     675                 :          0 :                     aBoxInfoItem.SetValid( VALID_DISTANCE, sal_True );
     676                 :            :                 }
     677                 :            :                 else
     678                 :          0 :                     aBoxInfoItem.SetValid( VALID_DISTANCE, sal_False );
     679                 :            :             }
     680                 :            :         }
     681                 :            :     }
     682                 :            : 
     683                 :            :     //------------------------------------------
     684                 :            :     // note Don't Care Status in the Info-Item:
     685                 :            :     //------------------------------------------
     686         [ #  # ]:          0 :     aBoxInfoItem.SetValid( VALID_TOP,    aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP )    != svx::FRAMESTATE_DONTCARE );
     687         [ #  # ]:          0 :     aBoxInfoItem.SetValid( VALID_BOTTOM, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM ) != svx::FRAMESTATE_DONTCARE );
     688         [ #  # ]:          0 :     aBoxInfoItem.SetValid( VALID_LEFT,   aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT )   != svx::FRAMESTATE_DONTCARE );
     689         [ #  # ]:          0 :     aBoxInfoItem.SetValid( VALID_RIGHT,  aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT )  != svx::FRAMESTATE_DONTCARE );
     690         [ #  # ]:          0 :     aBoxInfoItem.SetValid( VALID_HORI,   aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_HOR )    != svx::FRAMESTATE_DONTCARE );
     691         [ #  # ]:          0 :     aBoxInfoItem.SetValid( VALID_VERT,   aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_VER )    != svx::FRAMESTATE_DONTCARE );
     692                 :            : 
     693                 :            :     //
     694                 :            :     // Put or Clear of the border?
     695                 :            :     //
     696                 :          0 :     bPut = sal_True;
     697                 :            : 
     698 [ #  # ][ #  # ]:          0 :     if (   SFX_ITEM_DEFAULT == rOldSet.GetItemState( nBoxWhich,     sal_False ))
     699                 :            :     {
     700 [ #  # ][ #  # ]:          0 :         bPut = aBoxItem != (const SvxBoxItem&)(rOldSet.Get(nBoxWhich)) ? sal_True : sal_False;
                 [ #  # ]
     701                 :            :     }
     702 [ #  # ][ #  # ]:          0 :     if(  SFX_ITEM_DEFAULT == rOldSet.GetItemState( nBoxInfoWhich, sal_False ) )
     703                 :            :     {
     704                 :            :         const SvxBoxInfoItem& rOldBoxInfo = (const SvxBoxInfoItem&)
     705         [ #  # ]:          0 :                                 rOldSet.Get(nBoxInfoWhich);
     706                 :            : 
     707                 :          0 :         aBoxInfoItem.SetMinDist( rOldBoxInfo.IsMinDist() );
     708                 :          0 :         aBoxInfoItem.SetDefDist( rOldBoxInfo.GetDefDist() );
     709         [ #  # ]:          0 :         bPut |= (aBoxInfoItem != rOldBoxInfo );
     710                 :            :     }
     711                 :            : 
     712         [ #  # ]:          0 :     if ( bPut )
     713                 :            :     {
     714 [ #  # ][ #  # ]:          0 :         if ( !pOldBoxItem || !( *pOldBoxItem == aBoxItem ) )
         [ #  # ][ #  # ]
     715                 :            :         {
     716         [ #  # ]:          0 :             rCoreAttrs.Put( aBoxItem );
     717                 :          0 :             bAttrsChanged |= sal_True;
     718                 :            :         }
     719         [ #  # ]:          0 :         pOld = GetOldItem( rCoreAttrs, SID_ATTR_BORDER_INNER, sal_False );
     720                 :            : 
     721 [ #  # ][ #  # ]:          0 :         if ( !pOld || !( *(const SvxBoxInfoItem*)pOld == aBoxInfoItem ) )
         [ #  # ][ #  # ]
     722                 :            :         {
     723         [ #  # ]:          0 :             rCoreAttrs.Put( aBoxInfoItem );
     724                 :          0 :             bAttrsChanged |= sal_True;
     725                 :            :         }
     726                 :            :     }
     727                 :            :     else
     728                 :            :     {
     729         [ #  # ]:          0 :         rCoreAttrs.ClearItem( nBoxWhich );
     730         [ #  # ]:          0 :         rCoreAttrs.ClearItem( nBoxInfoWhich );
     731                 :            :     }
     732                 :            : 
     733 [ #  # ][ #  # ]:          0 :     return bAttrsChanged;
     734                 :            : }
     735                 :            : 
     736                 :            : // -----------------------------------------------------------------------
     737                 :            : 
     738                 :          0 : void SvxBorderTabPage::HideShadowControls()
     739                 :            : {
     740                 :          0 :     aFtShadowPos.Hide();
     741                 :          0 :     aWndShadows.Hide();
     742                 :          0 :     aFtShadowSize.Hide();
     743                 :          0 :     aEdShadowSize.Hide();
     744                 :          0 :     aFtShadowColor.Hide();
     745                 :          0 :     aLbShadowColor.Hide();
     746                 :          0 :     aFlShadow.Hide();
     747                 :          0 : }
     748                 :            : 
     749                 :            : // -----------------------------------------------------------------------
     750                 :            : 
     751                 :          0 : IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl)
     752                 :            : {
     753                 :          0 :     const svx::FrameBorderState SHOW = svx::FRAMESTATE_SHOW;
     754                 :          0 :     const svx::FrameBorderState HIDE = svx::FRAMESTATE_HIDE;
     755                 :          0 :     const svx::FrameBorderState DONT = svx::FRAMESTATE_DONTCARE;
     756                 :            : 
     757                 :            :     static const svx::FrameBorderState ppeStates[][ svx::FRAMEBORDERTYPE_COUNT ] =
     758                 :            :     {                   /*    Left  Right Top   Bot   Hor   Ver   TLBR  BLTR */
     759                 :            : /* ---------------------+--------------------------------------------------- */
     760                 :            : /* IID_PRE_CELL_NONE    */  { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
     761                 :            : /* IID_PRE_CELL_ALL     */  { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
     762                 :            : /* IID_PRE_CELL_LR      */  { SHOW, SHOW, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
     763                 :            : /* IID_PRE_CELL_TB      */  { HIDE, HIDE, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
     764                 :            : /* IID_PRE_CELL_L       */  { SHOW, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
     765                 :            : /* IID_PRE_CELL_DIAG    */  { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, SHOW, SHOW },
     766                 :            : /* IID_PRE_HOR_NONE     */  { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
     767                 :            : /* IID_PRE_HOR_OUTER    */  { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
     768                 :            : /* IID_PRE_HOR_HOR      */  { HIDE, HIDE, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE },
     769                 :            : /* IID_PRE_HOR_ALL      */  { SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE },
     770                 :            : /* IID_PRE_HOR_OUTER2   */  { SHOW, SHOW, SHOW, SHOW, DONT, HIDE, HIDE, HIDE },
     771                 :            : /* IID_PRE_VER_NONE     */  { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
     772                 :            : /* IID_PRE_VER_OUTER    */  { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
     773                 :            : /* IID_PRE_VER_VER      */  { SHOW, SHOW, HIDE, HIDE, HIDE, SHOW, HIDE, HIDE },
     774                 :            : /* IID_PRE_VER_ALL      */  { SHOW, SHOW, SHOW, SHOW, HIDE, SHOW, HIDE, HIDE },
     775                 :            : /* IID_PRE_VER_OUTER2   */  { SHOW, SHOW, SHOW, SHOW, HIDE, DONT, HIDE, HIDE },
     776                 :            : /* IID_PRE_TABLE_NONE   */  { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE },
     777                 :            : /* IID_PRE_TABLE_OUTER  */  { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE },
     778                 :            : /* IID_PRE_TABLE_OUTERH */  { SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE },
     779                 :            : /* IID_PRE_TABLE_ALL    */  { SHOW, SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE },
     780                 :            : /* IID_PRE_TABLE_OUTER2 */  { SHOW, SHOW, SHOW, SHOW, DONT, DONT, HIDE, HIDE }
     781                 :            :     };
     782                 :            : 
     783                 :            :     // first hide and deselect all frame borders
     784                 :          0 :     aFrameSel.HideAllBorders();
     785                 :          0 :     aFrameSel.DeselectAllBorders();
     786                 :            : 
     787                 :            :     // Using image ID to find correct line in table above.
     788                 :          0 :     sal_uInt16 nLine = GetPresetImageId( aWndPresets.GetSelectItemId() ) - 1;
     789                 :            : 
     790                 :            :     // Apply all styles from the table
     791         [ #  # ]:          0 :     for( int nBorder = 0; nBorder < svx::FRAMEBORDERTYPE_COUNT; ++nBorder )
     792                 :            :     {
     793                 :          0 :         svx::FrameBorderType eBorder = svx::GetFrameBorderTypeFromIndex( nBorder );
     794   [ #  #  #  # ]:          0 :         switch( ppeStates[ nLine ][ nBorder ] )
     795                 :            :         {
     796                 :          0 :             case SHOW:  aFrameSel.SelectBorder( eBorder );      break;
     797                 :          0 :             case HIDE:  /* nothing to do */                     break;
     798                 :          0 :             case DONT:  aFrameSel.SetBorderDontCare( eBorder ); break;
     799                 :            :         }
     800                 :            :     }
     801                 :            : 
     802                 :            :     // Show all lines that have been selected above
     803         [ #  # ]:          0 :     if( aFrameSel.IsAnyBorderSelected() )
     804                 :            :     {
     805                 :            :         // any visible style, but "no-line" in line list box? -> use hair-line
     806 [ #  # ][ #  # ]:          0 :         if( (aLbLineStyle.GetSelectEntryPos() == 0) || (aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND) )
                 [ #  # ]
     807                 :          0 :             aLbLineStyle.SelectEntryPos( 1 );
     808                 :            : 
     809                 :            :         // set current style to all previously selected lines
     810                 :          0 :         SelStyleHdl_Impl( &aLbLineStyle );
     811                 :          0 :         SelColHdl_Impl( &aLbLineColor );
     812                 :            :     }
     813                 :            : 
     814                 :            :     // Presets ValueSet does not show a selection (used as push buttons).
     815                 :          0 :     aWndPresets.SetNoSelection();
     816                 :            : 
     817                 :          0 :     LinesChanged_Impl( 0 );
     818                 :          0 :     return 0;
     819                 :            : }
     820                 :            : 
     821                 :            : // -----------------------------------------------------------------------
     822                 :            : 
     823                 :          0 : IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl)
     824                 :            : {
     825                 :          0 :     sal_Bool bEnable = aWndShadows.GetSelectItemId() > 1;
     826                 :          0 :     aFtShadowSize.Enable(bEnable);
     827                 :          0 :     aEdShadowSize.Enable(bEnable);
     828                 :          0 :     aFtShadowColor.Enable(bEnable);
     829                 :          0 :     aLbShadowColor.Enable(bEnable);
     830                 :          0 :     return 0;
     831                 :            : }
     832                 :            : 
     833                 :            : // -----------------------------------------------------------------------
     834                 :            : 
     835                 :          0 : IMPL_LINK( SvxBorderTabPage, SelColHdl_Impl, ListBox *, pLb )
     836                 :            : {
     837                 :          0 :     ColorListBox* pColLb = (ColorListBox*)pLb;
     838                 :            : 
     839         [ #  # ]:          0 :     if ( pLb == &aLbLineColor )
     840                 :            :     {
     841         [ #  # ]:          0 :         aFrameSel.SetColorToSelection( pColLb->GetSelectEntryColor() );
     842         [ #  # ]:          0 :         aLbLineStyle.SetColor( pColLb->GetSelectEntryColor() );
     843                 :            :     }
     844                 :            : 
     845                 :          0 :     return 0;
     846                 :            : }
     847                 :            : 
     848                 :          0 : IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthHdl_Impl)
     849                 :            : {
     850                 :            :     sal_Int64 nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(
     851                 :            :                 aLineWidthMF.GetValue( ),
     852                 :          0 :                 aLineWidthMF.GetDecimalDigits( ),
     853                 :          0 :                 aLineWidthMF.GetUnit(), MAP_TWIP ));
     854                 :          0 :     aLbLineStyle.SetWidth( nVal );
     855                 :            : 
     856                 :            :     aFrameSel.SetStyleToSelection( nVal,
     857                 :          0 :         SvxBorderStyle( aLbLineStyle.GetSelectEntryStyle() ) );
     858                 :            : 
     859                 :          0 :     return 0;
     860                 :            : }
     861                 :            : 
     862                 :            : // -----------------------------------------------------------------------
     863                 :            : 
     864                 :          0 : IMPL_LINK( SvxBorderTabPage, SelStyleHdl_Impl, ListBox *, pLb )
     865                 :            : {
     866         [ #  # ]:          0 :     if ( pLb == &aLbLineStyle )
     867                 :            :     {
     868                 :            :         sal_Int64 nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(
     869                 :            :                     aLineWidthMF.GetValue( ),
     870                 :          0 :                     aLineWidthMF.GetDecimalDigits( ),
     871                 :          0 :                     aLineWidthMF.GetUnit(), MAP_TWIP ));
     872                 :            :         aFrameSel.SetStyleToSelection ( nVal,
     873                 :          0 :             SvxBorderStyle( aLbLineStyle.GetSelectEntryStyle() ) );
     874                 :            :     }
     875                 :            : 
     876                 :          0 :     return 0;
     877                 :            : }
     878                 :            : 
     879                 :            : // ============================================================================
     880                 :            : // ValueSet handling
     881                 :            : // ============================================================================
     882                 :            : 
     883                 :            : // number of preset images to show
     884                 :            : const sal_uInt16 SVX_BORDER_PRESET_COUNT = 5;
     885                 :            : 
     886                 :            : // number of shadow images to show
     887                 :            : const sal_uInt16 SVX_BORDER_SHADOW_COUNT = 5;
     888                 :            : 
     889                 :            : // ----------------------------------------------------------------------------
     890                 :            : 
     891                 :          0 : sal_uInt16 SvxBorderTabPage::GetPresetImageId( sal_uInt16 nValueSetIdx ) const
     892                 :            : {
     893                 :            :     // table with all sets of predefined border styles
     894                 :            :     static const sal_uInt16 ppnImgIds[][ SVX_BORDER_PRESET_COUNT ] =
     895                 :            :     {
     896                 :            :         // simple cell without diagonal frame borders
     897                 :            :         {   IID_PRE_CELL_NONE,  IID_PRE_CELL_ALL,       IID_PRE_CELL_LR,        IID_PRE_CELL_TB,    IID_PRE_CELL_L          },
     898                 :            :         // simple cell with diagonal frame borders
     899                 :            :         {   IID_PRE_CELL_NONE,  IID_PRE_CELL_ALL,       IID_PRE_CELL_LR,        IID_PRE_CELL_TB,    IID_PRE_CELL_DIAG       },
     900                 :            :         // with horizontal inner frame border
     901                 :            :         {   IID_PRE_HOR_NONE,   IID_PRE_HOR_OUTER,      IID_PRE_HOR_HOR,        IID_PRE_HOR_ALL,    IID_PRE_HOR_OUTER2      },
     902                 :            :         // with vertical inner frame border
     903                 :            :         {   IID_PRE_VER_NONE,   IID_PRE_VER_OUTER,      IID_PRE_VER_VER,        IID_PRE_VER_ALL,    IID_PRE_VER_OUTER2      },
     904                 :            :         // with horizontal and vertical inner frame borders
     905                 :            :         {   IID_PRE_TABLE_NONE, IID_PRE_TABLE_OUTER,    IID_PRE_TABLE_OUTERH,   IID_PRE_TABLE_ALL,  IID_PRE_TABLE_OUTER2    }
     906                 :            :     };
     907                 :            : 
     908                 :            :     // find correct set of presets
     909                 :          0 :     int nLine = 0;
     910 [ #  # ][ #  # ]:          0 :     if( !mbHorEnabled && !mbVerEnabled )
     911 [ #  # ][ #  # ]:          0 :         nLine = (mbTLBREnabled || mbBLTREnabled) ? 1 : 0;
     912 [ #  # ][ #  # ]:          0 :     else if( mbHorEnabled && !mbVerEnabled )
     913                 :          0 :         nLine = 2;
     914 [ #  # ][ #  # ]:          0 :     else if( !mbHorEnabled && mbVerEnabled )
     915                 :          0 :         nLine = 3;
     916                 :            :     else
     917                 :          0 :         nLine = 4;
     918                 :            : 
     919                 :            :     DBG_ASSERT( (1 <= nValueSetIdx) && (nValueSetIdx <= SVX_BORDER_PRESET_COUNT),
     920                 :            :         "SvxBorderTabPage::GetPresetImageId - wrong index" );
     921                 :          0 :     return ppnImgIds[ nLine ][ nValueSetIdx - 1 ];
     922                 :            : }
     923                 :            : 
     924                 :          0 : sal_uInt16 SvxBorderTabPage::GetPresetStringId( sal_uInt16 nValueSetIdx ) const
     925                 :            : {
     926                 :            :     // string resource IDs for each image (in order of the IID_PRE_* image IDs)
     927                 :            :     static const sal_uInt16 pnStrIds[] =
     928                 :            :     {
     929                 :            :         RID_SVXSTR_TABLE_PRESET_NONE,
     930                 :            :         RID_SVXSTR_PARA_PRESET_ALL,
     931                 :            :         RID_SVXSTR_PARA_PRESET_LEFTRIGHT,
     932                 :            :         RID_SVXSTR_PARA_PRESET_TOPBOTTOM,
     933                 :            :         RID_SVXSTR_PARA_PRESET_ONLYLEFT,
     934                 :            :         RID_SVXSTR_PARA_PRESET_DIAGONAL,
     935                 :            : 
     936                 :            :         RID_SVXSTR_TABLE_PRESET_NONE,
     937                 :            :         RID_SVXSTR_TABLE_PRESET_ONLYOUTER,
     938                 :            :         RID_SVXSTR_HOR_PRESET_ONLYHOR,
     939                 :            :         RID_SVXSTR_TABLE_PRESET_OUTERALL,
     940                 :            :         RID_SVXSTR_TABLE_PRESET_OUTERINNER,
     941                 :            : 
     942                 :            :         RID_SVXSTR_TABLE_PRESET_NONE,
     943                 :            :         RID_SVXSTR_TABLE_PRESET_ONLYOUTER,
     944                 :            :         RID_SVXSTR_VER_PRESET_ONLYVER,
     945                 :            :         RID_SVXSTR_TABLE_PRESET_OUTERALL,
     946                 :            :         RID_SVXSTR_TABLE_PRESET_OUTERINNER,
     947                 :            : 
     948                 :            :         RID_SVXSTR_TABLE_PRESET_NONE,
     949                 :            :         RID_SVXSTR_TABLE_PRESET_ONLYOUTER,
     950                 :            :         RID_SVXSTR_TABLE_PRESET_OUTERHORI,
     951                 :            :         RID_SVXSTR_TABLE_PRESET_OUTERALL,
     952                 :            :         RID_SVXSTR_TABLE_PRESET_OUTERINNER
     953                 :            :     };
     954                 :          0 :     return pnStrIds[ GetPresetImageId( nValueSetIdx ) - 1 ];
     955                 :            : }
     956                 :            : 
     957                 :            : // ----------------------------------------------------------------------------
     958                 :            : 
     959                 :          0 : void SvxBorderTabPage::FillPresetVS()
     960                 :            : {
     961                 :          0 :     ImageList& rImgList = aBorderImgLst;
     962 [ #  # ][ #  # ]:          0 :     Size aImgSize( rImgList.GetImage( IID_PRE_CELL_NONE ).GetSizePixel() );
                 [ #  # ]
     963                 :            : 
     964                 :            :     // basic initialization of the ValueSet
     965         [ #  # ]:          0 :     aWndPresets.SetColCount( SVX_BORDER_PRESET_COUNT );
     966 [ #  # ][ #  # ]:          0 :     aWndPresets.SetStyle( aWndPresets.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
     967 [ #  # ][ #  # ]:          0 :     aWndPresets.SetSizePixel( aWndPresets.CalcWindowSizePixel( aImgSize ) );
     968                 :            : 
     969                 :            :     // insert images and help texts
     970         [ #  # ]:          0 :     for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_PRESET_COUNT; ++nVSIdx )
     971                 :            :     {
     972         [ #  # ]:          0 :         aWndPresets.InsertItem( nVSIdx );
     973 [ #  # ][ #  # ]:          0 :         aWndPresets.SetItemImage( nVSIdx, rImgList.GetImage( GetPresetImageId( nVSIdx ) ) );
                 [ #  # ]
     974 [ #  # ][ #  # ]:          0 :         aWndPresets.SetItemText( nVSIdx, CUI_RESSTR( GetPresetStringId( nVSIdx ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     975                 :            :     }
     976                 :            : 
     977                 :            :     // show the control
     978         [ #  # ]:          0 :     aWndPresets.SetNoSelection();
     979         [ #  # ]:          0 :     aWndPresets.Show();
     980                 :          0 : }
     981                 :            : 
     982                 :            : // ----------------------------------------------------------------------------
     983                 :            : 
     984                 :          0 : void SvxBorderTabPage::FillShadowVS()
     985                 :            : {
     986                 :          0 :     ImageList& rImgList = aShadowImgLst;
     987 [ #  # ][ #  # ]:          0 :     Size aImgSize( rImgList.GetImage( IID_SHADOWNONE ).GetSizePixel() );
                 [ #  # ]
     988                 :            : 
     989                 :            :     // basic initialization of the ValueSet
     990         [ #  # ]:          0 :     aWndShadows.SetColCount( SVX_BORDER_SHADOW_COUNT );
     991 [ #  # ][ #  # ]:          0 :     aWndShadows.SetStyle( aWndShadows.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
     992 [ #  # ][ #  # ]:          0 :     aWndShadows.SetSizePixel( aWndShadows.CalcWindowSizePixel( aImgSize ) );
     993                 :            : 
     994                 :            :     // image resource IDs
     995                 :            :     static const sal_uInt16 pnImgIds[ SVX_BORDER_SHADOW_COUNT ] =
     996                 :            :         { IID_SHADOWNONE, IID_SHADOW_BOT_RIGHT, IID_SHADOW_TOP_RIGHT, IID_SHADOW_BOT_LEFT, IID_SHADOW_TOP_LEFT };
     997                 :            :     // string resource IDs for each image
     998                 :            :     static const sal_uInt16 pnStrIds[ SVX_BORDER_SHADOW_COUNT ] =
     999                 :            :         { RID_SVXSTR_SHADOW_STYLE_NONE, RID_SVXSTR_SHADOW_STYLE_BOTTOMRIGHT, RID_SVXSTR_SHADOW_STYLE_TOPRIGHT, RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT, RID_SVXSTR_SHADOW_STYLE_TOPLEFT };
    1000                 :            : 
    1001                 :            :     // insert images and help texts
    1002         [ #  # ]:          0 :     for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_SHADOW_COUNT; ++nVSIdx )
    1003                 :            :     {
    1004         [ #  # ]:          0 :         aWndShadows.InsertItem( nVSIdx );
    1005 [ #  # ][ #  # ]:          0 :         aWndShadows.SetItemImage( nVSIdx, rImgList.GetImage( pnImgIds[ nVSIdx - 1 ] ) );
                 [ #  # ]
    1006 [ #  # ][ #  # ]:          0 :         aWndShadows.SetItemText( nVSIdx, CUI_RESSTR( pnStrIds[ nVSIdx - 1 ] ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1007                 :            :     }
    1008                 :            : 
    1009                 :            :     // show the control
    1010         [ #  # ]:          0 :     aWndShadows.SelectItem( 1 );
    1011         [ #  # ]:          0 :     aWndShadows.Show();
    1012                 :          0 : }
    1013                 :            : 
    1014                 :            : // ----------------------------------------------------------------------------
    1015                 :            : 
    1016                 :          0 : void SvxBorderTabPage::FillValueSets()
    1017                 :            : {
    1018                 :          0 :     FillPresetVS();
    1019                 :          0 :     FillShadowVS();
    1020                 :          0 : }
    1021                 :            : 
    1022                 :            : // ============================================================================
    1023                 :          0 : Color lcl_mediumColor( Color aMain, Color /*aDefault*/ )
    1024                 :            : {
    1025                 :          0 :     return SvxBorderLine::threeDMediumColor( aMain );
    1026                 :            : }
    1027                 :            : 
    1028                 :          0 : void SvxBorderTabPage::FillLineListBox_Impl()
    1029                 :            : {
    1030                 :            :     using namespace ::com::sun::star::table::BorderLineStyle;
    1031                 :            : 
    1032                 :          0 :     aLbLineStyle.SetSourceUnit( FUNIT_TWIP );
    1033                 :            : 
    1034 [ #  # ][ #  # ]:          0 :     aLbLineStyle.SetNone( SVX_RESSTR( RID_SVXSTR_NONE ) );
         [ #  # ][ #  # ]
    1035                 :            : 
    1036                 :            :     // Simple lines
    1037                 :          0 :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( SOLID ), SOLID );
    1038                 :          0 :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( DOTTED ), DOTTED );
    1039                 :          0 :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( DASHED ), DASHED );
    1040                 :            : 
    1041                 :            :     // Double lines
    1042                 :          0 :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( DOUBLE ), DOUBLE );
    1043                 :          0 :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_SMALLGAP ), THINTHICK_SMALLGAP, 20 );
    1044                 :          0 :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_MEDIUMGAP ), THINTHICK_MEDIUMGAP );
    1045                 :          0 :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_LARGEGAP ), THINTHICK_LARGEGAP );
    1046                 :          0 :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_SMALLGAP ), THICKTHIN_SMALLGAP, 20 );
    1047                 :          0 :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_MEDIUMGAP ), THICKTHIN_MEDIUMGAP );
    1048                 :          0 :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_LARGEGAP ), THICKTHIN_LARGEGAP );
    1049                 :            : 
    1050                 :            :     // Engraved / Embossed
    1051                 :            :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( EMBOSSED ), EMBOSSED, 15,
    1052                 :            :             &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor,
    1053                 :          0 :             &lcl_mediumColor );
    1054                 :            :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( ENGRAVED ), ENGRAVED, 15,
    1055                 :            :             &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor,
    1056                 :          0 :             &lcl_mediumColor );
    1057                 :            : 
    1058                 :            :     // Inset / Outset
    1059                 :            :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 10,
    1060                 :          0 :            &SvxBorderLine::lightColor, &SvxBorderLine::darkColor );
    1061                 :            :     aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 10,
    1062                 :          0 :            &SvxBorderLine::darkColor, &SvxBorderLine::lightColor );
    1063                 :            : 
    1064                 :            :     sal_Int64 nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(
    1065                 :            :                 aLineWidthMF.GetValue( ),
    1066                 :          0 :                 aLineWidthMF.GetDecimalDigits( ),
    1067                 :          0 :                 aLineWidthMF.GetUnit(), MAP_TWIP ));
    1068                 :          0 :     aLbLineStyle.SetWidth( nVal );
    1069                 :          0 : }
    1070                 :            : 
    1071                 :            : // -----------------------------------------------------------------------
    1072                 :          0 : IMPL_LINK_NOARG(SvxBorderTabPage, LinesChanged_Impl)
    1073                 :            : {
    1074 [ #  # ][ #  # ]:          0 :     if(!mbUseMarginItem && aLeftMF.IsVisible())
                 [ #  # ]
    1075                 :            :     {
    1076                 :          0 :         sal_Bool bLineSet = aFrameSel.IsAnyBorderVisible();
    1077                 :          0 :         sal_Bool bMinAllowed = 0 != (nSWMode & (SW_BORDER_MODE_FRAME|SW_BORDER_MODE_TABLE));
    1078                 :          0 :         sal_Bool bSpaceModified =   aLeftMF  .IsModified()||
    1079                 :          0 :                                 aRightMF .IsModified()||
    1080                 :          0 :                                 aTopMF   .IsModified()||
    1081 [ #  # ][ #  #  :          0 :                                 aBottomMF.IsModified();
             #  #  #  # ]
    1082                 :            : 
    1083         [ #  # ]:          0 :         if(bLineSet)
    1084                 :            :         {
    1085         [ #  # ]:          0 :             if(!bMinAllowed)
    1086                 :            :             {
    1087                 :          0 :                 aLeftMF  .SetFirst(nMinValue);
    1088                 :          0 :                 aRightMF .SetFirst(nMinValue);
    1089                 :          0 :                 aTopMF   .SetFirst(nMinValue);
    1090                 :          0 :                 aBottomMF.SetFirst(nMinValue);
    1091                 :            :             }
    1092         [ #  # ]:          0 :             if(!bSpaceModified)
    1093                 :            :             {
    1094                 :          0 :                 aLeftMF  .SetValue(nMinValue);
    1095                 :          0 :                 aRightMF .SetValue(nMinValue);
    1096                 :          0 :                 aTopMF   .SetValue(nMinValue);
    1097                 :          0 :                 aBottomMF.SetValue(nMinValue);
    1098                 :            :             }
    1099                 :            :         }
    1100                 :            :         else
    1101                 :            :         {
    1102                 :          0 :             aLeftMF  .SetMin(0);
    1103                 :          0 :             aRightMF .SetMin(0);
    1104                 :          0 :             aTopMF   .SetMin(0);
    1105                 :          0 :             aBottomMF.SetMin(0);
    1106                 :          0 :             aLeftMF  .SetFirst(0);
    1107                 :          0 :             aRightMF .SetFirst(0);
    1108                 :          0 :             aTopMF   .SetFirst(0);
    1109                 :          0 :             aBottomMF.SetFirst(0);
    1110         [ #  # ]:          0 :             if(!bSpaceModified)
    1111                 :            :             {
    1112                 :          0 :                 aLeftMF  .SetValue(0);
    1113                 :          0 :                 aRightMF .SetValue(0);
    1114                 :          0 :                 aTopMF   .SetValue(0);
    1115                 :          0 :                 aBottomMF.SetValue(0);
    1116                 :            :             }
    1117                 :            :         }
    1118                 :            :         // for tables everything is allowed
    1119                 :          0 :         sal_uInt16 nValid = VALID_TOP|VALID_BOTTOM|VALID_LEFT|VALID_RIGHT;
    1120                 :            : 
    1121                 :            :         // for border and paragraph the edit is disabled, if there's no border set
    1122         [ #  # ]:          0 :         if(nSWMode & (SW_BORDER_MODE_FRAME|SW_BORDER_MODE_PARA))
    1123                 :            :         {
    1124         [ #  # ]:          0 :             if(bLineSet)
    1125                 :            :             {
    1126         [ #  # ]:          0 :                 nValid  = (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP)    == svx::FRAMESTATE_SHOW) ? VALID_TOP : 0;
    1127         [ #  # ]:          0 :                 nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM) == svx::FRAMESTATE_SHOW) ? VALID_BOTTOM : 0;
    1128         [ #  # ]:          0 :                 nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT)   == svx::FRAMESTATE_SHOW) ? VALID_LEFT : 0;
    1129         [ #  # ]:          0 :                 nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT ) == svx::FRAMESTATE_SHOW) ? VALID_RIGHT : 0;
    1130                 :            :             }
    1131                 :            :             else
    1132                 :          0 :                 nValid = 0;
    1133                 :            :         }
    1134                 :          0 :         aLeftFT.Enable(0 != (nValid&VALID_LEFT));
    1135                 :          0 :         aRightFT.Enable(0 != (nValid&VALID_RIGHT));
    1136                 :          0 :         aTopFT.Enable(0 != (nValid&VALID_TOP));
    1137                 :          0 :         aBottomFT.Enable(0 != (nValid&VALID_BOTTOM));
    1138                 :          0 :         aLeftMF.Enable(0 != (nValid&VALID_LEFT));
    1139                 :          0 :         aRightMF.Enable(0 != (nValid&VALID_RIGHT));
    1140                 :          0 :         aTopMF.Enable(0 != (nValid&VALID_TOP));
    1141                 :          0 :         aBottomMF.Enable(0 != (nValid&VALID_BOTTOM));
    1142                 :          0 :         aSynchronizeCB.Enable( aRightMF.IsEnabled() || aTopMF.IsEnabled() ||
    1143 [ #  # ][ #  # ]:          0 :                                aBottomMF.IsEnabled() || aLeftMF.IsEnabled() );
           [ #  #  #  # ]
    1144                 :            :     }
    1145                 :          0 :     return 0;
    1146                 :            : }
    1147                 :            : 
    1148                 :            : // -----------------------------------------------------------------------
    1149                 :            : 
    1150                 :          0 : IMPL_LINK( SvxBorderTabPage, ModifyDistanceHdl_Impl, MetricField*, pField)
    1151                 :            : {
    1152         [ #  # ]:          0 :     if ( mbSync )
    1153                 :            :     {
    1154                 :          0 :         sal_Int64 nVal = pField->GetValue();
    1155         [ #  # ]:          0 :         if(pField != &aLeftMF)
    1156                 :          0 :             aLeftMF.SetValue(nVal);
    1157         [ #  # ]:          0 :         if(pField != &aRightMF)
    1158                 :          0 :             aRightMF.SetValue(nVal);
    1159         [ #  # ]:          0 :         if(pField != &aTopMF)
    1160                 :          0 :             aTopMF.SetValue(nVal);
    1161         [ #  # ]:          0 :         if(pField != &aBottomMF)
    1162                 :          0 :             aBottomMF.SetValue(nVal);
    1163                 :            :     }
    1164                 :          0 :     return 0;
    1165                 :            : }
    1166                 :            : 
    1167                 :          0 : IMPL_LINK( SvxBorderTabPage, SyncHdl_Impl, CheckBox*, pBox)
    1168                 :            : {
    1169                 :          0 :     mbSync = pBox->IsChecked();
    1170                 :          0 :     return 0;
    1171                 :            : }
    1172                 :            : 
    1173                 :          0 : void SvxBorderTabPage::DataChanged( const DataChangedEvent& rDCEvt )
    1174                 :            : {
    1175 [ #  # ][ #  # ]:          0 :     if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
                 [ #  # ]
    1176                 :          0 :         FillValueSets();
    1177                 :            : 
    1178                 :          0 :     SfxTabPage::DataChanged( rDCEvt );
    1179                 :          0 : }
    1180                 :            : 
    1181                 :          0 : void SvxBorderTabPage::PageCreated (SfxAllItemSet aSet)
    1182                 :            : {
    1183                 :          0 :     SFX_ITEMSET_ARG (&aSet,pSWModeItem,SfxUInt16Item,SID_SWMODE_TYPE,sal_False);
    1184                 :          0 :     SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False);
    1185         [ #  # ]:          0 :     if (pSWModeItem)
    1186                 :            :     {
    1187                 :          0 :         nSWMode = pSWModeItem->GetValue();
    1188                 :            :         // #i43593#
    1189                 :            :         // show checkbox <aMergeWithNextCB> for format.paragraph
    1190         [ #  # ]:          0 :         if ( nSWMode == SW_BORDER_MODE_PARA )
    1191                 :            :         {
    1192                 :          0 :             aMergeWithNextCB.Show();
    1193                 :          0 :             aPropertiesFL.Show();
    1194                 :            :         }
    1195                 :            :         // show checkbox <aMergeAdjacentBordersCB> for format.paragraph
    1196         [ #  # ]:          0 :         else if ( nSWMode == SW_BORDER_MODE_TABLE )
    1197                 :            :         {
    1198                 :          0 :             aMergeAdjacentBordersCB.Show();
    1199                 :          0 :             aPropertiesFL.Show();
    1200                 :            :         }
    1201                 :            :     }
    1202         [ #  # ]:          0 :     if (pFlagItem)
    1203         [ #  # ]:          0 :         if ( ( pFlagItem->GetValue() & SVX_HIDESHADOWCTL ) == SVX_HIDESHADOWCTL )
    1204                 :          0 :             HideShadowControls();
    1205                 :          0 : }
    1206                 :            : 
    1207                 :            : // ============================================================================
    1208                 :            : 
    1209                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10