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