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