LibreOffice Module cui (master)  1
paragrph.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <memory>
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>
28 
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>
44 #include <editeng/ulspitem.hxx>
45 #include <editeng/lrspitem.hxx>
47 #include <editeng/keepitem.hxx>
48 #include <svx/dlgutil.hxx>
49 #include <sfx2/htmlmode.hxx>
51 #include <svl/eitem.hxx>
52 #include <svl/intitem.hxx>
53 
54 #include <sfx2/viewfrm.hxx>
55 
56 const sal_uInt16 SvxStdParagraphTabPage::pStdRanges[] =
57 {
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,
64  0
65 };
66 
67 const sal_uInt16 SvxParaAlignTabPage::pAlignRanges[] =
68 {
69  SID_ATTR_PARA_ADJUST, // 10027
70  SID_ATTR_PARA_ADJUST,
71  0
72 };
73 
74 const sal_uInt16 SvxExtParagraphTabPage::pExtRanges[] =
75 {
76  SID_ATTR_PARA_PAGEBREAK, // 10037 -
77  SID_ATTR_PARA_WIDOWS, // 10041
78  SID_ATTR_PARA_MODEL, // 10065 -
79  SID_ATTR_PARA_KEEP, // 10066
80  0
81 };
82 
83 #define MAX_DURCH 5670 // 10 cm makes sense as maximum interline lead
84  // according to BP
85 #define FIX_DIST_DEF 283 // standard fix distance 0,5 cm
86 
87 namespace {
88 
90 {
91  LLINESPACE_1 = 0,
92  LLINESPACE_115 = 1,
93  LLINESPACE_15 = 2,
94  LLINESPACE_2 = 3,
95  LLINESPACE_PROP = 4,
96  LLINESPACE_MIN = 5,
98  LLINESPACE_FIX = 7
99 };
100 
101 }
102 
103 static void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 );
104 
106  int eSpace, long lValue )
107 {
108  switch ( eSpace )
109  {
110  case LLINESPACE_1:
111  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
112  rLineSpace.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off );
113  break;
114 
115  case LLINESPACE_115:
116  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
117  rLineSpace.SetPropLineSpace( 115 );
118  break;
119 
120  case LLINESPACE_15:
121  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
122  rLineSpace.SetPropLineSpace( 150 );
123  break;
124 
125  case LLINESPACE_2:
126  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
127  rLineSpace.SetPropLineSpace( 200 );
128  break;
129 
130  case LLINESPACE_PROP:
131  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
132  rLineSpace.SetPropLineSpace( static_cast<sal_uInt16>(lValue) );
133  break;
134 
135  case LLINESPACE_MIN:
136  rLineSpace.SetLineHeight( static_cast<sal_uInt16>(lValue) );
137  rLineSpace.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off );
138  break;
139 
140  case LLINESPACE_DURCH:
141  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
142  rLineSpace.SetInterLineSpace( static_cast<sal_uInt16>(lValue) );
143  break;
144 
145  case LLINESPACE_FIX:
146  rLineSpace.SetLineHeight(static_cast<sal_uInt16>(lValue));
147  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Fix );
148  rLineSpace.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off );
149  break;
150  }
151 }
152 
153 static sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet)
154 {
155  sal_uInt16 nHtmlMode = 0;
156  const SfxPoolItem* pItem = nullptr;
157  SfxObjectShell* pShell;
158  if(SfxItemState::SET == rSet.GetItemState(SID_HTML_MODE, false, &pItem) ||
159  ( nullptr != (pShell = SfxObjectShell::Current()) &&
160  nullptr != (pItem = pShell->GetItem(SID_HTML_MODE))))
161  {
162  nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
163  }
164  return nHtmlMode;
165 
166 }
167 
169 {
170  SfxItemPool* pPool = GetItemSet().GetPool();
171  DBG_ASSERT( pPool, "Where is the pool?" );
172  FieldUnit eUnit =
173  MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
174 
175  sal_Int64 nL = m_xLeftIndent->denormalize(m_xLeftIndent->get_value(eUnit));
176  sal_Int64 nR = m_xRightIndent->denormalize(m_xRightIndent->get_value(eUnit));
177  OUString aTmp = m_xFLineIndent->get_text();
178 
179  if (m_xLeftIndent->get_min(FieldUnit::NONE) < 0)
180  m_xFLineIndent->set_min(-99999, FieldUnit::MM);
181  else
182  m_xFLineIndent->set_min(m_xFLineIndent->normalize(-nL), eUnit);
183 
184  // Check only for concrete width (Shell)
185  sal_Int64 nTmp = nWidth - nL - nR - MM50;
186  m_xFLineIndent->set_max(m_xFLineIndent->normalize(nTmp), eUnit);
187 
188  if (aTmp.isEmpty())
189  m_xFLineIndent->set_text(OUString());
190  // maximum left right
191  aTmp = m_xLeftIndent->get_text();
192  nTmp = nWidth - nR - MM50;
193  m_xLeftIndent->set_max(m_xLeftIndent->normalize(nTmp), eUnit);
194 
195  if ( aTmp.isEmpty() )
196  m_xLeftIndent->set_text(OUString());
197  aTmp = m_xRightIndent->get_text();
198  nTmp = nWidth - nL - MM50;
199  m_xRightIndent->set_max(m_xRightIndent->normalize(nTmp), eUnit);
200 
201  if ( aTmp.isEmpty() )
202  m_xRightIndent->set_text(OUString());
203 
205 }
206 
208 {
209  ELRLoseFocus();
210 }
211 
212 std::unique_ptr<SfxTabPage> SvxStdParagraphTabPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
213 {
214  return std::make_unique<SvxStdParagraphTabPage>(pPage, pController, *rSet);
215 }
216 
218 {
219  SfxItemState eState = SfxItemState::UNKNOWN;
220  const SfxPoolItem* pOld = nullptr;
221  SfxItemPool* pPool = rOutSet->GetPool();
222  DBG_ASSERT( pPool, "Where is the pool?" );
223 
224  bool bModified = false;
225  sal_uInt16 nWhich;
226  int nPos = m_xLineDist->get_active();
227 
228  if ( nPos != -1 &&
229  ( m_bLineDistToggled ||
230  m_xLineDist->get_value_changed_from_saved() ||
231  m_xLineDistAtPercentBox->get_value_changed_from_saved() ||
232  m_xLineDistAtMetricBox->get_value_changed_from_saved() ) )
233  {
234  nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
235  MapUnit eUnit = SfxViewFrame::Current()->GetPool().GetMetric( nWhich );
236  SvxLineSpacingItem aSpacing(
237  static_cast<const SvxLineSpacingItem&>(GetItemSet().Get( nWhich )) );
238 
239  switch ( nPos )
240  {
241  case LLINESPACE_1:
242  case LLINESPACE_115:
243  case LLINESPACE_15:
244  case LLINESPACE_2:
245  SetLineSpace_Impl( aSpacing, nPos );
246  break;
247 
248  case LLINESPACE_PROP:
249  SetLineSpace_Impl( aSpacing, nPos,
250  static_cast<long>(m_xLineDistAtPercentBox->denormalize(
251  m_xLineDistAtPercentBox->get_value(FieldUnit::NONE) )) );
252  break;
253 
254  case LLINESPACE_MIN:
255  case LLINESPACE_DURCH:
256  case LLINESPACE_FIX:
257  SetLineSpace_Impl( aSpacing, nPos,
259  break;
260 
261  default:
262  OSL_FAIL( "unknown LineDist entry" );
263  break;
264  }
265  eState = GetItemSet().GetItemState( nWhich );
266  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_LINESPACE );
267 
268  if ( m_bLineDistToggled ||
269  !pOld || !( *static_cast<const SvxLineSpacingItem*>(pOld) == aSpacing ) ||
270  SfxItemState::DONTCARE == eState )
271  {
272  rOutSet->Put( aSpacing );
273  bModified = true;
274  }
275  }
276 
277  if ( m_xTopDist->get_value_changed_from_saved() || m_xBottomDist->get_value_changed_from_saved()
278  || m_xContextualCB->get_state_changed_from_saved())
279  {
280  nWhich = GetWhich( SID_ATTR_ULSPACE );
281  MapUnit eUnit = pPool->GetMetric( nWhich );
282  pOld = GetOldItem( *rOutSet, SID_ATTR_ULSPACE );
283  SvxULSpaceItem aMargin( nWhich );
284 
285  if ( bRelativeMode )
286  {
287  DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
288 
289  const SvxULSpaceItem& rOldItem =
290  static_cast<const SvxULSpaceItem&>(GetItemSet().GetParent()->Get( nWhich ));
291 
292  if ( m_xTopDist->IsRelative() )
293  aMargin.SetUpper( rOldItem.GetUpper(),
294  static_cast<sal_uInt16>(m_xTopDist->get_value(FieldUnit::NONE)) );
295  else
296  aMargin.SetUpper( static_cast<sal_uInt16>(m_xTopDist->GetCoreValue(eUnit)) );
297 
298  if ( m_xBottomDist->IsRelative() )
299  aMargin.SetLower( rOldItem.GetLower(),
300  static_cast<sal_uInt16>(m_xBottomDist->get_value(FieldUnit::NONE)) );
301  else
302  aMargin.SetLower( static_cast<sal_uInt16>(m_xBottomDist->GetCoreValue(eUnit)) );
303 
304  }
305  else
306  {
307  aMargin.SetUpper(static_cast<sal_uInt16>(m_xTopDist->GetCoreValue(eUnit)));
308  aMargin.SetLower(static_cast<sal_uInt16>(m_xBottomDist->GetCoreValue(eUnit)));
309  }
310  aMargin.SetContextValue(m_xContextualCB->get_active());
311  eState = GetItemSet().GetItemState( nWhich );
312 
313  if ( !pOld || *static_cast<const SvxULSpaceItem*>(pOld) != aMargin ||
314  SfxItemState::DONTCARE == eState )
315  {
316  rOutSet->Put( aMargin );
317  bModified = true;
318  }
319  }
320  bool bNullTab = false;
321 
322  if ( m_xLeftIndent->get_value_changed_from_saved() ||
323  m_xFLineIndent->get_value_changed_from_saved() ||
324  m_xRightIndent->get_value_changed_from_saved() ||
325  m_xAutoCB->get_state_changed_from_saved() )
326  {
327  nWhich = GetWhich( SID_ATTR_LRSPACE );
328  MapUnit eUnit = pPool->GetMetric( nWhich );
329  SvxLRSpaceItem aMargin( nWhich );
330  pOld = GetOldItem( *rOutSet, SID_ATTR_LRSPACE );
331 
332  if ( bRelativeMode )
333  {
334  DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
335 
336  const SvxLRSpaceItem& rOldItem =
337  static_cast<const SvxLRSpaceItem&>(GetItemSet().GetParent()->Get( nWhich ));
338 
339  if (m_xLeftIndent->IsRelative())
340  aMargin.SetTextLeft( rOldItem.GetTextLeft(),
341  static_cast<sal_uInt16>(m_xLeftIndent->get_value(FieldUnit::NONE)) );
342  else
343  aMargin.SetTextLeft(m_xLeftIndent->GetCoreValue(eUnit));
344 
345  if ( m_xRightIndent->IsRelative() )
346  aMargin.SetRight( rOldItem.GetRight(),
347  static_cast<sal_uInt16>(m_xRightIndent->get_value(FieldUnit::NONE)) );
348  else
349  aMargin.SetRight(m_xRightIndent->GetCoreValue(eUnit));
350 
351  if ( m_xFLineIndent->IsRelative() )
352  aMargin.SetTextFirstLineOfst( rOldItem.GetTextFirstLineOfst(),
353  static_cast<sal_uInt16>(m_xFLineIndent->get_value(FieldUnit::NONE)) );
354  else
355  aMargin.SetTextFirstLineOfst(static_cast<sal_uInt16>(m_xFLineIndent->GetCoreValue(eUnit)));
356  }
357  else
358  {
359  aMargin.SetTextLeft(m_xLeftIndent->GetCoreValue(eUnit));
360  aMargin.SetRight(m_xRightIndent->GetCoreValue(eUnit));
361  aMargin.SetTextFirstLineOfst(static_cast<sal_uInt16>(m_xFLineIndent->GetCoreValue(eUnit)));
362  }
363  aMargin.SetAutoFirst(m_xAutoCB->get_active());
364  if ( aMargin.GetTextFirstLineOfst() < 0 )
365  bNullTab = true;
366  eState = GetItemSet().GetItemState( nWhich );
367 
368  if ( !pOld || *static_cast<const SvxLRSpaceItem*>(pOld) != aMargin ||
369  SfxItemState::DONTCARE == eState )
370  {
371  rOutSet->Put( aMargin );
372  bModified = true;
373  }
374  }
375 
376  if ( bNullTab )
377  {
378  MapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
379  if ( MapUnit::Map100thMM != eUnit )
380  {
381 
382  // negative first line indent -> set null default tabstob if applicable
383  sal_uInt16 _nWhich = GetWhich( SID_ATTR_TABSTOP );
384  const SfxItemSet& rInSet = GetItemSet();
385 
386  if ( rInSet.GetItemState( _nWhich ) >= SfxItemState::DEFAULT )
387  {
388  const SvxTabStopItem& rTabItem =
389  static_cast<const SvxTabStopItem&>(rInSet.Get( _nWhich ));
390  SvxTabStopItem aNullTab( rTabItem );
391  SvxTabStop aNull( 0, SvxTabAdjust::Default );
392  aNullTab.Insert( aNull );
393  rOutSet->Put( aNullTab );
394  }
395  }
396  }
397  if (m_xRegisterCB->get_visible())
398  {
399  const SfxBoolItem* pBoolItem = static_cast<const SfxBoolItem*>(GetOldItem(
400  *rOutSet, SID_ATTR_PARA_REGISTER));
401  if (!pBoolItem)
402  return bModified;
403  std::unique_ptr<SfxBoolItem> pRegItem(static_cast<SfxBoolItem*>(pBoolItem->Clone()));
404  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
405  bool bSet = pRegItem->GetValue();
406 
407  if (m_xRegisterCB->get_active() != bSet)
408  {
409  pRegItem->SetValue(!bSet);
410  rOutSet->Put(*pRegItem);
411  bModified = true;
412  }
413  else if ( SfxItemState::DEFAULT == GetItemSet().GetItemState( _nWhich, false ) )
414  rOutSet->ClearItem(_nWhich);
415  }
416 
417  return bModified;
418 }
419 
421 {
422  SfxItemPool* pPool = rSet->GetPool();
423  DBG_ASSERT( pPool, "Where is the pool?" );
424 
425  // adjust metric
426  FieldUnit eFUnit = GetModuleFieldUnit( *rSet );
427 
428  bool bApplyCharUnit = GetApplyCharUnit( *rSet );
429 
430  SvtCJKOptions aCJKOptions;
431  if(aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
432  eFUnit = FieldUnit::CHAR;
433 
434  m_xLeftIndent->SetFieldUnit(eFUnit);
435  m_xRightIndent->SetFieldUnit(eFUnit);
436  m_xFLineIndent->SetFieldUnit(eFUnit);
437  if ( eFUnit == FieldUnit::CHAR )
438  {
439  m_xTopDist->SetFieldUnit(FieldUnit::LINE);
440  m_xBottomDist->SetFieldUnit(FieldUnit::LINE);
441  SetFieldUnit(*m_xLineDistAtMetricBox, FieldUnit::POINT);
442  }
443  else
444  {
445  m_xTopDist->SetFieldUnit(eFUnit);
446  m_xBottomDist->SetFieldUnit(eFUnit);
448  }
449 
450  sal_uInt16 _nWhich = GetWhich( SID_ATTR_LRSPACE );
451  SfxItemState eItemState = rSet->GetItemState( _nWhich );
452 
453  if ( eItemState >= SfxItemState::DEFAULT )
454  {
455  MapUnit eUnit = pPool->GetMetric( _nWhich );
456 
457  if ( bRelativeMode )
458  {
459  const SvxLRSpaceItem& rOldItem =
460  static_cast<const SvxLRSpaceItem&>(rSet->Get( _nWhich ));
461 
462  if ( rOldItem.GetPropLeft() != 100 )
463  {
464  m_xLeftIndent->SetRelative( true );
465  m_xLeftIndent->set_value(rOldItem.GetPropLeft(), FieldUnit::NONE);
466  }
467  else
468  {
469  m_xLeftIndent->SetRelative(false);
470  m_xLeftIndent->SetFieldUnit(eFUnit);
471  m_xLeftIndent->SetMetricValue(rOldItem.GetTextLeft(), eUnit);
472  }
473 
474  if ( rOldItem.GetPropRight() != 100 )
475  {
476  m_xRightIndent->SetRelative( true );
477  m_xRightIndent->set_value(rOldItem.GetPropRight(), FieldUnit::NONE);
478  }
479  else
480  {
481  m_xRightIndent->SetRelative(false);
482  m_xRightIndent->SetFieldUnit(eFUnit);
483  m_xRightIndent->SetMetricValue(rOldItem.GetRight(), eUnit);
484  }
485 
486  if ( rOldItem.GetPropTextFirstLineOfst() != 100 )
487  {
488  m_xFLineIndent->SetRelative(true);
489  m_xFLineIndent->set_value(rOldItem.GetPropTextFirstLineOfst(), FieldUnit::NONE);
490  }
491  else
492  {
493  m_xFLineIndent->SetRelative(false);
494  m_xFLineIndent->set_min(-9999, FieldUnit::NONE);
495  m_xFLineIndent->SetFieldUnit(eFUnit);
496  m_xFLineIndent->SetMetricValue(rOldItem.GetTextFirstLineOfst(), eUnit);
497  }
498  m_xAutoCB->set_active(rOldItem.IsAutoFirst());
499  }
500  else
501  {
502  const SvxLRSpaceItem& rSpace =
503  static_cast<const SvxLRSpaceItem&>(rSet->Get( _nWhich ));
504 
505  m_xLeftIndent->SetMetricValue(rSpace.GetTextLeft(), eUnit);
506  m_xRightIndent->SetMetricValue(rSpace.GetRight(), eUnit);
507  m_xFLineIndent->SetMetricValue(rSpace.GetTextFirstLineOfst(), eUnit);
508  m_xAutoCB->set_active(rSpace.IsAutoFirst());
509  }
510  AutoHdl_Impl(*m_xAutoCB);
511  }
512  else
513  {
514  m_xLeftIndent->set_text(OUString());
515  m_xRightIndent->set_text(OUString());
516  m_xFLineIndent->set_text(OUString());
517  }
518 
519  _nWhich = GetWhich( SID_ATTR_ULSPACE );
520  eItemState = rSet->GetItemState( _nWhich );
521 
522  if ( eItemState >= SfxItemState::DEFAULT )
523  {
524  MapUnit eUnit = pPool->GetMetric( _nWhich );
525 
526  const SvxULSpaceItem& rOldItem =
527  static_cast<const SvxULSpaceItem&>(rSet->Get( _nWhich ));
528  if ( bRelativeMode )
529  {
530 
531  if ( rOldItem.GetPropUpper() != 100 )
532  {
533  m_xTopDist->SetRelative( true );
534  m_xTopDist->set_value(rOldItem.GetPropUpper(), FieldUnit::NONE);
535  }
536  else
537  {
538  m_xTopDist->SetRelative(false);
539  if (eFUnit == FieldUnit::CHAR)
540  m_xTopDist->SetFieldUnit(FieldUnit::LINE);
541  else
542  m_xTopDist->SetFieldUnit(eFUnit);
543  m_xTopDist->SetMetricValue(rOldItem.GetUpper(), eUnit);
544  }
545 
546  if ( rOldItem.GetPropLower() != 100 )
547  {
548  m_xBottomDist->SetRelative( true );
549  m_xBottomDist->set_value(rOldItem.GetPropLower(), FieldUnit::NONE);
550  }
551  else
552  {
553  m_xBottomDist->SetRelative(false);
554  if (eFUnit == FieldUnit::CHAR)
555  m_xBottomDist->SetFieldUnit(FieldUnit::LINE);
556  else
557  m_xBottomDist->SetFieldUnit(eFUnit);
558  m_xBottomDist->SetMetricValue(rOldItem.GetLower(), eUnit);
559  }
560  }
561  else
562  {
563  m_xTopDist->SetMetricValue(rOldItem.GetUpper(), eUnit);
564  m_xBottomDist->SetMetricValue(rOldItem.GetLower(), eUnit);
565  }
566  m_xContextualCB->set_active(rOldItem.GetContext());
567  }
568  else
569  {
570  m_xTopDist->set_text(OUString());
571  m_xBottomDist->set_text(OUString());
572  }
573 
574  _nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
575  eItemState = rSet->GetItemState( _nWhich );
576 
577  if ( eItemState >= SfxItemState::DEFAULT )
578  SetLineSpacing_Impl( static_cast<const SvxLineSpacingItem &>(rSet->Get( _nWhich )) );
579  else
580  m_xLineDist->set_active(-1);
581 
582  _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
583  eItemState = rSet->GetItemState( _nWhich );
584 
585  if ( eItemState >= SfxItemState::DEFAULT )
586  m_xRegisterCB->set_active( static_cast<const SfxBoolItem &>(rSet->Get( _nWhich )).GetValue());
587  m_xRegisterCB->save_state();
588  sal_uInt16 nHtmlMode = GetHtmlMode_Impl(*rSet);
589  if(nHtmlMode & HTMLMODE_ON)
590  {
591  m_xRegisterFL->hide();
592  m_xRegisterCB->hide();
593  m_xAutoCB->hide();
594  }
595 
596  // this sets the min/max limits; do this _after_ setting the values,
597  // because for Impress the min of first-line indent depends on value of
598  // left-indent!
599  ELRLoseFocus();
600  ChangesApplied();
601 }
602 
604 {
605  m_xLeftIndent->save_value();
606  m_xRightIndent->save_value();
607  m_xFLineIndent->save_value();
608  m_xLineDist->save_value();
609  m_xLineDistAtPercentBox->save_value();
610  m_xLineDistAtMetricBox->save_value();
611  m_xRegisterCB->save_state();
612  m_xTopDist->save_value();
613  m_xBottomDist->save_value();
614  m_xContextualCB->save_state();
615  m_xAutoCB->save_state();
616 }
617 
619 {
620  DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
621 
622  m_xLeftIndent->EnableRelativeMode( 0, 999 );
623  m_xFLineIndent->EnableRelativeMode( 0, 999 );
624  m_xRightIndent->EnableRelativeMode( 0, 999 );
625  m_xTopDist->EnableRelativeMode( 0, 999 );
626  m_xBottomDist->EnableRelativeMode( 0, 999 );
627  bRelativeMode = true;
628 }
629 
631 {
632  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
633  SfxItemState eItemState = rSet.GetItemState( _nWhich );
634 
635  if ( eItemState >= SfxItemState::DEFAULT )
636  {
637  const SvxAdjustItem& rAdj = static_cast<const SvxAdjustItem&>( rSet.Get( _nWhich ) );
638  SvxAdjust eAdjust = rAdj.GetAdjust();
639  if ( eAdjust == SvxAdjust::Center || eAdjust == SvxAdjust::Block )
640  {
641  _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
642  eItemState = rSet.GetItemState( _nWhich );
643 
644  if ( eItemState >= SfxItemState::DEFAULT )
645  {
646  const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>( rSet.Get( _nWhich ) );
647  SvxFrameDirection eFrameDirection = rFrameDirItem.GetValue();
648 
649  m_aExampleWin.EnableRTL( SvxFrameDirection::Horizontal_RL_TB == eFrameDirection );
650 
651  if ( eAdjust == SvxAdjust::Block )
653  }
654  }
655  else
656  {
657  m_aExampleWin.EnableRTL( eAdjust == SvxAdjust::Right );
658  eAdjust = SvxAdjust::Left; //required for correct preview display
659  m_aExampleWin.SetLastLine( eAdjust );
660  }
661  m_aExampleWin.SetAdjust( eAdjust );
662 
664  }
665 }
666 
668 {
669  ELRLoseFocus();
670 
671  if ( _pSet )
672  FillItemSet( _pSet );
673  return DeactivateRC::LeavePage;
674 }
675 
677  : SfxTabPage(pPage, pController, "cui/ui/paraindentspacing.ui", "ParaIndentSpacing", &rAttr)
678  , nWidth(11905 /*567 * 50*/)
679  , nMinFixDist(0)
680  , bRelativeMode(false)
681  , m_xLeftIndent(new RelativeField(m_xBuilder->weld_metric_spin_button("spinED_LEFTINDENT", FieldUnit::CM)))
682  , m_xRightLabel(m_xBuilder->weld_label("labelFT_RIGHTINDENT"))
683  , m_xRightIndent(new RelativeField(m_xBuilder->weld_metric_spin_button("spinED_RIGHTINDENT", FieldUnit::CM)))
684  , m_xFLineLabel(m_xBuilder->weld_label("labelFT_FLINEINDENT"))
685  , m_xFLineIndent(new RelativeField(m_xBuilder->weld_metric_spin_button("spinED_FLINEINDENT", FieldUnit::CM)))
686  , m_xAutoCB(m_xBuilder->weld_check_button("checkCB_AUTO"))
687  , m_xTopDist(new RelativeField(m_xBuilder->weld_metric_spin_button("spinED_TOPDIST", FieldUnit::CM)))
688  , m_xBottomDist(new RelativeField(m_xBuilder->weld_metric_spin_button("spinED_BOTTOMDIST", FieldUnit::CM)))
689  , m_xContextualCB(m_xBuilder->weld_check_button("checkCB_CONTEXTUALSPACING"))
690  , m_xLineDist(m_xBuilder->weld_combo_box("comboLB_LINEDIST"))
691  , m_xLineDistAtPercentBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTPERCENT", FieldUnit::PERCENT))
692  , m_xLineDistAtMetricBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTMETRIC", FieldUnit::CM))
693  , m_xLineDistAtLabel(m_xBuilder->weld_label("labelFT_LINEDIST"))
694  , m_xAbsDist(m_xBuilder->weld_label("labelST_LINEDIST_ABS"))
695  , m_xRegisterFL(m_xBuilder->weld_widget("frameFL_REGISTER"))
696  , m_xRegisterCB(m_xBuilder->weld_check_button("checkCB_REGISTER"))
697  , m_xExampleWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWN_EXAMPLE", m_aExampleWin))
698 {
699  sAbsDist = m_xAbsDist->get_label();
700 
701  // this page needs ExchangeSupport
703 
704  m_xLineDistAtMetricBox->hide();
705 
706  Init_Impl();
707  m_xFLineIndent->set_min(-9999, FieldUnit::NONE); // is set to 0 on default
708 }
709 
711 {
712 }
713 
715 {
716  m_xLeftIndent->set_min(-9999, FieldUnit::NONE);
717  m_xRightIndent->set_min(-9999, FieldUnit::NONE);
718  m_xRightIndent->EnableNegativeMode();
719  m_xLeftIndent->EnableNegativeMode();
720 }
721 
723 (
724  const SvxLineSpacingItem &rAttr
725 )
726 {
727  MapUnit eUnit = SfxViewFrame::Current()->GetPool().GetMetric( rAttr.Which() );
728 
729  switch( rAttr.GetLineSpaceRule() )
730  {
731  case SvxLineSpaceRule::Auto:
732  {
734 
735  switch( eInter )
736  {
737  // Default single line spacing
738  case SvxInterLineSpaceRule::Off:
739  m_xLineDist->set_active( LLINESPACE_1 );
740  break;
741 
742  // Default single line spacing
743  case SvxInterLineSpaceRule::Prop:
744  if ( 100 == rAttr.GetPropLineSpace() )
745  {
746  m_xLineDist->set_active( LLINESPACE_1 );
747  break;
748  }
749  // 1.15 line spacing
750  if ( 115 == rAttr.GetPropLineSpace() )
751  {
752  m_xLineDist->set_active( LLINESPACE_115 );
753  break;
754  }
755  // 1.5 line spacing
756  if ( 150 == rAttr.GetPropLineSpace() )
757  {
758  m_xLineDist->set_active( LLINESPACE_15 );
759  break;
760  }
761  // double line spacing
762  if ( 200 == rAttr.GetPropLineSpace() )
763  {
764  m_xLineDist->set_active( LLINESPACE_2 );
765  break;
766  }
767  // the set per cent value
768  m_xLineDistAtPercentBox->set_value(m_xLineDistAtPercentBox->normalize(rAttr.GetPropLineSpace()), FieldUnit::NONE);
769  m_xLineDist->set_active( LLINESPACE_PROP );
770  break;
771 
772  case SvxInterLineSpaceRule::Fix:
773  SetMetricValue( *m_xLineDistAtMetricBox, rAttr.GetInterLineSpace(), eUnit );
774  m_xLineDist->set_active( LLINESPACE_DURCH );
775  break;
776  default: ;//prevent warning
777  }
778  }
779  break;
780  case SvxLineSpaceRule::Fix:
781  SetMetricValue(*m_xLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
782  m_xLineDist->set_active( LLINESPACE_FIX );
783  break;
784 
785  case SvxLineSpaceRule::Min:
786  SetMetricValue(*m_xLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
787  m_xLineDist->set_active( LLINESPACE_MIN );
788  break;
789  default: ;//prevent warning
790  }
791  LineDistHdl_Impl( *m_xLineDist );
792 }
793 
795 {
796  m_bLineDistToggled = true;
797 }
798 
799 IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox&, rBox, void)
800 {
801  switch (rBox.get_active())
802  {
803  case LLINESPACE_1:
804  case LLINESPACE_115:
805  case LLINESPACE_15:
806  case LLINESPACE_2:
807  m_xLineDistAtLabel->set_sensitive(false);
808  m_xLineDistAtPercentBox->set_sensitive(false);
809  m_xLineDistAtPercentBox->set_text(OUString());
810  m_xLineDistAtMetricBox->set_sensitive(false);
811  m_xLineDistAtMetricBox->set_text(OUString());
812  break;
813 
814  case LLINESPACE_DURCH:
815  // setting a sensible default?
816  // limit MS min(10, aPageSize)
817  m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
818 
819  if (m_xLineDistAtMetricBox->get_text().isEmpty())
820  m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(1), FieldUnit::NONE);
821  m_xLineDistAtPercentBox->hide();
822  m_xLineDistAtMetricBox->show();
823  m_xLineDistAtMetricBox->set_sensitive(true);
824  m_xLineDistAtLabel->set_sensitive(true);
825  break;
826 
827  case LLINESPACE_MIN:
828  m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
829 
830  if (m_xLineDistAtMetricBox->get_text().isEmpty())
831  m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(10), FieldUnit::TWIP);
832  m_xLineDistAtPercentBox->hide();
833  m_xLineDistAtMetricBox->show();
834  m_xLineDistAtMetricBox->set_sensitive(true);
835  m_xLineDistAtLabel->set_sensitive(true);
836  break;
837 
838  case LLINESPACE_PROP:
839 
840  if (m_xLineDistAtPercentBox->get_text().isEmpty())
841  m_xLineDistAtPercentBox->set_value(m_xLineDistAtPercentBox->normalize(100), FieldUnit::TWIP);
842  m_xLineDistAtMetricBox->hide();
843  m_xLineDistAtPercentBox->show();
844  m_xLineDistAtPercentBox->set_sensitive(true);
845  m_xLineDistAtLabel->set_sensitive(true);
846  break;
847  case LLINESPACE_FIX:
848  {
849  auto nTemp = m_xLineDistAtMetricBox->get_value(FieldUnit::NONE);
850  m_xLineDistAtMetricBox->set_min(m_xLineDistAtMetricBox->normalize(nMinFixDist), FieldUnit::TWIP);
851 
852  // if the value has been changed at SetMin,
853  // it is time for the default
854  if (m_xLineDistAtMetricBox->get_value(FieldUnit::NONE) != nTemp)
855  SetMetricValue( *m_xLineDistAtMetricBox, FIX_DIST_DEF, MapUnit::MapTwip ); // fix is only in Writer
856  m_xLineDistAtPercentBox->hide();
857  m_xLineDistAtMetricBox->show();
858  m_xLineDistAtMetricBox->set_sensitive(true);
859  m_xLineDistAtLabel->set_sensitive(true);
860  }
861  break;
862  }
863  UpdateExample_Impl();
864 }
865 
867 {
868  UpdateExample_Impl();
869 }
870 
872 {
873  m_xLineDist->connect_popup_toggled(LINK(this, SvxStdParagraphTabPage, LineDistPopupHdl_Impl));
874  m_xLineDist->connect_changed(LINK(this, SvxStdParagraphTabPage, LineDistHdl_Impl));
875 
876  Link<weld::MetricSpinButton&,void> aLink2 = LINK(this, SvxStdParagraphTabPage, ELRLoseFocusHdl);
877  m_xFLineIndent->connect_value_changed(aLink2);
878  m_xLeftIndent->connect_value_changed(aLink2);
879  m_xRightIndent->connect_value_changed(aLink2);
880 
881  Link<weld::MetricSpinButton&,void> aLink = LINK(this, SvxStdParagraphTabPage, ModifyHdl_Impl);
882  m_xTopDist->connect_value_changed(aLink);
883  m_xBottomDist->connect_value_changed(aLink);
884 
885  m_xAutoCB->connect_toggled(LINK(this, SvxStdParagraphTabPage, AutoHdl_Impl));
886  SfxItemPool* pPool = GetItemSet().GetPool();
887  DBG_ASSERT( pPool, "Where is the pool?" );
888  FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
889 
890  m_xTopDist->set_max( m_xTopDist->normalize( MAX_DURCH ), eUnit );
891  m_xBottomDist->set_max( m_xBottomDist->normalize( MAX_DURCH ), eUnit );
892  m_xLineDistAtMetricBox->set_max( m_xLineDistAtMetricBox->normalize( MAX_DURCH ), eUnit );
893 }
894 
896 {
897  m_aExampleWin.SetFirstLineOfst( static_cast<short>(m_xFLineIndent->denormalize( m_xFLineIndent->get_value( FieldUnit::TWIP ) )) );
898  m_aExampleWin.SetLeftMargin( static_cast<long>(m_xLeftIndent->denormalize( m_xLeftIndent->get_value( FieldUnit::TWIP ) ) ) );
899  m_aExampleWin.SetRightMargin( static_cast<long>(m_xRightIndent->denormalize( m_xRightIndent->get_value( FieldUnit::TWIP ) ) ) );
900  m_aExampleWin.SetUpper( static_cast<sal_uInt16>(m_xTopDist->denormalize( m_xTopDist->get_value( FieldUnit::TWIP ) )) );
901  m_aExampleWin.SetLower( static_cast<sal_uInt16>(m_xBottomDist->denormalize( m_xBottomDist->get_value( FieldUnit::TWIP ) )) );
902 
903  int nPos = m_xLineDist->get_active();
904 
905  switch ( nPos )
906  {
907  case LLINESPACE_1:
908  case LLINESPACE_115:
909  case LLINESPACE_15:
910  case LLINESPACE_2:
911  case LLINESPACE_PROP:
912  case LLINESPACE_MIN:
913  case LLINESPACE_DURCH:
914  case LLINESPACE_FIX:
915  m_aExampleWin.SetLineSpace( static_cast<SvxPrevLineSpace>(nPos) );
916  break;
917  }
918  m_aExampleWin.Invalidate();
919 }
920 
922 {
923  m_xRegisterCB->show();
924  m_xRegisterFL->show();
925 }
926 
928 {
929  m_xContextualCB->show();
930 }
931 
933 {
934  bool bEnable = !rBox.get_active();
935  m_xFLineLabel->set_sensitive(bEnable);
936  m_xFLineIndent->set_sensitive(bEnable);
937 }
938 
940 {
941  m_xAutoCB->show();
942 }
943 
945 {
946  m_xLineDist->append_text(sAbsDist);
947  nMinFixDist = nMinTwip;
948 }
949 
951 {
952 
953 /* different bit represent call to different method of SvxStdParagraphTabPage
954  0x0001 --->EnableRelativeMode()
955  0x0002 --->EnableRegisterMode()
956  0x0004 --->EnableAutoFirstLine()
957  0x0008 --->EnableNegativeMode()
958  0x0010 --->EnableContextualMode()
959  */
960  const SfxUInt16Item* pPageWidthItem = aSet.GetItem<SfxUInt16Item>(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH, false);
961  const SfxUInt32Item* pFlagSetItem = aSet.GetItem<SfxUInt32Item>(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET, false);
962  const SfxUInt32Item* pLineDistItem = aSet.GetItem<SfxUInt32Item>(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, false);
963 
964  if (pPageWidthItem)
965  nWidth = pPageWidthItem->GetValue();
966 
967  if (pFlagSetItem )
968  {
969  if (( 0x0001 & pFlagSetItem->GetValue())== 0x0001 )
971 
972  if (( 0x0002 & pFlagSetItem->GetValue())== 0x0002 )
974 
975  if ( ( 0x0004 & pFlagSetItem->GetValue())== 0x0004 )
977  }
978 
979  if(pLineDistItem)
980  EnableAbsLineDist(pLineDistItem->GetValue());
981 
982  if (pFlagSetItem)
983  {
984  if (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 )
986 
987  if (( 0x0010 & pFlagSetItem->GetValue()) == 0x0010 )
989  }
990 }
991 
992 #define LASTLINEPOS_DEFAULT 0
993 #define LASTLINEPOS_LEFT 1
994 
995 #define LASTLINECOUNT_OLD 3
996 #define LASTLINECOUNT_NEW 4
997 
999  : SfxTabPage(pPage, pController, "cui/ui/paragalignpage.ui", "ParaAlignPage", &rSet)
1000  , m_xLeft(m_xBuilder->weld_radio_button("radioBTN_LEFTALIGN"))
1001  , m_xRight(m_xBuilder->weld_radio_button("radioBTN_RIGHTALIGN"))
1002  , m_xCenter(m_xBuilder->weld_radio_button("radioBTN_CENTERALIGN"))
1003  , m_xJustify(m_xBuilder->weld_radio_button("radioBTN_JUSTIFYALIGN"))
1004  , m_xLeftBottom(m_xBuilder->weld_label("labelST_LEFTALIGN_ASIAN"))
1005  , m_xRightTop(m_xBuilder->weld_label("labelST_RIGHTALIGN_ASIAN"))
1006  , m_xLastLineFT(m_xBuilder->weld_label("labelLB_LASTLINE"))
1007  , m_xLastLineLB(m_xBuilder->weld_combo_box("comboLB_LASTLINE"))
1008  , m_xExpandCB(m_xBuilder->weld_check_button("checkCB_EXPAND"))
1009  , m_xSnapToGridCB(m_xBuilder->weld_check_button("checkCB_SNAP"))
1010  , m_xExampleWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWN_EXAMPLE", m_aExampleWin))
1011  , m_xVertAlignFL(m_xBuilder->weld_widget("frameFL_VERTALIGN"))
1012  , m_xVertAlignLB(m_xBuilder->weld_combo_box("comboLB_VERTALIGN"))
1013  , m_xPropertiesFL(m_xBuilder->weld_widget("framePROPERTIES"))
1014  , m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("comboLB_TEXTDIRECTION")))
1015 {
1017 
1018  SvtLanguageOptions aLangOptions;
1019  sal_uInt16 nLastLinePos = LASTLINEPOS_DEFAULT;
1020 
1021  if ( aLangOptions.IsAsianTypographyEnabled() )
1022  {
1023  m_xLeft->set_label(m_xLeftBottom->get_label());
1024  m_xRight->set_label(m_xRightTop->get_label());
1025 
1026  OUString sLeft(m_xLeft->get_label());
1028 
1029  if (m_xLastLineLB->get_count() == LASTLINECOUNT_OLD)
1030  {
1031  m_xLastLineLB->remove(0);
1032  m_xLastLineLB->insert_text(0, sLeft);
1033  }
1034  else
1035  nLastLinePos = LASTLINEPOS_LEFT;
1036  }
1037 
1038  // remove "Default" or "Left" entry, depends on CJKOptions
1039  if (m_xLastLineLB->get_count() == LASTLINECOUNT_NEW)
1040  m_xLastLineLB->remove(nLastLinePos);
1041 
1042  Link<weld::ToggleButton&, void> aLink = LINK( this, SvxParaAlignTabPage, AlignHdl_Impl );
1043  m_xLeft->connect_toggled(aLink);
1044  m_xRight->connect_toggled(aLink);
1045  m_xCenter->connect_toggled(aLink);
1046  m_xJustify->connect_toggled(aLink);
1047  m_xLastLineLB->connect_changed(LINK(this, SvxParaAlignTabPage, LastLineHdl_Impl));
1048  m_xTextDirectionLB->connect_changed(LINK(this, SvxParaAlignTabPage, TextDirectionHdl_Impl));
1049 
1050  m_xTextDirectionLB->append(SvxFrameDirection::Environment, SvxResId(RID_SVXSTR_FRAMEDIR_SUPER));
1051  m_xTextDirectionLB->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_FRAMEDIR_LTR));
1052  m_xTextDirectionLB->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_FRAMEDIR_RTL));
1053 }
1054 
1056 {
1057 }
1058 
1060 {
1061  if ( _pSet )
1062  FillItemSet( _pSet );
1063  return DeactivateRC::LeavePage;
1064 }
1065 
1066 std::unique_ptr<SfxTabPage> SvxParaAlignTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
1067 {
1068  return std::make_unique<SvxParaAlignTabPage>(pPage, pController, *rSet);
1069 }
1070 
1072 {
1073  bool bModified = false;
1074 
1075  bool bAdj = false;
1076  SvxAdjust eAdjust = SvxAdjust::Left;
1077 
1078  if (m_xLeft->get_active())
1079  {
1080  eAdjust = SvxAdjust::Left;
1081  bAdj = m_xLeft->get_saved_state() == TRISTATE_FALSE;
1082  }
1083  else if (m_xRight->get_active())
1084  {
1085  eAdjust = SvxAdjust::Right;
1086  bAdj = m_xRight->get_saved_state() == TRISTATE_FALSE;
1087  }
1088  else if (m_xCenter->get_active())
1089  {
1090  eAdjust = SvxAdjust::Center;
1091  bAdj = m_xCenter->get_saved_state() == TRISTATE_FALSE;
1092  }
1093  else if (m_xJustify->get_active())
1094  {
1095  eAdjust = SvxAdjust::Block;
1096  bAdj = m_xJustify->get_saved_state() == TRISTATE_FALSE ||
1097  m_xExpandCB->get_state_changed_from_saved() ||
1098  m_xLastLineLB->get_value_changed_from_saved();
1099  }
1100 
1101  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
1102 
1103  if (bAdj)
1104  {
1105  SvxAdjust eOneWord = m_xExpandCB->get_active() ? SvxAdjust::Block : SvxAdjust::Left;
1106 
1107  int nLBPos = m_xLastLineLB->get_active();
1108  SvxAdjust eLastBlock = SvxAdjust::Left;
1109  if ( 1 == nLBPos )
1110  eLastBlock = SvxAdjust::Center;
1111  else if ( 2 == nLBPos )
1112  eLastBlock = SvxAdjust::Block;
1113 
1114  SvxAdjustItem aAdj( static_cast<const SvxAdjustItem&>(GetItemSet().Get( _nWhich )) );
1115  aAdj.SetAdjust( eAdjust );
1116  aAdj.SetOneWord( eOneWord );
1117  aAdj.SetLastBlock( eLastBlock );
1118  rOutSet->Put( aAdj );
1119  bModified = true;
1120  }
1121 
1122  if (m_xSnapToGridCB->get_state_changed_from_saved())
1123  {
1124  rOutSet->Put(SvxParaGridItem(m_xSnapToGridCB->get_active(), GetWhich( SID_ATTR_PARA_SNAPTOGRID )));
1125  bModified = true;
1126  }
1127 
1128  if (m_xVertAlignLB->get_value_changed_from_saved())
1129  {
1130  rOutSet->Put(SvxParaVertAlignItem(static_cast<SvxParaVertAlignItem::Align>(m_xVertAlignLB->get_active()), GetWhich( SID_PARA_VERTALIGN )));
1131  bModified = true;
1132  }
1133 
1134  if (m_xTextDirectionLB->get_visible())
1135  {
1136  if (m_xTextDirectionLB->get_value_changed_from_saved())
1137  {
1138  SvxFrameDirection eDir = m_xTextDirectionLB->get_active_id();
1139  rOutSet->Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
1140  bModified = true;
1141  }
1142  }
1143 
1144  return bModified;
1145 }
1146 
1148 {
1149  Reset( &rSet );
1150 }
1151 
1153 {
1154  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
1155  SfxItemState eItemState = rSet->GetItemState( _nWhich );
1156 
1157  sal_Int32 nLBSelect = 0;
1158  if ( eItemState >= SfxItemState::DEFAULT )
1159  {
1160  const SvxAdjustItem& rAdj = static_cast<const SvxAdjustItem&>(rSet->Get( _nWhich ));
1161 
1162  switch ( rAdj.GetAdjust() )
1163  {
1164  case SvxAdjust::Left: m_xLeft->set_active(true); break;
1165 
1166  case SvxAdjust::Right: m_xRight->set_active(true); break;
1167 
1168  case SvxAdjust::Center: m_xCenter->set_active(true); break;
1169 
1170  case SvxAdjust::Block: m_xJustify->set_active(true); break;
1171  default: ; //prevent warning
1172  }
1173  bool bEnable = m_xJustify->get_active();
1174  m_xLastLineFT->set_sensitive(bEnable);
1175  m_xLastLineLB->set_sensitive(bEnable);
1176 
1177  switch(rAdj.GetLastBlock())
1178  {
1179  case SvxAdjust::Left: nLBSelect = 0; break;
1180 
1181  case SvxAdjust::Center: nLBSelect = 1; break;
1182 
1183  case SvxAdjust::Block: nLBSelect = 2; break;
1184  default: ; //prevent warning
1185  }
1186  m_xExpandCB->set_sensitive(bEnable && nLBSelect == 2);
1187  m_xExpandCB->set_active(SvxAdjust::Block == rAdj.GetOneWord());
1188  }
1189  else
1190  {
1191  m_xLeft->set_active(false);
1192  m_xRight->set_active(false);
1193  m_xCenter->set_active(false);
1194  m_xJustify->set_active(false);
1195  }
1196  m_xLastLineLB->set_active(nLBSelect);
1197 
1198  sal_uInt16 nHtmlMode = GetHtmlMode_Impl(*rSet);
1199  if(nHtmlMode & HTMLMODE_ON)
1200  {
1201  m_xLastLineLB->hide();
1202  m_xLastLineFT->hide();
1203  m_xExpandCB->hide();
1204  if(!(nHtmlMode & HTMLMODE_FULL_STYLES) )
1205  m_xJustify->set_sensitive(false);
1206  m_xSnapToGridCB->hide();
1207  }
1208  _nWhich = GetWhich(SID_ATTR_PARA_SNAPTOGRID);
1209  eItemState = rSet->GetItemState( _nWhich );
1210  if ( eItemState >= SfxItemState::DEFAULT )
1211  {
1212  const SvxParaGridItem& rSnap = static_cast<const SvxParaGridItem&>(rSet->Get( _nWhich ));
1213  m_xSnapToGridCB->set_active(rSnap.GetValue());
1214  }
1215 
1216  _nWhich = GetWhich( SID_PARA_VERTALIGN );
1217  eItemState = rSet->GetItemState( _nWhich );
1218 
1219  if ( eItemState >= SfxItemState::DEFAULT )
1220  {
1221  m_xVertAlignFL->show();
1222 
1223  const SvxParaVertAlignItem& rAlign = static_cast<const SvxParaVertAlignItem&>(rSet->Get( _nWhich ));
1224 
1225  m_xVertAlignLB->set_active(static_cast<sal_Int32>(rAlign.GetValue()));
1226  }
1227 
1228  _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
1229  //text direction
1230  if( SfxItemState::DEFAULT <= rSet->GetItemState( _nWhich ) )
1231  {
1232  const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>( rSet->Get( _nWhich ) );
1233  m_xTextDirectionLB->set_active_id(rFrameDirItem.GetValue());
1234  m_xTextDirectionLB->save_value();
1235  }
1236 
1237  m_xSnapToGridCB->save_state();
1238  m_xVertAlignLB->save_value();
1239  m_xLeft->save_state();
1240  m_xRight->save_state();
1241  m_xCenter->save_state();
1242  m_xJustify->save_state();
1243  m_xLastLineLB->save_value();
1244  m_xExpandCB->save_state();
1245 
1247 }
1248 
1250 {
1251  m_xTextDirectionLB->save_value();
1252  m_xSnapToGridCB->save_state();
1253  m_xVertAlignLB->save_value();
1254  m_xLeft->save_state();
1255  m_xRight->save_state();
1256  m_xCenter->save_state();
1257  m_xJustify->save_state();
1258  m_xLastLineLB->save_value();
1259  m_xExpandCB->save_state();
1260 }
1261 
1263 {
1264  bool bJustify = m_xJustify->get_active();
1265  m_xLastLineFT->set_sensitive(bJustify);
1266  m_xLastLineLB->set_sensitive(bJustify);
1267  bool bLastLineIsBlock = m_xLastLineLB->get_active() == 2;
1268  m_xExpandCB->set_sensitive(bJustify && bLastLineIsBlock);
1269  //set last line listbox to entry position 0 if not enabled
1270  if (!m_xLastLineLB->get_sensitive())
1271  m_xLastLineLB->set_active(0);
1272  //uncheck 'Expand ... word' when check box is not enabled
1273  if (!m_xExpandCB->get_sensitive())
1274  m_xExpandCB->set_active(false);
1275  UpdateExample_Impl();
1276 }
1277 
1279 {
1280  //fdo#41350 only enable 'Expand last word' if last line is also justified
1281  bool bLastLineIsBlock = m_xLastLineLB->get_active() == 2;
1282  m_xExpandCB->set_sensitive(bLastLineIsBlock);
1283  //uncheck 'Expand ... word' when check box is not enabled
1284  if (!m_xExpandCB->get_sensitive())
1285  m_xExpandCB->set_active(false);
1286  UpdateExample_Impl();
1287 }
1288 
1289 IMPL_LINK_NOARG(SvxParaAlignTabPage, TextDirectionHdl_Impl, weld::ComboBox&, void)
1290 {
1291  UpdateExample_Impl();
1292 }
1293 
1295 {
1296  if (m_xLeft->get_active())
1297  {
1298  m_aExampleWin.EnableRTL(false);
1299  m_aExampleWin.SetAdjust(SvxAdjust::Left);
1300  m_aExampleWin.SetLastLine(SvxAdjust::Left);
1301  }
1302  else if (m_xRight->get_active())
1303  {
1304  m_aExampleWin.EnableRTL(true);
1305  m_aExampleWin.SetAdjust(SvxAdjust::Left);
1306  m_aExampleWin.SetLastLine(SvxAdjust::Left);
1307  }
1308  else
1309  {
1310  SvxFrameDirection eDir = m_xTextDirectionLB->get_active_id();
1311  switch ( eDir )
1312  {
1313  case SvxFrameDirection::Environment :
1314  if ( !m_xRight->get_active() )
1316  break;
1317  case SvxFrameDirection::Horizontal_RL_TB :
1318  if ( !m_xLeft->get_active() )
1319  m_aExampleWin.EnableRTL( true );
1320  break;
1321  case SvxFrameDirection::Horizontal_LR_TB :
1322  if ( !m_xRight->get_active() )
1323  m_aExampleWin.EnableRTL( false );
1324  break;
1325  default: ; //prevent warning
1326  }
1327  if (m_xCenter->get_active())
1328  m_aExampleWin.SetAdjust( SvxAdjust::Center );
1329  else if (m_xJustify->get_active())
1330  {
1331  m_aExampleWin.SetAdjust( SvxAdjust::Block );
1332  int nLBPos = m_xLastLineLB->get_active();
1333  if (nLBPos == 0)
1334  m_aExampleWin.SetLastLine(SvxAdjust::Left);
1335  else if (nLBPos == 1)
1336  m_aExampleWin.SetLastLine(SvxAdjust::Center);
1337  else if (nLBPos == 2)
1338  m_aExampleWin.SetLastLine(SvxAdjust::Block);
1339  }
1340  }
1341 
1342  m_aExampleWin.Invalidate();
1343 }
1344 
1346 {
1347  m_xLastLineFT->show();
1348  m_xLastLineLB->show();
1349  m_xExpandCB->show();
1350  SvtLanguageOptions aCJKOptions;
1351  if (aCJKOptions.IsAsianTypographyEnabled())
1352  m_xSnapToGridCB->show();
1353 
1354 }
1355 
1357 {
1358  const SfxBoolItem* pBoolItem = aSet.GetItem<SfxBoolItem>(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT, false);
1359  if (pBoolItem && pBoolItem->GetValue())
1360  EnableJustifyExt();
1361 }
1362 
1363 std::unique_ptr<SfxTabPage> SvxExtParagraphTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
1364 {
1365  return std::make_unique<SvxExtParagraphTabPage>(pPage, pController, *rSet);
1366 }
1367 
1369 {
1370  bool bModified = false;
1371  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
1372  const TriState eHyphenState = m_xHyphenBox->get_state();
1373  const SfxPoolItem* pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_HYPHENZONE );
1374 
1375  if ( m_xHyphenBox->get_state_changed_from_saved() ||
1376  m_xExtHyphenBeforeBox->get_value_changed_from_saved() ||
1377  m_xExtHyphenAfterBox->get_value_changed_from_saved() ||
1378  m_xMaxHyphenEdit->get_value_changed_from_saved() )
1379  {
1380  SvxHyphenZoneItem aHyphen(
1381  static_cast<const SvxHyphenZoneItem&>(GetItemSet().Get( _nWhich )) );
1382  aHyphen.SetHyphen( eHyphenState == TRISTATE_TRUE );
1383 
1384  if ( eHyphenState == TRISTATE_TRUE )
1385  {
1386  aHyphen.GetMinLead() = static_cast<sal_uInt8>(m_xExtHyphenBeforeBox->get_value());
1387  aHyphen.GetMinTrail() = static_cast<sal_uInt8>(m_xExtHyphenAfterBox->get_value());
1388  }
1389  aHyphen.GetMaxHyphens() = static_cast<sal_uInt8>(m_xMaxHyphenEdit->get_value());
1390 
1391  if ( !pOld ||
1392  *static_cast<const SvxHyphenZoneItem*>(pOld) != aHyphen ||
1393  m_xHyphenBox->get_state_changed_from_saved())
1394  {
1395  rOutSet->Put( aHyphen );
1396  bModified = true;
1397  }
1398  }
1399 
1400  if (m_xPageNumBox->get_sensitive()
1401  && (m_xPageNumBox->get_state_changed_from_saved() || m_xPagenumEdit->get_value_changed_from_saved()))
1402  {
1403  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_PAGENUM );
1404 
1405  if (TRISTATE_TRUE == m_xPageNumBox->get_state()
1406  && (!pOld || IsInvalidItem(pOld)
1407  || static_cast<const SfxUInt16Item*>(pOld)->GetValue() != m_xPagenumEdit->get_value()))
1408  {
1409  SfxUInt16Item aPageNum(SID_ATTR_PARA_PAGENUM,
1410  static_cast<sal_uInt16>(m_xPagenumEdit->get_value()));
1411  rOutSet->Put( aPageNum );
1412  bModified = true;
1413  }
1414  else if (TRISTATE_FALSE == m_xPageNumBox->get_state()
1415  && (pOld || IsInvalidItem(pOld)))
1416  {
1417  // need to tell sw to remove the item
1418  rOutSet->DisableItem(SID_ATTR_PARA_PAGENUM);
1419  bModified = true;
1420  }
1421  }
1422 
1423  // pagebreak
1424 
1425  TriState eState = m_xApplyCollBtn->get_state();
1426  bool bIsPageModel = false;
1427 
1428  _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
1429  OUString sPage;
1430  if ( m_xApplyCollBtn->get_state_changed_from_saved() ||
1431  ( TRISTATE_TRUE == eState &&
1432  m_xApplyCollBox->get_value_changed_from_saved() ) )
1433  {
1434  if ( eState == TRISTATE_TRUE )
1435  {
1436  sPage = m_xApplyCollBox->get_active_text();
1437  bIsPageModel = !sPage.isEmpty();
1438  }
1439  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_MODEL );
1440 
1441  if ( !pOld || static_cast<const SvxPageModelItem*>(pOld)->GetValue() != sPage )
1442  {
1443  rOutSet->Put( SvxPageModelItem( sPage, false, _nWhich ) );
1444  bModified = true;
1445  }
1446  else
1447  bIsPageModel = false;
1448  }
1449  else if(TRISTATE_TRUE == eState && m_xApplyCollBtn->get_sensitive())
1450  bIsPageModel = true;
1451  else
1452  rOutSet->Put( SvxPageModelItem( sPage, false, _nWhich ) );
1453 
1454  _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
1455 
1456  if ( bIsPageModel )
1457  // if PageModel is turned on, always turn off PageBreak
1458  rOutSet->Put( SvxFormatBreakItem( SvxBreak::NONE, _nWhich ) );
1459  else
1460  {
1461  eState = m_xPageBreakBox->get_state();
1462  SfxItemState eModelState = GetItemSet().GetItemState(SID_ATTR_PARA_MODEL, false);
1463 
1464  if ( (eModelState == SfxItemState::SET && TRISTATE_TRUE == m_xPageBreakBox->get_state()) ||
1465  m_xPageBreakBox->get_state_changed_from_saved() ||
1466  m_xBreakTypeLB->get_value_changed_from_saved() ||
1467  m_xBreakPositionLB->get_value_changed_from_saved() )
1468  {
1469  const SvxFormatBreakItem rOldBreak(
1470  static_cast<const SvxFormatBreakItem&>(GetItemSet().Get( _nWhich )));
1471  SvxFormatBreakItem aBreak(rOldBreak.GetBreak(), rOldBreak.Which());
1472 
1473  switch ( eState )
1474  {
1475  case TRISTATE_TRUE:
1476  {
1477  bool bBefore = m_xBreakPositionLB->get_active() == 0;
1478 
1479  if (m_xBreakTypeLB->get_active() == 0)
1480  {
1481  if ( bBefore )
1482  aBreak.SetValue( SvxBreak::PageBefore );
1483  else
1484  aBreak.SetValue( SvxBreak::PageAfter );
1485  }
1486  else
1487  {
1488  if ( bBefore )
1489  aBreak.SetValue( SvxBreak::ColumnBefore );
1490  else
1491  aBreak.SetValue( SvxBreak::ColumnAfter );
1492  }
1493  break;
1494  }
1495 
1496  case TRISTATE_FALSE:
1497  aBreak.SetValue( SvxBreak::NONE );
1498  break;
1499  default: ; //prevent warning
1500  }
1501  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_PAGEBREAK );
1502 
1503  if ( eState != m_xPageBreakBox->get_saved_state() ||
1504  !pOld || !( *static_cast<const SvxFormatBreakItem*>(pOld) == aBreak ) )
1505  {
1506  bModified = true;
1507  rOutSet->Put( aBreak );
1508  }
1509  }
1510  }
1511 
1512  // paragraph split
1513  _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
1514  eState = m_xKeepTogetherBox->get_state();
1515 
1516  if (m_xKeepTogetherBox->get_state_changed_from_saved())
1517  {
1518  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_SPLIT );
1519 
1520  if ( !pOld || static_cast<const SvxFormatSplitItem*>(pOld)->GetValue() !=
1521  ( eState == TRISTATE_FALSE ) )
1522  {
1523  rOutSet->Put( SvxFormatSplitItem( eState == TRISTATE_FALSE, _nWhich ) );
1524  bModified = true;
1525  }
1526  }
1527 
1528  // keep paragraphs
1529  _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
1530  eState = m_xKeepParaBox->get_state();
1531 
1532  if (m_xKeepParaBox->get_state_changed_from_saved())
1533  {
1534  // if the status has changed, putting is necessary
1535  rOutSet->Put( SvxFormatKeepItem( eState == TRISTATE_TRUE, _nWhich ) );
1536  bModified = true;
1537  }
1538 
1539  // widows and orphans
1540  _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
1541  eState = m_xWidowBox->get_state();
1542 
1543  if ( m_xWidowBox->get_state_changed_from_saved() ||
1544  m_xWidowRowNo->get_value_changed_from_saved() )
1545  {
1546  SvxWidowsItem rItem( eState == TRISTATE_TRUE ?
1547  static_cast<sal_uInt8>(m_xWidowRowNo->get_value()) : 0, _nWhich );
1548  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_WIDOWS );
1549 
1550  if ( m_xWidowBox->get_state_changed_from_saved() || !pOld || !( *static_cast<const SvxWidowsItem*>(pOld) == rItem ) )
1551  {
1552  rOutSet->Put( rItem );
1553  bModified = true;
1554  }
1555  }
1556 
1557  _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
1558  eState = m_xOrphanBox->get_state();
1559 
1560  if ( m_xOrphanBox->get_state_changed_from_saved() ||
1561  m_xOrphanRowNo->get_value_changed_from_saved() )
1562  {
1563  SvxOrphansItem rItem( eState == TRISTATE_TRUE ?
1564  static_cast<sal_uInt8>(m_xOrphanRowNo->get_value()) : 0, _nWhich );
1565  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_ORPHANS );
1566 
1567  if ( m_xOrphanBox->get_state_changed_from_saved() ||
1568  !pOld ||
1569  !( *static_cast<const SvxOrphansItem*>(pOld) == rItem ) )
1570  {
1571  rOutSet->Put( rItem );
1572  bModified = true;
1573  }
1574  }
1575 
1576  return bModified;
1577 }
1579 {
1580  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
1581  SfxItemState eItemState = rSet->GetItemState( _nWhich );
1582 
1583  bool bItemAvailable = eItemState >= SfxItemState::DEFAULT;
1584  bool bIsHyphen = false;
1585  if( !bHtmlMode && bItemAvailable )
1586  {
1587  const SvxHyphenZoneItem& rHyphen =
1588  static_cast<const SvxHyphenZoneItem&>(rSet->Get( _nWhich ));
1590 
1591  bIsHyphen = rHyphen.IsHyphen();
1592  m_xHyphenBox->set_state(bIsHyphen ? TRISTATE_TRUE : TRISTATE_FALSE);
1593 
1594  m_xExtHyphenBeforeBox->set_value(rHyphen.GetMinLead());
1595  m_xExtHyphenAfterBox->set_value(rHyphen.GetMinTrail());
1596  m_xMaxHyphenEdit->set_value(rHyphen.GetMaxHyphens());
1597  }
1598  else
1599  {
1600  m_xHyphenBox->set_state(TRISTATE_INDET);
1601  }
1602  bool bEnable = bItemAvailable && bIsHyphen;
1603  m_xExtHyphenBeforeBox->set_sensitive(bEnable);
1604  m_xExtHyphenAfterBox->set_sensitive(bEnable);
1605  m_xBeforeText->set_sensitive(bEnable);
1606  m_xAfterText->set_sensitive(bEnable);
1607  m_xMaxHyphenLabel->set_sensitive(bEnable);
1608  m_xMaxHyphenEdit->set_sensitive(bEnable);
1609 
1610  _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM );
1611 
1612  switch (rSet->GetItemState(_nWhich))
1613  {
1614  case SfxItemState::SET:
1615  {
1617  m_xPageNumBox->set_state(TRISTATE_TRUE);
1618  SfxUInt16Item const*const pItem(rSet->GetItem<SfxUInt16Item>(_nWhich));
1619  const sal_uInt16 nPageNum(pItem->GetValue());
1620  m_xPagenumEdit->set_value(nPageNum);
1621  break;
1622  }
1623  case SfxItemState::DONTCARE:
1624  {
1626  m_xPageNumBox->set_state(TRISTATE_INDET);
1627  break;
1628  }
1629  case SfxItemState::UNKNOWN:
1630  case SfxItemState::DEFAULT:
1631  case SfxItemState::DISABLED:
1632  {
1634  m_xPageNumBox->set_state(TRISTATE_FALSE);
1635  break;
1636  }
1637  default:
1638  assert(false); // unexpected
1639  break;
1640  }
1641 
1642  if ( bPageBreak )
1643  {
1644  // first handle PageModel
1645  _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
1646  bool bIsPageModel = false;
1647  eItemState = rSet->GetItemState( _nWhich );
1648 
1649  if ( eItemState >= SfxItemState::SET )
1650  {
1652 
1653  const SvxPageModelItem& rModel =
1654  static_cast<const SvxPageModelItem&>(rSet->Get( _nWhich ));
1655  const OUString& aStr( rModel.GetValue() );
1656 
1657  if (!aStr.isEmpty() && m_xApplyCollBox->find_text(aStr) != -1)
1658  {
1659  m_xApplyCollBox->set_active_text(aStr);
1660  m_xApplyCollBtn->set_state(TRISTATE_TRUE);
1661  bIsPageModel = true;
1662 
1663  m_xPageBreakBox->set_sensitive(true);
1665  m_xBreakTypeFT->set_sensitive(true);
1666  m_xBreakTypeLB->set_sensitive(true);
1667  m_xBreakPositionFT->set_sensitive(true);
1668  m_xBreakPositionLB->set_sensitive(true);
1669  m_xApplyCollBtn->set_sensitive(false);
1670  m_xPageBreakBox->set_state(TRISTATE_TRUE);
1671 
1672  //select page break
1673  m_xBreakTypeLB->set_active(0);
1674  //select break before
1675  m_xBreakPositionLB->set_active(0);
1676  }
1677  else
1678  {
1679  m_xApplyCollBox->set_active(-1);
1680  m_xApplyCollBtn->set_state(TRISTATE_FALSE);
1681  }
1682  }
1683  else if ( SfxItemState::DONTCARE == eItemState )
1684  {
1686  m_xApplyCollBtn->set_state(TRISTATE_INDET);
1687  m_xApplyCollBox->set_active(-1);
1688  }
1689  else
1690  {
1691  m_xApplyCollBtn->set_sensitive(false);
1692  m_xApplyCollBox->set_sensitive(false);
1693  m_xPagenumEdit->set_sensitive(false);
1694  m_xPageNumBox->set_sensitive(false);
1695  }
1696 
1697  if ( !bIsPageModel )
1698  {
1699  _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
1700  eItemState = rSet->GetItemState( _nWhich );
1701 
1702  if ( eItemState >= SfxItemState::DEFAULT )
1703  {
1704  const SvxFormatBreakItem& rPageBreak =
1705  static_cast<const SvxFormatBreakItem&>(rSet->Get( _nWhich ));
1706 
1707  SvxBreak eBreak = rPageBreak.GetBreak();
1708 
1709  // PageBreak not via CTRL-RETURN,
1710  // then CheckBox can be freed
1711  m_xPageBreakBox->set_sensitive(true);
1713  m_xBreakTypeFT->set_sensitive(true);
1714  m_xBreakTypeLB->set_sensitive(true);
1715  m_xBreakPositionFT->set_sensitive(true);
1716  m_xBreakPositionLB->set_sensitive(true);
1717 
1718  m_xPageBreakBox->set_state(TRISTATE_TRUE);
1719 
1720  bool _bEnable = eBreak != SvxBreak::NONE &&
1721  eBreak != SvxBreak::ColumnBefore &&
1722  eBreak != SvxBreak::ColumnAfter;
1723  m_xApplyCollBtn->set_sensitive(_bEnable);
1724  if (!_bEnable)
1725  {
1726  m_xApplyCollBox->set_sensitive(_bEnable);
1727  m_xPageNumBox->set_sensitive(false);
1728  m_xPagenumEdit->set_sensitive(_bEnable);
1729  }
1730 
1731  if ( eBreak == SvxBreak::NONE )
1732  m_xPageBreakBox->set_state(TRISTATE_FALSE);
1733 
1734  sal_Int32 nType = 0; // selection position in break type ListBox : Page
1735  sal_Int32 nPosition = 0; // selection position in break position ListBox : Before
1736  switch ( eBreak )
1737  {
1738  case SvxBreak::PageBefore:
1739  break;
1740  case SvxBreak::PageAfter:
1741  nPosition = 1;
1742  break;
1743  case SvxBreak::ColumnBefore:
1744  nType = 1;
1745  break;
1746  case SvxBreak::ColumnAfter:
1747  nType = 1;
1748  nPosition = 1;
1749  break;
1750  default: ;//prevent warning
1751  }
1752  m_xBreakTypeLB->set_active(nType);
1753  m_xBreakPositionLB->set_active(nPosition);
1754  }
1755  else if ( SfxItemState::DONTCARE == eItemState )
1756  m_xPageBreakBox->set_state(TRISTATE_INDET);
1757  else
1758  {
1759  m_xPageBreakBox->set_sensitive(false);
1760  m_xBreakTypeFT->set_sensitive(false);
1761  m_xBreakTypeLB->set_sensitive(false);
1762  m_xBreakPositionFT->set_sensitive(false);
1763  m_xBreakPositionLB->set_sensitive(false);
1764  }
1765  }
1766 
1767  PageBreakPosHdl_Impl(*m_xBreakPositionLB);
1768  PageBreakHdl();
1769  }
1770 
1771  _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
1772  eItemState = rSet->GetItemState( _nWhich );
1773 
1774  if ( eItemState >= SfxItemState::DEFAULT )
1775  {
1777  const SvxFormatKeepItem& rKeep =
1778  static_cast<const SvxFormatKeepItem&>(rSet->Get( _nWhich ));
1779 
1780  if ( rKeep.GetValue() )
1781  m_xKeepParaBox->set_state(TRISTATE_TRUE);
1782  else
1783  m_xKeepParaBox->set_state(TRISTATE_FALSE);
1784  }
1785  else if ( SfxItemState::DONTCARE == eItemState )
1786  m_xKeepParaBox->set_state(TRISTATE_INDET);
1787  else
1788  m_xKeepParaBox->set_sensitive(false);
1789 
1790  _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
1791  eItemState = rSet->GetItemState( _nWhich );
1792 
1793  if ( eItemState >= SfxItemState::DEFAULT )
1794  {
1795  const SvxFormatSplitItem& rSplit =
1796  static_cast<const SvxFormatSplitItem&>(rSet->Get( _nWhich ));
1798 
1799  if ( !rSplit.GetValue() )
1800  m_xKeepTogetherBox->set_state(TRISTATE_TRUE);
1801  else
1802  {
1803  m_xKeepTogetherBox->set_state(TRISTATE_FALSE);
1804 
1805  // widows and orphans
1806  m_xWidowBox->set_sensitive(true);
1807  _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
1808  SfxItemState eTmpState = rSet->GetItemState( _nWhich );
1809 
1810  if ( eTmpState >= SfxItemState::DEFAULT )
1811  {
1812  const SvxWidowsItem& rWidow =
1813  static_cast<const SvxWidowsItem&>(rSet->Get( _nWhich ));
1814  aWidowState.bTriStateEnabled = false;
1815  const sal_uInt16 nLines = rWidow.GetValue();
1816 
1817  bool _bEnable = nLines > 0;
1818  m_xWidowRowNo->set_value(m_xWidowRowNo->normalize(nLines));
1819  m_xWidowBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
1820  m_xWidowRowNo->set_sensitive(_bEnable);
1821  //m_xWidowRowLabel->set_sensitive(_bEnable);
1822 
1823  }
1824  else if ( SfxItemState::DONTCARE == eTmpState )
1825  m_xWidowBox->set_state( TRISTATE_INDET );
1826  else
1827  m_xWidowBox->set_sensitive(false);
1828 
1829  m_xOrphanBox->set_sensitive(true);
1830  _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
1831  eTmpState = rSet->GetItemState( _nWhich );
1832 
1833  if ( eTmpState >= SfxItemState::DEFAULT )
1834  {
1835  const SvxOrphansItem& rOrphan =
1836  static_cast<const SvxOrphansItem&>(rSet->Get( _nWhich ));
1837  const sal_uInt16 nLines = rOrphan.GetValue();
1839 
1840  bool _bEnable = nLines > 0;
1841  m_xOrphanBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
1842  m_xOrphanRowNo->set_value(m_xOrphanRowNo->normalize(nLines));
1843  m_xOrphanRowNo->set_sensitive(_bEnable);
1844  m_xOrphanRowLabel->set_sensitive(_bEnable);
1845 
1846  }
1847  else if ( SfxItemState::DONTCARE == eTmpState )
1848  m_xOrphanBox->set_state(TRISTATE_INDET);
1849  else
1850  m_xOrphanBox->set_sensitive(false);
1851  aOrphanState.eState = m_xOrphanBox->get_state();
1852  }
1853  }
1854  else if ( SfxItemState::DONTCARE == eItemState )
1855  m_xKeepTogetherBox->set_state(TRISTATE_INDET);
1856  else
1857  m_xKeepTogetherBox->set_sensitive(false);
1858 
1859  // so that everything is enabled correctly
1860  KeepTogetherHdl();
1861  WidowHdl();
1862  OrphanHdl();
1863  ChangesApplied();
1864 }
1866 {
1867  m_xHyphenBox->save_state();
1868  m_xExtHyphenBeforeBox->set_value(m_xExtHyphenBeforeBox->get_value());
1869  m_xExtHyphenAfterBox->set_value(m_xExtHyphenAfterBox->get_value());
1870  m_xMaxHyphenEdit->set_value(m_xMaxHyphenEdit->get_value());
1871  m_xPageBreakBox->save_state();
1872  m_xBreakPositionLB->save_value();
1873  m_xBreakTypeLB->save_value();
1874  m_xApplyCollBtn->save_state();
1875  m_xApplyCollBox->save_value();
1876  m_xPageNumBox->save_state();
1877  m_xPagenumEdit->save_value();
1878  m_xKeepTogetherBox->save_state();
1879  m_xKeepParaBox->save_state();
1880  m_xWidowBox->save_state();
1881  m_xOrphanBox->save_state();
1882  m_xOrphanRowNo->save_value();
1883  m_xWidowRowNo->save_value();
1884 }
1885 
1887 {
1888  if ( _pSet )
1889  FillItemSet( _pSet );
1890  return DeactivateRC::LeavePage;
1891 }
1892 
1894 {
1895  bPageBreak = false;
1896  m_xPageBreakBox->set_sensitive(false);
1897  m_xBreakTypeLB->remove(0);
1898  m_xBreakPositionFT->set_sensitive(false);
1899  m_xBreakPositionLB->set_sensitive(false);
1900  m_xApplyCollBtn->set_sensitive(false);
1901  m_xApplyCollBox->set_sensitive(false);
1902  m_xPageNumBox->set_sensitive(false);
1903  m_xPagenumEdit->set_sensitive(false);
1904 }
1905 
1907  : SfxTabPage(pPage, pController, "cui/ui/textflowpage.ui", "TextFlowPage", &rAttr)
1908  , bPageBreak(true)
1909  , bHtmlMode(false)
1910  , nStdPos(0)
1911  // Hyphenation
1912  , m_xHyphenBox(m_xBuilder->weld_check_button("checkAuto"))
1913  , m_xBeforeText(m_xBuilder->weld_label("labelLineBegin"))
1914  , m_xExtHyphenBeforeBox(m_xBuilder->weld_spin_button("spinLineEnd"))
1915  , m_xAfterText(m_xBuilder->weld_label("labelLineEnd"))
1916  , m_xExtHyphenAfterBox(m_xBuilder->weld_spin_button("spinLineBegin"))
1917  , m_xMaxHyphenLabel(m_xBuilder->weld_label("labelMaxNum"))
1918  , m_xMaxHyphenEdit(m_xBuilder->weld_spin_button("spinMaxNum"))
1919  //Page break
1920  , m_xPageBreakBox(m_xBuilder->weld_check_button("checkInsert"))
1921  , m_xBreakTypeFT(m_xBuilder->weld_label("labelType"))
1922  , m_xBreakTypeLB(m_xBuilder->weld_combo_box("comboBreakType"))
1923  , m_xBreakPositionFT(m_xBuilder->weld_label("labelPosition"))
1924  , m_xBreakPositionLB(m_xBuilder->weld_combo_box("comboBreakPosition"))
1925  , m_xApplyCollBtn(m_xBuilder->weld_check_button("checkPageStyle"))
1926  , m_xApplyCollBox(m_xBuilder->weld_combo_box("comboPageStyle"))
1927  , m_xPageNumBox(m_xBuilder->weld_check_button("labelPageNum"))
1928  , m_xPagenumEdit(m_xBuilder->weld_spin_button("spinPageNumber"))
1929  // Options
1930  , m_xKeepTogetherBox(m_xBuilder->weld_check_button("checkSplitPara"))
1931  , m_xKeepParaBox(m_xBuilder->weld_check_button("checkKeepPara"))
1932  , m_xOrphanBox(m_xBuilder->weld_check_button("checkOrphan"))
1933  , m_xOrphanRowNo(m_xBuilder->weld_spin_button("spinOrphan"))
1934  , m_xOrphanRowLabel(m_xBuilder->weld_label("labelOrphan"))
1935  , m_xWidowBox(m_xBuilder->weld_check_button("checkWidow"))
1936  , m_xWidowRowNo(m_xBuilder->weld_spin_button("spinWidow"))
1937  , m_xWidowRowLabel(m_xBuilder->weld_label("labelWidow"))
1938 {
1939  // this page needs ExchangeSupport
1941 
1942  m_xHyphenBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, HyphenClickHdl_Impl));
1943  m_xPageBreakBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageBreakHdl_Impl));
1944  m_xKeepTogetherBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl));
1945  m_xWidowBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, WidowHdl_Impl));
1946  m_xOrphanBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, OrphanHdl_Impl));
1947  m_xApplyCollBtn->connect_toggled(LINK(this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl));
1948  m_xBreakTypeLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl));
1949  m_xBreakPositionLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl));
1950  m_xPageNumBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl));
1951  m_xKeepParaBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl));
1952 
1954  if ( pSh )
1955  {
1956  SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool();
1957  pPool->SetSearchMask( SfxStyleFamily::Page );
1958  SfxStyleSheetBase* pStyle = pPool->First();
1959  OUString aStdName;
1960 
1961  while( pStyle )
1962  {
1963  if ( aStdName.isEmpty() )
1964  // first style == standard style
1965  aStdName = pStyle->GetName();
1966  m_xApplyCollBox->append_text(pStyle->GetName());
1967  pStyle = pPool->Next();
1968  }
1969  nStdPos = m_xApplyCollBox->find_text(aStdName);
1970  }
1971 
1972  sal_uInt16 nHtmlMode = GetHtmlMode_Impl( rAttr );
1973  if ( nHtmlMode & HTMLMODE_ON )
1974  {
1975  bHtmlMode = true;
1976  m_xHyphenBox->set_sensitive(false);
1977  m_xBeforeText->set_sensitive(false);
1978  m_xExtHyphenBeforeBox->set_sensitive(false);
1979  m_xAfterText->set_sensitive(false);
1980  m_xExtHyphenAfterBox->set_sensitive(false);
1981  m_xMaxHyphenLabel->set_sensitive(false);
1982  m_xMaxHyphenEdit->set_sensitive(false);
1983  m_xPageNumBox->set_sensitive(false);
1984  m_xPagenumEdit->set_sensitive(false);
1985  // no column break in HTML
1986  m_xBreakTypeLB->remove(1);
1987  }
1988 }
1989 
1991 {
1992 }
1993 
1995 {
1996  switch (m_xPageBreakBox->get_state())
1997  {
1998  case TRISTATE_TRUE:
1999  m_xBreakTypeFT->set_sensitive(true);
2000  m_xBreakTypeLB->set_sensitive(true);
2001  m_xBreakPositionFT->set_sensitive(true);
2002  m_xBreakPositionLB->set_sensitive(true);
2003 
2004  if (0 == m_xBreakTypeLB->get_active() && 0 == m_xBreakPositionLB->get_active())
2005  {
2006  m_xApplyCollBtn->set_sensitive(true);
2007 
2008  bool bEnable = TRISTATE_TRUE == m_xApplyCollBtn->get_state() &&
2009  m_xApplyCollBox->get_count();
2010  m_xApplyCollBox->set_sensitive(bEnable);
2011  if(!bHtmlMode)
2012  {
2013  m_xPageNumBox->set_sensitive(bEnable);
2014  m_xPagenumEdit->set_sensitive(bEnable && m_xPageNumBox->get_state() == TRISTATE_TRUE);
2015  }
2016  }
2017  break;
2018 
2019  case TRISTATE_FALSE:
2020  case TRISTATE_INDET:
2021  m_xApplyCollBtn->set_state(TRISTATE_FALSE);
2022  m_xApplyCollBtn->set_sensitive(false);
2023  m_xApplyCollBox->set_sensitive(false);
2024  m_xPageNumBox->set_sensitive(false);
2025  m_xPagenumEdit->set_sensitive(false);
2026  m_xBreakTypeFT->set_sensitive(false);
2027  m_xBreakTypeLB->set_sensitive(false);
2028  m_xBreakPositionFT->set_sensitive(false);
2029  m_xBreakPositionLB->set_sensitive(false);
2030  break;
2031  }
2032 }
2033 
2034 IMPL_LINK(SvxExtParagraphTabPage, PageBreakHdl_Impl, weld::ToggleButton&, rToggle, void)
2035 {
2036  aPageBreakState.ButtonToggled(rToggle);
2037  PageBreakHdl();
2038 }
2039 
2041 {
2042  bool bEnable = m_xKeepTogetherBox->get_state() == TRISTATE_FALSE;
2043  m_xWidowBox->set_sensitive(bEnable);
2044  m_xOrphanBox->set_sensitive(bEnable);
2045 }
2046 
2047 IMPL_LINK(SvxExtParagraphTabPage, KeepTogetherHdl_Impl, weld::ToggleButton&, rToggle, void)
2048 {
2049  aKeepTogetherState.ButtonToggled(rToggle);
2050  KeepTogetherHdl();
2051 }
2052 
2054 {
2055  switch (m_xWidowBox->get_state())
2056  {
2057  case TRISTATE_TRUE:
2058  m_xWidowRowNo->set_sensitive(true);
2059  m_xWidowRowLabel->set_sensitive(true);
2060  m_xKeepTogetherBox->set_sensitive(false);
2061  break;
2062  case TRISTATE_FALSE:
2063  if (m_xOrphanBox->get_state() == TRISTATE_FALSE)
2064  m_xKeepTogetherBox->set_sensitive(true);
2065  [[fallthrough]];
2066  case TRISTATE_INDET:
2067  m_xWidowRowNo->set_sensitive(false);
2068  m_xWidowRowLabel->set_sensitive(false);
2069  break;
2070  }
2071 }
2072 
2073 IMPL_LINK(SvxExtParagraphTabPage, WidowHdl_Impl, weld::ToggleButton&, rToggle, void)
2074 {
2075  aWidowState.ButtonToggled(rToggle);
2076  WidowHdl();
2077 }
2078 
2079 IMPL_LINK(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::ToggleButton&, rToggle, void)
2080 {
2081  aOrphanState.ButtonToggled(rToggle);
2082  OrphanHdl();
2083 }
2084 
2086 {
2087  switch (m_xOrphanBox->get_state())
2088  {
2089  case TRISTATE_TRUE:
2090  m_xOrphanRowNo->set_sensitive(true);
2091  m_xOrphanRowLabel->set_sensitive(true);
2092  m_xKeepTogetherBox->set_sensitive(false);
2093  break;
2094 
2095  case TRISTATE_FALSE:
2096  if (m_xWidowBox->get_state() == TRISTATE_FALSE)
2097  m_xKeepTogetherBox->set_sensitive(true);
2098  [[fallthrough]];
2099  case TRISTATE_INDET:
2100  m_xOrphanRowNo->set_sensitive(false);
2101  m_xOrphanRowLabel->set_sensitive(false);
2102  break;
2103  }
2104 }
2105 
2107 {
2108  bool bEnable = m_xHyphenBox->get_state() == TRISTATE_TRUE;
2109  m_xBeforeText->set_sensitive(bEnable);
2110  m_xExtHyphenBeforeBox->set_sensitive(bEnable);
2111  m_xAfterText->set_sensitive(bEnable);
2112  m_xExtHyphenAfterBox->set_sensitive(bEnable);
2113  m_xMaxHyphenLabel->set_sensitive(bEnable);
2114  m_xMaxHyphenEdit->set_sensitive(bEnable);
2115  m_xHyphenBox->set_state(bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
2116 }
2117 
2118 IMPL_LINK(SvxExtParagraphTabPage, HyphenClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2119 {
2120  aHyphenState.ButtonToggled(rToggle);
2121  HyphenClickHdl();
2122 }
2123 
2125 {
2126  bool bEnable = false;
2127  if (m_xApplyCollBtn->get_state() == TRISTATE_TRUE && m_xApplyCollBox->get_count())
2128  {
2129  bEnable = true;
2130  m_xApplyCollBox->set_active(nStdPos);
2131  }
2132  else
2133  {
2134  m_xApplyCollBox->set_active(-1);
2135  }
2136  m_xApplyCollBox->set_sensitive(bEnable);
2137  if (!bHtmlMode)
2138  {
2139  m_xPageNumBox->set_sensitive(bEnable);
2140  m_xPagenumEdit->set_sensitive(bEnable && m_xPageNumBox->get_state() == TRISTATE_TRUE);
2141  }
2142 }
2143 
2144 IMPL_LINK(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2145 {
2146  aApplyCollState.ButtonToggled(rToggle);
2147  ApplyCollClickHdl();
2148 }
2149 
2150 IMPL_LINK(SvxExtParagraphTabPage, PageBreakPosHdl_Impl, weld::ComboBox&, rListBox, void)
2151 {
2152  if (0 == rListBox.get_active())
2153  {
2154  m_xApplyCollBtn->set_sensitive(true);
2155 
2156  bool bEnable = m_xApplyCollBtn->get_state() == TRISTATE_TRUE && m_xApplyCollBox->get_count();
2157 
2158  m_xApplyCollBox->set_sensitive(bEnable);
2159  if (!bHtmlMode)
2160  {
2161  m_xPageNumBox->set_sensitive(bEnable);
2162  m_xPagenumEdit->set_sensitive(bEnable && m_xPageNumBox->get_state() == TRISTATE_TRUE);
2163  }
2164  }
2165  else if (1 == rListBox.get_active())
2166  {
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);
2172  }
2173 }
2174 
2175 IMPL_LINK(SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, weld::ComboBox&, rListBox, void)
2176 {
2177  //column break or break after
2178  int nBreakPos = m_xBreakPositionLB->get_active();
2179  if (rListBox.get_active() == 1 || 1 == nBreakPos)
2180  {
2181  m_xApplyCollBtn->set_state(TRISTATE_FALSE);
2182  m_xApplyCollBtn->set_sensitive(false);
2183  m_xApplyCollBox->set_sensitive(false);
2184  m_xPageNumBox->set_sensitive(false);
2185  m_xPagenumEdit->set_sensitive(false);
2186  }
2187  else
2188  PageBreakPosHdl_Impl(*m_xBreakPositionLB);
2189 }
2190 
2192 {
2193  m_xPagenumEdit->set_sensitive(m_xPageNumBox->get_state() == TRISTATE_TRUE);
2194 }
2195 
2196 IMPL_LINK(SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2197 {
2198  aPageNumState.ButtonToggled(rToggle);
2199  PageNumBoxClickHdl();
2200 }
2201 
2202 IMPL_LINK(SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2203 {
2204  aKeepParaState.ButtonToggled(rToggle);
2205 }
2206 
2208 {
2209  const SfxBoolItem* pDisablePageBreakItem = aSet.GetItem<SfxBoolItem>(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK, false);
2210 
2211  if (pDisablePageBreakItem)
2212  if ( pDisablePageBreakItem->GetValue())
2213  DisablePageBreak();
2214 }
2215 
2217  : SfxTabPage(pPage, pController, "cui/ui/asiantypography.ui", "AsianTypography", &rSet)
2218  , m_xForbiddenRulesCB(m_xBuilder->weld_check_button("checkForbidList"))
2219  , m_xHangingPunctCB(m_xBuilder->weld_check_button("checkHangPunct"))
2220  , m_xScriptSpaceCB(m_xBuilder->weld_check_button("checkApplySpacing"))
2221 {
2222 }
2223 
2225 {
2226 }
2227 
2228 std::unique_ptr<SfxTabPage> SvxAsianTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
2229 {
2230  return std::make_unique<SvxAsianTabPage>(pPage, pController, *rSet);
2231 }
2232 
2233 const sal_uInt16* SvxAsianTabPage::GetRanges()
2234 {
2235  static const sal_uInt16 pRanges[] =
2236  {
2237  SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES,
2238  0
2239  };
2240  return pRanges;
2241 }
2242 
2244 {
2245  bool bRet = false;
2246  SfxItemPool* pPool = rSet->GetPool();
2247  if (m_xScriptSpaceCB->get_sensitive() && m_xScriptSpaceCB->get_state_changed_from_saved())
2248  {
2249  std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
2250  pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone()));
2251  pNewItem->SetValue(m_xScriptSpaceCB->get_active());
2252  rSet->Put(std::move(pNewItem));
2253  bRet = true;
2254  }
2255  if (m_xHangingPunctCB->get_sensitive() && m_xHangingPunctCB->get_state_changed_from_saved())
2256  {
2257  std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
2258  pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone()));
2259  pNewItem->SetValue(m_xHangingPunctCB->get_active());
2260  rSet->Put(std::move(pNewItem));
2261  bRet = true;
2262  }
2263  if (m_xForbiddenRulesCB->get_sensitive() && m_xForbiddenRulesCB->get_state_changed_from_saved())
2264  {
2265  std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
2266  pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone()));
2267  pNewItem->SetValue(m_xForbiddenRulesCB->get_active());
2268  rSet->Put(std::move(pNewItem));
2269  bRet = true;
2270  }
2271  return bRet;
2272 }
2273 
2274 static void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, weld::CheckButton& rBox)
2275 {
2276  sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId);
2277  SfxItemState eState = rSet.GetItemState(_nWhich);
2278  if( eState == SfxItemState::UNKNOWN || eState == SfxItemState::DISABLED )
2279  rBox.set_sensitive(false);
2280  else if(eState >= SfxItemState::DEFAULT)
2281  rBox.set_active(static_cast<const SfxBoolItem&>(rSet.Get(_nWhich)).GetValue());
2282  else
2283  rBox.set_state(TRISTATE_INDET);
2284  rBox.save_state();
2285 }
2286 
2288 {
2289  lcl_SetBox(*rSet, SID_ATTR_PARA_FORBIDDEN_RULES, *m_xForbiddenRulesCB );
2290  lcl_SetBox(*rSet, SID_ATTR_PARA_HANGPUNCTUATION, *m_xHangingPunctCB );
2291 
2292  //character distance not yet available
2293  lcl_SetBox(*rSet, SID_ATTR_PARA_SCRIPTSPACE, *m_xScriptSpaceCB );
2294 }
2295 
2297 {
2298  m_xForbiddenRulesCB->save_state();
2299  m_xHangingPunctCB->save_state();
2300  m_xScriptSpaceCB->save_state();
2301 }
2302 
2303 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::CheckButton > m_xRegisterCB
Definition: paragrph.hxx:78
bool GetValue() const
SvxBreak
sal_uInt8 & GetMaxHyphens()
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
SvxStdParagraphTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: paragrph.cxx:676
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: paragrph.cxx:667
weld::TriStateEnabled aOrphanState
Definition: paragrph.hxx:220
void SetAdjust(SvxAdjust eNew)
static void SetLineSpace_Impl(SvxLineSpacingItem &, int, long lValue=0)
Definition: paragrph.cxx:105
bool Insert(const SvxTabStop &rTab)
FieldUnit
std::unique_ptr< RelativeField > m_xFLineIndent
Definition: paragrph.hxx:61
#define LLINESPACE_1
sal_uInt16 GetPropLineSpace() const
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: paragrph.cxx:2207
void SetHyphen(const bool bNew)
std::unique_ptr< weld::Label > m_xWidowRowLabel
Definition: paragrph.hxx:258
sal_uInt16 GetLower() const
SvxAdjust GetAdjust() const
std::unique_ptr< weld::ComboBox > m_xLineDist
Definition: paragrph.hxx:70
SfxStyleSheetBase * First()
void SetLower(sal_uInt16 nNew)
void SetInterLineSpace(const short nSpace)
virtual void ChangesApplied() override
Definition: paragrph.cxx:1865
std::unique_ptr< weld::RadioButton > m_xLeft
Definition: paragrph.hxx:131
std::unique_ptr< weld::MetricSpinButton > m_xLineDistAtPercentBox
Definition: paragrph.hxx:71
std::string GetValue
std::unique_ptr< weld::Widget > m_xRegisterFL
Definition: paragrph.hxx:77
bool IsAsianTypographyEnabled() const
short GetTextFirstLineOfst() const
IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox &, rBox, void)
Definition: paragrph.cxx:799
std::unique_ptr< weld::Label > m_xBreakPositionFT
Definition: paragrph.hxx:240
std::unique_ptr< weld::Label > m_xOrphanRowLabel
Definition: paragrph.hxx:254
SvxBreak GetBreak() const
std::unique_ptr< weld::ComboBox > m_xApplyCollBox
Definition: paragrph.hxx:243
std::unique_ptr< RelativeField > m_xBottomDist
Definition: paragrph.hxx:66
#define LLINESPACE_15
virtual void Reset(const SfxItemSet *rSet) override
Definition: paragrph.cxx:420
std::unique_ptr< RelativeField > m_xLeftIndent
Definition: paragrph.hxx:55
std::unique_ptr< weld::CheckButton > m_xWidowBox
Definition: paragrph.hxx:256
#define LASTLINECOUNT_OLD
Definition: paragrph.cxx:995
virtual ~SvxExtParagraphTabPage() override
Definition: paragrph.cxx:1990
void SetFirstLineOfst(short nNew)
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: paragrph.cxx:1147
SvxExtParagraphTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: paragrph.cxx:1906
sal_uInt16 GetValue() const
std::unique_ptr< weld::CheckButton > m_xHangingPunctCB
Definition: paragrph.hxx:285
weld::TriStateEnabled aApplyCollState
Definition: paragrph.hxx:216
std::unique_ptr< weld::RadioButton > m_xRight
Definition: paragrph.hxx:132
void SetTextLeft(const long nL, const sal_uInt16 nProp=100)
std::unique_ptr< weld::CheckButton > m_xSnapToGridCB
Definition: paragrph.hxx:142
std::unique_ptr< weld::Label > m_xAfterText
Definition: paragrph.hxx:231
std::unique_ptr< weld::ComboBox > m_xBreakTypeLB
Definition: paragrph.hxx:239
SvxFrameDirection
static const sal_uInt16 pStdRanges[]
Definition: paragrph.hxx:44
static SfxObjectShell * Current()
#define MAX_DURCH
Definition: paragrph.cxx:83
std::unique_ptr< weld::Label > m_xLeftBottom
Definition: paragrph.hxx:135
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: paragrph.cxx:212
TRISTATE_TRUE
void SetLineSpaceRule(SvxLineSpaceRule e)
SvxInterLineSpaceRule
sal_uInt16 GetPropLower() const
SvxAdjust GetOneWord() const
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: paragrph.cxx:630
SvxLineSpaceRule GetLineSpaceRule() const
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: paragrph.cxx:2243
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
std::unique_ptr< weld::SpinButton > m_xWidowRowNo
Definition: paragrph.hxx:257
void SetLastBlock(const SvxAdjust eType)
virtual SfxStyleSheetBasePool * GetStyleSheetPool()
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
sal_uInt8 & GetMinLead()
static sal_uInt16 GetHtmlMode_Impl(const SfxItemSet &rSet)
Definition: paragrph.cxx:153
sal_uInt16 GetLineHeight() const
void SetPropLineSpace(const sal_uInt16 nProp)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: paragrph.cxx:1066
#define LASTLINEPOS_DEFAULT
Definition: paragrph.cxx:992
const OUString & GetName() const
void SetRightMargin(long nNew)
OUString SvxResId(const char *pId)
virtual void ChangesApplied() override
Definition: paragrph.cxx:2296
void SetExchangeSupport()
void SetOneWord(const SvxAdjust eType)
void SetUpper(sal_uInt16 nNew)
weld::TriStateEnabled aPageBreakState
Definition: paragrph.hxx:215
std::unique_ptr< svx::FrameDirectionListBox > m_xTextDirectionLB
Definition: paragrph.hxx:151
std::unique_ptr< weld::Label > m_xMaxHyphenLabel
Definition: paragrph.hxx:233
void SetLeftMargin(long nNew)
std::unique_ptr< weld::SpinButton > m_xExtHyphenBeforeBox
Definition: paragrph.hxx:230
std::unique_ptr< weld::Label > m_xLastLineFT
Definition: paragrph.hxx:138
TRISTATE_INDET
std::unique_ptr< RelativeField > m_xRightIndent
Definition: paragrph.hxx:58
virtual ~SvxAsianTabPage() override
Definition: paragrph.cxx:2224
virtual void set_active(bool active)=0
SvxParaPrevWindow m_aExampleWin
Definition: paragrph.hxx:128
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
virtual ~SvxStdParagraphTabPage() override
Definition: paragrph.cxx:710
SfxItemPool & GetPool() const
std::unique_ptr< weld::CheckButton > m_xForbiddenRulesCB
Definition: paragrph.hxx:284
const SfxItemSet & GetItemSet() const
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: paragrph.cxx:1368
sal_uInt16 GetPropRight() const
std::unique_ptr< weld::SpinButton > m_xOrphanRowNo
Definition: paragrph.hxx:253
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
void SetRight(const long nR, const sal_uInt16 nProp=100)
std::unique_ptr< weld::CheckButton > m_xKeepParaBox
Definition: paragrph.hxx:249
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: paragrph.cxx:2228
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxItemSet * GetParent() const
std::unique_ptr< weld::CheckButton > m_xApplyCollBtn
Definition: paragrph.hxx:242
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
virtual void Reset(const SfxItemSet *rSet) override
Definition: paragrph.cxx:1578
SvxAdjust
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
std::unique_ptr< weld::Label > m_xRightTop
Definition: paragrph.hxx:136
LineSpaceList
Definition: paragrph.cxx:89
std::unique_ptr< weld::CheckButton > m_xContextualCB
Definition: paragrph.hxx:67
std::unique_ptr< weld::Label > m_xBeforeText
Definition: paragrph.hxx:229
#define LLINESPACE_DURCH
#define LASTLINEPOS_LEFT
Definition: paragrph.cxx:993
std::unique_ptr< weld::ComboBox > m_xBreakPositionLB
Definition: paragrph.hxx:241
std::unique_ptr< weld::CheckButton > m_xScriptSpaceCB
Definition: paragrph.hxx:286
std::unique_ptr< weld::MetricSpinButton > m_xLineDistAtMetricBox
Definition: paragrph.hxx:72
QPRO_FUNC_TYPE const nType
std::unique_ptr< RelativeField > m_xTopDist
Definition: paragrph.hxx:65
std::unique_ptr< weld::SpinButton > m_xMaxHyphenEdit
Definition: paragrph.hxx:234
std::unique_ptr< weld::SpinButton > m_xPagenumEdit
Definition: paragrph.hxx:245
TRISTATE_FALSE
#define LLINESPACE_FIX
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
HTMLMODE_ON
sal_uInt16 GetPropLeft() const
Align GetValue() const
SvxAdjust GetLastBlock() const
std::unique_ptr< weld::RadioButton > m_xJustify
Definition: paragrph.hxx:134
SvxAsianTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: paragrph.cxx:2216
#define LLINESPACE_MIN
static bool GetLayoutRTL()
std::unique_ptr< weld::Label > m_xBreakTypeFT
Definition: paragrph.hxx:238
SvxInterLineSpaceRule GetInterLineSpaceRule() const
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: paragrph.cxx:1886
std::unique_ptr< weld::RadioButton > m_xCenter
Definition: paragrph.hxx:133
SvxParaPrevWindow m_aExampleWin
Definition: paragrph.hxx:52
virtual void ChangesApplied() override
Definition: paragrph.cxx:1249
void SetAdjust(const SvxAdjust eType)
#define LLINESPACE_2
void SetMetricValue(weld::MetricSpinButton &rField, int nCoreValue, MapUnit eUnit)
virtual void ChangesApplied() override
Definition: paragrph.cxx:603
SfxItemPool * GetPool() const
static const sal_uInt16 pExtRanges[]
Definition: paragrph.hxx:194
short GetInterLineSpace() const
std::unique_ptr< weld::SpinButton > m_xExtHyphenAfterBox
Definition: paragrph.hxx:232
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: paragrph.cxx:950
weld::TriStateEnabled aPageNumState
Definition: paragrph.hxx:217
weld::TriStateEnabled aKeepParaState
Definition: paragrph.hxx:219
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool IsAsianTypographyEnabled() const
void SetInterLineSpaceRule(SvxInterLineSpaceRule e)
static SfxViewFrame * Current()
SfxItemState
void DisableItem(sal_uInt16 nWhich)
void SetTextFirstLineOfst(const short nF, const sal_uInt16 nProp=100)
static void lcl_SetBox(const SfxItemSet &rSet, sal_uInt16 nSlotId, weld::CheckButton &rBox)
Definition: paragrph.cxx:2274
weld::TriStateEnabled aHyphenState
Definition: paragrph.hxx:214
#define MM50
weld::TriStateEnabled aKeepTogetherState
Definition: paragrph.hxx:218
virtual void Reset(const SfxItemSet *rSet) override
Definition: paragrph.cxx:2287
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
std::unique_ptr< weld::ComboBox > m_xVertAlignLB
Definition: paragrph.hxx:148
std::unique_ptr< weld::CheckButton > m_xAutoCB
Definition: paragrph.hxx:62
unsigned char sal_uInt8
void SetLineHeight(const sal_uInt16 nHeight)
void SetLineSpace(SvxPrevLineSpace eNew)
std::unique_ptr< weld::CheckButton > m_xOrphanBox
Definition: paragrph.hxx:252
SfxStyleSheetBase * Next()
std::unique_ptr< weld::CheckButton > m_xKeepTogetherBox
Definition: paragrph.hxx:248
virtual ~SvxParaAlignTabPage() override
Definition: paragrph.cxx:1055
std::unique_ptr< weld::Label > m_xAbsDist
Definition: paragrph.hxx:74
void SetContextValue(const bool bC)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: paragrph.cxx:1059
std::unique_ptr< weld::Widget > m_xVertAlignFL
Definition: paragrph.hxx:147
#define LASTLINECOUNT_NEW
Definition: paragrph.cxx:996
const OUString PERCENT("Percent")
bool IsHyphen() const
weld::TriStateEnabled aWidowState
Definition: paragrph.hxx:221
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: paragrph.cxx:1356
void SetSearchMask(SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
std::unique_ptr< weld::ComboBox > m_xLastLineLB
Definition: paragrph.hxx:139
void SetLastLine(SvxAdjust eNew)
static const sal_uInt16 * GetRanges()
Definition: paragrph.cxx:2233
#define FIX_DIST_DEF
Definition: paragrph.cxx:85
long GetRight() const
sal_uInt16 GetPropTextFirstLineOfst() const
DeactivateRC
FieldUnit MapToFieldUnit(const MapUnit eUnit)
IMPL_LINK_NOARG(SvxStdParagraphTabPage, ELRLoseFocusHdl, weld::MetricSpinButton &, void)
Definition: paragrph.cxx:207
HTMLMODE_FULL_STYLES
MapUnit
SVX_DLLPUBLIC MSO_SPT Get(const OUString &)
std::unique_ptr< weld::CheckButton > m_xPageNumBox
Definition: paragrph.hxx:244
void set_state(TriState eState)
static OUString EraseAllMnemonicChars(const OUString &rStr)
std::unique_ptr< weld::CheckButton > m_xExpandCB
Definition: paragrph.hxx:140
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: paragrph.cxx:1071
bool IsInvalidItem(const SfxPoolItem *pItem)
void SetAutoFirst(const bool bNew)
std::unique_ptr< weld::CheckButton > m_xHyphenBox
Definition: paragrph.hxx:228
void EnableAbsLineDist(long nMinTwip)
Definition: paragrph.cxx:944
#define LLINESPACE_PROP
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: paragrph.cxx:1363
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: paragrph.cxx:217
TriState
static const sal_uInt16 pAlignRanges[]
Definition: paragrph.hxx:126
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
long GetTextLeft() const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
sal_Int32 nPos
bool GetApplyCharUnit(const SfxItemSet &rSet)
virtual SfxPoolItem * Clone(SfxItemPool *=nullptr) const override
bool IsAutoFirst() const
aStr
void SetLineSpacing_Impl(const SvxLineSpacingItem &rAttr)
Definition: paragrph.cxx:723
#define LLINESPACE_115
sal_uInt8 & GetMinTrail()
SvxParaAlignTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: paragrph.cxx:998
bool GetContext() const
virtual void Reset(const SfxItemSet *rSet) override
Definition: paragrph.cxx:1152
virtual void set_sensitive(bool sensitive)=0
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
std::unique_ptr< weld::CheckButton > m_xPageBreakBox
Definition: paragrph.hxx:237
sal_uInt16 GetUpper() const
sal_uInt16 GetPropUpper() const