diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-02-23 01:52:05 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-02-23 11:49:51 +0100 |
commit | ad2809b4b6dc4837b0c1cadd89a14a234d995fb2 (patch) | |
tree | 61827039979b0c5c666081d8209f4fa9a731965e /oox | |
parent | c9611c5e6465948de029e9c2fbd17e75ee07d31f (diff) |
tdf#47365: import support for PPTX presentation's loop attribute
presProps stream handler is added to do this.
Export is not handled here.
Change-Id: I1979941a09c472c14f96c778ca9960ec14786fbe
Reviewed-on: https://gerrit.libreoffice.org/68237
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/Library_oox.mk | 1 | ||||
-rw-r--r-- | oox/source/ppt/pptimport.cxx | 9 | ||||
-rw-r--r-- | oox/source/ppt/presPropsfragmenthandler.cxx | 55 |
3 files changed, 65 insertions, 0 deletions
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk index f924d27543ba..7da04f81a6ce 100644 --- a/oox/Library_oox.mk +++ b/oox/Library_oox.mk @@ -266,6 +266,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\ oox/source/ppt/pptshapegroupcontext \ oox/source/ppt/pptshapepropertiescontext \ oox/source/ppt/presentationfragmenthandler \ + oox/source/ppt/presPropsfragmenthandler \ oox/source/ppt/slidefragmenthandler \ oox/source/ppt/slidemastertextstylescontext \ oox/source/ppt/slidepersist \ diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index 22f661d95546..d65e408d3c13 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -40,6 +40,7 @@ #include <oox/helper/graphichelper.hxx> #include <oox/ole/vbaproject.hxx> #include <oox/ppt/presentationfragmenthandler.hxx> +#include <oox/ppt/presPropsfragmenthandler.hxx> #include <oox/token/tokens.hxx> using namespace ::com::sun::star; @@ -125,6 +126,8 @@ bool PowerPointImport::importDocument() OUString aFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "officeDocument" ); FragmentHandlerRef xPresentationFragmentHandler( new PresentationFragmentHandler( *this, aFragmentPath ) ); maTableStyleListPath = xPresentationFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( "tableStyles" ); + 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)) @@ -137,6 +140,12 @@ bool PowerPointImport::importDocument() } bool bRet = importFragment(xPresentationFragmentHandler); + if (bRet && !sPresPropsPath.isEmpty()) + { + FragmentHandlerRef xPresPropsFragmentHandler( + new PresPropsFragmentHandler(*this, sPresPropsPath)); + importFragment(xPresPropsFragmentHandler); + } static bool bNoSmartartWarning = getenv("OOX_NO_SMARTART_WARNING"); if (!bNoSmartartWarning && mbMissingExtDrawing) diff --git a/oox/source/ppt/presPropsfragmenthandler.cxx b/oox/source/ppt/presPropsfragmenthandler.cxx new file mode 100644 index 000000000000..effee38dfaa0 --- /dev/null +++ b/oox/source/ppt/presPropsfragmenthandler.cxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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 <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/presentation/XPresentationSupplier.hpp> + +#include <oox/helper/attributelist.hxx> +#include <oox/ppt/pptimport.hxx> +#include <oox/ppt/presPropsfragmenthandler.hxx> +#include <oox/token/namespaces.hxx> + +namespace oox +{ +namespace ppt +{ +PresPropsFragmentHandler::PresPropsFragmentHandler(core::XmlFilterBase& rFilter, + const OUString& rFragmentPath) + : FragmentHandler2(rFilter, rFragmentPath) +{ +} + +PresPropsFragmentHandler::~PresPropsFragmentHandler() = default; + +void PresPropsFragmentHandler::finalizeImport() +{ + css::uno::Reference<css::presentation::XPresentationSupplier> xPresentationSupplier( + getFilter().getModel(), css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::beans::XPropertySet> xPresentationProps( + xPresentationSupplier->getPresentation(), css::uno::UNO_QUERY_THROW); + xPresentationProps->setPropertyValue("IsEndless", css::uno::Any(m_bLoop)); +} + +core::ContextHandlerRef PresPropsFragmentHandler::onCreateContext(sal_Int32 aElementToken, + const AttributeList& rAttribs) +{ + switch (aElementToken) + { + case PPT_TOKEN(presentationPr): + return this; + case PPT_TOKEN(showPr): + m_bLoop = rAttribs.getBool(XML_loop, false); + return this; + } + return this; +} +} // namespace ppt +} // namespace oox + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |