LCOV - code coverage report
Current view: top level - cui/source/tabpages - align.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 172 0.0 %
Date: 2014-04-14 Functions: 0 19 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 "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             : #include <vcl/settings.hxx>
      44             : 
      45             : namespace svx {
      46             : 
      47             : // item connections ===========================================================
      48             : 
      49             : // horizontal alignment -------------------------------------------------------
      50             : 
      51             : typedef sfx::ValueItemWrapper< SvxHorJustifyItem, SvxCellHorJustify, sal_uInt16 > HorJustItemWrapper;
      52             : typedef sfx::ListBoxConnection< HorJustItemWrapper > HorJustConnection;
      53             : 
      54             : static const HorJustConnection::MapEntryType s_pHorJustMap[] =
      55             : {
      56             :     { ALIGNDLG_HORALIGN_STD,    SVX_HOR_JUSTIFY_STANDARD    },
      57             :     { ALIGNDLG_HORALIGN_LEFT,   SVX_HOR_JUSTIFY_LEFT        },
      58             :     { ALIGNDLG_HORALIGN_CENTER, SVX_HOR_JUSTIFY_CENTER      },
      59             :     { ALIGNDLG_HORALIGN_RIGHT,  SVX_HOR_JUSTIFY_RIGHT       },
      60             :     { ALIGNDLG_HORALIGN_BLOCK,  SVX_HOR_JUSTIFY_BLOCK       },
      61             :     { ALIGNDLG_HORALIGN_FILL,   SVX_HOR_JUSTIFY_REPEAT      },
      62             :     { ALIGNDLG_HORALIGN_DISTRIBUTED, SVX_HOR_JUSTIFY_BLOCK  },
      63             :     { WRAPPER_LISTBOX_ENTRY_NOTFOUND,   SVX_HOR_JUSTIFY_STANDARD    }
      64             : };
      65             : 
      66             : // vertical alignment ---------------------------------------------------------
      67             : 
      68             : typedef sfx::ValueItemWrapper< SvxVerJustifyItem, SvxCellVerJustify, sal_uInt16 > VerJustItemWrapper;
      69             : typedef sfx::ListBoxConnection< VerJustItemWrapper > VerJustConnection;
      70             : 
      71             : static const VerJustConnection::MapEntryType s_pVerJustMap[] =
      72             : {
      73             :     { ALIGNDLG_VERALIGN_STD,    SVX_VER_JUSTIFY_STANDARD    },
      74             :     { ALIGNDLG_VERALIGN_TOP,    SVX_VER_JUSTIFY_TOP         },
      75             :     { ALIGNDLG_VERALIGN_MID,    SVX_VER_JUSTIFY_CENTER      },
      76             :     { ALIGNDLG_VERALIGN_BOTTOM, SVX_VER_JUSTIFY_BOTTOM      },
      77             :     { ALIGNDLG_VERALIGN_BLOCK,  SVX_VER_JUSTIFY_BLOCK       },
      78             :     { ALIGNDLG_VERALIGN_DISTRIBUTED, SVX_VER_JUSTIFY_BLOCK  },
      79             :     { WRAPPER_LISTBOX_ENTRY_NOTFOUND,   SVX_VER_JUSTIFY_STANDARD    }
      80             : };
      81             : 
      82             : // cell rotate mode -----------------------------------------------------------
      83             : 
      84             : typedef sfx::ValueItemWrapper< SvxRotateModeItem, SvxRotateMode, sal_uInt16 > RotateModeItemWrapper;
      85             : typedef sfx::ValueSetConnection< RotateModeItemWrapper > RotateModeConnection;
      86             : 
      87             : static const RotateModeConnection::MapEntryType s_pRotateModeMap[] =
      88             : {
      89             :     { IID_BOTTOMLOCK,           SVX_ROTATE_MODE_BOTTOM      },
      90             :     { IID_TOPLOCK,              SVX_ROTATE_MODE_TOP         },
      91             :     { IID_CELLLOCK,             SVX_ROTATE_MODE_STANDARD    },
      92             :     { WRAPPER_VALUESET_ITEM_NOTFOUND,   SVX_ROTATE_MODE_STANDARD    }
      93             : };
      94             : 
      95             : 
      96             : 
      97             : static sal_uInt16 s_pRanges[] =
      98             : {
      99             :     SID_ATTR_ALIGN_HOR_JUSTIFY,SID_ATTR_ALIGN_VER_JUSTIFY,
     100             :     SID_ATTR_ALIGN_STACKED,SID_ATTR_ALIGN_LINEBREAK,
     101             :     SID_ATTR_ALIGN_INDENT,SID_ATTR_ALIGN_INDENT,
     102             :     SID_ATTR_ALIGN_DEGREES,SID_ATTR_ALIGN_DEGREES,
     103             :     SID_ATTR_ALIGN_LOCKPOS,SID_ATTR_ALIGN_LOCKPOS,
     104             :     SID_ATTR_ALIGN_HYPHENATION,SID_ATTR_ALIGN_HYPHENATION,
     105             :     SID_ATTR_ALIGN_ASIANVERTICAL,SID_ATTR_ALIGN_ASIANVERTICAL,
     106             :     SID_ATTR_FRAMEDIRECTION,SID_ATTR_FRAMEDIRECTION,
     107             :     SID_ATTR_ALIGN_SHRINKTOFIT,SID_ATTR_ALIGN_SHRINKTOFIT,
     108             :     0
     109             : };
     110             : 
     111             : 
     112             : 
     113             : namespace {
     114             : 
     115             : template<typename _JustContainerType, typename _JustEnumType>
     116           0 : void lcl_MaybeResetAlignToDistro(
     117             :     ListBox& rLB, sal_uInt16 nListPos, const SfxItemSet& rCoreAttrs, sal_uInt16 nWhichAlign, sal_uInt16 nWhichJM, _JustEnumType eBlock)
     118             : {
     119             :     const SfxPoolItem* pItem;
     120           0 :     if (rCoreAttrs.GetItemState(nWhichAlign, true, &pItem) != SFX_ITEM_SET)
     121             :         // alignment not set.
     122           0 :         return;
     123             : 
     124           0 :     const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
     125           0 :     _JustContainerType eVal = static_cast<_JustContainerType>(p->GetEnumValue());
     126           0 :     if (eVal != eBlock)
     127             :         // alignment is not 'justify'.  No need to go further.
     128           0 :         return;
     129             : 
     130           0 :     if (rCoreAttrs.GetItemState(nWhichJM, true, &pItem) != SFX_ITEM_SET)
     131             :         // justification method is not set.
     132           0 :         return;
     133             : 
     134           0 :     p = static_cast<const SfxEnumItem*>(pItem);
     135           0 :     SvxCellJustifyMethod eMethod = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
     136           0 :     if (eMethod == SVX_JUSTIFY_METHOD_DISTRIBUTE)
     137             :         // Select the 'distribute' entry in the specified list box.
     138           0 :         rLB.SelectEntryPos(nListPos);
     139             : }
     140             : 
     141           0 : void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, sal_uInt16 nWhichJM, const ListBox& rLB, sal_uInt16 nListPos)
     142             : {
     143           0 :     SvxCellJustifyMethod eJM = SVX_JUSTIFY_METHOD_AUTO;
     144           0 :     if (rLB.GetSelectEntryPos() == nListPos)
     145           0 :         eJM = SVX_JUSTIFY_METHOD_DISTRIBUTE;
     146             : 
     147           0 :     SvxJustifyMethodItem aItem(eJM, nWhichJM);
     148           0 :     rSet.Put(aItem);
     149           0 : }
     150             : 
     151             : }//namespace
     152             : 
     153             : 
     154             : 
     155           0 : AlignmentTabPage::AlignmentTabPage( Window* pParent, const SfxItemSet& rCoreAttrs ) :
     156             : 
     157           0 :     SfxTabPage( pParent, "CellAlignPage","cui/ui/cellalignment.ui", rCoreAttrs )
     158             : 
     159             : {
     160             :     // text alignment
     161           0 :     get(m_pLbHorAlign,"comboboxHorzAlign");
     162           0 :     get(m_pFtIndent,"labelIndent");
     163           0 :     get(m_pEdIndent,"spinIndentFrom");
     164           0 :     get(m_pFtVerAlign,"labelVertAlign");
     165           0 :     get(m_pLbVerAlign,"comboboxVertAlign");
     166             : 
     167             :     //text rotation
     168           0 :     get(m_pNfRotate,"spinDegrees");
     169           0 :     get(m_pCtrlDial,"dialcontrol");
     170           0 :     get(m_pFtRotate,"labelDegrees");
     171           0 :     get(m_pFtRefEdge,"labelRefEdge");
     172           0 :     get(m_pVsRefEdge,"references");
     173           0 :     get(m_pBoxDirection,"boxDirection");
     174             : 
     175             :     //Asian mode
     176           0 :     get(m_pCbStacked,"checkVertStack");
     177           0 :     get(m_pCbAsianMode,"checkAsianMode");
     178             : 
     179           0 :     m_pOrientHlp = new OrientationHelper(*m_pCtrlDial, *m_pNfRotate, *m_pCbStacked);
     180             : 
     181             :     // Properties
     182           0 :     get(m_pBtnWrap,"checkWrapTextAuto");
     183           0 :     get(m_pBtnHyphen,"checkHyphActive");
     184           0 :     get(m_pBtnShrink,"checkShrinkFitCellSize");
     185           0 :     get(m_pLbFrameDir,"comboTextDirBox");
     186             : 
     187             :     //ValueSet hover strings
     188           0 :     get(m_pFtBotLock,"labelSTR_BOTTOMLOCK");
     189           0 :     get(m_pFtTopLock,"labelSTR_TOPLOCK");
     190           0 :     get(m_pFtCelLock,"labelSTR_CELLLOCK");
     191           0 :     get(m_pFtABCD,"labelABCD");
     192             : 
     193           0 :     get(m_pAlignmentFrame, "alignment");
     194           0 :     get(m_pOrientFrame, "orientation");
     195           0 :     get(m_pPropertiesFrame, "properties");
     196             : 
     197           0 :     m_pCtrlDial->SetText(m_pFtABCD->GetText());
     198             : 
     199           0 :     InitVsRefEgde();
     200             : 
     201             :     // windows to be disabled, if stacked text is turned ON
     202           0 :     m_pOrientHlp->AddDependentWindow( *m_pFtRotate,     TRISTATE_TRUE );
     203           0 :     m_pOrientHlp->AddDependentWindow( *m_pFtRefEdge,    TRISTATE_TRUE );
     204           0 :     m_pOrientHlp->AddDependentWindow( *m_pVsRefEdge,    TRISTATE_TRUE );
     205             :     // windows to be disabled, if stacked text is turned OFF
     206           0 :     m_pOrientHlp->AddDependentWindow( *m_pCbAsianMode,  TRISTATE_FALSE );
     207             : 
     208           0 :     Link aLink = LINK( this, AlignmentTabPage, UpdateEnableHdl );
     209             : 
     210           0 :     m_pLbHorAlign->SetSelectHdl( aLink );
     211           0 :     m_pBtnWrap->SetClickHdl( aLink );
     212             : 
     213             :     // Asian vertical mode
     214           0 :     m_pCbAsianMode->Show( SvtCJKOptions().IsVerticalTextEnabled() );
     215             : 
     216             : 
     217           0 :     if( !SvtLanguageOptions().IsCTLFontEnabled() )
     218             :     {
     219           0 :         m_pBoxDirection->Hide();
     220             :     }
     221             :     else
     222             :     {
     223             :        // CTL frame direction
     224           0 :        m_pLbFrameDir->InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP );
     225           0 :        m_pLbFrameDir->InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP );
     226           0 :        m_pLbFrameDir->InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT );
     227           0 :        m_pBoxDirection->Show();
     228             :     }
     229             : 
     230             :     // This page needs ExchangeSupport.
     231           0 :     SetExchangeSupport();
     232             : 
     233           0 :     AddItemConnection( new HorJustConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, *m_pLbHorAlign, s_pHorJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     234           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_INDENT, *m_pFtIndent, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     235           0 :     AddItemConnection( new sfx::UInt16MetricConnection( SID_ATTR_ALIGN_INDENT, *m_pEdIndent, FUNIT_TWIP, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     236           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_VER_JUSTIFY, *m_pFtVerAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     237           0 :     AddItemConnection( new VerJustConnection( SID_ATTR_ALIGN_VER_JUSTIFY, *m_pLbVerAlign, s_pVerJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     238           0 :     AddItemConnection( new DialControlConnection( SID_ATTR_ALIGN_DEGREES, *m_pCtrlDial, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     239           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_DEGREES, *m_pFtRotate, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     240           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_LOCKPOS, *m_pFtRefEdge, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     241           0 :     AddItemConnection( new RotateModeConnection( SID_ATTR_ALIGN_LOCKPOS, *m_pVsRefEdge, s_pRotateModeMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     242           0 :     AddItemConnection( new OrientStackedConnection( SID_ATTR_ALIGN_STACKED, *m_pOrientHlp ) );
     243           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_STACKED, *m_pCbStacked, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     244           0 :     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_ASIANVERTICAL, *m_pCbAsianMode, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     245           0 :     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_LINEBREAK, *m_pBtnWrap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     246           0 :     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_HYPHENATION, *m_pBtnHyphen, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     247           0 :     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_SHRINKTOFIT, *m_pBtnShrink, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     248           0 :     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_FRAMEDIRECTION, *m_pBoxDirection, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     249           0 :     AddItemConnection( new FrameDirListBoxConnection( SID_ATTR_FRAMEDIRECTION, *m_pLbFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) );
     250             : 
     251           0 : }
     252             : 
     253           0 : AlignmentTabPage::~AlignmentTabPage()
     254             : {
     255           0 :     delete m_pOrientHlp;
     256           0 : }
     257             : 
     258           0 : SfxTabPage* AlignmentTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
     259             : {
     260           0 :     return new AlignmentTabPage( pParent, rAttrSet );
     261             : }
     262             : 
     263           0 : sal_uInt16* AlignmentTabPage::GetRanges()
     264             : {
     265           0 :     return s_pRanges;
     266             : }
     267             : 
     268           0 : bool AlignmentTabPage::FillItemSet( SfxItemSet& rSet )
     269             : {
     270           0 :     bool bChanged = SfxTabPage::FillItemSet(rSet);
     271             : 
     272             :     // Special treatment for distributed alignment; we need to set the justify
     273             :     // method to 'distribute' to distinguish from the normal justification.
     274             : 
     275           0 :     sal_uInt16 nWhichHorJM = GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD);
     276           0 :     lcl_SetJustifyMethodToItemSet(rSet, nWhichHorJM, *m_pLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED);
     277           0 :     if (!bChanged)
     278           0 :         bChanged = HasAlignmentChanged(rSet, nWhichHorJM);
     279             : 
     280           0 :     sal_uInt16 nWhichVerJM = GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD);
     281           0 :     lcl_SetJustifyMethodToItemSet(rSet, nWhichVerJM, *m_pLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED);
     282           0 :     if (!bChanged)
     283           0 :         bChanged = HasAlignmentChanged(rSet, nWhichVerJM);
     284             : 
     285           0 :     return bChanged;
     286             : }
     287             : 
     288           0 : void AlignmentTabPage::Reset( const SfxItemSet& rCoreAttrs )
     289             : {
     290           0 :     SfxTabPage::Reset( rCoreAttrs );
     291             : 
     292             :     // Special treatment for distributed alignment; we need to set the justify
     293             :     // method to 'distribute' to distinguish from the normal justification.
     294             : 
     295             :     lcl_MaybeResetAlignToDistro<SvxCellHorJustify, SvxCellHorJustify>(
     296             :         *m_pLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED, rCoreAttrs,
     297           0 :         GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY), GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD),
     298           0 :         SVX_HOR_JUSTIFY_BLOCK);
     299             : 
     300             :     lcl_MaybeResetAlignToDistro<SvxCellVerJustify, SvxCellVerJustify>(
     301             :         *m_pLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED, rCoreAttrs,
     302           0 :         GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY), GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD),
     303           0 :         SVX_VER_JUSTIFY_BLOCK);
     304             : 
     305           0 :     UpdateEnableControls();
     306           0 : }
     307             : 
     308           0 : int AlignmentTabPage::DeactivatePage( SfxItemSet* _pSet )
     309             : {
     310           0 :     if( _pSet )
     311           0 :         FillItemSet( *_pSet );
     312           0 :     return LEAVE_PAGE;
     313             : }
     314             : 
     315           0 : void AlignmentTabPage::DataChanged( const DataChangedEvent& rDCEvt )
     316             : {
     317           0 :     SfxTabPage::DataChanged( rDCEvt );
     318           0 :     if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
     319             :     {
     320           0 :         svt::OLocalResourceAccess aLocalResAcc( CUI_RES( RID_SVXPAGE_ALIGNMENT ), RSC_TABPAGE );
     321           0 :         InitVsRefEgde();
     322             :     }
     323           0 : }
     324             : 
     325           0 : void AlignmentTabPage::InitVsRefEgde()
     326             : {
     327             :     // remember selection - is deleted in call to ValueSet::Clear()
     328           0 :     sal_uInt16 nSel = m_pVsRefEdge->GetSelectItemId();
     329             : 
     330           0 :     ResId aResId( IL_LOCK_BMPS, CUI_MGR() );
     331           0 :     ImageList aImageList( aResId );
     332             : 
     333           0 :     if( GetDPIScaleFactor() > 1 )
     334             :     {
     335           0 :         for (short i = 0; i < aImageList.GetImageCount(); i++)
     336             :         {
     337           0 :             OUString rImageName = aImageList.GetImageName(i);
     338           0 :             BitmapEx b = aImageList.GetImage(rImageName).GetBitmapEx();
     339           0 :             b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST);
     340           0 :             aImageList.ReplaceImage(rImageName, Image(b));
     341           0 :         }
     342             :     }
     343             : 
     344           0 :     Size aItemSize( aImageList.GetImage( IID_BOTTOMLOCK ).GetSizePixel() );
     345             : 
     346           0 :     m_pVsRefEdge->Clear();
     347           0 :     m_pVsRefEdge->SetStyle( m_pVsRefEdge->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
     348             : 
     349           0 :     m_pVsRefEdge->SetColCount( 3 );
     350           0 :     m_pVsRefEdge->InsertItem( IID_BOTTOMLOCK, aImageList.GetImage( IID_BOTTOMLOCK ),  m_pFtBotLock->GetText() );
     351           0 :     m_pVsRefEdge->InsertItem( IID_TOPLOCK,    aImageList.GetImage( IID_TOPLOCK ),     m_pFtTopLock->GetText() );
     352           0 :     m_pVsRefEdge->InsertItem( IID_CELLLOCK,   aImageList.GetImage( IID_CELLLOCK ),    m_pFtCelLock->GetText() );
     353             : 
     354           0 :     m_pVsRefEdge->SetSizePixel( m_pVsRefEdge->CalcWindowSizePixel( aItemSize ) );
     355             : 
     356           0 :     m_pVsRefEdge->SelectItem( nSel );
     357           0 : }
     358             : 
     359           0 : void AlignmentTabPage::UpdateEnableControls()
     360             : {
     361           0 :     sal_uInt16 nHorAlign = m_pLbHorAlign->GetSelectEntryPos();
     362           0 :     bool bHorLeft  = (nHorAlign == ALIGNDLG_HORALIGN_LEFT);
     363           0 :     bool bHorBlock = (nHorAlign == ALIGNDLG_HORALIGN_BLOCK);
     364           0 :     bool bHorFill  = (nHorAlign == ALIGNDLG_HORALIGN_FILL);
     365           0 :     bool bHorDist  = (nHorAlign == ALIGNDLG_HORALIGN_DISTRIBUTED);
     366             : 
     367             :     // indent edit field only for left alignment
     368           0 :     m_pFtIndent->Enable( bHorLeft );
     369           0 :     m_pEdIndent->Enable( bHorLeft );
     370             : 
     371             :     // rotation/stacked disabled for fill alignment
     372           0 :     m_pOrientHlp->Enable( !bHorFill );
     373             : 
     374             :     // hyphenation only for automatic line breaks or for block alignment
     375           0 :     m_pBtnHyphen->Enable( m_pBtnWrap->IsChecked() || bHorBlock );
     376             : 
     377             :     // shrink only without automatic line break, and not for block, fill or distribute.
     378           0 :     m_pBtnShrink->Enable( (m_pBtnWrap->GetState() == TRISTATE_FALSE) && !bHorBlock && !bHorFill && !bHorDist );
     379             : 
     380             :     // visibility of frames
     381           0 :     m_pAlignmentFrame->Show(m_pLbHorAlign->IsVisible() || m_pEdIndent->IsVisible() ||
     382           0 :         m_pLbVerAlign->IsVisible());
     383           0 :     m_pOrientFrame->Show(m_pCtrlDial->IsVisible() || m_pVsRefEdge->IsVisible() ||
     384           0 :         m_pCbStacked->IsVisible() || m_pCbAsianMode->IsVisible());
     385           0 :     m_pPropertiesFrame->Show(m_pBtnWrap->IsVisible() || m_pBtnHyphen->IsVisible() ||
     386           0 :         m_pBtnShrink->IsVisible() || m_pLbFrameDir->IsVisible());
     387           0 : }
     388             : 
     389           0 : bool AlignmentTabPage::HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 nWhich ) const
     390             : {
     391           0 :     const SfxItemSet& rOld = GetItemSet();
     392             :     const SfxPoolItem* pItem;
     393           0 :     SvxCellJustifyMethod eMethodOld = SVX_JUSTIFY_METHOD_AUTO;
     394           0 :     SvxCellJustifyMethod eMethodNew = SVX_JUSTIFY_METHOD_AUTO;
     395           0 :     if (rOld.GetItemState(nWhich, true, &pItem) == SFX_ITEM_SET)
     396             :     {
     397           0 :         const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
     398           0 :         eMethodOld = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
     399             :     }
     400             : 
     401           0 :     if (rNew.GetItemState(nWhich, true, &pItem) == SFX_ITEM_SET)
     402             :     {
     403           0 :         const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
     404           0 :         eMethodNew = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
     405             :     }
     406             : 
     407           0 :     return eMethodOld != eMethodNew;
     408             : }
     409             : 
     410           0 : IMPL_LINK_NOARG(AlignmentTabPage, UpdateEnableHdl)
     411             : {
     412           0 :     UpdateEnableControls();
     413           0 :     return 0;
     414             : }
     415             : 
     416             : 
     417             : 
     418           0 : } // namespace svx
     419             : 
     420             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10