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