convert SVX_ZOOM_ENABLE constants to enum class
Change-Id: Iead354b95b832edd72eb8e881855f228fd85be70
This commit is contained in:
parent
5d37fa2a71
commit
ecec9afe85
@ -207,7 +207,7 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet )
|
|||||||
const SvxZoomItem& rZoomItem = static_cast<const SvxZoomItem&>(rItem);
|
const SvxZoomItem& rZoomItem = static_cast<const SvxZoomItem&>(rItem);
|
||||||
const sal_uInt16 nZoom = rZoomItem.GetValue();
|
const sal_uInt16 nZoom = rZoomItem.GetValue();
|
||||||
const SvxZoomType eType = rZoomItem.GetType();
|
const SvxZoomType eType = rZoomItem.GetType();
|
||||||
const sal_uInt16 nValSet = rZoomItem.GetValueSet();
|
const SvxZoomEnableFlags nValSet = rZoomItem.GetValueSet();
|
||||||
sal_uInt16 nButtonId = 0;
|
sal_uInt16 nButtonId = 0;
|
||||||
|
|
||||||
switch (eType)
|
switch (eType)
|
||||||
@ -227,13 +227,13 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(SVX_ZOOM_ENABLE_100 & nValSet))
|
if (!(SvxZoomEnableFlags::N100 & nValSet))
|
||||||
m_p100Btn->Disable();
|
m_p100Btn->Disable();
|
||||||
if (!(SVX_ZOOM_ENABLE_OPTIMAL & nValSet))
|
if (!(SvxZoomEnableFlags::OPTIMAL & nValSet))
|
||||||
m_pOptimalBtn->Disable();
|
m_pOptimalBtn->Disable();
|
||||||
if (!(SVX_ZOOM_ENABLE_PAGEWIDTH & nValSet))
|
if (!(SvxZoomEnableFlags::PAGEWIDTH & nValSet))
|
||||||
m_pPageWidthBtn->Disable();
|
m_pPageWidthBtn->Disable();
|
||||||
if (!(SVX_ZOOM_ENABLE_WHOLEPAGE & nValSet))
|
if (!(SvxZoomEnableFlags::WHOLEPAGE & nValSet))
|
||||||
m_pWholePageBtn->Disable();
|
m_pWholePageBtn->Disable();
|
||||||
|
|
||||||
SetFactor(nZoom, nButtonId);
|
SetFactor(nZoom, nButtonId);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <svl/intitem.hxx>
|
#include <svl/intitem.hxx>
|
||||||
#include <sfx2/sfxsids.hrc>
|
#include <sfx2/sfxsids.hrc>
|
||||||
#include <sfx2/dllapi.h>
|
#include <sfx2/dllapi.h>
|
||||||
|
#include <o3tl/typed_flags_set.hxx>
|
||||||
|
|
||||||
|
|
||||||
enum class SvxZoomType
|
enum class SvxZoomType
|
||||||
@ -34,11 +34,27 @@ enum class SvxZoomType
|
|||||||
PAGEWIDTH_NOBORDER // GetValue() pagewidth without border
|
PAGEWIDTH_NOBORDER // GetValue() pagewidth without border
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class SvxZoomEnableFlags
|
||||||
|
{
|
||||||
|
NONE = 0x0000,
|
||||||
|
N50 = 0x0001,
|
||||||
|
N75 = 0x0002,
|
||||||
|
N100 = 0x0004,
|
||||||
|
N150 = 0x0008,
|
||||||
|
N200 = 0x0010,
|
||||||
|
OPTIMAL = 0x1000,
|
||||||
|
WHOLEPAGE = 0x2000,
|
||||||
|
PAGEWIDTH = 0x4000,
|
||||||
|
ALL = 0x701F
|
||||||
|
};
|
||||||
|
namespace o3tl
|
||||||
|
{
|
||||||
|
template<> struct typed_flags<SvxZoomEnableFlags> : is_typed_flags<SvxZoomEnableFlags, 0x701f> {};
|
||||||
|
}
|
||||||
|
|
||||||
class SFX2_DLLPUBLIC SvxZoomItem: public SfxUInt16Item
|
class SFX2_DLLPUBLIC SvxZoomItem: public SfxUInt16Item
|
||||||
{
|
{
|
||||||
sal_uInt16 nValueSet; // allowed values (see #defines below)
|
SvxZoomEnableFlags nValueSet; // allowed values (see #defines below)
|
||||||
SvxZoomType eType;
|
SvxZoomType eType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -49,14 +65,13 @@ public:
|
|||||||
SvxZoomItem( const SvxZoomItem& );
|
SvxZoomItem( const SvxZoomItem& );
|
||||||
virtual ~SvxZoomItem();
|
virtual ~SvxZoomItem();
|
||||||
|
|
||||||
void SetValueSet( sal_uInt16 nValues ) { nValueSet = nValues; }
|
void SetValueSet( SvxZoomEnableFlags nValues ) { nValueSet = nValues; }
|
||||||
sal_uInt16 GetValueSet() const { return nValueSet; }
|
SvxZoomEnableFlags GetValueSet() const { return nValueSet; }
|
||||||
bool IsValueAllowed( sal_uInt16 nValue ) const
|
bool IsValueAllowed( SvxZoomEnableFlags nValue ) const
|
||||||
{ return nValue == ( nValue & nValueSet ); }
|
{ return bool( nValue & nValueSet ); }
|
||||||
|
|
||||||
SvxZoomType GetType() const { return eType; }
|
SvxZoomType GetType() const { return eType; }
|
||||||
void SetType( SvxZoomType eNewType )
|
void SetType( SvxZoomType eNewType ) { eType = eNewType; }
|
||||||
{ eType = eNewType; }
|
|
||||||
|
|
||||||
virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
|
virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
|
||||||
virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVersion ) const SAL_OVERRIDE;
|
virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVersion ) const SAL_OVERRIDE;
|
||||||
@ -68,16 +83,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SVX_ZOOM_ENABLE_50 0x0001
|
|
||||||
#define SVX_ZOOM_ENABLE_75 0x0002
|
|
||||||
#define SVX_ZOOM_ENABLE_100 0x0004
|
|
||||||
#define SVX_ZOOM_ENABLE_150 0x0008
|
|
||||||
#define SVX_ZOOM_ENABLE_200 0x0010
|
|
||||||
#define SVX_ZOOM_ENABLE_OPTIMAL 0x1000
|
|
||||||
#define SVX_ZOOM_ENABLE_WHOLEPAGE 0x2000
|
|
||||||
#define SVX_ZOOM_ENABLE_PAGEWIDTH 0x4000
|
|
||||||
#define SVX_ZOOM_ENABLE_ALL 0x701F
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@ -21,13 +21,14 @@
|
|||||||
|
|
||||||
#include <sfx2/stbitem.hxx>
|
#include <sfx2/stbitem.hxx>
|
||||||
#include <svx/svxdllapi.h>
|
#include <svx/svxdllapi.h>
|
||||||
|
#include <sfx2/zoomitem.hxx>
|
||||||
#include <vcl/image.hxx>
|
#include <vcl/image.hxx>
|
||||||
|
|
||||||
class SVX_DLLPUBLIC SvxZoomStatusBarControl : public SfxStatusBarControl
|
class SVX_DLLPUBLIC SvxZoomStatusBarControl : public SfxStatusBarControl
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
sal_uInt16 nZoom;
|
sal_uInt16 nZoom;
|
||||||
sal_uInt16 nValueSet;
|
SvxZoomEnableFlags nValueSet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
|
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
|
||||||
|
@ -942,7 +942,7 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const
|
|||||||
aReturn.bEnabled = true;
|
aReturn.bEnabled = true;
|
||||||
{
|
{
|
||||||
SvxZoomItem aZoom(m_eZoomType,m_nZoomValue);
|
SvxZoomItem aZoom(m_eZoomType,m_nZoomValue);
|
||||||
aZoom.SetValueSet(SVX_ZOOM_ENABLE_50|SVX_ZOOM_ENABLE_75|SVX_ZOOM_ENABLE_100|SVX_ZOOM_ENABLE_200);
|
aZoom.SetValueSet(SvxZoomEnableFlags::N50|SvxZoomEnableFlags::N75|SvxZoomEnableFlags::N100|SvxZoomEnableFlags::N200);
|
||||||
aZoom.QueryValue(aReturn.aValue);
|
aZoom.QueryValue(aReturn.aValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4275,7 +4275,7 @@ void OReportController::openZoomDialog()
|
|||||||
::std::unique_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges));
|
::std::unique_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges));
|
||||||
// fill it
|
// fill it
|
||||||
SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM );
|
SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM );
|
||||||
aZoomItem.SetValueSet(SVX_ZOOM_ENABLE_100|SVX_ZOOM_ENABLE_WHOLEPAGE|SVX_ZOOM_ENABLE_PAGEWIDTH);
|
aZoomItem.SetValueSet(SvxZoomEnableFlags::N100|SvxZoomEnableFlags::WHOLEPAGE|SvxZoomEnableFlags::PAGEWIDTH);
|
||||||
pDescriptor->Put(aZoomItem);
|
pDescriptor->Put(aZoomItem);
|
||||||
|
|
||||||
::std::unique_ptr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(NULL, *pDescriptor.get()) );
|
::std::unique_ptr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(NULL, *pDescriptor.get()) );
|
||||||
|
@ -829,7 +829,7 @@ void ScPreviewShell::GetState( SfxItemSet& rSet )
|
|||||||
case SID_ATTR_ZOOM:
|
case SID_ATTR_ZOOM:
|
||||||
{
|
{
|
||||||
SvxZoomItem aZoom( eZoom, nZoom, nWhich );
|
SvxZoomItem aZoom( eZoom, nZoom, nWhich );
|
||||||
aZoom.SetValueSet( SVX_ZOOM_ENABLE_ALL & ~SVX_ZOOM_ENABLE_OPTIMAL );
|
aZoom.SetValueSet( SvxZoomEnableFlags::ALL & ~SvxZoomEnableFlags::OPTIMAL );
|
||||||
rSet.Put( aZoom );
|
rSet.Put( aZoom );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -640,16 +640,16 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
|
|||||||
SvxZoomItem aZoomItem( eOldZoomType, nOldZoom, SID_ATTR_ZOOM );
|
SvxZoomItem aZoomItem( eOldZoomType, nOldZoom, SID_ATTR_ZOOM );
|
||||||
boost::scoped_ptr<AbstractSvxZoomDialog> pDlg;
|
boost::scoped_ptr<AbstractSvxZoomDialog> pDlg;
|
||||||
ScMarkData& rMark = GetViewData().GetMarkData();
|
ScMarkData& rMark = GetViewData().GetMarkData();
|
||||||
sal_uInt16 nBtnFlags = SVX_ZOOM_ENABLE_50
|
SvxZoomEnableFlags nBtnFlags = SvxZoomEnableFlags::N50
|
||||||
| SVX_ZOOM_ENABLE_75
|
| SvxZoomEnableFlags::N75
|
||||||
| SVX_ZOOM_ENABLE_100
|
| SvxZoomEnableFlags::N100
|
||||||
| SVX_ZOOM_ENABLE_150
|
| SvxZoomEnableFlags::N150
|
||||||
| SVX_ZOOM_ENABLE_200
|
| SvxZoomEnableFlags::N200
|
||||||
| SVX_ZOOM_ENABLE_WHOLEPAGE
|
| SvxZoomEnableFlags::WHOLEPAGE
|
||||||
| SVX_ZOOM_ENABLE_PAGEWIDTH;
|
| SvxZoomEnableFlags::PAGEWIDTH;
|
||||||
|
|
||||||
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
|
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
|
||||||
nBtnFlags = nBtnFlags | SVX_ZOOM_ENABLE_OPTIMAL;
|
nBtnFlags = nBtnFlags | SvxZoomEnableFlags::OPTIMAL;
|
||||||
|
|
||||||
aZoomItem.SetValueSet( nBtnFlags );
|
aZoomItem.SetValueSet( nBtnFlags );
|
||||||
aSet.Put( aZoomItem );
|
aSet.Put( aZoomItem );
|
||||||
|
@ -72,7 +72,7 @@ void FuScale::DoExecute( SfxRequest& rReq )
|
|||||||
{
|
{
|
||||||
SfxItemSet aNewAttr( mpDoc->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM );
|
SfxItemSet aNewAttr( mpDoc->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM );
|
||||||
boost::scoped_ptr<SvxZoomItem> pZoomItem;
|
boost::scoped_ptr<SvxZoomItem> pZoomItem;
|
||||||
sal_uInt16 nZoomValues = SVX_ZOOM_ENABLE_ALL;
|
SvxZoomEnableFlags nZoomValues = SvxZoomEnableFlags::ALL;
|
||||||
|
|
||||||
nValue = (sal_Int16) mpWindow->GetZoom();
|
nValue = (sal_Int16) mpWindow->GetZoom();
|
||||||
|
|
||||||
@ -96,14 +96,14 @@ void FuScale::DoExecute( SfxRequest& rReq )
|
|||||||
if( ( pPageView && pPageView->GetObjList()->GetObjCount() == 0 ) )
|
if( ( pPageView && pPageView->GetObjList()->GetObjCount() == 0 ) )
|
||||||
// || ( mpView->GetMarkedObjectList().GetMarkCount() == 0 ) )
|
// || ( mpView->GetMarkedObjectList().GetMarkCount() == 0 ) )
|
||||||
{
|
{
|
||||||
nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
|
nZoomValues &= ~SvxZoomEnableFlags::OPTIMAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( mpViewShell->ISA( OutlineViewShell ) )
|
else if( mpViewShell->ISA( OutlineViewShell ) )
|
||||||
{
|
{
|
||||||
nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
|
nZoomValues &= ~SvxZoomEnableFlags::OPTIMAL;
|
||||||
nZoomValues &= ~SVX_ZOOM_ENABLE_WHOLEPAGE;
|
nZoomValues &= ~SvxZoomEnableFlags::WHOLEPAGE;
|
||||||
nZoomValues &= ~SVX_ZOOM_ENABLE_PAGEWIDTH;
|
nZoomValues &= ~SvxZoomEnableFlags::PAGEWIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,13 +590,13 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
|
|||||||
pZoomItem.reset(new SvxZoomItem( SvxZoomType::PERCENT, nZoom ));
|
pZoomItem.reset(new SvxZoomItem( SvxZoomType::PERCENT, nZoom ));
|
||||||
|
|
||||||
// constrain area
|
// constrain area
|
||||||
sal_uInt16 nZoomValues = SVX_ZOOM_ENABLE_ALL;
|
SvxZoomEnableFlags nZoomValues = SvxZoomEnableFlags::ALL;
|
||||||
SdrPageView* pPageView = mpDrawView->GetSdrPageView();
|
SdrPageView* pPageView = mpDrawView->GetSdrPageView();
|
||||||
|
|
||||||
if( ( pPageView && pPageView->GetObjList()->GetObjCount() == 0 ) )
|
if( ( pPageView && pPageView->GetObjList()->GetObjCount() == 0 ) )
|
||||||
// || ( mpDrawView->GetMarkedObjectList().GetMarkCount() == 0 ) )
|
// || ( mpDrawView->GetMarkedObjectList().GetMarkCount() == 0 ) )
|
||||||
{
|
{
|
||||||
nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
|
nZoomValues &= ~SvxZoomEnableFlags::OPTIMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pZoomItem->SetValueSet( nZoomValues );
|
pZoomItem->SetValueSet( nZoomValues );
|
||||||
|
@ -1279,10 +1279,10 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet)
|
|||||||
boost::scoped_ptr<SvxZoomItem> pZoomItem(new SvxZoomItem( SvxZoomType::PERCENT, nZoom ));
|
boost::scoped_ptr<SvxZoomItem> pZoomItem(new SvxZoomItem( SvxZoomType::PERCENT, nZoom ));
|
||||||
|
|
||||||
// limit area
|
// limit area
|
||||||
sal_uInt16 nZoomValues = SVX_ZOOM_ENABLE_ALL;
|
SvxZoomEnableFlags nZoomValues = SvxZoomEnableFlags::ALL;
|
||||||
nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
|
nZoomValues &= ~SvxZoomEnableFlags::OPTIMAL;
|
||||||
nZoomValues &= ~SVX_ZOOM_ENABLE_WHOLEPAGE;
|
nZoomValues &= ~SvxZoomEnableFlags::WHOLEPAGE;
|
||||||
nZoomValues &= ~SVX_ZOOM_ENABLE_PAGEWIDTH;
|
nZoomValues &= ~SvxZoomEnableFlags::PAGEWIDTH;
|
||||||
|
|
||||||
pZoomItem->SetValueSet( nZoomValues );
|
pZoomItem->SetValueSet( nZoomValues );
|
||||||
rSet.Put( *pZoomItem );
|
rSet.Put( *pZoomItem );
|
||||||
|
@ -43,7 +43,7 @@ SvxZoomItem::SvxZoomItem
|
|||||||
sal_uInt16 _nWhich
|
sal_uInt16 _nWhich
|
||||||
)
|
)
|
||||||
: SfxUInt16Item( _nWhich, nVal ),
|
: SfxUInt16Item( _nWhich, nVal ),
|
||||||
nValueSet( SVX_ZOOM_ENABLE_ALL ),
|
nValueSet( SvxZoomEnableFlags::ALL ),
|
||||||
eType( eZoomType )
|
eType( eZoomType )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ SfxPoolItem* SvxZoomItem::Create( SvStream& rStrm, sal_uInt16 /*nVersion*/ ) con
|
|||||||
sal_Int8 nType;
|
sal_Int8 nType;
|
||||||
rStrm.ReadUInt16( nValue ).ReadUInt16( nValSet ).ReadSChar( nType );
|
rStrm.ReadUInt16( nValue ).ReadUInt16( nValSet ).ReadSChar( nType );
|
||||||
SvxZoomItem* pNew = new SvxZoomItem( (SvxZoomType)nType, nValue, Which() );
|
SvxZoomItem* pNew = new SvxZoomItem( (SvxZoomType)nType, nValue, Which() );
|
||||||
pNew->SetValueSet( nValSet );
|
pNew->SetValueSet( static_cast<SvxZoomEnableFlags>(nValSet) );
|
||||||
return pNew;
|
return pNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ SfxPoolItem* SvxZoomItem::Create( SvStream& rStrm, sal_uInt16 /*nVersion*/ ) con
|
|||||||
SvStream& SvxZoomItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
|
SvStream& SvxZoomItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
|
||||||
{
|
{
|
||||||
rStrm.WriteUInt16( GetValue() )
|
rStrm.WriteUInt16( GetValue() )
|
||||||
.WriteUInt16( nValueSet )
|
.WriteUInt16( static_cast<sal_uInt16>(nValueSet) )
|
||||||
.WriteSChar( static_cast<int>(eType) );
|
.WriteSChar( static_cast<int>(eType) );
|
||||||
return rStrm;
|
return rStrm;
|
||||||
}
|
}
|
||||||
@ -172,8 +172,8 @@ bool SvxZoomItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMem
|
|||||||
if ( bAllConverted && nConvertedCount == ZOOM_PARAMS )
|
if ( bAllConverted && nConvertedCount == ZOOM_PARAMS )
|
||||||
{
|
{
|
||||||
SetValue( (sal_uInt16)nValueTmp );
|
SetValue( (sal_uInt16)nValueTmp );
|
||||||
nValueSet = nValueSetTmp;
|
nValueSet = static_cast<SvxZoomEnableFlags>(nValueSetTmp);
|
||||||
eType = SvxZoomType( nTypeTmp );
|
eType = static_cast<SvxZoomType>(nTypeTmp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,13 +194,13 @@ bool SvxZoomItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMem
|
|||||||
case MID_VALUESET:
|
case MID_VALUESET:
|
||||||
case MID_TYPE:
|
case MID_TYPE:
|
||||||
{
|
{
|
||||||
sal_Int16 nVal = sal_Int16();
|
sal_Int16 nVal;
|
||||||
if ( rVal >>= nVal )
|
if ( rVal >>= nVal )
|
||||||
{
|
{
|
||||||
if ( nMemberId == MID_VALUESET )
|
if ( nMemberId == MID_VALUESET )
|
||||||
nValueSet = (sal_Int16) nVal;
|
nValueSet = static_cast<SvxZoomEnableFlags>(nVal);
|
||||||
else if ( nMemberId == MID_TYPE )
|
else if ( nMemberId == MID_TYPE )
|
||||||
eType = SvxZoomType( (sal_Int16) nVal );
|
eType = static_cast<SvxZoomType>(nVal);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -39,7 +39,7 @@ SFX_IMPL_STATUSBAR_CONTROL(SvxZoomStatusBarControl,SvxZoomItem);
|
|||||||
class ZoomPopup_Impl : public PopupMenu
|
class ZoomPopup_Impl : public PopupMenu
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ZoomPopup_Impl( sal_uInt16 nZ, sal_uInt16 nValueSet );
|
ZoomPopup_Impl( sal_uInt16 nZ, SvxZoomEnableFlags nValueSet );
|
||||||
|
|
||||||
sal_uInt16 GetZoom() const { return nZoom; }
|
sal_uInt16 GetZoom() const { return nZoom; }
|
||||||
sal_uInt16 GetCurId() const { return nCurId; }
|
sal_uInt16 GetCurId() const { return nCurId; }
|
||||||
@ -53,25 +53,25 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ZoomPopup_Impl::ZoomPopup_Impl( sal_uInt16 nZ, sal_uInt16 nValueSet )
|
ZoomPopup_Impl::ZoomPopup_Impl( sal_uInt16 nZ, SvxZoomEnableFlags nValueSet )
|
||||||
: PopupMenu(ResId(RID_SVXMNU_ZOOM, DIALOG_MGR()))
|
: PopupMenu(ResId(RID_SVXMNU_ZOOM, DIALOG_MGR()))
|
||||||
, nZoom(nZ)
|
, nZoom(nZ)
|
||||||
, nCurId(0)
|
, nCurId(0)
|
||||||
{
|
{
|
||||||
static const sal_uInt16 aTable[] =
|
if ( !(SvxZoomEnableFlags::N50 & nValueSet) )
|
||||||
{
|
EnableItem( ZOOM_50, false );
|
||||||
SVX_ZOOM_ENABLE_50, ZOOM_50,
|
if ( !(SvxZoomEnableFlags::N100 & nValueSet) )
|
||||||
SVX_ZOOM_ENABLE_100, ZOOM_100,
|
EnableItem( ZOOM_100, false );
|
||||||
SVX_ZOOM_ENABLE_150, ZOOM_150,
|
if ( !(SvxZoomEnableFlags::N150 & nValueSet) )
|
||||||
SVX_ZOOM_ENABLE_200, ZOOM_200,
|
EnableItem( ZOOM_150, false );
|
||||||
SVX_ZOOM_ENABLE_OPTIMAL, ZOOM_OPTIMAL,
|
if ( !(SvxZoomEnableFlags::N200 & nValueSet) )
|
||||||
SVX_ZOOM_ENABLE_WHOLEPAGE, ZOOM_WHOLE_PAGE,
|
EnableItem( ZOOM_200, false );
|
||||||
SVX_ZOOM_ENABLE_PAGEWIDTH, ZOOM_PAGE_WIDTH
|
if ( !(SvxZoomEnableFlags::OPTIMAL & nValueSet) )
|
||||||
};
|
EnableItem( ZOOM_OPTIMAL, false );
|
||||||
|
if ( !(SvxZoomEnableFlags::WHOLEPAGE & nValueSet) )
|
||||||
for ( sal_uInt16 nPos = 0; nPos < SAL_N_ELEMENTS(aTable); nPos += 2 )
|
EnableItem( ZOOM_WHOLE_PAGE, false );
|
||||||
if ( ( aTable[nPos] != ( aTable[nPos] & nValueSet ) ) )
|
if ( !(SvxZoomEnableFlags::PAGEWIDTH & nValueSet) )
|
||||||
EnableItem( aTable[nPos+1], false );
|
EnableItem( ZOOM_PAGE_WIDTH, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ SvxZoomStatusBarControl::SvxZoomStatusBarControl( sal_uInt16 _nSlotId,
|
|||||||
|
|
||||||
SfxStatusBarControl( _nSlotId, _nId, rStb ),
|
SfxStatusBarControl( _nSlotId, _nId, rStb ),
|
||||||
nZoom( 100 ),
|
nZoom( 100 ),
|
||||||
nValueSet( SVX_ZOOM_ENABLE_ALL )
|
nValueSet( SvxZoomEnableFlags::ALL )
|
||||||
{
|
{
|
||||||
GetStatusBar().SetQuickHelpText(GetId(), SVX_RESSTR(RID_SVXSTR_ZOOMTOOL_HINT));
|
GetStatusBar().SetQuickHelpText(GetId(), SVX_RESSTR(RID_SVXSTR_ZOOMTOOL_HINT));
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ void SvxZoomStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState,
|
|||||||
if( SfxItemState::DEFAULT != eState )
|
if( SfxItemState::DEFAULT != eState )
|
||||||
{
|
{
|
||||||
GetStatusBar().SetItemText( GetId(), "" );
|
GetStatusBar().SetItemText( GetId(), "" );
|
||||||
nValueSet = 0;
|
nValueSet = SvxZoomEnableFlags::NONE;
|
||||||
}
|
}
|
||||||
else if ( pState->ISA( SfxUInt16Item) )
|
else if ( pState->ISA( SfxUInt16Item) )
|
||||||
{
|
{
|
||||||
@ -129,7 +129,7 @@ void SvxZoomStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DBG_WARNING( "use SfxZoomItem for SID_ATTR_ZOOM" );
|
DBG_WARNING( "use SfxZoomItem for SID_ATTR_ZOOM" );
|
||||||
nValueSet = SVX_ZOOM_ENABLE_ALL;
|
nValueSet = SvxZoomEnableFlags::ALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ void SvxZoomStatusBarControl::Paint( const UserDrawEvent& )
|
|||||||
|
|
||||||
void SvxZoomStatusBarControl::Command( const CommandEvent& rCEvt )
|
void SvxZoomStatusBarControl::Command( const CommandEvent& rCEvt )
|
||||||
{
|
{
|
||||||
if ( COMMAND_CONTEXTMENU & rCEvt.GetCommand() && 0 != nValueSet )
|
if ( COMMAND_CONTEXTMENU & rCEvt.GetCommand() && bool(nValueSet) )
|
||||||
{
|
{
|
||||||
ZoomPopup_Impl aPop( nZoom, nValueSet );
|
ZoomPopup_Impl aPop( nZoom, nValueSet );
|
||||||
StatusBar& rStatusbar = GetStatusBar();
|
StatusBar& rStatusbar = GetStatusBar();
|
||||||
|
@ -750,12 +750,12 @@ void SwPagePreview::Execute( SfxRequest &rReq )
|
|||||||
SvxZoomItem aZoom( (SvxZoomType)pVOpt->GetZoomType(),
|
SvxZoomItem aZoom( (SvxZoomType)pVOpt->GetZoomType(),
|
||||||
pVOpt->GetZoom() );
|
pVOpt->GetZoom() );
|
||||||
aZoom.SetValueSet(
|
aZoom.SetValueSet(
|
||||||
SVX_ZOOM_ENABLE_50|
|
SvxZoomEnableFlags::N50|
|
||||||
SVX_ZOOM_ENABLE_75|
|
SvxZoomEnableFlags::N75|
|
||||||
SVX_ZOOM_ENABLE_100|
|
SvxZoomEnableFlags::N100|
|
||||||
SVX_ZOOM_ENABLE_150|
|
SvxZoomEnableFlags::N150|
|
||||||
SVX_ZOOM_ENABLE_200|
|
SvxZoomEnableFlags::N200|
|
||||||
SVX_ZOOM_ENABLE_WHOLEPAGE);
|
SvxZoomEnableFlags::WHOLEPAGE);
|
||||||
aCoreSet.Put( aZoom );
|
aCoreSet.Put( aZoom );
|
||||||
|
|
||||||
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
||||||
@ -992,11 +992,11 @@ void SwPagePreview::GetState( SfxItemSet& rSet )
|
|||||||
SvxZoomItem aZoom((SvxZoomType)pVOpt->GetZoomType(),
|
SvxZoomItem aZoom((SvxZoomType)pVOpt->GetZoomType(),
|
||||||
pVOpt->GetZoom());
|
pVOpt->GetZoom());
|
||||||
aZoom.SetValueSet(
|
aZoom.SetValueSet(
|
||||||
SVX_ZOOM_ENABLE_50|
|
SvxZoomEnableFlags::N50|
|
||||||
SVX_ZOOM_ENABLE_75|
|
SvxZoomEnableFlags::N75|
|
||||||
SVX_ZOOM_ENABLE_100|
|
SvxZoomEnableFlags::N100|
|
||||||
SVX_ZOOM_ENABLE_150|
|
SvxZoomEnableFlags::N150|
|
||||||
SVX_ZOOM_ENABLE_200);
|
SvxZoomEnableFlags::N200);
|
||||||
rSet.Put( aZoom );
|
rSet.Put( aZoom );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1403,11 +1403,11 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
|
|||||||
if( pVOpt->getBrowseMode() )
|
if( pVOpt->getBrowseMode() )
|
||||||
{
|
{
|
||||||
aZoom.SetValueSet(
|
aZoom.SetValueSet(
|
||||||
SVX_ZOOM_ENABLE_50|
|
SvxZoomEnableFlags::N50|
|
||||||
SVX_ZOOM_ENABLE_75|
|
SvxZoomEnableFlags::N75|
|
||||||
SVX_ZOOM_ENABLE_100|
|
SvxZoomEnableFlags::N100|
|
||||||
SVX_ZOOM_ENABLE_150|
|
SvxZoomEnableFlags::N150|
|
||||||
SVX_ZOOM_ENABLE_200);
|
SvxZoomEnableFlags::N200);
|
||||||
}
|
}
|
||||||
rSet.Put( aZoom );
|
rSet.Put( aZoom );
|
||||||
}
|
}
|
||||||
@ -1690,11 +1690,11 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq)
|
|||||||
if( bBrowseMode )
|
if( bBrowseMode )
|
||||||
{
|
{
|
||||||
aZoom.SetValueSet(
|
aZoom.SetValueSet(
|
||||||
SVX_ZOOM_ENABLE_50|
|
SvxZoomEnableFlags::N50|
|
||||||
SVX_ZOOM_ENABLE_75|
|
SvxZoomEnableFlags::N75|
|
||||||
SVX_ZOOM_ENABLE_100|
|
SvxZoomEnableFlags::N100|
|
||||||
SVX_ZOOM_ENABLE_150|
|
SvxZoomEnableFlags::N150|
|
||||||
SVX_ZOOM_ENABLE_200);
|
SvxZoomEnableFlags::N200);
|
||||||
}
|
}
|
||||||
aCoreSet.Put( aZoom );
|
aCoreSet.Put( aZoom );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user