[Libreoffice-commits] core.git: Branch 'libreoffice-6-0-0' - sw/qa writerfilter/source
Patrick Jaap
patrick.jaap at tu-dresden.de
Tue Jan 23 21:02:19 UTC 2018
sw/qa/extras/ooxmlimport/data/tdf113946.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 7 ++
writerfilter/source/dmapper/GraphicHelpers.cxx | 86 ++++++++++++-------------
3 files changed, 51 insertions(+), 42 deletions(-)
New commits:
commit dc8665445e81891eafcbe8a25a5b5b80db330375
Author: Patrick Jaap <patrick.jaap at tu-dresden.de>
Date: Mon Jan 15 16:43:07 2018 +0100
tdf#113946 add 'topMargin' to GraphicHelpers import
The case '...topMargin' was not caught for setting a relative
vertical position in GraphicHelpers. The test file demands a '7' here,
which stands for 'PAGE_FRAME'. The '7' was overwritten in GraphicImport in case
'LN_CT_Anchor_positionV' by a call of 'resolve'.
For a better overview a switch is inserted here.
Change-Id: Ie98209fe445ecbba15c3dafe5980ca52421126f8
Reviewed-on: https://gerrit.libreoffice.org/47905
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
(cherry picked from commit ff8826d438a9fd080e8e61f8e66b3d3b2c8d752b)
Reviewed-on: https://gerrit.libreoffice.org/48288
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/qa/extras/ooxmlimport/data/tdf113946.docx b/sw/qa/extras/ooxmlimport/data/tdf113946.docx
new file mode 100644
index 000000000000..060df76ecc2a
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf113946.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 4d65beeb90c4..449dae04ac59 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1567,6 +1567,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx")
CPPUNIT_ASSERT_EQUAL( OUString("30624"), aTop );
}
+
+DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx")
+{
+ OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top");
+ CPPUNIT_ASSERT_EQUAL( OUString("1696"), aTop );
+}
+
// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx
index 8108445d24fb..a7ce01868714 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.cxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.cxx
@@ -63,57 +63,59 @@ void PositionHandler::lcl_attribute( Id aName, Value& rVal )
{
case NS_ooxml::LN_CT_PosV_relativeFrom:
{
- // TODO There are some other unhandled values
- static const Id pVertRelValues[] =
+ switch ( nIntValue )
{
- NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin,
- NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page,
- NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph,
- NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line
- };
+ case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin:
+ m_nRelation = text::RelOrientation::PAGE_PRINT_AREA;
+ break;
- static const sal_Int16 pVertRelations[] =
- {
- text::RelOrientation::PAGE_PRINT_AREA,
- text::RelOrientation::PAGE_FRAME,
- text::RelOrientation::FRAME,
- text::RelOrientation::TEXT_LINE
- };
+ case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page:
+ case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_topMargin: // fallthrough intended
+ m_nRelation = text::RelOrientation::PAGE_FRAME;
+ break;
- for ( int i = 0; i < 4; i++ )
- {
- if ( pVertRelValues[i] == sal_uInt32( nIntValue ) )
- m_nRelation = pVertRelations[i];
+ case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph:
+ m_nRelation = text::RelOrientation::FRAME;
+ break;
+
+ case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line:
+ m_nRelation = text::RelOrientation::TEXT_LINE;
+ break;
+
+ // TODO There are some other unhandled values
}
}
break;
+
case NS_ooxml::LN_CT_PosH_relativeFrom:
{
- // TODO There are some other unhandled values
- static const Id pHoriRelValues[] =
+ switch ( nIntValue )
{
- NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_margin,
- NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page,
- NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_column,
- NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_character,
- NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_leftMargin,
- NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_rightMargin
- };
-
- static const sal_Int16 pHoriRelations[] =
- {
- text::RelOrientation::PAGE_PRINT_AREA,
- text::RelOrientation::PAGE_FRAME,
- text::RelOrientation::FRAME,
- text::RelOrientation::CHAR,
- text::RelOrientation::PAGE_LEFT,
- text::RelOrientation::PAGE_RIGHT,
- };
-
- for ( int i = 0; i < 6; i++ )
- {
- if ( pHoriRelValues[i] == sal_uInt32( nIntValue ) )
- m_nRelation = pHoriRelations[i];
+ case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_margin:
+ m_nRelation = text::RelOrientation::PAGE_PRINT_AREA;
+ break;
+
+ case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page:
+ m_nRelation = text::RelOrientation::PAGE_FRAME;
+ break;
+
+ case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_column:
+ m_nRelation = text::RelOrientation::FRAME;
+ break;
+
+ case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_character:
+ m_nRelation = text::RelOrientation::CHAR;
+ break;
+
+ case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_leftMargin:
+ m_nRelation = text::RelOrientation::PAGE_LEFT;
+ break;
+
+ case NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_rightMargin:
+ m_nRelation = text::RelOrientation::PAGE_RIGHT;
+ break;
+
+ // TODO There are some other unhandled values
}
}
break;
More information about the Libreoffice-commits
mailing list