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