diff options
author | Patrick Jaap <patrick.jaap@tu-dresden.de> | 2018-01-15 16:43:07 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-01-23 23:28:04 +0100 |
commit | ada232a67fbb3acf60b104a4916719dbdb891819 (patch) | |
tree | 6506393d29be795a7bb5ba9bb3d97b87e63b3009 /writerfilter | |
parent | 4e00b175e2c222bc320ec16caa90aa1bd2c1b7a7 (diff) |
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/47908
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/GraphicHelpers.cxx | 86 |
1 files changed, 44 insertions, 42 deletions
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; |