summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-11-02 14:25:24 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-11-02 18:29:13 +0100
commit688489959e69994d455f36f3e9bb4c0ba3ee87aa (patch)
treecb1ea91700a36485ab04f5b8bc13024f6dfb9a9e /sfx2
parentfffd76195e0701cf774e36963105cd63a2e65a26 (diff)
Revert "tdf#117895: "Edit document properties before saving"..."
This reverts commit 3add3e5b70ad991c8351a54b0da62d05e977458f to try and alternative approach Change-Id: Ieb36b78246586cc7f1977c67eab130d2ae025988 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124605 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/Library_sfx.mk1
-rw-r--r--sfx2/sdi/sfx.sdi2
-rw-r--r--sfx2/source/control/asyncfunc.cxx28
-rw-r--r--sfx2/source/doc/guisaveas.cxx54
-rw-r--r--sfx2/source/doc/objserv.cxx10
-rw-r--r--sfx2/source/view/frame.cxx10
6 files changed, 28 insertions, 77 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index a47d57138d94..d5f1c28ed436 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -133,7 +133,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/bastyp/sfxresid \
sfx2/source/commandpopup/CommandPopup \
sfx2/source/config/evntconf \
- sfx2/source/control/asyncfunc \
sfx2/source/control/bindings \
sfx2/source/control/ctrlitem \
sfx2/source/control/dispatch \
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 85570cdbb08c..0a9b40b7f7a5 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -3325,7 +3325,7 @@ SfxBoolItem PrintPreview SID_PRINTPREVIEW
SfxVoidItem SetDocumentProperties SID_DOCINFO
-(SfxDocumentInfoItem Properties SID_DOCINFO,SfxUnoAnyItem AsyncFunc FN_PARAM_2)
+(SfxDocumentInfoItem Properties SID_DOCINFO)
[
AutoUpdate = FALSE,
FastCall = FALSE,
diff --git a/sfx2/source/control/asyncfunc.cxx b/sfx2/source/control/asyncfunc.cxx
deleted file mode 100644
index b81639af5646..000000000000
--- a/sfx2/source/control/asyncfunc.cxx
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <asyncfunc.hxx>
-
-AsyncFunc::AsyncFunc(const std::function<void()>& rAsyncFunc)
- : m_pAsyncFunc(rAsyncFunc)
-{
-}
-
-AsyncFunc::~AsyncFunc() {}
-
-void AsyncFunc::Execute()
-{
- if (m_pAsyncFunc)
- m_pAsyncFunc();
-}
-
-//XUnoTunnel
-UNO3_GETIMPLEMENTATION_IMPL(AsyncFunc)
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index d5eb3369d735..ee059c790619 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -71,7 +71,6 @@
#include <sfx2/strings.hrc>
#include <sfx2/sfxresid.hxx>
#include <sfx2/filedlghelper.hxx>
-#include <asyncfunc.hxx>
#include <sfx2/app.hxx>
#include <sfx2/sfxuno.hxx>
#include <alienwarn.hxx>
@@ -318,7 +317,7 @@ public:
const css::uno::Sequence< OUString >& rDenyList
);
- bool ShowDocumentInfoDialog(const std::function< void () >&);
+ bool ShowDocumentInfoDialog();
static OUString GetRecommendedExtension( const OUString& aTypeName );
OUString GetRecommendedDir( const OUString& aSuggestedDir );
@@ -1102,7 +1101,7 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode,
}
-bool ModelData_Impl::ShowDocumentInfoDialog(const std::function< void () >& aFunc)
+bool ModelData_Impl::ShowDocumentInfoDialog()
{
bool bDialogUsed = false;
@@ -1125,11 +1124,7 @@ bool ModelData_Impl::ShowDocumentInfoDialog(const std::function< void () >& aFun
0 );
if ( xDispatch.is() )
{
- uno::Reference< lang::XUnoTunnel > aAsyncFunc(new AsyncFunc(aFunc));
- uno::Sequence< beans::PropertyValue > aProperties{
- comphelper::makePropertyValue("AsyncFunc", aAsyncFunc)
- };
- xDispatch->dispatch( aURL, aProperties );
+ xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() );
bDialogUsed = true;
}
}
@@ -1637,33 +1632,34 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo
uno::Reference<document::XDocumentProperties> xOldDocProps(
xCloneable->createClone(), uno::UNO_QUERY_THROW);
- std::function< void () > aFunc = [xModel, xOldDocProps, nStoreMode, aURL, aArgsSequence]() {
- SfxStoringHelper aStoringHelper;
- ModelData_Impl aModel(aStoringHelper, xModel, aArgsSequence );
-
- try
- {
- if ( nStoreMode & EXPORT_REQUESTED )
- aModel.GetStorable()->storeToURL( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aArgsSequence );
- else
- aModel.GetStorable()->storeAsURL( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aArgsSequence );
- }
- catch( const uno::Exception& )
- {
- }
+ // use dispatch API to show document info dialog
+ if ( aModelData.ShowDocumentInfoDialog() )
+ bDialogUsed = true;
+ else
+ {
+ OSL_FAIL( "Can't execute document info dialog!" );
+ }
+ try {
+ // Document properties can contain streams that should be freed before storing
+ aModelData.FreeDocumentProps();
+ if ( nStoreMode & EXPORT_REQUESTED )
+ aModelData.GetStorable()->storeToURL( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aArgsSequence );
+ else
+ aModelData.GetStorable()->storeAsURL( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aArgsSequence );
+ }
+ catch( const uno::Exception& )
+ {
if ( nStoreMode & EXPORT_REQUESTED )
{
- SfxStoringHelper::SetDocInfoState(aModel.GetModel(), xOldDocProps);
+ SetDocInfoState(aModelData.GetModel(), xOldDocProps);
}
- };
+ throw;
+ }
- // use dispatch API to show document info dialog
- if ( aModelData.ShowDocumentInfoDialog(aFunc) )
- bDialogUsed = true;
- else
+ if ( nStoreMode & EXPORT_REQUESTED )
{
- OSL_FAIL( "Can't execute document info dialog!" );
+ SetDocInfoState(aModelData.GetModel(), xOldDocProps);
}
}
else
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 67de2f96a547..3fb676dc4b0a 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/servicehelper.hxx>
#include <com/sun/star/drawing/XDrawView.hpp>
#include <com/sun/star/security/DocumentSignatureInformation.hpp>
@@ -63,7 +64,6 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <tools/link.hxx>
-#include <asyncfunc.hxx>
#include <sfx2/signaturestate.hxx>
#include <sfx2/sfxresid.hxx>
#include <sfx2/request.hxx>
@@ -623,14 +623,6 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
pReq->AppendItem( SfxDocumentInfoItem( GetTitle(),
getDocProperties(), aNewCmisProperties, IsUseUserData(), IsUseThumbnailSave() ) );
}
-
- css::uno::Reference< css::uno::XInterface > xInterface;
- const SfxUnoAnyItem* pUnoAny = pReq->GetArg<SfxUnoAnyItem>(FN_PARAM_2);
- AsyncFunc* pAsyncFunc = pUnoAny && (pUnoAny->GetValue() >>= xInterface ) ?
- comphelper::getFromUnoTunnel<AsyncFunc>(xInterface) : nullptr;
- if (pAsyncFunc)
- pAsyncFunc->Execute();
-
pReq->Done();
}
else
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index 5f5aed2d208f..91bea023858e 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -58,16 +58,12 @@ using namespace ::com::sun::star::util;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::container;
-SfxPoolItem* SfxUnoAnyItem::CreateDefault()
-{
- return new SfxUnoAnyItem();
-}
+SfxPoolItem* SfxUnoAnyItem::CreateDefault() { SAL_WARN( "sfx", "No SfxUnoAnyItem factory available"); return nullptr; }
SfxPoolItem* SfxUnoFrameItem::CreateDefault()
{
return new SfxUnoFrameItem();
}
-
void SfxFrame::Construct_Impl()
{
pImpl.reset(new SfxFrame_Impl);
@@ -443,10 +439,6 @@ bool SfxFrameItem::PutValue( const css::uno::Any& rVal, sal_uInt8 )
return false;
}
-SfxUnoAnyItem::SfxUnoAnyItem()
- : SfxPoolItem( 0 )
-{
-}
SfxUnoAnyItem::SfxUnoAnyItem( sal_uInt16 nWhichId, const css::uno::Any& rAny )
: SfxPoolItem( nWhichId )