framework/source/fwe/helper/titlehelper.cxx | 7 - framework/source/services/autorecovery.cxx | 14 +-- include/framework/titlehelper.hxx | 4 include/sfx2/objsh.hxx | 5 - include/sfx2/sfxbasemodel.hxx | 8 + offapi/UnoApi_offapi.mk | 1 offapi/com/sun/star/frame/XModel3.idl | 51 ++++++++++++ sc/qa/unit/copy_paste_test.cxx | 10 +- sd/qa/unit/misc-tests.cxx | 2 sfx2/source/doc/objmisc.cxx | 20 ++-- sfx2/source/doc/objxtor.cxx | 4 sfx2/source/doc/sfxbasemodel.cxx | 116 ++++++++++++++++------------ sfx2/source/view/frame2.cxx | 2 sfx2/source/view/sfxbasecontroller.cxx | 3 14 files changed, 164 insertions(+), 83 deletions(-)
New commits: commit 857caa5fc69b92e781457a1b67a89aa051c2d70f Author: Noel Grandin <n...@peralex.com> AuthorDate: Fri Apr 30 13:00:35 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Apr 30 16:03:35 2021 +0200 tdf#79049 speed up OOXML workbook load we spend a lot of time in ScAttrArray::GetLastVisibleAttr which appears to be very expensive for this worksheet. This is re-computed every time we enter SfxBaseModel::getArgs Reduce the recomputation by introducing a new method which only retrieves specific SfxBaseModel arguments. This takes the load time from 5m9 to 1m9 for me. Change-Id: I605fae0faa94760c7d6993877c9559ea5dc813cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114905 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index 24d1eb3bf898..ae9c1f348b0e 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XUntitledNumbers.hpp> +#include <com/sun/star/frame/XModel3.hpp> #include <com/sun/star/document/XDocumentEventBroadcaster.hpp> #include <unotools/configmgr.hxx> @@ -302,7 +303,7 @@ void TitleHelper::impl_sendTitleChangedEvent () void TitleHelper::impl_updateTitle (bool init) { - css::uno::Reference< css::frame::XModel > xModel; + css::uno::Reference< css::frame::XModel3 > xModel; css::uno::Reference< css::frame::XController > xController; css::uno::Reference< css::frame::XFrame > xFrame; // SYNCHRONIZED -> @@ -329,7 +330,7 @@ void TitleHelper::impl_updateTitle (bool init) } } -void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel, bool init) +void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel3 >& xModel, bool init) { css::uno::Reference< css::uno::XInterface > xOwner; css::uno::Reference< css::frame::XUntitledNumbers > xNumbers; @@ -363,7 +364,7 @@ void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::fram if (xURLProvider.is()) sURL = xURLProvider->getLocation (); - utl::MediaDescriptor aDescriptor(xModel->getArgs()); + utl::MediaDescriptor aDescriptor(xModel->getArgs2( { utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME() } )); const OUString sSuggestedSaveAsName = aDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME(), OUString()); diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 085b627f5794..3fdf6c0af01c 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -34,7 +34,7 @@ #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XLoadable.hpp> -#include <com/sun/star/frame/XModel2.hpp> +#include <com/sun/star/frame/XModel3.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -636,7 +636,7 @@ private: @threadsafe */ - void implts_registerDocument(const css::uno::Reference< css::frame::XModel >& xDocument); + void implts_registerDocument(const css::uno::Reference< css::frame::XModel3 >& xDocument); /** @short remove the specified document from our internal document list. @@ -1537,7 +1537,7 @@ void SAL_CALL AutoRecovery::removeStatusListener(const css::uno::Reference< css: void SAL_CALL AutoRecovery::documentEventOccured(const css::document::DocumentEvent& aEvent) { - css::uno::Reference< css::frame::XModel > xDocument(aEvent.Source, css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XModel3 > xDocument(aEvent.Source, css::uno::UNO_QUERY); // new document => put it into the internal list if ( @@ -2361,7 +2361,7 @@ IMPL_LINK_NOARG(AutoRecovery, implts_asyncDispatch, LinkParamNone*, void) } } -void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame::XModel >& xDocument) +void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame::XModel3 > & xDocument) { // ignore corrupted events, where no document is given ... Runtime Error ?! if (!xDocument.is()) @@ -2386,7 +2386,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame aCacheLock.unlock(); - utl::MediaDescriptor lDescriptor(xDocument->getArgs()); + utl::MediaDescriptor lDescriptor(xDocument->getArgs2( { utl::MediaDescriptor::PROP_FILTERNAME(), utl::MediaDescriptor::PROP_NOAUTOSAVE() } )); // check if this document must be ignored for recovery ! // Some use cases don't wish support for AutoSave/Recovery ... as e.g. OLE-Server / ActiveX Control etcpp. @@ -4004,11 +4004,11 @@ void AutoRecovery::implts_verifyCacheAgainstDesktopDocumentList() // extract the model from the frame. // Ignore "view only" frames, which does not have a model. css::uno::Reference< css::frame::XController > xController; - css::uno::Reference< css::frame::XModel > xModel; + css::uno::Reference< css::frame::XModel3 > xModel; xController = xFrame->getController(); if (xController.is()) - xModel = xController->getModel(); + xModel.set( xController->getModel(), UNO_QUERY_THROW ); if (!xModel.is()) continue; diff --git a/include/framework/titlehelper.hxx b/include/framework/titlehelper.hxx index 1152cf1f7a5f..93322818955d 100644 --- a/include/framework/titlehelper.hxx +++ b/include/framework/titlehelper.hxx @@ -37,7 +37,7 @@ namespace com::sun::star::frame { class XController; } namespace com::sun::star::frame { class XFrame; } -namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::frame { class XModel3; } namespace com::sun::star::frame { class XUntitledNumbers; } namespace com::sun::star::uno { class XComponentContext; } namespace com::sun::star::uno { class XInterface; } @@ -138,7 +138,7 @@ class FWK_DLLPUBLIC TitleHelper final : private ::cppu::BaseMutex void impl_sendTitleChangedEvent (); void impl_updateTitle (bool init = false); - void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel, bool init); + void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel3 >& xModel, bool init); void impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController, bool init); void impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame, bool init); diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 5d95f29bf3ea..dfdd240a4413 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -26,6 +26,7 @@ #include <vcl/errcode.hxx> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/frame/XModel3.hpp> #include <vcl/bitmapex.hxx> #include <svl/poolitem.hxx> @@ -565,11 +566,11 @@ public: virtual SfxObjectShell* GetObjectShell() override; - css::uno::Reference< css::frame::XModel > + css::uno::Reference< css::frame::XModel3 > GetModel() const; // Only temporarily for the applications! void SetBaseModel( SfxBaseModel* pModel ); - css::uno::Reference< css::frame::XModel > GetBaseModel() const; + css::uno::Reference< css::frame::XModel3 > GetBaseModel() const; // Only temporarily for the applications! virtual css::uno::Sequence< OUString > GetEventNames(); diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx index 8fa52fbfa977..d2b50b6aa9be 100644 --- a/include/sfx2/sfxbasemodel.hxx +++ b/include/sfx2/sfxbasemodel.hxx @@ -41,7 +41,7 @@ #include <com/sun/star/document/XStorageBasedDocument.hpp> #include <com/sun/star/document/XScriptInvocationContext.hpp> #include <com/sun/star/lang/XEventListener.hpp> -#include <com/sun/star/frame/XModel2.hpp> +#include <com/sun/star/frame/XModel3.hpp> #include <com/sun/star/util/XModifiable2.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/view/XPrintable.hpp> @@ -124,7 +124,7 @@ typedef ::cppu::WeakImplHelper < css::container::XChild , css::document::XEventsSupplier , css::document::XEmbeddedScripts , css::document::XScriptInvocationContext - , css::frame::XModel2 + , css::frame::XModel3 , css::util::XModifiable2 , css::view::XPrintable , css::view::XPrintJobBroadcaster @@ -329,6 +329,10 @@ public: virtual void SAL_CALL setArgs(const css::uno::Sequence<css::beans::PropertyValue>& aArgs) override; + // XModel3 + + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getArgs2( const css::uno::Sequence< OUString > & requestedArgs ) override; + // XModifiable2 diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 21adff7c48f1..c958419b7aa3 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2643,6 +2643,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/frame,\ XMenuBarMergingAcceptor \ XModel \ XModel2 \ + XModel3 \ XModule \ XModuleManager \ XModuleManager2 \ diff --git a/offapi/com/sun/star/frame/XModel3.idl b/offapi/com/sun/star/frame/XModel3.idl new file mode 100644 index 000000000000..96c527d261c2 --- /dev/null +++ b/offapi/com/sun/star/frame/XModel3.idl @@ -0,0 +1,51 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_frame_XModel3_idl__ +#define __com_sun_star_frame_XModel3_idl__ + +#include <com/sun/star/frame/XModel2.idl> + + + module com { module sun { module star { module frame { + +/** extends interface XModel2 with optimised read access getArgs(). + + */ +interface XModel3 : com::sun::star::frame::XModel2 +{ + /** Provides optimised read access + (so we don't need to fetch expensive properties that we are not interested in) + on currently representation of the + com::sun::star::document::MediaDescriptor + of this model which describes the model and its state. + Returns only the selected args. + + @param requestedArgs + @returns the requested and possibly some more arguments with which the model was originally created or + stored the last time. + */ + sequence< com::sun::star::beans::PropertyValue > getArgs2([in] sequence< string > requestedArgs); +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index ba5d0a226489..b9476b018c06 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -94,7 +94,7 @@ void ScCopyPasteTest::testCopyPasteXLS() ScDocShellRef xDocSh = loadDoc(u"chartx2.", FORMAT_XLS); CPPUNIT_ASSERT_MESSAGE("Failed to load chartx2.xls.", xDocSh.is()); - uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY ); + uno::Reference< frame::XModel2 > xModel2 = xDocSh->GetModel(); CPPUNIT_ASSERT( xModel2.is() ); Reference< frame::XController2 > xController = xModel2->createDefaultViewController( xTargetFrame ); @@ -217,7 +217,7 @@ void ScCopyPasteTest::testTdf84411() ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); CPPUNIT_ASSERT(xDocSh); - uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY ); + uno::Reference< frame::XModel2 > xModel2 = xDocSh->GetModel(); CPPUNIT_ASSERT( xModel2.is() ); Reference< frame::XController2 > xController = xModel2->createDefaultViewController( xTargetFrame ); @@ -286,7 +286,7 @@ void ScCopyPasteTest::testTdf124565() Reference< frame::XFrame > xTargetFrame = xDesktop->findFrame( "_blank", 0 ); CPPUNIT_ASSERT( xTargetFrame.is() ); - uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY ); + uno::Reference< frame::XModel2 > xModel2 = xDocSh->GetModel(); CPPUNIT_ASSERT( xModel2.is() ); Reference< frame::XController2 > xController = xModel2->createDefaultViewController( xTargetFrame ); @@ -357,7 +357,7 @@ void ScCopyPasteTest::testTdf126421() ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); CPPUNIT_ASSERT(xDocSh); - uno::Reference<frame::XModel2> xModel2(xDocSh->GetModel(), UNO_QUERY); + uno::Reference<frame::XModel2> xModel2 = xDocSh->GetModel(); CPPUNIT_ASSERT(xModel2.is()); Reference<frame::XController2> xController = xModel2->createDefaultViewController(xTargetFrame); @@ -477,7 +477,7 @@ ScDocShellRef ScCopyPasteTest::loadDocAndSetupModelViewController(std::u16string ScDocShellRef xDocSh = loadDoc(rFileName, nFormat, bReadWrite); CPPUNIT_ASSERT_MESSAGE(OString("Failed to load " + OUStringToOString(rFileName, RTL_TEXTENCODING_UTF8)).getStr(), xDocSh.is()); - uno::Reference< frame::XModel2 > xModel2(xDocSh->GetModel(), UNO_QUERY); + uno::Reference< frame::XModel2 > xModel2 = xDocSh->GetModel(); CPPUNIT_ASSERT(xModel2.is()); Reference< frame::XController2 > xController = xModel2->createDefaultViewController(xTargetFrame); diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index 6329ca3a602c..1ba7d21a2d18 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -157,7 +157,7 @@ sd::DrawDocShellRef SdMiscTest::Load(const OUString& rURL, sal_Int32 nFormat) sd::DrawDocShellRef xDocSh = loadURL(rURL, nFormat); CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh.is()); - uno::Reference< frame::XModel2 > xModel2(xDocSh->GetModel(), uno::UNO_QUERY); + uno::Reference< frame::XModel2 > xModel2 = xDocSh->GetModel(); CPPUNIT_ASSERT(xModel2.is()); uno::Reference< frame::XController2 > xController = xModel2->createDefaultViewController(xTargetFrame); diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 81298eb8ff11..18042c7eca70 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1871,48 +1871,48 @@ bool SfxObjectShell::IsContinueImportOnFilterExceptions(std::u16string_view aErr bool SfxObjectShell::isEditDocLocked() const { - Reference<XModel> xModel = GetModel(); + Reference<XModel3> xModel = GetModel(); if (!xModel.is()) return false; if (!officecfg::Office::Common::Misc::AllowEditReadonlyDocs::get()) return true; - comphelper::NamedValueCollection aArgs(xModel->getArgs()); + comphelper::NamedValueCollection aArgs(xModel->getArgs2( { "LockEditDoc" } )); return aArgs.getOrDefault("LockEditDoc", false); } bool SfxObjectShell::isContentExtractionLocked() const { - Reference<XModel> xModel = GetModel(); + Reference<XModel3> xModel = GetModel(); if (!xModel.is()) return false; - comphelper::NamedValueCollection aArgs(xModel->getArgs()); + comphelper::NamedValueCollection aArgs(xModel->getArgs2( { "LockContentExtraction" } )); return aArgs.getOrDefault("LockContentExtraction", false); } bool SfxObjectShell::isExportLocked() const { - Reference<XModel> xModel = GetModel(); + Reference<XModel3> xModel = GetModel(); if (!xModel.is()) return false; - comphelper::NamedValueCollection aArgs(xModel->getArgs()); + comphelper::NamedValueCollection aArgs(xModel->getArgs2( { "LockExport" } )); return aArgs.getOrDefault("LockExport", false); } bool SfxObjectShell::isPrintLocked() const { - Reference<XModel> xModel = GetModel(); + Reference<XModel3> xModel = GetModel(); if (!xModel.is()) return false; - comphelper::NamedValueCollection aArgs(xModel->getArgs()); + comphelper::NamedValueCollection aArgs(xModel->getArgs2( { "LockPrint" } )); return aArgs.getOrDefault("LockPrint", false); } bool SfxObjectShell::isSaveLocked() const { - Reference<XModel> xModel = GetModel(); + Reference<XModel3> xModel = GetModel(); if (!xModel.is()) return false; - comphelper::NamedValueCollection aArgs(xModel->getArgs()); + comphelper::NamedValueCollection aArgs(xModel->getArgs2( { "LockSave" } )); return aArgs.getOrDefault("LockSave", false); } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 6c6c7852c8d2..70b2e1e2e486 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -827,7 +827,7 @@ uno::Sequence< OUString > SfxObjectShell::GetEventNames() } -css::uno::Reference< css::frame::XModel > SfxObjectShell::GetModel() const +css::uno::Reference< css::frame::XModel3 > SfxObjectShell::GetModel() const { return GetBaseModel(); } @@ -843,7 +843,7 @@ void SfxObjectShell::SetBaseModel( SfxBaseModel* pModel ) } -css::uno::Reference< css::frame::XModel > SfxObjectShell::GetBaseModel() const +css::uno::Reference< css::frame::XModel3 > SfxObjectShell::GetBaseModel() const { return pImpl->pBaseModel; } diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index fa5d405dfdd0..0af671f6ae0a 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -931,8 +931,14 @@ OUString SAL_CALL SfxBaseModel::getURL() // frame::XModel - Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() +{ + return getArgs2({}); +} + +// frame::XModel3 + +Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs2(const Sequence<OUString> & requestedArgsSeq ) { SfxModelGuard aGuard( *this ); @@ -942,6 +948,10 @@ Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() return m_pData->m_seqArguments; } + std::set<std::u16string_view> requestedArgs; + for (OUString const & s : requestedArgsSeq) + requestedArgs.insert(s); + if ( m_pData->m_pObjectShell.is() ) { Sequence< beans::PropertyValue > seqArgsNew; @@ -958,67 +968,79 @@ Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() sal_Int32 nNewLength = seqArgsNew.getLength(); - // "WinExtent" property should be updated always. - // We can store it now to overwrite an old value - // since it is not from ItemSet - tools::Rectangle aTmpRect = m_pData->m_pObjectShell->GetVisArea( ASPECT_CONTENT ); - aTmpRect = OutputDevice::LogicToLogic(aTmpRect, MapMode(m_pData->m_pObjectShell->GetMapUnit()), MapMode(MapUnit::Map100thMM)); - - Sequence< sal_Int32 > aRectSeq(4); - aRectSeq[0] = aTmpRect.Left(); - aRectSeq[1] = aTmpRect.Top(); - aRectSeq[2] = aTmpRect.IsWidthEmpty() ? aTmpRect.Left() : aTmpRect.Right(); - aRectSeq[3] = aTmpRect.IsHeightEmpty() ? aTmpRect.Top() : aTmpRect.Bottom(); + if (requestedArgs.empty() || requestedArgs.count(u"WinExtent")) + { + // "WinExtent" property should be updated always. + // We can store it now to overwrite an old value + // since it is not from ItemSet + tools::Rectangle aTmpRect = m_pData->m_pObjectShell->GetVisArea( ASPECT_CONTENT ); + aTmpRect = OutputDevice::LogicToLogic(aTmpRect, MapMode(m_pData->m_pObjectShell->GetMapUnit()), MapMode(MapUnit::Map100thMM)); + + Sequence< sal_Int32 > aRectSeq(4); + aRectSeq[0] = aTmpRect.Left(); + aRectSeq[1] = aTmpRect.Top(); + aRectSeq[2] = aTmpRect.IsWidthEmpty() ? aTmpRect.Left() : aTmpRect.Right(); + aRectSeq[3] = aTmpRect.IsHeightEmpty() ? aTmpRect.Top() : aTmpRect.Bottom(); - seqArgsNew.realloc( ++nNewLength ); - seqArgsNew[ nNewLength - 1 ].Name = "WinExtent"; - seqArgsNew[ nNewLength - 1 ].Value <<= aRectSeq; + seqArgsNew.realloc( ++nNewLength ); + seqArgsNew[ nNewLength - 1 ].Name = "WinExtent"; + seqArgsNew[ nNewLength - 1 ].Value <<= aRectSeq; + } - if ( !m_pData->m_aPreusedFilterName.isEmpty() ) + if (requestedArgs.empty() || requestedArgs.count(u"PreusedFilterName")) { - seqArgsNew.realloc( ++nNewLength ); - seqArgsNew[ nNewLength - 1 ].Name = "PreusedFilterName"; - seqArgsNew[ nNewLength - 1 ].Value <<= m_pData->m_aPreusedFilterName; + if ( !m_pData->m_aPreusedFilterName.isEmpty() ) + { + seqArgsNew.realloc( ++nNewLength ); + seqArgsNew[ nNewLength - 1 ].Name = "PreusedFilterName"; + seqArgsNew[ nNewLength - 1 ].Value <<= m_pData->m_aPreusedFilterName; + } } - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell.get() ); - if ( pFrame ) + if (requestedArgs.empty() || requestedArgs.count(u"DocumentBorder")) { - SvBorder aBorder = pFrame->GetBorderPixelImpl(); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell.get() ); + if ( pFrame ) + { + SvBorder aBorder = pFrame->GetBorderPixelImpl(); - Sequence< sal_Int32 > aBorderSeq(4); - aBorderSeq[0] = aBorder.Left(); - aBorderSeq[1] = aBorder.Top(); - aBorderSeq[2] = aBorder.Right(); - aBorderSeq[3] = aBorder.Bottom(); + Sequence< sal_Int32 > aBorderSeq(4); + aBorderSeq[0] = aBorder.Left(); + aBorderSeq[1] = aBorder.Top(); + aBorderSeq[2] = aBorder.Right(); + aBorderSeq[3] = aBorder.Bottom(); - seqArgsNew.realloc( ++nNewLength ); - seqArgsNew[ nNewLength - 1 ].Name = "DocumentBorder"; - seqArgsNew[ nNewLength - 1 ].Value <<= aBorderSeq; + seqArgsNew.realloc( ++nNewLength ); + seqArgsNew[ nNewLength - 1 ].Name = "DocumentBorder"; + seqArgsNew[ nNewLength - 1 ].Value <<= aBorderSeq; + } } - // only the values that are not supported by the ItemSet must be cached here - Sequence< beans::PropertyValue > aFinalCache; - sal_Int32 nFinalLength = 0; - - for ( const auto& rOrg : std::as_const(m_pData->m_seqArguments) ) + if (requestedArgs.empty()) { - auto bNew = std::none_of(seqArgsOld.begin(), seqArgsOld.end(), - [&rOrg](const beans::PropertyValue& rOld){ return rOld.Name == rOrg.Name; }); - if ( bNew ) + // only the values that are not supported by the ItemSet must be cached here + Sequence< beans::PropertyValue > aFinalCache; + sal_Int32 nFinalLength = 0; + + for ( const auto& rOrg : std::as_const(m_pData->m_seqArguments) ) { - // the entity with this name should be new for seqArgsNew - // since it is not supported by transformer + auto bNew = std::none_of(seqArgsOld.begin(), seqArgsOld.end(), + [&rOrg](const beans::PropertyValue& rOld){ return rOld.Name == rOrg.Name; }); + if ( bNew ) + { + // the entity with this name should be new for seqArgsNew + // since it is not supported by transformer - seqArgsNew.realloc( ++nNewLength ); - seqArgsNew[ nNewLength - 1 ] = rOrg; + seqArgsNew.realloc( ++nNewLength ); + seqArgsNew[ nNewLength - 1 ] = rOrg; - aFinalCache.realloc( ++nFinalLength ); - aFinalCache[ nFinalLength - 1 ] = rOrg; + aFinalCache.realloc( ++nFinalLength ); + aFinalCache[ nFinalLength - 1 ] = rOrg; + } } - } - m_pData->m_seqArguments = aFinalCache; + m_pData->m_seqArguments = aFinalCache; + } return seqArgsNew; } @@ -4228,7 +4250,7 @@ Reference< frame::XController2 > SAL_CALL SfxBaseModel::createViewController( pBaseController->SetCreationArguments_Impl( i_rArguments ); // some initial view settings, coming from our most recent attachResource call - ::comphelper::NamedValueCollection aDocumentLoadArgs( getArgs() ); + ::comphelper::NamedValueCollection aDocumentLoadArgs( getArgs2( { "ViewOnly", "PluginMode" } ) ); if ( aDocumentLoadArgs.getOrDefault( "ViewOnly", false ) ) pViewFrame->GetFrame().SetMenuBarOn_Impl( false ); diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index 3e96664527e0..990f46a53f86 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -381,7 +381,7 @@ bool SfxFrame::IsMenuBarOn_Impl() const void SfxFrame::PrepareForDoc_Impl( SfxObjectShell& i_rDoc ) { - const ::comphelper::NamedValueCollection aDocumentArgs( i_rDoc.GetModel()->getArgs() ); + const ::comphelper::NamedValueCollection aDocumentArgs( i_rDoc.GetModel()->getArgs2( { "Hidden", "PluginMode" } ) ); // hidden? OSL_ENSURE( !pImpl->bHidden, "when does this happen?" ); diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index a74674a82917..8f5bfddba32d 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1224,7 +1224,8 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) if ( i_eConnect == E_CONNECT ) { - ::comphelper::NamedValueCollection aDocumentArgs( getModel()->getArgs() ); + css::uno::Reference<css::frame::XModel3> xModel(getModel(), css::uno::UNO_QUERY_THROW); + ::comphelper::NamedValueCollection aDocumentArgs( xModel->getArgs2( { "PluginMode" } ) ); const sal_Int16 nPluginMode = aDocumentArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); const bool bHasPluginMode = ( nPluginMode != 0 ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits