summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-03-13 10:32:28 -0400
committerJustin Luth <jluth@mail.com>2023-03-15 09:51:21 +0000
commit2d331e6bfe8c9ca31f1a4e092dbcffb8919b8655 (patch)
treea36586c27ce805368f1d31cabbb8596274f309eb
parent070e62bad980cbe15dfbe9096a5e5d962a70f07c (diff)
tdf#154129 writerfilter framePr: deduplicate w:vAnchor
This is not a No Functional Change commit. However, it seems that pretty much only RTF fails to typically have styles defined, since even an unspecified "Normal" style is checked. That means that in all but the most bizarre cases, the "no style" case would never be reached anyway. That really eliminates any worries about the deduplication going bad. In any case, I can't see any reason why the same qualification is not made if there is no parent style involved. make CppunitTest_sw_ooxmlexport5 CPPUNIT_TEST_NAME=testTdf112287 make CppunitTest_sw_ooxmlexport5 CPPUNIT_TEST_NAME=testTdf112287B Change-Id: Ied79f83dcd18304ae0d86c0b7843cd36a532ae93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148810 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx39
1 files changed, 18 insertions, 21 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 34442046c706..822746e5f02e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1744,6 +1744,24 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
aFrameProperties.push_back(
comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT), nVertOrient));
+ //Default the anchor in case FramePr_vAnchor is missing ECMA 17.3.1.11
+ sal_Int16 nVAnchor = text::RelOrientation::FRAME; // 'text'
+ // vAlign is ignored if vAnchor is set to 'text'. So, if w:y is not defined,
+ // but there is a defined vAlign, then a missing vAnchor should become 'margin'.
+ if (!bValidY && nVertOrient)
+ {
+ nVAnchor = text::RelOrientation::PAGE_PRINT_AREA; // 'margin'
+ }
+ for (const auto pProp : vProps)
+ {
+ if (pProp->GetvAnchor() < 0)
+ continue;
+ nVAnchor = pProp->GetvAnchor();
+ break;
+ }
+ aFrameProperties.push_back(
+ comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_RELATION), nVAnchor));
+
if (vProps.size() > 1)
{
if (const std::optional<sal_Int16> nDirection = PopFrameDirection())
@@ -1751,24 +1769,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION), *nDirection));
}
- //Default the anchor in case FramePr_vAnchor is missing ECMA 17.3.1.11
- sal_Int16 nVAnchor = text::RelOrientation::FRAME; // 'text'
- // vAlign is ignored if vAnchor is set to 'text'. So, if w:y is not defined,
- // but there is a defined vAlign, then a missing vAnchor should become 'margin'.
- if (!bValidY && nVertOrient)
- {
- nVAnchor = text::RelOrientation::PAGE_PRINT_AREA; // 'margin'
- }
- for (const auto pProp : vProps)
- {
- if (pProp->GetvAnchor() < 0)
- continue;
- nVAnchor = pProp->GetvAnchor();
- break;
- }
- aFrameProperties.push_back(comphelper::makePropertyValue(
- getPropertyName(PROP_VERT_ORIENT_RELATION), nVAnchor));
-
text::WrapTextMode nWrap = text::WrapTextMode_NONE;
for (const auto pProp : vProps)
{
@@ -1837,9 +1837,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN), nHoriOrient == text::HoriOrientation::LEFT ? 0 : nHoriDist));
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN), nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nHoriDist));
- if( rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 )
- aFrameProperties.push_back(comphelper::makePropertyValue("VertOrientRelation", sal_Int16(rAppendContext.pLastParagraphProperties->GetvAnchor())));
-
if( rAppendContext.pLastParagraphProperties->GetWrap() >= text::WrapTextMode_NONE )
aFrameProperties.push_back(comphelper::makePropertyValue("Surround", rAppendContext.pLastParagraphProperties->GetWrap()));