[Libreoffice-commits] core.git: starmath/inc starmath/source

Takeshi Abe tabe at fixedpoint.jp
Wed Dec 14 08:07:34 UTC 2016


 starmath/inc/view.hxx    |    3 +
 starmath/source/view.cxx |   74 +++++++++++++++++++++++++----------------------
 2 files changed, 43 insertions(+), 34 deletions(-)

New commits:
commit 77eac365c179e1a1cad3e0d8ebe3fe5bafa65720
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Wed Dec 14 07:08:16 2016 +0900

    tdf#91767 Read SfxItemSet before disposing its AbstractSvxZoomDialog
    
    Change-Id: I5dc6a1b1fa42a4fd76af398c2fb56461574900ee
    Reviewed-on: https://gerrit.libreoffice.org/31980
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Takeshi Abe <tabe at fixedpoint.jp>

diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index a1a3b49..840b6d2 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -319,6 +319,9 @@ public:
         bInsertIntoEditWindow = bEditWindowHadFocusLast;
     }
     bool IsInlineEditEnabled() const;
+
+private:
+    void ZoomByItemSet(const SfxItemSet *pSet);
 };
 
 #endif
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 4486a89..df0edfc 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1730,7 +1730,11 @@ void SmViewShell::Execute(SfxRequest& rReq)
             if ( !GetViewFrame()->GetFrame().IsInPlace() )
             {
                 const SfxItemSet *pSet = rReq.GetArgs();
-                if ( !pSet )
+                if ( pSet )
+                {
+                    ZoomByItemSet(pSet);
+                }
+                else
                 {
                     SfxItemSet aSet( SmDocShell::GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM);
                     aSet.Put( SvxZoomItem( SvxZoomType::PERCENT, aGraphic->GetZoom()));
@@ -1741,39 +1745,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
                         assert(xDlg);
                         xDlg->SetLimits( MINZOOM, MAXZOOM );
                         if (xDlg->Execute() != RET_CANCEL)
-                            pSet = xDlg->GetOutputItemSet();
-                    }
-                }
-                if ( pSet )
-                {
-                    const SvxZoomItem &rZoom = static_cast<const SvxZoomItem &>(pSet->Get(SID_ATTR_ZOOM));
-                    switch( rZoom.GetType() )
-                    {
-                        case SvxZoomType::PERCENT:
-                            aGraphic->SetZoom(sal::static_int_cast<sal_uInt16>(rZoom.GetValue ()));
-                            break;
-
-                        case SvxZoomType::OPTIMAL:
-                            aGraphic->ZoomToFitInWindow();
-                            break;
-
-                        case SvxZoomType::PAGEWIDTH:
-                        case SvxZoomType::WHOLEPAGE:
-                        {
-                            const MapMode aMap( MapUnit::Map100thMM );
-                            SfxPrinter *pPrinter = GetPrinter( true );
-                            Point aPoint;
-                            Rectangle  OutputRect(aPoint, pPrinter->GetOutputSize());
-                            Size       OutputSize(pPrinter->LogicToPixel(Size(OutputRect.GetWidth(),
-                                                                              OutputRect.GetHeight()), aMap));
-                            Size       GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap));
-                            sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(long(Fraction(OutputSize.Width()  * 100L, GraphicSize.Width())),
-                                                                                      long(Fraction(OutputSize.Height() * 100L, GraphicSize.Height()))));
-                            aGraphic->SetZoom (nZ);
-                            break;
-                        }
-                        default:
-                            break;
+                            ZoomByItemSet(xDlg->GetOutputItemSet());
                     }
                 }
             }
@@ -2057,4 +2029,38 @@ bool SmViewShell::IsInlineEditEnabled() const
     return pImpl->aOpts.IsExperimentalMode();
 }
 
+void SmViewShell::ZoomByItemSet(const SfxItemSet *pSet)
+{
+    assert(pSet);
+    const SvxZoomItem &rZoom = static_cast<const SvxZoomItem &>(pSet->Get(SID_ATTR_ZOOM));
+    switch( rZoom.GetType() )
+    {
+        case SvxZoomType::PERCENT:
+            aGraphic->SetZoom(sal::static_int_cast<sal_uInt16>(rZoom.GetValue ()));
+            break;
+
+        case SvxZoomType::OPTIMAL:
+            aGraphic->ZoomToFitInWindow();
+            break;
+
+        case SvxZoomType::PAGEWIDTH:
+        case SvxZoomType::WHOLEPAGE:
+        {
+            const MapMode aMap( MapUnit::Map100thMM );
+            SfxPrinter *pPrinter = GetPrinter( true );
+            Point aPoint;
+            Rectangle  OutputRect(aPoint, pPrinter->GetOutputSize());
+            Size       OutputSize(pPrinter->LogicToPixel(Size(OutputRect.GetWidth(),
+                                                              OutputRect.GetHeight()), aMap));
+            Size       GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap));
+            sal_uInt16 nZ = sal::static_int_cast<sal_uInt16>(std::min(long(Fraction(OutputSize.Width()  * 100L, GraphicSize.Width())),
+                                                                      long(Fraction(OutputSize.Height() * 100L, GraphicSize.Height()))));
+            aGraphic->SetZoom (nZ);
+            break;
+        }
+        default:
+            break;
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list