/writerperfect/qa/

c/flyfrms.hxx?h=master' type='application/atom+xml'/>
summaryrefslogtreecommitdiff
path: root/sw/source/core/inc/flyfrms.hxx
AgeCommit message (Collapse)Author
2024-05-13Revert "reduce symbol visibility in sw"Thorsten Behrens
This reverts commit 1a6711276f0c8abeb0028a47cc345a7453374a38. After some discussion and experiments, it turned out this rather fundamentally breaks clang's PCH build. Conclusion was: this change is not significant enough to warrant making life harder for developers. Excerpt of errors (affected were vbaswobj, msword & swui libs): - ld.lld: error: undefined symbol: SwFormat::~SwFormat() >>> referenced by fmtcol.hxx:37 (sw/inc/fmtcol.hxx:37) >>> core/workdir/CxxObject/sw/inc/pch/precompiled_vbaswobj.o:(SwFormatColl::~SwFormatColl()) - ld.lld: error: undefined symbol: SwFrameFormat::SetPositionLayoutDir(short) >>> referenced by precompiled_msword.cxx >>> core/workdir/CxxObject/sw/inc/pch/precompiled_msword.o:(vtable for sw::SpzFrameFormat) - ld.lld: error: undefined symbol: SwFrameFormat::SetLayoutDir(SwFrameFormat::tLayoutDir) >>> referenced by precompiled_swui.cxx >>> core/workdir/CxxObject/sw/inc/pch/precompiled_swui.o:(vtable for sw::SpzFrameFormat) Change-Id: I1dcf115cc191b1ebf1f8d5023c0c5015f891287a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167549 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-03-13reduce symbol visibility in swNoel Grandin
Change-Id: Ib3edefc365d3c605c3024e160572fa4030100ef1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164724 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-10-13sw floattable, wrap on all pages: add layoutMiklos Vajna
The anchor text of a floating table is normally wrapped around the table only on the last page of the table. This compat flag requests to wrap on all pages instead. First, disable the SwTextFrame::FormatEmpty() optimization in this case, so not only the last page has portions inside the text frame. Second, improve SwTextFrame::FormatAdjust(), so that anchor content from the last page can flow to previous pages. Note that having a dedicated SwFlyAtContentFrame::IsWrapOnAllPages() means that later it'll be possible to do per-frame decision on this if there is demand for that (this came up on the mailing list, but it's not something Word would support). Change-Id: I75df539df859aaa6c7eaaeddb33f004639b1c004 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157902 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-04-04sw: document at-char vs as-char layout framesMiklos Vajna
"bound to a character" is a bit misleading for as-char. Change-Id: I0c322c88f81bf96c7b4818598cfbef4fc7f4baea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149996 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-03-31sw floattable: remove empty follow flys on follow table removalMiklos Vajna
- add a SwRootFrame::DeleteEmptyFlys_(), which can delete empty flys and invalidate the anchors, so the necessary text frame joins and page frame deletions happen - add a SwRootFrame::InsertEmptyFly(), which can build a to-delete list for DeleteEmptyFlys_() - add a SwFlyAtContentFrame::DelEmpty(), which can call InsertEmptyFly() for one empty fly frame - in SwTabFrame::Cut(), call DelEmpty() on the fly parent, similar to how we do it for sections - in SwLayAction::InternalAction(), call DeleteEmptyFlys() to actually delete the unnecessary fly frames Change-Id: I8d3b4ee2c07b60d6187059bb177c56a129810750 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149815 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-02-13sw floattable: handle table-in-fly in SwFrame::GetNextFlyLeaf()Miklos Vajna
Trying to lay out a split fly that contains a table resulted in a stack overflow. The reason for this was that SwObjectFormatter::FormatObjsAtFrame_() has a loop that will format all objects of the current fly frame, but we managed to anchor the follow fly into itself. Fix the problem by improving SwFrame::GetNextFlyLeaf(), somewhat based on how SwFrame::GetNextSctLeaf() has special cases for tables. This way once we split the fly frame, we'll try to move the follow anchor frame to the next page's body frame, and not to a child of the follow fly itself. Also add a first floattable testcase, we can already assert that the table is split correctly. Do this in a separate suite for now, since the pool's default SwFormatFlySplit is only created once, so SwFormatFlySplit::SetForce(false) doesn't have the wanted effect. The anchor's text is still on both pages, should be on page 2 only. Change-Id: Ie2ce75dbace5d9716008351aedb6a8989036badb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146854 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-02-07sw: handle split flys in SwTextFormatter::FormatLine()Miklos Vajna
One workaround in SwFrame::GetNextFlyLeaf() is to assume that there is always a next frame after the fly's anchor when we split the fly. An alternative to this is to split the fly's anchor as well, so we always have a next such frame. When this happens, we hit various problems, the first is that once we have 2 flys after the split, we try to move the first fly to page 2 as well. The reason for this appears to be that SwTextFormatter::FormatLine() sets the height of the line in the fly's anchor to 1 twip larger than the available space. Disable this tweak when the only reason that text frame is on the page to serve as an anchor. We definitely don't want to move it to the next page, arguing it's too large. Towards an initial layout for multi-page fly frames. Change-Id: Ia7b7a93ff78af640366fb49e30e910e5f4e0e0a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146602 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-02-06sw: implement SwFrame::GetPrevFlyLeaf()Miklos Vajna
This is much easier than the "next" case, since here we can nullptr when there is no previous leaf instead of creating one. With this, if the MoveBwd() call in SwContentFrame::MakeAll() is disabled, some simple fly frame can be split across 2 pages if it's positioned in a way that the rectangle of the fly would not fit into the body frame without changing the position, in SW_FORCE_FLY_SPLIT=1 mode. Towards an initial layout for multi-page fly frames. Change-Id: I3b6ba85ad66117b5595a113d688e2fcb97bcf745 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146571 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-02-03sw: avoid unwanted initial content in split/follow fly framesMiklos Vajna
If the fly on the first gets split, SwFrame::GetNextFlyLeaf() will create a follow fly frame. Don't fill this one with content, we'll instead want to move some of the content of the master here. (Which is not yet working.) InsertCnt() is called *really* early, so we can't check if this frame has a master -- just pass a bool around instead. This fixes the unwanted first paragraph in the follow fly frame at least. (The one that fits the master already.) Towards an initial layout for multi-page fly frames. Change-Id: If364fdaf7595fbc5addbc6b3b3b0092e958c5380 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146539 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-30sw: add an initial SwFrame::GetNextFlyLeaf()Miklos Vajna
To be called by SwFrame::GetLeaf() in the future. Towards an initial layout for multi-page fly frames. Change-Id: I62f895c2db89513fe124113c81c9f14bfb8ed697 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146337 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-27sw: add an SwFlyAtContentFrame ctor that creates a follow fly frameMiklos Vajna
This is meant to be a called by a future SwFrame::GetNextFlyLeaf() (similar to the existing SwFrame::GetNextSctLeaf()), which still has to be added. What an anchor should be for a follow fly frame is a bit unclear to me, let's go with an explicit nullptr for now and we can clarify that later. Towards an initial layout for multi-page fly frames. Change-Id: I2429f47aef90dfe61340bfe244353dcefeb4ef1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146244 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-01-26sw: inherit SwFlyAtContentFrame from SwFlowFrameMiklos Vajna
Checking how e.g. section frames are split in SwFrame::GetNextLeaf(), we call into SwFrame::GetNextSctLeaf() which then calls a dedicated SwSectionFrame ctor that connects the master with its follow. Add infrastructure to be able to do the same for fly at-content frames. (At-fly anchored and as-char anchored frames are not relevant for the broader multi-page floating table picture. Also, SwFrame::GetLeaf() wants to work with a non-abstract type, so allocating SwFlyFrame there would make no sense, so inherit SwFlyAtContentFrame and not SwFlyFrame from SwFlowFrame.) This is meant to be a minimal change, that can be unconditional, seeing that the only dynamic_cast to SwFlowFrame in RestoreContent() only does something if the frame has a follow, which is never the case at the moment. Towards an initial layout for multi-page fly frames. Change-Id: I8ea930bed4bbddb96b181796ab893e810ba9dcd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146160 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-12-21tdf#146875 sw: move also at-frame flys off SwPageFrameMichael Stahl
The bugdoc contains an at-frame anchored fly on page 77, which is anchored to an at-page anchored fly. While layouting page 74, the fly is moved to page 77, and the content on page 74 invalidated. Unexpectedly, calling RegisterAtPage on a SwFlyLayFrame does absolutely nothing, as it calls the base class SwFlyFrame, so the fly stays on page 74. Thus, page 74 never actually becomes valid, and later pages are never layouted. (regression from commit eb85de8e6b61fb3fcb6c03ae0145f7fe5478bccf) Change-Id: I4fcbed4daf83f9e554de5a877a40b2c2419c0f2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144631 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-04-20tdf#138785 sw: fix mis-positioned as-char flys when deleting empty pageMichael Stahl
When SwFrame::CheckPageDescs() deletes an empty page in the middle of the document, which happens during SetRedlineFlags() here, the SwFlyInContentFrame::maFrameArea is moved in lcl_MoveAllLowers(), but the SwFlyInContentFrame::m_aRefPoint stays unchanged. Because the formatting occurs only after the redline mode is reset, the position of the SwFlyInContentFrame when it is formatted is exactly the same as its (stale) m_aRefPoint, so the setting of (updated) maFrameArea is skipped in SwAsCharAnchoredObjectPosition::CalcPosition(), so the fly ends up a page above where it should be. So keep m_aRefPoint consistent with maFrameArea in lcl_MoveAllLowers(). (regression from b9ef71476fd70bc13f50ebe80390e0730d1b7afb) Change-Id: If1b421daa0d71718d89d9772f5c0d9e367e76845 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114332 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-04-19sw: layout: if fly's anchor moves forward, move fly off SwPageFrameMichael Stahl
The problem is that on Show Changes->Hide Changes->Show Changes in a 311 page document, the fly "Grafik1" was initially on page 203 but ends up on page 204, with a fly-sized gap on page 194. In a 25 page cut down version of the bugdoc, on layout action 659 the fly's anchor SwTextFrame moves from page 21 to page 22, but the fly remains in the SwPageFrame's m_pSortedObjs, because it's not the anchor frame itself that moves but a distant previous frame, and page 21 goes valid. 0 SwFlowFrame::PasteTree(SwFrame*, SwLayoutFrame*, SwFrame*, SwFrame*) (pStart=0x57c9e30, pParent=0xba15c50, pSibling=0x5a0f920, pOldParent=0xb057690) at sw/source/core/layout/flowfrm.cxx:586 1 SwFlowFrame::MoveSubTree(SwLayoutFrame*, SwFrame*) (this=0x57c9f48, pParent=0xba15c50, pSibling=0x5a0f920) at sw/source/core/layout/flowfrm.cxx:677 2 SwFlowFrame::MoveFwd(bool, bool, bool) (this=0x57c9f48, bMakePage=true, bPageBreak=false, bMoveAlways=false) at sw/source/core/layout/flowfrm.cxx:2061 3 SwContentFrame::MakeAll(OutputDevice*) (this=0x57c9e30) at sw/source/core/layout/calcmove.cxx:1831 4 SwFrame::OptPrepareMake() (this=0x57c9e30) at sw/source/core/layout/calcmove.cxx:399 5 SwFrame::OptCalc() const (this=0x57c9e30) at sw/source/core/inc/frame.hxx:1065 6 SwLayAction::FormatContent_(SwContentFrame const*, SwPageFrame const*) (this=0x7ffec0191b30, pContent=0x57c9e30, pPage=0xb9a1fd0) at sw/source/core/layout/layact.cxx:1833 In subsequent layout actions the anchor frame moves forward one page at a time, until in action 665, when things get really interesting. On page 24, the anchor text frame 582 is formatted for the first time, and it moves the fly to page 24, after positioning it on the page. 2 SwPageFrame::MoveFly(SwFlyFrame*, SwPageFrame*) (this=0xb9a1fd0, pToMove=0x641d310, pDest=0x9125bb0) at sw/source/core/layout/flylay.cxx:972 3 SwFlyAtContentFrame::RegisterAtCorrectPage() (this=0x641d310) at sw/source/core/layout/flycnt.cxx:1432 4 SwAnchoredObject::SetVertPosOrientFrame(SwLayoutFrame const&) (this=0x641d468, _rVertPosOrientFrame=...) at sw/source/core/layout/anchoredobject.cxx:195 5 SwFlyAtContentFrame::MakeObjPos() (this=0x641d310) at sw/source/core/layout/flycnt.cxx:1466 6 SwFlyFreeFrame::MakeAll(OutputDevice*) (this=0x641d310) at sw/source/core/layout/flylay.cxx:223 7 SwFlyAtContentFrame::MakeAll(OutputDevice*) (this=0x641d310, pRenderContext=0x55b1f00) at sw/source/core/layout/flycnt.cxx:384 8 SwFrame::PrepareMake(OutputDevice*) (this=0x641d310, pRenderContext=0x55b1f00) at sw/source/core/layout/calcmove.cxx:375 9 SwFrame::Calc(OutputDevice*) const (this=0x641d310, pRenderContext=0x55b1f00) at sw/source/core/layout/trvlfrm.cxx:1791 10 SwFlyFrame::Calc(OutputDevice*) const (this=0x641d310, pRenderContext=0x55b1f00) at sw/source/core/layout/fly.cxx:2874 11 SwLayAction::FormatLayoutFly(SwFlyFrame*) (this=0x7ffec0191b30, pFly=0x641d310) at sw/source/core/layout/layact.cxx:1455 12 SwObjectFormatter::FormatObj_(SwAnchoredObject&) (this=0xa5c0d10, _rAnchoredObj=...) at sw/source/core/layout/objectformatter.cxx:286 13 SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject&, bool) (this=0xa5c0d10, _rAnchoredObj=..., _bCheckForMovedFwd=false) at sw/source/core/layout/objectformattertxtfrm.cxx:135 14 SwObjectFormatter::FormatObjsAtFrame_(SwTextFrame*) (this=0xa5c0d10, _pMasterTextFrame=0x0) at sw/source/core/layout/objectformatter.cxx:408 15 SwObjectFormatterTextFrame::DoFormatObjs() (this=0xa5c0d10) at sw/source/core/layout/objectformattertxtfrm.cxx:337 16 SwObjectFormatter::FormatObjsAtFrame(SwFrame&, SwPageFrame const&, SwLayAction*) (_rAnchorFrame=..., _rPageFrame=..., _pLayAction=0x7ffec0191b30) at sw/source/core/layout/objectformatter.cxx:160 17 SwLayAction::FormatContent(SwPageFrame const*) (this=0x7ffec0191b30, pPage=0x9125bb0) at sw/source/core/layout/layact.cxx:1675 18 SwLayAction::InternalAction(OutputDevice*) (this=0x7ffec0191b30, pRenderContext=0x55b1f00) at sw/source/core/layout/layact.cxx:771 Nothing invalidates page 21 now that the fly is gone, and formatting on page 24 is kind of pointless now because everything from page 21 on is wrongly positioned. (It's possible to skip out of the main layout action loop via SetNextCycle()/IsAgain(), but at this point it's in layact:771 in the layout-all-the-visible-pages loop that follows the main loop, and that one can't be cancelled.) Then DoFormatObjs() is called on frame 582, and this calls FormatAnchorFrameForCheckMoveFwd(), which formats previous frame 581, splitting it and moving its follow along with 582 to page 25. Here SwMovedFwdFramesByObjPos::Insert() is called, and now the anchor text frame 582 cannot move back to page 24 because it's prevented by SwMovedFwdFramesByObjPos::FrameMovedFwdByObjPos(), but that was all based on the wrong assumption that the pages before 24 were completely formatted (this happens in action 670). Something later formats page 21 again, and so at the end there is a fly-sized hole at the bottom of page 24, with frame 582 at the top of page 25. It won't help to detect a situation where the fly is on a page previous to the page it's anchor frame is on in DoFormatObjs() because it was actually moved to the same page in a previous formatting of the anchor frame, in the same layout action. To fix this, try to detect in SwLayAction::FormatContent() if the anchor frame of any fly on the page has moved forward, and move those flys off the page; this is enough for the 25 page document. The 311 page document still has a hole on page 194 though; apparently the last content frame on the page is never reformatted, so invalidate its size. Change-Id: I232c6b305e8593bfecd885c36058777f3980f82f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114066 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2020-12-30atrflyin.cxx Modify no moreBjoern Michaelsen
the fragile tests depending on specific order of objects any a bit unfortunate ... Change-Id: Ib74ec2a69c95e6ca859d7c75796081ac889ac32d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107647 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>