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 <svx/flagsdef.hxx>
26 #include <svx/svxids.hrc>
27 
28 #include <svl/languageoptions.hxx>
29 #include <svl/cjkoptions.hxx>
30 #include <editeng/pgrditem.hxx>
31 #include <svx/strings.hrc>
32 #include <svx/dialmgr.hxx>
33 #include <paragrph.hxx>
34 #include <editeng/frmdiritem.hxx>
35 #include <editeng/lspcitem.hxx>
36 #include <editeng/adjustitem.hxx>
37 #include <editeng/orphitem.hxx>
38 #include <editeng/widwitem.hxx>
39 #include <editeng/tstpitem.hxx>
40 #include <editeng/pmdlitem.hxx>
41 #include <editeng/spltitem.hxx>
43 #include <editeng/ulspitem.hxx>
44 #include <editeng/lrspitem.hxx>
46 #include <editeng/keepitem.hxx>
47 #include <svx/dlgutil.hxx>
48 #include <sfx2/htmlmode.hxx>
50 #include <svl/eitem.hxx>
51 #include <svl/intitem.hxx>
52 
53 #include <sfx2/viewfrm.hxx>
54 
55 const sal_uInt16 SvxStdParagraphTabPage::pStdRanges[] =
56 {
57  SID_ATTR_PARA_LINESPACE, // 10033
58  SID_ATTR_PARA_LINESPACE,
59  SID_ATTR_LRSPACE, // 10048 -
60  SID_ATTR_ULSPACE, // 10049
61  SID_ATTR_PARA_REGISTER, // 10413
62  SID_ATTR_PARA_REGISTER,
63  0
64 };
65 
66 const sal_uInt16 SvxParaAlignTabPage::pAlignRanges[] =
67 {
68  SID_ATTR_PARA_ADJUST, // 10027
69  SID_ATTR_PARA_ADJUST,
70  0
71 };
72 
73 const sal_uInt16 SvxExtParagraphTabPage::pExtRanges[] =
74 {
75  SID_ATTR_PARA_PAGEBREAK, // 10037 -
76  SID_ATTR_PARA_WIDOWS, // 10041
77  SID_ATTR_PARA_MODEL, // 10065 -
78  SID_ATTR_PARA_KEEP, // 10066
79  0
80 };
81 
82 #define MAX_DURCH 5670 // 10 cm makes sense as maximum interline lead
83  // according to BP
84 #define FIX_DIST_DEF 283 // standard fix distance 0,5 cm
85 
87 {
96 };
97 
98 static void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 );
99 
101  int eSpace, long lValue )
102 {
103  switch ( eSpace )
104  {
105  case LLINESPACE_1:
106  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
107  rLineSpace.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off );
108  break;
109 
110  case LLINESPACE_115:
111  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
112  rLineSpace.SetPropLineSpace( 115 );
113  break;
114 
115  case LLINESPACE_15:
116  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
117  rLineSpace.SetPropLineSpace( 150 );
118  break;
119 
120  case LLINESPACE_2:
121  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
122  rLineSpace.SetPropLineSpace( 200 );
123  break;
124 
125  case LLINESPACE_PROP:
126  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
127  rLineSpace.SetPropLineSpace( static_cast<sal_uInt16>(lValue) );
128  break;
129 
130  case LLINESPACE_MIN:
131  rLineSpace.SetLineHeight( static_cast<sal_uInt16>(lValue) );
132  rLineSpace.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off );
133  break;
134 
135  case LLINESPACE_DURCH:
136  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto );
137  rLineSpace.SetInterLineSpace( static_cast<sal_uInt16>(lValue) );
138  break;
139 
140  case LLINESPACE_FIX:
141  rLineSpace.SetLineHeight(static_cast<sal_uInt16>(lValue));
142  rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Fix );
143  rLineSpace.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off );
144  break;
145  }
146 }
147 
148 static sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet)
149 {
150  sal_uInt16 nHtmlMode = 0;
151  const SfxPoolItem* pItem = nullptr;
152  SfxObjectShell* pShell;
153  if(SfxItemState::SET == rSet.GetItemState(SID_HTML_MODE, false, &pItem) ||
154  ( nullptr != (pShell = SfxObjectShell::Current()) &&
155  nullptr != (pItem = pShell->GetItem(SID_HTML_MODE))))
156  {
157  nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
158  }
159  return nHtmlMode;
160 
161 }
162 
164 {
165  SfxItemPool* pPool = GetItemSet().GetPool();
166  DBG_ASSERT( pPool, "Where is the pool?" );
167  FieldUnit eUnit =
168  MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
169 
170  sal_Int64 nL = m_xLeftIndent->denormalize(m_xLeftIndent->get_value(eUnit));
171  sal_Int64 nR = m_xRightIndent->denormalize(m_xRightIndent->get_value(eUnit));
172  OUString aTmp = m_xFLineIndent->get_text();
173 
174  if (m_xLeftIndent->get_min(FieldUnit::NONE) < 0)
175  m_xFLineIndent->set_min(-99999, FieldUnit::MM);
176  else
177  m_xFLineIndent->set_min(m_xFLineIndent->normalize(-nL), eUnit);
178 
179  // Check only for concrete width (Shell)
180  sal_Int64 nTmp = nWidth - nL - nR - MM50;
181  m_xFLineIndent->set_max(m_xFLineIndent->normalize(nTmp), eUnit);
182 
183  if (aTmp.isEmpty())
184  m_xFLineIndent->set_text(OUString());
185  // maximum left right
186  aTmp = m_xLeftIndent->get_text();
187  nTmp = nWidth - nR - MM50;
188  m_xLeftIndent->set_max(m_xLeftIndent->normalize(nTmp), eUnit);
189 
190  if ( aTmp.isEmpty() )
191  m_xLeftIndent->set_text(OUString());
192  aTmp = m_xRightIndent->get_text();
193  nTmp = nWidth - nL - MM50;
194  m_xRightIndent->set_max(m_xRightIndent->normalize(nTmp), eUnit);
195 
196  if ( aTmp.isEmpty() )
197  m_xRightIndent->set_text(OUString());
198 
200 }
201 
203 {
204  ELRLoseFocus();
205 }
206 
208 {
209  return VclPtr<SvxStdParagraphTabPage>::Create(pParent, *rSet);
210 }
211 
213 {
214  SfxItemState eState = SfxItemState::UNKNOWN;
215  const SfxPoolItem* pOld = nullptr;
216  SfxItemPool* pPool = rOutSet->GetPool();
217  DBG_ASSERT( pPool, "Where is the pool?" );
218 
219  bool bModified = false;
220  sal_uInt16 nWhich;
221  int nPos = m_xLineDist->get_active();
222 
223  if ( nPos != -1 &&
224  ( m_bLineDistToggled ||
225  m_xLineDist->get_value_changed_from_saved() ||
226  m_xLineDistAtPercentBox->get_value_changed_from_saved() ||
227  m_xLineDistAtMetricBox->get_value_changed_from_saved() ) )
228  {
229  nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
230  MapUnit eUnit = SfxViewFrame::Current()->GetPool().GetMetric( nWhich );
231  SvxLineSpacingItem aSpacing(
232  static_cast<const SvxLineSpacingItem&>(GetItemSet().Get( nWhich )) );
233 
234  switch ( nPos )
235  {
236  case LLINESPACE_1:
237  case LLINESPACE_115:
238  case LLINESPACE_15:
239  case LLINESPACE_2:
240  SetLineSpace_Impl( aSpacing, nPos );
241  break;
242 
243  case LLINESPACE_PROP:
244  SetLineSpace_Impl( aSpacing, nPos,
245  static_cast<long>(m_xLineDistAtPercentBox->denormalize(
246  m_xLineDistAtPercentBox->get_value(FieldUnit::NONE) )) );
247  break;
248 
249  case LLINESPACE_MIN:
250  case LLINESPACE_DURCH:
251  case LLINESPACE_FIX:
252  SetLineSpace_Impl( aSpacing, nPos,
254  break;
255 
256  default:
257  OSL_FAIL( "unknown LineDist entry" );
258  break;
259  }
260  eState = GetItemSet().GetItemState( nWhich );
261  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_LINESPACE );
262 
263  if ( m_bLineDistToggled ||
264  !pOld || !( *static_cast<const SvxLineSpacingItem*>(pOld) == aSpacing ) ||
265  SfxItemState::DONTCARE == eState )
266  {
267  rOutSet->Put( aSpacing );
268  bModified = true;
269  }
270  }
271 
272  if ( m_xTopDist->get_value_changed_from_saved() || m_xBottomDist->get_value_changed_from_saved()
273  || m_xContextualCB->get_state_changed_from_saved())
274  {
275  nWhich = GetWhich( SID_ATTR_ULSPACE );
276  MapUnit eUnit = pPool->GetMetric( nWhich );
277  pOld = GetOldItem( *rOutSet, SID_ATTR_ULSPACE );
278  SvxULSpaceItem aMargin( nWhich );
279 
280  if ( bRelativeMode )
281  {
282  DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
283 
284  const SvxULSpaceItem& rOldItem =
285  static_cast<const SvxULSpaceItem&>(GetItemSet().GetParent()->Get( nWhich ));
286 
287  if ( m_xTopDist->IsRelative() )
288  aMargin.SetUpper( rOldItem.GetUpper(),
289  static_cast<sal_uInt16>(m_xTopDist->get_value(FieldUnit::NONE)) );
290  else
291  aMargin.SetUpper( static_cast<sal_uInt16>(m_xTopDist->GetCoreValue(eUnit)) );
292 
293  if ( m_xBottomDist->IsRelative() )
294  aMargin.SetLower( rOldItem.GetLower(),
295  static_cast<sal_uInt16>(m_xBottomDist->get_value(FieldUnit::NONE)) );
296  else
297  aMargin.SetLower( static_cast<sal_uInt16>(m_xBottomDist->GetCoreValue(eUnit)) );
298 
299  }
300  else
301  {
302  aMargin.SetUpper(static_cast<sal_uInt16>(m_xTopDist->GetCoreValue(eUnit)));
303  aMargin.SetLower(static_cast<sal_uInt16>(m_xBottomDist->GetCoreValue(eUnit)));
304  }
305  aMargin.SetContextValue(m_xContextualCB->get_active());
306  eState = GetItemSet().GetItemState( nWhich );
307 
308  if ( !pOld || *static_cast<const SvxULSpaceItem*>(pOld) != aMargin ||
309  SfxItemState::DONTCARE == eState )
310  {
311  rOutSet->Put( aMargin );
312  bModified = true;
313  }
314  }
315  bool bNullTab = false;
316 
317  if ( m_xLeftIndent->get_value_changed_from_saved() ||
318  m_xFLineIndent->get_value_changed_from_saved() ||
319  m_xRightIndent->get_value_changed_from_saved() ||
320  m_xAutoCB->get_state_changed_from_saved() )
321  {
322  nWhich = GetWhich( SID_ATTR_LRSPACE );
323  MapUnit eUnit = pPool->GetMetric( nWhich );
324  SvxLRSpaceItem aMargin( nWhich );
325  pOld = GetOldItem( *rOutSet, SID_ATTR_LRSPACE );
326 
327  if ( bRelativeMode )
328  {
329  DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
330 
331  const SvxLRSpaceItem& rOldItem =
332  static_cast<const SvxLRSpaceItem&>(GetItemSet().GetParent()->Get( nWhich ));
333 
334  if (m_xLeftIndent->IsRelative())
335  aMargin.SetTextLeft( rOldItem.GetTextLeft(),
336  static_cast<sal_uInt16>(m_xLeftIndent->get_value(FieldUnit::NONE)) );
337  else
338  aMargin.SetTextLeft(m_xLeftIndent->GetCoreValue(eUnit));
339 
340  if ( m_xRightIndent->IsRelative() )
341  aMargin.SetRight( rOldItem.GetRight(),
342  static_cast<sal_uInt16>(m_xRightIndent->get_value(FieldUnit::NONE)) );
343  else
344  aMargin.SetRight(m_xRightIndent->GetCoreValue(eUnit));
345 
346  if ( m_xFLineIndent->IsRelative() )
347  aMargin.SetTextFirstLineOfst( rOldItem.GetTextFirstLineOfst(),
348  static_cast<sal_uInt16>(m_xFLineIndent->get_value(FieldUnit::NONE)) );
349  else
350  aMargin.SetTextFirstLineOfst(static_cast<sal_uInt16>(m_xFLineIndent->GetCoreValue(eUnit)));
351  }
352  else
353  {
354  aMargin.SetTextLeft(m_xLeftIndent->GetCoreValue(eUnit));
355  aMargin.SetRight(m_xRightIndent->GetCoreValue(eUnit));
356  aMargin.SetTextFirstLineOfst(static_cast<sal_uInt16>(m_xFLineIndent->GetCoreValue(eUnit)));
357  }
358  aMargin.SetAutoFirst(m_xAutoCB->get_active());
359  if ( aMargin.GetTextFirstLineOfst() < 0 )
360  bNullTab = true;
361  eState = GetItemSet().GetItemState( nWhich );
362 
363  if ( !pOld || *static_cast<const SvxLRSpaceItem*>(pOld) != aMargin ||
364  SfxItemState::DONTCARE == eState )
365  {
366  rOutSet->Put( aMargin );
367  bModified = true;
368  }
369  }
370 
371  if ( bNullTab )
372  {
373  MapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
374  if ( MapUnit::Map100thMM != eUnit )
375  {
376 
377  // negative first line indent -> set null default tabstob if applicable
378  sal_uInt16 _nWhich = GetWhich( SID_ATTR_TABSTOP );
379  const SfxItemSet& rInSet = GetItemSet();
380 
381  if ( rInSet.GetItemState( _nWhich ) >= SfxItemState::DEFAULT )
382  {
383  const SvxTabStopItem& rTabItem =
384  static_cast<const SvxTabStopItem&>(rInSet.Get( _nWhich ));
385  SvxTabStopItem aNullTab( rTabItem );
386  SvxTabStop aNull( 0, SvxTabAdjust::Default );
387  aNullTab.Insert( aNull );
388  rOutSet->Put( aNullTab );
389  }
390  }
391  }
392  if (m_xRegisterCB->get_visible())
393  {
394  const SfxBoolItem* pBoolItem = static_cast<const SfxBoolItem*>(GetOldItem(
395  *rOutSet, SID_ATTR_PARA_REGISTER));
396  if (!pBoolItem)
397  return bModified;
398  std::unique_ptr<SfxBoolItem> pRegItem(static_cast<SfxBoolItem*>(pBoolItem->Clone()));
399  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
400  bool bSet = pRegItem->GetValue();
401 
402  if (m_xRegisterCB->get_active() != bSet)
403  {
404  pRegItem->SetValue(!bSet);
405  rOutSet->Put(*pRegItem);
406  bModified = true;
407  }
408  else if ( SfxItemState::DEFAULT == GetItemSet().GetItemState( _nWhich, false ) )
409  rOutSet->ClearItem(_nWhich);
410  }
411 
412  return bModified;
413 }
414 
416 {
417  SfxItemPool* pPool = rSet->GetPool();
418  DBG_ASSERT( pPool, "Where is the pool?" );
419 
420  // adjust metric
421  FieldUnit eFUnit = GetModuleFieldUnit( *rSet );
422 
423  bool bApplyCharUnit = GetApplyCharUnit( *rSet );
424 
425  SvtCJKOptions aCJKOptions;
426  if(aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
427  eFUnit = FieldUnit::CHAR;
428 
429  m_xLeftIndent->SetFieldUnit(eFUnit);
430  m_xRightIndent->SetFieldUnit(eFUnit);
431  m_xFLineIndent->SetFieldUnit(eFUnit);
432  if ( eFUnit == FieldUnit::CHAR )
433  {
434  m_xTopDist->SetFieldUnit(FieldUnit::LINE);
435  m_xBottomDist->SetFieldUnit(FieldUnit::LINE);
436  SetFieldUnit(*m_xLineDistAtMetricBox, FieldUnit::POINT);
437  }
438  else
439  {
440  m_xTopDist->SetFieldUnit(eFUnit);
441  m_xBottomDist->SetFieldUnit(eFUnit);
443  }
444 
445  sal_uInt16 _nWhich = GetWhich( SID_ATTR_LRSPACE );
446  SfxItemState eItemState = rSet->GetItemState( _nWhich );
447 
448  if ( eItemState >= SfxItemState::DEFAULT )
449  {
450  MapUnit eUnit = pPool->GetMetric( _nWhich );
451 
452  if ( bRelativeMode )
453  {
454  const SvxLRSpaceItem& rOldItem =
455  static_cast<const SvxLRSpaceItem&>(rSet->Get( _nWhich ));
456 
457  if ( rOldItem.GetPropLeft() != 100 )
458  {
459  m_xLeftIndent->SetRelative( true );
460  m_xLeftIndent->set_value(rOldItem.GetPropLeft(), FieldUnit::NONE);
461  }
462  else
463  {
464  m_xLeftIndent->SetRelative(false);
465  m_xLeftIndent->SetFieldUnit(eFUnit);
466  m_xLeftIndent->SetMetricValue(rOldItem.GetTextLeft(), eUnit);
467  }
468 
469  if ( rOldItem.GetPropRight() != 100 )
470  {
471  m_xRightIndent->SetRelative( true );
472  m_xRightIndent->set_value(rOldItem.GetPropRight(), FieldUnit::NONE);
473  }
474  else
475  {
476  m_xRightIndent->SetRelative(false);
477  m_xRightIndent->SetFieldUnit(eFUnit);
478  m_xRightIndent->SetMetricValue(rOldItem.GetRight(), eUnit);
479  }
480 
481  if ( rOldItem.GetPropTextFirstLineOfst() != 100 )
482  {
483  m_xFLineIndent->SetRelative(true);
484  m_xFLineIndent->set_value(rOldItem.GetPropTextFirstLineOfst(), FieldUnit::NONE);
485  }
486  else
487  {
488  m_xFLineIndent->SetRelative(false);
489  m_xFLineIndent->set_min(-9999, FieldUnit::NONE);
490  m_xFLineIndent->SetFieldUnit(eFUnit);
491  m_xFLineIndent->SetMetricValue(rOldItem.GetTextFirstLineOfst(), eUnit);
492  }
493  m_xAutoCB->set_active(rOldItem.IsAutoFirst());
494  }
495  else
496  {
497  const SvxLRSpaceItem& rSpace =
498  static_cast<const SvxLRSpaceItem&>(rSet->Get( _nWhich ));
499 
500  m_xLeftIndent->SetMetricValue(rSpace.GetTextLeft(), eUnit);
501  m_xRightIndent->SetMetricValue(rSpace.GetRight(), eUnit);
502  m_xFLineIndent->SetMetricValue(rSpace.GetTextFirstLineOfst(), eUnit);
503  m_xAutoCB->set_active(rSpace.IsAutoFirst());
504  }
505  AutoHdl_Impl(*m_xAutoCB);
506  }
507  else
508  {
509  m_xLeftIndent->set_text(OUString());
510  m_xRightIndent->set_text(OUString());
511  m_xFLineIndent->set_text(OUString());
512  }
513 
514  _nWhich = GetWhich( SID_ATTR_ULSPACE );
515  eItemState = rSet->GetItemState( _nWhich );
516 
517  if ( eItemState >= SfxItemState::DEFAULT )
518  {
519  MapUnit eUnit = pPool->GetMetric( _nWhich );
520 
521  const SvxULSpaceItem& rOldItem =
522  static_cast<const SvxULSpaceItem&>(rSet->Get( _nWhich ));
523  if ( bRelativeMode )
524  {
525 
526  if ( rOldItem.GetPropUpper() != 100 )
527  {
528  m_xTopDist->SetRelative( true );
529  m_xTopDist->set_value(rOldItem.GetPropUpper(), FieldUnit::NONE);
530  }
531  else
532  {
533  m_xTopDist->SetRelative(false);
534  if (eFUnit == FieldUnit::CHAR)
535  m_xTopDist->SetFieldUnit(FieldUnit::LINE);
536  else
537  m_xTopDist->SetFieldUnit(eFUnit);
538  m_xTopDist->SetMetricValue(rOldItem.GetUpper(), eUnit);
539  }
540 
541  if ( rOldItem.GetPropLower() != 100 )
542  {
543  m_xBottomDist->SetRelative( true );
544  m_xBottomDist->set_value(rOldItem.GetPropLower(), FieldUnit::NONE);
545  }
546  else
547  {
548  m_xBottomDist->SetRelative(false);
549  if (eFUnit == FieldUnit::CHAR)
550  m_xBottomDist->SetFieldUnit(FieldUnit::LINE);
551  else
552  m_xBottomDist->SetFieldUnit(eFUnit);
553  m_xBottomDist->SetMetricValue(rOldItem.GetLower(), eUnit);
554  }
555  }
556  else
557  {
558  m_xTopDist->SetMetricValue(rOldItem.GetUpper(), eUnit);
559  m_xBottomDist->SetMetricValue(rOldItem.GetLower(), eUnit);
560  }
561  m_xContextualCB->set_active(rOldItem.GetContext());
562  }
563  else
564  {
565  m_xTopDist->set_text(OUString());
566  m_xBottomDist->set_text(OUString());
567  }
568 
569  _nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
570  eItemState = rSet->GetItemState( _nWhich );
571 
572  if ( eItemState >= SfxItemState::DEFAULT )
573  SetLineSpacing_Impl( static_cast<const SvxLineSpacingItem &>(rSet->Get( _nWhich )) );
574  else
575  m_xLineDist->set_active(-1);
576 
577  _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
578  eItemState = rSet->GetItemState( _nWhich );
579 
580  if ( eItemState >= SfxItemState::DEFAULT )
581  m_xRegisterCB->set_active( static_cast<const SfxBoolItem &>(rSet->Get( _nWhich )).GetValue());
582  m_xRegisterCB->save_state();
583  sal_uInt16 nHtmlMode = GetHtmlMode_Impl(*rSet);
584  if(nHtmlMode & HTMLMODE_ON)
585  {
586  m_xRegisterFL->hide();
587  m_xRegisterCB->hide();
588  m_xAutoCB->hide();
589  }
590 
591  // this sets the min/max limits; do this _after_ setting the values,
592  // because for Impress the min of first-line indent depends on value of
593  // left-indent!
594  ELRLoseFocus();
595  ChangesApplied();
596 }
597 
599 {
600  m_xLeftIndent->save_value();
601  m_xRightIndent->save_value();
602  m_xFLineIndent->save_value();
603  m_xLineDist->save_value();
604  m_xLineDistAtPercentBox->save_value();
605  m_xLineDistAtMetricBox->save_value();
606  m_xRegisterCB->save_state();
607  m_xTopDist->save_value();
608  m_xBottomDist->save_value();
609  m_xContextualCB->save_state();
610  m_xAutoCB->save_state();
611 }
612 
614 {
615  DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
616 
617  m_xLeftIndent->EnableRelativeMode( 0, 999 );
618  m_xFLineIndent->EnableRelativeMode( 0, 999 );
619  m_xRightIndent->EnableRelativeMode( 0, 999 );
620  m_xTopDist->EnableRelativeMode( 0, 999 );
621  m_xBottomDist->EnableRelativeMode( 0, 999 );
622  bRelativeMode = true;
623 }
624 
626 {
627  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
628  SfxItemState eItemState = rSet.GetItemState( _nWhich );
629 
630  if ( eItemState >= SfxItemState::DEFAULT )
631  {
632  const SvxAdjustItem& rAdj = static_cast<const SvxAdjustItem&>( rSet.Get( _nWhich ) );
633  SvxAdjust eAdjust = rAdj.GetAdjust();
634  if ( eAdjust == SvxAdjust::Center || eAdjust == SvxAdjust::Block )
635  {
636  _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
637  eItemState = rSet.GetItemState( _nWhich );
638 
639  if ( eItemState >= SfxItemState::DEFAULT )
640  {
641  const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>( rSet.Get( _nWhich ) );
642  SvxFrameDirection eFrameDirection = rFrameDirItem.GetValue();
643 
644  m_aExampleWin.EnableRTL( SvxFrameDirection::Horizontal_RL_TB == eFrameDirection );
645 
646  if ( eAdjust == SvxAdjust::Block )
648  }
649  }
650  else
651  {
652  m_aExampleWin.EnableRTL( eAdjust == SvxAdjust::Right );
653  eAdjust = SvxAdjust::Left; //required for correct preview display
654  m_aExampleWin.SetLastLine( eAdjust );
655  }
656  m_aExampleWin.SetAdjust( eAdjust );
657 
659  }
660 }
661 
663 {
664  ELRLoseFocus();
665 
666  if ( _pSet )
667  FillItemSet( _pSet );
668  return DeactivateRC::LeavePage;
669 }
670 
672  : SfxTabPage(pParent, "cui/ui/paraindentspacing.ui", "ParaIndentSpacing", &rAttr)
673  , nWidth(11905 /*567 * 50*/)
674  , nMinFixDist(0)
675  , bRelativeMode(false)
676  , m_xLeftIndent(new RelativeField(m_xBuilder->weld_metric_spin_button("spinED_LEFTINDENT", FieldUnit::CM)))
677  , m_xRightLabel(m_xBuilder->weld_label("labelFT_RIGHTINDENT"))
678  , m_xRightIndent(new RelativeField(m_xBuilder->weld_metric_spin_button("spinED_RIGHTINDENT", FieldUnit::CM)))
679  , m_xFLineLabel(m_xBuilder->weld_label("labelFT_FLINEINDENT"))
680  , m_xFLineIndent(new RelativeField(m_xBuilder->weld_metric_spin_button("spinED_FLINEINDENT", FieldUnit::CM)))
681  , m_xAutoCB(m_xBuilder->weld_check_button("checkCB_AUTO"))
682  , m_xTopDist(new RelativeField(m_xBuilder->weld_metric_spin_button("spinED_TOPDIST", FieldUnit::CM)))
683  , m_xBottomDist(new RelativeField(m_xBuilder->weld_metric_spin_button("spinED_BOTTOMDIST", FieldUnit::CM)))
684  , m_xContextualCB(m_xBuilder->weld_check_button("checkCB_CONTEXTUALSPACING"))
685  , m_xLineDist(m_xBuilder->weld_combo_box("comboLB_LINEDIST"))
686  , m_xLineDistAtPercentBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTPERCENT", FieldUnit::PERCENT))
687  , m_xLineDistAtMetricBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTMETRIC", FieldUnit::CM))
688  , m_xLineDistAtLabel(m_xBuilder->weld_label("labelFT_LINEDIST"))
689  , m_xAbsDist(m_xBuilder->weld_label("labelST_LINEDIST_ABS"))
690  , m_xRegisterFL(m_xBuilder->weld_widget("frameFL_REGISTER"))
691  , m_xRegisterCB(m_xBuilder->weld_check_button("checkCB_REGISTER"))
692  , m_xExampleWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWN_EXAMPLE", m_aExampleWin))
693 {
694  sAbsDist = m_xAbsDist->get_label();
695 
696  // this page needs ExchangeSupport
698 
699  m_xLineDistAtMetricBox->hide();
700 
701  Init_Impl();
702  m_xFLineIndent->set_min(-9999, FieldUnit::NONE); // is set to 0 on default
703 }
704 
706 {
707 }
708 
710 {
711  m_xLeftIndent->set_min(-9999, FieldUnit::NONE);
712  m_xRightIndent->set_min(-9999, FieldUnit::NONE);
713  m_xRightIndent->EnableNegativeMode();
714  m_xLeftIndent->EnableNegativeMode();
715 }
716 
718 (
719  const SvxLineSpacingItem &rAttr
720 )
721 {
722  MapUnit eUnit = SfxViewFrame::Current()->GetPool().GetMetric( rAttr.Which() );
723 
724  switch( rAttr.GetLineSpaceRule() )
725  {
726  case SvxLineSpaceRule::Auto:
727  {
729 
730  switch( eInter )
731  {
732  // Default single line spacing
733  case SvxInterLineSpaceRule::Off:
734  m_xLineDist->set_active( LLINESPACE_1 );
735  break;
736 
737  // Default single line spacing
738  case SvxInterLineSpaceRule::Prop:
739  if ( 100 == rAttr.GetPropLineSpace() )
740  {
741  m_xLineDist->set_active( LLINESPACE_1 );
742  break;
743  }
744  // 1.15 line spacing
745  if ( 115 == rAttr.GetPropLineSpace() )
746  {
747  m_xLineDist->set_active( LLINESPACE_115 );
748  break;
749  }
750  // 1.5 line spacing
751  if ( 150 == rAttr.GetPropLineSpace() )
752  {
753  m_xLineDist->set_active( LLINESPACE_15 );
754  break;
755  }
756  // double line spacing
757  if ( 200 == rAttr.GetPropLineSpace() )
758  {
759  m_xLineDist->set_active( LLINESPACE_2 );
760  break;
761  }
762  // the set per cent value
763  m_xLineDistAtPercentBox->set_value(m_xLineDistAtPercentBox->normalize(rAttr.GetPropLineSpace()), FieldUnit::NONE);
764  m_xLineDist->set_active( LLINESPACE_PROP );
765  break;
766 
767  case SvxInterLineSpaceRule::Fix:
768  SetMetricValue( *m_xLineDistAtMetricBox, rAttr.GetInterLineSpace(), eUnit );
769  m_xLineDist->set_active( LLINESPACE_DURCH );
770  break;
771  default: ;//prevent warning
772  }
773  }
774  break;
775  case SvxLineSpaceRule::Fix:
776  SetMetricValue(*m_xLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
777  m_xLineDist->set_active( LLINESPACE_FIX );
778  break;
779 
780  case SvxLineSpaceRule::Min:
781  SetMetricValue(*m_xLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
782  m_xLineDist->set_active( LLINESPACE_MIN );
783  break;
784  default: ;//prevent warning
785  }
786  LineDistHdl_Impl( *m_xLineDist );
787 }
788 
790 {
791  m_bLineDistToggled = true;
792 }
793 
794 IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox&, rBox, void)
795 {
796  switch (rBox.get_active())
797  {
798  case LLINESPACE_1:
799  case LLINESPACE_115:
800  case LLINESPACE_15:
801  case LLINESPACE_2:
802  m_xLineDistAtLabel->set_sensitive(false);
803  m_xLineDistAtPercentBox->set_sensitive(false);
804  m_xLineDistAtPercentBox->set_text(OUString());
805  m_xLineDistAtMetricBox->set_sensitive(false);
806  m_xLineDistAtMetricBox->set_text(OUString());
807  break;
808 
809  case LLINESPACE_DURCH:
810  // setting a sensible default?
811  // limit MS min(10, aPageSize)
812  m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
813 
814  if (m_xLineDistAtMetricBox->get_text().isEmpty())
815  m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(1), FieldUnit::NONE);
816  m_xLineDistAtPercentBox->hide();
817  m_xLineDistAtMetricBox->show();
818  m_xLineDistAtMetricBox->set_sensitive(true);
819  m_xLineDistAtLabel->set_sensitive(true);
820  break;
821 
822  case LLINESPACE_MIN:
823  m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
824 
825  if (m_xLineDistAtMetricBox->get_text().isEmpty())
826  m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(10), FieldUnit::TWIP);
827  m_xLineDistAtPercentBox->hide();
828  m_xLineDistAtMetricBox->show();
829  m_xLineDistAtMetricBox->set_sensitive(true);
830  m_xLineDistAtLabel->set_sensitive(true);
831  break;
832 
833  case LLINESPACE_PROP:
834 
835  if (m_xLineDistAtPercentBox->get_text().isEmpty())
836  m_xLineDistAtPercentBox->set_value(m_xLineDistAtPercentBox->normalize(100), FieldUnit::TWIP);
837  m_xLineDistAtMetricBox->hide();
838  m_xLineDistAtPercentBox->show();
839  m_xLineDistAtPercentBox->set_sensitive(true);
840  m_xLineDistAtLabel->set_sensitive(true);
841  break;
842  case LLINESPACE_FIX:
843  {
844  auto nTemp = m_xLineDistAtMetricBox->get_value(FieldUnit::NONE);
845  m_xLineDistAtMetricBox->set_min(m_xLineDistAtMetricBox->normalize(nMinFixDist), FieldUnit::TWIP);
846 
847  // if the value has been changed at SetMin,
848  // it is time for the default
849  if (m_xLineDistAtMetricBox->get_value(FieldUnit::NONE) != nTemp)
850  SetMetricValue( *m_xLineDistAtMetricBox, FIX_DIST_DEF, MapUnit::MapTwip ); // fix is only in Writer
851  m_xLineDistAtPercentBox->hide();
852  m_xLineDistAtMetricBox->show();
853  m_xLineDistAtMetricBox->set_sensitive(true);
854  m_xLineDistAtLabel->set_sensitive(true);
855  }
856  break;
857  }
858  UpdateExample_Impl();
859 }
860 
862 {
863  UpdateExample_Impl();
864 }
865 
867 {
868  m_xLineDist->connect_popup_toggled(LINK(this, SvxStdParagraphTabPage, LineDistPopupHdl_Impl));
869  m_xLineDist->connect_changed(LINK(this, SvxStdParagraphTabPage, LineDistHdl_Impl));
870 
871  Link<weld::MetricSpinButton&,void> aLink2 = LINK(this, SvxStdParagraphTabPage, ELRLoseFocusHdl);
872  m_xFLineIndent->connect_value_changed(aLink2);
873  m_xLeftIndent->connect_value_changed(aLink2);
874  m_xRightIndent->connect_value_changed(aLink2);
875 
876  Link<weld::MetricSpinButton&,void> aLink = LINK(this, SvxStdParagraphTabPage, ModifyHdl_Impl);
877  m_xTopDist->connect_value_changed(aLink);
878  m_xBottomDist->connect_value_changed(aLink);
879 
880  m_xAutoCB->connect_toggled(LINK(this, SvxStdParagraphTabPage, AutoHdl_Impl));
881  SfxItemPool* pPool = GetItemSet().GetPool();
882  DBG_ASSERT( pPool, "Where is the pool?" );
883  FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
884 
885  m_xTopDist->set_max( m_xTopDist->normalize( MAX_DURCH ), eUnit );
886  m_xBottomDist->set_max( m_xBottomDist->normalize( MAX_DURCH ), eUnit );
887  m_xLineDistAtMetricBox->set_max( m_xLineDistAtMetricBox->normalize( MAX_DURCH ), eUnit );
888 }
889 
891 {
892  m_aExampleWin.SetFirstLineOfst( static_cast<short>(m_xFLineIndent->denormalize( m_xFLineIndent->get_value( FieldUnit::TWIP ) )) );
893  m_aExampleWin.SetLeftMargin( static_cast<long>(m_xLeftIndent->denormalize( m_xLeftIndent->get_value( FieldUnit::TWIP ) ) ) );
894  m_aExampleWin.SetRightMargin( static_cast<long>(m_xRightIndent->denormalize( m_xRightIndent->get_value( FieldUnit::TWIP ) ) ) );
895  m_aExampleWin.SetUpper( static_cast<sal_uInt16>(m_xTopDist->denormalize( m_xTopDist->get_value( FieldUnit::TWIP ) )) );
896  m_aExampleWin.SetLower( static_cast<sal_uInt16>(m_xBottomDist->denormalize( m_xBottomDist->get_value( FieldUnit::TWIP ) )) );
897 
898  int nPos = m_xLineDist->get_active();
899 
900  switch ( nPos )
901  {
902  case LLINESPACE_1:
903  case LLINESPACE_115:
904  case LLINESPACE_15:
905  case LLINESPACE_2:
906  case LLINESPACE_PROP:
907  case LLINESPACE_MIN:
908  case LLINESPACE_DURCH:
909  case LLINESPACE_FIX:
910  m_aExampleWin.SetLineSpace( static_cast<SvxPrevLineSpace>(nPos) );
911  break;
912  }
913  m_aExampleWin.Invalidate();
914 }
915 
917 {
918  m_xRegisterCB->show();
919  m_xRegisterFL->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(pParent, "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 
1062 {
1063  return VclPtr<SvxParaAlignTabPage>::Create(pParent, *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() )
1310  m_aExampleWin.EnableRTL( IsRTLEnabled() /*false*/ );
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 
1359 {
1360  return VclPtr<SvxExtParagraphTabPage>::Create(pParent, *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_xExtHyphenBeforeBox->get_value_changed_from_saved() ||
1372  m_xExtHyphenAfterBox->get_value_changed_from_saved() ||
1373  m_xMaxHyphenEdit->get_value_changed_from_saved() )
1374  {
1375  SvxHyphenZoneItem aHyphen(
1376  static_cast<const SvxHyphenZoneItem&>(GetItemSet().Get( _nWhich )) );
1377  aHyphen.SetHyphen( eHyphenState == TRISTATE_TRUE );
1378 
1379  if ( eHyphenState == TRISTATE_TRUE )
1380  {
1381  aHyphen.GetMinLead() = static_cast<sal_uInt8>(m_xExtHyphenBeforeBox->get_value());
1382  aHyphen.GetMinTrail() = static_cast<sal_uInt8>(m_xExtHyphenAfterBox->get_value());
1383  }
1384  aHyphen.GetMaxHyphens() = static_cast<sal_uInt8>(m_xMaxHyphenEdit->get_value());
1385 
1386  if ( !pOld ||
1387  *static_cast<const SvxHyphenZoneItem*>(pOld) != aHyphen ||
1388  m_xHyphenBox->get_state_changed_from_saved())
1389  {
1390  rOutSet->Put( aHyphen );
1391  bModified = true;
1392  }
1393  }
1394 
1395  if (m_xPageNumBox->get_sensitive()
1396  && (m_xPageNumBox->get_state_changed_from_saved() || m_xPagenumEdit->get_value_changed_from_saved()))
1397  {
1398  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_PAGENUM );
1399 
1400  if (TRISTATE_TRUE == m_xPageNumBox->get_state()
1401  && (!pOld || IsInvalidItem(pOld)
1402  || static_cast<const SfxUInt16Item*>(pOld)->GetValue() != m_xPagenumEdit->get_value()))
1403  {
1404  SfxUInt16Item aPageNum(SID_ATTR_PARA_PAGENUM,
1405  static_cast<sal_uInt16>(m_xPagenumEdit->get_value()));
1406  rOutSet->Put( aPageNum );
1407  bModified = true;
1408  }
1409  else if (TRISTATE_FALSE == m_xPageNumBox->get_state()
1410  && (pOld || IsInvalidItem(pOld)))
1411  {
1412  // need to tell sw to remove the item
1413  rOutSet->DisableItem(SID_ATTR_PARA_PAGENUM);
1414  bModified = true;
1415  }
1416  }
1417 
1418  // pagebreak
1419 
1420  TriState eState = m_xApplyCollBtn->get_state();
1421  bool bIsPageModel = false;
1422 
1423  _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
1424  OUString sPage;
1425  if ( m_xApplyCollBtn->get_state_changed_from_saved() ||
1426  ( TRISTATE_TRUE == eState &&
1427  m_xApplyCollBox->get_value_changed_from_saved() ) )
1428  {
1429  if ( eState == TRISTATE_TRUE )
1430  {
1431  sPage = m_xApplyCollBox->get_active_text();
1432  bIsPageModel = !sPage.isEmpty();
1433  }
1434  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_MODEL );
1435 
1436  if ( !pOld || static_cast<const SvxPageModelItem*>(pOld)->GetValue() != sPage )
1437  {
1438  rOutSet->Put( SvxPageModelItem( sPage, false, _nWhich ) );
1439  bModified = true;
1440  }
1441  else
1442  bIsPageModel = false;
1443  }
1444  else if(TRISTATE_TRUE == eState && m_xApplyCollBtn->get_sensitive())
1445  bIsPageModel = true;
1446  else
1447  rOutSet->Put( SvxPageModelItem( sPage, false, _nWhich ) );
1448 
1449  _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
1450 
1451  if ( bIsPageModel )
1452  // if PageModel is turned on, always turn off PageBreak
1453  rOutSet->Put( SvxFormatBreakItem( SvxBreak::NONE, _nWhich ) );
1454  else
1455  {
1456  eState = m_xPageBreakBox->get_state();
1457  SfxItemState eModelState = GetItemSet().GetItemState(SID_ATTR_PARA_MODEL, false);
1458 
1459  if ( (eModelState == SfxItemState::SET && TRISTATE_TRUE == m_xPageBreakBox->get_state()) ||
1460  m_xPageBreakBox->get_state_changed_from_saved() ||
1461  m_xBreakTypeLB->get_value_changed_from_saved() ||
1462  m_xBreakPositionLB->get_value_changed_from_saved() )
1463  {
1464  const SvxFormatBreakItem rOldBreak(
1465  static_cast<const SvxFormatBreakItem&>(GetItemSet().Get( _nWhich )));
1466  SvxFormatBreakItem aBreak(rOldBreak.GetBreak(), rOldBreak.Which());
1467 
1468  switch ( eState )
1469  {
1470  case TRISTATE_TRUE:
1471  {
1472  bool bBefore = m_xBreakPositionLB->get_active() == 0;
1473 
1474  if (m_xBreakTypeLB->get_active() == 0)
1475  {
1476  if ( bBefore )
1477  aBreak.SetValue( SvxBreak::PageBefore );
1478  else
1479  aBreak.SetValue( SvxBreak::PageAfter );
1480  }
1481  else
1482  {
1483  if ( bBefore )
1484  aBreak.SetValue( SvxBreak::ColumnBefore );
1485  else
1486  aBreak.SetValue( SvxBreak::ColumnAfter );
1487  }
1488  break;
1489  }
1490 
1491  case TRISTATE_FALSE:
1492  aBreak.SetValue( SvxBreak::NONE );
1493  break;
1494  default: ; //prevent warning
1495  }
1496  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_PAGEBREAK );
1497 
1498  if ( eState != m_xPageBreakBox->get_saved_state() ||
1499  !pOld || !( *static_cast<const SvxFormatBreakItem*>(pOld) == aBreak ) )
1500  {
1501  bModified = true;
1502  rOutSet->Put( aBreak );
1503  }
1504  }
1505  }
1506 
1507  // paragraph split
1508  _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
1509  eState = m_xKeepTogetherBox->get_state();
1510 
1511  if (m_xKeepTogetherBox->get_state_changed_from_saved())
1512  {
1513  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_SPLIT );
1514 
1515  if ( !pOld || static_cast<const SvxFormatSplitItem*>(pOld)->GetValue() !=
1516  ( eState == TRISTATE_FALSE ) )
1517  {
1518  rOutSet->Put( SvxFormatSplitItem( eState == TRISTATE_FALSE, _nWhich ) );
1519  bModified = true;
1520  }
1521  }
1522 
1523  // keep paragraphs
1524  _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
1525  eState = m_xKeepParaBox->get_state();
1526 
1527  if (m_xKeepParaBox->get_state_changed_from_saved())
1528  {
1529  // if the status has changed, putting is necessary
1530  rOutSet->Put( SvxFormatKeepItem( eState == TRISTATE_TRUE, _nWhich ) );
1531  bModified = true;
1532  }
1533 
1534  // widows and orphans
1535  _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
1536  eState = m_xWidowBox->get_state();
1537 
1538  if ( m_xWidowBox->get_state_changed_from_saved() ||
1539  m_xWidowRowNo->get_value_changed_from_saved() )
1540  {
1541  SvxWidowsItem rItem( eState == TRISTATE_TRUE ?
1542  static_cast<sal_uInt8>(m_xWidowRowNo->get_value()) : 0, _nWhich );
1543  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_WIDOWS );
1544 
1545  if ( m_xWidowBox->get_state_changed_from_saved() || !pOld || !( *static_cast<const SvxWidowsItem*>(pOld) == rItem ) )
1546  {
1547  rOutSet->Put( rItem );
1548  bModified = true;
1549  }
1550  }
1551 
1552  _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
1553  eState = m_xOrphanBox->get_state();
1554 
1555  if ( m_xOrphanBox->get_state_changed_from_saved() ||
1556  m_xOrphanRowNo->get_value_changed_from_saved() )
1557  {
1558  SvxOrphansItem rItem( eState == TRISTATE_TRUE ?
1559  static_cast<sal_uInt8>(m_xOrphanRowNo->get_value()) : 0, _nWhich );
1560  pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_ORPHANS );
1561 
1562  if ( m_xOrphanBox->get_state_changed_from_saved() ||
1563  !pOld ||
1564  !( *static_cast<const SvxOrphansItem*>(pOld) == rItem ) )
1565  {
1566  rOutSet->Put( rItem );
1567  bModified = true;
1568  }
1569  }
1570 
1571  return bModified;
1572 }
1574 {
1575  sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
1576  SfxItemState eItemState = rSet->GetItemState( _nWhich );
1577 
1578  bool bItemAvailable = eItemState >= SfxItemState::DEFAULT;
1579  bool bIsHyphen = false;
1580  if( !bHtmlMode && bItemAvailable )
1581  {
1582  const SvxHyphenZoneItem& rHyphen =
1583  static_cast<const SvxHyphenZoneItem&>(rSet->Get( _nWhich ));
1585 
1586  bIsHyphen = rHyphen.IsHyphen();
1587  m_xHyphenBox->set_state(bIsHyphen ? TRISTATE_TRUE : TRISTATE_FALSE);
1588 
1589  m_xExtHyphenBeforeBox->set_value(rHyphen.GetMinLead());
1590  m_xExtHyphenAfterBox->set_value(rHyphen.GetMinTrail());
1591  m_xMaxHyphenEdit->set_value(rHyphen.GetMaxHyphens());
1592  }
1593  else
1594  {
1595  m_xHyphenBox->set_state(TRISTATE_INDET);
1596  }
1597  bool bEnable = bItemAvailable && bIsHyphen;
1598  m_xExtHyphenBeforeBox->set_sensitive(bEnable);
1599  m_xExtHyphenAfterBox->set_sensitive(bEnable);
1600  m_xBeforeText->set_sensitive(bEnable);
1601  m_xAfterText->set_sensitive(bEnable);
1602  m_xMaxHyphenLabel->set_sensitive(bEnable);
1603  m_xMaxHyphenEdit->set_sensitive(bEnable);
1604 
1605  _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM );
1606 
1607  switch (rSet->GetItemState(_nWhich))
1608  {
1609  case SfxItemState::SET:
1610  {
1612  m_xPageNumBox->set_state(TRISTATE_TRUE);
1613  SfxUInt16Item const*const pItem(rSet->GetItem<SfxUInt16Item>(_nWhich));
1614  const sal_uInt16 nPageNum(pItem->GetValue());
1615  m_xPagenumEdit->set_value(nPageNum);
1616  break;
1617  }
1618  case SfxItemState::DONTCARE:
1619  {
1621  m_xPageNumBox->set_state(TRISTATE_INDET);
1622  break;
1623  }
1624  case SfxItemState::UNKNOWN:
1625  case SfxItemState::DEFAULT:
1626  case SfxItemState::DISABLED:
1627  {
1629  m_xPageNumBox->set_state(TRISTATE_FALSE);
1630  break;
1631  }
1632  default:
1633  assert(false); // unexpected
1634  break;
1635  }
1636 
1637  if ( bPageBreak )
1638  {
1639  // first handle PageModel
1640  _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
1641  bool bIsPageModel = false;
1642  eItemState = rSet->GetItemState( _nWhich );
1643 
1644  if ( eItemState >= SfxItemState::SET )
1645  {
1647 
1648  const SvxPageModelItem& rModel =
1649  static_cast<const SvxPageModelItem&>(rSet->Get( _nWhich ));
1650  const OUString& aStr( rModel.GetValue() );
1651 
1652  if (!aStr.isEmpty() && m_xApplyCollBox->find_text(aStr) != -1)
1653  {
1654  m_xApplyCollBox->set_active_text(aStr);
1655  m_xApplyCollBtn->set_state(TRISTATE_TRUE);
1656  bIsPageModel = true;
1657 
1658  m_xPageBreakBox->set_sensitive(true);
1660  m_xBreakTypeFT->set_sensitive(true);
1661  m_xBreakTypeLB->set_sensitive(true);
1662  m_xBreakPositionFT->set_sensitive(true);
1663  m_xBreakPositionLB->set_sensitive(true);
1664  m_xApplyCollBtn->set_sensitive(false);
1665  m_xPageBreakBox->set_state(TRISTATE_TRUE);
1666 
1667  //select page break
1668  m_xBreakTypeLB->set_active(0);
1669  //select break before
1670  m_xBreakPositionLB->set_active(0);
1671  }
1672  else
1673  {
1674  m_xApplyCollBox->set_active(-1);
1675  m_xApplyCollBtn->set_state(TRISTATE_FALSE);
1676  }
1677  }
1678  else if ( SfxItemState::DONTCARE == eItemState )
1679  {
1681  m_xApplyCollBtn->set_state(TRISTATE_INDET);
1682  m_xApplyCollBox->set_active(-1);
1683  }
1684  else
1685  {
1686  m_xApplyCollBtn->set_sensitive(false);
1687  m_xApplyCollBox->set_sensitive(false);
1688  m_xPagenumEdit->set_sensitive(false);
1689  m_xPageNumBox->set_sensitive(false);
1690  }
1691 
1692  if ( !bIsPageModel )
1693  {
1694  _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
1695  eItemState = rSet->GetItemState( _nWhich );
1696 
1697  if ( eItemState >= SfxItemState::DEFAULT )
1698  {
1699  const SvxFormatBreakItem& rPageBreak =
1700  static_cast<const SvxFormatBreakItem&>(rSet->Get( _nWhich ));
1701 
1702  SvxBreak eBreak = rPageBreak.GetBreak();
1703 
1704  // PageBreak not via CTRL-RETURN,
1705  // then CheckBox can be freed
1706  m_xPageBreakBox->set_sensitive(true);
1708  m_xBreakTypeFT->set_sensitive(true);
1709  m_xBreakTypeLB->set_sensitive(true);
1710  m_xBreakPositionFT->set_sensitive(true);
1711  m_xBreakPositionLB->set_sensitive(true);
1712 
1713  m_xPageBreakBox->set_state(TRISTATE_TRUE);
1714 
1715  bool _bEnable = eBreak != SvxBreak::NONE &&
1716  eBreak != SvxBreak::ColumnBefore &&
1717  eBreak != SvxBreak::ColumnAfter;
1718  m_xApplyCollBtn->set_sensitive(_bEnable);
1719  if (!_bEnable)
1720  {
1721  m_xApplyCollBox->set_sensitive(_bEnable);
1722  m_xPageNumBox->set_sensitive(false);
1723  m_xPagenumEdit->set_sensitive(_bEnable);
1724  }
1725 
1726  if ( eBreak == SvxBreak::NONE )
1727  m_xPageBreakBox->set_state(TRISTATE_FALSE);
1728 
1729  sal_Int32 nType = 0; // selection position in break type ListBox : Page
1730  sal_Int32 nPosition = 0; // selection position in break position ListBox : Before
1731  switch ( eBreak )
1732  {
1733  case SvxBreak::PageBefore:
1734  break;
1735  case SvxBreak::PageAfter:
1736  nPosition = 1;
1737  break;
1738  case SvxBreak::ColumnBefore:
1739  nType = 1;
1740  break;
1741  case SvxBreak::ColumnAfter:
1742  nType = 1;
1743  nPosition = 1;
1744  break;
1745  default: ;//prevent warning
1746  }
1747  m_xBreakTypeLB->set_active(nType);
1748  m_xBreakPositionLB->set_active(nPosition);
1749  }
1750  else if ( SfxItemState::DONTCARE == eItemState )
1751  m_xPageBreakBox->set_state(TRISTATE_INDET);
1752  else
1753  {
1754  m_xPageBreakBox->set_sensitive(false);
1755  m_xBreakTypeFT->set_sensitive(false);
1756  m_xBreakTypeLB->set_sensitive(false);
1757  m_xBreakPositionFT->set_sensitive(false);
1758  m_xBreakPositionLB->set_sensitive(false);
1759  }
1760  }
1761 
1762  PageBreakPosHdl_Impl(*m_xBreakPositionLB);
1763  PageBreakHdl();
1764  }
1765 
1766  _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
1767  eItemState = rSet->GetItemState( _nWhich );
1768 
1769  if ( eItemState >= SfxItemState::DEFAULT )
1770  {
1772  const SvxFormatKeepItem& rKeep =
1773  static_cast<const SvxFormatKeepItem&>(rSet->Get( _nWhich ));
1774 
1775  if ( rKeep.GetValue() )
1776  m_xKeepParaBox->set_state(TRISTATE_TRUE);
1777  else
1778  m_xKeepParaBox->set_state(TRISTATE_FALSE);
1779  }
1780  else if ( SfxItemState::DONTCARE == eItemState )
1781  m_xKeepParaBox->set_state(TRISTATE_INDET);
1782  else
1783  m_xKeepParaBox->set_sensitive(false);
1784 
1785  _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
1786  eItemState = rSet->GetItemState( _nWhich );
1787 
1788  if ( eItemState >= SfxItemState::DEFAULT )
1789  {
1790  const SvxFormatSplitItem& rSplit =
1791  static_cast<const SvxFormatSplitItem&>(rSet->Get( _nWhich ));
1793 
1794  if ( !rSplit.GetValue() )
1795  m_xKeepTogetherBox->set_state(TRISTATE_TRUE);
1796  else
1797  {
1798  m_xKeepTogetherBox->set_state(TRISTATE_FALSE);
1799 
1800  // widows and orphans
1801  m_xWidowBox->set_sensitive(true);
1802  _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
1803  SfxItemState eTmpState = rSet->GetItemState( _nWhich );
1804 
1805  if ( eTmpState >= SfxItemState::DEFAULT )
1806  {
1807  const SvxWidowsItem& rWidow =
1808  static_cast<const SvxWidowsItem&>(rSet->Get( _nWhich ));
1809  aWidowState.bTriStateEnabled = false;
1810  const sal_uInt16 nLines = rWidow.GetValue();
1811 
1812  bool _bEnable = nLines > 0;
1813  m_xWidowRowNo->set_value(m_xWidowRowNo->normalize(nLines));
1814  m_xWidowBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
1815  m_xWidowRowNo->set_sensitive(_bEnable);
1816  //m_xWidowRowLabel->set_sensitive(_bEnable);
1817 
1818  }
1819  else if ( SfxItemState::DONTCARE == eTmpState )
1820  m_xWidowBox->set_state( TRISTATE_INDET );
1821  else
1822  m_xWidowBox->set_sensitive(false);
1823 
1824  m_xOrphanBox->set_sensitive(true);
1825  _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
1826  eTmpState = rSet->GetItemState( _nWhich );
1827 
1828  if ( eTmpState >= SfxItemState::DEFAULT )
1829  {
1830  const SvxOrphansItem& rOrphan =
1831  static_cast<const SvxOrphansItem&>(rSet->Get( _nWhich ));
1832  const sal_uInt16 nLines = rOrphan.GetValue();
1834 
1835  bool _bEnable = nLines > 0;
1836  m_xOrphanBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
1837  m_xOrphanRowNo->set_value(m_xOrphanRowNo->normalize(nLines));
1838  m_xOrphanRowNo->set_sensitive(_bEnable);
1839  m_xOrphanRowLabel->set_sensitive(_bEnable);
1840 
1841  }
1842  else if ( SfxItemState::DONTCARE == eTmpState )
1843  m_xOrphanBox->set_state(TRISTATE_INDET);
1844  else
1845  m_xOrphanBox->set_sensitive(false);
1846  aOrphanState.eState = m_xOrphanBox->get_state();
1847  }
1848  }
1849  else if ( SfxItemState::DONTCARE == eItemState )
1850  m_xKeepTogetherBox->set_state(TRISTATE_INDET);
1851  else
1852  m_xKeepTogetherBox->set_sensitive(false);
1853 
1854  // so that everything is enabled correctly
1855  KeepTogetherHdl();
1856  WidowHdl();
1857  OrphanHdl();
1858  ChangesApplied();
1859 }
1861 {
1862  m_xHyphenBox->save_state();
1863  m_xExtHyphenBeforeBox->set_value(m_xExtHyphenBeforeBox->get_value());
1864  m_xExtHyphenAfterBox->set_value(m_xExtHyphenAfterBox->get_value());
1865  m_xMaxHyphenEdit->set_value(m_xMaxHyphenEdit->get_value());
1866  m_xPageBreakBox->save_state();
1867  m_xBreakPositionLB->save_value();
1868  m_xBreakTypeLB->save_value();
1869  m_xApplyCollBtn->save_state();
1870  m_xApplyCollBox->save_value();
1871  m_xPageNumBox->save_state();
1872  m_xPagenumEdit->save_value();
1873  m_xKeepTogetherBox->save_state();
1874  m_xKeepParaBox->save_state();
1875  m_xWidowBox->save_state();
1876  m_xOrphanBox->save_state();
1877  m_xOrphanRowNo->save_value();
1878  m_xWidowRowNo->save_value();
1879 }
1880 
1882 {
1883  if ( _pSet )
1884  FillItemSet( _pSet );
1885  return DeactivateRC::LeavePage;
1886 }
1887 
1889 {
1890  bPageBreak = false;
1891  m_xPageBreakBox->set_sensitive(false);
1892  m_xBreakTypeLB->remove(0);
1893  m_xBreakPositionFT->set_sensitive(false);
1894  m_xBreakPositionLB->set_sensitive(false);
1895  m_xApplyCollBtn->set_sensitive(false);
1896  m_xApplyCollBox->set_sensitive(false);
1897  m_xPageNumBox->set_sensitive(false);
1898  m_xPagenumEdit->set_sensitive(false);
1899 }
1900 
1902  : SfxTabPage(pParent, "cui/ui/textflowpage.ui", "TextFlowPage", &rAttr)
1903  , bPageBreak(true)
1904  , bHtmlMode(false)
1905  , nStdPos(0)
1906  // Hyphenation
1907  , m_xHyphenBox(m_xBuilder->weld_check_button("checkAuto"))
1908  , m_xBeforeText(m_xBuilder->weld_label("labelLineBegin"))
1909  , m_xExtHyphenBeforeBox(m_xBuilder->weld_spin_button("spinLineEnd"))
1910  , m_xAfterText(m_xBuilder->weld_label("labelLineEnd"))
1911  , m_xExtHyphenAfterBox(m_xBuilder->weld_spin_button("spinLineBegin"))
1912  , m_xMaxHyphenLabel(m_xBuilder->weld_label("labelMaxNum"))
1913  , m_xMaxHyphenEdit(m_xBuilder->weld_spin_button("spinMaxNum"))
1914  //Page break
1915  , m_xPageBreakBox(m_xBuilder->weld_check_button("checkInsert"))
1916  , m_xBreakTypeFT(m_xBuilder->weld_label("labelType"))
1917  , m_xBreakTypeLB(m_xBuilder->weld_combo_box("comboBreakType"))
1918  , m_xBreakPositionFT(m_xBuilder->weld_label("labelPosition"))
1919  , m_xBreakPositionLB(m_xBuilder->weld_combo_box("comboBreakPosition"))
1920  , m_xApplyCollBtn(m_xBuilder->weld_check_button("checkPageStyle"))
1921  , m_xApplyCollBox(m_xBuilder->weld_combo_box("comboPageStyle"))
1922  , m_xPageNumBox(m_xBuilder->weld_check_button("labelPageNum"))
1923  , m_xPagenumEdit(m_xBuilder->weld_spin_button("spinPageNumber"))
1924  // Options
1925  , m_xKeepTogetherBox(m_xBuilder->weld_check_button("checkSplitPara"))
1926  , m_xKeepParaBox(m_xBuilder->weld_check_button("checkKeepPara"))
1927  , m_xOrphanBox(m_xBuilder->weld_check_button("checkOrphan"))
1928  , m_xOrphanRowNo(m_xBuilder->weld_spin_button("spinOrphan"))
1929  , m_xOrphanRowLabel(m_xBuilder->weld_label("labelOrphan"))
1930  , m_xWidowBox(m_xBuilder->weld_check_button("checkWidow"))
1931  , m_xWidowRowNo(m_xBuilder->weld_spin_button("spinWidow"))
1932  , m_xWidowRowLabel(m_xBuilder->weld_label("labelWidow"))
1933 {
1934  // this page needs ExchangeSupport
1936 
1937  m_xHyphenBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, HyphenClickHdl_Impl));
1938  m_xPageBreakBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageBreakHdl_Impl));
1939  m_xKeepTogetherBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl));
1940  m_xWidowBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, WidowHdl_Impl));
1941  m_xOrphanBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, OrphanHdl_Impl));
1942  m_xApplyCollBtn->connect_toggled(LINK(this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl));
1943  m_xBreakTypeLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl));
1944  m_xBreakPositionLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl));
1945  m_xPageNumBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl));
1946  m_xKeepParaBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl));
1947 
1949  if ( pSh )
1950  {
1951  SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool();
1952  pPool->SetSearchMask( SfxStyleFamily::Page );
1953  SfxStyleSheetBase* pStyle = pPool->First();
1954  OUString aStdName;
1955 
1956  while( pStyle )
1957  {
1958  if ( aStdName.isEmpty() )
1959  // first style == standard style
1960  aStdName = pStyle->GetName();
1961  m_xApplyCollBox->append_text(pStyle->GetName());
1962  pStyle = pPool->Next();
1963  }
1964  nStdPos = m_xApplyCollBox->find_text(aStdName);
1965  }
1966 
1967  sal_uInt16 nHtmlMode = GetHtmlMode_Impl( rAttr );
1968  if ( nHtmlMode & HTMLMODE_ON )
1969  {
1970  bHtmlMode = true;
1971  m_xHyphenBox->set_sensitive(false);
1972  m_xBeforeText->set_sensitive(false);
1973  m_xExtHyphenBeforeBox->set_sensitive(false);
1974  m_xAfterText->set_sensitive(false);
1975  m_xExtHyphenAfterBox->set_sensitive(false);
1976  m_xMaxHyphenLabel->set_sensitive(false);
1977  m_xMaxHyphenEdit->set_sensitive(false);
1978  m_xPageNumBox->set_sensitive(false);
1979  m_xPagenumEdit->set_sensitive(false);
1980  // no column break in HTML
1981  m_xBreakTypeLB->remove(1);
1982  }
1983 }
1984 
1986 {
1987 }
1988 
1990 {
1991  switch (m_xPageBreakBox->get_state())
1992  {
1993  case TRISTATE_TRUE:
1994  m_xBreakTypeFT->set_sensitive(true);
1995  m_xBreakTypeLB->set_sensitive(true);
1996  m_xBreakPositionFT->set_sensitive(true);
1997  m_xBreakPositionLB->set_sensitive(true);
1998 
1999  if (0 == m_xBreakTypeLB->get_active() && 0 == m_xBreakPositionLB->get_active())
2000  {
2001  m_xApplyCollBtn->set_sensitive(true);
2002 
2003  bool bEnable = TRISTATE_TRUE == m_xApplyCollBtn->get_state() &&
2004  m_xApplyCollBox->get_count();
2005  m_xApplyCollBox->set_sensitive(bEnable);
2006  if(!bHtmlMode)
2007  {
2008  m_xPageNumBox->set_sensitive(bEnable);
2009  m_xPagenumEdit->set_sensitive(bEnable && m_xPageNumBox->get_state() == TRISTATE_TRUE);
2010  }
2011  }
2012  break;
2013 
2014  case TRISTATE_FALSE:
2015  case TRISTATE_INDET:
2016  m_xApplyCollBtn->set_state(TRISTATE_FALSE);
2017  m_xApplyCollBtn->set_sensitive(false);
2018  m_xApplyCollBox->set_sensitive(false);
2019  m_xPageNumBox->set_sensitive(false);
2020  m_xPagenumEdit->set_sensitive(false);
2021  m_xBreakTypeFT->set_sensitive(false);
2022  m_xBreakTypeLB->set_sensitive(false);
2023  m_xBreakPositionFT->set_sensitive(false);
2024  m_xBreakPositionLB->set_sensitive(false);
2025  break;
2026  }
2027 }
2028 
2029 IMPL_LINK(SvxExtParagraphTabPage, PageBreakHdl_Impl, weld::ToggleButton&, rToggle, void)
2030 {
2031  aPageBreakState.ButtonToggled(rToggle);
2032  PageBreakHdl();
2033 }
2034 
2036 {
2037  bool bEnable = m_xKeepTogetherBox->get_state() == TRISTATE_FALSE;
2038  m_xWidowBox->set_sensitive(bEnable);
2039  m_xOrphanBox->set_sensitive(bEnable);
2040 }
2041 
2042 IMPL_LINK(SvxExtParagraphTabPage, KeepTogetherHdl_Impl, weld::ToggleButton&, rToggle, void)
2043 {
2044  aKeepTogetherState.ButtonToggled(rToggle);
2045  KeepTogetherHdl();
2046 }
2047 
2049 {
2050  switch (m_xWidowBox->get_state())
2051  {
2052  case TRISTATE_TRUE:
2053  m_xWidowRowNo->set_sensitive(true);
2054  m_xWidowRowLabel->set_sensitive(true);
2055  m_xKeepTogetherBox->set_sensitive(false);
2056  break;
2057  case TRISTATE_FALSE:
2058  if (m_xOrphanBox->get_state() == TRISTATE_FALSE)
2059  m_xKeepTogetherBox->set_sensitive(true);
2060  [[fallthrough]];
2061  case TRISTATE_INDET:
2062  m_xWidowRowNo->set_sensitive(false);
2063  m_xWidowRowLabel->set_sensitive(false);
2064  break;
2065  }
2066 }
2067 
2068 IMPL_LINK(SvxExtParagraphTabPage, WidowHdl_Impl, weld::ToggleButton&, rToggle, void)
2069 {
2070  aWidowState.ButtonToggled(rToggle);
2071  WidowHdl();
2072 }
2073 
2074 IMPL_LINK(SvxExtParagraphTabPage, OrphanHdl_Impl, weld::ToggleButton&, rToggle, void)
2075 {
2076  aOrphanState.ButtonToggled(rToggle);
2077  OrphanHdl();
2078 }
2079 
2081 {
2082  switch (m_xOrphanBox->get_state())
2083  {
2084  case TRISTATE_TRUE:
2085  m_xOrphanRowNo->set_sensitive(true);
2086  m_xOrphanRowLabel->set_sensitive(true);
2087  m_xKeepTogetherBox->set_sensitive(false);
2088  break;
2089 
2090  case TRISTATE_FALSE:
2091  if (m_xWidowBox->get_state() == TRISTATE_FALSE)
2092  m_xKeepTogetherBox->set_sensitive(true);
2093  [[fallthrough]];
2094  case TRISTATE_INDET:
2095  m_xOrphanRowNo->set_sensitive(false);
2096  m_xOrphanRowLabel->set_sensitive(false);
2097  break;
2098  }
2099 }
2100 
2102 {
2103  bool bEnable = m_xHyphenBox->get_state() == TRISTATE_TRUE;
2104  m_xBeforeText->set_sensitive(bEnable);
2105  m_xExtHyphenBeforeBox->set_sensitive(bEnable);
2106  m_xAfterText->set_sensitive(bEnable);
2107  m_xExtHyphenAfterBox->set_sensitive(bEnable);
2108  m_xMaxHyphenLabel->set_sensitive(bEnable);
2109  m_xMaxHyphenEdit->set_sensitive(bEnable);
2110  m_xHyphenBox->set_state(bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
2111 }
2112 
2113 IMPL_LINK(SvxExtParagraphTabPage, HyphenClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2114 {
2115  aHyphenState.ButtonToggled(rToggle);
2116  HyphenClickHdl();
2117 }
2118 
2120 {
2121  bool bEnable = false;
2122  if (m_xApplyCollBtn->get_state() == TRISTATE_TRUE && m_xApplyCollBox->get_count())
2123  {
2124  bEnable = true;
2125  m_xApplyCollBox->set_active(nStdPos);
2126  }
2127  else
2128  {
2129  m_xApplyCollBox->set_active(-1);
2130  }
2131  m_xApplyCollBox->set_sensitive(bEnable);
2132  if (!bHtmlMode)
2133  {
2134  m_xPageNumBox->set_sensitive(bEnable);
2135  m_xPagenumEdit->set_sensitive(bEnable && m_xPageNumBox->get_state() == TRISTATE_TRUE);
2136  }
2137 }
2138 
2139 IMPL_LINK(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2140 {
2141  aApplyCollState.ButtonToggled(rToggle);
2142  ApplyCollClickHdl();
2143 }
2144 
2145 IMPL_LINK(SvxExtParagraphTabPage, PageBreakPosHdl_Impl, weld::ComboBox&, rListBox, void)
2146 {
2147  if (0 == rListBox.get_active())
2148  {
2149  m_xApplyCollBtn->set_sensitive(true);
2150 
2151  bool bEnable = m_xApplyCollBtn->get_state() == TRISTATE_TRUE && m_xApplyCollBox->get_count();
2152 
2153  m_xApplyCollBox->set_sensitive(bEnable);
2154  if (!bHtmlMode)
2155  {
2156  m_xPageNumBox->set_sensitive(bEnable);
2157  m_xPagenumEdit->set_sensitive(bEnable && m_xPageNumBox->get_state() == TRISTATE_TRUE);
2158  }
2159  }
2160  else if (1 == rListBox.get_active())
2161  {
2162  m_xApplyCollBtn->set_state(TRISTATE_FALSE);
2163  m_xApplyCollBtn->set_sensitive(false);
2164  m_xApplyCollBox->set_sensitive(false);
2165  m_xPageNumBox->set_sensitive(false);
2166  m_xPagenumEdit->set_sensitive(false);
2167  }
2168 }
2169 
2170 IMPL_LINK(SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, weld::ComboBox&, rListBox, void)
2171 {
2172  //column break or break after
2173  int nBreakPos = m_xBreakPositionLB->get_active();
2174  if (rListBox.get_active() == 1 || 1 == nBreakPos)
2175  {
2176  m_xApplyCollBtn->set_state(TRISTATE_FALSE);
2177  m_xApplyCollBtn->set_sensitive(false);
2178  m_xApplyCollBox->set_sensitive(false);
2179  m_xPageNumBox->set_sensitive(false);
2180  m_xPagenumEdit->set_sensitive(false);
2181  }
2182  else
2183  PageBreakPosHdl_Impl(*m_xBreakPositionLB);
2184 }
2185 
2187 {
2188  m_xPagenumEdit->set_sensitive(m_xPageNumBox->get_state() == TRISTATE_TRUE);
2189 }
2190 
2191 IMPL_LINK(SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2192 {
2193  aPageNumState.ButtonToggled(rToggle);
2194  PageNumBoxClickHdl();
2195 }
2196 
2197 IMPL_LINK(SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl, weld::ToggleButton&, rToggle, void)
2198 {
2199  aKeepParaState.ButtonToggled(rToggle);
2200 }
2201 
2203 {
2204  const SfxBoolItem* pDisablePageBreakItem = aSet.GetItem<SfxBoolItem>(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK, false);
2205 
2206  if (pDisablePageBreakItem)
2207  if ( pDisablePageBreakItem->GetValue())
2208  DisablePageBreak();
2209 }
2210 
2212  : SfxTabPage(pParent, "cui/ui/asiantypography.ui", "AsianTypography", &rSet)
2213  , m_xForbiddenRulesCB(m_xBuilder->weld_check_button("checkForbidList"))
2214  , m_xHangingPunctCB(m_xBuilder->weld_check_button("checkHangPunct"))
2215  , m_xScriptSpaceCB(m_xBuilder->weld_check_button("checkApplySpacing"))
2216 {
2217 }
2218 
2220 {
2221 }
2222 
2224 {
2225  return VclPtr<SvxAsianTabPage>::Create(pParent, *rSet);
2226 }
2227 
2228 const sal_uInt16* SvxAsianTabPage::GetRanges()
2229 {
2230  static const sal_uInt16 pRanges[] =
2231  {
2232  SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES,
2233  0
2234  };
2235  return pRanges;
2236 }
2237 
2239 {
2240  bool bRet = false;
2241  SfxItemPool* pPool = rSet->GetPool();
2242  if (m_xScriptSpaceCB->get_sensitive() && m_xScriptSpaceCB->get_state_changed_from_saved())
2243  {
2244  std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
2245  pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone()));
2246  pNewItem->SetValue(m_xScriptSpaceCB->get_active());
2247  rSet->Put(std::move(pNewItem));
2248  bRet = true;
2249  }
2250  if (m_xHangingPunctCB->get_sensitive() && m_xHangingPunctCB->get_state_changed_from_saved())
2251  {
2252  std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
2253  pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone()));
2254  pNewItem->SetValue(m_xHangingPunctCB->get_active());
2255  rSet->Put(std::move(pNewItem));
2256  bRet = true;
2257  }
2258  if (m_xForbiddenRulesCB->get_sensitive() && m_xForbiddenRulesCB->get_state_changed_from_saved())
2259  {
2260  std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
2261  pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone()));
2262  pNewItem->SetValue(m_xForbiddenRulesCB->get_active());
2263  rSet->Put(std::move(pNewItem));
2264  bRet = true;
2265  }
2266  return bRet;
2267 }
2268 
2269 static void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, weld::CheckButton& rBox)
2270 {
2271  sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId);
2272  SfxItemState eState = rSet.GetItemState(_nWhich);
2273  if( eState == SfxItemState::UNKNOWN || eState == SfxItemState::DISABLED )
2274  rBox.set_sensitive(false);
2275  else if(eState >= SfxItemState::DEFAULT)
2276  rBox.set_active(static_cast<const SfxBoolItem&>(rSet.Get(_nWhich)).GetValue());
2277  else
2278  rBox.set_state(TRISTATE_INDET);
2279  rBox.save_state();
2280 }
2281 
2283 {
2284  lcl_SetBox(*rSet, SID_ATTR_PARA_FORBIDDEN_RULES, *m_xForbiddenRulesCB );
2285  lcl_SetBox(*rSet, SID_ATTR_PARA_HANGPUNCTUATION, *m_xHangingPunctCB );
2286 
2287  //character distance not yet available
2288  lcl_SetBox(*rSet, SID_ATTR_PARA_SCRIPTSPACE, *m_xScriptSpaceCB );
2289 }
2290 
2292 {
2293  m_xForbiddenRulesCB->save_state();
2294  m_xHangingPunctCB->save_state();
2295  m_xScriptSpaceCB->save_state();
2296 }
2297 
2298 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::CheckButton > m_xRegisterCB
Definition: paragrph.hxx:83
bool GetValue() const
SvxBreak
sal_uInt8 & GetMaxHyphens()
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: paragrph.cxx:662
weld::TriStateEnabled aOrphanState
Definition: paragrph.hxx:231
void SetAdjust(SvxAdjust eNew)
static void SetLineSpace_Impl(SvxLineSpacingItem &, int, long lValue=0)
Definition: paragrph.cxx:100
bool Insert(const SvxTabStop &rTab)
FieldUnit
std::unique_ptr< RelativeField > m_xFLineIndent
Definition: paragrph.hxx:66
sal_uInt16 GetPropLineSpace() const
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: paragrph.cxx:2223
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: paragrph.cxx:2202
void SetHyphen(const bool bNew)
std::unique_ptr< weld::Label > m_xWidowRowLabel
Definition: paragrph.hxx:269
sal_uInt16 GetLower() const
SvxAdjust GetAdjust() const
std::unique_ptr< weld::ComboBox > m_xLineDist
Definition: paragrph.hxx:75
SfxStyleSheetBase * First()
void SetLower(sal_uInt16 nNew)
void SetInterLineSpace(const short nSpace)
virtual void ChangesApplied() override
Definition: paragrph.cxx:1860
std::unique_ptr< weld::RadioButton > m_xLeft
Definition: paragrph.hxx:138
std::unique_ptr< weld::MetricSpinButton > m_xLineDistAtPercentBox
Definition: paragrph.hxx:76
std::string GetValue
std::unique_ptr< weld::Widget > m_xRegisterFL
Definition: paragrph.hxx:82
bool IsAsianTypographyEnabled() const
short GetTextFirstLineOfst() const
IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox &, rBox, void)
Definition: paragrph.cxx:794
std::unique_ptr< weld::Label > m_xBreakPositionFT
Definition: paragrph.hxx:251
std::unique_ptr< weld::Label > m_xOrphanRowLabel
Definition: paragrph.hxx:265
SvxBreak GetBreak() const
std::unique_ptr< weld::ComboBox > m_xApplyCollBox
Definition: paragrph.hxx:254
std::unique_ptr< RelativeField > m_xBottomDist
Definition: paragrph.hxx:71
virtual void Reset(const SfxItemSet *rSet) override
Definition: paragrph.cxx:415
std::unique_ptr< RelativeField > m_xLeftIndent
Definition: paragrph.hxx:60
std::unique_ptr< weld::CheckButton > m_xWidowBox
Definition: paragrph.hxx:267
#define LASTLINECOUNT_OLD
Definition: paragrph.cxx:990
virtual ~SvxExtParagraphTabPage() override
Definition: paragrph.cxx:1985
void SetFirstLineOfst(short nNew)
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: paragrph.cxx:1142
sal_uInt16 GetValue() const
std::unique_ptr< weld::CheckButton > m_xHangingPunctCB
Definition: paragrph.hxx:298
weld::TriStateEnabled aApplyCollState
Definition: paragrph.hxx:227
std::unique_ptr< weld::RadioButton > m_xRight
Definition: paragrph.hxx:139
void SetTextLeft(const long nL, const sal_uInt16 nProp=100)
SvxExtParagraphTabPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: paragrph.cxx:1901
std::unique_ptr< weld::CheckButton > m_xSnapToGridCB
Definition: paragrph.hxx:149
std::unique_ptr< weld::Label > m_xAfterText
Definition: paragrph.hxx:242
std::unique_ptr< weld::ComboBox > m_xBreakTypeLB
Definition: paragrph.hxx:250
SvxFrameDirection
static const sal_uInt16 pStdRanges[]
Definition: paragrph.hxx:47
static SfxObjectShell * Current()
#define MAX_DURCH
Definition: paragrph.cxx:82
std::unique_ptr< weld::Label > m_xLeftBottom
Definition: paragrph.hxx:142
TRISTATE_TRUE
void SetLineSpaceRule(SvxLineSpaceRule e)
SvxInterLineSpaceRule
sal_uInt16 GetPropLower() const
SvxAdjust GetOneWord() const
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: paragrph.cxx:625
SvxLineSpaceRule GetLineSpaceRule() const
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: paragrph.cxx:2238
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
std::unique_ptr< weld::SpinButton > m_xWidowRowNo
Definition: paragrph.hxx:268
void SetLastBlock(const SvxAdjust eType)
virtual SfxStyleSheetBasePool * GetStyleSheetPool()
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
sal_uInt8 & GetMinLead()
static sal_uInt16 GetHtmlMode_Impl(const SfxItemSet &rSet)
Definition: paragrph.cxx:148
sal_uInt16 GetLineHeight() const
void SetPropLineSpace(const sal_uInt16 nProp)
#define LASTLINEPOS_DEFAULT
Definition: paragrph.cxx:987
const OUString & GetName() const
FUNC_TYPE const nType
void SetRightMargin(long nNew)
OUString SvxResId(const char *pId)
virtual void ChangesApplied() override
Definition: paragrph.cxx:2291
void SetExchangeSupport()
void SetOneWord(const SvxAdjust eType)
void SetUpper(sal_uInt16 nNew)
weld::TriStateEnabled aPageBreakState
Definition: paragrph.hxx:226
std::unique_ptr< svx::FrameDirectionListBox > m_xTextDirectionLB
Definition: paragrph.hxx:158
std::unique_ptr< weld::Label > m_xMaxHyphenLabel
Definition: paragrph.hxx:244
void SetLeftMargin(long nNew)
std::unique_ptr< weld::SpinButton > m_xExtHyphenBeforeBox
Definition: paragrph.hxx:241
std::unique_ptr< weld::Label > m_xLastLineFT
Definition: paragrph.hxx:145
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: paragrph.cxx:1061
TRISTATE_INDET
std::unique_ptr< RelativeField > m_xRightIndent
Definition: paragrph.hxx:63
virtual ~SvxAsianTabPage() override
Definition: paragrph.cxx:2219
virtual void set_active(bool active)=0
SvxParaPrevWindow m_aExampleWin
Definition: paragrph.hxx:135
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
virtual ~SvxStdParagraphTabPage() override
Definition: paragrph.cxx:705
SfxItemPool & GetPool() const
std::unique_ptr< weld::CheckButton > m_xForbiddenRulesCB
Definition: paragrph.hxx:297
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:264
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:260
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxItemSet * GetParent() const
std::unique_ptr< weld::CheckButton > m_xApplyCollBtn
Definition: paragrph.hxx:253
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:1573
SvxAdjust
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
std::unique_ptr< weld::Label > m_xRightTop
Definition: paragrph.hxx:143
LineSpaceList
Definition: paragrph.cxx:86
std::unique_ptr< weld::CheckButton > m_xContextualCB
Definition: paragrph.hxx:72
std::unique_ptr< weld::Label > m_xBeforeText
Definition: paragrph.hxx:240
#define LASTLINEPOS_LEFT
Definition: paragrph.cxx:988
std::unique_ptr< weld::ComboBox > m_xBreakPositionLB
Definition: paragrph.hxx:252
std::unique_ptr< weld::CheckButton > m_xScriptSpaceCB
Definition: paragrph.hxx:299
std::unique_ptr< weld::MetricSpinButton > m_xLineDistAtMetricBox
Definition: paragrph.hxx:77
std::unique_ptr< RelativeField > m_xTopDist
Definition: paragrph.hxx:70
std::unique_ptr< weld::SpinButton > m_xMaxHyphenEdit
Definition: paragrph.hxx:245
std::unique_ptr< weld::SpinButton > m_xPagenumEdit
Definition: paragrph.hxx:256
TRISTATE_FALSE
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
HTMLMODE_ON
sal_uInt16 GetPropLeft() const
Align GetValue() const
SvxAdjust GetLastBlock() const
std::unique_ptr< weld::RadioButton > m_xJustify
Definition: paragrph.hxx:141
std::unique_ptr< weld::Label > m_xBreakTypeFT
Definition: paragrph.hxx:249
SvxInterLineSpaceRule GetInterLineSpaceRule() const
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: paragrph.cxx:1881
std::unique_ptr< weld::RadioButton > m_xCenter
Definition: paragrph.hxx:140
SvxParaPrevWindow m_aExampleWin
Definition: paragrph.hxx:57
SvxParaAlignTabPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: paragrph.cxx:993
virtual void ChangesApplied() override
Definition: paragrph.cxx:1244
void SetAdjust(const SvxAdjust eType)
void SetMetricValue(weld::MetricSpinButton &rField, int nCoreValue, MapUnit eUnit)
virtual void ChangesApplied() override
Definition: paragrph.cxx:598
SfxItemPool * GetPool() const
static const sal_uInt16 pExtRanges[]
Definition: paragrph.hxx:204
short GetInterLineSpace() const
SvxStdParagraphTabPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: paragrph.cxx:671
std::unique_ptr< weld::SpinButton > m_xExtHyphenAfterBox
Definition: paragrph.hxx:243
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: paragrph.cxx:1358
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: paragrph.cxx:945
weld::TriStateEnabled aPageNumState
Definition: paragrph.hxx:228
weld::TriStateEnabled aKeepParaState
Definition: paragrph.hxx:230
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)
void SetTextFirstLineOfst(const short nF, const sal_uInt16 nProp=100)
static void lcl_SetBox(const SfxItemSet &rSet, sal_uInt16 nSlotId, weld::CheckButton &rBox)
Definition: paragrph.cxx:2269
weld::TriStateEnabled aHyphenState
Definition: paragrph.hxx:225
#define MM50
weld::TriStateEnabled aKeepTogetherState
Definition: paragrph.hxx:229
virtual void Reset(const SfxItemSet *rSet) override
Definition: paragrph.cxx:2282
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:155
std::unique_ptr< weld::CheckButton > m_xAutoCB
Definition: paragrph.hxx:67
unsigned char sal_uInt8
void SetLineHeight(const sal_uInt16 nHeight)
void SetLineSpace(SvxPrevLineSpace eNew)
std::unique_ptr< weld::CheckButton > m_xOrphanBox
Definition: paragrph.hxx:263
SfxStyleSheetBase * Next()
std::unique_ptr< weld::CheckButton > m_xKeepTogetherBox
Definition: paragrph.hxx:259
virtual ~SvxParaAlignTabPage() override
Definition: paragrph.cxx:1050
std::unique_ptr< weld::Label > m_xAbsDist
Definition: paragrph.hxx:79
static VclPtr< reference_type > Create(Arg &&...arg)
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:154
#define LASTLINECOUNT_NEW
Definition: paragrph.cxx:991
const OUString PERCENT("Percent")
bool IsHyphen() const
weld::TriStateEnabled aWidowState
Definition: paragrph.hxx:232
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: paragrph.cxx:1351
void SetSearchMask(SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
std::unique_ptr< weld::ComboBox > m_xLastLineLB
Definition: paragrph.hxx:146
void SetLastLine(SvxAdjust eNew)
static const sal_uInt16 * GetRanges()
Definition: paragrph.cxx:2228
#define FIX_DIST_DEF
Definition: paragrph.cxx:84
long GetRight() const
sal_uInt16 GetPropTextFirstLineOfst() const
DeactivateRC
SvxAsianTabPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: paragrph.cxx:2211
FieldUnit MapToFieldUnit(const MapUnit eUnit)
IMPL_LINK_NOARG(SvxStdParagraphTabPage, ELRLoseFocusHdl, weld::MetricSpinButton &, void)
Definition: paragrph.cxx:202
HTMLMODE_FULL_STYLES
MapUnit
SVX_DLLPUBLIC MSO_SPT Get(const OUString &)
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: paragrph.cxx:207
std::unique_ptr< weld::CheckButton > m_xPageNumBox
Definition: paragrph.hxx:255
void set_state(TriState eState)
static OUString EraseAllMnemonicChars(const OUString &rStr)
std::unique_ptr< weld::CheckButton > m_xExpandCB
Definition: paragrph.hxx:147
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:239
void EnableAbsLineDist(long nMinTwip)
Definition: paragrph.cxx:939
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: paragrph.cxx:212
TriState
static const sal_uInt16 pAlignRanges[]
Definition: paragrph.hxx:133
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
long GetTextLeft() const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
sal_Int32 nPos
bool GetApplyCharUnit(const SfxItemSet &rSet)
virtual SfxPoolItem * Clone(SfxItemPool *=nullptr) const override
bool IsAutoFirst() const
aStr
void SetLineSpacing_Impl(const SvxLineSpacingItem &rAttr)
Definition: paragrph.cxx:718
sal_uInt8 & GetMinTrail()
bool GetContext() const
virtual void Reset(const SfxItemSet *rSet) override
Definition: paragrph.cxx:1147
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:248
sal_uInt16 GetUpper() const
sal_uInt16 GetPropUpper() const