LibreOffice Module sw (master) 1
ssfrm.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 <config_wasm_strip.h>
21
22#include <pagefrm.hxx>
23#include <rootfrm.hxx>
24#include <dcontact.hxx>
25#include <flyfrm.hxx>
26#include <tabfrm.hxx>
27#include <txtfrm.hxx>
28#include <cellfrm.hxx>
29#include <swtable.hxx>
30#include <fmtfsize.hxx>
31#include <editeng/boxitem.hxx>
32#include <editeng/shaditem.hxx>
35#include <fmtclds.hxx>
36#include <viewimp.hxx>
37#include <sortedobjs.hxx>
38#include <hints.hxx>
39#include <frmtool.hxx>
40#include <ndtxt.hxx>
41#include <osl/diagnose.h>
42
43 // No inline cause we need the function pointers
45 { return getFramePrintArea().Top(); }
49 { return getFramePrintArea().Left(); }
53 { return getFrameArea().Left() + getFramePrintArea().Left(); }
59 { return getFrameArea().Top() + getFramePrintArea().Top(); }
60
62{
63 SwTwips nDiff = nDeadline - getFrameArea().Left();
64 if( nDiff > 0 )
65 {
67 aFrm.Left( nDeadline );
68
70 aPrt.Width( aPrt.Width() - nDiff );
71
72 return true;
73 }
74 return false;
75}
76
78{
79 SwTwips nDiff = getFrameArea().Top() + getFrameArea().Height() - nDeadline;
80 if( nDiff > 0 )
81 {
83 aFrm.Height( aFrm.Height() - nDiff );
84
86 aPrt.Height( aPrt.Height() - nDiff );
87
88 return true;
89 }
90 return false;
91}
92
94{
95 SwTwips nDiff = getFrameArea().Left() + getFrameArea().Width() - nDeadline;
96 if( nDiff > 0 )
97 {
99 aFrm.Width( aFrm.Width() - nDiff );
100
102 aPrt.Width( aPrt.Width() - nDiff );
103
104 return true;
105 }
106 return false;
107}
108
109void SwFrame::MakeBelowPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify )
110{
112
113 if( pPrv )
114 {
115 aFrm.Pos( pPrv->getFrameArea().Pos() );
116 aFrm.Pos().AdjustY(pPrv->getFrameArea().Height() );
117 }
118 else
119 {
120 aFrm.Pos( pUp->getFrameArea().Pos() );
121 aFrm.Pos() += pUp->getFramePrintArea().Pos();
122 }
123
124 if( bNotify )
125 {
126 aFrm.Pos().AdjustY(1 );
127 }
128}
129
130void SwFrame::MakeLeftPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify )
131{
133
134 if( pPrv )
135 {
136 aFrm.Pos( pPrv->getFrameArea().Pos() );
137 aFrm.Pos().AdjustX( -(aFrm.Width()) );
138 }
139 else
140 {
141 aFrm.Pos( pUp->getFrameArea().Pos() );
142 aFrm.Pos() += pUp->getFramePrintArea().Pos();
143 aFrm.Pos().AdjustX(pUp->getFramePrintArea().Width() - aFrm.Width() );
144 }
145
146 if( bNotify )
147 {
148 aFrm.Pos().AdjustX( -1 );
149 }
150}
151
152void SwFrame::MakeRightPos( const SwFrame* pUp, const SwFrame* pPrv, bool bNotify )
153{
155
156 if( pPrv )
157 {
158 aFrm.Pos( pPrv->getFrameArea().Pos() );
159 aFrm.Pos().AdjustX(pPrv->getFrameArea().Width() );
160 }
161 else
162 {
163 aFrm.Pos( pUp->getFrameArea().Pos() );
164 aFrm.Pos() += pUp->getFramePrintArea().Pos();
165 }
166
167 if( bNotify )
168 {
169 aFrm.Pos().AdjustX(1 );
170 }
171}
172
174{
176 aPrt.Top( nTop );
177 aPrt.Height( getFrameArea().Height() - nTop - nBot );
178}
179
181{
183 aPrt.Left( nLeft );
184 aPrt.Width( getFrameArea().Width() - nLeft - nRight );
185}
186
188{
190 aPrt.Left( nLeft );
191 aPrt.Width( getFrameArea().Width() - nLeft - nRight );
192}
193
196{
197 bool bOldVert = mbVertical;
198 bool bOldR2L = mbRightToLeft;
199 SetInvalidVert( true );
200 mbInvalidR2L = true;
201 bool bChg = bOldR2L != IsRightToLeft();
202 bool bOldVertL2R = IsVertLR();
203 if( !(( IsVertical() != bOldVert ) || bChg || bOldVertL2R != IsVertLR()) )
204 return;
205
207 if( IsLayoutFrame() )
208 {
209 // set minimum row height for vertical cells in horizontal table:
210 if ( IsCellFrame() && GetUpper() )
211 {
212 if ( IsVertical() != GetUpper()->IsVertical() &&
213 static_cast<SwCellFrame*>(this)->GetTabBox()->getRowSpan() == 1 )
214 {
215 enum {
216 MIN_VERT_CELL_HEIGHT = 1135
217 };
218
219 SwTableLine* pLine = const_cast<SwTableLine*>(static_cast<SwCellFrame*>(this)->GetTabBox()->GetUpper());
220 SwFrameFormat* pFrameFormat = pLine->GetFrameFormat();
221 SwFormatFrameSize aNew( pFrameFormat->GetFrameSize() );
224 if ( aNew.GetHeight() < MIN_VERT_CELL_HEIGHT )
225 aNew.SetHeight( MIN_VERT_CELL_HEIGHT );
226 SwDoc* pDoc = pFrameFormat->GetDoc();
227 pDoc->SetAttr( aNew, *pLine->ClaimFrameFormat() );
228 }
229 }
230
231 SwFrame* pFrame = static_cast<SwLayoutFrame*>(this)->Lower();
232 const SwFormatCol* pCol = nullptr;
233 SwLayoutFrame* pBody = nullptr;
234 if( pFrame )
235 {
236 if( IsPageFrame() )
237 {
238 // If we're a page frame and we change our layout direction,
239 // we have to look for columns and rearrange them.
240 pBody = static_cast<SwPageFrame*>(this)->FindBodyCont();
241 if(pBody && pBody->Lower() && pBody->Lower()->IsColumnFrame())
242 pCol = &static_cast<SwPageFrame*>(this)->GetFormat()->GetCol();
243 }
244 else if( pFrame->IsColumnFrame() )
245 {
246 pBody = static_cast<SwLayoutFrame*>(this);
247 const SwFrameFormat *pFormat = pBody->GetFormat();
248 if( pFormat )
249 pCol = &pFormat->GetCol();
250 }
251 }
252 while( pFrame )
253 {
254 pFrame->CheckDirChange();
255 pFrame = pFrame->GetNext();
256 }
257 if( pCol )
258 pBody->AdjustColumns( pCol, true );
259 }
260 else if( IsTextFrame() )
261 static_cast<SwTextFrame*>(this)->Prepare();
262
263 // #i31698# - notify anchored objects also for page frames.
264 // Remove code above for special handling of page frames
265 if ( !GetDrawObjs() )
266 return;
267
268 const SwSortedObjs *pObjs = GetDrawObjs();
269 const size_t nCnt = pObjs->size();
270 for ( size_t i = 0; i < nCnt; ++i )
271 {
272 SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
273 if( auto pFlyFrame = pAnchoredObj->DynCastFlyFrame() )
274 pFlyFrame->CheckDirChange();
275 else
276 {
277 // OD 2004-04-06 #i26791# - direct object
278 // positioning no longer needed. Instead
279 // invalidate
280 pAnchoredObj->InvalidateObjPos();
281 }
282 // #i31698# - update layout direction of
283 // anchored object
284 {
285 ::setContextWritingMode( pAnchoredObj->DrawObj(), pAnchoredObj->GetAnchorFrameContainingAnchPos() );
286 pAnchoredObj->UpdateLayoutDir();
287 }
288 }
289}
290
292// OD 2004-03-10 #i11860# - consider lower space and line spacing of
293// previous frame according to new option 'Use former object positioning'
294Point SwFrame::GetFrameAnchorPos( bool bIgnoreFlysAnchoredAtThisFrame ) const
295{
296 Point aAnchor = getFrameArea().Pos();
297
298 if ( ( IsVertical() && !IsVertLR() ) || IsRightToLeft() )
299 aAnchor.AdjustX(getFrameArea().Width() );
300
301 if ( IsTextFrame() )
302 {
303 SwTwips nBaseOfstForFly =
304 static_cast<const SwTextFrame*>(this)->GetBaseOffsetForFly( bIgnoreFlysAnchoredAtThisFrame );
305 if ( IsVertical() )
306 aAnchor.AdjustY(nBaseOfstForFly );
307 else
308 aAnchor.AdjustX(nBaseOfstForFly );
309
310 // OD 2004-03-10 #i11860# - if option 'Use former object positioning'
311 // is OFF, consider the lower space and the line spacing of the
312 // previous frame and the spacing considered for the page grid
313 const SwTextFrame* pThisTextFrame = static_cast<const SwTextFrame*>(this);
314 const SwTwips nUpperSpaceAmountConsideredForPrevFrameAndPageGrid =
315 pThisTextFrame->GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid();
316 if ( IsVertical() )
317 {
318 aAnchor.AdjustX( -nUpperSpaceAmountConsideredForPrevFrameAndPageGrid );
319 }
320 else
321 {
322 aAnchor.AdjustY(nUpperSpaceAmountConsideredForPrevFrameAndPageGrid );
323 }
324 }
325
326 return aAnchor;
327}
328
330{
331 mbInDtor = true;
332
333 // accessible objects for fly and cell frames have been already disposed
334 // by the destructors of the derived classes.
335#if !ENABLE_WASM_STRIP_ACCESSIBILITY
336 if (IsAccessibleFrame() && !(IsFlyFrame() || IsCellFrame())
337 && (GetDep() || IsTextFrame())) // sw_redlinehide: text frame may not have Dep!
338 {
339 assert(!IsTextFrame() || GetDep() || static_cast<SwTextFrame*>(this)->GetMergedPara());
340 const bool bInDocDtor = IsTabFrame() && static_cast<SwTabFrame*>(this)->GetFormat()->GetDoc()->IsInDtor();
341 SwRootFrame *pRootFrame = getRootFrame();
342 if( !bInDocDtor && pRootFrame && pRootFrame->IsAnyShellAccessible() )
343 {
344 SwViewShell *pVSh = pRootFrame->GetCurrShell();
345 if( pVSh && pVSh->Imp() )
346 {
347 OSL_ENSURE( !GetLower(), "Lowers should be dispose already!" );
348 pVSh->Imp()->DisposeAccessibleFrame( this );
349 }
350 }
351 }
352#endif
353
354 if (!m_pDrawObjs)
355 return;
356
357 for (size_t i = m_pDrawObjs->size(); i; )
358 {
359 SwAnchoredObject* pAnchoredObj = (*m_pDrawObjs)[--i];
360 if ( auto pFlyFrame = pAnchoredObj->DynCastFlyFrame() )
361 {
362 SwFrame::DestroyFrame(pFlyFrame);
363 }
364 else
365 {
366 SdrObject* pSdrObj = pAnchoredObj->DrawObj();
367 SwDrawContact* pContact =
368 static_cast<SwDrawContact*>(pSdrObj->GetUserCall());
369 OSL_ENSURE( pContact,
370 "<SwFrame::~SwFrame> - missing contact for drawing object" );
371 if ( pContact )
372 {
373 pContact->DisconnectObjFromLayout( pSdrObj );
374 }
375 }
376 }
377 m_pDrawObjs.reset();
378}
379
381{
382 assert(m_isInDestroy); // check that only DestroySwFrame does "delete"
383 assert(!IsDeleteForbidden()); // check that it's not deleted while deletes are forbidden
384#if OSL_DEBUG_LEVEL > 0
385 // JP 15.10.2001: for detection of access to deleted frames
386 mpRoot = reinterpret_cast<SwRootFrame*>(0x33333333);
387#endif
388}
389
391{
392 if (pFrame)
393 {
394 pFrame->m_isInDestroy = true;
395 pFrame->DestroyImpl();
396 assert(pFrame->mbInDtor); // check that nobody forgot to call base class
397 delete pFrame;
398 }
399}
400
402{
403 return static_cast< const SwFrameFormat * >( GetDep() );
404}
405
407{
408 return static_cast< SwFrameFormat * >( GetDep() );
409}
410
412{
413 if(pNew == GetFormat())
414 return;
415 const SwFormatChg aOldFormat(GetFormat());
416 pNew->Add(this);
417 const SwFormatChg aNewFormat(pNew);
418 SwClientNotify(*pNew, sw::LegacyModifyHint(&aOldFormat, &aNewFormat));
419}
420
422 SwFrame( pContent, pSib ),
423 SwFlowFrame( static_cast<SwFrame&>(*this) )
424{
425 assert(!getRootFrame()->HasMergedParas() || pContent->IsCreateFrameWhenHidingRedlines());
426}
427
429{
430 const SwContentNode* pCNd(dynamic_cast<SwContentNode*>(GetDep()));
431 if (nullptr == pCNd && IsTextFrame())
432 {
433 pCNd = static_cast<SwTextFrame*>(this)->GetTextNodeFirst();
434 }
435 // IsInDtor shouldn't be happening with ViewShell owning layout
436 assert(nullptr == pCNd || !pCNd->GetDoc().IsInDtor());
437 if (nullptr != pCNd && !pCNd->GetDoc().IsInDtor())
438 {
439 //Unregister from root if I'm still in turbo there.
440 SwRootFrame *pRoot = getRootFrame();
441 if( pRoot && pRoot->GetTurbo() == this )
442 {
443 pRoot->DisallowTurbo();
444 pRoot->ResetTurbo();
445 }
446 }
447
449}
450
452{
453}
454
455void SwTextFrame::RegisterToNode(SwTextNode & rNode, bool const isForceNodeAsFirst)
456{
457 if (isForceNodeAsFirst && m_pMergedPara)
458 { // nothing registered here, in particular no delete redlines (insert
459 // redline might end on empty node where delete rl starts, should be ok)
460 assert(m_pMergedPara->pFirstNode->GetIndex() + 1 == rNode.GetIndex());
462 *m_pMergedPara->pFirstNode, RedlineType::Delete) == SwRedlineTable::npos);
463 assert(std::find_if(
466 [this](::sw::mark::IMark const*const pMark) {
467 return pMark->GetMarkStart().GetNode() == *m_pMergedPara->pFirstNode
468 && pMark->GetMarkEnd().GetNode() != *m_pMergedPara->pFirstNode;
470 }
471 assert(&rNode != GetDep());
472 assert(!m_pMergedPara
473 || (m_pMergedPara->pFirstNode->GetIndex() < rNode.GetIndex())
474 || (rNode.GetIndex() + 1 == m_pMergedPara->pFirstNode->GetIndex()));
475 SwTextNode & rFirstNode(
476 (!isForceNodeAsFirst && m_pMergedPara && m_pMergedPara->pFirstNode->GetIndex() < rNode.GetIndex())
477 ? *m_pMergedPara->pFirstNode
478 : rNode);
479 // sw_redlinehide: use New here, because the only caller also calls lcl_ChangeFootnoteRef
481 if (!m_pMergedPara)
482 {
483 rNode.Add(this);
484 }
485}
486
488{
489 while (!m_VertPosOrientFramesFor.empty())
490 {
493 }
494
495 assert(m_VertPosOrientFramesFor.empty());
496
497 SwFrame *pFrame = m_pLower;
498
499 if( GetFormat() && !GetFormat()->GetDoc()->IsInDtor() )
500 {
501 while ( pFrame )
502 {
503 //First delete the Objs of the Frame because they can't unregister
504 //from the page after remove.
505 //We don't want to create an endless loop only because one couldn't
506 //unregister.
507
508 while ( pFrame->GetDrawObjs() && pFrame->GetDrawObjs()->size() )
509 {
510 const size_t nCnt = pFrame->GetDrawObjs()->size();
511 // #i28701#
512 SwAnchoredObject* pAnchoredObj = (*pFrame->GetDrawObjs())[0];
513 if (SwFlyFrame* pFlyFrame = pAnchoredObj->DynCastFlyFrame())
514 {
515 SwFrame::DestroyFrame(pFlyFrame);
516 assert(!pFrame->GetDrawObjs() || nCnt > pFrame->GetDrawObjs()->size());
517 }
518 else
519 {
520 pAnchoredObj->ClearTmpConsiderWrapInfluence();
521 SdrObject* pSdrObj = pAnchoredObj->DrawObj();
522 SwDrawContact* pContact =
523 static_cast<SwDrawContact*>(pSdrObj->GetUserCall());
524 OSL_ENSURE( pContact,
525 "<SwFrame::~SwFrame> - missing contact for drawing object" );
526 if ( pContact )
527 {
528 pContact->DisconnectObjFromLayout( pSdrObj );
529 }
530
531 if ( pFrame->GetDrawObjs() &&
532 nCnt == pFrame->GetDrawObjs()->size() )
533 {
534 pFrame->GetDrawObjs()->Remove( *pAnchoredObj );
535 }
536 }
537 }
538 pFrame->RemoveFromLayout();
539 SwFrame::DestroyFrame(pFrame);
540 pFrame = m_pLower;
541 }
542 //Delete the Flys, the last one also deletes the array.
543 while ( GetDrawObjs() && GetDrawObjs()->size() )
544 {
545 const size_t nCnt = GetDrawObjs()->size();
546
547 // #i28701#
548 SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[0];
549 if ( auto pFlyFrame = pAnchoredObj->DynCastFlyFrame() )
550 {
551 SwFrame::DestroyFrame(pFlyFrame);
552 assert(!GetDrawObjs() || nCnt > GetDrawObjs()->size());
553 }
554 else
555 {
556 SdrObject* pSdrObj = pAnchoredObj->DrawObj();
557 SwDrawContact* pContact =
558 static_cast<SwDrawContact*>(pSdrObj->GetUserCall());
559 OSL_ENSURE( pContact,
560 "<SwFrame::~SwFrame> - missing contact for drawing object" );
561 if ( pContact )
562 {
563 pContact->DisconnectObjFromLayout( pSdrObj );
564 }
565
566 if ( GetDrawObjs() && nCnt == GetDrawObjs()->size() )
567 {
568 GetDrawObjs()->Remove( *pAnchoredObj );
569 }
570 }
571 }
572 }
573 else
574 {
575 while( pFrame )
576 {
577 SwFrame *pNxt = pFrame->GetNext();
578 SwFrame::DestroyFrame(pFrame);
579 pFrame = pNxt;
580 }
581 }
582
584}
585
587{
588}
589
596{
597 // NEW TABLES
598 // Cell frames may not leave their upper:
600 const bool bVert = IsVertical();
602 SwRectFnSet aRectFnSet(this);
603 tools::Long nRight = (aRect.*fnRect->fnGetRight)();
604 tools::Long nLeft = (aRect.*fnRect->fnGetLeft)();
605 const SwFrame* pTmp = this;
606 bool bLeft = true;
607 bool bRight = true;
608 tools::Long nRowSpan = 0;
609 while( pTmp )
610 {
611 if( pTmp->IsCellFrame() && pTmp->GetUpper() &&
612 pTmp->GetUpper()->IsVertical() != pTmp->IsVertical() )
613 nRowSpan = static_cast<const SwCellFrame*>(pTmp)->GetTabBox()->getRowSpan();
614 tools::Long nTmpRight = (pTmp->getFrameArea().*fnRect->fnGetRight)();
615 tools::Long nTmpLeft = (pTmp->getFrameArea().*fnRect->fnGetLeft)();
616 if( pTmp->IsRowFrame() && nRowSpan > 1 )
617 {
618 const SwFrame* pNxt = pTmp;
619 while( --nRowSpan > 0 && pNxt->GetNext() )
620 pNxt = pNxt->GetNext();
621 if( pTmp->IsVertical() )
622 nTmpLeft = (pNxt->getFrameArea().*fnRect->fnGetLeft)();
623 else
624 {
625 // pTmp is a row frame, but it's not vertical.
626 if (IsVertLRBT())
627 {
628 // This frame cell is OK to expand towards the physical down direction.
629 // Physical down is left.
630 nTmpLeft = (pNxt->getFrameArea().*fnRect->fnGetLeft)();
631 }
632 else
633 {
634 nTmpRight = (pNxt->getFrameArea().*fnRect->fnGetRight)();
635 }
636 }
637 }
638 OSL_ENSURE( pTmp, "GetPaintArea lost in time and space" );
639 if( pTmp->IsPageFrame() || pTmp->IsFlyFrame() ||
640 pTmp->IsCellFrame() || pTmp->IsRowFrame() || //nobody leaves a table!
641 pTmp->IsRootFrame() )
642 {
643 // BTLR is OK to expand towards the physical down direction. Physical down is left.
644 if( bLeft || (aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 && !IsVertLRBT()) )
645 nLeft = nTmpLeft;
646 if( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 )
647 nRight = nTmpRight;
648 if( pTmp->IsPageFrame() || pTmp->IsFlyFrame() || pTmp->IsRootFrame() )
649 break;
650 bLeft = false;
651 bRight = false;
652 }
653 else if( pTmp->IsColumnFrame() ) // nobody enters neighbour columns
654 {
655 bool bR2L = pTmp->IsRightToLeft();
656 // the first column has _no_ influence to the left range
657 if( bR2L ? pTmp->GetNext() : pTmp->GetPrev() )
658 {
659 if( bLeft || aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 )
660 nLeft = nTmpLeft;
661 bLeft = false;
662 }
663 // the last column has _no_ influence to the right range
664 if( bR2L ? pTmp->GetPrev() : pTmp->GetNext() )
665 {
666 if( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 )
667 nRight = nTmpRight;
668 bRight = false;
669 }
670 }
671 else if( bVert && pTmp->IsBodyFrame() )
672 {
673 // Header and footer frames have always horizontal direction and
674 // limit the body frame.
675 // A previous frame of a body frame must be a header,
676 // the next frame of a body frame may be a footnotecontainer or
677 // a footer. The footnotecontainer has the same direction like
678 // the body frame.
679 if( pTmp->GetPrev() && ( bLeft || aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 ) )
680 {
681 nLeft = nTmpLeft;
682 bLeft = false;
683 }
684 if( pTmp->GetNext() &&
685 ( pTmp->GetNext()->IsFooterFrame() || pTmp->GetNext()->GetNext() )
686 && ( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 ) )
687 {
688 nRight = nTmpRight;
689 bRight = false;
690 }
691 }
692 pTmp = pTmp->GetUpper();
693 }
694 (aRect.*fnRect->fnSetLeft)( nLeft );
695 (aRect.*fnRect->fnSetRight)( nRight );
696 return aRect;
697}
698
703SwRect SwFrame::UnionFrame( bool bBorder ) const
704{
705 bool bVert = IsVertical();
707 tools::Long nLeft = (getFrameArea().*fnRect->fnGetLeft)();
708 tools::Long nWidth = (getFrameArea().*fnRect->fnGetWidth)();
709 tools::Long nPrtLeft = (getFramePrintArea().*fnRect->fnGetLeft)();
710 tools::Long nPrtWidth = (getFramePrintArea().*fnRect->fnGetWidth)();
711 SwRectFnSet aRectFnSet(this);
712 if (aRectFnSet.XInc(nPrtLeft, nPrtWidth) > nWidth)
713 nWidth = nPrtLeft + nPrtWidth;
714 if( nPrtLeft < 0 )
715 {
716 nLeft += nPrtLeft;
717 nWidth -= nPrtLeft;
718 }
719 SwTwips nRight = aRectFnSet.XInc(nLeft, nWidth);
720 tools::Long nAdd = 0;
721 if( bBorder )
722 {
723 SwBorderAttrAccess aAccess( SwFrame::GetCache(), this );
724 const SwBorderAttrs &rAttrs = *aAccess.Get();
725 const SvxBoxItem &rBox = rAttrs.GetBox();
726 if ( rBox.GetLeft() )
727 nLeft -= rBox.CalcLineSpace( SvxBoxItemLine::LEFT );
728 else
729 nLeft -= rBox.GetDistance( SvxBoxItemLine::LEFT ) + 1;
730 if ( rBox.GetRight() )
731 nAdd += rBox.CalcLineSpace( SvxBoxItemLine::RIGHT );
732 else
733 nAdd += rBox.GetDistance( SvxBoxItemLine::RIGHT ) + 1;
734 if( rAttrs.GetShadow().GetLocation() != SvxShadowLocation::NONE )
735 {
736 const SvxShadowItem &rShadow = rAttrs.GetShadow();
737 nLeft -= rShadow.CalcShadowSpace( SvxShadowItemSide::LEFT );
738 nAdd += rShadow.CalcShadowSpace( SvxShadowItemSide::RIGHT );
739 }
740 }
741 if( IsTextFrame() && static_cast<const SwTextFrame*>(this)->HasPara() )
742 {
743 tools::Long nTmp = static_cast<const SwTextFrame*>(this)->HangingMargin();
744 if( nTmp > nAdd )
745 nAdd = nTmp;
746 }
747 nWidth = aRectFnSet.XDiff(aRectFnSet.XInc(nRight, nAdd), nLeft);
748 SwRect aRet( getFrameArea() );
749 (aRet.*fnRect->fnSetLeft)(nLeft);
750 (aRet.*fnRect->fnSetWidth)( nWidth );
751 return aRet;
752}
753
754/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual const_iterator_t getFieldmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of fieldmarks.
virtual const_iterator_t getFieldmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of fieldmarks.
virtual SwRedlineTable::size_type GetRedlinePos(const SwNode &rNode, RedlineType nType) const =0
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
SdrObjUserCall * GetUserCall() const
sal_Int16 CalcLineSpace(SvxBoxItemLine nLine, bool bEvenIfNoLine=false, bool bAllowNegative=false) const
const editeng::SvxBorderLine * GetRight() const
const editeng::SvxBorderLine * GetLeft() const
sal_Int16 GetDistance(SvxBoxItemLine nLine, bool bAllowNegative=false) const
sal_uInt16 CalcShadowSpace(SvxShadowItemSide nShadow) const
SvxShadowLocation GetLocation() const
tools::Long GetHeight() const
void SetHeight(tools::Long n)
wrapper class for the positioning of Writer fly frames and drawing objects
void ClearTmpConsiderWrapInfluence()
SwFrame * GetAnchorFrameContainingAnchPos()
determine anchor frame containing the anchor position
void ClearVertPosOrientFrame()
virtual void InvalidateObjPos()=0
method to invalidate position of the anchored object
virtual const SwFlyFrame * DynCastFlyFrame() const
virtual void UpdateLayoutDir()
method update layout direction the layout direction, the anchored object is assigned to
SdrObject * DrawObj()
SwBorderAttrs * Get()
Definition: frmtool.cxx:2696
const SvxBoxItem & GetBox() const
Definition: frmtool.hxx:399
const SvxShadowItem & GetShadow() const
Definition: frmtool.hxx:400
SwCellFrame is one table cell in the document layout.
Definition: cellfrm.hxx:31
const SwTableBox * GetTabBox() const
Definition: cellfrm.hxx:52
virtual void DestroyImpl() override
Definition: ssfrm.cxx:428
virtual ~SwContentFrame() override
Definition: ssfrm.cxx:451
SwContentFrame(SwContentNode *const, SwFrame *)
Definition: ssfrm.cxx:421
Definition: doc.hxx:197
bool IsInDtor() const
Definition: doc.hxx:417
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
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:349
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1890
ContactObject for connection of formats as representatives of draw objects in SwClient and the object...
Definition: dcontact.hxx:305
void DisconnectObjFromLayout(SdrObject *_pDrawObj)
disconnect for a dedicated drawing object - could be 'master' or 'virtual'.
Definition: dcontact.cxx:1745
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
void SetHeightSizeType(SwFrameSize eSize)
Definition: fmtfsize.hxx:81
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:168
const SwRect & getFrameArea() const
Definition: frame.hxx:179
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
Style of a layout element.
Definition: frmfmt.hxx:72
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 mbInDtor
Definition: frame.hxx:416
SwRect GetPaintArea() const
|* The paintarea is the area, in which the content of a frame is allowed |* to be displayed.
Definition: ssfrm.cxx:595
std::unique_ptr< SwSortedObjs > m_pDrawObjs
Definition: frame.hxx:413
bool IsTextFrame() const
Definition: frame.hxx:1240
tools::Long GetLeftMargin() const
Definition: ssfrm.cxx:48
virtual void DestroyImpl()
Definition: ssfrm.cxx:329
tools::Long GetPrtLeft() const
Definition: ssfrm.cxx:52
bool IsInDtor() const
Definition: frame.hxx:898
void InvalidateAll()
Definition: frame.hxx:1061
void CheckDirChange()
checks the layout direction and invalidates the lower frames recursively, if necessary.
Definition: ssfrm.cxx:195
tools::Long GetRightMargin() const
Definition: ssfrm.cxx:50
bool IsAccessibleFrame() const
Definition: frame.hxx:1256
Point GetFrameAnchorPos(bool bIgnoreFlysAnchoredAtThisFrame) const
returns the position for anchors based on frame direction
Definition: ssfrm.cxx:294
SwFrame * GetNext()
Definition: frame.hxx:682
virtual ~SwFrame() override
Definition: ssfrm.cxx:380
bool IsPageFrame() const
Definition: frame.hxx:1184
bool IsColumnFrame() const
Definition: frame.hxx:1188
bool SetMinLeft(tools::Long)
Definition: ssfrm.cxx:61
bool IsVertLRBT() const
Definition: frame.hxx:989
bool IsTabFrame() const
Definition: frame.hxx:1224
void SetLeftRightMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:180
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:568
void MakeBelowPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:109
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: wsfrm.cxx:482
bool mbVertical
Definition: frame.hxx:422
static SwCache & GetCache()
Definition: frame.hxx:523
SwFrame * GetLower()
Definition: findfrm.cxx:196
bool IsRightToLeft() const
Definition: frame.hxx:993
virtual bool IsDeleteForbidden() const
Definition: frame.hxx:893
bool SetMaxBottom(tools::Long)
Definition: ssfrm.cxx:77
void SetRightLeftMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:187
void RemoveFromLayout()
Definition: wsfrm.cxx:1018
bool m_isInDestroy
Definition: frame.hxx:445
SwRect UnionFrame(bool bBorder=false) const
|* The unionframe is the framearea (getFrameArea()) of a frame expanded by the |* printarea,...
Definition: ssfrm.cxx:703
bool mbRightToLeft
Definition: frame.hxx:419
bool IsRootFrame() const
Definition: frame.hxx:1180
bool IsFooterFrame() const
Definition: frame.hxx:1200
SwLayoutFrame * GetUpper()
Definition: frame.hxx:684
tools::Long GetPrtTop() const
Definition: ssfrm.cxx:58
tools::Long GetBottomMargin() const
Definition: ssfrm.cxx:46
bool IsVertical() const
Definition: frame.hxx:979
void SetTopBottomMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:173
SwRootFrame * mpRoot
Definition: frame.hxx:336
tools::Long GetPrtBottom() const
Definition: ssfrm.cxx:54
SwRootFrame * getRootFrame()
Definition: frame.hxx:685
bool SetMaxRight(tools::Long)
Definition: ssfrm.cxx:93
bool IsFlyFrame() const
Definition: frame.hxx:1216
void MakeLeftPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:130
tools::Long GetPrtRight() const
Definition: ssfrm.cxx:56
bool mbInvalidR2L
Definition: frame.hxx:417
SwFrame * GetPrev()
Definition: frame.hxx:683
bool IsVertLR() const
Definition: frame.hxx:985
void SetInvalidVert(bool bNew)
Definition: frame.hxx:634
sw::BroadcastingModify * GetDep()
use these so we can grep for SwFrame's GetRegisteredIn accesses beware that SwTextFrame may return sw...
Definition: frame.hxx:478
void MakeRightPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:152
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
Definition: ssfrm.cxx:390
tools::Long GetTopMargin() const
Definition: ssfrm.cxx:44
bool IsLayoutFrame() const
Definition: frame.hxx:1176
bool IsBodyFrame() const
Definition: frame.hxx:1212
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
void SetFrameFormat(SwFrameFormat *)
Definition: ssfrm.cxx:411
void AdjustColumns(const SwFormatCol *pCol, bool bAdjustAttributes)
Definition: colfrm.cxx:313
virtual const SwFrameFormat * GetFormat() const
Definition: ssfrm.cxx:401
virtual void DestroyImpl() override
Definition: ssfrm.cxx:487
std::vector< SwAnchoredObject * > m_VertPosOrientFramesFor
Definition: layfrm.hxx:54
SwFrame * m_pLower
Definition: layfrm.hxx:53
virtual ~SwLayoutFrame() override
Definition: ssfrm.cxx:586
const SwFrame * Lower() const
Definition: layfrm.hxx:101
SwNodeOffset GetIndex() const
Definition: node.hxx:312
SwDoc & GetDoc()
Definition: node.hxx:233
bool IsCreateFrameWhenHidingRedlines() const
Definition: node.hxx:112
A page of the document layout.
Definition: pagefrm.hxx:60
tools::Long XDiff(tools::Long n1, tools::Long n2) const
Definition: frame.hxx:1427
tools::Long XInc(tools::Long n1, tools::Long n2) const
Definition: frame.hxx:1429
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
void Pos(const Point &rNew)
Definition: swrect.hxx:171
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
void Width(tools::Long nNew)
Definition: swrect.hxx:189
static constexpr size_type npos
Definition: docary.hxx:224
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:215
const SwContentFrame * GetTurbo() const
Definition: rootfrm.hxx:361
bool IsAnyShellAccessible() const
Definition: rootfrm.hxx:402
void DisallowTurbo() const
Definition: rootfrm.hxx:356
void ResetTurbo()
Definition: rootfrm.hxx:360
class for collecting anchored objects
Definition: sortedobjs.hxx:49
size_t size() const
Definition: sortedobjs.cxx:43
void Remove(SwAnchoredObject &_rAnchoredObj)
Definition: sortedobjs.cxx:229
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:49
sal_Int32 getRowSpan() const
Definition: swtable.hxx:540
SwTableLine is one table row in the document model.
Definition: swtable.hxx:376
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:398
SwFrameFormat * ClaimFrameFormat()
Definition: swtable.cxx:1482
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
std::unique_ptr< sw::MergedPara > m_pMergedPara
redline merge data
Definition: txtfrm.hxx:205
void RegisterToNode(SwTextNode &, bool isForceNodeAsFirst=false)
Definition: ssfrm.cxx:455
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true) override
SwContentFrame: the shortcut for the Frames If the void* casts wrongly, it's its own fault!...
Definition: txtfrm.cxx:2840
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
void DisposeAccessibleFrame(const SwFrame *pFrame, bool bRecursive=false)
Definition: viewimp.hxx:287
SwViewShellImp * Imp()
Definition: viewsh.hxx:211
void setContextWritingMode(SdrObject *pObj, SwFrame const *pAnchor)
Definition: dcontact.cxx:103
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
@ Fixed
Frame cannot be moved in Var-direction.
@ Minimum
Value in Var-direction gives minimum (can be exceeded but not be less).
SwRectFn fnRectVert
Definition: frame.hxx:1353
SwRectFn fnRectVertL2RB2T
Definition: frame.hxx:1353
SwRectFn fnRectHori
Definition: newfrm.cxx:287
SwRectFn fnRectVertL2R
Definition: frame.hxx:1353
size
int i
std::unique_ptr< sw::MergedPara > CheckParaRedlineMerge(SwTextFrame &rFrame, SwTextNode &rTextNode, FrameMode eMode)
Definition: redlnitr.cxx:268
long Long
SwRectSet fnSetWidth
Definition: frame.hxx:1309
SwRectGet fnGetWidth
Definition: frame.hxx:1300
SwRectGet fnGetLeft
Definition: frame.hxx:1298
SwRectSet fnSetLeft
Definition: frame.hxx:1307
SwRectSet fnSetRight
Definition: frame.hxx:1308
SwRectGet fnGetRight
Definition: frame.hxx:1299
tools::Long SwTwips
Definition: swtypes.hxx:51