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.StartsWithTable() && 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_BoxesInDeletedRows(SwWrtShell &rSh, const SwSelBoxes& rBoxes)
450{
451 // cursor and selection are there only in deleted rows in Show Changes mode
452 if ( rSh.GetLayout()->IsHideRedlines() )
453 return false;
454
455 // not selected or all selected rows are deleted
456 bool bRet = true;
457 SwRedlineTable::size_type nRedlinePos = 0;
458 if ( rBoxes.empty() )
459 bRet = rSh.GetCursor()->GetPointNode().GetTableBox()->GetUpper()->IsDeleted(nRedlinePos);
460 else
461 {
462 tools::Long nBoxes = rBoxes.size();
463 SwTableLine* pPrevLine = nullptr;
464 for ( tools::Long i = 0; i < nBoxes; i++ )
465 {
466 SwTableLine* pLine = rBoxes[i]->GetUpper();
467 if ( pLine != pPrevLine )
468 bRet &= pLine->IsDeleted(nRedlinePos);
469 pPrevLine = pLine;
470 }
471 }
472
473 return bRet;
474}
475
477{
478 // cursor and selection are there only in deleted table in Show Changes mode
479 if ( rSh.GetLayout()->IsHideRedlines() )
480 return false;
481
482 SwTableNode* pTableNd = rSh.GetCursor()->GetPoint()->GetNode().FindTableNode();
483 return pTableNd && pTableNd->GetTable().IsDeleted();
484}
485
487{
488 const SfxItemSet* pArgs = rReq.GetArgs();
489 SwWrtShell &rSh = GetShell();
490
491 // At first the slots which doesn't need a FrameMgr.
492 bool bMore = false;
493 const SfxPoolItem* pItem = nullptr;
494 sal_uInt16 nSlot = rReq.GetSlot();
495 if(pArgs)
496 pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
497 bool bCallDone = false;
498 switch ( nSlot )
499 {
500 case SID_ATTR_BORDER:
501 {
502 if(!pArgs)
503 break;
504 // Create items, because we have to rework anyway.
505 std::shared_ptr<SvxBoxItem> aBox(std::make_shared<SvxBoxItem>(RES_BOX));
507 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>
508 aCoreSet( GetPool() );
509 SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER );
510 aCoreSet.Put(aCoreInfo);
511 rSh.GetTabBorders( aCoreSet );
512 const SvxBoxItem& rCoreBox = aCoreSet.Get(RES_BOX);
513 const SvxBoxItem *pBoxItem = pArgs->GetItemIfSet(RES_BOX);
514 if ( pBoxItem )
515 {
516 aBox.reset(pBoxItem->Clone());
517 sal_Int16 nDefValue = MIN_BORDER_DIST;
518 if ( !rReq.IsAPI() )
519 nDefValue = 55;
520 if (!rReq.IsAPI() || aBox->GetSmallestDistance() < MIN_BORDER_DIST)
521 {
523 aBox->SetDistance( std::max(rCoreBox.GetDistance(k), nDefValue) , k );
524 }
525 }
526 else
527 OSL_ENSURE( false, "where is BoxItem?" );
528
529 //since the drawing layer also supports borders the which id might be a different one
530 std::shared_ptr<SvxBoxInfoItem> aInfo(std::make_shared<SvxBoxInfoItem>(SID_ATTR_BORDER_INNER));
531 if (const SvxBoxInfoItem* pBoxInfoItem = pArgs->GetItemIfSet(SID_ATTR_BORDER_INNER))
532 {
533 aInfo.reset(pBoxInfoItem->Clone());
534 }
535 else if( const SvxBoxInfoItem* pBoxInfoInnerItem = pArgs->GetItemIfSet(SDRATTR_TABLE_BORDER_INNER))
536 {
537 aInfo.reset(pBoxInfoInnerItem->Clone());
538 aInfo->SetWhich(SID_ATTR_BORDER_INNER);
539 }
540
541 aInfo->SetTable( true );
542 aInfo->SetValid( SvxBoxInfoItemValidFlags::DISABLE, false );
543
544// The attributes of all lines will be read and the strongest wins.
545 const SvxBorderLine* pBorderLine;
546 SvxBorderLine aBorderLine;
547 if ((pBorderLine = rCoreBox.GetTop()) != nullptr)
548 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
549 if ((pBorderLine = rCoreBox.GetBottom()) != nullptr)
550 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
551 if ((pBorderLine = rCoreBox.GetLeft()) != nullptr)
552 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
553 if ((pBorderLine = rCoreBox.GetRight()) != nullptr)
554 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
555 if ((pBorderLine = aCoreInfo.GetHori()) != nullptr)
556 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
557 if ((pBorderLine = aCoreInfo.GetVert()) != nullptr)
558 lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
559
560 if(aBorderLine.GetOutWidth() == 0)
561 {
562 aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
563 aBorderLine.SetWidth( SvxBorderLineWidth::VeryThin );
564 }
565
566 if( aBox->GetTop() != nullptr )
567 {
568 aBox->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
569 }
570 if( aBox->GetBottom() != nullptr )
571 {
572 aBox->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
573 }
574 if( aBox->GetLeft() != nullptr )
575 {
576 aBox->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
577 }
578 if( aBox->GetRight() != nullptr )
579 {
580 aBox->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
581 }
582 if( aInfo->GetHori() != nullptr )
583 {
584 aInfo->SetLine(&aBorderLine, SvxBoxInfoItemLine::HORI);
585 }
586 if( aInfo->GetVert() != nullptr )
587 {
588 aInfo->SetLine(&aBorderLine, SvxBoxInfoItemLine::VERT);
589 }
590
591 aCoreSet.Put( *aBox );
592 aCoreSet.Put( *aInfo );
593 rSh.SetTabBorders( aCoreSet );
594
595 // we must record the "real" values because otherwise the lines can't be reconstructed on playtime
596 // the coding style of the controller (setting lines with width 0) is not transportable via Query/PutValue in
597 // the SvxBoxItem
598 rReq.AppendItem( *aBox );
599 rReq.AppendItem( *aInfo );
600 bCallDone = true;
601 break;
602 }
603 case FN_INSERT_TABLE:
604 InsertTable( rReq );
605 break;
607 {
608 //#127012# get the bindings before the dialog is called
609 // it might happen that this shell is removed after closing the dialog
610 SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
612
613 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &rSh.GetView()) != nullptr );
614 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
615 std::shared_ptr<SwTableRep> pTableRep(::lcl_TableParamToItemSet(aCoreSet, rSh));
616
617 aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
618 rSh.GetTableAttr(aCoreSet);
619 // GetTableAttr overwrites the background!
620 std::unique_ptr<SvxBrushItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
621 if(rSh.GetBoxBackground(aBrush))
622 aCoreSet.Put( *aBrush );
623 else
624 aCoreSet.InvalidateItem( RES_BACKGROUND );
625
627 VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTableTabDlg(GetView().GetFrameWeld(), &aCoreSet, &rSh));
628
629 if (pDlg)
630 {
631 if (pItem)
632 pDlg->SetCurPageId(OUStringToOString(static_cast<const SfxStringItem *>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8));
633
634 auto pRequest = std::make_shared<SfxRequest>(rReq);
635 rReq.Ignore(); // the 'old' request is not relevant any more
636
637 const bool bTableMode = rSh.IsTableMode();
638 SwPaM* pCursor = bTableMode ? rSh.GetTableCrs() : rSh.GetCursor(); // tdf#142165 use table cursor if in table mode
639 auto vCursors = CopyPaMRing(*pCursor); // tdf#135636 make a copy to use at later apply
640 pDlg->StartExecuteAsync([pDlg, pRequest, pTableRep, &rBindings, &rSh, vCursors, bTableMode](sal_Int32 nResult){
641 if (RET_OK == nResult)
642 {
643 if (!bTableMode && rSh.IsTableMode()) // tdf#140977 drop current table-cursor if setting a replacement
644 rSh.TableCursorToCursor(); // non-table one
645
646 // tdf#135636 set the selection at dialog launch as current selection
647 rSh.SetSelection(*vCursors->front()); // UpdateCursor() will be called which in the case
648 // of a table selection should recreate a
649 // SwShellTableCursor if the selection is more than a single cell
650
651 if (bTableMode && !rSh.IsTableMode()) // tdf#142721 ensure the new selection is a SwShellTableCursor in
652 rSh.SelTableBox(); // the case of a single cell
653
654 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
655
656 //to record FN_INSERT_TABLE correctly
657 pRequest->SetSlot(FN_FORMAT_TABLE_DLG);
658 pRequest->Done(*pOutSet);
659
660 ItemSetToTableParam(*pOutSet, rSh);
661 }
662
663 rBindings.Update(SID_RULER_BORDERS);
664 rBindings.Update(SID_ATTR_TABSTOP);
665 rBindings.Update(SID_RULER_BORDERS_VERTICAL);
666 rBindings.Update(SID_ATTR_TABSTOP_VERTICAL);
667
668 pDlg->disposeOnce();
669 });
670 }
671 else
672 {
673 if (rReq.GetArgs())
674 ItemSetToTableParam(*rReq.GetArgs(), rSh);
675
676 rBindings.Update(SID_RULER_BORDERS);
677 rBindings.Update(SID_ATTR_TABSTOP);
678 rBindings.Update(SID_RULER_BORDERS_VERTICAL);
679 rBindings.Update(SID_ATTR_TABSTOP_VERTICAL);
680 }
681
682 break;
683 }
684 case SID_ATTR_BRUSH:
685 case SID_ATTR_BRUSH_ROW :
686 case SID_ATTR_BRUSH_TABLE :
687 if(rReq.GetArgs())
688 ItemSetToTableParam(*rReq.GetArgs(), rSh);
689 break;
691 {
692 SwView* pView = GetActiveView();
693 if(pView)
694 {
695 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
696 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
697 SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
698 auto pCoreSet = std::make_shared<SfxItemSetFixed<SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO>>( GetPool() );
699
702 aBoxSet( *pCoreSet->GetPool() );
703 rSh.GetTableBoxFormulaAttrs( aBoxSet );
704
705 SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT);
706 if(eState == SfxItemState::DEFAULT)
707 {
708 pCoreSet->Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
709 pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_SYSTEM)));
710 }
711 else
712 pCoreSet->Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
713 aBoxSet.Get(
714 RES_BOXATR_FORMAT ).GetValue() ));
715
716 OUString sCurText( rSh.GetTableBoxText() );
717 pCoreSet->Put( SvxNumberInfoItem( pFormatter,
718 aBoxSet.Get(
719 RES_BOXATR_VALUE).GetValue(),
720 sCurText, SID_ATTR_NUMBERFORMAT_INFO ));
721
722 SwWrtShell* pSh = &rSh;
725
726 pDlg->StartExecuteAsync([pDlg, pCoreSet, pSh](sal_uInt32 nResult){
727 if (RET_OK == nResult)
728 {
729 const SvxNumberInfoItem* pNumberFormatItem
730 = pSh->GetView().GetDocShell()->GetItem( SID_ATTR_NUMBERFORMAT_INFO );
731
732 if( pNumberFormatItem )
733 {
734 for ( sal_uInt32 key : pNumberFormatItem->GetDelFormats() )
735 pNumberFormatItem->GetNumberFormatter()->DeleteEntry( key );
736 }
737
738 const SfxPoolItem* pNumberFormatValueItem =
739 pDlg->GetOutputItemSet()->GetItemIfSet(
740 SID_ATTR_NUMBERFORMAT_VALUE, false);
741 if( pNumberFormatValueItem )
742 {
744 aBoxFormatSet( *pCoreSet->GetPool() );
745 aBoxFormatSet.Put( SwTableBoxNumFormat(
746 static_cast<const SfxUInt32Item*>(pNumberFormatValueItem)->GetValue() ));
747 pSh->SetTableBoxFormulaAttrs( aBoxFormatSet );
748
749 }
750 }
751
752 pDlg->disposeOnce();
753 });
754 }
755 break;
756 }
757 case FN_CALC_TABLE:
758 rSh.UpdateTable();
759 bCallDone = true;
760 break;
762 if ( rSh.DeleteCol() && rSh.HasSelection() )
763 rSh.EnterStdMode();
764 bCallDone = true;
765 break;
766 case FN_END_TABLE:
768 bCallDone = true;
769 break;
770 case FN_START_TABLE:
772 bCallDone = true;
773 break;
775 {
776 bool bAppendLine = true;
777 if( pItem )
778 bAppendLine = static_cast<const SfxBoolItem*>(pItem)->GetValue();
779 rReq.SetReturnValue( SfxBoolItem( nSlot,
780 rSh.GoNextCell( bAppendLine ) ) );
781 bCallDone = true;
782 break;
783 }
785 rReq.SetReturnValue( SfxBoolItem( nSlot, rSh.GoPrevCell() ) );
786 bCallDone = true;
787 break;
789 if ( rSh.DeleteRow() && rSh.HasSelection() )
790 rSh.EnterStdMode();
791 bCallDone = true;
792 break;
794 if ( rSh.IsTableMode() )
795 switch ( rSh.MergeTab() )
796 {
798 bCallDone = true;
799 [[fallthrough]];
801 break;
803 {
804 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetView().GetFrameWeld(),
805 VclMessageType::Info, VclButtonsType::Ok,
806 SwResId(STR_ERR_TABLE_MERGE)));
807 xInfoBox->run();
808 break;
809 }
810 default:
811 OSL_ENSURE( false, "unknown return value MergeTab.");
812 break;
813 }
814 break;
815 case SID_TABLE_MINIMAL_COLUMN_WIDTH:
818 {
819 bool bBalance = (FN_TABLE_BALANCE_CELLS == nSlot);
820 const bool bNoShrink = FN_TABLE_ADJUST_CELLS == nSlot;
821 if ( rSh.IsAdjustCellWidthAllowed(bBalance) )
822 {
823 {
824 // remove actions to make a valid table selection
825 UnoActionRemoveContext aRemoveContext(rSh.GetDoc());
826 }
827 rSh.AdjustCellWidth(bBalance, bNoShrink);
828 }
829 bCallDone = true;
830 break;
831 }
832 case SID_TABLE_MINIMAL_ROW_HEIGHT:
833 {
834 const SwFormatFrameSize aSz;
835 rSh.SetRowHeight( aSz );
836 bCallDone = true;
837 break;
838 }
840 {
841 rSh.BalanceRowHeight(/*bTstOnly=*/false, /*bOptimize=*/true);
842 rSh.BalanceRowHeight(/*bTstOnly=*/false, /*bOptimize=*/false);
843 bCallDone = true;
844 break;
845 }
847 if ( rSh.BalanceRowHeight(true) )
848 rSh.BalanceRowHeight(false);
849 bCallDone = true;
850 break;
852 rSh.EnterStdMode();
854 rSh.SttSelect();
856 rSh.EndSelect();
857 bCallDone = true;
858 break;
860 rSh.EnterStdMode();
861 rSh.SelectTableCol();
862 bCallDone = true;
863 break;
865 rSh.EnterStdMode();
866 rSh.SelectTableRow();
867 bCallDone = true;
868 break;
870 rSh.ProtectCells();
871 rSh.ResetSelect( nullptr, false );
872 bCallDone = true;
873 break;
875 rSh.UnProtectCells();
876 bCallDone = true;
877 break;
878 case SID_AUTOFORMAT:
879 {
882 pDlg->Execute();
883 break;
884 }
886 {
889 pDlg->Execute();
890 break;
891 }
893 case FN_NUM_BULLET_ON:
894 OSL_ENSURE( false, "function may not be called now." );
895 break;
896
897
898 // 2015/06 The following two are deprecated but kept for ascending
899 // compatibility
902 // fallback
907 {
908 bool bColumn = rReq.GetSlot() == FN_TABLE_INSERT_COL_BEFORE
910 || rReq.GetSlot() == FN_TABLE_INSERT_COL;
911 sal_uInt16 nCount = 0;
912 bool bAfter = true;
913 if (pItem)
914 {
915 nCount = static_cast<const SfxInt16Item* >(pItem)->GetValue();
916 if(const SfxBoolItem* pAfterItem = pArgs->GetItemIfSet(FN_PARAM_INSERT_AFTER))
917 bAfter = pAfterItem->GetValue();
918 }
919 else if( !rReq.IsAPI() )
920 {
921 SwSelBoxes aBoxes;
922 ::GetTableSel( rSh, aBoxes );
923 if ( !aBoxes.empty() )
924 {
925 tools::Long maxX = 0;
926 tools::Long maxY = 0;
927 tools::Long minX = std::numeric_limits<tools::Long>::max();
928 tools::Long minY = std::numeric_limits<tools::Long>::max();
929 tools::Long nbBoxes = aBoxes.size();
930 for ( tools::Long i = 0; i < nbBoxes; i++ )
931 {
932 Point aCoord ( aBoxes[i]->GetCoordinates() );
933 if ( aCoord.X() < minX ) minX = aCoord.X();
934 if ( aCoord.X() > maxX ) maxX = aCoord.X();
935 if ( aCoord.Y() < minY ) minY = aCoord.Y();
936 if ( aCoord.Y() > maxY ) maxY = aCoord.Y();
937 }
938 if (bColumn)
939 nCount = maxX - minX + 1;
940 else
941 nCount = maxY - minY + 1;
942 }
943 bAfter = rReq.GetSlot() == FN_TABLE_INSERT_COL_AFTER
945 || rReq.GetSlot() == FN_TABLE_INSERT_ROW
946 || rReq.GetSlot() == FN_TABLE_INSERT_COL;
947 }
948
949 if( nCount )
950 {
951 // i74180: Table border patch submitted by chensuchun:
952 // -->get the SvxBoxInfoItem of the table before insert
954 ::lcl_TableParamToItemSet( aCoreSet, rSh );
955 bool bSetInnerBorders = false;
956 SwUndoId nUndoId = SwUndoId::EMPTY;
957 // <--End
958
959 if( bColumn )
960 {
962 rSh.InsertCol( nCount, bAfter );
963 bSetInnerBorders = true;
964 nUndoId = SwUndoId::TABLE_INSCOL;
965 }
966 else if ( !rSh.IsInRepeatedHeadline() )
967 {
969 rSh.InsertRow( nCount, bAfter );
970 bSetInnerBorders = true;
971 nUndoId = SwUndoId::TABLE_INSROW;
972 }
973
974 // -->after inserting,reset the inner table borders
975 if ( bSetInnerBorders )
976 {
977 const SvxBoxInfoItem& aBoxInfo(aCoreSet.Get(SID_ATTR_BORDER_INNER));
979 aSet.Put( aBoxInfo );
980 ItemSetToTableParam( aSet, rSh );
981 rSh.EndUndo( nUndoId );
982 }
983
984 bCallDone = true;
985 break;
986 }
987
989
990 [[fallthrough]]; // on Count = 0 appears the dialog
991 }
994 {
995 const SfxSlot* pSlot = GetStaticInterface()->GetSlot(nSlot);
996 if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline())
997 {
1000 nSlot == FN_TABLE_INSERT_COL_DLG, pSlot->GetCommand()));
1001 if( pDlg->Execute() == 1 )
1002 {
1003 const sal_uInt16 nDispatchSlot = (nSlot == FN_TABLE_INSERT_COL_DLG)
1005 SfxUInt16Item aCountItem( nDispatchSlot, pDlg->getInsertCount() );
1006 SfxBoolItem aAfter( FN_PARAM_INSERT_AFTER, !pDlg->isInsertBefore() );
1007 SfxViewFrame* pVFrame = GetView().GetViewFrame();
1008 if( pVFrame )
1009 pVFrame->GetDispatcher()->ExecuteList(nDispatchSlot,
1010 SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
1011 { &aCountItem, &aAfter });
1012 }
1013 }
1014 break;
1015 }
1017 {
1019 bool bHorizontal=true;
1020 bool bProportional = false;
1022 const SfxBoolItem* pHor = rReq.GetArg<SfxBoolItem>(FN_PARAM_1);
1023 const SfxBoolItem* pProp = rReq.GetArg<SfxBoolItem>(FN_PARAM_2);
1024 if ( pSplit )
1025 {
1026 nCount = pSplit->GetValue();
1027 if ( pHor )
1028 bHorizontal = pHor->GetValue();
1029 if ( pProp )
1030 bProportional = pProp->GetValue();
1031 }
1032 else
1033 {
1035 SwWrtShell* pSh = &rSh;
1036 const tools::Long nMaxVert = rSh.GetAnyCurRect( CurRectType::Frame ).Width() / MINLAY;
1038 if(rSh.IsSplitVerticalByDefault())
1039 pDlg->SetSplitVerticalByDefault();
1040 pDlg->StartExecuteAsync([pDlg, pSh](int nResult) {
1041 if (nResult == RET_OK)
1042 {
1043 tools::Long nCount2 = pDlg->GetCount();
1044 bool bHorizontal2 = pDlg->IsHorizontal();
1045 bool bProportional2 = pDlg->IsProportional();
1046
1047 // tdf#60242: remember choice for next time
1048 bool bVerticalWasChecked = !pDlg->IsHorizontal();
1049 pSh->SetSplitVerticalByDefault(bVerticalWasChecked);
1050
1051 if ( nCount2 > 1 )
1052 pSh->SplitTab(!bHorizontal2, static_cast< sal_uInt16 >( nCount2-1 ), bProportional2 );
1053 }
1054
1055 pDlg->disposeOnce();
1056 });
1057 }
1058
1059 if ( nCount>1 )
1060 {
1061 rSh.SplitTab(!bHorizontal, static_cast< sal_uInt16 >( nCount-1 ), bProportional );
1062 bCallDone = true;
1063 }
1064 else
1065 rReq.Ignore();
1066 break;
1067 }
1068
1070 {
1071 const SfxUInt16Item* pType = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
1072 if( pType )
1073 {
1074 switch( static_cast<SplitTable_HeadlineOption>(pType->GetValue()) )
1075 {
1081 rSh.SplitTable(static_cast<SplitTable_HeadlineOption>(pType->GetValue())) ;
1082 break;
1083 default: ;//wrong parameter, do nothing
1084 }
1085 }
1086 else
1087 {
1090
1091 SwWrtShell* pSh = &rSh;
1092
1093 pDlg->StartExecuteAsync([pDlg, pSh](int nResult) {
1094 if (nResult == RET_OK)
1095 {
1096 const auto aSplitMode = pDlg->GetSplitMode();
1097 pSh->SplitTable( aSplitMode );
1098 }
1099
1100 pDlg->disposeOnce();
1101 });
1102 rReq.Ignore(); // We're already handling the request in our async bit
1103 }
1104 break;
1105 }
1106
1108 {
1109 bool bPrev = rSh.CanMergeTable();
1110 bool bNext = rSh.CanMergeTable( false );
1111
1112 if( bPrev && bNext )
1113 {
1116 if( RET_OK != pDlg->Execute())
1117 bPrev = bNext = false;
1118 }
1119
1120 if( bPrev || bNext )
1121 rSh.MergeTable( bPrev );
1122 break;
1123 }
1124
1125 case FN_TABLE_MODE_FIX :
1128 {
1131 : FN_TABLE_MODE_FIX_PROP == nSlot
1134
1136 static sal_uInt16 aInva[] =
1140 0
1141 };
1142 rBind.Invalidate( aInva );
1143 bCallDone = true;
1144 break;
1145 }
1146 case FN_TABLE_AUTOSUM:
1147 {
1148 SfxViewFrame* pVFrame = GetView().GetViewFrame();
1149 pVFrame->GetDispatcher()->Execute(FN_EDIT_FORMULA, SfxCallMode::SYNCHRON);
1150 const sal_uInt16 nId = SwInputChild::GetChildWindowId();
1151 SwInputChild* pChildWin = static_cast<SwInputChild*>(pVFrame->
1152 GetChildWindow( nId ));
1153 OUString sSum;
1154 GetShell().GetAutoSum(sSum);
1155 if( pChildWin )
1156 pChildWin->SetFormula( sSum );
1157
1158 break;
1159 }
1161 if(0 != rSh.GetRowsToRepeat())
1162 rSh.SetRowsToRepeat( 0 );
1163 else
1165 break;
1167 rSh.SelectTableCell();
1168 break;
1170 {
1171 rSh.StartAction();
1172 rSh.StartUndo();
1174 rSh.DeleteTable();
1175 rSh.EndUndo();
1176 rSh.EndAction();
1177 //'this' is already destroyed
1178 return;
1179 }
1181 {
1183 if (pItem2)
1184 {
1185 tools::Long nNewHeight = pItem2->GetValue();
1186 std::unique_ptr<SwFormatFrameSize> pHeight = rSh.GetRowHeight();
1187 if ( pHeight )
1188 {
1189 if (pHeight->GetHeightSizeType() == SwFrameSize::Variable)
1190 pHeight->SetHeightSizeType(SwFrameSize::Minimum);
1191 pHeight->SetHeight(nNewHeight);
1192 rSh.SetRowHeight(*pHeight);
1193 }
1194 }
1195 return;
1196 }
1198 {
1200 if (pItem2)
1201 {
1202 tools::Long nNewWidth = pItem2->GetValue();
1203 SwTableFUNC aFunc( &rSh );
1204 aFunc.InitTabCols();
1205 aFunc.SetColWidth(aFunc.GetCurColNum(), nNewWidth);
1206 }
1207 return;
1208 }
1209 default:
1210 bMore = true;
1211 }
1212
1213 if ( !bMore )
1214 {
1215 if(bCallDone)
1216 rReq.Done();
1217 return;
1218 }
1219
1220 // Now the slots which are working directly on the TableFormat.
1221 switch ( nSlot )
1222 {
1223 case SID_ATTR_ULSPACE:
1224 if(pItem)
1225 {
1226 SvxULSpaceItem aULSpace( *static_cast<const SvxULSpaceItem*>(pItem) );
1227 aULSpace.SetWhich( RES_UL_SPACE );
1228 ::lcl_SetAttr( rSh, aULSpace );
1229 }
1230 break;
1231
1232 case SID_ATTR_LRSPACE:
1233 if(pItem)
1234 {
1237 SvxLRSpaceItem aLRSpace( *static_cast<const SvxLRSpaceItem*>(pItem) );
1238 aLRSpace.SetWhich( RES_LR_SPACE );
1239 aSet.Put( aLRSpace );
1240 rSh.SetTableAttr( aSet );
1241 }
1242 break;
1243 // The last case branch which needs a table manager!!
1245 {
1246 SwTableFUNC aMgr( &rSh );
1248 break;
1249 }
1250 case SID_TABLE_VERT_NONE:
1251 case SID_TABLE_VERT_CENTER:
1252 case SID_TABLE_VERT_BOTTOM:
1253 {
1254 const sal_uInt16 nAlign = nSlot == SID_TABLE_VERT_NONE ?
1256 nSlot == SID_TABLE_VERT_CENTER ?
1257 text::VertOrientation::CENTER : text::VertOrientation::BOTTOM;
1258 rSh.SetBoxAlign(nAlign);
1259 bCallDone = true;
1260 break;
1261 }
1262
1263 case SID_ATTR_PARA_SPLIT:
1264 if ( pItem )
1265 {
1266 SwFormatLayoutSplit aSplit( static_cast<const SvxFormatSplitItem*>(pItem)->GetValue());
1268 aSet.Put(aSplit);
1269 rSh.SetTableAttr(aSet);
1270 }
1271 break;
1272
1273 case SID_ATTR_PARA_KEEP:
1274 if ( pItem )
1275 {
1276 SvxFormatKeepItem aKeep( *static_cast<const SvxFormatKeepItem*>(pItem) );
1277 aKeep.SetWhich( RES_KEEP );
1279 aSet.Put(aKeep);
1280 rSh.SetTableAttr(aSet);
1281 }
1282 break;
1283 case FN_TABLE_ROW_SPLIT :
1284 {
1285 const SfxBoolItem* pBool = static_cast<const SfxBoolItem*>(pItem);
1286 std::unique_ptr<SwFormatRowSplit> pSplit;
1287 if(!pBool)
1288 {
1289 pSplit = rSh.GetRowSplit();
1290 if(pSplit)
1291 pSplit->SetValue(!pSplit->GetValue());
1292 else
1293 pSplit.reset(new SwFormatRowSplit(true));
1294 }
1295 else
1296 {
1297 pSplit.reset(new SwFormatRowSplit(pBool->GetValue()));
1298 }
1299 rSh.SetRowSplit( *pSplit );
1300 break;
1301 }
1302
1303 default:
1304 OSL_ENSURE( false, "wrong Dispatcher" );
1305 return;
1306 }
1307 if(bCallDone)
1308 rReq.Done();
1309}
1310
1312{
1313 SfxWhichIter aIter( rSet );
1314 SwWrtShell &rSh = GetShell();
1315 SwFrameFormat *pFormat = rSh.GetTableFormat();
1316 // os #124829# crash report: in case of an invalid shell selection return immediately
1317 if(!pFormat)
1318 return;
1319 sal_uInt16 nSlot = aIter.FirstWhich();
1320 while ( nSlot )
1321 {
1322 switch ( nSlot )
1323 {
1325 if ( !rSh.IsTableMode() )
1327 break;
1328 case SID_TABLE_MINIMAL_COLUMN_WIDTH:
1330 if ( !rSh.IsAdjustCellWidthAllowed() )
1331 rSet.DisableItem(nSlot);
1332 break;
1333
1335 if ( !rSh.IsAdjustCellWidthAllowed(true) )
1337 break;
1338
1341 if ( !rSh.BalanceRowHeight(true) )
1342 rSet.DisableItem(nSlot);
1343 break;
1344 case FN_OPTIMIZE_TABLE:
1345 if ( !rSh.IsTableMode() &&
1346 !rSh.IsAdjustCellWidthAllowed() &&
1347 !rSh.IsAdjustCellWidthAllowed(true) &&
1348 !rSh.BalanceRowHeight(true) )
1350 break;
1351 case SID_INSERT_DIAGRAM:
1352 {
1353 SvtModuleOptions aMOpt;
1354 if ( !aMOpt.IsMath() || rSh.IsTableComplexForChart() )
1355 rSet.DisableItem(nSlot);
1356 }
1357 break;
1358
1359 case FN_INSERT_TABLE:
1360 if ( rSh.CursorInsideInputField() )
1361 {
1362 rSet.DisableItem( nSlot );
1363 }
1364 break;
1365
1366 case SID_TABLE_MINIMAL_ROW_HEIGHT:
1367 {
1368 // Disable if auto height already is enabled.
1369 std::unique_ptr<SwFormatFrameSize> pSz = rSh.GetRowHeight();
1370 if ( pSz )
1371 {
1372 if ( SwFrameSize::Variable == pSz->GetHeightSizeType() )
1373 rSet.DisableItem( nSlot );
1374 }
1375 break;
1376 }
1379 {
1380 SfxImageItem aImageItem(nSlot);
1381 if (pFormat->GetFrameDir().GetValue() == SvxFrameDirection::Environment)
1382 {
1383 // Inherited from superordinate object (page or frame).
1384 // If the table spans multiple pages, direction is set by the first page.
1386 for (SwTabFrame* pFrame = aIterT.First(); pFrame;
1387 pFrame = static_cast<SwTabFrame*>(pFrame->GetPrecede()))
1388 aImageItem.SetMirrored(pFrame->IsRightToLeft());
1389 }
1390 else
1391 aImageItem.SetMirrored(pFormat->GetFrameDir().GetValue() == SvxFrameDirection::Horizontal_RL_TB);
1392 rSet.Put(aImageItem);
1393 break;
1394 }
1398 if ( rSh.IsInRepeatedHeadline() )
1399 rSet.DisableItem( nSlot );
1400 break;
1401 case RES_LR_SPACE:
1402 rSet.Put(pFormat->GetLRSpace());
1403 break;
1404 case RES_UL_SPACE:
1405 rSet.Put(pFormat->GetULSpace());
1406 break;
1407
1408 case SID_TABLE_VERT_NONE:
1409 case SID_TABLE_VERT_CENTER:
1410 case SID_TABLE_VERT_BOTTOM:
1411 {
1412 const sal_uInt16 nAlign = rSh.GetBoxAlign();
1413 bool bSet = (nSlot == SID_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) ||
1414 (nSlot == SID_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) ||
1415 (nSlot == SID_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM);
1416 rSet.Put(SfxBoolItem(nSlot, bSet));
1417 break;
1418 }
1419
1420 case FN_TABLE_MODE_FIX :
1423 {
1424 TableChgMode nMode = rSh.GetTableChgMode();
1425 bool bSet = (nSlot == FN_TABLE_MODE_FIX && nMode == TableChgMode::FixedWidthChangeAbs) ||
1428 rSet.Put(SfxBoolItem(nSlot, bSet));
1429 }
1430 break;
1431
1432 case SID_ATTR_PARA_SPLIT:
1433 rSet.Put( pFormat->GetKeep() );
1434 break;
1435
1436 case SID_ATTR_PARA_KEEP:
1437 rSet.Put( pFormat->GetLayoutSplit() );
1438 break;
1440 if ( rSh.IsInHeadline() )
1441 rSet.DisableItem( nSlot );
1442 break;
1444 {
1445 bool bAsk;
1446 if( !rSh.CanMergeTable( true, &bAsk ))
1447 rSet.DisableItem( nSlot );
1448 break;
1449 }
1450
1452 {
1453 SwSelBoxes aBoxes;
1454 ::GetTableSel( rSh, aBoxes, SwTableSearchType::Row );
1455 if( ::HasProtectedCells( aBoxes ) || lcl_BoxesInDeletedRows( rSh, aBoxes ) )
1456 rSet.DisableItem( nSlot );
1457 }
1458 break;
1460 {
1461 SwSelBoxes aBoxes;
1462 ::GetTableSel( rSh, aBoxes, SwTableSearchType::Col );
1463 if( ::HasProtectedCells( aBoxes ) || lcl_CursorInDeletedTable( rSh ) )
1464 rSet.DisableItem( nSlot );
1465 }
1466 break;
1468 if( lcl_CursorInDeletedTable( rSh ) )
1469 rSet.DisableItem( nSlot );
1470 break;
1471
1473 // disable in readonly sections, but enable in protected cells
1474 if( !rSh.CanUnProtectCells() )
1475 rSet.DisableItem( nSlot );
1476 break;
1477 case RES_ROW_SPLIT:
1478 {
1479 const SwFormatLayoutSplit& rTabSplit = pFormat->GetLayoutSplit();
1480 if ( !rTabSplit.GetValue() )
1481 {
1482 rSet.DisableItem( nSlot );
1483 }
1484 else
1485 {
1486 std::unique_ptr<SwFormatRowSplit> pSplit = rSh.GetRowSplit();
1487 if(pSplit)
1488 rSet.Put(std::move(pSplit));
1489 else
1490 rSet.InvalidateItem( nSlot );
1491 }
1492 break;
1493 }
1495 if(0 != rSh.GetRowsToRepeat())
1496 rSet.Put(SfxBoolItem(nSlot, true));
1497 else if(!rSh.GetRowSelectionFromTop())
1498 rSet.DisableItem( nSlot );
1499 else
1500 rSet.Put(SfxBoolItem(nSlot, false));
1501 break;
1503 if(rSh.HasBoxSelection())
1504 rSet.DisableItem( nSlot );
1505 break;
1507 {
1509 std::unique_ptr<SwFormatFrameSize> pHeight = rSh.GetRowHeight();
1510 if (pHeight)
1511 {
1512 tools::Long nHeight = pHeight->GetHeight();
1513 aRowHeight.SetValue(nHeight);
1514 rSet.Put(aRowHeight);
1515
1517 {
1518 // TODO: set correct unit
1519 MapUnit eTargetUnit = MapUnit::MapInch;
1520 OUString sHeight = GetMetricText(nHeight,
1521 MapUnit::MapTwip, eTargetUnit, nullptr);
1522
1523 OUString sPayload = ".uno:TableRowHeight=" + sHeight;
1524
1525 GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
1526 OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
1527 }
1528 }
1529 break;
1530 }
1532 {
1534 SwTableFUNC aFunc( &rSh );
1535 aFunc.InitTabCols();
1536 SwTwips nWidth = aFunc.GetColWidth(aFunc.GetCurColNum());
1537 aColumnWidth.SetValue(nWidth);
1538 rSet.Put(aColumnWidth);
1539
1541 {
1542 // TODO: set correct unit
1543 MapUnit eTargetUnit = MapUnit::MapInch;
1544 OUString sWidth = GetMetricText(nWidth,
1545 MapUnit::MapTwip, eTargetUnit, nullptr);
1546
1547 OUString sPayload = ".uno:TableColumWidth=" + sWidth;
1548
1549 GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
1550 OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
1551 }
1552
1553 break;
1554 }
1555 }
1556 nSlot = aIter.NextWhich();
1557 }
1558}
1559
1561 SwBaseShell(_rView)
1562{
1563 SetName("Table");
1565}
1566
1568{
1570 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aCoreSet( GetPool() );
1571 SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1572 aCoreSet.Put( aBoxInfo );
1573 GetShell().GetTabBorders( aCoreSet );
1574 rSet.Put( aCoreSet );
1575}
1576
1578{
1579 SwWrtShell &rSh = GetShell();
1580 const SfxItemSet *pArgs = rReq.GetArgs();
1581 if(!pArgs)
1582 return;
1583
1584 switch ( rReq.GetSlot() )
1585 {
1586 case SID_FRAME_LINESTYLE:
1587 case SID_FRAME_LINECOLOR:
1588 if ( rReq.GetSlot() == SID_FRAME_LINESTYLE )
1589 {
1590 const SvxLineItem &rLineItem = pArgs->Get( SID_FRAME_LINESTYLE );
1591 const SvxBorderLine* pBorderLine = rLineItem.GetLine();
1592 rSh.SetTabLineStyle( nullptr, true, pBorderLine);
1593 }
1594 else
1595 {
1596 const SvxColorItem &rNewColorItem = pArgs->Get( SID_FRAME_LINECOLOR );
1597 rSh.SetTabLineStyle( &rNewColorItem.GetValue() );
1598 }
1599
1600 rReq.Done();
1601
1602 break;
1603 }
1604}
1605
1607{
1609 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aCoreSet( GetPool() );
1610 SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER );
1611 aCoreSet.Put(aCoreInfo);
1612 GetShell().GetTabBorders( aCoreSet );
1613
1614 const SvxBoxItem& rBoxItem = aCoreSet.Get( RES_BOX );
1615 const SvxBorderLine* pLine = rBoxItem.GetTop();
1616
1617 rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) );
1618 SvxLineItem aLine( SID_FRAME_LINESTYLE );
1619 aLine.SetLine(pLine);
1620 rSet.Put( aLine );
1621}
1622
1624{
1625 const SfxItemSet* pArgs = rReq.GetArgs();
1626 SwWrtShell &rSh = GetShell();
1627
1628 // At first the slots, which doesn't need a FrameMgr.
1629 const SfxPoolItem* pItem = nullptr;
1630 const sal_uInt16 nSlot = rReq.GetSlot();
1631 if(pArgs)
1632 pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
1633
1634 // Always acquire the language from the current cursor position.
1635 LanguageType eLang = rSh.GetCurLang();
1636 SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
1637 sal_uInt32 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
1638 SvNumFormatType nFormatType = SvNumFormatType::ALL;
1639 sal_uInt16 nOffset = 0;
1640
1641 switch ( nSlot )
1642 {
1643 case FN_NUMBER_FORMAT:
1644 if( pItem )
1645 {
1646 // Determine index for string.
1647 OUString aCode( static_cast<const SfxStringItem*>(pItem)->GetValue() );
1648 nNumberFormat = pFormatter->GetEntryKey( aCode, eLang );
1649 if( NUMBERFORMAT_ENTRY_NOT_FOUND == nNumberFormat )
1650 {
1651 // Re-enter
1652 sal_Int32 nErrPos;
1654 if( !pFormatter->PutEntry( aCode, nErrPos, nType,
1655 nNumberFormat, eLang ))
1656 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
1657 }
1658 }
1659 break;
1660 case FN_NUMBER_STANDARD: nFormatType = SvNumFormatType::NUMBER; break;
1661 case FN_NUMBER_SCIENTIFIC: nFormatType = SvNumFormatType::SCIENTIFIC; break;
1662 case FN_NUMBER_DATE: nFormatType = SvNumFormatType::DATE; break;
1663 case FN_NUMBER_TIME: nFormatType = SvNumFormatType::TIME; break;
1664 case FN_NUMBER_CURRENCY: nFormatType = SvNumFormatType::CURRENCY; break;
1665 case FN_NUMBER_PERCENT: nFormatType = SvNumFormatType::PERCENT; break;
1666
1667 case FN_NUMBER_TWODEC: // #.##0,00
1668 nFormatType = SvNumFormatType::NUMBER;
1669 nOffset = NF_NUMBER_1000DEC2;
1670 break;
1671
1672 default:
1673 OSL_FAIL("wrong dispatcher");
1674 return;
1675 }
1676
1677 if( nFormatType != SvNumFormatType::ALL )
1678 nNumberFormat = pFormatter->GetStandardFormat( nFormatType, eLang ) + nOffset;
1679
1680 if( NUMBERFORMAT_ENTRY_NOT_FOUND != nNumberFormat )
1681 {
1683 aBoxSet.Put( SwTableBoxNumFormat( nNumberFormat ));
1684 rSh.SetTableBoxFormulaAttrs( aBoxSet );
1685 }
1686
1687}
1688
1689/* 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, bool bMobile=false)
sal_Int32 GetValue() const
sal_uInt16 GetValue() const
void SetValue(sal_uInt32 nTheValue)
sal_uInt32 GetValue() 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 OString GetCommand() const
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
SfxViewFrame * GetViewFrame() const
virtual void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
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 OString &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:3182
SwWrtShell & GetShell()
Definition: basesh.cxx:2827
SwView & GetView()
Definition: basesh.hxx:59
void InsertTable(SfxRequest &_rRequest)
Definition: basesh.cxx:2889
bool IsTableComplexForChart()
Definition: trvltbl.cxx:723
const SwPaM * GetTableCrs() const
Definition: crsrsh.hxx:924
bool GoPrevCell()
Definition: trvltbl.cxx:101
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2251
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:2752
bool SelTableBox()
Definition: trvltbl.cxx:286
void SetSelection(const SwPaM &rCursor)
Definition: crsrsh.cxx:3529
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:896
bool CursorInsideInputField() const
Definition: crstrvl.cxx:963
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
bool ExtendedSelectedAll()
If ExtendedSelectAll() was called and selection didn't change since then.
Definition: crsrsh.cxx:607
void ClearMark()
Definition: crsrsh.cxx:939
bool StartsWithTable()
If document body starts with a table.
Definition: crsrsh.cxx:626
bool IsTableMode() const
Definition: crsrsh.hxx:659
bool GoNextCell(bool bAppendLine=true)
set cursor into next/previous cell
Definition: trvltbl.cxx:39
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:471
bool MergeTable(bool bWithPrev)
Definition: edtab.cxx:453
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:301
void SetTableChgMode(TableChgMode eMode)
Definition: edtab.cxx:286
void SplitTable(SplitTable_HeadlineOption eMode)
Split table at cursor position.
Definition: edtab.cxx:437
void SetTableBoxFormulaAttrs(const SfxItemSet &rSet)
Definition: edtab.cxx:342
TableChgMode GetTableChgMode() const
Definition: edtab.cxx:275
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:415
void EndAllAction()
Definition: edws.cxx:97
LanguageType GetCurLang() const
Definition: edattr.cxx:801
void GetTableAttr(SfxItemSet &) const
Definition: fetab.cxx:2234
bool DeleteCol()
Definition: fetab.cxx:264
void SetTabCols(const SwTabCols &rNew, bool bCurRowOnly)
Definition: fetab.cxx:732
void GetAutoSum(OUString &rFormula) const
Definition: fetab.cxx:2319
void InsertCol(sal_uInt16 nCnt, bool bBehind)
Definition: fetab.cxx:211
bool BalanceRowHeight(bool bTstOnly, const bool bOptimize=false)
Definition: fetab.cxx:846
bool GetRowBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:865
sal_uInt16 GetRowsToRepeat() const
Definition: fetab.cxx:1106
bool IsInRepeatedHeadline() const
Definition: fesh.hxx:722
bool HasBoxSelection() const
Is content of a table cell or at least a table cell completely selected?
Definition: fetab.cxx:976
void SetBoxAlign(sal_uInt16 nOrient)
Definition: fetab.cxx:925
void SetBoxBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:893
void SetRowSplit(const SwFormatRowSplit &rSz)
Definition: fetab.cxx:820
void GetTabCols(SwTabCols &rToFill) const
Info about columns and margins.
Definition: fetab.cxx:750
void SetRowBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:857
void DeleteTable()
Definition: fetab.cxx:317
void SetRowHeight(const SwFormatFrameSize &rSz)
Definition: fetab.cxx:833
bool IsInHeadline() const
Definition: fesh.hxx:723
bool IsTableVertical() const
Definition: fetab.cxx:2432
bool GetBoxBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:901
sal_uInt16 GetRowSelectionFromTop() const
Definition: fetab.cxx:1168
void InsertRow(sal_uInt16 nCnt, bool bBehind)
Definition: fetab.cxx:173
bool IsAdjustCellWidthAllowed(bool bBalance=false) const
Not allowed if only empty cells are selected.
Definition: fetab.cxx:1238
std::unique_ptr< SwFormatRowSplit > GetRowSplit() const
Definition: fetab.cxx:828
void SetRowsToRepeat(sal_uInt16 nNumOfRows)
Definition: fetab.cxx:1115
void SetTabBorders(const SfxItemSet &rSet)
Definition: fetab.cxx:870
bool CanUnProtectCells() const
Definition: fetab.cxx:1079
void UnProtectCells()
Refers to table selection.
Definition: fetab.cxx:1037
void SetTabBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:938
void SetTabLineStyle(const Color *pColor, bool bSetLine=false, const editeng::SvxBorderLine *pBorderLine=nullptr)
Definition: fetab.cxx:878
void SplitTab(bool bVert, sal_uInt16 nCnt, bool bSameHeight)
Split cell vertically or horizontally.
Definition: fetab.cxx:582
void AdjustCellWidth(const bool bBalance, const bool bNoShrink)
Definition: fetab.cxx:1224
bool DeleteRow(bool bCompleteTable=false)
Definition: fetab.cxx:322
void ProtectCells()
If a table selection exists it is destroyed in case cursor is not allowed in readonly.
Definition: fetab.cxx:1017
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:888
bool HasWholeTabSelection() const
Definition: fetab.cxx:958
std::unique_ptr< SwFormatFrameSize > GetRowHeight() const
Pointer must be destroyed by caller != 0.
Definition: fetab.cxx:841
sal_uInt16 GetBoxAlign() const
USHRT_MAX if ambiguous.
Definition: fetab.cxx:933
void GetTabBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
Definition: fetab.cxx:951
bool GetBoxDirection(std::unique_ptr< SvxFrameDirectionItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:917
void SetTableAttr(const SfxItemSet &)
Definition: fetab.cxx:2241
TableMergeErr MergeTab()
Merge selected parts of table.
Definition: fetab.cxx:550
void SetBoxDirection(const SvxFrameDirectionItem &rNew)
Definition: fetab.cxx:909
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
const SvxFrameDirectionItem & GetFrameDir(bool=true) const
Definition: frmatr.hxx:94
const SvxFormatKeepItem & GetKeep(bool=true) const
Definition: frmatr.hxx:86
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
const OUString & GetName() const
Definition: format.hxx:131
const SvxShadowItem & GetShadow(bool=true) const
Definition: frmatr.hxx:88
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:76
Style of a layout element.
Definition: frmfmt.hxx:62
void SetFormula(const OUString &rFormula)
Definition: inputwin.hxx:202
TElementType * First()
Definition: calbck.hxx:363
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:777
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:381
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
SwNode & GetPointNode() const
Definition: pam.hxx:283
const SwPosition * GetPoint() const
Definition: pam.hxx:261
void Width(tools::Long nNew)
Definition: swrect.hxx:189
vector_type::size_type size_type
Definition: docary.hxx:222
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
Definition: rootfrm.hxx:421
tools::Long GetRightMax() const
Definition: tabcol.hxx:80
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:47
SwTableLine * GetUpper()
Definition: swtable.hxx:460
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:364
bool IsDeleted(SwRedlineTable::size_type &rRedlinePos) const
Definition: swtable.cxx:1769
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:1567
void GetLineStyleState(SfxItemSet &rSet)
Definition: tabsh.cxx:1606
void ExecNumberFormat(SfxRequest const &rReq)
Definition: tabsh.cxx:1623
SwTableShell(SwView &rView)
Definition: tabsh.cxx:1560
void ExecTableStyle(SfxRequest &rReq)
Definition: tabsh.cxx:1577
void GetState(SfxItemSet &)
Definition: tabsh.cxx:1311
void Execute(SfxRequest &)
Definition: tabsh.cxx:486
bool IsDeleted() const
Definition: swtable.cxx:1598
void SetTableDest(sal_uInt8 nNew)
Definition: viewopt.hxx:681
sal_uInt8 GetTableDest() const
Definition: viewopt.hxx:656
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:433
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2160
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:624
Definition: view.hxx:146
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void SelectTableRow()
Definition: select.cxx:835
void SetSplitVerticalByDefault(bool value)
Definition: select.cxx:372
void EndSelect()
Definition: select.cxx:425
bool IsSplitVerticalByDefault() const
Definition: select.cxx:367
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1706
void EnterStdMode()
Definition: select.cxx:551
void SelectTableCol()
Definition: select.cxx:844
void SelectTableCell()
Definition: select.cxx:853
bool HasSelection() const
Definition: wrtsh.hxx:147
void SttSelect()
Definition: select.cxx:385
tools::Long ResetSelect(const Point *, bool)
Definition: select.cxx:333
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2030
const SwView & GetView() const
Definition: wrtsh.hxx:438
bool empty() const
size_type size() const
static const OUString & GetContextName(const Context eContext)
#define FN_GOTO_NEXT_CELL
Definition: cmdid.h:406
#define FN_CALC_TABLE
Definition: cmdid.h:85
#define SID_ATTR_TABLE_COLUMN_WIDTH
Definition: cmdid.h:445
#define FN_PARAM_TABLE_NAME
Definition: cmdid.h:799
#define FN_TABLE_MODE_FIX_PROP
Definition: cmdid.h:441
#define FN_TABLE_BALANCE_ROWS
Definition: cmdid.h:433
#define FN_TABLE_SET_READ_ONLY_CELLS
Definition: cmdid.h:378
#define FN_TABLE_MODE_VARIABLE
Definition: cmdid.h:442
#define FN_TABLE_INSERT_COL
Definition: cmdid.h:363
#define FN_TABLE_SELECT_COL
Definition: cmdid.h:375
#define FN_TABLE_ADJUST_CELLS
Definition: cmdid.h:381
#define FN_INSERT_TABLE
Definition: cmdid.h:228
#define FN_TABLE_BALANCE_CELLS
Definition: cmdid.h:432
#define FN_TABLE_INSERT_COL_DLG
Definition: cmdid.h:403
#define FN_TABLE_UNSET_READ_ONLY_CELLS
Definition: cmdid.h:379
#define FN_PARAM_TABLE_HEADLINE
Definition: cmdid.h:800
#define FN_GOTO_PREV_CELL
Definition: cmdid.h:407
#define FN_EDIT_FORMULA
Definition: cmdid.h:84
#define FN_TABLE_SET_COL_WIDTH
Definition: cmdid.h:369
#define FN_NUMBER_SCIENTIFIC
Definition: cmdid.h:462
#define FN_NUMBER_TIME
Definition: cmdid.h:464
#define FN_TABLE_AUTOSUM
Definition: cmdid.h:447
#define FN_TABLE_SPLIT_TABLE
Definition: cmdid.h:477
#define FN_NUMBER_DATE
Definition: cmdid.h:463
#define FN_TABLE_INSERT_ROW_BEFORE
Definition: cmdid.h:372
#define FN_TABLE_DELETE_ROW
Definition: cmdid.h:364
#define SID_ATTR_TABLE_ROW_HEIGHT
Definition: cmdid.h:444
#define FN_TABLE_INSERT_COL_BEFORE
Definition: cmdid.h:373
#define FN_NUMBER_TWODEC
Definition: cmdid.h:461
#define FN_TABLE_INSERT_ROW
Definition: cmdid.h:362
#define FN_TABLE_SET_ROW_HEIGHT
Definition: cmdid.h:368
#define FN_PARAM_INSERT_AFTER
Definition: cmdid.h:797
#define FN_TABLE_INSERT_ROW_DLG
Definition: cmdid.h:404
#define FN_TABLE_ROW_SPLIT
Definition: cmdid.h:490
#define FN_FORMAT_TABLE_DLG
Definition: cmdid.h:337
#define FN_TABLE_SELECT_ROW
Definition: cmdid.h:374
#define FN_NUMBER_BULLETS
Definition: cmdid.h:80
#define FN_OPTIMIZE_TABLE
Definition: cmdid.h:371
#define FN_NUM_FORMAT_TABLE_DLG
Definition: cmdid.h:328
#define FN_NUMBER_STANDARD
Definition: cmdid.h:460
#define FN_TABLE_REP
Definition: cmdid.h:360
#define FN_TABLE_HEADLINE_REPEAT
Definition: cmdid.h:380
#define FN_TABLE_BOX_TEXTORIENTATION
Definition: cmdid.h:443
#define FN_NUMBER_CURRENCY
Definition: cmdid.h:465
#define FN_TABLE_DELETE_COL
Definition: cmdid.h:365
#define FN_END_TABLE
Definition: cmdid.h:701
#define FN_TABLE_SELECT_ALL
Definition: cmdid.h:376
#define FN_TABLE_MERGE_TABLE
Definition: cmdid.h:489
#define FN_TABLE_MERGE_CELLS
Definition: cmdid.h:367
#define FN_TABLE_MODE_FIX
Definition: cmdid.h:440
#define FN_TABLE_SET_VERT_ALIGN
Definition: cmdid.h:439
#define FN_TABLE_INSERT_ROW_AFTER
Definition: cmdid.h:370
#define FN_NUMBER_FORMAT
Definition: cmdid.h:459
#define FN_NUMBER_PERCENT
Definition: cmdid.h:466
#define FN_TABLE_OPTIMAL_HEIGHT
Definition: cmdid.h:386
#define FN_TABLE_SPLIT_CELLS
Definition: cmdid.h:366
#define FN_START_TABLE
Definition: cmdid.h:700
#define FN_TABLE_SELECT_CELL
Definition: cmdid.h:388
#define FN_TABLE_DELETE_TABLE
Definition: cmdid.h:387
#define FN_TABLE_INSERT_COL_AFTER
Definition: cmdid.h:377
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(120)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr sal_uInt16 RES_FRMATR_END(133)
constexpr TypedWhichId< SfxBoolItem > RES_COLLAPSING_BORDERS(124)
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(152)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr TypedWhichId< SwFormatRowSplit > RES_ROW_SPLIT(122)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(110)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
constexpr TypedWhichId< SwFormatLayoutSplit > RES_LAYOUT_SPLIT(113)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
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:80
constexpr TypedWhichId< SvxBoxInfoItem > SDRATTR_TABLE_BORDER_INNER(SDRATTR_TABLE_FIRST+1)
SwView * GetActiveView()
Definition: swmodul1.cxx:116
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
#define SW_MOD()
Definition: swmodule.hxx:256
#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:476
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
static bool lcl_BoxesInDeletedRows(SwWrtShell &rSh, const SwSelBoxes &rBoxes)
Definition: tabsh.cxx:449
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 >)
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:755
SwTwips GetTableWidth(SwFrameFormat const *pFormat, SwTabCols const &rCols, sal_uInt16 *pPercent, SwWrtShell *pSh)
Definition: uitool.cxx:821
RET_OK
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:332
SvNumFormatType
NF_TEXT
NF_NUMBER_1000DEC2
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND