[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - include/oox oox/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 1 14:05:22 UTC 2021
include/oox/helper/graphichelper.hxx | 7 ---
oox/source/helper/graphichelper.cxx | 67 -----------------------------------
oox/source/ppt/pptimport.cxx | 41 ---------------------
3 files changed, 115 deletions(-)
New commits:
commit 7fb701b263b6b9184bb4c2243c5a0a37c46e465e
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Dec 18 11:17:53 2020 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Apr 1 16:04:06 2021 +0200
do not preload all images in the pptx importer
Now with my GraphicFilter::MakeGraphicsAvailableThreaded() patches
for Impress images will be loaded in parallel as they are needed,
which should usually be more efficient than loading all of them
immediately.
This basically reverts commits:
b1319842a49cdf6512bbd9e81081e2a9edbd6089
04e27df3c162f1df02f061b94434a38d1eaa3a46
9eb8e2737d3a4d52ce1b0cc44091a3b7ecf59e3b
Change-Id: I46bb0d6d93fb69f03f464308f6fce1603aafdfd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107945
Tested-by: Luboš Luňák <l.lunak at collabora.com>
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx
index 9a99647589b2..50c54175db93 100644
--- a/include/oox/helper/graphichelper.hxx
+++ b/include/oox/helper/graphichelper.hxx
@@ -113,10 +113,6 @@ public:
const css::uno::Reference< css::io::XInputStream >& rxInStrm,
const WmfExternal* pExtHeader = nullptr ) const;
- /** Imports graphics from the passed input streams. */
- std::vector< css::uno::Reference<css::graphic::XGraphic> >
- importGraphics(const std::vector< css::uno::Reference<css::io::XInputStream> >& rStreams) const;
-
/** Imports a graphic from the passed binary memory block. */
css::uno::Reference< css::graphic::XGraphic >
importGraphic( const StreamDataSequence& rGraphicData ) const;
@@ -127,9 +123,6 @@ public:
const OUString& rStreamName,
const WmfExternal* pExtHeader = nullptr ) const;
- /** Imports graphics from the storage with the passed stream names. */
- void importEmbeddedGraphics(const std::vector<OUString>& rStreamNames) const;
-
/** calculates the original size of a graphic which is necessary to be able to calculate cropping values
@return The original Graphic size in 100thmm */
css::awt::Size getOriginalSize( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic ) const;
diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx
index e8a1c94326a7..82978a76451e 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -35,7 +35,6 @@
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
#include <tools/gen.hxx>
-#include <comphelper/propertysequence.hxx>
#include <comphelper/sequence.hxx>
#include <oox/helper/containerhelper.hxx>
#include <oox/helper/propertyset.hxx>
@@ -277,27 +276,6 @@ Reference< XGraphic > GraphicHelper::importGraphic( const Reference< XInputStrea
return xGraphic;
}
-std::vector< uno::Reference<graphic::XGraphic> > GraphicHelper::importGraphics(const std::vector< uno::Reference<io::XInputStream> >& rStreams) const
-{
- std::vector< uno::Sequence<beans::PropertyValue> > aArgsVec;
-
- for (const auto& rStream : rStreams)
- {
- uno::Sequence<beans::PropertyValue > aArgs = comphelper::InitPropertySequence(
- {
- {"InputStream", uno::makeAny(rStream)}
- });
- aArgsVec.push_back(aArgs);
- }
-
- std::vector< uno::Reference<graphic::XGraphic> > aRet;
-
- if (mxGraphicProvider.is())
- aRet = comphelper::sequenceToContainer< std::vector< uno::Reference<graphic::XGraphic> > >(mxGraphicProvider->queryGraphics(comphelper::containerToSequence(aArgsVec)));
-
- return aRet;
-}
-
Reference< XGraphic > GraphicHelper::importGraphic( const StreamDataSequence& rGraphicData ) const
{
Reference< XGraphic > xGraphic;
@@ -309,51 +287,6 @@ Reference< XGraphic > GraphicHelper::importGraphic( const StreamDataSequence& rG
return xGraphic;
}
-void GraphicHelper::importEmbeddedGraphics(const std::vector<OUString>& rStreamNames) const
-{
- // Don't actually return anything, just fill maEmbeddedGraphics.
-
- // Stream names and streams to be imported.
- std::vector<OUString> aMissingStreamNames;
- std::vector< uno::Reference<io::XInputStream> > aMissingStreams;
-
- initializeGraphicMapperIfNeeded();
-
- SAL_WARN_IF(!mxGraphicMapper.is(), "oox", "GraphicHelper::importEmbeddedGraphic - graphic mapper not available");
-
- for (const auto& rStreamName : rStreamNames)
- {
-
- if (rStreamName.isEmpty())
- {
- SAL_WARN("oox", "GraphicHelper::importEmbeddedGraphics - empty stream name");
- continue;
- }
-
- Reference<XGraphic> xGraphic;
-
- xGraphic = mxGraphicMapper->findGraphic(rStreamName);
-
- if (!xGraphic.is())
- {
- aMissingStreamNames.push_back(rStreamName);
- aMissingStreams.push_back(mxStorage->openInputStream(rStreamName));
- }
- }
-
- std::vector< uno::Reference<graphic::XGraphic> > aGraphics = importGraphics(aMissingStreams);
-
-
- assert(aGraphics.size() == aMissingStreamNames.size());
- for (size_t i = 0; i < aGraphics.size(); ++i)
- {
- if (aGraphics[i].is())
- {
- mxGraphicMapper->putGraphic(aMissingStreamNames[i], aGraphics[i]);
- }
- }
-}
-
Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStreamName, const WmfExternal* pExtHeader ) const
{
Reference< XGraphic > xGraphic;
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index f7d00920705e..98a855c77fa4 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -73,37 +73,6 @@ PowerPointImport::~PowerPointImport()
maPPTShapes.clear();
}
-/// Visits the relations from pRelations which are of type rType.
-static void visitRelations(PowerPointImport& rImport, const core::RelationsRef& pRelations, const OUString& rType, std::vector<OUString>& rImageFragments)
-{
- core::RelationsRef pRelationsOfType = pRelations->getRelationsFromTypeFromOfficeDoc(rType);
- if (!pRelationsOfType)
- return;
-
- for (const auto& rRelation : *pRelationsOfType)
- {
- OUString aFragment = pRelationsOfType->getFragmentPathFromRelation(rRelation.second);
- if (core::RelationsRef pFragmentRelations = rImport.importRelations(aFragment))
- {
- // See if the fragment has images.
- if (core::RelationsRef pImages = pFragmentRelations->getRelationsFromTypeFromOfficeDoc("image"))
- {
- for (const auto& rImage : *pImages)
- {
- OUString aPath = pImages->getFragmentPathFromRelation(rImage.second);
- // Safe subset: e.g. WMF may have an external header from the
- // referencing fragment.
- if (aPath.endsWith(".jpg") || aPath.endsWith(".jpeg"))
- rImageFragments.push_back(aPath);
- }
- }
-
- // See if the fragment has a slide layout, and recurse.
- visitRelations(rImport, pFragmentRelations, "slideLayout", rImageFragments);
- }
- }
-}
-
bool PowerPointImport::importDocument()
{
/* to activate the PPTX dumper, define the environment variable
@@ -132,16 +101,6 @@ bool PowerPointImport::importDocument()
const OUString sPresPropsPath
= xPresentationFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc("presProps");
- // importRelations() is cheap, it will do an actual import for the first time only.
- if (core::RelationsRef pFragmentRelations = importRelations(aFragmentPath))
- {
- std::vector<OUString> aImageFragments;
- visitRelations(*this, pFragmentRelations, "slide", aImageFragments);
- visitRelations(*this, pFragmentRelations, "slideMaster", aImageFragments);
-
- getGraphicHelper().importEmbeddedGraphics(aImageFragments);
- }
-
bool bRet = importFragment(xPresentationFragmentHandler);
if (bRet && !sPresPropsPath.isEmpty())
{
More information about the Libreoffice-commits
mailing list