sw/source/uibase/docvw/UnfloatTableButton.cxx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
New commits: commit 089b409a618491c2881d2380ccd1dc4f57272445 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Dec 4 20:26:49 2019 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Dec 17 09:07:11 2019 +0100 tdf#129176: clear "TablePosition" grab bag when unfloating table The operation explicitly changes the table to be not floating; this will change its position; yet when saving back to DOCX, saved values from the grab bag were used, incorrectly restoring table floating state. Change-Id: I19c185849443dc1a8b5ac974e09349c206b0506b Reviewed-on: https://gerrit.libreoffice.org/84446 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 2a9e162564a6af63bece77f50fc553640e747b9e) Reviewed-on: https://gerrit.libreoffice.org/84547 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/uibase/docvw/UnfloatTableButton.cxx b/sw/source/uibase/docvw/UnfloatTableButton.cxx index 63604b6a3525..fb243624d574 100644 --- a/sw/source/uibase/docvw/UnfloatTableButton.cxx +++ b/sw/source/uibase/docvw/UnfloatTableButton.cxx @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * @@ -26,6 +26,8 @@ #include <ndindex.hxx> #include <ndtxt.hxx> #include <swtable.hxx> +#include <unoprnms.hxx> +#include <unotbl.hxx> #include <IDocumentState.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentLayoutAccess.hxx> @@ -37,6 +39,7 @@ #include <drawinglayer/processor2d/processorfromoutputdevice.hxx> #include <basegfx/vector/b2dvector.hxx> #include <DocumentContentOperationsManager.hxx> +#include <svl/grabbagitem.hxx> #define TEXT_PADDING 3 #define BOX_DISTANCE 3 @@ -110,6 +113,25 @@ void UnfloatTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/) SwDoc& rDoc = pTextFrame->GetDoc(); + // tdf#129176: clear "TablePosition" grab bag, since we explicitly change the position here + // See DomainMapperTableHandler::endTableGetTableStyle, where the grab bag is filled, and + // DocxAttributeOutput::TableDefinition that uses it on export + SwFrameFormat* pTableFormat = pTableFrame->GetTable()->GetFrameFormat(); + assert(pTableFormat); + if (const SfxGrabBagItem* pGrabBagItem = pTableFormat->GetAttrSet().GetItem(RES_FRMATR_GRABBAG)) + { + SfxGrabBagItem aGrabBagItem(*pGrabBagItem); // Editable copy + if (aGrabBagItem.GetGrabBag().erase("TablePosition")) + { + css::uno::Any aVal; + aGrabBagItem.QueryValue(aVal); + const auto xTable = SwXTextTable::CreateXTextTable(pTableFormat); + const css::uno::Reference<css::beans::XPropertySet> xSet(xTable, css::uno::UNO_QUERY); + assert(xSet); + xSet->setPropertyValue(UNO_NAME_TABLE_INTEROP_GRAB_BAG, aVal); + } + } + // When we move the table before the first text node, we need to clear RES_PAGEDESC attribute // of the text node otherwise LO will create a page break after the table if (pTextFrame->GetTextNodeFirst()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits