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