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, tools::Long lValue = 0 );
104 
106  int eSpace, tools::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<tools::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() )
353  static_cast<sal_uInt16>(m_xFLineIndent->get_value(FieldUnit::NONE)) );
354  else
355  aMargin.SetTextFirstLineOffset(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.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_xFLineIndent->GetCoreValue(eUnit)));
362  }
363  aMargin.SetAutoFirst(m_xAutoCB->get_active());
364  if ( aMargin.GetTextFirstLineOffset() < 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(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.GetPropTextFirstLineOffset() != 100 )
487  {
488  m_xFLineIndent->SetRelative(true);
489  m_xFLineIndent->set_value(rOldItem.GetPropTextFirstLineOffset(), 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.GetTextFirstLineOffset(), 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.GetTextFirstLineOffset(), 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_xRegisterCB->hide();
592  m_xAutoCB->hide();
593  }
594 
595  // this sets the min/max limits; do this _after_ setting the values,
596  // because for Impress the min of first-line indent depends on value of
597  // left-indent!
598  ELRLoseFocus();
599  ChangesApplied();
600 }
601 
603 {
604  m_xLeftIndent->save_value();
605  m_xRightIndent->save_value();
606  m_xFLineIndent->save_value();
607  m_xLineDist->save_value();
608  m_xLineDistAtPercentBox->save_value();
609  m_xLineDistAtMetricBox->save_value();
610  m_xRegisterCB->save_state();
611  m_xTopDist->save_value();
612  m_xBottomDist->save_value();
613  m_xContextualCB->save_state();
614  m_xAutoCB->save_state();
615 }
616 
618 {
619  DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
620 
621  m_xLeftIndent->EnableRelativeMode( 0, 999 );
622  m_xFLineIndent->EnableRelativeMode( 0, 999 );
623  m_xRightIndent->EnableRelativeMode( 0, 999 );
624  m_xTopDist->EnableRelativeMode( 0, 999 );
625  m_xBottomDist->EnableRelativeMode( 0, 999 );
626  bRelativeMode = true;
627 }
628 
630 {
631  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
632  SfxItemState eItemState = rSet.GetItemState( _nWhich );
633 
634  if ( eItemState < SfxItemState::DEFAULT )
635  return;
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 
667 {
668  ELRLoseFocus();
669 
670  if ( _pSet )
671  FillItemSet( _pSet );
672  return DeactivateRC::LeavePage;
673 }
674 
676  : SfxTabPage(pPage, pController, "cui/ui/paraindentspacing.ui", "ParaIndentSpacing", &rAttr)
677  , nWidth(11905 /*567 * 50*/)
678  , nMinFixDist(0)
679  , bRelativeMode(false)
680  , m_xLeftIndent(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_LEFTINDENT", FieldUnit::CM)))
681  , m_xRightLabel(m_xBuilder->weld_label("labelFT_RIGHTINDENT"))
682  , m_xRightIndent(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_RIGHTINDENT", FieldUnit::CM)))
683  , m_xFLineLabel(m_xBuilder->weld_label("labelFT_FLINEINDENT"))
684  , m_xFLineIndent(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_FLINEINDENT", FieldUnit::CM)))
685  , m_xAutoCB(m_xBuilder->weld_check_button("checkCB_AUTO"))
686  , m_xTopDist(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_TOPDIST", FieldUnit::CM)))
687  , m_xBottomDist(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_BOTTOMDIST", FieldUnit::CM)))
688  , m_xContextualCB(m_xBuilder->weld_check_button("checkCB_CONTEXTUALSPACING"))
689  , m_xLineDist(m_xBuilder->weld_combo_box("comboLB_LINEDIST"))
690  , m_xLineDistAtPercentBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTPERCENT", FieldUnit::PERCENT))
691  , m_xLineDistAtMetricBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTMETRIC", FieldUnit::CM))
692  , m_xLineDistAtLabel(m_xBuilder->weld_label("labelFT_LINEDIST"))
693  , m_xAbsDist(m_xBuilder->weld_label("labelST_LINEDIST_ABS"))
694  , m_xRegisterCB(m_xBuilder->weld_check_button("checkCB_REGISTER"))
695  , m_xExampleWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWN_EXAMPLE", m_aExampleWin))
696 {
697  sAbsDist = m_xAbsDist->get_label();
698 
699  // this page needs ExchangeSupport
701 
702  m_xLineDistAtMetricBox->hide();
703 
704  Init_Impl();
705  m_xFLineIndent->set_min(-9999, FieldUnit::NONE); // is set to 0 on default
706 }
707 
709 {
710 }
711 
713 {
714  m_xLeftIndent->set_min(-9999, FieldUnit::NONE);
715  m_xRightIndent->set_min(-9999, FieldUnit::NONE);
716  m_xRightIndent->EnableNegativeMode();
717  m_xLeftIndent->EnableNegativeMode();
718 }
719 
721 (
722  const SvxLineSpacingItem &rAttr
723 )
724 {
725  MapUnit eUnit = SfxViewFrame::Current()->GetPool().GetMetric( rAttr.Which() );
726 
727  switch( rAttr.GetLineSpaceRule() )
728  {
729  case SvxLineSpaceRule::Auto:
730  {
732 
733  switch( eInter )
734  {
735  // Default single line spacing
736  case SvxInterLineSpaceRule::Off:
737  m_xLineDist->set_active( LLINESPACE_1 );
738  break;
739 
740  // Default single line spacing
741  case SvxInterLineSpaceRule::Prop:
742  if ( 100 == rAttr.GetPropLineSpace() )
743  {
744  m_xLineDist->set_active( LLINESPACE_1 );
745  break;
746  }
747  // 1.15 line spacing
748  if ( 115 == rAttr.GetPropLineSpace() )
749  {
750  m_xLineDist->set_active( LLINESPACE_115 );
751  break;
752  }
753  // 1.5 line spacing
754  if ( 150 == rAttr.GetPropLineSpace() )
755  {
756  m_xLineDist->set_active( LLINESPACE_15 );
757  break;
758  }
759  // double line spacing
760  if ( 200 == rAttr.GetPropLineSpace() )
761  {
762  m_xLineDist->set_active( LLINESPACE_2 );
763  break;
764  }
765  // the set per cent value
766  m_xLineDistAtPercentBox->set_value(m_xLineDistAtPercentBox->normalize(rAttr.GetPropLineSpace()), FieldUnit::NONE);
767  m_xLineDist->set_active( LLINESPACE_PROP );
768  break;
769 
770  case SvxInterLineSpaceRule::Fix:
771  SetMetricValue( *m_xLineDistAtMetricBox, rAttr.GetInterLineSpace(), eUnit );
772  m_xLineDist->set_active( LLINESPACE_DURCH );
773  break;
774  default: ;//prevent warning
775  }
776  }
777  break;
778  case SvxLineSpaceRule::Fix:
779  SetMetricValue(*m_xLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
780  m_xLineDist->set_active( LLINESPACE_FIX );
781  break;
782 
783  case SvxLineSpaceRule::Min:
784  SetMetricValue(*m_xLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
785  m_xLineDist->set_active( LLINESPACE_MIN );
786  break;
787  default: ;//prevent warning
788  }
789  LineDistHdl_Impl( *m_xLineDist );
790 }
791 
793 {
794  m_bLineDistToggled = true;
795 }
796 
797 IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox&, rBox, void)
798 {
799  switch (rBox.get_active())
800  {
801  case LLINESPACE_1:
802  case LLINESPACE_115:
803  case LLINESPACE_15:
804  case LLINESPACE_2:
805  m_xLineDistAtLabel->set_sensitive(false);
806  m_xLineDistAtPercentBox->set_sensitive(false);
807  m_xLineDistAtPercentBox->set_text(OUString());
808  m_xLineDistAtMetricBox->set_sensitive(false);
809  m_xLineDistAtMetricBox->set_text(OUString());
810  break;
811 
812  case LLINESPACE_DURCH:
813  // setting a sensible default?
814  // limit MS min(10, aPageSize)
815  m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
816 
817  if (m_xLineDistAtMetricBox->get_text().isEmpty())
818  m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(1), FieldUnit::NONE);
819  m_xLineDistAtPercentBox->hide();
820  m_xLineDistAtMetricBox->show();
821  m_xLineDistAtMetricBox->set_sensitive(true);
822  m_xLineDistAtLabel->set_sensitive(true);
823  break;
824 
825  case LLINESPACE_MIN:
826  m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
827 
828  if (m_xLineDistAtMetricBox->get_text().isEmpty())
829  m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(10), FieldUnit::TWIP);
830  m_xLineDistAtPercentBox->hide();
831  m_xLineDistAtMetricBox->show();
832  m_xLineDistAtMetricBox->set_sensitive(true);
833  m_xLineDistAtLabel->set_sensitive(true);
834  break;
835 
836  case LLINESPACE_PROP:
837 
838  if (m_xLineDistAtPercentBox->get_text().isEmpty())
839  m_xLineDistAtPercentBox->set_value(m_xLineDistAtPercentBox->normalize(100), FieldUnit::TWIP);
840  m_xLineDistAtMetricBox->hide();
841  m_xLineDistAtPercentBox->show();
842  m_xLineDistAtPercentBox->set_sensitive(true);
843  m_xLineDistAtLabel->set_sensitive(true);
844  break;
845  case LLINESPACE_FIX:
846  {
847  auto nTemp = m_xLineDistAtMetricBox->get_value(FieldUnit::NONE);
848  m_xLineDistAtMetricBox->set_min(m_xLineDistAtMetricBox->normalize(nMinFixDist), FieldUnit::TWIP);
849 
850  // if the value has been changed at SetMin,
851  // it is time for the default
852  if (m_xLineDistAtMetricBox->get_value(FieldUnit::NONE) != nTemp)
853  SetMetricValue( *m_xLineDistAtMetricBox, FIX_DIST_DEF, MapUnit::MapTwip ); // fix is only in Writer
854  m_xLineDistAtPercentBox->hide();
855  m_xLineDistAtMetricBox->show();
856  m_xLineDistAtMetricBox->set_sensitive(true);
857  m_xLineDistAtLabel->set_sensitive(true);
858  }
859  break;
860  }
861  UpdateExample_Impl();
862 }
863 
865 {
866  UpdateExample_Impl();
867 }
868 
870 {
871  m_xLineDist->connect_popup_toggled(LINK(this, SvxStdParagraphTabPage, LineDistPopupHdl_Impl));
872  m_xLineDist->connect_changed(LINK(this, SvxStdParagraphTabPage, LineDistHdl_Impl));
873 
874  Link<weld::MetricSpinButton&,void> aLink2 = LINK(this, SvxStdParagraphTabPage, ELRLoseFocusHdl);
875  m_xFLineIndent->connect_value_changed(aLink2);
876  m_xLeftIndent->connect_value_changed(aLink2);
877  m_xRightIndent->connect_value_changed(aLink2);
878 
879  Link<weld::MetricSpinButton&,void> aLink = LINK(this, SvxStdParagraphTabPage, ModifyHdl_Impl);
880  m_xTopDist->connect_value_changed(aLink);
881  m_xBottomDist->connect_value_changed(aLink);
882 
883  m_xAutoCB->connect_toggled(LINK(this, SvxStdParagraphTabPage, AutoHdl_Impl));
884  SfxItemPool* pPool = GetItemSet().GetPool();
885  DBG_ASSERT( pPool, "Where is the pool?" );
886  FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
887 
888  m_xTopDist->set_max( m_xTopDist->normalize( MAX_DURCH ), eUnit );
889  m_xBottomDist->set_max( m_xBottomDist->normalize( MAX_DURCH ), eUnit );
890  m_xLineDistAtMetricBox->set_max( m_xLineDistAtMetricBox->normalize( MAX_DURCH ), eUnit );
891 }
892 
894 {
895  m_aExampleWin.SetFirstLineOffset( static_cast<short>(m_xFLineIndent->denormalize( m_xFLineIndent->get_value( FieldUnit::TWIP ) )) );
896  m_aExampleWin.SetLeftMargin( static_cast<tools::Long>(m_xLeftIndent->denormalize( m_xLeftIndent->get_value( FieldUnit::TWIP ) ) ) );
897  m_aExampleWin.SetRightMargin( static_cast<tools::Long>(m_xRightIndent->denormalize( m_xRightIndent->get_value( FieldUnit::TWIP ) ) ) );
898  m_aExampleWin.SetUpper( static_cast<sal_uInt16>(m_xTopDist->denormalize( m_xTopDist->get_value( FieldUnit::TWIP ) )) );
899  m_aExampleWin.SetLower( static_cast<sal_uInt16>(m_xBottomDist->denormalize( m_xBottomDist->get_value( FieldUnit::TWIP ) )) );
900 
901  int nPos = m_xLineDist->get_active();
902 
903  switch ( nPos )
904  {
905  case LLINESPACE_1:
906  case LLINESPACE_115:
907  case LLINESPACE_15:
908  case LLINESPACE_2:
909  case LLINESPACE_PROP:
910  case LLINESPACE_MIN:
911  case LLINESPACE_DURCH:
912  case LLINESPACE_FIX:
913  m_aExampleWin.SetLineSpace( static_cast<SvxPrevLineSpace>(nPos) );
914  break;
915  }
916  m_aExampleWin.Invalidate();
917 }
918 
920 {
921  m_xRegisterCB->show();
922 }
923 
925 {
926  m_xContextualCB->show();
927 }
928 
930 {
931  bool bEnable = !rBox.get_active();
932  m_xFLineLabel->set_sensitive(bEnable);
933  m_xFLineIndent->set_sensitive(bEnable);
934 }
935 
937 {
938  m_xAutoCB->show();
939 }
940 
942 {
943  m_xLineDist->append_text(sAbsDist);
944  nMinFixDist = nMinTwip;
945 }
946 
948 {
949 
950 /* different bit represent call to different method of SvxStdParagraphTabPage
951  0x0001 --->EnableRelativeMode()
952  0x0002 --->EnableRegisterMode()
953  0x0004 --->EnableAutoFirstLine()
954  0x0008 --->EnableNegativeMode()
955  0x0010 --->EnableContextualMode()
956  */
957  const SfxUInt16Item* pPageWidthItem = aSet.GetItem<SfxUInt16Item>(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH, false);
958  const SfxUInt32Item* pFlagSetItem = aSet.GetItem<SfxUInt32Item>(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET, false);
959  const SfxUInt32Item* pLineDistItem = aSet.GetItem<SfxUInt32Item>(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, false);
960 
961  if (pPageWidthItem)
962  nWidth = pPageWidthItem->GetValue();
963 
964  if (pFlagSetItem )
965  {
966  if (( 0x0001 & pFlagSetItem->GetValue())== 0x0001 )
968 
969  if (( 0x0002 & pFlagSetItem->GetValue())== 0x0002 )
971 
972  if ( ( 0x0004 & pFlagSetItem->GetValue())== 0x0004 )
974  }
975 
976  if(pLineDistItem)
977  EnableAbsLineDist(pLineDistItem->GetValue());
978 
979  if (pFlagSetItem)
980  {
981  if (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 )
983 
984  if (( 0x0010 & pFlagSetItem->GetValue()) == 0x0010 )
986  }
987 }
988 
989 #define LASTLINEPOS_DEFAULT 0
990 #define LASTLINEPOS_LEFT 1
991 
992 #define LASTLINECOUNT_OLD 3
993 #define LASTLINECOUNT_NEW 4
994 
996  : SfxTabPage(pPage, pController, "cui/ui/paragalignpage.ui", "ParaAlignPage", &rSet)
997  , m_xLeft(m_xBuilder->weld_radio_button("radioBTN_LEFTALIGN"))
998  , m_xRight(m_xBuilder->weld_radio_button("radioBTN_RIGHTALIGN"))
999  , m_xCenter(m_xBuilder->weld_radio_button("radioBTN_CENTERALIGN"))
1000  , m_xJustify(m_xBuilder->weld_radio_button("radioBTN_JUSTIFYALIGN"))
1001  , m_xLeftBottom(m_xBuilder->weld_label("labelST_LEFTALIGN_ASIAN"))
1002  , m_xRightTop(m_xBuilder->weld_label("labelST_RIGHTALIGN_ASIAN"))
1003  , m_xLastLineFT(m_xBuilder->weld_label("labelLB_LASTLINE"))
1004  , m_xLastLineLB(m_xBuilder->weld_combo_box("comboLB_LASTLINE"))
1005  , m_xExpandCB(m_xBuilder->weld_check_button("checkCB_EXPAND"))
1006  , m_xSnapToGridCB(m_xBuilder->weld_check_button("checkCB_SNAP"))
1007  , m_xExampleWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWN_EXAMPLE", m_aExampleWin))
1008  , m_xVertAlignFL(m_xBuilder->weld_widget("frameFL_VERTALIGN"))
1009  , m_xVertAlignLB(m_xBuilder->weld_combo_box("comboLB_VERTALIGN"))
1010  , m_xPropertiesFL(m_xBuilder->weld_widget("framePROPERTIES"))
1011  , m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("comboLB_TEXTDIRECTION")))
1012 {
1014 
1015  SvtLanguageOptions aLangOptions;
1016  sal_uInt16 nLastLinePos = LASTLINEPOS_DEFAULT;
1017 
1018  if ( aLangOptions.IsAsianTypographyEnabled() )
1019  {
1020  m_xLeft->set_label(m_xLeftBottom->get_label());
1021  m_xRight->set_label(m_xRightTop->get_label());
1022 
1023  OUString sLeft(m_xLeft->get_label());
1025 
1026  if (m_xLastLineLB->get_count() == LASTLINECOUNT_OLD)
1027  {
1028  m_xLastLineLB->remove(0);
1029  m_xLastLineLB->insert_text(0, sLeft);
1030  }
1031  else
1032  nLastLinePos = LASTLINEPOS_LEFT;
1033  }
1034 
1035  // remove "Default" or "Left" entry, depends on CJKOptions
1036  if (m_xLastLineLB->get_count() == LASTLINECOUNT_NEW)
1037  m_xLastLineLB->remove(nLastLinePos);
1038 
1039  Link<weld::ToggleButton&, void> aLink = LINK( this, SvxParaAlignTabPage, AlignHdl_Impl );
1040  m_xLeft->connect_toggled(aLink);
1041  m_xRight->connect_toggled(aLink);
1042  m_xCenter->connect_toggled(aLink);
1043  m_xJustify->connect_toggled(aLink);
1044  m_xLastLineLB->connect_changed(LINK(this, SvxParaAlignTabPage, LastLineHdl_Impl));
1045  m_xTextDirectionLB->connect_changed(LINK(this, SvxParaAlignTabPage, TextDirectionHdl_Impl));
1046 
1047  m_xTextDirectionLB->append(SvxFrameDirection::Environment, SvxResId(RID_SVXSTR_FRAMEDIR_SUPER));
1048  m_xTextDirectionLB->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_FRAMEDIR_LTR));
1049  m_xTextDirectionLB->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_FRAMEDIR_RTL));
1050 }
1051 
1053 {
1054 }
1055 
1057 {
1058  if ( _pSet )
1059  FillItemSet( _pSet );
1060  return DeactivateRC::LeavePage;
1061 }
1062 
1063 std::unique_ptr<SfxTabPage> SvxParaAlignTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
1064 {
1065  return std::make_unique<SvxParaAlignTabPage>(pPage, pController, *rSet);
1066 }
1067 
1069 {
1070  bool bModified = false;
1071 
1072  bool bAdj = false;
1073  SvxAdjust eAdjust = SvxAdjust::Left;
1074 
1075  if (m_xLeft->get_active())
1076  {
1077  eAdjust = SvxAdjust::Left;
1078  bAdj = m_xLeft->get_saved_state() == TRISTATE_FALSE;
1079  }
1080  else if (m_xRight->get_active())
1081  {
1082  eAdjust = SvxAdjust::Right;
1083  bAdj = m_xRight->get_saved_state() == TRISTATE_FALSE;
1084  }
1085  else if (m_xCenter->get_active())
1086  {
1087  eAdjust = SvxAdjust::Center;
1088  bAdj = m_xCenter->get_saved_state() == TRISTATE_FALSE;
1089  }
1090  else if (m_xJustify->get_active())
1091  {
1092  eAdjust = SvxAdjust::Block;
1093  bAdj = m_xJustify->get_saved_state() == TRISTATE_FALSE ||
1094  m_xExpandCB->get_state_changed_from_saved() ||
1095  m_xLastLineLB->get_value_changed_from_saved();
1096  }
1097 
1098  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
1099 
1100  if (bAdj)
1101  {
1102  SvxAdjust eOneWord = m_xExpandCB->get_active() ? SvxAdjust::Block : SvxAdjust::Left;
1103 
1104  int nLBPos = m_xLastLineLB->get_active();
1105  SvxAdjust eLastBlock = SvxAdjust::Left;
1106  if ( 1 == nLBPos )
1107  eLastBlock = SvxAdjust::Center;
1108  else if ( 2 == nLBPos )
1109  eLastBlock = SvxAdjust::Block;
1110 
1111  SvxAdjustItem aAdj( static_cast<const SvxAdjustItem&>(GetItemSet().Get( _nWhich )) );
1112  aAdj.SetAdjust( eAdjust );
1113  aAdj.SetOneWord( eOneWord );
1114  aAdj.SetLastBlock( eLastBlock );
1115  rOutSet->Put( aAdj );
1116  bModified = true;
1117  }
1118 
1119  if (m_xSnapToGridCB->get_state_changed_from_saved())
1120  {
1121  rOutSet->Put(SvxParaGridItem(m_xSnapToGridCB->get_active(), GetWhich( SID_ATTR_PARA_SNAPTOGRID )));
1122  bModified = true;
1123  }
1124 
1125  if (m_xVertAlignLB->get_value_changed_from_saved())
1126  {
1127  rOutSet->Put(SvxParaVertAlignItem(static_cast<SvxParaVertAlignItem::Align>(m_xVertAlignLB->get_active()), GetWhich( SID_PARA_VERTALIGN )));
1128  bModified = true;
1129  }
1130 
1131  if (m_xTextDirectionLB->get_visible())
1132  {
1133  if (m_xTextDirectionLB->get_value_changed_from_saved())
1134  {
1135  SvxFrameDirection eDir = m_xTextDirectionLB->get_active_id();
1136  rOutSet->Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
1137  bModified = true;
1138  }
1139  }
1140 
1141  return bModified;
1142 }
1143 
1145 {
1146  Reset( &rSet );
1147 }
1148 
1150 {
1151  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
1152  SfxItemState eItemState = rSet->GetItemState( _nWhich );
1153 
1154  sal_Int32 nLBSelect = 0;
1155  if ( eItemState >= SfxItemState::DEFAULT )
1156  {
1157  const SvxAdjustItem& rAdj = static_cast<const SvxAdjustItem&>(rSet->Get( _nWhich ));
1158 
1159  switch ( rAdj.GetAdjust() )
1160  {
1161  case SvxAdjust::Left: m_xLeft->set_active(true); break;
1162 
1163  case SvxAdjust::Right: m_xRight->set_active(true); break;
1164 
1165  case SvxAdjust::Center: m_xCenter->set_active(true); break;
1166 
1167  case SvxAdjust::Block: m_xJustify->set_active(true); break;
1168  default: ; //prevent warning
1169  }
1170  bool bEnable = m_xJustify->get_active();
1171  m_xLastLineFT->set_sensitive(bEnable);
1172  m_xLastLineLB->set_sensitive(bEnable);
1173 
1174  switch(rAdj.GetLastBlock())
1175  {
1176  case SvxAdjust::Left: nLBSelect = 0; break;
1177 
1178  case SvxAdjust::Center: nLBSelect = 1; break;
1179 
1180  case SvxAdjust::Block: nLBSelect = 2; break;
1181  default: ; //prevent warning
1182  }
1183  m_xExpandCB->set_sensitive(bEnable && nLBSelect == 2);
1184  m_xExpandCB->set_active(SvxAdjust::Block == rAdj.GetOneWord());
1185  }
1186  else
1187  {
1188  m_xLeft->set_active(false);
1189  m_xRight->set_active(false);
1190  m_xCenter->set_active(false);
1191  m_xJustify->set_active(false);
1192  }
1193  m_xLastLineLB->set_active(nLBSelect);
1194 
1195  sal_uInt16 nHtmlMode = GetHtmlMode_Impl(*rSet);
1196  if(nHtmlMode & HTMLMODE_ON)
1197  {
1198  m_xLastLineLB->hide();
1199  m_xLastLineFT->hide();
1200  m_xExpandCB->hide();
1201  if(!(nHtmlMode & HTMLMODE_FULL_STYLES) )
1202  m_xJustify->set_sensitive(false);
1203  m_xSnapToGridCB->hide();
1204  }
1205  _nWhich = GetWhich(SID_ATTR_PARA_SNAPTOGRID);
1206  eItemState = rSet->GetItemState( _nWhich );
1207  if ( eItemState >= SfxItemState::DEFAULT )
1208  {
1209  const SvxParaGridItem& rSnap = static_cast<const SvxParaGridItem&>(rSet->Get( _nWhich ));
1210  m_xSnapToGridCB->set_active(rSnap.GetValue());
1211  }
1212 
1213  _nWhich = GetWhich( SID_PARA_VERTALIGN );
1214  eItemState = rSet->GetItemState( _nWhich );
1215 
1216  if ( eItemState >= SfxItemState::DEFAULT )
1217  {
1218  m_xVertAlignFL->show();
1219 
1220  const SvxParaVertAlignItem& rAlign = static_cast<const SvxParaVertAlignItem&>(rSet->Get( _nWhich ));
1221 
1222  m_xVertAlignLB->set_active(static_cast<sal_Int32>(rAlign.GetValue()));
1223  }
1224 
1225  _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
1226  //text direction
1227  if( SfxItemState::DEFAULT <= rSet->GetItemState( _nWhich ) )
1228  {
1229  const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>( rSet->Get( _nWhich ) );
1230  m_xTextDirectionLB->set_active_id(rFrameDirItem.GetValue());
1231  m_xTextDirectionLB->save_value();
1232  }
1233 
1234  m_xSnapToGridCB->save_state();
1235  m_xVertAlignLB->save_value();
1236  m_xLeft->save_state();
1237  m_xRight->save_state();
1238  m_xCenter->save_state();
1239  m_xJustify->save_state();
1240  m_xLastLineLB->save_value();
1241  m_xExpandCB->save_state();
1242 
1244 }
1245 
1247 {
1248  m_xTextDirectionLB->save_value();
1249  m_xSnapToGridCB->save_state();
1250  m_xVertAlignLB->save_value();
1251  m_xLeft->save_state();
1252  m_xRight->save_state();
1253  m_xCenter->save_state();
1254  m_xJustify->save_state();
1255  m_xLastLineLB->save_value();
1256  m_xExpandCB->save_state();
1257 }
1258 
1260 {
1261  bool bJustify = m_xJustify->get_active();
1262  m_xLastLineFT->set_sensitive(bJustify);
1263  m_xLastLineLB->set_sensitive(bJustify);
1264  bool bLastLineIsBlock = m_xLastLineLB->get_active() == 2;
1265  m_xExpandCB->set_sensitive(bJustify && bLastLineIsBlock);
1266  //set last line listbox to entry position 0 if not enabled
1267  if (!m_xLastLineLB->get_sensitive())
1268  m_xLastLineLB->set_active(0);
1269  //uncheck 'Expand ... word' when check box is not enabled
1270  if (!m_xExpandCB->get_sensitive())
1271  m_xExpandCB->set_active(false);
1272  UpdateExample_Impl();
1273 }
1274 
1276 {
1277  //fdo#41350 only enable 'Expand last word' if last line is also justified
1278  bool bLastLineIsBlock = m_xLastLineLB->get_active() == 2;
1279  m_xExpandCB->set_sensitive(bLastLineIsBlock);
1280  //uncheck 'Expand ... word' when check box is not enabled
1281  if (!m_xExpandCB->get_sensitive())
1282  m_xExpandCB->set_active(false);
1283  UpdateExample_Impl();
1284 }
1285 
1286 IMPL_LINK_NOARG(SvxParaAlignTabPage, TextDirectionHdl_Impl, weld::ComboBox&, void)
1287 {
1288  UpdateExample_Impl();
1289 }
1290 
1292 {
1293  if (m_xLeft->get_active())
1294  {
1295  m_aExampleWin.EnableRTL(false);
1296  m_aExampleWin.SetAdjust(SvxAdjust::Left);
1297  m_aExampleWin.SetLastLine(SvxAdjust::Left);
1298  }
1299  else if (m_xRight->get_active())
1300  {
1301  m_aExampleWin.EnableRTL(true);
1302  m_aExampleWin.SetAdjust(SvxAdjust::Left);
1303  m_aExampleWin.SetLastLine(SvxAdjust::Left);
1304  }
1305  else
1306  {
1307  SvxFrameDirection eDir = m_xTextDirectionLB->get_active_id();
1308  switch ( eDir )
1309  {
1310  case SvxFrameDirection::Environment :
1311  if ( !m_xRight->get_active() )
1313  break;
1314  case SvxFrameDirection::Horizontal_RL_TB :
1315  if ( !m_xLeft->get_active() )
1316  m_aExampleWin.EnableRTL( true );
1317  break;
1318  case SvxFrameDirection::Horizontal_LR_TB :
1319  if ( !m_xRight->get_active() )
1320  m_aExampleWin.EnableRTL( false );
1321  break;
1322  default: ; //prevent warning
1323  }
1324  if (m_xCenter->get_active())
1325  m_aExampleWin.SetAdjust( SvxAdjust::Center );
1326  else if (m_xJustify->get_active())
1327  {
1328  m_aExampleWin.SetAdjust( SvxAdjust::Block );
1329  int nLBPos = m_xLastLineLB->get_active();
1330  if (nLBPos == 0)
1331  m_aExampleWin.SetLastLine(SvxAdjust::Left);
1332  else if (nLBPos == 1)
1333  m_aExampleWin.SetLastLine(SvxAdjust::Center);
1334  else if (nLBPos == 2)
1335  m_aExampleWin.SetLastLine(SvxAdjust::Block);
1336  }
1337  }
1338 
1339  m_aExampleWin.Invalidate();
1340 }
1341 
1343 {
1344  m_xLastLineFT->show();
1345  m_xLastLineLB->show();
1346  m_xExpandCB->show();
1347  SvtLanguageOptions aCJKOptions;
1348  if (aCJKOptions.IsAsianTypographyEnabled())
1349  m_xSnapToGridCB->show();
1350 
1351 }
1352 
1354 {
1355  const SfxBoolItem* pBoolItem = aSet.GetItem<SfxBoolItem>(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT, false);
1356  if (pBoolItem && pBoolItem->GetValue())
1357  EnableJustifyExt();
1358 }
1359 
1360 std::unique_ptr<SfxTabPage> SvxExtParagraphTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
1361 {
1362  return std::make_unique<SvxExtParagraphTabPage>(pPage, pController, *rSet);
1363 }
1364 
1366 {
1367  bool bModified = false;
1368  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
1369  const TriState eHyphenState = m_xHyphenBox->get_state();
1370  const SfxPoolItem* pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_HYPHENZONE );
1371 
1372  if ( m_xHyphenBox->get_state_changed_from_saved() ||
1373  m_xHyphenNoCapsBox->get_state_changed_from_saved() ||
1374  m_xExtHyphenBeforeBox->get_value_changed_from_saved() ||
1375  m_xExtHyphenAfterBox->get_value_changed_from_saved() ||
1376  m_xMaxHyphenEdit->get_value_changed_from_saved() )
1377  {
1378  SvxHyphenZoneItem aHyphen(
1379  static_cast<const SvxHyphenZoneItem&>(GetItemSet().Get( _nWhich )) );
1380  aHyphen.SetHyphen( eHyphenState == TRISTATE_TRUE );
1381  aHyphen.SetNoCapsHyphenation(m_xHyphenNoCapsBox->get_state() == TRISTATE_TRUE);
1382 
1383  if ( eHyphenState == TRISTATE_TRUE )
1384  {
1385  aHyphen.GetMinLead() = static_cast<sal_uInt8>(m_xExtHyphenBeforeBox->get_value());
1386  aHyphen.GetMinTrail() = static_cast<sal_uInt8>(m_xExtHyphenAfterBox->get_value());
1387  }
1388  aHyphen.GetMaxHyphens() = static_cast<sal_uInt8>(m_xMaxHyphenEdit->get_value());
1389 
1390  if ( !pOld ||
1391  *static_cast<const SvxHyphenZoneItem*>(pOld) != aHyphen ||
1392  m_xHyphenBox->get_state_changed_from_saved())
1393  {
1394  rOutSet->Put( aHyphen );
1395  bModified = true;
1396  }
1397  }
1398 
1399  if (m_xPageNumBox->get_sensitive()
1400  && (m_xPageNumBox->get_state_changed_from_saved() || m_xPagenumEdit->get_value_changed_from_saved()))
1401  {
1402  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_PAGENUM );
1403 
1404  if (TRISTATE_TRUE == m_xPageNumBox->get_state()
1405  && (!pOld || IsInvalidItem(pOld)
1406  || static_cast<const SfxUInt16Item*>(pOld)->GetValue() != m_xPagenumEdit->get_value()))
1407  {
1408  SfxUInt16Item aPageNum(SID_ATTR_PARA_PAGENUM,
1409  static_cast<sal_uInt16>(m_xPagenumEdit->get_value()));
1410  rOutSet->Put( aPageNum );
1411  bModified = true;
1412  }
1413  else if (TRISTATE_FALSE == m_xPageNumBox->get_state()
1414  && (pOld || IsInvalidItem(pOld)))
1415  {
1416  // need to tell sw to remove the item
1417  rOutSet->DisableItem(SID_ATTR_PARA_PAGENUM);
1418  bModified = true;
1419  }
1420  }
1421 
1422  // pagebreak
1423 
1424  TriState eState = m_xApplyCollBtn->get_state();
1425  bool bIsPageModel = false;
1426 
1427  _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
1428  OUString sPage;
1429  if ( m_xApplyCollBtn->get_state_changed_from_saved() ||
1430  ( TRISTATE_TRUE == eState &&
1431  m_xApplyCollBox->get_value_changed_from_saved() ) )
1432  {
1433  if ( eState == TRISTATE_TRUE )
1434  {
1435  sPage = m_xApplyCollBox->get_active_text();
1436  bIsPageModel = !sPage.isEmpty();
1437  }
1438  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_MODEL );
1439 
1440  if ( !pOld || static_cast<const SvxPageModelItem*>(pOld)->GetValue() != sPage )
1441  {
1442  rOutSet->Put( SvxPageModelItem( sPage, false, _nWhich ) );
1443  bModified = true;
1444  }
1445  else
1446  bIsPageModel = false;
1447  }
1448  else if(TRISTATE_TRUE == eState && m_xApplyCollBtn->get_sensitive())
1449  bIsPageModel = true;
1450  else
1451  rOutSet->Put( SvxPageModelItem( sPage, false, _nWhich ) );
1452 
1453  _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
1454 
1455  if ( bIsPageModel )
1456  // if PageModel is turned on, always turn off PageBreak
1457  rOutSet->Put( SvxFormatBreakItem( SvxBreak::NONE, _nWhich ) );
1458  else
1459  {
1460  eState = m_xPageBreakBox->get_state();
1461  SfxItemState eModelState = GetItemSet().GetItemState(SID_ATTR_PARA_MODEL, false);
1462 
1463  if ( (eModelState == SfxItemState::SET && TRISTATE_TRUE == m_xPageBreakBox->get_state()) ||
1464  m_xPageBreakBox->get_state_changed_from_saved() ||
1465  m_xBreakTypeLB->get_value_changed_from_saved() ||
1466  m_xBreakPositionLB->get_value_changed_from_saved() )
1467  {
1468  const SvxFormatBreakItem rOldBreak(
1469  static_cast<const SvxFormatBreakItem&>(GetItemSet().Get( _nWhich )));
1470  SvxFormatBreakItem aBreak(rOldBreak.GetBreak(), rOldBreak.Which());
1471 
1472  switch ( eState )
1473  {
1474  case TRISTATE_TRUE:
1475  {
1476  bool bBefore = m_xBreakPositionLB->get_active() == 0;
1477 
1478  if (m_xBreakTypeLB->get_active() == 0)
1479  {
1480  if ( bBefore )
1481  aBreak.SetValue( SvxBreak::PageBefore );
1482  else
1483  aBreak.SetValue( SvxBreak::PageAfter );
1484  }
1485  else
1486  {
1487  if ( bBefore )
1488  aBreak.SetValue( SvxBreak::ColumnBefore );
1489  else
1490  aBreak.SetValue( SvxBreak::ColumnAfter );
1491  }
1492  break;
1493  }
1494 
1495  case TRISTATE_FALSE:
1496  aBreak.SetValue( SvxBreak::NONE );
1497  break;
1498  default: ; //prevent warning
1499  }
1500  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_PAGEBREAK );
1501 
1502  if ( eState != m_xPageBreakBox->get_saved_state() ||
1503  !pOld || !( *static_cast<const SvxFormatBreakItem*>(pOld) == aBreak ) )
1504  {
1505  bModified = true;
1506  rOutSet->Put( aBreak );
1507  }
1508  }
1509  }
1510 
1511  // paragraph split
1512  _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
1513  eState = m_xKeepTogetherBox->get_state();
1514 
1515  if (m_xKeepTogetherBox->get_state_changed_from_saved())
1516  {
1517  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_SPLIT );
1518 
1519  if ( !pOld || static_cast<const SvxFormatSplitItem*>(pOld)->GetValue() !=
1520  ( eState == TRISTATE_FALSE ) )
1521  {
1522  rOutSet->Put( SvxFormatSplitItem( eState == TRISTATE_FALSE, _nWhich ) );
1523  bModified = true;
1524  }
1525  }
1526 
1527  // keep paragraphs
1528  _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
1529  eState = m_xKeepParaBox->get_state();
1530 
1531  if (m_xKeepParaBox->get_state_changed_from_saved())
1532  {
1533  // if the status has changed, putting is necessary
1534  rOutSet->Put( SvxFormatKeepItem( eState == TRISTATE_TRUE, _nWhich ) );
1535  bModified = true;
1536  }
1537 
1538  // widows and orphans
1539  _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
1540  eState = m_xWidowBox->get_state();
1541 
1542  if ( m_xWidowBox->get_state_changed_from_saved() ||
1543  m_xWidowRowNo->get_value_changed_from_saved() )
1544  {
1545  SvxWidowsItem rItem( eState == TRISTATE_TRUE ?
1546  static_cast<sal_uInt8>(m_xWidowRowNo->get_value()) : 0, _nWhich );
1547  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_WIDOWS );
1548 
1549  if ( m_xWidowBox->get_state_changed_from_saved() || !pOld || !( *static_cast<const SvxWidowsItem*>(pOld) == rItem ) )
1550  {
1551  rOutSet->Put( rItem );
1552  bModified = true;
1553  }
1554  }
1555 
1556  _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
1557  eState = m_xOrphanBox->get_state();
1558 
1559  if ( m_xOrphanBox->get_state_changed_from_saved() ||
1560  m_xOrphanRowNo->get_value_changed_from_saved() )
1561  {
1562  SvxOrphansItem rItem( eState == TRISTATE_TRUE ?
1563  static_cast<sal_uInt8>(m_xOrphanRowNo->get_value()) : 0, _nWhich );
1564  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_ORPHANS );
1565 
1566  if ( m_xOrphanBox->get_state_changed_from_saved() ||
1567  !pOld ||
1568  !( *static_cast<const SvxOrphansItem*>(pOld) == rItem ) )
1569  {
1570  rOutSet->Put( rItem );
1571  bModified = true;
1572  }
1573  }
1574 
1575  return bModified;
1576 }
1578 {
1579  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
1580  SfxItemState eItemState = rSet->GetItemState( _nWhich );
1581 
1582  bool bItemAvailable = eItemState >= SfxItemState::DEFAULT;
1583  bool bIsHyphen = false;
1584  if( !bHtmlMode && bItemAvailable )
1585  {
1586  const SvxHyphenZoneItem& rHyphen =
1587  static_cast<const SvxHyphenZoneItem&>(rSet->Get( _nWhich ));
1589 
1590  bIsHyphen = rHyphen.IsHyphen();
1591  m_xHyphenBox->set_state(bIsHyphen ? TRISTATE_TRUE : TRISTATE_FALSE);
1592  m_xHyphenNoCapsBox->set_state(rHyphen.IsNoCapsHyphenation() ? 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  m_xHyphenNoCapsBox->set_state(TRISTATE_INDET);
1602  }
1603  bool bEnable = bItemAvailable && bIsHyphen;
1604  m_xHyphenNoCapsBox->set_sensitive(bEnable);
1605  m_xExtHyphenBeforeBox->set_sensitive(bEnable);
1606  m_xExtHyphenAfterBox->set_sensitive(bEnable);
1607  m_xBeforeText->set_sensitive(bEnable);
1608  m_xAfterText->set_sensitive(bEnable);
1609  m_xMaxHyphenLabel->set_sensitive(bEnable);
1610  m_xMaxHyphenEdit->set_sensitive(bEnable);
1611 
1612  _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM );
1613 
1614  switch (rSet->GetItemState(_nWhich))
1615  {
1616  case SfxItemState::SET:
1617  {
1619  m_xPageNumBox->set_state(TRISTATE_TRUE);
1620  SfxUInt16Item const*const pItem(rSet->GetItem<SfxUInt16Item>(_nWhich));
1621  const sal_uInt16 nPageNum(pItem->GetValue());
1622  m_xPagenumEdit->set_value(nPageNum);
1623  break;
1624  }
1625  case SfxItemState::DONTCARE:
1626  {
1628  m_xPageNumBox->set_state(TRISTATE_INDET);
1629  break;
1630  }
1631  case SfxItemState::UNKNOWN:
1632  case SfxItemState::DEFAULT:
1633  case SfxItemState::DISABLED:
1634  {
1636  m_xPageNumBox->set_state(TRISTATE_FALSE);
1637  break;
1638  }
1639  default:
1640  assert(false); // unexpected
1641  break;
1642  }
1643 
1644  if ( bPageBreak )
1645  {
1646  // first handle PageModel
1647  _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
1648  bool bIsPageModel = false;
1649  eItemState = rSet->GetItemState( _nWhich );
1650 
1651  if ( eItemState >= SfxItemState::SET )
1652  {
1654 
1655  const SvxPageModelItem& rModel =
1656  static_cast<const SvxPageModelItem&>(rSet->Get( _nWhich ));
1657  const OUString& aStr( rModel.GetValue() );
1658 
1659  if (!aStr.isEmpty() && m_xApplyCollBox->find_text(aStr) != -1)
1660  {
1661  m_xApplyCollBox->set_active_text(aStr);
1662  m_xApplyCollBtn->set_state(TRISTATE_TRUE);
1663  bIsPageModel = true;
1664 
1665  m_xPageBreakBox->set_sensitive(true);
1667  m_xBreakTypeFT->set_sensitive(true);
1668  m_xBreakTypeLB->set_sensitive(true);
1669  m_xBreakPositionFT->set_sensitive(true);
1670  m_xBreakPositionLB->set_sensitive(true);
1671  m_xApplyCollBtn->set_sensitive(false);
1672  m_xPageBreakBox->set_state(TRISTATE_TRUE);
1673 
1674  //select page break
1675  m_xBreakTypeLB->set_active(0);
1676  //select break before
1677  m_xBreakPositionLB->set_active(0);
1678  }
1679  else
1680  {
1681  m_xApplyCollBox->set_active(-1);
1682  m_xApplyCollBtn->set_state(TRISTATE_FALSE);
1683  }
1684  }
1685  else if ( SfxItemState::DONTCARE == eItemState )
1686  {
1688  m_xApplyCollBtn->set_state(TRISTATE_INDET);
1689  m_xApplyCollBox->set_active(-1);
1690  }
1691  else
1692  {
1693  m_xApplyCollBtn->set_sensitive(false);
1694  m_xApplyCollBox->set_sensitive(false);
1695  m_xPagenumEdit->set_sensitive(false);
1696  m_xPageNumBox->set_sensitive(false);
1697  }
1698 
1699  if ( !bIsPageModel )
1700  {
1701  _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
1702  eItemState = rSet->GetItemState( _nWhich );
1703 
1704  if ( eItemState >= SfxItemState::DEFAULT )
1705  {
1706  const SvxFormatBreakItem& rPageBreak =
1707  static_cast<const SvxFormatBreakItem&>(rSet->Get( _nWhich ));
1708 
1709  SvxBreak eBreak = rPageBreak.GetBreak();
1710 
1711  // PageBreak not via CTRL-RETURN,
1712  // then CheckBox can be freed
1713  m_xPageBreakBox->set_sensitive(true);
1715  m_xBreakTypeFT->set_sensitive(true);
1716  m_xBreakTypeLB->set_sensitive(true);
1717  m_xBreakPositionFT->set_sensitive(true);
1718  m_xBreakPositionLB->set_sensitive(true);
1719 
1720  m_xPageBreakBox->set_state(TRISTATE_TRUE);
1721 
1722  bool _bEnable = eBreak != SvxBreak::NONE &&
1723  eBreak != SvxBreak::ColumnBefore &&
1724  eBreak != SvxBreak::ColumnAfter;
1725  m_xApplyCollBtn->set_sensitive(_bEnable);
1726  if (!_bEnable)
1727  {
1728  m_xApplyCollBox->set_sensitive(_bEnable);
1729  m_xPageNumBox->set_sensitive(false);
1730  m_xPagenumEdit->set_sensitive(_bEnable);
1731  }
1732 
1733  if ( eBreak == SvxBreak::NONE )
1734  m_xPageBreakBox->set_state(TRISTATE_FALSE);
1735 
1736  sal_Int32 nType = 0; // selection position in break type ListBox : Page
1737  sal_Int32 nPosition = 0; // selection position in break position ListBox : Before
1738  switch ( eBreak )
1739  {
1740  case SvxBreak::PageBefore:
1741  break;
1742  case SvxBreak::PageAfter:
1743  nPosition = 1;
1744  break;
1745  case SvxBreak::ColumnBefore:
1746  nType = 1;
1747  break;
1748  case SvxBreak::ColumnAfter:
1749  nType = 1;
1750  nPosition = 1;
1751  break;
1752  default: ;//prevent warning
1753  }
1754  m_xBreakTypeLB->set_active(nType);
1755  m_xBreakPositionLB->set_active(nPosition);
1756  }
1757  else if ( SfxItemState::DONTCARE == eItemState )
1758  m_xPageBreakBox->set_state(TRISTATE_INDET);
1759  else
1760  {
1761  m_xPageBreakBox->set_sensitive(false);
1762  m_xBreakTypeFT->set_sensitive(false);
1763  m_xBreakTypeLB->set_sensitive(false);
1764  m_xBreakPositionFT->set_sensitive(false);
1765  m_xBreakPositionLB->set_sensitive(false);
1766  }
1767  }
1768 
1769  PageBreakPosHdl_Impl(*m_xBreakPositionLB);
1770  PageBreakHdl();
1771  }
1772 
1773  _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
1774  eItemState = rSet->GetItemState( _nWhich );
1775 
1776  if ( eItemState >= SfxItemState::DEFAULT )
1777  {
1779  const SvxFormatKeepItem& rKeep =
1780  static_cast<const SvxFormatKeepItem&>(rSet->Get( _nWhich ));
1781 
1782  if ( rKeep.GetValue() )
1783  m_xKeepParaBox->set_state(TRISTATE_TRUE);
1784  else
1785  m_xKeepParaBox->set_state(TRISTATE_FALSE);
1786  }
1787  else if ( SfxItemState::DONTCARE == eItemState )
1788  m_xKeepParaBox->set_state(TRISTATE_INDET);
1789  else
1790  m_xKeepParaBox->set_sensitive(false);
1791 
1792  _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
1793  eItemState = rSet->GetItemState( _nWhich );
1794 
1795  if ( eItemState >= SfxItemState::DEFAULT )
1796  {
1797  const SvxFormatSplitItem& rSplit =
1798  static_cast<const SvxFormatSplitItem&>(rSet->Get( _nWhich ));
1800 
1801  if ( !rSplit.GetValue() )
1802  m_xKeepTogetherBox->set_state(TRISTATE_TRUE);
1803  else
1804  {
1805  m_xKeepTogetherBox->set_state(TRISTATE_FALSE);
1806 
1807  // widows and orphans
1808  m_xWidowBox->set_sensitive(true);
1809  _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
1810  SfxItemState eTmpState = rSet->GetItemState( _nWhich );
1811 
1812  if ( eTmpState >= SfxItemState::DEFAULT )
1813  {
1814  const SvxWidowsItem& rWidow =
1815  static_cast<const SvxWidowsItem&>(rSet->Get( _nWhich ));
1816  aWidowState.bTriStateEnabled = false;
1817  const sal_uInt16 nLines = rWidow.GetValue();
1818 
1819  bool _bEnable = nLines > 0;
1820  m_xWidowRowNo->set_value(m_xWidowRowNo->normalize(nLines));
1821  m_xWidowBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
1822  m_xWidowRowNo->set_sensitive(_bEnable);
1823  //m_xWidowRowLabel->set_sensitive(_bEnable);
1824 
1825  }
1826  else if ( SfxItemState::DONTCARE == eTmpState )
1827  m_xWidowBox->set_state( TRISTATE_INDET );
1828  else
1829  m_xWidowBox->set_sensitive(false);
1830 
1831  m_xOrphanBox->set_sensitive(true);
1832  _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
1833  eTmpState = rSet->GetItemState( _nWhich );
1834 
1835  if ( eTmpState >= SfxItemState::DEFAULT )
1836  {
1837  const SvxOrphansItem& rOrphan =
1838  static_cast<const SvxOrphansItem&>(rSet->Get( _nWhich ));
1839  const sal_uInt16 nLines = rOrphan.GetValue();
1841 
1842  bool _bEnable = nLines > 0;
1843  m_xOrphanBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
1844  m_xOrphanRowNo->set_value(m_xOrphanRowNo->normalize(nLines));
1845  m_xOrphanRowNo->set_sensitive(_bEnable);
1846  m_xOrphanRowLabel->set_sensitive(_bEnable);
1847 
1848  }
1849  else if ( SfxItemState::DONTCARE == eTmpState )
1850  m_xOrphanBox->set_state(TRISTATE_INDET);
1851  else
1852  m_xOrphanBox->set_sensitive(false);
1853  aOrphanState.eState = m_xOrphanBox->get_state();
1854  }
1855  }
1856  else if ( SfxItemState::DONTCARE == eItemState )
1857  m_xKeepTogetherBox->set_state(TRISTATE_INDET);
1858  else
1859  m_xKeepTogetherBox->set_sensitive(false);
1860 
1861  // so that everything is enabled correctly
1862  KeepTogetherHdl();
1863  WidowHdl();
1864  OrphanHdl();
1865  ChangesApplied();
1866 }
1868 {
1869  m_xHyphenBox->save_state();
1870  m_xHyphenNoCapsBox->save_state();
1871  m_xExtHyphenBeforeBox->set_value(m_xExtHyphenBeforeBox->get_value());
1872  m_xExtHyphenAfterBox->set_value(m_xExtHyphenAfterBox->get_value());
1873  m_xMaxHyphenEdit->set_value(m_xMaxHyphenEdit->get_value());
1874  m_xPageBreakBox->save_state();
1875  m_xBreakPositionLB->save_value();
1876  m_xBreakTypeLB->save_value();
1877  m_xApplyCollBtn->save_state();
1878  m_xApplyCollBox->save_value();
1879  m_xPageNumBox->save_state();
1880  m_xPagenumEdit->save_value();
1881  m_xKeepTogetherBox->save_state();
1882  m_xKeepParaBox->save_state();
1883  m_xWidowBox->save_state();
1884  m_xOrphanBox->save_state();
1885  m_xOrphanRowNo->save_value();
1886  m_xWidowRowNo->save_value();
1887 }
1888 
1890 {
1891  if ( _pSet )
1892  FillItemSet( _pSet );
1893  return DeactivateRC::LeavePage;
1894 }
1895 
1897 {
1898  bPageBreak = false;
1899  m_xPageBreakBox->set_sensitive(false);
1900  m_xBreakTypeLB->remove(0);
1901  m_xBreakPositionFT->set_sensitive(false);
1902  m_xBreakPositionLB->set_sensitive(false);
1903  m_xApplyCollBtn->set_sensitive(false);
1904  m_xApplyCollBox->set_sensitive(false);
1905  m_xPageNumBox->set_sensitive(false);
1906  m_xPagenumEdit->set_sensitive(false);
1907 }
1908 
1910  : SfxTabPage(pPage, pController, "cui/ui/textflowpage.ui", "TextFlowPage", &rAttr)
1911  , bPageBreak(true)
1912  , bHtmlMode(false)
1913  , nStdPos(0)
1914  // Hyphenation
1915  , m_xHyphenBox(m_xBuilder->weld_check_button("checkAuto"))
1916  , m_xHyphenNoCapsBox(m_xBuilder->weld_check_button("checkNoCaps"))
1917  , m_xBeforeText(m_xBuilder->weld_label("labelLineBegin"))
1918  , m_xExtHyphenBeforeBox(m_xBuilder->weld_spin_button("spinLineEnd"))
1919  , m_xAfterText(m_xBuilder->weld_label("labelLineEnd"))
1920  , m_xExtHyphenAfterBox(m_xBuilder->weld_spin_button("spinLineBegin"))
1921  , m_xMaxHyphenLabel(m_xBuilder->weld_label("labelMaxNum"))
1922  , m_xMaxHyphenEdit(m_xBuilder->weld_spin_button("spinMaxNum"))
1923  //Page break
1924  , m_xPageBreakBox(m_xBuilder->weld_check_button("checkInsert"))
1925  , m_xBreakTypeFT(m_xBuilder->weld_label("labelType"))
1926  , m_xBreakTypeLB(m_xBuilder->weld_combo_box("comboBreakType"))
1927  , m_xBreakPositionFT(m_xBuilder->weld_label("labelPosition"))
1928  , m_xBreakPositionLB(m_xBuilder->weld_combo_box("comboBreakPosition"))
1929  , m_xApplyCollBtn(m_xBuilder->weld_check_button("checkPageStyle"))
1930  , m_xApplyCollBox(m_xBuilder->weld_combo_box("comboPageStyle"))
1931  , m_xPageNumBox(m_xBuilder->weld_check_button("labelPageNum"))
1932  , m_xPagenumEdit(m_xBuilder->weld_spin_button("spinPageNumber"))
1933  // Options
1934  , m_xKeepTogetherBox(m_xBuilder->weld_check_button("checkSplitPara"))
1935  , m_xKeepParaBox(m_xBuilder->weld_check_button("checkKeepPara"))
1936  , m_xOrphanBox(m_xBuilder->weld_check_button("checkOrphan"))
1937  , m_xOrphanRowNo(m_xBuilder->weld_spin_button("spinOrphan"))
1938  , m_xOrphanRowLabel(m_xBuilder->weld_label("labelOrphan"))
1939  , m_xWidowBox(m_xBuilder->weld_check_button("checkWidow"))
1940  , m_xWidowRowNo(m_xBuilder->weld_spin_button("spinWidow"))
1941  , m_xWidowRowLabel(m_xBuilder->weld_label("labelWidow"))
1942 {
1943  // this page needs ExchangeSupport
1945 
1946  m_xHyphenBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, HyphenClickHdl_Impl));
1947  m_xPageBreakBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageBreakHdl_Impl));
1948  m_xKeepTogetherBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl));
1949  m_xWidowBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, WidowHdl_Impl));
1950  m_xOrphanBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, OrphanHdl_Impl));
1951  m_xApplyCollBtn->connect_toggled(LINK(this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl));
1952  m_xBreakTypeLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl));
1953  m_xBreakPositionLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl));
1954  m_xPageNumBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl));
1955  m_xKeepParaBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl));
1956 
1958  if ( pSh )
1959  {
1960  SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool();
1961  SfxStyleSheetBase* pStyle = pPool->First(SfxStyleFamily::Page);
1962  OUString aStdName;
1963 
1964  while( pStyle )
1965  {
1966  if ( aStdName.isEmpty() )
1967  // first style == standard style
1968  aStdName = pStyle->GetName();
1969  m_xApplyCollBox->append_text(pStyle->GetName());
1970  pStyle = pPool->Next();
1971  }
1972  nStdPos = m_xApplyCollBox->find_text(aStdName);
1973  }
1974 
1975  sal_uInt16 nHtmlMode = GetHtmlMode_Impl( rAttr );
1976  if ( !(nHtmlMode & HTMLMODE_ON) )
1977  return;
1978 
1979  bHtmlMode = true;
1980  m_xHyphenBox->set_sensitive(false);
1981  m_xHyphenNoCapsBox->set_sensitive(false);
1982  m_xBeforeText->set_sensitive(false);
1983  m_xExtHyphenBeforeBox->set_sensitive(false);
1984  m_xAfterText->set_sensitive(false);
1985  m_xExtHyphenAfterBox->set_sensitive(false);
1986  m_xMaxHyphenLabel->set_sensitive(false);
1987  m_xMaxHyphenEdit->set_sensitive(false);
1988  m_xPageNumBox->set_sensitive(false);
1989  m_xPagenumEdit->set_sensitive(false);
1990  // no column break in HTML
1991  m_xBreakTypeLB->remove(1);
1992 }
1993 
1995 {
1996 }
1997 
1999 {
2000  switch (m_xPageBreakBox->get_state())
2001  {
2002  case TRISTATE_TRUE:
2003  m_xBreakTypeFT->set_sensitive(true);
2004  m_xBreakTypeLB->set_sensitive(true);
2005  m_xBreakPositionFT->set_sensitive(true);
2006  m_xBreakPositionLB->set_sensitive(true);
2007 
2008  if (0 == m_xBreakTypeLB->get_active() && 0 == m_xBreakPositionLB->get_active())
2009  {
2010  m_xApplyCollBtn->set_sensitive(true);
2011 
2012  bool bEnable = TRISTATE_TRUE == m_xApplyCollBtn->get_state() &&
2013  m_xApplyCollBox->get_count();
2014  m_xApplyCollBox->set_sensitive(bEnable);
2015  if(!bHtmlMode)
2016  {
2017  m_xPageNumBox->set_sensitive(bEnable);
2018  m_xPagenumEdit->set_sensitive(bEnable && m_xPageNumBox->get_state() == TRISTATE_TRUE);
2019  }
2020  }
2021  break;
2022 
2023  case TRISTATE_FALSE:
2024  case TRISTATE_INDET:
2025  m_xApplyCollBtn->set_state(TRISTATE_FALSE);
2026  m_xApplyCollBtn->set_sensitive(false);
2027  m_xApplyCollBox->set_sensitive(false);
2028  m_xPageNumBox->set_sensitive(false);
2029  m_xPagenumEdit->set_sensitive(false);
2030  m_xBreakTypeFT->set_sensitive(false);
2031  m_xBreakTypeLB->set_sensitive(false);
2032  m_xBreakPositionFT->set_sensitive(false);
2033  m_xBreakPositionLB->set_sensitive(false);
2034  break;
2035  }
2036 }
2037 
2038 IMPL_LINK(SvxExtParagraphTabPage, PageBreakHdl_Impl, weld::ToggleButton&, rToggle, void)
2039 {
2040  aPageBreakState.ButtonToggled(rToggle);
2041  PageBreakHdl();
2042 }
2043 
2045 {
2046  bool bEnable = m_xKeepTogetherBox->get_state() == TRISTATE_FALSE;
2047  m_xWidowBox->set_sensitive(bEnable);
2048  m_xOrphanBox->set_sensitive(bEnable);
2049 }
2050 
2051 IMPL_LINK(SvxExtParagraphTabPage, KeepTogetherHdl_Impl, weld::ToggleButton&, rToggle, void)
2052 {
2053  aKeepTogetherState.ButtonToggled(rToggle);
2054  KeepTogetherHdl();
2055 }
2056 
2058 {
2059  switch (m_xWidowBox->get_state())
2060  {
2061  case TRISTATE_TRUE:
2062  m_xWidowRowNo->set_sensitive(true);
2063  m_xWidowRowLabel->set_sensitive(true);
2064  m_xKeepTogetherBox->set_sensitive(false);
2065  break;
2066  case TRISTATE_FALSE:
2067  if (m_xOrphanBox->get_state() == TRISTATE_FALSE)
2068  m_xKeepTogetherBox->set_sensitive(true);
2069  [[fallthrough]];
2070  case TRISTATE_INDET:
2071  m_xWidowRowNo->set_sensitive(false);
2072  m_xWidowRowLabel->set_sensitive(false);
2073  break;
2074  }
2075 }
2076 
2077 IMPL_LINK(SvxExtParagraphTabPage, WidowHdl_Impl, weld::ToggleButton&, rToggle, void)
2078 {
2079  aWidowState.ButtonToggled(rToggle);
2080  WidowHdl();
2081 }
2082 
2083 IMPL_LINK(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::ToggleButton&, rToggle, void)
2084 {
2085  aOrphanState.ButtonToggled(rToggle);
2086  OrphanHdl();
2087 }
2088 
2090 {
2091  switch (m_xOrphanBox->get_state())
2092  {
2093  case TRISTATE_TRUE:
2094  m_xOrphanRowNo->set_sensitive(true);
2095  m_xOrphanRowLabel->set_sensitive(true);
2096  m_xKeepTogetherBox->set_sensitive(false);
2097  break;
2098 
2099  case TRISTATE_FALSE:
2100  if (m_xWidowBox->get_state() == TRISTATE_FALSE)
2101  m_xKeepTogetherBox->set_sensitive(true);
2102  [[fallthrough]];
2103  case TRISTATE_INDET:
2104  m_xOrphanRowNo->set_sensitive(false);
2105  m_xOrphanRowLabel->set_sensitive(false);
2106  break;
2107  }
2108 }
2109 
2111 {
2112  bool bEnable = m_xHyphenBox->get_state() == TRISTATE_TRUE;
2113  m_xHyphenNoCapsBox->set_sensitive(bEnable);
2114  m_xBeforeText->set_sensitive(bEnable);
2115  m_xExtHyphenBeforeBox->set_sensitive(bEnable);
2116  m_xAfterText->set_sensitive(bEnable);
2117  m_xExtHyphenAfterBox->set_sensitive(bEnable);
2118  m_xMaxHyphenLabel->set_sensitive(bEnable);
2119  m_xMaxHyphenEdit->set_sensitive(bEnable);
2120  m_xHyphenBox->set_state(bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
2121 }
2122 
2123 IMPL_LINK(SvxExtParagraphTabPage, HyphenClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2124 {
2125  aHyphenState.ButtonToggled(rToggle);
2126  HyphenClickHdl();
2127 }
2128 
2130 {
2131  bool bEnable = false;
2132  if (m_xApplyCollBtn->get_state() == TRISTATE_TRUE && m_xApplyCollBox->get_count())
2133  {
2134  bEnable = true;
2135  m_xApplyCollBox->set_active(nStdPos);
2136  }
2137  else
2138  {
2139  m_xApplyCollBox->set_active(-1);
2140  }
2141  m_xApplyCollBox->set_sensitive(bEnable);
2142  if (!bHtmlMode)
2143  {
2144  m_xPageNumBox->set_sensitive(bEnable);
2145  m_xPagenumEdit->set_sensitive(bEnable && m_xPageNumBox->get_state() == TRISTATE_TRUE);
2146  }
2147 }
2148 
2149 IMPL_LINK(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2150 {
2151  aApplyCollState.ButtonToggled(rToggle);
2152  ApplyCollClickHdl();
2153 }
2154 
2155 IMPL_LINK(SvxExtParagraphTabPage, PageBreakPosHdl_Impl, weld::ComboBox&, rListBox, void)
2156 {
2157  if (0 == rListBox.get_active())
2158  {
2159  m_xApplyCollBtn->set_sensitive(true);
2160 
2161  bool bEnable = m_xApplyCollBtn->get_state() == TRISTATE_TRUE && m_xApplyCollBox->get_count();
2162 
2163  m_xApplyCollBox->set_sensitive(bEnable);
2164  if (!bHtmlMode)
2165  {
2166  m_xPageNumBox->set_sensitive(bEnable);
2167  m_xPagenumEdit->set_sensitive(bEnable && m_xPageNumBox->get_state() == TRISTATE_TRUE);
2168  }
2169  }
2170  else if (1 == rListBox.get_active())
2171  {
2172  m_xApplyCollBtn->set_state(TRISTATE_FALSE);
2173  m_xApplyCollBtn->set_sensitive(false);
2174  m_xApplyCollBox->set_sensitive(false);
2175  m_xPageNumBox->set_sensitive(false);
2176  m_xPagenumEdit->set_sensitive(false);
2177  }
2178 }
2179 
2180 IMPL_LINK(SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, weld::ComboBox&, rListBox, void)
2181 {
2182  //column break or break after
2183  int nBreakPos = m_xBreakPositionLB->get_active();
2184  if (rListBox.get_active() == 1 || 1 == nBreakPos)
2185  {
2186  m_xApplyCollBtn->set_state(TRISTATE_FALSE);
2187  m_xApplyCollBtn->set_sensitive(false);
2188  m_xApplyCollBox->set_sensitive(false);
2189  m_xPageNumBox->set_sensitive(false);
2190  m_xPagenumEdit->set_sensitive(false);
2191  }
2192  else
2193  PageBreakPosHdl_Impl(*m_xBreakPositionLB);
2194 }
2195 
2197 {
2198  m_xPagenumEdit->set_sensitive(m_xPageNumBox->get_state() == TRISTATE_TRUE);
2199 }
2200 
2201 IMPL_LINK(SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2202 {
2203  aPageNumState.ButtonToggled(rToggle);
2204  PageNumBoxClickHdl();
2205 }
2206 
2207 IMPL_LINK(SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2208 {
2209  aKeepParaState.ButtonToggled(rToggle);
2210 }
2211 
2213 {
2214  const SfxBoolItem* pDisablePageBreakItem = aSet.GetItem<SfxBoolItem>(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK, false);
2215 
2216  if (pDisablePageBreakItem)
2217  if ( pDisablePageBreakItem->GetValue())
2218  DisablePageBreak();
2219 }
2220 
2222  : SfxTabPage(pPage, pController, "cui/ui/asiantypography.ui", "AsianTypography", &rSet)
2223  , m_xForbiddenRulesCB(m_xBuilder->weld_check_button("checkForbidList"))
2224  , m_xHangingPunctCB(m_xBuilder->weld_check_button("checkHangPunct"))
2225  , m_xScriptSpaceCB(m_xBuilder->weld_check_button("checkApplySpacing"))
2226 {
2227 }
2228 
2230 {
2231 }
2232 
2233 std::unique_ptr<SfxTabPage> SvxAsianTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
2234 {
2235  return std::make_unique<SvxAsianTabPage>(pPage, pController, *rSet);
2236 }
2237 
2238 const sal_uInt16* SvxAsianTabPage::GetRanges()
2239 {
2240  static const sal_uInt16 pRanges[] =
2241  {
2242  SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES,
2243  0
2244  };
2245  return pRanges;
2246 }
2247 
2249 {
2250  bool bRet = false;
2251  SfxItemPool* pPool = rSet->GetPool();
2252  if (m_xScriptSpaceCB->get_sensitive() && m_xScriptSpaceCB->get_state_changed_from_saved())
2253  {
2254  std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
2255  pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone()));
2256  pNewItem->SetValue(m_xScriptSpaceCB->get_active());
2257  rSet->Put(std::move(pNewItem));
2258  bRet = true;
2259  }
2260  if (m_xHangingPunctCB->get_sensitive() && m_xHangingPunctCB->get_state_changed_from_saved())
2261  {
2262  std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
2263  pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone()));
2264  pNewItem->SetValue(m_xHangingPunctCB->get_active());
2265  rSet->Put(std::move(pNewItem));
2266  bRet = true;
2267  }
2268  if (m_xForbiddenRulesCB->get_sensitive() && m_xForbiddenRulesCB->get_state_changed_from_saved())
2269  {
2270  std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
2271  pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone()));
2272  pNewItem->SetValue(m_xForbiddenRulesCB->get_active());
2273  rSet->Put(std::move(pNewItem));
2274  bRet = true;
2275  }
2276  return bRet;
2277 }
2278 
2279 static void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, weld::CheckButton& rBox)
2280 {
2281  sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId);
2282  SfxItemState eState = rSet.GetItemState(_nWhich);
2283  if( eState == SfxItemState::UNKNOWN || eState == SfxItemState::DISABLED )
2284  rBox.set_sensitive(false);
2285  else if(eState >= SfxItemState::DEFAULT)
2286  rBox.set_active(static_cast<const SfxBoolItem&>(rSet.Get(_nWhich)).GetValue());
2287  else
2288  rBox.set_state(TRISTATE_INDET);
2289  rBox.save_state();
2290 }
2291 
2293 {
2294  lcl_SetBox(*rSet, SID_ATTR_PARA_FORBIDDEN_RULES, *m_xForbiddenRulesCB );
2295  lcl_SetBox(*rSet, SID_ATTR_PARA_HANGPUNCTUATION, *m_xHangingPunctCB );
2296 
2297  //character distance not yet available
2298  lcl_SetBox(*rSet, SID_ATTR_PARA_SCRIPTSPACE, *m_xScriptSpaceCB );
2299 }
2300 
2302 {
2303  m_xForbiddenRulesCB->save_state();
2304  m_xHangingPunctCB->save_state();
2305  m_xScriptSpaceCB->save_state();
2306 }
2307 
2308 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::CheckButton > m_xRegisterCB
Definition: paragrph.hxx:76
bool GetValue() const
SvxBreak
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
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:675
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: paragrph.cxx:666
weld::TriStateEnabled aOrphanState
Definition: paragrph.hxx:218
void SetAdjust(SvxAdjust eNew)
bool Insert(const SvxTabStop &rTab)
FieldUnit
#define LLINESPACE_1
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
sal_uInt16 GetPropLineSpace() const
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: paragrph.cxx:2212
void SetHyphen(const bool bNew)
std::unique_ptr< weld::Label > m_xWidowRowLabel
Definition: paragrph.hxx:257
virtual SfxBoolItem * Clone(SfxItemPool *=nullptr) const override
sal_uInt16 GetLower() const
SvxAdjust GetAdjust() const
std::unique_ptr< weld::ComboBox > m_xLineDist
Definition: paragrph.hxx:69
void SetLower(sal_uInt16 nNew)
void SetInterLineSpace(const short nSpace)
virtual void ChangesApplied() override
Definition: paragrph.cxx:1867
void SetFirstLineOffset(short nNew)
std::unique_ptr< weld::RadioButton > m_xLeft
Definition: paragrph.hxx:129
std::unique_ptr< weld::MetricSpinButton > m_xLineDistAtPercentBox
Definition: paragrph.hxx:70
void SetRightMargin(tools::Long nNew)
std::unique_ptr< weld::CheckButton > m_xHyphenNoCapsBox
Definition: paragrph.hxx:227
std::string GetValue
bool IsAsianTypographyEnabled() const
IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox &, rBox, void)
Definition: paragrph.cxx:797
std::unique_ptr< weld::Label > m_xBreakPositionFT
Definition: paragrph.hxx:239
std::unique_ptr< weld::Label > m_xOrphanRowLabel
Definition: paragrph.hxx:253
SvxBreak GetBreak() const
bool IsNoCapsHyphenation() const
std::unique_ptr< weld::ComboBox > m_xApplyCollBox
Definition: paragrph.hxx:242
long Long
tools::Long GetRight() const
#define LLINESPACE_15
virtual void Reset(const SfxItemSet *rSet) override
Definition: paragrph.cxx:420
std::unique_ptr< weld::CheckButton > m_xWidowBox
Definition: paragrph.hxx:255
constexpr OUStringLiteral PERCENT(u"Percent")
#define LASTLINECOUNT_OLD
Definition: paragrph.cxx:992
virtual ~SvxExtParagraphTabPage() override
Definition: paragrph.cxx:1994
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: paragrph.cxx:1144
sal_uInt16 GetPropTextFirstLineOffset() const
SvxExtParagraphTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: paragrph.cxx:1909
sal_uInt16 GetValue() const
std::unique_ptr< weld::CheckButton > m_xHangingPunctCB
Definition: paragrph.hxx:284
weld::TriStateEnabled aApplyCollState
Definition: paragrph.hxx:214
std::unique_ptr< weld::RadioButton > m_xRight
Definition: paragrph.hxx:130
void EnableAbsLineDist(tools::Long nMinTwip)
Definition: paragrph.cxx:941
std::unique_ptr< weld::CheckButton > m_xSnapToGridCB
Definition: paragrph.hxx:140
std::unique_ptr< weld::Label > m_xAfterText
Definition: paragrph.hxx:230
std::unique_ptr< weld::ComboBox > m_xBreakTypeLB
Definition: paragrph.hxx:238
std::unique_ptr< SvxRelativeField > m_xLeftIndent
Definition: paragrph.hxx:54
SvxFrameDirection
tools::Long nMinFixDist
Definition: paragrph.hxx:47
static const sal_uInt16 pStdRanges[]
Definition: paragrph.hxx:43
static SfxObjectShell * Current()
#define MAX_DURCH
Definition: paragrph.cxx:83
std::unique_ptr< weld::Label > m_xLeftBottom
Definition: paragrph.hxx:133
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:629
SvxLineSpaceRule GetLineSpaceRule() const
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: paragrph.cxx:2248
std::unique_ptr< SvxRelativeField > m_xRightIndent
Definition: paragrph.hxx:57
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
std::unique_ptr< weld::SpinButton > m_xWidowRowNo
Definition: paragrph.hxx:256
void SetLastBlock(const SvxAdjust eType)
virtual SfxStyleSheetBasePool * GetStyleSheetPool()
std::unique_ptr< SvxRelativeField > m_xBottomDist
Definition: paragrph.hxx:65
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
sal_uInt8 & GetMinLead()
static sal_uInt16 GetHtmlMode_Impl(const SfxItemSet &rSet)
Definition: paragrph.cxx:153
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
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:1063
#define LASTLINEPOS_DEFAULT
Definition: paragrph.cxx:989
const OUString & GetName() const
OUString SvxResId(const char *pId)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual void ChangesApplied() override
Definition: paragrph.cxx:2301
void SetExchangeSupport()
void SetOneWord(const SvxAdjust eType)
void SetUpper(sal_uInt16 nNew)
weld::TriStateEnabled aPageBreakState
Definition: paragrph.hxx:213
std::unique_ptr< svx::FrameDirectionListBox > m_xTextDirectionLB
Definition: paragrph.hxx:149
std::unique_ptr< weld::Label > m_xMaxHyphenLabel
Definition: paragrph.hxx:232
std::unique_ptr< weld::SpinButton > m_xExtHyphenBeforeBox
Definition: paragrph.hxx:229
std::unique_ptr< weld::Label > m_xLastLineFT
Definition: paragrph.hxx:136
tools::Long nWidth
Definition: paragrph.hxx:46
TRISTATE_INDET
virtual ~SvxAsianTabPage() override
Definition: paragrph.cxx:2229
virtual void set_active(bool active)=0
SvxParaPrevWindow m_aExampleWin
Definition: paragrph.hxx:126
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
virtual ~SvxStdParagraphTabPage() override
Definition: paragrph.cxx:708
SfxItemPool & GetPool() const
std::unique_ptr< weld::CheckButton > m_xForbiddenRulesCB
Definition: paragrph.hxx:283
const SfxItemSet & GetItemSet() const
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: paragrph.cxx:1365
sal_uInt16 GetPropRight() const
std::unique_ptr< weld::SpinButton > m_xOrphanRowNo
Definition: paragrph.hxx:252
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
std::unique_ptr< weld::CheckButton > m_xKeepParaBox
Definition: paragrph.hxx:248
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: paragrph.cxx:2233
tools::Long GetTextLeft() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxItemSet * GetParent() const
std::unique_ptr< weld::CheckButton > m_xApplyCollBtn
Definition: paragrph.hxx:241
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:1577
SvxAdjust
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
std::unique_ptr< weld::Label > m_xRightTop
Definition: paragrph.hxx:134
LineSpaceList
Definition: paragrph.cxx:89
std::unique_ptr< weld::CheckButton > m_xContextualCB
Definition: paragrph.hxx:66
std::unique_ptr< weld::Label > m_xBeforeText
Definition: paragrph.hxx:228
#define LLINESPACE_DURCH
#define LASTLINEPOS_LEFT
Definition: paragrph.cxx:990
std::unique_ptr< weld::ComboBox > m_xBreakPositionLB
Definition: paragrph.hxx:240
std::unique_ptr< weld::CheckButton > m_xScriptSpaceCB
Definition: paragrph.hxx:285
std::unique_ptr< weld::MetricSpinButton > m_xLineDistAtMetricBox
Definition: paragrph.hxx:71
std::unique_ptr< weld::SpinButton > m_xMaxHyphenEdit
Definition: paragrph.hxx:233
std::unique_ptr< weld::SpinButton > m_xPagenumEdit
Definition: paragrph.hxx:244
TRISTATE_FALSE
#define LLINESPACE_FIX
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
HTMLMODE_ON
sal_uInt16 GetPropLeft() const
Align GetValue() const
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
SvxAdjust GetLastBlock() const
std::unique_ptr< weld::RadioButton > m_xJustify
Definition: paragrph.hxx:132
SvxAsianTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: paragrph.cxx:2221
#define LLINESPACE_MIN
static bool GetLayoutRTL()
std::unique_ptr< weld::Label > m_xBreakTypeFT
Definition: paragrph.hxx:237
SvxInterLineSpaceRule GetInterLineSpaceRule() const
short GetTextFirstLineOffset() const
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: paragrph.cxx:1889
std::unique_ptr< weld::RadioButton > m_xCenter
Definition: paragrph.hxx:131
SvxParaPrevWindow m_aExampleWin
Definition: paragrph.hxx:51
virtual void ChangesApplied() override
Definition: paragrph.cxx:1246
void SetAdjust(const SvxAdjust eType)
#define LLINESPACE_2
void SetMetricValue(weld::MetricSpinButton &rField, int nCoreValue, MapUnit eUnit)
virtual void ChangesApplied() override
Definition: paragrph.cxx:602
SfxItemPool * GetPool() const
static const sal_uInt16 pExtRanges[]
Definition: paragrph.hxx:192
short GetInterLineSpace() const
std::unique_ptr< weld::SpinButton > m_xExtHyphenAfterBox
Definition: paragrph.hxx:231
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: paragrph.cxx:947
weld::TriStateEnabled aPageNumState
Definition: paragrph.hxx:215
weld::TriStateEnabled aKeepParaState
Definition: paragrph.hxx:217
void SetNoCapsHyphenation(const bool bNew)
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)
static void lcl_SetBox(const SfxItemSet &rSet, sal_uInt16 nSlotId, weld::CheckButton &rBox)
Definition: paragrph.cxx:2279
weld::TriStateEnabled aHyphenState
Definition: paragrph.hxx:212
#define MM50
weld::TriStateEnabled aKeepTogetherState
Definition: paragrph.hxx:216
virtual void Reset(const SfxItemSet *rSet) override
Definition: paragrph.cxx:2292
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:146
std::unique_ptr< weld::CheckButton > m_xAutoCB
Definition: paragrph.hxx:61
unsigned char sal_uInt8
void SetLineHeight(const sal_uInt16 nHeight)
void SetLineSpace(SvxPrevLineSpace eNew)
std::unique_ptr< weld::CheckButton > m_xOrphanBox
Definition: paragrph.hxx:251
SfxStyleSheetBase * Next()
std::unique_ptr< weld::CheckButton > m_xKeepTogetherBox
Definition: paragrph.hxx:247
virtual ~SvxParaAlignTabPage() override
Definition: paragrph.cxx:1052
std::unique_ptr< weld::Label > m_xAbsDist
Definition: paragrph.hxx:73
void SetContextValue(const bool bC)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: paragrph.cxx:1056
std::unique_ptr< weld::Widget > m_xVertAlignFL
Definition: paragrph.hxx:145
#define LASTLINECOUNT_NEW
Definition: paragrph.cxx:993
bool IsHyphen() const
weld::TriStateEnabled aWidowState
Definition: paragrph.hxx:219
QPRO_FUNC_TYPE nType
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: paragrph.cxx:1353
void SetLeftMargin(tools::Long nNew)
std::unique_ptr< weld::ComboBox > m_xLastLineLB
Definition: paragrph.hxx:137
void SetLastLine(SvxAdjust eNew)
static const sal_uInt16 * GetRanges()
Definition: paragrph.cxx:2238
#define FIX_DIST_DEF
Definition: paragrph.cxx:85
DeactivateRC
FieldUnit MapToFieldUnit(const MapUnit eUnit)
IMPL_LINK_NOARG(SvxStdParagraphTabPage, ELRLoseFocusHdl, weld::MetricSpinButton &, void)
Definition: paragrph.cxx:207
HTMLMODE_FULL_STYLES
MapUnit
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
std::unique_ptr< weld::CheckButton > m_xPageNumBox
Definition: paragrph.hxx:243
void set_state(TriState eState)
static OUString EraseAllMnemonicChars(const OUString &rStr)
std::unique_ptr< SvxRelativeField > m_xTopDist
Definition: paragrph.hxx:64
std::unique_ptr< weld::CheckButton > m_xExpandCB
Definition: paragrph.hxx:138
std::unique_ptr< SvxRelativeField > m_xFLineIndent
Definition: paragrph.hxx:60
static void SetLineSpace_Impl(SvxLineSpacingItem &, int, tools::Long lValue=0)
Definition: paragrph.cxx:105
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: paragrph.cxx:1068
bool IsInvalidItem(const SfxPoolItem *pItem)
void SetAutoFirst(const bool bNew)
std::unique_ptr< weld::CheckButton > m_xHyphenBox
Definition: paragrph.hxx:226
#define LLINESPACE_PROP
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: paragrph.cxx:1360
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: paragrph.cxx:217
TriState
static const sal_uInt16 pAlignRanges[]
Definition: paragrph.hxx:124
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
bool GetApplyCharUnit(const SfxItemSet &rSet)
bool IsAutoFirst() const
aStr
void SetLineSpacing_Impl(const SvxLineSpacingItem &rAttr)
Definition: paragrph.cxx:721
#define LLINESPACE_115
sal_uInt8 & GetMinTrail()
SvxParaAlignTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: paragrph.cxx:995
bool GetContext() const
virtual void Reset(const SfxItemSet *rSet) override
Definition: paragrph.cxx:1149
sal_uInt16 nPos
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:236
sal_uInt16 GetUpper() const
sal_uInt16 GetPropUpper() const