summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2016-12-14 07:08:16 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2016-12-14 12:15:35 +0000
commitb4e1d0240ed55f05d435bb848d8f256cc81e3ba3 (patch)
treef93f47f3b7bf24d3c68a1531bdfd6af57531985f /starmath
parent8f79e709e7452267e30c0744e7f906a70830bd58 (diff)
tdf#91767 Read SfxItemSet before disposing its AbstractSvxZoomDialog
Change-Id: I5dc6a1b1fa42a4fd76af398c2fb56461574900ee Reviewed-on: https://gerrit.libreoffice.org/31980 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp> (cherry picked from commit 77eac365c179e1a1cad3e0d8ebe3fe5bafa65720) Reviewed-on: https://gerrit.libreoffice.org/32000
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/view.hxx3
-rw-r--r--starmath/source/view.cxx74
2 files changed, 43 insertions, 34 deletions
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index a1a3b4964f13..840b6d27428d 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 162751f513ac..eed2c2495c08 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1729,7 +1729,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()));
@@ -1740,39 +1744,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());
}
}
}
@@ -2056,4 +2028,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: */