LCOV - code coverage report
Current view: top level - libreoffice/cui/source/tabpages - align.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 158 0.6 %
Date: 2012-12-27 Functions: 2 19 10.5 %
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 "align.hxx"
      21             : 
      22             : #include <editeng/svxenum.hxx>
      23             : #include <svx/dialogs.hrc>
      24             : #include <cuires.hrc>
      25             : #include "align.hrc"
      26             : #include <svx/rotmodit.hxx>
      27             : 
      28             : #include <svx/algitem.hxx>
      29             : #include <editeng/frmdiritem.hxx>
      30             : #include <editeng/justifyitem.hxx>
      31             : #include <dialmgr.hxx>
      32             : #include <svx/dlgutil.hxx>
      33             : #include <tools/shl.hxx>
      34             : #include <sfx2/app.hxx>
      35             : #include <sfx2/module.hxx>
      36             : #include <sfx2/itemconnect.hxx>
      37             : #include <svl/cjkoptions.hxx>
      38             : #include <svl/languageoptions.hxx>
      39             : #include <svtools/localresaccess.hxx>
      40             : #include <svx/flagsdef.hxx>
      41             : #include <svl/intitem.hxx>
      42             : #include <sfx2/request.hxx>
      43             : 
      44             : namespace svx {
      45             : 
      46             : // item connections ===========================================================
      47             : 
      48             : // horizontal alignment -------------------------------------------------------
      49             : 
      50             : typedef sfx::ValueItemWrapper< SvxHorJustifyItem, SvxCellHorJustify, sal_uInt16 > HorJustItemWrapper;
      51             : typedef sfx::ListBoxConnection< HorJustItemWrapper > HorJustConnection;
      52             : 
      53             : static const HorJustConnection::MapEntryType s_pHorJustMap[] =
      54             : {
      55             :     { ALIGNDLG_HORALIGN_STD,    SVX_HOR_JUSTIFY_STANDARD    },
      56             :     { ALIGNDLG_HORALIGN_LEFT,   SVX_HOR_JUSTIFY_LEFT        },
      57             :     { ALIGNDLG_HORALIGN_CENTER, SVX_HOR_JUSTIFY_CENTER      },
      58             :     { ALIGNDLG_HORALIGN_RIGHT,  SVX_HOR_JUSTIFY_RIGHT       },
      59             :     { ALIGNDLG_HORALIGN_BLOCK,  SVX_HOR_JUSTIFY_BLOCK       },
      60             :     { ALIGNDLG_HORALIGN_FILL,   SVX_HOR_JUSTIFY_REPEAT      },
      61             :     { ALIGNDLG_HORALIGN_DISTRIBUTED, SVX_HOR_JUSTIFY_BLOCK  },
      62             :     { LISTBOX_ENTRY_NOTFOUND,   SVX_HOR_JUSTIFY_STANDARD    }
      63             : };
      64             : 
      65             : // vertical alignment ---------------------------------------------------------
      66             : 
      67             : typedef sfx::ValueItemWrapper< SvxVerJustifyItem, SvxCellVerJustify, sal_uInt16 > VerJustItemWrapper;
      68             : typedef sfx::ListBoxConnection< VerJustItemWrapper > VerJustConnection;
      69             : 
      70             : static const VerJustConnection::MapEntryType s_pVerJustMap[] =
      71             : {
      72             :     { ALIGNDLG_VERALIGN_STD,    SVX_VER_JUSTIFY_STANDARD    },
      73             :     { ALIGNDLG_VERALIGN_TOP,    SVX_VER_JUSTIFY_TOP         },
      74             :     { ALIGNDLG_VERALIGN_MID,    SVX_VER_JUSTIFY_CENTER      },
      75             :     { ALIGNDLG_VERALIGN_BOTTOM, SVX_VER_JUSTIFY_BOTTOM      },
      76             :     { ALIGNDLG_VERALIGN_BLOCK,  SVX_VER_JUSTIFY_BLOCK       },
      77             :     { ALIGNDLG_VERALIGN_DISTRIBUTED, SVX_VER_JUSTIFY_BLOCK  },
      78             :     { LISTBOX_ENTRY_NOTFOUND,   SVX_VER_JUSTIFY_STANDARD    }
      79             : };
      80             : 
      81             : // cell rotate mode -----------------------------------------------------------
      82             : 
      83             : typedef sfx::ValueItemWrapper< SvxRotateModeItem, SvxRotateMode, sal_uInt16 > RotateModeItemWrapper;
      84             : typedef sfx::ValueSetConnection< RotateModeItemWrapper > RotateModeConnection;
      85             : 
      86             : static const RotateModeConnection::MapEntryType s_pRotateModeMap[] =
      87             : {
      88             :     { IID_BOTTOMLOCK,           SVX_ROTATE_MODE_BOTTOM      },
      89             :     { IID_TOPLOCK,              SVX_ROTATE_MODE_TOP         },
      90             :     { IID_CELLLOCK,             SVX_ROTATE_MODE_STANDARD    },
      91             :     { VALUESET_ITEM_NOTFOUND,   SVX_ROTATE_MODE_STANDARD    }
      92             : };
      93             : 
      94             : // ============================================================================
      95             : 
      96             : static sal_uInt16 s_pRanges[] =
      97             : {
      98             :     SID_ATTR_ALIGN_HOR_JUSTIFY,SID_ATTR_ALIGN_VER_JUSTIFY,
      99             :     SID_ATTR_ALIGN_STACKED,SID_ATTR_ALIGN_LINEBREAK,
     100             :     SID_ATTR_ALIGN_INDENT,SID_ATTR_ALIGN_INDENT,
     101             :     SID_ATTR_ALIGN_DEGREES,SID_ATTR_ALIGN_DEGREES,
     102             :     SID_ATTR_ALIGN_LOCKPOS,SID_ATTR_ALIGN_LOCKPOS,
     103             :     SID_ATTR_ALIGN_HYPHENATION,SID_ATTR_ALIGN_HYPHENATION,
     104             :     SID_ATTR_ALIGN_ASIANVERTICAL,SID_ATTR_ALIGN_ASIANVERTICAL,
     105             :     SID_ATTR_FRAMEDIRECTION,SID_ATTR_FRAMEDIRECTION,
     106             :     SID_ATTR_ALIGN_SHRINKTOFIT,SID_ATTR_ALIGN_SHRINKTOFIT,
     107             :     0
     108             : };
     109             : 
     110             : // ============================================================================
     111             : 
     112             : namespace {
     113             : 
     114             : template<typename _JustContainerType, typename _JustEnumType>
     115           0 : void lcl_MaybeResetAlignToDistro(
     116             :     ListBox& rLB, sal_uInt16 nListPos, const SfxItemSet& rCoreAttrs, sal_uInt16 nWhichAlign, sal_uInt16 nWhichJM, _JustEnumType eBlock)
     117             : {
     118             :     const SfxPoolItem* pItem;
     119           0 :     if (rCoreAttrs.GetItemState(nWhichAlign, sal_True, &pItem) != SFX_ITEM_SET)
     120             :         // alignment not set.
     121             :         return;
     122             : 
     123           0 :     const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
     124           0 :     _JustContainerType eVal = static_cast<_JustContainerType>(p->GetEnumValue());
     125           0 :     if (eVal != eBlock)
     126             :         // alignment is not 'justify'.  No need to go further.
     127             :         return;
     128             : 
     129           0 :     if (rCoreAttrs.GetItemState(nWhichJM, sal_True, &pItem) != SFX_ITEM_SET)
     130             :         // justification method is not set.
     131             :         return;
     132             : 
     133           0 :     p = static_cast<const SfxEnumItem*>(pItem);
     134           0 :     SvxCellJustifyMethod eMethod = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
     135           0 :     if (eMethod == SVX_JUSTIFY_METHOD_DISTRIBUTE)
     136             :         // Select the 'distribute' entry in the specified list box.
     137           0 :         rLB.SelectEntryPos(nListPos);
     138             : }
     139             : 
     140           0 : void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, sal_uInt16 nWhichJM, const ListBox& rLB, sal_uInt16 nListPos)
     141             : {
     142           0 :     SvxCellJustifyMethod eJM = SVX_JUSTIFY_METHOD_AUTO;
     143           0 :     if (rLB.GetSelectEntryPos() == nListPos)
     144           0 :         eJM = SVX_JUSTIFY_METHOD_DISTRIBUTE;
     145             : 
     146           0 :     SvxJustifyMethodItem aItem(eJM, nWhichJM);
     147           0 :     rSet.Put(aItem);
     148           0 : }
     149             : 
     150             : }
     151             : 
     152             : // ============================================================================
     153             : 
     154           0 : AlignmentTabPage::AlignmentTabPage( Window* pParent, const SfxItemSet& rCoreAttrs ) :
     155             : 
     156           0 :     SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_ALIGNMENT ), rCoreAttrs ),
     157             : 
     158           0 :     maFlAlignment   ( this, CUI_RES( FL_ALIGNMENT ) ),
     159           0 :     maFtHorAlign    ( this, CUI_RES( FT_HORALIGN ) ),
     160           0 :     maLbHorAlign    ( this, CUI_RES( LB_HORALIGN ) ),
     161           0 :     maFtIndent      ( this, CUI_RES( FT_INDENT ) ),
     162           0 :     maEdIndent      ( this, CUI_RES( ED_INDENT ) ),
     163           0 :     maFtVerAlign    ( this, CUI_RES( FT_VERALIGN ) ),
     164           0 :     maLbVerAlign    ( this, CUI_RES( LB_VERALIGN ) ),
     165             : 
     166           0 :     maFlOrient      ( this, CUI_RES( FL_ORIENTATION ) ),
     167           0 :     maCtrlDial      ( this, CUI_RES( CTR_DIAL ) ),
     168           0 :     maFtRotate      ( this, CUI_RES( FT_DEGREES ) ),
     169           0 :     maNfRotate      ( this, CUI_RES( NF_DEGREES ) ),
     170           0 :     maFtRefEdge     ( this, CUI_RES( FT_BORDER_LOCK ) ),
     171           0 :     maVsRefEdge     ( this, CUI_RES( CTR_BORDER_LOCK ) ),
     172           0 :     maCbStacked     ( this, CUI_RES( BTN_TXTSTACKED ) ),
     173           0 :     maCbAsianMode   ( this, CUI_RES( BTN_ASIAN_VERTICAL ) ),
     174             :     maOrientHlp     ( maCtrlDial, maNfRotate, maCbStacked ),
     175             : 
     176           0 :     maFlProperties  ( this, CUI_RES( FL_WRAP ) ),
     177           0 :     maBtnWrap       ( this, CUI_RES( BTN_WRAP ) ),
     178           0 :     maBtnHyphen     ( this, CUI_RES( BTN_HYPH ) ),
     179           0 :     maBtnShrink     ( this, CUI_RES( BTN_SHRINK ) ),
     180           0 :     maFtFrameDir    ( this, CUI_RES( FT_TEXTFLOW ) ),
     181           0 :     maLbFrameDir    ( this, CUI_RES( LB_FRAMEDIR ) )
     182             : {
     183           0 :     InitVsRefEgde();
     184             : 
     185             :     // windows to be disabled, if stacked text is turned ON
     186           0 :     maOrientHlp.AddDependentWindow( maFtRotate,     STATE_CHECK );
     187           0 :     maOrientHlp.AddDependentWindow( maFtRefEdge,    STATE_CHECK );
     188           0 :     maOrientHlp.AddDependentWindow( maVsRefEdge,    STATE_CHECK );
     189             :     // windows to be disabled, if stacked text is turned OFF
     190           0 :     maOrientHlp.AddDependentWindow( maCbAsianMode,  STATE_NOCHECK );
     191             : 
     192           0 :     Link aLink = LINK( this, AlignmentTabPage, UpdateEnableHdl );
     193             : 
     194           0 :     maLbHorAlign.SetSelectHdl( aLink );
     195           0 :     maBtnWrap.SetClickHdl( aLink );
     196             : 
     197             :     // Asian vertical mode
     198           0 :     maCbAsianMode.Show( SvtCJKOptions().IsVerticalTextEnabled() );
     199             : 
     200             :     // CTL frame direction
     201           0 :     maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP );
     202           0 :     maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP );
     203           0 :     maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT );
     204           0 :     if( !SvtLanguageOptions().IsCTLFontEnabled() )
     205             :     {
     206           0 :         maFtFrameDir.Hide();
     207           0 :         maLbFrameDir.Hide();
     208             :     }
     209             : 
     210             :     // This page needs ExchangeSupport.
     211           0 :     SetExchangeSupport();
     212             : 
     213           0 :     FreeResource();
     214             : 
     215           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maFtHorAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     216           0 :     AddItemConnection( new HorJustConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maLbHorAlign, s_pHorJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     217           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_INDENT, maFtIndent, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     218           0 :     AddItemConnection( new sfx::UInt16MetricConnection( SID_ATTR_ALIGN_INDENT, maEdIndent, FUNIT_TWIP, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     219           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maFtVerAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     220           0 :     AddItemConnection( new VerJustConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maLbVerAlign, s_pVerJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     221           0 :     AddItemConnection( new DialControlConnection( SID_ATTR_ALIGN_DEGREES, maCtrlDial, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     222           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_DEGREES, maFtRotate, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     223           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_LOCKPOS, maFtRefEdge, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     224           0 :     AddItemConnection( new RotateModeConnection( SID_ATTR_ALIGN_LOCKPOS, maVsRefEdge, s_pRotateModeMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     225           0 :     AddItemConnection( new OrientStackedConnection( SID_ATTR_ALIGN_STACKED, maOrientHlp ) );
     226           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_STACKED, maCbStacked, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     227           0 :     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_ASIANVERTICAL, maCbAsianMode, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     228           0 :     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_LINEBREAK, maBtnWrap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     229           0 :     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_HYPHENATION, maBtnHyphen, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     230           0 :     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_SHRINKTOFIT, maBtnShrink, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     231           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_FRAMEDIRECTION, maFtFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     232           0 :     AddItemConnection( new FrameDirListBoxConnection( SID_ATTR_FRAMEDIRECTION, maLbFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     233             : 
     234           0 :     maLbHorAlign.SetAccessibleRelationMemberOf( &maFlAlignment );
     235           0 :     maEdIndent.SetAccessibleRelationMemberOf( &maFlAlignment );
     236           0 :     maLbVerAlign.SetAccessibleRelationMemberOf( &maFlAlignment );
     237           0 : }
     238             : 
     239           0 : AlignmentTabPage::~AlignmentTabPage()
     240             : {
     241           0 : }
     242             : 
     243           0 : SfxTabPage* AlignmentTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
     244             : {
     245           0 :     return new AlignmentTabPage( pParent, rAttrSet );
     246             : }
     247             : 
     248           0 : sal_uInt16* AlignmentTabPage::GetRanges()
     249             : {
     250           0 :     return s_pRanges;
     251             : }
     252             : 
     253           0 : sal_Bool AlignmentTabPage::FillItemSet( SfxItemSet& rSet )
     254             : {
     255           0 :     bool bChanged = SfxTabPage::FillItemSet(rSet);
     256             : 
     257             :     // Special treatment for distributed alignment; we need to set the justify
     258             :     // method to 'distribute' to distinguish from the normal justification.
     259             : 
     260           0 :     sal_uInt16 nWhichHorJM = GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD);
     261           0 :     lcl_SetJustifyMethodToItemSet(rSet, nWhichHorJM, maLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED);
     262           0 :     if (!bChanged)
     263           0 :         bChanged = HasAlignmentChanged(rSet, nWhichHorJM);
     264             : 
     265           0 :     sal_uInt16 nWhichVerJM = GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD);
     266           0 :     lcl_SetJustifyMethodToItemSet(rSet, nWhichVerJM, maLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED);
     267           0 :     if (!bChanged)
     268           0 :         bChanged = HasAlignmentChanged(rSet, nWhichVerJM);
     269             : 
     270           0 :     return bChanged;
     271             : }
     272             : 
     273           0 : void AlignmentTabPage::Reset( const SfxItemSet& rCoreAttrs )
     274             : {
     275           0 :     SfxTabPage::Reset( rCoreAttrs );
     276             : 
     277             :     // Special treatment for distributed alignment; we need to set the justify
     278             :     // method to 'distribute' to distinguish from the normal justification.
     279             : 
     280             :     lcl_MaybeResetAlignToDistro<SvxCellHorJustify, SvxCellHorJustify>(
     281             :         maLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED, rCoreAttrs,
     282           0 :         GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY), GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD),
     283           0 :         SVX_HOR_JUSTIFY_BLOCK);
     284             : 
     285             :     lcl_MaybeResetAlignToDistro<SvxCellVerJustify, SvxCellVerJustify>(
     286             :         maLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED, rCoreAttrs,
     287           0 :         GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY), GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD),
     288           0 :         SVX_VER_JUSTIFY_BLOCK);
     289             : 
     290           0 :     UpdateEnableControls();
     291           0 : }
     292             : 
     293           0 : int AlignmentTabPage::DeactivatePage( SfxItemSet* _pSet )
     294             : {
     295           0 :     if( _pSet )
     296           0 :         FillItemSet( *_pSet );
     297           0 :     return LEAVE_PAGE;
     298             : }
     299             : 
     300           0 : void AlignmentTabPage::DataChanged( const DataChangedEvent& rDCEvt )
     301             : {
     302           0 :     SfxTabPage::DataChanged( rDCEvt );
     303           0 :     if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
     304             :     {
     305           0 :         svt::OLocalResourceAccess aLocalResAcc( CUI_RES( RID_SVXPAGE_ALIGNMENT ), RSC_TABPAGE );
     306           0 :         InitVsRefEgde();
     307             :     }
     308           0 : }
     309             : 
     310           0 : void AlignmentTabPage::InitVsRefEgde()
     311             : {
     312             :     // remember selection - is deleted in call to ValueSet::Clear()
     313           0 :     sal_uInt16 nSel = maVsRefEdge.GetSelectItemId();
     314             : 
     315           0 :     ResId aResId( IL_LOCK_BMPS, CUI_MGR() );
     316           0 :     ImageList aImageList( aResId );
     317           0 :     Size aItemSize( aImageList.GetImage( IID_BOTTOMLOCK ).GetSizePixel() );
     318             : 
     319           0 :     maVsRefEdge.Clear();
     320           0 :     maVsRefEdge.SetStyle( maVsRefEdge.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
     321             : 
     322           0 :     maVsRefEdge.SetColCount( 3 );
     323           0 :     maVsRefEdge.InsertItem( IID_BOTTOMLOCK, aImageList.GetImage( IID_BOTTOMLOCK ),  String( CUI_RES( STR_BOTTOMLOCK ) ) );
     324           0 :     maVsRefEdge.InsertItem( IID_TOPLOCK,    aImageList.GetImage( IID_TOPLOCK ),     String( CUI_RES( STR_TOPLOCK ) ) );
     325           0 :     maVsRefEdge.InsertItem( IID_CELLLOCK,   aImageList.GetImage( IID_CELLLOCK ),    String( CUI_RES( STR_CELLLOCK ) ) );
     326             : 
     327           0 :     maVsRefEdge.SetSizePixel( maVsRefEdge.CalcWindowSizePixel( aItemSize ) );
     328             : 
     329           0 :     maVsRefEdge.SelectItem( nSel );
     330           0 : }
     331             : 
     332           0 : void AlignmentTabPage::UpdateEnableControls()
     333             : {
     334           0 :     sal_uInt16 nHorAlign = maLbHorAlign.GetSelectEntryPos();
     335           0 :     bool bHorLeft  = (nHorAlign == ALIGNDLG_HORALIGN_LEFT);
     336           0 :     bool bHorBlock = (nHorAlign == ALIGNDLG_HORALIGN_BLOCK);
     337           0 :     bool bHorFill  = (nHorAlign == ALIGNDLG_HORALIGN_FILL);
     338           0 :     bool bHorDist  = (nHorAlign == ALIGNDLG_HORALIGN_DISTRIBUTED);
     339             : 
     340             :     // indent edit field only for left alignment
     341           0 :     maFtIndent.Enable( bHorLeft );
     342           0 :     maEdIndent.Enable( bHorLeft );
     343             : 
     344             :     // rotation/stacked disabled for fill alignment
     345           0 :     maOrientHlp.Enable( !bHorFill );
     346             : 
     347             :     // hyphenation only for automatic line breaks or for block alignment
     348           0 :     maBtnHyphen.Enable( maBtnWrap.IsChecked() || bHorBlock );
     349             : 
     350             :     // shrink only without automatic line break, and not for block, fill or distribute.
     351           0 :     maBtnShrink.Enable( (maBtnWrap.GetState() == STATE_NOCHECK) && !bHorBlock && !bHorFill && !bHorDist );
     352             : 
     353             :     // visibility of fixed lines
     354           0 :     maFlAlignment.Show( maLbHorAlign.IsVisible() || maEdIndent.IsVisible() || maLbVerAlign.IsVisible() );
     355           0 :     maFlOrient.Show( maCtrlDial.IsVisible() || maVsRefEdge.IsVisible() || maCbStacked.IsVisible() || maCbAsianMode.IsVisible() );
     356           0 :     maFlProperties.Show( maBtnWrap.IsVisible() || maBtnHyphen.IsVisible() || maBtnShrink.IsVisible() || maLbFrameDir.IsVisible() );
     357           0 : }
     358             : 
     359           0 : bool AlignmentTabPage::HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 nWhich ) const
     360             : {
     361           0 :     const SfxItemSet& rOld = GetItemSet();
     362             :     const SfxPoolItem* pItem;
     363           0 :     SvxCellJustifyMethod eMethodOld = SVX_JUSTIFY_METHOD_AUTO;
     364           0 :     SvxCellJustifyMethod eMethodNew = SVX_JUSTIFY_METHOD_AUTO;
     365           0 :     if (rOld.GetItemState(nWhich, sal_True, &pItem) == SFX_ITEM_SET)
     366             :     {
     367           0 :         const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
     368           0 :         eMethodOld = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
     369             :     }
     370             : 
     371           0 :     if (rNew.GetItemState(nWhich, sal_True, &pItem) == SFX_ITEM_SET)
     372             :     {
     373           0 :         const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
     374           0 :         eMethodNew = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
     375             :     }
     376             : 
     377           0 :     return eMethodOld != eMethodNew;
     378             : }
     379             : 
     380           0 : IMPL_LINK_NOARG(AlignmentTabPage, UpdateEnableHdl)
     381             : {
     382           0 :     UpdateEnableControls();
     383           0 :     return 0;
     384             : }
     385             : 
     386             : // ============================================================================
     387             : 
     388           3 : } // namespace svx
     389             : 
     390             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10