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