svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit efbdd13f96888ae06717afafb1e4014ce502aa3e
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Wed Jul 19 21:35:16 2023 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Sun Jul 23 20:27:05 2023 +0200

    tdf#154038 tdf#83618 fix wrong line spacing value
    
    Impress and Writer seem to require different MapUnit values for fixed
    line spacing metric values to be correctly calculated. This patch
    initially sets the MapUnit unit value to Map100thMM, which is what it
    was before commit 849b837d1a3b185a8dd893a8f6eaed53605bcab1, which works
    for Impress. For Writer, the value is set to MapTwip.
    
    Change-Id: I49e9b80aa4d3fbda1f19101903d2a4459089024c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154665
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx 
b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
index fee659817a14..4c756a5b1224 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
@@ -32,6 +32,8 @@
 
 #include <ParaLineSpacingPopup.hxx>
 
+#include <vcl/commandinfoprovider.hxx>
+
 #define DEFAULT_LINE_SPACING  200
 #define FIX_DIST_DEF          283
 #define LINESPACE_1           100
@@ -134,7 +136,12 @@ void ParaLineSpacingControl::Initialize()
     if( bItemStateSet && (eState == SfxItemState::DEFAULT || eState == 
SfxItemState::SET) )
     {
         const SvxLineSpacingItem* currSPItem = pItem;
-        MapUnit eUnit = pCurrent->GetPool().GetMetric(currSPItem->Which());
+        // It seems draw/impress and writer require different MapUnit values 
for fixed line spacing
+        // metric values to be correctly calculated.
+        MapUnit eUnit = MapUnit::Map100thMM; // works for draw/impress
+        if 
(vcl::CommandInfoProvider::GetModuleIdentifier(pCurrent->GetFrame().GetFrameInterface())
+                == "com.sun.star.text.TextDocument")
+            eUnit = MapUnit::MapTwip; // works for writer
         meLNSpaceUnit = eUnit;
 
         switch( currSPItem->GetLineSpaceRule() )

Reply via email to