diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/shell.cxx | 253 |
1 files changed, 64 insertions, 189 deletions
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index 27f5a7689875..cca95224795c 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -71,8 +71,6 @@ public: using namespace com::sun::star; -// SfxShell_Impl - struct SfxShell_Impl: public SfxBroadcaster { OUString aObjectName; // Name of Sbx-Objects @@ -107,9 +105,6 @@ struct SfxShell_Impl: public SfxBroadcaster }; -// SfxShell - - void SfxShell::EmptyExecStub(SfxShell *, SfxRequest &) { } @@ -118,15 +113,13 @@ void SfxShell::EmptyStateStub(SfxShell *, SfxItemSet &) { } -SfxShell::SfxShell() - /* [Description] The constructor of the SfxShell class initializes only simple types, the corresponding SbxObject is only created on-demand. Therefore, the application of a SfxShell instance is very cheap. */ - +SfxShell::SfxShell() : pImp(0), pPool(0), pUndoMgr(0) @@ -134,17 +127,13 @@ SfxShell::SfxShell() pImp = new SfxShell_Impl; } - - -SfxShell::SfxShell( SfxViewShell *pViewSh ) - /* [Description] The constructor of the SfxShell class initializes only simple types, the corresponding SbxObject is only created on-demand. Therefore, the application of a SfxShell instance is very cheap. */ - +SfxShell::SfxShell( SfxViewShell *pViewSh ) : pImp(0), pPool(0), pUndoMgr(0) @@ -153,55 +142,39 @@ SfxShell::SfxShell( SfxViewShell *pViewSh ) pImp->pViewSh = pViewSh; } - - -SfxShell::~SfxShell() - /* [Description] The connection to a possible corresponding SbxObject is dissolved. The SbxObject may continoue to exist, but can not any longer perform any functions and can not provide any properties. */ - +SfxShell::~SfxShell() { delete pImp; } - - -void SfxShell::SetName( const OUString &rName ) - /* [Description] Sets the name of the Shell object. With this name, the SfxShell instance of BASIC can be expressed. */ - +void SfxShell::SetName( const OUString &rName ) { pImp->aObjectName = rName; } - - -const OUString& SfxShell::GetName() const - /* [Description] Returns the name of the Shell object. With this name, the SfxShell instance of BASIC can be expressed. */ - +const OUString& SfxShell::GetName() const { return pImp->aObjectName; } - - -SfxDispatcher* SfxShell::GetDispatcher() const - /* [Description] This method returns a pointer to the <SfxDispatcher>, when the SfxShell @@ -210,30 +183,22 @@ SfxDispatcher* SfxShell::GetDispatcher() const The returned pointer is only valid in the immediate context of the method call. */ - +SfxDispatcher* SfxShell::GetDispatcher() const { return pImp->pFrame ? pImp->pFrame->GetDispatcher() : 0; } - - -SfxViewShell* SfxShell::GetViewShell() const - /* [Description] Returns the SfxViewShell in which they are located in the subshells. Otherwise, and if not specified by the App developer, this method returns NULL. */ - +SfxViewShell* SfxShell::GetViewShell() const { return pImp->pViewSh; } - - -SfxViewFrame* SfxShell::GetFrame() const - /* [Description] This method returns a pointer to the <SfxViewFrame> to which this SfxShell @@ -254,6 +219,7 @@ SfxViewFrame* SfxShell::GetFrame() const <SfxViewShell::GetViewFrame()const> */ +SfxViewFrame* SfxShell::GetFrame() const { if ( pImp->pFrame ) @@ -263,13 +229,6 @@ SfxViewFrame* SfxShell::GetFrame() const return 0; } - - -const SfxPoolItem* SfxShell::GetItem -( - sal_uInt16 nSlotId // Slot-Id of the querying <SfxPoolItem>s -) const - /* [Description] With this method any objects of <SfxPoolItemu> subclasses can be accessed. @@ -284,7 +243,10 @@ const SfxPoolItem* SfxShell::GetItem <SfxShell::PutItem(const SfxPoolItem&)> <SfxShell::RemoveItem(sal_uInt16)> */ - +const SfxPoolItem* SfxShell::GetItem +( + sal_uInt16 nSlotId // Slot-Id of the querying <SfxPoolItem>s +) const { SfxItemPtrMap::iterator it = pImp->aItems.find( nSlotId ); if( it != pImp->aItems.end() ) @@ -292,14 +254,6 @@ const SfxPoolItem* SfxShell::GetItem return 0; } - - -void SfxShell::PutItem -( - const SfxPoolItem& rItem /* Instance, of which a copy is created, - which is stored in the SfxShell in a list. */ -) - /* [Description] With this method, any objects of subclasses of <SfxPoolItem> can be made @@ -314,7 +268,11 @@ void SfxShell::PutItem <SfxShell::RemoveItem(sal_uInt16)> <SfxShell::GetItem(sal_uInt16)> */ - +void SfxShell::PutItem +( + const SfxPoolItem& rItem /* Instance, of which a copy is created, + which is stored in the SfxShell in a list. */ +) { DBG_ASSERT( !rItem.ISA(SfxSetItem), "SetItems aren't allowed here" ); DBG_ASSERT( SfxItemPool::IsSlot( rItem.Which() ), @@ -356,10 +314,6 @@ void SfxShell::PutItem } } - - -SfxInterface* SfxShell::GetInterface() const - /* [Description] With this virtual method, which is automatically overloaded by each subclass @@ -369,15 +323,11 @@ SfxInterface* SfxShell::GetInterface() const The class SfxShell itself has no own SfxInterface (no slots), therefore a NULL-pointer is returned. */ - +SfxInterface* SfxShell::GetInterface() const { return GetStaticInterface(); } - - -::svl::IUndoManager* SfxShell::GetUndoManager() - /* [Description] Each Subclass of SfxShell can hava a <SfxUndoManager>. This can be set in @@ -386,15 +336,11 @@ SfxInterface* SfxShell::GetInterface() const The class SfxShell itself does not have a SfxUndoManager, a NULL-pointer is therefore returned. */ - +::svl::IUndoManager* SfxShell::GetUndoManager() { return pUndoMgr; } - - -void SfxShell::SetUndoManager( ::svl::IUndoManager *pNewUndoMgr ) - /* [Description] Sets a <SfxUndoManager> for this <SfxShell> Instance. For the undo @@ -407,7 +353,7 @@ void SfxShell::SetUndoManager( ::svl::IUndoManager *pNewUndoMgr ) 'pNewUndoMgr' must exist until the Destuctor of SfxShell instance is called or until the next 'SetUndoManager()'. */ - +void SfxShell::SetUndoManager( ::svl::IUndoManager *pNewUndoMgr ) { OSL_ENSURE( ( pUndoMgr == NULL ) || ( pNewUndoMgr == NULL ) || ( pUndoMgr == pNewUndoMgr ), "SfxShell::SetUndoManager: exchanging one non-NULL manager with another non-NULL manager? Suspicious!" ); @@ -421,10 +367,6 @@ void SfxShell::SetUndoManager( ::svl::IUndoManager *pNewUndoMgr ) officecfg::Office::Common::Undo::Steps::get()); } - - -SfxRepeatTarget* SfxShell::GetRepeatTarget() const - /* [Description] Returns a pointer to the <SfxRepeatTarget> instance that is used in @@ -437,15 +379,11 @@ SfxRepeatTarget* SfxShell::GetRepeatTarget() const is not recommended, as compiler errors are provoked. (due to Call-to-Pointer-to-Member-Function to the subclass). */ - +SfxRepeatTarget* SfxShell::GetRepeatTarget() const { return pImp->pRepeatTarget; } - - -void SfxShell::SetRepeatTarget( SfxRepeatTarget *pTarget ) - /* [Description] Sets the <SfxRepeatTarget> instance that is used in SID_REPEAT as @@ -459,21 +397,11 @@ void SfxShell::SetRepeatTarget( SfxRepeatTarget *pTarget ) is not recommended, as compiler errors are provoked. (due to Call-to-Pointer-to-Member-Function to the subclass). */ - +void SfxShell::SetRepeatTarget( SfxRepeatTarget *pTarget ) { pImp->pRepeatTarget = pTarget; } - - -void SfxShell::Invalidate -( - sal_uInt16 nId /* Invalidated Slot-Id or Which-Id. - If these are 0 (default), then all - by this Shell currently handled Slot-Ids are - invalidated. */ -) - /* [Description] With this method can the slots of the subclasses be invalidated through the @@ -485,7 +413,13 @@ void SfxShell::Invalidate <SfxBindings::Invalidate(sal_uInt16)> <SfxBindings::InvalidateAll(sal_Bool)> */ - +void SfxShell::Invalidate +( + sal_uInt16 nId /* Invalidated Slot-Id or Which-Id. + If these are 0 (default), then all + by this Shell currently handled Slot-Ids are + invalidated. */ +) { if ( !GetViewShell() ) { @@ -534,10 +468,6 @@ void SfxShell::Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId ) } } - - -void SfxShell::DoActivate_Impl( SfxViewFrame *pFrame, bool bMDI ) - /* [Description] This method controls the activation of SfxShell instance. First, by calling @@ -548,7 +478,7 @@ void SfxShell::DoActivate_Impl( SfxViewFrame *pFrame, bool bMDI ) unqualified methods of the object (without the name of the object) from BASIC are found. */ - +void SfxShell::DoActivate_Impl( SfxViewFrame *pFrame, bool bMDI ) { #ifdef DBG_UTIL const SfxInterface *p_IF = GetInterface(); @@ -571,10 +501,6 @@ void SfxShell::DoActivate_Impl( SfxViewFrame *pFrame, bool bMDI ) Activate(bMDI); } - - -void SfxShell::DoDeactivate_Impl( SfxViewFrame *pFrame, bool bMDI ) - /* [Description] This method controls the deactivation of the SfxShell instance. When @@ -584,7 +510,7 @@ void SfxShell::DoDeactivate_Impl( SfxViewFrame *pFrame, bool bMDI ) Then the subclass gets the opportunity in every case to respond to the event by calling the virtual method <SfxShell::Deactivate(sal_Bool)>. */ - +void SfxShell::DoDeactivate_Impl( SfxViewFrame *pFrame, bool bMDI ) { #ifdef DBG_UTIL const SfxInterface *p_IF = GetInterface(); @@ -609,15 +535,21 @@ void SfxShell::DoDeactivate_Impl( SfxViewFrame *pFrame, bool bMDI ) Deactivate(bMDI); } - - bool SfxShell::IsActive() const { return pImp->bActive; } +/* [Description] + + Virtual method that is called when enabling the SfxShell instance, + in order to give the Subclasses the opportunity to respond to the + to the enabling. + [Cross-reference] + StarView SystemWindow::Activate(bool) +*/ void SfxShell::Activate ( bool /*bMDI*/ /* TRUE @@ -631,24 +563,19 @@ void SfxShell::Activate the SfxShell instance is located, was activated. (for example by a closing dialoge) */ ) +{ + BroadcastContextForActivation(true); +} /* [Description] - Virtual method that is called when enabling the SfxShell instance, - in order to give the Subclasses the opportunity to respond to the - to the enabling. + Virtual method that is called when disabling the SfxShell instance, + to give the Subclasses the opportunity to respond to the disabling. [Cross-reference] - StarView SystemWindow::Activate(bool) + StarView SystemWindow::Dectivate(bool) */ - -{ - BroadcastContextForActivation(true); -} - - - void SfxShell::Deactivate ( bool /*bMDI*/ /* TRUE @@ -661,28 +588,11 @@ void SfxShell::Deactivate the <SfxViewFrame>, on which SfxDispatcher the SfxShell instance is located, was deactivated. (for example by a dialoge) */ - ) - -/* [Description] - - Virtual method that is called when disabling the SfxShell instance, - to give the Subclasses the opportunity to respond to the disabling. - - [Cross-reference] - - StarView SystemWindow::Dectivate(bool) -*/ - { BroadcastContextForActivation(false); } - -void SfxShell::ParentActivate -( -) - /* [Description] A parent of the <SfxDispatcher> on which the SfxShell is located, has @@ -695,14 +605,11 @@ void SfxShell::ParentActivate SfxShell::Activate() */ -{ -} - - - -void SfxShell::ParentDeactivate +void SfxShell::ParentActivate ( ) +{ +} /* [Description] @@ -715,33 +622,29 @@ void SfxShell::ParentDeactivate SfxShell::Deactivate() */ +void SfxShell::ParentDeactivate +( +) { } - - -ResMgr* SfxShell::GetResMgr() const - /* [Description] This method provides the ResMgr of the <Resource-DLL> that are used by the SfxShell instance. If this is a NULL-pointer, then the current resource manager is to be used. */ - +ResMgr* SfxShell::GetResMgr() const { return GetInterface()->GetResMgr(); } - - -bool SfxShell::CanExecuteSlot_Impl( const SfxSlot &rSlot ) - /* [Description] This method determines by calling the status function whether 'rSlot' can be executed currently. */ +bool SfxShell::CanExecuteSlot_Impl( const SfxSlot &rSlot ) { // Get Slot status SfxItemPool &rPool = GetPool(); @@ -752,8 +655,6 @@ bool SfxShell::CanExecuteSlot_Impl( const SfxSlot &rSlot ) return aSet.GetItemState(nId) != SFX_ITEM_DISABLED; } - - long ShellCall_Impl( void* pObj, void* pArg ) { ((SfxShell* )pObj)->ExecuteSlot( *(SfxRequest*)pArg, (SfxInterface*)0L ); @@ -764,8 +665,6 @@ long ShellCall_Impl( void* pObj, void* pArg ) Asynchronous ExecuteSlot for the RELOAD */ - - const SfxPoolItem* SfxShell::ExecuteSlot( SfxRequest& rReq, bool bAsync ) { if( !bAsync ) @@ -780,12 +679,6 @@ const SfxPoolItem* SfxShell::ExecuteSlot( SfxRequest& rReq, bool bAsync ) } } -const SfxPoolItem* SfxShell::ExecuteSlot -( - SfxRequest &rReq, // the relayed <SfxRequest> - const SfxInterface* pIF // default = 0 means get virtually -) - /* [Description] This method allows you to forward a <SfxRequest> to the specified @@ -817,7 +710,11 @@ const SfxPoolItem* SfxShell::ExecuteSlot <SfxShell::GetSlotState(sal_uInt16,const SfxInterface*,SfxItemSet*)> */ - +const SfxPoolItem* SfxShell::ExecuteSlot +( + SfxRequest &rReq, // the relayed <SfxRequest> + const SfxInterface* pIF // default = 0 means get virtually +) { if ( !pIF ) pIF = GetInterface(); @@ -837,15 +734,6 @@ const SfxPoolItem* SfxShell::ExecuteSlot return rReq.GetReturnValue(); } - - -const SfxPoolItem* SfxShell::GetSlotState -( - sal_uInt16 nSlotId, // Slot-Id to the Slots in question - const SfxInterface* pIF, // default = 0 means get virtually - SfxItemSet* pStateSet // SfxItemSet of the Slot-State method -) - /* [Description] This method returns the status of the slot with the specified slot ID @@ -881,7 +769,12 @@ const SfxPoolItem* SfxShell::GetSlotState <SfxShell::ExecuteSlot(SfxRequest&)> */ - +const SfxPoolItem* SfxShell::GetSlotState +( + sal_uInt16 nSlotId, // Slot-Id to the Slots in question + const SfxInterface* pIF, // default = 0 means get virtually + SfxItemSet* pStateSet // SfxItemSet of the Slot-State method +) { // Get Slot on the given Interface if ( !pIF ) @@ -946,8 +839,6 @@ const SfxPoolItem* SfxShell::GetSlotState return pRetItem; } - - SFX_EXEC_STUB(SfxShell, VerbExec) SFX_STATE_STUB(SfxShell, VerbState) @@ -1022,15 +913,11 @@ void SfxShell::SetVerbs(const com::sun::star::uno::Sequence < com::sun::star::em } } - - const com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor >& SfxShell::GetVerbs() const { return pImp->aVerbList; } - - void SfxShell::VerbExec(SfxRequest& rReq) { sal_uInt16 nId = rReq.GetSlot(); @@ -1059,14 +946,10 @@ void SfxShell::VerbExec(SfxRequest& rReq) } } - - void SfxShell::VerbState(SfxItemSet& ) { } - - const SfxSlot* SfxShell::GetVerbSlot_Impl(sal_uInt16 nId) const { com::sun::star::uno::Sequence < com::sun::star::embed::VerbDescriptor > rList = pImp->aVerbList; @@ -1081,22 +964,16 @@ const SfxSlot* SfxShell::GetVerbSlot_Impl(sal_uInt16 nId) const return 0; } - - void SfxShell::SetHelpId(sal_uIntPtr nId) { pImp->nHelpId = nId; } - - sal_uIntPtr SfxShell::GetHelpId() const { return pImp->nHelpId; } - - SfxObjectShell* SfxShell::GetObjectShell() { if ( GetViewShell() ) @@ -1105,8 +982,6 @@ SfxObjectShell* SfxShell::GetObjectShell() return NULL; } - - bool SfxShell::HasUIFeature( sal_uInt32 ) { return false; |