LibreOffice Module sw (master) 1
fetab.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 <memory>
21#include <hintids.hxx>
22
23#include <vcl/errinf.hxx>
25#include <editeng/protitem.hxx>
26#include <editeng/brushitem.hxx>
28#include <svtools/ruler.hxx>
29#include <osl/diagnose.h>
30#include <swwait.hxx>
31#include <fmtfsize.hxx>
32#include <fmtornt.hxx>
33#include <frmatr.hxx>
34#include <fesh.hxx>
35#include <wrtsh.hxx>
36#include <doc.hxx>
37#include <docsh.hxx>
38#include <IDocumentState.hxx>
41#include <IDocumentUndoRedo.hxx>
42#include <cntfrm.hxx>
43#include <txtfrm.hxx>
44#include <notxtfrm.hxx>
45#include <rootfrm.hxx>
46#include <pagefrm.hxx>
47#include <tabfrm.hxx>
48#include <rowfrm.hxx>
49#include <cellfrm.hxx>
50#include <flyfrm.hxx>
51#include <swtable.hxx>
52#include <swddetbl.hxx>
53#include <ndtxt.hxx>
54#include <calc.hxx>
55#include <dialoghelp.hxx>
56#include <tabcol.hxx>
57#include <tblafmt.hxx>
58#include <cellatr.hxx>
59#include <pam.hxx>
60#include <viscrs.hxx>
61#include <tblsel.hxx>
62#include <swerror.h>
63#include <swundo.hxx>
64#include <frmtool.hxx>
65#include <fmtrowsplt.hxx>
66#include <node.hxx>
67#include <sortedobjs.hxx>
68
69using namespace ::com::sun::star;
70
71// also see swtable.cxx
72#define COLFUZZY 20L
73
74static bool IsSame( tools::Long nA, tools::Long nB ) { return std::abs(nA-nB) <= COLFUZZY; }
75
76namespace {
77
78class TableWait
79{
80 const std::unique_ptr<SwWait> m_pWait;
81 // this seems really fishy: do some locking, if an arbitrary number of lines is exceeded
82 static const size_t our_kLineLimit = 20;
83 static bool ShouldWait(size_t nCnt, SwFrame *pFrame, size_t nCnt2)
84 { return our_kLineLimit < nCnt || our_kLineLimit < nCnt2 || (pFrame && our_kLineLimit < pFrame->ImplFindTabFrame()->GetTable()->GetTabLines().size()); }
85public:
86 TableWait(size_t nCnt, SwFrame *pFrame, SwDocShell &rDocShell, size_t nCnt2 = 0)
87 : m_pWait( ShouldWait(nCnt, pFrame, nCnt2) ? std::make_unique<SwWait>( rDocShell, true ) : nullptr )
88 { }
89};
90
91}
92
94{
95 SwCursor * pSwCursor = GetCursor();
96
97 OSL_ENSURE(pSwCursor, "no SwCursor");
98
99 SwPosition aStartPos = *pSwCursor->GetPoint(), aEndPos = aStartPos;
100
101 /* Search least and greatest position in current cursor ring.
102 */
103 for(SwPaM& rTmpCursor : pSwCursor->GetRingContainer())
104 {
105 SwCursor* pTmpCursor = static_cast<SwCursor *>(&rTmpCursor);
106 const SwPosition * pPt = pTmpCursor->GetPoint(),
107 * pMk = pTmpCursor->GetMark();
108
109 if (*pPt < aStartPos)
110 aStartPos = *pPt;
111
112 if (*pPt > aEndPos)
113 aEndPos = *pPt;
114
115 if (*pMk < aStartPos)
116 aStartPos = *pMk;
117
118 if (*pMk > aEndPos)
119 aEndPos = *pMk;
120
121 }
122
123 KillPams();
124
125 /* @@@ semantic: SwCursor::operator=() is not implemented @@@ */
126
127 /* Set cursor to end of selection to ensure IsLastCellInRow works
128 properly. */
129 {
130 SwCursor aTmpCursor( aEndPos, nullptr );
131 *pSwCursor = aTmpCursor;
132 }
133
134 /* Move the cursor out of the columns to delete and stay in the
135 same row. If the table has only one column the cursor will
136 stay in the row and the shell will take care of it. */
137 if (IsLastCellInRow())
138 {
139 /* If the cursor is in the last row of the table, first
140 try to move it to the previous cell. If that fails move
141 it to the next cell. */
142
143 {
144 SwCursor aTmpCursor( aStartPos, nullptr );
145 *pSwCursor = aTmpCursor;
146 }
147
148 if (! pSwCursor->GoPrevCell())
149 {
150 SwCursor aTmpCursor( aEndPos, nullptr );
151 *pSwCursor = aTmpCursor;
152 pSwCursor->GoNextCell();
153 }
154 }
155 else
156 {
157 /* If the cursor is not in the last row of the table, first
158 try to move it to the next cell. If that fails move it
159 to the previous cell. */
160
161 {
162 SwCursor aTmpCursor( aEndPos, nullptr );
163 *pSwCursor = aTmpCursor;
164 }
165
166 if (! pSwCursor->GoNextCell())
167 {
168 SwCursor aTmpCursor( aStartPos, nullptr );
169 *pSwCursor = aTmpCursor;
170 pSwCursor->GoPrevCell();
171 }
172 }
173}
174
175void SwFEShell::InsertRow( sal_uInt16 nCnt, bool bBehind )
176{
177 // check if Point/Mark of current cursor are in a table
178 SwFrame *pFrame = GetCurrFrame();
179 if( !pFrame || !pFrame->IsInTab() )
180 return;
181
182 if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
183 {
185 DialogMask::MessageInfo | DialogMask::ButtonsOk );
186 return;
187 }
188
189 CurrShell aCurr( this );
191
192 // search boxes via the layout
193 SwSelBoxes aBoxes;
194 bool bSelectAll = StartsWith_() == StartsWith::Table && ExtendedSelectedAll();
195 if (bSelectAll)
196 {
197 // Set the end of the selection to the last paragraph of the last cell of the table.
198 SwPaM* pPaM = getShellCursor(false);
199 SwNode* pNode = pPaM->Start()->GetNode().FindTableNode()->EndOfSectionNode();
200 // pNode is the end node of the table, we want the last node before the end node of the last cell.
201 pPaM->End()->Assign( pNode->GetIndex() - 2 );
202 }
203 GetTableSel( *this, aBoxes, SwTableSearchType::Row );
204
205 TableWait aWait( nCnt, pFrame, *GetDoc()->GetDocShell(), aBoxes.size() );
206
207 if ( !aBoxes.empty() )
208 GetDoc()->InsertRow( aBoxes, nCnt, bBehind );
209
211}
212
213void SwFEShell::InsertCol( sal_uInt16 nCnt, bool bBehind )
214{
215 // check if Point/Mark of current cursor are in a table
216 SwFrame *pFrame = GetCurrFrame();
217 if( !pFrame || !pFrame->IsInTab() )
218 return;
219
220 if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
221 {
223 DialogMask::MessageInfo | DialogMask::ButtonsOk );
224 return;
225 }
226
227 CurrShell aCurr( this );
228
229 if( !CheckSplitCells( *this, nCnt + 1, SwTableSearchType::Col ) )
230 {
232 DialogMask::MessageInfo | DialogMask::ButtonsOk );
233 return;
234 }
235
237 // search boxes via the layout
238 SwSelBoxes aBoxes;
239 GetTableSel( *this, aBoxes, SwTableSearchType::Col );
240
241 TableWait aWait( nCnt, pFrame, *GetDoc()->GetDocShell(), aBoxes.size() );
242
243 if( !aBoxes.empty() )
244 GetDoc()->InsertCol( aBoxes, nCnt, bBehind );
245
247}
248
249// Determines if the current cursor is in the last row of the table.
251{
252 SwTabCols aTabCols;
253 GetTabCols( aTabCols );
254 bool bResult = false;
255
256 if (IsTableRightToLeft())
257 /* If the table is right-to-left the last row is the most left one. */
258 bResult = 0 == GetCurTabColNum();
259 else
260 /* If the table is left-to-right the last row is the most right one. */
261 bResult = aTabCols.Count() == GetCurTabColNum();
262
263 return bResult;
264}
265
267{
268 // check if Point/Mark of current cursor are in a table
269 SwFrame *pFrame = GetCurrFrame();
270 if( !pFrame || !pFrame->IsInTab() )
271 return false;
272
273 if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
274 {
276 DialogMask::MessageInfo | DialogMask::ButtonsOk );
277 return false;
278 }
279
280 CurrShell aCurr( this );
281
282 // tracked deletion: remove only textbox content,
283 // and set IsNoTracked table box property to false
284 if ( GetDoc()->GetDocShell()->IsChangeRecording() )
285 {
288
289 if ( SwWrtShell* pWrtShell = dynamic_cast<SwWrtShell*>(this) )
290 pWrtShell->SelectTableCol();
291
292 // search boxes via the layout
293 SwSelBoxes aBoxes;
294 GetTableSel( *this, aBoxes, SwTableSearchType::Col );
295
296 TableWait aWait( 20, pFrame, *GetDoc()->GetDocShell(), aBoxes.size() );
297
298 for (size_t i = 0; i < aBoxes.size(); ++i)
299 {
300 SwTableBox *pBox = aBoxes[i];
301 if ( pBox->GetSttNd() )
302 {
303 SwNodeIndex aIdx( *pBox->GetSttNd(), 1 );
304 SwCursor aCursor( SwPosition(aIdx), nullptr );
305 SvxPrintItem aHasTextChangesOnly(RES_PRINT, false);
306 GetDoc()->SetBoxAttr( aCursor, aHasTextChangesOnly );
307
308 // add dummy text content to the empty box for change tracking
309 if ( pBox->IsEmpty() )
310 {
313 RedlineFlags eOld = rIDRA.GetRedlineFlags();
315 rIDCO.InsertString( aCursor, OUStringChar(CH_TXT_TRACKED_DUMMY_CHAR) );
316 aCursor.SetMark();
317 aCursor.GetMark()->SetContent(0);
318 rIDRA.SetRedlineFlags_intern( eOld );
319 rIDCO.DeleteAndJoin( aCursor );
320 }
321
322 }
323 }
324
325 SwEditShell* pEditShell = GetDoc()->GetEditShell();
326 SwRedlineTable::size_type nPrev = pEditShell->GetRedlineCount();
327 pEditShell->Delete();
328
331
332 // track column deletion only if there were tracked text changes
333 // FIXME redline count can be the same in special cases, e.g. adding a
334 // new tracked deletion with removing an own tracked insertion...
335 if ( nPrev != pEditShell->GetRedlineCount() )
336 return true;
337 }
338
340
341 // search boxes via the layout
342 bool bRet;
343 SwSelBoxes aBoxes;
345
346 // NewModel tables already ExpandColumnSelection, so don't do it here also.
347 const SwContentNode* pContentNd = getShellCursor(false)->GetPointNode().GetContentNode();
348 const SwTableNode* pTableNd = pContentNd ? pContentNd->FindTableNode() : nullptr;
349 if (pTableNd && pTableNd->GetTable().IsNewModel())
350 eSearchType = SwTableSearchType::NONE;
351
352 GetTableSel(*this, aBoxes, eSearchType);
353 if ( !aBoxes.empty() )
354 {
355 TableWait aWait( aBoxes.size(), pFrame, *GetDoc()->GetDocShell() );
356
357 // remove crsr from the deletion area.
358 // Put them behind/on the table; via the
359 // document position they will be put to the old position
360 while( !pFrame->IsCellFrame() )
361 pFrame = pFrame->GetUpper();
362
364
365 // then delete the column
369 }
370 else
371 bRet = false;
372
374 return bRet;
375}
376
378{
379 DeleteRow(true);
380}
381
382bool SwFEShell::DeleteRow(bool bCompleteTable)
383{
384 // check if Point/Mark of current cursor are in a table
385 SwFrame *pFrame = GetCurrFrame();
386 if( !pFrame || !pFrame->IsInTab() )
387 return false;
388
389 if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
390 {
392 DialogMask::MessageInfo | DialogMask::ButtonsOk );
393 return false;
394 }
395
396 CurrShell aCurr( this );
397
398 bool bRecordChanges = GetDoc()->GetDocShell()->IsChangeRecording();
399 bool bRecordAndHideChanges = bRecordChanges &&
401
402 // tracked deletion: all rows have already had tracked row change in the table selection
403 if ( bRecordChanges && !SwDoc::HasRowNotTracked( *getShellCursor( false ) ) )
404 return false;
405
406 if ( bRecordChanges )
408
410
411 // tracked deletion: remove only textbox content,
412 // and set HasTextChangesOnly table line property to false
413 if ( bRecordChanges )
414 {
415 SvxPrintItem aHasTextChangesOnly(RES_PRINT, false);
416 GetDoc()->SetRowNotTracked( *getShellCursor( false ), aHasTextChangesOnly );
417
418 if ( SwWrtShell* pWrtShell = dynamic_cast<SwWrtShell*>(this) )
419 pWrtShell->SelectTableRow();
420
421 // don't need to remove the row frames in Show Changes mode
422 if ( !bRecordAndHideChanges )
423 {
424 if (SwEditShell* pEditShell = GetDoc()->GetEditShell())
425 pEditShell->Delete(false);
426
429
430 return true;
431 }
432 }
433
434 // search for boxes via the layout
435 bool bRet;
436 SwSelBoxes aBoxes;
437 GetTableSel( *this, aBoxes, SwTableSearchType::Row );
438
439 if( !aBoxes.empty() )
440 {
441 TableWait aWait( aBoxes.size(), pFrame, *GetDoc()->GetDocShell() );
442
443 // Delete cursors from the deletion area.
444 // Then the cursor is:
445 // 1. the following row, if there is another row after this
446 // 2. the preceding row, if there is another row before this
447 // 3. otherwise below the table
448 {
449 SwTableNode* pTableNd = pFrame->IsTextFrame()
450 ? static_cast<SwTextFrame*>(pFrame)->GetTextNodeFirst()->FindTableNode()
451 : static_cast<SwNoTextFrame*>(pFrame)->GetNode()->FindTableNode();
452
453 // search all boxes / lines
454 FndBox_ aFndBox( nullptr, nullptr );
455 {
456 FndPara aPara( aBoxes, &aFndBox );
457 ForEach_FndLineCopyCol( pTableNd->GetTable().GetTabLines(), &aPara );
458 }
459
460 if( aFndBox.GetLines().empty() )
461 {
463 return false;
464 }
465
466 KillPams();
467
468 FndBox_* pFndBox = &aFndBox;
469 while( 1 == pFndBox->GetLines().size() &&
470 1 == pFndBox->GetLines().front()->GetBoxes().size())
471 {
472 FndBox_ *const pTmp = pFndBox->GetLines().front()->GetBoxes()[0].get();
473 if( pTmp->GetBox()->GetSttNd() )
474 break; // otherwise too far
475 pFndBox = pTmp;
476 }
477
478 SwTableLine* pDelLine = pFndBox->GetLines().back()->GetLine();
479 SwTableBox* pDelBox = pDelLine->GetTabBoxes().back();
480 while( !pDelBox->GetSttNd() )
481 {
482 SwTableLine* pLn = pDelBox->GetTabLines().back();
483 pDelBox = pLn->GetTabBoxes().back();
484 }
485 SwTableBox* pNextBox = pDelLine->FindNextBox( pTableNd->GetTable(),
486 pDelBox );
487 // skip deleted lines in Hide Changes mode with enabled change tracking
488 if ( bRecordAndHideChanges )
489 {
490 SwRedlineTable::size_type nRedlinePos = 0;
491 while( pNextBox && pNextBox->GetUpper()->IsDeleted(nRedlinePos) )
492 pNextBox = pNextBox->GetUpper()->FindNextBox( pTableNd->GetTable(),
493 pNextBox->GetUpper()->GetTabBoxes().back() );
494 }
495
496 // skip protected cells
497 while( pNextBox &&
499 pNextBox = pNextBox->FindNextBox( pTableNd->GetTable(), pNextBox );
500
501 if( !pNextBox ) // no next? then the previous
502 {
503 pDelLine = pFndBox->GetLines().front()->GetLine();
504 pDelBox = pDelLine->GetTabBoxes()[ 0 ];
505 while( !pDelBox->GetSttNd() )
506 pDelBox = pDelBox->GetTabLines()[0]->GetTabBoxes()[0];
507 pNextBox = pDelLine->FindPreviousBox( pTableNd->GetTable(),
508 pDelBox );
509 // skip previous deleted lines in Hide Changes mode with enabled change tracking
510 if ( bRecordAndHideChanges )
511 {
512 SwRedlineTable::size_type nRedlinePos = 0;
513 while( pNextBox && pNextBox->GetUpper()->IsDeleted(nRedlinePos) )
514 {
515 pNextBox = pNextBox->GetUpper()->FindPreviousBox( pTableNd->GetTable(),
516 pNextBox->GetUpper()->GetTabBoxes()[0] );
517 nRedlinePos = 0;
518 }
519 }
520
521 // skip previous protected cells
522 while( pNextBox &&
524 pNextBox = pNextBox->FindPreviousBox( pTableNd->GetTable(), pNextBox );
525 }
526
527 // delete row content in Hide Changes mode
528 if ( bRecordAndHideChanges )
529 {
530 SwEditShell* pEditShell = GetDoc()->GetEditShell();
531
532 // select the rows deleted with change tracking
533 if ( SwWrtShell* pWrtShell = dynamic_cast<SwWrtShell*>(this) )
534 {
535 pWrtShell->SelectTableRow();
536 SwShellTableCursor* pTableCursor = GetTableCursor();
537 auto pStt = aBoxes[0];
538 auto pEnd = aBoxes.back();
539 pTableCursor->DeleteMark();
540
541 // set start and end of the selection
542 pTableCursor->GetPoint()->Assign( *pEnd->GetSttNd()->EndOfSectionNode() );
543 pTableCursor->Move( fnMoveBackward, GoInContent );
544 pTableCursor->SetMark();
545 pTableCursor->GetPoint()->Assign( *pStt->GetSttNd()->EndOfSectionNode() );
546 pTableCursor->Move( fnMoveBackward, GoInContent );
547 pWrtShell->UpdateCursor();
548 }
549
550 if (pEditShell)
551 pEditShell->Delete(false);
552 }
553
554 SwNodeOffset nIdx;
555 if( pNextBox ) // put cursor here
556 nIdx = pNextBox->GetSttIdx() + 1;
557 else // otherwise below the table
558 nIdx = pTableNd->EndOfSectionIndex() + 1;
559
560 SwNodeIndex aIdx( GetDoc()->GetNodes(), nIdx );
561 SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
562 if( !pCNd )
563 pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
564
565 // remove row frames in Hide Changes mode (and table frames, if needed)
566 if ( bRecordAndHideChanges )
567 {
568 // remove all frames of the table, and make them again without the deleted ones
569 // TODO remove only the deleted frames
570 pTableNd->DelFrames();
571 if ( !pTableNd->GetTable().IsDeleted() )
572 {
573 pTableNd->MakeOwnFrames();
574 }
575
577
578 // put cursor
579 SwPaM* pPam = GetCursor();
580 pPam->GetPoint()->Assign( *pCNd, 0 );
581 pPam->SetMark(); // both want something
582 pPam->DeleteMark();
583 if ( SwWrtShell* pWrtShell = dynamic_cast<SwWrtShell*>(this) )
584 {
585 pWrtShell->UpdateCursor();
586 // tdf#150578 enable the disabled table toolbar by (zero) cursor moving
587 pWrtShell->Right( SwCursorSkipMode::Chars, false, 0, false );
588 }
589
591 return true;
592 }
593 else if( pCNd )
594 {
595 // put cursor
596 SwPaM* pPam = GetCursor();
597 pPam->GetPoint()->Assign( *pCNd, 0 );
598 pPam->SetMark(); // both want something
599 pPam->DeleteMark();
600 }
601 }
602
603 // now delete the lines
605 bRet = GetDoc()->DeleteRowCol( aBoxes );
607 }
608 else
609 bRet = false;
610
612 return bRet;
613}
614
616{
617 // check if Point/Mark of current cursor are in a table
619 if( IsTableMode() )
620 {
621 SwShellTableCursor* pTableCursor = GetTableCursor();
622 const SwTableNode* pTableNd = pTableCursor->GetPointNode().FindTableNode();
623 if( dynamic_cast< const SwDDETable* >(&pTableNd->GetTable()) != nullptr )
624 {
626 DialogMask::MessageInfo | DialogMask::ButtonsOk );
627 }
628 else
629 {
630 CurrShell aCurr( this );
632
633 TableWait aWait(pTableCursor->GetSelectedBoxesCount(), nullptr,
634 *GetDoc()->GetDocShell(),
635 pTableNd->GetTable().GetTabLines().size() );
636
637 nRet = GetDoc()->MergeTable( *pTableCursor );
638
639 KillPams();
640
642 }
643 }
644 return nRet;
645}
646
647void SwFEShell::SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight )
648{
649 // check if Point/Mark of current cursor are in a table
650 SwFrame *pFrame = GetCurrFrame();
651 if( !pFrame || !pFrame->IsInTab() )
652 return;
653
654 if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
655 {
657 DialogMask::MessageInfo | DialogMask::ButtonsOk );
658 return;
659 }
660
661 CurrShell aCurr( this );
662
663 if( bVert && !CheckSplitCells( *this, nCnt + 1, SwTableSearchType::NONE ) )
664 {
666 DialogMask::MessageInfo | DialogMask::ButtonsOk );
667 return;
668 }
670 // search boxes via the layout
671 SwSelBoxes aBoxes;
672 GetTableSel( *this, aBoxes );
673 if( !aBoxes.empty() )
674 {
675 TableWait aWait( nCnt, pFrame, *GetDoc()->GetDocShell(), aBoxes.size() );
676
677 // now delete the columns
678 GetDoc()->SplitTable( aBoxes, bVert, nCnt, bSameHeight );
679
680 ClearFEShellTabCols(*GetDoc(), nullptr);
681 }
683}
684
685void SwFEShell::GetTabCols_(SwTabCols &rToFill, const SwFrame *pBox) const
686{
687 const SwTabFrame *pTab = pBox->FindTabFrame();
688 if (m_pColumnCache)
689 {
690 bool bDel = true;
691 if (m_pColumnCache->pLastTable == pTab->GetTable())
692 {
693 bDel = false;
694 SwRectFnSet aRectFnSet(pTab);
695
696 const SwPageFrame* pPage = pTab->FindPageFrame();
697 const sal_uLong nLeftMin = aRectFnSet.GetLeft(pTab->getFrameArea()) -
698 aRectFnSet.GetLeft(pPage->getFrameArea());
699 const sal_uLong nRightMax = aRectFnSet.GetRight(pTab->getFrameArea()) -
700 aRectFnSet.GetLeft(pPage->getFrameArea());
701
702 if (m_pColumnCache->pLastTabFrame != pTab)
703 {
704 // if TabFrame was changed, we only shift a little bit
705 // as the width is the same
706 SwRectFnSet fnRectX(m_pColumnCache->pLastTabFrame);
707 if (fnRectX.GetWidth(m_pColumnCache->pLastTabFrame->getFrameArea()) ==
708 aRectFnSet.GetWidth(pTab->getFrameArea()) )
709 {
710 m_pColumnCache->pLastCols->SetLeftMin( nLeftMin );
711
712 m_pColumnCache->pLastTabFrame = pTab;
713 }
714 else
715 bDel = true;
716 }
717
718 if ( !bDel &&
719 m_pColumnCache->pLastCols->GetLeftMin () == o3tl::narrowing<sal_uInt16>(nLeftMin) &&
720 m_pColumnCache->pLastCols->GetLeft () == o3tl::narrowing<sal_uInt16>(aRectFnSet.GetLeft(pTab->getFramePrintArea())) &&
721 m_pColumnCache->pLastCols->GetRight () == o3tl::narrowing<sal_uInt16>(aRectFnSet.GetRight(pTab->getFramePrintArea()))&&
722 m_pColumnCache->pLastCols->GetRightMax() == o3tl::narrowing<sal_uInt16>(nRightMax) - m_pColumnCache->pLastCols->GetLeftMin() )
723 {
724 if (m_pColumnCache->pLastCellFrame != pBox)
725 {
726 pTab->GetTable()->GetTabCols( *m_pColumnCache->pLastCols,
727 static_cast<const SwCellFrame*>(pBox)->GetTabBox(), true);
728 m_pColumnCache->pLastCellFrame = pBox;
729 }
730 rToFill = *m_pColumnCache->pLastCols;
731 }
732 else
733 bDel = true;
734 }
735 if ( bDel )
736 m_pColumnCache.reset();
737 }
738 if (!m_pColumnCache)
739 {
740 SwDoc::GetTabCols( rToFill, static_cast<const SwCellFrame*>(pBox) );
741
742 m_pColumnCache.reset(new SwColCache);
743 m_pColumnCache->pLastCols.reset(new SwTabCols(rToFill));
744 m_pColumnCache->pLastTable = pTab->GetTable();
745 m_pColumnCache->pLastTabFrame = pTab;
746 m_pColumnCache->pLastCellFrame = pBox;
747 }
748}
749
750void SwFEShell::GetTabRows_(SwTabCols &rToFill, const SwFrame *pBox) const
751{
752 const SwTabFrame *pTab = pBox->FindTabFrame();
753 if (m_pRowCache)
754 {
755 bool bDel = true;
756 if (m_pRowCache->pLastTable == pTab->GetTable())
757 {
758 bDel = false;
759 SwRectFnSet aRectFnSet(pTab);
760 const SwPageFrame* pPage = pTab->FindPageFrame();
761 const tools::Long nLeftMin = ( aRectFnSet.IsVert() ?
762 pTab->GetPrtLeft() - pPage->getFrameArea().Left() :
763 pTab->GetPrtTop() - pPage->getFrameArea().Top() );
764 const tools::Long nLeft = aRectFnSet.IsVert() ? LONG_MAX : 0;
765 const tools::Long nRight = aRectFnSet.GetHeight(pTab->getFramePrintArea());
766 const tools::Long nRightMax = aRectFnSet.IsVert() ? nRight : LONG_MAX;
767
768 if (m_pRowCache->pLastTabFrame != pTab || m_pRowCache->pLastCellFrame != pBox)
769 bDel = true;
770
771 if ( !bDel &&
772 m_pRowCache->pLastCols->GetLeftMin () == nLeftMin &&
773 m_pRowCache->pLastCols->GetLeft () == nLeft &&
774 m_pRowCache->pLastCols->GetRight () == nRight &&
775 m_pRowCache->pLastCols->GetRightMax() == nRightMax )
776 {
777 rToFill = *m_pRowCache->pLastCols;
778 }
779 else
780 bDel = true;
781 }
782 if ( bDel )
783 m_pRowCache.reset();
784 }
785 if (!m_pRowCache)
786 {
787 SwDoc::GetTabRows( rToFill, static_cast<const SwCellFrame*>(pBox) );
788
789 m_pRowCache.reset(new SwColCache);
790 m_pRowCache->pLastCols.reset(new SwTabCols(rToFill));
791 m_pRowCache->pLastTable = pTab->GetTable();
792 m_pRowCache->pLastTabFrame = pTab;
793 m_pRowCache->pLastCellFrame = pBox;
794 }
795}
796
797void SwFEShell::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly )
798{
799 SwFrame *pBox = GetCurrFrame();
800 if( !pBox || !pBox->IsInTab() )
801 return;
802
803 CurrShell aCurr( this );
805
806 do
807 {
808 pBox = pBox->GetUpper();
809 } while (pBox && !pBox->IsCellFrame());
810
811 GetDoc()->SetTabCols( rNew, bCurRowOnly, static_cast<SwCellFrame*>(pBox) );
813}
814
815void SwFEShell::GetTabCols( SwTabCols &rToFill ) const
816{
817 const SwFrame *pFrame = GetCurrFrame();
818 if( !pFrame || !pFrame->IsInTab() )
819 return;
820 do
821 {
822 pFrame = pFrame->GetUpper();
823 }
824 while (pFrame && !pFrame->IsCellFrame());
825
826 if (!pFrame)
827 return;
828
829 GetTabCols_( rToFill, pFrame );
830}
831
832void SwFEShell::GetTabRows( SwTabCols &rToFill ) const
833{
834 const SwFrame *pFrame = GetCurrFrame();
835 if( !pFrame || !pFrame->IsInTab() )
836 return;
837 do
838 {
839 pFrame = pFrame->GetUpper();
840 } while (pFrame && !pFrame->IsCellFrame());
841
842 if (!pFrame)
843 return;
844
845 GetTabRows_( rToFill, pFrame );
846}
847
848void SwFEShell::SetTabRows( const SwTabCols &rNew, bool bCurColOnly )
849{
850 SwFrame *pBox = GetCurrFrame();
851 if( !pBox || !pBox->IsInTab() )
852 return;
853
854 CurrShell aCurr( this );
856
857 do
858 {
859 pBox = pBox->GetUpper();
860 } while (pBox && !pBox->IsCellFrame());
861
862 GetDoc()->SetTabRows( rNew, bCurColOnly, static_cast<SwCellFrame*>(pBox) );
864}
865
866void SwFEShell::GetMouseTabRows( SwTabCols &rToFill, const Point &rPt ) const
867{
868 const SwFrame *pBox = GetBox( rPt );
869 if ( pBox )
870 GetTabRows_( rToFill, pBox );
871}
872
873void SwFEShell::SetMouseTabRows( const SwTabCols &rNew, bool bCurColOnly, const Point &rPt )
874{
875 const SwFrame *pBox = GetBox( rPt );
876 if( pBox )
877 {
878 CurrShell aCurr( this );
880 GetDoc()->SetTabRows( rNew, bCurColOnly, static_cast<const SwCellFrame*>(pBox) );
882 }
883}
884
886{
887 CurrShell aCurr( this );
889 GetDoc()->SetRowSplit( *getShellCursor( false ), rNew );
891}
892
893std::unique_ptr<SwFormatRowSplit> SwFEShell::GetRowSplit() const
894{
895 return SwDoc::GetRowSplit( *getShellCursor( false ) );
896}
897
899{
900 CurrShell aCurr( this );
902 GetDoc()->SetRowHeight( *getShellCursor( false ), rNew );
904}
905
906std::unique_ptr<SwFormatFrameSize> SwFEShell::GetRowHeight() const
907{
908 return SwDoc::GetRowHeight( *getShellCursor( false ) );
909}
910
911bool SwFEShell::BalanceRowHeight( bool bTstOnly, const bool bOptimize )
912{
913 CurrShell aCurr( this );
914 if( !bTstOnly )
916 bool bRet = GetDoc()->BalanceRowHeight( *getShellCursor( false ), bTstOnly, bOptimize );
917 if( !bTstOnly )
919 return bRet;
920}
921
923{
924 CurrShell aCurr( this );
926 GetDoc()->SetRowBackground( *getShellCursor( false ), rNew );
928}
929
930bool SwFEShell::GetRowBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const
931{
932 return SwDoc::GetRowBackground( *getShellCursor( false ), rToFill );
933}
934
936{
937 CurrShell aCurr( this );
939 GetDoc()->SetTabBorders( *getShellCursor( false ), rSet );
941}
942
943void SwFEShell::SetTabLineStyle( const Color* pColor, bool bSetLine,
944 const editeng::SvxBorderLine* pBorderLine )
945{
946 CurrShell aCurr( this );
949 pColor, bSetLine, pBorderLine );
951}
952
954{
956}
957
959{
960 CurrShell aCurr( this );
962 GetDoc()->SetBoxAttr( *getShellCursor( false ), rNew );
964}
965
966bool SwFEShell::GetBoxBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const
967{
968 std::unique_ptr<SfxPoolItem> aTemp = std::move(rToFill);
969 bool bRetval(SwDoc::GetBoxAttr(*getShellCursor( false ), aTemp));
970 rToFill.reset(static_cast<SvxBrushItem*>(aTemp.release()));
971 return bRetval;
972}
973
975{
976 CurrShell aCurr( this );
978 GetDoc()->SetBoxAttr( *getShellCursor( false ), rNew );
980}
981
982bool SwFEShell::GetBoxDirection( std::unique_ptr<SvxFrameDirectionItem>& rToFill ) const
983{
984 std::unique_ptr<SfxPoolItem> aTemp = std::move(rToFill);
985 bool bRetval(SwDoc::GetBoxAttr(*getShellCursor( false ), aTemp));
986 rToFill.reset(static_cast<SvxFrameDirectionItem*>(aTemp.release()));
987 return bRetval;
988}
989
990void SwFEShell::SetBoxAlign( sal_uInt16 nAlign )
991{
992 CurrShell aCurr( this );
994 GetDoc()->SetBoxAlign( *getShellCursor( false ), nAlign );
996}
997
998sal_uInt16 SwFEShell::GetBoxAlign() const
999{
1000 return SwDoc::GetBoxAlign( *getShellCursor( false ) );
1001}
1002
1004{
1005 SwFrame *pFrame = GetCurrFrame();
1006 if( !pFrame || !pFrame->IsInTab() )
1007 return;
1008
1009 CurrShell aCurr( this );
1011 GetDoc()->SetAttr( rNew, *pFrame->ImplFindTabFrame()->GetFormat() );
1012 EndAllAction(); // no call, nothing changes!
1014}
1015
1016void SwFEShell::GetTabBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const
1017{
1018 SwFrame *pFrame = GetCurrFrame();
1019 if( pFrame && pFrame->IsInTab() )
1020 rToFill = pFrame->ImplFindTabFrame()->GetFormat()->makeBackgroundBrushItem();
1021}
1022
1024{
1025 // whole table selected?
1026 if ( IsTableMode() )
1027 {
1028 SwSelBoxes aBoxes;
1029 ::GetTableSelCrs( *this, aBoxes );
1030 if( !aBoxes.empty() )
1031 {
1032 const SwTableNode *pTableNd = IsCursorInTable();
1033 return pTableNd &&
1034 aBoxes[0]->GetSttIdx() - 1 == pTableNd->EndOfSectionNode()->StartOfSectionIndex() &&
1035 aBoxes.back()->GetSttNd()->EndOfSectionIndex() + 1 == pTableNd->EndOfSectionIndex();
1036 }
1037 }
1038 return false;
1039}
1040
1042{
1043 if(!IsCursorInTable())
1044 return false;
1045 // whole table selected?
1046 if( IsTableMode() )
1047 return true;
1048 SwPaM* pPam = GetCursor();
1049 // empty boxes are also selected as the absence of selection
1050 bool bChg = false;
1051 if( pPam->GetPoint() == pPam->End())
1052 {
1053 bChg = true;
1054 pPam->Exchange();
1055 }
1056 SwNode* pNd;
1057 if( pPam->GetPoint()->GetNodeIndex() -1 ==
1058 ( pNd = &pPam->GetPointNode())->StartOfSectionIndex() &&
1059 !pPam->GetPoint()->GetContentIndex() &&
1060 pPam->GetMark()->GetNodeIndex() + 1 ==
1061 pNd->EndOfSectionIndex())
1062 {
1063 SwNodeIndex aIdx( *pNd->EndOfSectionNode(), -1 );
1064 SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
1065 if( !pCNd )
1066 {
1067 pCNd = SwNodes::GoPrevious( &aIdx );
1068 assert(pCNd && "no ContentNode in box ??");
1069 }
1070 if( pPam->GetMark()->GetContentIndex() == pCNd->Len() )
1071 {
1072 if( bChg )
1073 pPam->Exchange();
1074 return true;
1075 }
1076 }
1077 if( bChg )
1078 pPam->Exchange();
1079 return false;
1080}
1081
1083{
1084 SvxProtectItem aProt( RES_PROTECT );
1085 aProt.SetContentProtect( true );
1086
1087 CurrShell aCurr( this );
1089
1090 GetDoc()->SetBoxAttr( *getShellCursor( false ), aProt );
1091
1092 if( !IsCursorReadonly() )
1093 {
1094 if( IsTableMode() )
1095 ClearMark();
1097 }
1099}
1100
1101// cancel table selection
1103{
1104 CurrShell aCurr( this );
1106
1107 SwSelBoxes aBoxes;
1108 if( IsTableMode() )
1109 ::GetTableSelCrs( *this, aBoxes );
1110 else
1111 {
1112 SwFrame *pFrame = GetCurrFrame();
1113 do {
1114 pFrame = pFrame->GetUpper();
1115 } while ( pFrame && !pFrame->IsCellFrame() );
1116 if( pFrame )
1117 {
1118 SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox());
1119 aBoxes.insert( pBox );
1120 }
1121 }
1122
1123 if( !aBoxes.empty() )
1124 GetDoc()->UnProtectCells( aBoxes );
1125
1127}
1128
1130{
1131 CurrShell aCurr( this );
1135}
1136
1137bool SwFEShell::HasTableAnyProtection( const OUString* pTableName,
1138 bool* pFullTableProtection )
1139{
1140 return GetDoc()->HasTableAnyProtection( GetCursor()->GetPoint(), pTableName,
1141 pFullTableProtection );
1142}
1143
1145{
1146 bool bUnProtectAvailable = false;
1147 const SwTableNode *pTableNd = IsCursorInTable();
1148 if( pTableNd && !pTableNd->IsProtect() )
1149 {
1150 SwSelBoxes aBoxes;
1151 if( IsTableMode() )
1152 ::GetTableSelCrs( *this, aBoxes );
1153 else
1154 {
1155 SwFrame *pFrame = GetCurrFrame();
1156 do {
1157 pFrame = pFrame->GetUpper();
1158 } while ( pFrame && !pFrame->IsCellFrame() );
1159 if( pFrame )
1160 {
1161 SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox());
1162 aBoxes.insert( pBox );
1163 }
1164 }
1165 if( !aBoxes.empty() )
1166 bUnProtectAvailable = ::HasProtectedCells( aBoxes );
1167 }
1168 return bUnProtectAvailable;
1169}
1170
1172{
1173 const SwFrame *pFrame = GetCurrFrame();
1174 const SwTabFrame *pTab = pFrame ? pFrame->FindTabFrame() : nullptr;
1175 if( pTab )
1176 return pTab->GetTable()->GetRowsToRepeat();
1177 return 0;
1178}
1179
1180void SwFEShell::SetRowsToRepeat( sal_uInt16 nSet )
1181{
1182 SwFrame *pFrame = GetCurrFrame();
1183 SwTabFrame *pTab = pFrame ? pFrame->FindTabFrame() : nullptr;
1184 if( pTab && pTab->GetTable()->GetRowsToRepeat() != nSet )
1185 {
1186 SwWait aWait( *GetDoc()->GetDocShell(), true );
1187 CurrShell aCurr( this );
1189 GetDoc()->SetRowsToRepeat( *pTab->GetTable(), nSet );
1191 }
1192}
1193
1194// returns the number of rows consecutively selected from top
1195static sal_uInt16 lcl_GetRowNumber( const SwPosition& rPos )
1196{
1197 Point aTmpPt;
1198 const SwContentNode *pNd;
1199 const SwContentFrame *pFrame;
1200
1201 std::pair<Point, bool> const tmp(aTmpPt, false);
1202 pNd = rPos.GetNode().GetContentNode();
1203 if( nullptr != pNd )
1204 pFrame = pNd->getLayoutFrame(pNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), &rPos, &tmp);
1205 else
1206 pFrame = nullptr;
1207
1208 const SwFrame* pRow = (pFrame && pFrame->IsInTab()) ? pFrame->GetUpper() : nullptr;
1209
1210 while (pRow && (!pRow->GetUpper() || !pRow->GetUpper()->IsTabFrame()))
1211 pRow = pRow->GetUpper();
1212
1213 if (!pRow)
1214 return USHRT_MAX;
1215
1216 const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>(pRow->GetUpper());
1217 const SwTableLine* pTabLine = static_cast<const SwRowFrame*>(pRow)->GetTabLine();
1218 sal_uInt16 nRet = USHRT_MAX;
1219 sal_uInt16 nI = 0;
1220 while ( sal::static_int_cast<SwTableLines::size_type>(nI) < pTabFrame->GetTable()->GetTabLines().size() )
1221 {
1222 if ( pTabFrame->GetTable()->GetTabLines()[ nI ] == pTabLine )
1223 {
1224 nRet = nI;
1225 break;
1226 }
1227 ++nI;
1228 }
1229
1230 return nRet;
1231}
1232
1234{
1235 sal_uInt16 nRet = 0;
1236 const SwPaM* pPaM = IsTableMode() ? GetTableCursor() : GetCursor_();
1237 const sal_uInt16 nPtLine = lcl_GetRowNumber( *pPaM->GetPoint() );
1238
1239 if ( !IsTableMode() )
1240 {
1241 nRet = 0 == nPtLine ? 1 : 0;
1242 }
1243 else
1244 {
1245 const sal_uInt16 nMkLine = lcl_GetRowNumber( *pPaM->GetMark() );
1246
1247 if ( ( nPtLine == 0 && nMkLine != USHRT_MAX ) ||
1248 ( nMkLine == 0 && nPtLine != USHRT_MAX ) )
1249 {
1250 nRet = std::max( nPtLine, nMkLine ) + 1;
1251 }
1252 }
1253
1254 return nRet;
1255}
1256
1257/*
1258 * 1. case: bRepeat = true
1259 * returns true if the current frame is located inside a table headline in
1260 * a follow frame
1261 *
1262 * 2. case: bRepeat = false
1263 * returns true if the current frame is located inside a table headline OR
1264 * inside the first line of a table!!!
1265 */
1266bool SwFEShell::CheckHeadline( bool bRepeat ) const
1267{
1268 bool bRet = false;
1269 if ( !IsTableMode() )
1270 {
1271 SwFrame *pFrame = GetCurrFrame(); // DONE MULTIIHEADER
1272 SwTabFrame* pTab = (pFrame && pFrame->IsInTab()) ? pFrame->FindTabFrame() : nullptr;
1273 if (pTab)
1274 {
1275 if ( bRepeat )
1276 {
1277 bRet = pTab->IsFollow() && pTab->IsInHeadline( *pFrame );
1278 }
1279 else
1280 {
1281 bRet = static_cast<SwLayoutFrame*>(pTab->Lower())->IsAnLower( pFrame ) ||
1282 pTab->IsInHeadline( *pFrame );
1283 }
1284 }
1285 }
1286 return bRet;
1287}
1288
1289void SwFEShell::AdjustCellWidth( const bool bBalance, const bool bNoShrink )
1290{
1291 CurrShell aCurr( this );
1293
1294 // switch on wait-cursor, as we do not know how
1295 // much content is affected
1296 TableWait aWait(std::numeric_limits<size_t>::max(), nullptr,
1297 *GetDoc()->GetDocShell());
1298
1299 GetDoc()->AdjustCellWidth( *getShellCursor( false ), bBalance, bNoShrink );
1301}
1302
1303bool SwFEShell::IsAdjustCellWidthAllowed( bool bBalance ) const
1304{
1305 // at least one row with content should be contained in the selection
1306
1307 SwFrame *pFrame = GetCurrFrame();
1308 if( !pFrame || !pFrame->IsInTab() )
1309 return false;
1310
1311 SwSelBoxes aBoxes;
1312 ::GetTableSelCrs( *this, aBoxes );
1313
1314 if ( bBalance )
1315 return aBoxes.size() > 1;
1316
1317 if ( aBoxes.empty() )
1318 {
1319 do
1320 {
1321 pFrame = pFrame->GetUpper();
1322 }
1323 while (pFrame && !pFrame->IsCellFrame());
1324
1325 if (!pFrame)
1326 return false;
1327
1328 SwTableBox *pBox = const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox());
1329 aBoxes.insert( pBox );
1330 }
1331
1332 for (size_t i = 0; i < aBoxes.size(); ++i)
1333 {
1334 SwTableBox *pBox = aBoxes[i];
1335 if ( pBox->GetSttNd() )
1336 {
1337 SwNodeIndex aIdx( *pBox->GetSttNd(), 1 );
1338 SwTextNode* pCNd = aIdx.GetNode().GetTextNode();
1339 if( !pCNd )
1340 pCNd = static_cast<SwTextNode*>(GetDoc()->GetNodes().GoNext( &aIdx ));
1341
1342 while ( pCNd )
1343 {
1344 if (!pCNd->GetText().isEmpty())
1345 return true;
1346 ++aIdx;
1347 pCNd = aIdx.GetNode().GetTextNode();
1348 }
1349 }
1350 }
1351 return false;
1352}
1353
1354void SwFEShell::SetTableStyle(const OUString& rStyleName)
1355{
1356 // make sure SwDoc has the style
1357 SwTableAutoFormat *pTableFormat = GetDoc()->GetTableStyles().FindAutoFormat(rStyleName);
1358 if (!pTableFormat)
1359 return;
1360
1361 SwTableNode *pTableNode = const_cast<SwTableNode*>(IsCursorInTable());
1362 if (!pTableNode)
1363 return;
1364
1365 // set the name & update
1366 UpdateTableStyleFormatting(pTableNode, false, &rStyleName);
1367}
1368
1369 // AutoFormat for the table/table selection
1371{
1372 // make sure SwDoc has the style
1373 GetDoc()->GetTableStyles().AddAutoFormat(rStyle);
1374
1375 SwTableNode *pTableNode = const_cast<SwTableNode*>(IsCursorInTable());
1376 if (!pTableNode)
1377 return false;
1378
1379 // set the name & update
1380 return UpdateTableStyleFormatting(pTableNode, false, &rStyle.GetName());
1381}
1382
1384 bool bResetDirect, OUString const*const pStyleName)
1385{
1386 if (!pTableNode)
1387 {
1388 pTableNode = const_cast<SwTableNode*>(IsCursorInTable());
1389 if (!pTableNode || pTableNode->GetTable().IsTableComplex())
1390 return false;
1391 }
1392
1393 OUString const aTableStyleName(pStyleName
1394 ? *pStyleName
1395 : pTableNode->GetTable().GetTableStyleName());
1396 SwTableAutoFormat* pTableStyle = GetDoc()->GetTableStyles().FindAutoFormat(aTableStyleName);
1397 if (!pTableStyle)
1398 return false;
1399
1400 SwSelBoxes aBoxes;
1401
1402 // whole table or only current selection
1403 if( IsTableMode() )
1404 ::GetTableSelCrs( *this, aBoxes );
1405 else
1406 {
1407 const SwTableSortBoxes& rTBoxes = pTableNode->GetTable().GetTabSortBoxes();
1408 for (size_t n = 0; n < rTBoxes.size(); ++n)
1409 {
1410 SwTableBox* pBox = rTBoxes[ n ];
1411 aBoxes.insert( pBox );
1412 }
1413 }
1414
1415 bool bRet;
1416 if( !aBoxes.empty() )
1417 {
1418 CurrShell aCurr( this );
1420 bRet = GetDoc()->SetTableAutoFormat(
1421 aBoxes, *pTableStyle, bResetDirect, pStyleName != nullptr);
1422 ClearFEShellTabCols(*GetDoc(), nullptr);
1424 }
1425 else
1426 bRet = false;
1427 return bRet;
1428}
1429
1431{
1432 const SwTableNode *pTableNd = IsCursorInTable();
1433 if( !pTableNd || pTableNd->GetTable().IsTableComplex() )
1434 return false;
1435
1436 SwSelBoxes aBoxes;
1437
1438 if ( !IsTableMode() ) // if cursor are not current
1439 GetCursor();
1440
1441 // whole table or only current selection
1442 if( IsTableMode() )
1443 ::GetTableSelCrs( *this, aBoxes );
1444 else
1445 {
1446 const SwTableSortBoxes& rTBoxes = pTableNd->GetTable().GetTabSortBoxes();
1447 for (size_t n = 0; n < rTBoxes.size(); ++n)
1448 {
1449 SwTableBox* pBox = rTBoxes[ n ];
1450 aBoxes.insert( pBox );
1451 }
1452 }
1453
1454 return GetDoc()->GetTableAutoFormat( aBoxes, rGet );
1455}
1456
1458{
1459 // check if SPoint/Mark of current cursor are in a table
1460 SwFrame *pFrame = GetCurrFrame();
1461 if( !pFrame || !pFrame->IsInTab() )
1462 return false;
1463
1464 if( dynamic_cast< const SwDDETable* >(pFrame->ImplFindTabFrame()->GetTable()) != nullptr )
1465 {
1467 DialogMask::MessageInfo | DialogMask::ButtonsOk );
1468 return false;
1469 }
1470
1471 CurrShell aCurr( this );
1473
1474 // search boxes via the layout
1475 bool bRet;
1476 SwSelBoxes aBoxes;
1477 GetTableSelCrs( *this, aBoxes );
1478 if( !aBoxes.empty() )
1479 {
1480 TableWait aWait( aBoxes.size(), pFrame, *GetDoc()->GetDocShell() );
1481
1482 // cursor should be removed from deletion area.
1483 // Put them behind/on the table; via the document
1484 // position they'll be set to the old position
1485 while( !pFrame->IsCellFrame() )
1486 pFrame = pFrame->GetUpper();
1487 ParkCursor( *static_cast<SwCellFrame*>(pFrame)->GetTabBox()->GetSttNd() );
1488
1489 bRet = GetDoc()->DeleteRowCol( aBoxes );
1490
1491 ClearFEShellTabCols(*GetDoc(), nullptr);
1492 }
1493 else
1494 bRet = false;
1496 return bRet;
1497}
1498
1500{
1502 SwFrame *pFrame = GetCurrFrame();
1503 OSL_ENSURE( pFrame, "Cursor parked?" );
1504
1505 // check if SPoint/Mark of current cursor are in a table
1506 if (!pFrame || !pFrame->IsInTab())
1507 return 0;
1508
1509 do
1510 {
1511 // JP 26.09.95: why compare with ContentFrame
1512 // and not with CellFrame ????
1513 pFrame = pFrame->GetUpper();
1514 } while (pFrame && !pFrame->IsCellFrame());
1515
1516 if (!pFrame)
1517 return 0;
1518
1519 size_t nRet = 0;
1520
1521 SwRectFnSet aRectFnSet(pFrame);
1522
1523 const SwPageFrame* pPage = pFrame->FindPageFrame();
1524
1525 // get TabCols, as only via these we get to the position
1526 SwTabCols aTabCols;
1527 GetTabCols( aTabCols );
1528
1529 if( pFrame->FindTabFrame()->IsRightToLeft() )
1530 {
1531 tools::Long nX = aRectFnSet.GetRight(pFrame->getFrameArea()) - aRectFnSet.GetLeft(pPage->getFrameArea());
1532
1533 const tools::Long nRight = aTabCols.GetLeftMin() + aTabCols.GetRight();
1534
1535 if ( !::IsSame( nX, nRight ) )
1536 {
1537 nX = nRight - nX + aTabCols.GetLeft();
1538 for ( size_t i = 0; i < aTabCols.Count(); ++i )
1539 if ( ::IsSame( nX, aTabCols[i] ) )
1540 {
1541 nRet = i + 1;
1542 break;
1543 }
1544 }
1545 }
1546 else
1547 {
1548 const tools::Long nX = aRectFnSet.GetLeft(pFrame->getFrameArea()) -
1549 aRectFnSet.GetLeft(pPage->getFrameArea());
1550
1551 const tools::Long nLeft = aTabCols.GetLeftMin();
1552
1553 if ( !::IsSame( nX, nLeft + aTabCols.GetLeft() ) )
1554 {
1555 for ( size_t i = 0; i < aTabCols.Count(); ++i )
1556 if ( ::IsSame( nX, nLeft + aTabCols[i] ) )
1557 {
1558 nRet = i + 1;
1559 break;
1560 }
1561 }
1562 }
1563 return nRet;
1564}
1565
1566static const SwFrame *lcl_FindFrameInTab( const SwLayoutFrame *pLay, const Point &rPt, SwTwips nFuzzy )
1567{
1568 const SwFrame *pFrame = pLay->Lower();
1569
1570 while( pFrame && pLay->IsAnLower( pFrame ) )
1571 {
1572 if ( pFrame->getFrameArea().IsNear( rPt, nFuzzy ) )
1573 {
1574 if ( pFrame->IsLayoutFrame() )
1575 {
1576 const SwFrame *pTmp = ::lcl_FindFrameInTab( static_cast<const SwLayoutFrame*>(pFrame), rPt, nFuzzy );
1577 if ( pTmp )
1578 return pTmp;
1579 }
1580
1581 return pFrame;
1582 }
1583
1584 pFrame = pFrame->FindNext();
1585 }
1586
1587 return nullptr;
1588}
1589
1590static const SwCellFrame *lcl_FindFrame( const SwLayoutFrame *pLay, const Point &rPt,
1591 SwTwips nFuzzy, bool* pbRow, bool* pbCol )
1592{
1593 // bMouseMoveRowCols :
1594 // Method is called for
1595 // - Moving columns/rows with the mouse or
1596 // - Enhanced table selection
1597 const bool bMouseMoveRowCols = nullptr == pbCol;
1598
1599 bool bCloseToRow = false;
1600 bool bCloseToCol = false;
1601
1602 const SwFrame *pFrame = pLay->ContainsContent();
1603 const SwFrame* pRet = nullptr;
1604
1605 if ( pFrame )
1606 {
1607 do
1608 {
1609 if ( pFrame->IsInTab() )
1610 pFrame = const_cast<SwFrame*>(pFrame)->ImplFindTabFrame();
1611
1612 if (!pFrame)
1613 break;
1614
1615 if ( pFrame->IsTabFrame() )
1616 {
1617 Point aPt( rPt );
1618 bool bSearchForFrameInTab = true;
1619 SwTwips nTmpFuzzy = nFuzzy;
1620
1621 if ( !bMouseMoveRowCols )
1622 {
1623 // We ignore nested tables for the enhanced table selection:
1624 while ( pFrame->GetUpper()->IsInTab() )
1625 pFrame = pFrame->GetUpper()->FindTabFrame();
1626
1627 // We first check if the given point is 'close' to the left or top
1628 // border of the table frame:
1629 OSL_ENSURE( pFrame, "Nested table frame without outer table" );
1630 SwRectFnSet aRectFnSet(pFrame);
1631 const bool bRTL = pFrame->IsRightToLeft();
1632
1633 SwRect aTabRect = pFrame->getFramePrintArea();
1634 aTabRect.Pos() += pFrame->getFrameArea().Pos();
1635
1636 const SwTwips nLeft = bRTL ?
1637 aRectFnSet.GetRight(aTabRect) :
1638 aRectFnSet.GetLeft(aTabRect);
1639 const SwTwips nTop = aRectFnSet.GetTop(aTabRect);
1640
1641 SwTwips const rPointX = aRectFnSet.IsVert() ? aPt.Y() : aPt.X();
1642 SwTwips const rPointY = aRectFnSet.IsVert() ? aPt.X() : aPt.Y();
1643
1644 const SwTwips nXDiff = aRectFnSet.XDiff( nLeft, rPointX ) * ( bRTL ? -1 : 1 );
1645 const SwTwips nYDiff = aRectFnSet.YDiff( nTop, rPointY );
1646
1647 bCloseToRow = nXDiff >= 0 && nXDiff < nFuzzy;
1648 bCloseToCol = nYDiff >= 0 && nYDiff < nFuzzy;
1649
1650 if ( bCloseToCol && 2 * nYDiff > nFuzzy )
1651 {
1652 const SwFrame* pPrev = pFrame->GetPrev();
1653 if ( pPrev )
1654 {
1655 SwRect aPrevRect = pPrev->getFramePrintArea();
1656 aPrevRect.Pos() += pPrev->getFrameArea().Pos();
1657
1658 if( aPrevRect.Contains( rPt ) )
1659 {
1660 bCloseToCol = false;
1661 }
1662 }
1663
1664 }
1665
1666 // If we found the point to be 'close' to the left or top border
1667 // of the table frame, we adjust the point to be on that border:
1668 if ( bCloseToRow && bCloseToCol )
1669 aPt = bRTL ? aTabRect.TopRight() : aRectFnSet.GetPos(aTabRect);
1670 else if ( bCloseToRow )
1671 aRectFnSet.IsVert() ? aPt.setY(nLeft) : aPt.setX(nLeft);
1672 else if ( bCloseToCol )
1673 aRectFnSet.IsVert() ? aPt.setX(nTop) : aPt.setY(nTop);
1674
1675 if ( !bCloseToRow && !bCloseToCol )
1676 bSearchForFrameInTab = false;
1677
1678 // Since the point has been adjusted, we call lcl_FindFrameInTab()
1679 // with a fuzzy value of 1:
1680 nTmpFuzzy = 1;
1681 }
1682
1683 const SwFrame* pTmp = bSearchForFrameInTab ?
1684 ::lcl_FindFrameInTab( static_cast<const SwLayoutFrame*>(pFrame), aPt, nTmpFuzzy ) :
1685 nullptr;
1686
1687 if ( pTmp )
1688 {
1689 pFrame = pTmp;
1690 break;
1691 }
1692 }
1693 pFrame = pFrame->FindNextCnt();
1694
1695 } while ( pFrame && pLay->IsAnLower( pFrame ) );
1696 }
1697
1698 if ( pFrame && pFrame->IsInTab() && pLay->IsAnLower( pFrame ) )
1699 {
1700 do
1701 {
1702 // We allow mouse drag of table borders within nested tables,
1703 // but disallow hotspot selection of nested tables.
1704 if ( bMouseMoveRowCols )
1705 {
1706 // find the next cell frame
1707 while ( pFrame && !pFrame->IsCellFrame() )
1708 pFrame = pFrame->GetUpper();
1709 }
1710 else
1711 {
1712 // find the most upper cell frame:
1713 while ( pFrame &&
1714 ( !pFrame->IsCellFrame() ||
1715 !pFrame->GetUpper()->GetUpper()->IsTabFrame() ||
1716 pFrame->GetUpper()->GetUpper()->GetUpper()->IsInTab() ) )
1717 pFrame = pFrame->GetUpper();
1718 }
1719
1720 if ( pFrame ) // Note: this condition should be the same like the while condition!!!
1721 {
1722 // #i32329# Enhanced table selection
1723 // used for hotspot selection of tab/cols/rows
1724 if ( !bMouseMoveRowCols )
1725 {
1726
1727 OSL_ENSURE( pbCol && pbRow, "pbCol or pbRow missing" );
1728
1729 if ( bCloseToRow || bCloseToCol )
1730 {
1731 *pbRow = bCloseToRow;
1732 *pbCol = bCloseToCol;
1733 pRet = pFrame;
1734 break;
1735 }
1736 }
1737 else
1738 {
1739 // used for mouse move of columns/rows
1740 const SwTabFrame* pTabFrame = pFrame->FindTabFrame();
1741 SwRect aTabRect = pTabFrame->getFramePrintArea();
1742 aTabRect.Pos() += pTabFrame->getFrameArea().Pos();
1743
1744 SwRectFnSet aRectFnSet(pTabFrame);
1745
1746 const SwTwips nTabTop = aRectFnSet.GetTop(aTabRect);
1747 const SwTwips nMouseTop = aRectFnSet.IsVert() ? rPt.X() : rPt.Y();
1748
1749 // Do not allow to drag upper table border:
1750 if ( !::IsSame( nTabTop, nMouseTop ) )
1751 {
1752 if ( ::IsSame( pFrame->getFrameArea().Left(), rPt.X() ) ||
1753 ::IsSame( pFrame->getFrameArea().Right(),rPt.X() ) )
1754 {
1755 if ( pbRow ) *pbRow = false;
1756 pRet = pFrame;
1757 break;
1758 }
1759 if ( ::IsSame( pFrame->getFrameArea().Top(), rPt.Y() ) ||
1760 ::IsSame( pFrame->getFrameArea().Bottom(),rPt.Y() ) )
1761 {
1762 if ( pbRow ) *pbRow = true;
1763 pRet = pFrame;
1764 break;
1765 }
1766 }
1767 }
1768
1769 pFrame = pFrame->GetUpper();
1770 }
1771 } while ( pFrame );
1772 }
1773
1774 // robust:
1775 OSL_ENSURE( !pRet || pRet->IsCellFrame(), "lcl_FindFrame() is supposed to find a cell frame!" );
1776 return pRet && pRet->IsCellFrame() ? static_cast<const SwCellFrame*>(pRet) : nullptr;
1777}
1778
1779// pbCol = 0 => Used for moving table rows/cols with mouse
1780// pbCol != 0 => Used for selecting table/rows/cols
1781
1782#define ENHANCED_TABLE_SELECTION_FUZZY 10
1783
1784const SwFrame* SwFEShell::GetBox( const Point &rPt, bool* pbRow, bool* pbCol ) const
1785{
1786 const SwPageFrame *pPage = static_cast<SwPageFrame*>(GetLayout()->Lower());
1787 vcl::Window* pOutWin = GetWin();
1788 SwTwips nFuzzy = COLFUZZY;
1789 if( pOutWin )
1790 {
1791 // #i32329# Enhanced table selection
1793 Size aTmp( nSize, nSize );
1794 aTmp = pOutWin->PixelToLogic( aTmp );
1795 nFuzzy = aTmp.Width();
1796 }
1797
1798 while ( pPage && !pPage->getFrameArea().IsNear( rPt, nFuzzy ) )
1799 pPage = static_cast<const SwPageFrame*>(pPage->GetNext());
1800
1801 const SwCellFrame *pFrame = nullptr;
1802 if ( pPage )
1803 {
1804 // We cannot search the box by GetModelPositionForViewPoint or GetContentPos.
1805 // This would lead to a performance collapse for documents
1806 // with a lot of paragraphs/tables on one page
1807 //(BrowseMode!)
1808
1809 // check flys first
1810 if ( pPage->GetSortedObjs() )
1811 {
1812 for ( size_t i = 0; !pFrame && i < pPage->GetSortedObjs()->size(); ++i )
1813 {
1814 SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i];
1815 if ( auto pFlyFrame = pObj->DynCastFlyFrame() )
1816 {
1817 pFrame = lcl_FindFrame( pFlyFrame, rPt, nFuzzy, pbRow, pbCol );
1818 }
1819 }
1820 }
1821 const SwLayoutFrame *pLay = static_cast<const SwLayoutFrame*>(pPage->Lower());
1822 while ( pLay && !pFrame )
1823 {
1824 pFrame = lcl_FindFrame( pLay, rPt, nFuzzy, pbRow, pbCol );
1825 pLay = static_cast<const SwLayoutFrame*>(pLay->GetNext());
1826 }
1827 }
1828 return pFrame;
1829}
1830
1831/* Helper function*/
1832/* calculated the distance between Point rC and Line Segment (rA, rB) */
1833static double lcl_DistancePoint2Segment( const Point& rA, const Point& rB, const Point& rC )
1834{
1835 double nRet = 0;
1836
1837 const basegfx::B2DVector aBC( rC.X() - rB.X(), rC.Y() - rB.Y() );
1838 const basegfx::B2DVector aAB( rB.X() - rA.X(), rB.Y() - rA.Y() );
1839 const double nDot1 = aBC.scalar( aAB );
1840
1841 if ( nDot1 > 0 ) // check outside case 1
1842 nRet = aBC.getLength();
1843 else
1844 {
1845 const basegfx::B2DVector aAC( rC.X() - rA.X(), rC.Y() - rA.Y() );
1846 const basegfx::B2DVector aBA( rA.X() - rB.X(), rA.Y() - rB.Y() );
1847 const double nDot2 = aAC.scalar( aBA );
1848
1849 if ( nDot2 > 0 ) // check outside case 2
1850 nRet = aAC.getLength();
1851 else
1852 {
1853 const double nDiv = aAB.getLength();
1854 nRet = nDiv ? aAB.cross( aAC ) / nDiv : 0;
1855 }
1856 }
1857
1858 return std::abs(nRet);
1859}
1860
1861/* Helper function*/
1862static Point lcl_ProjectOntoClosestTableFrame( const SwTabFrame& rTab, const Point& rPoint, bool bRowDrag )
1863{
1864 Point aRet( rPoint );
1865 const SwTabFrame* pCurrentTab = &rTab;
1866 const bool bVert = pCurrentTab->IsVertical();
1867 const bool bRTL = pCurrentTab->IsRightToLeft();
1868
1869 // Western Layout:
1870 // bRowDrag = true => compare to left border of table
1871 // bRowDrag = false => compare to top border of table
1872
1873 // Asian Layout:
1874 // bRowDrag = true => compare to right border of table
1875 // bRowDrag = false => compare to top border of table
1876
1877 // RTL Layout:
1878 // bRowDrag = true => compare to right border of table
1879 // bRowDrag = false => compare to top border of table
1880 bool bLeft = false;
1881 bool bRight = false;
1882
1883 if ( bRowDrag )
1884 {
1885 if ( bVert || bRTL )
1886 bRight = true;
1887 else
1888 bLeft = true;
1889 }
1890
1891 // used to find the minimal distance
1892 double nMin = -1;
1893 Point aMin1;
1894 Point aMin2;
1895
1896 Point aS1;
1897 Point aS2;
1898
1899 while ( pCurrentTab )
1900 {
1901 SwRect aTabRect( pCurrentTab->getFramePrintArea() );
1902 aTabRect += pCurrentTab->getFrameArea().Pos();
1903
1904 if ( bLeft )
1905 {
1906 // distance to left table border
1907 aS1 = aTabRect.TopLeft();
1908 aS2 = aTabRect.BottomLeft();
1909 }
1910 else if ( bRight )
1911 {
1912 // distance to right table border
1913 aS1 = aTabRect.TopRight();
1914 aS2 = aTabRect.BottomRight();
1915 }
1916 else //if ( bTop )
1917 {
1918 // distance to top table border
1919 aS1 = aTabRect.TopLeft();
1920 aS2 = aTabRect.TopRight();
1921 }
1922
1923 const double nDist = lcl_DistancePoint2Segment( aS1, aS2, rPoint );
1924
1925 if ( nDist < nMin || -1 == nMin )
1926 {
1927 aMin1 = aS1;
1928 aMin2 = aS2;
1929 nMin = nDist;
1930 }
1931
1932 pCurrentTab = pCurrentTab->GetFollow();
1933 }
1934
1935 // project onto closest line:
1936 if ( bLeft || bRight )
1937 {
1938 aRet.setX(aMin1.getX());
1939 if ( aRet.getY() > aMin2.getY() )
1940 aRet.setY(aMin2.getY());
1941 else if ( aRet.getY() < aMin1.getY() )
1942 aRet.setY(aMin1.getY());
1943 }
1944 else
1945 {
1946 aRet.setY(aMin1.getY());
1947 if ( aRet.getX() > aMin2.getX() )
1948 aRet.setX(aMin2.getX());
1949 else if ( aRet.getX() < aMin1.getX() )
1950 aRet.setX(aMin1.getX());
1951 }
1952
1953 return aRet;
1954}
1955
1956// #i32329# Enhanced table selection
1957bool SwFEShell::SelTableRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag )
1958{
1959 bool bRet = false;
1960 Point aEndPt;
1961 if ( pEnd )
1962 aEndPt = *pEnd;
1963
1964 SwPosition* ppPos[2] = { nullptr, nullptr };
1965 Point paPt [2] = { rPt, aEndPt };
1966 bool pbRow[2] = { false, false };
1967 bool pbCol[2] = { false, false };
1968
1969 // pEnd is set during dragging.
1970 for ( sal_uInt16 i = 0; i < ( pEnd ? 2 : 1 ); ++i )
1971 {
1972 const SwCellFrame* pFrame =
1973 static_cast<const SwCellFrame*>(GetBox( paPt[i], &pbRow[i], &pbCol[i] ) );
1974
1975 if( pFrame )
1976 {
1977 while( pFrame && pFrame->Lower() && pFrame->Lower()->IsRowFrame() )
1978 pFrame = static_cast<const SwCellFrame*>( static_cast<const SwLayoutFrame*>( pFrame->Lower() )->Lower() );
1979 if( pFrame && pFrame->GetTabBox()->GetSttNd() &&
1980 pFrame->GetTabBox()->GetSttNd()->IsInProtectSect() )
1981 pFrame = nullptr;
1982 }
1983
1984 if ( pFrame )
1985 {
1986 const SwContentFrame* pContent = ::GetCellContent( *pFrame );
1987
1988 if ( pContent && pContent->IsTextFrame() )
1989 {
1990
1991 ppPos[i] = new SwPosition(static_cast<SwTextFrame const*>(pContent)->MapViewToModelPos(TextFrameIndex(0)));
1992
1993 // paPt[i] will not be used any longer, now we use it to store
1994 // a position inside the content frame
1995 paPt[i] = pContent->getFrameArea().Center();
1996 }
1997 }
1998
1999 // no calculation of end frame if start frame has not been found.
2000 if ( 1 == i || !ppPos[0] || !pEnd || !pFrame )
2001 break;
2002
2003 // find 'closest' table frame to pEnd:
2004 const SwTabFrame* pCurrentTab = pFrame->FindTabFrame();
2005 if ( pCurrentTab->IsFollow() )
2006 pCurrentTab = pCurrentTab->FindMaster( true );
2007
2008 const Point aProjection = lcl_ProjectOntoClosestTableFrame( *pCurrentTab, *pEnd, bRowDrag );
2009 paPt[1] = aProjection;
2010 }
2011
2012 if ( ppPos[0] )
2013 {
2014 SwShellCursor* pCursor = GetCursor_();
2015 SwCursorSaveState aSaveState( *pCursor );
2016 SwPosition aOldPos( *pCursor->GetPoint() );
2017
2018 pCursor->DeleteMark();
2019 *pCursor->GetPoint() = *ppPos[0];
2020 pCursor->GetPtPos() = paPt[0];
2021
2022 if ( !pCursor->IsInProtectTable() )
2023 {
2024 bool bNewSelection = true;
2025
2026 if ( ppPos[1] )
2027 {
2028 if ( ppPos[1]->GetNode().StartOfSectionNode() !=
2029 aOldPos.GetNode().StartOfSectionNode() )
2030 {
2031 pCursor->SetMark();
2032 SwCursorSaveState aSaveState2( *pCursor );
2033 *pCursor->GetPoint() = *ppPos[1];
2034 pCursor->GetPtPos() = paPt[1];
2035
2036 if ( pCursor->IsInProtectTable( false, false ) )
2037 {
2038 pCursor->RestoreSavePos();
2039 bNewSelection = false;
2040 }
2041 }
2042 else
2043 {
2044 pCursor->RestoreSavePos();
2045 bNewSelection = false;
2046 }
2047 }
2048
2049 if ( bNewSelection )
2050 {
2051 // #i35543# SelTableRowCol should remove any existing
2052 // table cursor:
2053 if ( IsTableMode() )
2055
2056 if ( pbRow[0] && pbCol[0] )
2057 bRet = SwCursorShell::SelTable();
2058 else if ( pbRow[0] )
2059 bRet = SwCursorShell::SelTableRowOrCol( true, true );
2060 else if ( pbCol[0] )
2061 bRet = SwCursorShell::SelTableRowOrCol( false, true );
2062 }
2063 else
2064 bRet = true;
2065 }
2066
2067 delete ppPos[0];
2068 delete ppPos[1];
2069 }
2070
2071 return bRet;
2072}
2073
2075{
2076 SwTab nRet = SwTab::COL_NONE;
2077 bool bRow = false;
2078 bool bCol = false;
2079 bool bSelect = false;
2080
2081 // First try: Do we get the row/col move cursor?
2082 const SwCellFrame* pFrame = static_cast<const SwCellFrame*>(GetBox( rPt, &bRow ));
2083
2084 if ( !pFrame )
2085 {
2086 // Second try: Do we get the row/col/tab selection cursor?
2087 pFrame = static_cast<const SwCellFrame*>(GetBox( rPt, &bRow, &bCol ));
2088 bSelect = true;
2089 }
2090
2091 if( pFrame )
2092 {
2093 while( pFrame && pFrame->Lower() && pFrame->Lower()->IsRowFrame() )
2094 pFrame = static_cast<const SwCellFrame*>(static_cast<const SwLayoutFrame*>(pFrame->Lower())->Lower());
2095 if( pFrame && pFrame->GetTabBox()->GetSttNd() &&
2096 pFrame->GetTabBox()->GetSttNd()->IsInProtectSect() )
2097 pFrame = nullptr;
2098 }
2099
2100 if( pFrame )
2101 {
2102 if ( !bSelect )
2103 {
2104 if ( pFrame->IsVertical() )
2105 nRet = bRow ? SwTab::COL_VERT : SwTab::ROW_VERT;
2106 else
2107 nRet = bRow ? SwTab::ROW_HORI : SwTab::COL_HORI;
2108 }
2109 else
2110 {
2111 const SwTabFrame* pTabFrame = pFrame->FindTabFrame();
2112 if ( pTabFrame->IsVertical() )
2113 {
2114 if ( bRow && bCol )
2115 {
2116 nRet = SwTab::SEL_VERT;
2117 }
2118 else if ( bRow )
2119 {
2120 nRet = SwTab::ROWSEL_VERT;
2121 }
2122 else if ( bCol )
2123 {
2124 nRet = SwTab::COLSEL_VERT;
2125 }
2126 }
2127 else
2128 {
2129 if ( bRow && bCol )
2130 {
2131 nRet = pTabFrame->IsRightToLeft() ?
2134 }
2135 else if ( bRow )
2136 {
2137 nRet = pTabFrame->IsRightToLeft() ?
2140 }
2141 else if ( bCol )
2142 {
2143 nRet = SwTab::COLSEL_HORI;
2144 }
2145 }
2146 }
2147 }
2148
2149 return nRet;
2150}
2151
2152// -> #i23726#
2154{
2155 SwTextNode * pResult = nullptr;
2156
2158
2159 if( GetContentAtPos(rPt, aContentAtPos) && aContentAtPos.aFnd.pNode)
2160 pResult = aContentAtPos.aFnd.pNode->GetTextNode();
2161
2162 return pResult;
2163}
2164
2165bool SwFEShell::IsNumLabel( const Point &rPt, int nMaxOffset )
2166{
2167 bool bResult = false;
2168
2170
2171 if( GetContentAtPos(rPt, aContentAtPos))
2172 {
2173 if ((nMaxOffset >= 0 && aContentAtPos.nDist <= nMaxOffset) ||
2174 (nMaxOffset < 0))
2175 bResult = true;
2176 }
2177
2178 return bResult;
2179}
2180// <- #i23726#
2181
2182// #i42921#
2184 const Point& _rDocPos )
2185{
2186 bool bRet( false );
2187
2188 const SvxFrameDirection nTextDir =
2189 _rTextNode.GetTextDirection( SwPosition(_rTextNode), &_rDocPos );
2190 switch ( nTextDir )
2191 {
2192 case SvxFrameDirection::Unknown:
2193 case SvxFrameDirection::Horizontal_RL_TB:
2194 case SvxFrameDirection::Horizontal_LR_TB:
2195 {
2196 bRet = false;
2197 }
2198 break;
2199 case SvxFrameDirection::Vertical_LR_TB:
2200 case SvxFrameDirection::Vertical_RL_TB:
2201 {
2202 bRet = true;
2203 }
2204 break;
2205 default: break;
2206 }
2207
2208 return bRet;
2209}
2210
2211void SwFEShell::GetMouseTabCols( SwTabCols &rToFill, const Point &rPt ) const
2212{
2213 const SwFrame *pBox = GetBox( rPt );
2214 if ( pBox )
2215 GetTabCols_( rToFill, pBox );
2216}
2217
2218void SwFEShell::SetMouseTabCols( const SwTabCols &rNew, bool bCurRowOnly,
2219 const Point &rPt )
2220{
2221 const SwFrame *pBox = GetBox( rPt );
2222 if( pBox )
2223 {
2224 CurrShell aCurr( this );
2226 GetDoc()->SetTabCols( rNew, bCurRowOnly, static_cast<const SwCellFrame*>(pBox) );
2228 }
2229}
2230
2231sal_uInt16 SwFEShell::GetCurMouseColNum( const Point &rPt ) const
2232{
2233 return GetCurColNum_( GetBox( rPt ), nullptr );
2234}
2235
2236size_t SwFEShell::GetCurMouseTabColNum( const Point &rPt ) const
2237{
2239 size_t nRet = 0;
2240
2241 const SwFrame *pFrame = GetBox( rPt );
2242 OSL_ENSURE( pFrame, "Table not found" );
2243 if( pFrame )
2244 {
2245 const tools::Long nX = pFrame->getFrameArea().Left();
2246
2247 // get TabCols, only via these we get the position
2248 SwTabCols aTabCols;
2249 GetMouseTabCols( aTabCols, rPt );
2250
2251 const tools::Long nLeft = aTabCols.GetLeftMin();
2252
2253 if ( !::IsSame( nX, nLeft + aTabCols.GetLeft() ) )
2254 {
2255 for ( size_t i = 0; i < aTabCols.Count(); ++i )
2256 if ( ::IsSame( nX, nLeft + aTabCols[i] ) )
2257 {
2258 nRet = i + 1;
2259 break;
2260 }
2261 }
2262 }
2263 return nRet;
2264}
2265
2266void ClearFEShellTabCols(SwDoc & rDoc, SwTabFrame const*const pFrame)
2267{
2268 auto const pShell(rDoc.getIDocumentLayoutAccess().GetCurrentViewShell());
2269 if (pShell)
2270 {
2271 for (SwViewShell& rCurrentShell : pShell->GetRingContainer())
2272 {
2273 if (auto const pFE = dynamic_cast<SwFEShell *>(&rCurrentShell))
2274 {
2275 pFE->ClearColumnRowCache(pFrame);
2276 }
2277 }
2278 }
2279}
2280
2282{
2283 if (m_pColumnCache)
2284 {
2285 if (pFrame == nullptr || pFrame == m_pColumnCache->pLastTabFrame)
2286 {
2287 m_pColumnCache.reset();
2288 }
2289 }
2290 if (m_pRowCache)
2291 {
2292 if (pFrame == nullptr || pFrame == m_pRowCache->pLastTabFrame)
2293 {
2294 m_pRowCache.reset();
2295 }
2296 }
2297}
2298
2300{
2301 SwFrame *pFrame = GetCurrFrame();
2302 if( pFrame && pFrame->IsInTab() )
2303 rSet.Put( pFrame->ImplFindTabFrame()->GetFormat()->GetAttrSet() );
2304}
2305
2307{
2308 SwFrame *pFrame = GetCurrFrame();
2309 if( pFrame && pFrame->IsInTab() )
2310 {
2311 CurrShell aCurr( this );
2313 SwTabFrame *pTab = pFrame->FindTabFrame();
2314 pTab->GetTable()->SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>());
2315 GetDoc()->SetAttr( rNew, *pTab->GetFormat() );
2318 }
2319}
2320
2321// change a cell width/cell height/column width/row height
2323{
2324 SwFrame *pFrame = GetCurrFrame();
2325 if( !pFrame || !pFrame->IsInTab() )
2326 return;
2327
2328 CurrShell aCurr( this );
2330
2331 do {
2332 pFrame = pFrame->GetUpper();
2333 } while( !pFrame->IsCellFrame() );
2334
2335 SwTabFrame *pTab = pFrame->ImplFindTabFrame();
2336
2337 // if the table is in relative values (USHRT_MAX)
2338 // then it should be recalculated to absolute values now
2339 const SwFormatFrameSize& rTableFrameSz = pTab->GetFormat()->GetFrameSize();
2340 SwRectFnSet aRectFnSet(pTab);
2341 tools::Long nPrtWidth = aRectFnSet.GetWidth(pTab->getFramePrintArea());
2346 nPrtWidth != rTableFrameSz.GetWidth() )
2347 {
2348 SwFormatFrameSize aSz( rTableFrameSz );
2349 aSz.SetWidth( pTab->getFramePrintArea().Width() );
2350 pTab->GetFormat()->SetFormatAttr( aSz );
2351 }
2352
2353 SwTwips nLogDiff = nDiff;
2354 nLogDiff *= pTab->GetFormat()->GetFrameSize().GetWidth();
2355 nLogDiff /= nPrtWidth;
2356
2359 *const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()),
2360 eType, nDiff, nLogDiff );
2361
2362 ClearFEShellTabCols(*GetDoc(), nullptr);
2364}
2365
2366static bool lcl_IsFormulaSelBoxes( const SwTable& rTable, const SwTableBoxFormula& rFormula,
2367 SwCellFrames& rCells )
2368{
2369 SwTableBoxFormula aTmp( rFormula );
2370 SwSelBoxes aBoxes;
2371 aTmp.GetBoxesOfFormula(rTable, aBoxes);
2372 for (size_t nSelBoxes = aBoxes.size(); nSelBoxes; )
2373 {
2374 SwTableBox* pBox = aBoxes[ --nSelBoxes ];
2375
2376 if( std::none_of(rCells.begin(), rCells.end(), [&pBox](SwCellFrame* pFrame) { return pFrame->GetTabBox() == pBox; }) )
2377 return false;
2378 }
2379
2380 return true;
2381}
2382
2383 // ask formula for auto-sum
2384void SwFEShell::GetAutoSum( OUString& rFormula ) const
2385{
2386 SwFrame *pFrame = GetCurrFrame();
2387 SwTabFrame *pTab = pFrame ? pFrame->ImplFindTabFrame() : nullptr;
2388 if( !pTab )
2389 return;
2390
2391 SwCellFrames aCells;
2392 OUString sFields;
2393 if( ::GetAutoSumSel( *this, aCells ))
2394 {
2395 sal_uInt16 nW = 0;
2396 for( size_t n = aCells.size(); n; )
2397 {
2398 SwCellFrame* pCFrame = aCells[ --n ];
2399 sal_uInt16 nBoxW = pCFrame->GetTabBox()->IsFormulaOrValueBox();
2400 if( !nBoxW )
2401 break;
2402
2403 if( !nW )
2404 {
2405 if( USHRT_MAX == nBoxW )
2406 continue; // skip space at beginning
2407
2408 // formula only if box is contained
2409 if( RES_BOXATR_FORMULA == nBoxW &&
2410 !::lcl_IsFormulaSelBoxes( *pTab->GetTable(), pCFrame->
2411 GetTabBox()->GetFrameFormat()->GetTableBoxFormula(), aCells))
2412 {
2413 nW = RES_BOXATR_VALUE;
2414 // restore previous spaces!
2415 for( size_t i = aCells.size(); n+1 < i; )
2416 {
2417 sFields = "|<" + aCells[--i]->GetTabBox()->GetName() + ">"
2418 + sFields;
2419 }
2420 }
2421 else
2422 nW = nBoxW;
2423 }
2424 else if( RES_BOXATR_VALUE == nW )
2425 {
2426 // search for values, Value/Formula/Text found -> include
2427 if( RES_BOXATR_FORMULA == nBoxW &&
2428 ::lcl_IsFormulaSelBoxes( *pTab->GetTable(), pCFrame->
2429 GetTabBox()->GetFrameFormat()->GetTableBoxFormula(), aCells ))
2430 break;
2431 else if( USHRT_MAX != nBoxW )
2432 sFields = OUStringChar(cListDelim) + sFields;
2433 else
2434 break;
2435 }
2436 else if( RES_BOXATR_FORMULA == nW )
2437 {
2438 // only continue search when the current formula points to
2439 // all boxes contained in the selection
2440 if( RES_BOXATR_FORMULA == nBoxW )
2441 {
2442 if( !::lcl_IsFormulaSelBoxes( *pTab->GetTable(), pCFrame->
2443 GetTabBox()->GetFrameFormat()->GetTableBoxFormula(), aCells ))
2444 {
2445 // redo only for values!
2446
2447 nW = RES_BOXATR_VALUE;
2448 sFields.clear();
2449 // restore previous spaces!
2450 for( size_t i = aCells.size(); n+1 < i; )
2451 {
2452 sFields = "|<" + aCells[--i]->GetTabBox()->GetName() + ">"
2453 + sFields;
2454 }
2455 }
2456 else
2457 sFields = OUStringChar(cListDelim) + sFields;
2458 }
2459 else if( USHRT_MAX == nBoxW )
2460 break;
2461 else
2462 continue; // ignore this box
2463 }
2464 else
2465 // all other stuff terminates the loop
2466 // possibly allow texts??
2467 break;
2468
2469 sFields = "<" + pCFrame->GetTabBox()->GetName() + ">" + sFields;
2470 }
2471 }
2472
2473 rFormula = OUString::createFromAscii( sCalc_Sum );
2474 if (!sFields.isEmpty())
2475 {
2476 rFormula += "(" + sFields + ")";
2477 }
2478}
2479
2481{
2482 SwFrame *pFrame = GetCurrFrame();
2483 SwTabFrame *pTab = (pFrame && pFrame->IsInTab()) ? pFrame->ImplFindTabFrame() : nullptr;
2484 if (!pTab)
2485 return false;
2486 return pTab->IsRightToLeft();
2487}
2488
2490{
2491 SwFrame *pFrame = const_cast<SwFrame *>(GetBox( rPt ));
2492 const SwTabFrame* pTabFrame = pFrame ? pFrame->ImplFindTabFrame() : nullptr;
2493 OSL_ENSURE( pTabFrame, "Table not found" );
2494 return pTabFrame && pTabFrame->IsRightToLeft();
2495}
2496
2498{
2499 SwFrame *pFrame = GetCurrFrame();
2500 SwTabFrame *pTab = (pFrame && pFrame->IsInTab()) ? pFrame->ImplFindTabFrame() : nullptr;
2501 if (!pTab)
2502 return false;
2503 return pTab->IsVertical();
2504}
2505
2506/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ NONE
no RedlineFlags
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
const char sCalc_Sum[]
Definition: calc.cxx:75
const sal_Unicode cListDelim
Definition: calc.hxx:42
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
const FndLines_t & GetLines() const
Definition: tblsel.hxx:172
const SwTableBox * GetBox() const
Definition: tblsel.hxx:174
Text operation/manipulation interface.
virtual bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default)=0
complete delete of a given PaM
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual void SetModified()=0
Must be called manually at changes of format.
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr tools::Long Width() const
void SetContentProtect(bool bNew)
bool IsContentProtected() const
tools::Long GetWidth() const
void SetWidth(tools::Long n)
wrapper class for the positioning of Writer fly frames and drawing objects
virtual const SwFlyFrame * DynCastFlyFrame() const
SwCellFrame is one table cell in the document layout.
Definition: cellfrm.hxx:31
const SwTableBox * GetTabBox() const
Definition: cellfrm.hxx:52
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1223
SvxFrameDirection GetTextDirection(const SwPosition &rPos, const Point *pPt) const
determines the text direction for a certain position.
Definition: node.cxx:2076
virtual sal_Int32 Len() const
Definition: node.cxx:1256
A helper class to save cursor state (position).
Definition: swcrsr.hxx:233
const SwTableNode * IsCursorInTable() const
Check if Point of current cursor is placed within a table.
Definition: crsrsh.cxx:600
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:343
friend bool GetAutoSumSel(const SwCursorShell &, SwCellFrames &)
Definition: tblsel.cxx:691
void ParkCursor(const SwNode &rIdx)
Remove selections and additional cursors of all shells.
Definition: crsrsh.cxx:3188
StartsWith StartsWith_()
If document body starts with a table or starts/ends with hidden paragraph.
Definition: crsrsh.cxx:895
bool SelTableRowOrCol(bool bRow, bool bRowSimple=false)
Definition: trvltbl.cxx:127
bool SelTable()
Definition: trvltbl.cxx:253
bool IsCursorReadonly() const
Definition: crsrsh.cxx:3609
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
void TableCursorToCursor()
enter block mode, change normal cursor into block cursor
Definition: crsrsh.cxx:1182
const SwShellTableCursor * GetTableCursor() const
Definition: crsrsh.hxx:670
SwContentFrame * GetCurrFrame(const bool bCalcFrame=true) const
Get current frame in which the cursor is positioned.
Definition: crsrsh.cxx:2771
void ClearMark()
Definition: crsrsh.cxx:1225
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
Definition: crsrsh.cxx:3356
void KillPams()
Definition: crsrsh.cxx:1308
bool GetContentAtPos(const Point &rPt, SwContentAtPos &rContentAtPos, bool bSetCursor=false, SwRect *pFieldRect=nullptr)
Definition: crstrvl.cxx:1433
bool IsTableMode() const
Definition: crsrsh.hxx:668
::std::optional<::std::pair< SwNode const *, ::std::vector< SwTableNode * > > > ExtendedSelectedAll() const
If ExtendedSelectAll() was called and selection didn't change since then.
Definition: crsrsh.cxx:823
void RestoreSavePos()
Restore cursor state to the one saved by SwCursorSaveState.
Definition: swcrsr.cxx:2339
bool GoNextCell(sal_uInt16 nCnt=1)
Definition: swcrsr.hxx:174
bool IsInProtectTable(bool bMove=false, bool bChgCursor=true)
Definition: swcrsr.cxx:557
bool GoPrevCell(sal_uInt16 nCnt=1)
Definition: swcrsr.hxx:175
virtual bool IsChangeRecording() const override
passwword protection for Writer (derived from SfxObjectShell) see also: FN_REDLINE_ON,...
Definition: docsh.cxx:1341
Definition: doc.hxx:197
bool GetTableAutoFormat(const SwSelBoxes &rBoxes, SwTableAutoFormat &rGet)
Find out who has the Attributes.
Definition: ndtbl.cxx:3824
void InsertCol(const SwCursor &rCursor, sal_uInt16 nCnt=1, bool bBehind=true)
Inserting Columns/Rows.
Definition: ndtbl.cxx:1695
void SetRowHeight(const SwCursor &rCursor, const SwFormatFrameSize &rNew)
Definition: ndtbl1.cxx:389
void SetTabLineStyle(const SwCursor &rCursor, const Color *pColor, bool bSetLine, const editeng::SvxBorderLine *pBorderLine)
Definition: ndtbl1.cxx:968
static sal_uInt16 GetBoxAlign(const SwCursor &rCursor)
Definition: ndtbl1.cxx:1395
void SetRowSplit(const SwCursor &rCursor, const SwFormatRowSplit &rNew)
Definition: ndtbl1.cxx:324
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:408
TableMergeErr MergeTable(SwPaM &rPam)
Definition: ndtbl.cxx:2242
bool BalanceRowHeight(const SwCursor &rCursor, bool bTstOnly, const bool bOptimize)
Adjustment of Rowheights.
Definition: ndtbl1.cxx:436
static bool GetRowBackground(const SwCursor &rCursor, std::unique_ptr< SvxBrushItem > &rToFill)
Definition: ndtbl1.cxx:515
static bool GetBoxAttr(const SwCursor &rCursor, std::unique_ptr< SfxPoolItem > &rToFill)
Retrieves a box attribute from the given cursor.
Definition: ndtbl1.cxx:1321
static void GetTabRows(SwTabCols &rFill, const SwCellFrame *pBoxFrame)
Definition: ndtbl.cxx:2593
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history.
Definition: docfmt.cxx:458
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
static std::unique_ptr< SwFormatFrameSize > GetRowHeight(const SwCursor &rCursor)
Definition: ndtbl1.cxx:414
SwNodes & GetNodes()
Definition: doc.hxx:422
void SetRowNotTracked(const SwCursor &rCursor, const SvxPrintItem &rNotTracked, bool bAll=false, bool bIns=false)
rNotTracked = false means that the row was deleted or inserted with its tracked cell content bAll: de...
Definition: ndtbl1.cxx:581
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:349
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:330
static std::unique_ptr< SwFormatRowSplit > GetRowSplit(const SwCursor &rCursor)
Definition: ndtbl1.cxx:350
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:419
void SetTabCols(const SwTabCols &rNew, bool bCurRowOnly, const SwCellFrame *pBoxFrame)
Definition: ndtbl.cxx:2728
void InsertRow(const SwCursor &rCursor, sal_uInt16 nCnt=1, bool bBehind=true)
Definition: ndtbl.cxx:1750
void SetTabRows(const SwTabCols &rNew, bool bCurColOnly, const SwCellFrame *pBoxFrame)
Definition: ndtbl.cxx:2784
static void GetTabCols(SwTabCols &rFill, const SwCellFrame *pBoxFrame)
Definition: ndtbl.cxx:2539
void UnProtectTables(const SwPaM &rPam)
Definition: ndtbl.cxx:4489
bool SplitTable(const SwSelBoxes &rBoxes, bool bVert, sal_uInt16 nCnt, bool bSameHeight=false)
Split up/merge Boxes in the Table.
Definition: ndtbl.cxx:2178
void SetTabBorders(const SwCursor &rCursor, const SfxItemSet &rSet)
Definition: ndtbl1.cxx:688
void SetBoxAlign(const SwCursor &rCursor, sal_uInt16 nAlign)
Definition: ndtbl1.cxx:1386
bool DeleteRowCol(const SwSelBoxes &rBoxes, RowColMode eMode=RowColMode::DeleteRow)
Definition: ndtbl.cxx:2093
void AdjustCellWidth(const SwCursor &rCursor, const bool bBalance, const bool bNoShrink)
Adjusts selected cell widths in such a way, that their content does not need to be wrapped (if possib...
Definition: ndtbl1.cxx:1606
bool HasTableAnyProtection(const SwPosition *pPos, const OUString *pTableName, bool *pFullTableProtection)
Definition: ndtbl.cxx:4529
static bool HasRowNotTracked(const SwCursor &rCursor)
don't call SetRowNotTracked() for rows with tracked row change
Definition: ndtbl1.cxx:545
void SetRowsToRepeat(SwTable &rTable, sal_uInt16 nSet)
Definition: ndtbl.cxx:2930
void SetBoxAttr(const SwCursor &rCursor, const SfxPoolItem &rNew)
Definition: ndtbl1.cxx:1276
SwTableAutoFormatTable & GetTableStyles()
Return the available table styles.
Definition: ndtbl.cxx:3897
void SetColRowWidthHeight(SwTableBox &rCurrentBox, TableChgWidthHeightType eType, SwTwips nAbsDiff, SwTwips nRelDiff)
Definition: ndtbl.cxx:3982
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
void SetRowBackground(const SwCursor &rCursor, const SvxBrushItem &rNew)
Definition: ndtbl1.cxx:489
void UnProtectCells(const OUString &rTableName)
Definition: ndtbl.cxx:4441
static void GetTabBorders(const SwCursor &rCursor, SfxItemSet &rSet)
Definition: ndtbl1.cxx:1059
bool SetTableAutoFormat(const SwSelBoxes &rBoxes, const SwTableAutoFormat &rNew, bool bResetDirect=false, bool isSetStyleName=false)
AutoFormat for table/table selection.
Definition: ndtbl.cxx:3733
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
bool Delete(bool isArtificialSelection=false)
Delete content of all ranges.
Definition: eddel.cxx:134
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
SwRedlineTable::size_type GetRedlineCount() const
Definition: edredln.cxx:48
void EndAllAction()
Definition: edws.cxx:97
void GetTableAttr(SfxItemSet &) const
Definition: fetab.cxx:2299
bool DeleteCol()
Definition: fetab.cxx:266
void SetTabCols(const SwTabCols &rNew, bool bCurRowOnly)
Definition: fetab.cxx:797
void GetAutoSum(OUString &rFormula) const
Definition: fetab.cxx:2384
void InsertCol(sal_uInt16 nCnt, bool bBehind)
Definition: fetab.cxx:213
std::unique_ptr< SwColCache > m_pColumnCache
Definition: fesh.hxx:204
bool BalanceRowHeight(bool bTstOnly, const bool bOptimize=false)
Definition: fetab.cxx:911
void SetTabRows(const SwTabCols &rNew, bool bCurColOnly)
Definition: fetab.cxx:848
SwTextNode * GetNumRuleNodeAtPos(const Point &rPot)
Definition: fetab.cxx:2153
bool GetRowBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:930
bool HasTableAnyProtection(const OUString *pTableName, bool *pFullTableProtection)
Definition: fetab.cxx:1137
bool IsNumLabel(const Point &rPt, int nMaxOffset=-1)
Definition: fetab.cxx:2165
sal_uInt16 GetRowsToRepeat() const
Definition: fetab.cxx:1171
bool HasBoxSelection() const
Is content of a table cell or at least a table cell completely selected?
Definition: fetab.cxx:1041
void SetBoxAlign(sal_uInt16 nOrient)
Definition: fetab.cxx:990
SAL_DLLPRIVATE const SwFrame * GetBox(const Point &rPt, bool *pbRow=nullptr, bool *pbCol=nullptr) const
Used for mouse operations on a table:
Definition: fetab.cxx:1784
void SetBoxBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:958
std::unique_ptr< SwColCache > m_pRowCache
Definition: fesh.hxx:205
void SetRowSplit(const SwFormatRowSplit &rSz)
Definition: fetab.cxx:885
void SetTableStyle(const OUString &rStyleName)
Set table style of the current table.
Definition: fetab.cxx:1354
void SetMouseTabRows(const SwTabCols &rNew, bool bCurColOnly, const Point &rPt)
Definition: fetab.cxx:873
void GetTabCols(SwTabCols &rToFill) const
Info about columns and margins.
Definition: fetab.cxx:815
void SetRowBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:922
void DeleteTable()
Definition: fetab.cxx:377
void SetRowHeight(const SwFormatFrameSize &rSz)
Definition: fetab.cxx:898
bool IsTableVertical() const
Definition: fetab.cxx:2497
bool IsLastCellInRow() const
Definition: fetab.cxx:250
void SetMouseTabCols(const SwTabCols &rNew, bool bCurRowOnly, const Point &rPt)
Definition: fetab.cxx:2218
SAL_DLLPRIVATE void GetTabCols_(SwTabCols &rToFill, const SwFrame *pBox) const
Definition: fetab.cxx:685
SAL_DLLPRIVATE void GetTabRows_(SwTabCols &rToFill, const SwFrame *pBox) const
Definition: fetab.cxx:750
bool GetBoxBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:966
sal_uInt16 GetRowSelectionFromTop() const
Definition: fetab.cxx:1233
void InsertRow(sal_uInt16 nCnt, bool bBehind)
Definition: fetab.cxx:175
bool IsAdjustCellWidthAllowed(bool bBalance=false) const
Not allowed if only empty cells are selected.
Definition: fetab.cxx:1303
SAL_DLLPRIVATE void EndAllActionAndCall()
Terminate actions for all shells and call ChangeLink.
Definition: fews.cxx:69
std::unique_ptr< SwFormatRowSplit > GetRowSplit() const
Definition: fetab.cxx:893
SAL_DLLPRIVATE void ClearColumnRowCache(SwTabFrame const *)
Definition: fetab.cxx:2281
bool DeleteTableSel()
Current selection, may be whole table.
Definition: fetab.cxx:1457
void SetRowsToRepeat(sal_uInt16 nNumOfRows)
Definition: fetab.cxx:1180
void UnProtectTables()
Unprotect all tables in selection.
Definition: fetab.cxx:1129
void SetTabBorders(const SfxItemSet &rSet)
Definition: fetab.cxx:935
static SAL_DLLPRIVATE sal_uInt16 GetCurColNum_(const SwFrame *pFrame, SwGetCurColNumPara *pPara)
Definition: fews.cxx:599
bool CanUnProtectCells() const
Definition: fetab.cxx:1144
void UnProtectCells()
Refers to table selection.
Definition: fetab.cxx:1102
bool GetTableAutoFormat(SwTableAutoFormat &rGet)
Definition: fetab.cxx:1430
void GetTabRows(SwTabCols &rToFill) const
Definition: fetab.cxx:832
SwTab WhichMouseTabCol(const Point &rPt) const
Definition: fetab.cxx:2074
void SetTabBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:1003
bool IsMouseTableRightToLeft(const Point &rPt) const
Definition: fetab.cxx:2489
void GetMouseTabCols(SwTabCols &rToFill, const Point &rPt) const
Definition: fetab.cxx:2211
void SetTabLineStyle(const Color *pColor, bool bSetLine=false, const editeng::SvxBorderLine *pBorderLine=nullptr)
Definition: fetab.cxx:943
void SplitTab(bool bVert, sal_uInt16 nCnt, bool bSameHeight)
Split cell vertically or horizontally.
Definition: fetab.cxx:647
void AdjustCellWidth(const bool bBalance, const bool bNoShrink)
Definition: fetab.cxx:1289
bool DeleteRow(bool bCompleteTable=false)
Definition: fetab.cxx:382
void ProtectCells()
If a table selection exists it is destroyed in case cursor is not allowed in readonly.
Definition: fetab.cxx:1082
void GetTabBorders(SfxItemSet &rSet) const
Definition: fetab.cxx:953
bool HasWholeTabSelection() const
Definition: fetab.cxx:1023
bool UpdateTableStyleFormatting(SwTableNode *pTableNode=nullptr, bool bResetDirect=false, OUString const *pStyleName=nullptr)
Update the direct formatting according to the current table style.
Definition: fetab.cxx:1383
void ParkCursorInTab()
Definition: fetab.cxx:93
sal_uInt16 GetCurMouseColNum(const Point &rPt) const
Definition: fetab.cxx:2231
bool SelTableRowCol(const Point &rPt, const Point *pEnd, bool bRowDrag)
pEnd will be used during MouseMove
Definition: fetab.cxx:1957
size_t GetCurMouseTabColNum(const Point &rPt) const
Definition: fetab.cxx:2236
void SetColRowWidthHeight(TableChgWidthHeightType eType, sal_uInt16 nDiff)
Definition: fetab.cxx:2322
std::unique_ptr< SwFormatFrameSize > GetRowHeight() const
Pointer must be destroyed by caller != 0.
Definition: fetab.cxx:906
size_t GetCurTabColNum() const
Definition: fetab.cxx:1499
static bool IsVerticalModeAtNdAndPos(const SwTextNode &_rTextNode, const Point &_rDocPos)
Definition: fetab.cxx:2183
sal_uInt16 GetBoxAlign() const
USHRT_MAX if ambiguous.
Definition: fetab.cxx:998
void GetTabBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
Definition: fetab.cxx:1016
bool GetBoxDirection(std::unique_ptr< SvxFrameDirectionItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:982
void GetMouseTabRows(SwTabCols &rToFill, const Point &rPt) const
Definition: fetab.cxx:866
SAL_DLLPRIVATE bool CheckHeadline(bool bRepeat) const
Definition: fetab.cxx:1266
bool IsTableRightToLeft() const
Definition: fetab.cxx:2480
void SetTableAttr(const SfxItemSet &)
Definition: fetab.cxx:2306
TableMergeErr MergeTab()
Merge selected parts of table.
Definition: fetab.cxx:615
void SetBoxDirection(const SvxFrameDirectionItem &rNew)
Definition: fetab.cxx:974
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:94
Controls if a table row is allowed to split or not.
Definition: fmtrowsplt.hxx:32
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const SvxProtectItem & GetProtect(bool=true) const
Definition: frmatr.hxx:106
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:115
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
std::unique_ptr< SvxBrushItem > makeBackgroundBrushItem(bool=true) const
Definition: format.cxx:736
const SwRect & getFrameArea() const
Definition: frame.hxx:179
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsRowFrame() const
Definition: frame.hxx:1228
bool IsCellFrame() const
Definition: frame.hxx:1232
bool IsTextFrame() const
Definition: frame.hxx:1240
tools::Long GetPrtLeft() const
Definition: ssfrm.cxx:52
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1105
SwFrame * FindNext()
Definition: frame.hxx:1147
SwFrame * GetNext()
Definition: frame.hxx:682
SwTabFrame * ImplFindTabFrame()
Definition: findfrm.cxx:554
bool IsTabFrame() const
Definition: frame.hxx:1224
bool IsInTab() const
Definition: frame.hxx:961
bool IsRightToLeft() const
Definition: frame.hxx:993
SwLayoutFrame * GetUpper()
Definition: frame.hxx:684
tools::Long GetPrtTop() const
Definition: ssfrm.cxx:58
bool IsVertical() const
Definition: frame.hxx:979
SwFrame * GetPrev()
Definition: frame.hxx:683
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
Definition: findfrm.cxx:217
SwPageFrame * FindPageFrame()
Definition: frame.hxx:686
bool IsLayoutFrame() const
Definition: frame.hxx:1176
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
bool IsAnLower(const SwFrame *) const
Definition: findfrm.cxx:233
virtual const SwFrameFormat * GetFormat() const
Definition: ssfrm.cxx:401
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
Definition: findfrm.cxx:72
const SwFrame * Lower() const
Definition: layfrm.hxx:101
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:123
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
SwNodeOffset GetIndex() const
Definition: node.hxx:312
bool IsProtect() const
Is node in something that is protected (range, frame, table cells ... including anchor in case of fra...
Definition: node.cxx:449
bool IsInProtectSect() const
Is node in a protected area?
Definition: node.cxx:439
SwDoc & GetDoc()
Definition: node.hxx:233
SwNodeOffset StartOfSectionIndex() const
Definition: node.hxx:687
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:380
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:153
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:691
SwContentNode * GetContentNode()
Definition: node.hxx:666
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:695
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1333
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1299
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
SwNode & GetPointNode() const
Definition: pam.hxx:275
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:643
void Exchange()
Definition: pam.hxx:242
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:657
const SwPosition * End() const
Definition: pam.hxx:263
void DeleteMark()
Definition: pam.hxx:232
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SwPosition * Start() const
Definition: pam.hxx:258
A page of the document layout.
Definition: pagefrm.hxx:60
const SwSortedObjs * GetSortedObjs() const
Definition: pagefrm.hxx:136
bool IsVert() const
Definition: frame.hxx:1372
tools::Long GetHeight(const SwRect &rRect) const
Definition: frame.hxx:1387
tools::Long GetWidth(const SwRect &rRect) const
Definition: frame.hxx:1386
tools::Long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1382
tools::Long XDiff(tools::Long n1, tools::Long n2) const
Definition: frame.hxx:1427
Point GetPos(const SwRect &rRect) const
Definition: frame.hxx:1388
tools::Long YDiff(tools::Long n1, tools::Long n2) const
Definition: frame.hxx:1428
tools::Long GetLeft(const SwRect &rRect) const
Definition: frame.hxx:1384
tools::Long GetRight(const SwRect &rRect) const
Definition: frame.hxx:1385
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
Point TopLeft() const
Definition: swrect.hxx:254
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
Point BottomLeft() const
Definition: swrect.hxx:262
void Right(const tools::Long nRight)
Definition: swrect.hxx:202
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:211
bool IsNear(const Point &rPoint, tools::Long nTolerance) const
Definition: swrect.hxx:365
void Pos(const Point &rNew)
Definition: swrect.hxx:171
bool Contains(const Point &rPOINT) const
Definition: swrect.hxx:356
Point Center() const
Definition: swrect.hxx:338
Point BottomRight() const
Definition: swrect.hxx:266
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
Point TopRight() const
Definition: swrect.hxx:258
void Width(tools::Long nNew)
Definition: swrect.hxx:189
vector_type::size_type size_type
Definition: docary.hxx:223
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
Definition: rootfrm.hxx:434
SwRowFrame is one table row in the document layout.
Definition: rowfrm.hxx:29
Represents the current text cursor of one opened edit window.
Definition: viscrs.hxx:140
const Point & GetPtPos() const
Definition: viscrs.hxx:165
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:939
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:1133
size_t size() const
Definition: sortedobjs.cxx:43
size_t Count() const
Definition: tabcol.hxx:65
tools::Long GetLeft() const
Definition: tabcol.hxx:78
tools::Long GetLeftMin() const
Definition: tabcol.hxx:77
tools::Long GetRight() const
Definition: tabcol.hxx:79
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:49
SwTabFrame * FindMaster(bool bFirstMaster=false) const
Definition: flowfrm.cxx:798
const SwTabFrame * GetFollow() const
Definition: tabfrm.hxx:255
const SwTable * GetTable() const
Definition: tabfrm.hxx:162
bool IsInHeadline(const SwFrame &rFrame) const
Definition: tabfrm.cxx:5966
void AddAutoFormat(const SwTableAutoFormat &rFormat)
Append table style to the existing styles.
Definition: tblafmt.cxx:949
SwTableAutoFormat * FindAutoFormat(std::u16string_view rName) const
Find table style with the provided name, return nullptr when not found.
Definition: tblafmt.cxx:1001
const OUString & GetName() const
Definition: tblafmt.hxx:206
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:443
SwTableLine * GetUpper()
Definition: swtable.hxx:477
bool IsEmpty(bool bWithRemainingNestedTable=true) const
Definition: swtable.cxx:2247
sal_uInt16 IsFormulaOrValueBox() const
Definition: swtable.cxx:2940
SwNodeOffset GetSttIdx() const
Definition: swtable.cxx:2242
OUString GetName() const
Definition: swtable.cxx:2189
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:481
SwTableLines & GetTabLines()
Definition: swtable.hxx:474
SwTableBox * FindPreviousBox(const SwTable &, const SwTableBox *) const
Definition: tblrwcl.cxx:2319
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:495
SwTableBox * FindNextBox(const SwTable &, const SwTableBox *, bool bOvrTableLns=true) const
Definition: tblrwcl.cxx:2308
size_t GetSelectedBoxesCount() const
Definition: swcrsr.hxx:279
void GetBoxesOfFormula(const SwTable &rTable, SwSelBoxes &rBoxes)
Definition: cellfml.cxx:924
SwTableLine is one table row in the document model.
Definition: swtable.hxx:376
SwTableBoxes & GetTabBoxes()
Definition: swtable.hxx:386
bool IsDeleted(SwRedlineTable::size_type &rRedlinePos) const
Definition: swtable.cxx:1937
SwTableBox * FindPreviousBox(const SwTable &, const SwTableBox *=nullptr, bool bOvrTableLns=true) const
Definition: tblrwcl.cxx:2252
SwTableBox * FindNextBox(const SwTable &, const SwTableBox *=nullptr, bool bOvrTableLns=true) const
Definition: tblrwcl.cxx:2201
size_type size() const
Definition: swtable.hxx:76
SwTableLine * back() const
Definition: swtable.hxx:82
const SwTable & GetTable() const
Definition: node.hxx:542
void MakeOwnFrames(SwPosition *pIdxBehind=nullptr)
Creates the frms for the table node (i.e.
Definition: ndtbl.cxx:2414
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
Definition: ndtbl.cxx:2461
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
void SetHTMLTableLayout(std::shared_ptr< SwHTMLTableLayout > const &r)
Definition: swtable.cxx:2330
const OUString & GetTableStyleName() const
Return the table style name of this table.
Definition: swtable.hxx:196
bool IsDeleted() const
Definition: swtable.cxx:1611
SwTableLines & GetTabLines()
Definition: swtable.hxx:206
bool IsTableComplex() const
Definition: swtable.cxx:1445
sal_uInt16 GetRowsToRepeat() const
Definition: swtable.hxx:201
SwTableSortBoxes & GetTabSortBoxes()
Definition: swtable.hxx:267
void GetTabCols(SwTabCols &rToFill, const SwTableBox *pStart, bool bHidden=false, bool bCurRowOnly=false) const
Definition: swtable.cxx:518
bool IsNewModel() const
Definition: swtable.hxx:193
TableChgMode GetTableChgMode() const
Definition: swtable.hxx:338
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
const OUString & GetText() const
Definition: ndtxt.hxx:244
const SwNodes & GetNodes() const
Definition: viewsh.cxx:2181
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
vcl::Window * GetWin() const
Definition: viewsh.hxx:364
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
double scalar(const B2DVector &rVec) const
double cross(const B2DVector &rVec) const
double getLength() const
const Value & back() const
bool empty() const
size_type size() const
std::pair< const_iterator, bool > insert(Value &&x)
ring_container GetRingContainer()
Definition: ring.hxx:240
Point PixelToLogic(const Point &rDevicePt) const
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
SwTab
Definition: fesh.hxx:182
@ ROW_VERT
@ ROWSEL_HORI_RTL
@ SEL_HORI
@ SEL_VERT
@ COL_NONE
@ COL_HORI
@ COLSEL_VERT
@ COLSEL_HORI
@ SEL_HORI_RTL
@ ROWSEL_VERT
@ COL_VERT
@ ROWSEL_HORI
@ ROW_HORI
static Point lcl_ProjectOntoClosestTableFrame(const SwTabFrame &rTab, const Point &rPoint, bool bRowDrag)
Definition: fetab.cxx:1862
#define COLFUZZY
Definition: fetab.cxx:72
static bool IsSame(tools::Long nA, tools::Long nB)
Definition: fetab.cxx:74
static const SwCellFrame * lcl_FindFrame(const SwLayoutFrame *pLay, const Point &rPt, SwTwips nFuzzy, bool *pbRow, bool *pbCol)
Definition: fetab.cxx:1590
#define ENHANCED_TABLE_SELECTION_FUZZY
Definition: fetab.cxx:1782
static sal_uInt16 lcl_GetRowNumber(const SwPosition &rPos)
Definition: fetab.cxx:1195
static bool lcl_IsFormulaSelBoxes(const SwTable &rTable, const SwTableBoxFormula &rFormula, SwCellFrames &rCells)
Definition: fetab.cxx:2366
void ClearFEShellTabCols(SwDoc &rDoc, SwTabFrame const *const pFrame)
Definition: fetab.cxx:2266
static double lcl_DistancePoint2Segment(const Point &rA, const Point &rB, const Point &rC)
Definition: fetab.cxx:1833
static const SwFrame * lcl_FindFrameInTab(const SwLayoutFrame *pLay, const Point &rPt, SwTwips nFuzzy)
Definition: fetab.cxx:1566
DocumentType eType
SvxFrameDirection
const SwContentFrame * GetCellContent(const SwLayoutFrame &rCell_)
method to get the content of the table cell
Definition: frmtool.cxx:3997
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(158)
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(157)
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(106)
#define CH_TXT_TRACKED_DUMMY_CHAR
Definition: hintids.hxx:191
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(104)
sal_Int64 n
const long LONG_MAX
int i
long Long
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:1043
bool GoInContent(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:1203
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:60
constexpr auto RULER_MOUSE_MARGINWIDTH
static SfxItemSet & rSet
sal_uIntPtr sal_uLong
static bool bCol
Definition: srtdlg.cxx:56
union SwContentAtPos::@21 aFnd
SwContentNode * pNode
Definition: crsrsh.hxx:109
Marks a position in the document model.
Definition: pam.hxx:38
SwNode & GetNode() const
Definition: pam.hxx:81
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:267
SwNodeOffset GetNodeIndex() const
Definition: pam.hxx:78
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
#define ERR_TBLINSCOL_ERROR
Definition: swerror.h:36
#define ERR_TBLDDECHG_ERROR
Definition: swerror.h:37
#define ERR_TBLSPLIT_ERROR
Definition: swerror.h:35
tools::Long SwTwips
Definition: swtypes.hxx:51
@ UI_TABLE_DELETE
TableMergeErr
Definition: tblenum.hxx:64
constexpr TableChgWidthHeightType extractPosition(TableChgWidthHeightType e)
Definition: tblenum.hxx:43
TableChgWidthHeightType
Definition: tblenum.hxx:27
void ForEach_FndLineCopyCol(SwTableLines &rLines, FndPara *pFndPara)
This creates a structure mirroring the SwTable structure that contains all rows and non-leaf boxes (a...
Definition: tblsel.cxx:2090
void GetTableSelCrs(const SwCursorShell &rShell, SwSelBoxes &rBoxes)
Definition: tblsel.cxx:124
void GetTableSel(const SwCursorShell &rShell, SwSelBoxes &rBoxes, const SwTableSearchType eSearchType)
Definition: tblsel.cxx:149
bool CheckSplitCells(const SwCursorShell &rShell, sal_uInt16 nDiv, const SwTableSearchType eSearchType)
Definition: tblsel.cxx:1949
bool HasProtectedCells(const SwSelBoxes &rBoxes)
Definition: tblsel.cxx:854
SwTableSearchType
Definition: tblsel.hxx:59
std::deque< SwCellFrame * > SwCellFrames
Definition: tblsel.hxx:41