diff options
Diffstat (limited to 'sw')
54 files changed, 372 insertions, 356 deletions
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: diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 57d94bee83f2..7de2ec5f0c55 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -72,6 +72,7 @@ class SwList; #include <com/sun/star/linguistic2/XHyphenatedWord.hpp> #include <vos/ref.hxx> #include <svx/svdtypes.hxx> +#include <sfx2/objsh.hxx> #include <svl/style.hxx> #include <editeng/numitem.hxx> #include "comphelper/implementationreference.hxx" @@ -92,8 +93,6 @@ class SwList; #include <boost/scoped_ptr.hpp> -class SfxObjectShell; -class SfxObjectShellRef; class SvxForbiddenCharactersTable; class SwExtTextInput; class DateTime; @@ -352,9 +351,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 @@ -1789,10 +1787,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/modcfg.hxx b/sw/inc/modcfg.hxx index c5d67217ab2a..89c5a7a1a1be 100644 --- a/sw/inc/modcfg.hxx +++ b/sw/inc/modcfg.hxx @@ -28,7 +28,7 @@ #define _MODOPT_HXX #include <tools/string.hxx> -#include <vcl/wintypes.hxx> +#include <tools/wintypes.hxx> #include <vcl/field.hxx> #include <svl/svarray.hxx> #include <unotools/configitem.hxx> diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index 7a5f1e2847b1..13e8cb3ddbdd 100644..100755 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -659,7 +659,6 @@ #include "unotools/pathoptions.hxx" #include "svl/poolitem.hxx" #include "svtools/prgsbar.hxx" -#include "svtools/printdlg.hxx" #include "svtools/prnsetup.hxx" #include "svl/ptitem.hxx" #include "svl/rectitem.hxx" @@ -913,7 +912,7 @@ #include "vcl/event.hxx" #include "vcl/field.hxx" #include "vcl/fixed.hxx" -#include "vcl/fldunit.hxx" +#include "tools/fldunit.hxx" #include "vcl/font.hxx" #include "unotools/fontcvt.hxx" #include "vcl/graph.hxx" @@ -950,7 +949,7 @@ #include "vcl/virdev.hxx" #include "vcl/waitobj.hxx" #include "vcl/window.hxx" -#include "vcl/wintypes.hxx" +#include "tools/wintypes.hxx" #include "vcl/wrkwin.hxx" #include "vos/mutex.hxx" diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index c8e601143877..da2fc80f33ad 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -28,7 +28,7 @@ #define _SWMODULE_HXX #include <tools/link.hxx> #include <tools/string.hxx> -#include <vcl/fldunit.hxx> +#include <tools/fldunit.hxx> #include <svl/lstner.hxx> #include <unotools/options.hxx> #include <sfx2/module.hxx> 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 <com/sun/star/beans/PropertyChangeEvent.hpp> #include <com/sun/star/text/XMailMergeBroadcaster.hpp> #include <svl/itemprop.hxx> -#include <sfx2/objsh.hxx> // SfxObjectShellRef +#include <sfx2/objsh.hxx> #include <functional> diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index c1fc9014533a..f528652ccd2d 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -255,7 +255,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(); @@ -606,7 +606,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 1f811afd864e..c20eaa55ce12 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -256,7 +256,6 @@ SwDoc::SwDoc() pFtnIdxs( new SwFtnIdxs ), pDocStat( new SwDocStat ), pDocShell( 0 ), - pDocShRef( 0 ), pLinkMgr( new sfx2::LinkManager( 0 ) ), pACEWord( 0 ), pURLStateChgd( 0 ), @@ -1181,15 +1180,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 16673491cfe6..d91506721fb6 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -4403,7 +4403,6 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, } SwDoc* pCpyDoc = (SwDoc*)pSrcTblNd->GetDoc(); - SfxObjectShellRef* pRefForDocSh = 0; BOOL bDelCpyDoc = pCpyDoc == this; if( bDelCpyDoc ) @@ -4411,13 +4410,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; @@ -4431,8 +4427,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(); @@ -4471,7 +4465,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 3e269915c99a..bd517ae0b32a 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1318,9 +1318,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, @@ -1406,7 +1407,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; } @@ -1503,6 +1506,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, RedlineMode_t eOldRedlineMode = nsRedlineMode_t::REDLINE_NONE; SfxObjectShellRef xDocSh; + SfxObjectShellLock xLockRef; int nRet; if( !sFileName.Len() ) { @@ -1511,7 +1515,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 135911f2907c..5c8669691aba 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -936,6 +936,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/printdata.cxx b/sw/source/core/view/printdata.cxx index b54922a1b8e7..bc16348abaee 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -198,8 +198,8 @@ SwPrintUIOptions::SwPrintUIOptions( { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); - DBG_ASSERT( aLocalizedStrings.Count() >= 44, "resource incomplete" ); - if( aLocalizedStrings.Count() < 44 ) // bad resource ? + DBG_ASSERT( aLocalizedStrings.Count() >= 30, "resource incomplete" ); + if( aLocalizedStrings.Count() < 30 ) // bad resource ? return; // printing HTML sources does not have any valid UI options. @@ -226,7 +226,7 @@ SwPrintUIOptions::SwPrintUIOptions( String aAppGroupname( aLocalizedStrings.GetString( 0 ) ); aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), aModOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) ); - m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() ); + m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aAppGroupname, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:TabPage:AppPage" ) ) ); // create sub section for Contents m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() ); @@ -234,79 +234,79 @@ SwPrintUIOptions::SwPrintUIOptions( // create a bool option for background bool bDefaultVal = rDefaultPrintData.IsPrintPageBackground(); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), - aLocalizedStrings.GetString( 3 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPageBackground" ) ), - bDefaultVal ); + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintPageBackground:CheckBox" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPageBackground" ) ), + bDefaultVal ); // create a bool option for pictures/graphics AND OLE and drawing objects as well bDefaultVal = rDefaultPrintData.IsPrintGraphic() || rDefaultPrintData.IsPrintDraw(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), - aLocalizedStrings.GetString( 5 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPicturesAndObjects" ) ), - bDefaultVal ); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 3 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintPicturesAndObjects:CheckBox" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPicturesAndObjects" ) ), + bDefaultVal ); if (!bWeb) { // create a bool option for hidden text bDefaultVal = rDefaultPrintData.IsPrintHiddenText(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ), - aLocalizedStrings.GetString( 7 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), - bDefaultVal ); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintHiddenText:CheckBox" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ), + bDefaultVal ); // create a bool option for place holder bDefaultVal = rDefaultPrintData.IsPrintTextPlaceholder(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ), - aLocalizedStrings.GetString( 9 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTextPlaceholder" ) ), - bDefaultVal ); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 5 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintTextPlaceholder:CheckBox" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTextPlaceholder" ) ), + bDefaultVal ); } // create a bool option for controls bDefaultVal = rDefaultPrintData.IsPrintControl(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), - aLocalizedStrings.GetString( 11 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), - bDefaultVal ); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintControls:CheckBox" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ), + bDefaultVal ); // create sub section for Color - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 12 ), rtl::OUString() ); + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 7 ), rtl::OUString() ); // create a bool option for printing text with black font color bDefaultVal = rDefaultPrintData.IsPrintBlackFont(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), - aLocalizedStrings.GetString( 14 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlackFonts" ) ), - bDefaultVal ); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintBlackFonts:CheckBox" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlackFonts" ) ), + bDefaultVal ); if (!bWeb) { // create subgroup for misc options - m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 15 ) ), rtl::OUString() ); + m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 9 ) ), rtl::OUString() ); // create a bool option for printing automatically inserted blank pages bDefaultVal = rDefaultPrintData.IsPrintEmptyPages(); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 16 ), - aLocalizedStrings.GetString( 17 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), - bDefaultVal ); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintEmptyPages:CheckBox" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ), + bDefaultVal ); } // create a bool option for paper tray bDefaultVal = rDefaultPrintData.IsPaperFromSetup(); vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt; aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) ); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 18 ), - aLocalizedStrings.GetString( 19 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ), - bDefaultVal, - aPaperTrayOpt - ); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 11 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintPaperFromSetup:CheckBox" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ), + bDefaultVal, + aPaperTrayOpt + ); // print range selection vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); aPrintRangeOpt.mbInternalOnly = sal_True; - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 37 ) ), + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 26 ) ), rtl::OUString(), aPrintRangeOpt ); @@ -315,18 +315,18 @@ SwPrintUIOptions::SwPrintUIOptions( rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); uno::Sequence< rtl::OUString > aChoices( 3 ); uno::Sequence< sal_Bool > aChoicesDisabled( 3 ); - uno::Sequence< rtl::OUString > aHelpText( 3 ); - aChoices[0] = aLocalizedStrings.GetString( 38 ); + uno::Sequence< rtl::OUString > aHelpIds( 3 ); + aChoices[0] = aLocalizedStrings.GetString( 27 ); aChoicesDisabled[0] = sal_False; - aHelpText[0] = aLocalizedStrings.GetString( 39 ); - aChoices[1] = aLocalizedStrings.GetString( 40 ); + aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0" ) ); + aChoices[1] = aLocalizedStrings.GetString( 28 ); aChoicesDisabled[1] = sal_False; - aHelpText[1] = aLocalizedStrings.GetString( 41 ); - aChoices[2] = aLocalizedStrings.GetString( 42 ); + aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1" ) ); + aChoices[2] = aLocalizedStrings.GetString( 29 ); aChoicesDisabled[2] = sal_Bool(! bHasSelection); - aHelpText[2] = aLocalizedStrings.GetString( 43 ); + aHelpIds[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:2" ) ); m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(), - aHelpText, + aHelpIds, aPrintRangeName, aChoices, bHasSelection ? 2 /*enable 'Selection' radio button*/ : 0 /* enable 'All pages' */, @@ -336,7 +336,7 @@ SwPrintUIOptions::SwPrintUIOptions( // create a an Edit dependent on "Pages" selected vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True ); m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(), - rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PageRange:Edit" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), rtl::OUString(), aPageRangeOpt @@ -344,31 +344,31 @@ SwPrintUIOptions::SwPrintUIOptions( // print content selection vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt; aContentsOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) ); - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 20 ) ), + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 12 ) ), rtl::OUString(), aContentsOpt ); // create a list box for notes content const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts(); aChoices.realloc( 4 ); - aChoices[0] = aLocalizedStrings.GetString( 21 ); - aChoices[1] = aLocalizedStrings.GetString( 22 ); - aChoices[2] = aLocalizedStrings.GetString( 23 ); - aChoices[3] = aLocalizedStrings.GetString( 24 ); - aHelpText.realloc( 2 ); - aHelpText[0] = aLocalizedStrings.GetString( 25 ); - aHelpText[1] = aLocalizedStrings.GetString( 25 ); + aChoices[0] = aLocalizedStrings.GetString( 13 ); + aChoices[1] = aLocalizedStrings.GetString( 14 ); + aChoices[2] = aLocalizedStrings.GetString( 15 ); + aChoices[3] = aLocalizedStrings.GetString( 16 ); + aHelpIds.realloc( 2 ); + aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintAnnotationMode:FixedText" ) ); + aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintAnnotationMode:ListBox" ) ); vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), 0, sal_False ); aAnnotOpt.mbEnabled = bHasPostIts; - m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ), - aHelpText, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ), - aChoices, - nPrintPostIts, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), - uno::Sequence< sal_Bool >(), - aAnnotOpt - ); + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 17 ), + aHelpIds, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ), + aChoices, + nPrintPostIts, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), + uno::Sequence< sal_Bool >(), + aAnnotOpt + ); // create subsection for Page settings vcl::PrinterOptionsHelper::UIControlOptions aPageSetOpt; @@ -376,16 +376,16 @@ SwPrintUIOptions::SwPrintUIOptions( if (!bWeb) { - m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 27 ) ), + m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 18 ) ), rtl::OUString(), aPageSetOpt ); uno::Sequence< rtl::OUString > aRLChoices( 3 ); - aRLChoices[0] = aLocalizedStrings.GetString( 28 ); - aRLChoices[1] = aLocalizedStrings.GetString( 29 ); - aRLChoices[2] = aLocalizedStrings.GetString( 30 ); + aRLChoices[0] = aLocalizedStrings.GetString( 19 ); + aRLChoices[1] = aLocalizedStrings.GetString( 20 ); + aRLChoices[2] = aLocalizedStrings.GetString( 21 ); uno::Sequence< rtl::OUString > aRLHelp( 1 ); - aRLHelp[0] = aLocalizedStrings.GetString( 31 ); + aRLHelp[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintLeftRightPages:ListBox" ) ); // create a choice option for all/left/right pages // 0 : all pages (left & right) // 1 : left pages @@ -397,7 +397,7 @@ SwPrintUIOptions::SwPrintUIOptions( nPagesChoice = 1; else if (!rDefaultPrintData.IsPrintLeftPage() && rDefaultPrintData.IsPrintRightPage()) nPagesChoice = 2; - m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 32 ), + m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 22 ), aRLHelp, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftRightPages" ) ), aRLChoices, @@ -409,27 +409,29 @@ SwPrintUIOptions::SwPrintUIOptions( // create a bool option for brochure bDefaultVal = rDefaultPrintData.IsPrintProspect(); rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ); - m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 33 ), - aLocalizedStrings.GetString( 34 ), - aBrochurePropertyName, - bDefaultVal, - aPageSetOpt - ); + m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 23 ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintProspect:CheckBox" ) ), + aBrochurePropertyName, + bDefaultVal, + aPageSetOpt + ); if (bCTL) { // create a bool option for brochure RTL dependent on brochure uno::Sequence< rtl::OUString > aBRTLChoices( 2 ); - aBRTLChoices[0] = aLocalizedStrings.GetString( 35 ); - aBRTLChoices[1] = aLocalizedStrings.GetString( 36 ); + aBRTLChoices[0] = aLocalizedStrings.GetString( 24 ); + aBRTLChoices[1] = aLocalizedStrings.GetString( 25 ); vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True ); + uno::Sequence< rtl::OUString > aBRTLHelpIds( 1 ); + aBRTLHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintProspectRTL:ListBox" ) ); aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); // RTL brochure choices // 0 : left-to-right // 1 : right-to-left const sal_Int16 nBRTLChoice = rDefaultPrintData.IsPrintProspectRTL() ? 1 : 0; m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(), - uno::Sequence< rtl::OUString >(), + aBRTLHelpIds, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectRTL" ) ), aBRTLChoices, nBRTLChoice, diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 3be3009c2d19..271ca4e4c463 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -444,8 +444,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 ); @@ -504,10 +504,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/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index 282551474e36..64a261fc8ba0 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -54,6 +54,8 @@ #include <mdiexp.hxx> // ...Percent() #include <poolfmt.hxx> +#include "vcl/metric.hxx" + #define ASC_BUFFLEN 4096 class SwASCIIParser @@ -129,24 +131,14 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn, } if( rOpt.GetFontName().Len() ) { - bool bDelete = false; - const SfxFont* pFnt = 0; + Font aTextFont( rOpt.GetFontName(), Size( 0, 10 ) ); if( pDoc->getPrinter( false ) ) - pFnt = pDoc->getPrinter( false )->GetFontByName( rOpt.GetFontName() ); - - if( !pFnt ) - { - pFnt = new SfxFont( FAMILY_DONTKNOW, rOpt.GetFontName() ); - bDelete = true; - } - SvxFontItem aFont( pFnt->GetFamily(), pFnt->GetName(), - aEmptyStr, pFnt->GetPitch(), pFnt->GetCharSet(), RES_CHRATR_FONT ); + aTextFont = pDoc->getPrinter( false )->GetFontMetric( aTextFont ); + SvxFontItem aFont( aTextFont.GetFamily(), aTextFont.GetName(), + aEmptyStr, aTextFont.GetPitch(), aTextFont.GetCharSet(), RES_CHRATR_FONT ); pItemSet->Put( aFont ); pItemSet->Put( aFont, RES_CHRATR_CJK_FONT ); pItemSet->Put( aFont, RES_CHRATR_CTL_FONT ); - - if( bDelete ) - delete (SfxFont*)pFnt; } } diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 5fe201cf1a8b..80ed9630318c 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -537,7 +537,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(); @@ -813,15 +813,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. @@ -979,7 +976,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/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 0a6151b98388..0ab613730948 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -32,7 +32,7 @@ #include "wrtww8.hxx" #include "ww8par.hxx" -#include <oox/core/tokens.hxx> +#include <oox/token/tokens.hxx> #include <oox/export/drawingml.hxx> #include <oox/export/utils.hxx> #include <oox/export/vmlexport.hxx> @@ -128,6 +128,7 @@ using rtl::OUString; using rtl::OUStringBuffer; using rtl::OUStringToOString; +using namespace oox; using namespace docx; using namespace sax_fastparser; using namespace nsSwDocInfoSubType; diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 35c126cd6571..a4b5fb3a9514 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -32,7 +32,7 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/i18n/ScriptType.hdl> -#include <oox/core/tokens.hxx> +#include <oox/token/tokens.hxx> #include <oox/export/drawingml.hxx> #include <oox/export/vmlexport.hxx> @@ -62,6 +62,7 @@ using namespace ::comphelper; using namespace ::com::sun::star; +using namespace ::oox; using oox::vml::VMLExport; diff --git a/sw/source/filter/ww8/docxfootnotes.hxx b/sw/source/filter/ww8/docxfootnotes.hxx index b9d49f78f560..ec91731bc6dd 100644 --- a/sw/source/filter/ww8/docxfootnotes.hxx +++ b/sw/source/filter/ww8/docxfootnotes.hxx @@ -30,7 +30,6 @@ #include <fmtftn.hxx> -#include <oox/core/tokens.hxx> #include <rtl/string.hxx> #include <rtl/ustring.hxx> #include <sax/fshelper.hxx> 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/filter/xml/xmliteme.cxx b/sw/source/filter/xml/xmliteme.cxx index 5645891c5b3c..05c30ce7b496 100644 --- a/sw/source/filter/xml/xmliteme.cxx +++ b/sw/source/filter/xml/xmliteme.cxx @@ -40,7 +40,7 @@ #include "xmlbrshe.hxx" #include <editeng/tstpitem.hxx> #include <editeng/brshitem.hxx> -#include <vcl/fldunit.hxx> +#include <tools/fldunit.hxx> #include <swmodule.hxx> #include <doc.hxx> #include "fmtornt.hxx" 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 1badfbe6dda1..8e939c88fd37 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -962,7 +962,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 b480b0f7d175..c1704f21d0f0 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -469,7 +469,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 ); @@ -702,25 +704,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 34125c7829ee..263e3274972b 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -1001,7 +1001,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/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index 98fe7316ecd5..d4b15b7febd0 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -210,21 +210,15 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) if(!pStdFont->IsFontDefault(nFontId)) { sEntry = pStdFont->GetFontFor(nFontId); - sal_Bool bDelete = sal_False; - const SfxFont* pFnt = pPrt ? pPrt->GetFontByName(sEntry): 0; - if(!pFnt) - { - pFnt = new SfxFont( FAMILY_DONTKNOW, sEntry, PITCH_DONTKNOW, - ::gsl_getSystemTextEncoding() ); - bDelete = sal_True; - } - pFontItem = new SvxFontItem(pFnt->GetFamily(), pFnt->GetName(), - aEmptyStr, pFnt->GetPitch(), pFnt->GetCharSet(), nFontWhich); - if(bDelete) + + Font aFont( sEntry, Size( 0, 10 ) ); + if( pPrt ) { - delete (SfxFont*) pFnt; - bDelete = sal_False; + aFont = pPrt->GetFontMetric( aFont ); } + + pFontItem = new SvxFontItem(aFont.GetFamily(), aFont.GetName(), + aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich); } else { @@ -303,25 +297,18 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) if(!pStdFont->IsFontDefault(aFontIdPoolId[nIdx])) { sEntry = pStdFont->GetFontFor(aFontIdPoolId[nIdx]); - sal_Bool bDelete = sal_False; - const SfxFont* pFnt = pPrt ? pPrt->GetFontByName(sEntry): 0; - if(!pFnt) - { - pFnt = new SfxFont( FAMILY_DONTKNOW, sEntry, PITCH_DONTKNOW, - ::gsl_getSystemTextEncoding() ); - bDelete = sal_True; - } + + Font aFont( sEntry, Size( 0, 10 ) ); + if( pPrt ) + aFont = pPrt->GetFontMetric( aFont ); + pColl = pDoc->GetTxtCollFromPool(aFontIdPoolId[nIdx + 1]); if( !bHTMLTemplSet || SFX_ITEM_SET != pColl->GetAttrSet().GetItemState( nFontWhich, sal_False ) ) { - pColl->SetFmtAttr(SvxFontItem(pFnt->GetFamily(), pFnt->GetName(), - aEmptyStr, pFnt->GetPitch(), pFnt->GetCharSet(), nFontWhich)); - } - if(bDelete) - { - delete (SfxFont*) pFnt; + pColl->SetFmtAttr(SvxFontItem(aFont.GetFamily(), aFont.GetName(), + aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich)); } } sal_Int32 nFontHeight = pStdFont->GetFontHeight( static_cast< sal_Int8 >(aFontIdPoolId[nIdx]), 0, eLanguage ); diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 0f0eddc5d9ed..400b3439b795 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -1035,7 +1035,6 @@ TabPage TP_OPTSHDWCRSR }; }; - StringArray STR_PRINTOPTUI { ItemList [en-US] = @@ -1043,47 +1042,33 @@ StringArray STR_PRINTOPTUI < "%PRODUCTNAME %s"; >; < "Contents"; >; < "Page ba~ckground"; >; - < "Specifies whether to include colors and objects that are inserted to the background of the page (Format - Page - Background) in the printed document."; >; < "P~ictures and other graphic objects"; >; - < "Specifies whether the graphics and drawing or OLE objects of your text document are printed"; >; < "Hidden te~xt"; >; - < "Enable this option to print text that is marked as hidden."; >; < "~Text placeholders"; >; - < "Enable this option to print text placeholders. Disable this option to leave the text placeholders blank in the printout."; >; < "Form control~s"; >; - < "Specifies whether the form control fields of the text document are printed"; >; < "Color"; >; < "Print text in blac~k"; >; - < "Specifies whether to always print text in black."; >; < "Pages"; >; < "Print ~automatically inserted blank pages"; >; - < "If this option is enabled automatically inserted blank pages are printed. This is best if you are printing double-sided. For example, in a book, a \"chapter\" paragraph style has been set to always start with an odd numbered page. If the previous chapter ends on an odd page, %PRODUCTNAME inserts an even numbered blank page. This option controls whether to print that even numbered page or not"; >; < "~Use only paper tray from printer preferences"; >; - < "For printers with multiple trays this option specifies whether the paper tray used is specified by the system settings of the printer."; >; < "Print"; >; < "None (document only)"; >; < "Comments only"; >; < "Place at end of document"; >; < "Place at end of page"; >; - < "Specify where to print comments (if any)."; >; < "~Comments"; >; < "Page sides";>; < "All pages"; >; < "Back sides / left pages"; >; < "Front sides / right pages"; >; - < "Specify which pages to include in the output"; >; < "Include"; >; < "Broch~ure"; >; - < "Select the Brochure option to print the document in brochure format."; >; < "Left-to-right script"; >; < "Right-to-left script"; >; < "Range and copies"; >; < "~All pages"; >; - < "Print the whole document."; >; < "Pa~ges"; >; - < "Print a range of pages of the document."; >; < "~Selection"; >; - < "Print only the selected parts of the document"; >; }; }; diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 6e6ed773a33d..01ef0a4f7500 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -726,20 +726,12 @@ void lcl_SetColl(SwWrtShell* pWrtShell, USHORT nType, SfxPrinter* pPrt, const String& rStyle, USHORT nFontWhich) { - BOOL bDelete = FALSE; - const SfxFont* pFnt = pPrt ? pPrt->GetFontByName(rStyle): 0; - if(!pFnt) - { - pFnt = new SfxFont(FAMILY_DONTKNOW, rStyle); - bDelete = TRUE; - } + Font aFont( rStyle, Size( 0, 10 ) ); + if( pPrt ) + aFont = pPrt->GetFontMetric( aFont ); SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(nType); - pColl->SetFmtAttr(SvxFontItem(pFnt->GetFamily(), pFnt->GetName(), - aEmptyStr, pFnt->GetPitch(), pFnt->GetCharSet(), nFontWhich)); - if(bDelete) - { - delete (SfxFont*) pFnt; - } + pColl->SetFmtAttr(SvxFontItem(aFont.GetFamily(), aFont.GetName(), + aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich)); } /*-- 11.10.2005 15:47:52--------------------------------------------------- @@ -822,22 +814,13 @@ BOOL SwStdFontTabPage::FillItemSet( SfxItemSet& ) FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONTSIZE : RES_CHRATR_CTL_FONTSIZE); if(sStandard != sShellStd) { - BOOL bDelete = FALSE; - const SfxFont* pFnt = pPrinter ? pPrinter->GetFontByName(sStandard): 0; - if(!pFnt) - { - pFnt = new SfxFont(FAMILY_DONTKNOW, sStandard); - bDelete = TRUE; - } - pWrtShell->SetDefault(SvxFontItem(pFnt->GetFamily(), pFnt->GetName(), - aEmptyStr, pFnt->GetPitch(), pFnt->GetCharSet(), nFontWhich)); + Font aFont( sStandard, Size( 0, 10 ) ); + if( pPrinter ) + aFont = pPrinter->GetFontMetric( aFont ); + pWrtShell->SetDefault(SvxFontItem(aFont.GetFamily(), aFont.GetName(), + aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich)); SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD); pColl->ResetFmtAttr(nFontWhich); - if(bDelete) - { - delete (SfxFont*) pFnt; - bDelete = FALSE; - } // lcl_SetColl(pWrtShell, RES_POOLCOLL_STANDARD, pPrinter, sStandard); bMod = TRUE; } @@ -943,15 +926,24 @@ void SwStdFontTabPage::Reset( const SfxItemSet& rSet) // #i94536# prevent duplication of font entries when 'reset' button is pressed if( !aStandardBox.GetEntryCount() ) { - const USHORT nCount = pPrt->GetFontCount(); - for (USHORT i = 0; i < nCount; ++i) + // get the set of disctinct available family names + std::set< String > aFontNames; + int nFontNames = pPrt->GetDevFontCount(); + for( int i = 0; i < nFontNames; i++ ) + { + FontInfo aInf( pPrt->GetDevFont( i ) ); + aFontNames.insert( aInf.GetName() ); + } + + // insert to listboxes + for( std::set< String >::const_iterator it = aFontNames.begin(); + it != aFontNames.end(); ++it ) { - const String &rString = pPrt->GetFont(i)->GetName(); - aStandardBox.InsertEntry( rString ); - aTitleBox .InsertEntry( rString ); - aListBox .InsertEntry( rString ); - aLabelBox .InsertEntry( rString ); - aIdxBox .InsertEntry( rString ); + aStandardBox.InsertEntry( *it ); + aTitleBox .InsertEntry( *it ); + aListBox .InsertEntry( *it ); + aLabelBox .InsertEntry( *it ); + aIdxBox .InsertEntry( *it ); } } if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_STDFONTS, FALSE, &pItem)) diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index e8633e3e3806..85e0198ac70f 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 ); @@ -1503,7 +1508,8 @@ ULONG SwNewDBMgr::GetColumnFmt( uno::Reference< XDataSource> xSource, if(!xSource.is()) { uno::Reference<XChild> xChild(xConnection, UNO_QUERY); - xSource = uno::Reference<XDataSource>(xChild->getParent(), UNO_QUERY); + if ( xChild.is() ) + xSource = uno::Reference<XDataSource>(xChild->getParent(), UNO_QUERY); } if(xSource.is() && xConnection.is() && xColumn.is() && pNFmtr) { @@ -2543,6 +2549,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 +2580,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) ) @@ -2916,7 +2925,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 ee2803e73aad..943e21adee34 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(); @@ -1271,7 +1272,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/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index 355e68bd5c58..4cab48e79d8a 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -58,6 +58,8 @@ #include <ascfldlg.hrc> #endif +#include "vcl/metric.hxx" + using namespace ::com::sun::star; @@ -180,11 +182,21 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, bDelPrinter = TRUE; } - const USHORT nCount = pPrt->GetFontCount(); - for (USHORT i = 0; i < nCount; ++i) + + // get the set of disctinct available family names + std::set< String > aFontNames; + int nFontNames = pPrt->GetDevFontCount(); + for( int i = 0; i < nFontNames; i++ ) + { + FontInfo aInf( pPrt->GetDevFont( i ) ); + aFontNames.insert( aInf.GetName() ); + } + + // insert to listbox + for( std::set< String >::const_iterator it = aFontNames.begin(); + it != aFontNames.end(); ++it ) { - const String &rStr = pPrt->GetFont(i)->GetName(); - aFontLB.InsertEntry( rStr ); + aFontLB.InsertEntry( *it ); } if( !aOpt.GetFontName().Len() ) diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index c43979225d31..23f7741969ce 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/pview.hxx b/sw/source/ui/inc/pview.hxx index d0d8f2cb804a..2b1c9366707e 100644 --- a/sw/source/ui/inc/pview.hxx +++ b/sw/source/ui/inc/pview.hxx @@ -223,7 +223,6 @@ class SW_DLLPUBLIC SwPagePreView: public SfxViewShell SW_DLLPRIVATE virtual USHORT SetPrinter( SfxPrinter *pNewPrinter, USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ); SW_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ); - SW_DLLPRIVATE virtual PrintDialog* CreatePrintDialog( Window *pParent ); SW_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill, BOOL bInner ); 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/uitool.hxx b/sw/source/ui/inc/uitool.hxx index e48f78f9aa96..c3dfd0f07b2a 100644 --- a/sw/source/ui/inc/uitool.hxx +++ b/sw/source/ui/inc/uitool.hxx @@ -27,7 +27,7 @@ #ifndef _UITOOL_HXX #define _UITOOL_HXX -#include <vcl/wintypes.hxx> +#include <tools/wintypes.hxx> #include <vcl/field.hxx> #include <swtypes.hxx> #include "swdllapi.h" 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/usrpref.hxx b/sw/source/ui/inc/usrpref.hxx index 0758f89af8bf..854b12d4f40e 100644 --- a/sw/source/ui/inc/usrpref.hxx +++ b/sw/source/ui/inc/usrpref.hxx @@ -32,7 +32,7 @@ #include <unotools/configitem.hxx> #include <fldupde.hxx> #include "viewopt.hxx" -#include <vcl/fldunit.hxx> +#include <tools/fldunit.hxx> /* -----------------------------28.09.00 09:45-------------------------------- diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index 78817eec874c..a462cd1deb6d 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -32,7 +32,7 @@ #include <svtools/htmlcfg.hxx> #include <sfx2/viewfac.hxx> #include <sfx2/viewsh.hxx> -#include <sfx2/objsh.hxx> // SfxObjectShellRef <-> SV_DECL_REF(SfxObjectShell) +#include <sfx2/objsh.hxx> #include <editeng/svxenum.hxx> #include <svx/zoomitem.hxx> #include <editeng/editstat.hxx> @@ -57,7 +57,6 @@ class SvxRuler; class SvxLRSpaceItem; class SwDocShell; class SwScrollbar; -class PrintDialog; class SvxVCBrowser; class SvBorder; class Ruler; @@ -355,7 +354,6 @@ class SW_DLLPUBLIC SwView: public SfxViewShell // Methoden fuers Printing SW_DLLPRIVATE virtual SfxPrinter* GetPrinter( BOOL bCreate = FALSE ); - SW_DLLPRIVATE virtual PrintDialog* CreatePrintDialog( Window* pParent ); SfxTabPage* CreatePrintOptionsPage( Window* pParent, const SfxItemSet& rSet); // fuer Readonly-Umschaltung @@ -643,8 +641,8 @@ public: void NotifyDBChanged(); - SfxObjectShellRef & GetTmpSelectionDoc(); - SfxObjectShellRef & GetOrCreateTmpSelectionDoc(); + SfxObjectShellLock & GetTmpSelectionDoc(); + SfxObjectShellLock & GetOrCreateTmpSelectionDoc(); void AddTransferable(SwTransferable& rTransferable); diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index addf6f9db512..fd5d57ae35c0 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -35,7 +35,6 @@ #include <vcl/help.hxx> #include <vcl/cmdevt.hxx> #include <vcl/button.hxx> -#include <svtools/printdlg.hxx> #include <svl/whiter.hxx> #include <svl/stritem.hxx> #include <svl/eitem.hxx> @@ -1985,18 +1984,6 @@ SfxTabPage* SwPagePreView::CreatePrintOptionsPage( Window *pParent, --------------------------------------------------------------------*/ -PrintDialog* SwPagePreView::CreatePrintDialog( Window *pParent ) -{ - PrintDialog *pDlg = ::CreatePrintDialog( pParent, 1, 0 ); - pDlg->DisableRange( PRINTDIALOG_SELECTION ); - return pDlg; -} - -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - - // OD 18.12.2002 #103492# - no longer needed ?? Size SwPagePreView::GetOptimalSizePixel() const { diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index ff279510f978..2c4a556f6bca 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -39,7 +39,6 @@ #include <svl/eitem.hxx> #include <unotools/undoopt.hxx> #include <unotools/lingucfg.hxx> -#include <svtools/printdlg.hxx> #include <unotools/useroptions.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> @@ -183,7 +182,7 @@ void SwView::ImpSetVerb( int nSelType ) } if ( bResetVerbs ) { - SetVerbs( 0 ); + SetVerbs( Sequence< embed::VerbDescriptor >() ); bVerbsActive = sal_False; } } @@ -1896,16 +1895,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 fd3ac1544b6b..960478c925dd 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -2144,14 +2144,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/uiview/viewfunc.hxx b/sw/source/ui/uiview/viewfunc.hxx index f04db152ec2f..6da6c01bbda4 100644 --- a/sw/source/ui/uiview/viewfunc.hxx +++ b/sw/source/ui/uiview/viewfunc.hxx @@ -30,7 +30,6 @@ class ImageButton; class Point; -class PrintDialog; class SfxItemSet; class SfxPrinter; class SfxTabPage; @@ -42,7 +41,6 @@ class Window; class SwWrtShell; // folgende Funktionen stehen im viewprt.cxx -PrintDialog* CreatePrintDialog( Window* , USHORT, SwWrtShell* ); void SetPrinter( IDocumentDeviceAccess*, SfxPrinter*, BOOL bWeb ); SfxTabPage* CreatePrintOptionsPage( Window*, const SfxItemSet& ); void SetAppPrintOptions( ViewShell* pSh, BOOL bWeb ); diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index 7ddc594dd223..3fdc6f6d61d3 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -49,7 +49,6 @@ #include <svl/flagitem.hxx> #include <vcl/msgbox.hxx> #include <vcl/oldprintadaptor.hxx> -#include <svtools/printdlg.hxx> #include <sfx2/printer.hxx> #include <sfx2/prnmon.hxx> #include <editeng/paperinf.hxx> @@ -183,42 +182,6 @@ SfxTabPage* __EXPORT SwView::CreatePrintOptionsPage(Window* pParent, } /*-------------------------------------------------------------------- - Beschreibung: Druckerdialog - --------------------------------------------------------------------*/ - -PrintDialog* CreatePrintDialog( Window* pParent, USHORT nPg, SwWrtShell* pSh ) -{ - PrintDialog *pDlg = new PrintDialog( pParent, false ); -// pDlg->ChangeFirstPage( 1 ); - - if ( !nPg ) - nPg = 1; -// pDlg->ChangeLastPage( nPg ); -// pDlg->ChangeMaxPage( 9999 ); - pDlg->EnableRange( PRINTDIALOG_FROMTO ); - - if (pSh && (pSh->IsSelection() || pSh->IsFrmSelected() || pSh->IsObjSelected())) - pDlg->EnableRange( PRINTDIALOG_SELECTION ); - - pDlg->SetRangeText( String::CreateFromInt32(nPg) ); - pDlg->EnableRange( PRINTDIALOG_RANGE ); - pDlg->EnableCollate(); - return pDlg; -} - -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - -PrintDialog* __EXPORT SwView::CreatePrintDialog( Window* pParent ) -{ - // AMA: Hier sollte vielleicht die virtuelle Seitennummer angezeigt werden, - // aber nur, wenn das Drucken virtuelle Seitennummern und nicht wie - // bisher (auch beim SWG 2.0) physikalische beachtet werden. - return ::CreatePrintDialog( pParent, GetWrtShell().GetPhyPageNum(), &GetWrtShell() ); -} - -/*-------------------------------------------------------------------- Beschreibung: Print-Dispatcher --------------------------------------------------------------------*/ 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 diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index 1402286d3c67..60b9821c15ba 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/util/XModifiable.hpp> #if STLPORT_VERSION>=321 #include <math.h> // prevent conflict between exception and std::exception @@ -603,6 +604,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); |