[Libreoffice-commits] core.git: sw/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Thu Dec 5 05:00:54 UTC 2019
sw/source/uibase/docvw/UnfloatTableButton.cxx | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
New commits:
commit 2a9e162564a6af63bece77f50fc553640e747b9e
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Dec 4 20:26:49 2019 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Dec 5 05:59:48 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.kaganski at collabora.com>
Tested-by: Mike Kaganski <mike.kaganski at 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())
More information about the Libreoffice-commits
mailing list