diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2011-01-18 18:14:05 +0100 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2011-01-18 18:14:05 +0100 |
commit | e5b085ce3e35347a22d58e41ec99b5d5cea9f854 (patch) | |
tree | 3836326286308faff9f35bea67bf49375fdcd67e | |
parent | f2f73a0b2aad85b4e3bc0d322641257dec3e77ce (diff) | |
parent | fdf0c3f3c73229588d52893c5c77faea0228a5fb (diff) |
CWS-TOOLING: integrate CWS fwk162
-rw-r--r-- | embeddedobj/source/commonembedding/embedobj.cxx | 21 | ||||
-rw-r--r-- | embeddedobj/source/commonembedding/miscobj.cxx | 14 | ||||
-rw-r--r-- | sfx2/inc/frmload.hxx | 2 | ||||
-rw-r--r-- | sfx2/inc/sfx2/docfile.hxx | 1 | ||||
-rw-r--r-- | sfx2/inc/sfx2/objsh.hxx | 11 | ||||
-rw-r--r-- | sfx2/inc/sfx2/sfxbasecontroller.hxx | 3 | ||||
-rw-r--r-- | sfx2/inc/sfx2/sfxbasemodel.hxx | 31 | ||||
-rw-r--r-- | sfx2/source/appl/app.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/doctempl.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/doc/docvor.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/doc/objcont.cxx | 50 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 25 | ||||
-rwxr-xr-x | sfx2/source/doc/printhelper.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/view/frmload.cxx | 40 | ||||
-rw-r--r-- | sfx2/source/view/sfxbasecontroller.cxx | 10 | ||||
-rw-r--r-- | svx/source/form/fmscriptingenv.cxx | 1 | ||||
-rw-r--r-- | svx/source/form/fmundo.cxx | 3 |
17 files changed, 78 insertions, 166 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index 3d360245f1ea..2a56a0acb52a 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -165,7 +165,7 @@ void OCommonEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState ) { // TODO: may be needs interaction handler to detect wherether the object state - // can be changed even after errors + // can be changed even after errors if ( m_nObjectState == embed::EmbedStates::LOADED ) { @@ -485,14 +485,19 @@ void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState ) { if ( nOldState != m_nObjectState ) // notify listeners that the object has changed the state - StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState ,aGuard); + StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState, aGuard ); throw; } } // notify listeners that the object has changed the state - StateChangeNotification_Impl( sal_False, nOldState, nNewState,aGuard ); + StateChangeNotification_Impl( sal_False, nOldState, nNewState, aGuard ); + + // let the object window be shown + if ( nNewState == embed::EmbedStates::UI_ACTIVE || nNewState == embed::EmbedStates::INPLACE_ACTIVE ) + PostEvent_Impl( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" ) ), + uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); } } @@ -501,7 +506,6 @@ uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getReachableStates() throw ( embed::WrongStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -517,7 +521,6 @@ sal_Int32 SAL_CALL OCommonEmbeddedObject::getCurrentState() throw ( embed::WrongStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -538,7 +541,7 @@ void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID ) { RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::doVerb" ); - ::osl::MutexGuard aGuard( m_aMutex ); + ::osl::ResettableMutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -561,7 +564,10 @@ void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID ) // TODO/LATER: check if the verb is a supported one and if it is produce related operation } else + { + aGuard.clear(); changeState( nNewState ); + } } //---------------------------------------------- @@ -569,7 +575,6 @@ uno::Sequence< embed::VerbDescriptor > SAL_CALL OCommonEmbeddedObject::getSuppor throw ( embed::WrongStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -606,7 +611,6 @@ uno::Reference< embed::XEmbeddedClient > SAL_CALL OCommonEmbeddedObject::getClie throw ( embed::WrongStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -659,7 +663,6 @@ sal_Int64 SAL_CALL OCommonEmbeddedObject::getStatus( sal_Int64 ) throw ( embed::WrongStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index e0ff1266921a..f4c0c90162ed 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -342,7 +342,7 @@ void OCommonEmbeddedObject::PostEvent_Impl( const ::rtl::OUString& aEventName, aEvent.Source = uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ); // For now all the events are sent as object events // aEvent.Source = ( xSource.is() ? xSource - // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) ); + // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) ); ::cppu::OInterfaceIteratorHelper aIt( *pIC ); while( aIt.hasMoreElements() ) { @@ -476,9 +476,8 @@ uno::Sequence< sal_Int8 > SAL_CALL OCommonEmbeddedObject::getImplementationId() uno::Sequence< sal_Int8 > SAL_CALL OCommonEmbeddedObject::getClassID() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); // TODO + throw lang::DisposedException(); return m_aClassID; } @@ -487,9 +486,8 @@ uno::Sequence< sal_Int8 > SAL_CALL OCommonEmbeddedObject::getClassID() ::rtl::OUString SAL_CALL OCommonEmbeddedObject::getClassName() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); // TODO + throw lang::DisposedException(); return m_aClassName; } @@ -521,9 +519,9 @@ uno::Reference< util::XCloseable > SAL_CALL OCommonEmbeddedObject::getComponent( } // if ( m_bWaitSaveCompleted ) - // throw embed::WrongStateException( - // ::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ), - // uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); + // throw embed::WrongStateException( + // ::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ), + // uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); return uno::Reference< util::XCloseable >( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); } diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index b03bdd724c20..74c5a1ff35d1 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -113,7 +113,7 @@ private: const ::rtl::OUString& i_rFactoryURL ) const; - SfxObjectShellLock impl_findObjectShell( + SfxObjectShellRef impl_findObjectShell( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel2 >& i_rxDocument ) const; diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index 35656202650f..f2253a8f2b67 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -75,7 +75,6 @@ class SvStringsDtor; #define OWEAKOBJECT ::cppu::OWeakObject #define REFERENCE ::com::sun::star::uno::Reference #define XINTERFACE ::com::sun::star::uno::XInterface -#define SEQUENCE ::com::sun::star::uno::Sequence #define EXCEPTION ::com::sun::star::uno::Exception #define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException #define ANY ::com::sun::star::uno::Any diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 9473ac126bd7..3e696369c7a3 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -158,11 +158,6 @@ typedef sal_uInt32 SfxObjectShellFlags; //-------------------------------------------------------------------- -#define SEQUENCE ::com::sun::star::uno::Sequence -#define OUSTRING ::rtl::OUString - -//-------------------------------------------------------------------- - #define HIDDENINFORMATION_RECORDEDCHANGES 0x0001 #define HIDDENINFORMATION_NOTES 0x0002 #define HIDDENINFORMATION_DOCUMENTVERSIONS 0x0004 @@ -209,6 +204,7 @@ class SFX2_DLLPUBLIC SfxObjectShell : public ::comphelper::IEmbeddedHelper, public ::sfx2::IXmlIdRegistrySupplier { friend struct ModifyBlocker_Impl; +friend class SfxObjectShellLock; private: struct SfxObjectShell_Impl* pImp; // interne Daten @@ -617,7 +613,7 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel() const; // Nur uebergangsweise fuer die Applikationen !!! - virtual SEQUENCE< OUSTRING > GetEventNames(); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > GetEventNames(); Window* GetDialogParent( SfxMedium* pMedium=0 ); String UpdateTitle( SfxMedium* pMed=NULL, USHORT nDocViewNo=0 ); @@ -831,7 +827,6 @@ public: //#endif //-------------------------------------------------------------------- - #ifndef SFX_DECL_OBJECTSHELL_DEFINED #define SFX_DECL_OBJECTSHELL_DEFINED SV_DECL_REF(SfxObjectShell) @@ -840,8 +835,6 @@ SV_DECL_LOCK(SfxObjectShell) SV_IMPL_LOCK(SfxObjectShell) SV_IMPL_REF(SfxObjectShell) -SfxObjectShellRef MakeObjectShellForOrganizer_Impl( const String& rName, BOOL bWriting ); - //#if 0 // _SOLAR__PRIVATE //-------------------------------------------------------------------- class AutoReloadTimer_Impl : public Timer diff --git a/sfx2/inc/sfx2/sfxbasecontroller.hxx b/sfx2/inc/sfx2/sfxbasecontroller.hxx index ca30d243bbac..de01f1965d74 100644 --- a/sfx2/inc/sfx2/sfxbasecontroller.hxx +++ b/sfx2/inc/sfx2/sfxbasecontroller.hxx @@ -66,7 +66,6 @@ // Some defines to write better code :-) #define REFERENCE ::com::sun::star::uno::Reference #define ANY ::com::sun::star::uno::Any -#define SEQUENCE ::com::sun::star::uno::Sequence #define XDISPATCH ::com::sun::star::frame::XDispatch #define DISPATCHDESCRIPTOR ::com::sun::star::frame::DispatchDescriptor #define XMODEL ::com::sun::star::frame::XModel @@ -304,7 +303,7 @@ public: @onerror - */ - virtual SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescriptor ) throw( RUNTIMEEXCEPTION ) ; + virtual ::com::sun::star::uno::Sequence< REFERENCE< XDISPATCH > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< DISPATCHDESCRIPTOR >& seqDescriptor ) throw( RUNTIMEEXCEPTION ) ; //____________________________________________________________________________________________________ // XControllerBorder diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index 26122419e661..d0978ebc1e5f 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -161,7 +161,6 @@ #define EVENTOBJECT ::com::sun::star::lang::EventObject #define PROPERTYVALUE ::com::sun::star::beans::PropertyValue #define REFERENCE ::com::sun::star::uno::Reference -#define SEQUENCE ::com::sun::star::uno::Sequence #define MUTEX ::osl::Mutex #define OUSTRING ::rtl::OUString #define UNOTYPE ::com::sun::star::uno::Type @@ -385,7 +384,7 @@ public: @onerror A RuntimeException is thrown. */ - virtual SEQUENCE< UNOTYPE > SAL_CALL getTypes() throw( RUNTIMEEXCEPTION ) ; + virtual ::com::sun::star::uno::Sequence< UNOTYPE > SAL_CALL getTypes() throw( RUNTIMEEXCEPTION ) ; /**___________________________________________________________________________________________________ @short get implementation id @@ -401,7 +400,7 @@ public: @onerror A RuntimeException is thrown. */ - virtual SEQUENCE< sal_Int8 > SAL_CALL getImplementationId() throw( RUNTIMEEXCEPTION ) ; + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( RUNTIMEEXCEPTION ) ; //____________________________________________________________________________________________________ @@ -580,7 +579,7 @@ public: */ virtual sal_Bool SAL_CALL attachResource( const OUSTRING& sURL , - const SEQUENCE< PROPERTYVALUE >& aArgs ) + const ::com::sun::star::uno::Sequence< PROPERTYVALUE >& aArgs ) throw (::com::sun::star::uno::RuntimeException); /**___________________________________________________________________________________________________ @@ -611,7 +610,7 @@ public: @onerror - */ - virtual SEQUENCE< PROPERTYVALUE > SAL_CALL getArgs() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< PROPERTYVALUE > SAL_CALL getArgs() throw (::com::sun::star::uno::RuntimeException); /**___________________________________________________________________________________________________ @short - @@ -861,7 +860,7 @@ public: @onerror - */ - virtual SEQUENCE< PROPERTYVALUE > SAL_CALL getPrinter() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< PROPERTYVALUE > SAL_CALL getPrinter() throw (::com::sun::star::uno::RuntimeException); /**___________________________________________________________________________________________________ @short - @@ -876,7 +875,7 @@ public: @onerror - */ - virtual void SAL_CALL setPrinter( const SEQUENCE< PROPERTYVALUE >& seqPrinter ) + virtual void SAL_CALL setPrinter( const ::com::sun::star::uno::Sequence< PROPERTYVALUE >& seqPrinter ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); /**___________________________________________________________________________________________________ @short - @@ -891,14 +890,14 @@ public: @onerror - */ - virtual void SAL_CALL print( const SEQUENCE< PROPERTYVALUE >& seqOptions ) + virtual void SAL_CALL print( const ::com::sun::star::uno::Sequence< PROPERTYVALUE >& seqOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); //____________________________________________________________________________________________________ // XStorable2 //____________________________________________________________________________________________________ - virtual void SAL_CALL storeSelf( const SEQUENCE< PROPERTYVALUE >& seqArguments ) + virtual void SAL_CALL storeSelf( const ::com::sun::star::uno::Sequence< PROPERTYVALUE >& seqArguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); //____________________________________________________________________________________________________ @@ -979,7 +978,7 @@ public: */ virtual void SAL_CALL storeAsURL( const OUSTRING& sURL , - const SEQUENCE< PROPERTYVALUE >& seqArguments ) + const ::com::sun::star::uno::Sequence< PROPERTYVALUE >& seqArguments ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) ; /**___________________________________________________________________________________________________ @@ -996,7 +995,7 @@ public: */ virtual void SAL_CALL storeToURL( const OUSTRING& sURL , - const SEQUENCE< PROPERTYVALUE >& seqArguments ) + const ::com::sun::star::uno::Sequence< PROPERTYVALUE >& seqArguments ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); @@ -1037,7 +1036,7 @@ public: @onerror - */ - virtual void SAL_CALL load( const SEQUENCE< PROPERTYVALUE >& seqArguments ) + virtual void SAL_CALL load( const ::com::sun::star::uno::Sequence< PROPERTYVALUE >& seqArguments ) throw (::com::sun::star::frame::DoubleInitializationException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException, @@ -1058,7 +1057,7 @@ public: //____________________________________________________________________________________________________ virtual void SAL_CALL loadFromStorage( const REFERENCE< XSTORAGE >& xStorage, - const SEQUENCE< PROPERTYVALUE >& aMediaDescriptor ) + const ::com::sun::star::uno::Sequence< PROPERTYVALUE >& aMediaDescriptor ) throw ( ILLEGALARGUMENTEXCEPTION, DOUBLEINITIALIZATIONEXCEPTION, IOEXCEPTION, @@ -1066,7 +1065,7 @@ public: RUNTIMEEXCEPTION ); virtual void SAL_CALL storeToStorage( const REFERENCE< XSTORAGE >& xStorage, - const SEQUENCE< PROPERTYVALUE >& aMediaDescriptor ) + const ::com::sun::star::uno::Sequence< PROPERTYVALUE >& aMediaDescriptor ) throw ( ILLEGALARGUMENTEXCEPTION, IOEXCEPTION, EXCEPTION, @@ -1164,7 +1163,7 @@ public: */ - virtual SEQUENCE< DATAFLAVOR > SAL_CALL getTransferDataFlavors() + virtual ::com::sun::star::uno::Sequence< DATAFLAVOR > SAL_CALL getTransferDataFlavors() throw (::com::sun::star::uno::RuntimeException); /**___________________________________________________________________________________________________ @@ -1544,7 +1543,7 @@ private: SAL_DLLPRIVATE ::rtl::OUString GetMediumFilterName_Impl(); SAL_DLLPRIVATE void impl_store( const OUSTRING& sURL , - const SEQUENCE< PROPERTYVALUE >& seqArguments , + const ::com::sun::star::uno::Sequence< PROPERTYVALUE >& seqArguments , sal_Bool bSaveTo ) ; SAL_DLLPRIVATE void postEvent_Impl( const ::rtl::OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 >& xController = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 >() ); diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 727d9f17c493..eb9307ad7538 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -375,6 +375,8 @@ SfxApplication::SfxApplication() SfxApplication::~SfxApplication() { + OSL_ENSURE( GetObjectShells_Impl().Count() == 0, "Memory leak: some object shells were not removed!" ); + Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); SfxModule::DestroyModules_Impl(); diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index f5ea04e5e08d..f962542aac10 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -137,7 +137,11 @@ namespace DocTempl { class DocTempl_EntryData_Impl { RegionData_Impl* mpParent; + + // the following member must be SfxObjectShellLock since it controlls that SfxObjectShell lifetime by design + // and users of this class expect it to be so. SfxObjectShellLock mxObjShell; + OUString maTitle; OUString maOwnURL; OUString maTargetURL; diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx index 6367f2a65d76..c017a5779cdd 100644 --- a/sfx2/source/doc/docvor.cxx +++ b/sfx2/source/doc/docvor.cxx @@ -546,6 +546,9 @@ BOOL SfxOrganizeListBox_Impl::Select( SvLBoxEntry* pEntry, BOOL bSelect ) return SvTreeListBox::Select(pEntry,bSelect); Path aPath(this, pEntry); + + // it is ok to use the SfxObjectShellRef here since the object that + // provides it ( GetObjectShell() calls CreateObjectShell() ) has a lock on it GetObjectShell(aPath)->TriggerHelpPI( aPath[nLevel+1], aPath[nLevel+2], aPath[nLevel+3]); return SvTreeListBox::Select(pEntry,bSelect); @@ -691,10 +694,12 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox, BOOL bRemovedFromSource = FALSE; Path aSource(pSourceBox, pSource); Path aTarget(this, pTarget); - SfxObjectShellRef aSourceDoc = - ((SfxOrganizeListBox_Impl *)pSourceBox)->GetObjectShell(aSource); + // it is ok to use the SfxObjectShellRef here since the object that + // provides it ( GetObjectShell() calls CreateObjectShell() ) has a lock on it + SfxObjectShellRef aSourceDoc = ((SfxOrganizeListBox_Impl *)pSourceBox)->GetObjectShell(aSource); SfxObjectShellRef aTargetDoc = GetObjectShell(aTarget); + const USHORT nSLevel = ((SfxOrganizeListBox_Impl *)pSourceBox)->GetDocLevel(); const USHORT nTLevel = GetDocLevel(); @@ -1210,6 +1215,9 @@ void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry ) { const USHORT nDocLevel = GetDocLevel(); Path aPath(this, pEntry); + + // it is ok to use the SfxObjectShellRef here since the object that + // provides it ( GetObjectShell() calls CreateObjectShell() ) has a lock on it SfxObjectShellRef aRef = GetObjectShell(aPath); if(aRef.Is()) { @@ -1887,6 +1895,9 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu ) if(!QueryDelete_Impl(pDialog, STR_DELETE_TEMPLATE, pFocusBox->GetEntryText(pEntry))) return 1; Path aPath(pFocusBox, pEntry); + + // it is ok to use the SfxObjectShellRef here since the object that + // provides it ( GetObjectShell() calls CreateObjectShell() ) has a lock on it SfxObjectShellRef aRef = pFocusBox->GetObjectShell(aPath); if(aRef.Is() && aRef->Remove(aPath[1+pFocusBox->GetDocLevel()], @@ -1953,6 +1964,9 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu ) if ( !pEntry ) return 1; Path aPath( pFocusBox, pEntry ); + + // it is ok to use the SfxObjectShellRef here since the object that + // provides it ( GetObjectShell() calls CreateObjectShell() ) has a lock on it SfxObjectShellRef aRef = pFocusBox->GetObjectShell( aPath ); if ( aRef.Is() ) { diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 91f5842c1fb7..4aea842e44e9 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -1088,60 +1088,10 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) //REPLACE pInfo->Save(xDocStor); } } -/* - SfxConfigManager *pCfgMgr = SFX_CFGMANAGER(); - { - SfxConfigManager *pTemplCfg = new SfxConfigManager(aTemplStor, pCfgMgr); - SetConfigManager(pTemplCfg); - SetTemplateConfig(TRUE); - - // Falls der gerade zerst"orte CfgMgr des Dokuments der - // aktive war, pCfgMgr lieber neu holen - pCfgMgr = SFX_CFGMANAGER(); - - // ggf. den neuen ConfigManager aktivieren - if ( this == SfxObjectShell::Current() ) - pTemplCfg->Activate(pCfgMgr); - } -*/ - // Template und Template-DocInfo werden nicht mehr gebraucht -// delete pTemplInfo; } } } -SfxObjectShellRef MakeObjectShellForOrganizer_Impl( const String& aTargetURL, BOOL bForWriting ) -{ - // check for own format - SfxObjectShellRef xDoc; - StreamMode nMode = bForWriting ? SFX_STREAM_READWRITE : SFX_STREAM_READONLY; - SfxMedium *pMed = new SfxMedium( aTargetURL, nMode, FALSE, 0 ); - const SfxFilter* pFilter = NULL; - pMed->UseInteractionHandler(TRUE); - if( SFX_APP()->GetFilterMatcher().GuessFilter( *pMed, &pFilter ) == ERRCODE_NONE && pFilter && pFilter->IsOwnFormat() ) - { - // create document - xDoc = SfxObjectShell::CreateObject( pFilter->GetServiceName(), SFX_CREATE_MODE_ORGANIZER ); - if ( xDoc.Is() ) - { - // partially load, so don't use DoLoad! - xDoc->DoInitNew(0); - // TODO/LATER: make sure that we don't use binary templates! - if( xDoc->LoadFrom( *pMed ) ) - { - // connect to storage, abandon temp. storage - xDoc->DoSaveCompleted( pMed ); - } - else - xDoc.Clear(); - } - } - else - delete pMed; - - return xDoc; -} - sal_Bool SfxObjectShell::IsHelpDocument() const { const SfxFilter* pFilter = GetMedium()->GetFilter(); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 693911f0404c..a5141662fa3d 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -172,12 +172,7 @@ void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::Even SfxObjectShell::SetCurrentComponent( Reference< XInterface >() ); } - if ( mpDoc->Get_Impl()->bHiddenLockedByAPI ) - { - mpDoc->Get_Impl()->bHiddenLockedByAPI = FALSE; - mpDoc->OwnerLock(FALSE); - } - else if ( !mpDoc->Get_Impl()->bClosing ) + if ( !mpDoc->Get_Impl()->bClosing ) // GCC stuerzt ab, wenn schon im dtor, also vorher Flag abfragen mpDoc->DoClose(); } @@ -835,22 +830,6 @@ void SfxObjectShell::InitBasicManager_Impl() } //-------------------------------------------------------------------- -#if 0 //(mba) -SotObjectRef SfxObjectShell::CreateAggObj( const SotFactory* pFact ) -{ - // SvDispatch? - SotFactory* pDispFact = SvDispatch::ClassFactory(); - if( pFact == pDispFact ) - return( (SfxShellObject*)GetSbxObject() ); - - // sonst unbekannte Aggregation - DBG_ERROR("unkekannte Factory"); - SotObjectRef aSvObjectRef; - return aSvObjectRef; -} -#endif - -//-------------------------------------------------------------------- sal_uInt16 SfxObjectShell::Count() { @@ -873,7 +852,7 @@ SfxObjectShell* SfxObjectShell::GetObjectShell() //-------------------------------------------------------------------- -SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames() +uno::Sequence< ::rtl::OUString > SfxObjectShell::GetEventNames() { static uno::Sequence< ::rtl::OUString >* pEventNameContainer = NULL; diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 1dc2423bcdaf..d088f6981f49 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -344,7 +344,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > // Name-Property? if ( rProp.Name.compareToAscii( "Name" ) == 0 ) { - OUSTRING sTemp; + ::rtl::OUString sTemp; if ( ( rProp.Value >>= sTemp ) == sal_False ) throw ::com::sun::star::lang::IllegalArgumentException(); @@ -618,9 +618,9 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& if ( rProp.Name.compareToAscii( "FileName" ) == 0 ) { // unpack th URL and check for a valid and well known protocol - OUSTRING sTemp; + ::rtl::OUString sTemp; if ( - ( rProp.Value.getValueType()!=::getCppuType((const OUSTRING*)0)) || + ( rProp.Value.getValueType()!=::getCppuType((const ::rtl::OUString*)0)) || (!(rProp.Value>>=sTemp)) ) { @@ -717,7 +717,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // Pages-Property else if ( rProp.Name.compareToAscii( "Pages" ) == 0 ) { - OUSTRING sTemp; + ::rtl::OUString sTemp; if( rProp.Value >>= sTemp ) { aCheckedArgs[nProps].Name = rProp.Name; diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index a4707f03d364..4dbb8a3c640e 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -263,25 +263,6 @@ sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlo } // -------------------------------------------------------------------------------------------------------------------- -void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) const -{ - const sal_Bool bHidden = i_rDescriptor.getOrDefault( "Hidden", sal_False ); - if ( !bHidden ) - return; - - const SfxViewFrame* pExistingViewFrame = SfxViewFrame::GetFirst( &i_rDocument ); - if ( pExistingViewFrame ) - return; - - // the document is to be loaded hidden, and it is not yet displayed in any other frame - // To prevent it from being closed when the loader returns, increase its OwnerLock - // (the OwnerLock is normally increased by every frame in which the document is displayed, and by this loader) - i_rDocument.RestoreNoDelete(); - i_rDocument.OwnerLock( TRUE ); - i_rDocument.Get_Impl()->bHiddenLockedByAPI = TRUE; -} - -// -------------------------------------------------------------------------------------------------------------------- void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor ) const { const ::rtl::OUString sURL = io_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ); @@ -331,7 +312,7 @@ void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollecti } // -------------------------------------------------------------------------------------------------------------------- -SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) const +SfxObjectShellRef SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) const { for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) { @@ -635,15 +616,12 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // tell the doc its (current) load args. impl_removeLoaderArguments( aDescriptor ); xModel->attachResource( xModel->getURL(), aDescriptor.getPropertyValues() ); - // TODO: not sure this is correct. The original, pre-refactoring code did it this way. However, I could - // imagine scenarios where it is *not* correct to overrule the *existing* model args (XModel::getArgs) - // with the ones passed to the loader here. For instance, what about the MacroExecutionMode? The document - // might have a mode other than the one passed to the loader, and we always overwrite the former with - // the latter. } // get the SfxObjectShell (still needed at the moment) - const SfxObjectShellLock xDoc = impl_findObjectShell( xModel ); + // SfxObjectShellRef is used here ( instead of ...Lock ) since the model is closed below if necessary + // SfxObjectShellLock would be even dangerous here, since the lifetime control should be done outside in case of success + const SfxObjectShellRef xDoc = impl_findObjectShell( xModel ); ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the given model" ); // ensure the ID of the to-be-created view is in the descriptor, if possible @@ -651,16 +629,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 ); const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetAPIViewName() ); - // if the document is created hidden, prevent it from being deleted until it is shown or disposed - impl_lockHiddenDocument( *xDoc, aDescriptor ); - // TODO; if we wouldn't use a SfxObjectShellLock instance for xDoc, but a simple SfxObjectShellRef, - // then this would not be necessary, /me thinks. That is, the *Lock classes inc/dec a "Lock" counter - // (additional to the ref counter) in their ctor/dtor, and if the lock counter goes to 0, the - // object is closed (DoClose). The impl_lockHiddenDocument is to prevent exactly that premature - // closing. However, a *Ref object wouldn't close, anyway. And in case of unsuccessfull loading, the - // code at the very end of this method cares for closing the XModel, which should also close the - // ObjectShell. - // plug the document into the frame impl_createDocumentView( xModel, _rTargetFrame, aViewCreationArgs, sViewName ); bLoadSuccess = sal_True; diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index b8ad1cfc61f7..8fd223279372 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -734,7 +734,7 @@ ANY SfxBaseController::getViewData() throw( ::com::sun::star::uno::RuntimeExcept if ( m_pData->m_pViewShell ) { m_pData->m_pViewShell->WriteUserData( sData1 ) ; - OUSTRING sData( sData1 ); + ::rtl::OUString sData( sData1 ); aAny <<= sData ; } @@ -750,7 +750,7 @@ void SAL_CALL SfxBaseController::restoreViewData( const ANY& aValue ) throw( ::c ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pData->m_pViewShell ) { - OUSTRING sData; + ::rtl::OUString sData; aValue >>= sData ; m_pData->m_pViewShell->ReadUserData( sData ) ; } @@ -781,7 +781,7 @@ REFERENCE< XMODEL > SAL_CALL SfxBaseController::getModel() throw( ::com::sun::st //________________________________________________________________________________________________________ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOURL& aURL , - const OUSTRING& sTargetFrameName, + const ::rtl::OUString& sTargetFrameName, sal_Int32 eSearchFlags ) throw( RUNTIMEEXCEPTION ) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); @@ -938,12 +938,12 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU // SfxBaseController -> XDispatchProvider //________________________________________________________________________________________________________ -SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL SfxBaseController::queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescripts ) throw( ::com::sun::star::uno::RuntimeException ) +uno::Sequence< REFERENCE< XDISPATCH > > SAL_CALL SfxBaseController::queryDispatches( const uno::Sequence< DISPATCHDESCRIPTOR >& seqDescripts ) throw( ::com::sun::star::uno::RuntimeException ) { // Create return list - which must have same size then the given descriptor // It's not allowed to pack it! sal_Int32 nCount = seqDescripts.getLength(); - SEQUENCE< REFERENCE< XDISPATCH > > lDispatcher( nCount ); + uno::Sequence< REFERENCE< XDISPATCH > > lDispatcher( nCount ); for( sal_Int32 i=0; i<nCount; ++i ) { diff --git a/svx/source/form/fmscriptingenv.cxx b/svx/source/form/fmscriptingenv.cxx index 154999333296..b8b4055ef5de 100644 --- a/svx/source/form/fmscriptingenv.cxx +++ b/svx/source/form/fmscriptingenv.cxx @@ -481,6 +481,7 @@ namespace svxform if ( m_bDisposed ) return; + // SfxObjectShellRef is good here since the model controls the lifetime of the object SfxObjectShellRef xObjectShell = m_rFormModel.GetObjectShell(); if( !xObjectShell.Is() ) return; diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index e63325f710e9..ed0d57b96f97 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -130,6 +130,8 @@ private: { Reference< XMultiComponentFactory > xMFac( xCtx->getServiceManager(), UNO_QUERY ); + + // SfxObjectShellRef is good here since the model controls the lifetime of the shell SfxObjectShellRef xObjSh = pModel->GetObjectShell(); Reference< XMultiServiceFactory > xDocFac; if ( xObjSh.Is() ) @@ -150,6 +152,7 @@ private: { try { + // SfxObjectShellRef is good here since the model controls the lifetime of the shell SfxObjectShellRef xObjSh = pModel->GetObjectShell(); if ( xObjSh.Is() && m_vbaListener.is() ) { |