diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-16 08:16:45 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-16 08:17:34 +0200 |
commit | d76d15552d7ef9faddb0694e5f05d180e5798c14 (patch) | |
tree | e32629af3435a3d75e2aad57e6b0e7877a05462f | |
parent | ce3441c2d5b6267c437b7af362fc8d29e38c1dd4 (diff) |
convert FrameListAnalyzer::EDetect to scoped enum
Change-Id: I4e1bd449c4ad60ec810ef52c73d6c6ff3dd313ee
-rw-r--r-- | framework/source/dispatch/closedispatcher.cxx | 6 | ||||
-rw-r--r-- | framework/source/dispatch/startmoduledispatcher.cxx | 2 | ||||
-rw-r--r-- | framework/source/fwe/classes/framelistanalyzer.cxx | 23 | ||||
-rw-r--r-- | framework/source/loadenv/loadenv.cxx | 8 | ||||
-rw-r--r-- | framework/source/services/frame.cxx | 2 | ||||
-rw-r--r-- | include/framework/framelistanalyzer.hxx | 50 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 2 |
7 files changed, 47 insertions, 46 deletions
diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index a9ad77b8db7d..97527aaa607e 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -287,7 +287,7 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, LinkParamNone*, void) // If we found some special cases, we can // make some decisions earlier! css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create(xContext), css::uno::UNO_QUERY_THROW); - FrameListAnalyzer aCheck1(xDesktop, xCloseFrame, FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT); + FrameListAnalyzer aCheck1(xDesktop, xCloseFrame, FrameAnalyzerFlags::Help | FrameAnalyzerFlags::BackingComponent); // Check for existing UNO connections. // NOTE: There is a race between checking this and connections being created/destroyed before @@ -330,7 +330,7 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, LinkParamNone*, void) { // OK; this frame is empty now. // Check the environment again to decide, what is the next step. - FrameListAnalyzer aCheck2(xDesktop, xCloseFrame, FrameListAnalyzer::E_ALL); + FrameListAnalyzer aCheck2(xDesktop, xCloseFrame, FrameAnalyzerFlags::All); // c1) there is as minimum 1 frame open, which is visible and contains a document // different from our one. And it's not the help! @@ -456,7 +456,7 @@ bool CloseDispatcher::implts_prepareFrameForClosing(const css::uno::Reference< c } css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create( xContext ), css::uno::UNO_QUERY_THROW); - FrameListAnalyzer aCheck(xDesktop, xFrame, FrameListAnalyzer::E_ALL); + FrameListAnalyzer aCheck(xDesktop, xFrame, FrameAnalyzerFlags::All); size_t c = aCheck.m_lModelFrames.size(); size_t i = 0; diff --git a/framework/source/dispatch/startmoduledispatcher.cxx b/framework/source/dispatch/startmoduledispatcher.cxx index 8fb1006d4c27..64f5974e227e 100644 --- a/framework/source/dispatch/startmoduledispatcher.cxx +++ b/framework/source/dispatch/startmoduledispatcher.cxx @@ -111,7 +111,7 @@ bool StartModuleDispatcher::implts_isBackingModePossible() FrameListAnalyzer aCheck( xDesktop, css::uno::Reference< css::frame::XFrame >(), - FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT); + FrameAnalyzerFlags::Help | FrameAnalyzerFlags::BackingComponent); bool bIsPossible = false; diff --git a/framework/source/fwe/classes/framelistanalyzer.cxx b/framework/source/fwe/classes/framelistanalyzer.cxx index 2b6ded8181c0..efb772fbee0a 100644 --- a/framework/source/fwe/classes/framelistanalyzer.cxx +++ b/framework/source/fwe/classes/framelistanalyzer.cxx @@ -40,7 +40,7 @@ namespace framework{ FrameListAnalyzer::FrameListAnalyzer( const css::uno::Reference< css::frame::XFramesSupplier >& xSupplier , const css::uno::Reference< css::frame::XFrame >& xReferenceFrame , - sal_uInt32 eDetectMode ) + FrameAnalyzerFlags eDetectMode ) : m_xSupplier (xSupplier ) , m_xReferenceFrame(xReferenceFrame) , m_eDetectMode (eDetectMode ) @@ -97,7 +97,7 @@ void FrameListAnalyzer::impl_analyze() // to sort it into the list of frames with the same model. // Suppress this step, if right detect mode isn't set. css::uno::Reference< css::frame::XModel > xReferenceModel; - if ((m_eDetectMode & E_MODEL) == E_MODEL ) + if (m_eDetectMode & FrameAnalyzerFlags::Model) { css::uno::Reference< css::frame::XController > xReferenceController; if (m_xReferenceFrame.is()) @@ -109,17 +109,14 @@ void FrameListAnalyzer::impl_analyze() // check, if the reference frame is in hidden mode. // But look, if this analyze step is really needed. css::uno::Reference< css::beans::XPropertySet > xSet(m_xReferenceFrame, css::uno::UNO_QUERY); - if ( - ((m_eDetectMode & E_HIDDEN) == E_HIDDEN) && - (xSet.is() ) - ) + if ( (m_eDetectMode & FrameAnalyzerFlags::Hidden) && xSet.is() ) { xSet->getPropertyValue(FRAME_PROPNAME_ASCII_ISHIDDEN) >>= m_bReferenceIsHidden; } // check, if the reference frame includes the backing component. // But look, if this analyze step is really needed. - if (((m_eDetectMode & E_BACKINGCOMPONENT) == E_BACKINGCOMPONENT) && m_xReferenceFrame.is() ) + if ((m_eDetectMode & FrameAnalyzerFlags::BackingComponent) && m_xReferenceFrame.is() ) { try { @@ -140,7 +137,7 @@ void FrameListAnalyzer::impl_analyze() // check, if the reference frame includes the help module. // But look, if this analyze step is really needed. if ( - ((m_eDetectMode & E_HELP) == E_HELP ) && + (m_eDetectMode & FrameAnalyzerFlags::Help) && (m_xReferenceFrame.is() ) && (m_xReferenceFrame->getName() == SPECIALTARGET_HELPTASK) ) @@ -165,7 +162,7 @@ void FrameListAnalyzer::impl_analyze() continue; if ( - ((m_eDetectMode & E_ZOMBIE) == E_ZOMBIE) && + (m_eDetectMode & FrameAnalyzerFlags::Zombie) && ( (!xFrame->getContainerWindow().is()) || (!xFrame->getComponentWindow().is()) @@ -178,7 +175,7 @@ void FrameListAnalyzer::impl_analyze() // a) Is it the special help task? // Return it separated from any return list. if ( - ((m_eDetectMode & E_HELP) == E_HELP ) && + (m_eDetectMode & FrameAnalyzerFlags::Help) && (xFrame->getName()==SPECIALTARGET_HELPTASK) ) { @@ -190,7 +187,7 @@ void FrameListAnalyzer::impl_analyze() // Return it separated from any return list. // But check if the reference task itself is the backing frame. // Our user must know it to decide right. - if ((m_eDetectMode & E_BACKINGCOMPONENT) == E_BACKINGCOMPONENT) + if (m_eDetectMode & FrameAnalyzerFlags::BackingComponent) { try { @@ -210,7 +207,7 @@ void FrameListAnalyzer::impl_analyze() // c) Or is it the a task, which uses the specified model? // Add it to the list of "model frames". - if ((m_eDetectMode & E_MODEL) == E_MODEL) + if (m_eDetectMode & FrameAnalyzerFlags::Model) { css::uno::Reference< css::frame::XController > xController = xFrame->getController(); css::uno::Reference< css::frame::XModel > xModel; @@ -229,7 +226,7 @@ void FrameListAnalyzer::impl_analyze() // visible state ... if it's allowed to do so. bool bHidden = false; - if ((m_eDetectMode & E_HIDDEN) == E_HIDDEN ) + if (m_eDetectMode & FrameAnalyzerFlags::Hidden) { xSet.set(xFrame, css::uno::UNO_QUERY); if (xSet.is()) diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 4687489b07f4..c98fb8bcbba9 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -914,9 +914,9 @@ bool LoadEnv::impl_furtherDocsAllowed() FrameListAnalyzer aAnalyzer(xDesktop, css::uno::Reference< css::frame::XFrame >(), - FrameListAnalyzer::E_HELP | - FrameListAnalyzer::E_BACKINGCOMPONENT | - FrameListAnalyzer::E_HIDDEN); + FrameAnalyzerFlags::Help | + FrameAnalyzerFlags::BackingComponent | + FrameAnalyzerFlags::Hidden); sal_Int32 nOpenDocuments = aAnalyzer.m_lOtherVisibleFrames.size(); bAllowed = (nOpenDocuments < nMaxOpenDocuments); @@ -1352,7 +1352,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget() return css::uno::Reference< css::frame::XFrame >(); css::uno::Reference< css::frame::XFramesSupplier > xSupplier( css::frame::Desktop::create( m_xContext ), css::uno::UNO_QUERY); - FrameListAnalyzer aTasksAnalyzer(xSupplier, css::uno::Reference< css::frame::XFrame >(), FrameListAnalyzer::E_BACKINGCOMPONENT); + FrameListAnalyzer aTasksAnalyzer(xSupplier, css::uno::Reference< css::frame::XFrame >(), FrameAnalyzerFlags::BackingComponent); if (aTasksAnalyzer.m_xBackingComponent.is()) { if (!impl_isFrameAlreadyUsedForLoading(aTasksAnalyzer.m_xBackingComponent)) diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 3bdda7772091..f18f85055de6 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -3254,7 +3254,7 @@ void Frame::impl_checkMenuCloser() FrameListAnalyzer aAnalyzer( xTaskSupplier, this, - FrameListAnalyzer::E_HIDDEN | FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT); + FrameAnalyzerFlags::Hidden | FrameAnalyzerFlags::Help | FrameAnalyzerFlags::BackingComponent); // specify the new frame, which must have this special state ... css::uno::Reference< css::frame::XFrame2 > xNewCloserFrame; diff --git a/include/framework/framelistanalyzer.hxx b/include/framework/framelistanalyzer.hxx index fe4798eafa56..ce44de67207f 100644 --- a/include/framework/framelistanalyzer.hxx +++ b/include/framework/framelistanalyzer.hxx @@ -21,10 +21,30 @@ #define INCLUDED_FRAMEWORK_FRAMELISTANALYZER_HXX #include <com/sun/star/frame/XFrame.hpp> - #include <framework/fwedllapi.h> +#include <o3tl/typed_flags_set.hxx> + #include <vector> +/** These enums can be combined as flags to enable/disable + special search algorithm during analyze phase. + see impl_analyze() for further information. + But note: To be useable as flags, these enums + must be values of range [2^n]! */ +enum class FrameAnalyzerFlags +{ + Model = 1, + Help = 2, + BackingComponent = 4, + Hidden = 8, + All = 15, + Zombie = 32768 // use it for special test scenarios only!!! +}; +namespace o3tl { + template<> struct typed_flags<FrameAnalyzerFlags> : is_typed_flags<FrameAnalyzerFlags, 32768+15> {}; +} + + namespace framework{ /** analyze and split the current available frame list of a given frames supplier @@ -41,22 +61,6 @@ class FWE_DLLPUBLIC FrameListAnalyzer final public: - /** These enums can be combined as flags to enable/disable - special search algorithm during analyze phase. - see impl_analyze() for further information. - But note: To be useable as flags, these enums - must be values of range [2^n]! */ - enum EDetect - { - E_MODEL = 1, - E_HELP = 2, - E_BACKINGCOMPONENT = 4, - E_HIDDEN = 8, - E_ALL = 15, - E_ZOMBIE = 32768 // use it for special test scenarios only!!! - }; - - // member public: @@ -69,10 +73,10 @@ class FWE_DLLPUBLIC FrameListAnalyzer final /** enable/disable some special analyzing steps. see impl_analyze() for further information. */ - sal_uInt32 m_eDetectMode; + FrameAnalyzerFlags m_eDetectMode; /** contains all frames, which uses the same model like the reference frame. - Will be filled only if m_eDetectMode has set the flag E_MODEL. + Will be filled only if m_eDetectMode has set the flag FrameAnalyzerFlags::Model. The reference frame is never part of this list! */ std::vector< css::uno::Reference< css::frame::XFrame > > m_lModelFrames; @@ -140,17 +144,17 @@ class FWE_DLLPUBLIC FrameListAnalyzer final css::uno::Reference< css::frame::XFrame > m_xBackingComponent; /** is set to true only, if the reference frame is a hidden one. - This value is undefined if m_eDetectMode doesn't have set the flag E_HIDDEN! */ + This value is undefined if m_eDetectMode doesn't have set the flag FrameAnalyzerFlags::Hidden! */ bool m_bReferenceIsHidden; /** is set to true only, if the reference frame contains the help component. In this case the member m_xHelp is set to NULL every time. - This value is undefined if m_eDetectMode doesn't have set the flag E_HELP! */ + This value is undefined if m_eDetectMode doesn't have set the flag FrameAnalyzerFlags::Help! */ bool m_bReferenceIsHelp; /** is set to true only, if the reference frame contains the backing component. In this case the member m_xBackingComponent is set to NULL every time. - This value is undefined if m_eDetectMode doesn't have set the flag E_BACKINGCOMPONENT! */ + This value is undefined if m_eDetectMode doesn't have set the flag FrameAnalyzerFlags::BackingComponent! */ bool m_bReferenceIsBacking; @@ -176,7 +180,7 @@ class FWE_DLLPUBLIC FrameListAnalyzer final */ FrameListAnalyzer( const css::uno::Reference< css::frame::XFramesSupplier >& xSupplier , const css::uno::Reference< css::frame::XFrame >& xReferenceFrame , - sal_uInt32 eDetectMode ); + FrameAnalyzerFlags eDetectMode ); ~FrameListAnalyzer(); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index f61d6e9728a5..5b03bb779657 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1748,7 +1748,7 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell try { // if there is a backing component, use it - ::framework::FrameListAnalyzer aAnalyzer( xDesktop, Reference< XFrame >(), ::framework::FrameListAnalyzer::E_BACKINGCOMPONENT ); + ::framework::FrameListAnalyzer aAnalyzer( xDesktop, Reference< XFrame >(), FrameAnalyzerFlags::BackingComponent ); if ( aAnalyzer.m_xBackingComponent.is() ) xFrame = aAnalyzer.m_xBackingComponent; |