1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svl/style.hxx>
21 #include <sfx2/app.hxx>
22 #include <sfx2/dialoghelper.hxx>
23 #include <sfx2/objsh.hxx>
24 #include <sfx2/module.hxx>
25 #include <vcl/mnemonic.hxx>
26 #include <svx/dialogs.hrc>
28 #include <svl/languageoptions.hxx>
29 #include <svl/cjkoptions.hxx>
30 #include <editeng/pgrditem.hxx>
32 #include "paragrph.hrc"
33 #include "paragrph.hxx"
34 #include <editeng/frmdiritem.hxx>
35 #include <editeng/lspcitem.hxx>
36 #include <editeng/adjustitem.hxx>
37 #include <editeng/orphitem.hxx>
38 #include <editeng/widwitem.hxx>
39 #include <editeng/tstpitem.hxx>
40 #include <editeng/pmdlitem.hxx>
41 #include <editeng/spltitem.hxx>
42 #include <editeng/hyphenzoneitem.hxx>
43 #include <editeng/ulspitem.hxx>
44 #include <editeng/lrspitem.hxx>
45 #include <editeng/formatbreakitem.hxx>
46 #include <editeng/keepitem.hxx>
47 #include "svx/dlgutil.hxx"
48 #include <dialmgr.hxx>
49 #include <sfx2/htmlmode.hxx>
50 #include <editeng/paravertalignitem.hxx>
51 #include <svl/eitem.hxx>
52 #include <sfx2/request.hxx>
53 #include <svl/intitem.hxx>
55 static const sal_uInt16 pStdRanges
[] =
57 SID_ATTR_PARA_LINESPACE
, // 10033
58 SID_ATTR_PARA_LINESPACE
,
59 SID_ATTR_LRSPACE
, // 10048 -
60 SID_ATTR_ULSPACE
, // 10049
61 SID_ATTR_PARA_REGISTER
, // 10413
62 SID_ATTR_PARA_REGISTER
,
66 static const sal_uInt16 pAlignRanges
[] =
68 SID_ATTR_PARA_ADJUST
, // 10027
73 static const sal_uInt16 pExtRanges
[] =
75 SID_ATTR_PARA_PAGEBREAK
, // 10037 -
76 SID_ATTR_PARA_WIDOWS
, // 10041
77 SID_ATTR_PARA_MODEL
, // 10065 -
78 SID_ATTR_PARA_KEEP
, // 10066
82 #define MAX_DURCH 5670 // 10 cm makes sense as maximum interline lead
84 #define FIX_DIST_DEF 283 // standard fix distance 0,5 cm
98 void SetLineSpace_Impl( SvxLineSpacingItem
&, int, long lValue
= 0 );
100 void SetLineSpace_Impl( SvxLineSpacingItem
& rLineSpace
,
101 int eSpace
, long lValue
)
106 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
107 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
111 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
112 rLineSpace
.SetPropLineSpace( 150 );
116 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
117 rLineSpace
.SetPropLineSpace( 200 );
120 case LLINESPACE_PROP
:
121 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
122 rLineSpace
.SetPropLineSpace( (sal_uInt8
)lValue
);
126 rLineSpace
.SetLineHeight( (sal_uInt16
)lValue
);
127 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
130 case LLINESPACE_DURCH
:
131 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO
;
132 rLineSpace
.SetInterLineSpace( (sal_uInt16
)lValue
);
136 rLineSpace
.SetLineHeight((sal_uInt16
)lValue
);
137 rLineSpace
.GetLineSpaceRule() = SVX_LINE_SPACE_FIX
;
138 rLineSpace
.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF
;
143 sal_uInt16
GetHtmlMode_Impl(const SfxItemSet
& rSet
)
145 sal_uInt16 nHtmlMode
= 0;
146 const SfxPoolItem
* pItem
= 0;
147 SfxObjectShell
* pShell
;
148 if(SFX_ITEM_SET
== rSet
.GetItemState(SID_HTML_MODE
, false, &pItem
) ||
149 ( 0 != (pShell
= SfxObjectShell::Current()) &&
150 0 != (pItem
= pShell
->GetItem(SID_HTML_MODE
))))
152 nHtmlMode
= ((SfxUInt16Item
*)pItem
)->GetValue();
158 IMPL_LINK_NOARG(SvxStdParagraphTabPage
, ELRLoseFocusHdl
)
160 SfxItemPool
* pPool
= GetItemSet().GetPool();
161 DBG_ASSERT( pPool
, "Wo ist der Pool" );
163 MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
165 sal_Int64 nL
= m_pLeftIndent
->Denormalize( m_pLeftIndent
->GetValue( eUnit
) );
166 sal_Int64 nR
= m_pRightIndent
->Denormalize( m_pRightIndent
->GetValue( eUnit
) );
167 OUString aTmp
= m_pFLineIndent
->GetText();
169 if( m_pLeftIndent
->GetMin() < 0 )
170 m_pFLineIndent
->SetMin( -99999, FUNIT_MM
);
172 m_pFLineIndent
->SetMin( m_pFLineIndent
->Normalize( -nL
), eUnit
);
174 // Check only for concrete width (Shell)
175 sal_Int64 nTmp
= nWidth
- nL
- nR
- MM50
;
176 m_pFLineIndent
->SetMax( m_pFLineIndent
->Normalize( nTmp
), eUnit
);
178 if ( aTmp
.isEmpty() )
179 m_pFLineIndent
->SetEmptyFieldValue();
180 // maximum left right
181 aTmp
= m_pLeftIndent
->GetText();
182 nTmp
= nWidth
- nR
- MM50
;
183 m_pLeftIndent
->SetMax( m_pLeftIndent
->Normalize( nTmp
), eUnit
);
185 if ( aTmp
.isEmpty() )
186 m_pLeftIndent
->SetEmptyFieldValue();
187 aTmp
= m_pRightIndent
->GetText();
188 nTmp
= nWidth
- nL
- MM50
;
189 m_pRightIndent
->SetMax( m_pRightIndent
->Normalize( nTmp
), eUnit
);
191 if ( aTmp
.isEmpty() )
192 m_pRightIndent
->SetEmptyFieldValue();
196 SfxTabPage
* SvxStdParagraphTabPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
198 return new SvxStdParagraphTabPage( pParent
, rSet
);
201 bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet
& rOutSet
)
203 SfxItemState eState
= SFX_ITEM_UNKNOWN
;
204 const SfxPoolItem
* pOld
= 0;
205 SfxItemPool
* pPool
= rOutSet
.GetPool();
206 DBG_ASSERT( pPool
, "Wo ist der Pool" );
208 bool bModified
= false;
210 sal_Int32 nPos
= m_pLineDist
->GetSelectEntryPos();
212 if ( LISTBOX_ENTRY_NOTFOUND
!= nPos
&&
213 ( m_pLineDist
->IsValueChangedFromSaved() ||
214 m_pLineDistAtPercentBox
->IsValueModified() ||
215 m_pLineDistAtMetricBox
->IsValueModified() ) )
217 nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
218 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
219 SvxLineSpacingItem
aSpacing(
220 (const SvxLineSpacingItem
&)GetItemSet().Get( nWhich
) );
227 SetLineSpace_Impl( aSpacing
, nPos
);
230 case LLINESPACE_PROP
:
231 SetLineSpace_Impl( aSpacing
, nPos
,
232 static_cast<long>(m_pLineDistAtPercentBox
->Denormalize(
233 m_pLineDistAtPercentBox
->GetValue() )) );
237 case LLINESPACE_DURCH
:
239 SetLineSpace_Impl( aSpacing
, nPos
,
240 GetCoreValue( *m_pLineDistAtMetricBox
, eUnit
) );
244 OSL_FAIL( "unbekannter Type fuer Zeilenabstand." );
247 eState
= GetItemSet().GetItemState( nWhich
);
248 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_LINESPACE
);
250 if ( !pOld
|| !( *(const SvxLineSpacingItem
*)pOld
== aSpacing
) ||
251 SFX_ITEM_DONTCARE
== eState
)
253 rOutSet
.Put( aSpacing
);
258 if ( m_pTopDist
->IsValueModified() || m_pBottomDist
->IsValueModified()
259 || m_pContextualCB
->IsValueChangedFromSaved())
261 nWhich
= GetWhich( SID_ATTR_ULSPACE
);
262 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
263 pOld
= GetOldItem( rOutSet
, SID_ATTR_ULSPACE
);
264 SvxULSpaceItem
aMargin( nWhich
);
268 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
270 const SvxULSpaceItem
& rOldItem
=
271 (const SvxULSpaceItem
&)GetItemSet().GetParent()->Get( nWhich
);
273 if ( m_pTopDist
->IsRelative() )
274 aMargin
.SetUpper( rOldItem
.GetUpper(),
275 (sal_uInt16
)m_pTopDist
->GetValue() );
277 aMargin
.SetUpper( (sal_uInt16
)GetCoreValue( *m_pTopDist
, eUnit
) );
279 if ( m_pBottomDist
->IsRelative() )
280 aMargin
.SetLower( rOldItem
.GetLower(),
281 (sal_uInt16
)m_pBottomDist
->GetValue() );
283 aMargin
.SetLower( (sal_uInt16
)GetCoreValue( *m_pBottomDist
, eUnit
) );
288 aMargin
.SetUpper( (sal_uInt16
)GetCoreValue( *m_pTopDist
, eUnit
) );
289 aMargin
.SetLower( (sal_uInt16
)GetCoreValue( *m_pBottomDist
, eUnit
) );
291 aMargin
.SetContextValue(m_pContextualCB
->IsChecked());
292 eState
= GetItemSet().GetItemState( nWhich
);
294 if ( !pOld
|| !( *(const SvxULSpaceItem
*)pOld
== aMargin
) ||
295 SFX_ITEM_DONTCARE
== eState
)
297 rOutSet
.Put( aMargin
);
301 bool bNullTab
= false;
303 if ( m_pLeftIndent
->IsValueModified() ||
304 m_pFLineIndent
->IsValueModified() ||
305 m_pRightIndent
->IsValueModified() ||
306 m_pAutoCB
->IsValueChangedFromSaved() )
308 nWhich
= GetWhich( SID_ATTR_LRSPACE
);
309 SfxMapUnit eUnit
= pPool
->GetMetric( nWhich
);
310 SvxLRSpaceItem
aMargin( nWhich
);
311 pOld
= GetOldItem( rOutSet
, SID_ATTR_LRSPACE
);
315 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
317 const SvxLRSpaceItem
& rOldItem
=
318 (const SvxLRSpaceItem
&)GetItemSet().GetParent()->Get( nWhich
);
320 if ( m_pLeftIndent
->IsRelative() )
321 aMargin
.SetTxtLeft( rOldItem
.GetTxtLeft(),
322 (sal_uInt16
)m_pLeftIndent
->GetValue() );
324 aMargin
.SetTxtLeft( GetCoreValue( *m_pLeftIndent
, eUnit
) );
326 if ( m_pRightIndent
->IsRelative() )
327 aMargin
.SetRight( rOldItem
.GetRight(),
328 (sal_uInt16
)m_pRightIndent
->GetValue() );
330 aMargin
.SetRight( GetCoreValue( *m_pRightIndent
, eUnit
) );
332 if ( m_pFLineIndent
->IsRelative() )
333 aMargin
.SetTxtFirstLineOfst( rOldItem
.GetTxtFirstLineOfst(),
334 (sal_uInt16
)m_pFLineIndent
->GetValue() );
336 aMargin
.SetTxtFirstLineOfst(
337 (sal_uInt16
)GetCoreValue( *m_pFLineIndent
, eUnit
) );
341 aMargin
.SetTxtLeft( GetCoreValue( *m_pLeftIndent
, eUnit
) );
342 aMargin
.SetRight( GetCoreValue( *m_pRightIndent
, eUnit
) );
343 aMargin
.SetTxtFirstLineOfst(
344 (sal_uInt16
)GetCoreValue( *m_pFLineIndent
, eUnit
) );
346 aMargin
.SetAutoFirst(m_pAutoCB
->IsChecked());
347 if ( aMargin
.GetTxtFirstLineOfst() < 0 )
349 eState
= GetItemSet().GetItemState( nWhich
);
351 if ( !pOld
|| !( *(const SvxLRSpaceItem
*)pOld
== aMargin
) ||
352 SFX_ITEM_DONTCARE
== eState
)
354 rOutSet
.Put( aMargin
);
361 MapUnit eUnit
= (MapUnit
)pPool
->GetMetric( GetWhich( SID_ATTR_TABSTOP
) );
362 if ( MAP_100TH_MM
!= eUnit
)
365 // negative first line indent -> set null default tabstob if applicable
366 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_TABSTOP
);
367 const SfxItemSet
& rInSet
= GetItemSet();
369 if ( rInSet
.GetItemState( _nWhich
) >= SFX_ITEM_AVAILABLE
)
371 const SvxTabStopItem
& rTabItem
=
372 (const SvxTabStopItem
&)rInSet
.Get( _nWhich
);
373 SvxTabStopItem
aNullTab( rTabItem
);
374 SvxTabStop
aNull( 0, SVX_TAB_ADJUST_DEFAULT
);
375 aNullTab
.Insert( aNull
);
376 rOutSet
.Put( aNullTab
);
380 if( m_pRegisterCB
->IsVisible())
382 const SfxBoolItem
* pBoolItem
= (SfxBoolItem
*)GetOldItem(
383 rOutSet
, SID_ATTR_PARA_REGISTER
);
386 SfxBoolItem
* pRegItem
= (SfxBoolItem
*)pBoolItem
->Clone();
387 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
388 bool bSet
= pRegItem
->GetValue();
390 if(m_pRegisterCB
->IsChecked() != bSet
)
392 pRegItem
->SetValue(!bSet
);
393 rOutSet
.Put(*pRegItem
);
396 else if ( SFX_ITEM_DEFAULT
== GetItemSet().GetItemState( _nWhich
, false ) )
397 rOutSet
.ClearItem(_nWhich
);
404 void SvxStdParagraphTabPage::Reset( const SfxItemSet
& rSet
)
406 SfxItemPool
* pPool
= rSet
.GetPool();
407 DBG_ASSERT( pPool
, "Wo ist der Pool?" );
410 FieldUnit eFUnit
= GetModuleFieldUnit( rSet
);
412 bool bApplyCharUnit
= GetApplyCharUnit( rSet
);
414 SvtCJKOptions aCJKOptions
;
415 if(aCJKOptions
.IsAsianTypographyEnabled() && bApplyCharUnit
)
418 SetFieldUnit( *m_pLeftIndent
, eFUnit
);
419 SetFieldUnit( *m_pRightIndent
, eFUnit
);
420 SetFieldUnit( *m_pFLineIndent
, eFUnit
);
421 if ( eFUnit
== FUNIT_CHAR
)
423 SetFieldUnit( *m_pTopDist
, FUNIT_LINE
);
424 SetFieldUnit( *m_pBottomDist
, FUNIT_LINE
);
425 SetFieldUnit( *m_pLineDistAtMetricBox
, FUNIT_POINT
);
429 SetFieldUnit( *m_pTopDist
, eFUnit
);
430 SetFieldUnit( *m_pBottomDist
, eFUnit
);
431 SetFieldUnit( *m_pLineDistAtMetricBox
, eFUnit
);
434 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_LRSPACE
);
435 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
437 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
439 SfxMapUnit eUnit
= pPool
->GetMetric( _nWhich
);
443 const SvxLRSpaceItem
& rOldItem
=
444 (const SvxLRSpaceItem
&)rSet
.Get( _nWhich
);
446 if ( rOldItem
.GetPropLeft() != 100 )
448 m_pLeftIndent
->SetRelative( true );
449 m_pLeftIndent
->SetValue( rOldItem
.GetPropLeft() );
453 m_pLeftIndent
->SetRelative();
454 SetFieldUnit( *m_pLeftIndent
, eFUnit
);
455 SetMetricValue( *m_pLeftIndent
, rOldItem
.GetTxtLeft(), eUnit
);
458 if ( rOldItem
.GetPropRight() != 100 )
460 m_pRightIndent
->SetRelative( true );
461 m_pRightIndent
->SetValue( rOldItem
.GetPropRight() );
465 m_pRightIndent
->SetRelative();
466 SetFieldUnit( *m_pRightIndent
, eFUnit
);
467 SetMetricValue( *m_pRightIndent
, rOldItem
.GetRight(), eUnit
);
470 if ( rOldItem
.GetPropTxtFirstLineOfst() != 100 )
472 m_pFLineIndent
->SetRelative( true );
473 m_pFLineIndent
->SetValue( rOldItem
.GetPropTxtFirstLineOfst() );
477 m_pFLineIndent
->SetRelative();
478 m_pFLineIndent
->SetMin(-9999);
479 SetFieldUnit( *m_pFLineIndent
, eFUnit
);
480 SetMetricValue( *m_pFLineIndent
, rOldItem
.GetTxtFirstLineOfst(),
483 m_pAutoCB
->Check(rOldItem
.IsAutoFirst());
487 const SvxLRSpaceItem
& rSpace
=
488 (const SvxLRSpaceItem
&)rSet
.Get( _nWhich
);
490 SetMetricValue( *m_pLeftIndent
, rSpace
.GetTxtLeft(), eUnit
);
491 SetMetricValue( *m_pRightIndent
, rSpace
.GetRight(), eUnit
);
492 SetMetricValue( *m_pFLineIndent
, rSpace
.GetTxtFirstLineOfst(), eUnit
);
493 m_pAutoCB
->Check(rSpace
.IsAutoFirst());
495 AutoHdl_Impl(m_pAutoCB
);
499 m_pLeftIndent
->SetEmptyFieldValue();
500 m_pRightIndent
->SetEmptyFieldValue();
501 m_pFLineIndent
->SetEmptyFieldValue();
504 _nWhich
= GetWhich( SID_ATTR_ULSPACE
);
505 eItemState
= rSet
.GetItemState( _nWhich
);
507 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
509 SfxMapUnit eUnit
= pPool
->GetMetric( _nWhich
);
511 const SvxULSpaceItem
& rOldItem
=
512 (const SvxULSpaceItem
&)rSet
.Get( _nWhich
);
516 if ( rOldItem
.GetPropUpper() != 100 )
518 m_pTopDist
->SetRelative( true );
519 m_pTopDist
->SetValue( rOldItem
.GetPropUpper() );
523 m_pTopDist
->SetRelative();
524 if ( eFUnit
== FUNIT_CHAR
)
525 SetFieldUnit( *m_pTopDist
, FUNIT_LINE
);
527 SetFieldUnit( *m_pTopDist
, eFUnit
);
528 SetMetricValue( *m_pTopDist
, rOldItem
.GetUpper(), eUnit
);
531 if ( rOldItem
.GetPropLower() != 100 )
533 m_pBottomDist
->SetRelative( true );
534 m_pBottomDist
->SetValue( rOldItem
.GetPropLower() );
538 m_pBottomDist
->SetRelative();
539 if ( eFUnit
== FUNIT_CHAR
)
540 SetFieldUnit( *m_pBottomDist
, FUNIT_LINE
);
542 SetFieldUnit( *m_pBottomDist
, eFUnit
);
543 SetMetricValue( *m_pBottomDist
, rOldItem
.GetLower(), eUnit
);
548 SetMetricValue( *m_pTopDist
, rOldItem
.GetUpper(), eUnit
);
549 SetMetricValue( *m_pBottomDist
, rOldItem
.GetLower(), eUnit
);
551 m_pContextualCB
->Check(rOldItem
.GetContext());
555 m_pTopDist
->SetEmptyFieldValue();
556 m_pBottomDist
->SetEmptyFieldValue();
559 _nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
560 eItemState
= rSet
.GetItemState( _nWhich
);
562 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
563 SetLineSpacing_Impl( (const SvxLineSpacingItem
&)rSet
.Get( _nWhich
) );
565 m_pLineDist
->SetNoSelection();
567 _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
568 eItemState
= rSet
.GetItemState( _nWhich
);
570 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
571 m_pRegisterCB
->Check( ((const SfxBoolItem
&)rSet
.Get( _nWhich
)).GetValue());
572 m_pRegisterCB
->SaveValue();
573 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(rSet
);
574 if(nHtmlMode
& HTMLMODE_ON
)
576 m_pRegisterFL
->Hide();
577 m_pRegisterCB
->Hide();
580 if(!(nHtmlMode
& HTMLMODE_SOME_STYLES
)) // IE or SW
582 m_pRightLabel
->Disable();
583 m_pRightIndent
->Disable();
584 m_pTopDist
->Disable(); //HTML3.2 and NS 3.0
585 m_pBottomDist
->Disable();
586 m_pFLineIndent
->Disable();
587 m_pFLineLabel
->Disable();
591 // this sets the min/max limits; do this _after_ setting the values,
592 // because for Impress the min of first-line indent depends on value of
594 ELRLoseFocusHdl( NULL
);
595 m_pAutoCB
->SaveValue();
596 m_pContextualCB
->SaveValue();
597 m_pLineDist
->SaveValue();
600 void SvxStdParagraphTabPage::EnableRelativeMode()
602 DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
604 m_pLeftIndent
->EnableRelativeMode( 0, 999 );
605 m_pFLineIndent
->EnableRelativeMode( 0, 999 );
606 m_pRightIndent
->EnableRelativeMode( 0, 999 );
607 m_pTopDist
->EnableRelativeMode( 0, 999 );
608 m_pBottomDist
->EnableRelativeMode( 0, 999 );
609 bRelativeMode
= true;
612 int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
614 ELRLoseFocusHdl( NULL
);
617 FillItemSet( *_pSet
);
621 SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window
* pParent
, const SfxItemSet
& rAttr
) :
622 SfxTabPage( pParent
, "ParaIndentSpacing","cui/ui/paraindentspacing.ui", rAttr
),
625 nWidth ( 11905 /*567 * 50*/ ),
628 bRelativeMode ( false ),
629 bNegativeIndents(false)
632 get(m_pLeftIndent
,"spinED_LEFTINDENT");
633 get(m_pRightIndent
,"spinED_RIGHTINDENT");
634 get(m_pRightLabel
,"labelFT_RIGHTINDENT");
635 get(m_pFLineLabel
,"labelFT_FLINEINDENT");
636 get(m_pFLineIndent
,"spinED_FLINEINDENT");
637 get(m_pAutoCB
,"checkCB_AUTO");
639 get(m_pTopDist
,"spinED_TOPDIST");
640 get(m_pBottomDist
,"spinED_BOTTOMDIST");
641 get(m_pContextualCB
,"checkCB_CONTEXTUALSPACING");
643 get(m_pLineDist
,"comboLB_LINEDIST");
644 get(m_pLineDistAtPercentBox
,"spinED_LINEDISTPERCENT");
645 get(m_pLineDistAtMetricBox
,"spinED_LINEDISTMETRIC");
646 get(m_pLineDistAtLabel
,"labelFT_LINEDIST");
648 get(m_pAbsDist
,"labelST_LINEDIST_ABS");
649 sAbsDist
= m_pAbsDist
->GetText();
651 get(m_pRegisterFL
,"frameFL_REGISTER");
652 get(m_pRegisterCB
,"checkCB_REGISTER");
654 get(m_pExampleWin
,"drawingareaWN_EXAMPLE");
656 // this page needs ExchangeSupport
657 SetExchangeSupport();
659 m_pLineDistAtMetricBox
->Hide();
662 m_pFLineIndent
->SetMin(-9999); // is set to 0 on default
664 setPreviewsToSamePlace(pParent
, this);
667 SvxStdParagraphTabPage::~SvxStdParagraphTabPage()
671 void SvxStdParagraphTabPage::EnableNegativeMode()
673 m_pLeftIndent
->SetMin(-9999);
674 m_pRightIndent
->SetMin(-9999);
675 m_pRightIndent
->EnableNegativeMode();
676 m_pLeftIndent
->EnableNegativeMode();
677 bNegativeIndents
= true;
680 const sal_uInt16
* SvxStdParagraphTabPage::GetRanges()
685 void SvxStdParagraphTabPage::SetLineSpacing_Impl
687 const SvxLineSpacingItem
&rAttr
690 SfxMapUnit eUnit
= GetItemSet().GetPool()->GetMetric( rAttr
.Which() );
692 switch( rAttr
.GetLineSpaceRule() )
694 case SVX_LINE_SPACE_AUTO
:
696 SvxInterLineSpace eInter
= rAttr
.GetInterLineSpaceRule();
700 // Default single line spacing
701 case SVX_INTER_LINE_SPACE_OFF
:
702 m_pLineDist
->SelectEntryPos( LLINESPACE_1
);
705 // Default single line spacing
706 case SVX_INTER_LINE_SPACE_PROP
:
707 if ( 100 == rAttr
.GetPropLineSpace() )
709 m_pLineDist
->SelectEntryPos( LLINESPACE_1
);
713 if ( 150 == rAttr
.GetPropLineSpace() )
715 m_pLineDist
->SelectEntryPos( LLINESPACE_15
);
718 // double line spacing
719 if ( 200 == rAttr
.GetPropLineSpace() )
721 m_pLineDist
->SelectEntryPos( LLINESPACE_2
);
724 // the set per cent value
725 m_pLineDistAtPercentBox
->SetValue( m_pLineDistAtPercentBox
->Normalize(rAttr
.GetPropLineSpace() ) );
726 m_pLineDist
->SelectEntryPos( LLINESPACE_PROP
);
729 case SVX_INTER_LINE_SPACE_FIX
:
730 SetMetricValue( *m_pLineDistAtMetricBox
, rAttr
.GetInterLineSpace(), eUnit
);
731 m_pLineDist
->SelectEntryPos( LLINESPACE_DURCH
);
733 default: ;//prevent warning
737 case SVX_LINE_SPACE_FIX
:
738 SetMetricValue(*m_pLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
739 m_pLineDist
->SelectEntryPos( LLINESPACE_FIX
);
742 case SVX_LINE_SPACE_MIN
:
743 SetMetricValue(*m_pLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
744 m_pLineDist
->SelectEntryPos( LLINESPACE_MIN
);
746 default: ;//prevent warning
748 LineDistHdl_Impl( m_pLineDist
);
751 IMPL_LINK( SvxStdParagraphTabPage
, LineDistHdl_Impl
, ListBox
*, pBox
)
753 switch( pBox
->GetSelectEntryPos() )
758 m_pLineDistAtLabel
->Enable(false);
759 m_pLineDistAtPercentBox
->Enable(false);
760 m_pLineDistAtPercentBox
->SetText( OUString() );
761 m_pLineDistAtMetricBox
->Enable(false);
762 m_pLineDistAtMetricBox
->SetText( OUString() );
765 case LLINESPACE_DURCH
:
766 // setting a sensible default?
767 // limit MS min(10, aPageSize)
768 m_pLineDistAtMetricBox
->SetMin(0);
770 if ( m_pLineDistAtMetricBox
->GetText().isEmpty() )
771 m_pLineDistAtMetricBox
->SetValue( m_pLineDistAtMetricBox
->Normalize( 1 ) );
772 m_pLineDistAtPercentBox
->Hide();
773 m_pLineDistAtMetricBox
->Show();
774 m_pLineDistAtMetricBox
->Enable();
775 m_pLineDistAtLabel
->Enable();
779 m_pLineDistAtMetricBox
->SetMin(0);
781 if ( m_pLineDistAtMetricBox
->GetText().isEmpty() )
782 m_pLineDistAtMetricBox
->SetValue( m_pLineDistAtMetricBox
->Normalize( 10 ), FUNIT_TWIP
);
783 m_pLineDistAtPercentBox
->Hide();
784 m_pLineDistAtMetricBox
->Show();
785 m_pLineDistAtMetricBox
->Enable();
786 m_pLineDistAtLabel
->Enable();
789 case LLINESPACE_PROP
:
791 if ( m_pLineDistAtPercentBox
->GetText().isEmpty() )
792 m_pLineDistAtPercentBox
->SetValue( m_pLineDistAtPercentBox
->Normalize( 100 ), FUNIT_TWIP
);
793 m_pLineDistAtMetricBox
->Hide();
794 m_pLineDistAtPercentBox
->Show();
795 m_pLineDistAtPercentBox
->Enable();
796 m_pLineDistAtLabel
->Enable();
800 sal_Int64 nTemp
= m_pLineDistAtMetricBox
->GetValue();
801 m_pLineDistAtMetricBox
->SetMin(m_pLineDistAtMetricBox
->Normalize(nMinFixDist
), FUNIT_TWIP
);
803 // if the value has been changed at SetMin,
804 // it is time for the default
805 if ( m_pLineDistAtMetricBox
->GetValue() != nTemp
)
806 SetMetricValue( *m_pLineDistAtMetricBox
, FIX_DIST_DEF
, SFX_MAPUNIT_TWIP
); // fix is only in Writer
807 m_pLineDistAtPercentBox
->Hide();
808 m_pLineDistAtMetricBox
->Show();
809 m_pLineDistAtMetricBox
->Enable();
810 m_pLineDistAtLabel
->Enable();
814 UpdateExample_Impl( true );
818 IMPL_LINK_NOARG_INLINE_START(SvxStdParagraphTabPage
, ModifyHdl_Impl
)
820 UpdateExample_Impl();
823 IMPL_LINK_NOARG_INLINE_END(SvxStdParagraphTabPage
, ModifyHdl_Impl
)
825 void SvxStdParagraphTabPage::Init_Impl()
827 m_pLineDist
->SetSelectHdl(
828 LINK( this, SvxStdParagraphTabPage
, LineDistHdl_Impl
) );
830 Link aLink
= LINK( this, SvxStdParagraphTabPage
, ELRLoseFocusHdl
);
831 m_pFLineIndent
->SetLoseFocusHdl( aLink
);
832 m_pLeftIndent
->SetLoseFocusHdl( aLink
);
833 m_pRightIndent
->SetLoseFocusHdl( aLink
);
835 aLink
= LINK( this, SvxStdParagraphTabPage
, ModifyHdl_Impl
);
836 m_pFLineIndent
->SetModifyHdl( aLink
);
837 m_pLeftIndent
->SetModifyHdl( aLink
);
838 m_pRightIndent
->SetModifyHdl( aLink
);
839 m_pTopDist
->SetModifyHdl( aLink
);
840 m_pBottomDist
->SetModifyHdl( aLink
);
842 m_pAutoCB
->SetClickHdl( LINK( this, SvxStdParagraphTabPage
, AutoHdl_Impl
));
843 SfxItemPool
* pPool
= GetItemSet().GetPool();
844 DBG_ASSERT( pPool
, "Wo ist der Pool" );
845 FieldUnit eUnit
= MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
847 m_pTopDist
->SetMax( m_pTopDist
->Normalize( nAbst
), eUnit
);
848 m_pBottomDist
->SetMax( m_pBottomDist
->Normalize( nAbst
), eUnit
);
849 m_pLineDistAtMetricBox
->SetMax( m_pLineDistAtMetricBox
->Normalize( nAbst
), eUnit
);
852 void SvxStdParagraphTabPage::UpdateExample_Impl( bool bAll
)
854 m_pExampleWin
->SetFirstLineOfst( (short)m_pFLineIndent
->Denormalize( m_pFLineIndent
->GetValue( FUNIT_TWIP
) ) );
855 m_pExampleWin
->SetLeftMargin( static_cast<long>(m_pLeftIndent
->Denormalize( m_pLeftIndent
->GetValue( FUNIT_TWIP
) ) ) );
856 m_pExampleWin
->SetRightMargin( static_cast<long>(m_pRightIndent
->Denormalize( m_pRightIndent
->GetValue( FUNIT_TWIP
) ) ) );
857 m_pExampleWin
->SetUpper( (sal_uInt16
)m_pTopDist
->Denormalize( m_pTopDist
->GetValue( FUNIT_TWIP
) ) );
858 m_pExampleWin
->SetLower( (sal_uInt16
)m_pBottomDist
->Denormalize( m_pBottomDist
->GetValue( FUNIT_TWIP
) ) );
860 sal_Int32 nPos
= m_pLineDist
->GetSelectEntryPos();
867 m_pExampleWin
->SetLineSpace( (SvxPrevLineSpace
)nPos
);
870 case LLINESPACE_PROP
:
871 m_pExampleWin
->SetLineSpace( (SvxPrevLineSpace
)nPos
,
872 (sal_uInt16
)m_pLineDistAtPercentBox
->Denormalize( m_pLineDistAtPercentBox
->GetValue() ) );
876 case LLINESPACE_DURCH
:
878 m_pExampleWin
->SetLineSpace( (SvxPrevLineSpace
)nPos
,
879 (sal_uInt16
)GetCoreValue( *m_pLineDistAtMetricBox
, SFX_MAPUNIT_TWIP
) );
882 m_pExampleWin
->Draw( bAll
);
885 void SvxStdParagraphTabPage::EnableRegisterMode()
887 m_pRegisterCB
->Show();
888 m_pRegisterFL
->Show();
891 void SvxStdParagraphTabPage::EnableContextualMode()
893 m_pContextualCB
->Show();
896 IMPL_LINK( SvxStdParagraphTabPage
, AutoHdl_Impl
, CheckBox
*, pBox
)
898 bool bEnable
= !pBox
->IsChecked();
899 m_pFLineLabel
->Enable(bEnable
);
900 m_pFLineIndent
->Enable(bEnable
);
904 void SvxStdParagraphTabPage::SetPageWidth( sal_uInt16 nPageWidth
)
909 void SvxStdParagraphTabPage::EnableAutoFirstLine()
914 void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip
)
916 m_pLineDist
->InsertEntry(sAbsDist
);
917 nMinFixDist
= nMinTwip
;
920 void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet
& aSet
)
923 /* different bit represent call to different method of SvxStdParagraphTabPage
924 0x0001 --->EnableRelativeMode()
925 0x0002 --->EnableRegisterMode()
926 0x0004 --->EnableAutoFirstLine()
927 0x0008 --->EnableNegativeMode()
928 0x0010 --->EnableContextualMode()
930 SFX_ITEMSET_ARG (&aSet
,pPageWidthItem
,SfxUInt16Item
,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH
,false);
931 SFX_ITEMSET_ARG (&aSet
,pFlagSetItem
,SfxUInt32Item
,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET
,false);
932 SFX_ITEMSET_ARG (&aSet
,pLineDistItem
,SfxUInt32Item
,SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST
,false);
935 SetPageWidth(pPageWidthItem
->GetValue());
938 if (( 0x0001 & pFlagSetItem
->GetValue())== 0x0001 )
939 EnableRelativeMode();
942 if (( 0x0002 & pFlagSetItem
->GetValue())== 0x0002 )
943 EnableRegisterMode();
946 if ( ( 0x0004 & pFlagSetItem
->GetValue())== 0x0004 )
947 EnableAutoFirstLine();
950 EnableAbsLineDist(pLineDistItem
->GetValue());
953 if (( 0x0008 & pFlagSetItem
->GetValue()) == 0x0008 )
954 EnableNegativeMode();
957 if (( 0x0010 & pFlagSetItem
->GetValue()) == 0x0010 )
958 EnableContextualMode();
961 #define LASTLINEPOS_DEFAULT 0
962 #define LASTLINEPOS_LEFT 1
964 #define LASTLINECOUNT_OLD 3
965 #define LASTLINECOUNT_NEW 4
967 SvxParaAlignTabPage::SvxParaAlignTabPage( Window
* pParent
, const SfxItemSet
& rSet
)
969 : SfxTabPage(pParent
, "ParaAlignPage", "cui/ui/paragalignpage.ui",rSet
)
971 get(m_pLeft
,"radioBTN_LEFTALIGN");
972 get(m_pRight
,"radioBTN_RIGHTALIGN");
973 get(m_pCenter
,"radioBTN_CENTERALIGN");
974 get(m_pJustify
,"radioBTN_JUSTIFYALIGN");
975 get(m_pLeftBottom
,"labelST_LEFTALIGN_ASIAN");
976 get(m_pRightTop
,"labelST_RIGHTALIGN_ASIAN");
978 get(m_pLastLineFT
,"labelLB_LASTLINE");
979 get(m_pLastLineLB
,"comboLB_LASTLINE");
980 get(m_pExpandCB
,"checkCB_EXPAND");
981 get(m_pSnapToGridCB
,"checkCB_SNAP");
982 get(m_pExampleWin
,"drawingareaWN_EXAMPLE");
984 get(m_pVertAlignLB
,"comboLB_VERTALIGN");
985 get(m_pVertAlignFL
,"frameFL_VERTALIGN");
987 get(m_pPropertiesFL
,"framePROPERTIES");
988 get(m_pTextDirectionLB
,"comboLB_TEXTDIRECTION");
990 SvtLanguageOptions aLangOptions
;
991 sal_uInt16 nLastLinePos
= LASTLINEPOS_DEFAULT
;
993 if ( aLangOptions
.IsAsianTypographyEnabled() )
995 m_pLeft
->SetText(m_pLeftBottom
->GetText());
996 m_pRight
->SetText(m_pRightTop
->GetText());
998 OUString
sLeft(m_pLeft
->GetText());
999 sLeft
= MnemonicGenerator::EraseAllMnemonicChars( sLeft
);
1001 if ( m_pLastLineLB
->GetEntryCount() == LASTLINECOUNT_OLD
)
1003 m_pLastLineLB
->RemoveEntry( 0 );
1004 m_pLastLineLB
->InsertEntry( sLeft
, 0 );
1007 nLastLinePos
= LASTLINEPOS_LEFT
;
1010 // remove "Default" or "Left" entry, depends on CJKOptions
1011 if ( m_pLastLineLB
->GetEntryCount() == LASTLINECOUNT_NEW
)
1012 m_pLastLineLB
->RemoveEntry( nLastLinePos
);
1014 Link aLink
= LINK( this, SvxParaAlignTabPage
, AlignHdl_Impl
);
1015 m_pLeft
->SetClickHdl( aLink
);
1016 m_pRight
->SetClickHdl( aLink
);
1017 m_pCenter
->SetClickHdl( aLink
);
1018 m_pJustify
->SetClickHdl( aLink
);
1019 m_pLastLineLB
->SetSelectHdl( LINK( this, SvxParaAlignTabPage
, LastLineHdl_Impl
) );
1020 m_pTextDirectionLB
->SetSelectHdl( LINK( this, SvxParaAlignTabPage
, TextDirectionHdl_Impl
) );
1022 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(rSet
);
1023 if(!(nHtmlMode
& HTMLMODE_ON
) || (0 != (nHtmlMode
& HTMLMODE_SOME_STYLES
)) )
1025 if( aLangOptions
.IsCTLFontEnabled() )
1027 m_pTextDirectionLB
->InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR
), FRMDIR_HORI_LEFT_TOP
);
1028 m_pTextDirectionLB
->InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL
), FRMDIR_HORI_RIGHT_TOP
);
1029 m_pTextDirectionLB
->InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER
), FRMDIR_ENVIRONMENT
);
1031 m_pPropertiesFL
->Show();
1035 setPreviewsToSamePlace(pParent
, this);
1038 SvxParaAlignTabPage::~SvxParaAlignTabPage()
1042 int SvxParaAlignTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1045 FillItemSet( *_pSet
);
1049 SfxTabPage
* SvxParaAlignTabPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
1051 return new SvxParaAlignTabPage(pParent
, rSet
);
1054 const sal_uInt16
* SvxParaAlignTabPage::GetRanges()
1056 return pAlignRanges
;
1059 bool SvxParaAlignTabPage::FillItemSet( SfxItemSet
& rOutSet
)
1061 bool bModified
= false;
1063 bool bAdj
= false, bChecked
= false;
1064 SvxAdjust eAdjust
= SVX_ADJUST_LEFT
;
1066 if ( m_pLeft
->IsChecked() )
1068 eAdjust
= SVX_ADJUST_LEFT
;
1069 bAdj
= !m_pLeft
->GetSavedValue();
1072 else if ( m_pRight
->IsChecked() )
1074 eAdjust
= SVX_ADJUST_RIGHT
;
1075 bAdj
= !m_pRight
->GetSavedValue();
1078 else if ( m_pCenter
->IsChecked() )
1080 eAdjust
= SVX_ADJUST_CENTER
;
1081 bAdj
= !m_pCenter
->GetSavedValue();
1084 else if ( m_pJustify
->IsChecked() )
1086 eAdjust
= SVX_ADJUST_BLOCK
;
1087 bAdj
= !m_pJustify
->GetSavedValue() ||
1088 m_pExpandCB
->IsValueChangedFromSaved() ||
1089 m_pLastLineLB
->IsValueChangedFromSaved();
1092 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1096 const SvxAdjustItem
* pOld
= (const SvxAdjustItem
*)GetOldItem( rOutSet
, SID_ATTR_PARA_ADJUST
);
1098 SvxAdjust eOneWord
= m_pExpandCB
->IsChecked() ? SVX_ADJUST_BLOCK
: SVX_ADJUST_LEFT
;
1100 sal_Int32 nLBPos
= m_pLastLineLB
->GetSelectEntryPos();
1101 SvxAdjust eLastBlock
= SVX_ADJUST_LEFT
;
1104 eLastBlock
= SVX_ADJUST_CENTER
;
1105 else if ( 2 == nLBPos
)
1106 eLastBlock
= SVX_ADJUST_BLOCK
;
1108 bool bNothingWasChecked
=
1109 !m_pLeft
->GetSavedValue() && !m_pRight
->GetSavedValue() &&
1110 !m_pCenter
->GetSavedValue() && !m_pJustify
->GetSavedValue();
1112 if ( !pOld
|| pOld
->GetAdjust() != eAdjust
||
1113 pOld
->GetOneWord() != eOneWord
||
1114 pOld
->GetLastBlock() != eLastBlock
||
1115 ( bChecked
&& bNothingWasChecked
) )
1119 (const SvxAdjustItem
&)GetItemSet().Get( _nWhich
) );
1120 aAdj
.SetAdjust( eAdjust
);
1121 aAdj
.SetOneWord( eOneWord
);
1122 aAdj
.SetLastBlock( eLastBlock
);
1123 rOutSet
.Put( aAdj
);
1126 if(m_pSnapToGridCB
->IsValueChangedFromSaved())
1128 rOutSet
.Put(SvxParaGridItem(m_pSnapToGridCB
->IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID
)));
1131 if(m_pVertAlignLB
->IsValueChangedFromSaved())
1133 rOutSet
.Put(SvxParaVertAlignItem(m_pVertAlignLB
->GetSelectEntryPos(), GetWhich( SID_PARA_VERTALIGN
)));
1137 if( m_pTextDirectionLB
->IsVisible() )
1139 SvxFrameDirection eDir
= m_pTextDirectionLB
->GetSelectEntryValue();
1140 if( m_pTextDirectionLB
->IsValueChangedFromSaved() )
1142 rOutSet
.Put( SvxFrameDirectionItem( eDir
, GetWhich( SID_ATTR_FRAMEDIRECTION
) ) );
1150 void SvxParaAlignTabPage::Reset( const SfxItemSet
& rSet
)
1152 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1153 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
1155 sal_Int32 nLBSelect
= 0;
1156 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1158 const SvxAdjustItem
& rAdj
= (const SvxAdjustItem
&)rSet
.Get( _nWhich
);
1160 switch ( rAdj
.GetAdjust() /*!!! ask VB rAdj.GetLastBlock()*/ )
1162 case SVX_ADJUST_LEFT
: m_pLeft
->Check(); break;
1164 case SVX_ADJUST_RIGHT
: m_pRight
->Check(); break;
1166 case SVX_ADJUST_CENTER
: m_pCenter
->Check(); break;
1168 case SVX_ADJUST_BLOCK
: m_pJustify
->Check(); break;
1169 default: ; //prevent warning
1171 bool bEnable
= m_pJustify
->IsChecked();
1172 m_pLastLineFT
->Enable(bEnable
);
1173 m_pLastLineLB
->Enable(bEnable
);
1174 m_pExpandCB
->Enable(bEnable
);
1176 m_pExpandCB
->Check(SVX_ADJUST_BLOCK
== rAdj
.GetOneWord());
1177 switch(rAdj
.GetLastBlock())
1179 case SVX_ADJUST_LEFT
: nLBSelect
= 0; break;
1181 case SVX_ADJUST_CENTER
: nLBSelect
= 1; break;
1183 case SVX_ADJUST_BLOCK
: nLBSelect
= 2; break;
1184 default: ; //prevent warning
1189 m_pLeft
->Check( false );
1190 m_pRight
->Check( false );
1191 m_pCenter
->Check( false );
1192 m_pJustify
->Check( false );
1194 m_pLastLineLB
->SelectEntryPos(nLBSelect
);
1196 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(rSet
);
1197 if(nHtmlMode
& HTMLMODE_ON
)
1199 m_pLastLineLB
->Hide();
1200 m_pLastLineFT
->Hide();
1201 m_pExpandCB
->Hide();
1202 if(!(nHtmlMode
& HTMLMODE_FULL_STYLES
) )
1203 m_pJustify
->Disable();
1204 m_pSnapToGridCB
->Show(false);
1206 _nWhich
= GetWhich(SID_ATTR_PARA_SNAPTOGRID
);
1207 eItemState
= rSet
.GetItemState( _nWhich
);
1208 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1210 const SvxParaGridItem
& rSnap
= (const SvxParaGridItem
&)rSet
.Get( _nWhich
);
1211 m_pSnapToGridCB
->Check(rSnap
.GetValue());
1214 _nWhich
= GetWhich( SID_PARA_VERTALIGN
);
1215 eItemState
= rSet
.GetItemState( _nWhich
);
1217 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1219 m_pVertAlignFL
->Show();
1221 const SvxParaVertAlignItem
& rAlign
= (const SvxParaVertAlignItem
&)rSet
.Get( _nWhich
);
1223 m_pVertAlignLB
->SelectEntryPos(rAlign
.GetValue());
1226 _nWhich
= GetWhich( SID_ATTR_FRAMEDIRECTION
);
1228 if( SFX_ITEM_AVAILABLE
<= rSet
.GetItemState( _nWhich
) )
1230 const SvxFrameDirectionItem
& rFrameDirItem
= ( const SvxFrameDirectionItem
& ) rSet
.Get( _nWhich
);
1231 m_pTextDirectionLB
->SelectEntryValue( (SvxFrameDirection
)rFrameDirItem
.GetValue() );
1232 m_pTextDirectionLB
->SaveValue();
1235 m_pSnapToGridCB
->SaveValue();
1236 m_pVertAlignLB
->SaveValue();
1237 m_pLeft
->SaveValue();
1238 m_pRight
->SaveValue();
1239 m_pCenter
->SaveValue();
1240 m_pJustify
->SaveValue();
1241 m_pLastLineLB
->SaveValue();
1242 m_pExpandCB
->SaveValue();
1244 UpdateExample_Impl(true);
1247 IMPL_LINK_NOARG(SvxParaAlignTabPage
, AlignHdl_Impl
)
1249 bool bJustify
= m_pJustify
->IsChecked();
1250 m_pLastLineFT
->Enable(bJustify
);
1251 m_pLastLineLB
->Enable(bJustify
);
1252 m_pExpandCB
->Enable(bJustify
);
1253 UpdateExample_Impl(false);
1257 IMPL_LINK_NOARG(SvxParaAlignTabPage
, LastLineHdl_Impl
)
1259 UpdateExample_Impl(false);
1263 IMPL_LINK_NOARG(SvxParaAlignTabPage
, TextDirectionHdl_Impl
)
1265 SvxFrameDirection eDir
= m_pTextDirectionLB
->GetSelectEntryValue();
1268 // check the default alignment for this text direction
1269 case FRMDIR_HORI_LEFT_TOP
: m_pLeft
->Check( true ); break;
1270 case FRMDIR_HORI_RIGHT_TOP
: m_pRight
->Check( true ); break;
1271 case FRMDIR_ENVIRONMENT
: /* do nothing */ break;
1274 SAL_WARN( "cui.tabpages", "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" );
1281 void SvxParaAlignTabPage::UpdateExample_Impl( bool bAll
)
1283 if ( m_pLeft
->IsChecked() )
1284 m_pExampleWin
->SetAdjust( SVX_ADJUST_LEFT
);
1285 else if ( m_pRight
->IsChecked() )
1286 m_pExampleWin
->SetAdjust( SVX_ADJUST_RIGHT
);
1287 else if ( m_pCenter
->IsChecked() )
1288 m_pExampleWin
->SetAdjust( SVX_ADJUST_CENTER
);
1289 else if ( m_pJustify
->IsChecked() )
1291 m_pExampleWin
->SetAdjust( SVX_ADJUST_BLOCK
);
1292 SvxAdjust eLastBlock
= SVX_ADJUST_LEFT
;
1293 sal_Int32 nLBPos
= m_pLastLineLB
->GetSelectEntryPos();
1295 eLastBlock
= SVX_ADJUST_CENTER
;
1296 else if(nLBPos
== 2)
1297 eLastBlock
= SVX_ADJUST_BLOCK
;
1298 m_pExampleWin
->SetLastLine( eLastBlock
);
1301 m_pExampleWin
->Draw( bAll
);
1304 void SvxParaAlignTabPage::EnableJustifyExt()
1306 m_pLastLineFT
->Show();
1307 m_pLastLineLB
->Show();
1308 m_pExpandCB
->Show();
1309 SvtLanguageOptions aCJKOptions
;
1310 if(aCJKOptions
.IsAsianTypographyEnabled())
1311 m_pSnapToGridCB
->Show();
1315 void SvxParaAlignTabPage::PageCreated (const SfxAllItemSet
& aSet
)
1317 SFX_ITEMSET_ARG (&aSet
,pBoolItem
,SfxBoolItem
,SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT
,false);
1319 if(pBoolItem
->GetValue())
1323 SfxTabPage
* SvxExtParagraphTabPage::Create( Window
* pParent
,
1324 const SfxItemSet
& rSet
)
1326 return new SvxExtParagraphTabPage( pParent
, rSet
);
1329 bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet
& rOutSet
)
1331 bool bModified
= false;
1332 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1333 const TriState eHyphenState
= m_pHyphenBox
->GetState();
1334 const SfxPoolItem
* pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_HYPHENZONE
);
1336 if ( m_pHyphenBox
->IsValueChangedFromSaved() ||
1337 m_pExtHyphenBeforeBox
->IsValueModified() ||
1338 m_pExtHyphenAfterBox
->IsValueModified() ||
1339 m_pMaxHyphenEdit
->IsValueModified() )
1341 SvxHyphenZoneItem
aHyphen(
1342 (const SvxHyphenZoneItem
&)GetItemSet().Get( _nWhich
) );
1343 aHyphen
.SetHyphen( eHyphenState
== TRISTATE_TRUE
);
1345 if ( eHyphenState
== TRISTATE_TRUE
)
1347 aHyphen
.GetMinLead() = (sal_uInt8
)m_pExtHyphenBeforeBox
->GetValue();
1348 aHyphen
.GetMinTrail() = (sal_uInt8
)m_pExtHyphenAfterBox
->GetValue();
1350 aHyphen
.GetMaxHyphens() = (sal_uInt8
)m_pMaxHyphenEdit
->GetValue();
1353 !( *(SvxHyphenZoneItem
*)pOld
== aHyphen
) ||
1354 m_pHyphenBox
->IsValueChangedFromSaved())
1356 rOutSet
.Put( aHyphen
);
1361 if (m_pPagenumEdit
->IsEnabled() && m_pPagenumEdit
->IsValueModified())
1363 SfxUInt16Item
aPageNum( SID_ATTR_PARA_PAGENUM
,
1364 (sal_uInt16
)m_pPagenumEdit
->GetValue() );
1366 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_PAGENUM
);
1368 if ( !pOld
|| ( (const SfxUInt16Item
*)pOld
)->GetValue() != aPageNum
.GetValue() )
1370 rOutSet
.Put( aPageNum
);
1377 TriState eState
= m_pApplyCollBtn
->GetState();
1378 bool bIsPageModel
= false;
1380 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1382 if ( m_pApplyCollBtn
->IsValueChangedFromSaved() ||
1383 ( TRISTATE_TRUE
== eState
&&
1384 m_pApplyCollBox
->IsValueChangedFromSaved() ) )
1386 if ( eState
== TRISTATE_TRUE
)
1388 sPage
= m_pApplyCollBox
->GetSelectEntry();
1389 bIsPageModel
= !sPage
.isEmpty();
1391 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_MODEL
);
1393 if ( !pOld
|| ( (const SvxPageModelItem
*)pOld
)->GetValue() != sPage
)
1395 rOutSet
.Put( SvxPageModelItem( sPage
, false, _nWhich
) );
1399 bIsPageModel
= false;
1401 else if(TRISTATE_TRUE
== eState
&& m_pApplyCollBtn
->IsEnabled())
1402 bIsPageModel
= true;
1404 rOutSet
.Put( SvxPageModelItem( sPage
, false, _nWhich
) );
1406 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1409 // if PageModel is turned on, always turn off PageBreak
1410 rOutSet
.Put( SvxFmtBreakItem( SVX_BREAK_NONE
, _nWhich
) );
1413 eState
= m_pPageBreakBox
->GetState();
1414 SfxItemState eModelState
= GetItemSet().GetItemState(SID_ATTR_PARA_MODEL
, false);
1416 if ( (eModelState
== SFX_ITEM_SET
&& TRISTATE_TRUE
== m_pPageBreakBox
->GetState()) ||
1417 m_pPageBreakBox
->IsValueChangedFromSaved() ||
1418 m_pBreakTypeLB
->IsValueChangedFromSaved() ||
1419 m_pBreakPositionLB
->IsValueChangedFromSaved() )
1421 const SvxFmtBreakItem
rOldBreak(
1422 (const SvxFmtBreakItem
&)GetItemSet().Get( _nWhich
));
1423 SvxFmtBreakItem
aBreak(rOldBreak
.GetBreak(), rOldBreak
.Which());
1429 bool bBefore
= m_pBreakPositionLB
->GetSelectEntryPos() == 0;
1431 if ( m_pBreakTypeLB
->GetSelectEntryPos() == 0 )
1434 aBreak
.SetValue( SVX_BREAK_PAGE_BEFORE
);
1436 aBreak
.SetValue( SVX_BREAK_PAGE_AFTER
);
1441 aBreak
.SetValue( SVX_BREAK_COLUMN_BEFORE
);
1443 aBreak
.SetValue( SVX_BREAK_COLUMN_AFTER
);
1448 case TRISTATE_FALSE
:
1449 aBreak
.SetValue( SVX_BREAK_NONE
);
1451 default: ; //prevent warning
1453 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_PAGEBREAK
);
1455 if ( eState
!= m_pPageBreakBox
->GetSavedValue() ||
1456 !pOld
|| !( *(const SvxFmtBreakItem
*)pOld
== aBreak
) )
1459 rOutSet
.Put( aBreak
);
1465 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1466 eState
= m_pKeepTogetherBox
->GetState();
1468 if ( m_pKeepTogetherBox
->IsValueChangedFromSaved() )
1470 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_SPLIT
);
1472 if ( !pOld
|| ( (const SvxFmtSplitItem
*)pOld
)->GetValue() !=
1473 ( eState
== TRISTATE_FALSE
) )
1475 rOutSet
.Put( SvxFmtSplitItem( eState
== TRISTATE_FALSE
, _nWhich
) );
1481 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1482 eState
= m_pKeepParaBox
->GetState();
1484 if ( m_pKeepParaBox
->IsValueChangedFromSaved() )
1486 // if the status has changed, putting is necessary
1487 rOutSet
.Put( SvxFmtKeepItem( eState
== TRISTATE_TRUE
, _nWhich
) );
1491 // widows and orphans
1492 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1493 eState
= m_pWidowBox
->GetState();
1495 if ( m_pWidowBox
->IsValueChangedFromSaved() ||
1496 m_pWidowRowNo
->IsValueModified() )
1498 SvxWidowsItem
rItem( eState
== TRISTATE_TRUE
?
1499 (sal_uInt8
)m_pWidowRowNo
->GetValue() : 0, _nWhich
);
1500 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_WIDOWS
);
1502 if ( m_pWidowBox
->IsValueChangedFromSaved() || !pOld
|| !( *(const SvxWidowsItem
*)pOld
== rItem
) )
1504 rOutSet
.Put( rItem
);
1509 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1510 eState
= m_pOrphanBox
->GetState();
1512 if ( m_pOrphanBox
->IsValueChangedFromSaved() ||
1513 m_pOrphanRowNo
->IsValueModified() )
1515 SvxOrphansItem
rItem( eState
== TRISTATE_TRUE
?
1516 (sal_uInt8
)m_pOrphanRowNo
->GetValue() : 0, _nWhich
);
1517 pOld
= GetOldItem( rOutSet
, SID_ATTR_PARA_ORPHANS
);
1519 if ( m_pOrphanBox
->IsValueChangedFromSaved() ||
1521 !( *(const SvxOrphansItem
*)pOld
== rItem
) )
1523 rOutSet
.Put( rItem
);
1531 void SvxExtParagraphTabPage::Reset( const SfxItemSet
& rSet
)
1533 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1534 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
1536 bool bItemAvailable
= eItemState
>= SFX_ITEM_AVAILABLE
;
1537 bool bIsHyphen
= false;
1538 if( !bHtmlMode
&& bItemAvailable
)
1540 const SvxHyphenZoneItem
& rHyphen
=
1541 (const SvxHyphenZoneItem
&)rSet
.Get( _nWhich
);
1542 m_pHyphenBox
->EnableTriState( false );
1544 bIsHyphen
= rHyphen
.IsHyphen();
1545 m_pHyphenBox
->SetState( bIsHyphen
? TRISTATE_TRUE
: TRISTATE_FALSE
);
1547 m_pExtHyphenBeforeBox
->SetValue( rHyphen
.GetMinLead() );
1548 m_pExtHyphenAfterBox
->SetValue( rHyphen
.GetMinTrail() );
1549 m_pMaxHyphenEdit
->SetValue( rHyphen
.GetMaxHyphens() );
1553 m_pHyphenBox
->SetState( TRISTATE_INDET
);
1555 bool bEnable
= bItemAvailable
&& bIsHyphen
;
1556 m_pExtHyphenBeforeBox
->Enable(bEnable
);
1557 m_pExtHyphenAfterBox
->Enable(bEnable
);
1558 m_pBeforeText
->Enable(bEnable
);
1559 m_pAfterText
->Enable(bEnable
);
1560 m_pMaxHyphenLabel
->Enable(bEnable
);
1561 m_pMaxHyphenEdit
->Enable(bEnable
);
1563 _nWhich
= GetWhich( SID_ATTR_PARA_PAGENUM
);
1565 if ( rSet
.GetItemState(_nWhich
) >= SFX_ITEM_SET
)
1567 const sal_uInt16 nPageNum
=
1568 ( (const SfxUInt16Item
&)rSet
.Get( _nWhich
) ).GetValue();
1569 m_pPagenumEdit
->SetValue( nPageNum
);
1574 // first handle PageModel
1575 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1576 bool bIsPageModel
= false;
1577 eItemState
= rSet
.GetItemState( _nWhich
);
1579 if ( eItemState
>= SFX_ITEM_SET
)
1581 m_pApplyCollBtn
->EnableTriState( false );
1583 const SvxPageModelItem
& rModel
=
1584 (const SvxPageModelItem
&)rSet
.Get( _nWhich
);
1585 OUString
aStr( rModel
.GetValue() );
1587 if ( !aStr
.isEmpty() &&
1588 m_pApplyCollBox
->GetEntryPos( aStr
) != LISTBOX_ENTRY_NOTFOUND
)
1590 m_pApplyCollBox
->SelectEntry( aStr
);
1591 m_pApplyCollBtn
->SetState( TRISTATE_TRUE
);
1592 bIsPageModel
= true;
1594 m_pPageBreakBox
->Enable();
1595 m_pPageBreakBox
->EnableTriState( false );
1596 m_pBreakTypeFT
->Enable();
1597 m_pBreakTypeLB
->Enable();
1598 m_pBreakPositionFT
->Enable();
1599 m_pBreakPositionLB
->Enable();
1600 m_pApplyCollBtn
->Enable();
1601 m_pPageBreakBox
->SetState( TRISTATE_TRUE
);
1604 m_pBreakTypeLB
->SelectEntryPos(0);
1605 //select break before
1606 m_pBreakPositionLB
->SelectEntryPos(0);
1610 m_pApplyCollBox
->SetNoSelection();
1611 m_pApplyCollBtn
->SetState( TRISTATE_FALSE
);
1614 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1616 m_pApplyCollBtn
->EnableTriState( true );
1617 m_pApplyCollBtn
->SetState( TRISTATE_INDET
);
1618 m_pApplyCollBox
->SetNoSelection();
1622 m_pApplyCollBtn
->Enable(false);
1623 m_pApplyCollBox
->Enable(false);
1624 m_pPagenumEdit
->Enable(false);
1625 m_pPagenumText
->Enable(false);
1628 if ( !bIsPageModel
)
1630 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1631 eItemState
= rSet
.GetItemState( _nWhich
);
1633 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1635 const SvxFmtBreakItem
& rPageBreak
=
1636 (const SvxFmtBreakItem
&)rSet
.Get( _nWhich
);
1638 SvxBreak eBreak
= (SvxBreak
)rPageBreak
.GetValue();
1640 // PageBreak not via CTRL-RETURN,
1641 // then CheckBox can be freed
1642 m_pPageBreakBox
->Enable();
1643 m_pPageBreakBox
->EnableTriState( false );
1644 m_pBreakTypeFT
->Enable();
1645 m_pBreakTypeLB
->Enable();
1646 m_pBreakPositionFT
->Enable();
1647 m_pBreakPositionLB
->Enable();
1649 m_pPageBreakBox
->SetState( TRISTATE_TRUE
);
1651 bool _bEnable
= eBreak
!= SVX_BREAK_NONE
&&
1652 eBreak
!= SVX_BREAK_COLUMN_BEFORE
&&
1653 eBreak
!= SVX_BREAK_COLUMN_AFTER
;
1654 m_pApplyCollBtn
->Enable(_bEnable
);
1657 m_pApplyCollBox
->Enable(_bEnable
);
1658 m_pPagenumEdit
->Enable(_bEnable
);
1661 if ( eBreak
== SVX_BREAK_NONE
)
1662 m_pPageBreakBox
->SetState( TRISTATE_FALSE
);
1664 sal_Int32 nType
= 0; // selection position in break type ListBox : Page
1665 sal_Int32 nPosition
= 0; // selection position in break position ListBox : Before
1668 case SVX_BREAK_PAGE_BEFORE
:
1670 case SVX_BREAK_PAGE_AFTER
:
1673 case SVX_BREAK_COLUMN_BEFORE
:
1676 case SVX_BREAK_COLUMN_AFTER
:
1680 default: ;//prevent warning
1682 m_pBreakTypeLB
->SelectEntryPos(nType
);
1683 m_pBreakPositionLB
->SelectEntryPos(nPosition
);
1685 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1686 m_pPageBreakBox
->SetState( TRISTATE_INDET
);
1689 m_pPageBreakBox
->Enable(false);
1690 m_pBreakTypeFT
->Enable(false);
1691 m_pBreakTypeLB
->Enable(false);
1692 m_pBreakPositionFT
->Enable(false);
1693 m_pBreakPositionLB
->Enable(false);
1697 PageBreakPosHdl_Impl( m_pBreakPositionLB
);
1698 PageBreakHdl_Impl( m_pPageBreakBox
);
1701 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1702 eItemState
= rSet
.GetItemState( _nWhich
);
1704 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1706 m_pKeepParaBox
->EnableTriState( false );
1707 const SvxFmtKeepItem
& rKeep
=
1708 (const SvxFmtKeepItem
&)rSet
.Get( _nWhich
);
1710 if ( rKeep
.GetValue() )
1711 m_pKeepParaBox
->SetState( TRISTATE_TRUE
);
1713 m_pKeepParaBox
->SetState( TRISTATE_FALSE
);
1715 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1716 m_pKeepParaBox
->SetState( TRISTATE_INDET
);
1718 m_pKeepParaBox
->Enable(false);
1720 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1721 eItemState
= rSet
.GetItemState( _nWhich
);
1723 if ( eItemState
>= SFX_ITEM_AVAILABLE
)
1725 const SvxFmtSplitItem
& rSplit
=
1726 (const SvxFmtSplitItem
&)rSet
.Get( _nWhich
);
1727 m_pKeepTogetherBox
->EnableTriState( false );
1729 if ( !rSplit
.GetValue() )
1730 m_pKeepTogetherBox
->SetState( TRISTATE_TRUE
);
1733 m_pKeepTogetherBox
->SetState( TRISTATE_FALSE
);
1735 // widows and orphans
1736 m_pWidowBox
->Enable();
1737 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1738 SfxItemState eTmpState
= rSet
.GetItemState( _nWhich
);
1740 if ( eTmpState
>= SFX_ITEM_AVAILABLE
)
1742 const SvxWidowsItem
& rWidow
=
1743 (const SvxWidowsItem
&)rSet
.Get( _nWhich
);
1744 m_pWidowBox
->EnableTriState( false );
1745 const sal_uInt16 nLines
= rWidow
.GetValue();
1747 bool _bEnable
= nLines
> 0;
1748 m_pWidowRowNo
->SetValue( m_pWidowRowNo
->Normalize( nLines
) );
1749 m_pWidowBox
->SetState( _bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
);
1750 m_pWidowRowNo
->Enable(_bEnable
);
1751 //m_pWidowRowLabel->Enable(_bEnable);
1754 else if ( SFX_ITEM_DONTCARE
== eTmpState
)
1755 m_pWidowBox
->SetState( TRISTATE_INDET
);
1757 m_pWidowBox
->Enable(false);
1759 m_pOrphanBox
->Enable();
1760 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1761 eTmpState
= rSet
.GetItemState( _nWhich
);
1763 if ( eTmpState
>= SFX_ITEM_AVAILABLE
)
1765 const SvxOrphansItem
& rOrphan
=
1766 (const SvxOrphansItem
&)rSet
.Get( _nWhich
);
1767 const sal_uInt16 nLines
= rOrphan
.GetValue();
1768 m_pOrphanBox
->EnableTriState( false );
1770 bool _bEnable
= nLines
> 0;
1771 m_pOrphanBox
->SetState( _bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
);
1772 m_pOrphanRowNo
->SetValue( m_pOrphanRowNo
->Normalize( nLines
) );
1773 m_pOrphanRowNo
->Enable(_bEnable
);
1774 m_pOrphanRowLabel
->Enable(_bEnable
);
1777 else if ( SFX_ITEM_DONTCARE
== eTmpState
)
1778 m_pOrphanBox
->SetState( TRISTATE_INDET
);
1780 m_pOrphanBox
->Enable(false);
1783 else if ( SFX_ITEM_DONTCARE
== eItemState
)
1784 m_pKeepTogetherBox
->SetState( TRISTATE_INDET
);
1786 m_pKeepTogetherBox
->Enable(false);
1788 // so that everything is enabled correctly
1789 KeepTogetherHdl_Impl( 0 );
1791 OrphanHdl_Impl( 0 );
1793 m_pHyphenBox
->SaveValue();
1794 m_pExtHyphenBeforeBox
->SaveValue();
1795 m_pExtHyphenAfterBox
->SaveValue();
1796 m_pMaxHyphenEdit
->SaveValue();
1797 m_pPageBreakBox
->SaveValue();
1798 m_pBreakPositionLB
->SaveValue();
1799 m_pBreakTypeLB
->SaveValue();
1800 m_pApplyCollBtn
->SaveValue();
1801 m_pApplyCollBox
->SaveValue();
1802 m_pPagenumEdit
->SaveValue();
1803 m_pKeepTogetherBox
->SaveValue();
1804 m_pKeepParaBox
->SaveValue();
1805 m_pWidowBox
->SaveValue();
1806 m_pOrphanBox
->SaveValue();
1809 int SvxExtParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1812 FillItemSet( *_pSet
);
1816 void SvxExtParagraphTabPage::DisablePageBreak()
1819 m_pPageBreakBox
->Enable(false);
1820 m_pBreakTypeLB
->RemoveEntry(0);
1821 m_pBreakPositionFT
->Enable(false);
1822 m_pBreakPositionLB
->Enable(false);
1823 m_pApplyCollBtn
->Enable(false);
1824 m_pApplyCollBox
->Enable(false);
1825 m_pPagenumEdit
->Enable(false);
1828 SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window
* pParent
, const SfxItemSet
& rAttr
) :
1829 SfxTabPage( pParent
, "TextFlowPage","cui/ui/textflowpage.ui", rAttr
),
1831 bPageBreak ( true ),
1832 bHtmlMode ( false ),
1836 get(m_pHyphenBox
,"checkAuto");
1837 get(m_pExtHyphenBeforeBox
,"spinLineEnd");
1838 get(m_pExtHyphenAfterBox
,"spinLineBegin");
1839 get(m_pMaxHyphenEdit
,"spinMaxNum");
1840 get(m_pBeforeText
,"labelLineBegin");
1841 get(m_pAfterText
,"labelLineEnd");
1842 get(m_pMaxHyphenLabel
,"labelMaxNum");
1845 get(m_pPageBreakBox
,"checkInsert");
1846 get(m_pBreakTypeLB
,"comboBreakType");
1847 get(m_pBreakPositionLB
,"comboBreakPosition");
1848 get(m_pApplyCollBtn
,"checkPageStyle");
1849 get(m_pApplyCollBox
,"comboPageStyle");
1850 get(m_pPagenumEdit
,"spinPageNumber");
1851 get(m_pBreakTypeFT
,"labelType");
1852 get(m_pBreakPositionFT
,"labelPosition");
1853 get(m_pPagenumText
,"labelPageNum");
1856 get(m_pKeepTogetherBox
,"checkSplitPara");
1857 get(m_pKeepParaBox
,"checkKeepPara");
1859 get(m_pOrphanBox
,"checkOrphan");
1860 get(m_pOrphanRowNo
,"spinOrphan");
1861 get(m_pOrphanRowLabel
,"labelOrphan");
1863 get(m_pWidowBox
,"checkWidow");
1864 get(m_pWidowRowNo
,"spinWidow");
1865 get(m_pWidowRowLabel
,"labelWidow");
1867 m_pApplyCollBox
->SetAccessibleRelationLabeledBy(m_pApplyCollBtn
);
1868 m_pApplyCollBox
->SetAccessibleName(CUI_RES(STR_PAGE_STYLE
));
1870 m_pOrphanRowNo
->SetAccessibleRelationLabeledBy(m_pOrphanBox
);
1871 m_pWidowRowNo
->SetAccessibleRelationLabeledBy(m_pWidowBox
);
1873 // this page needs ExchangeSupport
1874 SetExchangeSupport();
1876 m_pHyphenBox
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, HyphenClickHdl_Impl
) );
1877 m_pPageBreakBox
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakHdl_Impl
) );
1878 m_pKeepTogetherBox
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
) );
1879 m_pWidowBox
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, WidowHdl_Impl
) );
1880 m_pOrphanBox
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, OrphanHdl_Impl
) );
1881 m_pApplyCollBtn
->SetClickHdl( LINK( this, SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
) );
1882 m_pBreakTypeLB
->SetSelectHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
) );
1883 m_pBreakPositionLB
->SetSelectHdl( LINK( this, SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
) );
1885 SfxObjectShell
* pSh
= SfxObjectShell::Current();
1888 SfxStyleSheetBasePool
* pPool
= pSh
->GetStyleSheetPool();
1889 pPool
->SetSearchMask( SFX_STYLE_FAMILY_PAGE
);
1890 SfxStyleSheetBase
* pStyle
= pPool
->First();
1895 if ( aStdName
.isEmpty() )
1896 // first style == standard style
1897 aStdName
= pStyle
->GetName();
1898 m_pApplyCollBox
->InsertEntry( pStyle
->GetName() );
1899 pStyle
= pPool
->Next();
1901 nStdPos
= m_pApplyCollBox
->GetEntryPos( aStdName
);
1904 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl( rAttr
);
1905 if ( nHtmlMode
& HTMLMODE_ON
)
1908 m_pHyphenBox
->Enable(false);
1909 m_pBeforeText
->Enable(false);
1910 m_pExtHyphenBeforeBox
->Enable(false);
1911 m_pAfterText
->Enable(false);
1912 m_pExtHyphenAfterBox
->Enable(false);
1913 m_pMaxHyphenLabel
->Enable(false);
1914 m_pMaxHyphenEdit
->Enable(false);
1915 m_pPagenumText
->Enable(false);
1916 m_pPagenumEdit
->Enable(false);
1917 // no column break in HTML
1918 m_pBreakTypeLB
->RemoveEntry(1);
1922 SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
1926 const sal_uInt16
* SvxExtParagraphTabPage::GetRanges()
1931 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, PageBreakHdl_Impl
)
1933 switch ( m_pPageBreakBox
->GetState() )
1936 m_pBreakTypeFT
->Enable();
1937 m_pBreakTypeLB
->Enable();
1938 m_pBreakPositionFT
->Enable();
1939 m_pBreakPositionLB
->Enable();
1941 if ( 0 == m_pBreakTypeLB
->GetSelectEntryPos()&&
1942 0 == m_pBreakPositionLB
->GetSelectEntryPos() )
1944 m_pApplyCollBtn
->Enable();
1946 bool bEnable
= TRISTATE_TRUE
== m_pApplyCollBtn
->GetState() &&
1947 m_pApplyCollBox
->GetEntryCount();
1948 m_pApplyCollBox
->Enable(bEnable
);
1951 m_pPagenumText
->Enable(bEnable
);
1952 m_pPagenumEdit
->Enable(bEnable
);
1957 case TRISTATE_FALSE
:
1958 case TRISTATE_INDET
:
1959 m_pApplyCollBtn
->SetState( TRISTATE_FALSE
);
1960 m_pApplyCollBtn
->Enable(false);
1961 m_pApplyCollBox
->Enable(false);
1962 m_pPagenumText
->Enable(false);
1963 m_pPagenumEdit
->Enable(false);
1964 m_pBreakTypeFT
->Enable(false);
1965 m_pBreakTypeLB
->Enable(false);
1966 m_pBreakPositionFT
->Enable(false);
1967 m_pBreakPositionLB
->Enable(false);
1973 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
)
1975 bool bEnable
= m_pKeepTogetherBox
->GetState() == TRISTATE_FALSE
;
1976 m_pWidowBox
->Enable(bEnable
);
1977 m_pOrphanBox
->Enable(bEnable
);
1982 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, WidowHdl_Impl
)
1984 switch ( m_pWidowBox
->GetState() )
1987 m_pWidowRowNo
->Enable();
1988 m_pWidowRowLabel
->Enable();
1989 m_pKeepTogetherBox
->Enable(false);
1992 case TRISTATE_FALSE
:
1993 if ( m_pOrphanBox
->GetState() == TRISTATE_FALSE
)
1994 m_pKeepTogetherBox
->Enable();
1997 case TRISTATE_INDET
:
1998 m_pWidowRowNo
->Enable(false);
1999 m_pWidowRowLabel
->Enable(false);
2005 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, OrphanHdl_Impl
)
2007 switch( m_pOrphanBox
->GetState() )
2010 m_pOrphanRowNo
->Enable();
2011 m_pOrphanRowLabel
->Enable();
2012 m_pKeepTogetherBox
->Enable(false);
2015 case TRISTATE_FALSE
:
2016 if ( m_pWidowBox
->GetState() == TRISTATE_FALSE
)
2017 m_pKeepTogetherBox
->Enable();
2020 case TRISTATE_INDET
:
2021 m_pOrphanRowNo
->Enable(false);
2022 m_pOrphanRowLabel
->Enable(false);
2028 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, HyphenClickHdl_Impl
)
2031 bool bEnable
= m_pHyphenBox
->GetState() == TRISTATE_TRUE
;
2032 m_pBeforeText
->Enable(bEnable
);
2033 m_pExtHyphenBeforeBox
->Enable(bEnable
);
2034 m_pAfterText
->Enable(bEnable
);
2035 m_pExtHyphenAfterBox
->Enable(bEnable
);
2036 m_pMaxHyphenLabel
->Enable(bEnable
);
2037 m_pMaxHyphenEdit
->Enable(bEnable
);
2038 m_pHyphenBox
->SetState( bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
);
2043 IMPL_LINK_NOARG(SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
)
2045 bool bEnable
= false;
2046 if ( m_pApplyCollBtn
->GetState() == TRISTATE_TRUE
&&
2047 m_pApplyCollBox
->GetEntryCount() )
2050 m_pApplyCollBox
->SelectEntryPos( nStdPos
);
2054 m_pApplyCollBox
->SetNoSelection();
2056 m_pApplyCollBox
->Enable(bEnable
);
2059 m_pPagenumText
->Enable(bEnable
);
2060 m_pPagenumEdit
->Enable(bEnable
);
2065 IMPL_LINK( SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
, ListBox
*, pListBox
)
2067 if ( 0 == pListBox
->GetSelectEntryPos() )
2069 m_pApplyCollBtn
->Enable();
2071 bool bEnable
= m_pApplyCollBtn
->GetState() == TRISTATE_TRUE
&&
2072 m_pApplyCollBox
->GetEntryCount();
2074 m_pApplyCollBox
->Enable(bEnable
);
2077 m_pPagenumText
->Enable(bEnable
);
2078 m_pPagenumEdit
->Enable(bEnable
);
2081 else if ( 1 == pListBox
->GetSelectEntryPos() )
2083 m_pApplyCollBtn
->SetState( TRISTATE_FALSE
);
2084 m_pApplyCollBtn
->Enable(false);
2085 m_pApplyCollBox
->Enable(false);
2086 m_pPagenumText
->Enable(false);
2087 m_pPagenumEdit
->Enable(false);
2092 IMPL_LINK( SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
, ListBox
*, pListBox
)
2094 //column break or break break after
2095 sal_Int32 nBreakPos
= m_pBreakPositionLB
->GetSelectEntryPos();
2096 if ( pListBox
->GetSelectEntryPos() == 1 || 1 == nBreakPos
)
2098 m_pApplyCollBtn
->SetState( TRISTATE_FALSE
);
2099 m_pApplyCollBtn
->Enable(false);
2100 m_pApplyCollBox
->Enable(false);
2101 m_pPagenumText
->Enable(false);
2102 m_pPagenumEdit
->Enable(false);
2105 PageBreakPosHdl_Impl( m_pBreakPositionLB
);
2109 void SvxExtParagraphTabPage::PageCreated(const SfxAllItemSet
& aSet
)
2111 SFX_ITEMSET_ARG (&aSet
,pDisablePageBreakItem
,SfxBoolItem
,SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK
,false);
2113 if (pDisablePageBreakItem
)
2114 if ( pDisablePageBreakItem
->GetValue())
2118 SvxAsianTabPage::SvxAsianTabPage( Window
* pParent
, const SfxItemSet
& rSet
) :
2119 SfxTabPage(pParent
, "AsianTypography","cui/ui/asiantypography.ui", rSet
)
2122 get(m_pForbiddenRulesCB
,"checkForbidList");
2123 get(m_pHangingPunctCB
,"checkHangPunct");
2124 get(m_pScriptSpaceCB
,"checkApplySpacing");
2126 Link aLink
= LINK( this, SvxAsianTabPage
, ClickHdl_Impl
);
2127 m_pHangingPunctCB
->SetClickHdl( aLink
);
2128 m_pScriptSpaceCB
->SetClickHdl( aLink
);
2129 m_pForbiddenRulesCB
->SetClickHdl( aLink
);
2133 SvxAsianTabPage::~SvxAsianTabPage()
2137 SfxTabPage
* SvxAsianTabPage::Create( Window
* pParent
, const SfxItemSet
& rSet
)
2139 return new SvxAsianTabPage(pParent
, rSet
);
2142 const sal_uInt16
* SvxAsianTabPage::GetRanges()
2144 static const sal_uInt16 pRanges
[] =
2146 SID_ATTR_PARA_SCRIPTSPACE
, SID_ATTR_PARA_FORBIDDEN_RULES
,
2152 bool SvxAsianTabPage::FillItemSet( SfxItemSet
& rSet
)
2155 SfxItemPool
* pPool
= rSet
.GetPool();
2156 if (m_pScriptSpaceCB
->IsEnabled() && m_pScriptSpaceCB
->IsValueChangedFromSaved())
2158 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2159 pPool
->GetWhich(SID_ATTR_PARA_SCRIPTSPACE
)).Clone();
2160 pNewItem
->SetValue(m_pScriptSpaceCB
->IsChecked());
2161 rSet
.Put(*pNewItem
);
2165 if (m_pHangingPunctCB
->IsEnabled() && m_pHangingPunctCB
->IsValueChangedFromSaved())
2167 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2168 pPool
->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION
)).Clone();
2169 pNewItem
->SetValue(m_pHangingPunctCB
->IsChecked());
2170 rSet
.Put(*pNewItem
);
2174 if (m_pForbiddenRulesCB
->IsEnabled() && m_pForbiddenRulesCB
->IsValueChangedFromSaved())
2176 SfxBoolItem
* pNewItem
= (SfxBoolItem
*)rSet
.Get(
2177 pPool
->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES
)).Clone();
2178 pNewItem
->SetValue(m_pForbiddenRulesCB
->IsChecked());
2179 rSet
.Put(*pNewItem
);
2186 static void lcl_SetBox(const SfxItemSet
& rSet
, sal_uInt16 nSlotId
, CheckBox
& rBox
)
2188 sal_uInt16 _nWhich
= rSet
.GetPool()->GetWhich(nSlotId
);
2189 SfxItemState eState
= rSet
.GetItemState(_nWhich
, true);
2190 if(!eState
|| eState
== SFX_ITEM_DISABLED
)
2192 else if(eState
>= SFX_ITEM_AVAILABLE
)
2194 rBox
.EnableTriState( false );
2195 rBox
.Check(((const SfxBoolItem
&)rSet
.Get(_nWhich
)).GetValue());
2198 rBox
.SetState( TRISTATE_INDET
);
2202 void SvxAsianTabPage::Reset( const SfxItemSet
& rSet
)
2204 lcl_SetBox(rSet
, SID_ATTR_PARA_FORBIDDEN_RULES
, *m_pForbiddenRulesCB
);
2205 lcl_SetBox(rSet
, SID_ATTR_PARA_HANGPUNCTUATION
, *m_pHangingPunctCB
);
2207 //character distance not yet available
2208 lcl_SetBox(rSet
, SID_ATTR_PARA_SCRIPTSPACE
, *m_pScriptSpaceCB
);
2211 IMPL_LINK( SvxAsianTabPage
, ClickHdl_Impl
, CheckBox
*, pBox
)
2213 pBox
->EnableTriState( false );
2217 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */