diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-05-29 09:58:42 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-05-29 11:02:45 +0100 |
commit | c24272c7972e0cbb51e7f104e356973ecb03c352 (patch) | |
tree | c8e3c0dd30daabae61adbdf9e70e70a1fc8b551c | |
parent | a65b6a4626d85880a4f39bda177473df91cf5369 (diff) |
the dubious SfxModelSubComponent and friends aren't used outside sfx2
so move out of the globals headers and drop their public visibility
markup
Change-Id: Ie0a852c962a9d05488022397e83152d1c73cfa29
-rw-r--r-- | include/sfx2/sfxbasemodel.hxx | 76 | ||||
-rw-r--r-- | sfx2/source/doc/docundomanager.cxx | 1 | ||||
-rw-r--r-- | sfx2/source/inc/docundomanager.hxx | 74 |
3 files changed, 73 insertions, 78 deletions
diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx index 9988183f0ad3..25c5a0901ea0 100644 --- a/include/sfx2/sfxbasemodel.hxx +++ b/include/sfx2/sfxbasemodel.hxx @@ -894,82 +894,6 @@ private: } ; // class SfxBaseModel -/** base class for sub components of an SfxBaseModel, which share their ref count and lifetime with the SfxBaseModel -*/ -class SFX2_DLLPUBLIC SfxModelSubComponent -{ -public: - /** checks whether the instance is alive, i.e. properly initialized, and not yet disposed - */ - void MethodEntryCheck() - { - m_rModel.MethodEntryCheck( true ); - } - - // called when the SfxBaseModel which the component is superordinate of is being disposed - virtual void disposing(); - -protected: - SfxModelSubComponent( SfxBaseModel& i_model ) - :m_rModel( i_model ) - { - } - virtual ~SfxModelSubComponent(); - - void acquireModel() { m_rModel.acquire(); } - void releaseModel() { m_rModel.release(); } - - bool isDisposed() const { return m_rModel.IsDisposed(); } - -protected: - const SfxBaseModel& getBaseModel() const { return m_rModel; } - SfxBaseModel& getBaseModel() { return m_rModel; } - - ::osl::Mutex& getMutex() { return m_rModel.getMutex(); } - -private: - SfxBaseModel& m_rModel; -}; - -class SFX2_DLLPUBLIC SfxModelGuard -{ -public: - enum AllowedModelState - { - // not yet initialized - E_INITIALIZING, - // fully alive, i.e. initialized, and not yet disposed - E_FULLY_ALIVE - }; - - SfxModelGuard( SfxBaseModel& i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE ) - : m_aGuard() - { - i_rModel.MethodEntryCheck( i_eState != E_INITIALIZING ); - } - SfxModelGuard( SfxModelSubComponent& i_rSubComponent ) - :m_aGuard() - { - i_rSubComponent.MethodEntryCheck(); - } - ~SfxModelGuard() - { - } - - void reset() - { - m_aGuard.reset(); - } - - void clear() - { - m_aGuard.clear(); - } - -private: - SolarMutexResettableGuard m_aGuard; -}; - #endif // INCLUDED_SFX2_SFXBASEMODEL_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/docundomanager.cxx b/sfx2/source/doc/docundomanager.cxx index ff876138dd45..b816e5139159 100644 --- a/sfx2/source/doc/docundomanager.cxx +++ b/sfx2/source/doc/docundomanager.cxx @@ -19,7 +19,6 @@ #include "docundomanager.hxx" -#include <cppuhelper/weak.hxx> #include <sfx2/sfxbasemodel.hxx> #include <sfx2/objsh.hxx> #include <sfx2/viewfrm.hxx> diff --git a/sfx2/source/inc/docundomanager.hxx b/sfx2/source/inc/docundomanager.hxx index 044d0fb7ca9d..f970bed57d71 100644 --- a/sfx2/source/inc/docundomanager.hxx +++ b/sfx2/source/inc/docundomanager.hxx @@ -29,12 +29,84 @@ #include <boost/scoped_ptr.hpp> #include <boost/noncopyable.hpp> +/** base class for sub components of an SfxBaseModel, which share their ref count and lifetime with the SfxBaseModel +*/ +class SfxModelSubComponent +{ +public: + /** checks whether the instance is alive, i.e. properly initialized, and not yet disposed + */ + void MethodEntryCheck() + { + m_rModel.MethodEntryCheck( true ); + } -namespace sfx2 + // called when the SfxBaseModel which the component is superordinate of is being disposed + virtual void disposing(); + +protected: + SfxModelSubComponent( SfxBaseModel& i_model ) + :m_rModel( i_model ) + { + } + virtual ~SfxModelSubComponent(); + + void acquireModel() { m_rModel.acquire(); } + void releaseModel() { m_rModel.release(); } + + bool isDisposed() const { return m_rModel.IsDisposed(); } + +protected: + const SfxBaseModel& getBaseModel() const { return m_rModel; } + SfxBaseModel& getBaseModel() { return m_rModel; } + + ::osl::Mutex& getMutex() { return m_rModel.getMutex(); } + +private: + SfxBaseModel& m_rModel; +}; + +class SfxModelGuard { +public: + enum AllowedModelState + { + // not yet initialized + E_INITIALIZING, + // fully alive, i.e. initialized, and not yet disposed + E_FULLY_ALIVE + }; + SfxModelGuard( SfxBaseModel& i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE ) + : m_aGuard() + { + i_rModel.MethodEntryCheck( i_eState != E_INITIALIZING ); + } + SfxModelGuard( SfxModelSubComponent& i_rSubComponent ) + :m_aGuard() + { + i_rSubComponent.MethodEntryCheck(); + } + ~SfxModelGuard() + { + } + void reset() + { + m_aGuard.reset(); + } + void clear() + { + m_aGuard.clear(); + } + +private: + SolarMutexResettableGuard m_aGuard; +}; + +namespace sfx2 +{ //= DocumentUndoManager typedef ::cppu::WeakImplHelper1 <css::document::XUndoManager> DocumentUndoManager_Base; |