Kaydet (Commit) 5d96ccd0 authored tarafından Noel Grandin's avatar Noel Grandin

convert ZOOMBTN constants to scoped enum

Change-Id: Ia7641f736fa4f84dce0b5ea8bf68339c1309e74b
üst 468446b7
...@@ -49,11 +49,11 @@ sal_uInt16 SvxZoomDialog::GetFactor() const ...@@ -49,11 +49,11 @@ sal_uInt16 SvxZoomDialog::GetFactor() const
return SPECIAL_FACTOR; return SPECIAL_FACTOR;
} }
void SvxZoomDialog::SetFactor(sal_uInt16 nNewFactor, sal_uInt16 nButtonId) void SvxZoomDialog::SetFactor(sal_uInt16 nNewFactor, ZoomButtonId nButtonId)
{ {
m_pUserEdit->Disable(); m_pUserEdit->Disable();
if (!nButtonId) if (nButtonId == ZoomButtonId::NONE)
{ {
if ( nNewFactor == 100 ) if ( nNewFactor == 100 )
{ {
...@@ -73,41 +73,42 @@ void SvxZoomDialog::SetFactor(sal_uInt16 nNewFactor, sal_uInt16 nButtonId) ...@@ -73,41 +73,42 @@ void SvxZoomDialog::SetFactor(sal_uInt16 nNewFactor, sal_uInt16 nButtonId)
m_pUserEdit->SetValue(static_cast<long>(nNewFactor)); m_pUserEdit->SetValue(static_cast<long>(nNewFactor));
switch(nButtonId) switch(nButtonId)
{ {
case ZOOMBTN_OPTIMAL: case ZoomButtonId::OPTIMAL:
{ {
m_pOptimalBtn->Check(); m_pOptimalBtn->Check();
m_pOptimalBtn->GrabFocus(); m_pOptimalBtn->GrabFocus();
break; break;
} }
case ZOOMBTN_PAGEWIDTH: case ZoomButtonId::PAGEWIDTH:
{ {
m_pPageWidthBtn->Check(); m_pPageWidthBtn->Check();
m_pPageWidthBtn->GrabFocus(); m_pPageWidthBtn->GrabFocus();
break; break;
} }
case ZOOMBTN_WHOLEPAGE: case ZoomButtonId::WHOLEPAGE:
{ {
m_pWholePageBtn->Check(); m_pWholePageBtn->Check();
m_pWholePageBtn->GrabFocus(); m_pWholePageBtn->GrabFocus();
break; break;
} }
default: break;
} }
} }
} }
void SvxZoomDialog::HideButton(sal_uInt16 nButtonId) void SvxZoomDialog::HideButton(ZoomButtonId nButtonId)
{ {
switch (nButtonId) switch (nButtonId)
{ {
case ZOOMBTN_OPTIMAL: case ZoomButtonId::OPTIMAL:
m_pOptimalBtn->Hide(); m_pOptimalBtn->Hide();
break; break;
case ZOOMBTN_PAGEWIDTH: case ZoomButtonId::PAGEWIDTH:
m_pPageWidthBtn->Hide(); m_pPageWidthBtn->Hide();
break; break;
case ZOOMBTN_WHOLEPAGE: case ZoomButtonId::WHOLEPAGE:
m_pWholePageBtn->Hide(); m_pWholePageBtn->Hide();
break; break;
...@@ -208,18 +209,18 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet ) ...@@ -208,18 +209,18 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet )
const sal_uInt16 nZoom = rZoomItem.GetValue(); const sal_uInt16 nZoom = rZoomItem.GetValue();
const SvxZoomType eType = rZoomItem.GetType(); const SvxZoomType eType = rZoomItem.GetType();
const SvxZoomEnableFlags nValSet = rZoomItem.GetValueSet(); const SvxZoomEnableFlags nValSet = rZoomItem.GetValueSet();
sal_uInt16 nButtonId = 0; ZoomButtonId nButtonId = ZoomButtonId::NONE;
switch (eType) switch (eType)
{ {
case SvxZoomType::OPTIMAL: case SvxZoomType::OPTIMAL:
nButtonId = ZOOMBTN_OPTIMAL; nButtonId = ZoomButtonId::OPTIMAL;
break; break;
case SvxZoomType::PAGEWIDTH: case SvxZoomType::PAGEWIDTH:
nButtonId = ZOOMBTN_PAGEWIDTH; nButtonId = ZoomButtonId::PAGEWIDTH;
break; break;
case SvxZoomType::WHOLEPAGE: case SvxZoomType::WHOLEPAGE:
nButtonId = ZOOMBTN_WHOLEPAGE; nButtonId = ZoomButtonId::WHOLEPAGE;
break; break;
case SvxZoomType::PERCENT: case SvxZoomType::PERCENT:
break; break;
......
...@@ -419,7 +419,7 @@ void AbstractSvxZoomDialog_Impl::SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) ...@@ -419,7 +419,7 @@ void AbstractSvxZoomDialog_Impl::SetLimits( sal_uInt16 nMin, sal_uInt16 nMax )
pDlg->SetLimits( nMin, nMax ); pDlg->SetLimits( nMin, nMax );
} }
void AbstractSvxZoomDialog_Impl::HideButton( sal_uInt16 nBtnId ) void AbstractSvxZoomDialog_Impl::HideButton( ZoomButtonId nBtnId )
{ {
pDlg->HideButton( nBtnId ); pDlg->HideButton( nBtnId );
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define INCLUDED_CUI_SOURCE_FACTORY_DLGFACT_HXX #define INCLUDED_CUI_SOURCE_FACTORY_DLGFACT_HXX
#include <svx/svxdlg.hxx> #include <svx/svxdlg.hxx>
#include <svx/zoom_def.hxx>
#include <com/sun/star/container/XNameReplace.hpp> #include <com/sun/star/container/XNameReplace.hpp>
#include "tools/link.hxx" #include "tools/link.hxx"
...@@ -195,7 +196,7 @@ class AbstractSvxZoomDialog_Impl : public AbstractSvxZoomDialog ...@@ -195,7 +196,7 @@ class AbstractSvxZoomDialog_Impl : public AbstractSvxZoomDialog
{ {
DECL_ABSTDLG_BASE(AbstractSvxZoomDialog_Impl,SvxZoomDialog) DECL_ABSTDLG_BASE(AbstractSvxZoomDialog_Impl,SvxZoomDialog)
virtual void SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) SAL_OVERRIDE; virtual void SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) SAL_OVERRIDE;
virtual void HideButton( sal_uInt16 nBtnId ) SAL_OVERRIDE; virtual void HideButton( ZoomButtonId nBtnId ) SAL_OVERRIDE;
virtual const SfxItemSet* GetOutputItemSet() const SAL_OVERRIDE ; virtual const SfxItemSet* GetOutputItemSet() const SAL_OVERRIDE ;
}; };
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define INCLUDED_CUI_SOURCE_INC_ZOOM_HXX #define INCLUDED_CUI_SOURCE_INC_ZOOM_HXX
#include <sfx2/basedlgs.hxx> #include <sfx2/basedlgs.hxx>
#include <svx/zoom_def.hxx>
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <vcl/field.hxx> #include <vcl/field.hxx>
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
...@@ -62,9 +63,9 @@ public: ...@@ -62,9 +63,9 @@ public:
const SfxItemSet* GetOutputItemSet() const; const SfxItemSet* GetOutputItemSet() const;
sal_uInt16 GetFactor() const; sal_uInt16 GetFactor() const;
void SetFactor(sal_uInt16 nNewFactor, sal_uInt16 nButtonId = 0); void SetFactor(sal_uInt16 nNewFactor, ZoomButtonId nButtonId = ZoomButtonId::NONE);
void HideButton(sal_uInt16 nButtonId); void HideButton(ZoomButtonId nButtonId);
void SetLimits(sal_uInt16 nMin, sal_uInt16 nMax); void SetLimits(sal_uInt16 nMin, sal_uInt16 nMax);
}; };
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define INCLUDED_SVX_SVXDLG_HXX #define INCLUDED_SVX_SVXDLG_HXX
#include <sfx2/sfxdlg.hxx> #include <sfx2/sfxdlg.hxx>
#include <svx/zoom_def.hxx>
#include <editeng/edtdlg.hxx> #include <editeng/edtdlg.hxx>
class SdrModel; class SdrModel;
...@@ -76,7 +77,7 @@ class AbstractSvxZoomDialog : public VclAbstractDialog ...@@ -76,7 +77,7 @@ class AbstractSvxZoomDialog : public VclAbstractDialog
{ {
public: public:
virtual void SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) = 0; virtual void SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) = 0;
virtual void HideButton( sal_uInt16 nBtnId )= 0; virtual void HideButton( ZoomButtonId nBtnId )= 0;
virtual const SfxItemSet* GetOutputItemSet() const = 0 ; virtual const SfxItemSet* GetOutputItemSet() const = 0 ;
}; };
......
...@@ -20,9 +20,13 @@ ...@@ -20,9 +20,13 @@
#ifndef INCLUDED_SVX_ZOOM_DEF_HXX #ifndef INCLUDED_SVX_ZOOM_DEF_HXX
#define INCLUDED_SVX_ZOOM_DEF_HXX #define INCLUDED_SVX_ZOOM_DEF_HXX
#define ZOOMBTN_OPTIMAL ((sal_uInt16)0x0001) enum class ZoomButtonId
#define ZOOMBTN_PAGEWIDTH ((sal_uInt16)0x0002) {
#define ZOOMBTN_WHOLEPAGE ((sal_uInt16)0x0004) NONE = 0x0000,
OPTIMAL = 0x0001,
PAGEWIDTH = 0x0002,
WHOLEPAGE = 0x0004,
};
#endif #endif
......
...@@ -652,7 +652,7 @@ void ScPreviewShell::Execute( SfxRequest& rReq ) ...@@ -652,7 +652,7 @@ void ScPreviewShell::Execute( SfxRequest& rReq )
boost::scoped_ptr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(NULL, aSet)); boost::scoped_ptr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(NULL, aSet));
OSL_ENSURE(pDlg, "Dialog creation failed!"); OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->SetLimits( 20, 400 ); pDlg->SetLimits( 20, 400 );
pDlg->HideButton( ZOOMBTN_OPTIMAL ); pDlg->HideButton( ZoomButtonId::OPTIMAL );
bCancel = ( RET_CANCEL == pDlg->Execute() ); bCancel = ( RET_CANCEL == pDlg->Execute() );
if ( !bCancel ) if ( !bCancel )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment