summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Arato (NISZ) <arato.daniel@nisz.hu>2020-09-02 15:46:56 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2020-09-15 12:55:59 +0200
commit2048a2c268125f17a440ec449df4030b91758172 (patch)
tree49a86a8b2117aaf5ceb378f04ab7a797c76c795c
parent22886babfdb9fad2e50d40e04250d54366a9a708 (diff)
tdf#135665 DOCX: import tight wrap setting of VML shapes
The wrap setting that OOXML calls "tight" and LibreOffice calls "contour" (== true) was not supported by the import code, only the export. Change-Id: I48739ffaad48e28df05fd87a9b51a14238dc47e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101932 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 4b7ee7bd61f78be60211cc72ba36da987191266e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102124 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--oox/source/token/properties.txt1
-rw-r--r--oox/source/vml/vmlshape.cxx1
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf135665.docxbin0 -> 25099 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport15.cxx17
-rw-r--r--sw/source/core/unocore/unoframe.cxx8
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx17
6 files changed, 32 insertions, 12 deletions
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 41e33ea67c26..5ae85fd245e1 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -508,6 +508,7 @@ SubViewSize
Subtotals
Suffix
Surround
+SurroundContour
SwapXAndYAxis
Symbol
SymbolColor
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index a1e5744db8da..d52e8e97fe1d 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -584,6 +584,7 @@ static void lcl_setSurround(PropertySet& rPropSet, const ShapeTypeModel& rTypeMo
nSurround = css::text::WrapTextMode_NONE;
rPropSet.setProperty(PROP_Surround, static_cast<sal_Int32>(nSurround));
+ rPropSet.setProperty(PROP_SurroundContour, aWrapType == "tight");
}
static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel, const GraphicHelper& rGraphicHelper)
diff --git a/sw/qa/extras/ooxmlexport/data/tdf135665.docx b/sw/qa/extras/ooxmlexport/data/tdf135665.docx
new file mode 100644
index 000000000000..2400a1c1a46c
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf135665.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 792e919394b7..ab204e9c5e67 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -41,7 +41,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133370_columnBreak, "tdf133370_columnBreak.odt")
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
-DECLARE_OOXMLIMPORT_TEST(testTdf131801, "tdf131801.docx")
+DECLARE_OOXMLEXPORT_TEST(testTdf131801, "tdf131801.docx")
{
CPPUNIT_ASSERT_EQUAL(1, getPages());
@@ -126,6 +126,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(720), getXPath(pDump, "//page[1]/body/txt[1]/Text[3]", "nWidth").toInt32());
}
+DECLARE_OOXMLEXPORT_TEST(testTdf135665, "tdf135665.docx")
+{
+ uno::Reference<beans::XPropertySet> xOLEProps1(getShape(1), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xOLEProps2(getShape(2), uno::UNO_QUERY_THROW);
+ bool bSurroundContour1 = false;
+ bool bSurroundContour2 = false;
+ xOLEProps1->getPropertyValue("SurroundContour") >>= bSurroundContour1;
+ xOLEProps2->getPropertyValue("SurroundContour") >>= bSurroundContour2;
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("OLE tight wrap setting not imported correctly", true, bSurroundContour1);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("OLE tight wrap setting not imported correctly", false, bSurroundContour2);
+}
+
DECLARE_OOXMLEXPORT_TEST(testAtPageShapeRelOrientation, "rotated_shape.fodt")
{
// invalid combination of at-page anchor and horizontal-rel="paragraph"
@@ -179,7 +192,7 @@ DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginHasFooter,
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1147), nAnchoredHeight);
}
-DECLARE_OOXMLIMPORT_TEST(TestTdf132483, "tdf132483.docx")
+DECLARE_OOXMLEXPORT_TEST(TestTdf132483, "tdf132483.docx")
{
uno::Reference<beans::XPropertySet> xOLEProps(getShape(1), uno::UNO_QUERY_THROW);
sal_Int16 nVRelPos = -1;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index a04ac6908b92..c96dc6676dda 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -751,15 +751,19 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
bRet &= aSh.PutValue(*pShTr, MID_SHADOW_TRANSPARENCE);
rToSet.Put(aSh);
}
- const ::uno::Any* pSur = nullptr;
+ const ::uno::Any* pSur = nullptr;
GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE, pSur);
+ const ::uno::Any* pSurCont = nullptr;
+ GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurCont);
const ::uno::Any* pSurAnch = nullptr;
GetProperty(RES_SURROUND, MID_SURROUND_ANCHORONLY, pSurAnch);
if(pSur || pSurAnch)
{
SwFormatSurround aSrnd ( rFromSet.Get ( RES_SURROUND ) );
if(pSur)
- bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE );
+ bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE);
+ if(pSurCont)
+ bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSurCont, MID_SURROUND_CONTOUR);
if(pSurAnch)
bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY);
rToSet.Put(aSrnd);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3c6d165facb6..0e9e87f6df46 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2223,14 +2223,15 @@ void DomainMapper_Impl::appendOLE( const OUString& rStreamName, const std::share
if (xReplacementProperties.is())
{
OUString pProperties[] = {
- OUString("AnchorType"),
- OUString("Surround"),
- OUString("HoriOrient"),
- OUString("HoriOrientPosition"),
- OUString("VertOrient"),
- OUString("VertOrientPosition"),
- OUString("VertOrientRelation"),
- OUString("HoriOrientRelation")
+ "AnchorType",
+ "Surround",
+ "SurroundContour",
+ "HoriOrient",
+ "HoriOrientPosition",
+ "VertOrient",
+ "VertOrientPosition",
+ "VertOrientRelation",
+ "HoriOrientRelation"
};
for (const OUString & s : pProperties)
xOLEProperties->setPropertyValue(s, xReplacementProperties->getPropertyValue(s));