summaryrefslogtreecommitdiff
path: root/svx/source/stbctrls/zoomctrl.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-05-08 14:27:53 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-05-08 14:48:22 +0100
commitd6f5d4ee2cd0654497f1af37421d788411db762c (patch)
treeda4f61905e264cd2094dce65f95385a4d1a83154 /svx/source/stbctrls/zoomctrl.cxx
parent6cf148baf9e0b98ce99ea75ba328b350c876842d (diff)
add a status bar icon to fit slide to window
Change-Id: I2c1d1fc7425b0aaad2a2445e0ac71ddc38410fdb
Diffstat (limited to 'svx/source/stbctrls/zoomctrl.cxx')
-rw-r--r--svx/source/stbctrls/zoomctrl.cxx46
1 files changed, 38 insertions, 8 deletions
diff --git a/svx/source/stbctrls/zoomctrl.cxx b/svx/source/stbctrls/zoomctrl.cxx
index 1a10bc839d3f..cd711eba9a18 100644
--- a/svx/source/stbctrls/zoomctrl.cxx
+++ b/svx/source/stbctrls/zoomctrl.cxx
@@ -28,7 +28,8 @@
#include <svx/dialogs.hrc>
-#include "svx/zoomctrl.hxx"
+#include <svx/zoomctrl.hxx>
+#include <svx/zoomslideritem.hxx>
#include <sfx2/zoomitem.hxx>
#include "stbctrls.h"
#include <svx/dialmgr.hxx>
@@ -97,7 +98,6 @@ void ZoomPopup_Impl::Select()
}
// class SvxZoomStatusBarControl ------------------------------------------
-
SvxZoomStatusBarControl::SvxZoomStatusBarControl( sal_uInt16 _nSlotId,
sal_uInt16 _nId,
StatusBar& rStb ) :
@@ -108,8 +108,6 @@ SvxZoomStatusBarControl::SvxZoomStatusBarControl( sal_uInt16 _nSlotId,
{
}
-
-
void SvxZoomStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState,
const SfxPoolItem* pState )
{
@@ -138,16 +136,12 @@ void SvxZoomStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState,
}
}
-
-
void SvxZoomStatusBarControl::Paint( const UserDrawEvent& )
{
OUString aStr(unicode::formatPercent(nZoom, Application::GetSettings().GetUILanguageTag()));
GetStatusBar().SetItemText( GetId(), aStr );
}
-
-
void SvxZoomStatusBarControl::Command( const CommandEvent& rCEvt )
{
if ( COMMAND_CONTEXTMENU & rCEvt.GetCommand() && 0 != nValueSet )
@@ -184,5 +178,41 @@ void SvxZoomStatusBarControl::Command( const CommandEvent& rCEvt )
SfxStatusBarControl::Command( rCEvt );
}
+SFX_IMPL_STATUSBAR_CONTROL(SvxZoomPageStatusBarControl,SfxVoidItem);
+
+SvxZoomPageStatusBarControl::SvxZoomPageStatusBarControl(sal_uInt16 _nSlotId,
+ sal_uInt16 _nId, StatusBar& rStb)
+ : SfxStatusBarControl(_nSlotId, _nId, rStb)
+ , maImage(SVX_RES(RID_SVXBMP_ZOOM_PAGE))
+{
+ GetStatusBar().SetQuickHelpText(GetId(), SVX_RESSTR(RID_SVXSTR_FIT_SLIDE));
+}
+
+extern Point centerImage(const Rectangle& rBoundingRect, const Image& rImg);
+
+void SvxZoomPageStatusBarControl::Paint(const UserDrawEvent& rUsrEvt)
+{
+ OutputDevice* pDev = rUsrEvt.GetDevice();
+ Rectangle aRect = rUsrEvt.GetRect();
+ Point aPt = centerImage(aRect, maImage);
+ pDev->DrawImage(aPt, maImage);
+}
+
+bool SvxZoomPageStatusBarControl::MouseButtonDown(const MouseEvent&)
+{
+ SvxZoomItem aZoom( SVX_ZOOM_WHOLEPAGE, 0, GetId() );
+
+ ::com::sun::star::uno::Any a;
+ INetURLObject aObj( m_aCommandURL );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = aObj.GetURLPath();
+ aZoom.QueryValue( a );
+ aArgs[0].Value = a;
+
+ execute( aArgs );
+
+ return true;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */