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
return SPECIAL_FACTOR;
}
void SvxZoomDialog::SetFactor(sal_uInt16 nNewFactor, sal_uInt16 nButtonId)
void SvxZoomDialog::SetFactor(sal_uInt16 nNewFactor, ZoomButtonId nButtonId)
{
m_pUserEdit->Disable();
if (!nButtonId)
if (nButtonId == ZoomButtonId::NONE)
{
if ( nNewFactor == 100 )
{
......@@ -73,41 +73,42 @@ void SvxZoomDialog::SetFactor(sal_uInt16 nNewFactor, sal_uInt16 nButtonId)
m_pUserEdit->SetValue(static_cast<long>(nNewFactor));
switch(nButtonId)
{
case ZOOMBTN_OPTIMAL:
case ZoomButtonId::OPTIMAL:
{
m_pOptimalBtn->Check();
m_pOptimalBtn->GrabFocus();
break;
}
case ZOOMBTN_PAGEWIDTH:
case ZoomButtonId::PAGEWIDTH:
{
m_pPageWidthBtn->Check();
m_pPageWidthBtn->GrabFocus();
break;
}
case ZOOMBTN_WHOLEPAGE:
case ZoomButtonId::WHOLEPAGE:
{
m_pWholePageBtn->Check();
m_pWholePageBtn->GrabFocus();
break;
}
default: break;
}
}
}
void SvxZoomDialog::HideButton(sal_uInt16 nButtonId)
void SvxZoomDialog::HideButton(ZoomButtonId nButtonId)
{
switch (nButtonId)
{
case ZOOMBTN_OPTIMAL:
case ZoomButtonId::OPTIMAL:
m_pOptimalBtn->Hide();
break;
case ZOOMBTN_PAGEWIDTH:
case ZoomButtonId::PAGEWIDTH:
m_pPageWidthBtn->Hide();
break;
case ZOOMBTN_WHOLEPAGE:
case ZoomButtonId::WHOLEPAGE:
m_pWholePageBtn->Hide();
break;
......@@ -208,18 +209,18 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet )
const sal_uInt16 nZoom = rZoomItem.GetValue();
const SvxZoomType eType = rZoomItem.GetType();
const SvxZoomEnableFlags nValSet = rZoomItem.GetValueSet();
sal_uInt16 nButtonId = 0;
ZoomButtonId nButtonId = ZoomButtonId::NONE;
switch (eType)
{
case SvxZoomType::OPTIMAL:
nButtonId = ZOOMBTN_OPTIMAL;
nButtonId = ZoomButtonId::OPTIMAL;
break;
case SvxZoomType::PAGEWIDTH:
nButtonId = ZOOMBTN_PAGEWIDTH;
nButtonId = ZoomButtonId::PAGEWIDTH;
break;
case SvxZoomType::WHOLEPAGE:
nButtonId = ZOOMBTN_WHOLEPAGE;
nButtonId = ZoomButtonId::WHOLEPAGE;
break;
case SvxZoomType::PERCENT:
break;
......
......@@ -419,7 +419,7 @@ void AbstractSvxZoomDialog_Impl::SetLimits( sal_uInt16 nMin, sal_uInt16 nMax )
pDlg->SetLimits( nMin, nMax );
}
void AbstractSvxZoomDialog_Impl::HideButton( sal_uInt16 nBtnId )
void AbstractSvxZoomDialog_Impl::HideButton( ZoomButtonId nBtnId )
{
pDlg->HideButton( nBtnId );
}
......
......@@ -20,6 +20,7 @@
#define INCLUDED_CUI_SOURCE_FACTORY_DLGFACT_HXX
#include <svx/svxdlg.hxx>
#include <svx/zoom_def.hxx>
#include <com/sun/star/container/XNameReplace.hpp>
#include "tools/link.hxx"
......@@ -195,7 +196,7 @@ class AbstractSvxZoomDialog_Impl : public AbstractSvxZoomDialog
{
DECL_ABSTDLG_BASE(AbstractSvxZoomDialog_Impl,SvxZoomDialog)
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 ;
};
......
......@@ -20,6 +20,7 @@
#define INCLUDED_CUI_SOURCE_INC_ZOOM_HXX
#include <sfx2/basedlgs.hxx>
#include <svx/zoom_def.hxx>
#include <vcl/button.hxx>
#include <vcl/field.hxx>
#include <vcl/fixed.hxx>
......@@ -62,9 +63,9 @@ public:
const SfxItemSet* GetOutputItemSet() 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);
};
......
......@@ -20,6 +20,7 @@
#define INCLUDED_SVX_SVXDLG_HXX
#include <sfx2/sfxdlg.hxx>
#include <svx/zoom_def.hxx>
#include <editeng/edtdlg.hxx>
class SdrModel;
......@@ -76,7 +77,7 @@ class AbstractSvxZoomDialog : public VclAbstractDialog
{
public:
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 ;
};
......
......@@ -20,9 +20,13 @@
#ifndef INCLUDED_SVX_ZOOM_DEF_HXX
#define INCLUDED_SVX_ZOOM_DEF_HXX
#define ZOOMBTN_OPTIMAL ((sal_uInt16)0x0001)
#define ZOOMBTN_PAGEWIDTH ((sal_uInt16)0x0002)
#define ZOOMBTN_WHOLEPAGE ((sal_uInt16)0x0004)
enum class ZoomButtonId
{
NONE = 0x0000,
OPTIMAL = 0x0001,
PAGEWIDTH = 0x0002,
WHOLEPAGE = 0x0004,
};
#endif
......
......@@ -652,7 +652,7 @@ void ScPreviewShell::Execute( SfxRequest& rReq )
boost::scoped_ptr<AbstractSvxZoomDialog> pDlg(pFact->CreateSvxZoomDialog(NULL, aSet));
OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->SetLimits( 20, 400 );
pDlg->HideButton( ZOOMBTN_OPTIMAL );
pDlg->HideButton( ZoomButtonId::OPTIMAL );
bCancel = ( RET_CANCEL == pDlg->Execute() );
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