1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_cui.hxx"
31 #include <svl/style.hxx>
32 #include <sfx2/app.hxx>
33 #include <sfx2/objsh.hxx>
34 #include <sfx2/module.hxx>
35 #include <vcl/mnemonic.hxx>
36 #include <svx/dialogs.hrc>
38 #define _SVX_PARAGRPH_CXX 0
40 #include <svl/languageoptions.hxx>
41 #include <editeng/pgrditem.hxx>
43 #include "paragrph.hrc"
44 #include "paragrph.hxx"
45 #include <editeng/frmdiritem.hxx>
46 #include <editeng/lspcitem.hxx>
47 #include <editeng/adjitem.hxx>
48 #include <editeng/orphitem.hxx>
49 #include <editeng/widwitem.hxx>
50 #include <editeng/tstpitem.hxx>
51 #include <editeng/pmdlitem.hxx>
52 #include <editeng/spltitem.hxx>
53 #include <editeng/hyznitem.hxx>
54 #include <editeng/ulspitem.hxx>
55 #include <editeng/lrspitem.hxx>
56 #include <editeng/brkitem.hxx>
57 #include <editeng/keepitem.hxx>
58 #include "svx/dlgutil.hxx"
59 #include <dialmgr.hxx>
60 #include "svx/htmlmode.hxx"
61 #include <editeng/paravertalignitem.hxx>
62 #include <svl/eitem.hxx> //add CHINA001
63 #include <sfx2/request.hxx> //add CHINA001
64 #include <svl/intitem.hxx> //add CHINA001
66 // static ----------------------------------------------------------------
68 static sal_uInt16 pStdRanges
[] =
70 SID_ATTR_PARA_LINESPACE
, // 10033
71 SID_ATTR_PARA_LINESPACE
,
72 SID_ATTR_LRSPACE
, // 10048 -
73 SID_ATTR_ULSPACE
, // 10049
74 SID_ATTR_PARA_REGISTER
, // 10413
75 SID_ATTR_PARA_REGISTER
,
79 static sal_uInt16 pAlignRanges
[] =
81 SID_ATTR_PARA_ADJUST
, // 10027
86 static sal_uInt16 pExtRanges
[] =
88 SID_ATTR_PARA_PAGEBREAK
, // 10037 -
89 SID_ATTR_PARA_WIDOWS
, // 10041
90 SID_ATTR_PARA_MODEL
, // 10065 -
91 SID_ATTR_PARA_KEEP
, // 10066
95 // define ----------------------------------------------------------------
97 #define MAX_DURCH 5670 // 10 cm ist sinnvoll als maximaler Durchschuss
99 #define FIX_DIST_DEF 283 // Standard-Fix-Abstand 0,5cm
101 // enum ------------------------------------------------------------------
115 // C-Funktion ------------------------------------------------------------
117 void SetLineSpace_Impl( SvxLineSpacingItem
&, int, long lValue
= 0 );
119 void SetLineSpace_Impl( SvxLineSpacingItem
& rLineSpace
,
120 int eSpace
, long lValue
)
125 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
126 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
130 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
131 rLineSpace
.SetPropLineSpace( 150 );
135 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
136 rLineSpace
.SetPropLineSpace( 200 );
139 case LLINESPACE_PROP
:
140 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
141 rLineSpace
.SetPropLineSpace( (sal_uInt8
)lValue
);
145 rLineSpace
.SetLineHeight( (sal_uInt16
)lValue
);
146 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
149 case LLINESPACE_DURCH
:
150 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
151 rLineSpace
.SetInterLineSpace( (sal_uInt16
)lValue
);
155 rLineSpace
.SetLineHeight((sal_uInt16
)lValue
);
156 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_FIX
;
157 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
163 sal_uInt16
GetHtmlMode_Impl(const SfxItemSet
& rSet
)
165 sal_uInt16 nHtmlMode
= 0;
166 const SfxPoolItem
* pItem
= 0;
167 SfxObjectShell
* pShell
;
168 if(SFX_ITEM_SET
== rSet
.GetItemState(SID_HTML_MODE
, sal_False
, &pItem
) ||
169 ( 0 != (pShell
= SfxObjectShell::Current()) &&
170 0 != (pItem
= pShell
->GetItem(SID_HTML_MODE
))))
172 nHtmlMode
= ((SfxUInt16Item
*)pItem
)->GetValue();
178 // class SvxStdParagraphTabPage ------------------------------------------
180 IMPL_LINK( SvxStdParagraphTabPage
, ELRLoseFocusHdl
, Edit
*, EMPTYARG
)
182 //! if ( aLeftIndent.IsRelativeMode() )
185 SfxItemPool
* pPool
= GetItemSet().GetPool();
186 DBG_ASSERT( pPool
, "Wo ist der Pool" );
188 MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
190 sal_Int64 nL
= aLeftIndent
.Denormalize( aLeftIndent
.GetValue( eUnit
) );
191 sal_Int64 nR
= aRightIndent
.Denormalize( aRightIndent
.GetValue( eUnit
) );
192 String aTmp
= aFLineIndent
.GetText();
195 if( aLeftIndent
.GetMin() < 0 )
196 aFLineIndent
.SetMin( -99999, FUNIT_MM
);
198 aFLineIndent
.SetMin( aFLineIndent
.Normalize( -nL
), eUnit
);
200 // Check nur fuer konkrete Breite (Shell)
201 sal_Int64 nTmp
= nWidth
- nL
- nR
- MM50
;
202 aFLineIndent
.SetMax( aFLineIndent
.Normalize( nTmp
), eUnit
);
205 aFLineIndent
.SetEmptyFieldValue();
206 // Maximum Links Rechts
207 aTmp
= aLeftIndent
.GetText();
208 nTmp
= nWidth
- nR
- MM50
;
209 aLeftIndent
.SetMax( aLeftIndent
.Normalize( nTmp
), eUnit
);
212 aLeftIndent
.SetEmptyFieldValue();
213 aTmp
= aRightIndent
.GetText();
214 nTmp
= nWidth
- nL
- MM50
;
215 aRightIndent
.SetMax( aRightIndent
.Normalize( nTmp
), eUnit
);
218 aRightIndent
.SetEmptyFieldValue();
222 // -----------------------------------------------------------------------
224 SfxTabPage
* SvxStdParagraphTabPage::Create( Window
* pParent
,
225 const SfxItemSet
& rSet
)
227 return new SvxStdParagraphTabPage( pParent
, rSet
);
230 // -----------------------------------------------------------------------
232 sal_Bool
SvxStdParagraphTabPage::FillItemSet( SfxItemSet
& rOutSet
)
234 SfxItemState eState
= SFX_ITEM_UNKNOWN
;
235 const SfxPoolItem
* pOld
= 0;
236 SfxItemPool
* pPool
= rOutSet
.GetPool();
237 DBG_ASSERT( pPool
, "Wo ist der Pool" );
239 sal_Bool bModified
= sal_False
;
241 sal_uInt16 nPos
= aLineDist
.GetSelectEntryPos();
243 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
244 ( nPos
!= aLineDist
.GetSavedValue() ||
245 aLineDistAtPercentBox
.IsValueModified() ||
246 aLineDistAtMetricBox
.IsValueModified() ) )
248 nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
249 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
250 SvxLineSpacingItem
aSpacing(
251 (const SvxLineSpacingItem
&)GetItemSet().Get( nWhich
) );
258 SetLineSpace_Impl( aSpacing
, nPos
);
261 case LLINESPACE_PROP
:
262 SetLineSpace_Impl( aSpacing
, nPos
,
263 static_cast<long>(aLineDistAtPercentBox
.Denormalize(
264 aLineDistAtPercentBox
.GetValue() )) );
268 case LLINESPACE_DURCH
:
270 SetLineSpace_Impl( aSpacing
, nPos
,
271 GetCoreValue( aLineDistAtMetricBox
, eUnit
) );
275 DBG_ERROR( "unbekannter Type fuer Zeilenabstand." );
278 eState
= GetItemSet().GetItemState( nWhich
);
279 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_LINESPACE
);
281 if ( !pOld
|| !( *(const SvxLineSpacingItem
*)pOld
== aSpacing
) ||
282 SFX_ITEM_DONTCARE
== eState
)
284 rOutSet
.Put( aSpacing
);
285 bModified
|= sal_True
;
289 if ( aTopDist
.IsValueModified() || aBottomDist
.IsValueModified() )
291 nWhich
= GetWhich( SID_ATTR_ULSPACE
);
292 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
293 pOld
= GetOldItem( rOutSet
, SID_ATTR_ULSPACE
);
294 SvxULSpaceItem
aMargin( nWhich
);
298 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
300 const SvxULSpaceItem
& rOldItem
=
301 (const SvxULSpaceItem
&)GetItemSet().GetParent()->Get( nWhich
);
303 if ( aTopDist
.IsRelative() )
304 aMargin
.SetUpper( rOldItem
.GetUpper(),
305 (sal_uInt16
)aTopDist
.GetValue() );
307 aMargin
.SetUpper( (sal_uInt16
)GetCoreValue( aTopDist
, eUnit
) );
309 if ( aBottomDist
.IsRelative() )
310 aMargin
.SetLower( rOldItem
.GetLower(),
311 (sal_uInt16
)aBottomDist
.GetValue() );
313 aMargin
.SetLower( (sal_uInt16
)GetCoreValue( aBottomDist
, eUnit
) );
318 aMargin
.SetUpper( (sal_uInt16
)GetCoreValue( aTopDist
, eUnit
) );
319 aMargin
.SetLower( (sal_uInt16
)GetCoreValue( aBottomDist
, eUnit
) );
321 eState
= GetItemSet().GetItemState( nWhich
);
323 if ( !pOld
|| !( *(const SvxULSpaceItem
*)pOld
== aMargin
) ||
324 SFX_ITEM_DONTCARE
== eState
)
326 rOutSet
.Put( aMargin
);
327 bModified
|= sal_True
;
330 FASTBOOL bNullTab
= sal_False
;
332 if ( aLeftIndent
.IsValueModified() ||
333 aFLineIndent
.IsValueModified() ||
334 aRightIndent
.IsValueModified()
335 || aAutoCB
.GetSavedValue() != aAutoCB
.IsChecked() )
337 nWhich
= GetWhich( SID_ATTR_LRSPACE
);
338 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
339 SvxLRSpaceItem
aMargin( nWhich
);
340 pOld
= GetOldItem( rOutSet
, SID_ATTR_LRSPACE
);
344 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
346 const SvxLRSpaceItem
& rOldItem
=
347 (const SvxLRSpaceItem
&)GetItemSet().GetParent()->Get( nWhich
);
349 if ( aLeftIndent
.IsRelative() )
350 aMargin
.SetTxtLeft( rOldItem
.GetTxtLeft(),
351 (sal_uInt16
)aLeftIndent
.GetValue() );
353 aMargin
.SetTxtLeft( GetCoreValue( aLeftIndent
, eUnit
) );
355 if ( aRightIndent
.IsRelative() )
356 aMargin
.SetRight( rOldItem
.GetRight(),
357 (sal_uInt16
)aRightIndent
.GetValue() );
359 aMargin
.SetRight( GetCoreValue( aRightIndent
, eUnit
) );
361 if ( aFLineIndent
.IsRelative() )
362 aMargin
.SetTxtFirstLineOfst( rOldItem
.GetTxtFirstLineOfst(),
363 (sal_uInt16
)aFLineIndent
.GetValue() );
365 aMargin
.SetTxtFirstLineOfst(
366 (sal_uInt16
)GetCoreValue( aFLineIndent
, eUnit
) );
370 aMargin
.SetTxtLeft( GetCoreValue( aLeftIndent
, eUnit
) );
371 aMargin
.SetRight( GetCoreValue( aRightIndent
, eUnit
) );
372 aMargin
.SetTxtFirstLineOfst(
373 (sal_uInt16
)GetCoreValue( aFLineIndent
, eUnit
) );
375 aMargin
.SetAutoFirst(aAutoCB
.IsChecked());
376 if ( aMargin
.GetTxtFirstLineOfst() < 0 )
378 eState
= GetItemSet().GetItemState( nWhich
);
380 if ( !pOld
|| !( *(const SvxLRSpaceItem
*)pOld
== aMargin
) ||
381 SFX_ITEM_DONTCARE
== eState
)
383 rOutSet
.Put( aMargin
);
384 bModified
|= sal_True
;
390 MapUnit eUnit
= (MapUnit
)pPool
->GetMetric( GetWhich( SID_ATTR_TABSTOP
) );
391 if ( MAP_100TH_MM
!= eUnit
)
394 // negativer Erstzeileneinzug -> ggf. Null Default-Tabstop setzen
395 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_TABSTOP
);
396 const SfxItemSet
& rInSet
= GetItemSet();
398 if ( rInSet
.GetItemState( _nWhich
) >= SFX_ITEM_AVAILABLE
)
400 const SvxTabStopItem
& rTabItem
=
401 (const SvxTabStopItem
&)rInSet
.Get( _nWhich
);
402 SvxTabStopItem
aNullTab( rTabItem
);
403 SvxTabStop
aNull( 0, SVX_TAB_ADJUST_DEFAULT
);
404 aNullTab
.Insert( aNull
);
405 rOutSet
.Put( aNullTab
);
409 if( aRegisterCB
.IsVisible())
411 const SfxBoolItem
* pBoolItem
= (SfxBoolItem
*)GetOldItem(
412 rOutSet
, SID_ATTR_PARA_REGISTER
);
413 SfxBoolItem
* pRegItem
= (SfxBoolItem
*)pBoolItem
->Clone();
414 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
415 sal_Bool bSet
= pRegItem
->GetValue();
417 if(aRegisterCB
.IsChecked() != bSet
)
419 pRegItem
->SetValue(!bSet
);
420 rOutSet
.Put(*pRegItem
);
421 bModified
|= sal_True
;
423 else if ( SFX_ITEM_DEFAULT
== GetItemSet().GetItemState( _nWhich
, sal_False
) )
424 rOutSet
.ClearItem(_nWhich
);
431 // -----------------------------------------------------------------------
433 void SvxStdParagraphTabPage::Reset( const SfxItemSet
& rSet
)
435 SfxItemPool
* pPool
= rSet
.GetPool();
436 DBG_ASSERT( pPool
, "Wo ist der Pool?" );
440 FieldUnit eFUnit
= GetModuleFieldUnit( rSet
);
441 SetFieldUnit( aLeftIndent
, eFUnit
);
442 SetFieldUnit( aRightIndent
, eFUnit
);
443 SetFieldUnit( aFLineIndent
, eFUnit
);
444 SetFieldUnit( aTopDist
, eFUnit
);
445 SetFieldUnit( aBottomDist
, eFUnit
);
446 SetFieldUnit( aLineDistAtMetricBox
, eFUnit
);
448 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_LRSPACE
);
449 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
451 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
453 SfxMapUnit eUnit
= pPool
->GetMetric( _nWhich
);
457 const SvxLRSpaceItem
& rOldItem
=
458 (const SvxLRSpaceItem
&)rSet
.Get( _nWhich
);
460 if ( rOldItem
.GetPropLeft() != 100 )
462 aLeftIndent
.SetRelative( sal_True
);
463 aLeftIndent
.SetValue( rOldItem
.GetPropLeft() );
467 aLeftIndent
.SetRelative();
468 SetFieldUnit( aLeftIndent
, eFUnit
);
469 SetMetricValue( aLeftIndent
, rOldItem
.GetTxtLeft(), eUnit
);
472 if ( rOldItem
.GetPropRight() != 100 )
474 aRightIndent
.SetRelative( sal_True
);
475 aRightIndent
.SetValue( rOldItem
.GetPropRight() );
479 aRightIndent
.SetRelative();
480 SetFieldUnit( aRightIndent
, eFUnit
);
481 SetMetricValue( aRightIndent
, rOldItem
.GetRight(), eUnit
);
484 if ( rOldItem
.GetPropTxtFirstLineOfst() != 100 )
486 aFLineIndent
.SetRelative( sal_True
);
487 aFLineIndent
.SetValue( rOldItem
.GetPropTxtFirstLineOfst() );
491 aFLineIndent
.SetRelative();
492 aFLineIndent
.SetMin(-9999);
493 SetFieldUnit( aFLineIndent
, eFUnit
);
494 SetMetricValue( aFLineIndent
, rOldItem
.GetTxtFirstLineOfst(),
497 aAutoCB
.Check(rOldItem
.IsAutoFirst());
501 const SvxLRSpaceItem
& rSpace
=
502 (const SvxLRSpaceItem
&)rSet
.Get( _nWhich
);
504 SetMetricValue( aLeftIndent
, rSpace
.GetTxtLeft(), eUnit
);
505 SetMetricValue( aRightIndent
, rSpace
.GetRight(), eUnit
);
506 SetMetricValue( aFLineIndent
, rSpace
.GetTxtFirstLineOfst(), eUnit
);
507 aAutoCB
.Check(rSpace
.IsAutoFirst());
509 AutoHdl_Impl(&aAutoCB
);
513 aLeftIndent
.SetEmptyFieldValue();
514 aRightIndent
.SetEmptyFieldValue();
515 aFLineIndent
.SetEmptyFieldValue();
518 _nWhich
= GetWhich( SID_ATTR_ULSPACE
);
519 eItemState
= rSet
.GetItemState( _nWhich
);
521 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
523 SfxMapUnit eUnit
= pPool
->GetMetric( _nWhich
);
527 const SvxULSpaceItem
& rOldItem
=
528 (const SvxULSpaceItem
&)rSet
.Get( _nWhich
);
530 if ( rOldItem
.GetPropUpper() != 100 )
532 aTopDist
.SetRelative( sal_True
);
533 aTopDist
.SetValue( rOldItem
.GetPropUpper() );
537 aTopDist
.SetRelative();
538 SetFieldUnit( aTopDist
, eFUnit
);
539 SetMetricValue( aTopDist
, rOldItem
.GetUpper(), eUnit
);
542 if ( rOldItem
.GetPropLower() != 100 )
544 aBottomDist
.SetRelative( sal_True
);
545 aBottomDist
.SetValue( rOldItem
.GetPropLower() );
549 aBottomDist
.SetRelative();
550 SetFieldUnit( aBottomDist
, eFUnit
);
551 SetMetricValue( aBottomDist
, rOldItem
.GetLower(), eUnit
);
556 const SvxULSpaceItem
& rTopMargin
=
557 (const SvxULSpaceItem
&)rSet
.Get( _nWhich
);
558 SetMetricValue( aTopDist
, rTopMargin
.GetUpper(), eUnit
);
559 SetMetricValue( aBottomDist
, rTopMargin
.GetLower(), eUnit
);
564 aTopDist
.SetEmptyFieldValue();
565 aBottomDist
.SetEmptyFieldValue();
568 _nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
569 eItemState
= rSet
.GetItemState( _nWhich
);
571 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
572 SetLineSpacing_Impl( (const SvxLineSpacingItem
&)rSet
.Get( _nWhich
) );
574 aLineDist
.SetNoSelection();
577 _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
578 eItemState
= rSet
.GetItemState( _nWhich
);
580 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
581 aRegisterCB
.Check( ((const SfxBoolItem
&)rSet
.Get( _nWhich
)).GetValue());
582 aRegisterCB
.SaveValue();
583 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(rSet
);
584 if(nHtmlMode
& HTMLMODE_ON
)
589 if(!(nHtmlMode
& HTMLMODE_SOME_STYLES
)) // IE oder SW
591 aRightLabel
.Disable();
592 aRightIndent
.Disable();
593 aTopDist
.Disable(); //HTML3.2 und NS 3.0
594 aBottomDist
.Disable();
595 if(!(nHtmlMode
& HTMLMODE_FIRSTLINE
)) //NS 3.0
597 aFLineIndent
.Disable();
598 aFLineLabel
.Disable();
603 ELRLoseFocusHdl( NULL
);
605 aLineDist
.SaveValue();
608 // -----------------------------------------------------------------------
610 void SvxStdParagraphTabPage::EnableRelativeMode()
612 DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
614 aLeftIndent
.EnableRelativeMode( 0, 999 );
615 aFLineIndent
.EnableRelativeMode( 0, 999 );
616 aRightIndent
.EnableRelativeMode( 0, 999 );
617 aTopDist
.EnableRelativeMode( 0, 999 );
618 aBottomDist
.EnableRelativeMode( 0, 999 );
619 bRelativeMode
= sal_True
;
622 // -----------------------------------------------------------------------
624 int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
626 ELRLoseFocusHdl( NULL
);
629 FillItemSet( *_pSet
);
633 // -----------------------------------------------------------------------
635 SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window
* pParent
,
636 const SfxItemSet
& rAttr
) :
638 SfxTabPage( pParent
, CUI_RES( RID_SVXPAGE_STD_PARAGRAPH
), rAttr
),
640 aIndentFrm ( this, CUI_RES( FL_INDENT
) ),
641 aLeftLabel ( this, CUI_RES( FT_LEFTINDENT
) ),
642 aLeftIndent ( this, CUI_RES( ED_LEFTINDENT
) ),
643 aRightLabel ( this, CUI_RES( FT_RIGHTINDENT
) ),
644 aRightIndent ( this, CUI_RES( ED_RIGHTINDENT
) ),
646 aFLineLabel ( this, CUI_RES( FT_FLINEINDENT
) ),
647 aFLineIndent ( this, CUI_RES( ED_FLINEINDENT
) ),
648 aAutoCB ( this, CUI_RES( CB_AUTO
) ),
649 aDistFrm ( this, CUI_RES( FL_DIST
) ),
650 aTopLabel ( this, CUI_RES( FT_TOPDIST
) ),
651 aTopDist ( this, CUI_RES( ED_TOPDIST
) ),
652 aBottomLabel ( this, CUI_RES( FT_BOTTOMDIST
) ),
653 aBottomDist ( this, CUI_RES( ED_BOTTOMDIST
) ),
655 aLineDistFrm ( this, CUI_RES( FL_LINEDIST
) ),
656 aLineDist ( this, CUI_RES( LB_LINEDIST
) ),
657 aLineDistAtLabel ( this, CUI_RES( FT_LINEDIST
) ),
658 aLineDistAtPercentBox ( this, CUI_RES( ED_LINEDISTPERCENT
) ),
659 aLineDistAtMetricBox ( this, CUI_RES( ED_LINEDISTMETRIC
) ),
660 sAbsDist ( CUI_RES(ST_LINEDIST_ABS
) ),
661 aExampleWin ( this, CUI_RES( WN_EXAMPLE
) ),
662 aRegisterFL ( this, CUI_RES( FL_REGISTER
) ),
663 aRegisterCB ( this, CUI_RES( CB_REGISTER
) ),
664 pActLineDistFld ( &aLineDistAtPercentBox
),
666 nWidth ( 11905 /*567 * 50*/ ),
669 bRelativeMode ( sal_False
),
670 bNegativeIndents(sal_False
)
673 // diese Page braucht ExchangeSupport
674 SetExchangeSupport();
676 aLineDistAtMetricBox
.Hide();
679 aFLineIndent
.SetMin(-9999); // wird default auf 0 gesetzt
681 aExampleWin
.SetAccessibleName(String(CUI_RES(STR_EXAMPLE
)));
686 // -----------------------------------------------------------------------
688 void SvxStdParagraphTabPage::EnableNegativeMode()
690 aLeftIndent
.SetMin(-9999);
691 aRightIndent
.SetMin(-9999);
692 aRightIndent
.EnableNegativeMode();
693 aLeftIndent
.EnableNegativeMode();
694 bNegativeIndents
= sal_True
;
697 // -----------------------------------------------------------------------
699 sal_uInt16
* SvxStdParagraphTabPage::GetRanges()
704 // -----------------------------------------------------------------------
706 void SvxStdParagraphTabPage::SetLineSpacing_Impl
708 const SvxLineSpacingItem
&rAttr
711 SfxMapUnit eUnit
= GetItemSet().GetPool()->GetMetric( rAttr
.Which() );
713 switch( rAttr
.GetLineSpaceRule() )
715 case SVX_LINE_SPACE_AUTO
:
717 SvxInterLineSpace eInter
= rAttr
.GetInterLineSpaceRule();
722 case SVX_INTER_LINE_SPACE_OFF
:
723 aLineDist
.SelectEntryPos( LLINESPACE_1
);
727 case SVX_INTER_LINE_SPACE_PROP
:
728 if ( 100 == rAttr
.GetPropLineSpace() )
730 aLineDist
.SelectEntryPos( LLINESPACE_1
);
734 if ( 150 == rAttr
.GetPropLineSpace() )
736 aLineDist
.SelectEntryPos( LLINESPACE_15
);
740 if ( 200 == rAttr
.GetPropLineSpace() )
742 aLineDist
.SelectEntryPos( LLINESPACE_2
);
745 // eingestellter Prozentwert
746 aLineDistAtPercentBox
.
747 SetValue( aLineDistAtPercentBox
.Normalize(
748 rAttr
.GetPropLineSpace() ) );
749 aLineDist
.SelectEntryPos( LLINESPACE_PROP
);
752 case SVX_INTER_LINE_SPACE_FIX
:
753 SetMetricValue( aLineDistAtMetricBox
,
754 rAttr
.GetInterLineSpace(), eUnit
);
755 aLineDist
.SelectEntryPos( LLINESPACE_DURCH
);
757 default: ;//prevent warning
761 case SVX_LINE_SPACE_FIX
:
762 SetMetricValue(aLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
763 aLineDist
.SelectEntryPos( LLINESPACE_FIX
);
766 case SVX_LINE_SPACE_MIN
:
767 SetMetricValue(aLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
768 aLineDist
.SelectEntryPos( LLINESPACE_MIN
);
770 default: ;//prevent warning
772 LineDistHdl_Impl( &aLineDist
);
775 // -----------------------------------------------------------------------
777 IMPL_LINK( SvxStdParagraphTabPage
, LineDistHdl_Impl
, ListBox
*, pBox
)
779 switch( pBox
->GetSelectEntryPos() )
784 aLineDistAtLabel
.Enable(sal_False
);
785 pActLineDistFld
->Enable(sal_False
);
786 pActLineDistFld
->SetText( String() );
789 case LLINESPACE_DURCH
:
790 // Setzen eines sinnvollen Defaults?
791 // MS Begrenzen min(10, aPageSize)
792 aLineDistAtPercentBox
.Hide();
793 pActLineDistFld
= &aLineDistAtMetricBox
;
794 aLineDistAtMetricBox
.SetMin(0);
797 if ( !aLineDistAtMetricBox
.GetText().Len() )
798 aLineDistAtMetricBox
.SetValue(
799 aLineDistAtMetricBox
.Normalize( 1 ) );
800 aLineDistAtPercentBox
.Hide();
801 pActLineDistFld
->Show();
802 pActLineDistFld
->Enable();
803 aLineDistAtLabel
.Enable();
807 aLineDistAtPercentBox
.Hide();
808 pActLineDistFld
= &aLineDistAtMetricBox
;
809 aLineDistAtMetricBox
.SetMin(0);
811 if ( !aLineDistAtMetricBox
.GetText().Len() )
812 aLineDistAtMetricBox
.SetValue(
813 aLineDistAtMetricBox
.Normalize( 10 ), FUNIT_TWIP
);
814 aLineDistAtPercentBox
.Hide();
815 pActLineDistFld
->Show();
816 pActLineDistFld
->Enable();
817 aLineDistAtLabel
.Enable();
820 case LLINESPACE_PROP
:
821 aLineDistAtMetricBox
.Hide();
822 pActLineDistFld
= &aLineDistAtPercentBox
;
824 if ( !aLineDistAtPercentBox
.GetText().Len() )
825 aLineDistAtPercentBox
.SetValue(
826 aLineDistAtPercentBox
.Normalize( 100 ), FUNIT_TWIP
);
827 aLineDistAtMetricBox
.Hide();
828 pActLineDistFld
->Show();
829 pActLineDistFld
->Enable();
830 aLineDistAtLabel
.Enable();
834 aLineDistAtPercentBox
.Hide();
835 pActLineDistFld
= &aLineDistAtMetricBox
;
836 sal_Int64 nTemp
= aLineDistAtMetricBox
.GetValue();
837 aLineDistAtMetricBox
.SetMin(aLineDistAtMetricBox
.Normalize(nMinFixDist
), FUNIT_TWIP
);
839 // wurde der Wert beim SetMin veraendert, dann ist es Zeit
841 if ( aLineDistAtMetricBox
.GetValue() != nTemp
)
842 SetMetricValue( aLineDistAtMetricBox
,
843 FIX_DIST_DEF
, SFX_MAPUNIT_TWIP
); // fix gibt's nur im Writer
844 aLineDistAtPercentBox
.Hide();
845 pActLineDistFld
->Show();
846 pActLineDistFld
->Enable();
847 aLineDistAtLabel
.Enable();
851 UpdateExample_Impl( sal_True
);
855 // -----------------------------------------------------------------------
857 IMPL_LINK_INLINE_START( SvxStdParagraphTabPage
, ModifyHdl_Impl
, SvxRelativeField
*, EMPTYARG
)
859 UpdateExample_Impl();
862 IMPL_LINK_INLINE_END( SvxStdParagraphTabPage
, ModifyHdl_Impl
, SvxRelativeField
*, EMPTYARG
)
864 // -----------------------------------------------------------------------
866 void SvxStdParagraphTabPage::Init_Impl()
868 aLineDist
.SetSelectHdl(
869 LINK( this, SvxStdParagraphTabPage
, LineDistHdl_Impl
) );
871 Link aLink
= LINK( this, SvxStdParagraphTabPage
, ELRLoseFocusHdl
);
872 aFLineIndent
.SetLoseFocusHdl( aLink
);
873 aLeftIndent
.SetLoseFocusHdl( aLink
);
874 aRightIndent
.SetLoseFocusHdl( aLink
);
876 aLink
= LINK( this, SvxStdParagraphTabPage
, ModifyHdl_Impl
);
877 aFLineIndent
.SetModifyHdl( aLink
);
878 aLeftIndent
.SetModifyHdl( aLink
);
879 aRightIndent
.SetModifyHdl( aLink
);
880 aTopDist
.SetModifyHdl( aLink
);
881 aBottomDist
.SetModifyHdl( aLink
);
883 aAutoCB
.SetClickHdl( LINK( this, SvxStdParagraphTabPage
, AutoHdl_Impl
));
884 SfxItemPool
* pPool
= GetItemSet().GetPool();
885 DBG_ASSERT( pPool
, "Wo ist der Pool" );
887 MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
889 aTopDist
.SetMax( aTopDist
.Normalize( nAbst
), eUnit
);
890 aBottomDist
.SetMax( aBottomDist
.Normalize( nAbst
), eUnit
);
891 aLineDistAtMetricBox
.SetMax(
892 aLineDistAtMetricBox
.Normalize( nAbst
), eUnit
);
895 // -----------------------------------------------------------------------
897 void SvxStdParagraphTabPage::UpdateExample_Impl( sal_Bool bAll
)
899 aExampleWin
.SetFirstLineOfst(
900 (short)aFLineIndent
.Denormalize( aFLineIndent
.GetValue( FUNIT_TWIP
) ) );
901 aExampleWin
.SetLeftMargin(
902 static_cast<long>(aLeftIndent
.Denormalize( aLeftIndent
.GetValue( FUNIT_TWIP
) ) ) );
903 aExampleWin
.SetRightMargin(
904 static_cast<long>(aRightIndent
.Denormalize( aRightIndent
.GetValue( FUNIT_TWIP
) ) ) );
905 aExampleWin
.SetUpper(
906 (sal_uInt16
)aTopDist
.Denormalize( aTopDist
.GetValue( FUNIT_TWIP
) ) );
907 aExampleWin
.SetLower(
908 (sal_uInt16
)aBottomDist
.Denormalize( aBottomDist
.GetValue( FUNIT_TWIP
) ) );
912 sal_uInt16 nPos
= aLineDist
.GetSelectEntryPos();
919 aExampleWin
.SetLineSpace( (SvxPrevLineSpace
)nPos
);
922 case LLINESPACE_PROP
:
923 aExampleWin
.SetLineSpace( (SvxPrevLineSpace
)nPos
,
924 (sal_uInt16
)aLineDistAtPercentBox
.Denormalize(
925 aLineDistAtPercentBox
.GetValue() ) );
929 case LLINESPACE_DURCH
:
931 aExampleWin
.SetLineSpace( (SvxPrevLineSpace
)nPos
,
932 (sal_uInt16
)GetCoreValue( aLineDistAtMetricBox
, SFX_MAPUNIT_TWIP
) );
935 aExampleWin
.Draw( bAll
);
938 // -----------------------------------------------------------------------
940 void SvxStdParagraphTabPage::EnableRegisterMode()
946 /*-----------------16.01.97 19.54-------------------
948 --------------------------------------------------*/
949 IMPL_LINK( SvxStdParagraphTabPage
, AutoHdl_Impl
, CheckBox
*, pBox
)
951 sal_Bool bEnable
= !pBox
->IsChecked();
952 aFLineLabel
.Enable(bEnable
);
953 aFLineIndent
.Enable(bEnable
);
957 /*-----------------16.01.97 18.00-------------------
959 --------------------------------------------------*/
960 void SvxStdParagraphTabPage::SetPageWidth( sal_uInt16 nPageWidth
)
965 /*-----------------17.01.97 08.11-------------------
967 --------------------------------------------------*/
968 void SvxStdParagraphTabPage::EnableAutoFirstLine()
973 /*-----------------11.06.97 11.48-------------------
974 absoluter Zeilenabstand
975 --------------------------------------------------*/
976 void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip
)
978 aLineDist
.InsertEntry(sAbsDist
);
979 nMinFixDist
= nMinTwip
;
982 //addd CHINA001 begin
983 void SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet
)
986 /* CHINA001 different bit represent call to different method of SvxStdParagraphTabPage
987 0x0001 --->EnableRelativeMode()
988 0x0002 --->EnableRegisterMode()
989 0x0004 --->EnableAutoFirstLine()
990 0x0008 --->EnableNegativeMode()
994 SFX_ITEMSET_ARG (&aSet
,pPageWidthItem
,SfxUInt16Item
,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH
,sal_False
);
995 SFX_ITEMSET_ARG (&aSet
,pFlagSetItem
,SfxUInt32Item
,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET
,sal_False
);
996 SFX_ITEMSET_ARG (&aSet
,pLineDistItem
,SfxUInt32Item
,SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST
,sal_False
);
999 SetPageWidth(pPageWidthItem
->GetValue());
1002 if (( 0x0001 & pFlagSetItem
->GetValue())== 0x0001 )
1003 EnableRelativeMode();
1006 if (( 0x0002 & pFlagSetItem
->GetValue())== 0x0002 )
1007 EnableRegisterMode();
1010 if ( ( 0x0004 & pFlagSetItem
->GetValue())== 0x0004 )
1011 EnableAutoFirstLine();
1014 EnableAbsLineDist(pLineDistItem
->GetValue());
1017 if (( 0x0008 & pFlagSetItem
->GetValue()) == 0x0008 )
1018 EnableNegativeMode();
1023 #define LASTLINEPOS_DEFAULT 0
1024 #define LASTLINEPOS_LEFT 1
1026 #define LASTLINECOUNT_OLD 3
1027 #define LASTLINECOUNT_NEW 4
1029 // class SvxParaAlignTabPage ------------------------------------------------
1031 /*-----------------16.01.97 19.34-------------------
1033 --------------------------------------------------*/
1034 SvxParaAlignTabPage::SvxParaAlignTabPage( Window
* pParent
, const SfxItemSet
& rSet
)
1035 : SfxTabPage(pParent
, CUI_RES( RID_SVXPAGE_ALIGN_PARAGRAPH
),rSet
),
1036 aAlignFrm ( this, CUI_RES( FL_ALIGN
) ),
1037 aLeft ( this, CUI_RES( BTN_LEFTALIGN
) ),
1038 aRight ( this, CUI_RES( BTN_RIGHTALIGN
) ),
1039 aCenter ( this, CUI_RES( BTN_CENTERALIGN
) ),
1040 aJustify ( this, CUI_RES( BTN_JUSTIFYALIGN
) ),
1041 aLastLineFT ( this, CUI_RES( FT_LASTLINE
) ),
1042 aLastLineLB ( this, CUI_RES( LB_LASTLINE
) ),
1043 aExpandCB ( this, CUI_RES( CB_EXPAND
) ),
1044 aSnapToGridCB ( this, CUI_RES( CB_SNAP
) ),
1045 aExampleWin ( this, CUI_RES( WN_EXAMPLE
) ),
1047 aVertAlignFL ( this, CUI_RES( FL_VERTALIGN
) ),
1048 aVertAlignFT ( this, CUI_RES( FT_VERTALIGN
) ),
1049 aVertAlignLB ( this, CUI_RES( LB_VERTALIGN
) ),
1051 aPropertiesFL ( this, CUI_RES( FL_PROPERTIES
)),
1052 aTextDirectionFT ( this, CUI_RES( FT_TEXTDIRECTION
)),
1053 aTextDirectionLB ( this, CUI_RES( LB_TEXTDIRECTION
))
1055 SvtLanguageOptions aLangOptions
;
1056 sal_uInt16 nLastLinePos
= LASTLINEPOS_DEFAULT
;
1058 if ( aLangOptions
.IsAsianTypographyEnabled() )
1060 String
sLeft(CUI_RES(ST_LEFTALIGN_ASIAN
));
1061 aLeft
.SetText(sLeft
);
1062 aRight
.SetText(String(CUI_RES(ST_RIGHTALIGN_ASIAN
)));
1063 sLeft
= MnemonicGenerator::EraseAllMnemonicChars( sLeft
);
1065 if ( aLastLineLB
.GetEntryCount() == LASTLINECOUNT_OLD
)
1067 aLastLineLB
.RemoveEntry( 0 );
1068 aLastLineLB
.InsertEntry( sLeft
, 0 );
1071 nLastLinePos
= LASTLINEPOS_LEFT
;
1073 // remove "Default" or "Left" entry, depends on CJKOptions
1074 if ( aLastLineLB
.GetEntryCount() == LASTLINECOUNT_NEW
)
1075 aLastLineLB
.RemoveEntry( nLastLinePos
);
1078 Link aLink
= LINK( this, SvxParaAlignTabPage
, AlignHdl_Impl
);
1079 aLeft
.SetClickHdl( aLink
);
1080 aRight
.SetClickHdl( aLink
);
1081 aCenter
.SetClickHdl( aLink
);
1082 aJustify
.SetClickHdl( aLink
);
1083 aLastLineLB
.SetSelectHdl( LINK( this, SvxParaAlignTabPage
, LastLineHdl_Impl
) );
1084 aTextDirectionLB
.SetSelectHdl( LINK( this, SvxParaAlignTabPage
, TextDirectionHdl_Impl
) );
1086 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(rSet
);
1087 if(!(nHtmlMode
& HTMLMODE_ON
) || (0 != (nHtmlMode
& HTMLMODE_SOME_STYLES
)) )
1089 if( aLangOptions
.IsCTLFontEnabled() )
1091 aTextDirectionLB
.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR
), FRMDIR_HORI_LEFT_TOP
);
1092 aTextDirectionLB
.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL
), FRMDIR_HORI_RIGHT_TOP
);
1093 aTextDirectionLB
.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER
), FRMDIR_ENVIRONMENT
);
1095 aPropertiesFL
.Show();
1096 aTextDirectionFT
.Show();
1097 aTextDirectionLB
.Show();
1101 aExampleWin
.SetAccessibleName(String(CUI_RES(STR_EXAMPLE
)));
1105 /*-----------------16.01.97 19.33-------------------
1107 --------------------------------------------------*/
1108 SvxParaAlignTabPage::~SvxParaAlignTabPage()
1112 /*-----------------16.01.97 19.33-------------------
1114 --------------------------------------------------*/
1115 int SvxParaAlignTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1118 FillItemSet( *_pSet
);
1122 /*-----------------16.01.97 19.33-------------------
1124 --------------------------------------------------*/
1125 SfxTabPage
* SvxParaAlignTabPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
1127 return new SvxParaAlignTabPage(pParent
, rSet
);
1130 /*-----------------16.01.97 19.33-------------------
1132 --------------------------------------------------*/
1133 sal_uInt16
* SvxParaAlignTabPage::GetRanges()
1135 return pAlignRanges
;
1139 /*-----------------16.01.97 19.33-------------------
1141 --------------------------------------------------*/
1142 sal_Bool
SvxParaAlignTabPage::FillItemSet( SfxItemSet
& rOutSet
)
1144 sal_Bool bModified
= sal_False
;
1146 FASTBOOL bAdj
= sal_False
, bChecked
= sal_False
;
1147 SvxAdjust eAdjust
= SVX_ADJUST_LEFT
;
1149 if ( aLeft
.IsChecked() )
1151 eAdjust
= SVX_ADJUST_LEFT
;
1152 bAdj
= !aLeft
.GetSavedValue();
1153 bChecked
= sal_True
;
1155 else if ( aRight
.IsChecked() )
1157 eAdjust
= SVX_ADJUST_RIGHT
;
1158 bAdj
= !aRight
.GetSavedValue();
1159 bChecked
= sal_True
;
1161 else if ( aCenter
.IsChecked() )
1163 eAdjust
= SVX_ADJUST_CENTER
;
1164 bAdj
= !aCenter
.GetSavedValue();
1165 bChecked
= sal_True
;
1167 else if ( aJustify
.IsChecked() )
1169 eAdjust
= SVX_ADJUST_BLOCK
;
1170 bAdj
= !aJustify
.GetSavedValue() ||
1171 aExpandCB
.IsChecked() != aExpandCB
.GetSavedValue() ||
1172 aLastLineLB
.GetSelectEntryPos() != aLastLineLB
.GetSavedValue();
1173 bChecked
= sal_True
;
1175 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1179 const SvxAdjustItem
* pOld
=
1180 (const SvxAdjustItem
*)GetOldItem( rOutSet
, SID_ATTR_PARA_ADJUST
);
1181 SvxAdjust eOneWord
= aExpandCB
.IsChecked() ? SVX_ADJUST_BLOCK
1183 sal_uInt16 nLBPos
= aLastLineLB
.GetSelectEntryPos();
1184 SvxAdjust eLastBlock
= SVX_ADJUST_LEFT
;
1187 eLastBlock
= SVX_ADJUST_CENTER
;
1188 else if ( 2 == nLBPos
)
1189 eLastBlock
= SVX_ADJUST_BLOCK
;
1191 FASTBOOL bNothingWasChecked
=
1192 !aLeft
.GetSavedValue() && !aRight
.GetSavedValue() &&
1193 !aCenter
.GetSavedValue() && !aJustify
.GetSavedValue();
1195 if ( !pOld
|| pOld
->GetAdjust() != eAdjust
||
1196 pOld
->GetOneWord() != eOneWord
||
1197 pOld
->GetLastBlock() != eLastBlock
||
1198 ( bChecked
&& bNothingWasChecked
) )
1200 bModified
|= sal_True
;
1202 (const SvxAdjustItem
&)GetItemSet().Get( _nWhich
) );
1203 aAdj
.SetAdjust( eAdjust
);
1204 aAdj
.SetOneWord( eOneWord
);
1205 aAdj
.SetLastBlock( eLastBlock
);
1206 rOutSet
.Put( aAdj
);
1209 if(aSnapToGridCB
.IsChecked() != aSnapToGridCB
.GetSavedValue())
1211 rOutSet
.Put(SvxParaGridItem(aSnapToGridCB
.IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID
)));
1212 bModified
= sal_True
;
1214 if(aVertAlignLB
.GetSavedValue() != aVertAlignLB
.GetSelectEntryPos())
1216 rOutSet
.Put(SvxParaVertAlignItem(aVertAlignLB
.GetSelectEntryPos(), GetWhich( SID_PARA_VERTALIGN
)));
1217 bModified
= sal_True
;
1220 if( aTextDirectionLB
.IsVisible() )
1222 SvxFrameDirection eDir
= aTextDirectionLB
.GetSelectEntryValue();
1223 if( eDir
!= aTextDirectionLB
.GetSavedValue() )
1225 rOutSet
.Put( SvxFrameDirectionItem( eDir
, GetWhich( SID_ATTR_FRAMEDIRECTION
) ) );
1226 bModified
= sal_True
;
1233 /*-----------------16.01.97 19.33-------------------
1235 --------------------------------------------------*/
1236 void SvxParaAlignTabPage::Reset( const SfxItemSet
& rSet
)
1238 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1239 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
1241 sal_uInt16 nLBSelect
= 0;
1242 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1244 const SvxAdjustItem
& rAdj
= (const SvxAdjustItem
&)rSet
.Get( _nWhich
);
1246 switch ( rAdj
.GetAdjust() /*!!! VB fragen rAdj.GetLastBlock()*/ )
1248 case SVX_ADJUST_LEFT
: aLeft
.Check(); break;
1250 case SVX_ADJUST_RIGHT
: aRight
.Check(); break;
1252 case SVX_ADJUST_CENTER
: aCenter
.Check(); break;
1254 case SVX_ADJUST_BLOCK
: aJustify
.Check(); break;
1255 default: ; //prevent warning
1257 sal_Bool bEnable
= aJustify
.IsChecked();
1258 aLastLineFT
.Enable(bEnable
);
1259 aLastLineLB
.Enable(bEnable
);
1260 aExpandCB
.Enable(bEnable
);
1262 aExpandCB
.Check(SVX_ADJUST_BLOCK
== rAdj
.GetOneWord());
1263 switch(rAdj
.GetLastBlock())
1265 case SVX_ADJUST_LEFT
: nLBSelect
= 0; break;
1267 case SVX_ADJUST_CENTER
: nLBSelect
= 1; break;
1269 case SVX_ADJUST_BLOCK
: nLBSelect
= 2; break;
1270 default: ; //prevent warning
1275 aLeft
.Check( sal_False
);
1276 aRight
.Check( sal_False
);
1277 aCenter
.Check( sal_False
);
1278 aJustify
.Check( sal_False
);
1280 aLastLineLB
.SelectEntryPos(nLBSelect
);
1282 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(rSet
);
1283 if(nHtmlMode
& HTMLMODE_ON
)
1288 if(!(nHtmlMode
& (HTMLMODE_FULL_STYLES
|HTMLMODE_FIRSTLINE
)) )
1290 aSnapToGridCB
.Show(sal_False
);
1292 _nWhich
= GetWhich(SID_ATTR_PARA_SNAPTOGRID
);
1293 eItemState
= rSet
.GetItemState( _nWhich
);
1294 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1296 const SvxParaGridItem
& rSnap
= (const SvxParaGridItem
&)rSet
.Get( _nWhich
);
1297 aSnapToGridCB
.Check(rSnap
.GetValue());
1300 _nWhich
= GetWhich( SID_PARA_VERTALIGN
);
1301 eItemState
= rSet
.GetItemState( _nWhich
);
1303 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1305 aVertAlignLB
.Show();
1306 aVertAlignFL
.Show();
1307 aVertAlignFT
.Show();
1309 const SvxParaVertAlignItem
& rAlign
= (const SvxParaVertAlignItem
&)rSet
.Get( _nWhich
);
1310 aVertAlignLB
.SelectEntryPos(rAlign
.GetValue());
1313 _nWhich
= GetWhich( SID_ATTR_FRAMEDIRECTION
);
1315 if( SFX_ITEM_AVAILABLE
<= rSet
.GetItemState( _nWhich
) )
1317 const SvxFrameDirectionItem
& rFrameDirItem
= ( const SvxFrameDirectionItem
& ) rSet
.Get( _nWhich
);
1318 aTextDirectionLB
.SelectEntryValue( (SvxFrameDirection
)rFrameDirItem
.GetValue() );
1319 aTextDirectionLB
.SaveValue();
1322 aSnapToGridCB
.SaveValue();
1323 aVertAlignLB
.SaveValue();
1326 aCenter
.SaveValue();
1327 aJustify
.SaveValue();
1328 aLastLineLB
.SaveValue();
1329 aExpandCB
.SaveValue();
1331 UpdateExample_Impl(sal_True
);
1334 /*-----------------17.01.97 08.06-------------------
1336 --------------------------------------------------*/
1337 IMPL_LINK( SvxParaAlignTabPage
, AlignHdl_Impl
, RadioButton
*, EMPTYARG
)
1339 sal_Bool bJustify
= aJustify
.IsChecked();
1340 aLastLineFT
.Enable(bJustify
);
1341 aLastLineLB
.Enable(bJustify
);
1342 aExpandCB
.Enable(bJustify
);
1343 UpdateExample_Impl(sal_False
);
1347 IMPL_LINK( SvxParaAlignTabPage
, LastLineHdl_Impl
, ListBox
*, EMPTYARG
)
1349 UpdateExample_Impl(sal_False
);
1353 IMPL_LINK( SvxParaAlignTabPage
, TextDirectionHdl_Impl
, ListBox
*, EMPTYARG
)
1355 SvxFrameDirection eDir
= aTextDirectionLB
.GetSelectEntryValue();
1358 // check the default alignment for this text direction
1359 case FRMDIR_HORI_LEFT_TOP
: aLeft
.Check( sal_True
); break;
1360 case FRMDIR_HORI_RIGHT_TOP
: aRight
.Check( sal_True
); break;
1361 case FRMDIR_ENVIRONMENT
: /* do nothing */ break;
1364 DBG_ERRORFILE( "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" );
1371 /*-----------------16.01.97 19.34-------------------
1373 --------------------------------------------------*/
1374 void SvxParaAlignTabPage::UpdateExample_Impl( sal_Bool bAll
)
1376 if ( aLeft
.IsChecked() )
1377 aExampleWin
.SetAdjust( SVX_ADJUST_LEFT
);
1378 else if ( aRight
.IsChecked() )
1379 aExampleWin
.SetAdjust( SVX_ADJUST_RIGHT
);
1380 else if ( aCenter
.IsChecked() )
1381 aExampleWin
.SetAdjust( SVX_ADJUST_CENTER
);
1382 else if ( aJustify
.IsChecked() )
1384 aExampleWin
.SetAdjust( SVX_ADJUST_BLOCK
);
1385 SvxAdjust eLastBlock
= SVX_ADJUST_LEFT
;
1386 sal_uInt16 nLBPos
= aLastLineLB
.GetSelectEntryPos();
1388 eLastBlock
= SVX_ADJUST_CENTER
;
1389 else if(nLBPos
== 2)
1390 eLastBlock
= SVX_ADJUST_BLOCK
;
1391 aExampleWin
.SetLastLine( eLastBlock
);
1394 aExampleWin
.Draw( bAll
);
1396 /*-----------------17.01.97 08.04-------------------
1397 Erweiterungen fuer den Blocksatz einschalten
1398 --------------------------------------------------*/
1399 void SvxParaAlignTabPage::EnableJustifyExt()
1404 SvtLanguageOptions aCJKOptions
;
1405 if(aCJKOptions
.IsAsianTypographyEnabled())
1406 aSnapToGridCB
.Show();
1409 //add CHINA001 begin
1410 void SvxParaAlignTabPage::PageCreated (SfxAllItemSet aSet
)
1412 SFX_ITEMSET_ARG (&aSet
,pBoolItem
,SfxBoolItem
,SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT
,sal_False
);
1414 if(pBoolItem
->GetValue())
1418 // class SvxExtParagraphTabPage ------------------------------------------
1420 SfxTabPage
* SvxExtParagraphTabPage::Create( Window
* pParent
,
1421 const SfxItemSet
& rSet
)
1423 return new SvxExtParagraphTabPage( pParent
, rSet
);
1426 // -----------------------------------------------------------------------
1428 sal_Bool
SvxExtParagraphTabPage::FillItemSet( SfxItemSet
& rOutSet
)
1430 sal_Bool bModified
= sal_False
;
1431 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1432 const TriState eHyphenState
= aHyphenBox
.GetState();
1433 const SfxPoolItem
* pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_HYPHENZONE
);
1435 if ( eHyphenState
!= aHyphenBox
.GetSavedValue() ||
1436 aExtHyphenBeforeBox
.IsValueModified() ||
1437 aExtHyphenAfterBox
.IsValueModified() ||
1438 aMaxHyphenEdit
.IsValueModified() )
1440 SvxHyphenZoneItem
aHyphen(
1441 (const SvxHyphenZoneItem
&)GetItemSet().Get( _nWhich
) );
1442 aHyphen
.SetHyphen( eHyphenState
== STATE_CHECK
);
1444 if ( eHyphenState
== STATE_CHECK
)
1446 aHyphen
.GetMinLead() = (sal_uInt8
)aExtHyphenBeforeBox
.GetValue();
1447 aHyphen
.GetMinTrail() = (sal_uInt8
)aExtHyphenAfterBox
.GetValue();
1449 aHyphen
.GetMaxHyphens() = (sal_uInt8
)aMaxHyphenEdit
.GetValue();
1452 !( *(SvxHyphenZoneItem
*)pOld
== aHyphen
) ||
1453 eHyphenState
!= aHyphenBox
.GetSavedValue())
1455 rOutSet
.Put( aHyphen
);
1456 bModified
|= sal_True
;
1460 if (aPagenumEdit
.IsEnabled() && aPagenumEdit
.IsValueModified())
1462 SfxUInt16Item
aPageNum( SID_ATTR_PARA_PAGENUM
,
1463 (sal_uInt16
)aPagenumEdit
.GetValue() );
1465 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_PAGENUM
);
1467 if ( !pOld
|| ( (const SfxUInt16Item
*)pOld
)->GetValue() != aPageNum
.GetValue() )
1469 rOutSet
.Put( aPageNum
);
1470 bModified
|= sal_True
;
1476 TriState eState
= aApplyCollBtn
.GetState();
1477 FASTBOOL bIsPageModel
= sal_False
;
1479 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1481 if ( eState
!= aApplyCollBtn
.GetSavedValue() ||
1482 ( STATE_CHECK
== eState
&&
1483 aApplyCollBox
.GetSelectEntryPos() != aApplyCollBox
.GetSavedValue() ) )
1485 if ( eState
== STATE_CHECK
)
1487 sPage
= aApplyCollBox
.GetSelectEntry();
1488 bIsPageModel
= 0 != sPage
.Len();
1490 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_MODEL
);
1492 if ( !pOld
|| ( (const SvxPageModelItem
*)pOld
)->GetValue() != sPage
)
1494 rOutSet
.Put( SvxPageModelItem( sPage
, sal_False
, _nWhich
) );
1495 bModified
|= sal_True
;
1498 bIsPageModel
= sal_False
;
1500 else if(STATE_CHECK
== eState
&& aApplyCollBtn
.IsEnabled())
1501 bIsPageModel
= sal_True
;
1503 rOutSet
.Put( SvxPageModelItem( sPage
, sal_False
, _nWhich
) );
1505 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1508 // wird PageModel eingeschaltet, dann immer PageBreak ausschalten
1509 rOutSet
.Put( SvxFmtBreakItem( SVX_BREAK_NONE
, _nWhich
) );
1512 eState
= aPageBreakBox
.GetState();
1513 SfxItemState eModelState
= GetItemSet().GetItemState(SID_ATTR_PARA_MODEL
, sal_False
);
1515 if ( (eModelState
== SFX_ITEM_SET
&& STATE_CHECK
== aPageBreakBox
.GetState()) ||
1516 eState
!= aPageBreakBox
.GetSavedValue() ||
1517 aBreakTypeLB
.GetSelectEntryPos() != aBreakTypeLB
.GetSavedValue() ||
1518 aBreakPositionLB
.GetSelectEntryPos() != aBreakPositionLB
.GetSavedValue() )
1520 const SvxFmtBreakItem
rOldBreak(
1521 (const SvxFmtBreakItem
&)GetItemSet().Get( _nWhich
));
1522 SvxFmtBreakItem
aBreak(rOldBreak
.GetBreak(), rOldBreak
.Which());
1528 sal_Bool bBefore
= aBreakPositionLB
.GetSelectEntryPos() == 0;
1530 if ( aBreakTypeLB
.GetSelectEntryPos() == 0 )
1533 aBreak
.SetValue( SVX_BREAK_PAGE_BEFORE
);
1535 aBreak
.SetValue( SVX_BREAK_PAGE_AFTER
);
1540 aBreak
.SetValue( SVX_BREAK_COLUMN_BEFORE
);
1542 aBreak
.SetValue( SVX_BREAK_COLUMN_AFTER
);
1548 aBreak
.SetValue( SVX_BREAK_NONE
);
1550 default: ; //prevent warning
1552 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_PAGEBREAK
);
1554 if ( eState
!= aPageBreakBox
.GetSavedValue() ||
1555 !pOld
|| !( *(const SvxFmtBreakItem
*)pOld
== aBreak
) )
1557 bModified
|= sal_True
;
1558 rOutSet
.Put( aBreak
);
1565 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1566 eState
= aKeepTogetherBox
.GetState();
1568 if ( eState
!= aKeepTogetherBox
.GetSavedValue() )
1570 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_SPLIT
);
1572 if ( !pOld
|| ( (const SvxFmtSplitItem
*)pOld
)->GetValue() !=
1573 ( eState
== STATE_NOCHECK
) )
1575 rOutSet
.Put( SvxFmtSplitItem( eState
== STATE_NOCHECK
, _nWhich
) );
1576 bModified
|= sal_True
;
1580 // Absaetze zusammenhalten
1581 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1582 eState
= aKeepParaBox
.GetState();
1584 if ( eState
!= aKeepParaBox
.GetSavedValue() )
1586 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_KEEP
);
1588 // hat sich der Status geaendert, muss immer geputtet werden
1589 rOutSet
.Put( SvxFmtKeepItem( eState
== STATE_CHECK
, _nWhich
) );
1590 bModified
|= sal_True
;
1593 // Witwen und Waisen
1594 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1595 eState
= aWidowBox
.GetState();
1597 if ( eState
!= aWidowBox
.GetSavedValue() ||
1598 aWidowRowNo
.IsValueModified() )
1600 SvxWidowsItem
rItem( eState
== STATE_CHECK
?
1601 (sal_uInt8
)aWidowRowNo
.GetValue() : 0, _nWhich
);
1602 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_WIDOWS
);
1604 if ( eState
!= aWidowBox
.GetSavedValue() || !pOld
|| !( *(const SvxWidowsItem
*)pOld
== rItem
) )
1606 rOutSet
.Put( rItem
);
1607 bModified
|= sal_True
;
1611 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1612 eState
= aOrphanBox
.GetState();
1614 if ( eState
!= aOrphanBox
.GetSavedValue() ||
1615 aOrphanRowNo
.IsValueModified() )
1617 SvxOrphansItem
rItem( eState
== STATE_CHECK
?
1618 (sal_uInt8
)aOrphanRowNo
.GetValue() : 0, _nWhich
);
1619 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_ORPHANS
);
1621 if ( eState
!= aOrphanBox
.GetSavedValue() ||
1623 !( *(const SvxOrphansItem
*)pOld
== rItem
) )
1625 rOutSet
.Put( rItem
);
1626 bModified
|= sal_True
;
1633 // -----------------------------------------------------------------------
1635 void SvxExtParagraphTabPage::Reset( const SfxItemSet
& rSet
)
1637 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1638 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
1640 sal_Bool bItemAvailable
= eItemState
>= SFX_ITEM_AVAILABLE
;
1641 sal_Bool bIsHyphen
= sal_False
;
1642 if( !bHtmlMode
&& bItemAvailable
)
1644 const SvxHyphenZoneItem
& rHyphen
=
1645 (const SvxHyphenZoneItem
&)rSet
.Get( _nWhich
);
1646 aHyphenBox
.EnableTriState( sal_False
);
1648 bIsHyphen
= rHyphen
.IsHyphen();
1649 aHyphenBox
.SetState( bIsHyphen
? STATE_CHECK
: STATE_NOCHECK
);
1651 aExtHyphenBeforeBox
.SetValue( rHyphen
.GetMinLead() );
1652 aExtHyphenAfterBox
.SetValue( rHyphen
.GetMinTrail() );
1653 aMaxHyphenEdit
.SetValue( rHyphen
.GetMaxHyphens() );
1657 aHyphenBox
.SetState( STATE_DONTKNOW
);
1659 sal_Bool bEnable
= bItemAvailable
&& bIsHyphen
;
1660 aExtHyphenBeforeBox
.Enable(bEnable
);
1661 aExtHyphenAfterBox
.Enable(bEnable
);
1662 aBeforeText
.Enable(bEnable
);
1663 aAfterText
.Enable(bEnable
);
1664 aMaxHyphenLabel
.Enable(bEnable
);
1665 aMaxHyphenEdit
.Enable(bEnable
);
1667 _nWhich
= GetWhich( SID_ATTR_PARA_PAGENUM
);
1669 if ( rSet
.GetItemState(_nWhich
) >= SFX_ITEM_AVAILABLE
)
1671 const sal_uInt16 nPageNum
=
1672 ( (const SfxUInt16Item
&)rSet
.Get( _nWhich
) ).GetValue();
1673 aPagenumEdit
.SetValue( nPageNum
);
1678 // zuerst PageModel behandeln
1679 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1680 sal_Bool bIsPageModel
= sal_False
;
1681 eItemState
= rSet
.GetItemState( _nWhich
);
1683 if ( eItemState
>= SFX_ITEM_SET
)
1685 aApplyCollBtn
.EnableTriState( sal_False
);
1687 const SvxPageModelItem
& rModel
=
1688 (const SvxPageModelItem
&)rSet
.Get( _nWhich
);
1689 String
aStr( rModel
.GetValue() );
1692 aApplyCollBox
.GetEntryPos( aStr
) != LISTBOX_ENTRY_NOTFOUND
)
1694 aApplyCollBox
.SelectEntry( aStr
);
1695 aApplyCollBtn
.SetState( STATE_CHECK
);
1696 bIsPageModel
= sal_True
;
1698 aPageBreakBox
.Enable();
1699 aPageBreakBox
.EnableTriState( sal_False
);
1700 aBreakTypeFT
.Enable();
1701 aBreakTypeLB
.Enable();
1702 aBreakPositionFT
.Enable();
1703 aBreakPositionLB
.Enable();
1704 aApplyCollBtn
.Enable();
1705 aPageBreakBox
.SetState( STATE_CHECK
);
1708 aBreakTypeLB
.SelectEntryPos(0);
1709 //select break before
1710 aBreakPositionLB
.SelectEntryPos(0);
1714 aApplyCollBox
.SetNoSelection();
1715 aApplyCollBtn
.SetState( STATE_NOCHECK
);
1718 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1720 aApplyCollBtn
.EnableTriState( sal_True
);
1721 aApplyCollBtn
.SetState( STATE_DONTKNOW
);
1722 aApplyCollBox
.SetNoSelection();
1726 aApplyCollBtn
.Enable(sal_False
);
1727 aApplyCollBox
.Enable(sal_False
);
1728 aPagenumEdit
.Enable(sal_False
);
1729 aPagenumText
.Enable(sal_False
);
1731 //!!! ApplyCollClickHdl_Impl( &aApplyCollBtn );
1733 if ( !bIsPageModel
)
1735 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1736 eItemState
= rSet
.GetItemState( _nWhich
);
1738 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1740 const SvxFmtBreakItem
& rPageBreak
=
1741 (const SvxFmtBreakItem
&)rSet
.Get( _nWhich
);
1743 SvxBreak eBreak
= (SvxBreak
)rPageBreak
.GetValue();
1745 // PageBreak nicht ueber CTRL-RETURN,
1746 // dann kann CheckBox frei gegeben werden
1747 aPageBreakBox
.Enable();
1748 aPageBreakBox
.EnableTriState( sal_False
);
1749 aBreakTypeFT
.Enable();
1750 aBreakTypeLB
.Enable();
1751 aBreakPositionFT
.Enable();
1752 aBreakPositionLB
.Enable();
1754 aPageBreakBox
.SetState( STATE_CHECK
);
1756 sal_Bool _bEnable
= eBreak
!= SVX_BREAK_NONE
&&
1757 eBreak
!= SVX_BREAK_COLUMN_BEFORE
&&
1758 eBreak
!= SVX_BREAK_COLUMN_AFTER
;
1759 aApplyCollBtn
.Enable(_bEnable
);
1762 aApplyCollBox
.Enable(_bEnable
);
1763 aPagenumEdit
.Enable(_bEnable
);
1766 if ( eBreak
== SVX_BREAK_NONE
)
1767 aPageBreakBox
.SetState( STATE_NOCHECK
);
1769 sal_uInt16 nType
= 0; // selection position in break type ListBox : Page
1770 sal_uInt16 nPosition
= 0; // selection position in break position ListBox : Before
1773 case SVX_BREAK_PAGE_BEFORE
:
1775 case SVX_BREAK_PAGE_AFTER
:
1778 case SVX_BREAK_COLUMN_BEFORE
:
1781 case SVX_BREAK_COLUMN_AFTER
:
1785 default: ;//prevent warning
1787 aBreakTypeLB
.SelectEntryPos(nType
);
1788 aBreakPositionLB
.SelectEntryPos(nPosition
);
1790 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1791 aPageBreakBox
.SetState( STATE_DONTKNOW
);
1794 aPageBreakBox
.Enable(sal_False
);
1795 aBreakTypeFT
.Enable(sal_False
);
1796 aBreakTypeLB
.Enable(sal_False
);
1797 aBreakPositionFT
.Enable(sal_False
);
1798 aBreakPositionLB
.Enable(sal_False
);
1802 PageBreakPosHdl_Impl( &aBreakPositionLB
);
1803 PageBreakHdl_Impl( &aPageBreakBox
);
1806 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1807 eItemState
= rSet
.GetItemState( _nWhich
);
1809 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1811 aKeepParaBox
.EnableTriState( sal_False
);
1812 const SvxFmtKeepItem
& rKeep
=
1813 (const SvxFmtKeepItem
&)rSet
.Get( _nWhich
);
1815 if ( rKeep
.GetValue() )
1816 aKeepParaBox
.SetState( STATE_CHECK
);
1818 aKeepParaBox
.SetState( STATE_NOCHECK
);
1820 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1821 aKeepParaBox
.SetState( STATE_DONTKNOW
);
1823 aKeepParaBox
.Enable(sal_False
);
1825 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1826 eItemState
= rSet
.GetItemState( _nWhich
);
1828 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1830 const SvxFmtSplitItem
& rSplit
=
1831 (const SvxFmtSplitItem
&)rSet
.Get( _nWhich
);
1832 aKeepTogetherBox
.EnableTriState( sal_False
);
1834 if ( !rSplit
.GetValue() )
1835 aKeepTogetherBox
.SetState( STATE_CHECK
);
1838 aKeepTogetherBox
.SetState( STATE_NOCHECK
);
1840 // Witwen und Waisen
1842 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1843 SfxItemState eTmpState
= rSet
.GetItemState( _nWhich
);
1845 if ( eTmpState
>= SFX_ITEM_AVAILABLE
)
1847 const SvxWidowsItem
& rWidow
=
1848 (const SvxWidowsItem
&)rSet
.Get( _nWhich
);
1849 aWidowBox
.EnableTriState( sal_False
);
1850 const sal_uInt16 nLines
= rWidow
.GetValue();
1852 sal_Bool _bEnable
= nLines
> 0;
1853 aWidowRowNo
.SetValue( aWidowRowNo
.Normalize( nLines
) );
1854 aWidowBox
.SetState( _bEnable
? STATE_CHECK
: STATE_NOCHECK
);
1855 aWidowRowNo
.Enable(_bEnable
);
1856 aWidowRowLabel
.Enable(_bEnable
);
1859 else if ( SFX_ITEM_DONTCARE
== eTmpState
)
1860 aWidowBox
.SetState( STATE_DONTKNOW
);
1862 aWidowBox
.Enable(sal_False
);
1864 aOrphanBox
.Enable();
1865 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1866 eTmpState
= rSet
.GetItemState( _nWhich
);
1868 if ( eTmpState
>= SFX_ITEM_AVAILABLE
)
1870 const SvxOrphansItem
& rOrphan
=
1871 (const SvxOrphansItem
&)rSet
.Get( _nWhich
);
1872 const sal_uInt16 nLines
= rOrphan
.GetValue();
1873 aOrphanBox
.EnableTriState( sal_False
);
1875 sal_Bool _bEnable
= nLines
> 0;
1876 aOrphanBox
.SetState( _bEnable
? STATE_CHECK
: STATE_NOCHECK
);
1877 aOrphanRowNo
.SetValue( aOrphanRowNo
.Normalize( nLines
) );
1878 aOrphanRowNo
.Enable(_bEnable
);
1879 aOrphanRowLabel
.Enable(_bEnable
);
1882 else if ( SFX_ITEM_DONTCARE
== eTmpState
)
1883 aOrphanBox
.SetState( STATE_DONTKNOW
);
1885 aOrphanBox
.Enable(sal_False
);
1888 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1889 aKeepTogetherBox
.SetState( STATE_DONTKNOW
);
1891 aKeepTogetherBox
.Enable(sal_False
);
1893 // damit alles richt enabled wird
1894 KeepTogetherHdl_Impl( 0 );
1896 OrphanHdl_Impl( 0 );
1898 aHyphenBox
.SaveValue();
1899 aExtHyphenBeforeBox
.SaveValue();
1900 aExtHyphenAfterBox
.SaveValue();
1901 aMaxHyphenEdit
.SaveValue();
1902 aPageBreakBox
.SaveValue();
1903 aBreakPositionLB
.SaveValue();
1904 aBreakTypeLB
.SaveValue();
1905 aApplyCollBtn
.SaveValue();
1906 aApplyCollBox
.SaveValue();
1907 aPagenumEdit
.SaveValue();
1908 aKeepTogetherBox
.SaveValue();
1909 aKeepParaBox
.SaveValue();
1910 aWidowBox
.SaveValue();
1911 aOrphanBox
.SaveValue();
1914 // -----------------------------------------------------------------------
1916 int SvxExtParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1919 FillItemSet( *_pSet
);
1923 // -----------------------------------------------------------------------
1925 void SvxExtParagraphTabPage::DisablePageBreak()
1927 bPageBreak
= sal_False
;
1928 aPageBreakBox
.Enable(sal_False
);
1929 aBreakTypeLB
.RemoveEntry(0);
1930 aBreakPositionFT
.Enable(sal_False
);
1931 aBreakPositionLB
.Enable(sal_False
);
1932 aApplyCollBtn
.Enable(sal_False
);
1933 aApplyCollBox
.Enable(sal_False
);
1934 aPagenumEdit
.Enable(sal_False
);
1937 // -----------------------------------------------------------------------
1939 SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window
* pParent
, const SfxItemSet
& rAttr
) :
1941 SfxTabPage( pParent
, CUI_RES( RID_SVXPAGE_EXT_PARAGRAPH
), rAttr
),
1943 aExtFL ( this, CUI_RES( FL_HYPHEN
) ),
1944 aHyphenBox ( this, CUI_RES( BTN_HYPHEN
) ),
1945 aBeforeText ( this, CUI_RES( FT_HYPHENBEFORE
) ),
1946 aExtHyphenBeforeBox ( this, CUI_RES( ED_HYPHENBEFORE
) ),
1947 aAfterText ( this, CUI_RES( FT_HYPHENAFTER
) ),
1948 aExtHyphenAfterBox ( this, CUI_RES( ED_HYPHENAFTER
) ),
1949 aMaxHyphenLabel ( this, CUI_RES( FT_MAXHYPH
) ),
1950 aMaxHyphenEdit ( this, CUI_RES( ED_MAXHYPH
) ),
1951 aBreaksFL ( this, CUI_RES( FL_BREAKS
) ),
1952 aPageBreakBox ( this, CUI_RES( BTN_PAGEBREAK
) ),
1953 aBreakTypeFT ( this, CUI_RES( FT_BREAKTYPE
)),
1954 aBreakTypeLB ( this, CUI_RES( LB_BREAKTYPE
)),
1955 aBreakPositionFT ( this, CUI_RES( FT_BREAKPOSITION
)),
1956 aBreakPositionLB ( this, CUI_RES( LB_BREAKPOSITION
)),
1957 // aPageBox ( this, CUI_RES( BTN_BREAKPAGE ) ),
1958 // aColumnBox ( this, CUI_RES( BTN_BREAKCOLUMN ) ),
1959 // aBeforeBox ( this, CUI_RES( BTN_PAGEBREAKBEFORE ) ),
1960 // aAfterBox ( this, CUI_RES( BTN_PAGEBREAKAFTER ) ),
1961 aApplyCollBtn ( this, CUI_RES( BTN_PAGECOLL
) ),
1962 aApplyCollBox ( this, CUI_RES( LB_PAGECOLL
) ),
1963 aPagenumText ( this, CUI_RES( FT_PAGENUM
) ),
1964 aPagenumEdit ( this, CUI_RES( ED_PAGENUM
) ),
1965 aExtendFL ( this, CUI_RES( FL_OPTIONS
) ),
1966 aKeepTogetherBox ( this, CUI_RES( BTN_KEEPTOGETHER
) ),
1967 aKeepParaBox ( this, CUI_RES( CB_KEEPTOGETHER
) ),
1968 aOrphanBox ( this, CUI_RES( BTN_ORPHANS
) ),
1969 aOrphanRowNo ( this, CUI_RES( ED_ORPHANS
) ),
1970 aOrphanRowLabel ( this, CUI_RES( FT_ORPHANS
) ),
1971 aWidowBox ( this, CUI_RES( BTN_WIDOWS
) ),
1972 aWidowRowNo ( this, CUI_RES( ED_WIDOWS
) ),
1973 aWidowRowLabel ( this, CUI_RES( FT_WIDOWS
) ),
1974 bPageBreak ( sal_True
),
1975 bHtmlMode ( sal_False
),
1980 aApplyCollBox
.SetAccessibleRelationLabeledBy(&aApplyCollBtn
);
1981 aApplyCollBox
.SetAccessibleName(String(CUI_RES(STR_PAGE_STYLE
)));
1982 aOrphanRowNo
.SetAccessibleRelationLabeledBy(&aOrphanBox
);
1983 aWidowRowNo
.SetAccessibleRelationLabeledBy(&aWidowBox
);
1985 // diese Page braucht ExchangeSupport
1986 SetExchangeSupport();
1988 aHyphenBox
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, HyphenClickHdl_Impl
) );
1989 aPageBreakBox
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakHdl_Impl
) );
1990 aKeepTogetherBox
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
) );
1991 aWidowBox
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, WidowHdl_Impl
) );
1992 aOrphanBox
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, OrphanHdl_Impl
) );
1993 aApplyCollBtn
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
) );
1994 aBreakTypeLB
.SetSelectHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
) );
1995 aBreakPositionLB
.SetSelectHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
) );
1997 SfxObjectShell
* pSh
= SfxObjectShell::Current();
2000 SfxStyleSheetBasePool
* pPool
= pSh
->GetStyleSheetPool();
2001 pPool
->SetSearchMask( SFX_STYLE_FAMILY_PAGE
);
2002 SfxStyleSheetBase
* pStyle
= pPool
->First();
2007 if ( aStdName
.Len() == 0 )
2008 // first style == standard style
2009 aStdName
= pStyle
->GetName();
2010 aApplyCollBox
.InsertEntry( pStyle
->GetName() );
2011 pStyle
= pPool
->Next();
2013 nStdPos
= aApplyCollBox
.GetEntryPos( aStdName
);
2016 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl( rAttr
);
2017 if ( nHtmlMode
& HTMLMODE_ON
)
2019 bHtmlMode
= sal_True
;
2020 aHyphenBox
.Enable(sal_False
);
2021 aBeforeText
.Enable(sal_False
);
2022 aExtHyphenBeforeBox
.Enable(sal_False
);
2023 aAfterText
.Enable(sal_False
);
2024 aExtHyphenAfterBox
.Enable(sal_False
);
2025 aMaxHyphenLabel
.Enable(sal_False
);
2026 aMaxHyphenEdit
.Enable(sal_False
);
2027 aExtFL
.Enable(sal_False
);
2028 aPagenumText
.Enable(sal_False
);
2029 aPagenumEdit
.Enable(sal_False
);
2030 // no column break in HTML
2031 aBreakTypeLB
.RemoveEntry(1);
2035 // -----------------------------------------------------------------------
2037 __EXPORT
SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
2041 // -----------------------------------------------------------------------
2043 sal_uInt16
* SvxExtParagraphTabPage::GetRanges()
2048 // -----------------------------------------------------------------------
2050 IMPL_LINK( SvxExtParagraphTabPage
, PageBreakHdl_Impl
, TriStateBox
*, EMPTYARG
)
2052 switch ( aPageBreakBox
.GetState() )
2055 aBreakTypeFT
.Enable();
2056 aBreakTypeLB
.Enable();
2057 aBreakPositionFT
.Enable();
2058 aBreakPositionLB
.Enable();
2060 if ( 0 == aBreakTypeLB
.GetSelectEntryPos()&&
2061 0 == aBreakPositionLB
.GetSelectEntryPos() )
2063 aApplyCollBtn
.Enable();
2065 sal_Bool bEnable
= STATE_CHECK
== aApplyCollBtn
.GetState() &&
2066 aApplyCollBox
.GetEntryCount();
2067 aApplyCollBox
.Enable(bEnable
);
2070 aPagenumText
.Enable(bEnable
);
2071 aPagenumEdit
.Enable(bEnable
);
2077 case STATE_DONTKNOW
:
2078 aApplyCollBtn
.SetState( STATE_NOCHECK
);
2079 aApplyCollBtn
.Enable(sal_False
);
2080 aApplyCollBox
.Enable(sal_False
);
2081 aPagenumText
.Enable(sal_False
);
2082 aPagenumEdit
.Enable(sal_False
);
2083 aBreakTypeFT
.Enable(sal_False
);
2084 aBreakTypeLB
.Enable(sal_False
);
2085 aBreakPositionFT
.Enable(sal_False
);
2086 aBreakPositionLB
.Enable(sal_False
);
2092 // -----------------------------------------------------------------------
2094 IMPL_LINK( SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
, TriStateBox
*, EMPTYARG
)
2096 sal_Bool bEnable
= aKeepTogetherBox
.GetState() == STATE_NOCHECK
;
2097 aWidowBox
.Enable(bEnable
);
2098 aOrphanBox
.Enable(bEnable
);
2103 // -----------------------------------------------------------------------
2105 IMPL_LINK( SvxExtParagraphTabPage
, WidowHdl_Impl
, TriStateBox
*, EMPTYARG
)
2107 switch ( aWidowBox
.GetState() )
2110 aWidowRowNo
.Enable();
2111 aWidowRowLabel
.Enable();
2112 aKeepTogetherBox
.Enable(sal_False
);
2116 if ( aOrphanBox
.GetState() == STATE_NOCHECK
)
2117 aKeepTogetherBox
.Enable();
2120 case STATE_DONTKNOW
:
2121 aWidowRowNo
.Enable(sal_False
);
2122 aWidowRowLabel
.Enable(sal_False
);
2128 // -----------------------------------------------------------------------
2130 IMPL_LINK( SvxExtParagraphTabPage
, OrphanHdl_Impl
, TriStateBox
*, EMPTYARG
)
2132 switch( aOrphanBox
.GetState() )
2135 aOrphanRowNo
.Enable();
2136 aOrphanRowLabel
.Enable();
2137 aKeepTogetherBox
.Enable(sal_False
);
2141 if ( aWidowBox
.GetState() == STATE_NOCHECK
)
2142 aKeepTogetherBox
.Enable();
2145 case STATE_DONTKNOW
:
2146 aOrphanRowNo
.Enable(sal_False
);
2147 aOrphanRowLabel
.Enable(sal_False
);
2153 // -----------------------------------------------------------------------
2155 IMPL_LINK( SvxExtParagraphTabPage
, HyphenClickHdl_Impl
, TriStateBox
*, EMPTYARG
)
2158 sal_Bool bEnable
= aHyphenBox
.GetState() == STATE_CHECK
;
2159 aBeforeText
.Enable(bEnable
);
2160 aExtHyphenBeforeBox
.Enable(bEnable
);
2161 aAfterText
.Enable(bEnable
);
2162 aExtHyphenAfterBox
.Enable(bEnable
);
2163 aMaxHyphenLabel
.Enable(bEnable
);
2164 aMaxHyphenEdit
.Enable(bEnable
);
2165 aHyphenBox
.SetState( bEnable
? STATE_CHECK
: STATE_NOCHECK
);
2170 // -----------------------------------------------------------------------
2172 IMPL_LINK( SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
, TriStateBox
*, EMPTYARG
)
2174 sal_Bool bEnable
= sal_False
;
2175 if ( aApplyCollBtn
.GetState() == STATE_CHECK
&&
2176 aApplyCollBox
.GetEntryCount() )
2179 aApplyCollBox
.SelectEntryPos( nStdPos
);
2183 aApplyCollBox
.SetNoSelection();
2185 aApplyCollBox
.Enable(bEnable
);
2188 aPagenumText
.Enable(bEnable
);
2189 aPagenumEdit
.Enable(bEnable
);
2194 // -----------------------------------------------------------------------
2196 IMPL_LINK( SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
, ListBox
*, pListBox
)
2198 if ( 0 == pListBox
->GetSelectEntryPos() )
2200 aApplyCollBtn
.Enable();
2202 sal_Bool bEnable
= aApplyCollBtn
.GetState() == STATE_CHECK
&&
2203 aApplyCollBox
.GetEntryCount();
2205 aApplyCollBox
.Enable(bEnable
);
2208 aPagenumText
.Enable(bEnable
);
2209 aPagenumEdit
.Enable(bEnable
);
2212 else if ( 1 == pListBox
->GetSelectEntryPos() )
2214 aApplyCollBtn
.SetState( STATE_NOCHECK
);
2215 aApplyCollBtn
.Enable(sal_False
);
2216 aApplyCollBox
.Enable(sal_False
);
2217 aPagenumText
.Enable(sal_False
);
2218 aPagenumEdit
.Enable(sal_False
);
2223 // -----------------------------------------------------------------------
2225 IMPL_LINK( SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
, ListBox
*, pListBox
)
2227 //column break or break break after
2228 sal_uInt16 nBreakPos
= aBreakPositionLB
.GetSelectEntryPos();
2229 if ( pListBox
->GetSelectEntryPos() == 1 || 1 == nBreakPos
)
2231 aApplyCollBtn
.SetState( STATE_NOCHECK
);
2232 aApplyCollBtn
.Enable(sal_False
);
2233 aApplyCollBox
.Enable(sal_False
);
2234 aPagenumText
.Enable(sal_False
);
2235 aPagenumEdit
.Enable(sal_False
);
2238 PageBreakPosHdl_Impl( &aBreakPositionLB
);
2241 //Add CHINA001 begin
2242 void SvxExtParagraphTabPage::PageCreated(SfxAllItemSet aSet
)
2246 SFX_ITEMSET_ARG (&aSet
,pDisablePageBreakItem
,SfxBoolItem
,SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK
,sal_False
);
2248 if (pDisablePageBreakItem
)
2249 if ( pDisablePageBreakItem
->GetValue())
2254 //end of Add CHINA001
2255 /*-- 29.11.00 11:36:24---------------------------------------------------
2257 -----------------------------------------------------------------------*/
2258 SvxAsianTabPage::SvxAsianTabPage( Window
* pParent
, const SfxItemSet
& rSet
) :
2259 SfxTabPage(pParent
, CUI_RES( RID_SVXPAGE_PARA_ASIAN
), rSet
),
2260 aOptionsFL( this, CUI_RES(FL_AS_OPTIONS
)),
2261 aForbiddenRulesCB( this, CUI_RES(CB_AS_FORBIDDEN
)),
2262 aHangingPunctCB( this, CUI_RES(CB_AS_HANG_PUNC
)),
2263 aScriptSpaceCB( this, CUI_RES(CB_AS_SCRIPT_SPACE
))//,
2268 Link aLink
= LINK( this, SvxAsianTabPage
, ClickHdl_Impl
);
2269 aHangingPunctCB
.SetClickHdl( aLink
);
2270 aScriptSpaceCB
.SetClickHdl( aLink
);
2271 aForbiddenRulesCB
.SetClickHdl( aLink
);
2274 /*-- 29.11.00 11:36:24---------------------------------------------------
2276 -----------------------------------------------------------------------*/
2277 SvxAsianTabPage::~SvxAsianTabPage()
2280 /*-- 29.11.00 11:36:24---------------------------------------------------
2282 -----------------------------------------------------------------------*/
2283 SfxTabPage
* SvxAsianTabPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
2285 return new SvxAsianTabPage(pParent
, rSet
);
2287 /*-- 29.11.00 11:36:24---------------------------------------------------
2289 -----------------------------------------------------------------------*/
2290 sal_uInt16
* SvxAsianTabPage::GetRanges()
2292 static sal_uInt16 pRanges
[] =
2294 SID_ATTR_PARA_SCRIPTSPACE
, SID_ATTR_PARA_FORBIDDEN_RULES
,
2299 /*-- 29.11.00 11:36:24---------------------------------------------------
2301 -----------------------------------------------------------------------*/
2302 sal_Bool
SvxAsianTabPage::FillItemSet( SfxItemSet
& rSet
)
2304 sal_Bool bRet
= sal_False
;
2305 SfxItemPool
* pPool
= rSet
.GetPool();
2306 if(aScriptSpaceCB
.IsChecked() != aScriptSpaceCB
.GetSavedValue())
2308 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2309 pPool
->GetWhich(SID_ATTR_PARA_SCRIPTSPACE
)).Clone();
2310 pNewItem
->SetValue(aScriptSpaceCB
.IsChecked());
2311 rSet
.Put(*pNewItem
);
2315 if(aHangingPunctCB
.IsChecked() != aHangingPunctCB
.GetSavedValue())
2317 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2318 pPool
->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION
)).Clone();
2319 pNewItem
->SetValue(aHangingPunctCB
.IsChecked());
2320 rSet
.Put(*pNewItem
);
2324 if(aForbiddenRulesCB
.IsChecked() != aForbiddenRulesCB
.GetSavedValue())
2326 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2327 pPool
->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES
)).Clone();
2328 pNewItem
->SetValue(aForbiddenRulesCB
.IsChecked());
2329 rSet
.Put(*pNewItem
);
2335 /*-- 29.11.00 11:36:25---------------------------------------------------
2337 -----------------------------------------------------------------------*/
2338 void lcl_SetBox(const SfxItemSet
& rSet
, sal_uInt16 nSlotId
, TriStateBox
& rBox
)
2340 sal_uInt16 _nWhich
= rSet
.GetPool()->GetWhich(nSlotId
);
2341 SfxItemState eState
= rSet
.GetItemState(_nWhich
, sal_True
);
2342 if(!eState
|| eState
== SFX_ITEM_DISABLED
)
2343 rBox
.Enable(sal_False
);
2344 else if(eState
>= SFX_ITEM_AVAILABLE
)
2346 rBox
.EnableTriState( sal_False
);
2347 rBox
.Check(((const SfxBoolItem
&)rSet
.Get(_nWhich
)).GetValue());
2350 rBox
.SetState( STATE_DONTKNOW
);
2355 void SvxAsianTabPage::Reset( const SfxItemSet
& rSet
)
2357 lcl_SetBox(rSet
, SID_ATTR_PARA_FORBIDDEN_RULES
, aForbiddenRulesCB
);
2358 // lcl_SetBox(rSet, , aAllowWordBreakCB );
2359 lcl_SetBox(rSet
, SID_ATTR_PARA_HANGPUNCTUATION
, aHangingPunctCB
);
2362 //character distance not yet available
2363 // lcl_SetBox(rSet, , aPuntuationCB );
2364 lcl_SetBox(rSet
, SID_ATTR_PARA_SCRIPTSPACE
, aScriptSpaceCB
);
2365 // lcl_SetBox(rSet, , aAdjustNumbersCB );
2366 // aAllowWordBreakCB .Enable(sal_False);
2367 // aPuntuationCB .Enable(sal_False);
2368 // aAdjustNumbersCB .Enable(sal_False);
2370 /* -----------------------------19.12.00 12:59--------------------------------
2372 ---------------------------------------------------------------------------*/
2373 IMPL_LINK( SvxAsianTabPage
, ClickHdl_Impl
, TriStateBox
*, pBox
)
2375 pBox
->EnableTriState( sal_False
);