summaryrefslogtreecommitdiff
path: root/sw/source/uibase/app/docsh2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/app/docsh2.cxx')
-rw-r--r--sw/source/uibase/app/docsh2.cxx447
1 files changed, 247 insertions, 200 deletions
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index e916c877304d..0261e30952ee 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -19,11 +19,14 @@
#include <config_features.h>
+#include <osl/diagnose.h>
#include <com/sun/star/drawing/ModuleDispatcher.hpp>
#include <com/sun/star/frame/DispatchHelper.hpp>
#include <ooo/vba/word/XDocument.hpp>
#include <comphelper/fileformat.h>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertyvalue.hxx>
+#include <comphelper/string.hxx>
#include <sal/log.hxx>
#include <edtwin.hxx>
@@ -35,7 +38,6 @@
#include <vcl/weld.hxx>
#include <svl/eitem.hxx>
#include <svl/macitem.hxx>
-#include <svl/zforlist.hxx>
#include <unotools/pathoptions.hxx>
#include <vcl/transfer.hxx>
#include <sfx2/dinfdlg.hxx>
@@ -56,7 +58,6 @@
#include <sfx2/classificationhelper.hxx>
#include <sfx2/watermarkitem.hxx>
-#include <svtools/htmlcfg.hxx>
#include <svx/ofaitem.hxx>
#include <SwSmartTagMgr.hxx>
#include <sfx2/app.hxx>
@@ -64,10 +65,12 @@
#include <basic/basmgr.hxx>
#include <comphelper/classids.hxx>
#include <fmtcol.hxx>
+#include <istype.hxx>
#include <view.hxx>
#include <docsh.hxx>
#include <docary.hxx>
#include <wrtsh.hxx>
+#include <rootfrm.hxx>
#include <fldbas.hxx>
#include <viewopt.hxx>
#include <globdoc.hxx>
@@ -107,6 +110,7 @@
#include <com/sun/star/script/vba/VBAEventId.hpp>
#include <editeng/acorrcfg.hxx>
#include <officecfg/Office/Security.hxx>
+#include <officecfg/Office/Common.hxx>
#include <sfx2/fcontnr.hxx>
#include <svx/ClassificationDialog.hxx>
@@ -121,7 +125,6 @@
#include <memory>
using namespace ::com::sun::star::ui::dialogs;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
using namespace ::sfx2;
@@ -157,14 +160,14 @@ void SwDocShell::ToggleLayoutMode(SwView* pView)
GetDoc()->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, rViewOptions.getBrowseMode());
UpdateFontList(); // Why is this necessary here?
- pView->GetViewFrame()->GetBindings().Invalidate(FN_SHADOWCURSOR);
+ pView->GetViewFrame().GetBindings().Invalidate(FN_SHADOWCURSOR);
if( !GetDoc()->getIDocumentDeviceAccess().getPrinter( false ) )
pView->SetPrinter( GetDoc()->getIDocumentDeviceAccess().getPrinter( false ), SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP );
GetDoc()->CheckDefaultPageFormat();
SfxViewFrame *pTmpFrame = SfxViewFrame::GetFirst(this, false);
while (pTmpFrame)
{
- if( pTmpFrame != pView->GetViewFrame() )
+ if( pTmpFrame != &pView->GetViewFrame() )
{
pTmpFrame->DoClose();
pTmpFrame = SfxViewFrame::GetFirst(this, false);
@@ -209,18 +212,19 @@ void SwDocShell::DoFlushDocInfo()
static void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVBAEventProcessor >& xVbaEvents, const SfxHint& rHint )
{
using namespace com::sun::star::script::vba::VBAEventId;
- const SfxEventHint* pSfxEventHint = dynamic_cast<const SfxEventHint*>(&rHint);
- if ( !pSfxEventHint )
+ if (rHint.GetId() != SfxHintId::ThisIsAnSfxEventHint)
return;
uno::Sequence< uno::Any > aArgs;
- switch( pSfxEventHint->GetEventId() )
+ switch (static_cast<const SfxEventHint&>(rHint).GetEventId())
{
case SfxEventHintId::CreateDoc:
- xVbaEvents->processVbaEvent( DOCUMENT_NEW, aArgs );
+ xVbaEvents->processVbaEvent(AUTO_NEW, aArgs);
+ xVbaEvents->processVbaEvent(DOCUMENT_NEW, aArgs);
break;
case SfxEventHintId::OpenDoc:
- xVbaEvents->processVbaEvent( DOCUMENT_OPEN, aArgs );
+ xVbaEvents->processVbaEvent(AUTO_OPEN, aArgs);
+ xVbaEvents->processVbaEvent(DOCUMENT_OPEN, aArgs);
break;
default: break;
}
@@ -239,9 +243,9 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
if( xVbaEvents.is() )
lcl_processCompatibleSfxHint( xVbaEvents, rHint );
- if ( const SfxEventHint* pSfxEventHint = dynamic_cast<const SfxEventHint*>(&rHint) )
+ if (rHint.GetId() == SfxHintId::ThisIsAnSfxEventHint)
{
- switch( pSfxEventHint->GetEventId() )
+ switch (static_cast<const SfxEventHint&>(rHint).GetEventId())
{
case SfxEventHintId::ActivateDoc:
case SfxEventHintId::CreateDoc:
@@ -255,14 +259,13 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
break;
}
- switch( pSfxEventHint->GetEventId() )
+ switch (static_cast<const SfxEventHint&>(rHint).GetEventId())
{
case SfxEventHintId::CreateDoc:
{
uno::Any aDocument;
aDocument <<= mxAutomationDocumentObject;
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[0] = aDocument;
+ uno::Sequence< uno::Any > aArgs{ aDocument };
SW_MOD()->CallAutomationApplicationEventSinks( "NewDocument", aArgs );
}
break;
@@ -270,8 +273,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
uno::Any aDocument;
aDocument <<= mxAutomationDocumentObject;
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[0] = aDocument;
+ uno::Sequence< uno::Any > aArgs{ aDocument };
SW_MOD()->CallAutomationApplicationEventSinks( "DocumentOpen", aArgs );
}
break;
@@ -281,8 +283,8 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
sal_uInt16 nAction = 0;
- auto pEventHint = dynamic_cast<const SfxEventHint*>(&rHint);
- if( pEventHint && pEventHint->GetEventId() == SfxEventHintId::LoadFinished )
+ if (rHint.GetId() == SfxHintId::ThisIsAnSfxEventHint &&
+ static_cast<const SfxEventHint&>(rHint).GetEventId() == SfxEventHintId::LoadFinished)
{
// #i38126# - own action id
nAction = 3;
@@ -357,11 +359,11 @@ bool SwDocShell::PrepareClose( bool bUI )
uno::Any aDocument;
aDocument <<= mxAutomationDocumentObject;
- uno::Sequence< uno::Any > aArgs(2);
- // Arg 0: Document
- aArgs[0] = aDocument;
- // Arg 1: Cancel
- aArgs[1] <<= false;
+ uno::Sequence<uno::Any> aArgs{ // Arg 0: Document
+ aDocument,
+ // Arg 1: Cancel
+ uno::Any(false)
+ };
SW_MOD()->CallAutomationApplicationEventSinks( "DocumentBeforeClose", aArgs );
@@ -383,7 +385,8 @@ bool SwDocShell::PrepareClose( bool bUI )
{
using namespace com::sun::star::script::vba::VBAEventId;
uno::Sequence< uno::Any > aNoArgs;
- xVbaEvents->processVbaEvent( DOCUMENT_CLOSE, aNoArgs );
+ xVbaEvents->processVbaEvent(AUTO_CLOSE, aNoArgs);
+ xVbaEvents->processVbaEvent(DOCUMENT_CLOSE, aNoArgs);
}
}
return bRet;
@@ -417,12 +420,12 @@ void SwDocShell::Execute(SfxRequest& rReq)
pAFlags->pSmartTagMgr = &SwSmartTagMgr::Get();
- SfxItemSet aSet( pApp->GetPool(), svl::Items<SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG, SID_OPEN_SMARTTAGOPTIONS, SID_OPEN_SMARTTAGOPTIONS>{} );
+ SfxItemSetFixed<SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG, SID_OPEN_SMARTTAGOPTIONS, SID_OPEN_SMARTTAGOPTIONS> aSet( pApp->GetPool() );
aSet.Put( aSwOptions );
- const SfxPoolItem* pOpenSmartTagOptionsItem = nullptr;
- if( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_OPEN_SMARTTAGOPTIONS, false, &pOpenSmartTagOptionsItem ) )
- aSet.Put( *static_cast<const SfxBoolItem*>(pOpenSmartTagOptionsItem) );
+ const SfxBoolItem* pOpenSmartTagOptionsItem = nullptr;
+ if( pArgs && (pOpenSmartTagOptionsItem = pArgs->GetItemIfSet( SID_OPEN_SMARTTAGOPTIONS, false )) )
+ aSet.Put( *pOpenSmartTagOptionsItem );
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
VclPtr<SfxAbstractTabDialog> pDlg = pFact->CreateAutoCorrTabDialog(GetView()->GetFrameWeld(), &aSet);
@@ -466,13 +469,13 @@ void SwDocShell::Execute(SfxRequest& rReq)
SfxViewFrame *pTmpFrame = SfxViewFrame::GetFirst(this);
SfxViewShell* pViewShell = SfxViewShell::Current();
SwView* pCurrView = dynamic_cast< SwView *> ( pViewShell );
- bool bCurrent = typeid(SwPagePreview) == typeid( pViewShell );
+ bool bCurrent = isType<SwPagePreview>( pViewShell );
while( pTmpFrame ) // search Preview
{
- if( typeid(SwView) == typeid( pTmpFrame->GetViewShell()) )
+ if( isType<SwView>( pTmpFrame->GetViewShell()) )
bOnly = false;
- else if( typeid(SwPagePreview) == typeid( pTmpFrame->GetViewShell()))
+ else if( isType<SwPagePreview>( pTmpFrame->GetViewShell()))
{
pTmpFrame->GetFrame().Appear();
bFound = true;
@@ -502,7 +505,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
nSlotId = SID_VIEWSHELL2;
if( pCurrView && pCurrView->GetDocShell() == this )
- pTmpFrame = pCurrView->GetViewFrame();
+ pTmpFrame = &pCurrView->GetViewFrame();
else
pTmpFrame = SfxViewFrame::GetFirst( this );
@@ -540,13 +543,12 @@ void SwDocShell::Execute(SfxRequest& rReq)
aFileName = pTemplateItem->GetValue();
const SfxInt32Item* pFlagsItem = rReq.GetArg<SfxInt32Item>(SID_TEMPLATE_LOAD);
if ( pFlagsItem )
- nFlags = static_cast<SfxTemplateFlags>(static_cast<sal_uInt16>(pFlagsItem->GetValue()));
+ nFlags = static_cast<SfxTemplateFlags>(o3tl::narrowing<sal_uInt16>(pFlagsItem->GetValue()));
}
}
if ( aFileName.isEmpty() )
{
- SvtPathOptions aPathOpt;
SfxNewFileDialog aNewFileDlg(GetView()->GetFrameWeld(), SfxNewFileDialogMode::LoadTemplate);
aNewFileDlg.SetTemplateFlags(nFlags);
@@ -555,10 +557,9 @@ void SwDocShell::Execute(SfxRequest& rReq)
{
FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE,
FileDialogFlags::NONE, GetView()->GetFrameWeld());
+ aDlgHelper.SetContext(FileDialogHelper::WriterLoadTemplate);
uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
- xFP->setDisplayDirectory( aPathOpt.GetWorkPath() );
-
SfxObjectFactory &rFact = GetFactory();
SfxFilterMatcher aMatcher( rFact.GetFactoryName() );
SfxFilterMatcherIter aIter( aMatcher );
@@ -629,7 +630,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
aOpt.SetMerge( !bMerge );
SetError(LoadStylesFromFile(aFileName, aOpt, false));
- if ( !GetError() )
+ if ( !GetErrorIgnoreWarning() )
rReq.Done();
}
}
@@ -639,7 +640,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
SfxViewShell* pViewShell = GetView()
? static_cast<SfxViewShell*>(GetView())
: SfxViewShell::Current();
- SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
+ SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
SwSrcView* pSrcView = dynamic_cast< SwSrcView *>( pViewShell );
if(!pSrcView)
{
@@ -658,7 +659,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
std::shared_ptr<const SfxFilter> pFlt = GetMedium()->GetFilter();
if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData())
{
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pViewFrame->GetWindow().GetFrameWeld(), "modules/swriter/ui/saveashtmldialog.ui"));
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(rViewFrame.GetFrameWeld(), "modules/swriter/ui/saveashtmldialog.ui"));
std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("SaveAsHTMLDialog"));
if (RET_YES == xQuery->run())
bLocalHasName = false;
@@ -671,6 +672,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
FileDialogHelper aDlgHelper(TemplateDescription::FILESAVE_AUTOEXTENSION,
FileDialogFlags::NONE,
GetView()->GetFrameWeld());
+ aDlgHelper.SetContext(FileDialogHelper::WriterSaveHTML);
aDlgHelper.AddFilter( pHtmlFlt->GetFilterName(), pHtmlFlt->GetDefaultExtension() );
aDlgHelper.SetCurrentFilter( pHtmlFlt->GetFilterName() );
if( ERRCODE_NONE != aDlgHelper.Execute())
@@ -680,17 +682,17 @@ void SwDocShell::Execute(SfxRequest& rReq)
OUString sPath = aDlgHelper.GetPath();
SfxStringItem aName(SID_FILE_NAME, sPath);
SfxStringItem aFilter(SID_FILTER_NAME, pHtmlFlt->GetName());
- const SfxBoolItem* pBool = static_cast<const SfxBoolItem*>(
- pViewFrame->GetDispatcher()->ExecuteList(
- SID_SAVEASDOC, SfxCallMode::SYNCHRON,
- { &aName, &aFilter }));
+ const SfxPoolItemHolder aResult(
+ rViewFrame.GetDispatcher()->ExecuteList(
+ SID_SAVEASDOC, SfxCallMode::SYNCHRON,
+ { &aName, &aFilter }));
+ const SfxBoolItem* pBool(static_cast<const SfxBoolItem*>(aResult.getItem()));
if(!pBool || !pBool->GetValue())
break;
}
}
- OSL_ENSURE(dynamic_cast<SwWebDocShell*>(this),
- "SourceView only in WebDocShell");
+ assert(dynamic_cast<SwWebDocShell*>(this) && "SourceView only in WebDocShell");
// the SourceView is not the 1 for SwWebDocShell
sal_uInt16 nSlot = SID_VIEWSHELL1;
@@ -704,7 +706,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
bSetModified = IsModified() || pSrcView->IsModified();
if(pSrcView->IsModified()||pSrcView->HasSourceSaved())
{
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
pSrcView->SaveContent(aTempFile.GetURL());
bDone = true;
@@ -721,8 +723,8 @@ void SwDocShell::Execute(SfxRequest& rReq)
nSlot = SID_VIEWSHELL0;
}
}
- if(nSlot)
- pViewFrame->GetDispatcher()->Execute(nSlot, SfxCallMode::SYNCHRON);
+ if (nSlot)
+ rViewFrame.GetDispatcher()->Execute(nSlot, SfxCallMode::SYNCHRON);
if(bSetModified)
GetDoc()->getIDocumentState().SetModified();
if(pSavePrinter)
@@ -730,87 +732,84 @@ void SwDocShell::Execute(SfxRequest& rReq)
GetDoc()->getIDocumentDeviceAccess().setPrinter( pSavePrinter, true, true);
//pSavePrinter must not be deleted again
}
- pViewFrame->GetBindings().SetState(SfxBoolItem(SID_SOURCEVIEW, false)); // not SID_VIEWSHELL2
- pViewFrame->GetBindings().Invalidate( SID_NEWWINDOW );
- pViewFrame->GetBindings().Invalidate( SID_BROWSER_MODE );
- pViewFrame->GetBindings().Invalidate( FN_PRINT_LAYOUT );
+ rViewFrame.GetBindings().SetState(SfxBoolItem(SID_SOURCEVIEW, false)); // not SID_VIEWSHELL2
+ rViewFrame.GetBindings().Invalidate( SID_NEWWINDOW );
+ rViewFrame.GetBindings().Invalidate( SID_BROWSER_MODE );
+ rViewFrame.GetBindings().Invalidate( FN_PRINT_LAYOUT );
}
break;
case SID_GET_COLORLIST:
{
const SvxColorListItem* pColItem = GetItem(SID_COLOR_TABLE);
const XColorListRef& pList = pColItem->GetColorList();
- rReq.SetReturnValue(OfaRefItem<XColorList>(SID_GET_COLORLIST, pList));
+ rReq.SetReturnValue(OfaXColorListItem(SID_GET_COLORLIST, pList));
}
break;
case FN_ABSTRACT_STARIMPRESS:
case FN_ABSTRACT_NEWDOC:
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractSwInsertAbstractDlg> pDlg(pFact->CreateSwInsertAbstractDlg(GetView()->GetFrameWeld()));
- if(RET_OK == pDlg->Execute())
- {
- sal_uInt8 nLevel = pDlg->GetLevel();
- sal_uInt8 nPara = pDlg->GetPara();
- SwDoc* pSmryDoc = new SwDoc();
- SfxObjectShellLock xDocSh(new SwDocShell(*pSmryDoc, SfxObjectCreateMode::STANDARD));
- xDocSh->DoInitNew();
-
- bool bImpress = FN_ABSTRACT_STARIMPRESS == nWhich;
- m_xDoc->Summary(*pSmryDoc, nLevel, nPara, bImpress);
- if( bImpress )
+ VclPtr<AbstractSwInsertAbstractDlg> pDlg(pFact->CreateSwInsertAbstractDlg(GetView()->GetFrameWeld()));
+ pDlg->StartExecuteAsync(
+ [this, pDlg, nWhich] (sal_Int32 nResult)->void
{
- WriterRef xWrt;
- // mba: looks as if relative URLs don't make sense here
- ::GetRTFWriter(OUString(), OUString(), xWrt);
- SvMemoryStream *pStrm = new SvMemoryStream();
- pStrm->SetBufferSize( 16348 );
- SwWriter aWrt( *pStrm, *pSmryDoc );
- ErrCode eErr = aWrt.Write( xWrt );
- if( !eErr.IgnoreWarning() )
+ if (nResult == RET_OK)
{
- uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
- uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext );
+ sal_uInt8 nLevel = pDlg->GetLevel();
+ sal_uInt8 nPara = pDlg->GetPara();
+ SwDoc* pSmryDoc = new SwDoc();
+ SfxObjectShellLock xDocSh(new SwDocShell(*pSmryDoc, SfxObjectCreateMode::STANDARD));
+ xDocSh->DoInitNew();
+
+ bool bImpress = FN_ABSTRACT_STARIMPRESS == nWhich;
+ m_xDoc->Summary(*pSmryDoc, nLevel, nPara, bImpress);
+ if( bImpress )
+ {
+ WriterRef xWrt;
+ // mba: looks as if relative URLs don't make sense here
+ ::GetRTFWriter(std::u16string_view(), OUString(), xWrt);
+ SvMemoryStream *pStrm = new SvMemoryStream();
+ pStrm->SetBufferSize( 16348 );
+ SwWriter aWrt( *pStrm, *pSmryDoc );
+ ErrCodeMsg eErr = aWrt.Write( xWrt );
+ if( !eErr.IgnoreWarning() )
+ {
+ uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+ uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext );
- uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
- pStrm->Seek( STREAM_SEEK_TO_END );
- pStrm->WriteChar( '\0' );
- pStrm->Seek( STREAM_SEEK_TO_BEGIN );
+ uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) );
+ pStrm->Seek( STREAM_SEEK_TO_END );
+ pStrm->WriteChar( '\0' );
+ pStrm->Seek( STREAM_SEEK_TO_BEGIN );
+
+ uno::Sequence< sal_Int8 > aSeq( pStrm->TellEnd() );
+ pStrm->ReadBytes( aSeq.getArray(), aSeq.getLength() );
- // Transfer ownership of stream to a lockbytes object
- SvLockBytes aLockBytes( pStrm, true );
- SvLockBytesStat aStat;
- if ( aLockBytes.Stat( &aStat ) == ERRCODE_NONE )
+ uno::Sequence< beans::PropertyValue > aArgs{
+ comphelper::makePropertyValue("RtfOutline", aSeq)
+ };
+ xHelper->executeDispatch( xProv, "SendOutlineToImpress", OUString(), 0, aArgs );
+ }
+ else
+ ErrorHandler::HandleError( eErr );
+ }
+ else
{
- sal_uInt32 nLen = aStat.nSize;
- std::size_t nRead = 0;
- uno::Sequence< sal_Int8 > aSeq( nLen );
- aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead );
-
- uno::Sequence< beans::PropertyValue > aArgs(1);
- aArgs[0].Name = "RtfOutline";
- aArgs[0].Value <<= aSeq;
- xHelper->executeDispatch( xProv, "SendOutlineToImpress", OUString(), 0, aArgs );
+ // Create new document
+ SfxViewFrame *pFrame = SfxViewFrame::LoadDocument( *xDocSh, SFX_INTERFACE_NONE );
+ SwView *pCurrView = static_cast<SwView*>( pFrame->GetViewShell());
+
+ // Set document's title
+ OUString aTmp = SwResId(STR_ABSTRACT_TITLE) + GetTitle();
+ xDocSh->SetTitle( aTmp );
+ pCurrView->GetWrtShell().SetNewDoc();
+ pFrame->Show();
+ pSmryDoc->getIDocumentState().SetModified();
}
}
- else
- ErrorHandler::HandleError( eErr );
- }
- else
- {
- // Create new document
- SfxViewFrame *pFrame = SfxViewFrame::LoadDocument( *xDocSh, SFX_INTERFACE_NONE );
- SwView *pCurrView = static_cast<SwView*>( pFrame->GetViewShell());
-
- // Set document's title
- OUString aTmp = SwResId(STR_ABSTRACT_TITLE) + GetTitle();
- xDocSh->SetTitle( aTmp );
- pCurrView->GetWrtShell().SetNewDoc();
- pFrame->Show();
- pSmryDoc->getIDocumentState().SetModified();
+ pDlg->disposeOnce();
}
-
- }
+ );
}
break;
case FN_OUTLINE_TO_CLIPBOARD:
@@ -820,11 +819,11 @@ void SwDocShell::Execute(SfxRequest& rReq)
EnableSetModified( false );
WriterRef xWrt;
// mba: looks as if relative URLs don't make sense here
- ::GetRTFWriter( OUString('O'), OUString(), xWrt );
+ ::GetRTFWriter( u"O", OUString(), xWrt );
std::unique_ptr<SvMemoryStream> pStrm (new SvMemoryStream());
pStrm->SetBufferSize( 16348 );
SwWriter aWrt( *pStrm, *GetDoc() );
- ErrCode eErr = aWrt.Write( xWrt );
+ ErrCodeMsg eErr = aWrt.Write( xWrt );
EnableSetModified( bEnable );
if( !eErr.IgnoreWarning() )
{
@@ -841,21 +840,13 @@ void SwDocShell::Execute(SfxRequest& rReq)
pStrm->WriteChar( '\0' );
pStrm->Seek( STREAM_SEEK_TO_BEGIN );
- // Transfer ownership of stream to a lockbytes object
- SvLockBytes aLockBytes( pStrm.release(), true );
- SvLockBytesStat aStat;
- if ( aLockBytes.Stat( &aStat ) == ERRCODE_NONE )
- {
- sal_uInt32 nLen = aStat.nSize;
- std::size_t nRead = 0;
- uno::Sequence< sal_Int8 > aSeq( nLen );
- aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead );
-
- uno::Sequence< beans::PropertyValue > aArgs(1);
- aArgs[0].Name = "RtfOutline";
- aArgs[0].Value <<= aSeq;
- xHelper->executeDispatch( xProv, "SendOutlineToImpress", OUString(), 0, aArgs );
- }
+ uno::Sequence< sal_Int8 > aSeq( pStrm->TellEnd() );
+ pStrm->ReadBytes( aSeq.getArray(), aSeq.getLength() );
+
+ uno::Sequence< beans::PropertyValue > aArgs{
+ comphelper::makePropertyValue("RtfOutline", aSeq)
+ };
+ xHelper->executeDispatch( xProv, "SendOutlineToImpress", OUString(), 0, aArgs );
}
else
{
@@ -872,17 +863,29 @@ void SwDocShell::Execute(SfxRequest& rReq)
}
break;
case SID_SPELLCHECKER_CHANGED:
+ {
//! false, true, true is on the save side but a probably overdone
SwModule::CheckSpellChanges(false, true, true, false );
+ Broadcast(SfxHint(SfxHintId::LanguageChanged));
+ }
break;
case SID_MAIL_PREPAREEXPORT:
{
+ const SfxBoolItem* pNoUpdate = pArgs ?
+ pArgs->GetItem<SfxBoolItem>(FN_NOUPDATE, false) :
+ nullptr;
+
//pWrtShell is not set in page preview
if (m_pWrtShell)
m_pWrtShell->StartAllAction();
- m_xDoc->getIDocumentFieldsAccess().UpdateFields( false );
- m_xDoc->getIDocumentLinksAdministration().EmbedAllLinks();
+
+ if (!pNoUpdate || !pNoUpdate->GetValue())
+ {
+ m_xDoc->getIDocumentFieldsAccess().UpdateFields( false );
+ m_xDoc->getIDocumentLinksAdministration().EmbedAllLinks();
+ }
+
m_IsRemovedInvisibleContent
= officecfg::Office::Security::HiddenContent::RemoveHiddenContent::get();
if (m_IsRemovedInvisibleContent)
@@ -926,6 +929,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
FileDialogHelper aDlgHelper(TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE, FileDialogFlags::NONE,
GetView()->GetFrameWeld());
+ aDlgHelper.SetContext(FileDialogHelper::WriterNewHTMLGlobalDoc);
const sal_Int16 nControlIds[] = {
CommonFilePickerElementIds::PUSHBUTTON_OK,
@@ -971,7 +975,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
std::shared_ptr<const SfxFilter> pFlt;
- const char* pStrId;
+ TranslateId pStrId;
if( bCreateHtml )
{
@@ -1080,7 +1084,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
}
else if ( sTmpl.startsWith(aOutline) )
{
- nTemplateOutlineLevel = sTmpl.copy(aOutline.getLength()).toInt32(); //get string behind "Outline: Level ";
+ nTemplateOutlineLevel = o3tl::toInt32(sTmpl.subView(aOutline.getLength())); //get string behind "Outline: Level ";
bCreateByOutlineLevel = true;
}
@@ -1125,12 +1129,11 @@ void SwDocShell::Execute(SfxRequest& rReq)
//search for the view that created the call
if(pViewShell->GetObjectShell() == this && pViewShell->GetDispatcher())
{
- std::unique_ptr<SfxFrameItem> pFrameItem(new SfxFrameItem( SID_DOCFRAME,
- pViewShell->GetViewFrame() ));
+ SfxFrameItem aFrameItem(SID_DOCFRAME, &pViewShell->GetViewFrame());
SfxDispatcher* pDispatch = pViewShell->GetDispatcher();
pDispatch->ExecuteList(SID_OPENDOC,
SfxCallMode::ASYNCHRON,
- { &aName, &aReferer, pFrameItem.get() });
+ { &aName, &aReferer, &aFrameItem });
break;
}
pViewShell = SfxViewShell::GetNext(*pViewShell);
@@ -1156,7 +1159,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
case SID_ATTR_YEAR2000:
if ( pArgs && SfxItemState::SET == pArgs->GetItemState( nWhich , false, &pItem ))
{
- OSL_ENSURE(dynamic_cast< const SfxUInt16Item *>( pItem ) != nullptr, "wrong Item");
+ assert(dynamic_cast< const SfxUInt16Item *>( pItem ) && "wrong Item");
sal_uInt16 nYear2K = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
// iterate over Views and put the State to FormShells
@@ -1185,11 +1188,12 @@ void SwDocShell::Execute(SfxRequest& rReq)
// Ok. I did my best.
break;
- SfxStringItem aApp(SID_DOC_SERVICE, "com.sun.star.text.TextDocument");
- SfxStringItem aTarget(SID_TARGETNAME, "_blank");
- pViewShell->GetDispatcher()->ExecuteList(SID_OPENDOC,
- SfxCallMode::API|SfxCallMode::SYNCHRON,
- { &aApp, &aTarget });
+ if (SfxDispatcher* pDispatch = pViewShell->GetDispatcher())
+ {
+ SfxStringItem aApp(SID_DOC_SERVICE, "com.sun.star.text.TextDocument");
+ SfxStringItem aTarget(SID_TARGETNAME, "_blank");
+ pDispatch->ExecuteList(SID_OPENDOC, SfxCallMode::API|SfxCallMode::SYNCHRON, { &aApp, &aTarget });
+ }
}
break;
case SID_CLASSIFICATION_APPLY:
@@ -1199,9 +1203,9 @@ void SwDocShell::Execute(SfxRequest& rReq)
SwWrtShell* pSh = GetWrtShell();
const OUString& rValue = static_cast<const SfxStringItem*>(pItem)->GetValue();
auto eType = SfxClassificationPolicyType::IntellectualProperty;
- if (pArgs->GetItemState(SID_TYPE_NAME, false, &pItem) == SfxItemState::SET)
+ if (const SfxStringItem* pTypeNameItem = pArgs->GetItemIfSet(SID_TYPE_NAME, false))
{
- const OUString& rType = static_cast<const SfxStringItem*>(pItem)->GetValue();
+ const OUString& rType = pTypeNameItem->GetValue();
eType = SfxClassificationHelper::stringToPolicyType(rType);
}
pSh->SetClassification(rValue, eType);
@@ -1211,36 +1215,38 @@ void SwDocShell::Execute(SfxRequest& rReq)
}
break;
case SID_CLASSIFICATION_DIALOG:
- {
- auto xDialog = std::make_shared<svx::ClassificationDialog>(GetView()->GetFrameWeld(), false);
+ if (SfxObjectShell* pObjSh = SfxObjectShell::Current())
+ {
+ auto xDialog = std::make_shared<svx::ClassificationDialog>(GetView()->GetFrameWeld(), pObjSh->getDocProperties(), false);
- SwWrtShell* pShell = GetWrtShell();
- std::vector<svx::ClassificationResult> aInput = pShell->CollectAdvancedClassification();
- xDialog->setupValues(aInput);
+ SwWrtShell* pShell = GetWrtShell();
+ std::vector<svx::ClassificationResult> aInput = pShell->CollectAdvancedClassification();
+ xDialog->setupValues(std::move(aInput));
- weld::DialogController::runAsync(xDialog, [xDialog, pShell](sal_Int32 nResult){
- if (RET_OK == nResult)
- pShell->ApplyAdvancedClassification(xDialog->getResult());
- });
- }
- break;
+ weld::DialogController::runAsync(xDialog, [xDialog, pShell](sal_Int32 nResult){
+ if (RET_OK == nResult)
+ pShell->ApplyAdvancedClassification(xDialog->getResult());
+ });
+ }
+ break;
case SID_PARAGRAPH_SIGN_CLASSIFY_DLG:
- {
- SwWrtShell* pShell = GetWrtShell();
- auto xDialog = std::make_shared<svx::ClassificationDialog>(GetView()->GetFrameWeld(), true, [pShell]()
+ if (SfxObjectShell* pObjSh = SfxObjectShell::Current())
{
- pShell->SignParagraph();
- });
+ SwWrtShell* pShell = GetWrtShell();
+ auto xDialog = std::make_shared<svx::ClassificationDialog>(GetView()->GetFrameWeld(), pObjSh->getDocProperties(), true, [pShell]()
+ {
+ pShell->SignParagraph();
+ });
- std::vector<svx::ClassificationResult> aInput = pShell->CollectParagraphClassification();
- xDialog->setupValues(aInput);
+ std::vector<svx::ClassificationResult> aInput = pShell->CollectParagraphClassification();
+ xDialog->setupValues(std::move(aInput));
- weld::DialogController::runAsync(xDialog, [xDialog, pShell](sal_Int32 nResult){
- if (RET_OK == nResult)
- pShell->ApplyParagraphClassification(xDialog->getResult());
- });
- }
- break;
+ weld::DialogController::runAsync(xDialog, [xDialog, pShell](sal_Int32 nResult){
+ if (RET_OK == nResult)
+ pShell->ApplyParagraphClassification(xDialog->getResult());
+ });
+ }
+ break;
case SID_WATERMARK:
{
SwWrtShell* pSh = GetWrtShell();
@@ -1251,22 +1257,22 @@ void SwDocShell::Execute(SfxRequest& rReq)
SfxWatermarkItem aItem;
aItem.SetText( static_cast<const SfxStringItem*>( pItem )->GetValue() );
- if ( pArgs->GetItemState( SID_WATERMARK_FONT, false, &pItem ) == SfxItemState::SET )
- aItem.SetFont( static_cast<const SfxStringItem*>( pItem )->GetValue() );
- if ( pArgs->GetItemState( SID_WATERMARK_ANGLE, false, &pItem ) == SfxItemState::SET )
- aItem.SetAngle( static_cast<const SfxInt16Item*>( pItem )->GetValue() );
- if ( pArgs->GetItemState( SID_WATERMARK_TRANSPARENCY, false, &pItem ) == SfxItemState::SET )
- aItem.SetTransparency( static_cast<const SfxInt16Item*>( pItem )->GetValue() );
- if ( pArgs->GetItemState( SID_WATERMARK_COLOR, false, &pItem ) == SfxItemState::SET )
- aItem.SetColor( Color(ColorTransparency, static_cast<const SfxUInt32Item*>( pItem )->GetValue()) );
+ if ( const SfxStringItem* pFontItem = pArgs->GetItemIfSet( SID_WATERMARK_FONT, false ) )
+ aItem.SetFont( pFontItem->GetValue() );
+ if ( const SfxInt16Item* pAngleItem = pArgs->GetItemIfSet( SID_WATERMARK_ANGLE, false ) )
+ aItem.SetAngle( pAngleItem->GetValue() );
+ if ( const SfxInt16Item* pTransItem = pArgs->GetItemIfSet( SID_WATERMARK_TRANSPARENCY, false ) )
+ aItem.SetTransparency( pTransItem->GetValue() );
+ if ( const SfxUInt32Item* pColorItem = pArgs->GetItemIfSet( SID_WATERMARK_COLOR, false ) )
+ aItem.SetColor( Color(ColorTransparency, pColorItem->GetValue()) );
pSh->SetWatermark( aItem );
}
else
{
SfxViewShell* pViewShell = GetView() ? GetView() : SfxViewShell::Current();
- SfxBindings& rBindings( pViewShell->GetViewFrame()->GetBindings() );
- auto xDlg = std::make_shared<SwWatermarkDialog>(pViewShell->GetViewFrame()->GetWindow().GetFrameWeld(),
+ SfxBindings& rBindings( pViewShell->GetViewFrame().GetBindings() );
+ auto xDlg = std::make_shared<SwWatermarkDialog>(pViewShell->GetViewFrame().GetFrameWeld(),
rBindings);
weld::DialogController::runAsync(xDlg, [](sal_Int32 /*nResult*/){});
}
@@ -1277,7 +1283,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
{
const SfxStringItem* pFile = rReq.GetArg<SfxStringItem>( SID_NOTEBOOKBAR );
SfxViewShell* pViewShell = GetView()? GetView(): SfxViewShell::Current();
- SfxBindings& rBindings( pViewShell->GetViewFrame()->GetBindings() );
+ SfxBindings& rBindings( pViewShell->GetViewFrame().GetBindings() );
if ( SfxNotebookBar::IsActive() )
sfx2::SfxNotebookBar::ExecMethod( rBindings, pFile ? pFile->GetValue() : "" );
@@ -1298,6 +1304,39 @@ void SwDocShell::Execute(SfxRequest& rReq)
break;
}
+ // tables with tracked deletion need Show Changes
+ bool bHideChanges = pWrtShell && pWrtShell->GetLayout() &&
+ pWrtShell->GetLayout()->IsHideRedlines();
+ bool bChangedHideChanges = false;
+ if ( bHideChanges )
+ {
+ SwTableNode* pOldTableNd = nullptr;
+ const SwRedlineTable& aRedlineTable = rRedlineAccess.GetRedlineTable();
+ for (SwRedlineTable::size_type n = 0; n < aRedlineTable.size(); ++n)
+ {
+ const SwRangeRedline* pRedline = aRedlineTable[n];
+ if ( pRedline->GetType() == RedlineType::Delete )
+ {
+ SwTableNode* pTableNd =
+ pRedline->GetPoint()->GetNode().FindTableNode();
+ if ( pTableNd && pTableNd !=
+ pOldTableNd && pTableNd->GetTable().HasDeletedRowOrCell() )
+ {
+ SfxBoolItem aShow(FN_REDLINE_SHOW, true);
+ SfxViewShell* pViewShell = GetView()
+ ? GetView()
+ : SfxViewShell::Current();
+ pViewShell->GetViewFrame().GetDispatcher()->ExecuteList(
+ FN_REDLINE_SHOW, SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
+ { &aShow });
+ bChangedHideChanges = true;
+ break;
+ }
+ pOldTableNd = pTableNd;
+ }
+ }
+ }
+
if (pWrtShell)
{
pWrtShell->StartAllAction();
@@ -1310,6 +1349,14 @@ void SwDocShell::Execute(SfxRequest& rReq)
pWrtShell->EndAllAction();
}
+ if ( bChangedHideChanges )
+ {
+ SfxBoolItem aShow(FN_REDLINE_SHOW, false);
+ SfxViewShell* pViewShell = GetView()? GetView(): SfxViewShell::Current();
+ pViewShell->GetViewFrame().GetDispatcher()->ExecuteList(
+ FN_REDLINE_SHOW, SfxCallMode::SYNCHRON|SfxCallMode::RECORD, { &aShow });
+ }
+
Broadcast(SfxHint(SfxHintId::RedlineChanged));
rReq.Done();
}
@@ -1337,6 +1384,8 @@ bool SwDocShell::DdeSetData( const OUString& rItem, const OUString& /*rMimeType*
::sfx2::SvLinkSource* SwDocShell::DdeCreateLinkSource( const OUString& rItem )
{
+ if(officecfg::Office::Common::Security::Scripting::DisableActiveContent::get())
+ return nullptr;
return m_xDoc->getIDocumentLinksAdministration().CreateLinkSource( rItem );
}
@@ -1377,7 +1426,7 @@ void SwDocShell::FillClass( SvGlobalName * pClassName,
void SwDocShell::SetModified( bool bSet )
{
- if (utl::ConfigManager::IsFuzzing())
+ if (comphelper::IsFuzzing())
return;
SfxObjectShell::SetModified( bSet );
if( !IsEnableSetModified())
@@ -1410,14 +1459,14 @@ void SwDocShell::UpdateChildWindows()
// if necessary newly initialize Fielddlg (i.e. for TYP_SETVAR)
if(!GetView())
return;
- SfxViewFrame* pVFrame = GetView()->GetViewFrame();
- SwFieldDlgWrapper *pWrp = static_cast<SwFieldDlgWrapper*>(pVFrame->
+ SfxViewFrame& rVFrame = GetView()->GetViewFrame();
+ SwFieldDlgWrapper *pWrp = static_cast<SwFieldDlgWrapper*>(rVFrame.
GetChildWindow( SwFieldDlgWrapper::GetChildWindowId() ));
if( pWrp )
pWrp->ReInitDlg( this );
// if necessary newly initialize RedlineDlg
- SwRedlineAcceptChild *pRed = static_cast<SwRedlineAcceptChild*>(pVFrame->
+ SwRedlineAcceptChild *pRed = static_cast<SwRedlineAcceptChild*>(rVFrame.
GetChildWindow( SwRedlineAcceptChild::GetChildWindowId() ));
if( pRed )
pRed->ReInitDlg( this );
@@ -1453,11 +1502,10 @@ void SwDocShell::ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcVie
// A EnterBasicCall is not needed here, because nothing is called and
// there can't be any Dok-Basic, that has not yet been loaded inside
// of an HTML document.
- SvxHtmlOptions& rHtmlOptions = SvxHtmlOptions::Get();
//#59620# HasBasic() shows, that there already is a BasicManager at the DocShell.
// That was always generated in HTML-Import, when there are
// Macros in the source code.
- if( rHtmlOptions.IsStarBasic() && HasBasic())
+ if( officecfg::Office::Common::Filter::HTML::Export::Basic::get() && HasBasic())
{
BasicManager *pBasicMan = GetBasicManager();
if( pBasicMan && (pBasicMan != SfxApplication::GetBasicManager()) )
@@ -1469,10 +1517,10 @@ void SwDocShell::ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcVie
if( pBasic )
{
// Notify the IDE
- SfxUnoAnyItem aShellItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( GetModel() ) );
+ SfxUnoAnyItem aShellItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, Any( GetModel() ) );
OUString aLibName( pBasic->GetName() );
SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName );
- pSrcView->GetViewFrame()->GetDispatcher()->ExecuteList(
+ pSrcView->GetViewFrame().GetDispatcher()->ExecuteList(
SID_BASICIDE_LIBREMOVED,
SfxCallMode::SYNCHRON,
{ &aShellItem, &aLibNameItem });
@@ -1511,8 +1559,8 @@ void SwDocShell::ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcVie
SfxViewShell* pViewShell = GetView() ? static_cast<SfxViewShell*>(GetView())
: SfxViewShell::Current();
- SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
- pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL0, SfxCallMode::SYNCHRON );
+ SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
+ rViewFrame.GetDispatcher()->Execute( SID_VIEWSHELL0, SfxCallMode::SYNCHRON );
SubInitNew();
@@ -1546,9 +1594,9 @@ void SwDocShell::ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcVie
m_xDoc->getIDocumentState().ResetModified();
}
-ErrCode SwDocShell::LoadStylesFromFile(const OUString& rURL, SwgReaderOption& rOpt, bool bUnoCall)
+ErrCodeMsg SwDocShell::LoadStylesFromFile(const OUString& rURL, SwgReaderOption& rOpt, bool bUnoCall)
{
- ErrCode nErr = ERRCODE_NONE;
+ ErrCodeMsg nErr = ERRCODE_NONE;
// Set filter:
SfxFilterMatcher aMatcher( SwDocShell::Factory().GetFactoryName() );
@@ -1592,13 +1640,13 @@ ErrCode SwDocShell::LoadStylesFromFile(const OUString& rURL, SwgReaderOption& rO
{
Reader* pRead = ReadXML;
SwReaderPtr pReader;
- std::unique_ptr<SwPaM> pPam;
+ std::optional<SwPaM> pPam;
// the SW3IO - Reader need the pam/wrtshell, because only then he
// insert the styles!
if( bUnoCall )
{
SwNodeIndex aIdx( m_xDoc->GetNodes().GetEndOfContent(), -1 );
- pPam.reset(new SwPaM( aIdx ));
+ pPam.emplace( aIdx );
pReader.reset(new SwReader( aMed, rURL, *pPam ));
}
else
@@ -1646,18 +1694,18 @@ SfxInPlaceClient* SwDocShell::GetIPClient( const ::svt::EmbeddedObjectRef& xObjR
int SwFindDocShell( SfxObjectShellRef& xDocSh,
SfxObjectShellLock& xLockRef,
- const OUString& rFileName,
+ std::u16string_view rFileName,
const OUString& rPasswd,
const OUString& rFilter,
sal_Int16 nVersion,
SwDocShell* pDestSh )
{
- if ( rFileName.isEmpty() )
+ if ( rFileName.empty() )
return 0;
// 1. Does the file already exist in the list of all Documents?
INetURLObject aTmpObj( rFileName );
- aTmpObj.SetMark( OUString() );
+ aTmpObj.SetMark( u"" );
// Iterate over the DocShell and get the ones with the name
@@ -1675,7 +1723,7 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh,
if( pMed && pMed->GetURLObject() == aTmpObj )
{
const SfxPoolItem* pItem;
- if( ( SfxItemState::SET == pMed->GetItemSet()->GetItemState(
+ if( ( SfxItemState::SET == pMed->GetItemSet().GetItemState(
SID_VERSION, false, &pItem ) )
? (nVersion == static_cast<const SfxInt16Item*>(pItem)->GetValue())
: !nVersion )
@@ -1702,7 +1750,7 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh,
xMed->Download(); // Touch the medium (download it)
std::shared_ptr<const SfxFilter> pSfxFlt;
- if (!xMed->GetError())
+ if (!xMed->GetErrorIgnoreWarning())
{
SfxFilterMatcher aMatcher( rFilter == "writerglobal8"
? SwGlobalDocShell::Factory().GetFactoryName()
@@ -1715,10 +1763,10 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh,
}
if( nVersion )
- xMed->GetItemSet()->Put( SfxInt16Item( SID_VERSION, nVersion ));
+ xMed->GetItemSet().Put( SfxInt16Item( SID_VERSION, nVersion ));
if( !rPasswd.isEmpty() )
- xMed->GetItemSet()->Put( SfxStringItem( SID_PASSWORD, rPasswd ));
+ xMed->GetItemSet().Put( SfxStringItem( SID_PASSWORD, rPasswd ));
if( !pSfxFlt )
aMatcher.DetectFilter( *xMed, pSfxFlt );
@@ -1729,8 +1777,7 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh,
xMed->SetFilter( pSfxFlt );
// If the new shell is created, SfxObjectShellLock should be used to let it be closed later for sure
- SwDocShell *const pNew(new SwDocShell(SfxObjectCreateMode::INTERNAL));
- xLockRef = pNew;
+ xLockRef = new SwDocShell(SfxObjectCreateMode::INTERNAL);
xDocSh = static_cast<SfxObjectShell*>(xLockRef);
if (xDocSh->DoLoad(xMed.release()))
{