sw/source/filter/ww8/ww8graf.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 45906d2dec179aa6868edd0b81ba01b2e479589c
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Tue Jun 6 12:29:39 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Tue Jun 6 21:09:17 2023 +0200

    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 <jl...@mail.com>

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)

Reply via email to