LCOV - code coverage report
Current view: top level - cui/source/tabpages - border.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 577 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 40 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11