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 const WhichRangesContainer
SvxStdParagraphTabPage::pStdRanges(
56 SID_ATTR_PARA_LINESPACE
, SID_ATTR_PARA_LINESPACE
, // 10033
57 SID_ATTR_LRSPACE
, SID_ATTR_ULSPACE
, // 10048 - 10049
58 SID_ATTR_PARA_REGISTER
, SID_ATTR_PARA_REGISTER
// 10413
61 const WhichRangesContainer
SvxParaAlignTabPage::pAlignRanges(
62 svl::Items
<SID_ATTR_PARA_ADJUST
, SID_ATTR_PARA_ADJUST
>); // 10027
64 const WhichRangesContainer
SvxExtParagraphTabPage::pExtRanges(svl::Items
<
65 SID_ATTR_PARA_PAGEBREAK
, SID_ATTR_PARA_WIDOWS
, // 10037 - 10041
66 SID_ATTR_PARA_MODEL
, SID_ATTR_PARA_KEEP
// 10065 - 10066
69 #define MAX_DURCH 5670 // 10 cm makes sense as maximum interline lead
71 #define FIX_DIST_DEF 283 // standard fix distance 0,5 cm
89 static void SetLineSpace_Impl( SvxLineSpacingItem
&, int, tools::Long lValue
= 0 );
91 void SetLineSpace_Impl( SvxLineSpacingItem
& rLineSpace
,
92 int eSpace
, tools::Long lValue
)
97 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
98 rLineSpace
.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off
);
102 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
103 rLineSpace
.SetPropLineSpace( 115 );
107 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
108 rLineSpace
.SetPropLineSpace( 150 );
112 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
113 rLineSpace
.SetPropLineSpace( 200 );
116 case LLINESPACE_PROP
:
117 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
118 rLineSpace
.SetPropLineSpace( static_cast<sal_uInt16
>(lValue
) );
122 rLineSpace
.SetLineHeight( static_cast<sal_uInt16
>(lValue
) );
123 rLineSpace
.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off
);
126 case LLINESPACE_DURCH
:
127 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Auto
);
128 rLineSpace
.SetInterLineSpace( static_cast<sal_uInt16
>(lValue
) );
132 rLineSpace
.SetLineHeight(static_cast<sal_uInt16
>(lValue
));
133 rLineSpace
.SetLineSpaceRule( SvxLineSpaceRule::Fix
);
134 rLineSpace
.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off
);
139 static sal_uInt16
GetHtmlMode_Impl(const SfxItemSet
& rSet
)
141 sal_uInt16 nHtmlMode
= 0;
142 const SfxPoolItem
* pItem
= nullptr;
143 SfxObjectShell
* pShell
;
144 if(SfxItemState::SET
== rSet
.GetItemState(SID_HTML_MODE
, false, &pItem
) ||
145 ( nullptr != (pShell
= SfxObjectShell::Current()) &&
146 nullptr != (pItem
= pShell
->GetItem(SID_HTML_MODE
))))
148 nHtmlMode
= static_cast<const SfxUInt16Item
*>(pItem
)->GetValue();
154 void SvxStdParagraphTabPage::ELRLoseFocus()
156 SfxItemPool
* pPool
= GetItemSet().GetPool();
157 DBG_ASSERT( pPool
, "Where is the pool?" );
159 MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
161 sal_Int64 nL
= m_xLeftIndent
->denormalize(m_xLeftIndent
->get_value(eUnit
));
162 sal_Int64 nR
= m_xRightIndent
->denormalize(m_xRightIndent
->get_value(eUnit
));
163 OUString aTmp
= m_xFLineIndent
->get_text();
165 if (m_xLeftIndent
->get_min(FieldUnit::NONE
) < 0)
166 m_xFLineIndent
->set_min(-99999, FieldUnit::MM
);
168 m_xFLineIndent
->set_min(m_xFLineIndent
->normalize(-nL
), eUnit
);
170 // Check only for concrete width (Shell)
171 sal_Int64 nTmp
= nWidth
- nL
- nR
- MM50
;
172 m_xFLineIndent
->set_max(m_xFLineIndent
->normalize(nTmp
), eUnit
);
175 m_xFLineIndent
->set_text(OUString());
176 // maximum left right
177 aTmp
= m_xLeftIndent
->get_text();
178 nTmp
= nWidth
- nR
- MM50
;
179 m_xLeftIndent
->set_max(m_xLeftIndent
->normalize(nTmp
), eUnit
);
181 if ( aTmp
.isEmpty() )
182 m_xLeftIndent
->set_text(OUString());
183 aTmp
= m_xRightIndent
->get_text();
184 nTmp
= nWidth
- nL
- MM50
;
185 m_xRightIndent
->set_max(m_xRightIndent
->normalize(nTmp
), eUnit
);
187 if ( aTmp
.isEmpty() )
188 m_xRightIndent
->set_text(OUString());
190 UpdateExample_Impl();
193 IMPL_LINK_NOARG(SvxStdParagraphTabPage
, ELRLoseFocusHdl
, weld::MetricSpinButton
&, void)
198 std::unique_ptr
<SfxTabPage
> SvxStdParagraphTabPage::Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
)
200 return std::make_unique
<SvxStdParagraphTabPage
>(pPage
, pController
, *rSet
);
203 bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet
* rOutSet
)
205 const SfxPoolItem
* pOld
= nullptr;
206 SfxItemPool
* pPool
= rOutSet
->GetPool();
207 DBG_ASSERT( pPool
, "Where is the pool?" );
209 bool bModified
= false;
211 int nPos
= m_xLineDist
->get_active();
214 ( m_bLineDistToggled
||
215 m_xLineDist
->get_value_changed_from_saved() ||
216 m_xLineDistAtPercentBox
->get_value_changed_from_saved() ||
217 m_xLineDistAtMetricBox
->get_value_changed_from_saved() ) )
219 nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
220 MapUnit eUnit
= pPool
->GetMetric( nWhich
);
221 SvxLineSpacingItem
aSpacing(
222 static_cast<const SvxLineSpacingItem
&>(GetItemSet().Get( nWhich
)) );
230 SetLineSpace_Impl( aSpacing
, nPos
);
233 case LLINESPACE_PROP
:
234 SetLineSpace_Impl( aSpacing
, nPos
,
235 static_cast<tools::Long
>(m_xLineDistAtPercentBox
->denormalize(
236 m_xLineDistAtPercentBox
->get_value(FieldUnit::NONE
) )) );
240 case LLINESPACE_DURCH
:
242 SetLineSpace_Impl( aSpacing
, nPos
,
243 GetCoreValue( *m_xLineDistAtMetricBox
, eUnit
) );
247 OSL_FAIL( "unknown LineDist entry" );
250 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_LINESPACE
);
252 if ( m_bLineDistToggled
||
253 !pOld
|| !( *static_cast<const SvxLineSpacingItem
*>(pOld
) == aSpacing
) ||
254 SfxItemState::DONTCARE
== GetItemSet().GetItemState( nWhich
) )
256 rOutSet
->Put( aSpacing
);
261 if ( m_xTopDist
->get_value_changed_from_saved() || m_xBottomDist
->get_value_changed_from_saved()
262 || m_xContextualCB
->get_state_changed_from_saved())
264 nWhich
= GetWhich( SID_ATTR_ULSPACE
);
265 MapUnit eUnit
= pPool
->GetMetric( nWhich
);
266 pOld
= GetOldItem( *rOutSet
, SID_ATTR_ULSPACE
);
267 SvxULSpaceItem
aMargin( nWhich
);
271 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
273 const SvxULSpaceItem
& rOldItem
=
274 static_cast<const SvxULSpaceItem
&>(GetItemSet().GetParent()->Get( nWhich
));
276 if ( m_xTopDist
->IsRelative() )
277 aMargin
.SetUpper( rOldItem
.GetUpper(),
278 static_cast<sal_uInt16
>(m_xTopDist
->get_value(FieldUnit::NONE
)) );
280 aMargin
.SetUpper( static_cast<sal_uInt16
>(m_xTopDist
->GetCoreValue(eUnit
)) );
282 if ( m_xBottomDist
->IsRelative() )
283 aMargin
.SetLower( rOldItem
.GetLower(),
284 static_cast<sal_uInt16
>(m_xBottomDist
->get_value(FieldUnit::NONE
)) );
286 aMargin
.SetLower( static_cast<sal_uInt16
>(m_xBottomDist
->GetCoreValue(eUnit
)) );
291 aMargin
.SetUpper(static_cast<sal_uInt16
>(m_xTopDist
->GetCoreValue(eUnit
)));
292 aMargin
.SetLower(static_cast<sal_uInt16
>(m_xBottomDist
->GetCoreValue(eUnit
)));
294 aMargin
.SetContextValue(m_xContextualCB
->get_active());
296 if ( !pOld
|| *static_cast<const SvxULSpaceItem
*>(pOld
) != aMargin
||
297 SfxItemState::DONTCARE
== GetItemSet().GetItemState( nWhich
) )
299 rOutSet
->Put( aMargin
);
303 bool bNullTab
= false;
305 if ( m_xLeftIndent
->get_value_changed_from_saved() ||
306 m_xFLineIndent
->get_value_changed_from_saved() ||
307 m_xRightIndent
->get_value_changed_from_saved() ||
308 m_xAutoCB
->get_state_changed_from_saved() )
310 nWhich
= GetWhich( SID_ATTR_LRSPACE
);
311 MapUnit eUnit
= pPool
->GetMetric( nWhich
);
312 SvxLRSpaceItem
aMargin( nWhich
);
313 pOld
= GetOldItem( *rOutSet
, SID_ATTR_LRSPACE
);
317 DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
319 const SvxLRSpaceItem
& rOldItem
=
320 static_cast<const SvxLRSpaceItem
&>(GetItemSet().GetParent()->Get( nWhich
));
322 if (m_xLeftIndent
->IsRelative())
323 aMargin
.SetTextLeft( rOldItem
.GetTextLeft(),
324 static_cast<sal_uInt16
>(m_xLeftIndent
->get_value(FieldUnit::NONE
)) );
326 aMargin
.SetTextLeft(m_xLeftIndent
->GetCoreValue(eUnit
));
328 if ( m_xRightIndent
->IsRelative() )
329 aMargin
.SetRight( rOldItem
.GetRight(),
330 static_cast<sal_uInt16
>(m_xRightIndent
->get_value(FieldUnit::NONE
)) );
332 aMargin
.SetRight(m_xRightIndent
->GetCoreValue(eUnit
));
334 if ( m_xFLineIndent
->IsRelative() )
335 aMargin
.SetTextFirstLineOffset( rOldItem
.GetTextFirstLineOffset(),
336 static_cast<sal_uInt16
>(m_xFLineIndent
->get_value(FieldUnit::NONE
)) );
338 aMargin
.SetTextFirstLineOffset(static_cast<sal_uInt16
>(m_xFLineIndent
->GetCoreValue(eUnit
)));
342 aMargin
.SetTextLeft(m_xLeftIndent
->GetCoreValue(eUnit
));
343 aMargin
.SetRight(m_xRightIndent
->GetCoreValue(eUnit
));
344 aMargin
.SetTextFirstLineOffset(static_cast<sal_uInt16
>(m_xFLineIndent
->GetCoreValue(eUnit
)));
346 aMargin
.SetAutoFirst(m_xAutoCB
->get_active());
347 if ( aMargin
.GetTextFirstLineOffset() < 0 )
350 if ( !pOld
|| *static_cast<const SvxLRSpaceItem
*>(pOld
) != aMargin
||
351 SfxItemState::DONTCARE
== GetItemSet().GetItemState( nWhich
) )
353 rOutSet
->Put( aMargin
);
360 MapUnit eUnit
= pPool
->GetMetric( GetWhich( SID_ATTR_TABSTOP
) );
361 if ( MapUnit::Map100thMM
!= eUnit
)
364 // negative first line indent -> set null default tabstob if applicable
365 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_TABSTOP
);
366 const SfxItemSet
& rInSet
= GetItemSet();
368 if ( rInSet
.GetItemState( _nWhich
) >= SfxItemState::DEFAULT
)
370 const SvxTabStopItem
& rTabItem
=
371 static_cast<const SvxTabStopItem
&>(rInSet
.Get( _nWhich
));
372 SvxTabStopItem
aNullTab( rTabItem
);
373 SvxTabStop
aNull( 0, SvxTabAdjust::Default
);
374 aNullTab
.Insert( aNull
);
375 rOutSet
->Put( aNullTab
);
379 if (m_xRegisterCB
->get_visible())
381 const SfxBoolItem
* pBoolItem
= static_cast<const SfxBoolItem
*>(GetOldItem(
382 *rOutSet
, SID_ATTR_PARA_REGISTER
));
385 std::unique_ptr
<SfxBoolItem
> pRegItem(pBoolItem
->Clone());
386 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
387 bool bSet
= pRegItem
->GetValue();
389 if (m_xRegisterCB
->get_active() != bSet
)
391 pRegItem
->SetValue(!bSet
);
392 rOutSet
->Put(*pRegItem
);
395 else if ( SfxItemState::DEFAULT
== GetItemSet().GetItemState( _nWhich
, false ) )
396 rOutSet
->ClearItem(_nWhich
);
402 void SvxStdParagraphTabPage::Reset( const SfxItemSet
* rSet
)
404 SfxItemPool
* pPool
= rSet
->GetPool();
405 DBG_ASSERT( pPool
, "Where is the pool?" );
408 FieldUnit eFUnit
= GetModuleFieldUnit( *rSet
);
410 bool bApplyCharUnit
= GetApplyCharUnit( *rSet
);
412 if(SvtCJKOptions::IsAsianTypographyEnabled() && bApplyCharUnit
)
413 eFUnit
= FieldUnit::CHAR
;
415 m_xLeftIndent
->SetFieldUnit(eFUnit
);
416 m_xRightIndent
->SetFieldUnit(eFUnit
);
417 m_xFLineIndent
->SetFieldUnit(eFUnit
);
418 if ( eFUnit
== FieldUnit::CHAR
)
420 m_xTopDist
->SetFieldUnit(FieldUnit::LINE
);
421 m_xBottomDist
->SetFieldUnit(FieldUnit::LINE
);
422 SetFieldUnit(*m_xLineDistAtMetricBox
, FieldUnit::POINT
);
426 m_xTopDist
->SetFieldUnit(eFUnit
);
427 m_xBottomDist
->SetFieldUnit(eFUnit
);
428 SetFieldUnit(*m_xLineDistAtMetricBox
, eFUnit
);
431 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_LRSPACE
);
432 SfxItemState eItemState
= rSet
->GetItemState( _nWhich
);
434 if ( eItemState
>= SfxItemState::DEFAULT
)
436 MapUnit eUnit
= pPool
->GetMetric( _nWhich
);
440 const SvxLRSpaceItem
& rOldItem
=
441 static_cast<const SvxLRSpaceItem
&>(rSet
->Get( _nWhich
));
443 if ( rOldItem
.GetPropLeft() != 100 )
445 m_xLeftIndent
->SetRelative( true );
446 m_xLeftIndent
->set_value(rOldItem
.GetPropLeft(), FieldUnit::NONE
);
450 m_xLeftIndent
->SetRelative(false);
451 m_xLeftIndent
->SetFieldUnit(eFUnit
);
452 m_xLeftIndent
->SetMetricValue(rOldItem
.GetTextLeft(), eUnit
);
455 if ( rOldItem
.GetPropRight() != 100 )
457 m_xRightIndent
->SetRelative( true );
458 m_xRightIndent
->set_value(rOldItem
.GetPropRight(), FieldUnit::NONE
);
462 m_xRightIndent
->SetRelative(false);
463 m_xRightIndent
->SetFieldUnit(eFUnit
);
464 m_xRightIndent
->SetMetricValue(rOldItem
.GetRight(), eUnit
);
467 if ( rOldItem
.GetPropTextFirstLineOffset() != 100 )
469 m_xFLineIndent
->SetRelative(true);
470 m_xFLineIndent
->set_value(rOldItem
.GetPropTextFirstLineOffset(), FieldUnit::NONE
);
474 m_xFLineIndent
->SetRelative(false);
475 m_xFLineIndent
->set_min(-9999, FieldUnit::NONE
);
476 m_xFLineIndent
->SetFieldUnit(eFUnit
);
477 m_xFLineIndent
->SetMetricValue(rOldItem
.GetTextFirstLineOffset(), eUnit
);
479 m_xAutoCB
->set_active(rOldItem
.IsAutoFirst());
483 const SvxLRSpaceItem
& rSpace
=
484 static_cast<const SvxLRSpaceItem
&>(rSet
->Get( _nWhich
));
486 m_xLeftIndent
->SetMetricValue(rSpace
.GetTextLeft(), eUnit
);
487 m_xRightIndent
->SetMetricValue(rSpace
.GetRight(), eUnit
);
488 m_xFLineIndent
->SetMetricValue(rSpace
.GetTextFirstLineOffset(), eUnit
);
489 m_xAutoCB
->set_active(rSpace
.IsAutoFirst());
491 AutoHdl_Impl(*m_xAutoCB
);
495 m_xLeftIndent
->set_text(OUString());
496 m_xRightIndent
->set_text(OUString());
497 m_xFLineIndent
->set_text(OUString());
500 _nWhich
= GetWhich( SID_ATTR_ULSPACE
);
501 eItemState
= rSet
->GetItemState( _nWhich
);
503 if ( eItemState
>= SfxItemState::DEFAULT
)
505 MapUnit eUnit
= pPool
->GetMetric( _nWhich
);
507 const SvxULSpaceItem
& rOldItem
=
508 static_cast<const SvxULSpaceItem
&>(rSet
->Get( _nWhich
));
512 if ( rOldItem
.GetPropUpper() != 100 )
514 m_xTopDist
->SetRelative( true );
515 m_xTopDist
->set_value(rOldItem
.GetPropUpper(), FieldUnit::NONE
);
519 m_xTopDist
->SetRelative(false);
520 if (eFUnit
== FieldUnit::CHAR
)
521 m_xTopDist
->SetFieldUnit(FieldUnit::LINE
);
523 m_xTopDist
->SetFieldUnit(eFUnit
);
524 m_xTopDist
->SetMetricValue(rOldItem
.GetUpper(), eUnit
);
527 if ( rOldItem
.GetPropLower() != 100 )
529 m_xBottomDist
->SetRelative( true );
530 m_xBottomDist
->set_value(rOldItem
.GetPropLower(), FieldUnit::NONE
);
534 m_xBottomDist
->SetRelative(false);
535 if (eFUnit
== FieldUnit::CHAR
)
536 m_xBottomDist
->SetFieldUnit(FieldUnit::LINE
);
538 m_xBottomDist
->SetFieldUnit(eFUnit
);
539 m_xBottomDist
->SetMetricValue(rOldItem
.GetLower(), eUnit
);
544 m_xTopDist
->SetMetricValue(rOldItem
.GetUpper(), eUnit
);
545 m_xBottomDist
->SetMetricValue(rOldItem
.GetLower(), eUnit
);
547 m_xContextualCB
->set_active(rOldItem
.GetContext());
551 m_xTopDist
->set_text(OUString());
552 m_xBottomDist
->set_text(OUString());
555 _nWhich
= GetWhich( SID_ATTR_PARA_LINESPACE
);
556 eItemState
= rSet
->GetItemState( _nWhich
);
558 if ( eItemState
>= SfxItemState::DEFAULT
)
559 SetLineSpacing_Impl( static_cast<const SvxLineSpacingItem
&>(rSet
->Get( _nWhich
)) );
561 m_xLineDist
->set_active(-1);
563 _nWhich
= GetWhich( SID_ATTR_PARA_REGISTER
);
564 eItemState
= rSet
->GetItemState( _nWhich
);
566 if ( eItemState
>= SfxItemState::DEFAULT
)
567 m_xRegisterCB
->set_active( static_cast<const SfxBoolItem
&>(rSet
->Get( _nWhich
)).GetValue());
568 m_xRegisterCB
->save_state();
569 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(*rSet
);
570 if(nHtmlMode
& HTMLMODE_ON
)
572 m_xRegisterCB
->hide();
576 // this sets the min/max limits; do this _after_ setting the values,
577 // because for Impress the min of first-line indent depends on value of
583 void SvxStdParagraphTabPage::ChangesApplied()
585 m_xLeftIndent
->save_value();
586 m_xRightIndent
->save_value();
587 m_xFLineIndent
->save_value();
588 m_xLineDist
->save_value();
589 m_xLineDistAtPercentBox
->save_value();
590 m_xLineDistAtMetricBox
->save_value();
591 m_xRegisterCB
->save_state();
592 m_xTopDist
->save_value();
593 m_xBottomDist
->save_value();
594 m_xContextualCB
->save_state();
595 m_xAutoCB
->save_state();
598 void SvxStdParagraphTabPage::EnableRelativeMode()
600 DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
602 m_xLeftIndent
->EnableRelativeMode( 0, 999 );
603 m_xFLineIndent
->EnableRelativeMode( 0, 999 );
604 m_xRightIndent
->EnableRelativeMode( 0, 999 );
605 m_xTopDist
->EnableRelativeMode( 0, 999 );
606 m_xBottomDist
->EnableRelativeMode( 0, 999 );
607 bRelativeMode
= true;
610 void SvxStdParagraphTabPage::ActivatePage( const SfxItemSet
& rSet
)
612 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
613 SfxItemState eItemState
= rSet
.GetItemState( _nWhich
);
615 if ( eItemState
< SfxItemState::DEFAULT
)
618 const SvxAdjustItem
& rAdj
= static_cast<const SvxAdjustItem
&>( rSet
.Get( _nWhich
) );
619 SvxAdjust eAdjust
= rAdj
.GetAdjust();
620 if ( eAdjust
== SvxAdjust::Center
|| eAdjust
== SvxAdjust::Block
)
622 _nWhich
= GetWhich( SID_ATTR_FRAMEDIRECTION
);
623 eItemState
= rSet
.GetItemState( _nWhich
);
625 if ( eItemState
>= SfxItemState::DEFAULT
)
627 const SvxFrameDirectionItem
& rFrameDirItem
= static_cast<const SvxFrameDirectionItem
&>( rSet
.Get( _nWhich
) );
628 SvxFrameDirection eFrameDirection
= rFrameDirItem
.GetValue();
630 m_aExampleWin
.EnableRTL( SvxFrameDirection::Horizontal_RL_TB
== eFrameDirection
);
632 if ( eAdjust
== SvxAdjust::Block
)
633 m_aExampleWin
.SetLastLine( rAdj
.GetLastBlock() );
638 m_aExampleWin
.EnableRTL( eAdjust
== SvxAdjust::Right
);
639 eAdjust
= SvxAdjust::Left
; //required for correct preview display
640 m_aExampleWin
.SetLastLine( eAdjust
);
642 m_aExampleWin
.SetAdjust( eAdjust
);
644 UpdateExample_Impl();
647 DeactivateRC
SvxStdParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
652 FillItemSet( _pSet
);
653 return DeactivateRC::LeavePage
;
656 SvxStdParagraphTabPage::SvxStdParagraphTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttr
)
657 : SfxTabPage(pPage
, pController
, "cui/ui/paraindentspacing.ui", "ParaIndentSpacing", &rAttr
)
658 , nWidth(11905 /*567 * 50*/)
660 , bRelativeMode(false)
661 , m_xLeftIndent(new SvxRelativeField(m_xBuilder
->weld_metric_spin_button("spinED_LEFTINDENT", FieldUnit::CM
)))
662 , m_xRightLabel(m_xBuilder
->weld_label("labelFT_RIGHTINDENT"))
663 , m_xRightIndent(new SvxRelativeField(m_xBuilder
->weld_metric_spin_button("spinED_RIGHTINDENT", FieldUnit::CM
)))
664 , m_xFLineLabel(m_xBuilder
->weld_label("labelFT_FLINEINDENT"))
665 , m_xFLineIndent(new SvxRelativeField(m_xBuilder
->weld_metric_spin_button("spinED_FLINEINDENT", FieldUnit::CM
)))
666 , m_xAutoCB(m_xBuilder
->weld_check_button("checkCB_AUTO"))
667 , m_xTopDist(new SvxRelativeField(m_xBuilder
->weld_metric_spin_button("spinED_TOPDIST", FieldUnit::CM
)))
668 , m_xBottomDist(new SvxRelativeField(m_xBuilder
->weld_metric_spin_button("spinED_BOTTOMDIST", FieldUnit::CM
)))
669 , m_xContextualCB(m_xBuilder
->weld_check_button("checkCB_CONTEXTUALSPACING"))
670 , m_xLineDist(m_xBuilder
->weld_combo_box("comboLB_LINEDIST"))
671 , m_xLineDistAtPercentBox(m_xBuilder
->weld_metric_spin_button("spinED_LINEDISTPERCENT", FieldUnit::PERCENT
))
672 , m_xLineDistAtMetricBox(m_xBuilder
->weld_metric_spin_button("spinED_LINEDISTMETRIC", FieldUnit::CM
))
673 , m_xLineDistAtLabel(m_xBuilder
->weld_label("labelFT_LINEDIST"))
674 , m_xAbsDist(m_xBuilder
->weld_label("labelST_LINEDIST_ABS"))
675 , m_xRegisterCB(m_xBuilder
->weld_check_button("checkCB_REGISTER"))
676 , m_xExampleWin(new weld::CustomWeld(*m_xBuilder
, "drawingareaWN_EXAMPLE", m_aExampleWin
))
678 sAbsDist
= m_xAbsDist
->get_label();
680 // this page needs ExchangeSupport
681 SetExchangeSupport();
683 m_xLineDistAtMetricBox
->hide();
686 m_xFLineIndent
->set_min(-9999, FieldUnit::NONE
); // is set to 0 on default
689 SvxStdParagraphTabPage::~SvxStdParagraphTabPage()
693 void SvxStdParagraphTabPage::EnableNegativeMode()
695 m_xLeftIndent
->set_min(-9999, FieldUnit::NONE
);
696 m_xRightIndent
->set_min(-9999, FieldUnit::NONE
);
697 m_xRightIndent
->EnableNegativeMode();
698 m_xLeftIndent
->EnableNegativeMode();
701 void SvxStdParagraphTabPage::SetLineSpacing_Impl
703 const SvxLineSpacingItem
&rAttr
706 MapUnit eUnit
= GetItemSet().GetPool()->GetMetric( rAttr
.Which() );
708 switch( rAttr
.GetLineSpaceRule() )
710 case SvxLineSpaceRule::Auto
:
712 SvxInterLineSpaceRule eInter
= rAttr
.GetInterLineSpaceRule();
716 // Default single line spacing
717 case SvxInterLineSpaceRule::Off
:
718 m_xLineDist
->set_active( LLINESPACE_1
);
721 // Default single line spacing
722 case SvxInterLineSpaceRule::Prop
:
723 if ( 100 == rAttr
.GetPropLineSpace() )
725 m_xLineDist
->set_active( LLINESPACE_1
);
729 if ( 115 == rAttr
.GetPropLineSpace() )
731 m_xLineDist
->set_active( LLINESPACE_115
);
735 if ( 150 == rAttr
.GetPropLineSpace() )
737 m_xLineDist
->set_active( LLINESPACE_15
);
740 // double line spacing
741 if ( 200 == rAttr
.GetPropLineSpace() )
743 m_xLineDist
->set_active( LLINESPACE_2
);
746 // the set per cent value
747 m_xLineDistAtPercentBox
->set_value(m_xLineDistAtPercentBox
->normalize(rAttr
.GetPropLineSpace()), FieldUnit::NONE
);
748 m_xLineDist
->set_active( LLINESPACE_PROP
);
751 case SvxInterLineSpaceRule::Fix
:
752 SetMetricValue( *m_xLineDistAtMetricBox
, rAttr
.GetInterLineSpace(), eUnit
);
753 m_xLineDist
->set_active( LLINESPACE_DURCH
);
755 default: ;//prevent warning
759 case SvxLineSpaceRule::Fix
:
760 SetMetricValue(*m_xLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
761 m_xLineDist
->set_active( LLINESPACE_FIX
);
764 case SvxLineSpaceRule::Min
:
765 SetMetricValue(*m_xLineDistAtMetricBox
, rAttr
.GetLineHeight(), eUnit
);
766 m_xLineDist
->set_active( LLINESPACE_MIN
);
768 default: ;//prevent warning
770 LineDistHdl_Impl( *m_xLineDist
);
773 IMPL_LINK_NOARG(SvxStdParagraphTabPage
, LineDistPopupHdl_Impl
, weld::ComboBox
&, void)
775 m_bLineDistToggled
= true;
778 IMPL_LINK(SvxStdParagraphTabPage
, LineDistHdl_Impl
, weld::ComboBox
&, rBox
, void)
780 switch (rBox
.get_active())
786 m_xLineDistAtLabel
->set_sensitive(false);
787 m_xLineDistAtPercentBox
->set_sensitive(false);
788 m_xLineDistAtPercentBox
->set_text(OUString());
789 m_xLineDistAtMetricBox
->set_sensitive(false);
790 m_xLineDistAtMetricBox
->set_text(OUString());
793 case LLINESPACE_DURCH
:
794 // setting a sensible default?
795 // limit MS min(10, aPageSize)
796 m_xLineDistAtMetricBox
->set_min(0, FieldUnit::NONE
);
798 if (m_xLineDistAtMetricBox
->get_text().isEmpty())
799 m_xLineDistAtMetricBox
->set_value(m_xLineDistAtMetricBox
->normalize(1), FieldUnit::NONE
);
800 m_xLineDistAtPercentBox
->hide();
801 m_xLineDistAtMetricBox
->show();
802 m_xLineDistAtMetricBox
->set_sensitive(true);
803 m_xLineDistAtLabel
->set_sensitive(true);
807 m_xLineDistAtMetricBox
->set_min(0, FieldUnit::NONE
);
809 if (m_xLineDistAtMetricBox
->get_text().isEmpty())
810 m_xLineDistAtMetricBox
->set_value(m_xLineDistAtMetricBox
->normalize(10), FieldUnit::TWIP
);
811 m_xLineDistAtPercentBox
->hide();
812 m_xLineDistAtMetricBox
->show();
813 m_xLineDistAtMetricBox
->set_sensitive(true);
814 m_xLineDistAtLabel
->set_sensitive(true);
817 case LLINESPACE_PROP
:
819 if (m_xLineDistAtPercentBox
->get_text().isEmpty())
820 m_xLineDistAtPercentBox
->set_value(m_xLineDistAtPercentBox
->normalize(100), FieldUnit::TWIP
);
821 m_xLineDistAtMetricBox
->hide();
822 m_xLineDistAtPercentBox
->show();
823 m_xLineDistAtPercentBox
->set_sensitive(true);
824 m_xLineDistAtLabel
->set_sensitive(true);
828 auto nTemp
= m_xLineDistAtMetricBox
->get_value(FieldUnit::NONE
);
829 m_xLineDistAtMetricBox
->set_min(m_xLineDistAtMetricBox
->normalize(nMinFixDist
), FieldUnit::TWIP
);
831 // if the value has been changed at SetMin,
832 // it is time for the default
833 if (m_xLineDistAtMetricBox
->get_value(FieldUnit::NONE
) != nTemp
)
834 SetMetricValue( *m_xLineDistAtMetricBox
, FIX_DIST_DEF
, MapUnit::MapTwip
); // fix is only in Writer
835 m_xLineDistAtPercentBox
->hide();
836 m_xLineDistAtMetricBox
->show();
837 m_xLineDistAtMetricBox
->set_sensitive(true);
838 m_xLineDistAtLabel
->set_sensitive(true);
842 UpdateExample_Impl();
845 IMPL_LINK_NOARG(SvxStdParagraphTabPage
, ModifyHdl_Impl
, weld::MetricSpinButton
&, void)
847 UpdateExample_Impl();
850 void SvxStdParagraphTabPage::Init_Impl()
852 m_xLineDist
->connect_popup_toggled(LINK(this, SvxStdParagraphTabPage
, LineDistPopupHdl_Impl
));
853 m_xLineDist
->connect_changed(LINK(this, SvxStdParagraphTabPage
, LineDistHdl_Impl
));
855 Link
<weld::MetricSpinButton
&,void> aLink2
= LINK(this, SvxStdParagraphTabPage
, ELRLoseFocusHdl
);
856 m_xFLineIndent
->connect_value_changed(aLink2
);
857 m_xLeftIndent
->connect_value_changed(aLink2
);
858 m_xRightIndent
->connect_value_changed(aLink2
);
860 Link
<weld::MetricSpinButton
&,void> aLink
= LINK(this, SvxStdParagraphTabPage
, ModifyHdl_Impl
);
861 m_xTopDist
->connect_value_changed(aLink
);
862 m_xBottomDist
->connect_value_changed(aLink
);
864 m_xAutoCB
->connect_toggled(LINK(this, SvxStdParagraphTabPage
, AutoHdl_Impl
));
865 SfxItemPool
* pPool
= GetItemSet().GetPool();
866 DBG_ASSERT( pPool
, "Where is the pool?" );
867 FieldUnit eUnit
= MapToFieldUnit( pPool
->GetMetric( GetWhich( SID_ATTR_LRSPACE
) ) );
869 m_xTopDist
->set_max( m_xTopDist
->normalize( MAX_DURCH
), eUnit
);
870 m_xBottomDist
->set_max( m_xBottomDist
->normalize( MAX_DURCH
), eUnit
);
871 m_xLineDistAtMetricBox
->set_max( m_xLineDistAtMetricBox
->normalize( MAX_DURCH
), eUnit
);
874 void SvxStdParagraphTabPage::UpdateExample_Impl()
876 m_aExampleWin
.SetFirstLineOffset( static_cast<short>(m_xFLineIndent
->denormalize( m_xFLineIndent
->get_value( FieldUnit::TWIP
) )) );
877 m_aExampleWin
.SetLeftMargin( static_cast<tools::Long
>(m_xLeftIndent
->denormalize( m_xLeftIndent
->get_value( FieldUnit::TWIP
) ) ) );
878 m_aExampleWin
.SetRightMargin( static_cast<tools::Long
>(m_xRightIndent
->denormalize( m_xRightIndent
->get_value( FieldUnit::TWIP
) ) ) );
879 m_aExampleWin
.SetUpper( static_cast<sal_uInt16
>(m_xTopDist
->denormalize( m_xTopDist
->get_value( FieldUnit::TWIP
) )) );
880 m_aExampleWin
.SetLower( static_cast<sal_uInt16
>(m_xBottomDist
->denormalize( m_xBottomDist
->get_value( FieldUnit::TWIP
) )) );
882 int nPos
= m_xLineDist
->get_active();
890 case LLINESPACE_PROP
:
892 case LLINESPACE_DURCH
:
894 m_aExampleWin
.SetLineSpace( static_cast<SvxPrevLineSpace
>(nPos
) );
897 m_aExampleWin
.Invalidate();
900 void SvxStdParagraphTabPage::EnableRegisterMode()
902 m_xRegisterCB
->show();
905 void SvxStdParagraphTabPage::EnableContextualMode()
907 m_xContextualCB
->show();
910 IMPL_LINK(SvxStdParagraphTabPage
, AutoHdl_Impl
, weld::Toggleable
&, rBox
, void)
912 bool bEnable
= !rBox
.get_active();
913 m_xFLineLabel
->set_sensitive(bEnable
);
914 m_xFLineIndent
->set_sensitive(bEnable
);
917 void SvxStdParagraphTabPage::EnableAutoFirstLine()
922 void SvxStdParagraphTabPage::EnableAbsLineDist(tools::Long nMinTwip
)
924 m_xLineDist
->append_text(sAbsDist
);
925 nMinFixDist
= nMinTwip
;
928 void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet
& aSet
)
931 /* different bit represent call to different method of SvxStdParagraphTabPage
932 0x0001 --->EnableRelativeMode()
933 0x0002 --->EnableRegisterMode()
934 0x0004 --->EnableAutoFirstLine()
935 0x0008 --->EnableNegativeMode()
936 0x0010 --->EnableContextualMode()
938 const SfxUInt16Item
* pPageWidthItem
= aSet
.GetItem
<SfxUInt16Item
>(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH
, false);
939 const SfxUInt32Item
* pFlagSetItem
= aSet
.GetItem
<SfxUInt32Item
>(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET
, false);
940 const SfxUInt32Item
* pLineDistItem
= aSet
.GetItem
<SfxUInt32Item
>(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST
, false);
943 nWidth
= pPageWidthItem
->GetValue();
947 if (( 0x0001 & pFlagSetItem
->GetValue())== 0x0001 )
948 EnableRelativeMode();
950 if (( 0x0002 & pFlagSetItem
->GetValue())== 0x0002 )
951 EnableRegisterMode();
953 if ( ( 0x0004 & pFlagSetItem
->GetValue())== 0x0004 )
954 EnableAutoFirstLine();
958 EnableAbsLineDist(pLineDistItem
->GetValue());
962 if (( 0x0008 & pFlagSetItem
->GetValue()) == 0x0008 )
963 EnableNegativeMode();
965 if (( 0x0010 & pFlagSetItem
->GetValue()) == 0x0010 )
966 EnableContextualMode();
970 #define LASTLINEPOS_DEFAULT 0
971 #define LASTLINEPOS_LEFT 1
973 #define LASTLINECOUNT_OLD 3
974 #define LASTLINECOUNT_NEW 4
976 SvxParaAlignTabPage::SvxParaAlignTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
)
977 : SfxTabPage(pPage
, pController
, "cui/ui/paragalignpage.ui", "ParaAlignPage", &rSet
)
978 , m_xLeft(m_xBuilder
->weld_radio_button("radioBTN_LEFTALIGN"))
979 , m_xRight(m_xBuilder
->weld_radio_button("radioBTN_RIGHTALIGN"))
980 , m_xCenter(m_xBuilder
->weld_radio_button("radioBTN_CENTERALIGN"))
981 , m_xJustify(m_xBuilder
->weld_radio_button("radioBTN_JUSTIFYALIGN"))
982 , m_xLeftBottom(m_xBuilder
->weld_label("labelST_LEFTALIGN_ASIAN"))
983 , m_xRightTop(m_xBuilder
->weld_label("labelST_RIGHTALIGN_ASIAN"))
984 , m_xLastLineFT(m_xBuilder
->weld_label("labelLB_LASTLINE"))
985 , m_xLastLineLB(m_xBuilder
->weld_combo_box("comboLB_LASTLINE"))
986 , m_xExpandCB(m_xBuilder
->weld_check_button("checkCB_EXPAND"))
987 , m_xSnapToGridCB(m_xBuilder
->weld_check_button("checkCB_SNAP"))
988 , m_xExampleWin(new weld::CustomWeld(*m_xBuilder
, "drawingareaWN_EXAMPLE", m_aExampleWin
))
989 , m_xVertAlignFL(m_xBuilder
->weld_widget("frameFL_VERTALIGN"))
990 , m_xVertAlignLB(m_xBuilder
->weld_combo_box("comboLB_VERTALIGN"))
991 , m_xPropertiesFL(m_xBuilder
->weld_widget("framePROPERTIES"))
992 , m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder
->weld_combo_box("comboLB_TEXTDIRECTION")))
994 SetExchangeSupport();
996 sal_uInt16 nLastLinePos
= LASTLINEPOS_DEFAULT
;
998 if ( SvtCJKOptions::IsAsianTypographyEnabled() )
1000 m_xLeft
->set_label(m_xLeftBottom
->get_label());
1001 m_xRight
->set_label(m_xRightTop
->get_label());
1003 OUString
sLeft(m_xLeft
->get_label());
1004 sLeft
= MnemonicGenerator::EraseAllMnemonicChars( sLeft
);
1006 if (m_xLastLineLB
->get_count() == LASTLINECOUNT_OLD
)
1008 m_xLastLineLB
->remove(0);
1009 m_xLastLineLB
->insert_text(0, sLeft
);
1012 nLastLinePos
= LASTLINEPOS_LEFT
;
1015 // remove "Default" or "Left" entry, depends on CJKOptions
1016 if (m_xLastLineLB
->get_count() == LASTLINECOUNT_NEW
)
1017 m_xLastLineLB
->remove(nLastLinePos
);
1019 Link
<weld::Toggleable
&, void> aLink
= LINK( this, SvxParaAlignTabPage
, AlignHdl_Impl
);
1020 m_xLeft
->connect_toggled(aLink
);
1021 m_xRight
->connect_toggled(aLink
);
1022 m_xCenter
->connect_toggled(aLink
);
1023 m_xJustify
->connect_toggled(aLink
);
1024 m_xLastLineLB
->connect_changed(LINK(this, SvxParaAlignTabPage
, LastLineHdl_Impl
));
1025 m_xTextDirectionLB
->connect_changed(LINK(this, SvxParaAlignTabPage
, TextDirectionHdl_Impl
));
1027 m_xTextDirectionLB
->append(SvxFrameDirection::Environment
, SvxResId(RID_SVXSTR_FRAMEDIR_SUPER
));
1028 m_xTextDirectionLB
->append(SvxFrameDirection::Horizontal_LR_TB
, SvxResId(RID_SVXSTR_FRAMEDIR_LTR
));
1029 m_xTextDirectionLB
->append(SvxFrameDirection::Horizontal_RL_TB
, SvxResId(RID_SVXSTR_FRAMEDIR_RTL
));
1032 SvxParaAlignTabPage::~SvxParaAlignTabPage()
1036 DeactivateRC
SvxParaAlignTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1039 FillItemSet( _pSet
);
1040 return DeactivateRC::LeavePage
;
1043 std::unique_ptr
<SfxTabPage
> SvxParaAlignTabPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
)
1045 return std::make_unique
<SvxParaAlignTabPage
>(pPage
, pController
, *rSet
);
1048 bool SvxParaAlignTabPage::FillItemSet( SfxItemSet
* rOutSet
)
1050 bool bModified
= false;
1053 SvxAdjust eAdjust
= SvxAdjust::Left
;
1055 if (m_xLeft
->get_active())
1057 eAdjust
= SvxAdjust::Left
;
1058 bAdj
= m_xLeft
->get_saved_state() == TRISTATE_FALSE
;
1060 else if (m_xRight
->get_active())
1062 eAdjust
= SvxAdjust::Right
;
1063 bAdj
= m_xRight
->get_saved_state() == TRISTATE_FALSE
;
1065 else if (m_xCenter
->get_active())
1067 eAdjust
= SvxAdjust::Center
;
1068 bAdj
= m_xCenter
->get_saved_state() == TRISTATE_FALSE
;
1070 else if (m_xJustify
->get_active())
1072 eAdjust
= SvxAdjust::Block
;
1073 bAdj
= m_xJustify
->get_saved_state() == TRISTATE_FALSE
||
1074 m_xExpandCB
->get_state_changed_from_saved() ||
1075 m_xLastLineLB
->get_value_changed_from_saved();
1078 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1082 SvxAdjust eOneWord
= m_xExpandCB
->get_active() ? SvxAdjust::Block
: SvxAdjust::Left
;
1084 int nLBPos
= m_xLastLineLB
->get_active();
1085 SvxAdjust eLastBlock
= SvxAdjust::Left
;
1087 eLastBlock
= SvxAdjust::Center
;
1088 else if ( 2 == nLBPos
)
1089 eLastBlock
= SvxAdjust::Block
;
1091 SvxAdjustItem
aAdj( static_cast<const SvxAdjustItem
&>(GetItemSet().Get( _nWhich
)) );
1092 aAdj
.SetAdjust( eAdjust
);
1093 aAdj
.SetOneWord( eOneWord
);
1094 aAdj
.SetLastBlock( eLastBlock
);
1095 rOutSet
->Put( aAdj
);
1099 if (m_xSnapToGridCB
->get_state_changed_from_saved())
1101 rOutSet
->Put(SvxParaGridItem(m_xSnapToGridCB
->get_active(), GetWhich( SID_ATTR_PARA_SNAPTOGRID
)));
1105 if (m_xVertAlignLB
->get_value_changed_from_saved())
1107 rOutSet
->Put(SvxParaVertAlignItem(static_cast<SvxParaVertAlignItem::Align
>(m_xVertAlignLB
->get_active()), GetWhich( SID_PARA_VERTALIGN
)));
1111 if (m_xTextDirectionLB
->get_visible())
1113 if (m_xTextDirectionLB
->get_value_changed_from_saved())
1115 SvxFrameDirection eDir
= m_xTextDirectionLB
->get_active_id();
1116 rOutSet
->Put( SvxFrameDirectionItem( eDir
, GetWhich( SID_ATTR_FRAMEDIRECTION
) ) );
1124 void SvxParaAlignTabPage::ActivatePage( const SfxItemSet
& rSet
)
1129 void SvxParaAlignTabPage::Reset( const SfxItemSet
* rSet
)
1131 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_ADJUST
);
1132 SfxItemState eItemState
= rSet
->GetItemState( _nWhich
);
1134 sal_Int32 nLBSelect
= 0;
1135 if ( eItemState
>= SfxItemState::DEFAULT
)
1137 const SvxAdjustItem
& rAdj
= static_cast<const SvxAdjustItem
&>(rSet
->Get( _nWhich
));
1139 switch ( rAdj
.GetAdjust() /*!!! ask VB rAdj.GetLastBlock()*/ )
1141 case SvxAdjust::Left
: m_xLeft
->set_active(true); break;
1143 case SvxAdjust::Right
: m_xRight
->set_active(true); break;
1145 case SvxAdjust::Center
: m_xCenter
->set_active(true); break;
1147 case SvxAdjust::Block
: m_xJustify
->set_active(true); break;
1148 default: ; //prevent warning
1150 bool bEnable
= m_xJustify
->get_active();
1151 m_xLastLineFT
->set_sensitive(bEnable
);
1152 m_xLastLineLB
->set_sensitive(bEnable
);
1154 switch(rAdj
.GetLastBlock())
1156 case SvxAdjust::Left
: nLBSelect
= 0; break;
1158 case SvxAdjust::Center
: nLBSelect
= 1; break;
1160 case SvxAdjust::Block
: nLBSelect
= 2; break;
1161 default: ; //prevent warning
1163 m_xExpandCB
->set_sensitive(bEnable
&& nLBSelect
== 2);
1164 m_xExpandCB
->set_active(SvxAdjust::Block
== rAdj
.GetOneWord());
1168 m_xLeft
->set_active(false);
1169 m_xRight
->set_active(false);
1170 m_xCenter
->set_active(false);
1171 m_xJustify
->set_active(false);
1173 m_xLastLineLB
->set_active(nLBSelect
);
1175 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl(*rSet
);
1176 if(nHtmlMode
& HTMLMODE_ON
)
1178 m_xLastLineLB
->hide();
1179 m_xLastLineFT
->hide();
1180 m_xExpandCB
->hide();
1181 if(!(nHtmlMode
& HTMLMODE_FULL_STYLES
) )
1182 m_xJustify
->set_sensitive(false);
1183 m_xSnapToGridCB
->hide();
1185 _nWhich
= GetWhich(SID_ATTR_PARA_SNAPTOGRID
);
1186 eItemState
= rSet
->GetItemState( _nWhich
);
1187 if ( eItemState
>= SfxItemState::DEFAULT
)
1189 const SvxParaGridItem
& rSnap
= static_cast<const SvxParaGridItem
&>(rSet
->Get( _nWhich
));
1190 m_xSnapToGridCB
->set_active(rSnap
.GetValue());
1193 _nWhich
= GetWhich( SID_PARA_VERTALIGN
);
1194 eItemState
= rSet
->GetItemState( _nWhich
);
1196 if ( eItemState
>= SfxItemState::DEFAULT
)
1198 m_xVertAlignFL
->show();
1200 const SvxParaVertAlignItem
& rAlign
= static_cast<const SvxParaVertAlignItem
&>(rSet
->Get( _nWhich
));
1202 m_xVertAlignLB
->set_active(static_cast<sal_Int32
>(rAlign
.GetValue()));
1205 _nWhich
= GetWhich( SID_ATTR_FRAMEDIRECTION
);
1207 if( SfxItemState::DEFAULT
<= rSet
->GetItemState( _nWhich
) )
1209 const SvxFrameDirectionItem
& rFrameDirItem
= static_cast<const SvxFrameDirectionItem
&>( rSet
->Get( _nWhich
) );
1210 m_xTextDirectionLB
->set_active_id(rFrameDirItem
.GetValue());
1211 m_xTextDirectionLB
->save_value();
1214 m_xSnapToGridCB
->save_state();
1215 m_xVertAlignLB
->save_value();
1216 m_xLeft
->save_state();
1217 m_xRight
->save_state();
1218 m_xCenter
->save_state();
1219 m_xJustify
->save_state();
1220 m_xLastLineLB
->save_value();
1221 m_xExpandCB
->save_state();
1223 UpdateExample_Impl();
1226 void SvxParaAlignTabPage::ChangesApplied()
1228 m_xTextDirectionLB
->save_value();
1229 m_xSnapToGridCB
->save_state();
1230 m_xVertAlignLB
->save_value();
1231 m_xLeft
->save_state();
1232 m_xRight
->save_state();
1233 m_xCenter
->save_state();
1234 m_xJustify
->save_state();
1235 m_xLastLineLB
->save_value();
1236 m_xExpandCB
->save_state();
1239 IMPL_LINK_NOARG(SvxParaAlignTabPage
, AlignHdl_Impl
, weld::Toggleable
&, void)
1241 bool bJustify
= m_xJustify
->get_active();
1242 m_xLastLineFT
->set_sensitive(bJustify
);
1243 m_xLastLineLB
->set_sensitive(bJustify
);
1244 bool bLastLineIsBlock
= m_xLastLineLB
->get_active() == 2;
1245 m_xExpandCB
->set_sensitive(bJustify
&& bLastLineIsBlock
);
1246 //set last line listbox to entry position 0 if not enabled
1247 if (!m_xLastLineLB
->get_sensitive())
1248 m_xLastLineLB
->set_active(0);
1249 //uncheck 'Expand ... word' when check box is not enabled
1250 if (!m_xExpandCB
->get_sensitive())
1251 m_xExpandCB
->set_active(false);
1252 UpdateExample_Impl();
1255 IMPL_LINK_NOARG(SvxParaAlignTabPage
, LastLineHdl_Impl
, weld::ComboBox
&, void)
1257 //fdo#41350 only enable 'Expand last word' if last line is also justified
1258 bool bLastLineIsBlock
= m_xLastLineLB
->get_active() == 2;
1259 m_xExpandCB
->set_sensitive(bLastLineIsBlock
);
1260 //uncheck 'Expand ... word' when check box is not enabled
1261 if (!m_xExpandCB
->get_sensitive())
1262 m_xExpandCB
->set_active(false);
1263 UpdateExample_Impl();
1266 IMPL_LINK_NOARG(SvxParaAlignTabPage
, TextDirectionHdl_Impl
, weld::ComboBox
&, void)
1268 UpdateExample_Impl();
1271 void SvxParaAlignTabPage::UpdateExample_Impl()
1273 if (m_xLeft
->get_active())
1275 m_aExampleWin
.EnableRTL(false);
1276 m_aExampleWin
.SetAdjust(SvxAdjust::Left
);
1277 m_aExampleWin
.SetLastLine(SvxAdjust::Left
);
1279 else if (m_xRight
->get_active())
1281 m_aExampleWin
.EnableRTL(true);
1282 m_aExampleWin
.SetAdjust(SvxAdjust::Left
);
1283 m_aExampleWin
.SetLastLine(SvxAdjust::Left
);
1287 SvxFrameDirection eDir
= m_xTextDirectionLB
->get_active_id();
1290 case SvxFrameDirection::Environment
:
1291 if ( !m_xRight
->get_active() )
1292 m_aExampleWin
.EnableRTL( AllSettings::GetLayoutRTL() );
1294 case SvxFrameDirection::Horizontal_RL_TB
:
1295 if ( !m_xLeft
->get_active() )
1296 m_aExampleWin
.EnableRTL( true );
1298 case SvxFrameDirection::Horizontal_LR_TB
:
1299 if ( !m_xRight
->get_active() )
1300 m_aExampleWin
.EnableRTL( false );
1302 default: ; //prevent warning
1304 if (m_xCenter
->get_active())
1305 m_aExampleWin
.SetAdjust( SvxAdjust::Center
);
1306 else if (m_xJustify
->get_active())
1308 m_aExampleWin
.SetAdjust( SvxAdjust::Block
);
1309 int nLBPos
= m_xLastLineLB
->get_active();
1311 m_aExampleWin
.SetLastLine(SvxAdjust::Left
);
1312 else if (nLBPos
== 1)
1313 m_aExampleWin
.SetLastLine(SvxAdjust::Center
);
1314 else if (nLBPos
== 2)
1315 m_aExampleWin
.SetLastLine(SvxAdjust::Block
);
1319 m_aExampleWin
.Invalidate();
1322 void SvxParaAlignTabPage::EnableJustifyExt()
1324 m_xLastLineFT
->show();
1325 m_xLastLineLB
->show();
1326 m_xExpandCB
->show();
1327 if (SvtCJKOptions::IsAsianTypographyEnabled())
1328 m_xSnapToGridCB
->show();
1332 void SvxParaAlignTabPage::PageCreated (const SfxAllItemSet
& aSet
)
1334 const SfxBoolItem
* pBoolItem
= aSet
.GetItem
<SfxBoolItem
>(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT
, false);
1335 if (pBoolItem
&& pBoolItem
->GetValue())
1339 std::unique_ptr
<SfxTabPage
> SvxExtParagraphTabPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
)
1341 return std::make_unique
<SvxExtParagraphTabPage
>(pPage
, pController
, *rSet
);
1344 bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet
* rOutSet
)
1346 bool bModified
= false;
1347 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1348 const TriState eHyphenState
= m_xHyphenBox
->get_state();
1349 const SfxPoolItem
* pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_HYPHENZONE
);
1351 if ( m_xHyphenBox
->get_state_changed_from_saved() ||
1352 m_xHyphenNoCapsBox
->get_state_changed_from_saved() ||
1353 m_xExtHyphenBeforeBox
->get_value_changed_from_saved() ||
1354 m_xExtHyphenAfterBox
->get_value_changed_from_saved() ||
1355 m_xMaxHyphenEdit
->get_value_changed_from_saved() )
1357 SvxHyphenZoneItem
aHyphen(
1358 static_cast<const SvxHyphenZoneItem
&>(GetItemSet().Get( _nWhich
)) );
1359 aHyphen
.SetHyphen( eHyphenState
== TRISTATE_TRUE
);
1360 aHyphen
.SetNoCapsHyphenation(m_xHyphenNoCapsBox
->get_state() == TRISTATE_TRUE
);
1362 if ( eHyphenState
== TRISTATE_TRUE
)
1364 aHyphen
.GetMinLead() = static_cast<sal_uInt8
>(m_xExtHyphenBeforeBox
->get_value());
1365 aHyphen
.GetMinTrail() = static_cast<sal_uInt8
>(m_xExtHyphenAfterBox
->get_value());
1367 aHyphen
.GetMaxHyphens() = static_cast<sal_uInt8
>(m_xMaxHyphenEdit
->get_value());
1370 *static_cast<const SvxHyphenZoneItem
*>(pOld
) != aHyphen
||
1371 m_xHyphenBox
->get_state_changed_from_saved())
1373 rOutSet
->Put( aHyphen
);
1378 if (m_xPageNumBox
->get_sensitive()
1379 && (m_xPageNumBox
->get_state_changed_from_saved() || m_xPagenumEdit
->get_value_changed_from_saved()))
1381 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_PAGENUM
);
1383 if (TRISTATE_TRUE
== m_xPageNumBox
->get_state()
1384 && (!pOld
|| IsInvalidItem(pOld
)
1385 || static_cast<const SfxUInt16Item
*>(pOld
)->GetValue() != m_xPagenumEdit
->get_value()))
1387 SfxUInt16Item
aPageNum(SID_ATTR_PARA_PAGENUM
,
1388 static_cast<sal_uInt16
>(m_xPagenumEdit
->get_value()));
1389 rOutSet
->Put( aPageNum
);
1392 else if (TRISTATE_FALSE
== m_xPageNumBox
->get_state()
1393 && (pOld
|| IsInvalidItem(pOld
)))
1395 // need to tell sw to remove the item
1396 rOutSet
->DisableItem(SID_ATTR_PARA_PAGENUM
);
1403 TriState eState
= m_xApplyCollBtn
->get_state();
1404 bool bIsPageModel
= false;
1406 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1408 if ( m_xApplyCollBtn
->get_state_changed_from_saved() ||
1409 ( TRISTATE_TRUE
== eState
&&
1410 m_xApplyCollBox
->get_value_changed_from_saved() ) )
1412 if ( eState
== TRISTATE_TRUE
)
1414 sPage
= m_xApplyCollBox
->get_active_text();
1415 bIsPageModel
= !sPage
.isEmpty();
1417 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_MODEL
);
1419 if ( !pOld
|| static_cast<const SvxPageModelItem
*>(pOld
)->GetValue() != sPage
)
1421 rOutSet
->Put( SvxPageModelItem( sPage
, false, _nWhich
) );
1425 bIsPageModel
= false;
1427 else if(TRISTATE_TRUE
== eState
&& m_xApplyCollBtn
->get_sensitive())
1428 bIsPageModel
= true;
1430 rOutSet
->Put( SvxPageModelItem( sPage
, false, _nWhich
) );
1432 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1435 // if PageModel is turned on, always turn off PageBreak
1436 rOutSet
->Put( SvxFormatBreakItem( SvxBreak::NONE
, _nWhich
) );
1439 eState
= m_xPageBreakBox
->get_state();
1440 SfxItemState eModelState
= GetItemSet().GetItemState(SID_ATTR_PARA_MODEL
, false);
1442 if ( (eModelState
== SfxItemState::SET
&& TRISTATE_TRUE
== m_xPageBreakBox
->get_state()) ||
1443 m_xPageBreakBox
->get_state_changed_from_saved() ||
1444 m_xBreakTypeLB
->get_value_changed_from_saved() ||
1445 m_xBreakPositionLB
->get_value_changed_from_saved() )
1447 const SvxFormatBreakItem
rOldBreak(
1448 static_cast<const SvxFormatBreakItem
&>(GetItemSet().Get( _nWhich
)));
1449 SvxFormatBreakItem
aBreak(rOldBreak
.GetBreak(), rOldBreak
.Which());
1455 bool bBefore
= m_xBreakPositionLB
->get_active() == 0;
1457 if (m_xBreakTypeLB
->get_active() == 0)
1460 aBreak
.SetValue( SvxBreak::PageBefore
);
1462 aBreak
.SetValue( SvxBreak::PageAfter
);
1467 aBreak
.SetValue( SvxBreak::ColumnBefore
);
1469 aBreak
.SetValue( SvxBreak::ColumnAfter
);
1474 case TRISTATE_FALSE
:
1475 aBreak
.SetValue( SvxBreak::NONE
);
1477 default: ; //prevent warning
1479 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_PAGEBREAK
);
1481 if ( eState
!= m_xPageBreakBox
->get_saved_state() ||
1482 !pOld
|| !( *static_cast<const SvxFormatBreakItem
*>(pOld
) == aBreak
) )
1485 rOutSet
->Put( aBreak
);
1491 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1492 eState
= m_xKeepTogetherBox
->get_state();
1494 if (m_xKeepTogetherBox
->get_state_changed_from_saved())
1496 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_SPLIT
);
1498 if ( !pOld
|| static_cast<const SvxFormatSplitItem
*>(pOld
)->GetValue() !=
1499 ( eState
== TRISTATE_FALSE
) )
1501 rOutSet
->Put( SvxFormatSplitItem( eState
== TRISTATE_FALSE
, _nWhich
) );
1507 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1508 eState
= m_xKeepParaBox
->get_state();
1510 if (m_xKeepParaBox
->get_state_changed_from_saved())
1512 // if the status has changed, putting is necessary
1513 rOutSet
->Put( SvxFormatKeepItem( eState
== TRISTATE_TRUE
, _nWhich
) );
1517 // widows and orphans
1518 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1519 eState
= m_xWidowBox
->get_state();
1521 if ( m_xWidowBox
->get_state_changed_from_saved() ||
1522 m_xWidowRowNo
->get_value_changed_from_saved() )
1524 SvxWidowsItem
rItem( eState
== TRISTATE_TRUE
?
1525 static_cast<sal_uInt8
>(m_xWidowRowNo
->get_value()) : 0, _nWhich
);
1526 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_WIDOWS
);
1528 if ( m_xWidowBox
->get_state_changed_from_saved() || !pOld
|| !( *static_cast<const SvxWidowsItem
*>(pOld
) == rItem
) )
1530 rOutSet
->Put( rItem
);
1535 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1536 eState
= m_xOrphanBox
->get_state();
1538 if ( m_xOrphanBox
->get_state_changed_from_saved() ||
1539 m_xOrphanRowNo
->get_value_changed_from_saved() )
1541 SvxOrphansItem
rItem( eState
== TRISTATE_TRUE
?
1542 static_cast<sal_uInt8
>(m_xOrphanRowNo
->get_value()) : 0, _nWhich
);
1543 pOld
= GetOldItem( *rOutSet
, SID_ATTR_PARA_ORPHANS
);
1545 if ( m_xOrphanBox
->get_state_changed_from_saved() ||
1547 !( *static_cast<const SvxOrphansItem
*>(pOld
) == rItem
) )
1549 rOutSet
->Put( rItem
);
1556 void SvxExtParagraphTabPage::Reset( const SfxItemSet
* rSet
)
1558 sal_uInt16 _nWhich
= GetWhich( SID_ATTR_PARA_HYPHENZONE
);
1559 SfxItemState eItemState
= rSet
->GetItemState( _nWhich
);
1561 bool bItemAvailable
= eItemState
>= SfxItemState::DEFAULT
;
1562 bool bIsHyphen
= false;
1563 if( !bHtmlMode
&& bItemAvailable
)
1565 const SvxHyphenZoneItem
& rHyphen
=
1566 static_cast<const SvxHyphenZoneItem
&>(rSet
->Get( _nWhich
));
1567 aHyphenState
.bTriStateEnabled
= false;
1569 bIsHyphen
= rHyphen
.IsHyphen();
1570 m_xHyphenBox
->set_state(bIsHyphen
? TRISTATE_TRUE
: TRISTATE_FALSE
);
1571 m_xHyphenNoCapsBox
->set_state(rHyphen
.IsNoCapsHyphenation() ? TRISTATE_TRUE
: TRISTATE_FALSE
);
1573 m_xExtHyphenBeforeBox
->set_value(rHyphen
.GetMinLead());
1574 m_xExtHyphenAfterBox
->set_value(rHyphen
.GetMinTrail());
1575 m_xMaxHyphenEdit
->set_value(rHyphen
.GetMaxHyphens());
1579 m_xHyphenBox
->set_state(TRISTATE_INDET
);
1580 m_xHyphenNoCapsBox
->set_state(TRISTATE_INDET
);
1582 bool bEnable
= bItemAvailable
&& bIsHyphen
;
1583 m_xHyphenNoCapsBox
->set_sensitive(bEnable
);
1584 m_xExtHyphenBeforeBox
->set_sensitive(bEnable
);
1585 m_xExtHyphenAfterBox
->set_sensitive(bEnable
);
1586 m_xBeforeText
->set_sensitive(bEnable
);
1587 m_xAfterText
->set_sensitive(bEnable
);
1588 m_xMaxHyphenLabel
->set_sensitive(bEnable
);
1589 m_xMaxHyphenEdit
->set_sensitive(bEnable
);
1591 _nWhich
= GetWhich( SID_ATTR_PARA_PAGENUM
);
1593 switch (rSet
->GetItemState(_nWhich
))
1595 case SfxItemState::SET
:
1597 aPageNumState
.bTriStateEnabled
= false;
1598 m_xPageNumBox
->set_state(TRISTATE_TRUE
);
1599 SfxUInt16Item
const*const pItem(rSet
->GetItem
<SfxUInt16Item
>(_nWhich
));
1600 const sal_uInt16
nPageNum(pItem
->GetValue());
1601 m_xPagenumEdit
->set_value(nPageNum
);
1604 case SfxItemState::DONTCARE
:
1606 aPageNumState
.bTriStateEnabled
= true;
1607 m_xPageNumBox
->set_state(TRISTATE_INDET
);
1610 case SfxItemState::UNKNOWN
:
1611 case SfxItemState::DEFAULT
:
1612 case SfxItemState::DISABLED
:
1614 aPageNumState
.bTriStateEnabled
= false;
1615 m_xPageNumBox
->set_state(TRISTATE_FALSE
);
1619 assert(false); // unexpected
1625 // first handle PageModel
1626 _nWhich
= GetWhich( SID_ATTR_PARA_MODEL
);
1627 bool bIsPageModel
= false;
1628 eItemState
= rSet
->GetItemState( _nWhich
);
1630 if ( eItemState
>= SfxItemState::SET
)
1632 aApplyCollState
.bTriStateEnabled
= false;
1634 const SvxPageModelItem
& rModel
=
1635 static_cast<const SvxPageModelItem
&>(rSet
->Get( _nWhich
));
1636 const OUString
& aStr( rModel
.GetValue() );
1638 if (!aStr
.isEmpty() && m_xApplyCollBox
->find_text(aStr
) != -1)
1640 m_xApplyCollBox
->set_active_text(aStr
);
1641 m_xApplyCollBtn
->set_state(TRISTATE_TRUE
);
1642 bIsPageModel
= true;
1644 m_xPageBreakBox
->set_sensitive(true);
1645 aPageBreakState
.bTriStateEnabled
= false;
1646 m_xBreakTypeFT
->set_sensitive(true);
1647 m_xBreakTypeLB
->set_sensitive(true);
1648 m_xBreakPositionFT
->set_sensitive(true);
1649 m_xBreakPositionLB
->set_sensitive(true);
1650 m_xApplyCollBtn
->set_sensitive(false);
1651 m_xPageBreakBox
->set_state(TRISTATE_TRUE
);
1654 m_xBreakTypeLB
->set_active(0);
1655 //select break before
1656 m_xBreakPositionLB
->set_active(0);
1660 m_xApplyCollBox
->set_active(-1);
1661 m_xApplyCollBtn
->set_state(TRISTATE_FALSE
);
1664 else if ( SfxItemState::DONTCARE
== eItemState
)
1666 aApplyCollState
.bTriStateEnabled
= true;
1667 m_xApplyCollBtn
->set_state(TRISTATE_INDET
);
1668 m_xApplyCollBox
->set_active(-1);
1672 m_xApplyCollBtn
->set_sensitive(false);
1673 m_xApplyCollBox
->set_sensitive(false);
1674 m_xPagenumEdit
->set_sensitive(false);
1675 m_xPageNumBox
->set_sensitive(false);
1678 if ( !bIsPageModel
)
1680 _nWhich
= GetWhich( SID_ATTR_PARA_PAGEBREAK
);
1681 eItemState
= rSet
->GetItemState( _nWhich
);
1683 if ( eItemState
>= SfxItemState::DEFAULT
)
1685 const SvxFormatBreakItem
& rPageBreak
=
1686 static_cast<const SvxFormatBreakItem
&>(rSet
->Get( _nWhich
));
1688 SvxBreak eBreak
= rPageBreak
.GetBreak();
1690 // PageBreak not via CTRL-RETURN,
1691 // then CheckBox can be freed
1692 m_xPageBreakBox
->set_sensitive(true);
1693 aPageBreakState
.bTriStateEnabled
= false;
1694 m_xBreakTypeFT
->set_sensitive(true);
1695 m_xBreakTypeLB
->set_sensitive(true);
1696 m_xBreakPositionFT
->set_sensitive(true);
1697 m_xBreakPositionLB
->set_sensitive(true);
1699 m_xPageBreakBox
->set_state(TRISTATE_TRUE
);
1701 bool _bEnable
= eBreak
!= SvxBreak::NONE
&&
1702 eBreak
!= SvxBreak::ColumnBefore
&&
1703 eBreak
!= SvxBreak::ColumnAfter
;
1704 m_xApplyCollBtn
->set_sensitive(_bEnable
);
1707 m_xApplyCollBox
->set_sensitive(_bEnable
);
1708 m_xPageNumBox
->set_sensitive(false);
1709 m_xPagenumEdit
->set_sensitive(_bEnable
);
1712 if ( eBreak
== SvxBreak::NONE
)
1713 m_xPageBreakBox
->set_state(TRISTATE_FALSE
);
1715 sal_Int32 nType
= 0; // selection position in break type ListBox : Page
1716 sal_Int32 nPosition
= 0; // selection position in break position ListBox : Before
1719 case SvxBreak::PageBefore
:
1721 case SvxBreak::PageAfter
:
1724 case SvxBreak::ColumnBefore
:
1727 case SvxBreak::ColumnAfter
:
1731 default: ;//prevent warning
1733 m_xBreakTypeLB
->set_active(nType
);
1734 m_xBreakPositionLB
->set_active(nPosition
);
1736 else if ( SfxItemState::DONTCARE
== eItemState
)
1737 m_xPageBreakBox
->set_state(TRISTATE_INDET
);
1740 m_xPageBreakBox
->set_sensitive(false);
1741 m_xBreakTypeFT
->set_sensitive(false);
1742 m_xBreakTypeLB
->set_sensitive(false);
1743 m_xBreakPositionFT
->set_sensitive(false);
1744 m_xBreakPositionLB
->set_sensitive(false);
1748 PageBreakPosHdl_Impl(*m_xBreakPositionLB
);
1752 _nWhich
= GetWhich( SID_ATTR_PARA_KEEP
);
1753 eItemState
= rSet
->GetItemState( _nWhich
);
1755 if ( eItemState
>= SfxItemState::DEFAULT
)
1757 aKeepParaState
.bTriStateEnabled
= false;
1758 const SvxFormatKeepItem
& rKeep
=
1759 static_cast<const SvxFormatKeepItem
&>(rSet
->Get( _nWhich
));
1761 if ( rKeep
.GetValue() )
1762 m_xKeepParaBox
->set_state(TRISTATE_TRUE
);
1764 m_xKeepParaBox
->set_state(TRISTATE_FALSE
);
1766 else if ( SfxItemState::DONTCARE
== eItemState
)
1767 m_xKeepParaBox
->set_state(TRISTATE_INDET
);
1769 m_xKeepParaBox
->set_sensitive(false);
1771 _nWhich
= GetWhich( SID_ATTR_PARA_SPLIT
);
1772 eItemState
= rSet
->GetItemState( _nWhich
);
1774 if ( eItemState
>= SfxItemState::DEFAULT
)
1776 const SvxFormatSplitItem
& rSplit
=
1777 static_cast<const SvxFormatSplitItem
&>(rSet
->Get( _nWhich
));
1778 aKeepTogetherState
.bTriStateEnabled
= false;
1780 if ( !rSplit
.GetValue() )
1781 m_xKeepTogetherBox
->set_state(TRISTATE_TRUE
);
1784 m_xKeepTogetherBox
->set_state(TRISTATE_FALSE
);
1786 // widows and orphans
1787 m_xWidowBox
->set_sensitive(true);
1788 _nWhich
= GetWhich( SID_ATTR_PARA_WIDOWS
);
1789 SfxItemState eTmpState
= rSet
->GetItemState( _nWhich
);
1791 if ( eTmpState
>= SfxItemState::DEFAULT
)
1793 const SvxWidowsItem
& rWidow
=
1794 static_cast<const SvxWidowsItem
&>(rSet
->Get( _nWhich
));
1795 aWidowState
.bTriStateEnabled
= false;
1796 const sal_uInt16 nLines
= rWidow
.GetValue();
1798 bool _bEnable
= nLines
> 0;
1799 m_xWidowRowNo
->set_value(m_xWidowRowNo
->normalize(nLines
));
1800 m_xWidowBox
->set_state(_bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
);
1801 m_xWidowRowNo
->set_sensitive(_bEnable
);
1802 //m_xWidowRowLabel->set_sensitive(_bEnable);
1805 else if ( SfxItemState::DONTCARE
== eTmpState
)
1806 m_xWidowBox
->set_state( TRISTATE_INDET
);
1808 m_xWidowBox
->set_sensitive(false);
1810 m_xOrphanBox
->set_sensitive(true);
1811 _nWhich
= GetWhich( SID_ATTR_PARA_ORPHANS
);
1812 eTmpState
= rSet
->GetItemState( _nWhich
);
1814 if ( eTmpState
>= SfxItemState::DEFAULT
)
1816 const SvxOrphansItem
& rOrphan
=
1817 static_cast<const SvxOrphansItem
&>(rSet
->Get( _nWhich
));
1818 const sal_uInt16 nLines
= rOrphan
.GetValue();
1819 aOrphanState
.bTriStateEnabled
= false;
1821 bool _bEnable
= nLines
> 0;
1822 m_xOrphanBox
->set_state(_bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
);
1823 m_xOrphanRowNo
->set_value(m_xOrphanRowNo
->normalize(nLines
));
1824 m_xOrphanRowNo
->set_sensitive(_bEnable
);
1825 m_xOrphanRowLabel
->set_sensitive(_bEnable
);
1828 else if ( SfxItemState::DONTCARE
== eTmpState
)
1829 m_xOrphanBox
->set_state(TRISTATE_INDET
);
1831 m_xOrphanBox
->set_sensitive(false);
1832 aOrphanState
.eState
= m_xOrphanBox
->get_state();
1835 else if ( SfxItemState::DONTCARE
== eItemState
)
1836 m_xKeepTogetherBox
->set_state(TRISTATE_INDET
);
1838 m_xKeepTogetherBox
->set_sensitive(false);
1840 // so that everything is enabled correctly
1846 void SvxExtParagraphTabPage::ChangesApplied()
1848 m_xHyphenBox
->save_state();
1849 m_xHyphenNoCapsBox
->save_state();
1850 m_xExtHyphenBeforeBox
->set_value(m_xExtHyphenBeforeBox
->get_value());
1851 m_xExtHyphenAfterBox
->set_value(m_xExtHyphenAfterBox
->get_value());
1852 m_xMaxHyphenEdit
->set_value(m_xMaxHyphenEdit
->get_value());
1853 m_xPageBreakBox
->save_state();
1854 m_xBreakPositionLB
->save_value();
1855 m_xBreakTypeLB
->save_value();
1856 m_xApplyCollBtn
->save_state();
1857 m_xApplyCollBox
->save_value();
1858 m_xPageNumBox
->save_state();
1859 m_xPagenumEdit
->save_value();
1860 m_xKeepTogetherBox
->save_state();
1861 m_xKeepParaBox
->save_state();
1862 m_xWidowBox
->save_state();
1863 m_xOrphanBox
->save_state();
1864 m_xOrphanRowNo
->save_value();
1865 m_xWidowRowNo
->save_value();
1868 DeactivateRC
SvxExtParagraphTabPage::DeactivatePage( SfxItemSet
* _pSet
)
1871 FillItemSet( _pSet
);
1872 return DeactivateRC::LeavePage
;
1875 void SvxExtParagraphTabPage::DisablePageBreak()
1878 m_xPageBreakBox
->set_sensitive(false);
1879 m_xBreakTypeLB
->remove(0);
1880 m_xBreakPositionFT
->set_sensitive(false);
1881 m_xBreakPositionLB
->set_sensitive(false);
1882 m_xApplyCollBtn
->set_sensitive(false);
1883 m_xApplyCollBox
->set_sensitive(false);
1884 m_xPageNumBox
->set_sensitive(false);
1885 m_xPagenumEdit
->set_sensitive(false);
1888 SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttr
)
1889 : SfxTabPage(pPage
, pController
, "cui/ui/textflowpage.ui", "TextFlowPage", &rAttr
)
1894 , m_xHyphenBox(m_xBuilder
->weld_check_button("checkAuto"))
1895 , m_xHyphenNoCapsBox(m_xBuilder
->weld_check_button("checkNoCaps"))
1896 , m_xBeforeText(m_xBuilder
->weld_label("labelLineBegin"))
1897 , m_xExtHyphenBeforeBox(m_xBuilder
->weld_spin_button("spinLineEnd"))
1898 , m_xAfterText(m_xBuilder
->weld_label("labelLineEnd"))
1899 , m_xExtHyphenAfterBox(m_xBuilder
->weld_spin_button("spinLineBegin"))
1900 , m_xMaxHyphenLabel(m_xBuilder
->weld_label("labelMaxNum"))
1901 , m_xMaxHyphenEdit(m_xBuilder
->weld_spin_button("spinMaxNum"))
1903 , m_xPageBreakBox(m_xBuilder
->weld_check_button("checkInsert"))
1904 , m_xBreakTypeFT(m_xBuilder
->weld_label("labelType"))
1905 , m_xBreakTypeLB(m_xBuilder
->weld_combo_box("comboBreakType"))
1906 , m_xBreakPositionFT(m_xBuilder
->weld_label("labelPosition"))
1907 , m_xBreakPositionLB(m_xBuilder
->weld_combo_box("comboBreakPosition"))
1908 , m_xApplyCollBtn(m_xBuilder
->weld_check_button("checkPageStyle"))
1909 , m_xApplyCollBox(m_xBuilder
->weld_combo_box("comboPageStyle"))
1910 , m_xPageNumBox(m_xBuilder
->weld_check_button("labelPageNum"))
1911 , m_xPagenumEdit(m_xBuilder
->weld_spin_button("spinPageNumber"))
1913 , m_xKeepTogetherBox(m_xBuilder
->weld_check_button("checkSplitPara"))
1914 , m_xKeepParaBox(m_xBuilder
->weld_check_button("checkKeepPara"))
1915 , m_xOrphanBox(m_xBuilder
->weld_check_button("checkOrphan"))
1916 , m_xOrphanRowNo(m_xBuilder
->weld_spin_button("spinOrphan"))
1917 , m_xOrphanRowLabel(m_xBuilder
->weld_label("labelOrphan"))
1918 , m_xWidowBox(m_xBuilder
->weld_check_button("checkWidow"))
1919 , m_xWidowRowNo(m_xBuilder
->weld_spin_button("spinWidow"))
1920 , m_xWidowRowLabel(m_xBuilder
->weld_label("labelWidow"))
1922 // this page needs ExchangeSupport
1923 SetExchangeSupport();
1925 m_xHyphenBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, HyphenClickHdl_Impl
));
1926 m_xPageBreakBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, PageBreakHdl_Impl
));
1927 m_xKeepTogetherBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
));
1928 m_xWidowBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, WidowHdl_Impl
));
1929 m_xOrphanBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, OrphanHdl_Impl
));
1930 m_xApplyCollBtn
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
));
1931 m_xBreakTypeLB
->connect_changed(LINK(this, SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
));
1932 m_xBreakPositionLB
->connect_changed(LINK(this, SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
));
1933 m_xPageNumBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, PageNumBoxClickHdl_Impl
));
1934 m_xKeepParaBox
->connect_toggled(LINK(this, SvxExtParagraphTabPage
, KeepParaBoxClickHdl_Impl
));
1936 SfxObjectShell
* pSh
= SfxObjectShell::Current();
1939 SfxStyleSheetBasePool
* pPool
= pSh
->GetStyleSheetPool();
1940 SfxStyleSheetBase
* pStyle
= pPool
->First(SfxStyleFamily::Page
);
1943 // tdf139131 - sort page styles
1944 m_xApplyCollBox
->make_sorted();
1947 if ( aStdName
.isEmpty() )
1948 // first style == standard style
1949 aStdName
= pStyle
->GetName();
1950 m_xApplyCollBox
->append_text(pStyle
->GetName());
1951 pStyle
= pPool
->Next();
1953 nStdPos
= m_xApplyCollBox
->find_text(aStdName
);
1956 sal_uInt16 nHtmlMode
= GetHtmlMode_Impl( rAttr
);
1957 if ( !(nHtmlMode
& HTMLMODE_ON
) )
1961 m_xHyphenBox
->set_sensitive(false);
1962 m_xHyphenNoCapsBox
->set_sensitive(false);
1963 m_xBeforeText
->set_sensitive(false);
1964 m_xExtHyphenBeforeBox
->set_sensitive(false);
1965 m_xAfterText
->set_sensitive(false);
1966 m_xExtHyphenAfterBox
->set_sensitive(false);
1967 m_xMaxHyphenLabel
->set_sensitive(false);
1968 m_xMaxHyphenEdit
->set_sensitive(false);
1969 m_xPageNumBox
->set_sensitive(false);
1970 m_xPagenumEdit
->set_sensitive(false);
1971 // no column break in HTML
1972 m_xBreakTypeLB
->remove(1);
1975 SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
1979 void SvxExtParagraphTabPage::PageBreakHdl()
1981 switch (m_xPageBreakBox
->get_state())
1984 m_xBreakTypeFT
->set_sensitive(true);
1985 m_xBreakTypeLB
->set_sensitive(true);
1986 m_xBreakPositionFT
->set_sensitive(true);
1987 m_xBreakPositionLB
->set_sensitive(true);
1989 if (0 == m_xBreakTypeLB
->get_active() && 0 == m_xBreakPositionLB
->get_active())
1991 m_xApplyCollBtn
->set_sensitive(true);
1993 bool bEnable
= TRISTATE_TRUE
== m_xApplyCollBtn
->get_state() &&
1994 m_xApplyCollBox
->get_count();
1995 m_xApplyCollBox
->set_sensitive(bEnable
);
1998 m_xPageNumBox
->set_sensitive(bEnable
);
1999 m_xPagenumEdit
->set_sensitive(bEnable
&& m_xPageNumBox
->get_state() == TRISTATE_TRUE
);
2004 case TRISTATE_FALSE
:
2005 case TRISTATE_INDET
:
2006 m_xApplyCollBtn
->set_state(TRISTATE_FALSE
);
2007 m_xApplyCollBtn
->set_sensitive(false);
2008 m_xApplyCollBox
->set_sensitive(false);
2009 m_xPageNumBox
->set_sensitive(false);
2010 m_xPagenumEdit
->set_sensitive(false);
2011 m_xBreakTypeFT
->set_sensitive(false);
2012 m_xBreakTypeLB
->set_sensitive(false);
2013 m_xBreakPositionFT
->set_sensitive(false);
2014 m_xBreakPositionLB
->set_sensitive(false);
2019 IMPL_LINK(SvxExtParagraphTabPage
, PageBreakHdl_Impl
, weld::Toggleable
&, rToggle
, void)
2021 aPageBreakState
.ButtonToggled(rToggle
);
2025 void SvxExtParagraphTabPage::KeepTogetherHdl()
2027 bool bEnable
= m_xKeepTogetherBox
->get_state() == TRISTATE_FALSE
;
2028 m_xWidowBox
->set_sensitive(bEnable
);
2029 m_xOrphanBox
->set_sensitive(bEnable
);
2032 IMPL_LINK(SvxExtParagraphTabPage
, KeepTogetherHdl_Impl
, weld::Toggleable
&, rToggle
, void)
2034 aKeepTogetherState
.ButtonToggled(rToggle
);
2038 void SvxExtParagraphTabPage::WidowHdl()
2040 switch (m_xWidowBox
->get_state())
2043 m_xWidowRowNo
->set_sensitive(true);
2044 m_xWidowRowLabel
->set_sensitive(true);
2045 m_xKeepTogetherBox
->set_sensitive(false);
2047 case TRISTATE_FALSE
:
2048 if (m_xOrphanBox
->get_state() == TRISTATE_FALSE
)
2049 m_xKeepTogetherBox
->set_sensitive(true);
2051 case TRISTATE_INDET
:
2052 m_xWidowRowNo
->set_sensitive(false);
2053 m_xWidowRowLabel
->set_sensitive(false);
2058 IMPL_LINK(SvxExtParagraphTabPage
, WidowHdl_Impl
, weld::Toggleable
&, rToggle
, void)
2060 aWidowState
.ButtonToggled(rToggle
);
2064 IMPL_LINK(SvxExtParagraphTabPage
, OrphanHdl_Impl
, weld::Toggleable
&, rToggle
, void)
2066 aOrphanState
.ButtonToggled(rToggle
);
2070 void SvxExtParagraphTabPage::OrphanHdl()
2072 switch (m_xOrphanBox
->get_state())
2075 m_xOrphanRowNo
->set_sensitive(true);
2076 m_xOrphanRowLabel
->set_sensitive(true);
2077 m_xKeepTogetherBox
->set_sensitive(false);
2080 case TRISTATE_FALSE
:
2081 if (m_xWidowBox
->get_state() == TRISTATE_FALSE
)
2082 m_xKeepTogetherBox
->set_sensitive(true);
2084 case TRISTATE_INDET
:
2085 m_xOrphanRowNo
->set_sensitive(false);
2086 m_xOrphanRowLabel
->set_sensitive(false);
2091 void SvxExtParagraphTabPage::HyphenClickHdl()
2093 bool bEnable
= m_xHyphenBox
->get_state() == TRISTATE_TRUE
;
2094 m_xHyphenNoCapsBox
->set_sensitive(bEnable
);
2095 m_xBeforeText
->set_sensitive(bEnable
);
2096 m_xExtHyphenBeforeBox
->set_sensitive(bEnable
);
2097 m_xAfterText
->set_sensitive(bEnable
);
2098 m_xExtHyphenAfterBox
->set_sensitive(bEnable
);
2099 m_xMaxHyphenLabel
->set_sensitive(bEnable
);
2100 m_xMaxHyphenEdit
->set_sensitive(bEnable
);
2101 m_xHyphenBox
->set_state(bEnable
? TRISTATE_TRUE
: TRISTATE_FALSE
);
2104 IMPL_LINK(SvxExtParagraphTabPage
, HyphenClickHdl_Impl
, weld::Toggleable
&, rToggle
, void)
2106 aHyphenState
.ButtonToggled(rToggle
);
2110 void SvxExtParagraphTabPage::ApplyCollClickHdl()
2112 bool bEnable
= false;
2113 if (m_xApplyCollBtn
->get_state() == TRISTATE_TRUE
&& m_xApplyCollBox
->get_count())
2116 m_xApplyCollBox
->set_active(nStdPos
);
2120 m_xApplyCollBox
->set_active(-1);
2122 m_xApplyCollBox
->set_sensitive(bEnable
);
2125 m_xPageNumBox
->set_sensitive(bEnable
);
2126 m_xPagenumEdit
->set_sensitive(bEnable
&& m_xPageNumBox
->get_state() == TRISTATE_TRUE
);
2130 IMPL_LINK(SvxExtParagraphTabPage
, ApplyCollClickHdl_Impl
, weld::Toggleable
&, rToggle
, void)
2132 aApplyCollState
.ButtonToggled(rToggle
);
2133 ApplyCollClickHdl();
2136 IMPL_LINK(SvxExtParagraphTabPage
, PageBreakPosHdl_Impl
, weld::ComboBox
&, rListBox
, void)
2138 if (0 == rListBox
.get_active())
2140 m_xApplyCollBtn
->set_sensitive(true);
2142 bool bEnable
= m_xApplyCollBtn
->get_state() == TRISTATE_TRUE
&& m_xApplyCollBox
->get_count();
2144 m_xApplyCollBox
->set_sensitive(bEnable
);
2147 m_xPageNumBox
->set_sensitive(bEnable
);
2148 m_xPagenumEdit
->set_sensitive(bEnable
&& m_xPageNumBox
->get_state() == TRISTATE_TRUE
);
2151 else if (1 == rListBox
.get_active())
2153 m_xApplyCollBtn
->set_state(TRISTATE_FALSE
);
2154 m_xApplyCollBtn
->set_sensitive(false);
2155 m_xApplyCollBox
->set_sensitive(false);
2156 m_xPageNumBox
->set_sensitive(false);
2157 m_xPagenumEdit
->set_sensitive(false);
2161 IMPL_LINK(SvxExtParagraphTabPage
, PageBreakTypeHdl_Impl
, weld::ComboBox
&, rListBox
, void)
2163 //column break or break after
2164 int nBreakPos
= m_xBreakPositionLB
->get_active();
2165 if (rListBox
.get_active() == 1 || 1 == nBreakPos
)
2167 m_xApplyCollBtn
->set_state(TRISTATE_FALSE
);
2168 m_xApplyCollBtn
->set_sensitive(false);
2169 m_xApplyCollBox
->set_sensitive(false);
2170 m_xPageNumBox
->set_sensitive(false);
2171 m_xPagenumEdit
->set_sensitive(false);
2174 PageBreakPosHdl_Impl(*m_xBreakPositionLB
);
2177 void SvxExtParagraphTabPage::PageNumBoxClickHdl()
2179 m_xPagenumEdit
->set_sensitive(m_xPageNumBox
->get_state() == TRISTATE_TRUE
);
2182 IMPL_LINK(SvxExtParagraphTabPage
, PageNumBoxClickHdl_Impl
, weld::Toggleable
&, rToggle
, void)
2184 aPageNumState
.ButtonToggled(rToggle
);
2185 PageNumBoxClickHdl();
2188 IMPL_LINK(SvxExtParagraphTabPage
, KeepParaBoxClickHdl_Impl
, weld::Toggleable
&, rToggle
, void)
2190 aKeepParaState
.ButtonToggled(rToggle
);
2193 void SvxExtParagraphTabPage::PageCreated(const SfxAllItemSet
& aSet
)
2195 const SfxBoolItem
* pDisablePageBreakItem
= aSet
.GetItem
<SfxBoolItem
>(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK
, false);
2197 if (pDisablePageBreakItem
)
2198 if ( pDisablePageBreakItem
->GetValue())
2202 SvxAsianTabPage::SvxAsianTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
)
2203 : SfxTabPage(pPage
, pController
, "cui/ui/asiantypography.ui", "AsianTypography", &rSet
)
2204 , m_xForbiddenRulesCB(m_xBuilder
->weld_check_button("checkForbidList"))
2205 , m_xHangingPunctCB(m_xBuilder
->weld_check_button("checkHangPunct"))
2206 , m_xScriptSpaceCB(m_xBuilder
->weld_check_button("checkApplySpacing"))
2210 SvxAsianTabPage::~SvxAsianTabPage()
2214 std::unique_ptr
<SfxTabPage
> SvxAsianTabPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
)
2216 return std::make_unique
<SvxAsianTabPage
>(pPage
, pController
, *rSet
);
2219 WhichRangesContainer
SvxAsianTabPage::GetRanges()
2221 return WhichRangesContainer(svl::Items
<SID_ATTR_PARA_SCRIPTSPACE
, SID_ATTR_PARA_FORBIDDEN_RULES
>);
2224 bool SvxAsianTabPage::FillItemSet( SfxItemSet
* rSet
)
2227 SfxItemPool
* pPool
= rSet
->GetPool();
2228 if (m_xScriptSpaceCB
->get_sensitive() && m_xScriptSpaceCB
->get_state_changed_from_saved())
2230 std::unique_ptr
<SfxBoolItem
> pNewItem(static_cast<SfxBoolItem
*>(rSet
->Get(
2231 pPool
->GetWhich(SID_ATTR_PARA_SCRIPTSPACE
)).Clone()));
2232 pNewItem
->SetValue(m_xScriptSpaceCB
->get_active());
2233 rSet
->Put(std::move(pNewItem
));
2236 if (m_xHangingPunctCB
->get_sensitive() && m_xHangingPunctCB
->get_state_changed_from_saved())
2238 std::unique_ptr
<SfxBoolItem
> pNewItem(static_cast<SfxBoolItem
*>(rSet
->Get(
2239 pPool
->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION
)).Clone()));
2240 pNewItem
->SetValue(m_xHangingPunctCB
->get_active());
2241 rSet
->Put(std::move(pNewItem
));
2244 if (m_xForbiddenRulesCB
->get_sensitive() && m_xForbiddenRulesCB
->get_state_changed_from_saved())
2246 std::unique_ptr
<SfxBoolItem
> pNewItem(static_cast<SfxBoolItem
*>(rSet
->Get(
2247 pPool
->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES
)).Clone()));
2248 pNewItem
->SetValue(m_xForbiddenRulesCB
->get_active());
2249 rSet
->Put(std::move(pNewItem
));
2255 static void lcl_SetBox(const SfxItemSet
& rSet
, sal_uInt16 nSlotId
, weld::CheckButton
& rBox
)
2257 sal_uInt16 _nWhich
= rSet
.GetPool()->GetWhich(nSlotId
);
2258 SfxItemState eState
= rSet
.GetItemState(_nWhich
);
2259 if( eState
== SfxItemState::UNKNOWN
|| eState
== SfxItemState::DISABLED
)
2260 rBox
.set_sensitive(false);
2261 else if(eState
>= SfxItemState::DEFAULT
)
2262 rBox
.set_active(static_cast<const SfxBoolItem
&>(rSet
.Get(_nWhich
)).GetValue());
2264 rBox
.set_state(TRISTATE_INDET
);
2268 void SvxAsianTabPage::Reset( const SfxItemSet
* rSet
)
2270 lcl_SetBox(*rSet
, SID_ATTR_PARA_FORBIDDEN_RULES
, *m_xForbiddenRulesCB
);
2271 lcl_SetBox(*rSet
, SID_ATTR_PARA_HANGPUNCTUATION
, *m_xHangingPunctCB
);
2273 //character distance not yet available
2274 lcl_SetBox(*rSet
, SID_ATTR_PARA_SCRIPTSPACE
, *m_xScriptSpaceCB
);
2277 void SvxAsianTabPage::ChangesApplied()
2279 m_xForbiddenRulesCB
->save_state();
2280 m_xHangingPunctCB
->save_state();
2281 m_xScriptSpaceCB
->save_state();
2284 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */