include/sfx2/viewsh.hxx | 11 +------ sfx2/source/view/viewimp.hxx | 6 +++ sfx2/source/view/viewsh.cxx | 66 +++++++++++++++++++++++++++++-------------- 3 files changed, 53 insertions(+), 30 deletions(-)
New commits: commit aafcbb3e1e70642983152f79843b2f0cd15eb79c Author: Kohei Yoshida <[email protected]> Date: Sat Dec 6 13:50:20 2014 -0500 Move SfxInPlaceClientList to SfxViewShell_Impl. Change-Id: I38c8dfa8198037268dabc0039f44e75e150b380b diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 77353f6..2894122b 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -58,6 +58,7 @@ class SfxFrameItem; class Dialog; class Menu; class NotifyEvent; +class SfxInPlaceClient; #define SFX_PRINTER_PRINTER 1 // without JOB SETUP => Temporary #define SFX_PRINTER_JOBSETUP 2 @@ -120,9 +121,6 @@ public: \ #define SFX_VIEW_REGISTRATION(DocClass) \ DocClass::Factory().RegisterViewFactory( *Factory() ) -class SfxInPlaceClient; -class SfxInPlaceClientList; - class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener { #ifdef INCLUDED_SFX2_VIEWSH_HXX @@ -132,7 +130,6 @@ friend class SfxPrinterController; #endif struct SfxViewShell_Impl* pImp; - SfxInPlaceClientList* pIPClientList; SfxViewFrame* pFrame; SfxShell* pSubShell; vcl::Window* pWindow; @@ -167,8 +164,6 @@ private: /// SfxInterface initializer. static void InitInterface_Impl(); - SAL_DLLPRIVATE SfxInPlaceClientList* GetIPClientList_Impl( bool bCreate = true ) const; - public: SfxViewShell( SfxViewFrame *pFrame, sal_uInt16 nFlags = 0 ); diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 7ce2473..c07fbc6 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -38,6 +38,7 @@ typedef SfxShell* SfxShellPtr_Impl; typedef std::vector<SfxShellPtr_Impl> SfxShellArr_Impl; class SfxClipboardChangeListener; +class SfxInPlaceClientList; struct SfxViewShell_Impl { @@ -62,7 +63,12 @@ struct SfxViewShell_Impl ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener; ::boost::shared_ptr< vcl::PrinterController > m_pPrinterController; + mutable SfxInPlaceClientList* mpIPClientList; + SfxViewShell_Impl(sal_uInt16 const nFlags); + ~SfxViewShell_Impl(); + + SfxInPlaceClientList* GetIPClientList_Impl( bool bCreate = true ) const; }; #endif diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 1cd95a9..deed34f 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -310,8 +310,21 @@ SfxViewShell_Impl::SfxViewShell_Impl(sal_uInt16 const nFlags) , m_bGotFrameOwnership(false) , m_nFamily(0xFFFF) // undefined, default set by TemplateDialog , m_pController(0) +, mpIPClientList(NULL) {} +SfxViewShell_Impl::~SfxViewShell_Impl() +{ + DELETEZ(mpIPClientList); +} + +SfxInPlaceClientList* SfxViewShell_Impl::GetIPClientList_Impl( bool bCreate ) const +{ + if (!mpIPClientList && bCreate) + mpIPClientList = new SfxInPlaceClientList; + return mpIPClientList; +} + SFX_IMPL_SUPERCLASS_INTERFACE(SfxViewShell,SfxShell) void SfxViewShell::InitInterface_Impl() @@ -431,12 +444,12 @@ OUString impl_searchFormatTypeForApp(const css::uno::Reference< css::frame::XFra void SfxViewShell::NewIPClient_Impl( SfxInPlaceClient *pIPClient ) { - GetIPClientList_Impl(true)->push_back(pIPClient); + pImp->GetIPClientList_Impl(true)->push_back(pIPClient); } void SfxViewShell::IPClientGone_Impl( SfxInPlaceClient *pIPClient ) { - SfxInPlaceClientList* pClientList = GetIPClientList_Impl(true); + SfxInPlaceClientList* pClientList = pImp->GetIPClientList_Impl(true); for( SfxInPlaceClientList::iterator it = pClientList->begin(); it != pClientList->end(); ++it ) { @@ -775,7 +788,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) VisAreaChanged(aVisArea); // the plugins might need change in their state - SfxInPlaceClientList *pClients = pView->GetIPClientList_Impl(false); + SfxInPlaceClientList *pClients = pView->pImp->GetIPClientList_Impl(false); if ( pClients ) { for ( size_t n = 0; n < pClients->size(); n++) @@ -955,7 +968,7 @@ SfxInPlaceClient* SfxViewShell::FindIPClient vcl::Window* pObjParentWin ) const { - SfxInPlaceClientList *pClients = GetIPClientList_Impl(false); + SfxInPlaceClientList *pClients = pImp->GetIPClientList_Impl(false); if ( !pClients ) return 0; @@ -983,7 +996,7 @@ SfxInPlaceClient* SfxViewShell::GetIPClient() const SfxInPlaceClient* SfxViewShell::GetUIActiveIPClient_Impl() const { // this method is needed as long as SFX still manages the border space for ChildWindows (see SfxFrame::Resize) - SfxInPlaceClientList *pClients = GetIPClientList_Impl(false); + SfxInPlaceClientList *pClients = pImp->GetIPClientList_Impl(false); if ( !pClients ) return 0; @@ -999,7 +1012,7 @@ SfxInPlaceClient* SfxViewShell::GetUIActiveIPClient_Impl() const SfxInPlaceClient* SfxViewShell::GetUIActiveClient() const { - SfxInPlaceClientList *pClients = GetIPClientList_Impl(false); + SfxInPlaceClientList *pClients = pImp->GetIPClientList_Impl(false); if ( !pClients ) return 0; @@ -1256,7 +1269,6 @@ SfxViewShell::SfxViewShell : SfxShell(this) , pImp( new SfxViewShell_Impl(nFlags) ) -, pIPClientList( 0 ) , pFrame(pViewFrame) , pSubShell(0) , pWindow(0) @@ -1302,7 +1314,6 @@ SfxViewShell::~SfxViewShell() } DELETEZ( pImp ); - DELETEZ( pIPClientList ); } void SfxViewShell::Initialize() @@ -1714,7 +1725,7 @@ void SfxViewShell::GotFocus() const void SfxViewShell::ResetAllClients_Impl( SfxInPlaceClient *pIP ) { - SfxInPlaceClientList *pClients = GetIPClientList_Impl(false); + SfxInPlaceClientList *pClients = pImp->GetIPClientList_Impl(false); if ( !pClients ) return; @@ -1730,7 +1741,7 @@ void SfxViewShell::ResetAllClients_Impl( SfxInPlaceClient *pIP ) void SfxViewShell::DisconnectAllClients() { - SfxInPlaceClientList *pClients = GetIPClientList_Impl(false); + SfxInPlaceClientList *pClients = pImp->GetIPClientList_Impl(false); if ( !pClients ) return; @@ -1749,7 +1760,7 @@ void SfxViewShell::QueryObjAreaPixel( Rectangle& ) const void SfxViewShell::VisAreaChanged(const Rectangle& /*rVisArea*/) { - SfxInPlaceClientList *pClients = GetIPClientList_Impl(false); + SfxInPlaceClientList *pClients = pImp->GetIPClientList_Impl(false); if ( !pClients ) return; @@ -1811,7 +1822,7 @@ void SfxViewShell::DiscardClients_Impl() */ { - SfxInPlaceClientList *pClients = GetIPClientList_Impl(false); + SfxInPlaceClientList *pClients = pImp->GetIPClientList_Impl(false); if ( !pClients ) return; @@ -1904,15 +1915,6 @@ void SfxViewShell::JumpToMark( const OUString& rMark ) &aMarkItem, 0L ); } - - -SfxInPlaceClientList* SfxViewShell::GetIPClientList_Impl( bool bCreate ) const -{ - if ( !pIPClientList && bCreate ) - ( (SfxViewShell*) this )->pIPClientList = new SfxInPlaceClientList; - return pIPClientList; -} - void SfxViewShell::SetController( SfxBaseController* pController ) { pImp->m_pController = pController; commit 5ae4cc92bd6660ccf36ff6cc45f96fa267514f1b Author: Kohei Yoshida <[email protected]> Date: Sat Dec 6 13:32:29 2014 -0500 Forward-declare SfxInPlaceClientList and remove <vector> include. Change-Id: I4e611820a4dae4341f971a545578048b52d7e37c diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 20114cfa..77353f6 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -35,7 +35,6 @@ #include <tools/gen.hxx> #include <tools/errcode.hxx> #include <vcl/jobset.hxx> -#include <vector> class SfxBaseController; class Size; @@ -122,8 +121,7 @@ public: \ DocClass::Factory().RegisterViewFactory( *Factory() ) class SfxInPlaceClient; -typedef ::std::vector< SfxInPlaceClient* > SfxInPlaceClientList; - +class SfxInPlaceClientList; class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener { @@ -169,6 +167,8 @@ private: /// SfxInterface initializer. static void InitInterface_Impl(); + SAL_DLLPRIVATE SfxInPlaceClientList* GetIPClientList_Impl( bool bCreate = true ) const; + public: SfxViewShell( SfxViewFrame *pFrame, sal_uInt16 nFlags = 0 ); @@ -284,10 +284,8 @@ public: SAL_DLLPRIVATE void RemoveContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor ); SAL_DLLPRIVATE bool GlobalKeyInput_Impl( const KeyEvent &rKeyEvent ); - SAL_DLLPRIVATE void NewIPClient_Impl( SfxInPlaceClient *pIPClient ) - { GetIPClientList_Impl(true)->push_back(pIPClient); } + SAL_DLLPRIVATE void NewIPClient_Impl( SfxInPlaceClient *pIPClient ); SAL_DLLPRIVATE void IPClientGone_Impl( SfxInPlaceClient *pIPClient ); - SAL_DLLPRIVATE SfxInPlaceClientList* GetIPClientList_Impl( bool bCreate = true ) const; SAL_DLLPRIVATE void ResetAllClients_Impl( SfxInPlaceClient *pIP ); SAL_DLLPRIVATE void DiscardClients_Impl(); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index be8f9fa..1cd95a9 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -82,6 +82,8 @@ #include "openuriexternally.hxx" #include <shellimpl.hxx> +#include <vector> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; @@ -277,6 +279,23 @@ static OUString RetrieveLabelFromCommand( return aLabel; } +class SfxInPlaceClientList +{ + typedef std::vector<SfxInPlaceClient*> DataType; + DataType maData; + +public: + typedef DataType::iterator iterator; + + SfxInPlaceClient* at( size_t i ) { return maData.at(i); } + + iterator begin() { return maData.begin(); } + iterator end() { return maData.end(); } + + void push_back( SfxInPlaceClient* p ) { maData.push_back(p); } + void erase( iterator it ) { maData.erase(it); } + size_t size() const { return maData.size(); } +}; SfxViewShell_Impl::SfxViewShell_Impl(sal_uInt16 const nFlags) : aInterceptorContainer( aMutex ) @@ -410,7 +429,10 @@ OUString impl_searchFormatTypeForApp(const css::uno::Reference< css::frame::XFra return OUString(); } - +void SfxViewShell::NewIPClient_Impl( SfxInPlaceClient *pIPClient ) +{ + GetIPClientList_Impl(true)->push_back(pIPClient); +} void SfxViewShell::IPClientGone_Impl( SfxInPlaceClient *pIPClient ) { _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
