LibreOffice Module sw (master)  1
tabsh.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 <svl/zforlist.hxx>
22 #include <svl/stritem.hxx>
23 #include <svl/whiter.hxx>
25 #include <svx/rulritem.hxx>
26 #include <svl/srchitem.hxx>
27 #include <editeng/lrspitem.hxx>
28 #include <editeng/ulspitem.hxx>
29 #include <editeng/brushitem.hxx>
30 #include <editeng/boxitem.hxx>
31 #include <editeng/shaditem.hxx>
32 #include <editeng/spltitem.hxx>
33 #include <editeng/langitem.hxx>
34 #include <editeng/keepitem.hxx>
35 #include <editeng/lineitem.hxx>
36 #include <editeng/colritem.hxx>
37 #include <editeng/frmdiritem.hxx>
38 #include <svx/numinf.hxx>
39 #include <svx/svddef.hxx>
40 #include <svx/svxdlg.hxx>
41 #include <svx/svxids.hrc>
42 #include <svl/zformat.hxx>
43 #include <sfx2/bindings.hxx>
44 #include <vcl/weld.hxx>
45 #include <sfx2/request.hxx>
46 #include <sfx2/dispatch.hxx>
47 #include <sfx2/objface.hxx>
48 #include <sfx2/viewfrm.hxx>
49 #include <vcl/EnumContext.hxx>
50 #include <o3tl/enumrange.hxx>
51 
52 #include <fmtornt.hxx>
53 #include <fmtclds.hxx>
54 #include <fmtlsplt.hxx>
55 #include <fmtrowsplt.hxx>
56 #include <fmtfsize.hxx>
57 #include <swmodule.hxx>
58 #include <wrtsh.hxx>
59 #include <wview.hxx>
60 #include <frmatr.hxx>
61 #include <uitool.hxx>
62 #include <inputwin.hxx>
63 #include <uiitems.hxx>
64 #include <usrpref.hxx>
65 #include <tabsh.hxx>
66 #include <swtablerep.hxx>
67 #include <tablemgr.hxx>
68 #include <cellatr.hxx>
69 #include <frmfmt.hxx>
70 #include <swundo.hxx>
71 #include <swtable.hxx>
72 #include <docsh.hxx>
73 #include <tblsel.hxx>
74 
75 #include <app.hrc>
76 #include <strings.hrc>
77 #include <cmdid.h>
78 #include <globals.hrc>
79 #include <unobaseclass.hxx>
80 
81 #define ShellClass_SwTableShell
82 #include <sfx2/msg.hxx>
83 #include <swslots.hxx>
84 
85 #include <swabstdlg.hxx>
86 
87 #include <memory>
88 
89 using ::editeng::SvxBorderLine;
90 using namespace ::com::sun::star;
91 
93 
94 void SwTableShell::InitInterface_Impl()
95 {
96  GetStaticInterface()->RegisterPopupMenu("table");
97  GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Table_Toolbox);
98 }
99 
100 
101 static const sal_uInt16 aUITableAttrRange[] =
102 {
108  SID_RULER_BORDERS, SID_RULER_BORDERS,
110  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW,
113  SID_BACKGRND_DESTINATION, SID_BACKGRND_DESTINATION,
114  SID_HTML_MODE, SID_HTML_MODE,
115  SID_ATTR_BRUSH_ROW, SID_ATTR_BRUSH_TABLE,
123 // #i29550#
125 // <-- collapsing borders
126  0
127 };
128 
129 const sal_uInt16* SwuiGetUITableAttrRange()
130 {
131  return aUITableAttrRange;
132 }
133 
134 static void lcl_SetAttr( SwWrtShell &rSh, const SfxPoolItem &rItem )
135 {
136  SfxItemSet aSet( rSh.GetView().GetPool(), {{rItem.Which(), rItem.Which()}});
137  aSet.Put( rItem );
138  rSh.SetTableAttr( aSet );
139 }
140 
141 static std::shared_ptr<SwTableRep> lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
142 {
143  std::shared_ptr<SwTableRep> pRep;
144 
145  SwFrameFormat *pFormat = rSh.GetTableFormat();
146  SwTabCols aCols;
147  rSh.GetTabCols( aCols );
148 
149  //At first get the simple attributes.
150  rSet.Put( SfxStringItem( FN_PARAM_TABLE_NAME, pFormat->GetName()));
152  rSet.Put( pFormat->GetShadow() );
154  rSet.Put( pFormat->GetFrameDir() );
155 
156  SvxULSpaceItem aULSpace( pFormat->GetULSpace() );
157  rSet.Put( aULSpace );
158 
159  const sal_uInt16 nBackgroundDestination = rSh.GetViewOptions()->GetTableDest();
160  rSet.Put(SfxUInt16Item(SID_BACKGRND_DESTINATION, nBackgroundDestination ));
161  std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
162  if(rSh.GetRowBackground(aBrush))
163  {
164  aBrush->SetWhich(SID_ATTR_BRUSH_ROW);
165  rSet.Put( *aBrush );
166  }
167  else
168  rSet.InvalidateItem(SID_ATTR_BRUSH_ROW);
169  rSh.GetTabBackground(aBrush);
170  aBrush->SetWhich(SID_ATTR_BRUSH_TABLE);
171  rSet.Put( *aBrush );
172 
173  // text direction in boxes
174  std::shared_ptr<SvxFrameDirectionItem> aBoxDirection(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR));
175  if(rSh.GetBoxDirection( aBoxDirection ))
176  {
177  aBoxDirection->SetWhich(FN_TABLE_BOX_TEXTORIENTATION);
178  rSet.Put(*aBoxDirection);
179  }
180 
181  bool bSelectAll = rSh.StartsWithTable() && rSh.ExtendedSelectedAll();
182  bool bTableSel = rSh.IsTableMode() || bSelectAll;
183  if(!bTableSel)
184  {
185  rSh.StartAllAction();
186  rSh.Push();
188  }
189  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
190 
191  // Table variant: If multiple table cells are selected.
192  rSh.GetCursor(); //Thus GetCursorCnt() returns the right thing
193  aBoxInfo.SetTable ((rSh.IsTableMode() && rSh.GetCursorCnt() > 1) ||
194  !bTableSel);
195  // Always show distance field.
196  aBoxInfo.SetDist (true);
197  // Set minimum size in tables and paragraphs.
198  aBoxInfo.SetMinDist( !bTableSel || rSh.IsTableMode() ||
199  rSh.GetSelectionType() &
201  // Always set the default spacing.
202  aBoxInfo.SetDefDist (MIN_BORDER_DIST);
203  // Individual lines can have DontCare status only in tables.
204  aBoxInfo.SetValid( SvxBoxInfoItemValidFlags::DISABLE, !bTableSel || !rSh.IsTableMode() );
205 
206  rSet.Put(aBoxInfo);
207  rSh.GetTabBorders( rSet );
208 
209  //row split
210  std::unique_ptr<SwFormatRowSplit> pSplit = rSh.GetRowSplit();
211  if(pSplit)
212  rSet.Put(std::move(pSplit));
213 
214  if(!bTableSel)
215  {
216  rSh.ClearMark();
218  rSh.EndAllAction();
219  }
220 
221  SwTabCols aTabCols;
222  rSh.GetTabCols( aTabCols );
223 
224  // Pointer will be deleted after the dialogue execution.
225  pRep = std::make_shared<SwTableRep>(aTabCols);
226  pRep->SetSpace(aCols.GetRightMax());
227 
228  sal_uInt16 nPercent = 0;
229  auto nWidth = ::GetTableWidth(pFormat, aCols, &nPercent, &rSh );
230  // The table width is wrong for relative values.
231  if (nPercent)
232  nWidth = pRep->GetSpace() * nPercent / 100;
233  const sal_uInt16 nAlign = pFormat->GetHoriOrient().GetHoriOrient();
234  pRep->SetAlign(nAlign);
235  SvxLRSpaceItem aLRSpace( pFormat->GetLRSpace() );
236  SwTwips nLeft = aLRSpace.GetLeft();
237  SwTwips nRight = aLRSpace.GetRight();
238  SwTwips nDiff = pRep->GetSpace() - nRight - nLeft - nWidth;
239  if(nAlign != text::HoriOrientation::FULL && std::abs(nDiff) > 2)
240  {
241  SwTwips nLR = pRep->GetSpace() - nWidth;
242  switch ( nAlign )
243  {
244  case text::HoriOrientation::CENTER:
245  nLeft = nRight = nLR / 2;
246  break;
248  nRight = nLR;
249  nLeft = 0;
250  break;
252  nLeft = nLR;
253  nRight = 0;
254  break;
255  case text::HoriOrientation::LEFT_AND_WIDTH:
256  nRight = nLR - nLeft;
257  break;
259  if(!nPercent)
260  nWidth = pRep->GetSpace() - nLeft - nRight;
261  break;
262  }
263  }
264  pRep->SetLeftSpace(nLeft);
265  pRep->SetRightSpace(nRight);
266 
267  pRep->SetWidth(nWidth);
268  pRep->SetWidthPercent(nPercent);
269  // Are individual rows / cells are selected, the column processing will be changed.
270  pRep->SetLineSelected(bTableSel && ! rSh.HasWholeTabSelection());
271  rSet.Put(SwPtrItem(FN_TABLE_REP, pRep.get()));
272  return pRep;
273 }
274 
275 void ItemSetToTableParam( const SfxItemSet& rSet,
276  SwWrtShell &rSh )
277 {
278  rSh.StartAllAction();
280  const SfxPoolItem* pItem = nullptr;
281 
282  if(SfxItemState::SET == rSet.GetItemState(SID_BACKGRND_DESTINATION, false, &pItem))
283  {
284  SwViewOption aUsrPref( *rSh.GetViewOptions() );
285  aUsrPref.SetTableDest(static_cast<sal_uInt8>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()));
286  SW_MOD()->ApplyUsrPref(aUsrPref, &rSh.GetView());
287  }
288  bool bBorder = ( SfxItemState::SET == rSet.GetItemState( RES_BOX ) ||
289  SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER ) );
290  pItem = nullptr;
291  bool bBackground = SfxItemState::SET == rSet.GetItemState( RES_BACKGROUND, false, &pItem );
292  const SfxPoolItem* pRowItem = nullptr, *pTableItem = nullptr;
293  bBackground |= SfxItemState::SET == rSet.GetItemState( SID_ATTR_BRUSH_ROW, false, &pRowItem );
294  bBackground |= SfxItemState::SET == rSet.GetItemState( SID_ATTR_BRUSH_TABLE, false, &pTableItem );
295  const SfxPoolItem* pSplit = nullptr;
296  bool bRowSplit = SfxItemState::SET == rSet.GetItemState( RES_ROW_SPLIT, false, &pSplit );
297  const SfxPoolItem* pBoxDirection = nullptr;
298  bool bBoxDirection = SfxItemState::SET == rSet.GetItemState( FN_TABLE_BOX_TEXTORIENTATION, false, &pBoxDirection );
299  if( bBackground || bBorder || bRowSplit || bBoxDirection)
300  {
301  // The border will be applied to the present selection.
302  // If there is no selection, the table will be completely selected.
303  // The background will always be applied to the current state.
304  bool bTableSel = rSh.IsTableMode();
305  rSh.StartAllAction();
306 
307  if(bBackground)
308  {
309  if(pItem)
310  rSh.SetBoxBackground( *static_cast<const SvxBrushItem*>(pItem) );
311  if(pRowItem)
312  {
313  std::shared_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pRowItem->Clone()));
314  aBrush->SetWhich(RES_BACKGROUND);
315  rSh.SetRowBackground(*aBrush);
316  }
317  if(pTableItem)
318  {
319  std::shared_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pTableItem->Clone()));
320  aBrush->SetWhich(RES_BACKGROUND);
321  rSh.SetTabBackground( *aBrush );
322  }
323  }
324 
325  if(bBoxDirection)
326  {
327  SvxFrameDirectionItem aDirection( SvxFrameDirection::Environment, RES_FRAMEDIR );
328  aDirection.SetValue(static_cast< const SvxFrameDirectionItem* >(pBoxDirection)->GetValue());
329  rSh.SetBoxDirection(aDirection);
330  }
331 
332  if(bBorder || bRowSplit)
333  {
334  rSh.Push();
335  if(!bTableSel)
336  {
338  }
339  if(bBorder)
340  rSh.SetTabBorders( rSet );
341 
342  if(bRowSplit)
343  {
344  rSh.SetRowSplit(*static_cast<const SwFormatRowSplit*>(pSplit));
345  }
346 
347  if(!bTableSel)
348  {
349  rSh.ClearMark();
350  }
352  }
353 
354  rSh.EndAllAction();
355  }
356 
357  SwTabCols aTabCols;
358  bool bTabCols = false;
359  SwTableRep* pRep = nullptr;
360  SwFrameFormat *pFormat = rSh.GetTableFormat();
362  if(SfxItemState::SET == rSet.GetItemState( FN_TABLE_REP, false, &pItem ))
363  {
364  pRep = static_cast<SwTableRep*>(static_cast<const SwPtrItem*>(pItem)->GetValue());
365 
366  const SwTwips nWidth = pRep->GetWidth();
367  if ( text::HoriOrientation::FULL == pRep->GetAlign() )
368  {
369  SwFormatHoriOrient aAttr( pFormat->GetHoriOrient() );
370  aAttr.SetHoriOrient( text::HoriOrientation::FULL );
371  aSet.Put( aAttr );
372  }
373  else
374  {
375  SwFormatFrameSize aSz( ATT_VAR_SIZE, nWidth );
376  if(pRep->GetWidthPercent())
377  {
378  aSz.SetWidthPercent( static_cast<sal_uInt8>(pRep->GetWidthPercent()) );
379  }
380  aSet.Put(aSz);
381  }
382 
383  SvxLRSpaceItem aLRSpace( RES_LR_SPACE );
384  aLRSpace.SetLeft(pRep->GetLeftSpace());
385  aLRSpace.SetRight(pRep->GetRightSpace());
386  aSet.Put( aLRSpace );
387 
388  sal_Int16 eOrient = pRep->GetAlign();
389  SwFormatHoriOrient aAttr( 0, eOrient );
390  aSet.Put( aAttr );
391  // The item must only be recorded while manual alignment, so that the
392  // alignment is not overwritten by the distances while recording.
393  if(eOrient != text::HoriOrientation::NONE)
394  const_cast<SfxItemSet&>(rSet).ClearItem( SID_ATTR_LRSPACE );
395 
396  if(pRep->HasColsChanged())
397  {
398  bTabCols = true;
399  }
400  }
401 
402  if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, false, &pItem))
403  rSh.SetRowsToRepeat( static_cast<const SfxUInt16Item*>(pItem)->GetValue() );
404 
405  if( SfxItemState::SET == rSet.GetItemState( FN_TABLE_SET_VERT_ALIGN, false, &pItem))
406  rSh.SetBoxAlign(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
407 
408  if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, false, &pItem ))
409  rSh.SetTableName( *pFormat, static_cast<const SfxStringItem*>(pItem)->GetValue() );
410 
411  // Copy the chosen attributes in the ItemSet.
412  static const sal_uInt16 aIds[] =
413  {
414  RES_PAGEDESC,
415  RES_BREAK,
416  RES_KEEP,
418  RES_UL_SPACE,
419  RES_SHADOW,
420  RES_FRAMEDIR,
421  // #i29550#
423  // <-- collapsing borders
424  0
425  };
426  for( const sal_uInt16* pIds = aIds; *pIds; ++pIds )
427  if( SfxItemState::SET == rSet.GetItemState( *pIds, false, &pItem))
428  aSet.Put( *pItem );
429 
430  if( aSet.Count() )
431  rSh.SetTableAttr( aSet );
432 
433  if(bTabCols)
434  {
435  rSh.GetTabCols( aTabCols );
436  bool bSingleLine = pRep->FillTabCols( aTabCols );
437  rSh.SetTabCols( aTabCols, bSingleLine );
438  }
439 
441  rSh.EndAllAction();
442 }
443 
444 static void lcl_TabGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine)
445 {
446  if(pBorderLine->GetWidth() > rBorderLine.GetWidth())
447  rBorderLine.SetWidth(pBorderLine->GetWidth());
448 
449  rBorderLine.SetBorderLineStyle(pBorderLine->GetBorderLineStyle());
450  rBorderLine.SetColor(pBorderLine->GetColor());
451 }
452 
454 {
455  const SfxItemSet* pArgs = rReq.GetArgs();
456  SwWrtShell &rSh = GetShell();
457 
458  // At first the slots which doesn't need a FrameMgr.
459  bool bMore = false;
460  const SfxPoolItem* pItem = nullptr;
461  sal_uInt16 nSlot = rReq.GetSlot();
462  if(pArgs)
463  pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
464  bool bCallDone = false;
465  switch ( nSlot )
466  {
467  case SID_ATTR_BORDER:
468  {
469  if(!pArgs)
470  break;
471  // Create items, because we have to rework anyway.
472  std::shared_ptr<SvxBoxItem> aBox(std::make_shared<SvxBoxItem>(RES_BOX));
473  SfxItemSet aCoreSet( GetPool(),
475  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>{});
476  SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER );
477  aCoreSet.Put(aCoreInfo);
478  rSh.GetTabBorders( aCoreSet );
479  const SvxBoxItem& rCoreBox = aCoreSet.Get(RES_BOX);
480  const SfxPoolItem *pBoxItem = nullptr;
481  if ( pArgs->GetItemState(RES_BOX, true, &pBoxItem) == SfxItemState::SET )
482  {
483  aBox.reset(static_cast<SvxBoxItem*>(pBoxItem->Clone()));
484  sal_uInt16 nDefValue = MIN_BORDER_DIST;
485  if ( !rReq.IsAPI() )
486  nDefValue = 55;
487  if (!rReq.IsAPI() || aBox->GetSmallestDistance() < MIN_BORDER_DIST)
488  {
490  aBox->SetDistance( std::max(rCoreBox.GetDistance(k), nDefValue) , k );
491  }
492  }
493  else
494  OSL_ENSURE( false, "where is BoxItem?" );
495 
496  //since the drawing layer also supports borders the which id might be a different one
497  std::shared_ptr<SvxBoxInfoItem> aInfo(std::make_shared<SvxBoxInfoItem>(SID_ATTR_BORDER_INNER));
498  if (pArgs->GetItemState(SID_ATTR_BORDER_INNER, true, &pBoxItem) == SfxItemState::SET)
499  {
500  aInfo.reset(static_cast<SvxBoxInfoItem*>(pBoxItem->Clone()));
501  }
502  else if( pArgs->GetItemState(SDRATTR_TABLE_BORDER_INNER, true, &pBoxItem) == SfxItemState::SET )
503  {
504  aInfo.reset(static_cast<SvxBoxInfoItem*>(pBoxItem->Clone()));
505  aInfo->SetWhich(SID_ATTR_BORDER_INNER);
506  }
507 
508  aInfo->SetTable( true );
509  aInfo->SetValid( SvxBoxInfoItemValidFlags::DISABLE, false );
510 
511 // The attributes of all lines will be read and the strongest wins.
512  const SvxBorderLine* pBorderLine;
513  SvxBorderLine aBorderLine;
514  if ((pBorderLine = rCoreBox.GetTop()) != nullptr)
515  lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
516  if ((pBorderLine = rCoreBox.GetBottom()) != nullptr)
517  lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
518  if ((pBorderLine = rCoreBox.GetLeft()) != nullptr)
519  lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
520  if ((pBorderLine = rCoreBox.GetRight()) != nullptr)
521  lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
522  if ((pBorderLine = aCoreInfo.GetHori()) != nullptr)
523  lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
524  if ((pBorderLine = aCoreInfo.GetVert()) != nullptr)
525  lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
526 
527  if(aBorderLine.GetOutWidth() == 0)
528  {
529  aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
530  aBorderLine.SetWidth( DEF_LINE_WIDTH_5 );
531  }
532 
533  if( aBox->GetTop() != nullptr )
534  {
535  aBox->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
536  }
537  if( aBox->GetBottom() != nullptr )
538  {
539  aBox->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
540  }
541  if( aBox->GetLeft() != nullptr )
542  {
543  aBox->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
544  }
545  if( aBox->GetRight() != nullptr )
546  {
547  aBox->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
548  }
549  if( aInfo->GetHori() != nullptr )
550  {
551  aInfo->SetLine(&aBorderLine, SvxBoxInfoItemLine::HORI);
552  }
553  if( aInfo->GetVert() != nullptr )
554  {
555  aInfo->SetLine(&aBorderLine, SvxBoxInfoItemLine::VERT);
556  }
557 
558  aCoreSet.Put( *aBox );
559  aCoreSet.Put( *aInfo );
560  rSh.SetTabBorders( aCoreSet );
561 
562  // we must record the "real" values because otherwise the lines can't be reconstructed on playtime
563  // the coding style of the controller (setting lines with width 0) is not transportable via Query/PutValue in
564  // the SvxBoxItem
565  rReq.AppendItem( *aBox );
566  rReq.AppendItem( *aInfo );
567  bCallDone = true;
568  break;
569  }
570  case FN_INSERT_TABLE:
571  InsertTable( rReq );
572  break;
573  case FN_FORMAT_TABLE_DLG:
574  {
575  //#127012# get the bindings before the dialog is called
576  // it might happen that this shell is removed after closing the dialog
577  SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
578  SfxItemSet aCoreSet( GetPool(), aUITableAttrRange);
579 
580  FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &rSh.GetView()) != nullptr );
581  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
582  std::shared_ptr<SwTableRep> pTableRep(::lcl_TableParamToItemSet(aCoreSet, rSh));
583 
584  aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
585  rSh.GetTableAttr(aCoreSet);
586  // GetTableAttr overwrites the background!
587  std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
588  if(rSh.GetBoxBackground(aBrush))
589  aCoreSet.Put( *aBrush );
590  else
591  aCoreSet.InvalidateItem( RES_BACKGROUND );
592 
594  VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTableTabDlg(GetView().GetFrameWeld(), &aCoreSet, &rSh));
595 
596  if (pDlg)
597  {
598  if (pItem)
599  pDlg->SetCurPageId(OUStringToOString(static_cast<const SfxStringItem *>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8));
600 
601  std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq));
602  rReq.Ignore(); // the 'old' request is not relevant any more
603 
604  pDlg->StartExecuteAsync([pDlg, pRequest, pTableRep, &rBindings, &rSh](sal_Int32 nResult){
605  if (RET_OK == nResult)
606  {
607  const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
608 
609  //to record FN_INSERT_TABLE correctly
610  pRequest->SetSlot(FN_FORMAT_TABLE_DLG);
611  pRequest->Done(*pOutSet);
612 
613  ItemSetToTableParam(*pOutSet, rSh);
614  }
615 
616  rBindings.Update(SID_RULER_BORDERS);
617  rBindings.Update(SID_ATTR_TABSTOP);
618  rBindings.Update(SID_RULER_BORDERS_VERTICAL);
619  rBindings.Update(SID_ATTR_TABSTOP_VERTICAL);
620 
621  pDlg->disposeOnce();
622  });
623  }
624  else
625  {
626  if (rReq.GetArgs())
627  ItemSetToTableParam(*rReq.GetArgs(), rSh);
628 
629  rBindings.Update(SID_RULER_BORDERS);
630  rBindings.Update(SID_ATTR_TABSTOP);
631  rBindings.Update(SID_RULER_BORDERS_VERTICAL);
632  rBindings.Update(SID_ATTR_TABSTOP_VERTICAL);
633  }
634 
635  break;
636  }
637  case SID_ATTR_BRUSH:
638  case SID_ATTR_BRUSH_ROW :
639  case SID_ATTR_BRUSH_TABLE :
640  if(rReq.GetArgs())
641  ItemSetToTableParam(*rReq.GetArgs(), rSh);
642  break;
644  {
645  SwView* pView = GetActiveView();
646  if(pView)
647  {
648  FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
649  SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
650  SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
651  SfxItemSet aCoreSet(
652  GetPool(),
653  svl::Items<
654  SID_ATTR_NUMBERFORMAT_VALUE,
655  SID_ATTR_NUMBERFORMAT_INFO>{});
656 
657  SfxItemSet aBoxSet( *aCoreSet.GetPool(),
659  RES_BOXATR_VALUE, RES_BOXATR_VALUE>{} );
660  rSh.GetTableBoxFormulaAttrs( aBoxSet );
661 
662  SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT);
663  if(eState == SfxItemState::DEFAULT)
664  {
665  aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
666  pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_SYSTEM)));
667  }
668  else
669  aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
670  aBoxSet.Get(
671  RES_BOXATR_FORMAT ).GetValue() ));
672 
673  OUString sCurText( rSh.GetTableBoxText() );
674  aCoreSet.Put( SvxNumberInfoItem( pFormatter,
675  aBoxSet.Get(
676  RES_BOXATR_VALUE).GetValue(),
677  sCurText, SID_ATTR_NUMBERFORMAT_INFO ));
678 
681 
682  if (RET_OK == pDlg->Execute())
683  {
684  const SvxNumberInfoItem* pNumberFormatItem
685  = GetView().GetDocShell()->GetItem( SID_ATTR_NUMBERFORMAT_INFO );
686 
687  if( pNumberFormatItem )
688  {
689  for ( sal_uInt32 key : pNumberFormatItem->GetDelFormats() )
690  pNumberFormatItem->GetNumberFormatter()->DeleteEntry( key );
691  }
692 
693  const SfxPoolItem* pNumberFormatValueItem = nullptr;
694  if( SfxItemState::SET == pDlg->GetOutputItemSet()->GetItemState(
695  SID_ATTR_NUMBERFORMAT_VALUE, false, &pNumberFormatValueItem ))
696  {
697  SfxItemSet aBoxFormatSet( *aCoreSet.GetPool(),
699  aBoxFormatSet.Put( SwTableBoxNumFormat(
700  static_cast<const SfxUInt32Item*>(pNumberFormatValueItem)->GetValue() ));
701  rSh.SetTableBoxFormulaAttrs( aBoxFormatSet );
702 
703  }
704  }
705  }
706  break;
707  }
708  case FN_CALC_TABLE:
709  rSh.UpdateTable();
710  bCallDone = true;
711  break;
712  case FN_TABLE_DELETE_COL:
713  if ( rSh.DeleteCol() && rSh.HasSelection() )
714  rSh.EnterStdMode();
715  bCallDone = true;
716  break;
717  case FN_END_TABLE:
719  bCallDone = true;
720  break;
721  case FN_START_TABLE:
723  bCallDone = true;
724  break;
725  case FN_GOTO_NEXT_CELL:
726  {
727  bool bAppendLine = true;
728  if( pItem )
729  bAppendLine = static_cast<const SfxBoolItem*>(pItem)->GetValue();
730  rReq.SetReturnValue( SfxBoolItem( nSlot,
731  rSh.GoNextCell( bAppendLine ) ) );
732  bCallDone = true;
733  break;
734  }
735  case FN_GOTO_PREV_CELL:
736  rReq.SetReturnValue( SfxBoolItem( nSlot, rSh.GoPrevCell() ) );
737  bCallDone = true;
738  break;
739  case FN_TABLE_DELETE_ROW:
740  if ( rSh.DeleteRow() && rSh.HasSelection() )
741  rSh.EnterStdMode();
742  bCallDone = true;
743  break;
745  if ( rSh.IsTableMode() )
746  switch ( rSh.MergeTab() )
747  {
748  case TableMergeErr::Ok:
749  bCallDone = true;
750  [[fallthrough]];
752  break;
754  {
755  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetView().GetFrameWeld(),
756  VclMessageType::Info, VclButtonsType::Ok,
757  SwResId(STR_ERR_TABLE_MERGE)));
758  xInfoBox->run();
759  break;
760  }
761  default:
762  OSL_ENSURE( false, "unknown return value MergeTab.");
763  break;
764  }
765  break;
766  case SID_TABLE_MINIMAL_COLUMN_WIDTH:
769  {
770  bool bBalance = (FN_TABLE_BALANCE_CELLS == nSlot);
771  const bool bNoShrink = FN_TABLE_ADJUST_CELLS == nSlot;
772  if ( rSh.IsAdjustCellWidthAllowed(bBalance) )
773  {
774  {
775  // remove actions to make a valid table selection
776  UnoActionRemoveContext aRemoveContext(rSh.GetDoc());
777  }
778  rSh.AdjustCellWidth(bBalance, bNoShrink);
779  }
780  bCallDone = true;
781  break;
782  }
783  case SID_TABLE_MINIMAL_ROW_HEIGHT:
784  {
785  const SwFormatFrameSize aSz;
786  rSh.SetRowHeight( aSz );
787  bCallDone = true;
788  break;
789  }
791  {
792  rSh.BalanceRowHeight(/*bTstOnly=*/false, /*bOptimize=*/true);
793  rSh.BalanceRowHeight(/*bTstOnly=*/false, /*bOptimize=*/false);
794  bCallDone = true;
795  break;
796  }
798  if ( rSh.BalanceRowHeight(true) )
799  rSh.BalanceRowHeight(false);
800  bCallDone = true;
801  break;
802  case FN_TABLE_SELECT_ALL:
803  rSh.EnterStdMode();
805  rSh.SttSelect();
807  rSh.EndSelect();
808  bCallDone = true;
809  break;
810  case FN_TABLE_SELECT_COL:
811  rSh.EnterStdMode();
812  rSh.SelectTableCol();
813  bCallDone = true;
814  break;
815  case FN_TABLE_SELECT_ROW:
816  rSh.EnterStdMode();
817  rSh.SelectTableRow();
818  bCallDone = true;
819  break;
821  rSh.ProtectCells();
822  rSh.ResetSelect( nullptr, false );
823  bCallDone = true;
824  break;
826  rSh.UnProtectCells();
827  bCallDone = true;
828  break;
829  case SID_AUTOFORMAT:
830  {
833  pDlg->Execute();
834  break;
835  }
837  {
840  pDlg->Execute();
841  break;
842  }
843  case FN_NUMBER_BULLETS:
844  case FN_NUM_BULLET_ON:
845  OSL_ENSURE( false, "function may not be called now." );
846  break;
847 
848 
849  // 2015/06 The following two are deprecated but kept for ascending
850  // compatibility
851  case FN_TABLE_INSERT_COL:
852  case FN_TABLE_INSERT_ROW:
853  // fallback
858  {
859  bool bColumn = rReq.GetSlot() == FN_TABLE_INSERT_COL_BEFORE
861  || rReq.GetSlot() == FN_TABLE_INSERT_COL;
862  sal_uInt16 nCount = 0;
863  bool bAfter = true;
864  if (pItem)
865  {
866  nCount = static_cast<const SfxInt16Item* >(pItem)->GetValue();
867  if(SfxItemState::SET == pArgs->GetItemState(FN_PARAM_INSERT_AFTER, true, &pItem))
868  bAfter = static_cast<const SfxBoolItem* >(pItem)->GetValue();
869  }
870  else if( !rReq.IsAPI() )
871  {
872  SwSelBoxes aBoxes;
873  ::GetTableSel( rSh, aBoxes );
874  if ( !aBoxes.empty() )
875  {
876  long maxX = 0;
877  long maxY = 0;
878  long minX = std::numeric_limits<long>::max();
879  long minY = std::numeric_limits<long>::max();
880  long nbBoxes = aBoxes.size();
881  for ( long i = 0; i < nbBoxes; i++ )
882  {
883  Point aCoord ( aBoxes[i]->GetCoordinates() );
884  if ( aCoord.X() < minX ) minX = aCoord.X();
885  if ( aCoord.X() > maxX ) maxX = aCoord.X();
886  if ( aCoord.Y() < minY ) minY = aCoord.Y();
887  if ( aCoord.Y() > maxY ) maxY = aCoord.Y();
888  }
889  if (bColumn)
890  nCount = maxX - minX + 1;
891  else
892  nCount = maxY - minY + 1;
893  }
894  bAfter = rReq.GetSlot() == FN_TABLE_INSERT_COL_AFTER
896  || rReq.GetSlot() == FN_TABLE_INSERT_ROW
897  || rReq.GetSlot() == FN_TABLE_INSERT_COL;
898  }
899 
900  if( nCount )
901  {
902  // i74180: Table border patch submitted by chensuchun:
903  // -->get the SvxBoxInfoItem of the table before insert
904  SfxItemSet aCoreSet( GetPool(), aUITableAttrRange);
905  ::lcl_TableParamToItemSet( aCoreSet, rSh );
906  bool bSetInnerBorders = false;
907  SwUndoId nUndoId = SwUndoId::EMPTY;
908  // <--End
909 
910  if( bColumn )
911  {
913  rSh.InsertCol( nCount, bAfter );
914  bSetInnerBorders = true;
915  nUndoId = SwUndoId::TABLE_INSCOL;
916  }
917  else if ( !rSh.IsInRepeatedHeadline() )
918  {
920  rSh.InsertRow( nCount, bAfter );
921  bSetInnerBorders = true;
922  nUndoId = SwUndoId::TABLE_INSROW;
923  }
924 
925  // -->after inserting,reset the inner table borders
926  if ( bSetInnerBorders )
927  {
928  const SvxBoxInfoItem& aBoxInfo(aCoreSet.Get(SID_ATTR_BORDER_INNER));
929  SfxItemSet aSet( GetPool(), svl::Items<SID_ATTR_BORDER_INNER,
930  SID_ATTR_BORDER_INNER>{});
931  aSet.Put( aBoxInfo );
932  ItemSetToTableParam( aSet, rSh );
933  rSh.EndUndo( nUndoId );
934  }
935 
936  bCallDone = true;
937  break;
938  }
939 
941 
942  [[fallthrough]]; // on Count = 0 appears the dialog
943  }
946  {
947  const SfxSlot* pSlot = GetStaticInterface()->GetSlot(nSlot);
948  if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline())
949  {
952  nSlot == FN_TABLE_INSERT_COL_DLG, pSlot->GetCommand()));
953  if( pDlg->Execute() == 1 )
954  {
955  const sal_uInt16 nDispatchSlot = (nSlot == FN_TABLE_INSERT_COL_DLG)
957  SfxUInt16Item aCountItem( nDispatchSlot, pDlg->getInsertCount() );
959  SfxViewFrame* pVFrame = GetView().GetViewFrame();
960  if( pVFrame )
961  pVFrame->GetDispatcher()->ExecuteList(nDispatchSlot,
962  SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
963  { &aCountItem, &aAfter });
964  }
965  }
966  break;
967  }
969  {
970  long nCount=0;
971  bool bHorizontal=true;
972  bool bProportional = false;
973  const SfxInt32Item* pSplit = rReq.GetArg<SfxInt32Item>(FN_TABLE_SPLIT_CELLS);
974  const SfxBoolItem* pHor = rReq.GetArg<SfxBoolItem>(FN_PARAM_1);
975  const SfxBoolItem* pProp = rReq.GetArg<SfxBoolItem>(FN_PARAM_2);
976  if ( pSplit )
977  {
978  nCount = pSplit->GetValue();
979  if ( pHor )
980  bHorizontal = pHor->GetValue();
981  if ( pProp )
982  bProportional = pProp->GetValue();
983  }
984  else
985  {
987  const long nMaxVert = rSh.GetAnyCurRect( CurRectType::Frame ).Width() / MINLAY;
989  if(rSh.IsSplitVerticalByDefault())
991  if( pDlg->Execute() == RET_OK )
992  {
993  nCount = pDlg->GetCount();
994  bHorizontal = pDlg->IsHorizontal();
995  bProportional = pDlg->IsProportional();
996  rReq.AppendItem( SfxInt32Item( FN_TABLE_SPLIT_CELLS, nCount ) );
997  rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bHorizontal ) );
998  rReq.AppendItem( SfxBoolItem( FN_PARAM_2, bProportional ) );
999 
1000  // tdf#60242: remember choice for next time
1001  bool bVerticalWasChecked = !pDlg->IsHorizontal();
1002  rSh.SetSplitVerticalByDefault(bVerticalWasChecked);
1003  }
1004  }
1005 
1006  if ( nCount>1 )
1007  {
1008  rSh.SplitTab(!bHorizontal, static_cast< sal_uInt16 >( nCount-1 ), bProportional );
1009  bCallDone = true;
1010  }
1011  else
1012  rReq.Ignore();
1013  break;
1014  }
1015 
1016  case FN_TABLE_SPLIT_TABLE:
1017  {
1018  const SfxUInt16Item* pType = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
1019  if( pType )
1020  {
1021  switch( static_cast<SplitTable_HeadlineOption>(pType->GetValue()) )
1022  {
1028  rSh.SplitTable(static_cast<SplitTable_HeadlineOption>(pType->GetValue())) ;
1029  break;
1030  default: ;//wrong parameter, do nothing
1031  }
1032  }
1033  else
1034  {
1037  pDlg->Execute();
1038  rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, static_cast<sal_uInt16>(pDlg->GetSplitMode()) ) );
1039  bCallDone = true;
1040  }
1041  break;
1042  }
1043 
1044  case FN_TABLE_MERGE_TABLE:
1045  {
1046  bool bPrev = rSh.CanMergeTable();
1047  bool bNext = rSh.CanMergeTable( false );
1048 
1049  if( bPrev && bNext )
1050  {
1053  if( RET_OK != pDlg->Execute())
1054  bPrev = bNext = false;
1055  }
1056 
1057  if( bPrev || bNext )
1058  rSh.MergeTable( bPrev );
1059  break;
1060  }
1061 
1062  case FN_TABLE_MODE_FIX :
1063  case FN_TABLE_MODE_FIX_PROP :
1064  case FN_TABLE_MODE_VARIABLE :
1065  {
1066  rSh.SetTableChgMode( FN_TABLE_MODE_FIX == nSlot
1068  : FN_TABLE_MODE_FIX_PROP == nSlot
1071 
1072  SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
1073  static sal_uInt16 aInva[] =
1077  0
1078  };
1079  rBind.Invalidate( aInva );
1080  bCallDone = true;
1081  break;
1082  }
1083  case FN_TABLE_AUTOSUM:
1084  {
1085  SfxViewFrame* pVFrame = GetView().GetViewFrame();
1086  pVFrame->GetDispatcher()->Execute(FN_EDIT_FORMULA, SfxCallMode::SYNCHRON);
1087  const sal_uInt16 nId = SwInputChild::GetChildWindowId();
1088  SwInputChild* pChildWin = static_cast<SwInputChild*>(pVFrame->
1089  GetChildWindow( nId ));
1090  OUString sSum;
1091  GetShell().GetAutoSum(sSum);
1092  if( pChildWin )
1093  pChildWin->SetFormula( sSum );
1094 
1095  break;
1096  }
1098  if(0 != rSh.GetRowsToRepeat())
1099  rSh.SetRowsToRepeat( 0 );
1100  else
1102  break;
1103  case FN_TABLE_SELECT_CELL :
1104  rSh.SelectTableCell();
1105  break;
1106  case FN_TABLE_DELETE_TABLE :
1107  {
1108  rSh.StartAction();
1109  rSh.StartUndo();
1111  rSh.DeleteTable();
1112  rSh.EndUndo();
1113  rSh.EndAction();
1114  //'this' is already destroyed
1115  return;
1116  }
1117  default:
1118  bMore = true;
1119  }
1120 
1121  if ( !bMore )
1122  {
1123  if(bCallDone)
1124  rReq.Done();
1125  return;
1126  }
1127 
1128  // Now the slots which are working directly on the TableFormat.
1129  switch ( nSlot )
1130  {
1131  case SID_ATTR_ULSPACE:
1132  if(pItem)
1133  {
1134  SvxULSpaceItem aULSpace( *static_cast<const SvxULSpaceItem*>(pItem) );
1135  aULSpace.SetWhich( RES_UL_SPACE );
1136  ::lcl_SetAttr( rSh, aULSpace );
1137  }
1138  break;
1139 
1140  case SID_ATTR_LRSPACE:
1141  if(pItem)
1142  {
1145  SvxLRSpaceItem aLRSpace( *static_cast<const SvxLRSpaceItem*>(pItem) );
1146  aLRSpace.SetWhich( RES_LR_SPACE );
1147  aSet.Put( aLRSpace );
1148  rSh.SetTableAttr( aSet );
1149  }
1150  break;
1151  // The last case branch which needs a table manager!!
1153  {
1154  SwTableFUNC aMgr( &rSh );
1155  aMgr.ColWidthDlg(GetView().GetFrameWeld());
1156  break;
1157  }
1158  case SID_TABLE_VERT_NONE:
1159  case SID_TABLE_VERT_CENTER:
1160  case SID_TABLE_VERT_BOTTOM:
1161  {
1162  const sal_uInt16 nAlign = nSlot == SID_TABLE_VERT_NONE ?
1164  nSlot == SID_TABLE_VERT_CENTER ?
1165  text::VertOrientation::CENTER : text::VertOrientation::BOTTOM;
1166  rSh.SetBoxAlign(nAlign);
1167  bCallDone = true;
1168  break;
1169  }
1170 
1171  case SID_ATTR_PARA_SPLIT:
1172  if ( pItem )
1173  {
1174  SwFormatLayoutSplit aSplit( static_cast<const SvxFormatSplitItem*>(pItem)->GetValue());
1176  aSet.Put(aSplit);
1177  rSh.SetTableAttr(aSet);
1178  }
1179  break;
1180 
1181  case SID_ATTR_PARA_KEEP:
1182  if ( pItem )
1183  {
1184  SvxFormatKeepItem aKeep( *static_cast<const SvxFormatKeepItem*>(pItem) );
1185  aKeep.SetWhich( RES_KEEP );
1187  aSet.Put(aKeep);
1188  rSh.SetTableAttr(aSet);
1189  }
1190  break;
1191  case FN_TABLE_ROW_SPLIT :
1192  {
1193  const SfxBoolItem* pBool = static_cast<const SfxBoolItem*>(pItem);
1194  std::unique_ptr<SwFormatRowSplit> pSplit;
1195  if(!pBool)
1196  {
1197  pSplit = rSh.GetRowSplit();
1198  if(pSplit)
1199  pSplit->SetValue(!pSplit->GetValue());
1200  else
1201  pSplit.reset(new SwFormatRowSplit(true));
1202  }
1203  else
1204  {
1205  pSplit.reset(new SwFormatRowSplit(pBool->GetValue()));
1206  }
1207  rSh.SetRowSplit( *pSplit );
1208  break;
1209  }
1210 
1211  default:
1212  OSL_ENSURE( false, "wrong Dispatcher" );
1213  return;
1214  }
1215  if(bCallDone)
1216  rReq.Done();
1217 }
1218 
1220 {
1221  SfxWhichIter aIter( rSet );
1222  SwWrtShell &rSh = GetShell();
1223  SwFrameFormat *pFormat = rSh.GetTableFormat();
1224  // os #124829# crash report: in case of an invalid shell selection return immediately
1225  if(!pFormat)
1226  return;
1227  sal_uInt16 nSlot = aIter.FirstWhich();
1228  while ( nSlot )
1229  {
1230  switch ( nSlot )
1231  {
1232  case FN_TABLE_MERGE_CELLS:
1233  if ( !rSh.IsTableMode() )
1235  break;
1236  case SID_TABLE_MINIMAL_COLUMN_WIDTH:
1237  case FN_TABLE_ADJUST_CELLS:
1238  if ( !rSh.IsAdjustCellWidthAllowed() )
1239  rSet.DisableItem(nSlot);
1240  break;
1241 
1243  if ( !rSh.IsAdjustCellWidthAllowed(true) )
1245  break;
1246 
1248  case FN_TABLE_BALANCE_ROWS:
1249  if ( !rSh.BalanceRowHeight(true) )
1250  rSet.DisableItem(nSlot);
1251  break;
1252  case FN_OPTIMIZE_TABLE:
1253  if ( !rSh.IsTableMode() &&
1254  !rSh.IsAdjustCellWidthAllowed() &&
1255  !rSh.IsAdjustCellWidthAllowed(true) &&
1256  !rSh.BalanceRowHeight(true) )
1258  break;
1259  case SID_INSERT_DIAGRAM:
1260  {
1261  SvtModuleOptions aMOpt;
1262  if ( !aMOpt.IsMath() || rSh.IsTableComplexForChart() )
1263  rSet.DisableItem(nSlot);
1264  }
1265  break;
1266 
1267  case FN_INSERT_TABLE:
1268  if ( rSh.CursorInsideInputField() )
1269  {
1270  rSet.DisableItem( nSlot );
1271  }
1272  break;
1273 
1274  case SID_TABLE_MINIMAL_ROW_HEIGHT:
1275  {
1276  // Disable if auto height already is enabled.
1277  std::unique_ptr<SwFormatFrameSize> pSz = rSh.GetRowHeight();
1278  if ( pSz )
1279  {
1280  if ( ATT_VAR_SIZE == pSz->GetHeightSizeType() )
1281  rSet.DisableItem( nSlot );
1282  }
1283  break;
1284  }
1285  case FN_TABLE_INSERT_ROW:
1288  if ( rSh.IsInRepeatedHeadline() )
1289  rSet.DisableItem( nSlot );
1290  break;
1291  case RES_LR_SPACE:
1292  rSet.Put(pFormat->GetLRSpace());
1293  break;
1294  case RES_UL_SPACE:
1295  rSet.Put(pFormat->GetULSpace());
1296  break;
1297 
1298  case SID_TABLE_VERT_NONE:
1299  case SID_TABLE_VERT_CENTER:
1300  case SID_TABLE_VERT_BOTTOM:
1301  {
1302  const sal_uInt16 nAlign = rSh.GetBoxAlign();
1303  bool bSet = (nSlot == SID_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) ||
1304  (nSlot == SID_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) ||
1305  (nSlot == SID_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM);
1306  rSet.Put(SfxBoolItem(nSlot, bSet));
1307  break;
1308  }
1309 
1310  case FN_TABLE_MODE_FIX :
1311  case FN_TABLE_MODE_FIX_PROP :
1312  case FN_TABLE_MODE_VARIABLE :
1313  {
1314  TableChgMode nMode = rSh.GetTableChgMode();
1315  bool bSet = (nSlot == FN_TABLE_MODE_FIX && nMode == TableChgMode::FixedWidthChangeAbs) ||
1318  rSet.Put(SfxBoolItem(nSlot, bSet));
1319  }
1320  break;
1321 
1322  case SID_ATTR_PARA_SPLIT:
1323  rSet.Put( pFormat->GetKeep() );
1324  break;
1325 
1326  case SID_ATTR_PARA_KEEP:
1327  rSet.Put( pFormat->GetLayoutSplit() );
1328  break;
1329  case FN_TABLE_SPLIT_TABLE:
1330  if ( rSh.IsInHeadline() )
1331  rSet.DisableItem( nSlot );
1332  break;
1333  case FN_TABLE_MERGE_TABLE:
1334  {
1335  bool bAsk;
1336  if( !rSh.CanMergeTable( true, &bAsk ))
1337  rSet.DisableItem( nSlot );
1338  break;
1339  }
1340 
1341  case FN_TABLE_DELETE_ROW:
1342  {
1343  SwSelBoxes aBoxes;
1344  ::GetTableSel( rSh, aBoxes, SwTableSearchType::Row );
1345  if( ::HasProtectedCells( aBoxes ))
1346  rSet.DisableItem( nSlot );
1347  }
1348  break;
1349  case FN_TABLE_DELETE_COL:
1350  {
1351  SwSelBoxes aBoxes;
1352  ::GetTableSel( rSh, aBoxes, SwTableSearchType::Col );
1353  if( ::HasProtectedCells( aBoxes ))
1354  rSet.DisableItem( nSlot );
1355  }
1356  break;
1357 
1359  // disable in readonly sections, but enable in protected cells
1360  if( !rSh.CanUnProtectCells() )
1361  rSet.DisableItem( nSlot );
1362  break;
1363  case RES_ROW_SPLIT:
1364  {
1365  const SwFormatLayoutSplit& rTabSplit = pFormat->GetLayoutSplit();
1366  if ( !rTabSplit.GetValue() )
1367  {
1368  rSet.DisableItem( nSlot );
1369  }
1370  else
1371  {
1372  std::unique_ptr<SwFormatRowSplit> pSplit = rSh.GetRowSplit();
1373  if(pSplit)
1374  rSet.Put(std::move(pSplit));
1375  else
1376  rSet.InvalidateItem( nSlot );
1377  }
1378  break;
1379  }
1381  if(0 != rSh.GetRowsToRepeat())
1382  rSet.Put(SfxBoolItem(nSlot, true));
1383  else if(!rSh.GetRowSelectionFromTop())
1384  rSet.DisableItem( nSlot );
1385  else
1386  rSet.Put(SfxBoolItem(nSlot, false));
1387  break;
1388  case FN_TABLE_SELECT_CELL :
1389  if(rSh.HasBoxSelection())
1390  rSet.DisableItem( nSlot );
1391  break;
1392  }
1393  nSlot = aIter.NextWhich();
1394  }
1395 }
1396 
1398  SwBaseShell(_rView)
1399 {
1400  SetName("Table");
1402 }
1403 
1405 {
1406  SfxItemSet aCoreSet( GetPool(),
1408  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>{} );
1409  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1410  aCoreSet.Put( aBoxInfo );
1411  GetShell().GetTabBorders( aCoreSet );
1412  rSet.Put( aCoreSet );
1413 }
1414 
1416 {
1417  SwWrtShell &rSh = GetShell();
1418  const SfxItemSet *pArgs = rReq.GetArgs();
1419  if(pArgs)
1420  switch ( rReq.GetSlot() )
1421  {
1422  case SID_FRAME_LINESTYLE:
1423  case SID_FRAME_LINECOLOR:
1424  if ( rReq.GetSlot() == SID_FRAME_LINESTYLE )
1425  {
1426  const SvxLineItem &rLineItem = pArgs->Get( SID_FRAME_LINESTYLE );
1427  const SvxBorderLine* pBorderLine = rLineItem.GetLine();
1428  rSh.SetTabLineStyle( nullptr, true, pBorderLine);
1429  }
1430  else
1431  {
1432  const SvxColorItem &rNewColorItem = pArgs->Get( SID_FRAME_LINECOLOR );
1433  rSh.SetTabLineStyle( &rNewColorItem.GetValue() );
1434  }
1435 
1436  rReq.Done();
1437 
1438  break;
1439  }
1440 }
1441 
1443 {
1444  SfxItemSet aCoreSet( GetPool(),
1446  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>{});
1447  SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER );
1448  aCoreSet.Put(aCoreInfo);
1449  GetShell().GetTabBorders( aCoreSet );
1450 
1451  const SvxBoxItem& rBoxItem = aCoreSet.Get( RES_BOX );
1452  const SvxBorderLine* pLine = rBoxItem.GetTop();
1453 
1454  rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) );
1455  SvxLineItem aLine( SID_FRAME_LINESTYLE );
1456  aLine.SetLine(pLine);
1457  rSet.Put( aLine );
1458 }
1459 
1461 {
1462  const SfxItemSet* pArgs = rReq.GetArgs();
1463  SwWrtShell &rSh = GetShell();
1464 
1465  // At first the slots, which doesn't need a FrameMgr.
1466  const SfxPoolItem* pItem = nullptr;
1467  const sal_uInt16 nSlot = rReq.GetSlot();
1468  if(pArgs)
1469  pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
1470 
1471  // Always acquire the language from the current cursor position.
1472  LanguageType eLang = rSh.GetCurLang();
1473  SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
1474  sal_uInt32 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
1475  SvNumFormatType nFormatType = SvNumFormatType::ALL;
1476  sal_uInt16 nOffset = 0;
1477 
1478  switch ( nSlot )
1479  {
1480  case FN_NUMBER_FORMAT:
1481  if( pItem )
1482  {
1483  // Determine index for string.
1484  OUString aCode( static_cast<const SfxStringItem*>(pItem)->GetValue() );
1485  nNumberFormat = pFormatter->GetEntryKey( aCode, eLang );
1486  if( NUMBERFORMAT_ENTRY_NOT_FOUND == nNumberFormat )
1487  {
1488  // Re-enter
1489  sal_Int32 nErrPos;
1491  if( !pFormatter->PutEntry( aCode, nErrPos, nType,
1492  nNumberFormat, eLang ))
1493  nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
1494  }
1495  }
1496  break;
1497  case FN_NUMBER_STANDARD: nFormatType = SvNumFormatType::NUMBER; break;
1498  case FN_NUMBER_SCIENTIFIC: nFormatType = SvNumFormatType::SCIENTIFIC; break;
1499  case FN_NUMBER_DATE: nFormatType = SvNumFormatType::DATE; break;
1500  case FN_NUMBER_TIME: nFormatType = SvNumFormatType::TIME; break;
1501  case FN_NUMBER_CURRENCY: nFormatType = SvNumFormatType::CURRENCY; break;
1502  case FN_NUMBER_PERCENT: nFormatType = SvNumFormatType::PERCENT; break;
1503 
1504  case FN_NUMBER_TWODEC: // #.##0,00
1505  nFormatType = SvNumFormatType::NUMBER;
1506  nOffset = NF_NUMBER_1000DEC2;
1507  break;
1508 
1509  default:
1510  OSL_FAIL("wrong dispatcher");
1511  return;
1512  }
1513 
1514  if( nFormatType != SvNumFormatType::ALL )
1515  nNumberFormat = pFormatter->GetStandardFormat( nFormatType, eLang ) + nOffset;
1516 
1517  if( NUMBERFORMAT_ENTRY_NOT_FOUND != nNumberFormat )
1518  {
1520  aBoxSet.Put( SwTableBoxNumFormat( nNumberFormat ));
1521  rSh.SetTableBoxFormulaAttrs( aBoxSet );
1522  }
1523 
1524 }
1525 
1526 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long GetLeft() const
SfxViewFrame * GetViewFrame() const
bool GetValue() const
virtual long GetCount() const =0
#define FN_TABLE_INSERT_COL_DLG
Definition: cmdid.h:371
#define FN_TABLE_SET_READ_ONLY_CELLS
Definition: cmdid.h:346
bool GetRowBackground(std::shared_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:757
sal_Int32 GetValue() const
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
FieldUnit
SwMoveFnCollection const & fnTableEnd
Definition: paminit.cxx:53
#define FN_TABLE_INSERT_COL_BEFORE
Definition: cmdid.h:341
#define FN_TABLE_OPTIMAL_HEIGHT
Definition: cmdid.h:354
#define FN_TABLE_SET_COL_WIDTH
Definition: cmdid.h:337
const SwFormatLayoutSplit & GetLayoutSplit(bool=true) const
Definition: fmtlsplt.hxx:46
void SplitTab(bool bVert, sal_uInt16 nCnt, bool bSameHeight)
Split cell vertically or horizontally.
Definition: fetab.cxx:472
SwView & GetView()
Definition: basesh.hxx:57
#define SFX_IMPL_INTERFACE(Class, SuperClass)
static SfxInterface * GetStaticInterface()
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:184
void SetDefDist(sal_uInt16 nNew)
SwTwips GetLeftSpace() const
Definition: swtablerep.hxx:50
SwView * GetActiveView()
Definition: swmodul1.cxx:123
void SetRowSplit(const SwFormatRowSplit &rSz)
Definition: fetab.cxx:712
SwTwips GetTableWidth(SwFrameFormat const *pFormat, SwTabCols const &rCols, sal_uInt16 *pPercent, SwWrtShell *pSh)
Definition: uitool.cxx:778
SwUndoId
Definition: swundo.hxx:29
#define RES_HORI_ORIENT
Definition: hintids.hxx:208
std::string GetValue
void SetRowBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:749
#define FN_TABLE_SPLIT_TABLE
Definition: cmdid.h:445
sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge=LANGUAGE_DONTKNOW)
virtual VclPtr< VclAbstractDialog > CreateTableMergeDialog(weld::Window *pParent, bool &rWithPrev)=0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
bool IsTableMode() const
Definition: crsrsh.hxx:646
void SetMinDist(bool bNew)
void ProtectCells()
If a table selection exists it is destroyed in case cursor is not allowed in readonly.
Definition: fetab.cxx:909
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
Definition: fews.cxx:92
#define FN_TABLE_DELETE_TABLE
Definition: cmdid.h:355
void InsertCol(sal_uInt16 nCnt, bool bBehind)
Definition: fetab.cxx:211
#define RES_SHADOW
Definition: hintids.hxx:212
SfxDispatcher * GetDispatcher()
SwWrtShell & GetShell()
Definition: basesh.cxx:2623
static SvxAbstractDialogFactory * Create()
#define FN_TABLE_INSERT_COL
Definition: cmdid.h:331
#define FN_TABLE_INSERT_ROW
Definition: cmdid.h:330
#define RES_FRAMEDIR
Definition: hintids.hxx:225
void SetTable(bool bNew)
#define MINLAY
Definition: swtypes.hxx:66
const SvxFrameDirectionItem & GetFrameDir(bool=true) const
Definition: frmatr.hxx:94
void DeleteTable()
Definition: fetab.cxx:313
virtual void SetSplitVerticalByDefault()=0
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1721
#define RES_FRMATR_END
Definition: hintids.hxx:236
void GetLineStyleState(SfxItemSet &rSet)
Definition: tabsh.cxx:1442
#define FN_FORMAT_TABLE_DLG
Definition: cmdid.h:305
long GetRightMax() const
Definition: tabcol.hxx:79
sal_uInt16 GetValue() const
void InvalidateItem(sal_uInt16 nWhich)
sal_Int16 nId
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
bool FillTabCols(SwTabCols &rTabCol) const
Definition: swtablerep.cxx:89
sal_uInt16 FirstWhich()
TableChgMode GetTableChgMode() const
Definition: edtab.cxx:284
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:233
#define FN_TABLE_INSERT_COL_AFTER
Definition: cmdid.h:345
bool DeleteCol()
Definition: fetab.cxx:266
long SwTwips
Definition: swtypes.hxx:49
bool HasProtectedCells(const SwSelBoxes &rBoxes)
Definition: tblsel.cxx:844
virtual VclPtr< SfxAbstractTabDialog > CreateSwTableTabDlg(weld::Window *pParent, const SfxItemSet *pItemSet, SwWrtShell *pSh)=0
void EnterStdMode()
Definition: select.cxx:552
void Done(bool bRemove=false)
#define FN_PARAM_TABLE_NAME
Definition: cmdid.h:755
NF_NUMBER_1000DEC2
SwTwips GetRightSpace() const
Definition: swtablerep.hxx:53
void SetLine(const editeng::SvxBorderLine *pNew)
#define FN_EDIT_FORMULA
Definition: cmdid.h:76
#define FN_CALC_TABLE
Definition: cmdid.h:77
std::unique_ptr< SwFormatFrameSize > GetRowHeight() const
Pointer must be destroyed by caller != 0.
Definition: fetab.cxx:733
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
#define FN_NUMBER_FORMAT
Definition: cmdid.h:427
bool HasColsChanged() const
Definition: swtablerep.hxx:68
void InsertRow(sal_uInt16 nCnt, bool bBehind)
Definition: fetab.cxx:171
const editeng::SvxBorderLine * GetRight() const
#define MIN_BORDER_DIST
Definition: swtypes.hxx:74
void EndAllAction()
Definition: edws.cxx:96
SwTwips GetWidth() const
Definition: swtablerep.hxx:56
#define FN_TABLE_SELECT_ROW
Definition: cmdid.h:342
const std::vector< sal_uInt32 > & GetDelFormats() const
bool GoNextCell(bool bAppendLine=true)
set cursor into next/previous cell
Definition: trvltbl.cxx:38
sal_uInt16 NextWhich()
virtual VclPtr< VclAbstractDialog > CreateSwTableHeightDialog(weld::Window *pParent, SwWrtShell &rSh)=0
virtual bool IsHorizontal() const =0
bool GotoCurrTable(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosTable, bool bInReadOnly)
Definition: trvltbl.cxx:630
LanguageType GetCurLang() const
Definition: edattr.cxx:813
bool IsInRepeatedHeadline() const
Definition: fesh.hxx:710
void SetTabBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:830
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
#define FN_PARAM_TABLE_HEADLINE
Definition: cmdid.h:756
#define FN_TABLE_AUTOSUM
Definition: cmdid.h:415
void SelectTableRow()
Definition: select.cxx:838
bool IsTableVertical() const
Definition: fetab.cxx:2325
static void lcl_SetAttr(SwWrtShell &rSh, const SfxPoolItem &rItem)
Definition: tabsh.cxx:134
#define FN_NUMBER_BULLETS
Definition: cmdid.h:72
#define SDRATTR_TABLE_BORDER_INNER
static void lcl_TabGetMaxLineWidth(const SvxBorderLine *pBorderLine, SvxBorderLine &rBorderLine)
Definition: tabsh.cxx:444
void SetLeft(const long nL, const sal_uInt16 nProp=100)
const SwView & GetView() const
Definition: wrtsh.hxx:426
#define FN_GOTO_NEXT_CELL
Definition: cmdid.h:374
void SetHoriOrient(sal_Int16 eNew)
Definition: fmtornt.hxx:89
FUNC_TYPE const nType
#define XATTR_FILL_LAST
#define FN_TABLE_SELECT_ALL
Definition: cmdid.h:344
sal_uInt16 GetAlign() const
Definition: swtablerep.hxx:62
#define XATTR_FILL_FIRST
void AdjustCellWidth(const bool bBalance, const bool bNoShrink)
Definition: fetab.cxx:1115
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND
#define FN_PARAM_INSERT_AFTER
Definition: cmdid.h:753
const OUString & GetName() const
Definition: format.hxx:111
void ExecTableStyle(SfxRequest &rReq)
Definition: tabsh.cxx:1415
bool BalanceRowHeight(bool bTstOnly, const bool bOptimize=false)
Definition: fetab.cxx:738
#define RES_UL_SPACE
Definition: hintids.hxx:197
void GetFrameBorderState(SfxItemSet &rSet)
Definition: tabsh.cxx:1404
bool GetBoxDirection(std::shared_ptr< SvxFrameDirectionItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:809
void GetState(SfxItemSet &)
Definition: tabsh.cxx:1219
virtual VclPtr< AbstractSwAutoFormatDlg > CreateSwAutoFormatDlg(weld::Window *pParent, SwWrtShell *pShell, bool bSetAutoFormat=true, const SwTableAutoFormat *pSelFormat=nullptr)=0
const SvxFormatKeepItem & GetKeep(bool=true) const
Definition: frmatr.hxx:86
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
#define FN_NUMBER_SCIENTIFIC
Definition: cmdid.h:430
#define FN_NUMBER_DATE
Definition: cmdid.h:431
static std::shared_ptr< SwTableRep > lcl_TableParamToItemSet(SfxItemSet &rSet, SwWrtShell &rSh)
Definition: tabsh.cxx:141
size_type size() const
#define FN_NUMBER_TWODEC
Definition: cmdid.h:429
void SelectTableCol()
Definition: select.cxx:847
void SetFormula(const OUString &rFormula)
Definition: inputwin.hxx:101
bool PutEntry(OUString &rString, sal_Int32 &nCheckPos, SvNumFormatType &nType, sal_uInt32 &nKey, LanguageType eLnge=LANGUAGE_DONTKNOW)
sal_uInt16 GetWidthPercent() const
Definition: swtablerep.hxx:59
SfxItemPool & GetPool() const
#define FN_NUMBER_PERCENT
Definition: cmdid.h:434
void SetTableBoxFormulaAttrs(const SfxItemSet &rSet)
Definition: edtab.cxx:351
#define RES_ROW_SPLIT
Definition: hintids.hxx:227
#define RES_BACKGROUND
Definition: hintids.hxx:210
void SetTableDest(sal_uInt8 nNew)
Definition: viewopt.hxx:534
const sal_uInt16 * SwuiGetUITableAttrRange()
Definition: tabsh.cxx:129
void SetTableChgMode(TableChgMode eMode)
Definition: edtab.cxx:295
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
#define FN_TABLE_INSERT_ROW_DLG
Definition: cmdid.h:372
void EndSelect()
Definition: select.cxx:426
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:614
bool IsMath() const
void SetTabBorders(const SfxItemSet &rSet)
Definition: fetab.cxx:762
bool ExtendedSelectedAll()
If ExtendedSelectAll() was called and selection didn't change since then.
Definition: crsrsh.cxx:595
const editeng::SvxBorderLine * GetTop() const
void SetBoxBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:785
void SetRight(const long nR, const sal_uInt16 nProp=100)
#define FN_TABLE_MERGE_CELLS
Definition: cmdid.h:335
void SetTabCols(const SwTabCols &rNew, bool bCurRowOnly)
Definition: fetab.cxx:624
Style of a layout element.
Definition: frmfmt.hxx:57
SwTableShell(SwView &rView)
Definition: tabsh.cxx:1397
bool HasSelection() const
Definition: wrtsh.hxx:139
#define SW_MOD()
Definition: swmodule.hxx:256
bool HasBoxSelection() const
Is content of a table cell or at least a table cell completely selected?
Definition: fetab.cxx:868
const editeng::SvxBorderLine * GetLeft() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:710
#define FN_INSERT_TABLE
Definition: cmdid.h:208
void GetTableSel(const SwCursorShell &rShell, SwSelBoxes &rBoxes, const SwTableSearchType eSearchType)
Definition: tblsel.cxx:144
void SetRowsToRepeat(sal_uInt16 nNumOfRows)
Definition: fetab.cxx:1007
const SfxSlot * GetSlot(sal_uInt16 nSlotId) const
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
Definition: crsrsh.cxx:228
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
void SetRowHeight(const SwFormatFrameSize &rSz)
Definition: fetab.cxx:725
#define LANGUAGE_SYSTEM
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2221
virtual VclPtr< SvxAbstractInsRowColDlg > CreateSvxInsRowColDlg(weld::Window *pParent, bool bCol, const OString &rHelpId)=0
#define FN_TABLE_ADJUST_CELLS
Definition: cmdid.h:349
SfxBindings & GetBindings()
#define FN_NUMBER_CURRENCY
Definition: cmdid.h:433
int i
virtual VclPtr< SfxAbstractDialog > CreateNumFormatDialog(weld::Widget *pParent, const SfxItemSet &rAttr)=0
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:340
bool GetBoxBackground(std::shared_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:793
const T * GetArg(sal_uInt16 nSlotId) const
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:222
virtual bool IsProportional() const =0
#define RES_LAYOUT_SPLIT
Definition: hintids.hxx:218
OUString GetTableBoxText() const
Definition: edtab.cxx:425
weld::Window * GetFrameWeld(SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
NF_TEXT
SvNumFormatType
void SetBoxAlign(sal_uInt16 nOrient)
Definition: fetab.cxx:817
sal_uInt16 GetCursorCnt(bool bAll=true) const
Get the number of elements in the ring of cursors.
Definition: crsrsh.cxx:2695
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
long ResetSelect(const Point *, bool)
Definition: select.cxx:337
void GetTabCols(SwTabCols &rToFill) const
Info about columns and margins.
Definition: fetab.cxx:642
OUString SwResId(const char *pId)
Definition: swmodule.cxx:191
#define RES_BOXATR_VALUE
Definition: hintids.hxx:263
void SetName(const OUString &rName)
bool empty() const
void SttSelect()
Definition: select.cxx:386
void DeleteEntry(sal_uInt32 nKey)
#define FN_TABLE_DELETE_COL
Definition: cmdid.h:333
sal_uInt16 GetRowSelectionFromTop() const
Definition: fetab.cxx:1059
TableMergeErr MergeTab()
Merge selected parts of table.
Definition: fetab.cxx:439
void GetTableAttr(SfxItemSet &) const
Definition: fetab.cxx:2127
long X() const
void UpdateTable()
update fields of a listing
Definition: edtab.cxx:264
virtual sal_uInt16 getInsertCount() const =0
SwDocShell * GetDocShell()
Definition: view.cxx:1127
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:182
#define FN_TABLE_INSERT_ROW_AFTER
Definition: cmdid.h:338
#define FN_GOTO_PREV_CELL
Definition: cmdid.h:375
#define SFX_OBJECTBAR_OBJECT
std::unique_ptr< SwFormatRowSplit > GetRowSplit() const
Definition: fetab.cxx:720
#define RES_LR_SPACE
Definition: hintids.hxx:196
void UnProtectCells()
Refers to table selection.
Definition: fetab.cxx:929
SvNumberFormatter * GetNumberFormatter() const
SFX2_DLLPUBLIC OString GetCommand() const
#define FN_TABLE_MODE_FIX_PROP
Definition: cmdid.h:411
void StartAction()
Definition: crsrsh.cxx:211
bool MergeTable(bool bWithPrev)
Definition: edtab.cxx:463
#define FN_NUMBER_TIME
Definition: cmdid.h:432
OString OUStringToOString(const OUString &str, ConnectionSettings const *settings)
void SetReturnValue(const SfxPoolItem &)
void Update(sal_uInt16 nId)
void InsertTable(SfxRequest &_rRequest)
Definition: basesh.cxx:2633
sal_uInt8 GetTableDest() const
Definition: viewopt.hxx:509
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
static const OUString & GetContextName(const Context eContext)
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:76
#define FN_START_TABLE
Definition: cmdid.h:662
#define FN_TABLE_ROW_SPLIT
Definition: cmdid.h:458
const editeng::SvxBorderLine * GetLine() const
#define FN_TABLE_BALANCE_CELLS
Definition: cmdid.h:402
SfxItemState
void DisableItem(sal_uInt16 nWhich)
void GetTabBackground(std::shared_ptr< SvxBrushItem > &rToFill) const
Definition: fetab.cxx:843
bool CanMergeTable(bool bWithPrev=true, bool *pChkNxtPrv=nullptr) const
Merge tables.
Definition: edtab.cxx:481
#define FN_TABLE_BALANCE_ROWS
Definition: cmdid.h:403
SwMoveFnCollection const & fnTableStart
Definition: paminit.cxx:52
virtual bool isInsertBefore() const =0
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool GoPrevCell()
Definition: trvltbl.cxx:100
#define FN_TABLE_REP
Definition: cmdid.h:328
#define GetWhich(nSlot)
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
virtual VclPtr< SvxAbstractSplitTableDialog > CreateSvxSplitTableDialog(weld::Window *pParent, bool bIsTableVertical, long nMaxVertical)=0
void Width(long nNew)
Definition: swrect.hxx:185
bool MoveTable(SwWhichTable, SwMoveFnCollection const &)
Definition: trvltbl.cxx:679
void SetTableAttr(const SfxItemSet &)
Definition: fetab.cxx:2134
void SetWidthPercent(sal_uInt8 n)
Definition: fmtfsize.hxx:95
#define FN_TABLE_MERGE_TABLE
Definition: cmdid.h:457
void SetSplitVerticalByDefault(bool value)
Definition: select.cxx:373
void ItemSetToTableParam(const SfxItemSet &rSet, SwWrtShell &rSh)
Definition: tabsh.cxx:275
#define FN_TABLE_UNSET_READ_ONLY_CELLS
Definition: cmdid.h:347
#define FN_END_TABLE
Definition: cmdid.h:663
void ColWidthDlg(weld::Window *pParent)
Definition: tablemgr.cxx:56
bool IsSplitVerticalByDefault() const
Definition: select.cxx:368
sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge=LANGUAGE_DONTKNOW)
bool StartsWithTable()
If document body starts with a table.
Definition: crsrsh.cxx:613
RET_OK
SvxBoxItemLine
#define RES_KEEP
Definition: hintids.hxx:215
void SelectTableCell()
Definition: select.cxx:856
bool GetTableBoxFormulaAttrs(SfxItemSet &rSet) const
Definition: edtab.cxx:310
#define FN_TABLE_BOX_TEXTORIENTATION
Definition: cmdid.h:413
#define FN_TABLE_SET_ROW_HEIGHT
Definition: cmdid.h:336
#define FN_TABLE_SELECT_COL
Definition: cmdid.h:343
#define DEF_LINE_WIDTH_5
SvxBoxItem & rBoxItem
virtual VclPtr< AbstractSplitTableDialog > CreateSplitTableDialog(weld::Window *pParent, SwWrtShell &rSh)=0
void ClearMark()
Definition: crsrsh.cxx:926
void GetTabBorders(SfxItemSet &rSet) const
Definition: fetab.cxx:780
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
sal_uInt32 GetEntryKey(const OUString &sStr, LanguageType eLnge=LANGUAGE_DONTKNOW)
#define FN_NUMBER_STANDARD
Definition: cmdid.h:428
#define RES_BOX
Definition: hintids.hxx:211
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
void SetTableName(SwFrameFormat &rTableFormat, const OUString &rNewName)
change table name
Definition: editsh.cxx:409
void AppendItem(const SfxPoolItem &)
bool IsTableComplexForChart()
Definition: trvltbl.cxx:723
sal_uInt16 GetBoxAlign() const
USHRT_MAX if ambiguous.
Definition: fetab.cxx:825
sal_uInt16 GetRowsToRepeat() const
Definition: fetab.cxx:998
#define FN_TABLE_INSERT_ROW_BEFORE
Definition: cmdid.h:340
bool IsInHeadline() const
Definition: fesh.hxx:711
#define FN_TABLE_MODE_VARIABLE
Definition: cmdid.h:412
#define FN_TABLE_SPLIT_CELLS
Definition: cmdid.h:334
TableChgMode
Definition: tblenum.hxx:46
bool IsAPI() const
bool IsAdjustCellWidthAllowed(bool bBalance=false) const
Not allowed if only empty cells are selected.
Definition: fetab.cxx:1129
#define RES_COLLAPSING_BORDERS
Definition: hintids.hxx:229
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
bool CanUnProtectCells() const
Definition: fetab.cxx:971
void ExecNumberFormat(SfxRequest const &rReq)
Definition: tabsh.cxx:1460
#define FN_TABLE_MODE_FIX
Definition: cmdid.h:410
#define FN_TABLE_DELETE_ROW
Definition: cmdid.h:332
#define FN_PARAM_TABLE_SPACE
Definition: cmdid.h:757
static const sal_uInt16 aUITableAttrRange[]
Definition: tabsh.cxx:101
#define FN_TABLE_HEADLINE_REPEAT
Definition: cmdid.h:348
#define FN_TABLE_SELECT_CELL
Definition: cmdid.h:356
void GetAutoSum(OUString &rFormula) const
Definition: fetab.cxx:2212
#define FN_OPTIMIZE_TABLE
Definition: cmdid.h:339
bool HasWholeTabSelection() const
Definition: fetab.cxx:850
#define RES_PAGEDESC
Definition: hintids.hxx:198
#define RES_BREAK
Definition: hintids.hxx:199
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1404
void StartAllAction()
For all views of this document.
Definition: edws.cxx:85
void SetTabLineStyle(const Color *pColor, bool bSetLine=false, const editeng::SvxBorderLine *pBorderLine=nullptr)
Definition: fetab.cxx:770
#define FN_TABLE_SET_VERT_ALIGN
Definition: cmdid.h:409
void Ignore()
#define RES_FRMATR_BEGIN
Definition: hintids.hxx:192
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
Definition: editsh.cxx:750
Frame is variable in Var-direction.
Definition: fmtfsize.hxx:37
bool DeleteRow(bool bCompleteTable=false)
Definition: fetab.cxx:318
void SetContextName(const OUString &rsContextName)
const editeng::SvxBorderLine * GetBottom() const
#define FN_NUM_FORMAT_TABLE_DLG
Definition: cmdid.h:296
sal_uInt16 Which() const
void Execute(SfxRequest &)
Definition: tabsh.cxx:453
Definition: view.hxx:146
long Y() const
const Color & GetValue() const
#define RES_BOXATR_FORMAT
Definition: hintids.hxx:261
void SetBoxDirection(const SvxFrameDirectionItem &rNew)
Definition: fetab.cxx:801
void SetDist(bool bNew)
Rect of current frame.
void SplitTable(SplitTable_HeadlineOption eMode)
Split table at cursor position.
Definition: edtab.cxx:447
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
const SvxShadowItem & GetShadow(bool=true) const
Definition: frmatr.hxx:88
bool CursorInsideInputField() const
Definition: crstrvl.cxx:948