summaryrefslogtreecommitdiff
path: root/include/oox
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-06-28 11:02:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-28 14:30:53 +0200
commit6701329f5b7d9c39fbd00f2f735dcd375992aa8e (patch)
tree4645f37a3b98ebfd6e9bdcf6593be38bdba540fc /include/oox
parent0aa7ee7827fc77b5b4c0479402bfbd9a4e5d9e84 (diff)
[API CHANGE] drop ShapeContextHandler service and interface
There is zero chance an extension is using this, because it is so intimately tired together with the oox and writerfilter interactions. I'm removing this so I can expose the ShapeContextHandler and then override it's implementation in a more fashion without jumping through UNO hoops. Change-Id: I79ef30247f4642303dfdb92bbf8f6e6226234829 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117996 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/oox')
-rw-r--r--include/oox/shape/ShapeContextHandler.hxx151
1 files changed, 151 insertions, 0 deletions
diff --git a/include/oox/shape/ShapeContextHandler.hxx b/include/oox/shape/ShapeContextHandler.hxx
new file mode 100644
index 000000000000..5655cc25acf2
--- /dev/null
+++ b/include/oox/shape/ShapeContextHandler.hxx
@@ -0,0 +1,151 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <memory>
+#include <cppuhelper/implbase.hxx>
+#include <oox/drawingml/graphicshapecontext.hxx>
+#include <oox/core/fragmenthandler2.hxx>
+#include <oox/core/xmlfilterbase.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/graphic/XGraphicMapper.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+namespace oox::shape {
+
+class ShapeFilterBase;
+
+class ShapeFragmentHandler : public core::FragmentHandler2
+{
+public:
+ typedef rtl::Reference<ShapeFragmentHandler> Pointer_t;
+
+ explicit ShapeFragmentHandler(core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath )
+ : FragmentHandler2(rFilter, rFragmentPath)
+ {
+ }
+};
+
+class OOX_DLLPUBLIC ShapeContextHandler:
+ public ::cppu::WeakImplHelper< css::xml::sax::XFastContextHandler >
+{
+public:
+ explicit ShapeContextHandler
+ (css::uno::Reference< css::uno::XComponentContext > const & context);
+
+ virtual ~ShapeContextHandler() override;
+
+ // css::xml::sax::XFastContextHandler:
+ virtual void SAL_CALL startFastElement
+ (::sal_Int32 Element,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+
+ virtual void SAL_CALL startUnknownElement
+ (const OUString & Namespace,
+ const OUString & Name,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+
+ virtual void SAL_CALL endFastElement(::sal_Int32 Element) override;
+
+ virtual void SAL_CALL endUnknownElement
+ (const OUString & Namespace,
+ const OUString & Name) override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext
+ (::sal_Int32 Element,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+
+ virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
+ createUnknownChildContext
+ (const OUString & Namespace,
+ const OUString & Name,
+ const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
+
+ virtual void SAL_CALL characters(const OUString & aChars) override;
+
+ css::uno::Reference< css::drawing::XShape > getShape();
+
+ css::uno::Reference< css::drawing::XDrawPage > getDrawPage();
+ void setDrawPage(const css::uno::Reference< css::drawing::XDrawPage > & the_value);
+
+ css::uno::Reference< css::frame::XModel > getModel();
+ void setModel(const css::uno::Reference< css::frame::XModel > & the_value);
+
+ OUString getRelationFragmentPath();
+ void setRelationFragmentPath(const OUString & the_value);
+
+ sal_Int32 getStartToken();
+ void setStartToken( sal_Int32 _starttoken );
+
+ css::awt::Point getPosition();
+ void setPosition(const css::awt::Point& rPosition);
+
+ void setDocumentProperties(const css::uno::Reference<css::document::XDocumentProperties>& xDocProps);
+ css::uno::Reference<css::document::XDocumentProperties> getDocumentProperties();
+ css::uno::Sequence<css::beans::PropertyValue> getMediaDescriptor();
+ void setMediaDescriptor(const css::uno::Sequence<css::beans::PropertyValue>& rMediaDescriptor);
+
+ void setGraphicMapper(css::uno::Reference<css::graphic::XGraphicMapper> const & rGraphicMapper);
+
+private:
+ ShapeContextHandler(ShapeContextHandler const &) = delete;
+ void operator =(ShapeContextHandler const &) = delete;
+
+ ::sal_uInt32 mnStartToken;
+ css::awt::Point maPosition;
+
+ drawingml::ShapePtr mpShape;
+ std::shared_ptr< vml::Drawing > mpDrawing;
+
+ typedef rtl::Reference<drawingml::GraphicShapeContext>
+ GraphicShapeContextPtr;
+ css::uno::Reference<XFastContextHandler> mxDrawingFragmentHandler;
+ css::uno::Reference<XFastContextHandler> mxGraphicShapeContext;
+ css::uno::Reference<XFastContextHandler> mxDiagramShapeContext;
+ css::uno::Reference<XFastContextHandler> mxLockedCanvasContext;
+ css::uno::Reference<XFastContextHandler> mxWpsContext;
+ css::uno::Reference<css::drawing::XShape> mxSavedShape;
+ css::uno::Reference<XFastContextHandler> mxWpgContext;
+ css::uno::Reference<XFastContextHandler> mxChartShapeContext;
+ css::uno::Reference<css::document::XDocumentProperties> mxDocumentProperties;
+ css::uno::Sequence<css::beans::PropertyValue> maMediaDescriptor;
+
+ ::rtl::Reference< ShapeFilterBase > mxShapeFilterBase;
+ drawingml::ThemePtr mpThemePtr;
+ css::uno::Reference<css::drawing::XDrawPage> mxDrawPage;
+ OUString msRelationFragmentPath;
+
+ css::uno::Reference<XFastContextHandler> const & getGraphicShapeContext(::sal_Int32 Element);
+ css::uno::Reference<XFastContextHandler> const & getChartShapeContext(::sal_Int32 Element);
+ css::uno::Reference<XFastContextHandler> const & getDrawingShapeContext();
+ css::uno::Reference<XFastContextHandler> const & getDiagramShapeContext();
+ css::uno::Reference<XFastContextHandler> const & getLockedCanvasContext(sal_Int32 nElement);
+ css::uno::Reference<XFastContextHandler> const & getWpsContext(sal_Int32 nStartElement, sal_Int32 nElement);
+ css::uno::Reference<XFastContextHandler> const & getWpgContext(sal_Int32 nElement);
+ css::uno::Reference<XFastContextHandler> getContextHandler(sal_Int32 nElement = 0);
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */