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