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 <svl/style.hxx>
30 : : #include <sfx2/app.hxx>
31 : : #include <sfx2/objsh.hxx>
32 : : #include <sfx2/module.hxx>
33 : : #include <vcl/mnemonic.hxx>
34 : : #include <svx/dialogs.hrc>
35 : :
36 : : #define _SVX_PARAGRPH_CXX 0
37 : :
38 : : #include <svl/languageoptions.hxx>
39 : : #include <svl/cjkoptions.hxx>
40 : : #include <editeng/pgrditem.hxx>
41 : : #include <cuires.hrc>
42 : : #include "paragrph.hrc"
43 : : #include "paragrph.hxx"
44 : : #include <editeng/frmdiritem.hxx>
45 : : #include <editeng/lspcitem.hxx>
46 : : #include <editeng/adjitem.hxx>
47 : : #include <editeng/orphitem.hxx>
48 : : #include <editeng/widwitem.hxx>
49 : : #include <editeng/tstpitem.hxx>
50 : : #include <editeng/pmdlitem.hxx>
51 : : #include <editeng/spltitem.hxx>
52 : : #include <editeng/hyznitem.hxx>
53 : : #include <editeng/ulspitem.hxx>
54 : : #include <editeng/lrspitem.hxx>
55 : : #include <editeng/brkitem.hxx>
56 : : #include <editeng/keepitem.hxx>
57 : : #include "svx/dlgutil.hxx"
58 : : #include <dialmgr.hxx>
59 : : #include "svx/htmlmode.hxx"
60 : : #include <editeng/paravertalignitem.hxx>
61 : : #include <svl/eitem.hxx>
62 : : #include <sfx2/request.hxx>
63 : : #include <svl/intitem.hxx>
64 : :
65 : : // static ----------------------------------------------------------------
66 : :
67 : : static sal_uInt16 pStdRanges[] =
68 : : {
69 : : SID_ATTR_PARA_LINESPACE, // 10033
70 : : SID_ATTR_PARA_LINESPACE,
71 : : SID_ATTR_LRSPACE, // 10048 -
72 : : SID_ATTR_ULSPACE, // 10049
73 : : SID_ATTR_PARA_REGISTER, // 10413
74 : : SID_ATTR_PARA_REGISTER,
75 : : 0
76 : : };
77 : :
78 : : static sal_uInt16 pAlignRanges[] =
79 : : {
80 : : SID_ATTR_PARA_ADJUST, // 10027
81 : : SID_ATTR_PARA_ADJUST,
82 : : 0
83 : : };
84 : :
85 : : static sal_uInt16 pExtRanges[] =
86 : : {
87 : : SID_ATTR_PARA_PAGEBREAK, // 10037 -
88 : : SID_ATTR_PARA_WIDOWS, // 10041
89 : : SID_ATTR_PARA_MODEL, // 10065 -
90 : : SID_ATTR_PARA_KEEP, // 10066
91 : : 0
92 : : };
93 : :
94 : : // define ----------------------------------------------------------------
95 : :
96 : : #define MAX_DURCH 5670 // 10 cm makes sense as maximum interline lead
97 : : // according to BP
98 : : #define FIX_DIST_DEF 283 // standard fix distance 0,5 cm
99 : :
100 : : // enum ------------------------------------------------------------------
101 : :
102 : : enum LineSpaceList
103 : : {
104 : : LLINESPACE_1 = 0,
105 : : LLINESPACE_15 = 1,
106 : : LLINESPACE_2 = 2,
107 : : LLINESPACE_PROP = 3,
108 : : LLINESPACE_MIN = 4,
109 : : LLINESPACE_DURCH= 5,
110 : : LLINESPACE_FIX = 6,
111 : : LLINESPACE_END
112 : : };
113 : :
114 : : // C-Function ------------------------------------------------------------
115 : :
116 : : void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 );
117 : :
118 : 0 : void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace,
119 : : int eSpace, long lValue )
120 : : {
121 [ # # # # : 0 : switch ( eSpace )
# # # # ]
122 : : {
123 : : case LLINESPACE_1:
124 : 0 : rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
125 : 0 : rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
126 : 0 : break;
127 : :
128 : : case LLINESPACE_15:
129 : 0 : rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
130 : 0 : rLineSpace.SetPropLineSpace( 150 );
131 : 0 : break;
132 : :
133 : : case LLINESPACE_2:
134 : 0 : rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
135 : 0 : rLineSpace.SetPropLineSpace( 200 );
136 : 0 : break;
137 : :
138 : : case LLINESPACE_PROP:
139 : 0 : rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
140 : 0 : rLineSpace.SetPropLineSpace( (sal_uInt8)lValue );
141 : 0 : break;
142 : :
143 : : case LLINESPACE_MIN:
144 : 0 : rLineSpace.SetLineHeight( (sal_uInt16)lValue );
145 : 0 : rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
146 : 0 : break;
147 : :
148 : : case LLINESPACE_DURCH:
149 : 0 : rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
150 : 0 : rLineSpace.SetInterLineSpace( (sal_uInt16)lValue );
151 : 0 : break;
152 : :
153 : : case LLINESPACE_FIX:
154 : 0 : rLineSpace.SetLineHeight((sal_uInt16)lValue);
155 : 0 : rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX;
156 : 0 : rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
157 : 0 : break;
158 : : }
159 : 0 : }
160 : :
161 : :
162 : 0 : sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet)
163 : : {
164 : 0 : sal_uInt16 nHtmlMode = 0;
165 : 0 : const SfxPoolItem* pItem = 0;
166 : : SfxObjectShell* pShell;
167 [ # # ][ # # ]: 0 : if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) ||
[ # # ][ # # ]
[ # # ][ # # ]
168 : : ( 0 != (pShell = SfxObjectShell::Current()) &&
169 [ # # ]: 0 : 0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
170 : : {
171 : 0 : nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
172 : : }
173 : 0 : return nHtmlMode;
174 : :
175 : : }
176 : :
177 : : // class SvxStdParagraphTabPage ------------------------------------------
178 : :
179 : 0 : IMPL_LINK_NOARG(SvxStdParagraphTabPage, ELRLoseFocusHdl)
180 : : {
181 : 0 : SfxItemPool* pPool = GetItemSet().GetPool();
182 : : DBG_ASSERT( pPool, "Wo ist der Pool" );
183 : : FieldUnit eUnit =
184 [ # # ][ # # ]: 0 : MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
[ # # ]
185 : :
186 [ # # ][ # # ]: 0 : sal_Int64 nL = aLeftIndent.Denormalize( aLeftIndent.GetValue( eUnit ) );
187 [ # # ][ # # ]: 0 : sal_Int64 nR = aRightIndent.Denormalize( aRightIndent.GetValue( eUnit ) );
188 [ # # ]: 0 : String aTmp = aFLineIndent.GetText();
189 : :
190 [ # # ]: 0 : if( aLeftIndent.GetMin() < 0 )
191 [ # # ]: 0 : aFLineIndent.SetMin( -99999, FUNIT_MM );
192 : : else
193 [ # # ][ # # ]: 0 : aFLineIndent.SetMin( aFLineIndent.Normalize( -nL ), eUnit );
194 : :
195 : : // Check only for concrete width (Shell)
196 : 0 : sal_Int64 nTmp = nWidth - nL - nR - MM50;
197 [ # # ][ # # ]: 0 : aFLineIndent.SetMax( aFLineIndent.Normalize( nTmp ), eUnit );
198 : :
199 [ # # ]: 0 : if ( !aTmp.Len() )
200 [ # # ]: 0 : aFLineIndent.SetEmptyFieldValue();
201 : : // maximum left right
202 [ # # ][ # # ]: 0 : aTmp = aLeftIndent.GetText();
[ # # ]
203 : 0 : nTmp = nWidth - nR - MM50;
204 [ # # ][ # # ]: 0 : aLeftIndent.SetMax( aLeftIndent.Normalize( nTmp ), eUnit );
205 : :
206 [ # # ]: 0 : if ( !aTmp.Len() )
207 [ # # ]: 0 : aLeftIndent.SetEmptyFieldValue();
208 [ # # ][ # # ]: 0 : aTmp = aRightIndent.GetText();
[ # # ]
209 : 0 : nTmp = nWidth - nL - MM50;
210 [ # # ][ # # ]: 0 : aRightIndent.SetMax( aRightIndent.Normalize( nTmp ), eUnit );
211 : :
212 [ # # ]: 0 : if ( !aTmp.Len() )
213 [ # # ]: 0 : aRightIndent.SetEmptyFieldValue();
214 [ # # ]: 0 : return 0;
215 : : }
216 : :
217 : : // -----------------------------------------------------------------------
218 : :
219 : 0 : SfxTabPage* SvxStdParagraphTabPage::Create( Window* pParent,
220 : : const SfxItemSet& rSet)
221 : : {
222 [ # # ]: 0 : return new SvxStdParagraphTabPage( pParent, rSet );
223 : : }
224 : :
225 : : // -----------------------------------------------------------------------
226 : :
227 : 0 : sal_Bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet& rOutSet )
228 : : {
229 : 0 : SfxItemState eState = SFX_ITEM_UNKNOWN;
230 : 0 : const SfxPoolItem* pOld = 0;
231 : 0 : SfxItemPool* pPool = rOutSet.GetPool();
232 : : DBG_ASSERT( pPool, "Wo ist der Pool" );
233 : :
234 : 0 : sal_Bool bModified = sal_False;
235 : : sal_uInt16 nWhich;
236 : 0 : sal_uInt16 nPos = aLineDist.GetSelectEntryPos();
237 : :
238 [ # # ][ # # : 0 : if ( LISTBOX_ENTRY_NOTFOUND != nPos &&
# # # # #
# ]
239 : 0 : ( nPos != aLineDist.GetSavedValue() ||
240 : 0 : aLineDistAtPercentBox.IsValueModified() ||
241 : 0 : aLineDistAtMetricBox.IsValueModified() ) )
242 : : {
243 [ # # ]: 0 : nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
244 [ # # ]: 0 : SfxMapUnit eUnit = pPool->GetMetric( nWhich );
245 : : SvxLineSpacingItem aSpacing(
246 [ # # ][ # # ]: 0 : (const SvxLineSpacingItem&)GetItemSet().Get( nWhich ) );
247 : :
248 [ # # # # ]: 0 : switch ( nPos )
249 : : {
250 : : case LLINESPACE_1:
251 : : case LLINESPACE_15:
252 : : case LLINESPACE_2:
253 : 0 : SetLineSpace_Impl( aSpacing, nPos );
254 : 0 : break;
255 : :
256 : : case LLINESPACE_PROP:
257 : : SetLineSpace_Impl( aSpacing, nPos,
258 : : static_cast<long>(aLineDistAtPercentBox.Denormalize(
259 [ # # ][ # # ]: 0 : aLineDistAtPercentBox.GetValue() )) );
260 : 0 : break;
261 : :
262 : : case LLINESPACE_MIN:
263 : : case LLINESPACE_DURCH:
264 : : case LLINESPACE_FIX:
265 : : SetLineSpace_Impl( aSpacing, nPos,
266 [ # # ]: 0 : GetCoreValue( aLineDistAtMetricBox, eUnit ) );
267 : 0 : break;
268 : :
269 : : default:
270 : : OSL_FAIL( "unbekannter Type fuer Zeilenabstand." );
271 : 0 : break;
272 : : }
273 [ # # ]: 0 : eState = GetItemSet().GetItemState( nWhich );
274 [ # # ]: 0 : pOld = GetOldItem( rOutSet, SID_ATTR_PARA_LINESPACE );
275 : :
276 [ # # ][ # # ]: 0 : if ( !pOld || !( *(const SvxLineSpacingItem*)pOld == aSpacing ) ||
[ # # ][ # # ]
[ # # ]
277 : : SFX_ITEM_DONTCARE == eState )
278 : : {
279 [ # # ]: 0 : rOutSet.Put( aSpacing );
280 : 0 : bModified = sal_True;
281 [ # # ]: 0 : }
282 : : }
283 : :
284 [ # # ]: 0 : if ( aTopDist.IsValueModified() || aBottomDist.IsValueModified()
[ # # # # ]
[ # # ]
285 : 0 : || aContextualCB.GetSavedValue() != aContextualCB.IsChecked())
286 : : {
287 [ # # ]: 0 : nWhich = GetWhich( SID_ATTR_ULSPACE );
288 [ # # ]: 0 : SfxMapUnit eUnit = pPool->GetMetric( nWhich );
289 [ # # ]: 0 : pOld = GetOldItem( rOutSet, SID_ATTR_ULSPACE );
290 [ # # ]: 0 : SvxULSpaceItem aMargin( nWhich );
291 : :
292 [ # # ]: 0 : if ( bRelativeMode )
293 : : {
294 : : DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
295 : :
296 : : const SvxULSpaceItem& rOldItem =
297 [ # # ]: 0 : (const SvxULSpaceItem&)GetItemSet().GetParent()->Get( nWhich );
298 : :
299 [ # # ]: 0 : if ( aTopDist.IsRelative() )
300 : 0 : aMargin.SetUpper( rOldItem.GetUpper(),
301 [ # # ]: 0 : (sal_uInt16)aTopDist.GetValue() );
302 : : else
303 [ # # ]: 0 : aMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopDist, eUnit ) );
304 : :
305 [ # # ]: 0 : if ( aBottomDist.IsRelative() )
306 : 0 : aMargin.SetLower( rOldItem.GetLower(),
307 [ # # ]: 0 : (sal_uInt16)aBottomDist.GetValue() );
308 : : else
309 [ # # ]: 0 : aMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomDist, eUnit ) );
310 : :
311 : : }
312 : : else
313 : : {
314 [ # # ]: 0 : aMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopDist, eUnit ) );
315 [ # # ]: 0 : aMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomDist, eUnit ) );
316 : : }
317 [ # # ]: 0 : aMargin.SetContextValue(aContextualCB.IsChecked());
318 [ # # ]: 0 : eState = GetItemSet().GetItemState( nWhich );
319 : :
320 [ # # ][ # # ]: 0 : if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aMargin ) ||
[ # # ][ # # ]
[ # # ]
321 : : SFX_ITEM_DONTCARE == eState )
322 : : {
323 [ # # ]: 0 : rOutSet.Put( aMargin );
324 : 0 : bModified = sal_True;
325 [ # # ]: 0 : }
326 : : }
327 : 0 : bool bNullTab = false;
328 : :
329 [ # # # # : 0 : if ( aLeftIndent.IsValueModified() ||
# # # # ]
[ # # ]
330 : 0 : aFLineIndent.IsValueModified() ||
331 : 0 : aRightIndent.IsValueModified()
332 : 0 : || aAutoCB.GetSavedValue() != aAutoCB.IsChecked() )
333 : : {
334 [ # # ]: 0 : nWhich = GetWhich( SID_ATTR_LRSPACE );
335 [ # # ]: 0 : SfxMapUnit eUnit = pPool->GetMetric( nWhich );
336 [ # # ]: 0 : SvxLRSpaceItem aMargin( nWhich );
337 [ # # ]: 0 : pOld = GetOldItem( rOutSet, SID_ATTR_LRSPACE );
338 : :
339 [ # # ]: 0 : if ( bRelativeMode )
340 : : {
341 : : DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
342 : :
343 : : const SvxLRSpaceItem& rOldItem =
344 [ # # ]: 0 : (const SvxLRSpaceItem&)GetItemSet().GetParent()->Get( nWhich );
345 : :
346 [ # # ]: 0 : if ( aLeftIndent.IsRelative() )
347 : : aMargin.SetTxtLeft( rOldItem.GetTxtLeft(),
348 [ # # ][ # # ]: 0 : (sal_uInt16)aLeftIndent.GetValue() );
349 : : else
350 [ # # ][ # # ]: 0 : aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) );
351 : :
352 [ # # ]: 0 : if ( aRightIndent.IsRelative() )
353 : : aMargin.SetRight( rOldItem.GetRight(),
354 [ # # ]: 0 : (sal_uInt16)aRightIndent.GetValue() );
355 : : else
356 [ # # ]: 0 : aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) );
357 : :
358 [ # # ]: 0 : if ( aFLineIndent.IsRelative() )
359 : 0 : aMargin.SetTxtFirstLineOfst( rOldItem.GetTxtFirstLineOfst(),
360 [ # # # # ]: 0 : (sal_uInt16)aFLineIndent.GetValue() );
361 : : else
362 : : aMargin.SetTxtFirstLineOfst(
363 [ # # ][ # # ]: 0 : (sal_uInt16)GetCoreValue( aFLineIndent, eUnit ) );
364 : : }
365 : : else
366 : : {
367 [ # # ][ # # ]: 0 : aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) );
368 [ # # ]: 0 : aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) );
369 : : aMargin.SetTxtFirstLineOfst(
370 [ # # ][ # # ]: 0 : (sal_uInt16)GetCoreValue( aFLineIndent, eUnit ) );
371 : : }
372 [ # # ]: 0 : aMargin.SetAutoFirst(aAutoCB.IsChecked());
373 [ # # ]: 0 : if ( aMargin.GetTxtFirstLineOfst() < 0 )
374 : 0 : bNullTab = true;
375 [ # # ]: 0 : eState = GetItemSet().GetItemState( nWhich );
376 : :
377 [ # # ][ # # ]: 0 : if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) ||
[ # # ][ # # ]
[ # # ]
378 : : SFX_ITEM_DONTCARE == eState )
379 : : {
380 [ # # ]: 0 : rOutSet.Put( aMargin );
381 : 0 : bModified = sal_True;
382 [ # # ]: 0 : }
383 : : }
384 : :
385 [ # # ]: 0 : if ( bNullTab )
386 : : {
387 : 0 : MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
388 [ # # ]: 0 : if ( MAP_100TH_MM != eUnit )
389 : : {
390 : :
391 : : // negative first line indent -> set null default tabstob if applicable
392 : 0 : sal_uInt16 _nWhich = GetWhich( SID_ATTR_TABSTOP );
393 : 0 : const SfxItemSet& rInSet = GetItemSet();
394 : :
395 [ # # ]: 0 : if ( rInSet.GetItemState( _nWhich ) >= SFX_ITEM_AVAILABLE )
396 : : {
397 : : const SvxTabStopItem& rTabItem =
398 [ # # ]: 0 : (const SvxTabStopItem&)rInSet.Get( _nWhich );
399 [ # # ]: 0 : SvxTabStopItem aNullTab( rTabItem );
400 [ # # ]: 0 : SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT );
401 [ # # ]: 0 : aNullTab.Insert( aNull );
402 [ # # ][ # # ]: 0 : rOutSet.Put( aNullTab );
403 : : }
404 : : }
405 : : }
406 [ # # ]: 0 : if( aRegisterCB.IsVisible())
407 : : {
408 : : const SfxBoolItem* pBoolItem = (SfxBoolItem*)GetOldItem(
409 : 0 : rOutSet, SID_ATTR_PARA_REGISTER);
410 : 0 : SfxBoolItem* pRegItem = (SfxBoolItem*)pBoolItem->Clone();
411 : 0 : sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
412 : 0 : sal_Bool bSet = pRegItem->GetValue();
413 : :
414 [ # # ]: 0 : if(aRegisterCB.IsChecked() != bSet )
415 : : {
416 : 0 : pRegItem->SetValue(!bSet);
417 : 0 : rOutSet.Put(*pRegItem);
418 : 0 : bModified = sal_True;
419 : : }
420 [ # # ]: 0 : else if ( SFX_ITEM_DEFAULT == GetItemSet().GetItemState( _nWhich, sal_False ) )
421 : 0 : rOutSet.ClearItem(_nWhich);
422 [ # # ]: 0 : delete pRegItem;
423 : : }
424 : :
425 : 0 : return bModified;
426 : : }
427 : :
428 : : // -----------------------------------------------------------------------
429 : :
430 : 0 : void SvxStdParagraphTabPage::Reset( const SfxItemSet& rSet )
431 : : {
432 : 0 : SfxItemPool* pPool = rSet.GetPool();
433 : : DBG_ASSERT( pPool, "Wo ist der Pool?" );
434 [ # # ]: 0 : String aEmpty;
435 : :
436 : : // adjust metric
437 [ # # ]: 0 : FieldUnit eFUnit = GetModuleFieldUnit( rSet );
438 : :
439 [ # # ]: 0 : bool bApplyCharUnit = GetApplyCharUnit( rSet );
440 : :
441 [ # # ]: 0 : SvtCJKOptions aCJKOptions;
442 [ # # ][ # # ]: 0 : if(aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
[ # # ][ # # ]
443 : 0 : eFUnit = FUNIT_CHAR;
444 : :
445 [ # # ]: 0 : SetFieldUnit( aLeftIndent, eFUnit );
446 [ # # ]: 0 : SetFieldUnit( aRightIndent, eFUnit );
447 [ # # ]: 0 : SetFieldUnit( aFLineIndent, eFUnit );
448 [ # # ]: 0 : if ( eFUnit == FUNIT_CHAR )
449 : : {
450 [ # # ]: 0 : SetFieldUnit( aTopDist, FUNIT_LINE );
451 [ # # ]: 0 : SetFieldUnit( aBottomDist, FUNIT_LINE );
452 [ # # ]: 0 : SetFieldUnit( aLineDistAtMetricBox, FUNIT_POINT );
453 : : }
454 : : else
455 : : {
456 [ # # ]: 0 : SetFieldUnit( aTopDist, eFUnit );
457 [ # # ]: 0 : SetFieldUnit( aBottomDist, eFUnit );
458 [ # # ]: 0 : SetFieldUnit( aLineDistAtMetricBox, eFUnit );
459 : : }
460 : :
461 [ # # ]: 0 : sal_uInt16 _nWhich = GetWhich( SID_ATTR_LRSPACE );
462 [ # # ]: 0 : SfxItemState eItemState = rSet.GetItemState( _nWhich );
463 : :
464 [ # # ]: 0 : if ( eItemState >= SFX_ITEM_AVAILABLE )
465 : : {
466 [ # # ]: 0 : SfxMapUnit eUnit = pPool->GetMetric( _nWhich );
467 : :
468 [ # # ]: 0 : if ( bRelativeMode )
469 : : {
470 : : const SvxLRSpaceItem& rOldItem =
471 [ # # ]: 0 : (const SvxLRSpaceItem&)rSet.Get( _nWhich );
472 : :
473 [ # # ]: 0 : if ( rOldItem.GetPropLeft() != 100 )
474 : : {
475 [ # # ]: 0 : aLeftIndent.SetRelative( sal_True );
476 [ # # ]: 0 : aLeftIndent.SetValue( rOldItem.GetPropLeft() );
477 : : }
478 : : else
479 : : {
480 [ # # ]: 0 : aLeftIndent.SetRelative();
481 [ # # ]: 0 : SetFieldUnit( aLeftIndent, eFUnit );
482 [ # # ]: 0 : SetMetricValue( aLeftIndent, rOldItem.GetTxtLeft(), eUnit );
483 : : }
484 : :
485 [ # # ]: 0 : if ( rOldItem.GetPropRight() != 100 )
486 : : {
487 [ # # ]: 0 : aRightIndent.SetRelative( sal_True );
488 [ # # ]: 0 : aRightIndent.SetValue( rOldItem.GetPropRight() );
489 : : }
490 : : else
491 : : {
492 [ # # ]: 0 : aRightIndent.SetRelative();
493 [ # # ]: 0 : SetFieldUnit( aRightIndent, eFUnit );
494 [ # # ]: 0 : SetMetricValue( aRightIndent, rOldItem.GetRight(), eUnit );
495 : : }
496 : :
497 [ # # ]: 0 : if ( rOldItem.GetPropTxtFirstLineOfst() != 100 )
498 : : {
499 [ # # ]: 0 : aFLineIndent.SetRelative( sal_True );
500 [ # # ]: 0 : aFLineIndent.SetValue( rOldItem.GetPropTxtFirstLineOfst() );
501 : : }
502 : : else
503 : : {
504 [ # # ]: 0 : aFLineIndent.SetRelative();
505 [ # # ]: 0 : aFLineIndent.SetMin(-9999);
506 [ # # ]: 0 : SetFieldUnit( aFLineIndent, eFUnit );
507 : 0 : SetMetricValue( aFLineIndent, rOldItem.GetTxtFirstLineOfst(),
508 [ # # ]: 0 : eUnit );
509 : : }
510 [ # # ]: 0 : aAutoCB.Check(rOldItem.IsAutoFirst());
511 : : }
512 : : else
513 : : {
514 : : const SvxLRSpaceItem& rSpace =
515 [ # # ]: 0 : (const SvxLRSpaceItem&)rSet.Get( _nWhich );
516 : :
517 [ # # ]: 0 : SetMetricValue( aLeftIndent, rSpace.GetTxtLeft(), eUnit );
518 [ # # ]: 0 : SetMetricValue( aRightIndent, rSpace.GetRight(), eUnit );
519 [ # # ]: 0 : SetMetricValue( aFLineIndent, rSpace.GetTxtFirstLineOfst(), eUnit );
520 [ # # ]: 0 : aAutoCB.Check(rSpace.IsAutoFirst());
521 : : }
522 [ # # ]: 0 : AutoHdl_Impl(&aAutoCB);
523 : : }
524 : : else
525 : : {
526 [ # # ]: 0 : aLeftIndent.SetEmptyFieldValue();
527 [ # # ]: 0 : aRightIndent.SetEmptyFieldValue();
528 [ # # ]: 0 : aFLineIndent.SetEmptyFieldValue();
529 : : }
530 : :
531 [ # # ]: 0 : _nWhich = GetWhich( SID_ATTR_ULSPACE );
532 [ # # ]: 0 : eItemState = rSet.GetItemState( _nWhich );
533 : :
534 [ # # ]: 0 : if ( eItemState >= SFX_ITEM_AVAILABLE )
535 : : {
536 [ # # ]: 0 : SfxMapUnit eUnit = pPool->GetMetric( _nWhich );
537 : :
538 : : const SvxULSpaceItem& rOldItem =
539 [ # # ]: 0 : (const SvxULSpaceItem&)rSet.Get( _nWhich );
540 [ # # ]: 0 : if ( bRelativeMode )
541 : : {
542 : :
543 [ # # ]: 0 : if ( rOldItem.GetPropUpper() != 100 )
544 : : {
545 [ # # ]: 0 : aTopDist.SetRelative( sal_True );
546 [ # # ]: 0 : aTopDist.SetValue( rOldItem.GetPropUpper() );
547 : : }
548 : : else
549 : : {
550 [ # # ]: 0 : aTopDist.SetRelative();
551 [ # # ]: 0 : if ( eFUnit == FUNIT_CHAR )
552 [ # # ]: 0 : SetFieldUnit( aTopDist, FUNIT_LINE );
553 : : else
554 [ # # ]: 0 : SetFieldUnit( aTopDist, eFUnit );
555 [ # # ]: 0 : SetMetricValue( aTopDist, rOldItem.GetUpper(), eUnit );
556 : : }
557 : :
558 [ # # ]: 0 : if ( rOldItem.GetPropLower() != 100 )
559 : : {
560 [ # # ]: 0 : aBottomDist.SetRelative( sal_True );
561 [ # # ]: 0 : aBottomDist.SetValue( rOldItem.GetPropLower() );
562 : : }
563 : : else
564 : : {
565 [ # # ]: 0 : aBottomDist.SetRelative();
566 [ # # ]: 0 : if ( eFUnit == FUNIT_CHAR )
567 [ # # ]: 0 : SetFieldUnit( aBottomDist, FUNIT_LINE );
568 : : else
569 [ # # ]: 0 : SetFieldUnit( aBottomDist, eFUnit );
570 [ # # ]: 0 : SetMetricValue( aBottomDist, rOldItem.GetLower(), eUnit );
571 : : }
572 : : }
573 : : else
574 : : {
575 [ # # ]: 0 : SetMetricValue( aTopDist, rOldItem.GetUpper(), eUnit );
576 [ # # ]: 0 : SetMetricValue( aBottomDist, rOldItem.GetLower(), eUnit );
577 : : }
578 [ # # ]: 0 : aContextualCB.Check(rOldItem.GetContext());
579 : : }
580 : : else
581 : : {
582 [ # # ]: 0 : aTopDist.SetEmptyFieldValue();
583 [ # # ]: 0 : aBottomDist.SetEmptyFieldValue();
584 : : }
585 : :
586 [ # # ]: 0 : _nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
587 [ # # ]: 0 : eItemState = rSet.GetItemState( _nWhich );
588 : :
589 [ # # ]: 0 : if ( eItemState >= SFX_ITEM_AVAILABLE )
590 [ # # ][ # # ]: 0 : SetLineSpacing_Impl( (const SvxLineSpacingItem &)rSet.Get( _nWhich ) );
591 : : else
592 [ # # ]: 0 : aLineDist.SetNoSelection();
593 : :
594 : :
595 [ # # ]: 0 : _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
596 [ # # ]: 0 : eItemState = rSet.GetItemState( _nWhich );
597 : :
598 [ # # ]: 0 : if ( eItemState >= SFX_ITEM_AVAILABLE )
599 [ # # ][ # # ]: 0 : aRegisterCB.Check( ((const SfxBoolItem &)rSet.Get( _nWhich )).GetValue());
600 : 0 : aRegisterCB.SaveValue();
601 [ # # ]: 0 : sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet);
602 [ # # ]: 0 : if(nHtmlMode & HTMLMODE_ON)
603 : : {
604 [ # # ]: 0 : aRegisterCB.Hide();
605 [ # # ]: 0 : aRegisterFL.Hide();
606 [ # # ]: 0 : aAutoCB.Hide();
607 [ # # ]: 0 : if(!(nHtmlMode & HTMLMODE_SOME_STYLES)) // IE or SW
608 : : {
609 [ # # ]: 0 : aRightLabel.Disable();
610 [ # # ]: 0 : aRightIndent.Disable();
611 [ # # ]: 0 : aTopDist.Disable(); //HTML3.2 and NS 3.0
612 [ # # ]: 0 : aBottomDist.Disable();
613 [ # # ]: 0 : aFLineIndent.Disable();
614 [ # # ]: 0 : aFLineLabel.Disable();
615 : : }
616 : : }
617 : :
618 [ # # ]: 0 : ELRLoseFocusHdl( NULL );
619 : 0 : aAutoCB.SaveValue();
620 : 0 : aContextualCB.SaveValue();
621 [ # # ][ # # ]: 0 : aLineDist.SaveValue();
[ # # ]
622 : 0 : }
623 : :
624 : : // -----------------------------------------------------------------------
625 : :
626 : 0 : void SvxStdParagraphTabPage::EnableRelativeMode()
627 : : {
628 : : DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
629 : :
630 : 0 : aLeftIndent.EnableRelativeMode( 0, 999 );
631 : 0 : aFLineIndent.EnableRelativeMode( 0, 999 );
632 : 0 : aRightIndent.EnableRelativeMode( 0, 999 );
633 : 0 : aTopDist.EnableRelativeMode( 0, 999 );
634 : 0 : aBottomDist.EnableRelativeMode( 0, 999 );
635 : 0 : bRelativeMode = sal_True;
636 : 0 : }
637 : :
638 : : // -----------------------------------------------------------------------
639 : :
640 : 0 : int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet* _pSet )
641 : : {
642 : 0 : ELRLoseFocusHdl( NULL );
643 : :
644 [ # # ]: 0 : if ( _pSet )
645 : 0 : FillItemSet( *_pSet );
646 : 0 : return LEAVE_PAGE;
647 : : }
648 : :
649 : : // -----------------------------------------------------------------------
650 : :
651 : 0 : SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window* pParent,
652 : : const SfxItemSet& rAttr ) :
653 : :
654 : 0 : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_STD_PARAGRAPH ), rAttr ),
655 : :
656 [ # # ]: 0 : aIndentFrm ( this, CUI_RES( FL_INDENT ) ),
657 [ # # ]: 0 : aLeftLabel ( this, CUI_RES( FT_LEFTINDENT ) ),
658 [ # # ]: 0 : aLeftIndent ( this, CUI_RES( ED_LEFTINDENT ) ),
659 [ # # ]: 0 : aRightLabel ( this, CUI_RES( FT_RIGHTINDENT ) ),
660 [ # # ]: 0 : aRightIndent ( this, CUI_RES( ED_RIGHTINDENT ) ),
661 : :
662 [ # # ]: 0 : aFLineLabel ( this, CUI_RES( FT_FLINEINDENT ) ),
663 [ # # ]: 0 : aFLineIndent ( this, CUI_RES( ED_FLINEINDENT ) ),
664 [ # # ]: 0 : aAutoCB ( this, CUI_RES( CB_AUTO ) ),
665 [ # # ]: 0 : aDistFrm ( this, CUI_RES( FL_DIST ) ),
666 [ # # ]: 0 : aTopLabel ( this, CUI_RES( FT_TOPDIST ) ),
667 [ # # ]: 0 : aTopDist ( this, CUI_RES( ED_TOPDIST ) ),
668 [ # # ]: 0 : aBottomLabel ( this, CUI_RES( FT_BOTTOMDIST ) ),
669 [ # # ]: 0 : aBottomDist ( this, CUI_RES( ED_BOTTOMDIST ) ),
670 [ # # ]: 0 : aContextualCB ( this, CUI_RES( CB_CONTEXTUALSPACING ) ),
671 : :
672 [ # # ]: 0 : aLineDistFrm ( this, CUI_RES( FL_LINEDIST ) ),
673 [ # # ]: 0 : aLineDist ( this, CUI_RES( LB_LINEDIST ) ),
674 [ # # ]: 0 : aLineDistAtLabel ( this, CUI_RES( FT_LINEDIST ) ),
675 [ # # ]: 0 : aLineDistAtPercentBox ( this, CUI_RES( ED_LINEDISTPERCENT ) ),
676 [ # # ]: 0 : aLineDistAtMetricBox ( this, CUI_RES( ED_LINEDISTMETRIC ) ),
677 [ # # ]: 0 : sAbsDist ( CUI_RES(ST_LINEDIST_ABS) ),
678 [ # # ]: 0 : aExampleWin ( this, CUI_RES( WN_EXAMPLE ) ),
679 [ # # ]: 0 : aRegisterFL ( this, CUI_RES( FL_REGISTER ) ),
680 [ # # ]: 0 : aRegisterCB ( this, CUI_RES( CB_REGISTER ) ),
681 : : pActLineDistFld ( &aLineDistAtPercentBox ),
682 : : nAbst ( MAX_DURCH ),
683 : : nWidth ( 11905 /*567 * 50*/ ),
684 : : nMinFixDist(0L),
685 : :
686 : : bRelativeMode ( sal_False ),
687 [ # # ][ # # ]: 0 : bNegativeIndents(sal_False)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
688 : :
689 : : {
690 : : // this page needs ExchangeSupport
691 : 0 : SetExchangeSupport();
692 : :
693 [ # # ]: 0 : aLineDistAtMetricBox.Hide();
694 [ # # ]: 0 : FreeResource();
695 [ # # ]: 0 : Init_Impl();
696 [ # # ]: 0 : aFLineIndent.SetMin(-9999); // is set to 0 on default
697 : :
698 [ # # ][ # # ]: 0 : aExampleWin.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
[ # # ][ # # ]
699 : :
700 : 0 : }
701 : :
702 : :
703 : : // -----------------------------------------------------------------------
704 : :
705 : 0 : void SvxStdParagraphTabPage::EnableNegativeMode()
706 : : {
707 : 0 : aLeftIndent.SetMin(-9999);
708 : 0 : aRightIndent.SetMin(-9999);
709 : 0 : aRightIndent.EnableNegativeMode();
710 : 0 : aLeftIndent.EnableNegativeMode();
711 : 0 : bNegativeIndents = sal_True;
712 : 0 : }
713 : :
714 : : // -----------------------------------------------------------------------
715 : :
716 : 0 : sal_uInt16* SvxStdParagraphTabPage::GetRanges()
717 : : {
718 : 0 : return pStdRanges;
719 : : }
720 : :
721 : : // -----------------------------------------------------------------------
722 : :
723 : 0 : void SvxStdParagraphTabPage::SetLineSpacing_Impl
724 : : (
725 : : const SvxLineSpacingItem &rAttr
726 : : )
727 : : {
728 : 0 : SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( rAttr.Which() );
729 : :
730 [ # # # # ]: 0 : switch( rAttr.GetLineSpaceRule() )
731 : : {
732 : : case SVX_LINE_SPACE_AUTO:
733 : : {
734 : 0 : SvxInterLineSpace eInter = rAttr.GetInterLineSpaceRule();
735 : :
736 [ # # # # ]: 0 : switch( eInter )
737 : : {
738 : : // Default single line spacing
739 : : case SVX_INTER_LINE_SPACE_OFF:
740 : 0 : aLineDist.SelectEntryPos( LLINESPACE_1 );
741 : 0 : break;
742 : :
743 : : // Default single line spacing
744 : : case SVX_INTER_LINE_SPACE_PROP:
745 [ # # ]: 0 : if ( 100 == rAttr.GetPropLineSpace() )
746 : : {
747 : 0 : aLineDist.SelectEntryPos( LLINESPACE_1 );
748 : 0 : break;
749 : : }
750 : : // 1.5 line spacing
751 [ # # ]: 0 : if ( 150 == rAttr.GetPropLineSpace() )
752 : : {
753 : 0 : aLineDist.SelectEntryPos( LLINESPACE_15 );
754 : 0 : break;
755 : : }
756 : : // double line spacing
757 [ # # ]: 0 : if ( 200 == rAttr.GetPropLineSpace() )
758 : : {
759 : 0 : aLineDist.SelectEntryPos( LLINESPACE_2 );
760 : 0 : break;
761 : : }
762 : : // the set per cent value
763 : : aLineDistAtPercentBox.
764 : : SetValue( aLineDistAtPercentBox.Normalize(
765 : 0 : rAttr.GetPropLineSpace() ) );
766 : 0 : aLineDist.SelectEntryPos( LLINESPACE_PROP );
767 : 0 : break;
768 : :
769 : : case SVX_INTER_LINE_SPACE_FIX:
770 : : SetMetricValue( aLineDistAtMetricBox,
771 : 0 : rAttr.GetInterLineSpace(), eUnit );
772 : 0 : aLineDist.SelectEntryPos( LLINESPACE_DURCH );
773 : 0 : break;
774 : : default: ;//prevent warning
775 : : }
776 : : }
777 : 0 : break;
778 : : case SVX_LINE_SPACE_FIX:
779 : 0 : SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
780 : 0 : aLineDist.SelectEntryPos( LLINESPACE_FIX );
781 : 0 : break;
782 : :
783 : : case SVX_LINE_SPACE_MIN:
784 : 0 : SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
785 : 0 : aLineDist.SelectEntryPos( LLINESPACE_MIN );
786 : 0 : break;
787 : : default: ;//prevent warning
788 : : }
789 : 0 : LineDistHdl_Impl( &aLineDist );
790 : 0 : }
791 : :
792 : : // -----------------------------------------------------------------------
793 : :
794 : 0 : IMPL_LINK( SvxStdParagraphTabPage, LineDistHdl_Impl, ListBox *, pBox )
795 : : {
796 [ # # # # : 0 : switch( pBox->GetSelectEntryPos() )
# # ]
797 : : {
798 : : case LLINESPACE_1:
799 : : case LLINESPACE_15:
800 : : case LLINESPACE_2:
801 : 0 : aLineDistAtLabel.Enable(sal_False);
802 : 0 : pActLineDistFld->Enable(sal_False);
803 [ # # ]: 0 : pActLineDistFld->SetText( String() );
804 : 0 : break;
805 : :
806 : : case LLINESPACE_DURCH:
807 : : // setting a sensible default?
808 : : // limit MS min(10, aPageSize)
809 : 0 : aLineDistAtPercentBox.Hide();
810 : 0 : pActLineDistFld = &aLineDistAtMetricBox;
811 : 0 : aLineDistAtMetricBox.SetMin(0);
812 : :
813 : :
814 [ # # ]: 0 : if ( !aLineDistAtMetricBox.GetText().Len() )
815 : : aLineDistAtMetricBox.SetValue(
816 : 0 : aLineDistAtMetricBox.Normalize( 1 ) );
817 : 0 : aLineDistAtPercentBox.Hide();
818 : 0 : pActLineDistFld->Show();
819 : 0 : pActLineDistFld->Enable();
820 : 0 : aLineDistAtLabel.Enable();
821 : 0 : break;
822 : :
823 : : case LLINESPACE_MIN:
824 : 0 : aLineDistAtPercentBox.Hide();
825 : 0 : pActLineDistFld = &aLineDistAtMetricBox;
826 : 0 : aLineDistAtMetricBox.SetMin(0);
827 : :
828 [ # # ]: 0 : if ( !aLineDistAtMetricBox.GetText().Len() )
829 : : aLineDistAtMetricBox.SetValue(
830 : 0 : aLineDistAtMetricBox.Normalize( 10 ), FUNIT_TWIP );
831 : 0 : aLineDistAtPercentBox.Hide();
832 : 0 : pActLineDistFld->Show();
833 : 0 : pActLineDistFld->Enable();
834 : 0 : aLineDistAtLabel.Enable();
835 : 0 : break;
836 : :
837 : : case LLINESPACE_PROP:
838 : 0 : aLineDistAtMetricBox.Hide();
839 : 0 : pActLineDistFld = &aLineDistAtPercentBox;
840 : :
841 [ # # ]: 0 : if ( !aLineDistAtPercentBox.GetText().Len() )
842 : : aLineDistAtPercentBox.SetValue(
843 : 0 : aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP );
844 : 0 : aLineDistAtMetricBox.Hide();
845 : 0 : pActLineDistFld->Show();
846 : 0 : pActLineDistFld->Enable();
847 : 0 : aLineDistAtLabel.Enable();
848 : 0 : break;
849 : : case LLINESPACE_FIX:
850 : : {
851 : 0 : aLineDistAtPercentBox.Hide();
852 : 0 : pActLineDistFld = &aLineDistAtMetricBox;
853 : 0 : sal_Int64 nTemp = aLineDistAtMetricBox.GetValue();
854 : 0 : aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP);
855 : :
856 : : // if the value has been changed at SetMin,
857 : : // it is time for the default
858 [ # # ]: 0 : if ( aLineDistAtMetricBox.GetValue() != nTemp )
859 : : SetMetricValue( aLineDistAtMetricBox,
860 : 0 : FIX_DIST_DEF, SFX_MAPUNIT_TWIP ); // fix is only in Writer
861 : 0 : aLineDistAtPercentBox.Hide();
862 : 0 : pActLineDistFld->Show();
863 : 0 : pActLineDistFld->Enable();
864 : 0 : aLineDistAtLabel.Enable();
865 : : }
866 : 0 : break;
867 : : }
868 : 0 : UpdateExample_Impl( sal_True );
869 : 0 : return 0;
870 : : }
871 : :
872 : : // -----------------------------------------------------------------------
873 : :
874 : 0 : IMPL_LINK_NOARG_INLINE_START(SvxStdParagraphTabPage, ModifyHdl_Impl)
875 : : {
876 : 0 : UpdateExample_Impl();
877 : 0 : return 0;
878 : : }
879 : 0 : IMPL_LINK_NOARG_INLINE_END(SvxStdParagraphTabPage, ModifyHdl_Impl)
880 : :
881 : : // -----------------------------------------------------------------------
882 : :
883 : 0 : void SvxStdParagraphTabPage::Init_Impl()
884 : : {
885 : : aLineDist.SetSelectHdl(
886 [ # # ]: 0 : LINK( this, SvxStdParagraphTabPage, LineDistHdl_Impl ) );
887 : :
888 [ # # ]: 0 : Link aLink = LINK( this, SvxStdParagraphTabPage, ELRLoseFocusHdl );
889 : 0 : aFLineIndent.SetLoseFocusHdl( aLink );
890 : 0 : aLeftIndent.SetLoseFocusHdl( aLink );
891 : 0 : aRightIndent.SetLoseFocusHdl( aLink );
892 : :
893 [ # # ]: 0 : aLink = LINK( this, SvxStdParagraphTabPage, ModifyHdl_Impl );
894 : 0 : aFLineIndent.SetModifyHdl( aLink );
895 : 0 : aLeftIndent.SetModifyHdl( aLink );
896 : 0 : aRightIndent.SetModifyHdl( aLink );
897 : 0 : aTopDist.SetModifyHdl( aLink );
898 : 0 : aBottomDist.SetModifyHdl( aLink );
899 : :
900 [ # # ]: 0 : aAutoCB.SetClickHdl( LINK( this, SvxStdParagraphTabPage, AutoHdl_Impl ));
901 : 0 : SfxItemPool* pPool = GetItemSet().GetPool();
902 : : DBG_ASSERT( pPool, "Wo ist der Pool" );
903 : : FieldUnit eUnit =
904 [ # # ][ # # ]: 0 : MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
[ # # ]
905 : :
906 [ # # ][ # # ]: 0 : aTopDist.SetMax( aTopDist.Normalize( nAbst ), eUnit );
907 [ # # ][ # # ]: 0 : aBottomDist.SetMax( aBottomDist.Normalize( nAbst ), eUnit );
908 : : aLineDistAtMetricBox.SetMax(
909 [ # # ][ # # ]: 0 : aLineDistAtMetricBox.Normalize( nAbst ), eUnit );
910 : 0 : }
911 : :
912 : : // -----------------------------------------------------------------------
913 : :
914 : 0 : void SvxStdParagraphTabPage::UpdateExample_Impl( sal_Bool bAll )
915 : : {
916 : : aExampleWin.SetFirstLineOfst(
917 : 0 : (short)aFLineIndent.Denormalize( aFLineIndent.GetValue( FUNIT_TWIP ) ) );
918 : : aExampleWin.SetLeftMargin(
919 : 0 : static_cast<long>(aLeftIndent.Denormalize( aLeftIndent.GetValue( FUNIT_TWIP ) ) ) );
920 : : aExampleWin.SetRightMargin(
921 : 0 : static_cast<long>(aRightIndent.Denormalize( aRightIndent.GetValue( FUNIT_TWIP ) ) ) );
922 : : aExampleWin.SetUpper(
923 : 0 : (sal_uInt16)aTopDist.Denormalize( aTopDist.GetValue( FUNIT_TWIP ) ) );
924 : : aExampleWin.SetLower(
925 : 0 : (sal_uInt16)aBottomDist.Denormalize( aBottomDist.GetValue( FUNIT_TWIP ) ) );
926 : :
927 : :
928 : :
929 : 0 : sal_uInt16 nPos = aLineDist.GetSelectEntryPos();
930 : :
931 [ # # # # ]: 0 : switch ( nPos )
932 : : {
933 : : case LLINESPACE_1:
934 : : case LLINESPACE_15:
935 : : case LLINESPACE_2:
936 : 0 : aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos );
937 : 0 : break;
938 : :
939 : : case LLINESPACE_PROP:
940 : : aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos,
941 : : (sal_uInt16)aLineDistAtPercentBox.Denormalize(
942 : 0 : aLineDistAtPercentBox.GetValue() ) );
943 : 0 : break;
944 : :
945 : : case LLINESPACE_MIN:
946 : : case LLINESPACE_DURCH:
947 : : case LLINESPACE_FIX:
948 : : aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos,
949 : 0 : (sal_uInt16)GetCoreValue( aLineDistAtMetricBox, SFX_MAPUNIT_TWIP ) );
950 : 0 : break;
951 : : }
952 : 0 : aExampleWin.Draw( bAll );
953 : 0 : }
954 : :
955 : : // -----------------------------------------------------------------------
956 : :
957 : 0 : void SvxStdParagraphTabPage::EnableRegisterMode()
958 : : {
959 : 0 : aRegisterCB.Show();
960 : 0 : aRegisterFL.Show();
961 : 0 : }
962 : :
963 : 0 : void SvxStdParagraphTabPage::EnableContextualMode()
964 : : {
965 : 0 : aContextualCB.Show();
966 : 0 : }
967 : :
968 : 0 : IMPL_LINK( SvxStdParagraphTabPage, AutoHdl_Impl, CheckBox*, pBox )
969 : : {
970 : 0 : sal_Bool bEnable = !pBox->IsChecked();
971 : 0 : aFLineLabel .Enable(bEnable);
972 : 0 : aFLineIndent.Enable(bEnable);
973 : 0 : return 0;
974 : : }
975 : :
976 : 0 : void SvxStdParagraphTabPage::SetPageWidth( sal_uInt16 nPageWidth )
977 : : {
978 : 0 : nWidth = nPageWidth;
979 : 0 : }
980 : :
981 : :
982 : 0 : void SvxStdParagraphTabPage::EnableAutoFirstLine()
983 : : {
984 : 0 : aAutoCB.Show();
985 : 0 : }
986 : :
987 : :
988 : 0 : void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip)
989 : : {
990 : 0 : aLineDist.InsertEntry(sAbsDist);
991 : 0 : nMinFixDist = nMinTwip;
992 : 0 : }
993 : :
994 : :
995 : 0 : void SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet)
996 : : {
997 : :
998 : : /* different bit represent call to different method of SvxStdParagraphTabPage
999 : : 0x0001 --->EnableRelativeMode()
1000 : : 0x0002 --->EnableRegisterMode()
1001 : : 0x0004 --->EnableAutoFirstLine()
1002 : : 0x0008 --->EnableNegativeMode()
1003 : : 0x0010 --->EnableContextualMode()
1004 : : */
1005 : 0 : SFX_ITEMSET_ARG (&aSet,pPageWidthItem,SfxUInt16Item,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,sal_False);
1006 : 0 : SFX_ITEMSET_ARG (&aSet,pFlagSetItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,sal_False);
1007 : 0 : SFX_ITEMSET_ARG (&aSet,pLineDistItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,sal_False);
1008 : :
1009 [ # # ]: 0 : if (pPageWidthItem)
1010 : 0 : SetPageWidth(pPageWidthItem->GetValue());
1011 : :
1012 [ # # ]: 0 : if (pFlagSetItem )
1013 [ # # ]: 0 : if (( 0x0001 & pFlagSetItem->GetValue())== 0x0001 )
1014 : 0 : EnableRelativeMode();
1015 : :
1016 [ # # ]: 0 : if (pFlagSetItem)
1017 [ # # ]: 0 : if (( 0x0002 & pFlagSetItem->GetValue())== 0x0002 )
1018 : 0 : EnableRegisterMode();
1019 : :
1020 [ # # ]: 0 : if (pFlagSetItem)
1021 [ # # ]: 0 : if ( ( 0x0004 & pFlagSetItem->GetValue())== 0x0004 )
1022 : 0 : EnableAutoFirstLine();
1023 : :
1024 [ # # ]: 0 : if(pLineDistItem)
1025 : 0 : EnableAbsLineDist(pLineDistItem->GetValue());
1026 : :
1027 [ # # ]: 0 : if (pFlagSetItem)
1028 [ # # ]: 0 : if (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 )
1029 : 0 : EnableNegativeMode();
1030 : :
1031 [ # # ]: 0 : if (pFlagSetItem)
1032 [ # # ]: 0 : if (( 0x0010 & pFlagSetItem->GetValue()) == 0x0010 )
1033 : 0 : EnableContextualMode();
1034 : 0 : }
1035 : :
1036 : :
1037 : : #define LASTLINEPOS_DEFAULT 0
1038 : : #define LASTLINEPOS_LEFT 1
1039 : :
1040 : : #define LASTLINECOUNT_OLD 3
1041 : : #define LASTLINECOUNT_NEW 4
1042 : :
1043 : : // class SvxParaAlignTabPage ------------------------------------------------
1044 : :
1045 : 0 : SvxParaAlignTabPage::SvxParaAlignTabPage( Window* pParent, const SfxItemSet& rSet )
1046 : 0 : : SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_ALIGN_PARAGRAPH ),rSet),
1047 [ # # ]: 0 : aAlignFrm ( this, CUI_RES( FL_ALIGN ) ),
1048 [ # # ]: 0 : aLeft ( this, CUI_RES( BTN_LEFTALIGN ) ),
1049 [ # # ]: 0 : aRight ( this, CUI_RES( BTN_RIGHTALIGN ) ),
1050 [ # # ]: 0 : aCenter ( this, CUI_RES( BTN_CENTERALIGN ) ),
1051 [ # # ]: 0 : aJustify ( this, CUI_RES( BTN_JUSTIFYALIGN ) ),
1052 [ # # ]: 0 : aLastLineFT ( this, CUI_RES( FT_LASTLINE ) ),
1053 [ # # ]: 0 : aLastLineLB ( this, CUI_RES( LB_LASTLINE ) ),
1054 [ # # ]: 0 : aExpandCB ( this, CUI_RES( CB_EXPAND ) ),
1055 [ # # ]: 0 : aSnapToGridCB ( this, CUI_RES( CB_SNAP ) ),
1056 [ # # ]: 0 : aExampleWin ( this, CUI_RES( WN_EXAMPLE ) ),
1057 : :
1058 [ # # ]: 0 : aVertAlignFL ( this, CUI_RES( FL_VERTALIGN ) ),
1059 [ # # ]: 0 : aVertAlignFT ( this, CUI_RES( FT_VERTALIGN ) ),
1060 [ # # ]: 0 : aVertAlignLB ( this, CUI_RES( LB_VERTALIGN ) ),
1061 : :
1062 [ # # ]: 0 : aPropertiesFL ( this, CUI_RES( FL_PROPERTIES )),
1063 [ # # ]: 0 : aTextDirectionFT ( this, CUI_RES( FT_TEXTDIRECTION )),
1064 [ # # ][ # # ]: 0 : aTextDirectionLB ( this, CUI_RES( LB_TEXTDIRECTION ))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1065 : : {
1066 [ # # ]: 0 : SvtLanguageOptions aLangOptions;
1067 : 0 : sal_uInt16 nLastLinePos = LASTLINEPOS_DEFAULT;
1068 : :
1069 [ # # ][ # # ]: 0 : if ( aLangOptions.IsAsianTypographyEnabled() )
1070 : : {
1071 [ # # ][ # # ]: 0 : String sLeft(CUI_RES(ST_LEFTALIGN_ASIAN));
1072 [ # # ]: 0 : aLeft.SetText(sLeft);
1073 [ # # ][ # # ]: 0 : aRight.SetText(String(CUI_RES(ST_RIGHTALIGN_ASIAN)));
[ # # ][ # # ]
1074 [ # # ][ # # ]: 0 : sLeft = MnemonicGenerator::EraseAllMnemonicChars( sLeft );
[ # # ]
1075 : :
1076 [ # # ][ # # ]: 0 : if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_OLD )
1077 : : {
1078 [ # # ]: 0 : aLastLineLB.RemoveEntry( 0 );
1079 [ # # ]: 0 : aLastLineLB.InsertEntry( sLeft, 0 );
1080 : : }
1081 : : else
1082 [ # # ]: 0 : nLastLinePos = LASTLINEPOS_LEFT;
1083 : : }
1084 : : // remove "Default" or "Left" entry, depends on CJKOptions
1085 [ # # ][ # # ]: 0 : if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_NEW )
1086 [ # # ]: 0 : aLastLineLB.RemoveEntry( nLastLinePos );
1087 : :
1088 [ # # ]: 0 : FreeResource();
1089 [ # # ]: 0 : Link aLink = LINK( this, SvxParaAlignTabPage, AlignHdl_Impl );
1090 : 0 : aLeft.SetClickHdl( aLink );
1091 : 0 : aRight.SetClickHdl( aLink );
1092 : 0 : aCenter.SetClickHdl( aLink );
1093 : 0 : aJustify.SetClickHdl( aLink );
1094 [ # # ]: 0 : aLastLineLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, LastLineHdl_Impl ) );
1095 [ # # ]: 0 : aTextDirectionLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, TextDirectionHdl_Impl ) );
1096 : :
1097 [ # # ]: 0 : sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet);
1098 [ # # ][ # # ]: 0 : if(!(nHtmlMode & HTMLMODE_ON) || (0 != (nHtmlMode & HTMLMODE_SOME_STYLES)) )
1099 : : {
1100 [ # # ][ # # ]: 0 : if( aLangOptions.IsCTLFontEnabled() )
1101 : : {
1102 [ # # ][ # # ]: 0 : aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP );
[ # # ][ # # ]
[ # # ]
1103 [ # # ][ # # ]: 0 : aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP );
[ # # ][ # # ]
[ # # ]
1104 [ # # ][ # # ]: 0 : aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT );
[ # # ][ # # ]
[ # # ]
1105 : :
1106 [ # # ]: 0 : aPropertiesFL.Show();
1107 [ # # ]: 0 : aTextDirectionFT.Show();
1108 [ # # ]: 0 : aTextDirectionLB.Show();
1109 : : }
1110 : : }
1111 : :
1112 [ # # ][ # # ]: 0 : aExampleWin.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
[ # # ][ # # ]
[ # # ]
1113 : :
1114 : 0 : }
1115 : :
1116 [ # # ][ # # ]: 0 : SvxParaAlignTabPage::~SvxParaAlignTabPage()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1117 : : {
1118 [ # # ]: 0 : }
1119 : :
1120 : 0 : int SvxParaAlignTabPage::DeactivatePage( SfxItemSet* _pSet )
1121 : : {
1122 [ # # ]: 0 : if ( _pSet )
1123 : 0 : FillItemSet( *_pSet );
1124 : 0 : return LEAVE_PAGE;
1125 : : }
1126 : :
1127 : 0 : SfxTabPage* SvxParaAlignTabPage::Create( Window* pParent, const SfxItemSet& rSet )
1128 : : {
1129 [ # # ]: 0 : return new SvxParaAlignTabPage(pParent, rSet);
1130 : : }
1131 : :
1132 : 0 : sal_uInt16* SvxParaAlignTabPage::GetRanges()
1133 : : {
1134 : 0 : return pAlignRanges;
1135 : :
1136 : : }
1137 : :
1138 : 0 : sal_Bool SvxParaAlignTabPage::FillItemSet( SfxItemSet& rOutSet )
1139 : : {
1140 : 0 : sal_Bool bModified = sal_False;
1141 : :
1142 : 0 : bool bAdj = false, bChecked = false;
1143 : 0 : SvxAdjust eAdjust = SVX_ADJUST_LEFT;
1144 : :
1145 [ # # ]: 0 : if ( aLeft.IsChecked() )
1146 : : {
1147 : 0 : eAdjust = SVX_ADJUST_LEFT;
1148 : 0 : bAdj = !aLeft.GetSavedValue();
1149 : 0 : bChecked = true;
1150 : : }
1151 [ # # ]: 0 : else if ( aRight.IsChecked() )
1152 : : {
1153 : 0 : eAdjust = SVX_ADJUST_RIGHT;
1154 : 0 : bAdj = !aRight.GetSavedValue();
1155 : 0 : bChecked = true;
1156 : : }
1157 [ # # ]: 0 : else if ( aCenter.IsChecked() )
1158 : : {
1159 : 0 : eAdjust = SVX_ADJUST_CENTER;
1160 : 0 : bAdj = !aCenter.GetSavedValue();
1161 : 0 : bChecked = true;
1162 : : }
1163 [ # # ]: 0 : else if ( aJustify.IsChecked() )
1164 : : {
1165 : 0 : eAdjust = SVX_ADJUST_BLOCK;
1166 : 0 : bAdj = !aJustify.GetSavedValue() ||
1167 : 0 : aExpandCB.IsChecked() != aExpandCB.GetSavedValue() ||
1168 [ # # ]: 0 : aLastLineLB.GetSelectEntryPos() != aLastLineLB.GetSavedValue();
[ # # # # ]
1169 : 0 : bChecked = true;
1170 : : }
1171 : 0 : sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
1172 : :
1173 [ # # ]: 0 : if ( bAdj )
1174 : : {
1175 : : const SvxAdjustItem* pOld =
1176 : 0 : (const SvxAdjustItem*)GetOldItem( rOutSet, SID_ATTR_PARA_ADJUST );
1177 : 0 : SvxAdjust eOneWord = aExpandCB.IsChecked() ? SVX_ADJUST_BLOCK
1178 [ # # ]: 0 : : SVX_ADJUST_LEFT;
1179 : 0 : sal_uInt16 nLBPos = aLastLineLB.GetSelectEntryPos();
1180 : 0 : SvxAdjust eLastBlock = SVX_ADJUST_LEFT;
1181 : :
1182 [ # # ]: 0 : if ( 1 == nLBPos )
1183 : 0 : eLastBlock = SVX_ADJUST_CENTER;
1184 [ # # ]: 0 : else if ( 2 == nLBPos )
1185 : 0 : eLastBlock = SVX_ADJUST_BLOCK;
1186 : :
1187 : : bool bNothingWasChecked =
1188 : 0 : !aLeft.GetSavedValue() && !aRight.GetSavedValue() &&
1189 [ # # ][ # # ]: 0 : !aCenter.GetSavedValue() && !aJustify.GetSavedValue();
[ # # # # ]
1190 : :
1191 [ # # ][ # # : 0 : if ( !pOld || pOld->GetAdjust() != eAdjust ||
# # # # ]
[ # # ][ # # ]
[ # # ]
1192 : 0 : pOld->GetOneWord() != eOneWord ||
1193 : 0 : pOld->GetLastBlock() != eLastBlock ||
1194 : : ( bChecked && bNothingWasChecked ) )
1195 : : {
1196 : 0 : bModified = sal_True;
1197 : : SvxAdjustItem aAdj(
1198 [ # # ][ # # ]: 0 : (const SvxAdjustItem&)GetItemSet().Get( _nWhich ) );
1199 : 0 : aAdj.SetAdjust( eAdjust );
1200 : 0 : aAdj.SetOneWord( eOneWord );
1201 : 0 : aAdj.SetLastBlock( eLastBlock );
1202 [ # # ][ # # ]: 0 : rOutSet.Put( aAdj );
1203 : : }
1204 : : }
1205 [ # # ]: 0 : if(aSnapToGridCB.IsChecked() != aSnapToGridCB.GetSavedValue())
1206 : : {
1207 [ # # ]: 0 : rOutSet.Put(SvxParaGridItem(aSnapToGridCB.IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID )));
1208 : 0 : bModified = sal_True;
1209 : : }
1210 [ # # ]: 0 : if(aVertAlignLB.GetSavedValue() != aVertAlignLB.GetSelectEntryPos())
1211 : : {
1212 [ # # ]: 0 : rOutSet.Put(SvxParaVertAlignItem(aVertAlignLB.GetSelectEntryPos(), GetWhich( SID_PARA_VERTALIGN )));
1213 : 0 : bModified = sal_True;
1214 : : }
1215 : :
1216 [ # # ]: 0 : if( aTextDirectionLB.IsVisible() )
1217 : : {
1218 : 0 : SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue();
1219 [ # # ]: 0 : if( eDir != aTextDirectionLB.GetSavedValue() )
1220 : : {
1221 [ # # ]: 0 : rOutSet.Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
1222 : 0 : bModified = sal_True;
1223 : : }
1224 : : }
1225 : :
1226 : 0 : return bModified;
1227 : : }
1228 : :
1229 : 0 : void SvxParaAlignTabPage::Reset( const SfxItemSet& rSet )
1230 : : {
1231 : 0 : sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
1232 : 0 : SfxItemState eItemState = rSet.GetItemState( _nWhich );
1233 : :
1234 : 0 : sal_uInt16 nLBSelect = 0;
1235 [ # # ]: 0 : if ( eItemState >= SFX_ITEM_AVAILABLE )
1236 : : {
1237 : 0 : const SvxAdjustItem& rAdj = (const SvxAdjustItem&)rSet.Get( _nWhich );
1238 : :
1239 [ # # # # : 0 : switch ( rAdj.GetAdjust() /*!!! ask VB rAdj.GetLastBlock()*/ )
# ]
1240 : : {
1241 : 0 : case SVX_ADJUST_LEFT: aLeft.Check(); break;
1242 : :
1243 : 0 : case SVX_ADJUST_RIGHT: aRight.Check(); break;
1244 : :
1245 : 0 : case SVX_ADJUST_CENTER: aCenter.Check(); break;
1246 : :
1247 : 0 : case SVX_ADJUST_BLOCK: aJustify.Check(); break;
1248 : : default: ; //prevent warning
1249 : : }
1250 : 0 : sal_Bool bEnable = aJustify.IsChecked();
1251 : 0 : aLastLineFT.Enable(bEnable);
1252 : 0 : aLastLineLB.Enable(bEnable);
1253 : 0 : aExpandCB .Enable(bEnable);
1254 : :
1255 : 0 : aExpandCB.Check(SVX_ADJUST_BLOCK == rAdj.GetOneWord());
1256 [ # # # # ]: 0 : switch(rAdj.GetLastBlock())
1257 : : {
1258 : 0 : case SVX_ADJUST_LEFT: nLBSelect = 0; break;
1259 : :
1260 : 0 : case SVX_ADJUST_CENTER: nLBSelect = 1; break;
1261 : :
1262 : 0 : case SVX_ADJUST_BLOCK: nLBSelect = 2; break;
1263 : : default: ; //prevent warning
1264 : : }
1265 : : }
1266 : : else
1267 : : {
1268 : 0 : aLeft.Check( sal_False );
1269 : 0 : aRight.Check( sal_False );
1270 : 0 : aCenter.Check( sal_False );
1271 : 0 : aJustify.Check( sal_False );
1272 : : }
1273 : 0 : aLastLineLB.SelectEntryPos(nLBSelect);
1274 : :
1275 : 0 : sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet);
1276 [ # # ]: 0 : if(nHtmlMode & HTMLMODE_ON)
1277 : : {
1278 : 0 : aLastLineLB.Hide();
1279 : 0 : aLastLineFT.Hide();
1280 : 0 : aExpandCB.Hide();
1281 [ # # ]: 0 : if(!(nHtmlMode & HTMLMODE_FULL_STYLES) )
1282 : 0 : aJustify.Disable();
1283 : 0 : aSnapToGridCB.Show(sal_False);
1284 : : }
1285 : 0 : _nWhich = GetWhich(SID_ATTR_PARA_SNAPTOGRID);
1286 : 0 : eItemState = rSet.GetItemState( _nWhich );
1287 [ # # ]: 0 : if ( eItemState >= SFX_ITEM_AVAILABLE )
1288 : : {
1289 : 0 : const SvxParaGridItem& rSnap = (const SvxParaGridItem&)rSet.Get( _nWhich );
1290 : 0 : aSnapToGridCB.Check(rSnap.GetValue());
1291 : : }
1292 : :
1293 : 0 : _nWhich = GetWhich( SID_PARA_VERTALIGN );
1294 : 0 : eItemState = rSet.GetItemState( _nWhich );
1295 : :
1296 [ # # ]: 0 : if ( eItemState >= SFX_ITEM_AVAILABLE )
1297 : : {
1298 : 0 : aVertAlignLB.Show();
1299 : 0 : aVertAlignFL.Show();
1300 : 0 : aVertAlignFT.Show();
1301 : :
1302 : 0 : const SvxParaVertAlignItem& rAlign = (const SvxParaVertAlignItem&)rSet.Get( _nWhich );
1303 : 0 : aVertAlignLB.SelectEntryPos(rAlign.GetValue());
1304 : : }
1305 : :
1306 : 0 : _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
1307 : : //text direction
1308 [ # # ]: 0 : if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( _nWhich ) )
1309 : : {
1310 : 0 : const SvxFrameDirectionItem& rFrameDirItem = ( const SvxFrameDirectionItem& ) rSet.Get( _nWhich );
1311 : 0 : aTextDirectionLB.SelectEntryValue( (SvxFrameDirection)rFrameDirItem.GetValue() );
1312 : 0 : aTextDirectionLB.SaveValue();
1313 : : }
1314 : :
1315 : 0 : aSnapToGridCB.SaveValue();
1316 : 0 : aVertAlignLB.SaveValue();
1317 : 0 : aLeft.SaveValue();
1318 : 0 : aRight.SaveValue();
1319 : 0 : aCenter.SaveValue();
1320 : 0 : aJustify.SaveValue();
1321 : 0 : aLastLineLB.SaveValue();
1322 : 0 : aExpandCB.SaveValue();
1323 : :
1324 : 0 : UpdateExample_Impl(sal_True);
1325 : 0 : }
1326 : :
1327 : 0 : IMPL_LINK_NOARG(SvxParaAlignTabPage, AlignHdl_Impl)
1328 : : {
1329 : 0 : sal_Bool bJustify = aJustify.IsChecked();
1330 : 0 : aLastLineFT.Enable(bJustify);
1331 : 0 : aLastLineLB.Enable(bJustify);
1332 : 0 : aExpandCB.Enable(bJustify);
1333 : 0 : UpdateExample_Impl(sal_False);
1334 : 0 : return 0;
1335 : : }
1336 : :
1337 : 0 : IMPL_LINK_NOARG(SvxParaAlignTabPage, LastLineHdl_Impl)
1338 : : {
1339 : 0 : UpdateExample_Impl(sal_False);
1340 : 0 : return 0;
1341 : : }
1342 : :
1343 : 0 : IMPL_LINK_NOARG(SvxParaAlignTabPage, TextDirectionHdl_Impl)
1344 : : {
1345 : 0 : SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue();
1346 [ # # # # ]: 0 : switch ( eDir )
1347 : : {
1348 : : // check the default alignment for this text direction
1349 : 0 : case FRMDIR_HORI_LEFT_TOP : aLeft.Check( sal_True ); break;
1350 : 0 : case FRMDIR_HORI_RIGHT_TOP : aRight.Check( sal_True ); break;
1351 : 0 : case FRMDIR_ENVIRONMENT : /* do nothing */ break;
1352 : : default:
1353 : : {
1354 : : SAL_WARN( "cui.tabpages", "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" );
1355 : : }
1356 : : }
1357 : :
1358 : 0 : return 0;
1359 : : }
1360 : :
1361 : 0 : void SvxParaAlignTabPage::UpdateExample_Impl( sal_Bool bAll )
1362 : : {
1363 [ # # ]: 0 : if ( aLeft.IsChecked() )
1364 : 0 : aExampleWin.SetAdjust( SVX_ADJUST_LEFT );
1365 [ # # ]: 0 : else if ( aRight.IsChecked() )
1366 : 0 : aExampleWin.SetAdjust( SVX_ADJUST_RIGHT );
1367 [ # # ]: 0 : else if ( aCenter.IsChecked() )
1368 : 0 : aExampleWin.SetAdjust( SVX_ADJUST_CENTER );
1369 [ # # ]: 0 : else if ( aJustify.IsChecked() )
1370 : : {
1371 : 0 : aExampleWin.SetAdjust( SVX_ADJUST_BLOCK );
1372 : 0 : SvxAdjust eLastBlock = SVX_ADJUST_LEFT;
1373 : 0 : sal_uInt16 nLBPos = aLastLineLB.GetSelectEntryPos();
1374 [ # # ]: 0 : if(nLBPos == 1)
1375 : 0 : eLastBlock = SVX_ADJUST_CENTER;
1376 [ # # ]: 0 : else if(nLBPos == 2)
1377 : 0 : eLastBlock = SVX_ADJUST_BLOCK;
1378 : 0 : aExampleWin.SetLastLine( eLastBlock );
1379 : : }
1380 : :
1381 : 0 : aExampleWin.Draw( bAll );
1382 : 0 : }
1383 : :
1384 : 0 : void SvxParaAlignTabPage::EnableJustifyExt()
1385 : : {
1386 [ # # ]: 0 : aLastLineFT.Show();
1387 [ # # ]: 0 : aLastLineLB.Show();
1388 [ # # ]: 0 : aExpandCB .Show();
1389 [ # # ]: 0 : SvtLanguageOptions aCJKOptions;
1390 [ # # ][ # # ]: 0 : if(aCJKOptions.IsAsianTypographyEnabled())
1391 [ # # ][ # # ]: 0 : aSnapToGridCB.Show();
1392 : :
1393 : 0 : }
1394 : :
1395 : 0 : void SvxParaAlignTabPage::PageCreated (SfxAllItemSet aSet)
1396 : : {
1397 : 0 : SFX_ITEMSET_ARG (&aSet,pBoolItem,SfxBoolItem,SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_False);
1398 [ # # ]: 0 : if (pBoolItem)
1399 [ # # ]: 0 : if(pBoolItem->GetValue())
1400 : 0 : EnableJustifyExt();
1401 : 0 : }
1402 : :
1403 : 0 : SfxTabPage* SvxExtParagraphTabPage::Create( Window* pParent,
1404 : : const SfxItemSet& rSet )
1405 : : {
1406 [ # # ]: 0 : return new SvxExtParagraphTabPage( pParent, rSet );
1407 : : }
1408 : :
1409 : : // -----------------------------------------------------------------------
1410 : :
1411 : 0 : sal_Bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet& rOutSet )
1412 : : {
1413 : 0 : sal_Bool bModified = sal_False;
1414 [ # # ]: 0 : sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
1415 : 0 : const TriState eHyphenState = aHyphenBox.GetState();
1416 [ # # ]: 0 : const SfxPoolItem* pOld = GetOldItem( rOutSet, SID_ATTR_PARA_HYPHENZONE );
1417 : :
1418 [ # # ][ # # ]: 0 : if ( eHyphenState != aHyphenBox.GetSavedValue() ||
[ # # ][ # # ]
[ # # ]
1419 [ # # ]: 0 : aExtHyphenBeforeBox.IsValueModified() ||
1420 [ # # ]: 0 : aExtHyphenAfterBox.IsValueModified() ||
1421 [ # # ]: 0 : aMaxHyphenEdit.IsValueModified() )
1422 : : {
1423 : : SvxHyphenZoneItem aHyphen(
1424 [ # # ][ # # ]: 0 : (const SvxHyphenZoneItem&)GetItemSet().Get( _nWhich ) );
1425 : 0 : aHyphen.SetHyphen( eHyphenState == STATE_CHECK );
1426 : :
1427 [ # # ]: 0 : if ( eHyphenState == STATE_CHECK )
1428 : : {
1429 [ # # ]: 0 : aHyphen.GetMinLead() = (sal_uInt8)aExtHyphenBeforeBox.GetValue();
1430 [ # # ]: 0 : aHyphen.GetMinTrail() = (sal_uInt8)aExtHyphenAfterBox.GetValue();
1431 : : }
1432 [ # # ]: 0 : aHyphen.GetMaxHyphens() = (sal_uInt8)aMaxHyphenEdit.GetValue();
1433 : :
1434 [ # # ]: 0 : if ( !pOld ||
[ # # # # ]
[ # # ]
1435 [ # # ]: 0 : !( *(SvxHyphenZoneItem*)pOld == aHyphen ) ||
1436 : 0 : eHyphenState != aHyphenBox.GetSavedValue())
1437 : : {
1438 [ # # ]: 0 : rOutSet.Put( aHyphen );
1439 : 0 : bModified = sal_True;
1440 [ # # ]: 0 : }
1441 : : }
1442 : :
1443 [ # # ][ # # ]: 0 : if (aPagenumEdit.IsEnabled() && aPagenumEdit.IsValueModified())
[ # # ][ # # ]
[ # # ]
1444 : : {
1445 : : SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM,
1446 [ # # ][ # # ]: 0 : (sal_uInt16)aPagenumEdit.GetValue() );
1447 : :
1448 [ # # ]: 0 : pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGENUM );
1449 : :
1450 [ # # ][ # # ]: 0 : if ( !pOld || ( (const SfxUInt16Item*)pOld )->GetValue() != aPageNum.GetValue() )
[ # # ]
1451 : : {
1452 [ # # ]: 0 : rOutSet.Put( aPageNum );
1453 : 0 : bModified = sal_True;
1454 [ # # ]: 0 : }
1455 : : }
1456 : :
1457 : : // pagebreak
1458 : :
1459 : 0 : TriState eState = aApplyCollBtn.GetState();
1460 : 0 : bool bIsPageModel = false;
1461 : :
1462 [ # # ]: 0 : _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
1463 [ # # ]: 0 : String sPage;
1464 [ # # ]: 0 : if ( eState != aApplyCollBtn.GetSavedValue() ||
[ # # # # ]
[ # # ]
1465 : : ( STATE_CHECK == eState &&
1466 [ # # ]: 0 : aApplyCollBox.GetSelectEntryPos() != aApplyCollBox.GetSavedValue() ) )
1467 : : {
1468 [ # # ]: 0 : if ( eState == STATE_CHECK )
1469 : : {
1470 [ # # ][ # # ]: 0 : sPage = aApplyCollBox.GetSelectEntry();
[ # # ]
1471 : 0 : bIsPageModel = 0 != sPage.Len();
1472 : : }
1473 [ # # ]: 0 : pOld = GetOldItem( rOutSet, SID_ATTR_PARA_MODEL );
1474 : :
1475 [ # # ][ # # ]: 0 : if ( !pOld || ( (const SvxPageModelItem*)pOld )->GetValue() != sPage )
[ # # ][ # # ]
1476 : : {
1477 [ # # ][ # # ]: 0 : rOutSet.Put( SvxPageModelItem( sPage, sal_False, _nWhich ) );
[ # # ]
1478 : 0 : bModified = sal_True;
1479 : : }
1480 : : else
1481 : 0 : bIsPageModel = false;
1482 : : }
1483 [ # # ][ # # ]: 0 : else if(STATE_CHECK == eState && aApplyCollBtn.IsEnabled())
[ # # ][ # # ]
1484 : 0 : bIsPageModel = true;
1485 : : else
1486 [ # # ][ # # ]: 0 : rOutSet.Put( SvxPageModelItem( sPage, sal_False, _nWhich ) );
[ # # ]
1487 : :
1488 [ # # ]: 0 : _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
1489 : :
1490 [ # # ]: 0 : if ( bIsPageModel )
1491 : : // if PageModel is turned on, always turn off PageBreak
1492 [ # # ][ # # ]: 0 : rOutSet.Put( SvxFmtBreakItem( SVX_BREAK_NONE, _nWhich ) );
[ # # ]
1493 : : else
1494 : : {
1495 : 0 : eState = aPageBreakBox.GetState();
1496 [ # # ]: 0 : SfxItemState eModelState = GetItemSet().GetItemState(SID_ATTR_PARA_MODEL, sal_False);
1497 : :
1498 [ # # ][ # # : 0 : if ( (eModelState == SFX_ITEM_SET && STATE_CHECK == aPageBreakBox.GetState()) ||
# # # # #
# ][ # # ]
1499 : 0 : eState != aPageBreakBox.GetSavedValue() ||
1500 [ # # ]: 0 : aBreakTypeLB.GetSelectEntryPos() != aBreakTypeLB.GetSavedValue() ||
1501 [ # # ]: 0 : aBreakPositionLB.GetSelectEntryPos() != aBreakPositionLB.GetSavedValue() )
1502 : : {
1503 : : const SvxFmtBreakItem rOldBreak(
1504 [ # # ][ # # ]: 0 : (const SvxFmtBreakItem&)GetItemSet().Get( _nWhich ));
1505 [ # # ]: 0 : SvxFmtBreakItem aBreak(rOldBreak.GetBreak(), rOldBreak.Which());
1506 : :
1507 [ # # # ]: 0 : switch ( eState )
1508 : : {
1509 : : case STATE_CHECK:
1510 : : {
1511 [ # # ]: 0 : sal_Bool bBefore = aBreakPositionLB.GetSelectEntryPos() == 0;
1512 : :
1513 [ # # ][ # # ]: 0 : if ( aBreakTypeLB.GetSelectEntryPos() == 0 )
1514 : : {
1515 [ # # ]: 0 : if ( bBefore )
1516 : 0 : aBreak.SetValue( SVX_BREAK_PAGE_BEFORE );
1517 : : else
1518 : 0 : aBreak.SetValue( SVX_BREAK_PAGE_AFTER );
1519 : : }
1520 : : else
1521 : : {
1522 [ # # ]: 0 : if ( bBefore )
1523 : 0 : aBreak.SetValue( SVX_BREAK_COLUMN_BEFORE );
1524 : : else
1525 : 0 : aBreak.SetValue( SVX_BREAK_COLUMN_AFTER );
1526 : : }
1527 : 0 : break;
1528 : : }
1529 : :
1530 : : case STATE_NOCHECK:
1531 : 0 : aBreak.SetValue( SVX_BREAK_NONE );
1532 : 0 : break;
1533 : : default: ; //prevent warning
1534 : : }
1535 [ # # ]: 0 : pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGEBREAK );
1536 : :
1537 [ # # ][ # # ]: 0 : if ( eState != aPageBreakBox.GetSavedValue() ||
[ # # ][ # # ]
1538 [ # # ]: 0 : !pOld || !( *(const SvxFmtBreakItem*)pOld == aBreak ) )
1539 : : {
1540 : 0 : bModified = sal_True;
1541 [ # # ]: 0 : rOutSet.Put( aBreak );
1542 [ # # ][ # # ]: 0 : }
1543 : : }
1544 : : }
1545 : :
1546 : :
1547 : : // paragraph split
1548 [ # # ]: 0 : _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
1549 : 0 : eState = aKeepTogetherBox.GetState();
1550 : :
1551 [ # # ]: 0 : if ( eState != aKeepTogetherBox.GetSavedValue() )
1552 : : {
1553 [ # # ]: 0 : pOld = GetOldItem( rOutSet, SID_ATTR_PARA_SPLIT );
1554 : :
1555 [ # # ][ # # ]: 0 : if ( !pOld || ( (const SvxFmtSplitItem*)pOld )->GetValue() !=
[ # # ]
1556 : : ( eState == STATE_NOCHECK ) )
1557 : : {
1558 [ # # ][ # # ]: 0 : rOutSet.Put( SvxFmtSplitItem( eState == STATE_NOCHECK, _nWhich ) );
[ # # ]
1559 : 0 : bModified = sal_True;
1560 : : }
1561 : : }
1562 : :
1563 : : // keep paragraphs
1564 [ # # ]: 0 : _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
1565 : 0 : eState = aKeepParaBox.GetState();
1566 : :
1567 [ # # ]: 0 : if ( eState != aKeepParaBox.GetSavedValue() )
1568 : : {
1569 [ # # ]: 0 : pOld = GetOldItem( rOutSet, SID_ATTR_PARA_KEEP );
1570 : :
1571 : : // if the status has changed, putting is necessary
1572 [ # # ][ # # ]: 0 : rOutSet.Put( SvxFmtKeepItem( eState == STATE_CHECK, _nWhich ) );
[ # # ]
1573 : 0 : bModified = sal_True;
1574 : : }
1575 : :
1576 : : // widows and orphans
1577 [ # # ]: 0 : _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
1578 : 0 : eState = aWidowBox.GetState();
1579 : :
1580 [ # # ][ # # ]: 0 : if ( eState != aWidowBox.GetSavedValue() ||
[ # # ]
1581 [ # # ]: 0 : aWidowRowNo.IsValueModified() )
1582 : : {
1583 : : SvxWidowsItem rItem( eState == STATE_CHECK ?
1584 [ # # ][ # # ]: 0 : (sal_uInt8)aWidowRowNo.GetValue() : 0, _nWhich );
[ # # ]
1585 [ # # ]: 0 : pOld = GetOldItem( rOutSet, SID_ATTR_PARA_WIDOWS );
1586 : :
1587 [ # # ][ # # ]: 0 : if ( eState != aWidowBox.GetSavedValue() || !pOld || !( *(const SvxWidowsItem*)pOld == rItem ) )
[ # # ][ # # ]
[ # # ]
1588 : : {
1589 [ # # ]: 0 : rOutSet.Put( rItem );
1590 : 0 : bModified = sal_True;
1591 [ # # ]: 0 : }
1592 : : }
1593 : :
1594 [ # # ]: 0 : _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
1595 : 0 : eState = aOrphanBox.GetState();
1596 : :
1597 [ # # ][ # # ]: 0 : if ( eState != aOrphanBox.GetSavedValue() ||
[ # # ]
1598 [ # # ]: 0 : aOrphanRowNo.IsValueModified() )
1599 : : {
1600 : : SvxOrphansItem rItem( eState == STATE_CHECK ?
1601 [ # # ][ # # ]: 0 : (sal_uInt8)aOrphanRowNo.GetValue() : 0, _nWhich );
[ # # ]
1602 [ # # ]: 0 : pOld = GetOldItem( rOutSet, SID_ATTR_PARA_ORPHANS );
1603 : :
1604 [ # # ][ # # ]: 0 : if ( eState != aOrphanBox.GetSavedValue() ||
[ # # ][ # # ]
1605 : : !pOld ||
1606 [ # # ]: 0 : !( *(const SvxOrphansItem*)pOld == rItem ) )
1607 : : {
1608 [ # # ]: 0 : rOutSet.Put( rItem );
1609 : 0 : bModified = sal_True;
1610 [ # # ]: 0 : }
1611 : : }
1612 : :
1613 [ # # ]: 0 : return bModified;
1614 : : }
1615 : :
1616 : : // -----------------------------------------------------------------------
1617 : :
1618 : 0 : void SvxExtParagraphTabPage::Reset( const SfxItemSet& rSet )
1619 : : {
1620 : 0 : sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
1621 : 0 : SfxItemState eItemState = rSet.GetItemState( _nWhich );
1622 : :
1623 : 0 : sal_Bool bItemAvailable = eItemState >= SFX_ITEM_AVAILABLE;
1624 : 0 : sal_Bool bIsHyphen = sal_False;
1625 [ # # ][ # # ]: 0 : if( !bHtmlMode && bItemAvailable )
1626 : : {
1627 : : const SvxHyphenZoneItem& rHyphen =
1628 : 0 : (const SvxHyphenZoneItem&)rSet.Get( _nWhich );
1629 : 0 : aHyphenBox.EnableTriState( sal_False );
1630 : :
1631 : 0 : bIsHyphen = rHyphen.IsHyphen();
1632 [ # # ]: 0 : aHyphenBox.SetState( bIsHyphen ? STATE_CHECK : STATE_NOCHECK );
1633 : :
1634 : 0 : aExtHyphenBeforeBox.SetValue( rHyphen.GetMinLead() );
1635 : 0 : aExtHyphenAfterBox.SetValue( rHyphen.GetMinTrail() );
1636 : 0 : aMaxHyphenEdit.SetValue( rHyphen.GetMaxHyphens() );
1637 : : }
1638 : : else
1639 : : {
1640 : 0 : aHyphenBox.SetState( STATE_DONTKNOW );
1641 : : }
1642 [ # # ][ # # ]: 0 : sal_Bool bEnable = bItemAvailable && bIsHyphen;
1643 : 0 : aExtHyphenBeforeBox.Enable(bEnable);
1644 : 0 : aExtHyphenAfterBox.Enable(bEnable);
1645 : 0 : aBeforeText.Enable(bEnable);
1646 : 0 : aAfterText.Enable(bEnable);
1647 : 0 : aMaxHyphenLabel.Enable(bEnable);
1648 : 0 : aMaxHyphenEdit.Enable(bEnable);
1649 : :
1650 : 0 : _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM );
1651 : :
1652 [ # # ]: 0 : if ( rSet.GetItemState(_nWhich) >= SFX_ITEM_AVAILABLE )
1653 : : {
1654 : : const sal_uInt16 nPageNum =
1655 : 0 : ( (const SfxUInt16Item&)rSet.Get( _nWhich ) ).GetValue();
1656 : 0 : aPagenumEdit.SetValue( nPageNum );
1657 : : }
1658 : :
1659 [ # # ]: 0 : if ( bPageBreak )
1660 : : {
1661 : : // first handle PageModel
1662 : 0 : _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
1663 : 0 : sal_Bool bIsPageModel = sal_False;
1664 : 0 : eItemState = rSet.GetItemState( _nWhich );
1665 : :
1666 [ # # ]: 0 : if ( eItemState >= SFX_ITEM_SET )
1667 : : {
1668 [ # # ]: 0 : aApplyCollBtn.EnableTriState( sal_False );
1669 : :
1670 : : const SvxPageModelItem& rModel =
1671 [ # # ]: 0 : (const SvxPageModelItem&)rSet.Get( _nWhich );
1672 [ # # ]: 0 : String aStr( rModel.GetValue() );
1673 : :
1674 [ # # ][ # # ]: 0 : if ( aStr.Len() &&
[ # # ]
1675 [ # # ]: 0 : aApplyCollBox.GetEntryPos( aStr ) != LISTBOX_ENTRY_NOTFOUND )
1676 : : {
1677 [ # # ]: 0 : aApplyCollBox.SelectEntry( aStr );
1678 [ # # ]: 0 : aApplyCollBtn.SetState( STATE_CHECK );
1679 : 0 : bIsPageModel = sal_True;
1680 : :
1681 [ # # ]: 0 : aPageBreakBox.Enable();
1682 [ # # ]: 0 : aPageBreakBox.EnableTriState( sal_False );
1683 [ # # ]: 0 : aBreakTypeFT.Enable();
1684 [ # # ]: 0 : aBreakTypeLB.Enable();
1685 [ # # ]: 0 : aBreakPositionFT.Enable();
1686 [ # # ]: 0 : aBreakPositionLB.Enable();
1687 [ # # ]: 0 : aApplyCollBtn.Enable();
1688 [ # # ]: 0 : aPageBreakBox.SetState( STATE_CHECK );
1689 : :
1690 : : //select page break
1691 [ # # ]: 0 : aBreakTypeLB.SelectEntryPos(0);
1692 : : //select break before
1693 [ # # ]: 0 : aBreakPositionLB.SelectEntryPos(0);
1694 : : }
1695 : : else
1696 : : {
1697 [ # # ]: 0 : aApplyCollBox.SetNoSelection();
1698 [ # # ]: 0 : aApplyCollBtn.SetState( STATE_NOCHECK );
1699 [ # # ]: 0 : }
1700 : : }
1701 [ # # ]: 0 : else if ( SFX_ITEM_DONTCARE == eItemState )
1702 : : {
1703 : 0 : aApplyCollBtn.EnableTriState( sal_True );
1704 : 0 : aApplyCollBtn.SetState( STATE_DONTKNOW );
1705 : 0 : aApplyCollBox.SetNoSelection();
1706 : : }
1707 : : else
1708 : : {
1709 : 0 : aApplyCollBtn.Enable(sal_False);
1710 : 0 : aApplyCollBox.Enable(sal_False);
1711 : 0 : aPagenumEdit.Enable(sal_False);
1712 : 0 : aPagenumText.Enable(sal_False);
1713 : : }
1714 : :
1715 [ # # ]: 0 : if ( !bIsPageModel )
1716 : : {
1717 : 0 : _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
1718 : 0 : eItemState = rSet.GetItemState( _nWhich );
1719 : :
1720 [ # # ]: 0 : if ( eItemState >= SFX_ITEM_AVAILABLE )
1721 : : {
1722 : : const SvxFmtBreakItem& rPageBreak =
1723 : 0 : (const SvxFmtBreakItem&)rSet.Get( _nWhich );
1724 : :
1725 : 0 : SvxBreak eBreak = (SvxBreak)rPageBreak.GetValue();
1726 : :
1727 : : // PageBreak not via CTRL-RETURN,
1728 : : // then CheckBox can be freed
1729 : 0 : aPageBreakBox.Enable();
1730 : 0 : aPageBreakBox.EnableTriState( sal_False );
1731 : 0 : aBreakTypeFT.Enable();
1732 : 0 : aBreakTypeLB.Enable();
1733 : 0 : aBreakPositionFT.Enable();
1734 : 0 : aBreakPositionLB.Enable();
1735 : :
1736 : 0 : aPageBreakBox.SetState( STATE_CHECK );
1737 : :
1738 : : sal_Bool _bEnable = eBreak != SVX_BREAK_NONE &&
1739 : : eBreak != SVX_BREAK_COLUMN_BEFORE &&
1740 [ # # ][ # # ]: 0 : eBreak != SVX_BREAK_COLUMN_AFTER;
[ # # ]
1741 : 0 : aApplyCollBtn.Enable(_bEnable);
1742 [ # # ]: 0 : if(!_bEnable)
1743 : : {
1744 : 0 : aApplyCollBox.Enable(_bEnable);
1745 : 0 : aPagenumEdit.Enable(_bEnable);
1746 : : }
1747 : :
1748 [ # # ]: 0 : if ( eBreak == SVX_BREAK_NONE )
1749 : 0 : aPageBreakBox.SetState( STATE_NOCHECK );
1750 : :
1751 : 0 : sal_uInt16 nType = 0; // selection position in break type ListBox : Page
1752 : 0 : sal_uInt16 nPosition = 0; // selection position in break position ListBox : Before
1753 [ # # # # : 0 : switch ( eBreak )
# ]
1754 : : {
1755 : : case SVX_BREAK_PAGE_BEFORE:
1756 : 0 : break;
1757 : : case SVX_BREAK_PAGE_AFTER:
1758 : 0 : nPosition = 1;
1759 : 0 : break;
1760 : : case SVX_BREAK_COLUMN_BEFORE:
1761 : 0 : nType = 1;
1762 : 0 : break;
1763 : : case SVX_BREAK_COLUMN_AFTER:
1764 : 0 : nType = 1;
1765 : 0 : nPosition = 1;
1766 : 0 : break;
1767 : : default: ;//prevent warning
1768 : : }
1769 : 0 : aBreakTypeLB.SelectEntryPos(nType);
1770 : 0 : aBreakPositionLB.SelectEntryPos(nPosition);
1771 : : }
1772 [ # # ]: 0 : else if ( SFX_ITEM_DONTCARE == eItemState )
1773 : 0 : aPageBreakBox.SetState( STATE_DONTKNOW );
1774 : : else
1775 : : {
1776 : 0 : aPageBreakBox.Enable(sal_False);
1777 : 0 : aBreakTypeFT.Enable(sal_False);
1778 : 0 : aBreakTypeLB.Enable(sal_False);
1779 : 0 : aBreakPositionFT.Enable(sal_False);
1780 : 0 : aBreakPositionLB.Enable(sal_False);
1781 : : }
1782 : : }
1783 : :
1784 : 0 : PageBreakPosHdl_Impl( &aBreakPositionLB );
1785 : 0 : PageBreakHdl_Impl( &aPageBreakBox );
1786 : : }
1787 : :
1788 : 0 : _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
1789 : 0 : eItemState = rSet.GetItemState( _nWhich );
1790 : :
1791 [ # # ]: 0 : if ( eItemState >= SFX_ITEM_AVAILABLE )
1792 : : {
1793 : 0 : aKeepParaBox.EnableTriState( sal_False );
1794 : : const SvxFmtKeepItem& rKeep =
1795 : 0 : (const SvxFmtKeepItem&)rSet.Get( _nWhich );
1796 : :
1797 [ # # ]: 0 : if ( rKeep.GetValue() )
1798 : 0 : aKeepParaBox.SetState( STATE_CHECK );
1799 : : else
1800 : 0 : aKeepParaBox.SetState( STATE_NOCHECK );
1801 : : }
1802 [ # # ]: 0 : else if ( SFX_ITEM_DONTCARE == eItemState )
1803 : 0 : aKeepParaBox.SetState( STATE_DONTKNOW );
1804 : : else
1805 : 0 : aKeepParaBox.Enable(sal_False);
1806 : :
1807 : 0 : _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
1808 : 0 : eItemState = rSet.GetItemState( _nWhich );
1809 : :
1810 [ # # ]: 0 : if ( eItemState >= SFX_ITEM_AVAILABLE )
1811 : : {
1812 : : const SvxFmtSplitItem& rSplit =
1813 : 0 : (const SvxFmtSplitItem&)rSet.Get( _nWhich );
1814 : 0 : aKeepTogetherBox.EnableTriState( sal_False );
1815 : :
1816 [ # # ]: 0 : if ( !rSplit.GetValue() )
1817 : 0 : aKeepTogetherBox.SetState( STATE_CHECK );
1818 : : else
1819 : : {
1820 : 0 : aKeepTogetherBox.SetState( STATE_NOCHECK );
1821 : :
1822 : : // widows and orphans
1823 : 0 : aWidowBox.Enable();
1824 : 0 : _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
1825 : 0 : SfxItemState eTmpState = rSet.GetItemState( _nWhich );
1826 : :
1827 [ # # ]: 0 : if ( eTmpState >= SFX_ITEM_AVAILABLE )
1828 : : {
1829 : : const SvxWidowsItem& rWidow =
1830 : 0 : (const SvxWidowsItem&)rSet.Get( _nWhich );
1831 : 0 : aWidowBox.EnableTriState( sal_False );
1832 : 0 : const sal_uInt16 nLines = rWidow.GetValue();
1833 : :
1834 : 0 : sal_Bool _bEnable = nLines > 0;
1835 : 0 : aWidowRowNo.SetValue( aWidowRowNo.Normalize( nLines ) );
1836 [ # # ]: 0 : aWidowBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK);
1837 : 0 : aWidowRowNo.Enable(_bEnable);
1838 : 0 : aWidowRowLabel.Enable(_bEnable);
1839 : :
1840 : : }
1841 [ # # ]: 0 : else if ( SFX_ITEM_DONTCARE == eTmpState )
1842 : 0 : aWidowBox.SetState( STATE_DONTKNOW );
1843 : : else
1844 : 0 : aWidowBox.Enable(sal_False);
1845 : :
1846 : 0 : aOrphanBox.Enable();
1847 : 0 : _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
1848 : 0 : eTmpState = rSet.GetItemState( _nWhich );
1849 : :
1850 [ # # ]: 0 : if ( eTmpState >= SFX_ITEM_AVAILABLE )
1851 : : {
1852 : : const SvxOrphansItem& rOrphan =
1853 : 0 : (const SvxOrphansItem&)rSet.Get( _nWhich );
1854 : 0 : const sal_uInt16 nLines = rOrphan.GetValue();
1855 : 0 : aOrphanBox.EnableTriState( sal_False );
1856 : :
1857 : 0 : sal_Bool _bEnable = nLines > 0;
1858 [ # # ]: 0 : aOrphanBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK);
1859 : 0 : aOrphanRowNo.SetValue( aOrphanRowNo.Normalize( nLines ) );
1860 : 0 : aOrphanRowNo.Enable(_bEnable);
1861 : 0 : aOrphanRowLabel.Enable(_bEnable);
1862 : :
1863 : : }
1864 [ # # ]: 0 : else if ( SFX_ITEM_DONTCARE == eTmpState )
1865 : 0 : aOrphanBox.SetState( STATE_DONTKNOW );
1866 : : else
1867 : 0 : aOrphanBox.Enable(sal_False);
1868 : : }
1869 : : }
1870 [ # # ]: 0 : else if ( SFX_ITEM_DONTCARE == eItemState )
1871 : 0 : aKeepTogetherBox.SetState( STATE_DONTKNOW );
1872 : : else
1873 : 0 : aKeepTogetherBox.Enable(sal_False);
1874 : :
1875 : : // so that everything is enabled correctly
1876 : 0 : KeepTogetherHdl_Impl( 0 );
1877 : 0 : WidowHdl_Impl( 0 );
1878 : 0 : OrphanHdl_Impl( 0 );
1879 : :
1880 : 0 : aHyphenBox.SaveValue();
1881 : 0 : aExtHyphenBeforeBox.SaveValue();
1882 : 0 : aExtHyphenAfterBox.SaveValue();
1883 : 0 : aMaxHyphenEdit.SaveValue();
1884 : 0 : aPageBreakBox.SaveValue();
1885 : 0 : aBreakPositionLB.SaveValue();
1886 : 0 : aBreakTypeLB.SaveValue();
1887 : 0 : aApplyCollBtn.SaveValue();
1888 : 0 : aApplyCollBox.SaveValue();
1889 : 0 : aPagenumEdit.SaveValue();
1890 : 0 : aKeepTogetherBox.SaveValue();
1891 : 0 : aKeepParaBox.SaveValue();
1892 : 0 : aWidowBox.SaveValue();
1893 : 0 : aOrphanBox.SaveValue();
1894 : 0 : }
1895 : :
1896 : : // -----------------------------------------------------------------------
1897 : :
1898 : 0 : int SvxExtParagraphTabPage::DeactivatePage( SfxItemSet* _pSet )
1899 : : {
1900 [ # # ]: 0 : if ( _pSet )
1901 : 0 : FillItemSet( *_pSet );
1902 : 0 : return LEAVE_PAGE;
1903 : : }
1904 : :
1905 : : // -----------------------------------------------------------------------
1906 : :
1907 : 0 : void SvxExtParagraphTabPage::DisablePageBreak()
1908 : : {
1909 : 0 : bPageBreak = sal_False;
1910 : 0 : aPageBreakBox.Enable(sal_False);
1911 : 0 : aBreakTypeLB.RemoveEntry(0);
1912 : 0 : aBreakPositionFT.Enable(sal_False);
1913 : 0 : aBreakPositionLB.Enable(sal_False);
1914 : 0 : aApplyCollBtn.Enable(sal_False);
1915 : 0 : aApplyCollBox.Enable(sal_False);
1916 : 0 : aPagenumEdit.Enable(sal_False);
1917 : 0 : }
1918 : :
1919 : : // -----------------------------------------------------------------------
1920 : :
1921 : 0 : SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window* pParent, const SfxItemSet& rAttr ) :
1922 : :
1923 : 0 : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_EXT_PARAGRAPH ), rAttr ),
1924 : :
1925 [ # # ]: 0 : aExtFL ( this, CUI_RES( FL_HYPHEN ) ),
1926 [ # # ]: 0 : aHyphenBox ( this, CUI_RES( BTN_HYPHEN ) ),
1927 [ # # ]: 0 : aBeforeText ( this, CUI_RES( FT_HYPHENBEFORE ) ),
1928 [ # # ]: 0 : aExtHyphenBeforeBox ( this, CUI_RES( ED_HYPHENBEFORE ) ),
1929 [ # # ]: 0 : aAfterText ( this, CUI_RES( FT_HYPHENAFTER ) ),
1930 [ # # ]: 0 : aExtHyphenAfterBox ( this, CUI_RES( ED_HYPHENAFTER ) ),
1931 [ # # ]: 0 : aMaxHyphenLabel ( this, CUI_RES( FT_MAXHYPH ) ),
1932 [ # # ]: 0 : aMaxHyphenEdit ( this, CUI_RES( ED_MAXHYPH ) ),
1933 [ # # ]: 0 : aBreaksFL ( this, CUI_RES( FL_BREAKS ) ),
1934 [ # # ]: 0 : aPageBreakBox ( this, CUI_RES( BTN_PAGEBREAK ) ),
1935 [ # # ]: 0 : aBreakTypeFT ( this, CUI_RES( FT_BREAKTYPE )),
1936 [ # # ]: 0 : aBreakTypeLB ( this, CUI_RES( LB_BREAKTYPE )),
1937 [ # # ]: 0 : aBreakPositionFT ( this, CUI_RES( FT_BREAKPOSITION )),
1938 [ # # ]: 0 : aBreakPositionLB ( this, CUI_RES( LB_BREAKPOSITION )),
1939 [ # # ]: 0 : aApplyCollBtn ( this, CUI_RES( BTN_PAGECOLL ) ),
1940 [ # # ]: 0 : aApplyCollBox ( this, CUI_RES( LB_PAGECOLL ) ),
1941 [ # # ]: 0 : aPagenumText ( this, CUI_RES( FT_PAGENUM ) ),
1942 [ # # ]: 0 : aPagenumEdit ( this, CUI_RES( ED_PAGENUM ) ),
1943 [ # # ]: 0 : aExtendFL ( this, CUI_RES( FL_OPTIONS ) ),
1944 [ # # ]: 0 : aKeepTogetherBox ( this, CUI_RES( BTN_KEEPTOGETHER ) ),
1945 [ # # ]: 0 : aKeepParaBox ( this, CUI_RES( CB_KEEPTOGETHER ) ),
1946 [ # # ]: 0 : aOrphanBox ( this, CUI_RES( BTN_ORPHANS ) ),
1947 [ # # ]: 0 : aOrphanRowNo ( this, CUI_RES( ED_ORPHANS ) ),
1948 [ # # ]: 0 : aOrphanRowLabel ( this, CUI_RES( FT_ORPHANS ) ),
1949 [ # # ]: 0 : aWidowBox ( this, CUI_RES( BTN_WIDOWS ) ),
1950 [ # # ]: 0 : aWidowRowNo ( this, CUI_RES( ED_WIDOWS ) ),
1951 [ # # ]: 0 : aWidowRowLabel ( this, CUI_RES( FT_WIDOWS ) ),
1952 : : bPageBreak ( sal_True ),
1953 : : bHtmlMode ( sal_False ),
1954 [ # # ][ # # ]: 0 : nStdPos ( 0 )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1955 : : {
1956 [ # # ]: 0 : FreeResource();
1957 : :
1958 [ # # ]: 0 : aApplyCollBox.SetAccessibleRelationLabeledBy(&aApplyCollBtn);
1959 [ # # ][ # # ]: 0 : aApplyCollBox.SetAccessibleName(String(CUI_RES(STR_PAGE_STYLE)));
[ # # ][ # # ]
1960 [ # # ]: 0 : aOrphanRowNo.SetAccessibleRelationLabeledBy(&aOrphanBox);
1961 [ # # ]: 0 : aWidowRowNo.SetAccessibleRelationLabeledBy(&aWidowBox);
1962 : :
1963 : : // this page needs ExchangeSupport
1964 : 0 : SetExchangeSupport();
1965 : :
1966 [ # # ]: 0 : aHyphenBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, HyphenClickHdl_Impl ) );
1967 [ # # ]: 0 : aPageBreakBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, PageBreakHdl_Impl ) );
1968 [ # # ]: 0 : aKeepTogetherBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl ) );
1969 [ # # ]: 0 : aWidowBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, WidowHdl_Impl ) );
1970 [ # # ]: 0 : aOrphanBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, OrphanHdl_Impl ) );
1971 [ # # ]: 0 : aApplyCollBtn.SetClickHdl( LINK( this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl ) );
1972 [ # # ]: 0 : aBreakTypeLB.SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl ) );
1973 [ # # ]: 0 : aBreakPositionLB.SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl ) );
1974 : :
1975 [ # # ]: 0 : SfxObjectShell* pSh = SfxObjectShell::Current();
1976 [ # # ]: 0 : if ( pSh )
1977 : : {
1978 [ # # ]: 0 : SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool();
1979 [ # # ]: 0 : pPool->SetSearchMask( SFX_STYLE_FAMILY_PAGE );
1980 [ # # ]: 0 : SfxStyleSheetBase* pStyle = pPool->First();
1981 [ # # ]: 0 : String aStdName;
1982 : :
1983 [ # # ]: 0 : while( pStyle )
1984 : : {
1985 [ # # ]: 0 : if ( aStdName.Len() == 0 )
1986 : : // first style == standard style
1987 [ # # ][ # # ]: 0 : aStdName = pStyle->GetName();
1988 [ # # ][ # # ]: 0 : aApplyCollBox.InsertEntry( pStyle->GetName() );
1989 [ # # ]: 0 : pStyle = pPool->Next();
1990 : : }
1991 [ # # ][ # # ]: 0 : nStdPos = aApplyCollBox.GetEntryPos( aStdName );
1992 : : }
1993 : :
1994 [ # # ]: 0 : sal_uInt16 nHtmlMode = GetHtmlMode_Impl( rAttr );
1995 [ # # ]: 0 : if ( nHtmlMode & HTMLMODE_ON )
1996 : : {
1997 : 0 : bHtmlMode = sal_True;
1998 [ # # ]: 0 : aHyphenBox .Enable(sal_False);
1999 [ # # ]: 0 : aBeforeText .Enable(sal_False);
2000 [ # # ]: 0 : aExtHyphenBeforeBox .Enable(sal_False);
2001 [ # # ]: 0 : aAfterText .Enable(sal_False);
2002 [ # # ]: 0 : aExtHyphenAfterBox .Enable(sal_False);
2003 [ # # ]: 0 : aMaxHyphenLabel .Enable(sal_False);
2004 [ # # ]: 0 : aMaxHyphenEdit .Enable(sal_False);
2005 [ # # ]: 0 : aExtFL .Enable(sal_False);
2006 [ # # ]: 0 : aPagenumText .Enable(sal_False);
2007 [ # # ]: 0 : aPagenumEdit .Enable(sal_False);
2008 : : // no column break in HTML
2009 [ # # ]: 0 : aBreakTypeLB.RemoveEntry(1);
2010 : : }
2011 : 0 : }
2012 : :
2013 : : // -----------------------------------------------------------------------
2014 : :
2015 [ # # ][ # # ]: 0 : SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2016 : : {
2017 [ # # ]: 0 : }
2018 : :
2019 : : // -----------------------------------------------------------------------
2020 : :
2021 : 0 : sal_uInt16* SvxExtParagraphTabPage::GetRanges()
2022 : : {
2023 : 0 : return pExtRanges;
2024 : : }
2025 : :
2026 : : // -----------------------------------------------------------------------
2027 : :
2028 : 0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, PageBreakHdl_Impl)
2029 : : {
2030 [ # # # ]: 0 : switch ( aPageBreakBox.GetState() )
2031 : : {
2032 : : case STATE_CHECK:
2033 : 0 : aBreakTypeFT.Enable();
2034 : 0 : aBreakTypeLB.Enable();
2035 : 0 : aBreakPositionFT.Enable();
2036 : 0 : aBreakPositionLB.Enable();
2037 : :
2038 [ # # ]: 0 : if ( 0 == aBreakTypeLB.GetSelectEntryPos()&&
[ # # # # ]
2039 : 0 : 0 == aBreakPositionLB.GetSelectEntryPos() )
2040 : : {
2041 : 0 : aApplyCollBtn.Enable();
2042 : :
2043 : 0 : sal_Bool bEnable = STATE_CHECK == aApplyCollBtn.GetState() &&
2044 [ # # ][ # # ]: 0 : aApplyCollBox.GetEntryCount();
2045 : 0 : aApplyCollBox.Enable(bEnable);
2046 [ # # ]: 0 : if(!bHtmlMode)
2047 : : {
2048 : 0 : aPagenumText.Enable(bEnable);
2049 : 0 : aPagenumEdit.Enable(bEnable);
2050 : : }
2051 : : }
2052 : 0 : break;
2053 : :
2054 : : case STATE_NOCHECK:
2055 : : case STATE_DONTKNOW:
2056 : 0 : aApplyCollBtn.SetState( STATE_NOCHECK );
2057 : 0 : aApplyCollBtn.Enable(sal_False);
2058 : 0 : aApplyCollBox.Enable(sal_False);
2059 : 0 : aPagenumText.Enable(sal_False);
2060 : 0 : aPagenumEdit.Enable(sal_False);
2061 : 0 : aBreakTypeFT.Enable(sal_False);
2062 : 0 : aBreakTypeLB.Enable(sal_False);
2063 : 0 : aBreakPositionFT.Enable(sal_False);
2064 : 0 : aBreakPositionLB.Enable(sal_False);
2065 : 0 : break;
2066 : : }
2067 : 0 : return 0;
2068 : : }
2069 : :
2070 : : // -----------------------------------------------------------------------
2071 : :
2072 : 0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, KeepTogetherHdl_Impl)
2073 : : {
2074 : 0 : sal_Bool bEnable = aKeepTogetherBox.GetState() == STATE_NOCHECK;
2075 : 0 : aWidowBox.Enable(bEnable);
2076 : 0 : aOrphanBox.Enable(bEnable);
2077 : :
2078 : 0 : return 0;
2079 : : }
2080 : :
2081 : : // -----------------------------------------------------------------------
2082 : :
2083 : 0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, WidowHdl_Impl)
2084 : : {
2085 [ # # # # ]: 0 : switch ( aWidowBox.GetState() )
2086 : : {
2087 : : case STATE_CHECK:
2088 : 0 : aWidowRowNo.Enable();
2089 : 0 : aWidowRowLabel.Enable();
2090 : 0 : aKeepTogetherBox.Enable(sal_False);
2091 : 0 : break;
2092 : :
2093 : : case STATE_NOCHECK:
2094 [ # # ]: 0 : if ( aOrphanBox.GetState() == STATE_NOCHECK )
2095 : 0 : aKeepTogetherBox.Enable();
2096 : :
2097 : : // no break
2098 : : case STATE_DONTKNOW:
2099 : 0 : aWidowRowNo.Enable(sal_False);
2100 : 0 : aWidowRowLabel.Enable(sal_False);
2101 : 0 : break;
2102 : : }
2103 : 0 : return 0;
2104 : : }
2105 : :
2106 : : // -----------------------------------------------------------------------
2107 : :
2108 : 0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, OrphanHdl_Impl)
2109 : : {
2110 [ # # # # ]: 0 : switch( aOrphanBox.GetState() )
2111 : : {
2112 : : case STATE_CHECK:
2113 : 0 : aOrphanRowNo.Enable();
2114 : 0 : aOrphanRowLabel.Enable();
2115 : 0 : aKeepTogetherBox.Enable(sal_False);
2116 : 0 : break;
2117 : :
2118 : : case STATE_NOCHECK:
2119 [ # # ]: 0 : if ( aWidowBox.GetState() == STATE_NOCHECK )
2120 : 0 : aKeepTogetherBox.Enable();
2121 : :
2122 : : // kein break
2123 : : case STATE_DONTKNOW:
2124 : 0 : aOrphanRowNo.Enable(sal_False);
2125 : 0 : aOrphanRowLabel.Enable(sal_False);
2126 : 0 : break;
2127 : : }
2128 : 0 : return 0;
2129 : : }
2130 : :
2131 : : // -----------------------------------------------------------------------
2132 : :
2133 : 0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, HyphenClickHdl_Impl)
2134 : : {
2135 : :
2136 : 0 : sal_Bool bEnable = aHyphenBox.GetState() == STATE_CHECK;
2137 : 0 : aBeforeText.Enable(bEnable);
2138 : 0 : aExtHyphenBeforeBox.Enable(bEnable);
2139 : 0 : aAfterText.Enable(bEnable);
2140 : 0 : aExtHyphenAfterBox.Enable(bEnable);
2141 : 0 : aMaxHyphenLabel.Enable(bEnable);
2142 : 0 : aMaxHyphenEdit.Enable(bEnable);
2143 [ # # ]: 0 : aHyphenBox.SetState( bEnable ? STATE_CHECK : STATE_NOCHECK);
2144 : :
2145 : 0 : return 0;
2146 : : }
2147 : :
2148 : : // -----------------------------------------------------------------------
2149 : :
2150 : 0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl)
2151 : : {
2152 : 0 : sal_Bool bEnable = sal_False;
2153 [ # # # # ]: 0 : if ( aApplyCollBtn.GetState() == STATE_CHECK &&
[ # # ]
2154 : 0 : aApplyCollBox.GetEntryCount() )
2155 : : {
2156 : 0 : bEnable = sal_True;
2157 : 0 : aApplyCollBox.SelectEntryPos( nStdPos );
2158 : : }
2159 : : else
2160 : : {
2161 : 0 : aApplyCollBox.SetNoSelection();
2162 : : }
2163 : 0 : aApplyCollBox.Enable(bEnable);
2164 [ # # ]: 0 : if(!bHtmlMode)
2165 : : {
2166 : 0 : aPagenumText.Enable(bEnable);
2167 : 0 : aPagenumEdit.Enable(bEnable);
2168 : : }
2169 : 0 : return 0;
2170 : : }
2171 : :
2172 : : // -----------------------------------------------------------------------
2173 : :
2174 : 0 : IMPL_LINK( SvxExtParagraphTabPage, PageBreakPosHdl_Impl, ListBox *, pListBox )
2175 : : {
2176 [ # # ]: 0 : if ( 0 == pListBox->GetSelectEntryPos() )
2177 : : {
2178 : 0 : aApplyCollBtn.Enable();
2179 : :
2180 : 0 : sal_Bool bEnable = aApplyCollBtn.GetState() == STATE_CHECK &&
2181 [ # # ][ # # ]: 0 : aApplyCollBox.GetEntryCount();
2182 : :
2183 : 0 : aApplyCollBox.Enable(bEnable);
2184 [ # # ]: 0 : if(!bHtmlMode)
2185 : : {
2186 : 0 : aPagenumText.Enable(bEnable);
2187 : 0 : aPagenumEdit.Enable(bEnable);
2188 : : }
2189 : : }
2190 [ # # ]: 0 : else if ( 1 == pListBox->GetSelectEntryPos() )
2191 : : {
2192 : 0 : aApplyCollBtn.SetState( STATE_NOCHECK );
2193 : 0 : aApplyCollBtn.Enable(sal_False);
2194 : 0 : aApplyCollBox.Enable(sal_False);
2195 : 0 : aPagenumText.Enable(sal_False);
2196 : 0 : aPagenumEdit.Enable(sal_False);
2197 : : }
2198 : 0 : return 0;
2199 : : }
2200 : :
2201 : : // -----------------------------------------------------------------------
2202 : :
2203 : 0 : IMPL_LINK( SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, ListBox *, pListBox )
2204 : : {
2205 : : //column break or break break after
2206 : 0 : sal_uInt16 nBreakPos = aBreakPositionLB.GetSelectEntryPos();
2207 [ # # ][ # # ]: 0 : if ( pListBox->GetSelectEntryPos() == 1 || 1 == nBreakPos)
[ # # ]
2208 : : {
2209 : 0 : aApplyCollBtn.SetState( STATE_NOCHECK );
2210 : 0 : aApplyCollBtn.Enable(sal_False);
2211 : 0 : aApplyCollBox.Enable(sal_False);
2212 : 0 : aPagenumText.Enable(sal_False);
2213 : 0 : aPagenumEdit.Enable(sal_False);
2214 : : }
2215 : : else
2216 : 0 : PageBreakPosHdl_Impl( &aBreakPositionLB );
2217 : 0 : return 0;
2218 : : }
2219 : :
2220 : 0 : void SvxExtParagraphTabPage::PageCreated(SfxAllItemSet aSet)
2221 : : {
2222 : :
2223 : :
2224 : 0 : SFX_ITEMSET_ARG (&aSet,pDisablePageBreakItem,SfxBoolItem,SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_False);
2225 : :
2226 [ # # ]: 0 : if (pDisablePageBreakItem)
2227 [ # # ]: 0 : if ( pDisablePageBreakItem->GetValue())
2228 : 0 : DisablePageBreak();
2229 : :
2230 : :
2231 : 0 : }
2232 : :
2233 : 0 : SvxAsianTabPage::SvxAsianTabPage( Window* pParent, const SfxItemSet& rSet ) :
2234 : 0 : SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_PARA_ASIAN ), rSet),
2235 [ # # ]: 0 : aOptionsFL( this, CUI_RES(FL_AS_OPTIONS )),
2236 [ # # ]: 0 : aForbiddenRulesCB( this, CUI_RES(CB_AS_FORBIDDEN )),
2237 [ # # ]: 0 : aHangingPunctCB( this, CUI_RES(CB_AS_HANG_PUNC )),
2238 [ # # ][ # # ]: 0 : aScriptSpaceCB( this, CUI_RES(CB_AS_SCRIPT_SPACE ))//,
[ # # ][ # # ]
[ # # ][ # # ]
2239 : :
2240 : : {
2241 [ # # ]: 0 : FreeResource();
2242 : :
2243 [ # # ]: 0 : Link aLink = LINK( this, SvxAsianTabPage, ClickHdl_Impl );
2244 : 0 : aHangingPunctCB.SetClickHdl( aLink );
2245 : 0 : aScriptSpaceCB.SetClickHdl( aLink );
2246 : 0 : aForbiddenRulesCB.SetClickHdl( aLink );
2247 : :
2248 : 0 : }
2249 : :
2250 [ # # ][ # # ]: 0 : SvxAsianTabPage::~SvxAsianTabPage()
[ # # ][ # # ]
2251 : : {
2252 [ # # ]: 0 : }
2253 : :
2254 : 0 : SfxTabPage* SvxAsianTabPage::Create( Window* pParent, const SfxItemSet& rSet )
2255 : : {
2256 [ # # ]: 0 : return new SvxAsianTabPage(pParent, rSet);
2257 : : }
2258 : :
2259 : 0 : sal_uInt16* SvxAsianTabPage::GetRanges()
2260 : : {
2261 : : static sal_uInt16 pRanges[] =
2262 : : {
2263 : : SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES,
2264 : : 0
2265 : : };
2266 : 0 : return pRanges;
2267 : : }
2268 : :
2269 : 0 : sal_Bool SvxAsianTabPage::FillItemSet( SfxItemSet& rSet )
2270 : : {
2271 : 0 : sal_Bool bRet = sal_False;
2272 : 0 : SfxItemPool* pPool = rSet.GetPool();
2273 [ # # ]: 0 : if(aScriptSpaceCB.IsChecked() != aScriptSpaceCB.GetSavedValue())
2274 : : {
2275 : : SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
2276 : 0 : pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone();
2277 : 0 : pNewItem->SetValue(aScriptSpaceCB.IsChecked());
2278 : 0 : rSet.Put(*pNewItem);
2279 [ # # ]: 0 : delete pNewItem;
2280 : 0 : bRet = sal_True;
2281 : : }
2282 [ # # ]: 0 : if(aHangingPunctCB.IsChecked() != aHangingPunctCB.GetSavedValue())
2283 : : {
2284 : : SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
2285 : 0 : pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone();
2286 : 0 : pNewItem->SetValue(aHangingPunctCB.IsChecked());
2287 : 0 : rSet.Put(*pNewItem);
2288 [ # # ]: 0 : delete pNewItem;
2289 : 0 : bRet = sal_True;
2290 : : }
2291 [ # # ]: 0 : if(aForbiddenRulesCB.IsChecked() != aForbiddenRulesCB.GetSavedValue())
2292 : : {
2293 : : SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
2294 : 0 : pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone();
2295 : 0 : pNewItem->SetValue(aForbiddenRulesCB.IsChecked());
2296 : 0 : rSet.Put(*pNewItem);
2297 [ # # ]: 0 : delete pNewItem;
2298 : 0 : bRet = sal_True;
2299 : : }
2300 : 0 : return bRet;
2301 : : }
2302 : :
2303 : 0 : void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, TriStateBox& rBox)
2304 : : {
2305 : 0 : sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId);
2306 : 0 : SfxItemState eState = rSet.GetItemState(_nWhich, sal_True);
2307 [ # # ][ # # ]: 0 : if(!eState || eState == SFX_ITEM_DISABLED )
2308 : 0 : rBox.Enable(sal_False);
2309 [ # # ]: 0 : else if(eState >= SFX_ITEM_AVAILABLE)
2310 : : {
2311 : 0 : rBox.EnableTriState( sal_False );
2312 : 0 : rBox.Check(((const SfxBoolItem&)rSet.Get(_nWhich)).GetValue());
2313 : : }
2314 : : else
2315 : 0 : rBox.SetState( STATE_DONTKNOW );
2316 : 0 : rBox.SaveValue();
2317 : 0 : }
2318 : :
2319 : :
2320 : 0 : void SvxAsianTabPage::Reset( const SfxItemSet& rSet )
2321 : : {
2322 : 0 : lcl_SetBox(rSet, SID_ATTR_PARA_FORBIDDEN_RULES, aForbiddenRulesCB );
2323 : 0 : lcl_SetBox(rSet, SID_ATTR_PARA_HANGPUNCTUATION, aHangingPunctCB );
2324 : :
2325 : : //character distance not yet available
2326 : 0 : lcl_SetBox(rSet, SID_ATTR_PARA_SCRIPTSPACE, aScriptSpaceCB );
2327 : 0 : }
2328 : :
2329 : 0 : IMPL_LINK( SvxAsianTabPage, ClickHdl_Impl, TriStateBox*, pBox )
2330 : : {
2331 : 0 : pBox->EnableTriState( sal_False );
2332 : 0 : return 0;
2333 : : }
2334 : :
2335 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|