summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBakos Attila <bakos.attilakaroly@nisz.hu>2020-02-11 11:43:48 +0100
committerLászló Németh <nemeth@numbertext.org>2020-02-21 16:08:51 +0100
commitad8857dab30e099a0cf6ec18d184a6c836b33317 (patch)
tree42530401d14bf11c693ff2dba081bd4d53515f3a /sw
parent4b3cccf59d200d96b1779bdd0d114b33597ef01e (diff)
tdf#130120 DOCX: export o:allowincell
Object anchors are set by allowincell/ LayoutInCell attributes in table cells. Export it by grab bag method temporarily, instead of using the suggested FollowTextFlow, related also to the missing GUI support. Follow-up of commit 14ad64270e4fbca3c24da6f55f260b1fb229556a (tdf#129888 DOCX shape import: handle o:allowincell) Change-Id: If883511b6114e8f60d673ecbd3a11095fcafddc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88438 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf130120.docxbin0 -> 23067 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx9
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx23
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx1
4 files changed, 30 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf130120.docx b/sw/qa/extras/ooxmlexport/data/tdf130120.docx
new file mode 100644
index 000000000000..5ca2adc76d60
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf130120.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index c78dbf3ddd95..7c02ef57d4fc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -88,6 +88,15 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129888dml, "tdf129888dml.docx")
text::RelOrientation::PAGE_FRAME, nValue);
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130120, "tdf130120.docx")
+{
+ //Text for exporting the allowincell attribute:
+ xmlDocPtr p_XmlDoc = parseExport("word/document.xml");
+ assertXPath(p_XmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r/mc:AlternateContent/"
+ "mc:Choice/w:drawing/wp:anchor","layoutInCell","0");
+}
+
+
DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
{
//the original tdf87569 sample has vml shapes...
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 8ab399a46fe3..e18cbd532a18 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -31,8 +31,9 @@
#include <comphelper/sequence.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <sal/log.hxx>
-
+#include <frmfmt.hxx>
#include <IDocumentDrawModelAccess.hxx>
+#include <comphelper/propertysequence.hxx>
using namespace com::sun::star;
using namespace oox;
@@ -465,7 +466,25 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
attrList->add(XML_distR, OString::number(nDistR).getStr());
attrList->add(XML_simplePos, "0");
attrList->add(XML_locked, "0");
- attrList->add(XML_layoutInCell, "1");
+ bool bLclInTabCell = true;
+ if (pObj)
+ {
+ uno::Reference<drawing::XShape> xShape((const_cast<SdrObject*>(pObj)->getUnoShape()),
+ uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> propList = lclGetProperty(xShape, "InteropGrabBag");
+ if (propList.hasElements())
+ {
+ auto pLclProp = std::find_if(
+ std::begin(propList), std::end(propList),
+ [](const beans::PropertyValue& rProp) { return rProp.Name == "LayoutInCell"; });
+ if (pLclProp && pLclProp != propList.end())
+ pLclProp->Value >>= bLclInTabCell;
+ }
+ }
+ if (bLclInTabCell)
+ attrList->add(XML_layoutInCell, "1");
+ else
+ attrList->add(XML_layoutInCell, "0");
bool bAllowOverlap = pFrameFormat->GetWrapInfluenceOnObjPos().GetAllowOverlap();
attrList->add(XML_allowOverlap, bAllowOverlap ? "1" : "0");
if (pObj != nullptr)
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 9e93aef7c14a..8bd5b6f42b78 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2684,7 +2684,6 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp )
SdrObject::Free(pObject);
return nullptr;
}
-
const bool bLayoutInTableCell =
m_nInTable && IsObjectLayoutInTableCell( pRecord->nLayoutInTableCell );