1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: paragrph.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
37 #include <svtools/style.hxx>
38 #include <sfx2/app.hxx>
39 #include <sfx2/objsh.hxx>
40 #include <sfx2/module.hxx>
41 #include <vcl/mnemonic.hxx>
56 #define _SVX_PARAGRPH_CXX 0
61 #include <svtools/languageoptions.hxx>
62 #include <pgrditem.hxx>
63 #include <svx/dialogs.hrc>
64 #include "paragrph.hrc"
65 #include "paragrph.hxx"
66 #include <svx/frmdiritem.hxx>
68 #include <svx/lspcitem.hxx>
69 #include <svx/adjitem.hxx>
70 #include <svx/orphitem.hxx>
71 #include <svx/widwitem.hxx>
72 #include <svx/tstpitem.hxx>
73 #include <svx/pmdlitem.hxx>
74 #include <svx/spltitem.hxx>
75 #include <svx/hyznitem.hxx>
76 #include <svx/ulspitem.hxx>
77 #include <svx/lrspitem.hxx>
78 #include <svx/brkitem.hxx>
79 #include <svx/keepitem.hxx>
80 #include "dlgutil.hxx"
81 #include <svx/dialmgr.hxx>
82 #include "htmlmode.hxx"
83 #include <svx/paravertalignitem.hxx>
84 #include <svtools/eitem.hxx> //add CHINA001
85 #include <sfx2/request.hxx> //add CHINA001
86 #include <svtools/intitem.hxx> //add CHINA001
87 #ifndef _SVTOOLS_CJKOPTIONS_HXX
88 #include <svtools/cjkoptions.hxx>
91 // static ----------------------------------------------------------------
93 static USHORT pStdRanges
[] =
95 SID_ATTR_PARA_LINESPACE
, // 10033
96 SID_ATTR_PARA_LINESPACE
,
97 SID_ATTR_LRSPACE
, // 10048 -
98 SID_ATTR_ULSPACE
, // 10049
99 SID_ATTR_PARA_REGISTER
, // 10413
100 SID_ATTR_PARA_REGISTER
,
104 static USHORT pAlignRanges
[] =
106 SID_ATTR_PARA_ADJUST
, // 10027
107 SID_ATTR_PARA_ADJUST
,
111 static USHORT pExtRanges
[] =
113 SID_ATTR_PARA_PAGEBREAK
, // 10037 -
114 SID_ATTR_PARA_WIDOWS
, // 10041
115 SID_ATTR_PARA_MODEL
, // 10065 -
116 SID_ATTR_PARA_KEEP
, // 10066
120 // define ----------------------------------------------------------------
122 #define MAX_DURCH 5670 // 10 cm ist sinnvoll als maximaler Durchschuss
124 #define FIX_DIST_DEF 283 // Standard-Fix-Abstand 0,5cm
126 // enum ------------------------------------------------------------------
140 // C-Funktion ------------------------------------------------------------
142 void SetLineSpace_Impl( SvxLineSpacingItem
&, int, long lValue
= 0 );
144 void SetLineSpace_Impl( SvxLineSpacingItem
& rLineSpace
,
145 int eSpace
, long lValue
)
150 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
151 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
155 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
156 rLineSpace
.SetPropLineSpace( 150 );
160 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
161 rLineSpace
.SetPropLineSpace( 200 );
164 case LLINESPACE_PROP
:
165 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
166 rLineSpace
.SetPropLineSpace( (BYTE
)lValue
);
170 rLineSpace
.SetLineHeight( (USHORT
)lValue
);
171 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
174 case LLINESPACE_DURCH
:
175 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
176 rLineSpace
.SetInterLineSpace( (USHORT
)lValue
);
180 rLineSpace
.SetLineHeight((USHORT
)lValue
);
181 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_FIX
;
182 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
188 USHORT
GetHtmlMode_Impl(const SfxItemSet
& rSet
)
190 USHORT nHtmlMode
= 0;
191 const SfxPoolItem
* pItem
= 0;
192 SfxObjectShell
* pShell
;
193 if(SFX_ITEM_SET
== rSet
.GetItemState(SID_HTML_MODE
, FALSE
, &pItem
) ||
194 ( 0 != (pShell
= SfxObjectShell::Current()) &&
195 0 != (pItem
= pShell
->GetItem(SID_HTML_MODE
))))
197 nHtmlMode
= ((SfxUInt16Item
*)pItem
)->GetValue();
203 // class SvxStdParagraphTabPage ------------------------------------------
205 IMPL_LINK( SvxStdParagraphTabPage
, ELRLoseFocusHdl
, Edit
*, EMPTYARG
)
207 //! if ( aLeftIndent.IsRelativeMode() )
210 SfxItemPool
* pPool
= GetItemSet().GetPool();
211 DBG_ASSERT( pPool
, "Wo ist der Pool" );
213 MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
215 sal_Int64 nL
= aLeftIndent
.Denormalize( aLeftIndent
.GetValue( eUnit
) );
216 sal_Int64 nR
= aRightIndent
.Denormalize( aRightIndent
.GetValue( eUnit
) );
217 String aTmp
= aFLineIndent
.GetText();
220 if( aLeftIndent
.GetMin() < 0 )
221 aFLineIndent
.SetMin( -99999, FUNIT_MM
);
223 aFLineIndent
.SetMin( aFLineIndent
.Normalize( -nL
), eUnit
);
225 // Check nur fuer konkrete Breite (Shell)
226 sal_Int64 nTmp
= nWidth
- nL
- nR
- MM50
;
227 aFLineIndent
.SetMax( aFLineIndent
.Normalize( nTmp
), eUnit
);
230 aFLineIndent
.SetEmptyFieldValue();
231 // Maximum Links Rechts
232 aTmp
= aLeftIndent
.GetText();
233 nTmp
= nWidth
- nR
- MM50
;
234 aLeftIndent
.SetMax( aLeftIndent
.Normalize( nTmp
), eUnit
);
237 aLeftIndent
.SetEmptyFieldValue();
238 aTmp
= aRightIndent
.GetText();
239 nTmp
= nWidth
- nL
- MM50
;
240 aRightIndent
.SetMax( aRightIndent
.Normalize( nTmp
), eUnit
);
243 aRightIndent
.SetEmptyFieldValue();
247 // -----------------------------------------------------------------------
249 SfxTabPage
* SvxStdParagraphTabPage::Create( Window
* pParent
,
250 const SfxItemSet
& rSet
)
252 return new SvxStdParagraphTabPage( pParent
, rSet
);
255 // -----------------------------------------------------------------------
257 BOOL
SvxStdParagraphTabPage::FillItemSet( SfxItemSet
& rOutSet
)
259 SfxItemState eState
= SFX_ITEM_UNKNOWN
;
260 const SfxPoolItem
* pOld
= 0;
261 SfxItemPool
* pPool
= rOutSet
.GetPool();
262 DBG_ASSERT( pPool
, "Wo ist der Pool" );
264 BOOL bModified
= FALSE
;
266 USHORT nPos
= aLineDist
.GetSelectEntryPos();
268 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
269 ( nPos
!= aLineDist
.GetSavedValue() ||
270 aLineDistAtPercentBox
.IsValueModified() ||
271 aLineDistAtMetricBox
.IsValueModified() ) )
273 nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
274 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
275 SvxLineSpacingItem
aSpacing(
276 (const SvxLineSpacingItem
&)GetItemSet().Get( nWhich
) );
283 SetLineSpace_Impl( aSpacing
, nPos
);
286 case LLINESPACE_PROP
:
287 SetLineSpace_Impl( aSpacing
, nPos
,
288 static_cast<long>(aLineDistAtPercentBox
.Denormalize(
289 aLineDistAtPercentBox
.GetValue() )) );
293 case LLINESPACE_DURCH
:
295 SetLineSpace_Impl( aSpacing
, nPos
,
296 GetCoreValue( aLineDistAtMetricBox
, eUnit
) );
300 DBG_ERROR( "unbekannter Type fuer Zeilenabstand." );
303 eState
= GetItemSet().GetItemState( nWhich
);
304 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_LINESPACE
);
306 if ( !pOld
|| !( *(const SvxLineSpacingItem
*)pOld
== aSpacing
) ||
307 SFX_ITEM_DONTCARE
== eState
)
309 rOutSet
.Put( aSpacing
);
314 if ( aTopDist
.IsValueModified() || aBottomDist
.IsValueModified() )
316 nWhich
= GetWhich( SID_ATTR_ULSPACE
);
317 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
318 pOld
= GetOldItem( rOutSet
, SID_ATTR_ULSPACE
);
319 SvxULSpaceItem
aMargin( nWhich
);
323 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
325 const SvxULSpaceItem
& rOldItem
=
326 (const SvxULSpaceItem
&)GetItemSet().GetParent()->Get( nWhich
);
328 if ( aTopDist
.IsRelative() )
329 aMargin
.SetUpper( rOldItem
.GetUpper(),
330 (USHORT
)aTopDist
.GetValue() );
332 aMargin
.SetUpper( (USHORT
)GetCoreValue( aTopDist
, eUnit
) );
334 if ( aBottomDist
.IsRelative() )
335 aMargin
.SetLower( rOldItem
.GetLower(),
336 (USHORT
)aBottomDist
.GetValue() );
338 aMargin
.SetLower( (USHORT
)GetCoreValue( aBottomDist
, eUnit
) );
343 aMargin
.SetUpper( (USHORT
)GetCoreValue( aTopDist
, eUnit
) );
344 aMargin
.SetLower( (USHORT
)GetCoreValue( aBottomDist
, eUnit
) );
346 eState
= GetItemSet().GetItemState( nWhich
);
348 if ( !pOld
|| !( *(const SvxULSpaceItem
*)pOld
== aMargin
) ||
349 SFX_ITEM_DONTCARE
== eState
)
351 rOutSet
.Put( aMargin
);
355 FASTBOOL bNullTab
= FALSE
;
357 if ( aLeftIndent
.IsValueModified() ||
358 aFLineIndent
.IsValueModified() ||
359 aRightIndent
.IsValueModified()
360 || aAutoCB
.GetSavedValue() != aAutoCB
.IsChecked() )
362 nWhich
= GetWhich( SID_ATTR_LRSPACE
);
363 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
364 SvxLRSpaceItem
aMargin( nWhich
);
365 pOld
= GetOldItem( rOutSet
, SID_ATTR_LRSPACE
);
369 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
371 const SvxLRSpaceItem
& rOldItem
=
372 (const SvxLRSpaceItem
&)GetItemSet().GetParent()->Get( nWhich
);
374 if ( aLeftIndent
.IsRelative() )
375 aMargin
.SetTxtLeft( rOldItem
.GetTxtLeft(),
376 (USHORT
)aLeftIndent
.GetValue() );
378 aMargin
.SetTxtLeft( GetCoreValue( aLeftIndent
, eUnit
) );
380 if ( aRightIndent
.IsRelative() )
381 aMargin
.SetRight( rOldItem
.GetRight(),
382 (USHORT
)aRightIndent
.GetValue() );
384 aMargin
.SetRight( GetCoreValue( aRightIndent
, eUnit
) );
386 if ( aFLineIndent
.IsRelative() )
387 aMargin
.SetTxtFirstLineOfst( rOldItem
.GetTxtFirstLineOfst(),
388 (USHORT
)aFLineIndent
.GetValue() );
390 aMargin
.SetTxtFirstLineOfst(
391 (USHORT
)GetCoreValue( aFLineIndent
, eUnit
) );
395 aMargin
.SetTxtLeft( GetCoreValue( aLeftIndent
, eUnit
) );
396 aMargin
.SetRight( GetCoreValue( aRightIndent
, eUnit
) );
397 aMargin
.SetTxtFirstLineOfst(
398 (USHORT
)GetCoreValue( aFLineIndent
, eUnit
) );
400 aMargin
.SetAutoFirst(aAutoCB
.IsChecked());
401 if ( aMargin
.GetTxtFirstLineOfst() < 0 )
403 eState
= GetItemSet().GetItemState( nWhich
);
405 if ( !pOld
|| !( *(const SvxLRSpaceItem
*)pOld
== aMargin
) ||
406 SFX_ITEM_DONTCARE
== eState
)
408 rOutSet
.Put( aMargin
);
415 MapUnit eUnit
= (MapUnit
)pPool
->GetMetric( GetWhich( SID_ATTR_TABSTOP
) );
416 if ( MAP_100TH_MM
!= eUnit
)
419 // negativer Erstzeileneinzug -> ggf. Null Default-Tabstop setzen
420 USHORT _nWhich
= GetWhich( SID_ATTR_TABSTOP
);
421 const SfxItemSet
& rInSet
= GetItemSet();
423 if ( rInSet
.GetItemState( _nWhich
) >= SFX_ITEM_AVAILABLE
)
425 const SvxTabStopItem
& rTabItem
=
426 (const SvxTabStopItem
&)rInSet
.Get( _nWhich
);
427 SvxTabStopItem
aNullTab( rTabItem
);
428 SvxTabStop
aNull( 0, SVX_TAB_ADJUST_DEFAULT
);
429 aNullTab
.Insert( aNull
);
430 rOutSet
.Put( aNullTab
);
434 if( aRegisterCB
.IsVisible())
436 const SfxBoolItem
* pBoolItem
= (SfxBoolItem
*)GetOldItem(
437 rOutSet
, SID_ATTR_PARA_REGISTER
);
438 SfxBoolItem
* pRegItem
= (SfxBoolItem
*)pBoolItem
->Clone();
439 USHORT _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
440 BOOL bSet
= pRegItem
->GetValue();
442 if(aRegisterCB
.IsChecked() != bSet
)
444 pRegItem
->SetValue(!bSet
);
445 rOutSet
.Put(*pRegItem
);
448 else if ( SFX_ITEM_DEFAULT
== GetItemSet().GetItemState( _nWhich
, FALSE
) )
449 rOutSet
.ClearItem(_nWhich
);
456 // -----------------------------------------------------------------------
458 void SvxStdParagraphTabPage::Reset( const SfxItemSet
& rSet
)
460 SfxItemPool
* pPool
= rSet
.GetPool();
461 DBG_ASSERT( pPool
, "Wo ist der Pool?" );
465 FieldUnit eFUnit
= GetModuleFieldUnit( &rSet
);
467 BOOL bApplyCharUnit
= sal_False
;
468 bApplyCharUnit
= GetApplyCharUnit( &rSet
);
470 SvtCJKOptions aCJKOptions
;
471 if(aCJKOptions
.IsAsianTypographyEnabled() && bApplyCharUnit
)
474 SetFieldUnit( aLeftIndent
, eFUnit
);
475 SetFieldUnit( aRightIndent
, eFUnit
);
476 SetFieldUnit( aFLineIndent
, eFUnit
);
477 if ( eFUnit
== FUNIT_CHAR
)
479 SetFieldUnit( aTopDist
, FUNIT_LINE
);
480 SetFieldUnit( aBottomDist
, FUNIT_LINE
);
481 SetFieldUnit( aLineDistAtMetricBox
, FUNIT_POINT
);
485 SetFieldUnit( aTopDist
, eFUnit
);
486 SetFieldUnit( aBottomDist
, eFUnit
);
487 SetFieldUnit( aLineDistAtMetricBox
, eFUnit
);
490 USHORT _nWhich
= GetWhich( SID_ATTR_LRSPACE
);
491 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
493 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
495 SfxMapUnit eUnit
= pPool
->GetMetric( _nWhich
);
499 const SvxLRSpaceItem
& rOldItem
=
500 (const SvxLRSpaceItem
&)rSet
.Get( _nWhich
);
502 if ( rOldItem
.GetPropLeft() != 100 )
504 aLeftIndent
.SetRelative( TRUE
);
505 aLeftIndent
.SetValue( rOldItem
.GetPropLeft() );
509 aLeftIndent
.SetRelative();
510 SetFieldUnit( aLeftIndent
, eFUnit
);
511 SetMetricValue( aLeftIndent
, rOldItem
.GetTxtLeft(), eUnit
);
514 if ( rOldItem
.GetPropRight() != 100 )
516 aRightIndent
.SetRelative( TRUE
);
517 aRightIndent
.SetValue( rOldItem
.GetPropRight() );
521 aRightIndent
.SetRelative();
522 SetFieldUnit( aRightIndent
, eFUnit
);
523 SetMetricValue( aRightIndent
, rOldItem
.GetRight(), eUnit
);
526 if ( rOldItem
.GetPropTxtFirstLineOfst() != 100 )
528 aFLineIndent
.SetRelative( TRUE
);
529 aFLineIndent
.SetValue( rOldItem
.GetPropTxtFirstLineOfst() );
533 aFLineIndent
.SetRelative();
534 aFLineIndent
.SetMin(-9999);
535 SetFieldUnit( aFLineIndent
, eFUnit
);
536 SetMetricValue( aFLineIndent
, rOldItem
.GetTxtFirstLineOfst(),
539 aAutoCB
.Check(rOldItem
.IsAutoFirst());
543 const SvxLRSpaceItem
& rSpace
=
544 (const SvxLRSpaceItem
&)rSet
.Get( _nWhich
);
546 SetMetricValue( aLeftIndent
, rSpace
.GetTxtLeft(), eUnit
);
547 SetMetricValue( aRightIndent
, rSpace
.GetRight(), eUnit
);
548 SetMetricValue( aFLineIndent
, rSpace
.GetTxtFirstLineOfst(), eUnit
);
549 aAutoCB
.Check(rSpace
.IsAutoFirst());
551 AutoHdl_Impl(&aAutoCB
);
555 aLeftIndent
.SetEmptyFieldValue();
556 aRightIndent
.SetEmptyFieldValue();
557 aFLineIndent
.SetEmptyFieldValue();
560 _nWhich
= GetWhich( SID_ATTR_ULSPACE
);
561 eItemState
= rSet
.GetItemState( _nWhich
);
563 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
565 SfxMapUnit eUnit
= pPool
->GetMetric( _nWhich
);
569 const SvxULSpaceItem
& rOldItem
=
570 (const SvxULSpaceItem
&)rSet
.Get( _nWhich
);
572 if ( rOldItem
.GetPropUpper() != 100 )
574 aTopDist
.SetRelative( TRUE
);
575 aTopDist
.SetValue( rOldItem
.GetPropUpper() );
579 aTopDist
.SetRelative();
580 if ( eFUnit
== FUNIT_CHAR
)
581 SetFieldUnit( aTopDist
, FUNIT_LINE
);
583 SetFieldUnit( aTopDist
, eFUnit
);
584 SetMetricValue( aTopDist
, rOldItem
.GetUpper(), eUnit
);
587 if ( rOldItem
.GetPropLower() != 100 )
589 aBottomDist
.SetRelative( TRUE
);
590 aBottomDist
.SetValue( rOldItem
.GetPropLower() );
594 aBottomDist
.SetRelative();
595 if ( eFUnit
== FUNIT_CHAR
)
596 SetFieldUnit( aBottomDist
, FUNIT_LINE
);
598 SetFieldUnit( aBottomDist
, eFUnit
);
599 SetMetricValue( aBottomDist
, rOldItem
.GetLower(), eUnit
);
604 const SvxULSpaceItem
& rTopMargin
=
605 (const SvxULSpaceItem
&)rSet
.Get( _nWhich
);
606 SetMetricValue( aTopDist
, rTopMargin
.GetUpper(), eUnit
);
607 SetMetricValue( aBottomDist
, rTopMargin
.GetLower(), eUnit
);
612 aTopDist
.SetEmptyFieldValue();
613 aBottomDist
.SetEmptyFieldValue();
616 _nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
617 eItemState
= rSet
.GetItemState( _nWhich
);
619 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
620 SetLineSpacing_Impl( (const SvxLineSpacingItem
&)rSet
.Get( _nWhich
) );
622 aLineDist
.SetNoSelection();
625 _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
626 eItemState
= rSet
.GetItemState( _nWhich
);
628 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
629 aRegisterCB
.Check( ((const SfxBoolItem
&)rSet
.Get( _nWhich
)).GetValue());
630 aRegisterCB
.SaveValue();
631 USHORT nHtmlMode
= GetHtmlMode_Impl(rSet
);
632 if(nHtmlMode
& HTMLMODE_ON
)
637 if(!(nHtmlMode
& HTMLMODE_SOME_STYLES
)) // IE oder SW
639 aRightLabel
.Disable();
640 aRightIndent
.Disable();
641 aTopDist
.Disable(); //HTML3.2 und NS 3.0
642 aBottomDist
.Disable();
643 if(!(nHtmlMode
& HTMLMODE_FIRSTLINE
)) //NS 3.0
645 aFLineIndent
.Disable();
646 aFLineLabel
.Disable();
651 ELRLoseFocusHdl( NULL
);
653 aLineDist
.SaveValue();
656 // -----------------------------------------------------------------------
658 void SvxStdParagraphTabPage::EnableRelativeMode()
660 DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
662 aLeftIndent
.EnableRelativeMode( 0, 999 );
663 aFLineIndent
.EnableRelativeMode( 0, 999 );
664 aRightIndent
.EnableRelativeMode( 0, 999 );
665 aTopDist
.EnableRelativeMode( 0, 999 );
666 aBottomDist
.EnableRelativeMode( 0, 999 );
667 bRelativeMode
= TRUE
;
670 // -----------------------------------------------------------------------
672 int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
674 ELRLoseFocusHdl( NULL
);
677 FillItemSet( *_pSet
);
681 // -----------------------------------------------------------------------
683 SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window
* pParent
,
684 const SfxItemSet
& rAttr
) :
686 SfxTabPage( pParent
, SVX_RES( RID_SVXPAGE_STD_PARAGRAPH
), rAttr
),
688 aLeftLabel ( this, SVX_RES( FT_LEFTINDENT
) ),
689 aLeftIndent ( this, SVX_RES( ED_LEFTINDENT
) ),
690 aRightLabel ( this, SVX_RES( FT_RIGHTINDENT
) ),
691 aRightIndent ( this, SVX_RES( ED_RIGHTINDENT
) ),
693 aFLineLabel ( this, SVX_RES( FT_FLINEINDENT
) ),
694 aFLineIndent ( this, SVX_RES( ED_FLINEINDENT
) ),
695 aAutoCB ( this, SVX_RES( CB_AUTO
) ),
696 aIndentFrm ( this, SVX_RES( FL_INDENT
) ),
697 aTopLabel ( this, SVX_RES( FT_TOPDIST
) ),
698 aTopDist ( this, SVX_RES( ED_TOPDIST
) ),
699 aBottomLabel ( this, SVX_RES( FT_BOTTOMDIST
) ),
700 aBottomDist ( this, SVX_RES( ED_BOTTOMDIST
) ),
701 aDistFrm ( this, SVX_RES( FL_DIST
) ),
702 aLineDist ( this, SVX_RES( LB_LINEDIST
) ),
703 aLineDistAtLabel ( this, SVX_RES( FT_LINEDIST
) ),
704 aLineDistAtPercentBox ( this, SVX_RES( ED_LINEDISTPERCENT
) ),
705 aLineDistAtMetricBox ( this, SVX_RES( ED_LINEDISTMETRIC
) ),
706 aLineDistFrm ( this, SVX_RES( FL_LINEDIST
) ),
707 sAbsDist ( SVX_RES(ST_LINEDIST_ABS
) ),
708 aExampleWin ( this, SVX_RES( WN_EXAMPLE
) ),
709 aRegisterCB ( this, SVX_RES( CB_REGISTER
) ),
710 aRegisterFL ( this, SVX_RES( FL_REGISTER
) ),
711 pActLineDistFld ( &aLineDistAtPercentBox
),
713 nWidth ( 11905 /*567 * 50*/ ),
716 bRelativeMode ( FALSE
),
717 bNegativeIndents(FALSE
)
720 // diese Page braucht ExchangeSupport
721 SetExchangeSupport();
723 aLineDistAtMetricBox
.Hide();
726 aFLineIndent
.SetMin(-9999); // wird default auf 0 gesetzt
730 // -----------------------------------------------------------------------
732 void SvxStdParagraphTabPage::EnableNegativeMode()
734 aLeftIndent
.SetMin(-9999);
735 aRightIndent
.SetMin(-9999);
736 aRightIndent
.EnableNegativeMode();
737 aLeftIndent
.EnableNegativeMode();
738 bNegativeIndents
= TRUE
;
741 // -----------------------------------------------------------------------
743 USHORT
* SvxStdParagraphTabPage::GetRanges()
748 // -----------------------------------------------------------------------
750 void SvxStdParagraphTabPage::SetLineSpacing_Impl
752 const SvxLineSpacingItem
&rAttr
755 SfxMapUnit eUnit
= GetItemSet().GetPool()->GetMetric( rAttr
.Which() );
757 switch( rAttr
.GetLineSpaceRule() )
759 case SVX_LINE_SPACE_AUTO
:
761 SvxInterLineSpace eInter
= rAttr
.GetInterLineSpaceRule();
766 case SVX_INTER_LINE_SPACE_OFF
:
767 aLineDist
.SelectEntryPos( LLINESPACE_1
);
771 case SVX_INTER_LINE_SPACE_PROP
:
772 if ( 100 == rAttr
.GetPropLineSpace() )
774 aLineDist
.SelectEntryPos( LLINESPACE_1
);
778 if ( 150 == rAttr
.GetPropLineSpace() )
780 aLineDist
.SelectEntryPos( LLINESPACE_15
);
784 if ( 200 == rAttr
.GetPropLineSpace() )
786 aLineDist
.SelectEntryPos( LLINESPACE_2
);
789 // eingestellter Prozentwert
790 aLineDistAtPercentBox
.
791 SetValue( aLineDistAtPercentBox
.Normalize(
792 rAttr
.GetPropLineSpace() ) );
793 aLineDist
.SelectEntryPos( LLINESPACE_PROP
);
796 case SVX_INTER_LINE_SPACE_FIX
:
797 SetMetricValue( aLineDistAtMetricBox
,
798 rAttr
.GetInterLineSpace(), eUnit
);
799 aLineDist
.SelectEntryPos( LLINESPACE_DURCH
);
801 default: ;//prevent warning
805 case SVX_LINE_SPACE_FIX
:
806 SetMetricValue(aLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
807 aLineDist
.SelectEntryPos( LLINESPACE_FIX
);
810 case SVX_LINE_SPACE_MIN
:
811 SetMetricValue(aLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
812 aLineDist
.SelectEntryPos( LLINESPACE_MIN
);
814 default: ;//prevent warning
816 LineDistHdl_Impl( &aLineDist
);
819 // -----------------------------------------------------------------------
821 IMPL_LINK( SvxStdParagraphTabPage
, LineDistHdl_Impl
, ListBox
*, pBox
)
823 switch( pBox
->GetSelectEntryPos() )
828 aLineDistAtLabel
.Enable(FALSE
);
829 pActLineDistFld
->Enable(FALSE
);
830 pActLineDistFld
->SetText( String() );
833 case LLINESPACE_DURCH
:
834 // Setzen eines sinnvollen Defaults?
835 // MS Begrenzen min(10, aPageSize)
836 aLineDistAtPercentBox
.Hide();
837 pActLineDistFld
= &aLineDistAtMetricBox
;
838 aLineDistAtMetricBox
.SetMin(0);
841 if ( !aLineDistAtMetricBox
.GetText().Len() )
842 aLineDistAtMetricBox
.SetValue(
843 aLineDistAtMetricBox
.Normalize( 1 ) );
844 aLineDistAtPercentBox
.Hide();
845 pActLineDistFld
->Show();
846 pActLineDistFld
->Enable();
847 aLineDistAtLabel
.Enable();
851 aLineDistAtPercentBox
.Hide();
852 pActLineDistFld
= &aLineDistAtMetricBox
;
853 aLineDistAtMetricBox
.SetMin(0);
855 if ( !aLineDistAtMetricBox
.GetText().Len() )
856 aLineDistAtMetricBox
.SetValue(
857 aLineDistAtMetricBox
.Normalize( 10 ), FUNIT_TWIP
);
858 aLineDistAtPercentBox
.Hide();
859 pActLineDistFld
->Show();
860 pActLineDistFld
->Enable();
861 aLineDistAtLabel
.Enable();
864 case LLINESPACE_PROP
:
865 aLineDistAtMetricBox
.Hide();
866 pActLineDistFld
= &aLineDistAtPercentBox
;
868 if ( !aLineDistAtPercentBox
.GetText().Len() )
869 aLineDistAtPercentBox
.SetValue(
870 aLineDistAtPercentBox
.Normalize( 100 ), FUNIT_TWIP
);
871 aLineDistAtMetricBox
.Hide();
872 pActLineDistFld
->Show();
873 pActLineDistFld
->Enable();
874 aLineDistAtLabel
.Enable();
878 aLineDistAtPercentBox
.Hide();
879 pActLineDistFld
= &aLineDistAtMetricBox
;
880 sal_Int64 nTemp
= aLineDistAtMetricBox
.GetValue();
881 aLineDistAtMetricBox
.SetMin(aLineDistAtMetricBox
.Normalize(nMinFixDist
), FUNIT_TWIP
);
883 // wurde der Wert beim SetMin veraendert, dann ist es Zeit
885 if ( aLineDistAtMetricBox
.GetValue() != nTemp
)
886 SetMetricValue( aLineDistAtMetricBox
,
887 FIX_DIST_DEF
, SFX_MAPUNIT_TWIP
); // fix gibt's nur im Writer
888 aLineDistAtPercentBox
.Hide();
889 pActLineDistFld
->Show();
890 pActLineDistFld
->Enable();
891 aLineDistAtLabel
.Enable();
895 UpdateExample_Impl( TRUE
);
899 // -----------------------------------------------------------------------
901 IMPL_LINK_INLINE_START( SvxStdParagraphTabPage
, ModifyHdl_Impl
, SvxRelativeField
*, EMPTYARG
)
903 UpdateExample_Impl();
906 IMPL_LINK_INLINE_END( SvxStdParagraphTabPage
, ModifyHdl_Impl
, SvxRelativeField
*, EMPTYARG
)
908 // -----------------------------------------------------------------------
910 void SvxStdParagraphTabPage::Init_Impl()
912 aLineDist
.SetSelectHdl(
913 LINK( this, SvxStdParagraphTabPage
, LineDistHdl_Impl
) );
915 Link aLink
= LINK( this, SvxStdParagraphTabPage
, ELRLoseFocusHdl
);
916 aFLineIndent
.SetLoseFocusHdl( aLink
);
917 aLeftIndent
.SetLoseFocusHdl( aLink
);
918 aRightIndent
.SetLoseFocusHdl( aLink
);
920 aLink
= LINK( this, SvxStdParagraphTabPage
, ModifyHdl_Impl
);
921 aFLineIndent
.SetModifyHdl( aLink
);
922 aLeftIndent
.SetModifyHdl( aLink
);
923 aRightIndent
.SetModifyHdl( aLink
);
924 aTopDist
.SetModifyHdl( aLink
);
925 aBottomDist
.SetModifyHdl( aLink
);
927 aAutoCB
.SetClickHdl( LINK( this, SvxStdParagraphTabPage
, AutoHdl_Impl
));
928 SfxItemPool
* pPool
= GetItemSet().GetPool();
929 DBG_ASSERT( pPool
, "Wo ist der Pool" );
931 MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
933 aTopDist
.SetMax( aTopDist
.Normalize( nAbst
), eUnit
);
934 aBottomDist
.SetMax( aBottomDist
.Normalize( nAbst
), eUnit
);
935 aLineDistAtMetricBox
.SetMax(
936 aLineDistAtMetricBox
.Normalize( nAbst
), eUnit
);
939 // -----------------------------------------------------------------------
941 void SvxStdParagraphTabPage::UpdateExample_Impl( BOOL bAll
)
943 aExampleWin
.SetFirstLineOfst(
944 (short)aFLineIndent
.Denormalize( aFLineIndent
.GetValue( FUNIT_TWIP
) ) );
945 aExampleWin
.SetLeftMargin(
946 static_cast<long>(aLeftIndent
.Denormalize( aLeftIndent
.GetValue( FUNIT_TWIP
) ) ) );
947 aExampleWin
.SetRightMargin(
948 static_cast<long>(aRightIndent
.Denormalize( aRightIndent
.GetValue( FUNIT_TWIP
) ) ) );
949 aExampleWin
.SetUpper(
950 (USHORT
)aTopDist
.Denormalize( aTopDist
.GetValue( FUNIT_TWIP
) ) );
951 aExampleWin
.SetLower(
952 (USHORT
)aBottomDist
.Denormalize( aBottomDist
.GetValue( FUNIT_TWIP
) ) );
956 USHORT nPos
= aLineDist
.GetSelectEntryPos();
963 aExampleWin
.SetLineSpace( (SvxPrevLineSpace
)nPos
);
966 case LLINESPACE_PROP
:
967 aExampleWin
.SetLineSpace( (SvxPrevLineSpace
)nPos
,
968 (USHORT
)aLineDistAtPercentBox
.Denormalize(
969 aLineDistAtPercentBox
.GetValue() ) );
973 case LLINESPACE_DURCH
:
975 aExampleWin
.SetLineSpace( (SvxPrevLineSpace
)nPos
,
976 (USHORT
)GetCoreValue( aLineDistAtMetricBox
, SFX_MAPUNIT_TWIP
) );
979 aExampleWin
.Draw( bAll
);
982 // -----------------------------------------------------------------------
984 void SvxStdParagraphTabPage::EnableRegisterMode()
990 /*-----------------16.01.97 19.54-------------------
992 --------------------------------------------------*/
993 IMPL_LINK( SvxStdParagraphTabPage
, AutoHdl_Impl
, CheckBox
*, pBox
)
995 BOOL bEnable
= !pBox
->IsChecked();
996 aFLineLabel
.Enable(bEnable
);
997 aFLineIndent
.Enable(bEnable
);
1001 /*-----------------16.01.97 18.00-------------------
1003 --------------------------------------------------*/
1004 void SvxStdParagraphTabPage::SetPageWidth( USHORT nPageWidth
)
1006 nWidth
= nPageWidth
;
1008 /*-----------------16.01.97 18.01-------------------
1010 --------------------------------------------------*/
1011 void SvxStdParagraphTabPage::SetMaxDistance( USHORT nMaxDist
)
1016 /*-----------------17.01.97 08.11-------------------
1018 --------------------------------------------------*/
1019 void SvxStdParagraphTabPage::EnableAutoFirstLine()
1024 /*-----------------11.06.97 11.48-------------------
1025 absoluter Zeilenabstand
1026 --------------------------------------------------*/
1027 void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip
)
1029 aLineDist
.InsertEntry(sAbsDist
);
1030 nMinFixDist
= nMinTwip
;
1033 //addd CHINA001 begin
1034 void SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet
)
1037 /* CHINA001 different bit represent call to different method of SvxStdParagraphTabPage
1038 0x0001 --->EnableRelativeMode()
1039 0x0002 --->EnableRegisterMode()
1040 0x0004 --->EnableAutoFirstLine()
1041 0x0008 --->EnableNegativeMode()
1045 SFX_ITEMSET_ARG (&aSet
,pPageWidthItem
,SfxUInt16Item
,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH
,sal_False
);
1046 SFX_ITEMSET_ARG (&aSet
,pFlagSetItem
,SfxUInt32Item
,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET
,sal_False
);
1047 SFX_ITEMSET_ARG (&aSet
,pLineDistItem
,SfxUInt32Item
,SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST
,sal_False
);
1050 SetPageWidth(pPageWidthItem
->GetValue());
1053 if (( 0x0001 & pFlagSetItem
->GetValue())== 0x0001 )
1054 EnableRelativeMode();
1057 if (( 0x0002 & pFlagSetItem
->GetValue())== 0x0002 )
1058 EnableRegisterMode();
1061 if ( ( 0x0004 & pFlagSetItem
->GetValue())== 0x0004 )
1062 EnableAutoFirstLine();
1065 EnableAbsLineDist(pLineDistItem
->GetValue());
1068 if (( 0x0008 & pFlagSetItem
->GetValue()) == 0x0008 )
1069 EnableNegativeMode();
1074 #define LASTLINEPOS_DEFAULT 0
1075 #define LASTLINEPOS_LEFT 1
1077 #define LASTLINECOUNT_OLD 3
1078 #define LASTLINECOUNT_NEW 4
1080 // class SvxParaAlignTabPage ------------------------------------------------
1082 /*-----------------16.01.97 19.34-------------------
1084 --------------------------------------------------*/
1085 SvxParaAlignTabPage::SvxParaAlignTabPage( Window
* pParent
, const SfxItemSet
& rSet
)
1086 : SfxTabPage(pParent
, SVX_RES( RID_SVXPAGE_ALIGN_PARAGRAPH
),rSet
),
1087 aAlignFrm ( this, SVX_RES( FL_ALIGN
) ),
1088 aLeft ( this, SVX_RES( BTN_LEFTALIGN
) ),
1089 aRight ( this, SVX_RES( BTN_RIGHTALIGN
) ),
1090 aCenter ( this, SVX_RES( BTN_CENTERALIGN
) ),
1091 aJustify ( this, SVX_RES( BTN_JUSTIFYALIGN
) ),
1092 aLastLineFT ( this, SVX_RES( FT_LASTLINE
) ),
1093 aLastLineLB ( this, SVX_RES( LB_LASTLINE
) ),
1094 aExpandCB ( this, SVX_RES( CB_EXPAND
) ),
1095 aSnapToGridCB ( this, SVX_RES( CB_SNAP
) ),
1096 aExampleWin ( this, SVX_RES( WN_EXAMPLE
) ),
1098 aVertAlignFL ( this, SVX_RES( FL_VERTALIGN
) ),
1099 aVertAlignFT ( this, SVX_RES( FT_VERTALIGN
) ),
1100 aVertAlignLB ( this, SVX_RES( LB_VERTALIGN
) ),
1102 aPropertiesFL ( this, SVX_RES( FL_PROPERTIES
)),
1103 aTextDirectionFT ( this, SVX_RES( FT_TEXTDIRECTION
)),
1104 aTextDirectionLB ( this, SVX_RES( LB_TEXTDIRECTION
))
1106 SvtLanguageOptions aLangOptions
;
1107 USHORT nLastLinePos
= LASTLINEPOS_DEFAULT
;
1109 if ( aLangOptions
.IsAsianTypographyEnabled() )
1111 String
sLeft(SVX_RES(ST_LEFTALIGN_ASIAN
));
1112 aLeft
.SetText(sLeft
);
1113 aRight
.SetText(String(SVX_RES(ST_RIGHTALIGN_ASIAN
)));
1114 sLeft
= MnemonicGenerator::EraseAllMnemonicChars( sLeft
);
1116 if ( aLastLineLB
.GetEntryCount() == LASTLINECOUNT_OLD
)
1118 aLastLineLB
.RemoveEntry( 0 );
1119 aLastLineLB
.InsertEntry( sLeft
, 0 );
1122 nLastLinePos
= LASTLINEPOS_LEFT
;
1124 // remove "Default" or "Left" entry, depends on CJKOptions
1125 if ( aLastLineLB
.GetEntryCount() == LASTLINECOUNT_NEW
)
1126 aLastLineLB
.RemoveEntry( nLastLinePos
);
1129 Link aLink
= LINK( this, SvxParaAlignTabPage
, AlignHdl_Impl
);
1130 aLeft
.SetClickHdl( aLink
);
1131 aRight
.SetClickHdl( aLink
);
1132 aCenter
.SetClickHdl( aLink
);
1133 aJustify
.SetClickHdl( aLink
);
1134 aLastLineLB
.SetSelectHdl( LINK( this, SvxParaAlignTabPage
, LastLineHdl_Impl
) );
1135 aTextDirectionLB
.SetSelectHdl( LINK( this, SvxParaAlignTabPage
, TextDirectionHdl_Impl
) );
1137 USHORT nHtmlMode
= GetHtmlMode_Impl(rSet
);
1138 if(!(nHtmlMode
& HTMLMODE_ON
) || (0 != (nHtmlMode
& HTMLMODE_SOME_STYLES
)) )
1140 if( aLangOptions
.IsCTLFontEnabled() )
1142 aTextDirectionLB
.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_LTR
), FRMDIR_HORI_LEFT_TOP
);
1143 aTextDirectionLB
.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_RTL
), FRMDIR_HORI_RIGHT_TOP
);
1144 aTextDirectionLB
.InsertEntryValue( SVX_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER
), FRMDIR_ENVIRONMENT
);
1146 aPropertiesFL
.Show();
1147 aTextDirectionFT
.Show();
1148 aTextDirectionLB
.Show();
1153 /*-----------------16.01.97 19.33-------------------
1155 --------------------------------------------------*/
1156 SvxParaAlignTabPage::~SvxParaAlignTabPage()
1160 /*-----------------16.01.97 19.33-------------------
1162 --------------------------------------------------*/
1163 int SvxParaAlignTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1166 FillItemSet( *_pSet
);
1170 /*-----------------16.01.97 19.33-------------------
1172 --------------------------------------------------*/
1173 SfxTabPage
* SvxParaAlignTabPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
1175 return new SvxParaAlignTabPage(pParent
, rSet
);
1178 /*-----------------16.01.97 19.33-------------------
1180 --------------------------------------------------*/
1181 USHORT
* SvxParaAlignTabPage::GetRanges()
1183 return pAlignRanges
;
1187 /*-----------------16.01.97 19.33-------------------
1189 --------------------------------------------------*/
1190 BOOL
SvxParaAlignTabPage::FillItemSet( SfxItemSet
& rOutSet
)
1192 BOOL bModified
= FALSE
;
1194 FASTBOOL bAdj
= FALSE
, bChecked
= FALSE
;
1195 SvxAdjust eAdjust
= SVX_ADJUST_LEFT
;
1197 if ( aLeft
.IsChecked() )
1199 eAdjust
= SVX_ADJUST_LEFT
;
1200 bAdj
= !aLeft
.GetSavedValue();
1203 else if ( aRight
.IsChecked() )
1205 eAdjust
= SVX_ADJUST_RIGHT
;
1206 bAdj
= !aRight
.GetSavedValue();
1209 else if ( aCenter
.IsChecked() )
1211 eAdjust
= SVX_ADJUST_CENTER
;
1212 bAdj
= !aCenter
.GetSavedValue();
1215 else if ( aJustify
.IsChecked() )
1217 eAdjust
= SVX_ADJUST_BLOCK
;
1218 bAdj
= !aJustify
.GetSavedValue() ||
1219 aExpandCB
.IsChecked() != aExpandCB
.GetSavedValue() ||
1220 aLastLineLB
.GetSelectEntryPos() != aLastLineLB
.GetSavedValue();
1223 USHORT _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1227 const SvxAdjustItem
* pOld
=
1228 (const SvxAdjustItem
*)GetOldItem( rOutSet
, SID_ATTR_PARA_ADJUST
);
1229 SvxAdjust eOneWord
= aExpandCB
.IsChecked() ? SVX_ADJUST_BLOCK
1231 USHORT nLBPos
= aLastLineLB
.GetSelectEntryPos();
1232 SvxAdjust eLastBlock
= SVX_ADJUST_LEFT
;
1235 eLastBlock
= SVX_ADJUST_CENTER
;
1236 else if ( 2 == nLBPos
)
1237 eLastBlock
= SVX_ADJUST_BLOCK
;
1239 FASTBOOL bNothingWasChecked
=
1240 !aLeft
.GetSavedValue() && !aRight
.GetSavedValue() &&
1241 !aCenter
.GetSavedValue() && !aJustify
.GetSavedValue();
1243 if ( !pOld
|| pOld
->GetAdjust() != eAdjust
||
1244 pOld
->GetOneWord() != eOneWord
||
1245 pOld
->GetLastBlock() != eLastBlock
||
1246 ( bChecked
&& bNothingWasChecked
) )
1250 (const SvxAdjustItem
&)GetItemSet().Get( _nWhich
) );
1251 aAdj
.SetAdjust( eAdjust
);
1252 aAdj
.SetOneWord( eOneWord
);
1253 aAdj
.SetLastBlock( eLastBlock
);
1254 rOutSet
.Put( aAdj
);
1257 if(aSnapToGridCB
.IsChecked() != aSnapToGridCB
.GetSavedValue())
1259 rOutSet
.Put(SvxParaGridItem(aSnapToGridCB
.IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID
)));
1262 if(aVertAlignLB
.GetSavedValue() != aVertAlignLB
.GetSelectEntryPos())
1264 rOutSet
.Put(SvxParaVertAlignItem(aVertAlignLB
.GetSelectEntryPos(), GetWhich( SID_PARA_VERTALIGN
)));
1268 if( aTextDirectionLB
.IsVisible() )
1270 SvxFrameDirection eDir
= aTextDirectionLB
.GetSelectEntryValue();
1271 if( eDir
!= aTextDirectionLB
.GetSavedValue() )
1273 rOutSet
.Put( SvxFrameDirectionItem( eDir
, GetWhich( SID_ATTR_FRAMEDIRECTION
) ) );
1281 /*-----------------16.01.97 19.33-------------------
1283 --------------------------------------------------*/
1284 void SvxParaAlignTabPage::Reset( const SfxItemSet
& rSet
)
1286 USHORT _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1287 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
1289 USHORT nLBSelect
= 0;
1290 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1292 const SvxAdjustItem
& rAdj
= (const SvxAdjustItem
&)rSet
.Get( _nWhich
);
1294 switch ( rAdj
.GetAdjust() /*!!! VB fragen rAdj.GetLastBlock()*/ )
1296 case SVX_ADJUST_LEFT
: aLeft
.Check(); break;
1298 case SVX_ADJUST_RIGHT
: aRight
.Check(); break;
1300 case SVX_ADJUST_CENTER
: aCenter
.Check(); break;
1302 case SVX_ADJUST_BLOCK
: aJustify
.Check(); break;
1303 default: ; //prevent warning
1305 BOOL bEnable
= aJustify
.IsChecked();
1306 aLastLineFT
.Enable(bEnable
);
1307 aLastLineLB
.Enable(bEnable
);
1308 aExpandCB
.Enable(bEnable
);
1310 aExpandCB
.Check(SVX_ADJUST_BLOCK
== rAdj
.GetOneWord());
1311 switch(rAdj
.GetLastBlock())
1313 case SVX_ADJUST_LEFT
: nLBSelect
= 0; break;
1315 case SVX_ADJUST_CENTER
: nLBSelect
= 1; break;
1317 case SVX_ADJUST_BLOCK
: nLBSelect
= 2; break;
1318 default: ; //prevent warning
1323 aLeft
.Check( FALSE
);
1324 aRight
.Check( FALSE
);
1325 aCenter
.Check( FALSE
);
1326 aJustify
.Check( FALSE
);
1328 aLastLineLB
.SelectEntryPos(nLBSelect
);
1330 USHORT nHtmlMode
= GetHtmlMode_Impl(rSet
);
1331 if(nHtmlMode
& HTMLMODE_ON
)
1336 if(!(nHtmlMode
& HTMLMODE_FULL_STYLES
|HTMLMODE_FIRSTLINE
) )
1338 aSnapToGridCB
.Show(FALSE
);
1340 _nWhich
= GetWhich(SID_ATTR_PARA_SNAPTOGRID
);
1341 eItemState
= rSet
.GetItemState( _nWhich
);
1342 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1344 const SvxParaGridItem
& rSnap
= (const SvxParaGridItem
&)rSet
.Get( _nWhich
);
1345 aSnapToGridCB
.Check(rSnap
.GetValue());
1348 _nWhich
= GetWhich( SID_PARA_VERTALIGN
);
1349 eItemState
= rSet
.GetItemState( _nWhich
);
1351 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1353 aVertAlignLB
.Show();
1354 aVertAlignFL
.Show();
1355 aVertAlignFT
.Show();
1357 const SvxParaVertAlignItem
& rAlign
= (const SvxParaVertAlignItem
&)rSet
.Get( _nWhich
);
1358 aVertAlignLB
.SelectEntryPos(rAlign
.GetValue());
1361 _nWhich
= GetWhich( SID_ATTR_FRAMEDIRECTION
);
1363 if( SFX_ITEM_AVAILABLE
<= rSet
.GetItemState( _nWhich
) )
1365 const SvxFrameDirectionItem
& rFrameDirItem
= ( const SvxFrameDirectionItem
& ) rSet
.Get( _nWhich
);
1366 aTextDirectionLB
.SelectEntryValue( (SvxFrameDirection
)rFrameDirItem
.GetValue() );
1367 aTextDirectionLB
.SaveValue();
1370 aSnapToGridCB
.SaveValue();
1371 aVertAlignLB
.SaveValue();
1374 aCenter
.SaveValue();
1375 aJustify
.SaveValue();
1376 aLastLineLB
.SaveValue();
1377 aExpandCB
.SaveValue();
1379 UpdateExample_Impl(TRUE
);
1382 /*-----------------17.01.97 08.06-------------------
1384 --------------------------------------------------*/
1385 IMPL_LINK( SvxParaAlignTabPage
, AlignHdl_Impl
, RadioButton
*, EMPTYARG
)
1387 BOOL bJustify
= aJustify
.IsChecked();
1388 aLastLineFT
.Enable(bJustify
);
1389 aLastLineLB
.Enable(bJustify
);
1390 aExpandCB
.Enable(bJustify
);
1391 UpdateExample_Impl(FALSE
);
1395 IMPL_LINK( SvxParaAlignTabPage
, LastLineHdl_Impl
, ListBox
*, EMPTYARG
)
1397 UpdateExample_Impl(FALSE
);
1401 IMPL_LINK( SvxParaAlignTabPage
, TextDirectionHdl_Impl
, ListBox
*, EMPTYARG
)
1403 SvxFrameDirection eDir
= aTextDirectionLB
.GetSelectEntryValue();
1406 // check the default alignment for this text direction
1407 case FRMDIR_HORI_LEFT_TOP
: aLeft
.Check( TRUE
); break;
1408 case FRMDIR_HORI_RIGHT_TOP
: aRight
.Check( TRUE
); break;
1409 case FRMDIR_ENVIRONMENT
: /* do nothing */ break;
1412 DBG_ERRORFILE( "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" );
1419 /*-----------------16.01.97 19.34-------------------
1421 --------------------------------------------------*/
1422 void SvxParaAlignTabPage::UpdateExample_Impl( BOOL bAll
)
1424 if ( aLeft
.IsChecked() )
1425 aExampleWin
.SetAdjust( SVX_ADJUST_LEFT
);
1426 else if ( aRight
.IsChecked() )
1427 aExampleWin
.SetAdjust( SVX_ADJUST_RIGHT
);
1428 else if ( aCenter
.IsChecked() )
1429 aExampleWin
.SetAdjust( SVX_ADJUST_CENTER
);
1430 else if ( aJustify
.IsChecked() )
1432 aExampleWin
.SetAdjust( SVX_ADJUST_BLOCK
);
1433 SvxAdjust eLastBlock
= SVX_ADJUST_LEFT
;
1434 USHORT nLBPos
= aLastLineLB
.GetSelectEntryPos();
1436 eLastBlock
= SVX_ADJUST_CENTER
;
1437 else if(nLBPos
== 2)
1438 eLastBlock
= SVX_ADJUST_BLOCK
;
1439 aExampleWin
.SetLastLine( eLastBlock
);
1442 aExampleWin
.Draw( bAll
);
1444 /*-----------------17.01.97 08.04-------------------
1445 Erweiterungen fuer den Blocksatz einschalten
1446 --------------------------------------------------*/
1447 void SvxParaAlignTabPage::EnableJustifyExt()
1452 SvtLanguageOptions aCJKOptions
;
1453 if(aCJKOptions
.IsAsianTypographyEnabled())
1454 aSnapToGridCB
.Show();
1457 //add CHINA001 begin
1458 void SvxParaAlignTabPage::PageCreated (SfxAllItemSet aSet
)
1460 SFX_ITEMSET_ARG (&aSet
,pBoolItem
,SfxBoolItem
,SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT
,sal_False
);
1462 if(pBoolItem
->GetValue())
1466 // class SvxExtParagraphTabPage ------------------------------------------
1468 SfxTabPage
* SvxExtParagraphTabPage::Create( Window
* pParent
,
1469 const SfxItemSet
& rSet
)
1471 return new SvxExtParagraphTabPage( pParent
, rSet
);
1474 // -----------------------------------------------------------------------
1476 BOOL
SvxExtParagraphTabPage::FillItemSet( SfxItemSet
& rOutSet
)
1478 BOOL bModified
= FALSE
;
1479 USHORT _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1480 const TriState eHyphenState
= aHyphenBox
.GetState();
1481 const SfxPoolItem
* pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_HYPHENZONE
);
1483 if ( eHyphenState
!= aHyphenBox
.GetSavedValue() ||
1484 aExtHyphenBeforeBox
.IsValueModified() ||
1485 aExtHyphenAfterBox
.IsValueModified() ||
1486 aMaxHyphenEdit
.IsValueModified() )
1488 SvxHyphenZoneItem
aHyphen(
1489 (const SvxHyphenZoneItem
&)GetItemSet().Get( _nWhich
) );
1490 aHyphen
.SetHyphen( eHyphenState
== STATE_CHECK
);
1492 if ( eHyphenState
== STATE_CHECK
)
1494 aHyphen
.GetMinLead() = (BYTE
)aExtHyphenBeforeBox
.GetValue();
1495 aHyphen
.GetMinTrail() = (BYTE
)aExtHyphenAfterBox
.GetValue();
1497 aHyphen
.GetMaxHyphens() = (BYTE
)aMaxHyphenEdit
.GetValue();
1500 !( *(SvxHyphenZoneItem
*)pOld
== aHyphen
) ||
1501 eHyphenState
!= aHyphenBox
.GetSavedValue())
1503 rOutSet
.Put( aHyphen
);
1508 if (aPagenumEdit
.IsEnabled() && aPagenumEdit
.IsValueModified())
1510 SfxUInt16Item
aPageNum( SID_ATTR_PARA_PAGENUM
,
1511 (USHORT
)aPagenumEdit
.GetValue() );
1513 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_PAGENUM
);
1515 if ( !pOld
|| ( (const SfxUInt16Item
*)pOld
)->GetValue() != aPageNum
.GetValue() )
1517 rOutSet
.Put( aPageNum
);
1524 TriState eState
= aApplyCollBtn
.GetState();
1525 FASTBOOL bIsPageModel
= FALSE
;
1527 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1529 if ( eState
!= aApplyCollBtn
.GetSavedValue() ||
1530 ( STATE_CHECK
== eState
&&
1531 aApplyCollBox
.GetSelectEntryPos() != aApplyCollBox
.GetSavedValue() ) )
1533 if ( eState
== STATE_CHECK
)
1535 sPage
= aApplyCollBox
.GetSelectEntry();
1536 bIsPageModel
= 0 != sPage
.Len();
1538 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_MODEL
);
1540 if ( !pOld
|| ( (const SvxPageModelItem
*)pOld
)->GetValue() != sPage
)
1542 rOutSet
.Put( SvxPageModelItem( sPage
, FALSE
, _nWhich
) );
1546 bIsPageModel
= FALSE
;
1548 else if(STATE_CHECK
== eState
&& aApplyCollBtn
.IsEnabled())
1549 bIsPageModel
= TRUE
;
1551 rOutSet
.Put( SvxPageModelItem( sPage
, FALSE
, _nWhich
) );
1553 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1556 // wird PageModel eingeschaltet, dann immer PageBreak ausschalten
1557 rOutSet
.Put( SvxFmtBreakItem( SVX_BREAK_NONE
, _nWhich
) );
1560 eState
= aPageBreakBox
.GetState();
1561 SfxItemState eModelState
= GetItemSet().GetItemState(SID_ATTR_PARA_MODEL
, FALSE
);
1563 if ( (eModelState
== SFX_ITEM_SET
&& STATE_CHECK
== aPageBreakBox
.GetState()) ||
1564 eState
!= aPageBreakBox
.GetSavedValue() ||
1565 aBreakTypeLB
.GetSelectEntryPos() != aBreakTypeLB
.GetSavedValue() ||
1566 aBreakPositionLB
.GetSelectEntryPos() != aBreakPositionLB
.GetSavedValue() )
1568 const SvxFmtBreakItem
rOldBreak(
1569 (const SvxFmtBreakItem
&)GetItemSet().Get( _nWhich
));
1570 SvxFmtBreakItem
aBreak(rOldBreak
.GetBreak(), rOldBreak
.Which());
1576 BOOL bBefore
= aBreakPositionLB
.GetSelectEntryPos() == 0;
1578 if ( aBreakTypeLB
.GetSelectEntryPos() == 0 )
1581 aBreak
.SetValue( SVX_BREAK_PAGE_BEFORE
);
1583 aBreak
.SetValue( SVX_BREAK_PAGE_AFTER
);
1588 aBreak
.SetValue( SVX_BREAK_COLUMN_BEFORE
);
1590 aBreak
.SetValue( SVX_BREAK_COLUMN_AFTER
);
1596 aBreak
.SetValue( SVX_BREAK_NONE
);
1598 default: ; //prevent warning
1600 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_PAGEBREAK
);
1602 if ( eState
!= aPageBreakBox
.GetSavedValue() ||
1603 !pOld
|| !( *(const SvxFmtBreakItem
*)pOld
== aBreak
) )
1606 rOutSet
.Put( aBreak
);
1613 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1614 eState
= aKeepTogetherBox
.GetState();
1616 if ( eState
!= aKeepTogetherBox
.GetSavedValue() )
1618 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_SPLIT
);
1620 if ( !pOld
|| ( (const SvxFmtSplitItem
*)pOld
)->GetValue() !=
1621 ( eState
== STATE_NOCHECK
) )
1623 rOutSet
.Put( SvxFmtSplitItem( eState
== STATE_NOCHECK
, _nWhich
) );
1628 // Absaetze zusammenhalten
1629 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1630 eState
= aKeepParaBox
.GetState();
1632 if ( eState
!= aKeepParaBox
.GetSavedValue() )
1634 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_KEEP
);
1636 // hat sich der Status geaendert, muss immer geputtet werden
1637 rOutSet
.Put( SvxFmtKeepItem( eState
== STATE_CHECK
, _nWhich
) );
1641 // Witwen und Waisen
1642 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1643 eState
= aWidowBox
.GetState();
1645 if ( eState
!= aWidowBox
.GetSavedValue() ||
1646 aWidowRowNo
.IsValueModified() )
1648 SvxWidowsItem
rItem( eState
== STATE_CHECK
?
1649 (BYTE
)aWidowRowNo
.GetValue() : 0, _nWhich
);
1650 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_WIDOWS
);
1652 if ( eState
!= aWidowBox
.GetSavedValue() || !pOld
|| !( *(const SvxWidowsItem
*)pOld
== rItem
) )
1654 rOutSet
.Put( rItem
);
1659 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1660 eState
= aOrphanBox
.GetState();
1662 if ( eState
!= aOrphanBox
.GetSavedValue() ||
1663 aOrphanRowNo
.IsValueModified() )
1665 SvxOrphansItem
rItem( eState
== STATE_CHECK
?
1666 (BYTE
)aOrphanRowNo
.GetValue() : 0, _nWhich
);
1667 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_ORPHANS
);
1669 if ( eState
!= aOrphanBox
.GetSavedValue() ||
1671 !( *(const SvxOrphansItem
*)pOld
== rItem
) )
1673 rOutSet
.Put( rItem
);
1681 // -----------------------------------------------------------------------
1683 void SvxExtParagraphTabPage::Reset( const SfxItemSet
& rSet
)
1685 USHORT _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1686 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
1688 BOOL bItemAvailable
= eItemState
>= SFX_ITEM_AVAILABLE
;
1689 BOOL bIsHyphen
= FALSE
;
1690 if( !bHtmlMode
&& bItemAvailable
)
1692 const SvxHyphenZoneItem
& rHyphen
=
1693 (const SvxHyphenZoneItem
&)rSet
.Get( _nWhich
);
1694 aHyphenBox
.EnableTriState( FALSE
);
1696 bIsHyphen
= rHyphen
.IsHyphen();
1697 aHyphenBox
.SetState( bIsHyphen
? STATE_CHECK
: STATE_NOCHECK
);
1699 aExtHyphenBeforeBox
.SetValue( rHyphen
.GetMinLead() );
1700 aExtHyphenAfterBox
.SetValue( rHyphen
.GetMinTrail() );
1701 aMaxHyphenEdit
.SetValue( rHyphen
.GetMaxHyphens() );
1705 aHyphenBox
.SetState( STATE_DONTKNOW
);
1707 BOOL bEnable
= bItemAvailable
&& bIsHyphen
;
1708 aExtHyphenBeforeBox
.Enable(bEnable
);
1709 aExtHyphenAfterBox
.Enable(bEnable
);
1710 aBeforeText
.Enable(bEnable
);
1711 aAfterText
.Enable(bEnable
);
1712 aMaxHyphenLabel
.Enable(bEnable
);
1713 aMaxHyphenEdit
.Enable(bEnable
);
1715 _nWhich
= GetWhich( SID_ATTR_PARA_PAGENUM
);
1717 if ( rSet
.GetItemState(_nWhich
) >= SFX_ITEM_AVAILABLE
)
1719 const USHORT nPageNum
=
1720 ( (const SfxUInt16Item
&)rSet
.Get( _nWhich
) ).GetValue();
1721 aPagenumEdit
.SetValue( nPageNum
);
1726 // zuerst PageModel behandeln
1727 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1728 BOOL bIsPageModel
= FALSE
;
1729 eItemState
= rSet
.GetItemState( _nWhich
);
1731 if ( eItemState
>= SFX_ITEM_SET
)
1733 aApplyCollBtn
.EnableTriState( FALSE
);
1735 const SvxPageModelItem
& rModel
=
1736 (const SvxPageModelItem
&)rSet
.Get( _nWhich
);
1737 String
aStr( rModel
.GetValue() );
1740 aApplyCollBox
.GetEntryPos( aStr
) != LISTBOX_ENTRY_NOTFOUND
)
1742 aApplyCollBox
.SelectEntry( aStr
);
1743 aApplyCollBtn
.SetState( STATE_CHECK
);
1744 bIsPageModel
= TRUE
;
1746 aPageBreakBox
.Enable();
1747 aPageBreakBox
.EnableTriState( FALSE
);
1748 aBreakTypeFT
.Enable();
1749 aBreakTypeLB
.Enable();
1750 aBreakPositionFT
.Enable();
1751 aBreakPositionLB
.Enable();
1752 aApplyCollBtn
.Enable();
1753 aPageBreakBox
.SetState( STATE_CHECK
);
1756 aBreakTypeLB
.SelectEntryPos(0);
1757 //select break before
1758 aBreakPositionLB
.SelectEntryPos(0);
1762 aApplyCollBox
.SetNoSelection();
1763 aApplyCollBtn
.SetState( STATE_NOCHECK
);
1766 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1768 aApplyCollBtn
.EnableTriState( TRUE
);
1769 aApplyCollBtn
.SetState( STATE_DONTKNOW
);
1770 aApplyCollBox
.SetNoSelection();
1774 aApplyCollBtn
.Enable(FALSE
);
1775 aApplyCollBox
.Enable(FALSE
);
1776 aPagenumEdit
.Enable(FALSE
);
1777 aPagenumText
.Enable(FALSE
);
1779 //!!! ApplyCollClickHdl_Impl( &aApplyCollBtn );
1781 if ( !bIsPageModel
)
1783 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1784 eItemState
= rSet
.GetItemState( _nWhich
);
1786 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1788 const SvxFmtBreakItem
& rPageBreak
=
1789 (const SvxFmtBreakItem
&)rSet
.Get( _nWhich
);
1791 SvxBreak eBreak
= (SvxBreak
)rPageBreak
.GetValue();
1793 // PageBreak nicht ueber CTRL-RETURN,
1794 // dann kann CheckBox frei gegeben werden
1795 aPageBreakBox
.Enable();
1796 aPageBreakBox
.EnableTriState( FALSE
);
1797 aBreakTypeFT
.Enable();
1798 aBreakTypeLB
.Enable();
1799 aBreakPositionFT
.Enable();
1800 aBreakPositionLB
.Enable();
1802 aPageBreakBox
.SetState( STATE_CHECK
);
1804 BOOL _bEnable
= eBreak
!= SVX_BREAK_NONE
&&
1805 eBreak
!= SVX_BREAK_COLUMN_BEFORE
&&
1806 eBreak
!= SVX_BREAK_COLUMN_AFTER
;
1807 aApplyCollBtn
.Enable(_bEnable
);
1810 aApplyCollBox
.Enable(_bEnable
);
1811 aPagenumEdit
.Enable(_bEnable
);
1814 if ( eBreak
== SVX_BREAK_NONE
)
1815 aPageBreakBox
.SetState( STATE_NOCHECK
);
1817 USHORT nType
= 0; // selection position in break type ListBox : Page
1818 USHORT nPosition
= 0; // selection position in break position ListBox : Before
1821 case SVX_BREAK_PAGE_BEFORE
:
1823 case SVX_BREAK_PAGE_AFTER
:
1826 case SVX_BREAK_COLUMN_BEFORE
:
1829 case SVX_BREAK_COLUMN_AFTER
:
1833 default: ;//prevent warning
1835 aBreakTypeLB
.SelectEntryPos(nType
);
1836 aBreakPositionLB
.SelectEntryPos(nPosition
);
1838 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1839 aPageBreakBox
.SetState( STATE_DONTKNOW
);
1842 aPageBreakBox
.Enable(FALSE
);
1843 aBreakTypeFT
.Enable(FALSE
);
1844 aBreakTypeLB
.Enable(FALSE
);
1845 aBreakPositionFT
.Enable(FALSE
);
1846 aBreakPositionLB
.Enable(FALSE
);
1850 PageBreakPosHdl_Impl( &aBreakPositionLB
);
1851 PageBreakHdl_Impl( &aPageBreakBox
);
1854 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1855 eItemState
= rSet
.GetItemState( _nWhich
);
1857 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1859 aKeepParaBox
.EnableTriState( FALSE
);
1860 const SvxFmtKeepItem
& rKeep
=
1861 (const SvxFmtKeepItem
&)rSet
.Get( _nWhich
);
1863 if ( rKeep
.GetValue() )
1864 aKeepParaBox
.SetState( STATE_CHECK
);
1866 aKeepParaBox
.SetState( STATE_NOCHECK
);
1868 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1869 aKeepParaBox
.SetState( STATE_DONTKNOW
);
1871 aKeepParaBox
.Enable(FALSE
);
1873 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1874 eItemState
= rSet
.GetItemState( _nWhich
);
1876 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1878 const SvxFmtSplitItem
& rSplit
=
1879 (const SvxFmtSplitItem
&)rSet
.Get( _nWhich
);
1880 aKeepTogetherBox
.EnableTriState( FALSE
);
1882 if ( !rSplit
.GetValue() )
1883 aKeepTogetherBox
.SetState( STATE_CHECK
);
1886 aKeepTogetherBox
.SetState( STATE_NOCHECK
);
1888 // Witwen und Waisen
1890 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1891 SfxItemState eTmpState
= rSet
.GetItemState( _nWhich
);
1893 if ( eTmpState
>= SFX_ITEM_AVAILABLE
)
1895 const SvxWidowsItem
& rWidow
=
1896 (const SvxWidowsItem
&)rSet
.Get( _nWhich
);
1897 aWidowBox
.EnableTriState( FALSE
);
1898 const USHORT nLines
= rWidow
.GetValue();
1900 BOOL _bEnable
= nLines
> 0;
1901 aWidowRowNo
.SetValue( aWidowRowNo
.Normalize( nLines
) );
1902 aWidowBox
.SetState( _bEnable
? STATE_CHECK
: STATE_NOCHECK
);
1903 aWidowRowNo
.Enable(_bEnable
);
1904 aWidowRowLabel
.Enable(_bEnable
);
1907 else if ( SFX_ITEM_DONTCARE
== eTmpState
)
1908 aWidowBox
.SetState( STATE_DONTKNOW
);
1910 aWidowBox
.Enable(FALSE
);
1912 aOrphanBox
.Enable();
1913 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1914 eTmpState
= rSet
.GetItemState( _nWhich
);
1916 if ( eTmpState
>= SFX_ITEM_AVAILABLE
)
1918 const SvxOrphansItem
& rOrphan
=
1919 (const SvxOrphansItem
&)rSet
.Get( _nWhich
);
1920 const USHORT nLines
= rOrphan
.GetValue();
1921 aOrphanBox
.EnableTriState( FALSE
);
1923 BOOL _bEnable
= nLines
> 0;
1924 aOrphanBox
.SetState( _bEnable
? STATE_CHECK
: STATE_NOCHECK
);
1925 aOrphanRowNo
.SetValue( aOrphanRowNo
.Normalize( nLines
) );
1926 aOrphanRowNo
.Enable(_bEnable
);
1927 aOrphanRowLabel
.Enable(_bEnable
);
1930 else if ( SFX_ITEM_DONTCARE
== eTmpState
)
1931 aOrphanBox
.SetState( STATE_DONTKNOW
);
1933 aOrphanBox
.Enable(FALSE
);
1936 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1937 aKeepTogetherBox
.SetState( STATE_DONTKNOW
);
1939 aKeepTogetherBox
.Enable(FALSE
);
1941 // damit alles richt enabled wird
1942 KeepTogetherHdl_Impl( 0 );
1944 OrphanHdl_Impl( 0 );
1946 aHyphenBox
.SaveValue();
1947 aExtHyphenBeforeBox
.SaveValue();
1948 aExtHyphenAfterBox
.SaveValue();
1949 aMaxHyphenEdit
.SaveValue();
1950 aPageBreakBox
.SaveValue();
1951 aBreakPositionLB
.SaveValue();
1952 aBreakTypeLB
.SaveValue();
1953 aApplyCollBtn
.SaveValue();
1954 aApplyCollBox
.SaveValue();
1955 aPagenumEdit
.SaveValue();
1956 aKeepTogetherBox
.SaveValue();
1957 aKeepParaBox
.SaveValue();
1958 aWidowBox
.SaveValue();
1959 aOrphanBox
.SaveValue();
1962 // -----------------------------------------------------------------------
1964 int SvxExtParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1967 FillItemSet( *_pSet
);
1971 // -----------------------------------------------------------------------
1973 void SvxExtParagraphTabPage::DisablePageBreak()
1976 aPageBreakBox
.Enable(FALSE
);
1977 aBreakTypeLB
.RemoveEntry(0);
1978 aBreakPositionFT
.Enable(FALSE
);
1979 aBreakPositionLB
.Enable(FALSE
);
1980 aApplyCollBtn
.Enable(FALSE
);
1981 aApplyCollBox
.Enable(FALSE
);
1982 aPagenumEdit
.Enable(FALSE
);
1985 // -----------------------------------------------------------------------
1987 SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window
* pParent
, const SfxItemSet
& rAttr
) :
1989 SfxTabPage( pParent
, SVX_RES( RID_SVXPAGE_EXT_PARAGRAPH
), rAttr
),
1991 aHyphenBox ( this, SVX_RES( BTN_HYPHEN
) ),
1992 aBeforeText ( this, SVX_RES( FT_HYPHENBEFORE
) ),
1993 aExtHyphenBeforeBox ( this, SVX_RES( ED_HYPHENBEFORE
) ),
1994 aAfterText ( this, SVX_RES( FT_HYPHENAFTER
) ),
1995 aExtHyphenAfterBox ( this, SVX_RES( ED_HYPHENAFTER
) ),
1996 aMaxHyphenLabel ( this, SVX_RES( FT_MAXHYPH
) ),
1997 aMaxHyphenEdit ( this, SVX_RES( ED_MAXHYPH
) ),
1998 aExtFL ( this, SVX_RES( FL_HYPHEN
) ),
1999 aBreaksFL ( this, SVX_RES( FL_BREAKS
) ),
2000 aPageBreakBox ( this, SVX_RES( BTN_PAGEBREAK
) ),
2001 aBreakTypeFT ( this, SVX_RES( FT_BREAKTYPE
)),
2002 aBreakTypeLB ( this, SVX_RES( LB_BREAKTYPE
)),
2003 aBreakPositionFT ( this, SVX_RES( FT_BREAKPOSITION
)),
2004 aBreakPositionLB ( this, SVX_RES( LB_BREAKPOSITION
)),
2005 // aPageBox ( this, SVX_RES( BTN_BREAKPAGE ) ),
2006 // aColumnBox ( this, SVX_RES( BTN_BREAKCOLUMN ) ),
2007 // aBeforeBox ( this, SVX_RES( BTN_PAGEBREAKBEFORE ) ),
2008 // aAfterBox ( this, SVX_RES( BTN_PAGEBREAKAFTER ) ),
2009 aApplyCollBtn ( this, SVX_RES( BTN_PAGECOLL
) ),
2010 aApplyCollBox ( this, SVX_RES( LB_PAGECOLL
) ),
2011 aPagenumText ( this, SVX_RES( FT_PAGENUM
) ),
2012 aPagenumEdit ( this, SVX_RES( ED_PAGENUM
) ),
2013 aExtendFL ( this, SVX_RES( FL_OPTIONS
) ),
2014 aKeepTogetherBox ( this, SVX_RES( BTN_KEEPTOGETHER
) ),
2015 aKeepParaBox ( this, SVX_RES( CB_KEEPTOGETHER
) ),
2016 aOrphanBox ( this, SVX_RES( BTN_ORPHANS
) ),
2017 aOrphanRowNo ( this, SVX_RES( ED_ORPHANS
) ),
2018 aOrphanRowLabel ( this, SVX_RES( FT_ORPHANS
) ),
2019 aWidowBox ( this, SVX_RES( BTN_WIDOWS
) ),
2020 aWidowRowNo ( this, SVX_RES( ED_WIDOWS
) ),
2021 aWidowRowLabel ( this, SVX_RES( FT_WIDOWS
) ),
2022 bPageBreak ( TRUE
),
2023 bHtmlMode ( FALSE
),
2028 // diese Page braucht ExchangeSupport
2029 SetExchangeSupport();
2031 aHyphenBox
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, HyphenClickHdl_Impl
) );
2032 aPageBreakBox
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakHdl_Impl
) );
2033 aKeepTogetherBox
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
) );
2034 aWidowBox
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, WidowHdl_Impl
) );
2035 aOrphanBox
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, OrphanHdl_Impl
) );
2036 aApplyCollBtn
.SetClickHdl( LINK( this, SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
) );
2037 aBreakTypeLB
.SetSelectHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
) );
2038 aBreakPositionLB
.SetSelectHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
) );
2040 SfxObjectShell
* pSh
= SfxObjectShell::Current();
2043 SfxStyleSheetBasePool
* pPool
= pSh
->GetStyleSheetPool();
2044 pPool
->SetSearchMask( SFX_STYLE_FAMILY_PAGE
);
2045 SfxStyleSheetBase
* pStyle
= pPool
->First();
2050 if ( aStdName
.Len() == 0 )
2051 // first style == standard style
2052 aStdName
= pStyle
->GetName();
2053 aApplyCollBox
.InsertEntry( pStyle
->GetName() );
2054 pStyle
= pPool
->Next();
2056 nStdPos
= aApplyCollBox
.GetEntryPos( aStdName
);
2059 USHORT nHtmlMode
= GetHtmlMode_Impl( rAttr
);
2060 if ( nHtmlMode
& HTMLMODE_ON
)
2063 aHyphenBox
.Enable(FALSE
);
2064 aBeforeText
.Enable(FALSE
);
2065 aExtHyphenBeforeBox
.Enable(FALSE
);
2066 aAfterText
.Enable(FALSE
);
2067 aExtHyphenAfterBox
.Enable(FALSE
);
2068 aMaxHyphenLabel
.Enable(FALSE
);
2069 aMaxHyphenEdit
.Enable(FALSE
);
2070 aExtFL
.Enable(FALSE
);
2071 aPagenumText
.Enable(FALSE
);
2072 aPagenumEdit
.Enable(FALSE
);
2073 // no column break in HTML
2074 aBreakTypeLB
.RemoveEntry(1);
2078 // -----------------------------------------------------------------------
2080 __EXPORT
SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
2084 // -----------------------------------------------------------------------
2086 USHORT
* SvxExtParagraphTabPage::GetRanges()
2091 // -----------------------------------------------------------------------
2093 IMPL_LINK( SvxExtParagraphTabPage
, PageBreakHdl_Impl
, TriStateBox
*, EMPTYARG
)
2095 switch ( aPageBreakBox
.GetState() )
2098 aBreakTypeFT
.Enable();
2099 aBreakTypeLB
.Enable();
2100 aBreakPositionFT
.Enable();
2101 aBreakPositionLB
.Enable();
2103 if ( 0 == aBreakTypeLB
.GetSelectEntryPos()&&
2104 0 == aBreakPositionLB
.GetSelectEntryPos() )
2106 aApplyCollBtn
.Enable();
2108 BOOL bEnable
= STATE_CHECK
== aApplyCollBtn
.GetState() &&
2109 aApplyCollBox
.GetEntryCount();
2110 aApplyCollBox
.Enable(bEnable
);
2113 aPagenumText
.Enable(bEnable
);
2114 aPagenumEdit
.Enable(bEnable
);
2120 case STATE_DONTKNOW
:
2121 aApplyCollBtn
.SetState( STATE_NOCHECK
);
2122 aApplyCollBtn
.Enable(FALSE
);
2123 aApplyCollBox
.Enable(FALSE
);
2124 aPagenumText
.Enable(FALSE
);
2125 aPagenumEdit
.Enable(FALSE
);
2126 aBreakTypeFT
.Enable(FALSE
);
2127 aBreakTypeLB
.Enable(FALSE
);
2128 aBreakPositionFT
.Enable(FALSE
);
2129 aBreakPositionLB
.Enable(FALSE
);
2135 // -----------------------------------------------------------------------
2137 IMPL_LINK( SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
, TriStateBox
*, EMPTYARG
)
2139 BOOL bEnable
= aKeepTogetherBox
.GetState() == STATE_NOCHECK
;
2140 aWidowBox
.Enable(bEnable
);
2141 aOrphanBox
.Enable(bEnable
);
2146 // -----------------------------------------------------------------------
2148 IMPL_LINK( SvxExtParagraphTabPage
, WidowHdl_Impl
, TriStateBox
*, EMPTYARG
)
2150 switch ( aWidowBox
.GetState() )
2153 aWidowRowNo
.Enable();
2154 aWidowRowLabel
.Enable();
2155 aKeepTogetherBox
.Enable(FALSE
);
2159 if ( aOrphanBox
.GetState() == STATE_NOCHECK
)
2160 aKeepTogetherBox
.Enable();
2163 case STATE_DONTKNOW
:
2164 aWidowRowNo
.Enable(FALSE
);
2165 aWidowRowLabel
.Enable(FALSE
);
2171 // -----------------------------------------------------------------------
2173 IMPL_LINK( SvxExtParagraphTabPage
, OrphanHdl_Impl
, TriStateBox
*, EMPTYARG
)
2175 switch( aOrphanBox
.GetState() )
2178 aOrphanRowNo
.Enable();
2179 aOrphanRowLabel
.Enable();
2180 aKeepTogetherBox
.Enable(FALSE
);
2184 if ( aWidowBox
.GetState() == STATE_NOCHECK
)
2185 aKeepTogetherBox
.Enable();
2188 case STATE_DONTKNOW
:
2189 aOrphanRowNo
.Enable(FALSE
);
2190 aOrphanRowLabel
.Enable(FALSE
);
2196 // -----------------------------------------------------------------------
2198 IMPL_LINK( SvxExtParagraphTabPage
, HyphenClickHdl_Impl
, TriStateBox
*, EMPTYARG
)
2201 BOOL bEnable
= aHyphenBox
.GetState() == STATE_CHECK
;
2202 aBeforeText
.Enable(bEnable
);
2203 aExtHyphenBeforeBox
.Enable(bEnable
);
2204 aAfterText
.Enable(bEnable
);
2205 aExtHyphenAfterBox
.Enable(bEnable
);
2206 aMaxHyphenLabel
.Enable(bEnable
);
2207 aMaxHyphenEdit
.Enable(bEnable
);
2208 aHyphenBox
.SetState( bEnable
? STATE_CHECK
: STATE_NOCHECK
);
2213 // -----------------------------------------------------------------------
2215 IMPL_LINK( SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
, TriStateBox
*, EMPTYARG
)
2217 BOOL bEnable
= FALSE
;
2218 if ( aApplyCollBtn
.GetState() == STATE_CHECK
&&
2219 aApplyCollBox
.GetEntryCount() )
2222 aApplyCollBox
.SelectEntryPos( nStdPos
);
2226 aApplyCollBox
.SetNoSelection();
2228 aApplyCollBox
.Enable(bEnable
);
2231 aPagenumText
.Enable(bEnable
);
2232 aPagenumEdit
.Enable(bEnable
);
2237 // -----------------------------------------------------------------------
2239 IMPL_LINK( SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
, ListBox
*, pListBox
)
2241 if ( 0 == pListBox
->GetSelectEntryPos() )
2243 aApplyCollBtn
.Enable();
2245 BOOL bEnable
= aApplyCollBtn
.GetState() == STATE_CHECK
&&
2246 aApplyCollBox
.GetEntryCount();
2248 aApplyCollBox
.Enable(bEnable
);
2251 aPagenumText
.Enable(bEnable
);
2252 aPagenumEdit
.Enable(bEnable
);
2255 else if ( 1 == pListBox
->GetSelectEntryPos() )
2257 aApplyCollBtn
.SetState( STATE_NOCHECK
);
2258 aApplyCollBtn
.Enable(FALSE
);
2259 aApplyCollBox
.Enable(FALSE
);
2260 aPagenumText
.Enable(FALSE
);
2261 aPagenumEdit
.Enable(FALSE
);
2266 // -----------------------------------------------------------------------
2268 IMPL_LINK( SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
, ListBox
*, pListBox
)
2270 //column break or break break after
2271 USHORT nBreakPos
= aBreakPositionLB
.GetSelectEntryPos();
2272 if ( pListBox
->GetSelectEntryPos() == 1 || 1 == nBreakPos
)
2274 aApplyCollBtn
.SetState( STATE_NOCHECK
);
2275 aApplyCollBtn
.Enable(FALSE
);
2276 aApplyCollBox
.Enable(FALSE
);
2277 aPagenumText
.Enable(FALSE
);
2278 aPagenumEdit
.Enable(FALSE
);
2281 PageBreakPosHdl_Impl( &aBreakPositionLB
);
2284 //Add CHINA001 begin
2285 void SvxExtParagraphTabPage::PageCreated(SfxAllItemSet aSet
)
2289 SFX_ITEMSET_ARG (&aSet
,pDisablePageBreakItem
,SfxBoolItem
,SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK
,sal_False
);
2291 if (pDisablePageBreakItem
)
2292 if ( pDisablePageBreakItem
->GetValue())
2297 //end of Add CHINA001
2298 /*-- 29.11.00 11:36:24---------------------------------------------------
2300 -----------------------------------------------------------------------*/
2301 SvxAsianTabPage::SvxAsianTabPage( Window
* pParent
, const SfxItemSet
& rSet
) :
2302 SfxTabPage(pParent
, SVX_RES( RID_SVXPAGE_PARA_ASIAN
), rSet
),
2303 aOptionsFL( this, SVX_RES(FL_AS_OPTIONS
)),
2304 aForbiddenRulesCB( this, SVX_RES(CB_AS_FORBIDDEN
)),
2305 aHangingPunctCB( this, SVX_RES(CB_AS_HANG_PUNC
)),
2306 aScriptSpaceCB( this, SVX_RES(CB_AS_SCRIPT_SPACE
))//,
2311 Link aLink
= LINK( this, SvxAsianTabPage
, ClickHdl_Impl
);
2312 aHangingPunctCB
.SetClickHdl( aLink
);
2313 aScriptSpaceCB
.SetClickHdl( aLink
);
2314 aForbiddenRulesCB
.SetClickHdl( aLink
);
2317 /*-- 29.11.00 11:36:24---------------------------------------------------
2319 -----------------------------------------------------------------------*/
2320 SvxAsianTabPage::~SvxAsianTabPage()
2323 /*-- 29.11.00 11:36:24---------------------------------------------------
2325 -----------------------------------------------------------------------*/
2326 SfxTabPage
* SvxAsianTabPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
2328 return new SvxAsianTabPage(pParent
, rSet
);
2330 /*-- 29.11.00 11:36:24---------------------------------------------------
2332 -----------------------------------------------------------------------*/
2333 USHORT
* SvxAsianTabPage::GetRanges()
2335 static USHORT pRanges
[] =
2337 SID_ATTR_PARA_SCRIPTSPACE
, SID_ATTR_PARA_FORBIDDEN_RULES
,
2342 /*-- 29.11.00 11:36:24---------------------------------------------------
2344 -----------------------------------------------------------------------*/
2345 BOOL
SvxAsianTabPage::FillItemSet( SfxItemSet
& rSet
)
2348 SfxItemPool
* pPool
= rSet
.GetPool();
2349 if(aScriptSpaceCB
.IsChecked() != aScriptSpaceCB
.GetSavedValue())
2351 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2352 pPool
->GetWhich(SID_ATTR_PARA_SCRIPTSPACE
)).Clone();
2353 pNewItem
->SetValue(aScriptSpaceCB
.IsChecked());
2354 rSet
.Put(*pNewItem
);
2358 if(aHangingPunctCB
.IsChecked() != aHangingPunctCB
.GetSavedValue())
2360 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2361 pPool
->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION
)).Clone();
2362 pNewItem
->SetValue(aHangingPunctCB
.IsChecked());
2363 rSet
.Put(*pNewItem
);
2367 if(aForbiddenRulesCB
.IsChecked() != aForbiddenRulesCB
.GetSavedValue())
2369 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2370 pPool
->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES
)).Clone();
2371 pNewItem
->SetValue(aForbiddenRulesCB
.IsChecked());
2372 rSet
.Put(*pNewItem
);
2378 /*-- 29.11.00 11:36:25---------------------------------------------------
2380 -----------------------------------------------------------------------*/
2381 void lcl_SetBox(const SfxItemSet
& rSet
, USHORT nSlotId
, TriStateBox
& rBox
)
2383 USHORT _nWhich
= rSet
.GetPool()->GetWhich(nSlotId
);
2384 SfxItemState eState
= rSet
.GetItemState(_nWhich
, TRUE
);
2385 if(!eState
|| eState
== SFX_ITEM_DISABLED
)
2387 else if(eState
>= SFX_ITEM_AVAILABLE
)
2389 rBox
.EnableTriState( FALSE
);
2390 rBox
.Check(((const SfxBoolItem
&)rSet
.Get(_nWhich
)).GetValue());
2393 rBox
.SetState( STATE_DONTKNOW
);
2398 void SvxAsianTabPage::Reset( const SfxItemSet
& rSet
)
2400 lcl_SetBox(rSet
, SID_ATTR_PARA_FORBIDDEN_RULES
, aForbiddenRulesCB
);
2401 // lcl_SetBox(rSet, , aAllowWordBreakCB );
2402 lcl_SetBox(rSet
, SID_ATTR_PARA_HANGPUNCTUATION
, aHangingPunctCB
);
2405 //character distance not yet available
2406 // lcl_SetBox(rSet, , aPuntuationCB );
2407 lcl_SetBox(rSet
, SID_ATTR_PARA_SCRIPTSPACE
, aScriptSpaceCB
);
2408 // lcl_SetBox(rSet, , aAdjustNumbersCB );
2409 // aAllowWordBreakCB .Enable(FALSE);
2410 // aPuntuationCB .Enable(FALSE);
2411 // aAdjustNumbersCB .Enable(FALSE);
2413 /* -----------------------------19.12.00 12:59--------------------------------
2415 ---------------------------------------------------------------------------*/
2416 IMPL_LINK( SvxAsianTabPage
, ClickHdl_Impl
, TriStateBox
*, pBox
)
2418 pBox
->EnableTriState( FALSE
);