diff options
author | Mikhail Voytenko <mav@openoffice.org> | 2011-01-03 13:40:23 +0100 |
---|---|---|
committer | Mikhail Voytenko <mav@openoffice.org> | 2011-01-03 13:40:23 +0100 |
commit | 58186468b42712ca0234d0554cc87b64f25b52a9 (patch) | |
tree | edc31559c3c1266ee68fbba4c75bf3b4ea3bad62 /sfx2 | |
parent | a0b40713789811793b528affcfaf8e4d5a7f0a87 (diff) |
fwk162: #i115902# review usage of SfxObjectShellRef, SfxObjecShellLock; remove unused some methods
Diffstat (limited to 'sfx2')
-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/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 |
12 files changed, 54 insertions, 149 deletions
diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index aa9b7e5cee..3f3fe029b6 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 8bed61e997..e0a4f13ee3 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 8e4dde2872..f6efccbb60 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 566e45a599..ebabd29de5 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 1f7f8da046..745d11de51 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -159,7 +159,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 @@ -382,7 +381,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 @@ -398,7 +397,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 ) ; //____________________________________________________________________________________________________ @@ -577,7 +576,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); /**___________________________________________________________________________________________________ @@ -608,7 +607,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 - @@ -858,7 +857,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 - @@ -873,7 +872,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 - @@ -888,14 +887,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); //____________________________________________________________________________________________________ @@ -976,7 +975,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) ; /**___________________________________________________________________________________________________ @@ -993,7 +992,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); @@ -1034,7 +1033,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, @@ -1055,7 +1054,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, @@ -1063,7 +1062,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, @@ -1161,7 +1160,7 @@ public: */ - virtual SEQUENCE< DATAFLAVOR > SAL_CALL getTransferDataFlavors() + virtual ::com::sun::star::uno::Sequence< DATAFLAVOR > SAL_CALL getTransferDataFlavors() throw (::com::sun::star::uno::RuntimeException); /**___________________________________________________________________________________________________ @@ -1529,7 +1528,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( ::rtl::OUString ); SAL_DLLPRIVATE String getEventName_Impl( long nID ); diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 770c4f9127..3b9af13155 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 7f93fdd43b..a935f67a89 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 31959f23e4..e692d6fea2 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 a9a75831e2..3f6b9abbbe 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(); } @@ -813,22 +808,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() { @@ -851,7 +830,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 fee1e4df3c..cdc8c176ca 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -345,7 +345,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(); @@ -619,9 +619,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)) ) { @@ -718,7 +718,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 03c2289283..63682ee5ab 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -264,25 +264,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() ); @@ -332,7 +313,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 ) ) { @@ -636,15 +617,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 @@ -652,16 +630,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 2967f52c9c..2ffa4327c3 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 UNOURL& // 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 ) { |