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_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 if (SwView* pView = GetActiveView())
693 {
694 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( pView) != nullptr );
695 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
696 SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
697 auto pCoreSet = std::make_shared<SfxItemSetFixed<SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO>>( GetPool() );
698
701 aBoxSet( *pCoreSet->GetPool() );
702 rSh.GetTableBoxFormulaAttrs( aBoxSet );
703
704 SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT);
705 if(eState == SfxItemState::DEFAULT)
706 {
707 pCoreSet->Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
708 pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_SYSTEM)));
709 }
710 else
711 pCoreSet->Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
712 aBoxSet.Get(
713 RES_BOXATR_FORMAT ).GetValue() ));
714
715 OUString sCurText( rSh.GetTableBoxText() );
716 pCoreSet->Put( SvxNumberInfoItem( pFormatter,
717 aBoxSet.Get(
718 RES_BOXATR_VALUE).GetValue(),
719 sCurText, SID_ATTR_NUMBERFORMAT_INFO ));
720
721 SwWrtShell* pSh = &rSh;
724
725 pDlg->StartExecuteAsync([pDlg, pCoreSet, pSh](sal_uInt32 nResult){
726 if (RET_OK == nResult)
727 {
728 const SvxNumberInfoItem* pNumberFormatItem
729 = pSh->GetView().GetDocShell()->GetItem( SID_ATTR_NUMBERFORMAT_INFO );
730
731 if( pNumberFormatItem )
732 {
733 for ( sal_uInt32 key : pNumberFormatItem->GetDelFormats() )
734 pNumberFormatItem->GetNumberFormatter()->DeleteEntry( key );
735 }
736
737 const SfxPoolItem* pNumberFormatValueItem =
738 pDlg->GetOutputItemSet()->GetItemIfSet(
739 SID_ATTR_NUMBERFORMAT_VALUE, false);
740 if( pNumberFormatValueItem )
741 {
743 aBoxFormatSet( *pCoreSet->GetPool() );
744 aBoxFormatSet.Put( SwTableBoxNumFormat(
745 static_cast<const SfxUInt32Item*>(pNumberFormatValueItem)->GetValue() ));
746 pSh->SetTableBoxFormulaAttrs( aBoxFormatSet );
747
748 }
749 }
750
751 pDlg->disposeOnce();
752 });
753 }
754 break;
755 }
756 case FN_CALC_TABLE:
757 rSh.UpdateTable();
758 bCallDone = true;
759 break;
761 if ( rSh.DeleteCol() && rSh.HasSelection() )
762 rSh.EnterStdMode();
763 bCallDone = true;
764 break;
765 case FN_END_TABLE:
767 bCallDone = true;
768 break;
769 case FN_START_TABLE:
771 bCallDone = true;
772 break;
774 {
775 bool bAppendLine = true;
776 if( pItem )
777 bAppendLine = static_cast<const SfxBoolItem*>(pItem)->GetValue();
778 rReq.SetReturnValue( SfxBoolItem( nSlot,
779 rSh.GoNextCell( bAppendLine ) ) );
780 bCallDone = true;
781 break;
782 }
784 rReq.SetReturnValue( SfxBoolItem( nSlot, rSh.GoPrevCell() ) );
785 bCallDone = true;
786 break;
788 if ( rSh.DeleteRow() && rSh.HasSelection() )
789 rSh.EnterStdMode();
790 bCallDone = true;
791 break;
793 if ( rSh.IsTableMode() )
794 switch ( rSh.MergeTab() )
795 {
797 bCallDone = true;
798 [[fallthrough]];
800 break;
802 {
803 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetView().GetFrameWeld(),
804 VclMessageType::Info, VclButtonsType::Ok,
805 SwResId(STR_ERR_TABLE_MERGE)));
806 xInfoBox->run();
807 break;
808 }
809 default:
810 OSL_ENSURE( false, "unknown return value MergeTab.");
811 break;
812 }
813 break;
814 case SID_TABLE_MINIMAL_COLUMN_WIDTH:
817 {
818 bool bBalance = (FN_TABLE_BALANCE_CELLS == nSlot);
819 const bool bNoShrink = FN_TABLE_ADJUST_CELLS == nSlot;
820 if ( rSh.IsAdjustCellWidthAllowed(bBalance) )
821 {
822 {
823 // remove actions to make a valid table selection
824 UnoActionRemoveContext aRemoveContext(rSh.GetDoc());
825 }
826 rSh.AdjustCellWidth(bBalance, bNoShrink);
827 }
828 bCallDone = true;
829 break;
830 }
831 case SID_TABLE_MINIMAL_ROW_HEIGHT:
832 {
833 const SwFormatFrameSize aSz;
834 rSh.SetRowHeight( aSz );
835 bCallDone = true;
836 break;
837 }
839 {
840 rSh.BalanceRowHeight(/*bTstOnly=*/false, /*bOptimize=*/true);
841 rSh.BalanceRowHeight(/*bTstOnly=*/false, /*bOptimize=*/false);
842 bCallDone = true;
843 break;
844 }
846 if ( rSh.BalanceRowHeight(true) )
847 rSh.BalanceRowHeight(false);
848 bCallDone = true;
849 break;
851 rSh.EnterStdMode();
853 rSh.SttSelect();
855 rSh.EndSelect();
856 bCallDone = true;
857 break;
859 rSh.EnterStdMode();
860 rSh.SelectTableCol();
861 bCallDone = true;
862 break;
864 rSh.EnterStdMode();
865 rSh.SelectTableRow();
866 bCallDone = true;
867 break;
869 rSh.ProtectCells();
870 rSh.ResetSelect( nullptr, false );
871 bCallDone = true;
872 break;
874 rSh.UnProtectCells();
875 bCallDone = true;
876 break;
877 case SID_AUTOFORMAT:
878 {
881 pDlg->Execute();
882 break;
883 }
885 {
888 pDlg->Execute();
889 break;
890 }
892 case FN_NUM_BULLET_ON:
893 OSL_ENSURE( false, "function may not be called now." );
894 break;
895
896
897 // 2015/06 The following two are deprecated but kept for ascending
898 // compatibility
901 // fallback
906 {
907 bool bColumn = rReq.GetSlot() == FN_TABLE_INSERT_COL_BEFORE
909 || rReq.GetSlot() == FN_TABLE_INSERT_COL;
910 sal_uInt16 nCount = 0;
911 bool bAfter = true;
912 if (pItem)
913 {
914 nCount = static_cast<const SfxInt16Item* >(pItem)->GetValue();
915 if(const SfxBoolItem* pAfterItem = pArgs->GetItemIfSet(FN_PARAM_INSERT_AFTER))
916 bAfter = pAfterItem->GetValue();
917 }
918 else if( !rReq.IsAPI() )
919 {
920 SwSelBoxes aBoxes;
921 ::GetTableSel( rSh, aBoxes );
922 if ( !aBoxes.empty() )
923 {
924 tools::Long maxX = 0;
925 tools::Long maxY = 0;
926 tools::Long minX = std::numeric_limits<tools::Long>::max();
927 tools::Long minY = std::numeric_limits<tools::Long>::max();
928 tools::Long nbBoxes = aBoxes.size();
929 for ( tools::Long i = 0; i < nbBoxes; i++ )
930 {
931 Point aCoord ( aBoxes[i]->GetCoordinates() );
932 if ( aCoord.X() < minX ) minX = aCoord.X();
933 if ( aCoord.X() > maxX ) maxX = aCoord.X();
934 if ( aCoord.Y() < minY ) minY = aCoord.Y();
935 if ( aCoord.Y() > maxY ) maxY = aCoord.Y();
936 }
937 if (bColumn)
938 nCount = maxX - minX + 1;
939 else
940 nCount = maxY - minY + 1;
941 }
942 bAfter = rReq.GetSlot() == FN_TABLE_INSERT_COL_AFTER
944 || rReq.GetSlot() == FN_TABLE_INSERT_ROW
945 || rReq.GetSlot() == FN_TABLE_INSERT_COL;
946 }
947
948 if( nCount )
949 {
950 // i74180: Table border patch submitted by chensuchun:
951 // -->get the SvxBoxInfoItem of the table before insert
953 ::lcl_TableParamToItemSet( aCoreSet, rSh );
954 bool bSetInnerBorders = false;
955 SwUndoId nUndoId = SwUndoId::EMPTY;
956 // <--End
957
958 if( bColumn )
959 {
961 rSh.InsertCol( nCount, bAfter );
962 bSetInnerBorders = true;
963 nUndoId = SwUndoId::TABLE_INSCOL;
964 }
965 else if ( !rSh.IsInRepeatedHeadline() )
966 {
968 rSh.InsertRow( nCount, bAfter );
969 bSetInnerBorders = true;
970 nUndoId = SwUndoId::TABLE_INSROW;
971 }
972
973 // -->after inserting,reset the inner table borders
974 if ( bSetInnerBorders )
975 {
976 const SvxBoxInfoItem& aBoxInfo(aCoreSet.Get(SID_ATTR_BORDER_INNER));
978 aSet.Put( aBoxInfo );
979 ItemSetToTableParam( aSet, rSh );
980 rSh.EndUndo( nUndoId );
981 }
982
983 bCallDone = true;
984 break;
985 }
986
988
989 [[fallthrough]]; // on Count = 0 appears the dialog
990 }
993 {
994 const SfxSlot* pSlot = GetStaticInterface()->GetSlot(nSlot);
995 if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline())
996 {
999 nSlot == FN_TABLE_INSERT_COL_DLG, pSlot->GetCommand()));
1000 if( pDlg->Execute() == 1 )
1001 {
1002 const sal_uInt16 nDispatchSlot = (nSlot == FN_TABLE_INSERT_COL_DLG)
1004 SfxUInt16Item aCountItem( nDispatchSlot, pDlg->getInsertCount() );
1005 SfxBoolItem aAfter( FN_PARAM_INSERT_AFTER, !pDlg->isInsertBefore() );
1006 SfxViewFrame& rVFrame = GetView().GetViewFrame();
1007 rVFrame.GetDispatcher()->ExecuteList(nDispatchSlot,
1008 SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
1009 { &aCountItem, &aAfter });
1010 }
1011 }
1012 break;
1013 }
1015 {
1017 bool bHorizontal=true;
1018 bool bProportional = false;
1020 const SfxBoolItem* pHor = rReq.GetArg<SfxBoolItem>(FN_PARAM_1);
1021 const SfxBoolItem* pProp = rReq.GetArg<SfxBoolItem>(FN_PARAM_2);
1022 if ( pSplit )
1023 {
1024 nCount = pSplit->GetValue();
1025 if ( pHor )
1026 bHorizontal = pHor->GetValue();
1027 if ( pProp )
1028 bProportional = pProp->GetValue();
1029 }
1030 else
1031 {
1033 SwWrtShell* pSh = &rSh;
1034 const tools::Long nMaxVert = rSh.GetAnyCurRect( CurRectType::Frame ).Width() / MINLAY;
1036 if(rSh.IsSplitVerticalByDefault())
1037 pDlg->SetSplitVerticalByDefault();
1038 pDlg->StartExecuteAsync([pDlg, pSh](int nResult) {
1039 if (nResult == RET_OK)
1040 {
1041 tools::Long nCount2 = pDlg->GetCount();
1042 bool bHorizontal2 = pDlg->IsHorizontal();
1043 bool bProportional2 = pDlg->IsProportional();
1044
1045 // tdf#60242: remember choice for next time
1046 bool bVerticalWasChecked = !pDlg->IsHorizontal();
1047 pSh->SetSplitVerticalByDefault(bVerticalWasChecked);
1048
1049 if ( nCount2 > 1 )
1050 pSh->SplitTab(!bHorizontal2, static_cast< sal_uInt16 >( nCount2-1 ), bProportional2 );
1051 }
1052
1053 pDlg->disposeOnce();
1054 });
1055 }
1056
1057 if ( nCount>1 )
1058 {
1059 rSh.SplitTab(!bHorizontal, static_cast< sal_uInt16 >( nCount-1 ), bProportional );
1060 bCallDone = true;
1061 }
1062 else
1063 rReq.Ignore();
1064 break;
1065 }
1066
1068 {
1069 const SfxUInt16Item* pType = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
1070 if( pType )
1071 {
1072 switch( static_cast<SplitTable_HeadlineOption>(pType->GetValue()) )
1073 {
1079 rSh.SplitTable(static_cast<SplitTable_HeadlineOption>(pType->GetValue())) ;
1080 break;
1081 default: ;//wrong parameter, do nothing
1082 }
1083 }
1084 else
1085 {
1088
1089 SwWrtShell* pSh = &rSh;
1090
1091 pDlg->StartExecuteAsync([pDlg, pSh](int nResult) {
1092 if (nResult == RET_OK)
1093 {
1094 const auto aSplitMode = pDlg->GetSplitMode();
1095 pSh->SplitTable( aSplitMode );
1096 }
1097
1098 pDlg->disposeOnce();
1099 });
1100 rReq.Ignore(); // We're already handling the request in our async bit
1101 }
1102 break;
1103 }
1104
1106 {
1107 bool bPrev = rSh.CanMergeTable();
1108 bool bNext = rSh.CanMergeTable( false );
1109
1110 if( bPrev && bNext )
1111 {
1114 if( RET_OK != pDlg->Execute())
1115 bPrev = bNext = false;
1116 }
1117
1118 if( bPrev || bNext )
1119 rSh.MergeTable( bPrev );
1120 break;
1121 }
1122
1123 case FN_TABLE_MODE_FIX :
1126 {
1129 : FN_TABLE_MODE_FIX_PROP == nSlot
1132
1134 static sal_uInt16 aInva[] =
1138 0
1139 };
1140 rBind.Invalidate( aInva );
1141 bCallDone = true;
1142 break;
1143 }
1144 case FN_TABLE_AUTOSUM:
1145 {
1146 SfxViewFrame& rVFrame = GetView().GetViewFrame();
1147 rVFrame.GetDispatcher()->Execute(FN_EDIT_FORMULA, SfxCallMode::SYNCHRON);
1148 const sal_uInt16 nId = SwInputChild::GetChildWindowId();
1149 SwInputChild* pChildWin = static_cast<SwInputChild*>(rVFrame.
1150 GetChildWindow( nId ));
1151 OUString sSum;
1152 GetShell().GetAutoSum(sSum);
1153 if( pChildWin )
1154 pChildWin->SetFormula( sSum );
1155
1156 break;
1157 }
1159 if(0 != rSh.GetRowsToRepeat())
1160 rSh.SetRowsToRepeat( 0 );
1161 else
1163 break;
1165 rSh.SelectTableCell();
1166 break;
1168 {
1169 rSh.StartAction();
1170 rSh.StartUndo();
1172 rSh.DeleteTable();
1173 rSh.EndUndo();
1174 rSh.EndAction();
1175 //'this' is already destroyed
1176 return;
1177 }
1179 {
1181 if (pItem2)
1182 {
1183 tools::Long nNewHeight = pItem2->GetValue();
1184 std::unique_ptr<SwFormatFrameSize> pHeight = rSh.GetRowHeight();
1185 if ( pHeight )
1186 {
1187 if (pHeight->GetHeightSizeType() == SwFrameSize::Variable)
1188 pHeight->SetHeightSizeType(SwFrameSize::Minimum);
1189 pHeight->SetHeight(nNewHeight);
1190 rSh.SetRowHeight(*pHeight);
1191 }
1192 }
1193 return;
1194 }
1196 {
1198 if (pItem2)
1199 {
1200 tools::Long nNewWidth = pItem2->GetValue();
1201 SwTableFUNC aFunc( &rSh );
1202 aFunc.InitTabCols();
1203 aFunc.SetColWidth(aFunc.GetCurColNum(), nNewWidth);
1204 }
1205 return;
1206 }
1207 default:
1208 bMore = true;
1209 }
1210
1211 if ( !bMore )
1212 {
1213 if(bCallDone)
1214 rReq.Done();
1215 return;
1216 }
1217
1218 // Now the slots which are working directly on the TableFormat.
1219 switch ( nSlot )
1220 {
1221 case SID_ATTR_ULSPACE:
1222 if(pItem)
1223 {
1224 SvxULSpaceItem aULSpace( *static_cast<const SvxULSpaceItem*>(pItem) );
1225 aULSpace.SetWhich( RES_UL_SPACE );
1226 ::lcl_SetAttr( rSh, aULSpace );
1227 }
1228 break;
1229
1230 case SID_ATTR_LRSPACE:
1231 if(pItem)
1232 {
1235 SvxLRSpaceItem aLRSpace( *static_cast<const SvxLRSpaceItem*>(pItem) );
1236 aLRSpace.SetWhich( RES_LR_SPACE );
1237 aSet.Put( aLRSpace );
1238 rSh.SetTableAttr( aSet );
1239 }
1240 break;
1241 // The last case branch which needs a table manager!!
1243 {
1244 SwTableFUNC aMgr( &rSh );
1246 break;
1247 }
1248 case SID_TABLE_VERT_NONE:
1249 case SID_TABLE_VERT_CENTER:
1250 case SID_TABLE_VERT_BOTTOM:
1251 {
1252 const sal_uInt16 nAlign = nSlot == SID_TABLE_VERT_NONE ?
1254 nSlot == SID_TABLE_VERT_CENTER ?
1255 text::VertOrientation::CENTER : text::VertOrientation::BOTTOM;
1256 rSh.SetBoxAlign(nAlign);
1257 bCallDone = true;
1258 break;
1259 }
1260
1261 case SID_ATTR_PARA_SPLIT:
1262 if ( pItem )
1263 {
1264 SwFormatLayoutSplit aSplit( static_cast<const SvxFormatSplitItem*>(pItem)->GetValue());
1266 aSet.Put(aSplit);
1267 rSh.SetTableAttr(aSet);
1268 }
1269 break;
1270
1271 case SID_ATTR_PARA_KEEP:
1272 if ( pItem )
1273 {
1274 SvxFormatKeepItem aKeep( *static_cast<const SvxFormatKeepItem*>(pItem) );
1275 aKeep.SetWhich( RES_KEEP );
1277 aSet.Put(aKeep);
1278 rSh.SetTableAttr(aSet);
1279 }
1280 break;
1281 case FN_TABLE_ROW_SPLIT :
1282 {
1283 const SfxBoolItem* pBool = static_cast<const SfxBoolItem*>(pItem);
1284 std::unique_ptr<SwFormatRowSplit> pSplit;
1285 if(!pBool)
1286 {
1287 pSplit = rSh.GetRowSplit();
1288 if(pSplit)
1289 pSplit->SetValue(!pSplit->GetValue());
1290 else
1291 pSplit.reset(new SwFormatRowSplit(true));
1292 }
1293 else
1294 {
1295 pSplit.reset(new SwFormatRowSplit(pBool->GetValue()));
1296 }
1297 rSh.SetRowSplit( *pSplit );
1298 break;
1299 }
1300
1301 default:
1302 OSL_ENSURE( false, "wrong Dispatcher" );
1303 return;
1304 }
1305 if(bCallDone)
1306 rReq.Done();
1307}
1308
1310{
1311 SfxWhichIter aIter( rSet );
1312 SwWrtShell &rSh = GetShell();
1313 SwFrameFormat *pFormat = rSh.GetTableFormat();
1314 // os #124829# crash report: in case of an invalid shell selection return immediately
1315 if(!pFormat)
1316 return;
1317 sal_uInt16 nSlot = aIter.FirstWhich();
1318 while ( nSlot )
1319 {
1320 switch ( nSlot )
1321 {
1323 if ( !rSh.IsTableMode() )
1325 break;
1326 case SID_TABLE_MINIMAL_COLUMN_WIDTH:
1328 if ( !rSh.IsAdjustCellWidthAllowed() )
1329 rSet.DisableItem(nSlot);
1330 break;
1331
1333 if ( !rSh.IsAdjustCellWidthAllowed(true) )
1335 break;
1336
1339 if ( !rSh.BalanceRowHeight(true) )
1340 rSet.DisableItem(nSlot);
1341 break;
1342 case FN_OPTIMIZE_TABLE:
1343 if ( !rSh.IsTableMode() &&
1344 !rSh.IsAdjustCellWidthAllowed() &&
1345 !rSh.IsAdjustCellWidthAllowed(true) &&
1346 !rSh.BalanceRowHeight(true) )
1348 break;
1349 case SID_INSERT_DIAGRAM:
1350 {
1351 SvtModuleOptions aMOpt;
1352 if ( !aMOpt.IsMath() || rSh.IsTableComplexForChart() )
1353 rSet.DisableItem(nSlot);
1354 }
1355 break;
1356
1357 case FN_INSERT_TABLE:
1358 if ( rSh.CursorInsideInputField() )
1359 {
1360 rSet.DisableItem( nSlot );
1361 }
1362 break;
1363
1364 case SID_TABLE_MINIMAL_ROW_HEIGHT:
1365 {
1366 // Disable if auto height already is enabled.
1367 std::unique_ptr<SwFormatFrameSize> pSz = rSh.GetRowHeight();
1368 if ( pSz )
1369 {
1370 if ( SwFrameSize::Variable == pSz->GetHeightSizeType() )
1371 rSet.DisableItem( nSlot );
1372 }
1373 break;
1374 }
1377 {
1378 SfxImageItem aImageItem(nSlot);
1379 if (pFormat->GetFrameDir().GetValue() == SvxFrameDirection::Environment)
1380 {
1381 // Inherited from superordinate object (page or frame).
1382 // If the table spans multiple pages, direction is set by the first page.
1384 for (SwTabFrame* pFrame = aIterT.First(); pFrame;
1385 pFrame = static_cast<SwTabFrame*>(pFrame->GetPrecede()))
1386 aImageItem.SetMirrored(pFrame->IsRightToLeft());
1387 }
1388 else
1389 aImageItem.SetMirrored(pFormat->GetFrameDir().GetValue() == SvxFrameDirection::Horizontal_RL_TB);
1390 rSet.Put(aImageItem);
1391 break;
1392 }
1396 if ( rSh.IsInRepeatedHeadline() )
1397 rSet.DisableItem( nSlot );
1398 break;
1399 case RES_LR_SPACE:
1400 rSet.Put(pFormat->GetLRSpace());
1401 break;
1402 case RES_UL_SPACE:
1403 rSet.Put(pFormat->GetULSpace());
1404 break;
1405
1406 case SID_TABLE_VERT_NONE:
1407 case SID_TABLE_VERT_CENTER:
1408 case SID_TABLE_VERT_BOTTOM:
1409 {
1410 const sal_uInt16 nAlign = rSh.GetBoxAlign();
1411 bool bSet = (nSlot == SID_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) ||
1412 (nSlot == SID_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) ||
1413 (nSlot == SID_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM);
1414 rSet.Put(SfxBoolItem(nSlot, bSet));
1415 break;
1416 }
1417
1418 case FN_TABLE_MODE_FIX :
1421 {
1422 TableChgMode nMode = rSh.GetTableChgMode();
1423 bool bSet = (nSlot == FN_TABLE_MODE_FIX && nMode == TableChgMode::FixedWidthChangeAbs) ||
1426 rSet.Put(SfxBoolItem(nSlot, bSet));
1427 }
1428 break;
1429
1430 case SID_ATTR_PARA_SPLIT:
1431 rSet.Put( pFormat->GetKeep() );
1432 break;
1433
1434 case SID_ATTR_PARA_KEEP:
1435 rSet.Put( pFormat->GetLayoutSplit() );
1436 break;
1438 if ( rSh.IsInHeadline() )
1439 rSet.DisableItem( nSlot );
1440 break;
1442 {
1443 bool bAsk;
1444 if( !rSh.CanMergeTable( true, &bAsk ))
1445 rSet.DisableItem( nSlot );
1446 break;
1447 }
1448
1450 {
1451 SwSelBoxes aBoxes;
1452 ::GetTableSel( rSh, aBoxes, SwTableSearchType::Row );
1453 if( ::HasProtectedCells( aBoxes ) || lcl_BoxesInDeletedRows( rSh, aBoxes ) )
1454 rSet.DisableItem( nSlot );
1455 }
1456 break;
1458 {
1459 SwSelBoxes aBoxes;
1460 ::GetTableSel( rSh, aBoxes, SwTableSearchType::Col );
1461 if( ::HasProtectedCells( aBoxes ) || lcl_CursorInDeletedTable( rSh ) )
1462 rSet.DisableItem( nSlot );
1463 }
1464 break;
1466 if( lcl_CursorInDeletedTable( rSh ) )
1467 rSet.DisableItem( nSlot );
1468 break;
1469
1471 // disable in readonly sections, but enable in protected cells
1472 if( !rSh.CanUnProtectCells() )
1473 rSet.DisableItem( nSlot );
1474 break;
1475 case RES_ROW_SPLIT:
1476 {
1477 const SwFormatLayoutSplit& rTabSplit = pFormat->GetLayoutSplit();
1478 if ( !rTabSplit.GetValue() )
1479 {
1480 rSet.DisableItem( nSlot );
1481 }
1482 else
1483 {
1484 std::unique_ptr<SwFormatRowSplit> pSplit = rSh.GetRowSplit();
1485 if(pSplit)
1486 rSet.Put(std::move(pSplit));
1487 else
1488 rSet.InvalidateItem( nSlot );
1489 }
1490 break;
1491 }
1493 if(0 != rSh.GetRowsToRepeat())
1494 rSet.Put(SfxBoolItem(nSlot, true));
1495 else if(!rSh.GetRowSelectionFromTop())
1496 rSet.DisableItem( nSlot );
1497 else
1498 rSet.Put(SfxBoolItem(nSlot, false));
1499 break;
1501 if(rSh.HasBoxSelection())
1502 rSet.DisableItem( nSlot );
1503 break;
1505 {
1507 std::unique_ptr<SwFormatFrameSize> pHeight = rSh.GetRowHeight();
1508 if (pHeight)
1509 {
1510 tools::Long nHeight = pHeight->GetHeight();
1511 aRowHeight.SetValue(nHeight);
1512 rSet.Put(aRowHeight);
1513
1515 {
1516 // TODO: set correct unit
1517 MapUnit eTargetUnit = MapUnit::MapInch;
1518 OUString sHeight = GetMetricText(nHeight,
1519 MapUnit::MapTwip, eTargetUnit, nullptr);
1520
1521 OUString sPayload = ".uno:TableRowHeight=" + sHeight;
1522
1523 GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
1524 OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
1525 }
1526 }
1527 break;
1528 }
1530 {
1532 SwTableFUNC aFunc( &rSh );
1533 aFunc.InitTabCols();
1534 SwTwips nWidth = aFunc.GetColWidth(aFunc.GetCurColNum());
1535 aColumnWidth.SetValue(nWidth);
1536 rSet.Put(aColumnWidth);
1537
1539 {
1540 // TODO: set correct unit
1541 MapUnit eTargetUnit = MapUnit::MapInch;
1542 OUString sWidth = GetMetricText(nWidth,
1543 MapUnit::MapTwip, eTargetUnit, nullptr);
1544
1545 OUString sPayload = ".uno:TableColumWidth=" + sWidth;
1546
1547 GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
1548 OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
1549 }
1550
1551 break;
1552 }
1553 }
1554 nSlot = aIter.NextWhich();
1555 }
1556}
1557
1559 SwBaseShell(_rView)
1560{
1561 SetName("Table");
1563}
1564
1566{
1568 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aCoreSet( GetPool() );
1569 SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1570 aCoreSet.Put( aBoxInfo );
1571 GetShell().GetTabBorders( aCoreSet );
1572 rSet.Put( aCoreSet );
1573}
1574
1576{
1577 SwWrtShell &rSh = GetShell();
1578 const SfxItemSet *pArgs = rReq.GetArgs();
1579 if(!pArgs)
1580 return;
1581
1582 switch ( rReq.GetSlot() )
1583 {
1584 case SID_FRAME_LINESTYLE:
1585 case SID_FRAME_LINECOLOR:
1586 if ( rReq.GetSlot() == SID_FRAME_LINESTYLE )
1587 {
1588 const SvxLineItem &rLineItem = pArgs->Get( SID_FRAME_LINESTYLE );
1589 const SvxBorderLine* pBorderLine = rLineItem.GetLine();
1590 rSh.SetTabLineStyle( nullptr, true, pBorderLine);
1591 }
1592 else
1593 {
1594 const SvxColorItem &rNewColorItem = pArgs->Get( SID_FRAME_LINECOLOR );
1595 rSh.SetTabLineStyle( &rNewColorItem.GetValue() );
1596 }
1597
1598 rReq.Done();
1599
1600 break;
1601 }
1602}
1603
1605{
1607 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aCoreSet( GetPool() );
1608 SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER );
1609 aCoreSet.Put(aCoreInfo);
1610 GetShell().GetTabBorders( aCoreSet );
1611
1612 const SvxBoxItem& rBoxItem = aCoreSet.Get( RES_BOX );
1613 const SvxBorderLine* pLine = rBoxItem.GetTop();
1614
1615 rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) );
1616 SvxLineItem aLine( SID_FRAME_LINESTYLE );
1617 aLine.SetLine(pLine);
1618 rSet.Put( aLine );
1619}
1620
1622{
1623 const SfxItemSet* pArgs = rReq.GetArgs();
1624 SwWrtShell &rSh = GetShell();
1625
1626 // At first the slots, which doesn't need a FrameMgr.
1627 const SfxPoolItem* pItem = nullptr;
1628 const sal_uInt16 nSlot = rReq.GetSlot();
1629 if(pArgs)
1630 pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
1631
1632 // Always acquire the language from the current cursor position.
1633 LanguageType eLang = rSh.GetCurLang();
1634 SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
1635 sal_uInt32 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
1636 SvNumFormatType nFormatType = SvNumFormatType::ALL;
1637 sal_uInt16 nOffset = 0;
1638
1639 switch ( nSlot )
1640 {
1641 case FN_NUMBER_FORMAT:
1642 if( pItem )
1643 {
1644 // Determine index for string.
1645 OUString aCode( static_cast<const SfxStringItem*>(pItem)->GetValue() );
1646 nNumberFormat = pFormatter->GetEntryKey( aCode, eLang );
1647 if( NUMBERFORMAT_ENTRY_NOT_FOUND == nNumberFormat )
1648 {
1649 // Re-enter
1650 sal_Int32 nErrPos;
1652 if( !pFormatter->PutEntry( aCode, nErrPos, nType,
1653 nNumberFormat, eLang ))
1654 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
1655 }
1656 }
1657 break;
1658 case FN_NUMBER_STANDARD: nFormatType = SvNumFormatType::NUMBER; break;
1659 case FN_NUMBER_SCIENTIFIC: nFormatType = SvNumFormatType::SCIENTIFIC; break;
1660 case FN_NUMBER_DATE: nFormatType = SvNumFormatType::DATE; break;
1661 case FN_NUMBER_TIME: nFormatType = SvNumFormatType::TIME; break;
1662 case FN_NUMBER_CURRENCY: nFormatType = SvNumFormatType::CURRENCY; break;
1663 case FN_NUMBER_PERCENT: nFormatType = SvNumFormatType::PERCENT; break;
1664
1665 case FN_NUMBER_TWODEC: // #.##0,00
1666 nFormatType = SvNumFormatType::NUMBER;
1667 nOffset = NF_NUMBER_1000DEC2;
1668 break;
1669
1670 default:
1671 OSL_FAIL("wrong dispatcher");
1672 return;
1673 }
1674
1675 if( nFormatType != SvNumFormatType::ALL )
1676 nNumberFormat = pFormatter->GetStandardFormat( nFormatType, eLang ) + nOffset;
1677
1678 if( NUMBERFORMAT_ENTRY_NOT_FOUND != nNumberFormat )
1679 {
1681 aBoxSet.Put( SwTableBoxNumFormat( nNumberFormat ));
1682 rSh.SetTableBoxFormulaAttrs( aBoxSet );
1683 }
1684
1685}
1686
1687/* 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
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:3419
SwWrtShell & GetShell()
Definition: basesh.cxx:3064
SwView & GetView()
Definition: basesh.hxx:59
void InsertTable(SfxRequest &_rRequest)
Definition: basesh.cxx:3126
bool IsTableComplexForChart()
Definition: trvltbl.cxx:723
const SwPaM * GetTableCrs() const
Definition: crsrsh.hxx:929
bool GoPrevCell()
Definition: trvltbl.cxx:101
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2279
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:2781
bool SelTableBox()
Definition: trvltbl.cxx:286
StartsWith StartsWith_()
If document body starts with a table or starts/ends with hidden paragraph.
Definition: crsrsh.cxx:626
void SetSelection(const SwPaM &rCursor)
Definition: crsrsh.cxx:3561
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:910
bool CursorInsideInputField() const
Definition: crstrvl.cxx:1089
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:953
bool IsTableMode() const
Definition: crsrsh.hxx:662
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:468
bool MergeTable(bool bWithPrev)
Definition: edtab.cxx:450
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:434
void SetTableBoxFormulaAttrs(const SfxItemSet &rSet)
Definition: edtab.cxx:339
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:412
void EndAllAction()
Definition: edws.cxx:97
LanguageType GetCurLang() const
Definition: edattr.cxx:801
void GetTableAttr(SfxItemSet &) const
Definition: fetab.cxx:2239
bool DeleteCol()
Definition: fetab.cxx:264
void SetTabCols(const SwTabCols &rNew, bool bCurRowOnly)
Definition: fetab.cxx:737
void GetAutoSum(OUString &rFormula) const
Definition: fetab.cxx:2324
void InsertCol(sal_uInt16 nCnt, bool bBehind)
Definition: fetab.cxx:211
bool BalanceRowHeight(bool bTstOnly, const bool bOptimize=false)
Definition: fetab.cxx:851
bool GetRowBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:870
sal_uInt16 GetRowsToRepeat() const
Definition: fetab.cxx:1111
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:981
void SetBoxAlign(sal_uInt16 nOrient)
Definition: fetab.cxx:930
void SetBoxBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:898
void SetRowSplit(const SwFormatRowSplit &rSz)
Definition: fetab.cxx:825
void GetTabCols(SwTabCols &rToFill) const
Info about columns and margins.
Definition: fetab.cxx:755
void SetRowBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:862
void DeleteTable()
Definition: fetab.cxx:317
void SetRowHeight(const SwFormatFrameSize &rSz)
Definition: fetab.cxx:838
bool IsInHeadline() const
Definition: fesh.hxx:723
bool IsTableVertical() const
Definition: fetab.cxx:2437
bool GetBoxBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:906
sal_uInt16 GetRowSelectionFromTop() const
Definition: fetab.cxx:1173
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:1243
std::unique_ptr< SwFormatRowSplit > GetRowSplit() const
Definition: fetab.cxx:833
void SetRowsToRepeat(sal_uInt16 nNumOfRows)
Definition: fetab.cxx:1120
void SetTabBorders(const SfxItemSet &rSet)
Definition: fetab.cxx:875
bool CanUnProtectCells() const
Definition: fetab.cxx:1084
void UnProtectCells()
Refers to table selection.
Definition: fetab.cxx:1042
void SetTabBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:943
void SetTabLineStyle(const Color *pColor, bool bSetLine=false, const editeng::SvxBorderLine *pBorderLine=nullptr)
Definition: fetab.cxx:883
void SplitTab(bool bVert, sal_uInt16 nCnt, bool bSameHeight)
Split cell vertically or horizontally.
Definition: fetab.cxx:587
void AdjustCellWidth(const bool bBalance, const bool bNoShrink)
Definition: fetab.cxx:1229
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:1022
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:893
bool HasWholeTabSelection() const
Definition: fetab.cxx:963
std::unique_ptr< SwFormatFrameSize > GetRowHeight() const
Pointer must be destroyed by caller != 0.
Definition: fetab.cxx:846
sal_uInt16 GetBoxAlign() const
USHRT_MAX if ambiguous.
Definition: fetab.cxx:938
void GetTabBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
Definition: fetab.cxx:956
bool GetBoxDirection(std::unique_ptr< SvxFrameDirectionItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:922
void SetTableAttr(const SfxItemSet &)
Definition: fetab.cxx:2246
TableMergeErr MergeTab()
Merge selected parts of table.
Definition: fetab.cxx:555
void SetBoxDirection(const SvxFrameDirectionItem &rNew)
Definition: fetab.cxx:914
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: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:62
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:774
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: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:425
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:470
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:374
bool IsDeleted(SwRedlineTable::size_type &rRedlinePos) const
Definition: swtable.cxx:1842
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:1565
void GetLineStyleState(SfxItemSet &rSet)
Definition: tabsh.cxx:1604
void ExecNumberFormat(SfxRequest const &rReq)
Definition: tabsh.cxx:1621
SwTableShell(SwView &rView)
Definition: tabsh.cxx:1558
void ExecTableStyle(SfxRequest &rReq)
Definition: tabsh.cxx:1575
void GetState(SfxItemSet &)
Definition: tabsh.cxx:1309
void Execute(SfxRequest &)
Definition: tabsh.cxx:486
bool IsDeleted() const
Definition: swtable.cxx:1601
void SetTableDest(sal_uInt8 nNew)
Definition: viewopt.hxx:739
sal_uInt8 GetTableDest() const
Definition: viewopt.hxx:714
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:434
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2159
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:625
Definition: view.hxx:146
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void SelectTableRow()
Definition: select.cxx:836
void SetSplitVerticalByDefault(bool value)
Definition: select.cxx:373
void EndSelect()
Definition: select.cxx:426
bool IsSplitVerticalByDefault() const
Definition: select.cxx:368
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1717
void EnterStdMode()
Definition: select.cxx:552
void SelectTableCol()
Definition: select.cxx:845
void SelectTableCell()
Definition: select.cxx:854
bool HasSelection() const
Definition: wrtsh.hxx:147
void SttSelect()
Definition: select.cxx:386
tools::Long ResetSelect(const Point *, bool)
Definition: select.cxx:334
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2041
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:421
#define FN_CALC_TABLE
Definition: cmdid.h:85
#define SID_ATTR_TABLE_COLUMN_WIDTH
Definition: cmdid.h:460
#define FN_PARAM_TABLE_NAME
Definition: cmdid.h:815
#define FN_TABLE_MODE_FIX_PROP
Definition: cmdid.h:456
#define FN_TABLE_BALANCE_ROWS
Definition: cmdid.h:448
#define FN_TABLE_SET_READ_ONLY_CELLS
Definition: cmdid.h:393
#define FN_TABLE_MODE_VARIABLE
Definition: cmdid.h:457
#define FN_TABLE_INSERT_COL
Definition: cmdid.h:378
#define FN_TABLE_SELECT_COL
Definition: cmdid.h:390
#define FN_TABLE_ADJUST_CELLS
Definition: cmdid.h:396
#define FN_INSERT_TABLE
Definition: cmdid.h:231
#define FN_TABLE_BALANCE_CELLS
Definition: cmdid.h:447
#define FN_TABLE_INSERT_COL_DLG
Definition: cmdid.h:418
#define FN_TABLE_UNSET_READ_ONLY_CELLS
Definition: cmdid.h:394
#define FN_PARAM_TABLE_HEADLINE
Definition: cmdid.h:816
#define FN_GOTO_PREV_CELL
Definition: cmdid.h:422
#define FN_EDIT_FORMULA
Definition: cmdid.h:84
#define FN_TABLE_SET_COL_WIDTH
Definition: cmdid.h:384
#define FN_NUMBER_SCIENTIFIC
Definition: cmdid.h:477
#define FN_NUMBER_TIME
Definition: cmdid.h:479
#define FN_TABLE_AUTOSUM
Definition: cmdid.h:462
#define FN_TABLE_SPLIT_TABLE
Definition: cmdid.h:492
#define FN_NUMBER_DATE
Definition: cmdid.h:478
#define FN_TABLE_INSERT_ROW_BEFORE
Definition: cmdid.h:387
#define FN_TABLE_DELETE_ROW
Definition: cmdid.h:379
#define SID_ATTR_TABLE_ROW_HEIGHT
Definition: cmdid.h:459
#define FN_TABLE_INSERT_COL_BEFORE
Definition: cmdid.h:388
#define FN_NUMBER_TWODEC
Definition: cmdid.h:476
#define FN_TABLE_INSERT_ROW
Definition: cmdid.h:377
#define FN_TABLE_SET_ROW_HEIGHT
Definition: cmdid.h:383
#define FN_PARAM_INSERT_AFTER
Definition: cmdid.h:813
#define FN_TABLE_INSERT_ROW_DLG
Definition: cmdid.h:419
#define FN_TABLE_ROW_SPLIT
Definition: cmdid.h:505
#define FN_FORMAT_TABLE_DLG
Definition: cmdid.h:352
#define FN_TABLE_SELECT_ROW
Definition: cmdid.h:389
#define FN_NUMBER_BULLETS
Definition: cmdid.h:80
#define FN_OPTIMIZE_TABLE
Definition: cmdid.h:386
#define FN_NUM_FORMAT_TABLE_DLG
Definition: cmdid.h:343
#define FN_NUMBER_STANDARD
Definition: cmdid.h:475
#define FN_TABLE_REP
Definition: cmdid.h:375
#define FN_TABLE_HEADLINE_REPEAT
Definition: cmdid.h:395
#define FN_TABLE_BOX_TEXTORIENTATION
Definition: cmdid.h:458
#define FN_NUMBER_CURRENCY
Definition: cmdid.h:480
#define FN_TABLE_DELETE_COL
Definition: cmdid.h:380
#define FN_END_TABLE
Definition: cmdid.h:717
#define FN_TABLE_SELECT_ALL
Definition: cmdid.h:391
#define FN_TABLE_MERGE_TABLE
Definition: cmdid.h:504
#define FN_TABLE_MERGE_CELLS
Definition: cmdid.h:382
#define FN_TABLE_MODE_FIX
Definition: cmdid.h:455
#define FN_TABLE_SET_VERT_ALIGN
Definition: cmdid.h:454
#define FN_TABLE_INSERT_ROW_AFTER
Definition: cmdid.h:385
#define FN_NUMBER_FORMAT
Definition: cmdid.h:474
#define FN_NUMBER_PERCENT
Definition: cmdid.h:481
#define FN_TABLE_OPTIMAL_HEIGHT
Definition: cmdid.h:401
#define FN_TABLE_SPLIT_CELLS
Definition: cmdid.h:381
#define FN_START_TABLE
Definition: cmdid.h:716
#define FN_TABLE_SELECT_CELL
Definition: cmdid.h:403
#define FN_TABLE_DELETE_TABLE
Definition: cmdid.h:402
#define FN_TABLE_INSERT_COL_AFTER
Definition: cmdid.h:392
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:80
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: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:415
SvNumFormatType
NF_TEXT
NF_NUMBER_1000DEC2
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND