starmath/source/unomodel.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 798d21e2a1b8bc48b6bb5e1b3cf0cba0e5882a59
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Oct 29 16:36:43 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Oct 29 20:26:38 2023 +0100

    tdf#157965: UNO methods are expected to return sizes in mm/100
    
    Commit 9e92a17cb6e03beedeeca40bfc8524c2623d31eb made sm to always
    use twips; before, it used mm/100 except in LOK. That change broke
    the size values returned from XRenderable::getRenderer: instead of
    mm/100, the resulting values were in twips, but handled as mm/100.
    
    Set the printer's map mode to use mm/100s explicitly. Also use
    mm/100s in the call to SvxPaperInfo::GetDefaultPaperSize.
    
    Change-Id: Id7cf40d4bc19c92dc54ca03d81f25ba1f6bf25b9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158622
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 73f1c4b17715..829c57de820f 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -960,12 +960,16 @@ uno::Sequence< beans::PropertyValue > SAL_CALL 
SmModel::getRenderer(
     SmPrinterAccess aPrinterAccess( *pDocSh );
     Size aPrtPaperSize;
     if (Printer *pPrinter = aPrinterAccess.GetPrinter())
+    {
+        // tdf#157965: UNO methods are expected to return sizes in mm/100
+        pPrinter->SetMapMode(MapMode(MapUnit::Map100thMM)); // reset in 
SmPrinterAccess dtor
         aPrtPaperSize = pPrinter->GetPaperSize();
+    }
 
     // if paper size is 0 (usually if no 'real' printer is found),
     // guess the paper size
     if (aPrtPaperSize.IsEmpty())
-        aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(SmMapUnit());
+        aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MapUnit::Map100thMM);
     awt::Size   aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() );
 
     uno::Sequence< beans::PropertyValue > aRenderer(1);

Reply via email to