From 91750f1374abf62953cefc28838ebe5960e31da2 Mon Sep 17 00:00:00 2001 From: Thomas Benisch Date: Tue, 9 Nov 2010 17:27:08 +0100 Subject: chartextensibility: #i113619# Pasting a chart into a spreadsheet is not notified --- sw/source/ui/wrtsh/wrtsh1.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index 04f87e877aa5..d6b6f91635dc 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #if STLPORT_VERSION>=321 #include // prevent conflict between exception and std::exception @@ -617,6 +618,31 @@ BOOL SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrmFm if (pFlyFrmFmt) *pFlyFrmFmt = pFmt; + if ( SotExchange::IsChart( aCLSID ) ) + { + uno::Reference< embed::XEmbeddedObject > xEmbeddedObj( xRef.GetObject(), uno::UNO_QUERY ); + if ( xEmbeddedObj.is() ) + { + bool bDisableDataTableDialog = false; + svt::EmbeddedObjectRef::TryRunningState( xEmbeddedObj ); + uno::Reference< beans::XPropertySet > xProps( xEmbeddedObj->getComponent(), uno::UNO_QUERY ); + if ( xProps.is() && + ( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ) ) >>= bDisableDataTableDialog ) && + bDisableDataTableDialog ) + { + xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ), + uno::makeAny( sal_False ) ); + xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableComplexChartTypes" ) ), + uno::makeAny( sal_False ) ); + uno::Reference< util::XModifiable > xModifiable( xProps, uno::UNO_QUERY ); + if ( xModifiable.is() ) + { + xModifiable->setModified( sal_True ); + } + } + } + } + EndAllAction(); GetView().AutoCaption(OLE_CAP, &aCLSID); -- cgit From 24735ecb14ca4ea87ba531ac05bb6557a050e424 Mon Sep 17 00:00:00 2001 From: tono Date: Fri, 31 Dec 2010 00:35:16 +0900 Subject: i#116264: gbuild for MinGW --- sw/Library_msword.mk | 16 ++++++++++++++++ sw/Library_sw.mk | 16 ++++++++++++++++ sw/Library_swd.mk | 13 +++++++++++++ sw/Library_swui.mk | 16 ++++++++++++++++ sw/Library_vbaswobj.mk | 16 ++++++++++++++++ 5 files changed, 77 insertions(+) diff --git a/sw/Library_msword.mk b/sw/Library_msword.mk index ee33da85561f..34a52e4786c7 100644 --- a/sw/Library_msword.mk +++ b/sw/Library_msword.mk @@ -114,6 +114,21 @@ $(eval $(call gb_Library_add_exception_objects,msword,\ )) ifeq ($(OS),WNT) +ifneq ($(USE_MINGW),) +$(eval $(call gb_Library_add_linked_libs,msword,\ + mingwthrd \ + $(gb_MINGW_LIBSTDCPP) \ + mingw32 \ + $(gb_MINGW_LIBGCC) \ + uwinapi \ + moldname \ + mingwex \ + advapi32 \ + kernel32 \ + msvcrt \ + user32 \ +)) +else $(eval $(call gb_Library_add_linked_libs,msword,\ advapi32 \ kernel32 \ @@ -123,4 +138,5 @@ $(eval $(call gb_Library_add_linked_libs,msword,\ uwinapi \ )) endif +endif # vim: set noet sw=4 ts=4: diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index cc1df51d2dba..e8e127d3ab0f 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -737,6 +737,21 @@ $(eval $(call gb_Library_add_linked_libs,sw,\ endif ifeq ($(OS),WNT) +ifneq ($(USE_MINGW),) +$(eval $(call gb_Library_add_linked_libs,sw,\ + mingwthrd \ + $(gb_MINGW_LIBSTDCPP) \ + mingw32 \ + $(gb_MINGW_LIBGCC) \ + uwinapi \ + moldname \ + mingwex \ + advapi32 \ + kernel32 \ + msvcrt \ + user32 \ +)) +else $(eval $(call gb_Library_add_linked_libs,sw,\ advapi32 \ kernel32 \ @@ -746,6 +761,7 @@ $(eval $(call gb_Library_add_linked_libs,sw,\ uwinapi \ )) endif +endif $(eval $(call gb_SdiTarget_SdiTarget,sw/sdi/swslots,sw/sdi/swriter)) diff --git a/sw/Library_swd.mk b/sw/Library_swd.mk index 17511d3bf4ed..39440092c574 100644 --- a/sw/Library_swd.mk +++ b/sw/Library_swd.mk @@ -70,10 +70,23 @@ $(eval $(call gb_Library_add_exception_objects,swd,\ sw/source/ui/uno/swdetect \ )) ifeq ($(OS),WNT) +ifneq ($(USE_MINGW),) +$(eval $(call gb_Library_add_linked_libs,swd,\ + mingwthrd \ + $(gb_MINGW_LIBSTDCPP) \ + mingw32 \ + $(gb_MINGW_LIBGCC) \ + uwinapi \ + mingwex \ + kernel32 \ + msvcrt \ +)) +else $(eval $(call gb_Library_add_linked_libs,swd,\ kernel32 \ msvcrt \ uwinapi \ )) endif +endif # vim: set noet sw=4 ts=4: diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk index 12227c9a0ae8..927aaab1fd98 100644 --- a/sw/Library_swui.mk +++ b/sw/Library_swui.mk @@ -167,6 +167,21 @@ $(eval $(call gb_Library_add_exception_objects,swui,\ )) ifeq ($(OS),WNT) +ifneq ($(USE_MINGW),) +$(eval $(call gb_Library_add_linked_libs,swui,\ + mingwthrd \ + $(gb_MINGW_LIBSTDCPP) \ + mingw32 \ + $(gb_MINGW_LIBGCC) \ + uwinapi \ + moldname \ + mingwex \ + advapi32 \ + kernel32 \ + msvcrt \ + user32 \ +)) +else $(eval $(call gb_Library_add_linked_libs,swui,\ advapi32 \ kernel32 \ @@ -176,4 +191,5 @@ $(eval $(call gb_Library_add_linked_libs,swui,\ uwinapi \ )) endif +endif # vim: set noet sw=4 ts=4: diff --git a/sw/Library_vbaswobj.mk b/sw/Library_vbaswobj.mk index 44bbfa8a0c6f..645d383dd8f9 100644 --- a/sw/Library_vbaswobj.mk +++ b/sw/Library_vbaswobj.mk @@ -126,6 +126,21 @@ $(eval $(call gb_Library_set_ldflags,vbaswobj,\ endif ifeq ($(OS),WNT) +ifneq ($(USE_MINGW),) +$(eval $(call gb_Library_add_linked_libs,vbaswobj,\ + mingwthrd \ + $(gb_MINGW_LIBSTDCPP) \ + mingw32 \ + $(gb_MINGW_LIBGCC) \ + uwinapi \ + moldname \ + mingwex \ + advapi32 \ + kernel32 \ + msvcrt \ + user32 \ +)) +else $(eval $(call gb_Library_add_linked_libs,vbaswobj,\ advapi32 \ kernel32 \ @@ -135,4 +150,5 @@ $(eval $(call gb_Library_add_linked_libs,vbaswobj,\ uwinapi \ )) endif +endif # vim: set noet sw=4 ts=4: -- cgit From 07fa2a259a3c76b1cadc138d6e4bb23172210347 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 3 Jan 2011 13:40:23 +0100 Subject: fwk162: #i115902# review usage of SfxObjectShellRef, SfxObjecShellLock; remove unused some methods --- sw/inc/doc.hxx | 16 +++++++--------- sw/inc/unomailmerge.hxx | 2 +- sw/source/core/doc/docglbl.cxx | 4 ++-- sw/source/core/doc/docnew.cxx | 21 ++++++++++++++------- sw/source/core/docnode/ndtbl.cxx | 7 ------- sw/source/core/docnode/section.cxx | 10 +++++++--- sw/source/core/fields/expfld.cxx | 16 ++++++++++++---- sw/source/core/ole/ndole.cxx | 18 ++++++++---------- sw/source/core/unocore/unocrsrhelper.cxx | 1 + sw/source/core/view/vprint.cxx | 8 ++------ sw/source/filter/basflt/shellio.cxx | 6 +----- sw/source/filter/ww8/ww8glsy.cxx | 2 +- sw/source/ui/app/appenv.cxx | 2 +- sw/source/ui/app/apphdl.cxx | 2 +- sw/source/ui/app/applab.cxx | 2 +- sw/source/ui/app/docsh.cxx | 23 +++-------------------- sw/source/ui/app/docsh2.cxx | 2 +- sw/source/ui/dbui/dbmgr.cxx | 21 +++++++++++++++------ sw/source/ui/dbui/mmoutputpage.cxx | 6 ++++-- sw/source/ui/dochdl/swdtflvr.cxx | 12 ++++++------ sw/source/ui/inc/swdtflvr.hxx | 2 +- sw/source/ui/inc/uivwimp.hxx | 7 ++----- sw/source/ui/inc/unotxvw.hxx | 2 +- sw/source/ui/inc/view.hxx | 6 +++--- sw/source/ui/uiview/view.cxx | 6 +++--- sw/source/ui/uiview/view2.cxx | 5 +++-- sw/source/ui/uno/unomailmerge.cxx | 1 + sw/source/ui/uno/unotxdoc.cxx | 10 +++++++--- sw/source/ui/uno/unotxvw.cxx | 4 ++-- 29 files changed, 111 insertions(+), 113 deletions(-) diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 736fbb70a3b5..4aad1fb56cd1 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -74,6 +74,7 @@ class SwList; #include #include #include +#include #include #include #include "comphelper/implementationreference.hxx" @@ -94,8 +95,6 @@ class SwList; #include -class SfxObjectShell; -class SfxObjectShellRef; class SvxForbiddenCharactersTable; class SwExtTextInput; class DateTime; @@ -358,9 +357,8 @@ class SW_DLLPUBLIC SwDoc : SvxMacroTableDtor *pMacroTable; // Tabelle der dokumentglobalen Macros SwDocShell *pDocShell; // Ptr auf die SfxDocShell vom Doc - SfxObjectShellRef* pDocShRef; // fuers Kopieren von OLE-Nodes (wenn keine - // DocShell gesetzt ist, muss dieser - // Ref-Pointer gesetzt sein!!!!) + SfxObjectShellLock xTmpDocShell; // A temporary shell that is used to copy OLE-Nodes + sfx2::LinkManager *pLinkMgr; // Liste von Verknuepften (Grafiken/DDE/OLE) SwAutoCorrExceptWord *pACEWord; // fuer die automatische Uebernahme von @@ -1834,10 +1832,10 @@ public: const SwDocShell* GetDocShell() const { return pDocShell; } void SetDocShell( SwDocShell* pDSh ); - // falls beim Kopieren von OLE-Nodes eine DocShell angelegt werden muss, - // dann MUSS der Ref-Pointer besetzt sein!!!! - SfxObjectShellRef* GetRefForDocShell() { return pDocShRef; } - void SetRefForDocShell( SfxObjectShellRef* p ) { pDocShRef = p; } + // in case during copying of embedded object a new shell is created, + // it should be set here and cleaned later + void SetTmpDocShell( SfxObjectShellLock rLock ) { xTmpDocShell = rLock; } + SfxObjectShellLock GetTmpDocShell() { return xTmpDocShell; } // fuer die TextBausteine - diese habe nur ein SvPersist zur // Verfuegung diff --git a/sw/inc/unomailmerge.hxx b/sw/inc/unomailmerge.hxx index 39a9664c4123..9e15051232a4 100644 --- a/sw/inc/unomailmerge.hxx +++ b/sw/inc/unomailmerge.hxx @@ -41,7 +41,7 @@ #include #include #include -#include // SfxObjectShellRef +#include #include diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 30a385442fc0..91c67cc96fb3 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -254,7 +254,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, String sFileName; if( pSttNd->GetIndex() + 1 < aEndIdx.GetIndex() ) { - SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); + SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); if( xDocSh->DoInitNew( 0 ) ) { SwDoc* pDoc = ((SwDocShell*)(&xDocSh))->GetDoc(); @@ -605,7 +605,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) String sFileName; if( pSttNd->GetIndex() + 1 < aEndIdx.GetIndex() ) { - SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); + SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); if( xDocSh->DoInitNew( 0 ) ) { SwDoc* pDoc = ((SwDocShell*)(&xDocSh))->GetDoc(); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 484b5119d9e5..e0d3437959c7 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -254,7 +254,6 @@ SwDoc::SwDoc() : pFtnIdxs( new SwFtnIdxs ), pDocStat( new SwDocStat ), pDocShell( 0 ), - pDocShRef( 0 ), pLinkMgr( new sfx2::LinkManager( 0 ) ), pACEWord( 0 ), pURLStateChgd( 0 ), @@ -1149,15 +1148,23 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const // COMPATIBILITY FLAGS END // pRet->ReplaceStyles( * const_cast< SwDoc*>( this )); - SfxObjectShellRef aDocShellRef = const_cast< SwDocShell* >( GetDocShell() ); - pRet->SetRefForDocShell( boost::addressof(aDocShellRef) ); - SfxObjectShellRef xRetShell = new SwDocShell( pRet, SFX_CREATE_MODE_STANDARD ); + + // we have to use pointer here, since the callee has to decide whether SfxObjectShellLock or SfxObjectShellRef should be used + // sometimes the object will be returned with refcount set to 0 ( if no DoInitNew is done ) + SfxObjectShell* pRetShell = new SwDocShell( pRet, SFX_CREATE_MODE_STANDARD ); if( bCallInitNew ) - xRetShell->DoInitNew(); + { + // it could happen that DoInitNew creates model, that increases the refcount of the object + pRetShell->DoInitNew(); + } + //copy content pRet->Paste( *this ); - pRet->SetRefForDocShell( 0 ); - return xRetShell; + + // remove the temporary shell if it is there as it was done before + pRet->SetTmpDocShell( (SfxObjectShell*)NULL ); + + return pRetShell; } /*-- 08.05.2009 10:52:40--------------------------------------------------- copy document content - code from SwFEShell::Paste( SwDoc* , BOOL ) diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 588ef88f7740..5f21e32df796 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -4376,7 +4376,6 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, } SwDoc* pCpyDoc = (SwDoc*)pSrcTblNd->GetDoc(); - SfxObjectShellRef* pRefForDocSh = 0; BOOL bDelCpyDoc = pCpyDoc == this; if( bDelCpyDoc ) @@ -4384,13 +4383,10 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, // kopiere die Tabelle erstmal in ein temp. Doc pCpyDoc = new SwDoc; pCpyDoc->acquire(); - pRefForDocSh = new SfxObjectShellRef(); - pCpyDoc->SetRefForDocShell( pRefForDocSh ); SwPosition aPos( SwNodeIndex( pCpyDoc->GetNodes().GetEndOfContent() )); if( !pSrcTblNd->GetTable().MakeCopy( pCpyDoc, aPos, rBoxes, TRUE, TRUE )) { - delete pRefForDocSh; if( pCpyDoc->release() == 0 ) delete pCpyDoc; @@ -4403,8 +4399,6 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, } aPos.nNode -= 1; // auf den EndNode der Tabelle pSrcTblNd = aPos.nNode.GetNode().FindTableNode(); - - pCpyDoc->SetRefForDocShell( NULL ); } const SwStartNode* pSttNd = rInsPos.nNode.GetNode().FindTableBoxStartNode(); @@ -4443,7 +4437,6 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, if( bDelCpyDoc ) { - delete pRefForDocSh; if( pCpyDoc->release() == 0 ) delete pCpyDoc; } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 2d54cb88f2e6..a0c16bd9d1e5 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1319,9 +1319,10 @@ void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) // Der Return-Wert gibt an, was mit der Shell zu geschehen hat: // 0 - Fehler, konnte DocShell nicht finden // 1 - DocShell ist ein existieren Document -// 2 - DocShell wurde neu angelegt, muss also wieder geschlossen werden +// 2 - DocShell wurde neu angelegt, muss also wieder geschlossen werden ( will be assigned to xLockRef additionaly ) int lcl_FindDocShell( SfxObjectShellRef& xDocSh, + SfxObjectShellLock& xLockRef, const String& rFileName, const String& rPasswd, String& rFilter, @@ -1407,7 +1408,9 @@ int lcl_FindDocShell( SfxObjectShellRef& xDocSh, // ohne Filter geht gar nichts pMed->SetFilter( pSfxFlt ); - xDocSh = new SwDocShell( SFX_CREATE_MODE_INTERNAL ); + // if the new shell is created, SfxObjectShellLock should be used to let it be closed later for sure + xLockRef = new SwDocShell( SFX_CREATE_MODE_INTERNAL ); + xDocSh = (SfxObjectShell*)xLockRef; if( xDocSh->DoLoad( pMed ) ) return 2; } @@ -1504,6 +1507,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, RedlineMode_t eOldRedlineMode = nsRedlineMode_t::REDLINE_NONE; SfxObjectShellRef xDocSh; + SfxObjectShellLock xLockRef; int nRet; if( !sFileName.Len() ) { @@ -1512,7 +1516,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, } else { - nRet = lcl_FindDocShell( xDocSh, sFileName, + nRet = lcl_FindDocShell( xDocSh, xLockRef, sFileName, rSection.GetLinkFilePassword(), sFilter, 0, pDoc->GetDocShell() ); if( nRet ) diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index e55c8598cf90..1be00582a586 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -76,10 +76,18 @@ sal_Int16 lcl_SubTypeToAPI(USHORT nSubType) sal_Int16 nRet = 0; switch(nSubType) { - case nsSwGetSetExpType::GSE_EXPR : nRet = SetVariableType::VAR /*0*/; break; - case nsSwGetSetExpType::GSE_SEQ : nRet = SetVariableType::SEQUENCE /*1*/; break; - case nsSwGetSetExpType::GSE_FORMULA : nRet = SetVariableType::FORMULA /*2*/; break; - case nsSwGetSetExpType::GSE_STRING : nRet = SetVariableType::STRING /*3*/; break; + case nsSwGetSetExpType::GSE_EXPR: + nRet = SetVariableType::VAR; // 0 + break; + case nsSwGetSetExpType::GSE_SEQ: + nRet = SetVariableType::SEQUENCE; // 1 + break; + case nsSwGetSetExpType::GSE_FORMULA: + nRet = SetVariableType::FORMULA; // 2 + break; + case nsSwGetSetExpType::GSE_STRING: + nRet = SetVariableType::STRING; // 3 + break; } return nRet; } diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 1cd0fdd02830..db341c9991ba 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -437,16 +437,14 @@ Size SwOLENode::GetTwipSize() const SwCntntNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const { // Falls bereits eine SvPersist-Instanz existiert, nehmen wir diese - SfxObjectShell* p = pDoc->GetPersist(); - if( !p ) + SfxObjectShell* pPersistShell = pDoc->GetPersist(); + if( !pPersistShell ) { - // TODO/LATER: reicht hier nicht ein EmbeddedObjectContainer? Was passiert mit - // diesem Dokument? - ASSERT( pDoc->GetRefForDocShell(), - "wo ist die Ref-Klasse fuer die DocShell?") - p = new SwDocShell( pDoc, SFX_CREATE_MODE_INTERNAL ); - *pDoc->GetRefForDocShell() = p; - p->DoInitNew( NULL ); + // TODO/LATER: is EmbeddedObjectContainer not enough? + // the created document will be closed by pDoc ( should use SfxObjectShellLock ) + pPersistShell = new SwDocShell( pDoc, SFX_CREATE_MODE_INTERNAL ); + pDoc->SetTmpDocShell( pPersistShell ); + pPersistShell->DoInitNew( NULL ); } // Wir hauen das Ding auf SvPersist-Ebene rein @@ -454,7 +452,7 @@ SwCntntNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const ::rtl::OUString aNewName/*( Sw3Io::UniqueName( p->GetStorage(), "Obj" ) )*/; SfxObjectShell* pSrc = GetDoc()->GetPersist(); - p->GetEmbeddedObjectContainer().CopyAndGetEmbeddedObject( + pPersistShell->GetEmbeddedObjectContainer().CopyAndGetEmbeddedObject( pSrc->GetEmbeddedObjectContainer(), pSrc->GetEmbeddedObjectContainer().GetEmbeddedObject( aOLEObj.aName ), aNewName ); diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 92a33da130fe..9b60693c6755 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -935,6 +935,7 @@ void InsertFile(SwUnoCrsr* pUnoCrsr, if( !pMed ) return; + // this sourcecode is not responsible for the lifetime of the shell, SfxObjectShellLock should not be used SfxObjectShellRef aRef( pDocSh ); pDocSh->RegisterTransfer( *pMed ); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 83e0289e6082..df6bcb377fb5 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -443,8 +443,8 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) } // es wurde in der CORE eine neu angelegt (OLE-Objekte kopiert!) -// if( aDocShellRef.Is() ) -// SwDataExchange::InitOle( aDocShellRef, pPrtDoc ); +//REMOVE // if( aDocShellRef.Is() ) +//REMOVE // SwDataExchange::InitOle( aDocShellRef, pPrtDoc ); // und fuellen es mit dem selektierten Bereich pFESh->Copy( pPrtDoc ); @@ -503,10 +503,6 @@ sal_Bool ViewShell::PrintOrPDFExport( ViewShell *pShell; SwDoc *pOutDevDoc; - //!! muss warum auch immer hier in diesem scope existieren !! - //!! (h?ngt mit OLE Objekten im Dokument zusammen.) - SfxObjectShellRef aDocShellRef; - // Print/PDF export for (multi-)selection has already generated a // temporary document with the selected text. // (see XRenderable implementation in unotxdoc.cxx) diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 963c5c847500..b0b69501979e 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -530,7 +530,7 @@ SwDoc* Reader::GetTemplateDoc() { SwDocShell *pDocSh = new SwDocShell ( SFX_CREATE_MODE_INTERNAL ); - SfxObjectShellRef xDocSh = pDocSh; + SfxObjectShellLock xDocSh = pDocSh; if( pDocSh->DoInitNew( 0 ) ) { pTemplate = pDocSh->GetDoc(); @@ -805,15 +805,12 @@ ULONG SwWriter::Write( WriterRef& rxWriter, const String* pRealFileName ) SwPaM * pPam; SwDoc *pDoc = 0; - SfxObjectShellRef* pRefForDocSh = 0; if ( pShell && !bWriteAll && pShell->IsTableMode() ) { bWriteAll = TRUE; pDoc = new SwDoc; pDoc->acquire(); - pRefForDocSh = new SfxObjectShellRef(); - pDoc->SetRefForDocShell( pRefForDocSh ); // kopiere Teile aus einer Tabelle: lege eine Tabelle mit der Breite // von der Originalen an und kopiere die selectierten Boxen. @@ -971,7 +968,6 @@ ULONG SwWriter::Write( WriterRef& rxWriter, const String* pRealFileName ) if ( pDoc ) { - delete pRefForDocSh; if ( !pDoc->release() ) delete pDoc; bWriteAll = FALSE; diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index 7d8bc56272b7..9ae2cf4ce442 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -219,7 +219,7 @@ bool WW8Glossary::Load( SwTextBlocks &rBlocks, bool bSaveRelFile ) if ( 0 != (nStrings = static_cast< USHORT >(aStrings.size()))) { - SfxObjectShellRef xDocSh(new SwDocShell(SFX_CREATE_MODE_INTERNAL)); + SfxObjectShellLock xDocSh(new SwDocShell(SFX_CREATE_MODE_INTERNAL)); if (xDocSh->DoInitNew(0)) { SwDoc *pD = ((SwDocShell*)(&xDocSh))->GetDoc(); diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx index ce06c22cfc88..ee2e686a8400 100644 --- a/sw/source/ui/app/appenv.cxx +++ b/sw/source/ui/app/appenv.cxx @@ -189,7 +189,7 @@ static USHORT nTitleNo = 0; pOldSh = pMyDocSh ? pMyDocSh->GetWrtShell() : 0; // Neues Dokument erzeugen (kein Show!) - SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); + SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xDocSh->DoInitNew( 0 ); pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); pNewView = (SwView*) pFrame->GetViewShell(); diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx index 653208aaf250..0002928c0eb6 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -968,7 +968,7 @@ void NewXForms( SfxRequest& rReq ) // copied & excerpted from SwModule::InsertLab(..) // create new document - SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD) ); + SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD) ); xDocSh->DoInitNew( 0 ); // initialize XForms diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index 41f055f86050..1bbdfc71eeb4 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -209,7 +209,7 @@ static sal_uInt16 nBCTitleNo = 0; aLabCfg.Commit(); // Neues Dokument erzeugen. - SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD)); + SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD)); xDocSh->DoInitNew( 0 ); // Drucker diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index 9508c4c17864..2e6c92c7fc9a 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -484,7 +484,9 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) // will set the wrong class id. SvGlobalName aClassName; String aAppName, aLongUserName, aUserName; - SfxObjectShellRef xDocSh = + + // The document is closed explicitly, but using SfxObjectShellLock is still more correct here + SfxObjectShellLock xDocSh = new SwGlobalDocShell( SFX_CREATE_MODE_INTERNAL ); // the global document can not be a template xDocSh->SetupStorage( xStor, SotStorage::GetVersion( xStor ), sal_False ); @@ -717,25 +719,6 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bIsGlblDocSaveLinksSave); } - if( bRet && nMyType != nSaveType ) - { - SvGlobalName aClassName; - String aAppName, aLongUserName, aUserName; - SfxObjectShellRef xDocSh; - switch( nSaveType ) - { - case 0: - xDocSh = new SwDocShell( SFX_CREATE_MODE_INTERNAL ); - break; - case 1: - xDocSh = new SwWebDocShell( SFX_CREATE_MODE_INTERNAL ); - break; - case 2: - xDocSh = new SwGlobalDocShell( SFX_CREATE_MODE_INTERNAL ); - break; - } - } - return bRet; } diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 5bbc29aab2ee..df49dc4b1e68 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -1013,7 +1013,7 @@ void SwDocShell::Execute(SfxRequest& rReq) BYTE nLevel = pDlg->GetLevel(); BYTE nPara = pDlg->GetPara(); SwDoc* pSmryDoc = new SwDoc(); - SfxObjectShellRef xDocSh( new SwDocShell( pSmryDoc, SFX_CREATE_MODE_STANDARD)); + SfxObjectShellLock xDocSh( new SwDocShell( pSmryDoc, SFX_CREATE_MODE_STANDARD)); xDocSh->DoInitNew( 0 ); BOOL bImpress = FN_ABSTRACT_STARIMPRESS == nWhich; diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 90eeb6ee1982..d1e370fd87ef 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -938,7 +938,11 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, // in case of creating a single resulting file this has to be created here SwWrtShell* pTargetShell = 0; - SfxObjectShellRef xTargetDocShell; + + // the shell will be explicitly closed at the end of the method, but it is + // still more safe to use SfxObjectShellLock here + SfxObjectShellLock xTargetDocShell; + SwView* pTargetView = 0; std::auto_ptr< utl::TempFile > aTempFile; String sModifiedStartingPageDesc; @@ -1062,8 +1066,9 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, for (USHORT i = 0; i < 10; i++) Application::Reschedule(); - // Neues Dokument erzeugen und speichern - SfxObjectShellRef xWorkDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); + // Create and save new document + // The SfxObjectShell will be closed explicitly later but it is more safe to use SfxObjectShellLock here + SfxObjectShellLock xWorkDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); SfxMedium* pWorkMed = new SfxMedium( sSourceDocumentURL, STREAM_STD_READ, TRUE ); pWorkMed->SetFilter( pSfxFlt ); @@ -2543,6 +2548,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh, if(xResSet.is()) aDescriptor[daCursor] <<= xResSet; + // SfxObjectShellRef is ok, since there should be no control over the document lifetime here SfxObjectShellRef xDocShell = rSh.GetView().GetViewFrame()->GetObjectShell(); SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xDocShell)); { @@ -2573,7 +2579,9 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh, } else { - SfxObjectShellRef xWorkDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); + // the shell will be explicitly closed, but it is more safe to use SfxObjectShellLock here + // especially for the case that the loading has failed + SfxObjectShellLock xWorkDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); SfxMedium* pWorkMed = new SfxMedium( sTempURL, STREAM_STD_READ, TRUE ); pWorkMed->SetFilter( pSfxFlt ); if( xWorkDocSh->DoLoad(pWorkMed) ) @@ -2868,7 +2876,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, try { // create a target docshell to put the merged document into - SfxObjectShellRef xTargetDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); + SfxObjectShellLock xTargetDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTargetDocShell->DoInitNew( 0 ); SfxViewFrame* pTargetFrame = SfxViewFrame::LoadHiddenDocument( *xTargetDocShell, 0 ); @@ -2916,7 +2924,8 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, } // copy the source document - SfxObjectShellRef xWorkDocSh; + // the copy will be closed later, but it is more safe to use SfxObjectShellLock here + SfxObjectShellLock xWorkDocSh; if(nDocNo == 1 ) { uno::Reference< util::XCloneable > xClone( rSourceView.GetDocShell()->GetModel(), uno::UNO_QUERY); diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 0fe1a3717ca1..9056596c884f 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -853,7 +853,8 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) aSaveMonitor.aPrintInfo.SetText(sStat); //now extract a document from the target document - SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); + // the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here + SfxObjectShellLock xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTempDocShell->DoInitNew( 0 ); SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 ); // pTempFrame->GetFrame().Appear(); @@ -1252,7 +1253,8 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) SwDocMergeInfo& rInfo = rConfigItem.GetDocumentMergeInfo(nDoc); //now extract a document from the target document - SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); + // the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here + SfxObjectShellLock xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTempDocShell->DoInitNew( 0 ); SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 ); // pTempFrame->GetFrame().Appear(); diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 8220c7ee2c8d..2efe65c50079 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -454,14 +454,14 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) pClpDocFac = new SwDocFac; SwDoc *const pTmpDoc = lcl_GetDoc(*pClpDocFac); - pTmpDoc->SetRefForDocShell( boost::addressof(aDocShellRef) ); pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen pWrtShell->Copy( pTmpDoc ); // es wurde in der CORE eine neu angelegt (OLE-Objekte kopiert!) + aDocShellRef = pTmpDoc->GetTmpDocShell(); if( aDocShellRef.Is() ) SwTransferable::InitOle( aDocShellRef, *pTmpDoc ); - pTmpDoc->SetRefForDocShell( 0 ); + pTmpDoc->SetTmpDocShell( (SfxObjectShell*)NULL ); if( nSelectionType & nsSelectionType::SEL_TXT && !pWrtShell->HasMark() ) { @@ -869,7 +869,6 @@ int SwTransferable::PrepareForCopy( BOOL bIsCut ) SwDoc *const pTmpDoc = lcl_GetDoc(*pClpDocFac); - pTmpDoc->SetRefForDocShell( boost::addressof(aDocShellRef) ); pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen pWrtShell->Copy( pTmpDoc ); @@ -892,9 +891,10 @@ int SwTransferable::PrepareForCopy( BOOL bIsCut ) } // es wurde in der CORE eine neu angelegt (OLE-Objekte kopiert!) + aDocShellRef = pTmpDoc->GetTmpDocShell(); if( aDocShellRef.Is() ) SwTransferable::InitOle( aDocShellRef, *pTmpDoc ); - pTmpDoc->SetRefForDocShell( 0 ); + pTmpDoc->SetTmpDocShell( (SfxObjectShell*)NULL ); if( pWrtShell->IsObjSelected() ) eBufferType = TRNSFR_DRAWING; @@ -1052,15 +1052,15 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, SwCntntNode* pCNd = rNds.GoNext( &aNodeIdx ); // gehe zum 1. ContentNode SwPaM aPam( *pCNd ); - pCDoc->SetRefForDocShell( boost::addressof(aDocShellRef) ); pCDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen pCDoc->InsertGlossary( rGlossary, rStr, aPam, 0 ); // es wurde in der CORE eine neu angelegt (OLE-Objekte kopiert!) + aDocShellRef = pCDoc->GetTmpDocShell(); if( aDocShellRef.Is() ) SwTransferable::InitOle( aDocShellRef, *pCDoc ); - pCDoc->SetRefForDocShell( 0 ); + pCDoc->SetTmpDocShell( (SfxObjectShell*)NULL ); eBufferType = TRNSFR_DOCUMENT; diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx index 041b55d9c6db..452637a3e7f8 100644 --- a/sw/source/ui/inc/swdtflvr.hxx +++ b/sw/source/ui/inc/swdtflvr.hxx @@ -65,7 +65,7 @@ namespace nsTransferBufferType class SwTransferable : public TransferableHelper { friend class SwView_Impl; - SfxObjectShellRef aDocShellRef; + SfxObjectShellLock aDocShellRef; TransferableDataHelper aOleData; TransferableObjectDescriptor aObjDesc; ::sfx2::SvBaseLinkRef refDdeLink; diff --git a/sw/source/ui/inc/uivwimp.hxx b/sw/source/ui/inc/uivwimp.hxx index 9c22b44ad868..509610500a3f 100644 --- a/sw/source/ui/inc/uivwimp.hxx +++ b/sw/source/ui/inc/uivwimp.hxx @@ -111,8 +111,7 @@ class SwView_Impl // temporary document for printing text of selection / multi selection // in PDF export. - SfxObjectShellRef xTmpSelDocSh; - SfxObjectShellRef aEmbeddedObjRef; + SfxObjectShellLock xTmpSelDocSh; SwView* pView; SwScannerEventListener* pScanEvtLstnr; @@ -148,9 +147,7 @@ public: void AddClipboardListener(); - SfxObjectShellRef & GetTmpSelectionDoc() { return xTmpSelDocSh; } - - SfxObjectShellRef& GetEmbeddedObjRef() { return *boost::addressof(aEmbeddedObjRef); } + SfxObjectShellLock& GetTmpSelectionDoc() { return xTmpSelDocSh; } void AddTransferable(SwTransferable& rTransferable); diff --git a/sw/source/ui/inc/unotxvw.hxx b/sw/source/ui/inc/unotxvw.hxx index 4990df84f43b..1c8ad77e2054 100644 --- a/sw/source/ui/inc/unotxvw.hxx +++ b/sw/source/ui/inc/unotxvw.hxx @@ -156,7 +156,7 @@ public: void Invalidate(); // temporary document used for PDF export of selections/multi-selections - SfxObjectShellRef BuildTmpSelectionDoc(); + SfxObjectShellLock BuildTmpSelectionDoc(); }; /* -----------------17.09.98 12:52------------------- diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index 78817eec874c..c14fe10f41bd 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -32,7 +32,7 @@ #include #include #include -#include // SfxObjectShellRef <-> SV_DECL_REF(SfxObjectShell) +#include #include #include #include @@ -643,8 +643,8 @@ public: void NotifyDBChanged(); - SfxObjectShellRef & GetTmpSelectionDoc(); - SfxObjectShellRef & GetOrCreateTmpSelectionDoc(); + SfxObjectShellLock & GetTmpSelectionDoc(); + SfxObjectShellLock & GetOrCreateTmpSelectionDoc(); void AddTransferable(SwTransferable& rTransferable); diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index b1fd76c63aff..f653d11f956f 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -1898,16 +1898,16 @@ void SwView::NotifyDBChanged() /* -----------------------------28.10.02 13:25-------------------------------- ---------------------------------------------------------------------------*/ -SfxObjectShellRef & SwView::GetTmpSelectionDoc() +SfxObjectShellLock & SwView::GetTmpSelectionDoc() { return GetViewImpl()->GetTmpSelectionDoc(); } /* -----------------------------31.10.02 13:25-------------------------------- ---------------------------------------------------------------------------*/ -SfxObjectShellRef & SwView::GetOrCreateTmpSelectionDoc() +SfxObjectShellLock & SwView::GetOrCreateTmpSelectionDoc() { - SfxObjectShellRef &rxTmpDoc = GetViewImpl()->GetTmpSelectionDoc(); + SfxObjectShellLock &rxTmpDoc = GetViewImpl()->GetTmpSelectionDoc(); if (!rxTmpDoc.Is()) { SwXTextView *pImpl = GetViewImpl()->GetUNOObject_Impl(); diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index eeab95b5bccd..7c4ee3924a4b 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -2142,14 +2142,15 @@ long SwView::InsertMedium( USHORT nSlotId, SfxMedium* pMedium, INT16 nVersion ) else { SfxObjectShellRef xDocSh; + SfxObjectShellLock xLockRef; -extern int lcl_FindDocShell( SfxObjectShellRef& xDocSh, +extern int lcl_FindDocShell( SfxObjectShellRef& xDocSh, SfxObjectShellLock& xLockRef, const String& rFileName, const String& rPasswd, String& rFilter, INT16 nVersion, SwDocShell* pDestSh ); String sFltNm; - int nRet = lcl_FindDocShell( xDocSh, pMedium->GetName(), aEmptyStr, + int nRet = lcl_FindDocShell( xDocSh, xLockRef, pMedium->GetName(), aEmptyStr, sFltNm, nVersion, pDocSh ); if( nRet ) { diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index 06b9e62b4a94..256d5737f7f5 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -201,6 +201,7 @@ static BOOL LoadFromURL_impl( } else { + // SfxObjectShellRef is ok here, since the document will be explicitly closed SfxObjectShellRef xTmpDocSh = pTmpDocShell; CloseModelAndDocSh( xTmpModel, xTmpDocSh ); } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index b0b95657600c..2dea6feb88c9 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2591,7 +2591,7 @@ SwDoc * SwXTextDocument::GetRenderDoc( const TypeId aSwViewTypeId = TYPE(SwView); if (rpView && rpView->IsA(aSwViewTypeId)) { - SfxObjectShellRef xDocSh(((SwView*)rpView)->GetOrCreateTmpSelectionDoc()); + SfxObjectShellLock xDocSh(((SwView*)rpView)->GetOrCreateTmpSelectionDoc()); if (xDocSh.Is()) { pDoc = ((SwDocShell*)&xDocSh)->GetDoc(); @@ -3170,8 +3170,12 @@ uno::Reference< util::XCloneable > SwXTextDocument::createClone( ) throw (uno:: ::vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw RuntimeException(); - //create a new document - hidden - copy the storage and return it - SfxObjectShell* pShell = pDocShell->GetDoc()->CreateCopy(false); + + // create a new document - hidden - copy the storage and return it + // SfxObjectShellRef is used here, since the model should control object lifetime after creation + // and thus SfxObjectShellLock is not allowed here + // the model holds reference to the shell, so the shell will not destructed at the end of method + SfxObjectShellRef pShell = pDocShell->GetDoc()->CreateCopy(false); uno::Reference< frame::XModel > xNewModel = pShell->GetModel(); uno::Reference< embed::XStorage > xNewStorage = ::comphelper::OStorageHelper::GetTemporaryStorage( ); uno::Sequence< beans::PropertyValue > aTempMediaDescriptor; diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx index c03935464abf..5f533bde3f22 100644 --- a/sw/source/ui/uno/unotxvw.cxx +++ b/sw/source/ui/uno/unotxvw.cxx @@ -903,12 +903,12 @@ void SAL_CALL SwXTextView::setRubyList( /*-- 29.12.02 15:45:29--------------------------------------------------- -----------------------------------------------------------------------*/ -SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc() +SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc() { SwWrtShell& rOldSh = m_pView->GetWrtShell(); SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess()->getPrinter( false ); SwDocShell* pDocSh; - SfxObjectShellRef xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) ); + SfxObjectShellLock xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) ); xDocSh->DoInitNew( 0 ); SwDoc *const pTempDoc( pDocSh->GetDoc() ); // #i103634#, #i112425#: do not expand numbering and fields on PDF export -- cgit From fb8b1341d8acd19fb0c7310bb559b5f70546ecab Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 5 Jan 2011 10:15:25 +0100 Subject: sb135: recreated tests that had erroneously been deleted by CWS gnumake2 --- sw/prj/build.lst | 3 ++ sw/qa/complex/accessibility/makefile.mk | 50 +++++++++++++++++++++++++++++++++ sw/qa/complex/checkColor/makefile.mk | 50 +++++++++++++++++++++++++++++++++ sw/qa/unoapi/makefile.mk | 48 +++++++++++++++++++++++++++++++ 4 files changed, 151 insertions(+) create mode 100644 sw/qa/complex/accessibility/makefile.mk create mode 100644 sw/qa/complex/checkColor/makefile.mk create mode 100644 sw/qa/unoapi/makefile.mk diff --git a/sw/prj/build.lst b/sw/prj/build.lst index 71a6b39a261d..f36b0075b70a 100644 --- a/sw/prj/build.lst +++ b/sw/prj/build.lst @@ -1,2 +1,5 @@ sw sw : filter l10n connectivity OOo:writerperfect vbahelper svx stoc writerfilter LIBXSLT:libxslt NULL sw sw\prj nmake - all sw_prj NULL +sw sw\qa\complex\accessibility nmake - all sw_qa_complex_accessibility NULL +sw sw\qa\complex\checkColor nmake - all sw_qa_complex_checkColor NULL +sw sw\qa\unoapi nmake - all sw_qa_unoapi NULL diff --git a/sw/qa/complex/accessibility/makefile.mk b/sw/qa/complex/accessibility/makefile.mk new file mode 100644 index 000000000000..06e7c6a70408 --- /dev/null +++ b/sw/qa/complex/accessibility/makefile.mk @@ -0,0 +1,50 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + +PRJ = ../../.. +PRJNAME = sw +TARGET = qa_complex_accessibility + +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/accessibility +JAVATESTFILES = AccessibleRelationSet.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END + +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk + +ALLTAR : javatest + +.END diff --git a/sw/qa/complex/checkColor/makefile.mk b/sw/qa/complex/checkColor/makefile.mk new file mode 100644 index 000000000000..e5b368083ada --- /dev/null +++ b/sw/qa/complex/checkColor/makefile.mk @@ -0,0 +1,50 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + +PRJ = ../../.. +PRJNAME = sw +TARGET = qa_complex_checkColor + +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/checkColor +JAVATESTFILES = CheckChangeColor.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END + +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk + +ALLTAR : javatest + +.END diff --git a/sw/qa/unoapi/makefile.mk b/sw/qa/unoapi/makefile.mk new file mode 100644 index 000000000000..f5102c2c9c84 --- /dev/null +++ b/sw/qa/unoapi/makefile.mk @@ -0,0 +1,48 @@ +#************************************************************************* +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +#***********************************************************************/ + +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + +PRJ = ../.. +PRJNAME = sw +TARGET = qa_unoapi + +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = org/openoffice/sw/qa/unoapi +JAVATESTFILES = Test.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END + +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk + +ALLTAR : javatest + +.END -- cgit From cc9a9d52686d3874ed0932eba4a750845860ae3e Mon Sep 17 00:00:00 2001 From: tono Date: Wed, 5 Jan 2011 21:38:47 +0900 Subject: Backed out changeset: e84942bd0aca --- sw/Library_msword.mk | 16 ---------------- sw/Library_sw.mk | 16 ---------------- sw/Library_swd.mk | 13 ------------- sw/Library_swui.mk | 16 ---------------- sw/Library_vbaswobj.mk | 16 ---------------- 5 files changed, 77 deletions(-) diff --git a/sw/Library_msword.mk b/sw/Library_msword.mk index 34a52e4786c7..ee33da85561f 100644 --- a/sw/Library_msword.mk +++ b/sw/Library_msword.mk @@ -114,21 +114,6 @@ $(eval $(call gb_Library_add_exception_objects,msword,\ )) ifeq ($(OS),WNT) -ifneq ($(USE_MINGW),) -$(eval $(call gb_Library_add_linked_libs,msword,\ - mingwthrd \ - $(gb_MINGW_LIBSTDCPP) \ - mingw32 \ - $(gb_MINGW_LIBGCC) \ - uwinapi \ - moldname \ - mingwex \ - advapi32 \ - kernel32 \ - msvcrt \ - user32 \ -)) -else $(eval $(call gb_Library_add_linked_libs,msword,\ advapi32 \ kernel32 \ @@ -138,5 +123,4 @@ $(eval $(call gb_Library_add_linked_libs,msword,\ uwinapi \ )) endif -endif # vim: set noet sw=4 ts=4: diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index e8e127d3ab0f..cc1df51d2dba 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -737,21 +737,6 @@ $(eval $(call gb_Library_add_linked_libs,sw,\ endif ifeq ($(OS),WNT) -ifneq ($(USE_MINGW),) -$(eval $(call gb_Library_add_linked_libs,sw,\ - mingwthrd \ - $(gb_MINGW_LIBSTDCPP) \ - mingw32 \ - $(gb_MINGW_LIBGCC) \ - uwinapi \ - moldname \ - mingwex \ - advapi32 \ - kernel32 \ - msvcrt \ - user32 \ -)) -else $(eval $(call gb_Library_add_linked_libs,sw,\ advapi32 \ kernel32 \ @@ -761,7 +746,6 @@ $(eval $(call gb_Library_add_linked_libs,sw,\ uwinapi \ )) endif -endif $(eval $(call gb_SdiTarget_SdiTarget,sw/sdi/swslots,sw/sdi/swriter)) diff --git a/sw/Library_swd.mk b/sw/Library_swd.mk index 39440092c574..17511d3bf4ed 100644 --- a/sw/Library_swd.mk +++ b/sw/Library_swd.mk @@ -70,23 +70,10 @@ $(eval $(call gb_Library_add_exception_objects,swd,\ sw/source/ui/uno/swdetect \ )) ifeq ($(OS),WNT) -ifneq ($(USE_MINGW),) -$(eval $(call gb_Library_add_linked_libs,swd,\ - mingwthrd \ - $(gb_MINGW_LIBSTDCPP) \ - mingw32 \ - $(gb_MINGW_LIBGCC) \ - uwinapi \ - mingwex \ - kernel32 \ - msvcrt \ -)) -else $(eval $(call gb_Library_add_linked_libs,swd,\ kernel32 \ msvcrt \ uwinapi \ )) endif -endif # vim: set noet sw=4 ts=4: diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk index 927aaab1fd98..12227c9a0ae8 100644 --- a/sw/Library_swui.mk +++ b/sw/Library_swui.mk @@ -167,21 +167,6 @@ $(eval $(call gb_Library_add_exception_objects,swui,\ )) ifeq ($(OS),WNT) -ifneq ($(USE_MINGW),) -$(eval $(call gb_Library_add_linked_libs,swui,\ - mingwthrd \ - $(gb_MINGW_LIBSTDCPP) \ - mingw32 \ - $(gb_MINGW_LIBGCC) \ - uwinapi \ - moldname \ - mingwex \ - advapi32 \ - kernel32 \ - msvcrt \ - user32 \ -)) -else $(eval $(call gb_Library_add_linked_libs,swui,\ advapi32 \ kernel32 \ @@ -191,5 +176,4 @@ $(eval $(call gb_Library_add_linked_libs,swui,\ uwinapi \ )) endif -endif # vim: set noet sw=4 ts=4: diff --git a/sw/Library_vbaswobj.mk b/sw/Library_vbaswobj.mk index 645d383dd8f9..44bbfa8a0c6f 100644 --- a/sw/Library_vbaswobj.mk +++ b/sw/Library_vbaswobj.mk @@ -126,21 +126,6 @@ $(eval $(call gb_Library_set_ldflags,vbaswobj,\ endif ifeq ($(OS),WNT) -ifneq ($(USE_MINGW),) -$(eval $(call gb_Library_add_linked_libs,vbaswobj,\ - mingwthrd \ - $(gb_MINGW_LIBSTDCPP) \ - mingw32 \ - $(gb_MINGW_LIBGCC) \ - uwinapi \ - moldname \ - mingwex \ - advapi32 \ - kernel32 \ - msvcrt \ - user32 \ -)) -else $(eval $(call gb_Library_add_linked_libs,vbaswobj,\ advapi32 \ kernel32 \ @@ -150,5 +135,4 @@ $(eval $(call gb_Library_add_linked_libs,vbaswobj,\ uwinapi \ )) endif -endif # vim: set noet sw=4 ts=4: -- cgit From 4344bf73859ac0583785059dccfe28da081ab821 Mon Sep 17 00:00:00 2001 From: tono Date: Wed, 5 Jan 2011 22:55:15 +0900 Subject: mingwport33: i#116264: gbuild for MinGW --- sw/Library_msword.mk | 16 ++++++++++++++++ sw/Library_sw.mk | 16 ++++++++++++++++ sw/Library_swd.mk | 13 +++++++++++++ sw/Library_swui.mk | 16 ++++++++++++++++ sw/Library_vbaswobj.mk | 16 ++++++++++++++++ 5 files changed, 77 insertions(+) diff --git a/sw/Library_msword.mk b/sw/Library_msword.mk index ee33da85561f..34a52e4786c7 100644 --- a/sw/Library_msword.mk +++ b/sw/Library_msword.mk @@ -114,6 +114,21 @@ $(eval $(call gb_Library_add_exception_objects,msword,\ )) ifeq ($(OS),WNT) +ifneq ($(USE_MINGW),) +$(eval $(call gb_Library_add_linked_libs,msword,\ + mingwthrd \ + $(gb_MINGW_LIBSTDCPP) \ + mingw32 \ + $(gb_MINGW_LIBGCC) \ + uwinapi \ + moldname \ + mingwex \ + advapi32 \ + kernel32 \ + msvcrt \ + user32 \ +)) +else $(eval $(call gb_Library_add_linked_libs,msword,\ advapi32 \ kernel32 \ @@ -123,4 +138,5 @@ $(eval $(call gb_Library_add_linked_libs,msword,\ uwinapi \ )) endif +endif # vim: set noet sw=4 ts=4: diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index cc1df51d2dba..e8e127d3ab0f 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -737,6 +737,21 @@ $(eval $(call gb_Library_add_linked_libs,sw,\ endif ifeq ($(OS),WNT) +ifneq ($(USE_MINGW),) +$(eval $(call gb_Library_add_linked_libs,sw,\ + mingwthrd \ + $(gb_MINGW_LIBSTDCPP) \ + mingw32 \ + $(gb_MINGW_LIBGCC) \ + uwinapi \ + moldname \ + mingwex \ + advapi32 \ + kernel32 \ + msvcrt \ + user32 \ +)) +else $(eval $(call gb_Library_add_linked_libs,sw,\ advapi32 \ kernel32 \ @@ -746,6 +761,7 @@ $(eval $(call gb_Library_add_linked_libs,sw,\ uwinapi \ )) endif +endif $(eval $(call gb_SdiTarget_SdiTarget,sw/sdi/swslots,sw/sdi/swriter)) diff --git a/sw/Library_swd.mk b/sw/Library_swd.mk index 17511d3bf4ed..39440092c574 100644 --- a/sw/Library_swd.mk +++ b/sw/Library_swd.mk @@ -70,10 +70,23 @@ $(eval $(call gb_Library_add_exception_objects,swd,\ sw/source/ui/uno/swdetect \ )) ifeq ($(OS),WNT) +ifneq ($(USE_MINGW),) +$(eval $(call gb_Library_add_linked_libs,swd,\ + mingwthrd \ + $(gb_MINGW_LIBSTDCPP) \ + mingw32 \ + $(gb_MINGW_LIBGCC) \ + uwinapi \ + mingwex \ + kernel32 \ + msvcrt \ +)) +else $(eval $(call gb_Library_add_linked_libs,swd,\ kernel32 \ msvcrt \ uwinapi \ )) endif +endif # vim: set noet sw=4 ts=4: diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk index 12227c9a0ae8..927aaab1fd98 100644 --- a/sw/Library_swui.mk +++ b/sw/Library_swui.mk @@ -167,6 +167,21 @@ $(eval $(call gb_Library_add_exception_objects,swui,\ )) ifeq ($(OS),WNT) +ifneq ($(USE_MINGW),) +$(eval $(call gb_Library_add_linked_libs,swui,\ + mingwthrd \ + $(gb_MINGW_LIBSTDCPP) \ + mingw32 \ + $(gb_MINGW_LIBGCC) \ + uwinapi \ + moldname \ + mingwex \ + advapi32 \ + kernel32 \ + msvcrt \ + user32 \ +)) +else $(eval $(call gb_Library_add_linked_libs,swui,\ advapi32 \ kernel32 \ @@ -176,4 +191,5 @@ $(eval $(call gb_Library_add_linked_libs,swui,\ uwinapi \ )) endif +endif # vim: set noet sw=4 ts=4: diff --git a/sw/Library_vbaswobj.mk b/sw/Library_vbaswobj.mk index 44bbfa8a0c6f..645d383dd8f9 100644 --- a/sw/Library_vbaswobj.mk +++ b/sw/Library_vbaswobj.mk @@ -126,6 +126,21 @@ $(eval $(call gb_Library_set_ldflags,vbaswobj,\ endif ifeq ($(OS),WNT) +ifneq ($(USE_MINGW),) +$(eval $(call gb_Library_add_linked_libs,vbaswobj,\ + mingwthrd \ + $(gb_MINGW_LIBSTDCPP) \ + mingw32 \ + $(gb_MINGW_LIBGCC) \ + uwinapi \ + moldname \ + mingwex \ + advapi32 \ + kernel32 \ + msvcrt \ + user32 \ +)) +else $(eval $(call gb_Library_add_linked_libs,vbaswobj,\ advapi32 \ kernel32 \ @@ -135,4 +150,5 @@ $(eval $(call gb_Library_add_linked_libs,vbaswobj,\ uwinapi \ )) endif +endif # vim: set noet sw=4 ts=4: -- cgit From 02e1029d8c6a1532de630d0dc74e869306a562a1 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 7 Jan 2011 15:19:05 +0100 Subject: fwk162: #i115902# review usage of SfxObjectShellRef, SfxObjecShellLock --- sw/source/ui/dbui/dbmgr.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index d1e370fd87ef..94d7c8c2f057 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -1508,7 +1508,8 @@ ULONG SwNewDBMgr::GetColumnFmt( uno::Reference< XDataSource> xSource, if(!xSource.is()) { uno::Reference xChild(xConnection, UNO_QUERY); - xSource = uno::Reference(xChild->getParent(), UNO_QUERY); + if ( xChild.is() ) + xSource = uno::Reference(xChild->getParent(), UNO_QUERY); } if(xSource.is() && xConnection.is() && xColumn.is() && pNFmtr) { @@ -2876,7 +2877,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, try { // create a target docshell to put the merged document into - SfxObjectShellLock xTargetDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); + SfxObjectShellRef xTargetDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTargetDocShell->DoInitNew( 0 ); SfxViewFrame* pTargetFrame = SfxViewFrame::LoadHiddenDocument( *xTargetDocShell, 0 ); -- cgit