[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sw/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sat Dec 14 01:59:29 UTC 2019


 sw/source/uibase/docvw/FloatingTableButton.cxx |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

New commits:
commit 40f6268c2a50d29e782a0bbdc828d4dfa9136c70
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Dec 4 20:26:49 2019 +0300
Commit:     Aron Budea <aron.budea at collabora.com>
CommitDate: Sat Dec 14 02:58:43 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>
    Reviewed-on: https://gerrit.libreoffice.org/84680
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Tested-by: Aron Budea <aron.budea at collabora.com>

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())


More information about the Libreoffice-commits mailing list