xref: /aoo41x/main/cui/source/tabpages/align.cxx (revision 2ee96f1c)
1*2ee96f1cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2ee96f1cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2ee96f1cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2ee96f1cSAndrew Rist  * distributed with this work for additional information
6*2ee96f1cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2ee96f1cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2ee96f1cSAndrew Rist  * "License"); you may not use this file except in compliance
9*2ee96f1cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2ee96f1cSAndrew Rist  *
11*2ee96f1cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2ee96f1cSAndrew Rist  *
13*2ee96f1cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2ee96f1cSAndrew Rist  * software distributed under the License is distributed on an
15*2ee96f1cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2ee96f1cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*2ee96f1cSAndrew Rist  * specific language governing permissions and limitations
18*2ee96f1cSAndrew Rist  * under the License.
19*2ee96f1cSAndrew Rist  *
20*2ee96f1cSAndrew Rist  *************************************************************/
21*2ee96f1cSAndrew Rist 
22*2ee96f1cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_cui.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "align.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <editeng/svxenum.hxx>
32cdf0e10cSrcweir #include <svx/dialogs.hrc>
33cdf0e10cSrcweir #include <cuires.hrc>
34cdf0e10cSrcweir #include "align.hrc"
35cdf0e10cSrcweir #include <svx/rotmodit.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <svx/algitem.hxx>
38cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
39cdf0e10cSrcweir #include <dialmgr.hxx>
40cdf0e10cSrcweir #include <svx/dlgutil.hxx>
41cdf0e10cSrcweir #include <tools/shl.hxx>
42cdf0e10cSrcweir #include <sfx2/app.hxx>
43cdf0e10cSrcweir #include <sfx2/module.hxx>
44cdf0e10cSrcweir #include <sfx2/itemconnect.hxx>
45cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
46cdf0e10cSrcweir #include <svl/languageoptions.hxx>
47cdf0e10cSrcweir #include <svtools/localresaccess.hxx>
48cdf0e10cSrcweir #include <svx/flagsdef.hxx>	//CHINA001
49cdf0e10cSrcweir #include <svl/intitem.hxx> //CHINA001
50cdf0e10cSrcweir #include <sfx2/request.hxx> //CHINA001
51cdf0e10cSrcweir 
52cdf0e10cSrcweir namespace svx {
53cdf0e10cSrcweir 
54cdf0e10cSrcweir // item connections ===========================================================
55cdf0e10cSrcweir 
56cdf0e10cSrcweir // horizontal alignment -------------------------------------------------------
57cdf0e10cSrcweir 
58cdf0e10cSrcweir typedef sfx::ValueItemWrapper< SvxHorJustifyItem, SvxCellHorJustify, sal_uInt16 > HorJustItemWrapper;
59cdf0e10cSrcweir typedef sfx::ListBoxConnection< HorJustItemWrapper > HorJustConnection;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir static const HorJustConnection::MapEntryType s_pHorJustMap[] =
62cdf0e10cSrcweir {
63cdf0e10cSrcweir     { ALIGNDLG_HORALIGN_STD,    SVX_HOR_JUSTIFY_STANDARD    },
64cdf0e10cSrcweir     { ALIGNDLG_HORALIGN_LEFT,   SVX_HOR_JUSTIFY_LEFT        },
65cdf0e10cSrcweir     { ALIGNDLG_HORALIGN_CENTER, SVX_HOR_JUSTIFY_CENTER      },
66cdf0e10cSrcweir     { ALIGNDLG_HORALIGN_RIGHT,  SVX_HOR_JUSTIFY_RIGHT       },
67cdf0e10cSrcweir     { ALIGNDLG_HORALIGN_BLOCK,  SVX_HOR_JUSTIFY_BLOCK       },
68cdf0e10cSrcweir     { ALIGNDLG_HORALIGN_FILL,   SVX_HOR_JUSTIFY_REPEAT      },
69cdf0e10cSrcweir     { LISTBOX_ENTRY_NOTFOUND,   SVX_HOR_JUSTIFY_STANDARD    }
70cdf0e10cSrcweir };
71cdf0e10cSrcweir 
72cdf0e10cSrcweir // vertical alignment ---------------------------------------------------------
73cdf0e10cSrcweir 
74cdf0e10cSrcweir typedef sfx::ValueItemWrapper< SvxVerJustifyItem, SvxCellVerJustify, sal_uInt16 > VerJustItemWrapper;
75cdf0e10cSrcweir typedef sfx::ListBoxConnection< VerJustItemWrapper > VerJustConnection;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir static const VerJustConnection::MapEntryType s_pVerJustMap[] =
78cdf0e10cSrcweir {
79cdf0e10cSrcweir     { ALIGNDLG_VERALIGN_STD,    SVX_VER_JUSTIFY_STANDARD    },
80cdf0e10cSrcweir     { ALIGNDLG_VERALIGN_TOP,    SVX_VER_JUSTIFY_TOP         },
81cdf0e10cSrcweir     { ALIGNDLG_VERALIGN_MID,    SVX_VER_JUSTIFY_CENTER      },
82cdf0e10cSrcweir     { ALIGNDLG_VERALIGN_BOTTOM, SVX_VER_JUSTIFY_BOTTOM      },
83cdf0e10cSrcweir     { LISTBOX_ENTRY_NOTFOUND,   SVX_VER_JUSTIFY_STANDARD    }
84cdf0e10cSrcweir };
85cdf0e10cSrcweir 
86cdf0e10cSrcweir // cell rotate mode -----------------------------------------------------------
87cdf0e10cSrcweir 
88cdf0e10cSrcweir typedef sfx::ValueItemWrapper< SvxRotateModeItem, SvxRotateMode, sal_uInt16 > RotateModeItemWrapper;
89cdf0e10cSrcweir typedef sfx::ValueSetConnection< RotateModeItemWrapper > RotateModeConnection;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir static const RotateModeConnection::MapEntryType s_pRotateModeMap[] =
92cdf0e10cSrcweir {
93cdf0e10cSrcweir     { IID_BOTTOMLOCK,           SVX_ROTATE_MODE_BOTTOM      },
94cdf0e10cSrcweir     { IID_TOPLOCK,              SVX_ROTATE_MODE_TOP         },
95cdf0e10cSrcweir     { IID_CELLLOCK,             SVX_ROTATE_MODE_STANDARD    },
96cdf0e10cSrcweir     { VALUESET_ITEM_NOTFOUND,   SVX_ROTATE_MODE_STANDARD    }
97cdf0e10cSrcweir };
98cdf0e10cSrcweir 
99cdf0e10cSrcweir // ============================================================================
100cdf0e10cSrcweir 
101cdf0e10cSrcweir static sal_uInt16 s_pRanges[] =
102cdf0e10cSrcweir {
103cdf0e10cSrcweir     SID_ATTR_ALIGN_HOR_JUSTIFY,SID_ATTR_ALIGN_VER_JUSTIFY,
104cdf0e10cSrcweir     SID_ATTR_ALIGN_STACKED,SID_ATTR_ALIGN_LINEBREAK,
105cdf0e10cSrcweir     SID_ATTR_ALIGN_INDENT,SID_ATTR_ALIGN_INDENT,
106cdf0e10cSrcweir     SID_ATTR_ALIGN_DEGREES,SID_ATTR_ALIGN_DEGREES,
107cdf0e10cSrcweir     SID_ATTR_ALIGN_LOCKPOS,SID_ATTR_ALIGN_LOCKPOS,
108cdf0e10cSrcweir     SID_ATTR_ALIGN_HYPHENATION,SID_ATTR_ALIGN_HYPHENATION,
109cdf0e10cSrcweir     SID_ATTR_ALIGN_ASIANVERTICAL,SID_ATTR_ALIGN_ASIANVERTICAL,
110cdf0e10cSrcweir     SID_ATTR_FRAMEDIRECTION,SID_ATTR_FRAMEDIRECTION,
111cdf0e10cSrcweir     SID_ATTR_ALIGN_SHRINKTOFIT,SID_ATTR_ALIGN_SHRINKTOFIT,
112cdf0e10cSrcweir     0
113cdf0e10cSrcweir };
114cdf0e10cSrcweir 
115cdf0e10cSrcweir // ============================================================================
116cdf0e10cSrcweir 
AlignmentTabPage(Window * pParent,const SfxItemSet & rCoreAttrs)117cdf0e10cSrcweir AlignmentTabPage::AlignmentTabPage( Window* pParent, const SfxItemSet& rCoreAttrs ) :
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_ALIGNMENT ), rCoreAttrs ),
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     maFlAlignment   ( this, CUI_RES( FL_ALIGNMENT ) ),
122cdf0e10cSrcweir     maFtHorAlign    ( this, CUI_RES( FT_HORALIGN ) ),
123cdf0e10cSrcweir     maLbHorAlign    ( this, CUI_RES( LB_HORALIGN ) ),
124cdf0e10cSrcweir     maFtIndent      ( this, CUI_RES( FT_INDENT ) ),
125cdf0e10cSrcweir     maEdIndent      ( this, CUI_RES( ED_INDENT ) ),
126cdf0e10cSrcweir     maFtVerAlign    ( this, CUI_RES( FT_VERALIGN ) ),
127cdf0e10cSrcweir     maLbVerAlign    ( this, CUI_RES( LB_VERALIGN ) ),
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     maFlOrient      ( this, CUI_RES( FL_ORIENTATION ) ),
130cdf0e10cSrcweir     maCtrlDial      ( this, CUI_RES( CTR_DIAL ) ),
131cdf0e10cSrcweir     maFtRotate      ( this, CUI_RES( FT_DEGREES ) ),
132cdf0e10cSrcweir     maNfRotate      ( this, CUI_RES( NF_DEGREES ) ),
133cdf0e10cSrcweir     maFtRefEdge     ( this, CUI_RES( FT_BORDER_LOCK ) ),
134cdf0e10cSrcweir     maVsRefEdge     ( this, CUI_RES( CTR_BORDER_LOCK ) ),
135cdf0e10cSrcweir     maCbStacked     ( this, CUI_RES( BTN_TXTSTACKED ) ),
136cdf0e10cSrcweir     maCbAsianMode   ( this, CUI_RES( BTN_ASIAN_VERTICAL ) ),
137cdf0e10cSrcweir     maOrientHlp     ( maCtrlDial, maNfRotate, maCbStacked ),
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     maFlProperties  ( this, CUI_RES( FL_WRAP ) ),
140cdf0e10cSrcweir     maBtnWrap       ( this, CUI_RES( BTN_WRAP ) ),
141cdf0e10cSrcweir     maBtnHyphen     ( this, CUI_RES( BTN_HYPH ) ),
142cdf0e10cSrcweir     maBtnShrink     ( this, CUI_RES( BTN_SHRINK ) ),
143cdf0e10cSrcweir     maFtFrameDir    ( this, CUI_RES( FT_TEXTFLOW ) ),
144cdf0e10cSrcweir     maLbFrameDir    ( this, CUI_RES( LB_FRAMEDIR ) )
145cdf0e10cSrcweir {
146cdf0e10cSrcweir     InitVsRefEgde();
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     // windows to be disabled, if stacked text is turned ON
149cdf0e10cSrcweir     maOrientHlp.AddDependentWindow( maFtRotate,     STATE_CHECK );
150cdf0e10cSrcweir     maOrientHlp.AddDependentWindow( maFtRefEdge,    STATE_CHECK );
151cdf0e10cSrcweir     maOrientHlp.AddDependentWindow( maVsRefEdge,    STATE_CHECK );
152cdf0e10cSrcweir     // windows to be disabled, if stacked text is turned OFF
153cdf0e10cSrcweir     maOrientHlp.AddDependentWindow( maCbAsianMode,  STATE_NOCHECK );
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     Link aLink = LINK( this, AlignmentTabPage, UpdateEnableHdl );
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     maLbHorAlign.SetSelectHdl( aLink );
158cdf0e10cSrcweir     maBtnWrap.SetClickHdl( aLink );
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     // Asian vertical mode
161cdf0e10cSrcweir     maCbAsianMode.Show( SvtCJKOptions().IsVerticalTextEnabled() );
162cdf0e10cSrcweir 
163cdf0e10cSrcweir     // CTL frame direction
164cdf0e10cSrcweir     maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP );
165cdf0e10cSrcweir     maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP );
166cdf0e10cSrcweir     maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT );
167cdf0e10cSrcweir     if( !SvtLanguageOptions().IsCTLFontEnabled() )
168cdf0e10cSrcweir     {
169cdf0e10cSrcweir         maFtFrameDir.Hide();
170cdf0e10cSrcweir         maLbFrameDir.Hide();
171cdf0e10cSrcweir     }
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 	// diese Page braucht ExchangeSupport
174cdf0e10cSrcweir 	SetExchangeSupport();
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 	FreeResource();
177cdf0e10cSrcweir 
178cdf0e10cSrcweir     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maFtHorAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) );
179cdf0e10cSrcweir     AddItemConnection( new HorJustConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maLbHorAlign, s_pHorJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
180cdf0e10cSrcweir     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_INDENT, maFtIndent, sfx::ITEMCONN_HIDE_UNKNOWN ) );
181cdf0e10cSrcweir     AddItemConnection( new sfx::UInt16MetricConnection( SID_ATTR_ALIGN_INDENT, maEdIndent, FUNIT_TWIP, sfx::ITEMCONN_HIDE_UNKNOWN ) );
182cdf0e10cSrcweir     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maFtVerAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) );
183cdf0e10cSrcweir     AddItemConnection( new VerJustConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maLbVerAlign, s_pVerJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
184cdf0e10cSrcweir     AddItemConnection( new DialControlConnection( SID_ATTR_ALIGN_DEGREES, maCtrlDial, sfx::ITEMCONN_HIDE_UNKNOWN ) );
185cdf0e10cSrcweir     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_DEGREES, maFtRotate, sfx::ITEMCONN_HIDE_UNKNOWN ) );
186cdf0e10cSrcweir     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_LOCKPOS, maFtRefEdge, sfx::ITEMCONN_HIDE_UNKNOWN ) );
187cdf0e10cSrcweir     AddItemConnection( new RotateModeConnection( SID_ATTR_ALIGN_LOCKPOS, maVsRefEdge, s_pRotateModeMap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
188cdf0e10cSrcweir     AddItemConnection( new OrientStackedConnection( SID_ATTR_ALIGN_STACKED, maOrientHlp ) );
189cdf0e10cSrcweir     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_STACKED, maCbStacked, sfx::ITEMCONN_HIDE_UNKNOWN ) );
190cdf0e10cSrcweir     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_ASIANVERTICAL, maCbAsianMode, sfx::ITEMCONN_HIDE_UNKNOWN ) );
191cdf0e10cSrcweir     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_LINEBREAK, maBtnWrap, sfx::ITEMCONN_HIDE_UNKNOWN ) );
192cdf0e10cSrcweir     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_HYPHENATION, maBtnHyphen, sfx::ITEMCONN_HIDE_UNKNOWN ) );
193cdf0e10cSrcweir     AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_SHRINKTOFIT, maBtnShrink, sfx::ITEMCONN_HIDE_UNKNOWN ) );
194cdf0e10cSrcweir     AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_FRAMEDIRECTION, maFtFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) );
195cdf0e10cSrcweir     AddItemConnection( new FrameDirListBoxConnection( SID_ATTR_FRAMEDIRECTION, maLbFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) );
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	maLbHorAlign.SetAccessibleRelationMemberOf( &maFlAlignment );
198cdf0e10cSrcweir 	maEdIndent.SetAccessibleRelationMemberOf( &maFlAlignment );
199cdf0e10cSrcweir 	maLbVerAlign.SetAccessibleRelationMemberOf( &maFlAlignment );
200cdf0e10cSrcweir }
201cdf0e10cSrcweir 
~AlignmentTabPage()202cdf0e10cSrcweir AlignmentTabPage::~AlignmentTabPage()
203cdf0e10cSrcweir {
204cdf0e10cSrcweir }
205cdf0e10cSrcweir 
Create(Window * pParent,const SfxItemSet & rAttrSet)206cdf0e10cSrcweir SfxTabPage* AlignmentTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir     return new AlignmentTabPage( pParent, rAttrSet );
209cdf0e10cSrcweir }
210cdf0e10cSrcweir 
GetRanges()211cdf0e10cSrcweir sal_uInt16* AlignmentTabPage::GetRanges()
212cdf0e10cSrcweir {
213cdf0e10cSrcweir     return s_pRanges;
214cdf0e10cSrcweir }
215cdf0e10cSrcweir 
Reset(const SfxItemSet & rCoreAttrs)216cdf0e10cSrcweir void AlignmentTabPage::Reset( const SfxItemSet& rCoreAttrs )
217cdf0e10cSrcweir {
218cdf0e10cSrcweir     SfxTabPage::Reset( rCoreAttrs );
219cdf0e10cSrcweir     UpdateEnableControls();
220cdf0e10cSrcweir }
221cdf0e10cSrcweir 
DeactivatePage(SfxItemSet * _pSet)222cdf0e10cSrcweir int AlignmentTabPage::DeactivatePage( SfxItemSet* _pSet )
223cdf0e10cSrcweir {
224cdf0e10cSrcweir     if( _pSet )
225cdf0e10cSrcweir         FillItemSet( *_pSet );
226cdf0e10cSrcweir 	return LEAVE_PAGE;
227cdf0e10cSrcweir }
228cdf0e10cSrcweir 
DataChanged(const DataChangedEvent & rDCEvt)229cdf0e10cSrcweir void AlignmentTabPage::DataChanged( const DataChangedEvent& rDCEvt )
230cdf0e10cSrcweir {
231cdf0e10cSrcweir     SfxTabPage::DataChanged( rDCEvt );
232cdf0e10cSrcweir     if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
233cdf0e10cSrcweir     {
234cdf0e10cSrcweir         svt::OLocalResourceAccess aLocalResAcc( CUI_RES( RID_SVXPAGE_ALIGNMENT ), RSC_TABPAGE );
235cdf0e10cSrcweir         InitVsRefEgde();
236cdf0e10cSrcweir     }
237cdf0e10cSrcweir }
238cdf0e10cSrcweir 
InitVsRefEgde()239cdf0e10cSrcweir void AlignmentTabPage::InitVsRefEgde()
240cdf0e10cSrcweir {
241cdf0e10cSrcweir     // remember selection - is deleted in call to ValueSet::Clear()
242cdf0e10cSrcweir     sal_uInt16 nSel = maVsRefEdge.GetSelectItemId();
243cdf0e10cSrcweir 
244cdf0e10cSrcweir     ResId aResId( GetSettings().GetStyleSettings().GetHighContrastMode() ? IL_LOCK_BMPS_HC : IL_LOCK_BMPS, CUI_MGR() );
245cdf0e10cSrcweir     ImageList aImageList( aResId );
246cdf0e10cSrcweir     Size aItemSize( aImageList.GetImage( IID_BOTTOMLOCK ).GetSizePixel() );
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     maVsRefEdge.Clear();
249cdf0e10cSrcweir     maVsRefEdge.SetStyle( maVsRefEdge.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
250cdf0e10cSrcweir 
251cdf0e10cSrcweir     maVsRefEdge.SetColCount( 3 );
252cdf0e10cSrcweir     maVsRefEdge.InsertItem( IID_BOTTOMLOCK, aImageList.GetImage( IID_BOTTOMLOCK ),  String( CUI_RES( STR_BOTTOMLOCK ) ) );
253cdf0e10cSrcweir     maVsRefEdge.InsertItem( IID_TOPLOCK,    aImageList.GetImage( IID_TOPLOCK ),     String( CUI_RES( STR_TOPLOCK ) ) );
254cdf0e10cSrcweir     maVsRefEdge.InsertItem( IID_CELLLOCK,   aImageList.GetImage( IID_CELLLOCK ),    String( CUI_RES( STR_CELLLOCK ) ) );
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     maVsRefEdge.SetSizePixel( maVsRefEdge.CalcWindowSizePixel( aItemSize ) );
257cdf0e10cSrcweir 
258cdf0e10cSrcweir     maVsRefEdge.SelectItem( nSel );
259cdf0e10cSrcweir }
260cdf0e10cSrcweir 
UpdateEnableControls()261cdf0e10cSrcweir void AlignmentTabPage::UpdateEnableControls()
262cdf0e10cSrcweir {
263cdf0e10cSrcweir     sal_uInt16 nHorAlign = maLbHorAlign.GetSelectEntryPos();
264cdf0e10cSrcweir     bool bHorLeft  = (nHorAlign == ALIGNDLG_HORALIGN_LEFT);
265cdf0e10cSrcweir     bool bHorBlock = (nHorAlign == ALIGNDLG_HORALIGN_BLOCK);
266cdf0e10cSrcweir     bool bHorFill  = (nHorAlign == ALIGNDLG_HORALIGN_FILL);
267cdf0e10cSrcweir 
268cdf0e10cSrcweir     // indent edit field only for left alignment
269cdf0e10cSrcweir     maFtIndent.Enable( bHorLeft );
270cdf0e10cSrcweir     maEdIndent.Enable( bHorLeft );
271cdf0e10cSrcweir 
272cdf0e10cSrcweir     // rotation/stacked disabled for fill alignment
273cdf0e10cSrcweir     maOrientHlp.Enable( !bHorFill );
274cdf0e10cSrcweir 
275cdf0e10cSrcweir     // hyphenation only for automatic line breaks or for block alignment
276cdf0e10cSrcweir     maBtnHyphen.Enable( maBtnWrap.IsChecked() || bHorBlock );
277cdf0e10cSrcweir 
278cdf0e10cSrcweir     // shrink only without automatic line break, and not for block and fill
279cdf0e10cSrcweir     maBtnShrink.Enable( (maBtnWrap.GetState() == STATE_NOCHECK) && !bHorBlock && !bHorFill );
280cdf0e10cSrcweir 
281cdf0e10cSrcweir     // visibility of fixed lines
282cdf0e10cSrcweir     maFlAlignment.Show( maLbHorAlign.IsVisible() || maEdIndent.IsVisible() || maLbVerAlign.IsVisible() );
283cdf0e10cSrcweir     maFlOrient.Show( maCtrlDial.IsVisible() || maVsRefEdge.IsVisible() || maCbStacked.IsVisible() || maCbAsianMode.IsVisible() );
284cdf0e10cSrcweir     maFlProperties.Show( maBtnWrap.IsVisible() || maBtnHyphen.IsVisible() || maBtnShrink.IsVisible() || maLbFrameDir.IsVisible() );
285cdf0e10cSrcweir }
286cdf0e10cSrcweir 
IMPL_LINK(AlignmentTabPage,UpdateEnableHdl,void *,EMPTYARG)287cdf0e10cSrcweir IMPL_LINK( AlignmentTabPage, UpdateEnableHdl, void*, EMPTYARG )
288cdf0e10cSrcweir {
289cdf0e10cSrcweir     UpdateEnableControls();
290cdf0e10cSrcweir     return 0;
291cdf0e10cSrcweir }
292cdf0e10cSrcweir 
293cdf0e10cSrcweir // ============================================================================
294cdf0e10cSrcweir 
295cdf0e10cSrcweir } // namespace svx
296cdf0e10cSrcweir 
297