diff options
author | Justin Luth <jluth@mail.com> | 2023-06-06 12:29:39 -0400 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2023-06-06 21:09:17 +0200 |
commit | 45906d2dec179aa6868edd0b81ba01b2e479589c (patch) | |
tree | e9ce36930298ba7f9bd440d640bc1065bef38e67 /sw/source | |
parent | 0558926c2f9201a12b4c46efc36b8a4080af4d46 (diff) |
tdf#135710 doc import: force page center on inline images
Relative anchoring is irrelevant for inline images,
so it is safe to do this in terms of writer layout.
The benefit is clearly seen when the user changes
from inline to anchored. In ODT format,
that results in a centered image in the paragraph,
while in DOC it was anchored somehow to a character
and didn't lay out nicely at all after the transition.
So this is mainly just side-stepping a layout issue in Writer
(because checking the properties and hitting OK shifted the image).
Change-Id: I6ff7a191d78bc1597ee9f053e02f161565a27174
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152683
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 7768680d8b2c..accf7cf53098 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -2373,8 +2373,12 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS text::RelOrientation::TEXT_LINE // 3 is relative to line }; - sal_Int16 eHoriOri = aHoriOriTab[ nXAlign ]; - sal_Int16 eHoriRel = aHoriRelOriTab[ nXRelTo ]; + // If the image is inline, then the relative orientation means nothing, + // so set it up so that if the user changes it into an anchor, it positions usefully. + sal_Int16 eHoriOri + = IsInlineEscherHack() ? text::HoriOrientation::CENTER : aHoriOriTab[ nXAlign ]; + sal_Int16 eHoriRel + = IsInlineEscherHack() ? text::RelOrientation::FRAME : aHoriRelOriTab[nXRelTo]; // #i36649# - adjustments for certain alignments if (eHoriOri == text::HoriOrientation::LEFT && eHoriRel == text::RelOrientation::PAGE_FRAME) |