diff options
author | Justin Luth <justin.luth@collabora.com> | 2024-03-05 19:05:29 -0500 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-03-11 09:44:33 +0100 |
commit | 22adb6942a081aaadfcb04adb2bd3746d4034a68 (patch) | |
tree | a25f42e64cfbaf011d950ef7c7b4ec3edf84b742 /oox | |
parent | 18db9d334e1cafddeef53ddff435d6c059aaf803 (diff) |
tdf#160049 oox import: use margins with left/right HoriOrientRelation
I'm really surprised this wasn't found much earlier.
Even DOC format isn't handling this.
make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMarginVML
Change-Id: I92ee8eceb6c6bab5f027663bae94d7acdf01be3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164442
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164581
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 5284de176839..8f16c6267211 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -647,8 +647,13 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rType rPropSet.setAnyProperty(PROP_VertOrient, Any(text::VertOrientation::TOP)); } + // if the anchor is not inline, and is relative to left or right, then apply the margins + bool bHonorMargins = rTypeModel.maPosition == "relative" || rTypeModel.maPosition == "absolute"; if ( rTypeModel.maPositionHorizontal == "center" ) + { rPropSet.setAnyProperty(PROP_HoriOrient, Any(text::HoriOrientation::CENTER)); + bHonorMargins = false; + } else if ( rTypeModel.maPositionHorizontal == "left" ) rPropSet.setAnyProperty(PROP_HoriOrient, Any(text::HoriOrientation::LEFT)); else if ( rTypeModel.maPositionHorizontal == "right" ) @@ -663,6 +668,8 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rType rPropSet.setAnyProperty(PROP_HoriOrient, Any(text::HoriOrientation::RIGHT)); rPropSet.setAnyProperty(PROP_PageToggle, Any(true)); } + else + bHonorMargins = false; if ( rTypeModel.maPositionHorizontalRelative == "page" ) rPropSet.setAnyProperty(PROP_HoriOrientRelation, Any(text::RelOrientation::PAGE_FRAME)); @@ -674,9 +681,13 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rType else if (rTypeModel.maPositionHorizontalRelative == "left-margin-area" || rTypeModel.maPositionHorizontalRelative == "outer-margin-area") rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::PAGE_LEFT); - else if ( rTypeModel.maPositionHorizontalRelative == "text" ) - rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::FRAME); - + else // "text" + { + if (bHonorMargins) + rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::PRINT_AREA); + else + rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::FRAME); + } if ( rTypeModel.maPositionVertical == "center" ) rPropSet.setAnyProperty(PROP_VertOrient, Any(text::VertOrientation::CENTER)); else if ( rTypeModel.maPositionVertical == "top" ) |