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