Kaydet (Commit) 81fbf138 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

tdf#84938 convert VIEWOPT_ constants to scoped enum

Change-Id: I7d72ed66ea2cf920a0a03a2aa71b5de079f0cf6e
üst 77c494de
...@@ -54,10 +54,13 @@ class SvtCTLOptions; ...@@ -54,10 +54,13 @@ class SvtCTLOptions;
class SvtUserOptions; class SvtUserOptions;
struct SwDBData; struct SwDBData;
#define VIEWOPT_DEST_VIEW 0
#define VIEWOPT_DEST_TEXT 1 enum class SvViewOpt {
#define VIEWOPT_DEST_WEB 2 DestView,
#define VIEWOPT_DEST_VIEW_ONLY 3 //ViewOptions are set only at View, not at the appl. DestText,
DestWeb,
DestViewOnly //ViewOptions are set only at View, not at the appl.
};
namespace com{ namespace sun{ namespace star{ namespace scanner{ namespace com{ namespace sun{ namespace star{ namespace scanner{
class XScannerManager2; class XScannerManager2;
...@@ -145,7 +148,7 @@ public: ...@@ -145,7 +148,7 @@ public:
const SwMasterUsrPref *GetUsrPref(bool bWeb) const; const SwMasterUsrPref *GetUsrPref(bool bWeb) const;
const SwViewOption* GetViewOption(bool bWeb); const SwViewOption* GetViewOption(bool bWeb);
void ApplyUsrPref(const SwViewOption &, SwView*, void ApplyUsrPref(const SwViewOption &, SwView*,
sal_uInt16 nDest = VIEWOPT_DEST_VIEW ); SvViewOpt nDest = SvViewOpt::DestView );
void ApplyUserMetric( FieldUnit eMetric, bool bWeb ); void ApplyUserMetric( FieldUnit eMetric, bool bWeb );
void ApplyRulerMetric( FieldUnit eMetric, bool bHorizontal, bool bWeb ); void ApplyRulerMetric( FieldUnit eMetric, bool bHorizontal, bool bWeb );
void ApplyFieldUpdateFlags(SwFieldUpdateFlags eFieldFlags); void ApplyFieldUpdateFlags(SwFieldUpdateFlags eFieldFlags);
......
...@@ -414,7 +414,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) ...@@ -414,7 +414,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
aViewOpt.SetIgnoreProtectedArea(static_cast<const SfxBoolItem*>(pItem)->GetValue()); aViewOpt.SetIgnoreProtectedArea(static_cast<const SfxBoolItem*>(pItem)->GetValue());
// set elements for the current view and shell // set elements for the current view and shell
ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB); ApplyUsrPref( aViewOpt, pAppView, bTextDialog? SvViewOpt::DestText : SvViewOpt::DestWeb);
} }
VclPtr<SfxTabPage> SwModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) VclPtr<SfxTabPage> SwModule::CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet )
......
...@@ -136,18 +136,18 @@ SwView* SwModule::GetNextView(SwView* pView) ...@@ -136,18 +136,18 @@ SwView* SwModule::GetNextView(SwView* pView)
// New Master for the settings is set; this affects the current view and all following. // New Master for the settings is set; this affects the current view and all following.
void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView, void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
sal_uInt16 nDest ) SvViewOpt nDest )
{ {
SwView* pCurrView = pActView; SwView* pCurrView = pActView;
SwViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : nullptr; SwViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : nullptr;
SwMasterUsrPref* pPref = const_cast<SwMasterUsrPref*>(GetUsrPref( SwMasterUsrPref* pPref = const_cast<SwMasterUsrPref*>(GetUsrPref(
nDest == VIEWOPT_DEST_WEB nDest == SvViewOpt::DestWeb
|| (nDest != VIEWOPT_DEST_TEXT || (nDest != SvViewOpt::DestText
&& pCurrView && dynamic_cast< const SwWebView *>( pCurrView ) != nullptr) )); && pCurrView && dynamic_cast< const SwWebView *>( pCurrView ) != nullptr) ));
// with Uno, only sdbcx::View, but not the Module should be changed // with Uno, only sdbcx::View, but not the Module should be changed
bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest; bool bViewOnly = SvViewOpt::DestViewOnly == nDest;
// fob Preview off // fob Preview off
SwPagePreview* pPPView; SwPagePreview* pPPView;
if( !pCurrView && nullptr != (pPPView = dynamic_cast<SwPagePreview*>( SfxViewShell::Current())) ) if( !pCurrView && nullptr != (pPPView = dynamic_cast<SwPagePreview*>( SfxViewShell::Current())) )
......
...@@ -591,7 +591,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq) ...@@ -591,7 +591,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
if( !bModified ) if( !bModified )
rSh.ResetModified(); rSh.ResetModified();
pModule->ApplyUsrPref( *pOpt, this, bWebView ? VIEWOPT_DEST_WEB : VIEWOPT_DEST_TEXT ); pModule->ApplyUsrPref( *pOpt, this, bWebView ? SvViewOpt::DestWeb : SvViewOpt::DestText );
// #i6193# let postits know about new spellcheck setting // #i6193# let postits know about new spellcheck setting
if ( nSlot == SID_AUTOSPELL_CHECK ) if ( nSlot == SID_AUTOSPELL_CHECK )
......
...@@ -810,9 +810,9 @@ void SwXViewSettings::_postSetValues() ...@@ -810,9 +810,9 @@ void SwXViewSettings::_postSetValues()
SW_MOD()->ApplyRulerMetric( (FieldUnit)eVRulerUnit, false, bWeb ); SW_MOD()->ApplyRulerMetric( (FieldUnit)eVRulerUnit, false, bWeb );
} }
SW_MOD()->ApplyUsrPref( *mpViewOption, pView, pView ? VIEWOPT_DEST_VIEW_ONLY SW_MOD()->ApplyUsrPref( *mpViewOption, pView, pView ? SvViewOpt::DestViewOnly
: bWeb ? VIEWOPT_DEST_WEB : bWeb ? SvViewOpt::DestWeb
: VIEWOPT_DEST_TEXT ); : SvViewOpt::DestText );
delete mpViewOption; delete mpViewOption;
mpViewOption = nullptr; mpViewOption = nullptr;
......
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