LibreOffice Module sw (master)  1
tabledlg.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 <hintids.hxx>
21 #include <vcl/svapp.hxx>
22 #include <vcl/weld.hxx>
23 #include <svl/stritem.hxx>
24 #include <svl/intitem.hxx>
25 #include <editeng/keepitem.hxx>
27 #include <editeng/ulspitem.hxx>
28 #include <editeng/frmdiritem.hxx>
29 #include <svl/ctloptions.hxx>
30 #include <swmodule.hxx>
31 #include <fmtpdsc.hxx>
32 #include <fmtlsplt.hxx>
33 
34 #include <svtools/htmlcfg.hxx>
35 #include <fmtrowsplt.hxx>
36 #include <sfx2/htmlmode.hxx>
37 #include <sfx2/sfxdlg.hxx>
38 
39 #include <strings.hrc>
40 #include <svx/strings.hrc>
41 #include <svx/dialmgr.hxx>
42 
43 #include <wrtsh.hxx>
44 #include <view.hxx>
45 #include <viewopt.hxx>
46 #include <uitool.hxx>
47 #include <tabledlg.hxx>
48 #include "../../uibase/table/tablepg.hxx"
49 #include <tablemgr.hxx>
50 #include <pagedesc.hxx>
51 #include <uiitems.hxx>
52 #include <poolfmt.hxx>
53 #include <swtablerep.hxx>
54 #include <SwStyleNameMapper.hxx>
55 
56 #include <cmdid.h>
57 #include <svx/dialogs.hrc>
58 #include <svx/flagsdef.hxx>
59 
60 #include <com/sun/star/text/HoriOrientation.hpp>
61 #include <com/sun/star/text/VertOrientation.hpp>
62 
63 using namespace ::com::sun::star;
64 
66  : SfxTabPage(pPage, pController, "modules/swriter/ui/formattablepage.ui", "FormatTablePage", &rSet)
67  , pTableData(nullptr)
68  , nSaveWidth(0)
69  , nMinTableWidth(MINLAY)
70  , bModified(false)
71  , bFull(false)
72  , bHtmlMode(false)
73  , m_xNameED(m_xBuilder->weld_entry("name"))
74  , m_xWidthFT(m_xBuilder->weld_label("widthft"))
75  , m_xWidthMF(new SwPercentField(m_xBuilder->weld_metric_spin_button("widthmf", FieldUnit::CM)))
76  , m_xRelWidthCB(m_xBuilder->weld_check_button("relwidth"))
77  , m_xFullBtn(m_xBuilder->weld_radio_button("full"))
78  , m_xLeftBtn(m_xBuilder->weld_radio_button("left"))
79  , m_xFromLeftBtn(m_xBuilder->weld_radio_button("fromleft"))
80  , m_xRightBtn(m_xBuilder->weld_radio_button("right"))
81  , m_xCenterBtn(m_xBuilder->weld_radio_button("center"))
82  , m_xFreeBtn(m_xBuilder->weld_radio_button("free"))
83  , m_xLeftFT(m_xBuilder->weld_label("leftft"))
84  , m_xLeftMF(new SwPercentField(m_xBuilder->weld_metric_spin_button("leftmf", FieldUnit::CM)))
85  , m_xRightFT(m_xBuilder->weld_label("rightft"))
86  , m_xRightMF(new SwPercentField(m_xBuilder->weld_metric_spin_button("rightmf", FieldUnit::CM)))
87  , m_xTopFT(m_xBuilder->weld_label("aboveft"))
88  , m_xTopMF(m_xBuilder->weld_metric_spin_button("abovemf", FieldUnit::CM))
89  , m_xBottomFT(m_xBuilder->weld_label("belowft"))
90  , m_xBottomMF(m_xBuilder->weld_metric_spin_button("belowmf", FieldUnit::CM))
91  , m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("textdirection")))
92  , m_xProperties(m_xBuilder->weld_widget("properties"))
93 {
94  //lock these to initial sizes so they don't change on percent to non percent change
95  Size aPrefSize(m_xLeftMF->get()->get_preferred_size());
96  m_xLeftMF->get()->set_size_request(aPrefSize.Width(), aPrefSize.Height());
97  m_xRightMF->get()->set_size_request(aPrefSize.Width(), aPrefSize.Height());
98  m_xWidthMF->get()->set_size_request(aPrefSize.Width(), aPrefSize.Height());
99 
100  m_xTextDirectionLB->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_FRAMEDIR_LTR));
101  m_xTextDirectionLB->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_FRAMEDIR_RTL));
102  m_xTextDirectionLB->append(SvxFrameDirection::Environment, SvxResId(RID_SVXSTR_FRAMEDIR_SUPER));
103 
105 
106  const SfxPoolItem* pItem;
107  if(SfxItemState::SET == rSet.GetItemState(SID_HTML_MODE, false, &pItem))
108  bHtmlMode = 0 != (static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON);
109 
110  bool bCTL = SW_MOD()->GetCTLOptions().IsCTLFontEnabled();
111  m_xProperties->set_visible(!bHtmlMode && bCTL);
112 
113  Init();
114 }
115 
117 {
118 }
119 
121 {
122  m_xLeftMF->SetMetricFieldMin(-999999);
123  m_xRightMF->SetMetricFieldMin(-999999);
124 
125  //handler
126  Link<weld::ToggleButton&,void> aLk2 = LINK( this, SwFormatTablePage, AutoClickHdl );
127  m_xFullBtn->connect_toggled( aLk2 );
128  m_xFreeBtn->connect_toggled( aLk2 );
129  m_xLeftBtn->connect_toggled( aLk2 );
130  m_xFromLeftBtn->connect_toggled( aLk2 );
131  m_xRightBtn->connect_toggled( aLk2 );
132  m_xCenterBtn->connect_toggled( aLk2 );
133 
134  Link<weld::MetricSpinButton&,void> aLk = LINK(this, SwFormatTablePage, ValueChangedHdl);
135  m_xTopMF->connect_value_changed(aLk);
136  m_xBottomMF->connect_value_changed(aLk);
137  m_xRightMF->connect_value_changed(aLk);
138  m_xLeftMF->connect_value_changed(aLk);
139  m_xWidthMF->connect_value_changed(aLk);
140 
141  m_xRelWidthCB->connect_toggled(LINK( this, SwFormatTablePage, RelWidthClickHdl ));
142 }
143 
144 IMPL_LINK( SwFormatTablePage, RelWidthClickHdl, weld::ToggleButton&, rBtn, void )
145 {
146  OSL_ENSURE(pTableData, "table data not available?");
147  bool bIsChecked = rBtn.get_active();
148  sal_Int64 nLeft = m_xLeftMF->DenormalizePercent(m_xLeftMF->get_value(FieldUnit::TWIP));
149  sal_Int64 nRight = m_xRightMF->DenormalizePercent(m_xRightMF->get_value(FieldUnit::TWIP));
150  m_xWidthMF->ShowPercent(bIsChecked);
151  m_xLeftMF->ShowPercent(bIsChecked);
152  m_xRightMF->ShowPercent(bIsChecked);
153 
154  if (bIsChecked)
155  {
156  m_xWidthMF->SetRefValue(pTableData->GetSpace());
157  m_xLeftMF->SetRefValue(pTableData->GetSpace());
158  m_xRightMF->SetRefValue(pTableData->GetSpace());
159  m_xLeftMF->SetMetricFieldMin(0); //will be overwritten by the Percentfield
160  m_xRightMF->SetMetricFieldMin(0); //dito
161  m_xLeftMF->SetMetricFieldMax(99);
162  m_xRightMF->SetMetricFieldMax(99);
163  m_xLeftMF->set_value(m_xLeftMF->NormalizePercent(nLeft ), FieldUnit::TWIP );
164  m_xRightMF->set_value(m_xRightMF->NormalizePercent(nRight ), FieldUnit::TWIP );
165  }
166  else
167  ModifyHdl(*m_xLeftMF->get()); //correct values again
168 
169  if (m_xFreeBtn->get_active())
170  {
171  bool bEnable = !rBtn.get_active();
172  m_xRightMF->set_sensitive(bEnable);
173  m_xRightFT->set_sensitive(bEnable);
174  }
175  bModified = true;
176 }
177 
179 {
180  bool bRestore = true,
181  bLeftEnable = false,
182  bRightEnable= false,
183  bWidthEnable= false,
184  bOthers = true;
185  if (m_xFullBtn->get_active())
186  {
187  m_xLeftMF->set_value(0);
188  m_xRightMF->set_value(0);
189  nSaveWidth = static_cast<SwTwips>(m_xWidthMF->DenormalizePercent(m_xWidthMF->get_value(FieldUnit::TWIP)));
190  m_xWidthMF->set_value(m_xWidthMF->NormalizePercent(pTableData->GetSpace()), FieldUnit::TWIP);
191  bFull = true;
192  bRestore = false;
193  }
194  else if (m_xLeftBtn->get_active())
195  {
196  bRightEnable = bWidthEnable = true;
197  m_xLeftMF->set_value(0);
198  }
199  else if (m_xFromLeftBtn->get_active())
200  {
201  bLeftEnable = bWidthEnable = true;
202  m_xRightMF->set_value(0);
203  }
204  else if (m_xRightBtn->get_active())
205  {
206  bLeftEnable = bWidthEnable = true;
207  m_xRightMF->set_value(0);
208  }
209  else if (m_xCenterBtn->get_active())
210  {
211  bLeftEnable = bWidthEnable = true;
212  }
213  else if (m_xFreeBtn->get_active())
214  {
215  RightModify();
216  bLeftEnable = true;
217  bWidthEnable = true;
218  bOthers = false;
219  }
220  m_xLeftMF->set_sensitive(bLeftEnable);
221  m_xLeftFT->set_sensitive(bLeftEnable);
222  m_xWidthMF->set_sensitive(bWidthEnable);
223  m_xWidthFT->set_sensitive(bWidthEnable);
224  if ( bOthers )
225  {
226  m_xRightMF->set_sensitive(bRightEnable);
227  m_xRightFT->set_sensitive(bRightEnable);
228  m_xRelWidthCB->set_sensitive(bWidthEnable);
229  }
230 
231  if(bFull && bRestore)
232  {
233  //After being switched on automatic, the width was pinned
234  //in order to restore the width while switching back to.
235  bFull = false;
236  m_xWidthMF->set_value(m_xWidthMF->NormalizePercent(nSaveWidth ), FieldUnit::TWIP );
237  }
238  ModifyHdl(*m_xWidthMF->get());
239  bModified = true;
240 }
241 
243 {
244  if (m_xFreeBtn->get_active())
245  {
246  bool bEnable = m_xRightMF->get_value() == 0;
247  m_xRelWidthCB->set_sensitive(bEnable);
248  if ( !bEnable )
249  {
250  m_xRelWidthCB->set_active(false);
251  RelWidthClickHdl(*m_xRelWidthCB);
252  }
253  bEnable = m_xRelWidthCB->get_active();
254  m_xRightMF->set_sensitive(!bEnable);
255  m_xRightFT->set_sensitive(!bEnable);
256  }
257 }
258 
259 IMPL_LINK( SwFormatTablePage, ValueChangedHdl, weld::MetricSpinButton&, rEdit, void )
260 {
261  if (m_xRightMF->get() == &rEdit)
262  RightModify();
263  ModifyHdl(rEdit);
264 }
265 
267 {
268  SwTwips nCurWidth = static_cast< SwTwips >(m_xWidthMF->DenormalizePercent(m_xWidthMF->get_value(FieldUnit::TWIP)));
269  SwTwips nPrevWidth = nCurWidth;
270  SwTwips nRight = static_cast< SwTwips >(m_xRightMF->DenormalizePercent(m_xRightMF->get_value(FieldUnit::TWIP)));
271  SwTwips nLeft = static_cast< SwTwips >(m_xLeftMF->DenormalizePercent(m_xLeftMF->get_value(FieldUnit::TWIP)));
272  SwTwips nDiff;
273 
274  if (&rEdit == m_xWidthMF->get())
275  {
276  if( nCurWidth < MINLAY )
277  nCurWidth = MINLAY;
278  nDiff = nRight + nLeft + nCurWidth - pTableData->GetSpace() ;
279  //right aligned: only change the left margin
280  if (m_xRightBtn->get_active())
281  nLeft -= nDiff;
282  //left aligned: only change the right margin
283  else if(m_xLeftBtn->get_active())
284  nRight -= nDiff;
285  //left margin and width allowed - first right - then left
286  else if (m_xFromLeftBtn->get_active())
287  {
288  if( nRight >= nDiff )
289  nRight -= nDiff;
290  else
291  {
292  nDiff -= nRight;
293  nRight = 0;
294  if(nLeft >= nDiff)
295  nLeft -= nDiff;
296  else
297  {
298  nRight += nLeft - nDiff;
299  nLeft = 0;
300  nCurWidth = pTableData->GetSpace();
301  }
302 
303  }
304  }
305  //centered: change both sides equally
306  else if (m_xCenterBtn->get_active())
307  {
308  if(nLeft != nRight)
309  {
310  nDiff += nLeft + nRight;
311  nLeft = nDiff/2;
312  nRight = nDiff/2;
313  }
314  else
315  {
316  nLeft -= nDiff/2;
317  nRight -= nDiff/2;
318  }
319  }
320  //free alignment: decrease both margins
321  else if (m_xFreeBtn->get_active())
322  {
323  nLeft -= nDiff/2;
324  nRight -= nDiff/2;
325  }
326  }
327  if (&rEdit == m_xRightMF->get())
328  {
329 
330  if( nRight + nLeft > pTableData->GetSpace() - MINLAY )
331  nRight = pTableData->GetSpace() -nLeft - MINLAY;
332 
333  nCurWidth = pTableData->GetSpace() - nLeft - nRight;
334  }
335  if (&rEdit == m_xLeftMF->get())
336  {
337  if(!m_xFromLeftBtn->get_active())
338  {
339  bool bCenter = m_xCenterBtn->get_active();
340  if( bCenter )
341  nRight = nLeft;
342  if(nRight + nLeft > pTableData->GetSpace() - MINLAY )
343  {
344  nLeft = bCenter ? (pTableData->GetSpace() - MINLAY) /2 :
345  (pTableData->GetSpace() - MINLAY) - nRight;
346  nRight = bCenter ? (pTableData->GetSpace() - MINLAY) /2 : nRight;
347  }
348  nCurWidth = pTableData->GetSpace() - nLeft - nRight;
349  }
350  else
351  {
352  //Upon changes on the left side the right margin will be changed at first,
353  //thereafter the width.
354  nDiff = nRight + nLeft + nCurWidth - pTableData->GetSpace() ;
355 
356  nRight -= nDiff;
357  nCurWidth = pTableData->GetSpace() - nLeft - nRight;
358  }
359  }
360  if (nCurWidth != nPrevWidth )
361  m_xWidthMF->set_value( m_xWidthMF->NormalizePercent( nCurWidth ), FieldUnit::TWIP );
362  m_xRightMF->set_value( m_xRightMF->NormalizePercent( nRight ), FieldUnit::TWIP );
363  m_xLeftMF->set_value( m_xLeftMF->NormalizePercent( nLeft ), FieldUnit::TWIP );
364  bModified = true;
365 }
366 
367 std::unique_ptr<SfxTabPage> SwFormatTablePage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet)
368 {
369  return std::make_unique<SwFormatTablePage>(pPage, pController, *rAttrSet);
370 }
371 
373 {
374  //Test if one of the controls still has the focus
375  if (m_xWidthMF->has_focus())
376  ModifyHdl(*m_xWidthMF->get());
377  else if (m_xLeftMF->has_focus())
378  ModifyHdl(*m_xLeftMF->get());
379  else if (m_xRightMF->has_focus())
380  ModifyHdl(*m_xRightMF->get());
381  else if (m_xTopMF->has_focus())
383  else if (m_xBottomMF->has_focus())
385 
386  if (bModified)
387  {
388  if (m_xBottomMF->get_value_changed_from_saved() ||
389  m_xTopMF->get_value_changed_from_saved() )
390  {
391  SvxULSpaceItem aULSpace(RES_UL_SPACE);
392  aULSpace.SetUpper(m_xTopMF->denormalize(m_xTopMF->get_value(FieldUnit::TWIP)));
393  aULSpace.SetLower(m_xBottomMF->denormalize(m_xBottomMF->get_value(FieldUnit::TWIP)));
394  rCoreSet->Put(aULSpace);
395  }
396 
397  }
398  if (m_xNameED->get_value_changed_from_saved())
399  {
400  rCoreSet->Put(SfxStringItem(FN_PARAM_TABLE_NAME, m_xNameED->get_text()));
401  bModified = true;
402  }
403 
404  if (m_xTextDirectionLB->get_visible())
405  {
406  if (m_xTextDirectionLB->get_value_changed_from_saved())
407  {
408  SvxFrameDirection nDirection = m_xTextDirectionLB->get_active_id();
409  rCoreSet->Put(SvxFrameDirectionItem(nDirection, RES_FRAMEDIR));
410  bModified = true;
411  }
412  }
413 
414  return bModified;
415 }
416 
418 {
419  const SfxItemSet& rSet = GetItemSet();
420  const SfxPoolItem* pItem;
421 
422  if(bHtmlMode)
423  {
424  m_xNameED->set_sensitive(false);
425  m_xTopFT->hide();
426  m_xTopMF->hide();
427  m_xBottomFT->hide();
428  m_xBottomMF->hide();
429  m_xFreeBtn->set_sensitive(false);
430  }
432  m_xWidthMF->SetMetric(aMetric);
433  m_xRightMF->SetMetric(aMetric);
434  m_xLeftMF->SetMetric(aMetric);
435  SetFieldUnit(*m_xTopMF, aMetric);
436  SetFieldUnit(*m_xBottomMF, aMetric);
437 
438  //Name
439  if(SfxItemState::SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, false, &pItem ))
440  {
441  m_xNameED->set_text(static_cast<const SfxStringItem*>(pItem)->GetValue());
442  m_xNameED->save_value();
443  }
444 
445  if(SfxItemState::SET == rSet.GetItemState( FN_TABLE_REP, false, &pItem ))
446  {
447  pTableData = static_cast<SwTableRep*>(static_cast<const SwPtrItem*>( pItem)->GetValue());
449 
451  {
452  m_xRelWidthCB->set_active(true);
453  RelWidthClickHdl(*m_xRelWidthCB);
454  m_xWidthMF->set_value(pTableData->GetWidthPercent(), FieldUnit::PERCENT);
455 
456  m_xWidthMF->save_value();
457  nSaveWidth = static_cast< SwTwips >(m_xWidthMF->get_value(FieldUnit::PERCENT));
458  }
459  else
460  {
461  m_xWidthMF->set_value(m_xWidthMF->NormalizePercent(
462  pTableData->GetWidth()), FieldUnit::TWIP);
463  m_xWidthMF->save_value();
466  }
467 
468  m_xWidthMF->SetRefValue(pTableData->GetSpace());
469 
470  m_xLeftMF->set_value(m_xLeftMF->NormalizePercent(
471  pTableData->GetLeftSpace()), FieldUnit::TWIP);
472  m_xRightMF->set_value(m_xRightMF->NormalizePercent(
473  pTableData->GetRightSpace()), FieldUnit::TWIP);
474  m_xLeftMF->save_value();
475  m_xRightMF->save_value();
476 
477  bool bSetRight = false, bSetLeft = false;
478  switch( pTableData->GetAlign() )
479  {
481  m_xFreeBtn->set_active(true);
482  if (m_xRelWidthCB->get_active())
483  bSetRight = true;
484  break;
485  case text::HoriOrientation::FULL:
486  {
487  bSetRight = bSetLeft = true;
488  m_xFullBtn->set_active(true);
489  m_xWidthMF->set_sensitive(false);
490  m_xRelWidthCB->set_sensitive(false);
491  m_xWidthFT->set_sensitive(false);
492  }
493  break;
494  case text::HoriOrientation::LEFT:
495  {
496  bSetLeft = true;
497  m_xLeftBtn->set_active(true);
498  }
499  break;
500  case text::HoriOrientation::LEFT_AND_WIDTH :
501  {
502  bSetRight = true;
503  m_xFromLeftBtn->set_active(true);
504  }
505  break;
506  case text::HoriOrientation::RIGHT:
507  {
508  bSetRight = true;
509  m_xRightBtn->set_active(true);
510  }
511  break;
512  case text::HoriOrientation::CENTER:
513  {
514  bSetRight = true;
515  m_xCenterBtn->set_active(true);
516  }
517  break;
518  }
519  if ( bSetRight )
520  {
521  m_xRightMF->set_sensitive(false);
522  m_xRightFT->set_sensitive(false);
523  }
524  if ( bSetLeft )
525  {
526  m_xLeftMF->set_sensitive(false);
527  m_xLeftFT->set_sensitive(false);
528  }
529 
530  }
531 
532  //Margins
533  if(SfxItemState::SET == rSet.GetItemState( RES_UL_SPACE, false,&pItem ))
534  {
535  m_xTopMF->set_value(m_xTopMF->normalize(
536  static_cast<const SvxULSpaceItem*>(pItem)->GetUpper()), FieldUnit::TWIP);
537  m_xBottomMF->set_value(m_xBottomMF->normalize(
538  static_cast<const SvxULSpaceItem*>(pItem)->GetLower()), FieldUnit::TWIP);
539  m_xTopMF->save_value();
540  m_xBottomMF->save_value();
541  }
542 
543  //Text direction
544  if( SfxItemState::SET == rSet.GetItemState( RES_FRAMEDIR, true, &pItem ) )
545  {
546  SvxFrameDirection nVal = static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue();
547  m_xTextDirectionLB->set_active_id(nVal);
548  m_xTextDirectionLB->save_value();
549  }
550 
551  m_xWidthMF->set_max( 2*m_xWidthMF->NormalizePercent( pTableData->GetSpace() ), FieldUnit::TWIP );
552  m_xRightMF->set_max( m_xRightMF->NormalizePercent( pTableData->GetSpace() ), FieldUnit::TWIP );
553  m_xLeftMF->set_max( m_xLeftMF->NormalizePercent( pTableData->GetSpace() ), FieldUnit::TWIP );
554  m_xWidthMF->set_min( m_xWidthMF->NormalizePercent( nMinTableWidth ), FieldUnit::TWIP );
555 }
556 
558 {
559  OSL_ENSURE(pTableData, "table data not available?");
560  if(SfxItemState::SET == rSet.GetItemState( FN_TABLE_REP ))
561  {
562  SwTwips nCurWidth = text::HoriOrientation::FULL != pTableData->GetAlign() ?
563  pTableData->GetWidth() :
564  pTableData->GetSpace();
565  if(pTableData->GetWidthPercent() == 0 &&
566  nCurWidth != m_xWidthMF->DenormalizePercent(m_xWidthMF->get_value(FieldUnit::TWIP)))
567  {
568  m_xWidthMF->set_value(m_xWidthMF->NormalizePercent(
569  nCurWidth), FieldUnit::TWIP);
570  m_xWidthMF->save_value();
571  nSaveWidth = nCurWidth;
572  m_xLeftMF->set_value(m_xLeftMF->NormalizePercent(
573  pTableData->GetLeftSpace()), FieldUnit::TWIP);
574  m_xLeftMF->save_value();
575  m_xRightMF->set_value(m_xRightMF->NormalizePercent(
576  pTableData->GetRightSpace()), FieldUnit::TWIP);
577  m_xRightMF->save_value();
578  }
579  }
580 }
581 
583 {
584  //test the table name for spaces
585  OUString sTableName = m_xNameED->get_text();
586  if(sTableName.indexOf(' ') != -1)
587  {
588  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
589  VclMessageType::Info, VclButtonsType::Ok,
590  SwResId(STR_WRONG_TABLENAME)));
591  xInfoBox->run();
592  m_xNameED->grab_focus();
593  return DeactivateRC::KeepPage;
594  }
595  if(_pSet)
596  {
597  FillItemSet(_pSet);
598  if(bModified)
599  {
600  SwTwips lLeft = static_cast< SwTwips >(m_xLeftMF->DenormalizePercent(m_xLeftMF->get_value(FieldUnit::TWIP)));
601  SwTwips lRight = static_cast< SwTwips >(m_xRightMF->DenormalizePercent(m_xRightMF->get_value(FieldUnit::TWIP)));
602 
603  if( m_xLeftMF->get_value_changed_from_saved() ||
604  m_xRightMF->get_value_changed_from_saved() )
605  {
607  pTableData->SetLeftSpace( lLeft);
608  pTableData->SetRightSpace( lRight);
609  }
610 
611  SwTwips lWidth;
612  if (m_xRelWidthCB->get_active() && m_xRelWidthCB->get_sensitive())
613  {
614  lWidth = pTableData->GetSpace() - lRight - lLeft;
615  const sal_uInt16 nPercentWidth = m_xWidthMF->get_value(FieldUnit::PERCENT);
616  if(pTableData->GetWidthPercent() != nPercentWidth)
617  {
618  pTableData->SetWidthPercent(nPercentWidth);
620  }
621  }
622  else
623  {
625  lWidth = static_cast<SwTwips>(m_xWidthMF->DenormalizePercent(m_xWidthMF->get_value(FieldUnit::TWIP)));
626  }
627  pTableData->SetWidth(lWidth);
628 
629  SwTwips nColSum = 0;
630 
631  for( sal_uInt16 i = 0; i < pTableData->GetColCount(); i++)
632  {
633  nColSum += pTableData->GetColumns()[i].nWidth;
634  }
635  if(nColSum != pTableData->GetWidth())
636  {
637  SwTwips nMinWidth = std::min( long(MINLAY),
638  static_cast<long>(pTableData->GetWidth() /
639  pTableData->GetColCount() - 1));
640  SwTwips nDiff = nColSum - pTableData->GetWidth();
641  while ( std::abs(nDiff) > pTableData->GetColCount() + 1 )
642  {
643  SwTwips nSub = nDiff / pTableData->GetColCount();
644  for( sal_uInt16 i = 0; i < pTableData->GetColCount(); i++)
645  {
646  if(pTableData->GetColumns()[i].nWidth - nMinWidth > nSub)
647  {
648  pTableData->GetColumns()[i].nWidth -= nSub;
649  nDiff -= nSub;
650  }
651  else
652  {
653  nDiff -= pTableData->GetColumns()[i].nWidth - nMinWidth;
654  pTableData->GetColumns()[i].nWidth = nMinWidth;
655  }
656 
657  }
658  }
659  }
660 
661  sal_Int16 nAlign = 0;
662  if (m_xRightBtn->get_active())
663  nAlign = text::HoriOrientation::RIGHT;
664  else if(m_xLeftBtn->get_active())
665  nAlign = text::HoriOrientation::LEFT;
666  else if(m_xFromLeftBtn->get_active())
667  nAlign = text::HoriOrientation::LEFT_AND_WIDTH;
668  else if(m_xCenterBtn->get_active())
669  nAlign = text::HoriOrientation::CENTER;
670  else if(m_xFreeBtn->get_active())
672  else if(m_xFullBtn->get_active())
673  {
674  nAlign = text::HoriOrientation::FULL;
675  lWidth = lAutoWidth;
676  }
677  if(nAlign != pTableData->GetAlign())
678  {
680  pTableData->SetAlign(nAlign);
681  }
682 
683  if(pTableData->GetWidth() != lWidth )
684  {
687  nAlign == text::HoriOrientation::FULL ? pTableData->GetSpace() : lWidth );
688  }
691  }
692  }
693  return DeactivateRC::LeavePage;
694 }
695 
696 //Description: Page column configuration
698  : SfxTabPage(pPage, pController, "modules/swriter/ui/tablecolumnpage.ui", "TableColumnPage", &rSet)
699  , m_pTableData(nullptr)
700  , m_pSizeHdlEvent(nullptr)
701  , m_nTableWidth(0)
702  , m_nMinWidth(MINLAY)
703  , m_nMetFields(MET_FIELDS)
704  , m_nNoOfCols(0)
705  , m_nNoOfVisibleCols(0)
706  , m_bModified(false)
707  , m_bModifyTable(false)
708  , m_bPercentMode(false)
709  , m_aFieldArr { m_xBuilder->weld_metric_spin_button("width1", FieldUnit::CM),
710  m_xBuilder->weld_metric_spin_button("width2", FieldUnit::CM),
711  m_xBuilder->weld_metric_spin_button("width3", FieldUnit::CM),
712  m_xBuilder->weld_metric_spin_button("width4", FieldUnit::CM),
713  m_xBuilder->weld_metric_spin_button("width5", FieldUnit::CM),
714  m_xBuilder->weld_metric_spin_button("width6", FieldUnit::CM) }
715  , m_aTextArr { m_xBuilder->weld_label("1"),
716  m_xBuilder->weld_label("2"),
717  m_xBuilder->weld_label("3"),
718  m_xBuilder->weld_label("4"),
719  m_xBuilder->weld_label("5"),
720  m_xBuilder->weld_label("6") }
721  , m_xModifyTableCB(m_xBuilder->weld_check_button("adaptwidth"))
722  , m_xProportionalCB(m_xBuilder->weld_check_button("adaptcolumns"))
723  , m_xSpaceFT(m_xBuilder->weld_label("spaceft"))
724  , m_xSpaceED(m_xBuilder->weld_metric_spin_button("space", FieldUnit::CM))
725  , m_xUpBtn(m_xBuilder->weld_button("next"))
726  , m_xDownBtn(m_xBuilder->weld_button("back"))
727 {
728  SetExchangeSupport();
729 
730  // fire off this handler to happen on next event loop when all the rest of
731  // the pages are instantiated and the dialog preferred size is that of the
732  // all the pages that currently exist and the rest to come after this one
733  m_pSizeHdlEvent = Application::PostUserEvent(LINK(this, SwTableColumnPage, SizeHdl));
734 
735  const SfxPoolItem* pItem;
736  Init(SfxItemState::SET == GetItemSet().GetItemState(SID_HTML_MODE, false, &pItem)
737  && static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON);
738 }
739 
740 IMPL_LINK_NOARG(SwTableColumnPage, SizeHdl, void*, void)
741 {
742  m_pSizeHdlEvent = nullptr;
743 
744  //tdf#120420 keeping showing column width fields unless
745  //the dialog begins to grow, then stop adding them
746  weld::Window* pTopLevel = GetFrameWeld();
747  Size aOrigSize = pTopLevel->get_preferred_size();
748  for (sal_uInt16 i = 0; i < MET_FIELDS; ++i)
749  {
750  m_aFieldArr[i].show();
751  m_aTextArr[i]->show();
752 
753  if (pTopLevel->get_preferred_size().Width() > aOrigSize.Width())
754  {
755  m_nMetFields = i + 1;
756  m_aTextArr[i]->set_grid_width(1);
757  m_xUpBtn->set_grid_left_attach(m_nMetFields * 2 - 1);
758  break;
759  }
760  }
761 }
762 
764 {
765  if (m_pSizeHdlEvent)
766  {
768  m_pSizeHdlEvent = nullptr;
769  }
770 }
771 
772 std::unique_ptr<SfxTabPage> SwTableColumnPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet)
773 {
774  return std::make_unique<SwTableColumnPage>(pPage, pController, *rAttrSet);
775 }
776 
778 {
779  const SfxItemSet& rSet = GetItemSet();
780 
781  const SfxPoolItem* pItem;
782  if(SfxItemState::SET == rSet.GetItemState( FN_TABLE_REP, false, &pItem ))
783  {
784  m_pTableData = static_cast<SwTableRep*>(static_cast<const SwPtrItem*>( pItem)->GetValue());
787  m_nTableWidth = m_pTableData->GetAlign() != text::HoriOrientation::FULL &&
788  m_pTableData->GetAlign() != text::HoriOrientation::LEFT_AND_WIDTH?
790 
791  for( sal_uInt16 i = 0; i < m_nNoOfCols; i++ )
792  {
795  }
796  sal_Int64 nMinTwips = m_aFieldArr[0].NormalizePercent( m_nMinWidth );
797  sal_Int64 nMaxTwips = m_aFieldArr[0].NormalizePercent( m_nTableWidth );
798  for( sal_uInt16 i = 0; (i < m_nMetFields) && (i < m_nNoOfVisibleCols); i++ )
799  {
800  m_aFieldArr[i].set_value( m_aFieldArr[i].NormalizePercent(
801  GetVisibleWidth(i) ), FieldUnit::TWIP );
802  m_aFieldArr[i].set_min(nMinTwips, FieldUnit::TWIP);
803  m_aFieldArr[i].set_max(nMaxTwips, FieldUnit::TWIP);
804  m_aFieldArr[i].set_sensitive(true);
805  m_aTextArr[i]->set_sensitive(true);
806  }
807 
809  {
810  m_xUpBtn->set_sensitive(true);
811  }
812 
813  for( sal_uInt16 i = m_nNoOfVisibleCols; i < m_nMetFields; ++i )
814  {
815  m_aFieldArr[i].set_text(OUString());
816  m_aTextArr[i]->set_sensitive(false);
817  }
818  }
819  ActivatePage(rSet);
820 
821 }
822 
823 void SwTableColumnPage::Init(bool bWeb)
824 {
825  FieldUnit aMetric = ::GetDfltMetric(bWeb);
826  Link<weld::MetricSpinButton&,void> aLk = LINK(this, SwTableColumnPage, ValueChangedHdl);
827  for (sal_uInt16 i = 0; i < MET_FIELDS; ++i)
828  {
829  m_aValueTable[i] = i;
830  m_aFieldArr[i].SetMetric(aMetric);
832  }
833  SetFieldUnit(*m_xSpaceED, aMetric);
834 
835  Link<weld::Button&,void> aClickLk = LINK(this, SwTableColumnPage, AutoClickHdl);
836  m_xUpBtn->connect_clicked(aClickLk);
837  m_xDownBtn->connect_clicked(aClickLk);
838 
839  Link<weld::ToggleButton&,void> aToggleLk = LINK(this, SwTableColumnPage, ModeHdl);
840  m_xModifyTableCB->connect_toggled(aToggleLk);
841  m_xProportionalCB->connect_toggled(aToggleLk);
842 }
843 
844 IMPL_LINK(SwTableColumnPage, AutoClickHdl, weld::Button&, rControl, void)
845 {
846  //move display window
847  if (&rControl == m_xDownBtn.get())
848  {
849  if(m_aValueTable[0] > 0)
850  {
851  for(sal_uInt16 & rn : m_aValueTable)
852  rn -= 1;
853  }
854  }
855  if (&rControl == m_xUpBtn.get())
856  {
857  if( m_aValueTable[ m_nMetFields -1 ] < m_nNoOfVisibleCols -1 )
858  {
859  for(sal_uInt16 & rn : m_aValueTable)
860  rn += 1;
861  }
862  }
863  for( sal_uInt16 i = 0; (i < m_nNoOfVisibleCols ) && ( i < m_nMetFields); i++ )
864  {
865  OUString sEntry('~');
866  OUString sIndex = OUString::number( m_aValueTable[i] + 1 );
867  sEntry += sIndex;
868  m_aTextArr[i]->set_label(sEntry);
869  }
870 
871  m_xDownBtn->set_sensitive(m_aValueTable[0] > 0);
872  m_xUpBtn->set_sensitive(m_aValueTable[ m_nMetFields -1 ] < m_nNoOfVisibleCols -1 );
873  UpdateCols(0);
874 }
875 
876 IMPL_LINK(SwTableColumnPage, ValueChangedHdl, weld::MetricSpinButton&, rEdit, void)
877 {
878  m_bModified = true;
879  ModifyHdl(&rEdit);
880 }
881 
883 {
884  const bool bCheck = rBox.get_active();
885  if (&rBox == m_xProportionalCB.get())
886  {
887  if (bCheck)
888  m_xModifyTableCB->set_active(true);
889  m_xModifyTableCB->set_sensitive(!bCheck && m_bModifyTable);
890  }
891 }
892 
894 {
895  for (SwPercentField & i : m_aFieldArr)
896  {
897  if (i.has_focus())
898  {
899  ModifyHdl(i.get());
900  break;
901  }
902  }
903 
904  if (m_bModified)
905  {
907  }
908  return m_bModified;
909 }
910 
912 {
913  SwPercentField *pEdit = nullptr;
914  sal_uInt16 i;
915 
916  for( i = 0; i < m_nMetFields; i++)
917  {
918  if (pField == m_aFieldArr[i].get())
919  {
920  pEdit = &m_aFieldArr[i];
921  break;
922  }
923  }
924 
925  if (m_nMetFields <= i || !pEdit)
926  {
927  OSL_ENSURE(false, "cannot happen.");
928  return;
929  }
930 
931  SetVisibleWidth(m_aValueTable[i], pEdit->DenormalizePercent(pEdit->get_value(FieldUnit::TWIP)));
932 
934 }
935 
936 void SwTableColumnPage::UpdateCols( sal_uInt16 nCurrentPos )
937 {
938  SwTwips nSum = 0;
939 
940  for( sal_uInt16 i = 0; i < m_nNoOfCols; i++ )
941  {
942  nSum += (m_pTableData->GetColumns())[i].nWidth;
943  }
944  SwTwips nDiff = nSum - m_nTableWidth;
945 
946  bool bModifyTableChecked = m_xModifyTableCB->get_active();
947  bool bProp = m_xProportionalCB->get_active();
948 
949  if (!bModifyTableChecked && !bProp)
950  {
951  //The table width is constant, the difference is balanced with the other columns
952  sal_uInt16 nLoopCount = 0;
953  while( nDiff )
954  {
955  if( ++nCurrentPos == m_nNoOfVisibleCols)
956  {
957  nCurrentPos = 0;
958  ++nLoopCount;
959  //#i101353# in small tables it might not be possible to balance column width
960  if( nLoopCount > 1 )
961  break;
962  }
963  if( nDiff < 0 )
964  {
965  SetVisibleWidth(nCurrentPos, GetVisibleWidth(nCurrentPos) -nDiff);
966  nDiff = 0;
967  }
968  else if( GetVisibleWidth(nCurrentPos) >= nDiff + m_nMinWidth )
969  {
970  SetVisibleWidth(nCurrentPos, GetVisibleWidth(nCurrentPos) -nDiff);
971  nDiff = 0;
972  }
973  if( nDiff > 0 && GetVisibleWidth(nCurrentPos) > m_nMinWidth )
974  {
975  if( nDiff >= (GetVisibleWidth(nCurrentPos) - m_nMinWidth) )
976  {
977  nDiff -= (GetVisibleWidth(nCurrentPos) - m_nMinWidth);
978  SetVisibleWidth(nCurrentPos, m_nMinWidth);
979  }
980  else
981  {
982  nDiff = 0;
983  SetVisibleWidth(nCurrentPos, GetVisibleWidth(nCurrentPos) -nDiff);
984  }
985  OSL_ENSURE(nDiff >= 0, "nDiff < 0 cannot be here!");
986  }
987  }
988  }
989  else if (bModifyTableChecked && !bProp)
990  {
991  //Difference is balanced by the width of the table,
992  //other columns remain unchanged.
993  OSL_ENSURE(nDiff <= m_pTableData->GetSpace() - m_nTableWidth, "wrong maximum" );
994  SwTwips nActSpace = m_pTableData->GetSpace() - m_nTableWidth;
995  if(nDiff > nActSpace)
996  {
997  m_nTableWidth = m_pTableData->GetSpace();
998  SetVisibleWidth(nCurrentPos, GetVisibleWidth(nCurrentPos) - nDiff + nActSpace );
999  }
1000  else
1001  {
1002  m_nTableWidth += nDiff;
1003  }
1004  }
1005  else if (bModifyTableChecked && bProp)
1006  {
1007  //All columns will be changed proportionally with,
1008  //the table width is adjusted accordingly.
1009  OSL_ENSURE(nDiff * m_nNoOfVisibleCols <= m_pTableData->GetSpace() - m_nTableWidth, "wrong maximum" );
1010  long nAdd = nDiff;
1012  {
1014  SetVisibleWidth(nCurrentPos, GetVisibleWidth(nCurrentPos) - nDiff + nAdd );
1015  nDiff = nAdd;
1016  }
1017  if(nAdd)
1018  for( sal_uInt16 i = 0; i < m_nNoOfVisibleCols; i++ )
1019  {
1020  if(i == nCurrentPos)
1021  continue;
1022  SwTwips nVisWidth;
1023  if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY)
1024  {
1025  nAdd += nVisWidth - MINLAY;
1026  SetVisibleWidth(i, MINLAY);
1027  }
1028  else
1029  {
1030  SetVisibleWidth(i, nVisWidth + nDiff);
1031  nAdd += nDiff;
1032  }
1033 
1034  }
1035  m_nTableWidth += nAdd;
1036  }
1037 
1038  if(!m_bPercentMode)
1039  m_xSpaceED->set_value(m_xSpaceED->normalize(m_pTableData->GetSpace() - m_nTableWidth), FieldUnit::TWIP);
1040 
1041  for( sal_uInt16 i = 0; ( i < m_nNoOfVisibleCols ) && ( i < m_nMetFields ); i++)
1042  {
1043  m_aFieldArr[i].set_value(m_aFieldArr[i].NormalizePercent(
1044  GetVisibleWidth(m_aValueTable[i]) ), FieldUnit::TWIP);
1045  }
1046 }
1047 
1049 {
1051  for( sal_uInt16 i = 0; (i < m_nMetFields) && (i < m_nNoOfVisibleCols); i++ )
1052  {
1055  }
1056 
1057  const sal_uInt16 nTableAlign = m_pTableData->GetAlign();
1058  if((text::HoriOrientation::FULL != nTableAlign && m_nTableWidth != m_pTableData->GetWidth()) ||
1059  (text::HoriOrientation::FULL == nTableAlign && m_nTableWidth != m_pTableData->GetSpace()))
1060  {
1061  m_nTableWidth = text::HoriOrientation::FULL == nTableAlign ?
1062  m_pTableData->GetSpace() :
1064  UpdateCols(0);
1065  }
1066  m_bModifyTable = true;
1067  if (m_pTableData->GetWidthPercent() ||
1068  text::HoriOrientation::FULL == nTableAlign ||
1070  m_bModifyTable = false;
1071  if (m_bPercentMode)
1072  {
1073  m_xModifyTableCB->set_active(false);
1074  m_xProportionalCB->set_active(false);
1075  }
1076  else if (!m_bModifyTable)
1077  {
1078  m_xProportionalCB->set_active(false);
1079  m_xModifyTableCB->set_active(false);
1080  }
1081  m_xSpaceFT->set_sensitive(!m_bPercentMode);
1082  m_xSpaceED->set_sensitive(!m_bPercentMode);
1083  m_xModifyTableCB->set_sensitive( !m_bPercentMode && m_bModifyTable );
1084  m_xProportionalCB->set_sensitive(!m_bPercentMode && m_bModifyTable );
1085 
1086  m_xSpaceED->set_value(m_xSpaceED->normalize(
1087  m_pTableData->GetSpace() - m_nTableWidth), FieldUnit::TWIP);
1088 
1089 }
1090 
1092 {
1093  if(_pSet)
1094  {
1095  FillItemSet(_pSet);
1096  if(text::HoriOrientation::FULL != m_pTableData->GetAlign() && m_pTableData->GetWidth() != m_nTableWidth)
1097  {
1101  switch( m_pTableData->GetAlign() )
1102  {
1103  case text::HoriOrientation::RIGHT:
1105  break;
1106  case text::HoriOrientation::LEFT:
1108  break;
1110  {
1111  SwTwips nDiff2 = nDiff/2;
1112  if( nDiff > 0 ||
1113  (-nDiff2 < m_pTableData->GetRightSpace() && - nDiff2 < m_pTableData->GetLeftSpace()))
1114  {
1117  }
1118  else
1119  {
1121  {
1124  }
1125  else
1126  {
1129  }
1130  }
1131  }
1132  break;
1133  case text::HoriOrientation::CENTER:
1136  break;
1137  case text::HoriOrientation::LEFT_AND_WIDTH :
1138  if(nDiff > m_pTableData->GetRightSpace())
1139  {
1141  }
1144  break;
1145  }
1147  }
1148  _pSet->Put(SwPtrItem( FN_TABLE_REP, m_pTableData ));
1149  }
1150  return DeactivateRC::LeavePage;
1151 }
1152 
1154 {
1155  sal_uInt16 i=0;
1156 
1157  while( nPos )
1158  {
1159  if(m_pTableData->GetColumns()[i].bVisible)
1160  nPos--;
1161  i++;
1162  }
1163  SwTwips nReturn = m_pTableData->GetColumns()[i].nWidth;
1164  OSL_ENSURE(i < m_nNoOfCols, "Array index out of range");
1165  while(!m_pTableData->GetColumns()[i].bVisible && (i + 1) < m_nNoOfCols)
1166  nReturn += m_pTableData->GetColumns()[++i].nWidth;
1167 
1168  return nReturn;
1169 }
1170 
1171 void SwTableColumnPage::SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth)
1172 {
1173  sal_uInt16 i=0;
1174  while( nPos )
1175  {
1176  if(m_pTableData->GetColumns()[i].bVisible)
1177  nPos--;
1178  i++;
1179  }
1180  OSL_ENSURE(i < m_nNoOfCols, "Array index out of range");
1181  m_pTableData->GetColumns()[i].nWidth = nNewWidth;
1182  while(!m_pTableData->GetColumns()[i].bVisible && (i + 1) < m_nNoOfCols)
1183  m_pTableData->GetColumns()[++i].nWidth = 0;
1184 
1185 }
1186 
1188  : SfxTabDialogController(pParent, "modules/swriter/ui/tableproperties.ui", "TablePropertiesDialog", pItemSet)
1189  , pShell(pSh)
1190 {
1192  AddTabPage("table", &SwFormatTablePage::Create, nullptr);
1193  AddTabPage("textflow", &SwTextFlowPage::Create, nullptr);
1194  AddTabPage("columns", &SwTableColumnPage::Create, nullptr);
1195  AddTabPage("background", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BKG), nullptr);
1196  AddTabPage("borders", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BORDER), nullptr);
1197 }
1198 
1199 void SwTableTabDlg::PageCreated(const OString& rId, SfxTabPage& rPage)
1200 {
1201  SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1202  if (rId == "background")
1203  {
1204  SvxBackgroundTabFlags const nFlagType = SvxBackgroundTabFlags::SHOW_TBLCTL;
1205  aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(nFlagType)));
1206  rPage.PageCreated(aSet);
1207  }
1208  else if (rId == "borders")
1209  {
1210  aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE, static_cast<sal_uInt16>(SwBorderModes::TABLE)));
1211  rPage.PageCreated(aSet);
1212  }
1213  else if (rId == "textflow")
1214  {
1215  static_cast<SwTextFlowPage&>(rPage).SetShell(pShell);
1216  const FrameTypeFlags eType = pShell->GetFrameType(nullptr,true);
1217  if( !(FrameTypeFlags::BODY & eType) )
1218  static_cast<SwTextFlowPage&>(rPage).DisablePageBreak();
1219  }
1220 }
1221 
1223  : SfxTabPage(pPage, pController, "modules/swriter/ui/tabletextflowpage.ui", "TableTextFlowPage", &rSet)
1224  , pShell(nullptr)
1225  , bPageBreak(true)
1226  , bHtmlMode(false)
1227  , m_xPgBrkCB(m_xBuilder->weld_check_button("break"))
1228  , m_xPgBrkRB(m_xBuilder->weld_radio_button("page"))
1229  , m_xColBrkRB(m_xBuilder->weld_radio_button("column"))
1230  , m_xPgBrkBeforeRB(m_xBuilder->weld_radio_button("before"))
1231  , m_xPgBrkAfterRB(m_xBuilder->weld_radio_button("after"))
1232  , m_xPageCollCB(m_xBuilder->weld_check_button("pagestyle"))
1233  , m_xPageCollLB(m_xBuilder->weld_combo_box("pagestylelb"))
1234  , m_xPageNoCB(m_xBuilder->weld_check_button("pagenoft"))
1235  , m_xPageNoNF(m_xBuilder->weld_spin_button("pagenonf"))
1236  , m_xSplitCB(m_xBuilder->weld_check_button("split"))
1237  , m_xSplitRowCB(m_xBuilder->weld_check_button("splitrow"))
1238  , m_xKeepCB(m_xBuilder->weld_check_button("keep"))
1239  , m_xHeadLineCB(m_xBuilder->weld_check_button("headline"))
1240  , m_xRepeatHeaderCombo(m_xBuilder->weld_widget("repeatheader"))
1241  , m_xRepeatHeaderNF(m_xBuilder->weld_spin_button("repeatheadernf"))
1242  , m_xTextDirectionLB(m_xBuilder->weld_combo_box("textorientation"))
1243  , m_xVertOrientLB(m_xBuilder->weld_combo_box("vertorient"))
1244 {
1245  m_xPgBrkCB->connect_toggled(LINK(this, SwTextFlowPage, PageBreakHdl_Impl));
1246  m_xPgBrkBeforeRB->connect_toggled(
1247  LINK(this, SwTextFlowPage, PageBreakPosHdl_Impl));
1248  m_xPgBrkAfterRB->connect_toggled(
1249  LINK(this, SwTextFlowPage, PageBreakPosHdl_Impl));
1250  m_xPageCollCB->connect_toggled(
1251  LINK(this, SwTextFlowPage, ApplyCollClickHdl_Impl));
1252  m_xColBrkRB->connect_toggled(
1253  LINK(this, SwTextFlowPage, PageBreakTypeHdl_Impl));
1254  m_xPgBrkRB->connect_toggled(
1255  LINK(this, SwTextFlowPage, PageBreakTypeHdl_Impl));
1256  m_xPageNoCB->connect_toggled(
1257  LINK(this, SwTextFlowPage, PageNoClickHdl_Impl));
1258  m_xSplitCB->connect_toggled(
1259  LINK(this, SwTextFlowPage, SplitHdl_Impl));
1260  m_xHeadLineCB->connect_toggled(LINK(this, SwTextFlowPage, HeadLineCBClickHdl));
1261 
1262  const SfxPoolItem *pItem;
1263  if(SfxItemState::SET == rSet.GetItemState( SID_HTML_MODE, false,&pItem )
1264  && static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON)
1265  {
1266  m_xKeepCB->hide();
1267  m_xSplitCB->hide();
1268  m_xSplitRowCB->hide();
1269  }
1270 
1271  HeadLineCBClickHdl(*m_xHeadLineCB);
1272 }
1273 
1275 {
1276 }
1277 
1278 std::unique_ptr<SfxTabPage> SwTextFlowPage::Create(weld::Container* pPage, weld::DialogController* pController,
1279  const SfxItemSet* rAttrSet)
1280 {
1281  return std::make_unique<SwTextFlowPage>(pPage, pController, *rAttrSet);
1282 }
1283 
1285 {
1286  bool bModified = false;
1287 
1288  //Repeat Heading
1289  if (m_xHeadLineCB->get_state_changed_from_saved() ||
1290  m_xRepeatHeaderNF->get_value_changed_from_saved() )
1291  {
1292  bModified |= nullptr != rSet->Put(
1293  SfxUInt16Item(FN_PARAM_TABLE_HEADLINE, m_xHeadLineCB->get_active() ? sal_uInt16(m_xRepeatHeaderNF->get_value()) : 0));
1294  }
1295  if (m_xKeepCB->get_state_changed_from_saved())
1296  bModified |= nullptr != rSet->Put( SvxFormatKeepItem( m_xKeepCB->get_active(), RES_KEEP));
1297 
1298  if (m_xSplitCB->get_state_changed_from_saved())
1299  bModified |= nullptr != rSet->Put( SwFormatLayoutSplit( m_xSplitCB->get_active()));
1300 
1301  if (m_xSplitRowCB->get_state_changed_from_saved())
1302  bModified |= nullptr != rSet->Put( SwFormatRowSplit( m_xSplitRowCB->get_active()));
1303 
1304  const SvxFormatBreakItem* pBreak = GetOldItem( *rSet, RES_BREAK );
1305  const SwFormatPageDesc* pDesc = GetOldItem( *rSet, RES_PAGEDESC );
1306 
1307  bool bState = m_xPageCollCB->get_active();
1308 
1309  //If we have a page style, then there's no break
1310  bool bPageItemPut = false;
1311  if ( bState != (m_xPageCollCB->get_saved_state() == TRISTATE_TRUE)
1312  || (bState && m_xPageCollLB->get_value_changed_from_saved())
1313  || (m_xPageNoCB->get_sensitive() && m_xPageNoCB->get_state_changed_from_saved())
1314  || (m_xPageNoNF->get_sensitive() && m_xPageNoNF->get_value_changed_from_saved()))
1315  {
1316  OUString sPage;
1317 
1318  if ( bState )
1319  {
1320  sPage = m_xPageCollLB->get_active_text();
1321  }
1322  sal_uInt16 nPgNum = static_cast<sal_uInt16>(m_xPageNoNF->get_value());
1323  bool const usePageNo(bState && m_xPageNoCB->get_active());
1324  std::optional<sal_uInt16> const oPageNum(
1325  usePageNo ? nPgNum : std::optional<sal_Int16>());
1326  if (!pDesc || !pDesc->GetPageDesc()
1327  || (pDesc->GetPageDesc()->GetName() != sPage)
1328  || (pDesc->GetNumOffset() != oPageNum))
1329  {
1330  SwFormatPageDesc aFormat( pShell->FindPageDescByName( sPage, true ) );
1331  aFormat.SetNumOffset(oPageNum);
1332  bModified |= nullptr != rSet->Put( aFormat );
1333  bPageItemPut = bState;
1334  }
1335  }
1336  bool bIsChecked = m_xPgBrkCB->get_active();
1337  if ( !bPageItemPut &&
1338  ( bState != (m_xPageCollCB->get_saved_state() == TRISTATE_TRUE) ||
1339  bIsChecked != (m_xPgBrkCB->get_saved_state() == TRISTATE_TRUE) ||
1340  m_xPgBrkBeforeRB->get_state_changed_from_saved() ||
1341  m_xPgBrkRB->get_state_changed_from_saved() ))
1342  {
1343  SvxFormatBreakItem aBreak( GetItemSet().Get( RES_BREAK ) );
1344 
1345  if(bIsChecked)
1346  {
1347  bool bBefore = m_xPgBrkBeforeRB->get_active();
1348 
1349  if (m_xPgBrkRB->get_active())
1350  {
1351  if ( bBefore )
1352  aBreak.SetValue( SvxBreak::PageBefore );
1353  else
1354  aBreak.SetValue( SvxBreak::PageAfter );
1355  }
1356  else
1357  {
1358  if ( bBefore )
1359  aBreak.SetValue( SvxBreak::ColumnBefore );
1360  else
1361  aBreak.SetValue( SvxBreak::ColumnAfter );
1362  }
1363  }
1364  else
1365  {
1366  aBreak.SetValue( SvxBreak::NONE );
1367  }
1368 
1369  if ( !pBreak || !( *pBreak == aBreak ) )
1370  {
1371  bModified |= nullptr != rSet->Put( aBreak );
1372  }
1373  }
1374 
1375  if (m_xTextDirectionLB->get_value_changed_from_saved())
1376  {
1377  OUString sId = m_xTextDirectionLB->get_active_id();
1378  bModified |= nullptr != rSet->Put(SvxFrameDirectionItem(static_cast<SvxFrameDirection>(sId.toUInt32()), FN_TABLE_BOX_TEXTORIENTATION));
1379  }
1380 
1381  if (m_xVertOrientLB->get_value_changed_from_saved())
1382  {
1383  sal_uInt16 nOrient = USHRT_MAX;
1384  switch (m_xVertOrientLB->get_active())
1385  {
1386  case 0 : nOrient = text::VertOrientation::NONE; break;
1387  case 1 : nOrient = text::VertOrientation::CENTER; break;
1388  case 2 : nOrient = text::VertOrientation::BOTTOM; break;
1389  }
1390  if (nOrient != USHRT_MAX)
1391  bModified |= nullptr != rSet->Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, nOrient));
1392  }
1393 
1394  return bModified;
1395 
1396 }
1397 
1399 {
1400  const SfxPoolItem* pItem;
1401  SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
1402  bool bFlowAllowed = !bHtmlMode || rHtmlOpt.IsPrintLayoutExtension();
1403  if(bFlowAllowed)
1404  {
1405  //Inserting of the existing page templates in the list box
1406  const size_t nCount = pShell->GetPageDescCnt();
1407 
1408  for( size_t i = 0; i < nCount; ++i)
1409  {
1410  const SwPageDesc &rPageDesc = pShell->GetPageDesc(i);
1411  m_xPageCollLB->append_text(rPageDesc.GetName());
1412  }
1413 
1414  OUString aFormatName;
1415  for (sal_uInt16 i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i)
1416  {
1417  aFormatName = SwStyleNameMapper::GetUIName(i, aFormatName);
1418  if (m_xPageCollLB->find_text(aFormatName) == -1)
1419  m_xPageCollLB->append_text(aFormatName);
1420  }
1421 
1422  if(SfxItemState::SET == rSet->GetItemState( RES_KEEP, false, &pItem ))
1423  {
1424  m_xKeepCB->set_active( static_cast<const SvxFormatKeepItem*>(pItem)->GetValue() );
1425  m_xKeepCB->save_state();
1426  }
1427  if(SfxItemState::SET == rSet->GetItemState( RES_LAYOUT_SPLIT, false, &pItem ))
1428  {
1429  m_xSplitCB->set_active( static_cast<const SwFormatLayoutSplit*>(pItem)->GetValue() );
1430  }
1431  else
1432  m_xSplitCB->set_active(true);
1433 
1434  m_xSplitCB->save_state();
1435  SplitHdl_Impl(*m_xSplitCB);
1436 
1437  if(SfxItemState::SET == rSet->GetItemState( RES_ROW_SPLIT, false, &pItem ))
1438  {
1439  m_xSplitRowCB->set_active( static_cast<const SwFormatRowSplit*>(pItem)->GetValue() );
1440  }
1441  else
1442  m_xSplitRowCB->set_state(TRISTATE_INDET);
1443  m_xSplitRowCB->save_state();
1444 
1445  if(bPageBreak)
1446  {
1447  if(SfxItemState::SET == rSet->GetItemState( RES_PAGEDESC, false, &pItem ))
1448  {
1449  OUString sPageDesc;
1450  const SwPageDesc* pDesc = static_cast<const SwFormatPageDesc*>(pItem)->GetPageDesc();
1451 
1452  ::std::optional<sal_uInt16> oNumOffset = static_cast<const SwFormatPageDesc*>(pItem)->GetNumOffset();
1453  if (oNumOffset)
1454  {
1455  m_xPageNoCB->set_active(true);
1456  m_xPageNoNF->set_sensitive(true);
1457  m_xPageNoNF->set_value(*oNumOffset);
1458  }
1459  else
1460  {
1461  m_xPageNoCB->set_active(false);
1462  m_xPageNoNF->set_sensitive(false);
1463  }
1464 
1465  if(pDesc)
1466  sPageDesc = pDesc->GetName();
1467  if (!sPageDesc.isEmpty() && m_xPageCollLB->find_text(sPageDesc) != -1)
1468  {
1469  m_xPageCollLB->set_active_text(sPageDesc);
1470  m_xPageCollCB->set_active(true);
1471 
1472  m_xPgBrkCB->set_sensitive(true);
1473  m_xPgBrkRB->set_sensitive(true);
1474  m_xColBrkRB->set_sensitive(true);
1475  m_xPgBrkBeforeRB->set_sensitive(true);
1476  m_xPgBrkAfterRB->set_sensitive(true);
1477  m_xPageCollCB->set_sensitive(true);
1478  m_xPgBrkCB->set_active(true);
1479 
1480  m_xPgBrkCB->set_active(true);
1481  m_xColBrkRB->set_active( false );
1482  m_xPgBrkBeforeRB->set_active(true);
1483  m_xPgBrkAfterRB->set_active( false );
1484  }
1485  else
1486  {
1487  m_xPageCollLB->set_active(-1);
1488  m_xPageCollCB->set_active(false);
1489  }
1490  }
1491 
1492  if(SfxItemState::SET == rSet->GetItemState( RES_BREAK, false, &pItem ))
1493  {
1494  const SvxFormatBreakItem* pPageBreak = static_cast<const SvxFormatBreakItem*>(pItem);
1495  SvxBreak eBreak = pPageBreak->GetBreak();
1496 
1497  if ( eBreak != SvxBreak::NONE )
1498  {
1499  m_xPgBrkCB->set_active(true);
1500  m_xPageCollCB->set_sensitive(false);
1501  m_xPageCollLB->set_sensitive(false);
1502  m_xPageNoCB->set_sensitive(false);
1503  m_xPageNoNF->set_sensitive(false);
1504  }
1505  switch ( eBreak )
1506  {
1507  case SvxBreak::PageBefore:
1508  m_xPgBrkRB->set_active(true);
1509  m_xColBrkRB->set_active( false );
1510  m_xPgBrkBeforeRB->set_active(true);
1511  m_xPgBrkAfterRB->set_active( false );
1512  break;
1513  case SvxBreak::PageAfter:
1514  m_xPgBrkRB->set_active(true);
1515  m_xColBrkRB->set_active( false );
1516  m_xPgBrkBeforeRB->set_active( false );
1517  m_xPgBrkAfterRB->set_active(true);
1518  break;
1519  case SvxBreak::ColumnBefore:
1520  m_xPgBrkRB->set_active( false );
1521  m_xColBrkRB->set_active(true);
1522  m_xPgBrkBeforeRB->set_active(true);
1523  m_xPgBrkAfterRB->set_active( false );
1524  break;
1525  case SvxBreak::ColumnAfter:
1526  m_xPgBrkRB->set_active( false );
1527  m_xColBrkRB->set_active(true);
1528  m_xPgBrkBeforeRB->set_active( false );
1529  m_xPgBrkAfterRB->set_active(true);
1530  break;
1531  default:; //prevent warning
1532  }
1533 
1534  }
1535  if (m_xPgBrkBeforeRB->get_active())
1536  PageBreakPosHdl_Impl(*m_xPgBrkBeforeRB);
1537  else if (m_xPgBrkAfterRB->get_active())
1538  PageBreakPosHdl_Impl(*m_xPgBrkAfterRB);
1539  PageBreakHdl_Impl(*m_xPgBrkCB);
1540  }
1541  }
1542  else
1543  {
1544  m_xPgBrkRB->set_sensitive(false);
1545  m_xColBrkRB->set_sensitive(false);
1546  m_xPgBrkBeforeRB->set_sensitive(false);
1547  m_xPgBrkAfterRB->set_sensitive(false);
1548  m_xKeepCB->set_sensitive(false);
1549  m_xSplitCB->set_sensitive(false);
1550  m_xPgBrkCB->set_sensitive(false);
1551  m_xPageCollCB->set_sensitive(false);
1552  m_xPageCollLB->set_sensitive(false);
1553  }
1554 
1555  if(SfxItemState::SET == rSet->GetItemState( FN_PARAM_TABLE_HEADLINE, false, &pItem ))
1556  {
1557  sal_uInt16 nRep = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1558  m_xHeadLineCB->set_active(nRep > 0);
1559  m_xHeadLineCB->save_state();
1560  m_xRepeatHeaderNF->set_value(nRep);
1561  m_xRepeatHeaderNF->set_min(1);
1562  m_xRepeatHeaderNF->save_value();
1563  }
1564  if ( rSet->GetItemState(FN_TABLE_BOX_TEXTORIENTATION) > SfxItemState::DEFAULT )
1565  {
1566  SvxFrameDirection nDirection =
1567  static_cast<const SvxFrameDirectionItem&>(rSet->Get(FN_TABLE_BOX_TEXTORIENTATION)).GetValue();
1568  m_xTextDirectionLB->set_active_id(OUString::number(static_cast<sal_uInt32>(nDirection)));
1569  }
1570 
1571  if ( rSet->GetItemState(FN_TABLE_SET_VERT_ALIGN) > SfxItemState::DEFAULT )
1572  {
1573  sal_uInt16 nVert = static_cast<const SfxUInt16Item&>(rSet->Get(FN_TABLE_SET_VERT_ALIGN)).GetValue();
1574  sal_uInt16 nPos = 0;
1575  switch(nVert)
1576  {
1577  case text::VertOrientation::NONE: nPos = 0; break;
1578  case text::VertOrientation::CENTER: nPos = 1; break;
1579  case text::VertOrientation::BOTTOM: nPos = 2; break;
1580  }
1581  m_xVertOrientLB->set_active(nPos);
1582  }
1583 
1584  m_xPageCollCB->save_state();
1585  m_xPageCollLB->save_value();
1586  m_xPgBrkCB->save_state();
1587  m_xPgBrkRB->save_state();
1588  m_xColBrkRB->save_state();
1589  m_xPgBrkBeforeRB->save_state();
1590  m_xPgBrkAfterRB->save_state();
1591  m_xPageNoCB->save_state();
1592  m_xPageNoNF->save_value();
1593  m_xTextDirectionLB->save_value();
1594  m_xVertOrientLB->save_value();
1595 
1596  HeadLineCBClickHdl(*m_xHeadLineCB);
1597 }
1598 
1600 {
1601  pShell = pSh;
1603  if(bHtmlMode)
1604  {
1605  m_xPageNoNF->set_sensitive(false);
1606  m_xPageNoCB->set_sensitive(false);
1607  }
1608 }
1609 
1611 {
1612  if (m_xPgBrkCB->get_active())
1613  {
1614  m_xPgBrkRB->set_sensitive(true);
1615  m_xColBrkRB->set_sensitive(true);
1616  m_xPgBrkBeforeRB->set_sensitive(true);
1617  m_xPgBrkAfterRB->set_sensitive(true);
1618 
1619  if (m_xPgBrkRB->get_active() && m_xPgBrkBeforeRB->get_active())
1620  {
1621  m_xPageCollCB->set_sensitive(true);
1622 
1623  bool bEnable = m_xPageCollCB->get_active() && m_xPageCollLB->get_count();
1624  m_xPageCollLB->set_sensitive(bEnable);
1625  if (!bHtmlMode)
1626  {
1627  m_xPageNoCB->set_sensitive(bEnable);
1628  m_xPageNoNF->set_sensitive(bEnable && m_xPageNoCB->get_active());
1629  }
1630  }
1631  }
1632  else
1633  {
1634  m_xPageCollCB->set_active(false);
1635  m_xPageCollCB->set_sensitive(false);
1636  m_xPageCollLB->set_sensitive(false);
1637  m_xPageNoCB->set_sensitive(false);
1638  m_xPageNoNF->set_sensitive(false);
1639  m_xPgBrkRB->set_sensitive(false);
1640  m_xColBrkRB->set_sensitive(false);
1641  m_xPgBrkBeforeRB->set_sensitive(false);
1642  m_xPgBrkAfterRB->set_sensitive(false);
1643  }
1644 }
1645 
1646 IMPL_LINK_NOARG(SwTextFlowPage, ApplyCollClickHdl_Impl, weld::ToggleButton&, void)
1647 {
1648  bool bEnable = false;
1649  if (m_xPageCollCB->get_active() && m_xPageCollLB->get_count())
1650  {
1651  bEnable = true;
1652  m_xPageCollLB->set_active(0);
1653  }
1654  else
1655  {
1656  m_xPageCollLB->set_active(-1);
1657  }
1658  m_xPageCollLB->set_sensitive(bEnable);
1659  if (!bHtmlMode)
1660  {
1661  m_xPageNoCB->set_sensitive(bEnable);
1662  m_xPageNoNF->set_sensitive(bEnable && m_xPageNoCB->get_active());
1663  }
1664 }
1665 
1666 IMPL_LINK_NOARG(SwTextFlowPage, PageBreakPosHdl_Impl, weld::ToggleButton&, void)
1667 {
1668  if (m_xPgBrkCB->get_active())
1669  {
1670  if (m_xPgBrkBeforeRB->get_active() && m_xPgBrkRB->get_active())
1671  {
1672  m_xPageCollCB->set_sensitive(true);
1673 
1674  bool bEnable = m_xPageCollCB->get_active() && m_xPageCollLB->get_count();
1675 
1676  m_xPageCollLB->set_sensitive(bEnable);
1677  if (!bHtmlMode)
1678  {
1679  m_xPageNoCB->set_sensitive(bEnable);
1680  m_xPageNoNF->set_sensitive(bEnable && m_xPageNoCB->get_active());
1681  }
1682  }
1683  else if (m_xPgBrkAfterRB->get_active())
1684  {
1685  m_xPageCollCB->set_active(false);
1686  m_xPageCollCB->set_sensitive(false);
1687  m_xPageCollLB->set_sensitive(false);
1688  m_xPageNoCB->set_sensitive(false);
1689  m_xPageNoNF->set_sensitive(false);
1690  }
1691  }
1692 }
1693 
1694 IMPL_LINK_NOARG(SwTextFlowPage, PageBreakTypeHdl_Impl, weld::ToggleButton&, void)
1695 {
1696  if (m_xColBrkRB->get_active() || m_xPgBrkAfterRB->get_active())
1697  {
1698  m_xPageCollCB->set_active(false);
1699  m_xPageCollCB->set_sensitive(false);
1700  m_xPageCollLB->set_sensitive(false);
1701  m_xPageNoCB->set_sensitive(false);
1702  m_xPageNoNF->set_sensitive(false);
1703  }
1704  else if (m_xPgBrkBeforeRB->get_active())
1705  PageBreakPosHdl_Impl(*m_xPgBrkBeforeRB);
1706 }
1707 
1709 {
1710  m_xPageNoNF->set_sensitive(m_xPageNoCB->get_active());
1711 }
1712 
1713 IMPL_LINK(SwTextFlowPage, SplitHdl_Impl, weld::ToggleButton&, rBox, void)
1714 {
1715  m_xSplitRowCB->set_sensitive(rBox.get_active());
1716 }
1717 
1719 {
1720  m_xRepeatHeaderCombo->set_sensitive(m_xHeadLineCB->get_active());
1721 }
1722 
1724 {
1725  bPageBreak = false;
1726  m_xPgBrkCB->set_sensitive(false);
1727  m_xPgBrkRB->set_sensitive(false);
1728  m_xColBrkRB->set_sensitive(false);
1729  m_xPgBrkBeforeRB->set_sensitive(false);
1730  m_xPgBrkAfterRB->set_sensitive(false);
1731  m_xPageCollCB->set_sensitive(false);
1732  m_xPageCollLB->set_sensitive(false);
1733  m_xPageNoCB->set_sensitive(false);
1734  m_xPageNoNF->set_sensitive(false);
1735 }
1736 
1737 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long Width() const
SvxBreak
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
std::unique_ptr< weld::Label > m_xRightFT
Definition: tablepg.hxx:59
const ::std::optional< sal_uInt16 > & GetNumOffset() const
Definition: fmtpdsc.hxx:65
std::unique_ptr< weld::Label > m_xSpaceFT
Definition: tablepg.hxx:110
bool IsPrintLayoutExtension() const
SwTwips nWidth
Definition: tablepg.hxx:32
sal_uInt16 m_nNoOfVisibleCols
Definition: tablepg.hxx:99
FieldUnit
std::unique_ptr< weld::ComboBox > m_xVertOrientLB
Definition: tablepg.hxx:159
SwFormatTablePage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: tabledlg.cxx:65
void SetRefValue(int nValue)
Definition: prcntfld.cxx:39
SwTableColumnPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: tabledlg.cxx:697
void SetLeftSpace(SwTwips nSet)
Definition: swtablerep.hxx:51
void Init()
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
size_t GetPageDescCnt() const
Definition: fedesc.cxx:37
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:62
std::unique_ptr< weld::RadioButton > m_xFreeBtn
Definition: tablepg.hxx:55
SwTextFlowPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: tabledlg.cxx:1222
virtual void PageCreated(const SfxAllItemSet &aSet)
static SfxAbstractDialogFactory * Create()
SwTwips GetLeftSpace() const
Definition: swtablerep.hxx:50
std::unique_ptr< weld::Label > m_xLeftFT
Definition: tablepg.hxx:57
std::string GetValue
sal_uInt16 m_aValueTable[MET_FIELDS]
Definition: tablepg.hxx:101
void UpdateCols(sal_uInt16 nCurrentPos)
Definition: tabledlg.cxx:936
bool HasWidthChanged() const
Definition: swtablerep.hxx:71
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(110)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tabledlg.cxx:1091
SwTwips m_nMinWidth
Definition: tablepg.hxx:96
sal_uInt16 char char * pDesc
SvxBreak GetBreak() const
void SetAlign(sal_uInt16 nSet)
Definition: swtablerep.hxx:63
void SetShell(SwViewShell *pSh)
Definition: newfrm.cxx:351
void ShowPercent(bool bPercent)
Definition: prcntfld.cxx:49
#define MINLAY
Definition: swtypes.hxx:66
SwWrtShell * pShell
Definition: tabledlg.hxx:30
std::unique_ptr< weld::RadioButton > m_xFullBtn
Definition: tablepg.hxx:50
void SetColsChanged()
Definition: swtablerep.hxx:69
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
long SwTwips
Definition: swtypes.hxx:49
std::unique_ptr< weld::SpinButton > m_xRepeatHeaderNF
Definition: tablepg.hxx:157
SvxFrameDirection
SfxItemSet * GetInputSetImpl()
#define FN_PARAM_TABLE_NAME
Definition: cmdid.h:770
SwTwips GetRightSpace() const
Definition: swtablerep.hxx:53
std::unique_ptr< weld::Label > m_xBottomFT
Definition: tablepg.hxx:63
TRISTATE_TRUE
virtual void Reset(const SfxItemSet *rSet) override
Definition: tabledlg.cxx:1398
SwTwips GetWidth() const
Definition: swtablerep.hxx:56
void set_min(int nNewMin, FieldUnit eInUnit)
Definition: prcntfld.cxx:134
void SetRightSpace(SwTwips nSet)
Definition: swtablerep.hxx:54
const OUString & GetName() const
Definition: pagedesc.hxx:187
constexpr TypedWhichId< SwFormatLayoutSplit > RES_LAYOUT_SPLIT(113)
std::unique_ptr< weld::Button > m_xDownBtn
Definition: tablepg.hxx:113
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
#define FN_PARAM_TABLE_HEADLINE
Definition: cmdid.h:771
std::unique_ptr< weld::CheckButton > m_xSplitCB
Definition: tablepg.hxx:152
const SwView & GetView() const
Definition: wrtsh.hxx:428
std::unique_ptr< SwPercentField > m_xRightMF
Definition: tablepg.hxx:60
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
void set_value(int nNewValue, FieldUnit eInUnit=FieldUnit::NONE)
Definition: prcntfld.cxx:107
SvxBackgroundTabFlags
OUString SvxResId(const char *pId)
std::unique_ptr< SwPercentField > m_xWidthMF
Definition: tablepg.hxx:47
sal_uInt16 GetAlign() const
Definition: swtablerep.hxx:62
std::unique_ptr< weld::CheckButton > m_xPageNoCB
Definition: tablepg.hxx:150
std::unique_ptr< weld::Label > m_xTopFT
Definition: tablepg.hxx:61
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: tabledlg.cxx:557
void SetExchangeSupport()
int nCount
SwTableTabDlg(weld::Window *pParent, const SfxItemSet *pItemSet, SwWrtShell *pSh)
Definition: tabledlg.cxx:1187
void set_sensitive(bool bEnable)
Definition: prcntfld.hxx:51
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: tabledlg.cxx:893
void connect_value_changed(const Link< weld::MetricSpinButton &, void > &rLink)
Definition: prcntfld.hxx:49
std::unique_ptr< weld::Entry > m_xNameED
Definition: tablepg.hxx:45
std::unique_ptr< weld::CheckButton > m_xKeepCB
Definition: tablepg.hxx:154
sal_uInt16 GetAllColCount() const
Definition: swtablerep.hxx:66
std::unique_ptr< weld::Label > m_aTextArr[MET_FIELDS]
Definition: tablepg.hxx:107
sal_uInt16 GetColCount() const
Definition: swtablerep.hxx:65
std::unique_ptr< weld::Widget > m_xProperties
Definition: tablepg.hxx:67
void SetWidth(SwTwips nSet)
Definition: swtablerep.hxx:57
TRISTATE_INDET
std::unique_ptr< weld::ComboBox > m_xPageCollLB
Definition: tablepg.hxx:149
sal_uInt16 GetWidthPercent() const
Definition: swtablerep.hxx:59
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
std::unique_ptr< weld::CheckButton > m_xSplitRowCB
Definition: tablepg.hxx:153
const SfxItemSet & GetItemSet() const
constexpr TypedWhichId< SwFormatRowSplit > RES_ROW_SPLIT(122)
static SvxHtmlOptions & Get()
DocumentType eType
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
void DisablePageBreak()
Definition: tabledlg.cxx:1723
#define SW_MOD()
Definition: swmodule.hxx:256
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:687
int i
void set_max(int nNewMax, FieldUnit eInUnit)
Definition: prcntfld.cxx:149
virtual ~SwFormatTablePage() override
Definition: tabledlg.cxx:116
std::unique_ptr< weld::RadioButton > m_xPgBrkBeforeRB
Definition: tablepg.hxx:146
int NormalizePercent(int nValue)
Definition: prcntfld.cxx:155
int get_value(FieldUnit eOutUnit=FieldUnit::NONE)
Definition: prcntfld.cxx:129
SwPercentField m_aFieldArr[MET_FIELDS]
Definition: tablepg.hxx:106
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:125
HTMLMODE_ON
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:62
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:337
SwTwips GetSpace() const
Definition: swtablerep.hxx:77
void SetWidthChanged()
Definition: swtablerep.hxx:72
sal_uInt16 m_nMetFields
Definition: tablepg.hxx:97
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: tabledlg.cxx:772
std::unique_ptr< SwPercentField > m_xLeftMF
Definition: tablepg.hxx:58
const SfxItemSet * GetItemSet(const SfxPoolItem &rAttr)
Returns the item set associated with a character/inet/auto style.
Definition: atrstck.cxx:133
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: tabledlg.cxx:367
std::unique_ptr< weld::ComboBox > m_xTextDirectionLB
Definition: tablepg.hxx:158
std::unique_ptr< weld::CheckButton > m_xPageCollCB
Definition: tablepg.hxx:148
OUString SwResId(const char *pId)
Definition: swmodule.cxx:178
std::unique_ptr< weld::MetricSpinButton > m_xSpaceED
Definition: tablepg.hxx:111
void ModifyHdl(const weld::MetricSpinButton &rEdit)
Definition: tabledlg.cxx:266
virtual Size get_preferred_size() const =0
IMPL_LINK_NOARG(SwFormatTablePage, AutoClickHdl, weld::ToggleButton &, void)
Definition: tabledlg.cxx:178
static sal_uInt16 nPgNum
Definition: viewport.cxx:49
SwTwips nMinTableWidth
Definition: tablepg.hxx:40
SwDocShell * GetDocShell()
Definition: view.cxx:1107
std::unique_ptr< weld::RadioButton > m_xPgBrkRB
Definition: tablepg.hxx:144
SwTwips nSaveWidth
Definition: tablepg.hxx:39
#define MET_FIELDS
Definition: tablepg.hxx:89
void ModifyHdl(const weld::MetricSpinButton *pEdit)
Definition: tabledlg.cxx:911
virtual void Reset(const SfxItemSet *rSet) override
Definition: tabledlg.cxx:777
std::unique_ptr< weld::SpinButton > m_xPageNoNF
Definition: tablepg.hxx:151
std::unique_ptr< svx::FrameDirectionListBox > m_xTextDirectionLB
Definition: tablepg.hxx:66
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void SetWidthPercent(sal_uInt16 nSet)
Definition: swtablerep.hxx:60
weld::Window * GetFrameWeld() const
std::unique_ptr< weld::RadioButton > m_xLeftBtn
Definition: tablepg.hxx:51
void SetShell(SwWrtShell *pSh)
Definition: tabledlg.cxx:1599
weld::Entry & rEdit
std::unique_ptr< weld::CheckButton > m_xHeadLineCB
Definition: tablepg.hxx:155
std::unique_ptr< weld::MetricSpinButton > m_xBottomMF
Definition: tablepg.hxx:64
sal_uInt16 m_nNoOfCols
Definition: tablepg.hxx:98
SwWrtShell * pShell
Definition: tablepg.hxx:139
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
std::unique_ptr< weld::RadioButton > m_xFromLeftBtn
Definition: tablepg.hxx:52
#define FN_TABLE_REP
Definition: cmdid.h:340
void SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth)
Definition: tabledlg.cxx:1171
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:253
std::unique_ptr< weld::RadioButton > m_xColBrkRB
Definition: tablepg.hxx:145
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
Definition: tabledlg.cxx:1199
IMPL_LINK(SwFormatTablePage, RelWidthClickHdl, weld::ToggleButton &, rBtn, void)
Definition: tabledlg.cxx:144
virtual ~SwTableColumnPage() override
Definition: tabledlg.cxx:763
virtual ~SwTextFlowPage() override
Definition: tabledlg.cxx:1274
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
int DenormalizePercent(int nValue)
Definition: prcntfld.cxx:164
static const OUString & GetUIName(const OUString &rName, SwGetPoolIdFromName)
std::unique_ptr< weld::MetricSpinButton > m_xTopMF
Definition: tablepg.hxx:62
#define FN_TABLE_BOX_TEXTORIENTATION
Definition: cmdid.h:425
TColumn * GetColumns() const
Definition: swtablerep.hxx:80
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
SwTwips GetVisibleWidth(sal_uInt16 nPos)
Definition: tabledlg.cxx:1153
DeactivateRC
SwPageDesc * FindPageDescByName(const OUString &rName, bool bGetFromPool=false, size_t *pPos=nullptr)
Definition: fedesc.cxx:130
OUString sId
bool IsLineSelected() const
Definition: swtablerep.hxx:74
bool bVisible
Definition: tablepg.hxx:33
std::unique_ptr< weld::Label > m_xWidthFT
Definition: tablepg.hxx:46
std::unique_ptr< weld::CheckButton > m_xProportionalCB
Definition: tablepg.hxx:109
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
void SetNumOffset(const ::std::optional< sal_uInt16 > &oNum)
Definition: fmtpdsc.hxx:66
void SetMetric(FieldUnit eUnit)
Definition: prcntfld.hxx:50
std::unique_ptr< weld::RadioButton > m_xPgBrkAfterRB
Definition: tablepg.hxx:147
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: tabledlg.cxx:1048
void set_text(const OUString &rStr)
Definition: prcntfld.hxx:56
std::unique_ptr< weld::CheckButton > m_xPgBrkCB
Definition: tablepg.hxx:143
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: tabledlg.cxx:1278
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
SwTableRep * pTableData
Definition: tablepg.hxx:38
#define FN_TABLE_SET_VERT_ALIGN
Definition: cmdid.h:421
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: tabledlg.cxx:372
std::unique_ptr< weld::RadioButton > m_xCenterBtn
Definition: tablepg.hxx:54
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:235
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
std::unique_ptr< weld::RadioButton > m_xRightBtn
Definition: tablepg.hxx:53
const SwTwips lAutoWidth
Definition: tablemgr.hxx:41
virtual void Reset(const SfxItemSet *rSet) override
Definition: tabledlg.cxx:417
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: tabledlg.cxx:1284
std::unique_ptr< weld::CheckButton > m_xModifyTableCB
Definition: tablepg.hxx:108
SwTableRep * m_pTableData
Definition: tablepg.hxx:93
ImplSVEvent * m_pSizeHdlEvent
Definition: tablepg.hxx:94
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tabledlg.cxx:582
sal_uInt16 nPos
void Init(bool bWeb)
Definition: tabledlg.cxx:823
std::unique_ptr< weld::CheckButton > m_xRelWidthCB
Definition: tablepg.hxx:48
SwTwips m_nTableWidth
Definition: tablepg.hxx:95
std::unique_ptr< weld::Button > m_xUpBtn
Definition: tablepg.hxx:112