summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-11-02 14:25:24 +0000
committerXisco Fauli <xiscofauli@libreoffice.org>2021-11-03 14:34:30 +0100
commit005e4693341c40c50a142c8995419c6cc0247ec1 (patch)
treedc180595bcf9fa37ede7440a0fc06d73b5bfcb5e
parent3350ab7f2d5859ea242a5a63f66da5cdfcd0e6f3 (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> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124617 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--include/sfx2/frame.hxx1
-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
7 files changed, 28 insertions, 78 deletions
diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
index 26af0c08f957..732860c62344 100644
--- a/include/sfx2/frame.hxx
+++ b/include/sfx2/frame.hxx
@@ -171,7 +171,6 @@ class SFX2_DLLPUBLIC SfxUnoAnyItem final : public SfxPoolItem
css::uno::Any aValue;
public:
static SfxPoolItem* CreateDefault();
- SfxUnoAnyItem();
SfxUnoAnyItem( sal_uInt16 nWhich, const css::uno::Any& rAny );
const css::uno::Any& GetValue() const
{ return aValue; }
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index cab55c2a3335..56f446694bb9 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -132,7 +132,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/ctrlfactoryimpl \
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 79476c68fa7f..02e4658a4db9 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -3326,7 +3326,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 65e346cba6e8..8a110b420e9a 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -70,7 +70,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>
@@ -317,7 +316,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 );
@@ -1086,7 +1085,7 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode,
}
-bool ModelData_Impl::ShowDocumentInfoDialog(const std::function< void () >& aFunc)
+bool ModelData_Impl::ShowDocumentInfoDialog()
{
bool bDialogUsed = false;
@@ -1109,11 +1108,7 @@ bool ModelData_Impl::ShowDocumentInfoDialog(const std::function< void () >& aFun
0 );
if ( xDispatch.is() )
{
- uno::Sequence< beans::PropertyValue > aProperties(1);
- uno::Reference< lang::XUnoTunnel > aAsyncFunc(new AsyncFunc(aFunc));
- aProperties[0].Name = "AsyncFunc";
- aProperties[0].Value <<= aAsyncFunc;
- xDispatch->dispatch( aURL, aProperties );
+ xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() );
bDialogUsed = true;
}
}
@@ -1622,33 +1617,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 c295c5c13a0c..78b686956ed0 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>
@@ -622,14 +622,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::getUnoTunnelImplementation<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 a99e9dead483..f0aa84f20661 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);
@@ -445,10 +441,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 )