summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-12-04 20:26:49 +0300
committerAron Budea <aron.budea@collabora.com>2019-12-14 02:58:43 +0100
commit40f6268c2a50d29e782a0bbdc828d4dfa9136c70 (patch)
tree247157d929b2acafd49387526601fb30dc11d972
parenta69f5b1386fc7e3f7f9838c078e4078eeeec555d (diff)
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@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/84680 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Aron Budea <aron.budea@collabora.com> Tested-by: Aron Budea <aron.budea@collabora.com>
-rw-r--r--sw/source/uibase/docvw/FloatingTableButton.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sw/source/uibase/docvw/FloatingTableButton.cxx b/sw/source/uibase/docvw/FloatingTableButton.cxx
index 598fc547d9aa..364611fbf80b 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->GetTextNode()->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<SfxGrabBagItem>(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->GetTextNode())