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