sw/source/uibase/docvw/FloatingTableButton.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
New commits: commit d170b73a6d75545ccb45ca58808573d03a1b0bec Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Dec 4 20:26:49 2019 +0300 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Sat Dec 14 02:58:58 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> Reviewed-on: https://gerrit.libreoffice.org/84679 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Aron Budea <aron.bu...@collabora.com> diff --git a/sw/source/uibase/docvw/FloatingTableButton.cxx b/sw/source/uibase/docvw/FloatingTableButton.cxx index e35c0de5f951..c18b6d485b52 100644 --- a/sw/source/uibase/docvw/FloatingTableButton.cxx +++ b/sw/source/uibase/docvw/FloatingTableButton.cxx @@ -24,6 +24,8 @@ #include <pagefrm.hxx> #include <ndindex.hxx> #include <swtable.hxx> +#include <unoprnms.hxx> +#include <unotbl.hxx> #include <IDocumentState.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentLayoutAccess.hxx> @@ -35,6 +37,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 @@ -108,6 +111,25 @@ void FloatingTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/) SwDoc& rDoc = *pTextFrame->GetTextNodeFirst()->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