[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Jan 30 15:31:39 UTC 2019
sw/source/uibase/docvw/UnfloatTableButton.cxx | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
New commits:
commit 9d319865f8bf78d25ca2e614d148420054a6461a
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jan 30 12:08:41 2019 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jan 30 16:31:13 2019 +0100
Unfloat: Need to move the page desc into the table node AttrSet
Change-Id: Ib9868bb31238905dd178fcf54c79f013079a037b
Reviewed-on: https://gerrit.libreoffice.org/67126
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
diff --git a/sw/source/uibase/docvw/UnfloatTableButton.cxx b/sw/source/uibase/docvw/UnfloatTableButton.cxx
index 3c564b95024a..0592378ec768 100644
--- a/sw/source/uibase/docvw/UnfloatTableButton.cxx
+++ b/sw/source/uibase/docvw/UnfloatTableButton.cxx
@@ -114,12 +114,24 @@ void UnfloatTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/)
// of the text node otherwise LO will create a page break after the table
if (pTextFrame->GetTextNodeFirst())
{
- SfxItemSet aSet(GetEditWin()->GetView().GetWrtShell().GetAttrPool(),
- svl::Items<RES_PAGEDESC, RES_PAGEDESC>{});
- aSet.Put(SwFormatPageDesc(nullptr));
- SwPaM aPaM(*pTextFrame->GetTextNodeFirst());
- rDoc.getIDocumentContentOperations().InsertItemSet(aPaM, aSet, SetAttrMode::DEFAULT,
- GetPageFrame()->getRootFrame());
+ const SwPageDesc* pPageDesc
+ = pTextFrame->GetPageDescItem().GetPageDesc(); // First text node of the page has this
+ if (pPageDesc)
+ {
+ // First set the existing page desc for the table node
+ SfxItemSet aSet(GetEditWin()->GetView().GetWrtShell().GetAttrPool(),
+ svl::Items<RES_PAGEDESC, RES_PAGEDESC>{});
+ aSet.Put(SwFormatPageDesc(pPageDesc));
+ SwPaM aPaMTable(*pTableNode);
+ rDoc.getIDocumentContentOperations().InsertItemSet(
+ aPaMTable, aSet, SetAttrMode::DEFAULT, GetPageFrame()->getRootFrame());
+
+ // Then remove pagedesc from the attributes of the text node
+ aSet.Put(SwFormatPageDesc(nullptr));
+ SwPaM aPaMTextNode(*pTextFrame->GetTextNodeFirst());
+ rDoc.getIDocumentContentOperations().InsertItemSet(
+ aPaMTextNode, aSet, SetAttrMode::DEFAULT, GetPageFrame()->getRootFrame());
+ }
}
// Move the table outside of the text frame
More information about the Libreoffice-commits
mailing list