1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svl/style.hxx>
21 #include <sfx2/app.hxx>
22 #include <sfx2/objsh.hxx>
23 #include <sfx2/module.hxx>
24 #include <vcl/mnemonic.hxx>
25 #include <svx/dialogs.hrc>
27 #include <svl/languageoptions.hxx>
28 #include <svl/cjkoptions.hxx>
29 #include <editeng/pgrditem.hxx>
31 #include "paragrph.hrc"
32 #include "paragrph.hxx"
33 #include <editeng/frmdiritem.hxx>
34 #include <editeng/lspcitem.hxx>
35 #include <editeng/adjustitem.hxx>
36 #include <editeng/orphitem.hxx>
37 #include <editeng/widwitem.hxx>
38 #include <editeng/tstpitem.hxx>
39 #include <editeng/pmdlitem.hxx>
40 #include <editeng/spltitem.hxx>
41 #include <editeng/hyphenzoneitem.hxx>
42 #include <editeng/ulspitem.hxx>
43 #include <editeng/lrspitem.hxx>
44 #include <editeng/formatbreakitem.hxx>
45 #include <editeng/keepitem.hxx>
46 #include "svx/dlgutil.hxx"
47 #include <dialmgr.hxx>
48 #include <sfx2/htmlmode.hxx>
49 #include <editeng/paravertalignitem.hxx>
50 #include <svl/eitem.hxx>
51 #include <sfx2/request.hxx>
52 #include <svl/intitem.hxx>
54 // static ----------------------------------------------------------------
56 static sal_uInt16 pStdRanges
[] =
58 SID_ATTR_PARA_LINESPACE
, // 10033
59 SID_ATTR_PARA_LINESPACE
,
60 SID_ATTR_LRSPACE
, // 10048 -
61 SID_ATTR_ULSPACE
, // 10049
62 SID_ATTR_PARA_REGISTER
, // 10413
63 SID_ATTR_PARA_REGISTER
,
67 static sal_uInt16 pAlignRanges
[] =
69 SID_ATTR_PARA_ADJUST
, // 10027
74 static sal_uInt16 pExtRanges
[] =
76 SID_ATTR_PARA_PAGEBREAK
, // 10037 -
77 SID_ATTR_PARA_WIDOWS
, // 10041
78 SID_ATTR_PARA_MODEL
, // 10065 -
79 SID_ATTR_PARA_KEEP
, // 10066
83 // define ----------------------------------------------------------------
85 #define MAX_DURCH 5670 // 10 cm makes sense as maximum interline lead
87 #define FIX_DIST_DEF 283 // standard fix distance 0,5 cm
89 // enum ------------------------------------------------------------------
103 // C-Function ------------------------------------------------------------
105 void SetLineSpace_Impl( SvxLineSpacingItem
&, int, long lValue
= 0 );
107 void SetLineSpace_Impl( SvxLineSpacingItem
& rLineSpace
,
108 int eSpace
, long lValue
)
113 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
114 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
118 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
119 rLineSpace
.SetPropLineSpace( 150 );
123 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
124 rLineSpace
.SetPropLineSpace( 200 );
127 case LLINESPACE_PROP
:
128 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
129 rLineSpace
.SetPropLineSpace( (sal_uInt8
)lValue
);
133 rLineSpace
.SetLineHeight( (sal_uInt16
)lValue
);
134 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
137 case LLINESPACE_DURCH
:
138 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
139 rLineSpace
.SetInterLineSpace( (sal_uInt16
)lValue
);
143 rLineSpace
.SetLineHeight((sal_uInt16
)lValue
);
144 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_FIX
;
145 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
151 sal_uInt16
GetHtmlMode_Impl(const SfxItemSet
& rSet
)
153 sal_uInt16 nHtmlMode
= 0;
154 const SfxPoolItem
* pItem
= 0;
155 SfxObjectShell
* pShell
;
156 if(SFX_ITEM_SET
== rSet
.GetItemState(SID_HTML_MODE
, sal_False
, &pItem
) ||
157 ( 0 != (pShell
= SfxObjectShell::Current()) &&
158 0 != (pItem
= pShell
->GetItem(SID_HTML_MODE
))))
160 nHtmlMode
= ((SfxUInt16Item
*)pItem
)->GetValue();
166 // class SvxStdParagraphTabPage ------------------------------------------
168 IMPL_LINK_NOARG(SvxStdParagraphTabPage
, ELRLoseFocusHdl
)
170 SfxItemPool
* pPool
= GetItemSet().GetPool();
171 DBG_ASSERT( pPool
, "Wo ist der Pool" );
173 MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
175 sal_Int64 nL
= aLeftIndent
.Denormalize( aLeftIndent
.GetValue( eUnit
) );
176 sal_Int64 nR
= aRightIndent
.Denormalize( aRightIndent
.GetValue( eUnit
) );
177 String aTmp
= aFLineIndent
.GetText();
179 if( aLeftIndent
.GetMin() < 0 )
180 aFLineIndent
.SetMin( -99999, FUNIT_MM
);
182 aFLineIndent
.SetMin( aFLineIndent
.Normalize( -nL
), eUnit
);
184 // Check only for concrete width (Shell)
185 sal_Int64 nTmp
= nWidth
- nL
- nR
- MM50
;
186 aFLineIndent
.SetMax( aFLineIndent
.Normalize( nTmp
), eUnit
);
189 aFLineIndent
.SetEmptyFieldValue();
190 // maximum left right
191 aTmp
= aLeftIndent
.GetText();
192 nTmp
= nWidth
- nR
- MM50
;
193 aLeftIndent
.SetMax( aLeftIndent
.Normalize( nTmp
), eUnit
);
196 aLeftIndent
.SetEmptyFieldValue();
197 aTmp
= aRightIndent
.GetText();
198 nTmp
= nWidth
- nL
- MM50
;
199 aRightIndent
.SetMax( aRightIndent
.Normalize( nTmp
), eUnit
);
202 aRightIndent
.SetEmptyFieldValue();
206 // -----------------------------------------------------------------------
208 SfxTabPage
* SvxStdParagraphTabPage::Create( Window
* pParent
,
209 const SfxItemSet
& rSet
)
211 return new SvxStdParagraphTabPage( pParent
, rSet
);
214 // -----------------------------------------------------------------------
216 sal_Bool
SvxStdParagraphTabPage::FillItemSet( SfxItemSet
& rOutSet
)
218 SfxItemState eState
= SFX_ITEM_UNKNOWN
;
219 const SfxPoolItem
* pOld
= 0;
220 SfxItemPool
* pPool
= rOutSet
.GetPool();
221 DBG_ASSERT( pPool
, "Wo ist der Pool" );
223 sal_Bool bModified
= sal_False
;
225 sal_uInt16 nPos
= aLineDist
.GetSelectEntryPos();
227 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
228 ( nPos
!= aLineDist
.GetSavedValue() ||
229 aLineDistAtPercentBox
.IsValueModified() ||
230 aLineDistAtMetricBox
.IsValueModified() ) )
232 nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
233 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
234 SvxLineSpacingItem
aSpacing(
235 (const SvxLineSpacingItem
&)GetItemSet().Get( nWhich
) );
242 SetLineSpace_Impl( aSpacing
, nPos
);
245 case LLINESPACE_PROP
:
246 SetLineSpace_Impl( aSpacing
, nPos
,
247 static_cast<long>(aLineDistAtPercentBox
.Denormalize(
248 aLineDistAtPercentBox
.GetValue() )) );
252 case LLINESPACE_DURCH
:
254 SetLineSpace_Impl( aSpacing
, nPos
,
255 GetCoreValue( aLineDistAtMetricBox
, eUnit
) );
259 OSL_FAIL( "unbekannter Type fuer Zeilenabstand." );
262 eState
= GetItemSet().GetItemState( nWhich
);
263 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_LINESPACE
);
265 if ( !pOld
|| !( *(const SvxLineSpacingItem
*)pOld
== aSpacing
) ||
266 SFX_ITEM_DONTCARE
== eState
)
268 rOutSet
.Put( aSpacing
);
269 bModified
= sal_True
;
273 if ( aTopDist
.IsValueModified() || aBottomDist
.IsValueModified()
274 || aContextualCB
.GetSavedValue() != aContextualCB
.IsChecked())
276 nWhich
= GetWhich( SID_ATTR_ULSPACE
);
277 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
278 pOld
= GetOldItem( rOutSet
, SID_ATTR_ULSPACE
);
279 SvxULSpaceItem
aMargin( nWhich
);
283 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
285 const SvxULSpaceItem
& rOldItem
=
286 (const SvxULSpaceItem
&)GetItemSet().GetParent()->Get( nWhich
);
288 if ( aTopDist
.IsRelative() )
289 aMargin
.SetUpper( rOldItem
.GetUpper(),
290 (sal_uInt16
)aTopDist
.GetValue() );
292 aMargin
.SetUpper( (sal_uInt16
)GetCoreValue( aTopDist
, eUnit
) );
294 if ( aBottomDist
.IsRelative() )
295 aMargin
.SetLower( rOldItem
.GetLower(),
296 (sal_uInt16
)aBottomDist
.GetValue() );
298 aMargin
.SetLower( (sal_uInt16
)GetCoreValue( aBottomDist
, eUnit
) );
303 aMargin
.SetUpper( (sal_uInt16
)GetCoreValue( aTopDist
, eUnit
) );
304 aMargin
.SetLower( (sal_uInt16
)GetCoreValue( aBottomDist
, eUnit
) );
306 aMargin
.SetContextValue(aContextualCB
.IsChecked());
307 eState
= GetItemSet().GetItemState( nWhich
);
309 if ( !pOld
|| !( *(const SvxULSpaceItem
*)pOld
== aMargin
) ||
310 SFX_ITEM_DONTCARE
== eState
)
312 rOutSet
.Put( aMargin
);
313 bModified
= sal_True
;
316 bool bNullTab
= false;
318 if ( aLeftIndent
.IsValueModified() ||
319 aFLineIndent
.IsValueModified() ||
320 aRightIndent
.IsValueModified()
321 || aAutoCB
.GetSavedValue() != aAutoCB
.IsChecked() )
323 nWhich
= GetWhich( SID_ATTR_LRSPACE
);
324 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
325 SvxLRSpaceItem
aMargin( nWhich
);
326 pOld
= GetOldItem( rOutSet
, SID_ATTR_LRSPACE
);
330 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
332 const SvxLRSpaceItem
& rOldItem
=
333 (const SvxLRSpaceItem
&)GetItemSet().GetParent()->Get( nWhich
);
335 if ( aLeftIndent
.IsRelative() )
336 aMargin
.SetTxtLeft( rOldItem
.GetTxtLeft(),
337 (sal_uInt16
)aLeftIndent
.GetValue() );
339 aMargin
.SetTxtLeft( GetCoreValue( aLeftIndent
, eUnit
) );
341 if ( aRightIndent
.IsRelative() )
342 aMargin
.SetRight( rOldItem
.GetRight(),
343 (sal_uInt16
)aRightIndent
.GetValue() );
345 aMargin
.SetRight( GetCoreValue( aRightIndent
, eUnit
) );
347 if ( aFLineIndent
.IsRelative() )
348 aMargin
.SetTxtFirstLineOfst( rOldItem
.GetTxtFirstLineOfst(),
349 (sal_uInt16
)aFLineIndent
.GetValue() );
351 aMargin
.SetTxtFirstLineOfst(
352 (sal_uInt16
)GetCoreValue( aFLineIndent
, eUnit
) );
356 aMargin
.SetTxtLeft( GetCoreValue( aLeftIndent
, eUnit
) );
357 aMargin
.SetRight( GetCoreValue( aRightIndent
, eUnit
) );
358 aMargin
.SetTxtFirstLineOfst(
359 (sal_uInt16
)GetCoreValue( aFLineIndent
, eUnit
) );
361 aMargin
.SetAutoFirst(aAutoCB
.IsChecked());
362 if ( aMargin
.GetTxtFirstLineOfst() < 0 )
364 eState
= GetItemSet().GetItemState( nWhich
);
366 if ( !pOld
|| !( *(const SvxLRSpaceItem
*)pOld
== aMargin
) ||
367 SFX_ITEM_DONTCARE
== eState
)
369 rOutSet
.Put( aMargin
);
370 bModified
= sal_True
;
376 MapUnit eUnit
= (MapUnit
)pPool
->GetMetric( GetWhich( SID_ATTR_TABSTOP
) );
377 if ( MAP_100TH_MM
!= eUnit
)
380 // negative first line indent -> set null default tabstob if applicable
381 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_TABSTOP
);
382 const SfxItemSet
& rInSet
= GetItemSet();
384 if ( rInSet
.GetItemState( _nWhich
) >= SFX_ITEM_AVAILABLE
)
386 const SvxTabStopItem
& rTabItem
=
387 (const SvxTabStopItem
&)rInSet
.Get( _nWhich
);
388 SvxTabStopItem
aNullTab( rTabItem
);
389 SvxTabStop
aNull( 0, SVX_TAB_ADJUST_DEFAULT
);
390 aNullTab
.Insert( aNull
);
391 rOutSet
.Put( aNullTab
);
395 if( aRegisterCB
.IsVisible())
397 const SfxBoolItem
* pBoolItem
= (SfxBoolItem
*)GetOldItem(
398 rOutSet
, SID_ATTR_PARA_REGISTER
);
399 SfxBoolItem
* pRegItem
= (SfxBoolItem
*)pBoolItem
->Clone();
400 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
401 sal_Bool bSet
= pRegItem
->GetValue();
403 if(aRegisterCB
.IsChecked() != bSet
)
405 pRegItem
->SetValue(!bSet
);
406 rOutSet
.Put(*pRegItem
);
407 bModified
= sal_True
;
409 else if ( SFX_ITEM_DEFAULT
== GetItemSet().GetItemState( _nWhich
, sal_False
) )
410 rOutSet
.ClearItem(_nWhich
);
417 // -----------------------------------------------------------------------
419 void SvxStdParagraphTabPage::Reset( const SfxItemSet
& rSet
)
421 SfxItemPool
* pPool
= rSet
.GetPool();
422 DBG_ASSERT( pPool
, "Wo ist der Pool?" );
425 FieldUnit eFUnit
= GetModuleFieldUnit( rSet
);
427 bool bApplyCharUnit
= GetApplyCharUnit( rSet
);
429 SvtCJKOptions aCJKOptions
;
430 if(aCJKOptions
.IsAsianTypographyEnabled() && bApplyCharUnit
)
433 SetFieldUnit( aLeftIndent
, eFUnit
);
434 SetFieldUnit( aRightIndent
, eFUnit
);
435 SetFieldUnit( aFLineIndent
, eFUnit
);
436 if ( eFUnit
== FUNIT_CHAR
)
438 SetFieldUnit( aTopDist
, FUNIT_LINE
);
439 SetFieldUnit( aBottomDist
, FUNIT_LINE
);
440 SetFieldUnit( aLineDistAtMetricBox
, FUNIT_POINT
);
444 SetFieldUnit( aTopDist
, eFUnit
);
445 SetFieldUnit( aBottomDist
, eFUnit
);
446 SetFieldUnit( aLineDistAtMetricBox
, eFUnit
);
449 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_LRSPACE
);
450 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
452 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
454 SfxMapUnit eUnit
= pPool
->GetMetric( _nWhich
);
458 const SvxLRSpaceItem
& rOldItem
=
459 (const SvxLRSpaceItem
&)rSet
.Get( _nWhich
);
461 if ( rOldItem
.GetPropLeft() != 100 )
463 aLeftIndent
.SetRelative( sal_True
);
464 aLeftIndent
.SetValue( rOldItem
.GetPropLeft() );
468 aLeftIndent
.SetRelative();
469 SetFieldUnit( aLeftIndent
, eFUnit
);
470 SetMetricValue( aLeftIndent
, rOldItem
.GetTxtLeft(), eUnit
);
473 if ( rOldItem
.GetPropRight() != 100 )
475 aRightIndent
.SetRelative( sal_True
);
476 aRightIndent
.SetValue( rOldItem
.GetPropRight() );
480 aRightIndent
.SetRelative();
481 SetFieldUnit( aRightIndent
, eFUnit
);
482 SetMetricValue( aRightIndent
, rOldItem
.GetRight(), eUnit
);
485 if ( rOldItem
.GetPropTxtFirstLineOfst() != 100 )
487 aFLineIndent
.SetRelative( sal_True
);
488 aFLineIndent
.SetValue( rOldItem
.GetPropTxtFirstLineOfst() );
492 aFLineIndent
.SetRelative();
493 aFLineIndent
.SetMin(-9999);
494 SetFieldUnit( aFLineIndent
, eFUnit
);
495 SetMetricValue( aFLineIndent
, rOldItem
.GetTxtFirstLineOfst(),
498 aAutoCB
.Check(rOldItem
.IsAutoFirst());
502 const SvxLRSpaceItem
& rSpace
=
503 (const SvxLRSpaceItem
&)rSet
.Get( _nWhich
);
505 SetMetricValue( aLeftIndent
, rSpace
.GetTxtLeft(), eUnit
);
506 SetMetricValue( aRightIndent
, rSpace
.GetRight(), eUnit
);
507 SetMetricValue( aFLineIndent
, rSpace
.GetTxtFirstLineOfst(), eUnit
);
508 aAutoCB
.Check(rSpace
.IsAutoFirst());
510 AutoHdl_Impl(&aAutoCB
);
514 aLeftIndent
.SetEmptyFieldValue();
515 aRightIndent
.SetEmptyFieldValue();
516 aFLineIndent
.SetEmptyFieldValue();
519 _nWhich
= GetWhich( SID_ATTR_ULSPACE
);
520 eItemState
= rSet
.GetItemState( _nWhich
);
522 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
524 SfxMapUnit eUnit
= pPool
->GetMetric( _nWhich
);
526 const SvxULSpaceItem
& rOldItem
=
527 (const SvxULSpaceItem
&)rSet
.Get( _nWhich
);
531 if ( rOldItem
.GetPropUpper() != 100 )
533 aTopDist
.SetRelative( sal_True
);
534 aTopDist
.SetValue( rOldItem
.GetPropUpper() );
538 aTopDist
.SetRelative();
539 if ( eFUnit
== FUNIT_CHAR
)
540 SetFieldUnit( aTopDist
, FUNIT_LINE
);
542 SetFieldUnit( aTopDist
, eFUnit
);
543 SetMetricValue( aTopDist
, rOldItem
.GetUpper(), eUnit
);
546 if ( rOldItem
.GetPropLower() != 100 )
548 aBottomDist
.SetRelative( sal_True
);
549 aBottomDist
.SetValue( rOldItem
.GetPropLower() );
553 aBottomDist
.SetRelative();
554 if ( eFUnit
== FUNIT_CHAR
)
555 SetFieldUnit( aBottomDist
, FUNIT_LINE
);
557 SetFieldUnit( aBottomDist
, eFUnit
);
558 SetMetricValue( aBottomDist
, rOldItem
.GetLower(), eUnit
);
563 SetMetricValue( aTopDist
, rOldItem
.GetUpper(), eUnit
);
564 SetMetricValue( aBottomDist
, rOldItem
.GetLower(), eUnit
);
566 aContextualCB
.Check(rOldItem
.GetContext());
570 aTopDist
.SetEmptyFieldValue();
571 aBottomDist
.SetEmptyFieldValue();
574 _nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
575 eItemState
= rSet
.GetItemState( _nWhich
);
577 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
578 SetLineSpacing_Impl( (const SvxLineSpacingItem
&)rSet
.Get( _nWhich
) );
580 aLineDist
.SetNoSelection();
583 _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
584 eItemState
= rSet
.GetItemState( _nWhich
);
586 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
587 aRegisterCB
.Check( ((const SfxBoolItem
&)rSet
.Get( _nWhich
)).GetValue());
588 aRegisterCB
.SaveValue();
589 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(rSet
);
590 if(nHtmlMode
& HTMLMODE_ON
)
595 if(!(nHtmlMode
& HTMLMODE_SOME_STYLES
)) // IE or SW
597 aRightLabel
.Disable();
598 aRightIndent
.Disable();
599 aTopDist
.Disable(); //HTML3.2 and NS 3.0
600 aBottomDist
.Disable();
601 aFLineIndent
.Disable();
602 aFLineLabel
.Disable();
606 ELRLoseFocusHdl( NULL
);
608 aContextualCB
.SaveValue();
609 aLineDist
.SaveValue();
612 // -----------------------------------------------------------------------
614 void SvxStdParagraphTabPage::EnableRelativeMode()
616 DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
618 aLeftIndent
.EnableRelativeMode( 0, 999 );
619 aFLineIndent
.EnableRelativeMode( 0, 999 );
620 aRightIndent
.EnableRelativeMode( 0, 999 );
621 aTopDist
.EnableRelativeMode( 0, 999 );
622 aBottomDist
.EnableRelativeMode( 0, 999 );
623 bRelativeMode
= sal_True
;
626 // -----------------------------------------------------------------------
628 int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
630 ELRLoseFocusHdl( NULL
);
633 FillItemSet( *_pSet
);
637 // -----------------------------------------------------------------------
639 SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window
* pParent
,
640 const SfxItemSet
& rAttr
) :
642 SfxTabPage( pParent
, CUI_RES( RID_SVXPAGE_STD_PARAGRAPH
), rAttr
),
644 aIndentFrm ( this, CUI_RES( FL_INDENT
) ),
645 aLeftLabel ( this, CUI_RES( FT_LEFTINDENT
) ),
646 aLeftIndent ( this, CUI_RES( ED_LEFTINDENT
) ),
647 aRightLabel ( this, CUI_RES( FT_RIGHTINDENT
) ),
648 aRightIndent ( this, CUI_RES( ED_RIGHTINDENT
) ),
650 aFLineLabel ( this, CUI_RES( FT_FLINEINDENT
) ),
651 aFLineIndent ( this, CUI_RES( ED_FLINEINDENT
) ),
652 aAutoCB ( this, CUI_RES( CB_AUTO
) ),
653 aDistFrm ( this, CUI_RES( FL_DIST
) ),
654 aTopLabel ( this, CUI_RES( FT_TOPDIST
) ),
655 aTopDist ( this, CUI_RES( ED_TOPDIST
) ),
656 aBottomLabel ( this, CUI_RES( FT_BOTTOMDIST
) ),
657 aBottomDist ( this, CUI_RES( ED_BOTTOMDIST
) ),
658 aContextualCB ( this, CUI_RES( CB_CONTEXTUALSPACING
) ),
660 aLineDistFrm ( this, CUI_RES( FL_LINEDIST
) ),
661 aLineDist ( this, CUI_RES( LB_LINEDIST
) ),
662 aLineDistAtLabel ( this, CUI_RES( FT_LINEDIST
) ),
663 aLineDistAtPercentBox ( this, CUI_RES( ED_LINEDISTPERCENT
) ),
664 aLineDistAtMetricBox ( this, CUI_RES( ED_LINEDISTMETRIC
) ),
665 sAbsDist ( CUI_RES(ST_LINEDIST_ABS
) ),
666 aExampleWin ( this, CUI_RES( WN_EXAMPLE
) ),
667 aRegisterFL ( this, CUI_RES( FL_REGISTER
) ),
668 aRegisterCB ( this, CUI_RES( CB_REGISTER
) ),
669 pActLineDistFld ( &aLineDistAtPercentBox
),
671 nWidth ( 11905 /*567 * 50*/ ),
674 bRelativeMode ( sal_False
),
675 bNegativeIndents(sal_False
)
678 // this page needs ExchangeSupport
679 SetExchangeSupport();
681 aLineDistAtMetricBox
.Hide();
684 aFLineIndent
.SetMin(-9999); // is set to 0 on default
686 aExampleWin
.SetAccessibleName(String(CUI_RES(STR_EXAMPLE
)));
691 // -----------------------------------------------------------------------
693 void SvxStdParagraphTabPage::EnableNegativeMode()
695 aLeftIndent
.SetMin(-9999);
696 aRightIndent
.SetMin(-9999);
697 aRightIndent
.EnableNegativeMode();
698 aLeftIndent
.EnableNegativeMode();
699 bNegativeIndents
= sal_True
;
702 // -----------------------------------------------------------------------
704 sal_uInt16
* SvxStdParagraphTabPage::GetRanges()
709 // -----------------------------------------------------------------------
711 void SvxStdParagraphTabPage::SetLineSpacing_Impl
713 const SvxLineSpacingItem
&rAttr
716 SfxMapUnit eUnit
= GetItemSet().GetPool()->GetMetric( rAttr
.Which() );
718 switch( rAttr
.GetLineSpaceRule() )
720 case SVX_LINE_SPACE_AUTO
:
722 SvxInterLineSpace eInter
= rAttr
.GetInterLineSpaceRule();
726 // Default single line spacing
727 case SVX_INTER_LINE_SPACE_OFF
:
728 aLineDist
.SelectEntryPos( LLINESPACE_1
);
731 // Default single line spacing
732 case SVX_INTER_LINE_SPACE_PROP
:
733 if ( 100 == rAttr
.GetPropLineSpace() )
735 aLineDist
.SelectEntryPos( LLINESPACE_1
);
739 if ( 150 == rAttr
.GetPropLineSpace() )
741 aLineDist
.SelectEntryPos( LLINESPACE_15
);
744 // double line spacing
745 if ( 200 == rAttr
.GetPropLineSpace() )
747 aLineDist
.SelectEntryPos( LLINESPACE_2
);
750 // the set per cent value
751 aLineDistAtPercentBox
.
752 SetValue( aLineDistAtPercentBox
.Normalize(
753 rAttr
.GetPropLineSpace() ) );
754 aLineDist
.SelectEntryPos( LLINESPACE_PROP
);
757 case SVX_INTER_LINE_SPACE_FIX
:
758 SetMetricValue( aLineDistAtMetricBox
,
759 rAttr
.GetInterLineSpace(), eUnit
);
760 aLineDist
.SelectEntryPos( LLINESPACE_DURCH
);
762 default: ;//prevent warning
766 case SVX_LINE_SPACE_FIX
:
767 SetMetricValue(aLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
768 aLineDist
.SelectEntryPos( LLINESPACE_FIX
);
771 case SVX_LINE_SPACE_MIN
:
772 SetMetricValue(aLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
773 aLineDist
.SelectEntryPos( LLINESPACE_MIN
);
775 default: ;//prevent warning
777 LineDistHdl_Impl( &aLineDist
);
780 // -----------------------------------------------------------------------
782 IMPL_LINK( SvxStdParagraphTabPage
, LineDistHdl_Impl
, ListBox
*, pBox
)
784 switch( pBox
->GetSelectEntryPos() )
789 aLineDistAtLabel
.Enable(sal_False
);
790 pActLineDistFld
->Enable(sal_False
);
791 pActLineDistFld
->SetText( String() );
794 case LLINESPACE_DURCH
:
795 // setting a sensible default?
796 // limit MS min(10, aPageSize)
797 aLineDistAtPercentBox
.Hide();
798 pActLineDistFld
= &aLineDistAtMetricBox
;
799 aLineDistAtMetricBox
.SetMin(0);
802 if ( aLineDistAtMetricBox
.GetText().isEmpty() )
803 aLineDistAtMetricBox
.SetValue(
804 aLineDistAtMetricBox
.Normalize( 1 ) );
805 aLineDistAtPercentBox
.Hide();
806 pActLineDistFld
->Show();
807 pActLineDistFld
->Enable();
808 aLineDistAtLabel
.Enable();
812 aLineDistAtPercentBox
.Hide();
813 pActLineDistFld
= &aLineDistAtMetricBox
;
814 aLineDistAtMetricBox
.SetMin(0);
816 if ( aLineDistAtMetricBox
.GetText().isEmpty() )
817 aLineDistAtMetricBox
.SetValue(
818 aLineDistAtMetricBox
.Normalize( 10 ), FUNIT_TWIP
);
819 aLineDistAtPercentBox
.Hide();
820 pActLineDistFld
->Show();
821 pActLineDistFld
->Enable();
822 aLineDistAtLabel
.Enable();
825 case LLINESPACE_PROP
:
826 aLineDistAtMetricBox
.Hide();
827 pActLineDistFld
= &aLineDistAtPercentBox
;
829 if ( aLineDistAtPercentBox
.GetText().isEmpty() )
830 aLineDistAtPercentBox
.SetValue(
831 aLineDistAtPercentBox
.Normalize( 100 ), FUNIT_TWIP
);
832 aLineDistAtMetricBox
.Hide();
833 pActLineDistFld
->Show();
834 pActLineDistFld
->Enable();
835 aLineDistAtLabel
.Enable();
839 aLineDistAtPercentBox
.Hide();
840 pActLineDistFld
= &aLineDistAtMetricBox
;
841 sal_Int64 nTemp
= aLineDistAtMetricBox
.GetValue();
842 aLineDistAtMetricBox
.SetMin(aLineDistAtMetricBox
.Normalize(nMinFixDist
), FUNIT_TWIP
);
844 // if the value has been changed at SetMin,
845 // it is time for the default
846 if ( aLineDistAtMetricBox
.GetValue() != nTemp
)
847 SetMetricValue( aLineDistAtMetricBox
,
848 FIX_DIST_DEF
, SFX_MAPUNIT_TWIP
); // fix is only in Writer
849 aLineDistAtPercentBox
.Hide();
850 pActLineDistFld
->Show();
851 pActLineDistFld
->Enable();
852 aLineDistAtLabel
.Enable();
856 UpdateExample_Impl( sal_True
);
860 // -----------------------------------------------------------------------
862 IMPL_LINK_NOARG_INLINE_START(SvxStdParagraphTabPage
, ModifyHdl_Impl
)
864 UpdateExample_Impl();
867 IMPL_LINK_NOARG_INLINE_END(SvxStdParagraphTabPage
, ModifyHdl_Impl
)
869 // -----------------------------------------------------------------------
871 void SvxStdParagraphTabPage::Init_Impl()
873 aLineDist
.SetSelectHdl(
874 LINK( this, SvxStdParagraphTabPage
, LineDistHdl_Impl
) );
876 Link aLink
= LINK( this, SvxStdParagraphTabPage
, ELRLoseFocusHdl
);
877 aFLineIndent
.SetLoseFocusHdl( aLink
);
878 aLeftIndent
.SetLoseFocusHdl( aLink
);
879 aRightIndent
.SetLoseFocusHdl( aLink
);
881 aLink
= LINK( this, SvxStdParagraphTabPage
, ModifyHdl_Impl
);
882 aFLineIndent
.SetModifyHdl( aLink
);
883 aLeftIndent
.SetModifyHdl( aLink
);
884 aRightIndent
.SetModifyHdl( aLink
);
885 aTopDist
.SetModifyHdl( aLink
);
886 aBottomDist
.SetModifyHdl( aLink
);
888 aAutoCB
.SetClickHdl( LINK( this, SvxStdParagraphTabPage
, AutoHdl_Impl
));
889 SfxItemPool
* pPool
= GetItemSet().GetPool();
890 DBG_ASSERT( pPool
, "Wo ist der Pool" );
892 MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
894 aTopDist
.SetMax( aTopDist
.Normalize( nAbst
), eUnit
);
895 aBottomDist
.SetMax( aBottomDist
.Normalize( nAbst
), eUnit
);
896 aLineDistAtMetricBox
.SetMax(
897 aLineDistAtMetricBox
.Normalize( nAbst
), eUnit
);
900 // -----------------------------------------------------------------------
902 void SvxStdParagraphTabPage::UpdateExample_Impl( sal_Bool bAll
)
904 aExampleWin
.SetFirstLineOfst(
905 (short)aFLineIndent
.Denormalize( aFLineIndent
.GetValue( FUNIT_TWIP
) ) );
906 aExampleWin
.SetLeftMargin(
907 static_cast<long>(aLeftIndent
.Denormalize( aLeftIndent
.GetValue( FUNIT_TWIP
) ) ) );
908 aExampleWin
.SetRightMargin(
909 static_cast<long>(aRightIndent
.Denormalize( aRightIndent
.GetValue( FUNIT_TWIP
) ) ) );
910 aExampleWin
.SetUpper(
911 (sal_uInt16
)aTopDist
.Denormalize( aTopDist
.GetValue( FUNIT_TWIP
) ) );
912 aExampleWin
.SetLower(
913 (sal_uInt16
)aBottomDist
.Denormalize( aBottomDist
.GetValue( FUNIT_TWIP
) ) );
917 sal_uInt16 nPos
= aLineDist
.GetSelectEntryPos();
924 aExampleWin
.SetLineSpace( (SvxPrevLineSpace
)nPos
);
927 case LLINESPACE_PROP
:
928 aExampleWin
.SetLineSpace( (SvxPrevLineSpace
)nPos
,
929 (sal_uInt16
)aLineDistAtPercentBox
.Denormalize(
930 aLineDistAtPercentBox
.GetValue() ) );
934 case LLINESPACE_DURCH
:
936 aExampleWin
.SetLineSpace( (SvxPrevLineSpace
)nPos
,
937 (sal_uInt16
)GetCoreValue( aLineDistAtMetricBox
, SFX_MAPUNIT_TWIP
) );
940 aExampleWin
.Draw( bAll
);
943 // -----------------------------------------------------------------------
945 void SvxStdParagraphTabPage::EnableRegisterMode()
951 void SvxStdParagraphTabPage::EnableContextualMode()
953 aContextualCB
.Show();
956 IMPL_LINK( SvxStdParagraphTabPage
, AutoHdl_Impl
, CheckBox
*, pBox
)
958 sal_Bool bEnable
= !pBox
->IsChecked();
959 aFLineLabel
.Enable(bEnable
);
960 aFLineIndent
.Enable(bEnable
);
964 void SvxStdParagraphTabPage::SetPageWidth( sal_uInt16 nPageWidth
)
970 void SvxStdParagraphTabPage::EnableAutoFirstLine()
976 void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip
)
978 aLineDist
.InsertEntry(sAbsDist
);
979 nMinFixDist
= nMinTwip
;
983 void SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet
)
986 /* different bit represent call to different method of SvxStdParagraphTabPage
987 0x0001 --->EnableRelativeMode()
988 0x0002 --->EnableRegisterMode()
989 0x0004 --->EnableAutoFirstLine()
990 0x0008 --->EnableNegativeMode()
991 0x0010 --->EnableContextualMode()
993 SFX_ITEMSET_ARG (&aSet
,pPageWidthItem
,SfxUInt16Item
,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH
,sal_False
);
994 SFX_ITEMSET_ARG (&aSet
,pFlagSetItem
,SfxUInt32Item
,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET
,sal_False
);
995 SFX_ITEMSET_ARG (&aSet
,pLineDistItem
,SfxUInt32Item
,SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST
,sal_False
);
998 SetPageWidth(pPageWidthItem
->GetValue());
1001 if (( 0x0001 & pFlagSetItem
->GetValue())== 0x0001 )
1002 EnableRelativeMode();
1005 if (( 0x0002 & pFlagSetItem
->GetValue())== 0x0002 )
1006 EnableRegisterMode();
1009 if ( ( 0x0004 & pFlagSetItem
->GetValue())== 0x0004 )
1010 EnableAutoFirstLine();
1013 EnableAbsLineDist(pLineDistItem
->GetValue());
1016 if (( 0x0008 & pFlagSetItem
->GetValue()) == 0x0008 )
1017 EnableNegativeMode();
1020 if (( 0x0010 & pFlagSetItem
->GetValue()) == 0x0010 )
1021 EnableContextualMode();
1025 #define LASTLINEPOS_DEFAULT 0
1026 #define LASTLINEPOS_LEFT 1
1028 #define LASTLINECOUNT_OLD 3
1029 #define LASTLINECOUNT_NEW 4
1031 // class SvxParaAlignTabPage ------------------------------------------------
1033 SvxParaAlignTabPage::SvxParaAlignTabPage( Window
* pParent
, const SfxItemSet
& rSet
)
1034 : SfxTabPage(pParent
, CUI_RES( RID_SVXPAGE_ALIGN_PARAGRAPH
),rSet
),
1035 aAlignFrm ( this, CUI_RES( FL_ALIGN
) ),
1036 aLeft ( this, CUI_RES( BTN_LEFTALIGN
) ),
1037 aRight ( this, CUI_RES( BTN_RIGHTALIGN
) ),
1038 aCenter ( this, CUI_RES( BTN_CENTERALIGN
) ),
1039 aJustify ( this, CUI_RES( BTN_JUSTIFYALIGN
) ),
1040 aLastLineFT ( this, CUI_RES( FT_LASTLINE
) ),
1041 aLastLineLB ( this, CUI_RES( LB_LASTLINE
) ),
1042 aExpandCB ( this, CUI_RES( CB_EXPAND
) ),
1043 aSnapToGridCB ( this, CUI_RES( CB_SNAP
) ),
1044 aExampleWin ( this, CUI_RES( WN_EXAMPLE
) ),
1046 aVertAlignFL ( this, CUI_RES( FL_VERTALIGN
) ),
1047 aVertAlignFT ( this, CUI_RES( FT_VERTALIGN
) ),
1048 aVertAlignLB ( this, CUI_RES( LB_VERTALIGN
) ),
1050 aPropertiesFL ( this, CUI_RES( FL_PROPERTIES
)),
1051 aTextDirectionFT ( this, CUI_RES( FT_TEXTDIRECTION
)),
1052 aTextDirectionLB ( this, CUI_RES( LB_TEXTDIRECTION
))
1054 SvtLanguageOptions aLangOptions
;
1055 sal_uInt16 nLastLinePos
= LASTLINEPOS_DEFAULT
;
1057 if ( aLangOptions
.IsAsianTypographyEnabled() )
1059 String
sLeft(CUI_RES(ST_LEFTALIGN_ASIAN
));
1060 aLeft
.SetText(sLeft
);
1061 aRight
.SetText(String(CUI_RES(ST_RIGHTALIGN_ASIAN
)));
1062 sLeft
= MnemonicGenerator::EraseAllMnemonicChars( sLeft
);
1064 if ( aLastLineLB
.GetEntryCount() == LASTLINECOUNT_OLD
)
1066 aLastLineLB
.RemoveEntry( 0 );
1067 aLastLineLB
.InsertEntry( sLeft
, 0 );
1070 nLastLinePos
= LASTLINEPOS_LEFT
;
1072 // remove "Default" or "Left" entry, depends on CJKOptions
1073 if ( aLastLineLB
.GetEntryCount() == LASTLINECOUNT_NEW
)
1074 aLastLineLB
.RemoveEntry( nLastLinePos
);
1077 Link aLink
= LINK( this, SvxParaAlignTabPage
, AlignHdl_Impl
);
1078 aLeft
.SetClickHdl( aLink
);
1079 aRight
.SetClickHdl( aLink
);
1080 aCenter
.SetClickHdl( aLink
);
1081 aJustify
.SetClickHdl( aLink
);
1082 aLastLineLB
.SetSelectHdl( LINK( this, SvxParaAlignTabPage
, LastLineHdl_Impl
) );
1083 aTextDirectionLB
.SetSelectHdl( LINK( this, SvxParaAlignTabPage
, TextDirectionHdl_Impl
) );
1085 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(rSet
);
1086 if(!(nHtmlMode
& HTMLMODE_ON
) || (0 != (nHtmlMode
& HTMLMODE_SOME_STYLES
)) )
1088 if( aLangOptions
.IsCTLFontEnabled() )
1090 aTextDirectionLB
.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR
), FRMDIR_HORI_LEFT_TOP
);
1091 aTextDirectionLB
.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL
), FRMDIR_HORI_RIGHT_TOP
);
1092 aTextDirectionLB
.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER
), FRMDIR_ENVIRONMENT
);
1094 aPropertiesFL
.Show();
1095 aTextDirectionFT
.Show();
1096 aTextDirectionLB
.Show();
1100 aExampleWin
.SetAccessibleName(String(CUI_RES(STR_EXAMPLE
)));
1104 SvxParaAlignTabPage::~SvxParaAlignTabPage()
1108 int SvxParaAlignTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1111 FillItemSet( *_pSet
);
1115 SfxTabPage
* SvxParaAlignTabPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
1117 return new SvxParaAlignTabPage(pParent
, rSet
);
1120 sal_uInt16
* SvxParaAlignTabPage::GetRanges()
1122 return pAlignRanges
;
1126 sal_Bool
SvxParaAlignTabPage::FillItemSet( SfxItemSet
& rOutSet
)
1128 sal_Bool bModified
= sal_False
;
1130 bool bAdj
= false, bChecked
= false;
1131 SvxAdjust eAdjust
= SVX_ADJUST_LEFT
;
1133 if ( aLeft
.IsChecked() )
1135 eAdjust
= SVX_ADJUST_LEFT
;
1136 bAdj
= !aLeft
.GetSavedValue();
1139 else if ( aRight
.IsChecked() )
1141 eAdjust
= SVX_ADJUST_RIGHT
;
1142 bAdj
= !aRight
.GetSavedValue();
1145 else if ( aCenter
.IsChecked() )
1147 eAdjust
= SVX_ADJUST_CENTER
;
1148 bAdj
= !aCenter
.GetSavedValue();
1151 else if ( aJustify
.IsChecked() )
1153 eAdjust
= SVX_ADJUST_BLOCK
;
1154 bAdj
= !aJustify
.GetSavedValue() ||
1155 aExpandCB
.IsChecked() != aExpandCB
.GetSavedValue() ||
1156 aLastLineLB
.GetSelectEntryPos() != aLastLineLB
.GetSavedValue();
1159 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1163 const SvxAdjustItem
* pOld
=
1164 (const SvxAdjustItem
*)GetOldItem( rOutSet
, SID_ATTR_PARA_ADJUST
);
1165 SvxAdjust eOneWord
= aExpandCB
.IsChecked() ? SVX_ADJUST_BLOCK
1167 sal_uInt16 nLBPos
= aLastLineLB
.GetSelectEntryPos();
1168 SvxAdjust eLastBlock
= SVX_ADJUST_LEFT
;
1171 eLastBlock
= SVX_ADJUST_CENTER
;
1172 else if ( 2 == nLBPos
)
1173 eLastBlock
= SVX_ADJUST_BLOCK
;
1175 bool bNothingWasChecked
=
1176 !aLeft
.GetSavedValue() && !aRight
.GetSavedValue() &&
1177 !aCenter
.GetSavedValue() && !aJustify
.GetSavedValue();
1179 if ( !pOld
|| pOld
->GetAdjust() != eAdjust
||
1180 pOld
->GetOneWord() != eOneWord
||
1181 pOld
->GetLastBlock() != eLastBlock
||
1182 ( bChecked
&& bNothingWasChecked
) )
1184 bModified
= sal_True
;
1186 (const SvxAdjustItem
&)GetItemSet().Get( _nWhich
) );
1187 aAdj
.SetAdjust( eAdjust
);
1188 aAdj
.SetOneWord( eOneWord
);
1189 aAdj
.SetLastBlock( eLastBlock
);
1190 rOutSet
.Put( aAdj
);
1193 if(aSnapToGridCB
.IsChecked() != aSnapToGridCB
.GetSavedValue())
1195 rOutSet
.Put(SvxParaGridItem(aSnapToGridCB
.IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID
)));
1196 bModified
= sal_True
;
1198 if(aVertAlignLB
.GetSavedValue() != aVertAlignLB
.GetSelectEntryPos())
1200 rOutSet
.Put(SvxParaVertAlignItem(aVertAlignLB
.GetSelectEntryPos(), GetWhich( SID_PARA_VERTALIGN
)));
1201 bModified
= sal_True
;
1204 if( aTextDirectionLB
.IsVisible() )
1206 SvxFrameDirection eDir
= aTextDirectionLB
.GetSelectEntryValue();
1207 if( eDir
!= aTextDirectionLB
.GetSavedValue() )
1209 rOutSet
.Put( SvxFrameDirectionItem( eDir
, GetWhich( SID_ATTR_FRAMEDIRECTION
) ) );
1210 bModified
= sal_True
;
1217 void SvxParaAlignTabPage::Reset( const SfxItemSet
& rSet
)
1219 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1220 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
1222 sal_uInt16 nLBSelect
= 0;
1223 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1225 const SvxAdjustItem
& rAdj
= (const SvxAdjustItem
&)rSet
.Get( _nWhich
);
1227 switch ( rAdj
.GetAdjust() /*!!! ask VB rAdj.GetLastBlock()*/ )
1229 case SVX_ADJUST_LEFT
: aLeft
.Check(); break;
1231 case SVX_ADJUST_RIGHT
: aRight
.Check(); break;
1233 case SVX_ADJUST_CENTER
: aCenter
.Check(); break;
1235 case SVX_ADJUST_BLOCK
: aJustify
.Check(); break;
1236 default: ; //prevent warning
1238 sal_Bool bEnable
= aJustify
.IsChecked();
1239 aLastLineFT
.Enable(bEnable
);
1240 aLastLineLB
.Enable(bEnable
);
1241 aExpandCB
.Enable(bEnable
);
1243 aExpandCB
.Check(SVX_ADJUST_BLOCK
== rAdj
.GetOneWord());
1244 switch(rAdj
.GetLastBlock())
1246 case SVX_ADJUST_LEFT
: nLBSelect
= 0; break;
1248 case SVX_ADJUST_CENTER
: nLBSelect
= 1; break;
1250 case SVX_ADJUST_BLOCK
: nLBSelect
= 2; break;
1251 default: ; //prevent warning
1256 aLeft
.Check( sal_False
);
1257 aRight
.Check( sal_False
);
1258 aCenter
.Check( sal_False
);
1259 aJustify
.Check( sal_False
);
1261 aLastLineLB
.SelectEntryPos(nLBSelect
);
1263 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(rSet
);
1264 if(nHtmlMode
& HTMLMODE_ON
)
1269 if(!(nHtmlMode
& HTMLMODE_FULL_STYLES
) )
1271 aSnapToGridCB
.Show(sal_False
);
1273 _nWhich
= GetWhich(SID_ATTR_PARA_SNAPTOGRID
);
1274 eItemState
= rSet
.GetItemState( _nWhich
);
1275 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1277 const SvxParaGridItem
& rSnap
= (const SvxParaGridItem
&)rSet
.Get( _nWhich
);
1278 aSnapToGridCB
.Check(rSnap
.GetValue());
1281 _nWhich
= GetWhich( SID_PARA_VERTALIGN
);
1282 eItemState
= rSet
.GetItemState( _nWhich
);
1284 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1286 aVertAlignLB
.Show();
1287 aVertAlignFL
.Show();
1288 aVertAlignFT
.Show();
1290 const SvxParaVertAlignItem
& rAlign
= (const SvxParaVertAlignItem
&)rSet
.Get( _nWhich
);
1291 aVertAlignLB
.SelectEntryPos(rAlign
.GetValue());
1294 _nWhich
= GetWhich( SID_ATTR_FRAMEDIRECTION
);
1296 if( SFX_ITEM_AVAILABLE
<= rSet
.GetItemState( _nWhich
) )
1298 const SvxFrameDirectionItem
& rFrameDirItem
= ( const SvxFrameDirectionItem
& ) rSet
.Get( _nWhich
);
1299 aTextDirectionLB
.SelectEntryValue( (SvxFrameDirection
)rFrameDirItem
.GetValue() );
1300 aTextDirectionLB
.SaveValue();
1303 aSnapToGridCB
.SaveValue();
1304 aVertAlignLB
.SaveValue();
1307 aCenter
.SaveValue();
1308 aJustify
.SaveValue();
1309 aLastLineLB
.SaveValue();
1310 aExpandCB
.SaveValue();
1312 UpdateExample_Impl(sal_True
);
1315 IMPL_LINK_NOARG(SvxParaAlignTabPage
, AlignHdl_Impl
)
1317 sal_Bool bJustify
= aJustify
.IsChecked();
1318 aLastLineFT
.Enable(bJustify
);
1319 aLastLineLB
.Enable(bJustify
);
1320 aExpandCB
.Enable(bJustify
);
1321 UpdateExample_Impl(sal_False
);
1325 IMPL_LINK_NOARG(SvxParaAlignTabPage
, LastLineHdl_Impl
)
1327 UpdateExample_Impl(sal_False
);
1331 IMPL_LINK_NOARG(SvxParaAlignTabPage
, TextDirectionHdl_Impl
)
1333 SvxFrameDirection eDir
= aTextDirectionLB
.GetSelectEntryValue();
1336 // check the default alignment for this text direction
1337 case FRMDIR_HORI_LEFT_TOP
: aLeft
.Check( sal_True
); break;
1338 case FRMDIR_HORI_RIGHT_TOP
: aRight
.Check( sal_True
); break;
1339 case FRMDIR_ENVIRONMENT
: /* do nothing */ break;
1342 SAL_WARN( "cui.tabpages", "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" );
1349 void SvxParaAlignTabPage::UpdateExample_Impl( sal_Bool bAll
)
1351 if ( aLeft
.IsChecked() )
1352 aExampleWin
.SetAdjust( SVX_ADJUST_LEFT
);
1353 else if ( aRight
.IsChecked() )
1354 aExampleWin
.SetAdjust( SVX_ADJUST_RIGHT
);
1355 else if ( aCenter
.IsChecked() )
1356 aExampleWin
.SetAdjust( SVX_ADJUST_CENTER
);
1357 else if ( aJustify
.IsChecked() )
1359 aExampleWin
.SetAdjust( SVX_ADJUST_BLOCK
);
1360 SvxAdjust eLastBlock
= SVX_ADJUST_LEFT
;
1361 sal_uInt16 nLBPos
= aLastLineLB
.GetSelectEntryPos();
1363 eLastBlock
= SVX_ADJUST_CENTER
;
1364 else if(nLBPos
== 2)
1365 eLastBlock
= SVX_ADJUST_BLOCK
;
1366 aExampleWin
.SetLastLine( eLastBlock
);
1369 aExampleWin
.Draw( bAll
);
1372 void SvxParaAlignTabPage::EnableJustifyExt()
1377 SvtLanguageOptions aCJKOptions
;
1378 if(aCJKOptions
.IsAsianTypographyEnabled())
1379 aSnapToGridCB
.Show();
1383 void SvxParaAlignTabPage::PageCreated (SfxAllItemSet aSet
)
1385 SFX_ITEMSET_ARG (&aSet
,pBoolItem
,SfxBoolItem
,SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT
,sal_False
);
1387 if(pBoolItem
->GetValue())
1391 SfxTabPage
* SvxExtParagraphTabPage::Create( Window
* pParent
,
1392 const SfxItemSet
& rSet
)
1394 return new SvxExtParagraphTabPage( pParent
, rSet
);
1397 // -----------------------------------------------------------------------
1399 sal_Bool
SvxExtParagraphTabPage::FillItemSet( SfxItemSet
& rOutSet
)
1401 sal_Bool bModified
= sal_False
;
1402 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1403 const TriState eHyphenState
= m_pHyphenBox
->GetState();
1404 const SfxPoolItem
* pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_HYPHENZONE
);
1406 if ( eHyphenState
!= m_pHyphenBox
->GetSavedValue() ||
1407 m_pExtHyphenBeforeBox
->IsValueModified() ||
1408 m_pExtHyphenAfterBox
->IsValueModified() ||
1409 m_pMaxHyphenEdit
->IsValueModified() )
1411 SvxHyphenZoneItem
aHyphen(
1412 (const SvxHyphenZoneItem
&)GetItemSet().Get( _nWhich
) );
1413 aHyphen
.SetHyphen( eHyphenState
== STATE_CHECK
);
1415 if ( eHyphenState
== STATE_CHECK
)
1417 aHyphen
.GetMinLead() = (sal_uInt8
)m_pExtHyphenBeforeBox
->GetValue();
1418 aHyphen
.GetMinTrail() = (sal_uInt8
)m_pExtHyphenAfterBox
->GetValue();
1420 aHyphen
.GetMaxHyphens() = (sal_uInt8
)m_pMaxHyphenEdit
->GetValue();
1423 !( *(SvxHyphenZoneItem
*)pOld
== aHyphen
) ||
1424 eHyphenState
!= m_pHyphenBox
->GetSavedValue())
1426 rOutSet
.Put( aHyphen
);
1427 bModified
= sal_True
;
1431 if (m_pPagenumEdit
->IsEnabled() && m_pPagenumEdit
->IsValueModified())
1433 SfxUInt16Item
aPageNum( SID_ATTR_PARA_PAGENUM
,
1434 (sal_uInt16
)m_pPagenumEdit
->GetValue() );
1436 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_PAGENUM
);
1438 if ( !pOld
|| ( (const SfxUInt16Item
*)pOld
)->GetValue() != aPageNum
.GetValue() )
1440 rOutSet
.Put( aPageNum
);
1441 bModified
= sal_True
;
1447 TriState eState
= m_pApplyCollBtn
->GetState();
1448 bool bIsPageModel
= false;
1450 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1452 if ( eState
!= m_pApplyCollBtn
->GetSavedValue() ||
1453 ( STATE_CHECK
== eState
&&
1454 m_pApplyCollBox
->GetSelectEntryPos() != m_pApplyCollBox
->GetSavedValue() ) )
1456 if ( eState
== STATE_CHECK
)
1458 sPage
= m_pApplyCollBox
->GetSelectEntry();
1459 bIsPageModel
= 0 != sPage
.Len();
1461 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_MODEL
);
1463 if ( !pOld
|| ( (const SvxPageModelItem
*)pOld
)->GetValue() != sPage
)
1465 rOutSet
.Put( SvxPageModelItem( sPage
, sal_False
, _nWhich
) );
1466 bModified
= sal_True
;
1469 bIsPageModel
= false;
1471 else if(STATE_CHECK
== eState
&& m_pApplyCollBtn
->IsEnabled())
1472 bIsPageModel
= true;
1474 rOutSet
.Put( SvxPageModelItem( sPage
, sal_False
, _nWhich
) );
1476 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1479 // if PageModel is turned on, always turn off PageBreak
1480 rOutSet
.Put( SvxFmtBreakItem( SVX_BREAK_NONE
, _nWhich
) );
1483 eState
= m_pPageBreakBox
->GetState();
1484 SfxItemState eModelState
= GetItemSet().GetItemState(SID_ATTR_PARA_MODEL
, sal_False
);
1486 if ( (eModelState
== SFX_ITEM_SET
&& STATE_CHECK
== m_pPageBreakBox
->GetState()) ||
1487 eState
!= m_pPageBreakBox
->GetSavedValue() ||
1488 m_pBreakTypeLB
->GetSelectEntryPos() != m_pBreakTypeLB
->GetSavedValue() ||
1489 m_pBreakPositionLB
->GetSelectEntryPos() != m_pBreakPositionLB
->GetSavedValue() )
1491 const SvxFmtBreakItem
rOldBreak(
1492 (const SvxFmtBreakItem
&)GetItemSet().Get( _nWhich
));
1493 SvxFmtBreakItem
aBreak(rOldBreak
.GetBreak(), rOldBreak
.Which());
1499 sal_Bool bBefore
= m_pBreakPositionLB
->GetSelectEntryPos() == 0;
1501 if ( m_pBreakTypeLB
->GetSelectEntryPos() == 0 )
1504 aBreak
.SetValue( SVX_BREAK_PAGE_BEFORE
);
1506 aBreak
.SetValue( SVX_BREAK_PAGE_AFTER
);
1511 aBreak
.SetValue( SVX_BREAK_COLUMN_BEFORE
);
1513 aBreak
.SetValue( SVX_BREAK_COLUMN_AFTER
);
1519 aBreak
.SetValue( SVX_BREAK_NONE
);
1521 default: ; //prevent warning
1523 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_PAGEBREAK
);
1525 if ( eState
!= m_pPageBreakBox
->GetSavedValue() ||
1526 !pOld
|| !( *(const SvxFmtBreakItem
*)pOld
== aBreak
) )
1528 bModified
= sal_True
;
1529 rOutSet
.Put( aBreak
);
1536 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1537 eState
= m_pKeepTogetherBox
->GetState();
1539 if ( eState
!= m_pKeepTogetherBox
->GetSavedValue() )
1541 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_SPLIT
);
1543 if ( !pOld
|| ( (const SvxFmtSplitItem
*)pOld
)->GetValue() !=
1544 ( eState
== STATE_NOCHECK
) )
1546 rOutSet
.Put( SvxFmtSplitItem( eState
== STATE_NOCHECK
, _nWhich
) );
1547 bModified
= sal_True
;
1552 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1553 eState
= m_pKeepParaBox
->GetState();
1555 if ( eState
!= m_pKeepParaBox
->GetSavedValue() )
1557 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_KEEP
);
1559 // if the status has changed, putting is necessary
1560 rOutSet
.Put( SvxFmtKeepItem( eState
== STATE_CHECK
, _nWhich
) );
1561 bModified
= sal_True
;
1564 // widows and orphans
1565 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1566 eState
= m_pWidowBox
->GetState();
1568 if ( eState
!= m_pWidowBox
->GetSavedValue() ||
1569 m_pWidowRowNo
->IsValueModified() )
1571 SvxWidowsItem
rItem( eState
== STATE_CHECK
?
1572 (sal_uInt8
)m_pWidowRowNo
->GetValue() : 0, _nWhich
);
1573 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_WIDOWS
);
1575 if ( eState
!= m_pWidowBox
->GetSavedValue() || !pOld
|| !( *(const SvxWidowsItem
*)pOld
== rItem
) )
1577 rOutSet
.Put( rItem
);
1578 bModified
= sal_True
;
1582 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1583 eState
= m_pOrphanBox
->GetState();
1585 if ( eState
!= m_pOrphanBox
->GetSavedValue() ||
1586 m_pOrphanRowNo
->IsValueModified() )
1588 SvxOrphansItem
rItem( eState
== STATE_CHECK
?
1589 (sal_uInt8
)m_pOrphanRowNo
->GetValue() : 0, _nWhich
);
1590 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_ORPHANS
);
1592 if ( eState
!= m_pOrphanBox
->GetSavedValue() ||
1594 !( *(const SvxOrphansItem
*)pOld
== rItem
) )
1596 rOutSet
.Put( rItem
);
1597 bModified
= sal_True
;
1604 // -----------------------------------------------------------------------
1606 void SvxExtParagraphTabPage::Reset( const SfxItemSet
& rSet
)
1608 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1609 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
1611 sal_Bool bItemAvailable
= eItemState
>= SFX_ITEM_AVAILABLE
;
1612 sal_Bool bIsHyphen
= sal_False
;
1613 if( !bHtmlMode
&& bItemAvailable
)
1615 const SvxHyphenZoneItem
& rHyphen
=
1616 (const SvxHyphenZoneItem
&)rSet
.Get( _nWhich
);
1617 m_pHyphenBox
->EnableTriState( sal_False
);
1619 bIsHyphen
= rHyphen
.IsHyphen();
1620 m_pHyphenBox
->SetState( bIsHyphen
? STATE_CHECK
: STATE_NOCHECK
);
1622 m_pExtHyphenBeforeBox
->SetValue( rHyphen
.GetMinLead() );
1623 m_pExtHyphenAfterBox
->SetValue( rHyphen
.GetMinTrail() );
1624 m_pMaxHyphenEdit
->SetValue( rHyphen
.GetMaxHyphens() );
1628 m_pHyphenBox
->SetState( STATE_DONTKNOW
);
1630 sal_Bool bEnable
= bItemAvailable
&& bIsHyphen
;
1631 m_pExtHyphenBeforeBox
->Enable(bEnable
);
1632 m_pExtHyphenAfterBox
->Enable(bEnable
);
1633 m_pBeforeText
->Enable(bEnable
);
1634 m_pAfterText
->Enable(bEnable
);
1635 m_pMaxHyphenLabel
->Enable(bEnable
);
1636 m_pMaxHyphenEdit
->Enable(bEnable
);
1638 _nWhich
= GetWhich( SID_ATTR_PARA_PAGENUM
);
1640 if ( rSet
.GetItemState(_nWhich
) >= SFX_ITEM_AVAILABLE
)
1642 const sal_uInt16 nPageNum
=
1643 ( (const SfxUInt16Item
&)rSet
.Get( _nWhich
) ).GetValue();
1644 m_pPagenumEdit
->SetValue( nPageNum
);
1649 // first handle PageModel
1650 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1651 sal_Bool bIsPageModel
= sal_False
;
1652 eItemState
= rSet
.GetItemState( _nWhich
);
1654 if ( eItemState
>= SFX_ITEM_SET
)
1656 m_pApplyCollBtn
->EnableTriState( sal_False
);
1658 const SvxPageModelItem
& rModel
=
1659 (const SvxPageModelItem
&)rSet
.Get( _nWhich
);
1660 String
aStr( rModel
.GetValue() );
1663 m_pApplyCollBox
->GetEntryPos( aStr
) != LISTBOX_ENTRY_NOTFOUND
)
1665 m_pApplyCollBox
->SelectEntry( aStr
);
1666 m_pApplyCollBtn
->SetState( STATE_CHECK
);
1667 bIsPageModel
= sal_True
;
1669 m_pPageBreakBox
->Enable();
1670 m_pPageBreakBox
->EnableTriState( sal_False
);
1671 m_pBreakTypeFT
->Enable();
1672 m_pBreakTypeLB
->Enable();
1673 m_pBreakPositionFT
->Enable();
1674 m_pBreakPositionLB
->Enable();
1675 m_pApplyCollBtn
->Enable();
1676 m_pPageBreakBox
->SetState( STATE_CHECK
);
1679 m_pBreakTypeLB
->SelectEntryPos(0);
1680 //select break before
1681 m_pBreakPositionLB
->SelectEntryPos(0);
1685 m_pApplyCollBox
->SetNoSelection();
1686 m_pApplyCollBtn
->SetState( STATE_NOCHECK
);
1689 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1691 m_pApplyCollBtn
->EnableTriState( sal_True
);
1692 m_pApplyCollBtn
->SetState( STATE_DONTKNOW
);
1693 m_pApplyCollBox
->SetNoSelection();
1697 m_pApplyCollBtn
->Enable(sal_False
);
1698 m_pApplyCollBox
->Enable(sal_False
);
1699 m_pPagenumEdit
->Enable(sal_False
);
1700 m_pPagenumText
->Enable(sal_False
);
1703 if ( !bIsPageModel
)
1705 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1706 eItemState
= rSet
.GetItemState( _nWhich
);
1708 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1710 const SvxFmtBreakItem
& rPageBreak
=
1711 (const SvxFmtBreakItem
&)rSet
.Get( _nWhich
);
1713 SvxBreak eBreak
= (SvxBreak
)rPageBreak
.GetValue();
1715 // PageBreak not via CTRL-RETURN,
1716 // then CheckBox can be freed
1717 m_pPageBreakBox
->Enable();
1718 m_pPageBreakBox
->EnableTriState( sal_False
);
1719 m_pBreakTypeFT
->Enable();
1720 m_pBreakTypeLB
->Enable();
1721 m_pBreakPositionFT
->Enable();
1722 m_pBreakPositionLB
->Enable();
1724 m_pPageBreakBox
->SetState( STATE_CHECK
);
1726 sal_Bool _bEnable
= eBreak
!= SVX_BREAK_NONE
&&
1727 eBreak
!= SVX_BREAK_COLUMN_BEFORE
&&
1728 eBreak
!= SVX_BREAK_COLUMN_AFTER
;
1729 m_pApplyCollBtn
->Enable(_bEnable
);
1732 m_pApplyCollBox
->Enable(_bEnable
);
1733 m_pPagenumEdit
->Enable(_bEnable
);
1736 if ( eBreak
== SVX_BREAK_NONE
)
1737 m_pPageBreakBox
->SetState( STATE_NOCHECK
);
1739 sal_uInt16 nType
= 0; // selection position in break type ListBox : Page
1740 sal_uInt16 nPosition
= 0; // selection position in break position ListBox : Before
1743 case SVX_BREAK_PAGE_BEFORE
:
1745 case SVX_BREAK_PAGE_AFTER
:
1748 case SVX_BREAK_COLUMN_BEFORE
:
1751 case SVX_BREAK_COLUMN_AFTER
:
1755 default: ;//prevent warning
1757 m_pBreakTypeLB
->SelectEntryPos(nType
);
1758 m_pBreakPositionLB
->SelectEntryPos(nPosition
);
1760 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1761 m_pPageBreakBox
->SetState( STATE_DONTKNOW
);
1764 m_pPageBreakBox
->Enable(sal_False
);
1765 m_pBreakTypeFT
->Enable(sal_False
);
1766 m_pBreakTypeLB
->Enable(sal_False
);
1767 m_pBreakPositionFT
->Enable(sal_False
);
1768 m_pBreakPositionLB
->Enable(sal_False
);
1772 PageBreakPosHdl_Impl( m_pBreakPositionLB
);
1773 PageBreakHdl_Impl( m_pPageBreakBox
);
1776 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1777 eItemState
= rSet
.GetItemState( _nWhich
);
1779 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1781 m_pKeepParaBox
->EnableTriState( sal_False
);
1782 const SvxFmtKeepItem
& rKeep
=
1783 (const SvxFmtKeepItem
&)rSet
.Get( _nWhich
);
1785 if ( rKeep
.GetValue() )
1786 m_pKeepParaBox
->SetState( STATE_CHECK
);
1788 m_pKeepParaBox
->SetState( STATE_NOCHECK
);
1790 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1791 m_pKeepParaBox
->SetState( STATE_DONTKNOW
);
1793 m_pKeepParaBox
->Enable(sal_False
);
1795 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1796 eItemState
= rSet
.GetItemState( _nWhich
);
1798 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1800 const SvxFmtSplitItem
& rSplit
=
1801 (const SvxFmtSplitItem
&)rSet
.Get( _nWhich
);
1802 m_pKeepTogetherBox
->EnableTriState( sal_False
);
1804 if ( !rSplit
.GetValue() )
1805 m_pKeepTogetherBox
->SetState( STATE_CHECK
);
1808 m_pKeepTogetherBox
->SetState( STATE_NOCHECK
);
1810 // widows and orphans
1811 m_pWidowBox
->Enable();
1812 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1813 SfxItemState eTmpState
= rSet
.GetItemState( _nWhich
);
1815 if ( eTmpState
>= SFX_ITEM_AVAILABLE
)
1817 const SvxWidowsItem
& rWidow
=
1818 (const SvxWidowsItem
&)rSet
.Get( _nWhich
);
1819 m_pWidowBox
->EnableTriState( sal_False
);
1820 const sal_uInt16 nLines
= rWidow
.GetValue();
1822 sal_Bool _bEnable
= nLines
> 0;
1823 m_pWidowRowNo
->SetValue( m_pWidowRowNo
->Normalize( nLines
) );
1824 m_pWidowBox
->SetState( _bEnable
? STATE_CHECK
: STATE_NOCHECK
);
1825 m_pWidowRowNo
->Enable(_bEnable
);
1826 //m_pWidowRowLabel->Enable(_bEnable);
1829 else if ( SFX_ITEM_DONTCARE
== eTmpState
)
1830 m_pWidowBox
->SetState( STATE_DONTKNOW
);
1832 m_pWidowBox
->Enable(sal_False
);
1834 m_pOrphanBox
->Enable();
1835 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1836 eTmpState
= rSet
.GetItemState( _nWhich
);
1838 if ( eTmpState
>= SFX_ITEM_AVAILABLE
)
1840 const SvxOrphansItem
& rOrphan
=
1841 (const SvxOrphansItem
&)rSet
.Get( _nWhich
);
1842 const sal_uInt16 nLines
= rOrphan
.GetValue();
1843 m_pOrphanBox
->EnableTriState( sal_False
);
1845 sal_Bool _bEnable
= nLines
> 0;
1846 m_pOrphanBox
->SetState( _bEnable
? STATE_CHECK
: STATE_NOCHECK
);
1847 m_pOrphanRowNo
->SetValue( m_pOrphanRowNo
->Normalize( nLines
) );
1848 m_pOrphanRowNo
->Enable(_bEnable
);
1849 m_pOrphanRowLabel
->Enable(_bEnable
);
1852 else if ( SFX_ITEM_DONTCARE
== eTmpState
)
1853 m_pOrphanBox
->SetState( STATE_DONTKNOW
);
1855 m_pOrphanBox
->Enable(sal_False
);
1858 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1859 m_pKeepTogetherBox
->SetState( STATE_DONTKNOW
);
1861 m_pKeepTogetherBox
->Enable(sal_False
);
1863 // so that everything is enabled correctly
1864 KeepTogetherHdl_Impl( 0 );
1866 OrphanHdl_Impl( 0 );
1868 m_pHyphenBox
->SaveValue();
1869 m_pExtHyphenBeforeBox
->SaveValue();
1870 m_pExtHyphenAfterBox
->SaveValue();
1871 m_pMaxHyphenEdit
->SaveValue();
1872 m_pPageBreakBox
->SaveValue();
1873 m_pBreakPositionLB
->SaveValue();
1874 m_pBreakTypeLB
->SaveValue();
1875 m_pApplyCollBtn
->SaveValue();
1876 m_pApplyCollBox
->SaveValue();
1877 m_pPagenumEdit
->SaveValue();
1878 m_pKeepTogetherBox
->SaveValue();
1879 m_pKeepParaBox
->SaveValue();
1880 m_pWidowBox
->SaveValue();
1881 m_pOrphanBox
->SaveValue();
1884 // -----------------------------------------------------------------------
1886 int SvxExtParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1889 FillItemSet( *_pSet
);
1893 // -----------------------------------------------------------------------
1895 void SvxExtParagraphTabPage::DisablePageBreak()
1897 bPageBreak
= sal_False
;
1898 m_pPageBreakBox
->Enable(sal_False
);
1899 m_pBreakTypeLB
->RemoveEntry(0);
1900 m_pBreakPositionFT
->Enable(sal_False
);
1901 m_pBreakPositionLB
->Enable(sal_False
);
1902 m_pApplyCollBtn
->Enable(sal_False
);
1903 m_pApplyCollBox
->Enable(sal_False
);
1904 m_pPagenumEdit
->Enable(sal_False
);
1907 // -----------------------------------------------------------------------
1909 SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window
* pParent
, const SfxItemSet
& rAttr
) :
1910 SfxTabPage( pParent
, "TextFlowPage","cui/ui/textflowpage.ui", rAttr
),
1912 bPageBreak ( sal_True
),
1913 bHtmlMode ( sal_False
),
1917 get(m_pHyphenBox
,"checkAuto");
1918 get(m_pExtHyphenBeforeBox
,"spinLineEnd");
1919 get(m_pExtHyphenAfterBox
,"spinLineBegin");
1920 get(m_pMaxHyphenEdit
,"spinMaxNum");
1921 get(m_pBeforeText
,"labelLineBegin");
1922 get(m_pAfterText
,"labelLineEnd");
1923 get(m_pMaxHyphenLabel
,"labelMaxNum");
1926 get(m_pPageBreakBox
,"checkInsert");
1927 get(m_pBreakTypeLB
,"comboBreakType");
1928 get(m_pBreakPositionLB
,"comboBreakPosition");
1929 get(m_pApplyCollBtn
,"checkPageStyle");
1930 get(m_pApplyCollBox
,"comboPageStyle");
1931 get(m_pPagenumEdit
,"spinPageNumber");
1932 get(m_pBreakTypeFT
,"labelType");
1933 get(m_pBreakPositionFT
,"labelPosition");
1934 get(m_pPagenumText
,"labelPageNum");
1938 get(m_pKeepTogetherBox
,"checkSplitPara");
1939 get(m_pKeepParaBox
,"checkKeepPara");
1941 get(m_pOrphanBox
,"checkOrphan");
1942 get(m_pOrphanRowNo
,"spinOrphan");
1943 get(m_pOrphanRowLabel
,"labelOrphan");
1945 get(m_pWidowBox
,"checkWidow");
1946 get(m_pWidowRowNo
,"spinWidow");
1947 get(m_pWidowRowLabel
,"labelWidow");
1949 m_pApplyCollBox
->SetAccessibleRelationLabeledBy(m_pApplyCollBtn
);
1950 m_pApplyCollBox
->SetAccessibleName(String(CUI_RES(STR_PAGE_STYLE
)));
1952 m_pOrphanRowNo
->SetAccessibleRelationLabeledBy(m_pOrphanBox
);
1953 m_pWidowRowNo
->SetAccessibleRelationLabeledBy(m_pWidowBox
);
1955 // this page needs ExchangeSupport
1956 SetExchangeSupport();
1958 m_pHyphenBox
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, HyphenClickHdl_Impl
) );
1959 m_pPageBreakBox
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakHdl_Impl
) );
1960 m_pKeepTogetherBox
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
) );
1961 m_pWidowBox
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, WidowHdl_Impl
) );
1962 m_pOrphanBox
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, OrphanHdl_Impl
) );
1963 m_pApplyCollBtn
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
) );
1964 m_pBreakTypeLB
->SetSelectHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
) );
1965 m_pBreakPositionLB
->SetSelectHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
) );
1967 SfxObjectShell
* pSh
= SfxObjectShell::Current();
1970 SfxStyleSheetBasePool
* pPool
= pSh
->GetStyleSheetPool();
1971 pPool
->SetSearchMask( SFX_STYLE_FAMILY_PAGE
);
1972 SfxStyleSheetBase
* pStyle
= pPool
->First();
1977 if ( aStdName
.Len() == 0 )
1978 // first style == standard style
1979 aStdName
= pStyle
->GetName();
1980 m_pApplyCollBox
->InsertEntry( pStyle
->GetName() );
1981 pStyle
= pPool
->Next();
1983 nStdPos
= m_pApplyCollBox
->GetEntryPos( aStdName
);
1986 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl( rAttr
);
1987 if ( nHtmlMode
& HTMLMODE_ON
)
1989 bHtmlMode
= sal_True
;
1990 m_pHyphenBox
->Enable(sal_False
);
1991 m_pBeforeText
->Enable(sal_False
);
1992 m_pExtHyphenBeforeBox
->Enable(sal_False
);
1993 m_pAfterText
->Enable(sal_False
);
1994 m_pExtHyphenAfterBox
->Enable(sal_False
);
1995 m_pMaxHyphenLabel
->Enable(sal_False
);
1996 m_pMaxHyphenEdit
->Enable(sal_False
);
1997 m_pPagenumText
->Enable(sal_False
);
1998 m_pPagenumEdit
->Enable(sal_False
);
1999 // no column break in HTML
2000 m_pBreakTypeLB
->RemoveEntry(1);
2004 // -----------------------------------------------------------------------
2006 SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
2010 // -----------------------------------------------------------------------
2012 sal_uInt16
* SvxExtParagraphTabPage::GetRanges()
2017 // -----------------------------------------------------------------------
2019 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, PageBreakHdl_Impl
)
2021 switch ( m_pPageBreakBox
->GetState() )
2024 m_pBreakTypeFT
->Enable();
2025 m_pBreakTypeLB
->Enable();
2026 m_pBreakPositionFT
->Enable();
2027 m_pBreakPositionLB
->Enable();
2029 if ( 0 == m_pBreakTypeLB
->GetSelectEntryPos()&&
2030 0 == m_pBreakPositionLB
->GetSelectEntryPos() )
2032 m_pApplyCollBtn
->Enable();
2034 sal_Bool bEnable
= STATE_CHECK
== m_pApplyCollBtn
->GetState() &&
2035 m_pApplyCollBox
->GetEntryCount();
2036 m_pApplyCollBox
->Enable(bEnable
);
2039 m_pPagenumText
->Enable(bEnable
);
2040 m_pPagenumEdit
->Enable(bEnable
);
2046 case STATE_DONTKNOW
:
2047 m_pApplyCollBtn
->SetState( STATE_NOCHECK
);
2048 m_pApplyCollBtn
->Enable(sal_False
);
2049 m_pApplyCollBox
->Enable(sal_False
);
2050 m_pPagenumText
->Enable(sal_False
);
2051 m_pPagenumEdit
->Enable(sal_False
);
2052 m_pBreakTypeFT
->Enable(sal_False
);
2053 m_pBreakTypeLB
->Enable(sal_False
);
2054 m_pBreakPositionFT
->Enable(sal_False
);
2055 m_pBreakPositionLB
->Enable(sal_False
);
2061 // -----------------------------------------------------------------------
2063 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
)
2065 sal_Bool bEnable
= m_pKeepTogetherBox
->GetState() == STATE_NOCHECK
;
2066 m_pWidowBox
->Enable(bEnable
);
2067 m_pOrphanBox
->Enable(bEnable
);
2072 // -----------------------------------------------------------------------
2074 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, WidowHdl_Impl
)
2076 switch ( m_pWidowBox
->GetState() )
2079 m_pWidowRowNo
->Enable();
2080 m_pWidowRowLabel
->Enable();
2081 m_pKeepTogetherBox
->Enable(sal_False
);
2085 if ( m_pOrphanBox
->GetState() == STATE_NOCHECK
)
2086 m_pKeepTogetherBox
->Enable();
2089 case STATE_DONTKNOW
:
2090 m_pWidowRowNo
->Enable(sal_False
);
2091 m_pWidowRowLabel
->Enable(sal_False
);
2097 // -----------------------------------------------------------------------
2099 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, OrphanHdl_Impl
)
2101 switch( m_pOrphanBox
->GetState() )
2104 m_pOrphanRowNo
->Enable();
2105 m_pOrphanRowLabel
->Enable();
2106 m_pKeepTogetherBox
->Enable(sal_False
);
2110 if ( m_pWidowBox
->GetState() == STATE_NOCHECK
)
2111 m_pKeepTogetherBox
->Enable();
2114 case STATE_DONTKNOW
:
2115 m_pOrphanRowNo
->Enable(sal_False
);
2116 m_pOrphanRowLabel
->Enable(sal_False
);
2122 // -----------------------------------------------------------------------
2124 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, HyphenClickHdl_Impl
)
2127 sal_Bool bEnable
= m_pHyphenBox
->GetState() == STATE_CHECK
;
2128 m_pBeforeText
->Enable(bEnable
);
2129 m_pExtHyphenBeforeBox
->Enable(bEnable
);
2130 m_pAfterText
->Enable(bEnable
);
2131 m_pExtHyphenAfterBox
->Enable(bEnable
);
2132 m_pMaxHyphenLabel
->Enable(bEnable
);
2133 m_pMaxHyphenEdit
->Enable(bEnable
);
2134 m_pHyphenBox
->SetState( bEnable
? STATE_CHECK
: STATE_NOCHECK
);
2139 // -----------------------------------------------------------------------
2141 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
)
2143 sal_Bool bEnable
= sal_False
;
2144 if ( m_pApplyCollBtn
->GetState() == STATE_CHECK
&&
2145 m_pApplyCollBox
->GetEntryCount() )
2148 m_pApplyCollBox
->SelectEntryPos( nStdPos
);
2152 m_pApplyCollBox
->SetNoSelection();
2154 m_pApplyCollBox
->Enable(bEnable
);
2157 m_pPagenumText
->Enable(bEnable
);
2158 m_pPagenumEdit
->Enable(bEnable
);
2163 // -----------------------------------------------------------------------
2165 IMPL_LINK( SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
, ListBox
*, pListBox
)
2167 if ( 0 == pListBox
->GetSelectEntryPos() )
2169 m_pApplyCollBtn
->Enable();
2171 sal_Bool bEnable
= m_pApplyCollBtn
->GetState() == STATE_CHECK
&&
2172 m_pApplyCollBox
->GetEntryCount();
2174 m_pApplyCollBox
->Enable(bEnable
);
2177 m_pPagenumText
->Enable(bEnable
);
2178 m_pPagenumEdit
->Enable(bEnable
);
2181 else if ( 1 == pListBox
->GetSelectEntryPos() )
2183 m_pApplyCollBtn
->SetState( STATE_NOCHECK
);
2184 m_pApplyCollBtn
->Enable(sal_False
);
2185 m_pApplyCollBox
->Enable(sal_False
);
2186 m_pPagenumText
->Enable(sal_False
);
2187 m_pPagenumEdit
->Enable(sal_False
);
2192 // -----------------------------------------------------------------------
2194 IMPL_LINK( SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
, ListBox
*, pListBox
)
2196 //column break or break break after
2197 sal_uInt16 nBreakPos
= m_pBreakPositionLB
->GetSelectEntryPos();
2198 if ( pListBox
->GetSelectEntryPos() == 1 || 1 == nBreakPos
)
2200 m_pApplyCollBtn
->SetState( STATE_NOCHECK
);
2201 m_pApplyCollBtn
->Enable(sal_False
);
2202 m_pApplyCollBox
->Enable(sal_False
);
2203 m_pPagenumText
->Enable(sal_False
);
2204 m_pPagenumEdit
->Enable(sal_False
);
2207 PageBreakPosHdl_Impl( m_pBreakPositionLB
);
2211 void SvxExtParagraphTabPage::PageCreated(SfxAllItemSet aSet
)
2215 SFX_ITEMSET_ARG (&aSet
,pDisablePageBreakItem
,SfxBoolItem
,SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK
,sal_False
);
2217 if (pDisablePageBreakItem
)
2218 if ( pDisablePageBreakItem
->GetValue())
2224 SvxAsianTabPage::SvxAsianTabPage( Window
* pParent
, const SfxItemSet
& rSet
) :
2225 SfxTabPage(pParent
, "AsianTypography","cui/ui/asiantypography.ui", rSet
)
2228 get(m_pForbiddenRulesCB
,"checkForbidList");
2229 get(m_pHangingPunctCB
,"checkHangPunct");
2230 get(m_pScriptSpaceCB
,"checkApplySpacing");
2232 Link aLink
= LINK( this, SvxAsianTabPage
, ClickHdl_Impl
);
2233 m_pHangingPunctCB
->SetClickHdl( aLink
);
2234 m_pScriptSpaceCB
->SetClickHdl( aLink
);
2235 m_pForbiddenRulesCB
->SetClickHdl( aLink
);
2239 SvxAsianTabPage::~SvxAsianTabPage()
2243 SfxTabPage
* SvxAsianTabPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
2245 return new SvxAsianTabPage(pParent
, rSet
);
2248 sal_uInt16
* SvxAsianTabPage::GetRanges()
2250 static sal_uInt16 pRanges
[] =
2252 SID_ATTR_PARA_SCRIPTSPACE
, SID_ATTR_PARA_FORBIDDEN_RULES
,
2258 sal_Bool
SvxAsianTabPage::FillItemSet( SfxItemSet
& rSet
)
2260 sal_Bool bRet
= sal_False
;
2261 SfxItemPool
* pPool
= rSet
.GetPool();
2262 if (m_pScriptSpaceCB
->IsEnabled() && m_pScriptSpaceCB
->IsChecked() != m_pScriptSpaceCB
->GetSavedValue())
2264 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2265 pPool
->GetWhich(SID_ATTR_PARA_SCRIPTSPACE
)).Clone();
2266 pNewItem
->SetValue(m_pScriptSpaceCB
->IsChecked());
2267 rSet
.Put(*pNewItem
);
2271 if (m_pHangingPunctCB
->IsEnabled() && m_pHangingPunctCB
->IsChecked() != m_pHangingPunctCB
->GetSavedValue())
2273 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2274 pPool
->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION
)).Clone();
2275 pNewItem
->SetValue(m_pHangingPunctCB
->IsChecked());
2276 rSet
.Put(*pNewItem
);
2280 if (m_pForbiddenRulesCB
->IsEnabled() && m_pForbiddenRulesCB
->IsChecked() != m_pForbiddenRulesCB
->GetSavedValue())
2282 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2283 pPool
->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES
)).Clone();
2284 pNewItem
->SetValue(m_pForbiddenRulesCB
->IsChecked());
2285 rSet
.Put(*pNewItem
);
2292 static void lcl_SetBox(const SfxItemSet
& rSet
, sal_uInt16 nSlotId
, CheckBox
& rBox
)
2294 sal_uInt16 _nWhich
= rSet
.GetPool()->GetWhich(nSlotId
);
2295 SfxItemState eState
= rSet
.GetItemState(_nWhich
, sal_True
);
2296 if(!eState
|| eState
== SFX_ITEM_DISABLED
)
2297 rBox
.Enable(sal_False
);
2298 else if(eState
>= SFX_ITEM_AVAILABLE
)
2300 rBox
.EnableTriState( sal_False
);
2301 rBox
.Check(((const SfxBoolItem
&)rSet
.Get(_nWhich
)).GetValue());
2304 rBox
.SetState( STATE_DONTKNOW
);
2309 void SvxAsianTabPage::Reset( const SfxItemSet
& rSet
)
2311 lcl_SetBox(rSet
, SID_ATTR_PARA_FORBIDDEN_RULES
, *m_pForbiddenRulesCB
);
2312 lcl_SetBox(rSet
, SID_ATTR_PARA_HANGPUNCTUATION
, *m_pHangingPunctCB
);
2314 //character distance not yet available
2315 lcl_SetBox(rSet
, SID_ATTR_PARA_SCRIPTSPACE
, *m_pScriptSpaceCB
);
2318 IMPL_LINK( SvxAsianTabPage
, ClickHdl_Impl
, CheckBox
*, pBox
)
2320 pBox
->EnableTriState( sal_False
);
2324 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */