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