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