1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 );
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(),
71 oox::core::Relations
aRelations("");
72 oox::drawingml::ShapePtr
pShape(
73 new oox::drawingml::Shape( "com.sun.star.drawing.DiagramShape" ) );
74 drawingml::loadDiagram(pShape
,
81 oox::drawingml::ThemePtr
pTheme(
82 new oox::drawingml::Theme());
83 basegfx::B2DHomMatrix aMatrix
;
84 pShape
->addShape( *this,
87 aMatrix
, pShape
->getFillProperties() );
92 bool QuickDiagrammingImport::exportDocument() throw()
97 const ::oox::drawingml::Theme
* QuickDiagrammingImport::getCurrentTheme() const
103 const oox::drawingml::table::TableStyleListPtr
QuickDiagrammingImport::getTableStyles()
105 return oox::drawingml::table::TableStyleListPtr();
108 oox::vml::Drawing
* QuickDiagrammingImport::getVmlDrawing()
113 oox::drawingml::chart::ChartConverter
* QuickDiagrammingImport::getChartConverter()
118 OUString
QuickDiagrammingImport::getImplementationName()
120 return QuickDiagrammingImport_getImplementationName();
123 ::oox::ole::VbaProject
* QuickDiagrammingImport::implCreateVbaProject() const
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */