starmath/inc/utility.hxx                  |   13 +++++++
 starmath/source/ElementsDockingWindow.cxx |    2 -
 starmath/source/cfgitem.cxx               |    4 +-
 starmath/source/dialog.cxx                |    4 +-
 starmath/source/document.cxx              |   26 ++++++++-------
 starmath/source/format.cxx                |    2 -
 starmath/source/mathml/mathmlexport.cxx   |    2 -
 starmath/source/node.cxx                  |    6 +--
 starmath/source/tmpdevice.cxx             |    6 ++-
 starmath/source/unomodel.cxx              |   10 +++---
 starmath/source/utility.cxx               |    2 -
 starmath/source/view.cxx                  |   49 +++++++++++++++++-------------
 12 files changed, 76 insertions(+), 50 deletions(-)

New commits:
commit 4d493db529600c3ae39b39da0c708c36d679a76b
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Nov 2 11:03:08 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Nov 4 19:01:48 2022 +0100

    lok: use twips in Math
    
    Change-Id: I11acd281da64b0023d74b3bc02e0f54864b94da9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142275
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx
index c0b473264532..a05578a53647 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -21,10 +21,13 @@
 
 #include <sal/config.h>
 
+#include <comphelper/lok.hxx>
+#include <o3tl/unit_conversion.hxx>
 #include <sal/log.hxx>
 #include <vcl/font.hxx>
 #include <vcl/weld.hxx>
 #include <tools/fract.hxx>
+#include <tools/mapunit.hxx>
 #include <deque>
 
 
@@ -113,4 +116,14 @@ public:
     virtual void    Insert(const vcl::Font &rFont) override;
 };
 
+// Math uses 100ths of MM by default, but lok needs twips everywhere
+inline MapUnit SmMapUnit()
+{
+    return comphelper::LibreOfficeKit::isActive() ? MapUnit::MapTwip : 
MapUnit::Map100thMM;
+}
+inline o3tl::Length SmO3tlLengthUnit()
+{
+    return comphelper::LibreOfficeKit::isActive() ? o3tl::Length::twip : 
o3tl::Length::mm100;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/source/ElementsDockingWindow.cxx 
b/starmath/source/ElementsDockingWindow.cxx
index 0444db4ba42a..e768726eada5 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -497,7 +497,7 @@ void SmElementsControl::addElement(const OUString& 
aElementVisual, const OUStrin
 {
     std::unique_ptr<SmNode> pNode = maParser->ParseExpression(aElementVisual);
     VclPtr<VirtualDevice> pDevice(mpIconView->create_virtual_device());
-    pDevice->SetMapMode(MapMode(MapUnit::Map100thMM));
+    pDevice->SetMapMode(MapMode(SmMapUnit()));
     pDevice->SetDrawMode(DrawModeFlags::Default);
     pDevice->SetLayoutMode(vcl::text::ComplexTextLayoutFlags::Default);
     pDevice->SetDigitLanguage(LANGUAGE_ENGLISH);
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index 9b6a4eadd184..3bf170c0afe4 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -988,7 +988,7 @@ void SmMathConfig::LoadFormat()
     ++pVal;
     // StandardFormat/BaseSize
     if (pVal->hasValue()  &&  (*pVal >>= nTmp16))
-        pFormat->SetBaseSize(Size(0, o3tl::convert(nTmp16, o3tl::Length::pt, 
o3tl::Length::mm100)));
+        pFormat->SetBaseSize(Size(0, o3tl::convert(nTmp16, o3tl::Length::pt, 
SmO3tlLengthUnit())));
     ++pVal;
 
     sal_uInt16 i;
@@ -1060,7 +1060,7 @@ void SmMathConfig::SaveFormat()
     *pValue++ <<= static_cast<sal_Int16>(pFormat->GetHorAlign());
     // StandardFormat/BaseSize
     *pValue++ <<= static_cast<sal_Int16>(
-        o3tl::convert(pFormat->GetBaseSize().Height(), o3tl::Length::mm100, 
o3tl::Length::pt));
+        o3tl::convert(pFormat->GetBaseSize().Height(), SmO3tlLengthUnit(), 
o3tl::Length::pt));
 
     sal_uInt16 i;
     for (i = SIZ_BEGIN;  i <= SIZ_END;  ++i)
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index f700b8e6ce9a..2aedbae19d05 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -393,7 +393,7 @@ void SmFontSizeDialog::ReadFrom(const SmFormat &rFormat)
 {
     //! watch out: round properly!
     m_xBaseSize->set_value(
-        o3tl::convert(rFormat.GetBaseSize().Height(), o3tl::Length::mm100, 
o3tl::Length::pt),
+        o3tl::convert(rFormat.GetBaseSize().Height(), SmO3tlLengthUnit(), 
o3tl::Length::pt),
         FieldUnit::NONE);
 
     m_xTextSize->set_value( rFormat.GetRelSize(SIZ_TEXT), FieldUnit::NONE );
@@ -405,7 +405,7 @@ void SmFontSizeDialog::ReadFrom(const SmFormat &rFormat)
 
 void SmFontSizeDialog::WriteTo(SmFormat &rFormat) const
 {
-    rFormat.SetBaseSize( Size(0, 
o3tl::convert(m_xBaseSize->get_value(FieldUnit::NONE), o3tl::Length::pt, 
o3tl::Length::mm100)) );
+    rFormat.SetBaseSize( Size(0, 
o3tl::convert(m_xBaseSize->get_value(FieldUnit::NONE), o3tl::Length::pt, 
SmO3tlLengthUnit())) );
 
     rFormat.SetRelSize(SIZ_TEXT,     
sal::static_int_cast<sal_uInt16>(m_xTextSize->get_value(FieldUnit::NONE)));
     rFormat.SetRelSize(SIZ_INDEX,    
sal::static_int_cast<sal_uInt16>(m_xIndexSize->get_value(FieldUnit::NONE)));
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index d13cd8218055..b6d0c7193e5f 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -253,10 +253,10 @@ void SmDocShell::ArrangeFormula()
         else
         {
             pOutDev = &SM_MOD()->GetDefaultVirtualDev();
-            pOutDev->SetMapMode( MapMode(MapUnit::Map100thMM) );
+            pOutDev->SetMapMode( MapMode(SmMapUnit()) );
         }
     }
-    OSL_ENSURE(pOutDev->GetMapMode().GetMapUnit() == MapUnit::Map100thMM,
+    OSL_ENSURE(pOutDev->GetMapMode().GetMapUnit() == SmMapUnit(),
                "Sm : wrong MapMode");
 
     const SmFormat &rFormat = GetFormat();
@@ -417,13 +417,13 @@ SmPrinterAccess::SmPrinterAccess( SmDocShell &rDocShell )
             //!this class.
 
             const MapUnit eOld = pPrinter->GetMapMode().GetMapUnit();
-            if ( MapUnit::Map100thMM != eOld )
+            if ( SmMapUnit() != eOld )
             {
                 MapMode aMap( pPrinter->GetMapMode() );
-                aMap.SetMapUnit( MapUnit::Map100thMM );
+                aMap.SetMapUnit( SmMapUnit() );
                 Point aTmp( aMap.GetOrigin() );
-                aTmp.setX( OutputDevice::LogicToLogic( aTmp.X(), eOld, 
MapUnit::Map100thMM ) );
-                aTmp.setY( OutputDevice::LogicToLogic( aTmp.Y(), eOld, 
MapUnit::Map100thMM ) );
+                aTmp.setX( OutputDevice::LogicToLogic( aTmp.X(), eOld, 
SmMapUnit() ) );
+                aTmp.setY( OutputDevice::LogicToLogic( aTmp.Y(), eOld, 
SmMapUnit() ) );
                 aMap.SetOrigin( aTmp );
                 pPrinter->SetMapMode( aMap );
             }
@@ -445,13 +445,13 @@ SmPrinterAccess::SmPrinterAccess( SmDocShell &rDocShell )
     //!this class.
 
     const MapUnit eOld = pRefDev->GetMapMode().GetMapUnit();
-    if ( MapUnit::Map100thMM != eOld )
+    if ( SmMapUnit() != eOld )
     {
         MapMode aMap( pRefDev->GetMapMode() );
-        aMap.SetMapUnit( MapUnit::Map100thMM );
+        aMap.SetMapUnit( SmMapUnit() );
         Point aTmp( aMap.GetOrigin() );
-        aTmp.setX( OutputDevice::LogicToLogic( aTmp.X(), eOld, 
MapUnit::Map100thMM ) );
-        aTmp.setY( OutputDevice::LogicToLogic( aTmp.Y(), eOld, 
MapUnit::Map100thMM ) );
+        aTmp.setX( OutputDevice::LogicToLogic( aTmp.X(), eOld, SmMapUnit() ) );
+        aTmp.setY( OutputDevice::LogicToLogic( aTmp.Y(), eOld, SmMapUnit() ) );
         aMap.SetOrigin( aTmp );
         pRefDev->SetMapMode( aMap );
     }
@@ -486,7 +486,7 @@ Printer* SmDocShell::GetPrt()
         SmModule *pp = SM_MOD();
         pp->GetConfig()->ConfigToItemSet(*pOptions);
         mpPrinter = VclPtr<SfxPrinter>::Create(std::move(pOptions));
-        mpPrinter->SetMapMode(MapMode(MapUnit::Map100thMM));
+        mpPrinter->SetMapMode(MapMode(SmMapUnit()));
     }
     return mpPrinter;
 }
@@ -507,7 +507,7 @@ void SmDocShell::SetPrinter( SfxPrinter *pNew )
 {
     mpPrinter.disposeAndClear();
     mpPrinter = pNew;    //Transfer ownership
-    mpPrinter->SetMapMode( MapMode(MapUnit::Map100thMM) );
+    mpPrinter->SetMapMode( MapMode(SmMapUnit()) );
     SetFormulaArranged(false);
     Repaint();
 }
@@ -562,6 +562,8 @@ SmDocShell::SmDocShell( SfxModelFlags i_nSfxCreationFlags )
 
     SetBaseModel(new SmModel(this));
     SetSmSyntaxVersion(mnSmSyntaxVersion);
+
+    SetMapUnit(SmMapUnit());
 }
 
 SmDocShell::~SmDocShell()
diff --git a/starmath/source/format.cxx b/starmath/source/format.cxx
index f1f7a00f3806..0ae4c344289f 100644
--- a/starmath/source/format.cxx
+++ b/starmath/source/format.cxx
@@ -21,7 +21,7 @@
 
 
 SmFormat::SmFormat()
-:   aBaseSize(0, o3tl::convert(12, o3tl::Length::pt, o3tl::Length::mm100))
+:   aBaseSize(0, o3tl::convert(12, o3tl::Length::pt, SmO3tlLengthUnit()))
 {
     eHorAlign       = SmHorAlign::Center;
     nGreekCharStyle = 0;
diff --git a/starmath/source/mathml/mathmlexport.cxx 
b/starmath/source/mathml/mathmlexport.cxx
index fe667fd52818..bbb5bfc18a4d 100644
--- a/starmath/source/mathml/mathmlexport.cxx
+++ b/starmath/source/mathml/mathmlexport.cxx
@@ -1197,7 +1197,7 @@ void SmXMLExport::ExportFont(const SmNode* pNode, int 
nLevel)
                     //Must fix StarMath to retain the original pt values
                     double mytest
                         = 
o3tl::convert<double>(pFontNode->GetFont().GetFontSize().Height(),
-                                                o3tl::Length::mm100, 
o3tl::Length::pt);
+                                                SmO3tlLengthUnit(), 
o3tl::Length::pt);
 
                     if (pFontNode->GetSizeType() == FontSizeType::MINUS)
                         mytest -= static_cast<double>(aFrac);
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 7b7f331bbf10..eddde9f18f2d 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -23,6 +23,7 @@
 #include "tmpdevice.hxx"
 #include <utility>
 #include <visitors.hxx>
+#include <tools/UnitConversion.hxx>
 #include <vcl/metric.hxx>
 #include <osl/diagnose.h>
 #include <basegfx/numeric/ftools.hxx>
@@ -135,8 +136,7 @@ void SmNode::SetFontSize(const Fraction &rSize, 
FontSizeType nType)
 
     if (!(Flags() & FontChangeMask::Size))
     {
-        constexpr auto md = o3tl::getConversionMulDiv(o3tl::Length::pt, 
o3tl::Length::mm100);
-        Fraction aVal (Fraction(md.first, md.second) * rSize);
+        Fraction aVal(conversionFract(o3tl::Length::pt, SmO3tlLengthUnit()) * 
rSize);
         tools::Long      nHeight = static_cast<tools::Long>(aVal);
 
         aFntSize = GetFont().GetFontSize();
@@ -168,7 +168,7 @@ void SmNode::SetFontSize(const Fraction &rSize, 
FontSizeType nType)
         }
 
         // check the requested size against maximum value
-        constexpr int nMaxVal = o3tl::convert(128, o3tl::Length::pt, 
o3tl::Length::mm100);
+        const int nMaxVal = o3tl::convert(128, o3tl::Length::pt, 
SmO3tlLengthUnit());
         if (aFntSize.Height() > nMaxVal)
             aFntSize.setHeight( nMaxVal );
 
diff --git a/starmath/source/tmpdevice.cxx b/starmath/source/tmpdevice.cxx
index 5eee10d9670f..1e30fbc7cd11 100644
--- a/starmath/source/tmpdevice.cxx
+++ b/starmath/source/tmpdevice.cxx
@@ -18,6 +18,8 @@
  */
 
 #include <smmod.hxx>
+#include <utility.hxx>
+
 #include "tmpdevice.hxx"
 
 #include <svtools/colorcfg.hxx>
@@ -36,10 +38,10 @@ SmTmpDevice::SmTmpDevice(OutputDevice &rTheDev, bool 
bUseMap100th_mm) :
 {
     rOutDev.Push(vcl::PushFlags::FONT | vcl::PushFlags::MAPMODE |
                  vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR | 
vcl::PushFlags::TEXTCOLOR);
-    if (bUseMap100th_mm  &&  MapUnit::Map100thMM != 
rOutDev.GetMapMode().GetMapUnit())
+    if (bUseMap100th_mm  &&  SmMapUnit() != rOutDev.GetMapMode().GetMapUnit())
     {
         SAL_WARN("starmath", "incorrect MapMode?");
-        rOutDev.SetMapMode(MapMode(MapUnit::Map100thMM)); // format for 100% 
always
+        rOutDev.SetMapMode(MapMode(SmMapUnit())); // format for 100% always
     }
 }
 
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 76c4e86651b1..b7a92567fe25 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -479,7 +479,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** 
ppEntries, const Any*
                 if(nVal < 1)
                     throw IllegalArgumentException();
                 Size aSize = aFormat.GetBaseSize();
-                aSize.setHeight(o3tl::convert(nVal, o3tl::Length::pt, 
o3tl::Length::mm100));
+                aSize.setHeight(o3tl::convert(nVal, o3tl::Length::pt, 
SmO3tlLengthUnit()));
                 aFormat.SetBaseSize(aSize);
 
                 // apply base size to fonts
@@ -729,7 +729,7 @@ void SmModel::_getPropertyValues( const PropertyMapEntry 
**ppEntries, Any *pValu
             {
                 // Point!
                 *pValue <<= 
sal_Int16(o3tl::convert(aFormat.GetBaseSize().Height(),
-                                                    o3tl::Length::mm100, 
o3tl::Length::pt));
+                                                    SmO3tlLengthUnit(), 
o3tl::Length::pt));
             }
             break;
             case HANDLE_RELATIVE_FONT_HEIGHT_TEXT           :
@@ -916,7 +916,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL 
SmModel::getRenderer(
     // if paper size is 0 (usually if no 'real' printer is found),
     // guess the paper size
     if (aPrtPaperSize.IsEmpty())
-        aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MapUnit::Map100thMM);
+        aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(SmMapUnit());
     awt::Size   aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() );
 
     uno::Sequence< beans::PropertyValue > aRenderer(1);
@@ -962,7 +962,7 @@ void SAL_CALL SmModel::render(
     if (!pOut)
         throw RuntimeException();
 
-    pOut->SetMapMode(MapMode(MapUnit::Map100thMM));
+    pOut->SetMapMode(MapMode(SmMapUnit()));
 
     uno::Reference< frame::XModel > xModel;
     rSelection >>= xModel;
@@ -990,7 +990,7 @@ void SAL_CALL SmModel::render(
     // no real printer ??
     if (aPrtPaperSize.IsEmpty())
     {
-        aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(MapUnit::Map100thMM);
+        aPrtPaperSize = SvxPaperInfo::GetDefaultPaperSize(SmMapUnit());
         // factors from Windows DIN A4
         aOutputSize    = Size( static_cast<tools::Long>(aPrtPaperSize.Width()  
* 0.941),
                                static_cast<tools::Long>(aPrtPaperSize.Height() 
* 0.961));
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index 35680ed24b73..5c957899092e 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -203,7 +203,7 @@ void SmFace::SetSize(const Size& rSize)
     Size  aSize (rSize);
 
     // check the requested size against minimum value
-    constexpr int nMinVal = o3tl::convert(2, o3tl::Length::pt, 
o3tl::Length::mm100);
+    const int nMinVal = o3tl::convert(2, o3tl::Length::pt, SmO3tlLengthUnit());
 
     if (aSize.Height() < nMinVal)
         aSize.setHeight( nMinVal );
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index dd6e5f40b3b7..aee745931ee7 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -308,9 +308,17 @@ void SmGraphicWidget::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
 
     
rDevice.SetBackground(SM_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor);
 
-    const Fraction aFraction(1, 1);
-    MapUnit unit = comphelper::LibreOfficeKit::isActive() ? MapUnit::MapPixel 
: MapUnit::Map100thMM;
-    rDevice.SetMapMode(MapMode(unit, Point(), aFraction, aFraction));
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        // Disable map mode, so that it's possible to send mouse event 
coordinates
+        // directly in twips.
+        rDevice.EnableMapMode(false);
+    }
+    else
+    {
+        const Fraction aFraction(1, 1);
+        rDevice.SetMapMode(MapMode(SmMapUnit(), Point(), aFraction, 
aFraction));
+    }
 
     SetTotalSize();
 
@@ -801,9 +809,11 @@ bool SmGraphicWidget::Command(const CommandEvent& rCEvt)
 
 void SmGraphicWindow::SetZoom(sal_uInt16 Factor)
 {
+    if (comphelper::LibreOfficeKit::isActive())
+        return;
     nZoom = std::clamp(Factor, MINZOOM, MAXZOOM);
     Fraction aFraction(nZoom, 100);
-    SetGraphicMapMode(MapMode(MapUnit::Map100thMM, Point(), aFraction, 
aFraction));
+    SetGraphicMapMode(MapMode(SmMapUnit(), Point(), aFraction, aFraction));
     mxGraphic->SetTotalSize();
     SmViewShell& rViewSh = mxGraphic->GetView();
     rViewSh.GetViewFrame()->GetBindings().Invalidate(SID_ATTR_ZOOM);
@@ -813,7 +823,7 @@ void SmGraphicWindow::SetZoom(sal_uInt16 Factor)
 void SmGraphicWindow::ZoomToFitInWindow()
 {
     // set defined mapmode before calling 'LogicToPixel' below
-    SetGraphicMapMode(MapMode(MapUnit::Map100thMM));
+    SetGraphicMapMode(MapMode(SmMapUnit()));
 
     assert(mxGraphic->GetDoc());
     Size 
aSize(mxGraphic->GetOutputDevice().LogicToPixel(mxGraphic->GetDoc()->GetSize()));
@@ -1101,7 +1111,7 @@ void SmViewShell::InnerResizePixel(const Point &rOfs, 
const Size &rSize, bool)
     Size aObjSize = GetObjectShell()->GetVisArea().GetSize();
     if ( !aObjSize.IsEmpty() )
     {
-        Size aProvidedSize = GetWindow()->PixelToLogic(rSize, 
MapMode(MapUnit::Map100thMM));
+        Size aProvidedSize = GetWindow()->PixelToLogic(rSize, 
MapMode(SmMapUnit()));
         Fraction aZoomX(aProvidedSize.Width(), aObjSize.Width());
         Fraction aZoomY(aProvidedSize.Height(), aObjSize.Height());
         MapMode aMap(mxGraphicWindow->GetGraphicMapMode());
@@ -1404,44 +1414,43 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, 
const SmPrintUIOptions &rPri
     switch (ePrintSize)
     {
         case PRINT_SIZE_NORMAL:
-            OutputMapMode = MapMode(MapUnit::Map100thMM);
+            OutputMapMode = MapMode(SmMapUnit());
             break;
 
         case PRINT_SIZE_SCALED:
             if (!aSize.IsEmpty())
             {
-                Size     OutputSize 
(rOutDev.LogicToPixel(Size(aOutRect.GetWidth(),
-                                                            
aOutRect.GetHeight()), MapMode(MapUnit::Map100thMM)));
-                Size     GraphicSize (rOutDev.LogicToPixel(aSize, 
MapMode(MapUnit::Map100thMM)));
-                sal_uInt16 nZ = 
sal::static_int_cast<sal_uInt16>(std::min(tools::Long(Fraction(OutputSize.Width()
  * 100, GraphicSize.Width())),
-                                                                          
tools::Long(Fraction(OutputSize.Height() * 100, GraphicSize.Height()))));
+                Size OutputSize(rOutDev.LogicToPixel(aOutRect.GetSize(), 
MapMode(SmMapUnit())));
+                Size GraphicSize(rOutDev.LogicToPixel(aSize, 
MapMode(SmMapUnit())));
+                sal_uInt16 nZ = std::min(o3tl::convert(OutputSize.Width(), 
100, GraphicSize.Width()),
+                                         o3tl::convert(OutputSize.Height(), 
100, GraphicSize.Height()));
                 nZ -= 10;
-                Fraction aFraction (std::clamp(nZ, MINZOOM, sal_uInt16(100)));
+                Fraction aFraction(std::clamp(nZ, MINZOOM, sal_uInt16(100)), 
1);
 
-                OutputMapMode = MapMode(MapUnit::Map100thMM, Point(), 
aFraction, aFraction);
+                OutputMapMode = MapMode(SmMapUnit(), Point(), aFraction, 
aFraction);
             }
             else
-                OutputMapMode = MapMode(MapUnit::Map100thMM);
+                OutputMapMode = MapMode(SmMapUnit());
             break;
 
         case PRINT_SIZE_ZOOMED:
         {
             Fraction aFraction( nZoomFactor, 100 );
 
-            OutputMapMode = MapMode(MapUnit::Map100thMM, Point(), aFraction, 
aFraction);
+            OutputMapMode = MapMode(SmMapUnit(), Point(), aFraction, 
aFraction);
             break;
         }
     }
 
     aSize = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aSize, OutputMapMode),
-                                   MapMode(MapUnit::Map100thMM));
+                                   MapMode(SmMapUnit()));
 
     Point aPos (aOutRect.Left() + (aOutRect.GetWidth()  - aSize.Width())  / 2,
                 aOutRect.Top()  + (aOutRect.GetHeight() - aSize.Height()) / 2);
 
-    aPos     = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aPos, 
MapMode(MapUnit::Map100thMM)),
+    aPos     = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aPos, 
MapMode(SmMapUnit())),
                                           OutputMapMode);
-    aOutRect   = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aOutRect, 
MapMode(MapUnit::Map100thMM)),
+    aOutRect   = rOutDev.PixelToLogic(rOutDev.LogicToPixel(aOutRect, 
MapMode(SmMapUnit())),
                                           OutputMapMode);
 
     rOutDev.SetMapMode(OutputMapMode);
@@ -2252,7 +2261,7 @@ void SmViewShell::ZoomByItemSet(const SfxItemSet *pSet)
         case SvxZoomType::PAGEWIDTH:
         case SvxZoomType::WHOLEPAGE:
         {
-            const MapMode aMap( MapUnit::Map100thMM );
+            const MapMode aMap( SmMapUnit() );
             SfxPrinter *pPrinter = GetPrinter( true );
             tools::Rectangle  OutputRect(Point(), pPrinter->GetOutputSize());
             Size       
OutputSize(pPrinter->LogicToPixel(Size(OutputRect.GetWidth(),

Reply via email to