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 .
21 #include <osl/diagnose.h>
22 #include <svl/style.hxx>
23 #include <sfx2/objsh.hxx>
24 #include <vcl/mnemonic.hxx>
25 #include <vcl/settings.hxx>
26 #include <svx/flagsdef.hxx>
27 #include <svx/svxids.hrc>
29 #include <svl/languageoptions.hxx>
30 #include <svl/cjkoptions.hxx>
31 #include <editeng/pgrditem.hxx>
32 #include <svx/strings.hrc>
33 #include <svx/dialmgr.hxx>
34 #include <paragrph.hxx>
35 #include <editeng/frmdiritem.hxx>
36 #include <editeng/lspcitem.hxx>
37 #include <editeng/adjustitem.hxx>
38 #include <editeng/orphitem.hxx>
39 #include <editeng/widwitem.hxx>
40 #include <editeng/tstpitem.hxx>
41 #include <editeng/pmdlitem.hxx>
42 #include <editeng/spltitem.hxx>
43 #include <editeng/hyphenzoneitem.hxx>
44 #include <editeng/ulspitem.hxx>
45 #include <editeng/lrspitem.hxx>
46 #include <editeng/formatbreakitem.hxx>
47 #include <editeng/keepitem.hxx>
48 #include <svx/dlgutil.hxx>
49 #include <sfx2/htmlmode.hxx>
50 #include <editeng/paravertalignitem.hxx>
51 #include <svl/eitem.hxx>
52 #include <svl/intitem.hxx>
54 #include <sfx2/viewfrm.hxx>
56 const sal_uInt16
SvxStdParagraphTabPage::pStdRanges
[] =
58 SID_ATTR_PARA_LINESPACE
, // 10033
59 SID_ATTR_PARA_LINESPACE
,
60 SID_ATTR_LRSPACE
, // 10048 -
61 SID_ATTR_ULSPACE
, // 10049
62 SID_ATTR_PARA_REGISTER
, // 10413
63 SID_ATTR_PARA_REGISTER
,
67 const sal_uInt16
SvxParaAlignTabPage::pAlignRanges
[] =
69 SID_ATTR_PARA_ADJUST
, // 10027
74 const sal_uInt16
SvxExtParagraphTabPage::pExtRanges
[] =
76 SID_ATTR_PARA_PAGEBREAK
, // 10037 -
77 SID_ATTR_PARA_WIDOWS
, // 10041
78 SID_ATTR_PARA_MODEL
, // 10065 -
79 SID_ATTR_PARA_KEEP
, // 10066
83 #define MAX_DURCH 5670 // 10 cm makes sense as maximum interline lead
85 #define FIX_DIST_DEF 283 // standard fix distance 0,5 cm
99 static void SetLineSpace_Impl( SvxLineSpacingItem
&, int, long lValue
= 0 );
101 void SetLineSpace_Impl( SvxLineSpacingItem
& rLineSpace
,
102 int eSpace
, long lValue
)
107 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
108 rLineSpace
.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off
);
112 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
113 rLineSpace
.SetPropLineSpace( 115 );
117 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
118 rLineSpace
.SetPropLineSpace( 150 );
122 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
123 rLineSpace
.SetPropLineSpace( 200 );
126 case LLINESPACE_PROP
:
127 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
128 rLineSpace
.SetPropLineSpace( static_cast<sal_uInt16
>(lValue
) );
132 rLineSpace
.SetLineHeight( static_cast<sal_uInt16
>(lValue
) );
133 rLineSpace
.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off
);
136 case LLINESPACE_DURCH
:
137 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
138 rLineSpace
.SetInterLineSpace( static_cast<sal_uInt16
>(lValue
) );
142 rLineSpace
.SetLineHeight(static_cast<sal_uInt16
>(lValue
));
143 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Fix
);
144 rLineSpace
.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off
);
149 static sal_uInt16
GetHtmlMode_Impl(const SfxItemSet
& rSet
)
151 sal_uInt16 nHtmlMode
= 0;
152 const SfxPoolItem
* pItem
= nullptr;
153 SfxObjectShell
* pShell
;
154 if(SfxItemState::SET
== rSet
.GetItemState(SID_HTML_MODE
, false, &pItem
) ||
155 ( nullptr != (pShell
= SfxObjectShell::Current()) &&
156 nullptr != (pItem
= pShell
->GetItem(SID_HTML_MODE
))))
158 nHtmlMode
= static_cast<const SfxUInt16Item
*>(pItem
)->GetValue();
164 void SvxStdParagraphTabPage::ELRLoseFocus()
166 SfxItemPool
* pPool
= GetItemSet().GetPool();
167 DBG_ASSERT( pPool
, "Where is the pool?" );
169 MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
171 sal_Int64 nL
= m_xLeftIndent
->denormalize(m_xLeftIndent
->get_value(eUnit
));
172 sal_Int64 nR
= m_xRightIndent
->denormalize(m_xRightIndent
->get_value(eUnit
));
173 OUString aTmp
= m_xFLineIndent
->get_text();
175 if (m_xLeftIndent
->get_min(FieldUnit::NONE
) < 0)
176 m_xFLineIndent
->set_min(-99999, FieldUnit::MM
);
178 m_xFLineIndent
->set_min(m_xFLineIndent
->normalize(-nL
), eUnit
);
180 // Check only for concrete width (Shell)
181 sal_Int64 nTmp
= nWidth
- nL
- nR
- MM50
;
182 m_xFLineIndent
->set_max(m_xFLineIndent
->normalize(nTmp
), eUnit
);
185 m_xFLineIndent
->set_text(OUString());
186 // maximum left right
187 aTmp
= m_xLeftIndent
->get_text();
188 nTmp
= nWidth
- nR
- MM50
;
189 m_xLeftIndent
->set_max(m_xLeftIndent
->normalize(nTmp
), eUnit
);
191 if ( aTmp
.isEmpty() )
192 m_xLeftIndent
->set_text(OUString());
193 aTmp
= m_xRightIndent
->get_text();
194 nTmp
= nWidth
- nL
- MM50
;
195 m_xRightIndent
->set_max(m_xRightIndent
->normalize(nTmp
), eUnit
);
197 if ( aTmp
.isEmpty() )
198 m_xRightIndent
->set_text(OUString());
200 UpdateExample_Impl();
203 IMPL_LINK_NOARG(SvxStdParagraphTabPage
, ELRLoseFocusHdl
, weld::MetricSpinButton
&, void)
208 std::unique_ptr
<SfxTabPage
> SvxStdParagraphTabPage::Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
)
210 return std::make_unique
<SvxStdParagraphTabPage
>(pPage
, pController
, *rSet
);
213 bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet
* rOutSet
)
215 SfxItemState eState
= SfxItemState::UNKNOWN
;
216 const SfxPoolItem
* pOld
= nullptr;
217 SfxItemPool
* pPool
= rOutSet
->GetPool();
218 DBG_ASSERT( pPool
, "Where is the pool?" );
220 bool bModified
= false;
222 int nPos
= m_xLineDist
->get_active();
225 ( m_bLineDistToggled
||
226 m_xLineDist
->get_value_changed_from_saved() ||
227 m_xLineDistAtPercentBox
->get_value_changed_from_saved() ||
228 m_xLineDistAtMetricBox
->get_value_changed_from_saved() ) )
230 nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
231 MapUnit eUnit
= SfxViewFrame::Current()->GetPool().GetMetric( nWhich
);
232 SvxLineSpacingItem
aSpacing(
233 static_cast<const SvxLineSpacingItem
&>(GetItemSet().Get( nWhich
)) );
241 SetLineSpace_Impl( aSpacing
, nPos
);
244 case LLINESPACE_PROP
:
245 SetLineSpace_Impl( aSpacing
, nPos
,
246 static_cast<long>(m_xLineDistAtPercentBox
->denormalize(
247 m_xLineDistAtPercentBox
->get_value(FieldUnit::NONE
) )) );
251 case LLINESPACE_DURCH
:
253 SetLineSpace_Impl( aSpacing
, nPos
,
254 GetCoreValue( *m_xLineDistAtMetricBox
, eUnit
) );
258 OSL_FAIL( "unknown LineDist entry" );
261 eState
= GetItemSet().GetItemState( nWhich
);
262 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_LINESPACE
);
264 if ( m_bLineDistToggled
||
265 !pOld
|| !( *static_cast<const SvxLineSpacingItem
*>(pOld
) == aSpacing
) ||
266 SfxItemState::DONTCARE
== eState
)
268 rOutSet
->Put( aSpacing
);
273 if ( m_xTopDist
->get_value_changed_from_saved() || m_xBottomDist
->get_value_changed_from_saved()
274 || m_xContextualCB
->get_state_changed_from_saved())
276 nWhich
= GetWhich( SID_ATTR_ULSPACE
);
277 MapUnit eUnit
= pPool
->GetMetric( nWhich
);
278 pOld
= GetOldItem( *rOutSet
, SID_ATTR_ULSPACE
);
279 SvxULSpaceItem
aMargin( nWhich
);
283 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
285 const SvxULSpaceItem
& rOldItem
=
286 static_cast<const SvxULSpaceItem
&>(GetItemSet().GetParent()->Get( nWhich
));
288 if ( m_xTopDist
->IsRelative() )
289 aMargin
.SetUpper( rOldItem
.GetUpper(),
290 static_cast<sal_uInt16
>(m_xTopDist
->get_value(FieldUnit::NONE
)) );
292 aMargin
.SetUpper( static_cast<sal_uInt16
>(m_xTopDist
->GetCoreValue(eUnit
)) );
294 if ( m_xBottomDist
->IsRelative() )
295 aMargin
.SetLower( rOldItem
.GetLower(),
296 static_cast<sal_uInt16
>(m_xBottomDist
->get_value(FieldUnit::NONE
)) );
298 aMargin
.SetLower( static_cast<sal_uInt16
>(m_xBottomDist
->GetCoreValue(eUnit
)) );
303 aMargin
.SetUpper(static_cast<sal_uInt16
>(m_xTopDist
->GetCoreValue(eUnit
)));
304 aMargin
.SetLower(static_cast<sal_uInt16
>(m_xBottomDist
->GetCoreValue(eUnit
)));
306 aMargin
.SetContextValue(m_xContextualCB
->get_active());
307 eState
= GetItemSet().GetItemState( nWhich
);
309 if ( !pOld
|| *static_cast<const SvxULSpaceItem
*>(pOld
) != aMargin
||
310 SfxItemState::DONTCARE
== eState
)
312 rOutSet
->Put( aMargin
);
316 bool bNullTab
= false;
318 if ( m_xLeftIndent
->get_value_changed_from_saved() ||
319 m_xFLineIndent
->get_value_changed_from_saved() ||
320 m_xRightIndent
->get_value_changed_from_saved() ||
321 m_xAutoCB
->get_state_changed_from_saved() )
323 nWhich
= GetWhich( SID_ATTR_LRSPACE
);
324 MapUnit eUnit
= pPool
->GetMetric( nWhich
);
325 SvxLRSpaceItem
aMargin( nWhich
);
326 pOld
= GetOldItem( *rOutSet
, SID_ATTR_LRSPACE
);
330 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
332 const SvxLRSpaceItem
& rOldItem
=
333 static_cast<const SvxLRSpaceItem
&>(GetItemSet().GetParent()->Get( nWhich
));
335 if (m_xLeftIndent
->IsRelative())
336 aMargin
.SetTextLeft( rOldItem
.GetTextLeft(),
337 static_cast<sal_uInt16
>(m_xLeftIndent
->get_value(FieldUnit::NONE
)) );
339 aMargin
.SetTextLeft(m_xLeftIndent
->GetCoreValue(eUnit
));
341 if ( m_xRightIndent
->IsRelative() )
342 aMargin
.SetRight( rOldItem
.GetRight(),
343 static_cast<sal_uInt16
>(m_xRightIndent
->get_value(FieldUnit::NONE
)) );
345 aMargin
.SetRight(m_xRightIndent
->GetCoreValue(eUnit
));
347 if ( m_xFLineIndent
->IsRelative() )
348 aMargin
.SetTextFirstLineOfst( rOldItem
.GetTextFirstLineOfst(),
349 static_cast<sal_uInt16
>(m_xFLineIndent
->get_value(FieldUnit::NONE
)) );
351 aMargin
.SetTextFirstLineOfst(static_cast<sal_uInt16
>(m_xFLineIndent
->GetCoreValue(eUnit
)));
355 aMargin
.SetTextLeft(m_xLeftIndent
->GetCoreValue(eUnit
));
356 aMargin
.SetRight(m_xRightIndent
->GetCoreValue(eUnit
));
357 aMargin
.SetTextFirstLineOfst(static_cast<sal_uInt16
>(m_xFLineIndent
->GetCoreValue(eUnit
)));
359 aMargin
.SetAutoFirst(m_xAutoCB
->get_active());
360 if ( aMargin
.GetTextFirstLineOfst() < 0 )
362 eState
= GetItemSet().GetItemState( nWhich
);
364 if ( !pOld
|| *static_cast<const SvxLRSpaceItem
*>(pOld
) != aMargin
||
365 SfxItemState::DONTCARE
== eState
)
367 rOutSet
->Put( aMargin
);
374 MapUnit eUnit
= pPool
->GetMetric( GetWhich( SID_ATTR_TABSTOP
) );
375 if ( MapUnit::Map100thMM
!= eUnit
)
378 // negative first line indent -> set null default tabstob if applicable
379 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_TABSTOP
);
380 const SfxItemSet
& rInSet
= GetItemSet();
382 if ( rInSet
.GetItemState( _nWhich
) >= SfxItemState::DEFAULT
)
384 const SvxTabStopItem
& rTabItem
=
385 static_cast<const SvxTabStopItem
&>(rInSet
.Get( _nWhich
));
386 SvxTabStopItem
aNullTab( rTabItem
);
387 SvxTabStop
aNull( 0, SvxTabAdjust::Default
);
388 aNullTab
.Insert( aNull
);
389 rOutSet
->Put( aNullTab
);
393 if (m_xRegisterCB
->get_visible())
395 const SfxBoolItem
* pBoolItem
= static_cast<const SfxBoolItem
*>(GetOldItem(
396 *rOutSet
, SID_ATTR_PARA_REGISTER
));
399 std::unique_ptr
<SfxBoolItem
> pRegItem(static_cast<SfxBoolItem
*>(pBoolItem
->Clone()));
400 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
401 bool bSet
= pRegItem
->GetValue();
403 if (m_xRegisterCB
->get_active() != bSet
)
405 pRegItem
->SetValue(!bSet
);
406 rOutSet
->Put(*pRegItem
);
409 else if ( SfxItemState::DEFAULT
== GetItemSet().GetItemState( _nWhich
, false ) )
410 rOutSet
->ClearItem(_nWhich
);
416 void SvxStdParagraphTabPage::Reset( const SfxItemSet
* rSet
)
418 SfxItemPool
* pPool
= rSet
->GetPool();
419 DBG_ASSERT( pPool
, "Where is the pool?" );
422 FieldUnit eFUnit
= GetModuleFieldUnit( *rSet
);
424 bool bApplyCharUnit
= GetApplyCharUnit( *rSet
);
426 SvtCJKOptions aCJKOptions
;
427 if(aCJKOptions
.IsAsianTypographyEnabled() && bApplyCharUnit
)
428 eFUnit
= FieldUnit::CHAR
;
430 m_xLeftIndent
->SetFieldUnit(eFUnit
);
431 m_xRightIndent
->SetFieldUnit(eFUnit
);
432 m_xFLineIndent
->SetFieldUnit(eFUnit
);
433 if ( eFUnit
== FieldUnit::CHAR
)
435 m_xTopDist
->SetFieldUnit(FieldUnit::LINE
);
436 m_xBottomDist
->SetFieldUnit(FieldUnit::LINE
);
437 SetFieldUnit(*m_xLineDistAtMetricBox
, FieldUnit::POINT
);
441 m_xTopDist
->SetFieldUnit(eFUnit
);
442 m_xBottomDist
->SetFieldUnit(eFUnit
);
443 SetFieldUnit(*m_xLineDistAtMetricBox
, eFUnit
);
446 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_LRSPACE
);
447 SfxItemState eItemState
= rSet
->GetItemState( _nWhich
);
449 if ( eItemState
>= SfxItemState::DEFAULT
)
451 MapUnit eUnit
= pPool
->GetMetric( _nWhich
);
455 const SvxLRSpaceItem
& rOldItem
=
456 static_cast<const SvxLRSpaceItem
&>(rSet
->Get( _nWhich
));
458 if ( rOldItem
.GetPropLeft() != 100 )
460 m_xLeftIndent
->SetRelative( true );
461 m_xLeftIndent
->set_value(rOldItem
.GetPropLeft(), FieldUnit::NONE
);
465 m_xLeftIndent
->SetRelative(false);
466 m_xLeftIndent
->SetFieldUnit(eFUnit
);
467 m_xLeftIndent
->SetMetricValue(rOldItem
.GetTextLeft(), eUnit
);
470 if ( rOldItem
.GetPropRight() != 100 )
472 m_xRightIndent
->SetRelative( true );
473 m_xRightIndent
->set_value(rOldItem
.GetPropRight(), FieldUnit::NONE
);
477 m_xRightIndent
->SetRelative(false);
478 m_xRightIndent
->SetFieldUnit(eFUnit
);
479 m_xRightIndent
->SetMetricValue(rOldItem
.GetRight(), eUnit
);
482 if ( rOldItem
.GetPropTextFirstLineOfst() != 100 )
484 m_xFLineIndent
->SetRelative(true);
485 m_xFLineIndent
->set_value(rOldItem
.GetPropTextFirstLineOfst(), FieldUnit::NONE
);
489 m_xFLineIndent
->SetRelative(false);
490 m_xFLineIndent
->set_min(-9999, FieldUnit::NONE
);
491 m_xFLineIndent
->SetFieldUnit(eFUnit
);
492 m_xFLineIndent
->SetMetricValue(rOldItem
.GetTextFirstLineOfst(), eUnit
);
494 m_xAutoCB
->set_active(rOldItem
.IsAutoFirst());
498 const SvxLRSpaceItem
& rSpace
=
499 static_cast<const SvxLRSpaceItem
&>(rSet
->Get( _nWhich
));
501 m_xLeftIndent
->SetMetricValue(rSpace
.GetTextLeft(), eUnit
);
502 m_xRightIndent
->SetMetricValue(rSpace
.GetRight(), eUnit
);
503 m_xFLineIndent
->SetMetricValue(rSpace
.GetTextFirstLineOfst(), eUnit
);
504 m_xAutoCB
->set_active(rSpace
.IsAutoFirst());
506 AutoHdl_Impl(*m_xAutoCB
);
510 m_xLeftIndent
->set_text(OUString());
511 m_xRightIndent
->set_text(OUString());
512 m_xFLineIndent
->set_text(OUString());
515 _nWhich
= GetWhich( SID_ATTR_ULSPACE
);
516 eItemState
= rSet
->GetItemState( _nWhich
);
518 if ( eItemState
>= SfxItemState::DEFAULT
)
520 MapUnit eUnit
= pPool
->GetMetric( _nWhich
);
522 const SvxULSpaceItem
& rOldItem
=
523 static_cast<const SvxULSpaceItem
&>(rSet
->Get( _nWhich
));
527 if ( rOldItem
.GetPropUpper() != 100 )
529 m_xTopDist
->SetRelative( true );
530 m_xTopDist
->set_value(rOldItem
.GetPropUpper(), FieldUnit::NONE
);
534 m_xTopDist
->SetRelative(false);
535 if (eFUnit
== FieldUnit::CHAR
)
536 m_xTopDist
->SetFieldUnit(FieldUnit::LINE
);
538 m_xTopDist
->SetFieldUnit(eFUnit
);
539 m_xTopDist
->SetMetricValue(rOldItem
.GetUpper(), eUnit
);
542 if ( rOldItem
.GetPropLower() != 100 )
544 m_xBottomDist
->SetRelative( true );
545 m_xBottomDist
->set_value(rOldItem
.GetPropLower(), FieldUnit::NONE
);
549 m_xBottomDist
->SetRelative(false);
550 if (eFUnit
== FieldUnit::CHAR
)
551 m_xBottomDist
->SetFieldUnit(FieldUnit::LINE
);
553 m_xBottomDist
->SetFieldUnit(eFUnit
);
554 m_xBottomDist
->SetMetricValue(rOldItem
.GetLower(), eUnit
);
559 m_xTopDist
->SetMetricValue(rOldItem
.GetUpper(), eUnit
);
560 m_xBottomDist
->SetMetricValue(rOldItem
.GetLower(), eUnit
);
562 m_xContextualCB
->set_active(rOldItem
.GetContext());
566 m_xTopDist
->set_text(OUString());
567 m_xBottomDist
->set_text(OUString());
570 _nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
571 eItemState
= rSet
->GetItemState( _nWhich
);
573 if ( eItemState
>= SfxItemState::DEFAULT
)
574 SetLineSpacing_Impl( static_cast<const SvxLineSpacingItem
&>(rSet
->Get( _nWhich
)) );
576 m_xLineDist
->set_active(-1);
578 _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
579 eItemState
= rSet
->GetItemState( _nWhich
);
581 if ( eItemState
>= SfxItemState::DEFAULT
)
582 m_xRegisterCB
->set_active( static_cast<const SfxBoolItem
&>(rSet
->Get( _nWhich
)).GetValue());
583 m_xRegisterCB
->save_state();
584 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(*rSet
);
585 if(nHtmlMode
& HTMLMODE_ON
)
587 m_xRegisterFL
->hide();
588 m_xRegisterCB
->hide();
592 // this sets the min/max limits; do this _after_ setting the values,
593 // because for Impress the min of first-line indent depends on value of
599 void SvxStdParagraphTabPage::ChangesApplied()
601 m_xLeftIndent
->save_value();
602 m_xRightIndent
->save_value();
603 m_xFLineIndent
->save_value();
604 m_xLineDist
->save_value();
605 m_xLineDistAtPercentBox
->save_value();
606 m_xLineDistAtMetricBox
->save_value();
607 m_xRegisterCB
->save_state();
608 m_xTopDist
->save_value();
609 m_xBottomDist
->save_value();
610 m_xContextualCB
->save_state();
611 m_xAutoCB
->save_state();
614 void SvxStdParagraphTabPage::EnableRelativeMode()
616 DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
618 m_xLeftIndent
->EnableRelativeMode( 0, 999 );
619 m_xFLineIndent
->EnableRelativeMode( 0, 999 );
620 m_xRightIndent
->EnableRelativeMode( 0, 999 );
621 m_xTopDist
->EnableRelativeMode( 0, 999 );
622 m_xBottomDist
->EnableRelativeMode( 0, 999 );
623 bRelativeMode
= true;
626 void SvxStdParagraphTabPage::ActivatePage( const SfxItemSet
& rSet
)
628 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
629 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
631 if ( eItemState
>= SfxItemState::DEFAULT
)
633 const SvxAdjustItem
& rAdj
= static_cast<const SvxAdjustItem
&>( rSet
.Get( _nWhich
) );
634 SvxAdjust eAdjust
= rAdj
.GetAdjust();
635 if ( eAdjust
== SvxAdjust::Center
|| eAdjust
== SvxAdjust::Block
)
637 _nWhich
= GetWhich( SID_ATTR_FRAMEDIRECTION
);
638 eItemState
= rSet
.GetItemState( _nWhich
);
640 if ( eItemState
>= SfxItemState::DEFAULT
)
642 const SvxFrameDirectionItem
& rFrameDirItem
= static_cast<const SvxFrameDirectionItem
&>( rSet
.Get( _nWhich
) );
643 SvxFrameDirection eFrameDirection
= rFrameDirItem
.GetValue();
645 m_aExampleWin
.EnableRTL( SvxFrameDirection::Horizontal_RL_TB
== eFrameDirection
);
647 if ( eAdjust
== SvxAdjust::Block
)
648 m_aExampleWin
.SetLastLine( rAdj
.GetLastBlock() );
653 m_aExampleWin
.EnableRTL( eAdjust
== SvxAdjust::Right
);
654 eAdjust
= SvxAdjust::Left
; //required for correct preview display
655 m_aExampleWin
.SetLastLine( eAdjust
);
657 m_aExampleWin
.SetAdjust( eAdjust
);
659 UpdateExample_Impl();
663 DeactivateRC
SvxStdParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
668 FillItemSet( _pSet
);
669 return DeactivateRC::LeavePage
;
672 SvxStdParagraphTabPage::SvxStdParagraphTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttr
)
673 : SfxTabPage(pPage
, pController
, "cui/ui/paraindentspacing.ui", "ParaIndentSpacing", &rAttr
)
674 , nWidth(11905 /*567 * 50*/)
676 , bRelativeMode(false)
677 , m_xLeftIndent(new RelativeField(m_xBuilder
->weld_metric_spin_button("spinED_LEFTINDENT", FieldUnit::CM
)))
678 , m_xRightLabel(m_xBuilder
->weld_label("labelFT_RIGHTINDENT"))
679 , m_xRightIndent(new RelativeField(m_xBuilder
->weld_metric_spin_button("spinED_RIGHTINDENT", FieldUnit::CM
)))
680 , m_xFLineLabel(m_xBuilder
->weld_label("labelFT_FLINEINDENT"))
681 , m_xFLineIndent(new RelativeField(m_xBuilder
->weld_metric_spin_button("spinED_FLINEINDENT", FieldUnit::CM
)))
682 , m_xAutoCB(m_xBuilder
->weld_check_button("checkCB_AUTO"))
683 , m_xTopDist(new RelativeField(m_xBuilder
->weld_metric_spin_button("spinED_TOPDIST", FieldUnit::CM
)))
684 , m_xBottomDist(new RelativeField(m_xBuilder
->weld_metric_spin_button("spinED_BOTTOMDIST", FieldUnit::CM
)))
685 , m_xContextualCB(m_xBuilder
->weld_check_button("checkCB_CONTEXTUALSPACING"))
686 , m_xLineDist(m_xBuilder
->weld_combo_box("comboLB_LINEDIST"))
687 , m_xLineDistAtPercentBox(m_xBuilder
->weld_metric_spin_button("spinED_LINEDISTPERCENT", FieldUnit::PERCENT
))
688 , m_xLineDistAtMetricBox(m_xBuilder
->weld_metric_spin_button("spinED_LINEDISTMETRIC", FieldUnit::CM
))
689 , m_xLineDistAtLabel(m_xBuilder
->weld_label("labelFT_LINEDIST"))
690 , m_xAbsDist(m_xBuilder
->weld_label("labelST_LINEDIST_ABS"))
691 , m_xRegisterFL(m_xBuilder
->weld_widget("frameFL_REGISTER"))
692 , m_xRegisterCB(m_xBuilder
->weld_check_button("checkCB_REGISTER"))
693 , m_xExampleWin(new weld::CustomWeld(*m_xBuilder
, "drawingareaWN_EXAMPLE", m_aExampleWin
))
695 sAbsDist
= m_xAbsDist
->get_label();
697 // this page needs ExchangeSupport
698 SetExchangeSupport();
700 m_xLineDistAtMetricBox
->hide();
703 m_xFLineIndent
->set_min(-9999, FieldUnit::NONE
); // is set to 0 on default
706 SvxStdParagraphTabPage::~SvxStdParagraphTabPage()
710 void SvxStdParagraphTabPage::EnableNegativeMode()
712 m_xLeftIndent
->set_min(-9999, FieldUnit::NONE
);
713 m_xRightIndent
->set_min(-9999, FieldUnit::NONE
);
714 m_xRightIndent
->EnableNegativeMode();
715 m_xLeftIndent
->EnableNegativeMode();
718 void SvxStdParagraphTabPage::SetLineSpacing_Impl
720 const SvxLineSpacingItem
&rAttr
723 MapUnit eUnit
= SfxViewFrame::Current()->GetPool().GetMetric( rAttr
.Which() );
725 switch( rAttr
.GetLineSpaceRule() )
727 case SvxLineSpaceRule::Auto
:
729 SvxInterLineSpaceRule eInter
= rAttr
.GetInterLineSpaceRule();
733 // Default single line spacing
734 case SvxInterLineSpaceRule::Off
:
735 m_xLineDist
->set_active( LLINESPACE_1
);
738 // Default single line spacing
739 case SvxInterLineSpaceRule::Prop
:
740 if ( 100 == rAttr
.GetPropLineSpace() )
742 m_xLineDist
->set_active( LLINESPACE_1
);
746 if ( 115 == rAttr
.GetPropLineSpace() )
748 m_xLineDist
->set_active( LLINESPACE_115
);
752 if ( 150 == rAttr
.GetPropLineSpace() )
754 m_xLineDist
->set_active( LLINESPACE_15
);
757 // double line spacing
758 if ( 200 == rAttr
.GetPropLineSpace() )
760 m_xLineDist
->set_active( LLINESPACE_2
);
763 // the set per cent value
764 m_xLineDistAtPercentBox
->set_value(m_xLineDistAtPercentBox
->normalize(rAttr
.GetPropLineSpace()), FieldUnit::NONE
);
765 m_xLineDist
->set_active( LLINESPACE_PROP
);
768 case SvxInterLineSpaceRule::Fix
:
769 SetMetricValue( *m_xLineDistAtMetricBox
, rAttr
.GetInterLineSpace(), eUnit
);
770 m_xLineDist
->set_active( LLINESPACE_DURCH
);
772 default: ;//prevent warning
776 case SvxLineSpaceRule::Fix
:
777 SetMetricValue(*m_xLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
778 m_xLineDist
->set_active( LLINESPACE_FIX
);
781 case SvxLineSpaceRule::Min
:
782 SetMetricValue(*m_xLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
783 m_xLineDist
->set_active( LLINESPACE_MIN
);
785 default: ;//prevent warning
787 LineDistHdl_Impl( *m_xLineDist
);
790 IMPL_LINK_NOARG(SvxStdParagraphTabPage
, LineDistPopupHdl_Impl
, weld::ComboBox
&, void)
792 m_bLineDistToggled
= true;
795 IMPL_LINK(SvxStdParagraphTabPage
, LineDistHdl_Impl
, weld::ComboBox
&, rBox
, void)
797 switch (rBox
.get_active())
803 m_xLineDistAtLabel
->set_sensitive(false);
804 m_xLineDistAtPercentBox
->set_sensitive(false);
805 m_xLineDistAtPercentBox
->set_text(OUString());
806 m_xLineDistAtMetricBox
->set_sensitive(false);
807 m_xLineDistAtMetricBox
->set_text(OUString());
810 case LLINESPACE_DURCH
:
811 // setting a sensible default?
812 // limit MS min(10, aPageSize)
813 m_xLineDistAtMetricBox
->set_min(0, FieldUnit::NONE
);
815 if (m_xLineDistAtMetricBox
->get_text().isEmpty())
816 m_xLineDistAtMetricBox
->set_value(m_xLineDistAtMetricBox
->normalize(1), FieldUnit::NONE
);
817 m_xLineDistAtPercentBox
->hide();
818 m_xLineDistAtMetricBox
->show();
819 m_xLineDistAtMetricBox
->set_sensitive(true);
820 m_xLineDistAtLabel
->set_sensitive(true);
824 m_xLineDistAtMetricBox
->set_min(0, FieldUnit::NONE
);
826 if (m_xLineDistAtMetricBox
->get_text().isEmpty())
827 m_xLineDistAtMetricBox
->set_value(m_xLineDistAtMetricBox
->normalize(10), FieldUnit::TWIP
);
828 m_xLineDistAtPercentBox
->hide();
829 m_xLineDistAtMetricBox
->show();
830 m_xLineDistAtMetricBox
->set_sensitive(true);
831 m_xLineDistAtLabel
->set_sensitive(true);
834 case LLINESPACE_PROP
:
836 if (m_xLineDistAtPercentBox
->get_text().isEmpty())
837 m_xLineDistAtPercentBox
->set_value(m_xLineDistAtPercentBox
->normalize(100), FieldUnit::TWIP
);
838 m_xLineDistAtMetricBox
->hide();
839 m_xLineDistAtPercentBox
->show();
840 m_xLineDistAtPercentBox
->set_sensitive(true);
841 m_xLineDistAtLabel
->set_sensitive(true);
845 auto nTemp
= m_xLineDistAtMetricBox
->get_value(FieldUnit::NONE
);
846 m_xLineDistAtMetricBox
->set_min(m_xLineDistAtMetricBox
->normalize(nMinFixDist
), FieldUnit::TWIP
);
848 // if the value has been changed at SetMin,
849 // it is time for the default
850 if (m_xLineDistAtMetricBox
->get_value(FieldUnit::NONE
) != nTemp
)
851 SetMetricValue( *m_xLineDistAtMetricBox
, FIX_DIST_DEF
, MapUnit::MapTwip
); // fix is only in Writer
852 m_xLineDistAtPercentBox
->hide();
853 m_xLineDistAtMetricBox
->show();
854 m_xLineDistAtMetricBox
->set_sensitive(true);
855 m_xLineDistAtLabel
->set_sensitive(true);
859 UpdateExample_Impl();
862 IMPL_LINK_NOARG(SvxStdParagraphTabPage
, ModifyHdl_Impl
, weld::MetricSpinButton
&, void)
864 UpdateExample_Impl();
867 void SvxStdParagraphTabPage::Init_Impl()
869 m_xLineDist
->connect_popup_toggled(LINK(this, SvxStdParagraphTabPage
, LineDistPopupHdl_Impl
));
870 m_xLineDist
->connect_changed(LINK(this, SvxStdParagraphTabPage
, LineDistHdl_Impl
));
872 Link
<weld::MetricSpinButton
&,void> aLink2
= LINK(this, SvxStdParagraphTabPage
, ELRLoseFocusHdl
);
873 m_xFLineIndent
->connect_value_changed(aLink2
);
874 m_xLeftIndent
->connect_value_changed(aLink2
);
875 m_xRightIndent
->connect_value_changed(aLink2
);
877 Link
<weld::MetricSpinButton
&,void> aLink
= LINK(this, SvxStdParagraphTabPage
, ModifyHdl_Impl
);
878 m_xTopDist
->connect_value_changed(aLink
);
879 m_xBottomDist
->connect_value_changed(aLink
);
881 m_xAutoCB
->connect_toggled(LINK(this, SvxStdParagraphTabPage
, AutoHdl_Impl
));
882 SfxItemPool
* pPool
= GetItemSet().GetPool();
883 DBG_ASSERT( pPool
, "Where is the pool?" );
884 FieldUnit eUnit
= MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
886 m_xTopDist
->set_max( m_xTopDist
->normalize( MAX_DURCH
), eUnit
);
887 m_xBottomDist
->set_max( m_xBottomDist
->normalize( MAX_DURCH
), eUnit
);
888 m_xLineDistAtMetricBox
->set_max( m_xLineDistAtMetricBox
->normalize( MAX_DURCH
), eUnit
);
891 void SvxStdParagraphTabPage::UpdateExample_Impl()
893 m_aExampleWin
.SetFirstLineOfst( static_cast<short>(m_xFLineIndent
->denormalize( m_xFLineIndent
->get_value( FieldUnit::TWIP
) )) );
894 m_aExampleWin
.SetLeftMargin( static_cast<long>(m_xLeftIndent
->denormalize( m_xLeftIndent
->get_value( FieldUnit::TWIP
) ) ) );
895 m_aExampleWin
.SetRightMargin( static_cast<long>(m_xRightIndent
->denormalize( m_xRightIndent
->get_value( FieldUnit::TWIP
) ) ) );
896 m_aExampleWin
.SetUpper( static_cast<sal_uInt16
>(m_xTopDist
->denormalize( m_xTopDist
->get_value( FieldUnit::TWIP
) )) );
897 m_aExampleWin
.SetLower( static_cast<sal_uInt16
>(m_xBottomDist
->denormalize( m_xBottomDist
->get_value( FieldUnit::TWIP
) )) );
899 int nPos
= m_xLineDist
->get_active();
907 case LLINESPACE_PROP
:
909 case LLINESPACE_DURCH
:
911 m_aExampleWin
.SetLineSpace( static_cast<SvxPrevLineSpace
>(nPos
) );
914 m_aExampleWin
.Invalidate();
917 void SvxStdParagraphTabPage::EnableRegisterMode()
919 m_xRegisterCB
->show();
920 m_xRegisterFL
->show();
923 void SvxStdParagraphTabPage::EnableContextualMode()
925 m_xContextualCB
->show();
928 IMPL_LINK(SvxStdParagraphTabPage
, AutoHdl_Impl
, weld::ToggleButton
&, rBox
, void)
930 bool bEnable
= !rBox
.get_active();
931 m_xFLineLabel
->set_sensitive(bEnable
);
932 m_xFLineIndent
->set_sensitive(bEnable
);
935 void SvxStdParagraphTabPage::EnableAutoFirstLine()
940 void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip
)
942 m_xLineDist
->append_text(sAbsDist
);
943 nMinFixDist
= nMinTwip
;
946 void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet
& aSet
)
949 /* different bit represent call to different method of SvxStdParagraphTabPage
950 0x0001 --->EnableRelativeMode()
951 0x0002 --->EnableRegisterMode()
952 0x0004 --->EnableAutoFirstLine()
953 0x0008 --->EnableNegativeMode()
954 0x0010 --->EnableContextualMode()
956 const SfxUInt16Item
* pPageWidthItem
= aSet
.GetItem
<SfxUInt16Item
>(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH
, false);
957 const SfxUInt32Item
* pFlagSetItem
= aSet
.GetItem
<SfxUInt32Item
>(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET
, false);
958 const SfxUInt32Item
* pLineDistItem
= aSet
.GetItem
<SfxUInt32Item
>(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST
, false);
961 nWidth
= pPageWidthItem
->GetValue();
965 if (( 0x0001 & pFlagSetItem
->GetValue())== 0x0001 )
966 EnableRelativeMode();
968 if (( 0x0002 & pFlagSetItem
->GetValue())== 0x0002 )
969 EnableRegisterMode();
971 if ( ( 0x0004 & pFlagSetItem
->GetValue())== 0x0004 )
972 EnableAutoFirstLine();
976 EnableAbsLineDist(pLineDistItem
->GetValue());
980 if (( 0x0008 & pFlagSetItem
->GetValue()) == 0x0008 )
981 EnableNegativeMode();
983 if (( 0x0010 & pFlagSetItem
->GetValue()) == 0x0010 )
984 EnableContextualMode();
988 #define LASTLINEPOS_DEFAULT 0
989 #define LASTLINEPOS_LEFT 1
991 #define LASTLINECOUNT_OLD 3
992 #define LASTLINECOUNT_NEW 4
994 SvxParaAlignTabPage::SvxParaAlignTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
)
995 : SfxTabPage(pPage
, pController
, "cui/ui/paragalignpage.ui", "ParaAlignPage", &rSet
)
996 , m_xLeft(m_xBuilder
->weld_radio_button("radioBTN_LEFTALIGN"))
997 , m_xRight(m_xBuilder
->weld_radio_button("radioBTN_RIGHTALIGN"))
998 , m_xCenter(m_xBuilder
->weld_radio_button("radioBTN_CENTERALIGN"))
999 , m_xJustify(m_xBuilder
->weld_radio_button("radioBTN_JUSTIFYALIGN"))
1000 , m_xLeftBottom(m_xBuilder
->weld_label("labelST_LEFTALIGN_ASIAN"))
1001 , m_xRightTop(m_xBuilder
->weld_label("labelST_RIGHTALIGN_ASIAN"))
1002 , m_xLastLineFT(m_xBuilder
->weld_label("labelLB_LASTLINE"))
1003 , m_xLastLineLB(m_xBuilder
->weld_combo_box("comboLB_LASTLINE"))
1004 , m_xExpandCB(m_xBuilder
->weld_check_button("checkCB_EXPAND"))
1005 , m_xSnapToGridCB(m_xBuilder
->weld_check_button("checkCB_SNAP"))
1006 , m_xExampleWin(new weld::CustomWeld(*m_xBuilder
, "drawingareaWN_EXAMPLE", m_aExampleWin
))
1007 , m_xVertAlignFL(m_xBuilder
->weld_widget("frameFL_VERTALIGN"))
1008 , m_xVertAlignLB(m_xBuilder
->weld_combo_box("comboLB_VERTALIGN"))
1009 , m_xPropertiesFL(m_xBuilder
->weld_widget("framePROPERTIES"))
1010 , m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder
->weld_combo_box("comboLB_TEXTDIRECTION")))
1012 SetExchangeSupport();
1014 SvtLanguageOptions aLangOptions
;
1015 sal_uInt16 nLastLinePos
= LASTLINEPOS_DEFAULT
;
1017 if ( aLangOptions
.IsAsianTypographyEnabled() )
1019 m_xLeft
->set_label(m_xLeftBottom
->get_label());
1020 m_xRight
->set_label(m_xRightTop
->get_label());
1022 OUString
sLeft(m_xLeft
->get_label());
1023 sLeft
= MnemonicGenerator::EraseAllMnemonicChars( sLeft
);
1025 if (m_xLastLineLB
->get_count() == LASTLINECOUNT_OLD
)
1027 m_xLastLineLB
->remove(0);
1028 m_xLastLineLB
->insert_text(0, sLeft
);
1031 nLastLinePos
= LASTLINEPOS_LEFT
;
1034 // remove "Default" or "Left" entry, depends on CJKOptions
1035 if (m_xLastLineLB
->get_count() == LASTLINECOUNT_NEW
)
1036 m_xLastLineLB
->remove(nLastLinePos
);
1038 Link
<weld::ToggleButton
&, void> aLink
= LINK( this, SvxParaAlignTabPage
, AlignHdl_Impl
);
1039 m_xLeft
->connect_toggled(aLink
);
1040 m_xRight
->connect_toggled(aLink
);
1041 m_xCenter
->connect_toggled(aLink
);
1042 m_xJustify
->connect_toggled(aLink
);
1043 m_xLastLineLB
->connect_changed(LINK(this, SvxParaAlignTabPage
, LastLineHdl_Impl
));
1044 m_xTextDirectionLB
->connect_changed(LINK(this, SvxParaAlignTabPage
, TextDirectionHdl_Impl
));
1046 m_xTextDirectionLB
->append(SvxFrameDirection::Environment
, SvxResId(RID_SVXSTR_FRAMEDIR_SUPER
));
1047 m_xTextDirectionLB
->append(SvxFrameDirection::Horizontal_LR_TB
, SvxResId(RID_SVXSTR_FRAMEDIR_LTR
));
1048 m_xTextDirectionLB
->append(SvxFrameDirection::Horizontal_RL_TB
, SvxResId(RID_SVXSTR_FRAMEDIR_RTL
));
1051 SvxParaAlignTabPage::~SvxParaAlignTabPage()
1055 DeactivateRC
SvxParaAlignTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1058 FillItemSet( _pSet
);
1059 return DeactivateRC::LeavePage
;
1062 std::unique_ptr
<SfxTabPage
> SvxParaAlignTabPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
)
1064 return std::make_unique
<SvxParaAlignTabPage
>(pPage
, pController
, *rSet
);
1067 bool SvxParaAlignTabPage::FillItemSet( SfxItemSet
* rOutSet
)
1069 bool bModified
= false;
1072 SvxAdjust eAdjust
= SvxAdjust::Left
;
1074 if (m_xLeft
->get_active())
1076 eAdjust
= SvxAdjust::Left
;
1077 bAdj
= m_xLeft
->get_saved_state() == TRISTATE_FALSE
;
1079 else if (m_xRight
->get_active())
1081 eAdjust
= SvxAdjust::Right
;
1082 bAdj
= m_xRight
->get_saved_state() == TRISTATE_FALSE
;
1084 else if (m_xCenter
->get_active())
1086 eAdjust
= SvxAdjust::Center
;
1087 bAdj
= m_xCenter
->get_saved_state() == TRISTATE_FALSE
;
1089 else if (m_xJustify
->get_active())
1091 eAdjust
= SvxAdjust::Block
;
1092 bAdj
= m_xJustify
->get_saved_state() == TRISTATE_FALSE
||
1093 m_xExpandCB
->get_state_changed_from_saved() ||
1094 m_xLastLineLB
->get_value_changed_from_saved();
1097 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1101 SvxAdjust eOneWord
= m_xExpandCB
->get_active() ? SvxAdjust::Block
: SvxAdjust::Left
;
1103 int nLBPos
= m_xLastLineLB
->get_active();
1104 SvxAdjust eLastBlock
= SvxAdjust::Left
;
1106 eLastBlock
= SvxAdjust::Center
;
1107 else if ( 2 == nLBPos
)
1108 eLastBlock
= SvxAdjust::Block
;
1110 SvxAdjustItem
aAdj( static_cast<const SvxAdjustItem
&>(GetItemSet().Get( _nWhich
)) );
1111 aAdj
.SetAdjust( eAdjust
);
1112 aAdj
.SetOneWord( eOneWord
);
1113 aAdj
.SetLastBlock( eLastBlock
);
1114 rOutSet
->Put( aAdj
);
1118 if (m_xSnapToGridCB
->get_state_changed_from_saved())
1120 rOutSet
->Put(SvxParaGridItem(m_xSnapToGridCB
->get_active(), GetWhich( SID_ATTR_PARA_SNAPTOGRID
)));
1124 if (m_xVertAlignLB
->get_value_changed_from_saved())
1126 rOutSet
->Put(SvxParaVertAlignItem(static_cast<SvxParaVertAlignItem::Align
>(m_xVertAlignLB
->get_active()), GetWhich( SID_PARA_VERTALIGN
)));
1130 if (m_xTextDirectionLB
->get_visible())
1132 if (m_xTextDirectionLB
->get_value_changed_from_saved())
1134 SvxFrameDirection eDir
= m_xTextDirectionLB
->get_active_id();
1135 rOutSet
->Put( SvxFrameDirectionItem( eDir
, GetWhich( SID_ATTR_FRAMEDIRECTION
) ) );
1143 void SvxParaAlignTabPage::ActivatePage( const SfxItemSet
& rSet
)
1148 void SvxParaAlignTabPage::Reset( const SfxItemSet
* rSet
)
1150 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1151 SfxItemState eItemState
= rSet
->GetItemState( _nWhich
);
1153 sal_Int32 nLBSelect
= 0;
1154 if ( eItemState
>= SfxItemState::DEFAULT
)
1156 const SvxAdjustItem
& rAdj
= static_cast<const SvxAdjustItem
&>(rSet
->Get( _nWhich
));
1158 switch ( rAdj
.GetAdjust() /*!!! ask VB rAdj.GetLastBlock()*/ )
1160 case SvxAdjust::Left
: m_xLeft
->set_active(true); break;
1162 case SvxAdjust::Right
: m_xRight
->set_active(true); break;
1164 case SvxAdjust::Center
: m_xCenter
->set_active(true); break;
1166 case SvxAdjust::Block
: m_xJustify
->set_active(true); break;
1167 default: ; //prevent warning
1169 bool bEnable
= m_xJustify
->get_active();
1170 m_xLastLineFT
->set_sensitive(bEnable
);
1171 m_xLastLineLB
->set_sensitive(bEnable
);
1173 switch(rAdj
.GetLastBlock())
1175 case SvxAdjust::Left
: nLBSelect
= 0; break;
1177 case SvxAdjust::Center
: nLBSelect
= 1; break;
1179 case SvxAdjust::Block
: nLBSelect
= 2; break;
1180 default: ; //prevent warning
1182 m_xExpandCB
->set_sensitive(bEnable
&& nLBSelect
== 2);
1183 m_xExpandCB
->set_active(SvxAdjust::Block
== rAdj
.GetOneWord());
1187 m_xLeft
->set_active(false);
1188 m_xRight
->set_active(false);
1189 m_xCenter
->set_active(false);
1190 m_xJustify
->set_active(false);
1192 m_xLastLineLB
->set_active(nLBSelect
);
1194 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(*rSet
);
1195 if(nHtmlMode
& HTMLMODE_ON
)
1197 m_xLastLineLB
->hide();
1198 m_xLastLineFT
->hide();
1199 m_xExpandCB
->hide();
1200 if(!(nHtmlMode
& HTMLMODE_FULL_STYLES
) )
1201 m_xJustify
->set_sensitive(false);
1202 m_xSnapToGridCB
->hide();
1204 _nWhich
= GetWhich(SID_ATTR_PARA_SNAPTOGRID
);
1205 eItemState
= rSet
->GetItemState( _nWhich
);
1206 if ( eItemState
>= SfxItemState::DEFAULT
)
1208 const SvxParaGridItem
& rSnap
= static_cast<const SvxParaGridItem
&>(rSet
->Get( _nWhich
));
1209 m_xSnapToGridCB
->set_active(rSnap
.GetValue());
1212 _nWhich
= GetWhich( SID_PARA_VERTALIGN
);
1213 eItemState
= rSet
->GetItemState( _nWhich
);
1215 if ( eItemState
>= SfxItemState::DEFAULT
)
1217 m_xVertAlignFL
->show();
1219 const SvxParaVertAlignItem
& rAlign
= static_cast<const SvxParaVertAlignItem
&>(rSet
->Get( _nWhich
));
1221 m_xVertAlignLB
->set_active(static_cast<sal_Int32
>(rAlign
.GetValue()));
1224 _nWhich
= GetWhich( SID_ATTR_FRAMEDIRECTION
);
1226 if( SfxItemState::DEFAULT
<= rSet
->GetItemState( _nWhich
) )
1228 const SvxFrameDirectionItem
& rFrameDirItem
= static_cast<const SvxFrameDirectionItem
&>( rSet
->Get( _nWhich
) );
1229 m_xTextDirectionLB
->set_active_id(rFrameDirItem
.GetValue());
1230 m_xTextDirectionLB
->save_value();
1233 m_xSnapToGridCB
->save_state();
1234 m_xVertAlignLB
->save_value();
1235 m_xLeft
->save_state();
1236 m_xRight
->save_state();
1237 m_xCenter
->save_state();
1238 m_xJustify
->save_state();
1239 m_xLastLineLB
->save_value();
1240 m_xExpandCB
->save_state();
1242 UpdateExample_Impl();
1245 void SvxParaAlignTabPage::ChangesApplied()
1247 m_xTextDirectionLB
->save_value();
1248 m_xSnapToGridCB
->save_state();
1249 m_xVertAlignLB
->save_value();
1250 m_xLeft
->save_state();
1251 m_xRight
->save_state();
1252 m_xCenter
->save_state();
1253 m_xJustify
->save_state();
1254 m_xLastLineLB
->save_value();
1255 m_xExpandCB
->save_state();
1258 IMPL_LINK_NOARG(SvxParaAlignTabPage
, AlignHdl_Impl
, weld::ToggleButton
&, void)
1260 bool bJustify
= m_xJustify
->get_active();
1261 m_xLastLineFT
->set_sensitive(bJustify
);
1262 m_xLastLineLB
->set_sensitive(bJustify
);
1263 bool bLastLineIsBlock
= m_xLastLineLB
->get_active() == 2;
1264 m_xExpandCB
->set_sensitive(bJustify
&& bLastLineIsBlock
);
1265 //set last line listbox to entry position 0 if not enabled
1266 if (!m_xLastLineLB
->get_sensitive())
1267 m_xLastLineLB
->set_active(0);
1268 //uncheck 'Expand ... word' when check box is not enabled
1269 if (!m_xExpandCB
->get_sensitive())
1270 m_xExpandCB
->set_active(false);
1271 UpdateExample_Impl();
1274 IMPL_LINK_NOARG(SvxParaAlignTabPage
, LastLineHdl_Impl
, weld::ComboBox
&, void)
1276 //fdo#41350 only enable 'Expand last word' if last line is also justified
1277 bool bLastLineIsBlock
= m_xLastLineLB
->get_active() == 2;
1278 m_xExpandCB
->set_sensitive(bLastLineIsBlock
);
1279 //uncheck 'Expand ... word' when check box is not enabled
1280 if (!m_xExpandCB
->get_sensitive())
1281 m_xExpandCB
->set_active(false);
1282 UpdateExample_Impl();
1285 IMPL_LINK_NOARG(SvxParaAlignTabPage
, TextDirectionHdl_Impl
, weld::ComboBox
&, void)
1287 UpdateExample_Impl();
1290 void SvxParaAlignTabPage::UpdateExample_Impl()
1292 if (m_xLeft
->get_active())
1294 m_aExampleWin
.EnableRTL(false);
1295 m_aExampleWin
.SetAdjust(SvxAdjust::Left
);
1296 m_aExampleWin
.SetLastLine(SvxAdjust::Left
);
1298 else if (m_xRight
->get_active())
1300 m_aExampleWin
.EnableRTL(true);
1301 m_aExampleWin
.SetAdjust(SvxAdjust::Left
);
1302 m_aExampleWin
.SetLastLine(SvxAdjust::Left
);
1306 SvxFrameDirection eDir
= m_xTextDirectionLB
->get_active_id();
1309 case SvxFrameDirection::Environment
:
1310 if ( !m_xRight
->get_active() )
1311 m_aExampleWin
.EnableRTL( AllSettings::GetLayoutRTL() );
1313 case SvxFrameDirection::Horizontal_RL_TB
:
1314 if ( !m_xLeft
->get_active() )
1315 m_aExampleWin
.EnableRTL( true );
1317 case SvxFrameDirection::Horizontal_LR_TB
:
1318 if ( !m_xRight
->get_active() )
1319 m_aExampleWin
.EnableRTL( false );
1321 default: ; //prevent warning
1323 if (m_xCenter
->get_active())
1324 m_aExampleWin
.SetAdjust( SvxAdjust::Center
);
1325 else if (m_xJustify
->get_active())
1327 m_aExampleWin
.SetAdjust( SvxAdjust::Block
);
1328 int nLBPos
= m_xLastLineLB
->get_active();
1330 m_aExampleWin
.SetLastLine(SvxAdjust::Left
);
1331 else if (nLBPos
== 1)
1332 m_aExampleWin
.SetLastLine(SvxAdjust::Center
);
1333 else if (nLBPos
== 2)
1334 m_aExampleWin
.SetLastLine(SvxAdjust::Block
);
1338 m_aExampleWin
.Invalidate();
1341 void SvxParaAlignTabPage::EnableJustifyExt()
1343 m_xLastLineFT
->show();
1344 m_xLastLineLB
->show();
1345 m_xExpandCB
->show();
1346 SvtLanguageOptions aCJKOptions
;
1347 if (aCJKOptions
.IsAsianTypographyEnabled())
1348 m_xSnapToGridCB
->show();
1352 void SvxParaAlignTabPage::PageCreated (const SfxAllItemSet
& aSet
)
1354 const SfxBoolItem
* pBoolItem
= aSet
.GetItem
<SfxBoolItem
>(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT
, false);
1355 if (pBoolItem
&& pBoolItem
->GetValue())
1359 std::unique_ptr
<SfxTabPage
> SvxExtParagraphTabPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
)
1361 return std::make_unique
<SvxExtParagraphTabPage
>(pPage
, pController
, *rSet
);
1364 bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet
* rOutSet
)
1366 bool bModified
= false;
1367 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1368 const TriState eHyphenState
= m_xHyphenBox
->get_state();
1369 const SfxPoolItem
* pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_HYPHENZONE
);
1371 if ( m_xHyphenBox
->get_state_changed_from_saved() ||
1372 m_xHyphenNoCapsBox
->get_state_changed_from_saved() ||
1373 m_xExtHyphenBeforeBox
->get_value_changed_from_saved() ||
1374 m_xExtHyphenAfterBox
->get_value_changed_from_saved() ||
1375 m_xMaxHyphenEdit
->get_value_changed_from_saved() )
1377 SvxHyphenZoneItem
aHyphen(
1378 static_cast<const SvxHyphenZoneItem
&>(GetItemSet().Get( _nWhich
)) );
1379 aHyphen
.SetHyphen( eHyphenState
== TRISTATE_TRUE
);
1380 aHyphen
.SetNoCapsHyphenation(m_xHyphenNoCapsBox
->get_state() == TRISTATE_TRUE
);
1382 if ( eHyphenState
== TRISTATE_TRUE
)
1384 aHyphen
.GetMinLead() = static_cast<sal_uInt8
>(m_xExtHyphenBeforeBox
->get_value());
1385 aHyphen
.GetMinTrail() = static_cast<sal_uInt8
>(m_xExtHyphenAfterBox
->get_value());
1387 aHyphen
.GetMaxHyphens() = static_cast<sal_uInt8
>(m_xMaxHyphenEdit
->get_value());
1390 *static_cast<const SvxHyphenZoneItem
*>(pOld
) != aHyphen
||
1391 m_xHyphenBox
->get_state_changed_from_saved())
1393 rOutSet
->Put( aHyphen
);
1398 if (m_xPageNumBox
->get_sensitive()
1399 && (m_xPageNumBox
->get_state_changed_from_saved() || m_xPagenumEdit
->get_value_changed_from_saved()))
1401 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_PAGENUM
);
1403 if (TRISTATE_TRUE
== m_xPageNumBox
->get_state()
1404 && (!pOld
|| IsInvalidItem(pOld
)
1405 || static_cast<const SfxUInt16Item
*>(pOld
)->GetValue() != m_xPagenumEdit
->get_value()))
1407 SfxUInt16Item
aPageNum(SID_ATTR_PARA_PAGENUM
,
1408 static_cast<sal_uInt16
>(m_xPagenumEdit
->get_value()));
1409 rOutSet
->Put( aPageNum
);
1412 else if (TRISTATE_FALSE
== m_xPageNumBox
->get_state()
1413 && (pOld
|| IsInvalidItem(pOld
)))
1415 // need to tell sw to remove the item
1416 rOutSet
->DisableItem(SID_ATTR_PARA_PAGENUM
);
1423 TriState eState
= m_xApplyCollBtn
->get_state();
1424 bool bIsPageModel
= false;
1426 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1428 if ( m_xApplyCollBtn
->get_state_changed_from_saved() ||
1429 ( TRISTATE_TRUE
== eState
&&
1430 m_xApplyCollBox
->get_value_changed_from_saved() ) )
1432 if ( eState
== TRISTATE_TRUE
)
1434 sPage
= m_xApplyCollBox
->get_active_text();
1435 bIsPageModel
= !sPage
.isEmpty();
1437 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_MODEL
);
1439 if ( !pOld
|| static_cast<const SvxPageModelItem
*>(pOld
)->GetValue() != sPage
)
1441 rOutSet
->Put( SvxPageModelItem( sPage
, false, _nWhich
) );
1445 bIsPageModel
= false;
1447 else if(TRISTATE_TRUE
== eState
&& m_xApplyCollBtn
->get_sensitive())
1448 bIsPageModel
= true;
1450 rOutSet
->Put( SvxPageModelItem( sPage
, false, _nWhich
) );
1452 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1455 // if PageModel is turned on, always turn off PageBreak
1456 rOutSet
->Put( SvxFormatBreakItem( SvxBreak::NONE
, _nWhich
) );
1459 eState
= m_xPageBreakBox
->get_state();
1460 SfxItemState eModelState
= GetItemSet().GetItemState(SID_ATTR_PARA_MODEL
, false);
1462 if ( (eModelState
== SfxItemState::SET
&& TRISTATE_TRUE
== m_xPageBreakBox
->get_state()) ||
1463 m_xPageBreakBox
->get_state_changed_from_saved() ||
1464 m_xBreakTypeLB
->get_value_changed_from_saved() ||
1465 m_xBreakPositionLB
->get_value_changed_from_saved() )
1467 const SvxFormatBreakItem
rOldBreak(
1468 static_cast<const SvxFormatBreakItem
&>(GetItemSet().Get( _nWhich
)));
1469 SvxFormatBreakItem
aBreak(rOldBreak
.GetBreak(), rOldBreak
.Which());
1475 bool bBefore
= m_xBreakPositionLB
->get_active() == 0;
1477 if (m_xBreakTypeLB
->get_active() == 0)
1480 aBreak
.SetValue( SvxBreak::PageBefore
);
1482 aBreak
.SetValue( SvxBreak::PageAfter
);
1487 aBreak
.SetValue( SvxBreak::ColumnBefore
);
1489 aBreak
.SetValue( SvxBreak::ColumnAfter
);
1494 case TRISTATE_FALSE
:
1495 aBreak
.SetValue( SvxBreak::NONE
);
1497 default: ; //prevent warning
1499 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_PAGEBREAK
);
1501 if ( eState
!= m_xPageBreakBox
->get_saved_state() ||
1502 !pOld
|| !( *static_cast<const SvxFormatBreakItem
*>(pOld
) == aBreak
) )
1505 rOutSet
->Put( aBreak
);
1511 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1512 eState
= m_xKeepTogetherBox
->get_state();
1514 if (m_xKeepTogetherBox
->get_state_changed_from_saved())
1516 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_SPLIT
);
1518 if ( !pOld
|| static_cast<const SvxFormatSplitItem
*>(pOld
)->GetValue() !=
1519 ( eState
== TRISTATE_FALSE
) )
1521 rOutSet
->Put( SvxFormatSplitItem( eState
== TRISTATE_FALSE
, _nWhich
) );
1527 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1528 eState
= m_xKeepParaBox
->get_state();
1530 if (m_xKeepParaBox
->get_state_changed_from_saved())
1532 // if the status has changed, putting is necessary
1533 rOutSet
->Put( SvxFormatKeepItem( eState
== TRISTATE_TRUE
, _nWhich
) );
1537 // widows and orphans
1538 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1539 eState
= m_xWidowBox
->get_state();
1541 if ( m_xWidowBox
->get_state_changed_from_saved() ||
1542 m_xWidowRowNo
->get_value_changed_from_saved() )
1544 SvxWidowsItem
rItem( eState
== TRISTATE_TRUE
?
1545 static_cast<sal_uInt8
>(m_xWidowRowNo
->get_value()) : 0, _nWhich
);
1546 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_WIDOWS
);
1548 if ( m_xWidowBox
->get_state_changed_from_saved() || !pOld
|| !( *static_cast<const SvxWidowsItem
*>(pOld
) == rItem
) )
1550 rOutSet
->Put( rItem
);
1555 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1556 eState
= m_xOrphanBox
->get_state();
1558 if ( m_xOrphanBox
->get_state_changed_from_saved() ||
1559 m_xOrphanRowNo
->get_value_changed_from_saved() )
1561 SvxOrphansItem
rItem( eState
== TRISTATE_TRUE
?
1562 static_cast<sal_uInt8
>(m_xOrphanRowNo
->get_value()) : 0, _nWhich
);
1563 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_ORPHANS
);
1565 if ( m_xOrphanBox
->get_state_changed_from_saved() ||
1567 !( *static_cast<const SvxOrphansItem
*>(pOld
) == rItem
) )
1569 rOutSet
->Put( rItem
);
1576 void SvxExtParagraphTabPage::Reset( const SfxItemSet
* rSet
)
1578 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1579 SfxItemState eItemState
= rSet
->GetItemState( _nWhich
);
1581 bool bItemAvailable
= eItemState
>= SfxItemState::DEFAULT
;
1582 bool bIsHyphen
= false;
1583 if( !bHtmlMode
&& bItemAvailable
)
1585 const SvxHyphenZoneItem
& rHyphen
=
1586 static_cast<const SvxHyphenZoneItem
&>(rSet
->Get( _nWhich
));
1587 aHyphenState
.bTriStateEnabled
= false;
1589 bIsHyphen
= rHyphen
.IsHyphen();
1590 m_xHyphenBox
->set_state(bIsHyphen
? TRISTATE_TRUE
: TRISTATE_FALSE
);
1591 m_xHyphenNoCapsBox
->set_state(rHyphen
.IsNoCapsHyphenation() ? TRISTATE_TRUE
: TRISTATE_FALSE
);
1593 m_xExtHyphenBeforeBox
->set_value(rHyphen
.GetMinLead());
1594 m_xExtHyphenAfterBox
->set_value(rHyphen
.GetMinTrail());
1595 m_xMaxHyphenEdit
->set_value(rHyphen
.GetMaxHyphens());
1599 m_xHyphenBox
->set_state(TRISTATE_INDET
);
1600 m_xHyphenNoCapsBox
->set_state(TRISTATE_INDET
);
1602 bool bEnable
= bItemAvailable
&& bIsHyphen
;
1603 m_xHyphenNoCapsBox
->set_sensitive(bEnable
);
1604 m_xExtHyphenBeforeBox
->set_sensitive(bEnable
);
1605 m_xExtHyphenAfterBox
->set_sensitive(bEnable
);
1606 m_xBeforeText
->set_sensitive(bEnable
);
1607 m_xAfterText
->set_sensitive(bEnable
);
1608 m_xMaxHyphenLabel
->set_sensitive(bEnable
);
1609 m_xMaxHyphenEdit
->set_sensitive(bEnable
);
1611 _nWhich
= GetWhich( SID_ATTR_PARA_PAGENUM
);
1613 switch (rSet
->GetItemState(_nWhich
))
1615 case SfxItemState::SET
:
1617 aPageNumState
.bTriStateEnabled
= false;
1618 m_xPageNumBox
->set_state(TRISTATE_TRUE
);
1619 SfxUInt16Item
const*const pItem(rSet
->GetItem
<SfxUInt16Item
>(_nWhich
));
1620 const sal_uInt16
nPageNum(pItem
->GetValue());
1621 m_xPagenumEdit
->set_value(nPageNum
);
1624 case SfxItemState::DONTCARE
:
1626 aPageNumState
.bTriStateEnabled
= true;
1627 m_xPageNumBox
->set_state(TRISTATE_INDET
);
1630 case SfxItemState::UNKNOWN
:
1631 case SfxItemState::DEFAULT
:
1632 case SfxItemState::DISABLED
:
1634 aPageNumState
.bTriStateEnabled
= false;
1635 m_xPageNumBox
->set_state(TRISTATE_FALSE
);
1639 assert(false); // unexpected
1645 // first handle PageModel
1646 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1647 bool bIsPageModel
= false;
1648 eItemState
= rSet
->GetItemState( _nWhich
);
1650 if ( eItemState
>= SfxItemState::SET
)
1652 aApplyCollState
.bTriStateEnabled
= false;
1654 const SvxPageModelItem
& rModel
=
1655 static_cast<const SvxPageModelItem
&>(rSet
->Get( _nWhich
));
1656 const OUString
& aStr( rModel
.GetValue() );
1658 if (!aStr
.isEmpty() && m_xApplyCollBox
->find_text(aStr
) != -1)
1660 m_xApplyCollBox
->set_active_text(aStr
);
1661 m_xApplyCollBtn
->set_state(TRISTATE_TRUE
);
1662 bIsPageModel
= true;
1664 m_xPageBreakBox
->set_sensitive(true);
1665 aPageBreakState
.bTriStateEnabled
= false;
1666 m_xBreakTypeFT
->set_sensitive(true);
1667 m_xBreakTypeLB
->set_sensitive(true);
1668 m_xBreakPositionFT
->set_sensitive(true);
1669 m_xBreakPositionLB
->set_sensitive(true);
1670 m_xApplyCollBtn
->set_sensitive(false);
1671 m_xPageBreakBox
->set_state(TRISTATE_TRUE
);
1674 m_xBreakTypeLB
->set_active(0);
1675 //select break before
1676 m_xBreakPositionLB
->set_active(0);
1680 m_xApplyCollBox
->set_active(-1);
1681 m_xApplyCollBtn
->set_state(TRISTATE_FALSE
);
1684 else if ( SfxItemState::DONTCARE
== eItemState
)
1686 aApplyCollState
.bTriStateEnabled
= true;
1687 m_xApplyCollBtn
->set_state(TRISTATE_INDET
);
1688 m_xApplyCollBox
->set_active(-1);
1692 m_xApplyCollBtn
->set_sensitive(false);
1693 m_xApplyCollBox
->set_sensitive(false);
1694 m_xPagenumEdit
->set_sensitive(false);
1695 m_xPageNumBox
->set_sensitive(false);
1698 if ( !bIsPageModel
)
1700 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1701 eItemState
= rSet
->GetItemState( _nWhich
);
1703 if ( eItemState
>= SfxItemState::DEFAULT
)
1705 const SvxFormatBreakItem
& rPageBreak
=
1706 static_cast<const SvxFormatBreakItem
&>(rSet
->Get( _nWhich
));
1708 SvxBreak eBreak
= rPageBreak
.GetBreak();
1710 // PageBreak not via CTRL-RETURN,
1711 // then CheckBox can be freed
1712 m_xPageBreakBox
->set_sensitive(true);
1713 aPageBreakState
.bTriStateEnabled
= false;
1714 m_xBreakTypeFT
->set_sensitive(true);
1715 m_xBreakTypeLB
->set_sensitive(true);
1716 m_xBreakPositionFT
->set_sensitive(true);
1717 m_xBreakPositionLB
->set_sensitive(true);
1719 m_xPageBreakBox
->set_state(TRISTATE_TRUE
);
1721 bool _bEnable
= eBreak
!= SvxBreak::NONE
&&
1722 eBreak
!= SvxBreak::ColumnBefore
&&
1723 eBreak
!= SvxBreak::ColumnAfter
;
1724 m_xApplyCollBtn
->set_sensitive(_bEnable
);
1727 m_xApplyCollBox
->set_sensitive(_bEnable
);
1728 m_xPageNumBox
->set_sensitive(false);
1729 m_xPagenumEdit
->set_sensitive(_bEnable
);
1732 if ( eBreak
== SvxBreak::NONE
)
1733 m_xPageBreakBox
->set_state(TRISTATE_FALSE
);
1735 sal_Int32 nType
= 0; // selection position in break type ListBox : Page
1736 sal_Int32 nPosition
= 0; // selection position in break position ListBox : Before
1739 case SvxBreak::PageBefore
:
1741 case SvxBreak::PageAfter
:
1744 case SvxBreak::ColumnBefore
:
1747 case SvxBreak::ColumnAfter
:
1751 default: ;//prevent warning
1753 m_xBreakTypeLB
->set_active(nType
);
1754 m_xBreakPositionLB
->set_active(nPosition
);
1756 else if ( SfxItemState::DONTCARE
== eItemState
)
1757 m_xPageBreakBox
->set_state(TRISTATE_INDET
);
1760 m_xPageBreakBox
->set_sensitive(false);
1761 m_xBreakTypeFT
->set_sensitive(false);
1762 m_xBreakTypeLB
->set_sensitive(false);
1763 m_xBreakPositionFT
->set_sensitive(false);
1764 m_xBreakPositionLB
->set_sensitive(false);
1768 PageBreakPosHdl_Impl(*m_xBreakPositionLB
);
1772 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1773 eItemState
= rSet
->GetItemState( _nWhich
);
1775 if ( eItemState
>= SfxItemState::DEFAULT
)
1777 aKeepParaState
.bTriStateEnabled
= false;
1778 const SvxFormatKeepItem
& rKeep
=
1779 static_cast<const SvxFormatKeepItem
&>(rSet
->Get( _nWhich
));
1781 if ( rKeep
.GetValue() )
1782 m_xKeepParaBox
->set_state(TRISTATE_TRUE
);
1784 m_xKeepParaBox
->set_state(TRISTATE_FALSE
);
1786 else if ( SfxItemState::DONTCARE
== eItemState
)
1787 m_xKeepParaBox
->set_state(TRISTATE_INDET
);
1789 m_xKeepParaBox
->set_sensitive(false);
1791 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1792 eItemState
= rSet
->GetItemState( _nWhich
);
1794 if ( eItemState
>= SfxItemState::DEFAULT
)
1796 const SvxFormatSplitItem
& rSplit
=
1797 static_cast<const SvxFormatSplitItem
&>(rSet
->Get( _nWhich
));
1798 aKeepTogetherState
.bTriStateEnabled
= false;
1800 if ( !rSplit
.GetValue() )
1801 m_xKeepTogetherBox
->set_state(TRISTATE_TRUE
);
1804 m_xKeepTogetherBox
->set_state(TRISTATE_FALSE
);
1806 // widows and orphans
1807 m_xWidowBox
->set_sensitive(true);
1808 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1809 SfxItemState eTmpState
= rSet
->GetItemState( _nWhich
);
1811 if ( eTmpState
>= SfxItemState::DEFAULT
)
1813 const SvxWidowsItem
& rWidow
=
1814 static_cast<const SvxWidowsItem
&>(rSet
->Get( _nWhich
));
1815 aWidowState
.bTriStateEnabled
= false;
1816 const sal_uInt16 nLines
= rWidow
.GetValue();
1818 bool _bEnable
= nLines
> 0;
1819 m_xWidowRowNo
->set_value(m_xWidowRowNo
->normalize(nLines
));
1820 m_xWidowBox
->set_state(_bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
);
1821 m_xWidowRowNo
->set_sensitive(_bEnable
);
1822 //m_xWidowRowLabel->set_sensitive(_bEnable);
1825 else if ( SfxItemState::DONTCARE
== eTmpState
)
1826 m_xWidowBox
->set_state( TRISTATE_INDET
);
1828 m_xWidowBox
->set_sensitive(false);
1830 m_xOrphanBox
->set_sensitive(true);
1831 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1832 eTmpState
= rSet
->GetItemState( _nWhich
);
1834 if ( eTmpState
>= SfxItemState::DEFAULT
)
1836 const SvxOrphansItem
& rOrphan
=
1837 static_cast<const SvxOrphansItem
&>(rSet
->Get( _nWhich
));
1838 const sal_uInt16 nLines
= rOrphan
.GetValue();
1839 aOrphanState
.bTriStateEnabled
= false;
1841 bool _bEnable
= nLines
> 0;
1842 m_xOrphanBox
->set_state(_bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
);
1843 m_xOrphanRowNo
->set_value(m_xOrphanRowNo
->normalize(nLines
));
1844 m_xOrphanRowNo
->set_sensitive(_bEnable
);
1845 m_xOrphanRowLabel
->set_sensitive(_bEnable
);
1848 else if ( SfxItemState::DONTCARE
== eTmpState
)
1849 m_xOrphanBox
->set_state(TRISTATE_INDET
);
1851 m_xOrphanBox
->set_sensitive(false);
1852 aOrphanState
.eState
= m_xOrphanBox
->get_state();
1855 else if ( SfxItemState::DONTCARE
== eItemState
)
1856 m_xKeepTogetherBox
->set_state(TRISTATE_INDET
);
1858 m_xKeepTogetherBox
->set_sensitive(false);
1860 // so that everything is enabled correctly
1866 void SvxExtParagraphTabPage::ChangesApplied()
1868 m_xHyphenBox
->save_state();
1869 m_xHyphenNoCapsBox
->save_state();
1870 m_xExtHyphenBeforeBox
->set_value(m_xExtHyphenBeforeBox
->get_value());
1871 m_xExtHyphenAfterBox
->set_value(m_xExtHyphenAfterBox
->get_value());
1872 m_xMaxHyphenEdit
->set_value(m_xMaxHyphenEdit
->get_value());
1873 m_xPageBreakBox
->save_state();
1874 m_xBreakPositionLB
->save_value();
1875 m_xBreakTypeLB
->save_value();
1876 m_xApplyCollBtn
->save_state();
1877 m_xApplyCollBox
->save_value();
1878 m_xPageNumBox
->save_state();
1879 m_xPagenumEdit
->save_value();
1880 m_xKeepTogetherBox
->save_state();
1881 m_xKeepParaBox
->save_state();
1882 m_xWidowBox
->save_state();
1883 m_xOrphanBox
->save_state();
1884 m_xOrphanRowNo
->save_value();
1885 m_xWidowRowNo
->save_value();
1888 DeactivateRC
SvxExtParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1891 FillItemSet( _pSet
);
1892 return DeactivateRC::LeavePage
;
1895 void SvxExtParagraphTabPage::DisablePageBreak()
1898 m_xPageBreakBox
->set_sensitive(false);
1899 m_xBreakTypeLB
->remove(0);
1900 m_xBreakPositionFT
->set_sensitive(false);
1901 m_xBreakPositionLB
->set_sensitive(false);
1902 m_xApplyCollBtn
->set_sensitive(false);
1903 m_xApplyCollBox
->set_sensitive(false);
1904 m_xPageNumBox
->set_sensitive(false);
1905 m_xPagenumEdit
->set_sensitive(false);
1908 SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttr
)
1909 : SfxTabPage(pPage
, pController
, "cui/ui/textflowpage.ui", "TextFlowPage", &rAttr
)
1914 , m_xHyphenBox(m_xBuilder
->weld_check_button("checkAuto"))
1915 , m_xHyphenNoCapsBox(m_xBuilder
->weld_check_button("checkNoCaps"))
1916 , m_xBeforeText(m_xBuilder
->weld_label("labelLineBegin"))
1917 , m_xExtHyphenBeforeBox(m_xBuilder
->weld_spin_button("spinLineEnd"))
1918 , m_xAfterText(m_xBuilder
->weld_label("labelLineEnd"))
1919 , m_xExtHyphenAfterBox(m_xBuilder
->weld_spin_button("spinLineBegin"))
1920 , m_xMaxHyphenLabel(m_xBuilder
->weld_label("labelMaxNum"))
1921 , m_xMaxHyphenEdit(m_xBuilder
->weld_spin_button("spinMaxNum"))
1923 , m_xPageBreakBox(m_xBuilder
->weld_check_button("checkInsert"))
1924 , m_xBreakTypeFT(m_xBuilder
->weld_label("labelType"))
1925 , m_xBreakTypeLB(m_xBuilder
->weld_combo_box("comboBreakType"))
1926 , m_xBreakPositionFT(m_xBuilder
->weld_label("labelPosition"))
1927 , m_xBreakPositionLB(m_xBuilder
->weld_combo_box("comboBreakPosition"))
1928 , m_xApplyCollBtn(m_xBuilder
->weld_check_button("checkPageStyle"))
1929 , m_xApplyCollBox(m_xBuilder
->weld_combo_box("comboPageStyle"))
1930 , m_xPageNumBox(m_xBuilder
->weld_check_button("labelPageNum"))
1931 , m_xPagenumEdit(m_xBuilder
->weld_spin_button("spinPageNumber"))
1933 , m_xKeepTogetherBox(m_xBuilder
->weld_check_button("checkSplitPara"))
1934 , m_xKeepParaBox(m_xBuilder
->weld_check_button("checkKeepPara"))
1935 , m_xOrphanBox(m_xBuilder
->weld_check_button("checkOrphan"))
1936 , m_xOrphanRowNo(m_xBuilder
->weld_spin_button("spinOrphan"))
1937 , m_xOrphanRowLabel(m_xBuilder
->weld_label("labelOrphan"))
1938 , m_xWidowBox(m_xBuilder
->weld_check_button("checkWidow"))
1939 , m_xWidowRowNo(m_xBuilder
->weld_spin_button("spinWidow"))
1940 , m_xWidowRowLabel(m_xBuilder
->weld_label("labelWidow"))
1942 // this page needs ExchangeSupport
1943 SetExchangeSupport();
1945 m_xHyphenBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, HyphenClickHdl_Impl
));
1946 m_xPageBreakBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, PageBreakHdl_Impl
));
1947 m_xKeepTogetherBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
));
1948 m_xWidowBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, WidowHdl_Impl
));
1949 m_xOrphanBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, OrphanHdl_Impl
));
1950 m_xApplyCollBtn
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
));
1951 m_xBreakTypeLB
->connect_changed(LINK(this, SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
));
1952 m_xBreakPositionLB
->connect_changed(LINK(this, SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
));
1953 m_xPageNumBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, PageNumBoxClickHdl_Impl
));
1954 m_xKeepParaBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, KeepParaBoxClickHdl_Impl
));
1956 SfxObjectShell
* pSh
= SfxObjectShell::Current();
1959 SfxStyleSheetBasePool
* pPool
= pSh
->GetStyleSheetPool();
1960 pPool
->SetSearchMask( SfxStyleFamily::Page
);
1961 SfxStyleSheetBase
* pStyle
= pPool
->First();
1966 if ( aStdName
.isEmpty() )
1967 // first style == standard style
1968 aStdName
= pStyle
->GetName();
1969 m_xApplyCollBox
->append_text(pStyle
->GetName());
1970 pStyle
= pPool
->Next();
1972 nStdPos
= m_xApplyCollBox
->find_text(aStdName
);
1975 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl( rAttr
);
1976 if ( nHtmlMode
& HTMLMODE_ON
)
1979 m_xHyphenBox
->set_sensitive(false);
1980 m_xHyphenNoCapsBox
->set_sensitive(false);
1981 m_xBeforeText
->set_sensitive(false);
1982 m_xExtHyphenBeforeBox
->set_sensitive(false);
1983 m_xAfterText
->set_sensitive(false);
1984 m_xExtHyphenAfterBox
->set_sensitive(false);
1985 m_xMaxHyphenLabel
->set_sensitive(false);
1986 m_xMaxHyphenEdit
->set_sensitive(false);
1987 m_xPageNumBox
->set_sensitive(false);
1988 m_xPagenumEdit
->set_sensitive(false);
1989 // no column break in HTML
1990 m_xBreakTypeLB
->remove(1);
1994 SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
1998 void SvxExtParagraphTabPage::PageBreakHdl()
2000 switch (m_xPageBreakBox
->get_state())
2003 m_xBreakTypeFT
->set_sensitive(true);
2004 m_xBreakTypeLB
->set_sensitive(true);
2005 m_xBreakPositionFT
->set_sensitive(true);
2006 m_xBreakPositionLB
->set_sensitive(true);
2008 if (0 == m_xBreakTypeLB
->get_active() && 0 == m_xBreakPositionLB
->get_active())
2010 m_xApplyCollBtn
->set_sensitive(true);
2012 bool bEnable
= TRISTATE_TRUE
== m_xApplyCollBtn
->get_state() &&
2013 m_xApplyCollBox
->get_count();
2014 m_xApplyCollBox
->set_sensitive(bEnable
);
2017 m_xPageNumBox
->set_sensitive(bEnable
);
2018 m_xPagenumEdit
->set_sensitive(bEnable
&& m_xPageNumBox
->get_state() == TRISTATE_TRUE
);
2023 case TRISTATE_FALSE
:
2024 case TRISTATE_INDET
:
2025 m_xApplyCollBtn
->set_state(TRISTATE_FALSE
);
2026 m_xApplyCollBtn
->set_sensitive(false);
2027 m_xApplyCollBox
->set_sensitive(false);
2028 m_xPageNumBox
->set_sensitive(false);
2029 m_xPagenumEdit
->set_sensitive(false);
2030 m_xBreakTypeFT
->set_sensitive(false);
2031 m_xBreakTypeLB
->set_sensitive(false);
2032 m_xBreakPositionFT
->set_sensitive(false);
2033 m_xBreakPositionLB
->set_sensitive(false);
2038 IMPL_LINK(SvxExtParagraphTabPage
, PageBreakHdl_Impl
, weld::ToggleButton
&, rToggle
, void)
2040 aPageBreakState
.ButtonToggled(rToggle
);
2044 void SvxExtParagraphTabPage::KeepTogetherHdl()
2046 bool bEnable
= m_xKeepTogetherBox
->get_state() == TRISTATE_FALSE
;
2047 m_xWidowBox
->set_sensitive(bEnable
);
2048 m_xOrphanBox
->set_sensitive(bEnable
);
2051 IMPL_LINK(SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
, weld::ToggleButton
&, rToggle
, void)
2053 aKeepTogetherState
.ButtonToggled(rToggle
);
2057 void SvxExtParagraphTabPage::WidowHdl()
2059 switch (m_xWidowBox
->get_state())
2062 m_xWidowRowNo
->set_sensitive(true);
2063 m_xWidowRowLabel
->set_sensitive(true);
2064 m_xKeepTogetherBox
->set_sensitive(false);
2066 case TRISTATE_FALSE
:
2067 if (m_xOrphanBox
->get_state() == TRISTATE_FALSE
)
2068 m_xKeepTogetherBox
->set_sensitive(true);
2070 case TRISTATE_INDET
:
2071 m_xWidowRowNo
->set_sensitive(false);
2072 m_xWidowRowLabel
->set_sensitive(false);
2077 IMPL_LINK(SvxExtParagraphTabPage
, WidowHdl_Impl
, weld::ToggleButton
&, rToggle
, void)
2079 aWidowState
.ButtonToggled(rToggle
);
2083 IMPL_LINK(SvxExtParagraphTabPage
, OrphanHdl_Impl
, weld::ToggleButton
&, rToggle
, void)
2085 aOrphanState
.ButtonToggled(rToggle
);
2089 void SvxExtParagraphTabPage::OrphanHdl()
2091 switch (m_xOrphanBox
->get_state())
2094 m_xOrphanRowNo
->set_sensitive(true);
2095 m_xOrphanRowLabel
->set_sensitive(true);
2096 m_xKeepTogetherBox
->set_sensitive(false);
2099 case TRISTATE_FALSE
:
2100 if (m_xWidowBox
->get_state() == TRISTATE_FALSE
)
2101 m_xKeepTogetherBox
->set_sensitive(true);
2103 case TRISTATE_INDET
:
2104 m_xOrphanRowNo
->set_sensitive(false);
2105 m_xOrphanRowLabel
->set_sensitive(false);
2110 void SvxExtParagraphTabPage::HyphenClickHdl()
2112 bool bEnable
= m_xHyphenBox
->get_state() == TRISTATE_TRUE
;
2113 m_xHyphenNoCapsBox
->set_sensitive(bEnable
);
2114 m_xBeforeText
->set_sensitive(bEnable
);
2115 m_xExtHyphenBeforeBox
->set_sensitive(bEnable
);
2116 m_xAfterText
->set_sensitive(bEnable
);
2117 m_xExtHyphenAfterBox
->set_sensitive(bEnable
);
2118 m_xMaxHyphenLabel
->set_sensitive(bEnable
);
2119 m_xMaxHyphenEdit
->set_sensitive(bEnable
);
2120 m_xHyphenBox
->set_state(bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
);
2123 IMPL_LINK(SvxExtParagraphTabPage
, HyphenClickHdl_Impl
, weld::ToggleButton
&, rToggle
, void)
2125 aHyphenState
.ButtonToggled(rToggle
);
2129 void SvxExtParagraphTabPage::ApplyCollClickHdl()
2131 bool bEnable
= false;
2132 if (m_xApplyCollBtn
->get_state() == TRISTATE_TRUE
&& m_xApplyCollBox
->get_count())
2135 m_xApplyCollBox
->set_active(nStdPos
);
2139 m_xApplyCollBox
->set_active(-1);
2141 m_xApplyCollBox
->set_sensitive(bEnable
);
2144 m_xPageNumBox
->set_sensitive(bEnable
);
2145 m_xPagenumEdit
->set_sensitive(bEnable
&& m_xPageNumBox
->get_state() == TRISTATE_TRUE
);
2149 IMPL_LINK(SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
, weld::ToggleButton
&, rToggle
, void)
2151 aApplyCollState
.ButtonToggled(rToggle
);
2152 ApplyCollClickHdl();
2155 IMPL_LINK(SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
, weld::ComboBox
&, rListBox
, void)
2157 if (0 == rListBox
.get_active())
2159 m_xApplyCollBtn
->set_sensitive(true);
2161 bool bEnable
= m_xApplyCollBtn
->get_state() == TRISTATE_TRUE
&& m_xApplyCollBox
->get_count();
2163 m_xApplyCollBox
->set_sensitive(bEnable
);
2166 m_xPageNumBox
->set_sensitive(bEnable
);
2167 m_xPagenumEdit
->set_sensitive(bEnable
&& m_xPageNumBox
->get_state() == TRISTATE_TRUE
);
2170 else if (1 == rListBox
.get_active())
2172 m_xApplyCollBtn
->set_state(TRISTATE_FALSE
);
2173 m_xApplyCollBtn
->set_sensitive(false);
2174 m_xApplyCollBox
->set_sensitive(false);
2175 m_xPageNumBox
->set_sensitive(false);
2176 m_xPagenumEdit
->set_sensitive(false);
2180 IMPL_LINK(SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
, weld::ComboBox
&, rListBox
, void)
2182 //column break or break after
2183 int nBreakPos
= m_xBreakPositionLB
->get_active();
2184 if (rListBox
.get_active() == 1 || 1 == nBreakPos
)
2186 m_xApplyCollBtn
->set_state(TRISTATE_FALSE
);
2187 m_xApplyCollBtn
->set_sensitive(false);
2188 m_xApplyCollBox
->set_sensitive(false);
2189 m_xPageNumBox
->set_sensitive(false);
2190 m_xPagenumEdit
->set_sensitive(false);
2193 PageBreakPosHdl_Impl(*m_xBreakPositionLB
);
2196 void SvxExtParagraphTabPage::PageNumBoxClickHdl()
2198 m_xPagenumEdit
->set_sensitive(m_xPageNumBox
->get_state() == TRISTATE_TRUE
);
2201 IMPL_LINK(SvxExtParagraphTabPage
, PageNumBoxClickHdl_Impl
, weld::ToggleButton
&, rToggle
, void)
2203 aPageNumState
.ButtonToggled(rToggle
);
2204 PageNumBoxClickHdl();
2207 IMPL_LINK(SvxExtParagraphTabPage
, KeepParaBoxClickHdl_Impl
, weld::ToggleButton
&, rToggle
, void)
2209 aKeepParaState
.ButtonToggled(rToggle
);
2212 void SvxExtParagraphTabPage::PageCreated(const SfxAllItemSet
& aSet
)
2214 const SfxBoolItem
* pDisablePageBreakItem
= aSet
.GetItem
<SfxBoolItem
>(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK
, false);
2216 if (pDisablePageBreakItem
)
2217 if ( pDisablePageBreakItem
->GetValue())
2221 SvxAsianTabPage::SvxAsianTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
)
2222 : SfxTabPage(pPage
, pController
, "cui/ui/asiantypography.ui", "AsianTypography", &rSet
)
2223 , m_xForbiddenRulesCB(m_xBuilder
->weld_check_button("checkForbidList"))
2224 , m_xHangingPunctCB(m_xBuilder
->weld_check_button("checkHangPunct"))
2225 , m_xScriptSpaceCB(m_xBuilder
->weld_check_button("checkApplySpacing"))
2229 SvxAsianTabPage::~SvxAsianTabPage()
2233 std::unique_ptr
<SfxTabPage
> SvxAsianTabPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
)
2235 return std::make_unique
<SvxAsianTabPage
>(pPage
, pController
, *rSet
);
2238 const sal_uInt16
* SvxAsianTabPage::GetRanges()
2240 static const sal_uInt16 pRanges
[] =
2242 SID_ATTR_PARA_SCRIPTSPACE
, SID_ATTR_PARA_FORBIDDEN_RULES
,
2248 bool SvxAsianTabPage::FillItemSet( SfxItemSet
* rSet
)
2251 SfxItemPool
* pPool
= rSet
->GetPool();
2252 if (m_xScriptSpaceCB
->get_sensitive() && m_xScriptSpaceCB
->get_state_changed_from_saved())
2254 std::unique_ptr
<SfxBoolItem
> pNewItem(static_cast<SfxBoolItem
*>(rSet
->Get(
2255 pPool
->GetWhich(SID_ATTR_PARA_SCRIPTSPACE
)).Clone()));
2256 pNewItem
->SetValue(m_xScriptSpaceCB
->get_active());
2257 rSet
->Put(std::move(pNewItem
));
2260 if (m_xHangingPunctCB
->get_sensitive() && m_xHangingPunctCB
->get_state_changed_from_saved())
2262 std::unique_ptr
<SfxBoolItem
> pNewItem(static_cast<SfxBoolItem
*>(rSet
->Get(
2263 pPool
->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION
)).Clone()));
2264 pNewItem
->SetValue(m_xHangingPunctCB
->get_active());
2265 rSet
->Put(std::move(pNewItem
));
2268 if (m_xForbiddenRulesCB
->get_sensitive() && m_xForbiddenRulesCB
->get_state_changed_from_saved())
2270 std::unique_ptr
<SfxBoolItem
> pNewItem(static_cast<SfxBoolItem
*>(rSet
->Get(
2271 pPool
->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES
)).Clone()));
2272 pNewItem
->SetValue(m_xForbiddenRulesCB
->get_active());
2273 rSet
->Put(std::move(pNewItem
));
2279 static void lcl_SetBox(const SfxItemSet
& rSet
, sal_uInt16 nSlotId
, weld::CheckButton
& rBox
)
2281 sal_uInt16 _nWhich
= rSet
.GetPool()->GetWhich(nSlotId
);
2282 SfxItemState eState
= rSet
.GetItemState(_nWhich
);
2283 if( eState
== SfxItemState::UNKNOWN
|| eState
== SfxItemState::DISABLED
)
2284 rBox
.set_sensitive(false);
2285 else if(eState
>= SfxItemState::DEFAULT
)
2286 rBox
.set_active(static_cast<const SfxBoolItem
&>(rSet
.Get(_nWhich
)).GetValue());
2288 rBox
.set_state(TRISTATE_INDET
);
2292 void SvxAsianTabPage::Reset( const SfxItemSet
* rSet
)
2294 lcl_SetBox(*rSet
, SID_ATTR_PARA_FORBIDDEN_RULES
, *m_xForbiddenRulesCB
);
2295 lcl_SetBox(*rSet
, SID_ATTR_PARA_HANGPUNCTUATION
, *m_xHangingPunctCB
);
2297 //character distance not yet available
2298 lcl_SetBox(*rSet
, SID_ATTR_PARA_SCRIPTSPACE
, *m_xScriptSpaceCB
);
2301 void SvxAsianTabPage::ChangesApplied()
2303 m_xForbiddenRulesCB
->save_state();
2304 m_xHangingPunctCB
->save_state();
2305 m_xScriptSpaceCB
->save_state();
2308 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */