Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / oox / source / ppt / dgmimport.cxx
blob191ec177102849326477adf74e0af5c70cb69472
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <basegfx/matrix/b2dhommatrix.hxx>
21 #include <oox/ppt/dgmimport.hxx>
22 #include <oox/drawingml/theme.hxx>
23 #include <drawingml/diagram/diagram.hxx>
24 #include <oox/dump/pptxdumper.hxx>
26 #include <com/sun/star/drawing/XShape.hpp>
27 #include <com/sun/star/drawing/XShapes.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <services.hxx>
32 using namespace ::com::sun::star;
33 using namespace ::com::sun::star::uno;
34 using namespace ::com::sun::star::xml::sax;
35 using namespace oox::core;
37 namespace oox { namespace ppt {
39 OUString QuickDiagrammingImport_getImplementationName()
41 return OUString( "com.sun.star.comp.Impress.oox.QuickDiagrammingImport" );
44 uno::Sequence< OUString > QuickDiagrammingImport_getSupportedServiceNames()
46 const OUString aServiceName = "com.sun.star.comp.ooxpptx.dgm.import";
47 const Sequence< OUString > aSeq( &aServiceName, 1 );
48 return aSeq;
51 uno::Reference< uno::XInterface > QuickDiagrammingImport_createInstance( const Reference< XComponentContext >& rxContext )
53 return static_cast<cppu::OWeakObject*>(new QuickDiagrammingImport( rxContext ));
56 QuickDiagrammingImport::QuickDiagrammingImport( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
57 : XmlFilterBase( rxContext )
60 bool QuickDiagrammingImport::importDocument()
62 /* to activate the PPTX dumper, define the environment variable
63 OOO_PPTXDUMPER and insert the full path to the file
64 file:///<path-to-oox-module>/source/dump/pptxdumper.ini. */
65 OOX_DUMP_FILE( ::oox::dump::pptx::Dumper );
67 OUString aFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "diagramLayout" );
69 Reference<drawing::XShapes> xParentShape(getParentShape(),
70 UNO_QUERY_THROW);
71 oox::core::Relations aRelations("");
72 oox::drawingml::ShapePtr pShape(
73 new oox::drawingml::Shape( "com.sun.star.drawing.DiagramShape" ) );
74 drawingml::loadDiagram(pShape,
75 *this,
76 "",
77 aFragmentPath,
78 "",
79 "",
80 aRelations);
81 oox::drawingml::ThemePtr pTheme(
82 new oox::drawingml::Theme());
83 basegfx::B2DHomMatrix aMatrix;
84 pShape->addShape( *this,
85 pTheme.get(),
86 xParentShape,
87 aMatrix, pShape->getFillProperties() );
89 return true;
92 bool QuickDiagrammingImport::exportDocument() throw()
94 return false;
97 const ::oox::drawingml::Theme* QuickDiagrammingImport::getCurrentTheme() const
99 // TODO
100 return nullptr;
103 const oox::drawingml::table::TableStyleListPtr QuickDiagrammingImport::getTableStyles()
105 return oox::drawingml::table::TableStyleListPtr();
108 oox::vml::Drawing* QuickDiagrammingImport::getVmlDrawing()
110 return nullptr;
113 oox::drawingml::chart::ChartConverter* QuickDiagrammingImport::getChartConverter()
115 return nullptr;
118 OUString QuickDiagrammingImport::getImplementationName()
120 return QuickDiagrammingImport_getImplementationName();
123 ::oox::ole::VbaProject* QuickDiagrammingImport::implCreateVbaProject() const
125 return nullptr;
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */