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/weld.hxx>
22 #include <svl/stritem.hxx>
23 #include <svl/intitem.hxx>
24 #include <editeng/keepitem.hxx>
26 #include <editeng/ulspitem.hxx>
27 #include <editeng/frmdiritem.hxx>
28 #include <svl/ctloptions.hxx>
29 #include <swmodule.hxx>
30 #include <fmtornt.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 
38 #include <strings.hrc>
39 #include <svx/strings.hrc>
40 #include <svx/dialmgr.hxx>
41 
42 #include <docsh.hxx>
43 #include <wrtsh.hxx>
44 #include <view.hxx>
45 #include <viewopt.hxx>
46 #include <uitool.hxx>
47 #include <frmatr.hxx>
48 #include <tabledlg.hxx>
49 #include "../../uibase/table/tablepg.hxx"
50 #include <tablemgr.hxx>
51 #include <pagedesc.hxx>
52 #include <uiitems.hxx>
53 #include <poolfmt.hxx>
54 #include <SwStyleNameMapper.hxx>
55 
56 #include <app.hrc>
57 #include <cmdid.h>
58 #include <svx/svxids.hrc>
59 #include <svx/dialogs.hrc>
60 #include <svx/flagsdef.hxx>
61 #include <svx/svxdlg.hxx>
62 
63 using namespace ::com::sun::star;
64 
66  : SfxTabPage(pParent, "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 
368 {
369  return VclPtr<SwFormatTablePage>::Create(pParent, *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;
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;
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  //os: VCL doesn't take care of making the active widget
585  //in the dialog lose the focus
586  m_xNameED->grab_focus();
587  //test the table name for spaces
588  OUString sTableName = m_xNameED->get_text();
589  if(sTableName.indexOf(' ') != -1)
590  {
591  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
592  VclMessageType::Info, VclButtonsType::Ok,
593  SwResId(STR_WRONG_TABLENAME)));
594  xInfoBox->run();
595  m_xNameED->grab_focus();
596  return DeactivateRC::KeepPage;
597  }
598  if(_pSet)
599  {
600  FillItemSet(_pSet);
601  if(bModified)
602  {
603  SwTwips lLeft = static_cast< SwTwips >(m_xLeftMF->DenormalizePercent(m_xLeftMF->get_value(FieldUnit::TWIP)));
604  SwTwips lRight = static_cast< SwTwips >(m_xRightMF->DenormalizePercent(m_xRightMF->get_value(FieldUnit::TWIP)));
605 
606  if( m_xLeftMF->get_value_changed_from_saved() ||
607  m_xRightMF->get_value_changed_from_saved() )
608  {
610  pTableData->SetLeftSpace( lLeft);
611  pTableData->SetRightSpace( lRight);
612  }
613 
614  SwTwips lWidth;
615  if (m_xRelWidthCB->get_active() && m_xRelWidthCB->get_sensitive())
616  {
617  lWidth = pTableData->GetSpace() - lRight - lLeft;
618  const sal_uInt16 nPercentWidth = m_xWidthMF->get_value(FieldUnit::PERCENT);
619  if(pTableData->GetWidthPercent() != nPercentWidth)
620  {
621  pTableData->SetWidthPercent(nPercentWidth);
623  }
624  }
625  else
626  {
628  lWidth = static_cast<SwTwips>(m_xWidthMF->DenormalizePercent(m_xWidthMF->get_value(FieldUnit::TWIP)));
629  }
630  pTableData->SetWidth(lWidth);
631 
632  SwTwips nColSum = 0;
633 
634  for( sal_uInt16 i = 0; i < pTableData->GetColCount(); i++)
635  {
636  nColSum += pTableData->GetColumns()[i].nWidth;
637  }
638  if(nColSum != pTableData->GetWidth())
639  {
640  SwTwips nMinWidth = std::min( long(MINLAY),
641  static_cast<long>(pTableData->GetWidth() /
642  pTableData->GetColCount() - 1));
643  SwTwips nDiff = nColSum - pTableData->GetWidth();
644  while ( std::abs(nDiff) > pTableData->GetColCount() + 1 )
645  {
646  SwTwips nSub = nDiff / pTableData->GetColCount();
647  for( sal_uInt16 i = 0; i < pTableData->GetColCount(); i++)
648  {
649  if(pTableData->GetColumns()[i].nWidth - nMinWidth > nSub)
650  {
651  pTableData->GetColumns()[i].nWidth -= nSub;
652  nDiff -= nSub;
653  }
654  else
655  {
656  nDiff -= pTableData->GetColumns()[i].nWidth - nMinWidth;
657  pTableData->GetColumns()[i].nWidth = nMinWidth;
658  }
659 
660  }
661  }
662  }
663 
664  sal_Int16 nAlign = 0;
665  if (m_xRightBtn->get_active())
667  else if(m_xLeftBtn->get_active())
669  else if(m_xFromLeftBtn->get_active())
670  nAlign = text::HoriOrientation::LEFT_AND_WIDTH;
671  else if(m_xCenterBtn->get_active())
672  nAlign = text::HoriOrientation::CENTER;
673  else if(m_xFreeBtn->get_active())
675  else if(m_xFullBtn->get_active())
676  {
677  nAlign = text::HoriOrientation::FULL;
678  lWidth = lAutoWidth;
679  }
680  if(nAlign != pTableData->GetAlign())
681  {
683  pTableData->SetAlign(nAlign);
684  }
685 
686  if(pTableData->GetWidth() != lWidth )
687  {
690  nAlign == text::HoriOrientation::FULL ? pTableData->GetSpace() : lWidth );
691  }
694  }
695  }
696  return DeactivateRC::LeavePage;
697 }
698 
699 //Description: Page column configuration
701  : SfxTabPage(pParent, "modules/swriter/ui/tablecolumnpage.ui", "TableColumnPage", &rSet)
702  , pTableData(nullptr)
703  , nTableWidth(0)
704  , nMinWidth(MINLAY)
705  , nMetFields(MET_FIELDS)
706  , nNoOfCols(0)
707  , nNoOfVisibleCols(0)
708  , bModified(false)
709  , bModifyTable(false)
710  , bPercentMode(false)
711  , m_aFieldArr { m_xBuilder->weld_metric_spin_button("width1", FieldUnit::CM),
712  m_xBuilder->weld_metric_spin_button("width2", FieldUnit::CM),
713  m_xBuilder->weld_metric_spin_button("width3", FieldUnit::CM),
714  m_xBuilder->weld_metric_spin_button("width4", FieldUnit::CM),
715  m_xBuilder->weld_metric_spin_button("width5", FieldUnit::CM),
716  m_xBuilder->weld_metric_spin_button("width6", FieldUnit::CM) }
717  , m_aTextArr { m_xBuilder->weld_label("1"),
718  m_xBuilder->weld_label("2"),
719  m_xBuilder->weld_label("3"),
720  m_xBuilder->weld_label("4"),
721  m_xBuilder->weld_label("5"),
722  m_xBuilder->weld_label("6") }
723  , m_xModifyTableCB(m_xBuilder->weld_check_button("adaptwidth"))
724  , m_xProportionalCB(m_xBuilder->weld_check_button("adaptcolumns"))
725  , m_xSpaceFT(m_xBuilder->weld_label("spaceft"))
726  , m_xSpaceED(m_xBuilder->weld_metric_spin_button("space", FieldUnit::CM))
727  , m_xUpBtn(m_xBuilder->weld_button("next"))
728  , m_xDownBtn(m_xBuilder->weld_button("back"))
729 {
730  SetExchangeSupport();
731 
732  //tdf#120420 keeping showing column width fields unless
733  //the dialog begins to grow, then stop adding them
734  weld::Window* pTopLevel = pParent.GetFrameWeld();
735  Size aOrigSize = pTopLevel->get_preferred_size();
736  for (sal_uInt16 i = 0; i < MET_FIELDS; ++i)
737  {
738  m_aFieldArr[i].show();
739  m_aTextArr[i]->show();
740 
741  if (pTopLevel->get_preferred_size().Width() > aOrigSize.Width())
742  {
743  nMetFields = i + 1;
744  m_aTextArr[i]->set_grid_width(1);
745  m_xUpBtn->set_grid_left_attach(nMetFields * 2 - 1);
746  break;
747  }
748  }
749 
750  const SfxPoolItem* pItem;
751  Init(SfxItemState::SET == rSet.GetItemState( SID_HTML_MODE, false,&pItem )
752  && static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON);
753 }
754 
756 {
757 }
758 
760 {
761  return VclPtr<SwTableColumnPage>::Create(pParent, *rAttrSet);
762 }
763 
765 {
766  const SfxItemSet& rSet = GetItemSet();
767 
768  const SfxPoolItem* pItem;
769  if(SfxItemState::SET == rSet.GetItemState( FN_TABLE_REP, false, &pItem ))
770  {
771  pTableData = static_cast<SwTableRep*>(static_cast<const SwPtrItem*>( pItem)->GetValue());
774  nTableWidth = pTableData->GetAlign() != text::HoriOrientation::FULL &&
775  pTableData->GetAlign() != text::HoriOrientation::LEFT_AND_WIDTH?
777 
778  for( sal_uInt16 i = 0; i < nNoOfCols; i++ )
779  {
782  }
783  sal_Int64 nMinTwips = m_aFieldArr[0].NormalizePercent( nMinWidth );
784  sal_Int64 nMaxTwips = m_aFieldArr[0].NormalizePercent( nTableWidth );
785  for( sal_uInt16 i = 0; (i < nMetFields) && (i < nNoOfVisibleCols); i++ )
786  {
787  m_aFieldArr[i].set_value( m_aFieldArr[i].NormalizePercent(
788  GetVisibleWidth(i) ), FieldUnit::TWIP );
789  m_aFieldArr[i].set_min(nMinTwips, FieldUnit::TWIP);
790  m_aFieldArr[i].set_max(nMaxTwips, FieldUnit::TWIP);
791  m_aFieldArr[i].set_sensitive(true);
792  m_aTextArr[i]->set_sensitive(true);
793  }
794 
796  {
797  m_xUpBtn->set_sensitive(true);
798  }
799 
800  for( sal_uInt16 i = nNoOfVisibleCols; i < nMetFields; ++i )
801  {
802  m_aFieldArr[i].set_text(OUString());
803  m_aTextArr[i]->set_sensitive(false);
804  }
805  }
806  ActivatePage(rSet);
807 
808 }
809 
810 void SwTableColumnPage::Init(bool bWeb)
811 {
812  FieldUnit aMetric = ::GetDfltMetric(bWeb);
813  Link<weld::MetricSpinButton&,void> aLk = LINK(this, SwTableColumnPage, ValueChangedHdl);
814  for (sal_uInt16 i = 0; i < nMetFields; ++i)
815  {
816  aValueTable[i] = i;
817  m_aFieldArr[i].SetMetric(aMetric);
819  }
820  SetFieldUnit(*m_xSpaceED, aMetric);
821 
822  Link<weld::Button&,void> aClickLk = LINK(this, SwTableColumnPage, AutoClickHdl);
823  m_xUpBtn->connect_clicked(aClickLk);
824  m_xDownBtn->connect_clicked(aClickLk);
825 
826  Link<weld::ToggleButton&,void> aToggleLk = LINK(this, SwTableColumnPage, ModeHdl);
827  m_xModifyTableCB->connect_toggled(aToggleLk);
828  m_xProportionalCB->connect_toggled(aToggleLk);
829 }
830 
831 IMPL_LINK(SwTableColumnPage, AutoClickHdl, weld::Button&, rControl, void)
832 {
833  //move display window
834  if (&rControl == m_xDownBtn.get())
835  {
836  if(aValueTable[0] > 0)
837  {
838  for(sal_uInt16 & rn : aValueTable)
839  rn -= 1;
840  }
841  }
842  if (&rControl == m_xUpBtn.get())
843  {
844  if( aValueTable[ nMetFields -1 ] < nNoOfVisibleCols -1 )
845  {
846  for(sal_uInt16 & rn : aValueTable)
847  rn += 1;
848  }
849  }
850  for( sal_uInt16 i = 0; (i < nNoOfVisibleCols ) && ( i < nMetFields); i++ )
851  {
852  OUString sEntry('~');
853  OUString sIndex = OUString::number( aValueTable[i] + 1 );
854  sEntry += sIndex;
855  m_aTextArr[i]->set_label(sEntry);
856  }
857 
858  m_xDownBtn->set_sensitive(aValueTable[0] > 0);
859  m_xUpBtn->set_sensitive(aValueTable[ nMetFields -1 ] < nNoOfVisibleCols -1 );
860  UpdateCols(0);
861 }
862 
863 IMPL_LINK(SwTableColumnPage, ValueChangedHdl, weld::MetricSpinButton&, rEdit, void)
864 {
865  bModified = true;
866  ModifyHdl(&rEdit);
867 }
868 
870 {
871  const bool bCheck = rBox.get_active();
872  if (&rBox == m_xProportionalCB.get())
873  {
874  if (bCheck)
875  m_xModifyTableCB->set_active(true);
876  m_xModifyTableCB->set_sensitive(!bCheck && bModifyTable);
877  }
878 }
879 
881 {
882  for (SwPercentField & i : m_aFieldArr)
883  {
884  if (i.has_focus())
885  {
886  ModifyHdl(i.get());
887  break;
888  }
889  }
890 
891  if (bModified)
892  {
894  }
895  return bModified;
896 }
897 
899 {
900  SwPercentField *pEdit = nullptr;
901  sal_uInt16 i;
902 
903  for( i = 0; i < nMetFields; i++)
904  {
905  if (pField == m_aFieldArr[i].get())
906  {
907  pEdit = &m_aFieldArr[i];
908  break;
909  }
910  }
911 
912  if (nMetFields <= i || !pEdit)
913  {
914  OSL_ENSURE(false, "cannot happen.");
915  return;
916  }
917 
918  SetVisibleWidth(aValueTable[i], pEdit->DenormalizePercent(pEdit->get_value(FieldUnit::TWIP)));
919 
920  UpdateCols( aValueTable[i] );
921 }
922 
923 void SwTableColumnPage::UpdateCols( sal_uInt16 nCurrentPos )
924 {
925  SwTwips nSum = 0;
926 
927  for( sal_uInt16 i = 0; i < nNoOfCols; i++ )
928  {
929  nSum += (pTableData->GetColumns())[i].nWidth;
930  }
931  SwTwips nDiff = nSum - nTableWidth;
932 
933  bool bModifyTableChecked = m_xModifyTableCB->get_active();
934  bool bProp = m_xProportionalCB->get_active();
935 
936  if (!bModifyTableChecked && !bProp)
937  {
938  //The table width is constant, the difference is balanced with the other columns
939  sal_uInt16 nLoopCount = 0;
940  while( nDiff )
941  {
942  if( ++nCurrentPos == nNoOfVisibleCols)
943  {
944  nCurrentPos = 0;
945  ++nLoopCount;
946  //#i101353# in small tables it might not be possible to balance column width
947  if( nLoopCount > 1 )
948  break;
949  }
950  if( nDiff < 0 )
951  {
952  SetVisibleWidth(nCurrentPos, GetVisibleWidth(nCurrentPos) -nDiff);
953  nDiff = 0;
954  }
955  else if( GetVisibleWidth(nCurrentPos) >= nDiff + nMinWidth )
956  {
957  SetVisibleWidth(nCurrentPos, GetVisibleWidth(nCurrentPos) -nDiff);
958  nDiff = 0;
959  }
960  if( nDiff > 0 && GetVisibleWidth(nCurrentPos) > nMinWidth )
961  {
962  if( nDiff >= (GetVisibleWidth(nCurrentPos) - nMinWidth) )
963  {
964  nDiff -= (GetVisibleWidth(nCurrentPos) - nMinWidth);
965  SetVisibleWidth(nCurrentPos, nMinWidth);
966  }
967  else
968  {
969  nDiff = 0;
970  SetVisibleWidth(nCurrentPos, GetVisibleWidth(nCurrentPos) -nDiff);
971  }
972  OSL_ENSURE(nDiff >= 0, "nDiff < 0 cannot be here!");
973  }
974  }
975  }
976  else if (bModifyTableChecked && !bProp)
977  {
978  //Difference is balanced by the width of the table,
979  //other columns remain unchanged.
980  OSL_ENSURE(nDiff <= pTableData->GetSpace() - nTableWidth, "wrong maximum" );
981  SwTwips nActSpace = pTableData->GetSpace() - nTableWidth;
982  if(nDiff > nActSpace)
983  {
984  nTableWidth = pTableData->GetSpace();
985  SetVisibleWidth(nCurrentPos, GetVisibleWidth(nCurrentPos) - nDiff + nActSpace );
986  }
987  else
988  {
989  nTableWidth += nDiff;
990  }
991  }
992  else if (bModifyTableChecked && bProp)
993  {
994  //All columns will be changed proportionally with,
995  //the table width is adjusted accordingly.
996  OSL_ENSURE(nDiff * nNoOfVisibleCols <= pTableData->GetSpace() - nTableWidth, "wrong maximum" );
997  long nAdd = nDiff;
999  {
1001  SetVisibleWidth(nCurrentPos, GetVisibleWidth(nCurrentPos) - nDiff + nAdd );
1002  nDiff = nAdd;
1003  }
1004  if(nAdd)
1005  for( sal_uInt16 i = 0; i < nNoOfVisibleCols; i++ )
1006  {
1007  if(i == nCurrentPos)
1008  continue;
1009  SwTwips nVisWidth;
1010  if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY)
1011  {
1012  nAdd += nVisWidth - MINLAY;
1013  SetVisibleWidth(i, MINLAY);
1014  }
1015  else
1016  {
1017  SetVisibleWidth(i, nVisWidth + nDiff);
1018  nAdd += nDiff;
1019  }
1020 
1021  }
1022  nTableWidth += nAdd;
1023  }
1024 
1025  if(!bPercentMode)
1026  m_xSpaceED->set_value(m_xSpaceED->normalize(pTableData->GetSpace() - nTableWidth), FieldUnit::TWIP);
1027 
1028  for( sal_uInt16 i = 0; ( i < nNoOfVisibleCols ) && ( i < nMetFields ); i++)
1029  {
1030  m_aFieldArr[i].set_value(m_aFieldArr[i].NormalizePercent(
1031  GetVisibleWidth(aValueTable[i]) ), FieldUnit::TWIP);
1032  }
1033 }
1034 
1036 {
1038  for( sal_uInt16 i = 0; (i < nMetFields) && (i < nNoOfVisibleCols); i++ )
1039  {
1042  }
1043 
1044  const sal_uInt16 nTableAlign = pTableData->GetAlign();
1045  if((text::HoriOrientation::FULL != nTableAlign && nTableWidth != pTableData->GetWidth()) ||
1046  (text::HoriOrientation::FULL == nTableAlign && nTableWidth != pTableData->GetSpace()))
1047  {
1048  nTableWidth = text::HoriOrientation::FULL == nTableAlign ?
1049  pTableData->GetSpace() :
1050  pTableData->GetWidth();
1051  UpdateCols(0);
1052  }
1053  bModifyTable = true;
1054  if (pTableData->GetWidthPercent() ||
1055  text::HoriOrientation::FULL == nTableAlign ||
1057  bModifyTable = false;
1058  if (bPercentMode)
1059  {
1060  m_xModifyTableCB->set_active(false);
1061  m_xProportionalCB->set_active(false);
1062  }
1063  else if (!bModifyTable)
1064  {
1065  m_xProportionalCB->set_active(false);
1066  m_xModifyTableCB->set_active(false);
1067  }
1068  m_xSpaceFT->set_sensitive(!bPercentMode);
1069  m_xSpaceED->set_sensitive(!bPercentMode);
1070  m_xModifyTableCB->set_sensitive( !bPercentMode && bModifyTable );
1071  m_xProportionalCB->set_sensitive(!bPercentMode && bModifyTable );
1072 
1073  m_xSpaceED->set_value(m_xSpaceED->normalize(
1074  pTableData->GetSpace() - nTableWidth), FieldUnit::TWIP);
1075 
1076 }
1077 
1079 {
1080  if(_pSet)
1081  {
1082  FillItemSet(_pSet);
1083  if(text::HoriOrientation::FULL != pTableData->GetAlign() && pTableData->GetWidth() != nTableWidth)
1084  {
1086  SwTwips nDiff = pTableData->GetSpace() - pTableData->GetWidth() -
1088  switch( pTableData->GetAlign() )
1089  {
1092  break;
1095  break;
1097  {
1098  SwTwips nDiff2 = nDiff/2;
1099  if( nDiff > 0 ||
1100  (-nDiff2 < pTableData->GetRightSpace() && - nDiff2 < pTableData->GetLeftSpace()))
1101  {
1104  }
1105  else
1106  {
1108  {
1111  }
1112  else
1113  {
1116  }
1117  }
1118  }
1119  break;
1120  case text::HoriOrientation::CENTER:
1123  break;
1124  case text::HoriOrientation::LEFT_AND_WIDTH :
1125  if(nDiff > pTableData->GetRightSpace())
1126  {
1128  }
1131  break;
1132  }
1134  }
1135  _pSet->Put(SwPtrItem( FN_TABLE_REP, pTableData ));
1136  }
1137  return DeactivateRC::LeavePage;
1138 }
1139 
1141 {
1142  sal_uInt16 i=0;
1143 
1144  while( nPos )
1145  {
1146  if(pTableData->GetColumns()[i].bVisible)
1147  nPos--;
1148  i++;
1149  }
1150  SwTwips nReturn = pTableData->GetColumns()[i].nWidth;
1151  OSL_ENSURE(i < nNoOfCols, "Array index out of range");
1152  while(!pTableData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols)
1153  nReturn += pTableData->GetColumns()[++i].nWidth;
1154 
1155  return nReturn;
1156 }
1157 
1158 void SwTableColumnPage::SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth)
1159 {
1160  sal_uInt16 i=0;
1161  while( nPos )
1162  {
1163  if(pTableData->GetColumns()[i].bVisible)
1164  nPos--;
1165  i++;
1166  }
1167  OSL_ENSURE(i < nNoOfCols, "Array index out of range");
1168  pTableData->GetColumns()[i].nWidth = nNewWidth;
1169  while(!pTableData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols)
1170  pTableData->GetColumns()[++i].nWidth = 0;
1171 
1172 }
1173 
1175  : SfxTabDialogController(pParent, "modules/swriter/ui/tableproperties.ui", "TablePropertiesDialog", pItemSet)
1176  , pShell(pSh)
1177 {
1179  AddTabPage("table", &SwFormatTablePage::Create, nullptr);
1180  AddTabPage("textflow", &SwTextFlowPage::Create, nullptr);
1181  AddTabPage("columns", &SwTableColumnPage::Create, nullptr);
1182  AddTabPage("background", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BKG), nullptr);
1183  AddTabPage("borders", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_BORDER), nullptr);
1184 }
1185 
1186 void SwTableTabDlg::PageCreated(const OString& rId, SfxTabPage& rPage)
1187 {
1188  SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
1189  if (rId == "background")
1190  {
1191  SvxBackgroundTabFlags const nFlagType = SvxBackgroundTabFlags::SHOW_TBLCTL;
1192  aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(nFlagType)));
1193  rPage.PageCreated(aSet);
1194  }
1195  else if (rId == "borders")
1196  {
1197  aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE, static_cast<sal_uInt16>(SwBorderModes::TABLE)));
1198  rPage.PageCreated(aSet);
1199  }
1200  else if (rId == "textflow")
1201  {
1202  static_cast<SwTextFlowPage&>(rPage).SetShell(pShell);
1203  const FrameTypeFlags eType = pShell->GetFrameType(nullptr,true);
1204  if( !(FrameTypeFlags::BODY & eType) )
1205  static_cast<SwTextFlowPage&>(rPage).DisablePageBreak();
1206  }
1207 }
1208 
1210  : SfxTabPage(pParent, "modules/swriter/ui/tabletextflowpage.ui", "TableTextFlowPage", &rSet)
1211  , pShell(nullptr)
1212  , bPageBreak(true)
1213  , bHtmlMode(false)
1214  , m_xPgBrkCB(m_xBuilder->weld_check_button("break"))
1215  , m_xPgBrkRB(m_xBuilder->weld_radio_button("page"))
1216  , m_xColBrkRB(m_xBuilder->weld_radio_button("column"))
1217  , m_xPgBrkBeforeRB(m_xBuilder->weld_radio_button("before"))
1218  , m_xPgBrkAfterRB(m_xBuilder->weld_radio_button("after"))
1219  , m_xPageCollCB(m_xBuilder->weld_check_button("pagestyle"))
1220  , m_xPageCollLB(m_xBuilder->weld_combo_box("pagestylelb"))
1221  , m_xPageNoCB(m_xBuilder->weld_check_button("pagenoft"))
1222  , m_xPageNoNF(m_xBuilder->weld_spin_button("pagenonf"))
1223  , m_xSplitCB(m_xBuilder->weld_check_button("split"))
1224  , m_xSplitRowCB(m_xBuilder->weld_check_button("splitrow"))
1225  , m_xKeepCB(m_xBuilder->weld_check_button("keep"))
1226  , m_xHeadLineCB(m_xBuilder->weld_check_button("headline"))
1227  , m_xRepeatHeaderCombo(m_xBuilder->weld_widget("repeatheader"))
1228  , m_xRepeatHeaderNF(m_xBuilder->weld_spin_button("repeatheadernf"))
1229  , m_xTextDirectionLB(m_xBuilder->weld_combo_box("textorientation"))
1230  , m_xVertOrientLB(m_xBuilder->weld_combo_box("vertorient"))
1231 {
1232  m_xPgBrkCB->connect_toggled(LINK(this, SwTextFlowPage, PageBreakHdl_Impl));
1233  m_xPgBrkBeforeRB->connect_toggled(
1234  LINK(this, SwTextFlowPage, PageBreakPosHdl_Impl));
1235  m_xPgBrkAfterRB->connect_toggled(
1236  LINK(this, SwTextFlowPage, PageBreakPosHdl_Impl));
1237  m_xPageCollCB->connect_toggled(
1238  LINK(this, SwTextFlowPage, ApplyCollClickHdl_Impl));
1239  m_xColBrkRB->connect_toggled(
1240  LINK(this, SwTextFlowPage, PageBreakTypeHdl_Impl));
1241  m_xPgBrkRB->connect_toggled(
1242  LINK(this, SwTextFlowPage, PageBreakTypeHdl_Impl));
1243  m_xPageNoCB->connect_toggled(
1244  LINK(this, SwTextFlowPage, PageNoClickHdl_Impl));
1245  m_xSplitCB->connect_toggled(
1246  LINK(this, SwTextFlowPage, SplitHdl_Impl));
1247  m_xHeadLineCB->connect_toggled(LINK(this, SwTextFlowPage, HeadLineCBClickHdl));
1248 
1249  const SfxPoolItem *pItem;
1250  if(SfxItemState::SET == rSet.GetItemState( SID_HTML_MODE, false,&pItem )
1251  && static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON)
1252  {
1253  m_xKeepCB->hide();
1254  m_xSplitCB->hide();
1255  m_xSplitRowCB->hide();
1256  }
1257 
1258  HeadLineCBClickHdl(*m_xHeadLineCB);
1259 }
1260 
1262 {
1263 }
1264 
1266  const SfxItemSet* rAttrSet)
1267 {
1268  return VclPtr<SwTextFlowPage>::Create(pParent, *rAttrSet);
1269 }
1270 
1272 {
1273  bool bModified = false;
1274 
1275  //Repeat Heading
1276  if (m_xHeadLineCB->get_state_changed_from_saved() ||
1277  m_xRepeatHeaderNF->get_value_changed_from_saved() )
1278  {
1279  bModified |= nullptr != rSet->Put(
1280  SfxUInt16Item(FN_PARAM_TABLE_HEADLINE, m_xHeadLineCB->get_active() ? sal_uInt16(m_xRepeatHeaderNF->get_value()) : 0));
1281  }
1282  if (m_xKeepCB->get_state_changed_from_saved())
1283  bModified |= nullptr != rSet->Put( SvxFormatKeepItem( m_xKeepCB->get_active(), RES_KEEP));
1284 
1285  if (m_xSplitCB->get_state_changed_from_saved())
1286  bModified |= nullptr != rSet->Put( SwFormatLayoutSplit( m_xSplitCB->get_active()));
1287 
1288  if (m_xSplitRowCB->get_state_changed_from_saved())
1289  bModified |= nullptr != rSet->Put( SwFormatRowSplit( m_xSplitRowCB->get_active()));
1290 
1291  const SvxFormatBreakItem* pBreak = GetOldItem( *rSet, RES_BREAK );
1292  const SwFormatPageDesc* pDesc = GetOldItem( *rSet, RES_PAGEDESC );
1293 
1294  bool bState = m_xPageCollCB->get_active();
1295 
1296  //If we have a page style, then there's no break
1297  bool bPageItemPut = false;
1298  if ( bState != (m_xPageCollCB->get_saved_state() == TRISTATE_TRUE)
1299  || (bState && m_xPageCollLB->get_value_changed_from_saved())
1300  || (m_xPageNoCB->get_sensitive() && m_xPageNoCB->get_state_changed_from_saved())
1301  || (m_xPageNoNF->get_sensitive() && m_xPageNoNF->get_value_changed_from_saved()))
1302  {
1303  OUString sPage;
1304 
1305  if ( bState )
1306  {
1307  sPage = m_xPageCollLB->get_active_text();
1308  }
1309  sal_uInt16 nPgNum = static_cast<sal_uInt16>(m_xPageNoNF->get_value());
1310  bool const usePageNo(bState && m_xPageNoCB->get_active());
1311  boost::optional<sal_uInt16> const oPageNum(
1312  usePageNo ? nPgNum : boost::optional<sal_Int16>());
1313  if (!pDesc || !pDesc->GetPageDesc()
1314  || (pDesc->GetPageDesc()->GetName() != sPage)
1315  || (pDesc->GetNumOffset() != oPageNum))
1316  {
1317  SwFormatPageDesc aFormat( pShell->FindPageDescByName( sPage, true ) );
1318  aFormat.SetNumOffset(oPageNum);
1319  bModified |= nullptr != rSet->Put( aFormat );
1320  bPageItemPut = bState;
1321  }
1322  }
1323  bool bIsChecked = m_xPgBrkCB->get_active();
1324  if ( !bPageItemPut &&
1325  ( bState != (m_xPageCollCB->get_saved_state() == TRISTATE_TRUE) ||
1326  bIsChecked != (m_xPgBrkCB->get_saved_state() == TRISTATE_TRUE) ||
1327  m_xPgBrkBeforeRB->get_state_changed_from_saved() ||
1328  m_xPgBrkRB->get_state_changed_from_saved() ))
1329  {
1330  SvxFormatBreakItem aBreak( GetItemSet().Get( RES_BREAK ) );
1331 
1332  if(bIsChecked)
1333  {
1334  bool bBefore = m_xPgBrkBeforeRB->get_active();
1335 
1336  if (m_xPgBrkRB->get_active())
1337  {
1338  if ( bBefore )
1339  aBreak.SetValue( SvxBreak::PageBefore );
1340  else
1341  aBreak.SetValue( SvxBreak::PageAfter );
1342  }
1343  else
1344  {
1345  if ( bBefore )
1346  aBreak.SetValue( SvxBreak::ColumnBefore );
1347  else
1348  aBreak.SetValue( SvxBreak::ColumnAfter );
1349  }
1350  }
1351  else
1352  {
1353  aBreak.SetValue( SvxBreak::NONE );
1354  }
1355 
1356  if ( !pBreak || !( *pBreak == aBreak ) )
1357  {
1358  bModified |= nullptr != rSet->Put( aBreak );
1359  }
1360  }
1361 
1362  if (m_xTextDirectionLB->get_value_changed_from_saved())
1363  {
1364  OUString sId = m_xTextDirectionLB->get_active_id();
1365  bModified |= nullptr != rSet->Put(SvxFrameDirectionItem(static_cast<SvxFrameDirection>(sId.toUInt32()), FN_TABLE_BOX_TEXTORIENTATION));
1366  }
1367 
1368  if (m_xVertOrientLB->get_value_changed_from_saved())
1369  {
1370  sal_uInt16 nOrient = USHRT_MAX;
1371  switch (m_xVertOrientLB->get_active())
1372  {
1373  case 0 : nOrient = text::VertOrientation::NONE; break;
1374  case 1 : nOrient = text::VertOrientation::CENTER; break;
1375  case 2 : nOrient = text::VertOrientation::BOTTOM; break;
1376  }
1377  if (nOrient != USHRT_MAX)
1378  bModified |= nullptr != rSet->Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, nOrient));
1379  }
1380 
1381  return bModified;
1382 
1383 }
1384 
1386 {
1387  const SfxPoolItem* pItem;
1388  SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
1389  bool bFlowAllowed = !bHtmlMode || rHtmlOpt.IsPrintLayoutExtension();
1390  if(bFlowAllowed)
1391  {
1392  //Inserting of the existing page templates in the list box
1393  const size_t nCount = pShell->GetPageDescCnt();
1394 
1395  for( size_t i = 0; i < nCount; ++i)
1396  {
1397  const SwPageDesc &rPageDesc = pShell->GetPageDesc(i);
1398  m_xPageCollLB->append_text(rPageDesc.GetName());
1399  }
1400 
1401  OUString aFormatName;
1402  for (sal_uInt16 i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i)
1403  {
1404  aFormatName = SwStyleNameMapper::GetUIName(i, aFormatName);
1405  if (m_xPageCollLB->find_text(aFormatName) == -1)
1406  m_xPageCollLB->append_text(aFormatName);
1407  }
1408 
1409  if(SfxItemState::SET == rSet->GetItemState( RES_KEEP, false, &pItem ))
1410  {
1411  m_xKeepCB->set_active( static_cast<const SvxFormatKeepItem*>(pItem)->GetValue() );
1412  m_xKeepCB->save_state();
1413  }
1414  if(SfxItemState::SET == rSet->GetItemState( RES_LAYOUT_SPLIT, false, &pItem ))
1415  {
1416  m_xSplitCB->set_active( static_cast<const SwFormatLayoutSplit*>(pItem)->GetValue() );
1417  }
1418  else
1419  m_xSplitCB->set_active(true);
1420 
1421  m_xSplitCB->save_state();
1422  SplitHdl_Impl(*m_xSplitCB);
1423 
1424  if(SfxItemState::SET == rSet->GetItemState( RES_ROW_SPLIT, false, &pItem ))
1425  {
1426  m_xSplitRowCB->set_active( static_cast<const SwFormatRowSplit*>(pItem)->GetValue() );
1427  }
1428  else
1429  m_xSplitRowCB->set_state(TRISTATE_INDET);
1430  m_xSplitRowCB->save_state();
1431 
1432  if(bPageBreak)
1433  {
1434  if(SfxItemState::SET == rSet->GetItemState( RES_PAGEDESC, false, &pItem ))
1435  {
1436  OUString sPageDesc;
1437  const SwPageDesc* pDesc = static_cast<const SwFormatPageDesc*>(pItem)->GetPageDesc();
1438 
1439  ::boost::optional<sal_uInt16> oNumOffset = static_cast<const SwFormatPageDesc*>(pItem)->GetNumOffset();
1440  if (oNumOffset)
1441  {
1442  m_xPageNoCB->set_active(true);
1443  m_xPageNoNF->set_sensitive(true);
1444  m_xPageNoNF->set_value(oNumOffset.get());
1445  }
1446  else
1447  {
1448  m_xPageNoCB->set_active(false);
1449  m_xPageNoNF->set_sensitive(false);
1450  }
1451 
1452  if(pDesc)
1453  sPageDesc = pDesc->GetName();
1454  if (!sPageDesc.isEmpty() && m_xPageCollLB->find_text(sPageDesc) != -1)
1455  {
1456  m_xPageCollLB->set_active_text(sPageDesc);
1457  m_xPageCollCB->set_active(true);
1458 
1459  m_xPgBrkCB->set_sensitive(true);
1460  m_xPgBrkRB->set_sensitive(true);
1461  m_xColBrkRB->set_sensitive(true);
1462  m_xPgBrkBeforeRB->set_sensitive(true);
1463  m_xPgBrkAfterRB->set_sensitive(true);
1464  m_xPageCollCB->set_sensitive(true);
1465  m_xPgBrkCB->set_active(true);
1466 
1467  m_xPgBrkCB->set_active(true);
1468  m_xColBrkRB->set_active( false );
1469  m_xPgBrkBeforeRB->set_active(true);
1470  m_xPgBrkAfterRB->set_active( false );
1471  }
1472  else
1473  {
1474  m_xPageCollLB->set_active(-1);
1475  m_xPageCollCB->set_active(false);
1476  }
1477  }
1478 
1479  if(SfxItemState::SET == rSet->GetItemState( RES_BREAK, false, &pItem ))
1480  {
1481  const SvxFormatBreakItem* pPageBreak = static_cast<const SvxFormatBreakItem*>(pItem);
1482  SvxBreak eBreak = pPageBreak->GetBreak();
1483 
1484  if ( eBreak != SvxBreak::NONE )
1485  {
1486  m_xPgBrkCB->set_active(true);
1487  m_xPageCollCB->set_sensitive(false);
1488  m_xPageCollLB->set_sensitive(false);
1489  m_xPageNoCB->set_sensitive(false);
1490  m_xPageNoNF->set_sensitive(false);
1491  }
1492  switch ( eBreak )
1493  {
1494  case SvxBreak::PageBefore:
1495  m_xPgBrkRB->set_active(true);
1496  m_xColBrkRB->set_active( false );
1497  m_xPgBrkBeforeRB->set_active(true);
1498  m_xPgBrkAfterRB->set_active( false );
1499  break;
1500  case SvxBreak::PageAfter:
1501  m_xPgBrkRB->set_active(true);
1502  m_xColBrkRB->set_active( false );
1503  m_xPgBrkBeforeRB->set_active( false );
1504  m_xPgBrkAfterRB->set_active(true);
1505  break;
1506  case SvxBreak::ColumnBefore:
1507  m_xPgBrkRB->set_active( false );
1508  m_xColBrkRB->set_active(true);
1509  m_xPgBrkBeforeRB->set_active(true);
1510  m_xPgBrkAfterRB->set_active( false );
1511  break;
1512  case SvxBreak::ColumnAfter:
1513  m_xPgBrkRB->set_active( false );
1514  m_xColBrkRB->set_active(true);
1515  m_xPgBrkBeforeRB->set_active( false );
1516  m_xPgBrkAfterRB->set_active(true);
1517  break;
1518  default:; //prevent warning
1519  }
1520 
1521  }
1522  if (m_xPgBrkBeforeRB->get_active())
1523  PageBreakPosHdl_Impl(*m_xPgBrkBeforeRB);
1524  else if (m_xPgBrkAfterRB->get_active())
1525  PageBreakPosHdl_Impl(*m_xPgBrkAfterRB);
1526  PageBreakHdl_Impl(*m_xPgBrkCB);
1527  }
1528  }
1529  else
1530  {
1531  m_xPgBrkRB->set_sensitive(false);
1532  m_xColBrkRB->set_sensitive(false);
1533  m_xPgBrkBeforeRB->set_sensitive(false);
1534  m_xPgBrkAfterRB->set_sensitive(false);
1535  m_xKeepCB->set_sensitive(false);
1536  m_xSplitCB->set_sensitive(false);
1537  m_xPgBrkCB->set_sensitive(false);
1538  m_xPageCollCB->set_sensitive(false);
1539  m_xPageCollLB->set_sensitive(false);
1540  }
1541 
1542  if(SfxItemState::SET == rSet->GetItemState( FN_PARAM_TABLE_HEADLINE, false, &pItem ))
1543  {
1544  sal_uInt16 nRep = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1545  m_xHeadLineCB->set_active(nRep > 0);
1546  m_xHeadLineCB->save_state();
1547  m_xRepeatHeaderNF->set_value(nRep);
1548  m_xRepeatHeaderNF->set_min(1);
1549  m_xRepeatHeaderNF->save_value();
1550  }
1551  if ( rSet->GetItemState(FN_TABLE_BOX_TEXTORIENTATION) > SfxItemState::DEFAULT )
1552  {
1553  SvxFrameDirection nDirection =
1554  static_cast<const SvxFrameDirectionItem&>(rSet->Get(FN_TABLE_BOX_TEXTORIENTATION)).GetValue();
1555  m_xTextDirectionLB->set_active_id(OUString::number(static_cast<sal_uInt32>(nDirection)));
1556  }
1557 
1558  if ( rSet->GetItemState(FN_TABLE_SET_VERT_ALIGN) > SfxItemState::DEFAULT )
1559  {
1560  sal_uInt16 nVert = static_cast<const SfxUInt16Item&>(rSet->Get(FN_TABLE_SET_VERT_ALIGN)).GetValue();
1561  sal_uInt16 nPos = 0;
1562  switch(nVert)
1563  {
1564  case text::VertOrientation::NONE: nPos = 0; break;
1565  case text::VertOrientation::CENTER: nPos = 1; break;
1566  case text::VertOrientation::BOTTOM: nPos = 2; break;
1567  }
1568  m_xVertOrientLB->set_active(nPos);
1569  }
1570 
1571  m_xPageCollCB->save_state();
1572  m_xPageCollLB->save_value();
1573  m_xPgBrkCB->save_state();
1574  m_xPgBrkRB->save_state();
1575  m_xColBrkRB->save_state();
1576  m_xPgBrkBeforeRB->save_state();
1577  m_xPgBrkAfterRB->save_state();
1578  m_xPageNoCB->save_state();
1579  m_xPageNoNF->save_value();
1580  m_xTextDirectionLB->save_value();
1581  m_xVertOrientLB->save_value();
1582 
1583  HeadLineCBClickHdl(*m_xHeadLineCB);
1584 }
1585 
1587 {
1588  pShell = pSh;
1590  if(bHtmlMode)
1591  {
1592  m_xPageNoNF->set_sensitive(false);
1593  m_xPageNoCB->set_sensitive(false);
1594  }
1595 }
1596 
1598 {
1599  if (m_xPgBrkCB->get_active())
1600  {
1601  m_xPgBrkRB->set_sensitive(true);
1602  m_xColBrkRB->set_sensitive(true);
1603  m_xPgBrkBeforeRB->set_sensitive(true);
1604  m_xPgBrkAfterRB->set_sensitive(true);
1605 
1606  if (m_xPgBrkRB->get_active() && m_xPgBrkBeforeRB->get_active())
1607  {
1608  m_xPageCollCB->set_sensitive(true);
1609 
1610  bool bEnable = m_xPageCollCB->get_active() && m_xPageCollLB->get_count();
1611  m_xPageCollLB->set_sensitive(bEnable);
1612  if (!bHtmlMode)
1613  {
1614  m_xPageNoCB->set_sensitive(bEnable);
1615  m_xPageNoNF->set_sensitive(bEnable && m_xPageNoCB->get_active());
1616  }
1617  }
1618  }
1619  else
1620  {
1621  m_xPageCollCB->set_active(false);
1622  m_xPageCollCB->set_sensitive(false);
1623  m_xPageCollLB->set_sensitive(false);
1624  m_xPageNoCB->set_sensitive(false);
1625  m_xPageNoNF->set_sensitive(false);
1626  m_xPgBrkRB->set_sensitive(false);
1627  m_xColBrkRB->set_sensitive(false);
1628  m_xPgBrkBeforeRB->set_sensitive(false);
1629  m_xPgBrkAfterRB->set_sensitive(false);
1630  }
1631 }
1632 
1633 IMPL_LINK_NOARG(SwTextFlowPage, ApplyCollClickHdl_Impl, weld::ToggleButton&, void)
1634 {
1635  bool bEnable = false;
1636  if (m_xPageCollCB->get_active() && m_xPageCollLB->get_count())
1637  {
1638  bEnable = true;
1639  m_xPageCollLB->set_active(0);
1640  }
1641  else
1642  {
1643  m_xPageCollLB->set_active(-1);
1644  }
1645  m_xPageCollLB->set_sensitive(bEnable);
1646  if (!bHtmlMode)
1647  {
1648  m_xPageNoCB->set_sensitive(bEnable);
1649  m_xPageNoNF->set_sensitive(bEnable && m_xPageNoCB->get_active());
1650  }
1651 }
1652 
1653 IMPL_LINK_NOARG(SwTextFlowPage, PageBreakPosHdl_Impl, weld::ToggleButton&, void)
1654 {
1655  if (m_xPgBrkCB->get_active())
1656  {
1657  if (m_xPgBrkBeforeRB->get_active() && m_xPgBrkRB->get_active())
1658  {
1659  m_xPageCollCB->set_sensitive(true);
1660 
1661  bool bEnable = m_xPageCollCB->get_active() && m_xPageCollLB->get_count();
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  else if (m_xPgBrkAfterRB->get_active())
1671  {
1672  m_xPageCollCB->set_active(false);
1673  m_xPageCollCB->set_sensitive(false);
1674  m_xPageCollLB->set_sensitive(false);
1675  m_xPageNoCB->set_sensitive(false);
1676  m_xPageNoNF->set_sensitive(false);
1677  }
1678  }
1679 }
1680 
1681 IMPL_LINK_NOARG(SwTextFlowPage, PageBreakTypeHdl_Impl, weld::ToggleButton&, void)
1682 {
1683  if (m_xColBrkRB->get_active() || 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  else if (m_xPgBrkBeforeRB->get_active())
1692  PageBreakPosHdl_Impl(*m_xPgBrkBeforeRB);
1693 }
1694 
1696 {
1697  m_xPageNoNF->set_sensitive(m_xPageNoCB->get_active());
1698 }
1699 
1700 IMPL_LINK(SwTextFlowPage, SplitHdl_Impl, weld::ToggleButton&, rBox, void)
1701 {
1702  m_xSplitRowCB->set_sensitive(rBox.get_active());
1703 }
1704 
1706 {
1707  m_xRepeatHeaderCombo->set_sensitive(m_xHeadLineCB->get_active());
1708 }
1709 
1711 {
1712  bPageBreak = false;
1713  m_xPgBrkCB->set_sensitive(false);
1714  m_xPgBrkRB->set_sensitive(false);
1715  m_xColBrkRB->set_sensitive(false);
1716  m_xPgBrkBeforeRB->set_sensitive(false);
1717  m_xPgBrkAfterRB->set_sensitive(false);
1718  m_xPageCollCB->set_sensitive(false);
1719  m_xPageCollLB->set_sensitive(false);
1720  m_xPageNoCB->set_sensitive(false);
1721  m_xPageNoNF->set_sensitive(false);
1722 }
1723 
1724 /* 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:59
SwFormatTablePage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: tabledlg.cxx:65
std::unique_ptr< weld::Label > m_xSpaceFT
Definition: tablepg.hxx:112
bool IsPrintLayoutExtension() const
SwTwips nWidth
Definition: tablepg.hxx:32
FieldUnit
std::unique_ptr< weld::ComboBox > m_xVertOrientLB
Definition: tablepg.hxx:163
void SetRefValue(int nValue)
Definition: prcntfld.cxx:38
void SetLeftSpace(SwTwips nSet)
Definition: swtablerep.hxx:52
void Init()
SwWrtShell *const pShell
Definition: tabledlg.hxx:33
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:55
virtual void PageCreated(const SfxAllItemSet &aSet)
static SfxAbstractDialogFactory * Create()
SwTwips GetLeftSpace() const
Definition: swtablerep.hxx:51
sal_uInt16 nNoOfVisibleCols
Definition: tablepg.hxx:101
std::unique_ptr< weld::Label > m_xLeftFT
Definition: tablepg.hxx:57
std::string GetValue
void UpdateCols(sal_uInt16 nCurrentPos)
Definition: tabledlg.cxx:923
bool HasWidthChanged() const
Definition: swtablerep.hxx:72
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tabledlg.cxx:1078
SvxBreak GetBreak() const
void SetAlign(sal_uInt16 nSet)
Definition: swtablerep.hxx:64
void SetShell(SwViewShell *pSh)
Definition: newfrm.cxx:354
#define RES_FRAMEDIR
Definition: hintids.hxx:225
void ShowPercent(bool bPercent)
Definition: prcntfld.cxx:48
#define MINLAY
Definition: swtypes.hxx:66
std::unique_ptr< weld::RadioButton > m_xFullBtn
Definition: tablepg.hxx:50
sal_uInt16 sal_Char sal_Char * pDesc
void SetColsChanged()
Definition: swtablerep.hxx:70
long SwTwips
Definition: swtypes.hxx:49
std::unique_ptr< weld::SpinButton > m_xRepeatHeaderNF
Definition: tablepg.hxx:161
SvxFrameDirection
SfxItemSet * GetInputSetImpl()
#define FN_PARAM_TABLE_NAME
Definition: cmdid.h:753
SwTwips GetRightSpace() const
Definition: swtablerep.hxx:54
std::unique_ptr< weld::Label > m_xBottomFT
Definition: tablepg.hxx:63
sal_uInt16 aValueTable[MET_FIELDS]
Definition: tablepg.hxx:103
TRISTATE_TRUE
virtual void Reset(const SfxItemSet *rSet) override
Definition: tabledlg.cxx:1385
SwTwips GetWidth() const
Definition: swtablerep.hxx:57
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: tabledlg.cxx:759
void set_min(int nNewMin, FieldUnit eInUnit)
Definition: prcntfld.cxx:133
void SetRightSpace(SwTwips nSet)
Definition: swtablerep.hxx:55
const OUString & GetName() const
Definition: pagedesc.hxx:186
std::unique_ptr< weld::Button > m_xDownBtn
Definition: tablepg.hxx:115
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
#define FN_PARAM_TABLE_HEADLINE
Definition: cmdid.h:754
std::unique_ptr< weld::CheckButton > m_xSplitCB
Definition: tablepg.hxx:156
const SwView & GetView() const
Definition: wrtsh.hxx:426
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:106
SvxBackgroundTabFlags
OUString SvxResId(const char *pId)
std::unique_ptr< SwPercentField > m_xWidthMF
Definition: tablepg.hxx:47
sal_uInt16 GetAlign() const
Definition: swtablerep.hxx:63
std::unique_ptr< weld::CheckButton > m_xPageNoCB
Definition: tablepg.hxx:154
std::unique_ptr< weld::Label > m_xTopFT
Definition: tablepg.hxx:61
SwTwips nMinWidth
Definition: tablepg.hxx:98
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: tabledlg.cxx:557
void SetExchangeSupport()
SwTableTabDlg(weld::Window *pParent, const SfxItemSet *pItemSet, SwWrtShell *pSh)
Definition: tabledlg.cxx:1174
void set_sensitive(bool bEnable)
Definition: prcntfld.hxx:53
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: tabledlg.cxx:880
void connect_value_changed(const Link< weld::MetricSpinButton &, void > &rLink)
Definition: prcntfld.hxx:51
std::unique_ptr< weld::Entry > m_xNameED
Definition: tablepg.hxx:45
std::unique_ptr< weld::CheckButton > m_xKeepCB
Definition: tablepg.hxx:158
#define RES_UL_SPACE
Definition: hintids.hxx:197
void SetNumOffset(const ::boost::optional< sal_uInt16 > &oNum)
Definition: fmtpdsc.hxx:66
sal_uInt16 GetAllColCount() const
Definition: swtablerep.hxx:67
std::unique_ptr< weld::Label > m_aTextArr[MET_FIELDS]
Definition: tablepg.hxx:109
sal_uInt16 GetColCount() const
Definition: swtablerep.hxx:66
std::unique_ptr< weld::Widget > m_xProperties
Definition: tablepg.hxx:67
void SetWidth(SwTwips nSet)
Definition: swtablerep.hxx:58
TRISTATE_INDET
std::unique_ptr< weld::ComboBox > m_xPageCollLB
Definition: tablepg.hxx:153
sal_uInt16 GetWidthPercent() const
Definition: swtablerep.hxx:60
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
std::unique_ptr< weld::CheckButton > m_xSplitRowCB
Definition: tablepg.hxx:157
const SfxItemSet & GetItemSet() const
static SvxHtmlOptions & Get()
#define RES_ROW_SPLIT
Definition: hintids.hxx:227
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:1710
#define SW_MOD()
Definition: swmodule.hxx:255
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:691
std::unique_ptr< weld::Builder > m_xBuilder
void set_max(int nNewMax, FieldUnit eInUnit)
Definition: prcntfld.cxx:148
virtual ~SwFormatTablePage() override
Definition: tabledlg.cxx:116
std::unique_ptr< weld::RadioButton > m_xPgBrkBeforeRB
Definition: tablepg.hxx:150
int NormalizePercent(int nValue)
Definition: prcntfld.cxx:154
int get_value(FieldUnit eOutUnit=FieldUnit::NONE)
Definition: prcntfld.cxx:128
int i
SwPercentField m_aFieldArr[MET_FIELDS]
Definition: tablepg.hxx:108
SwTwips nTableWidth
Definition: tablepg.hxx:97
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:339
SwTwips GetSpace() const
Definition: swtablerep.hxx:78
void SetWidthChanged()
Definition: swtablerep.hxx:73
std::unique_ptr< SwPercentField > m_xLeftMF
Definition: tablepg.hxx:58
#define RES_LAYOUT_SPLIT
Definition: hintids.hxx:218
sal_uInt16 nNoOfCols
Definition: tablepg.hxx:100
weld::Window * GetFrameWeld(SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
std::unique_ptr< weld::ComboBox > m_xTextDirectionLB
Definition: tablepg.hxx:162
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: tabledlg.cxx:1265
std::unique_ptr< weld::CheckButton > m_xPageCollCB
Definition: tablepg.hxx:152
OUString SwResId(const char *pId)
Definition: swmodule.cxx:191
std::unique_ptr< weld::MetricSpinButton > m_xSpaceED
Definition: tablepg.hxx:113
DocumentType const eType
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:63
SwTwips nMinTableWidth
Definition: tablepg.hxx:40
SwDocShell * GetDocShell()
Definition: view.cxx:1115
std::unique_ptr< weld::RadioButton > m_xPgBrkRB
Definition: tablepg.hxx:148
SwTwips nSaveWidth
Definition: tablepg.hxx:39
#define MET_FIELDS
Definition: tablepg.hxx:92
void ModifyHdl(const weld::MetricSpinButton *pEdit)
Definition: tabledlg.cxx:898
virtual void Reset(const SfxItemSet *rSet) override
Definition: tabledlg.cxx:764
std::unique_ptr< weld::SpinButton > m_xPageNoNF
Definition: tablepg.hxx:155
SwTextFlowPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: tabledlg.cxx:1209
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:61
std::unique_ptr< weld::RadioButton > m_xLeftBtn
Definition: tablepg.hxx:51
void SetShell(SwWrtShell *pSh)
Definition: tabledlg.cxx:1586
weld::Entry & rEdit
std::unique_ptr< weld::CheckButton > m_xHeadLineCB
Definition: tablepg.hxx:159
std::unique_ptr< weld::MetricSpinButton > m_xBottomMF
Definition: tablepg.hxx:64
SwWrtShell * pShell
Definition: tablepg.hxx:143
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:327
void SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth)
Definition: tabledlg.cxx:1158
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
std::unique_ptr< weld::RadioButton > m_xColBrkRB
Definition: tablepg.hxx:149
virtual void PageCreated(const OString &rId, SfxTabPage &rPage) override
Definition: tabledlg.cxx:1186
IMPL_LINK(SwFormatTablePage, RelWidthClickHdl, weld::ToggleButton &, rBtn, void)
Definition: tabledlg.cxx:144
virtual ~SwTableColumnPage() override
Definition: tabledlg.cxx:755
virtual ~SwTextFlowPage() override
Definition: tabledlg.cxx:1261
SwTableColumnPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: tabledlg.cxx:700
static VclPtr< reference_type > Create(Arg &&...arg)
#define RES_KEEP
Definition: hintids.hxx:215
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
int DenormalizePercent(int nValue)
Definition: prcntfld.cxx:163
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:412
SwTableRep * pTableData
Definition: tablepg.hxx:96
TColumn * GetColumns() const
Definition: swtablerep.hxx:81
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
SwTwips GetVisibleWidth(sal_uInt16 nPos)
Definition: tabledlg.cxx:1140
DeactivateRC
SwPageDesc * FindPageDescByName(const OUString &rName, bool bGetFromPool=false, size_t *pPos=nullptr)
Definition: fedesc.cxx:132
bool IsLineSelected() const
Definition: swtablerep.hxx:75
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:111
SVX_DLLPUBLIC MSO_SPT Get(const OUString &)
void SetMetric(FieldUnit eUnit)
Definition: prcntfld.hxx:52
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rAttrSet)
Definition: tabledlg.cxx:367
std::unique_ptr< weld::RadioButton > m_xPgBrkAfterRB
Definition: tablepg.hxx:151
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: tabledlg.cxx:1035
#define RES_PAGEDESC
Definition: hintids.hxx:198
#define RES_BREAK
Definition: hintids.hxx:199
void set_text(const OUString &rStr)
Definition: prcntfld.hxx:58
std::unique_ptr< weld::CheckButton > m_xPgBrkCB
Definition: tablepg.hxx:147
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
sal_Int32 nPos
SwTableRep * pTableData
Definition: tablepg.hxx:38
#define FN_TABLE_SET_VERT_ALIGN
Definition: cmdid.h:408
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:238
std::unique_ptr< weld::RadioButton > m_xRightBtn
Definition: tablepg.hxx:53
const SwTwips lAutoWidth
Definition: tablemgr.hxx:39
virtual void Reset(const SfxItemSet *rSet) override
Definition: tabledlg.cxx:417
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: tabledlg.cxx:1271
std::unique_ptr< weld::CheckButton > m_xModifyTableCB
Definition: tablepg.hxx:110
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tabledlg.cxx:582
void Init(bool bWeb)
Definition: tabledlg.cxx:810
sal_uInt16 nMetFields
Definition: tablepg.hxx:99
std::unique_ptr< weld::CheckButton > m_xRelWidthCB
Definition: tablepg.hxx:48
std::unique_ptr< weld::Button > m_xUpBtn
Definition: tablepg.hxx:114
OUString sId