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