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 "oox/ppt/dgmimport.hxx"
21 #include "oox/drawingml/theme.hxx"
22 #include "drawingml/diagram/diagram.hxx"
23 #include "oox/dump/pptxdumper.hxx"
25 #include <com/sun/star/drawing/XShape.hpp>
26 #include <com/sun/star/uno/XComponentContext.hpp>
28 #include <services.hxx>
30 using namespace ::com::sun::star
;
31 using namespace ::com::sun::star::uno
;
32 using namespace ::com::sun::star::xml::sax
;
33 using namespace oox::core
;
35 namespace oox
{ namespace ppt
{
37 OUString SAL_CALL
QuickDiagrammingImport_getImplementationName()
39 return OUString( "com.sun.star.comp.Impress.oox.QuickDiagrammingImport" );
42 uno::Sequence
< OUString
> SAL_CALL
QuickDiagrammingImport_getSupportedServiceNames()
44 const OUString aServiceName
= "com.sun.star.comp.ooxpptx.dgm.import";
45 const Sequence
< OUString
> aSeq( &aServiceName
, 1 );
49 uno::Reference
< uno::XInterface
> SAL_CALL
QuickDiagrammingImport_createInstance( const Reference
< XComponentContext
>& rxContext
) throw( Exception
)
51 return (cppu::OWeakObject
*)new QuickDiagrammingImport( rxContext
);
54 QuickDiagrammingImport::QuickDiagrammingImport( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
)
55 : XmlFilterBase( rxContext
)
58 bool QuickDiagrammingImport::importDocument() throw (css::uno::RuntimeException
, std::exception
)
60 /* to activate the PPTX dumper, define the environment variable
61 OOO_PPTXDUMPER and insert the full path to the file
62 file:///<path-to-oox-module>/source/dump/pptxdumper.ini. */
63 OOX_DUMP_FILE( ::oox::dump::pptx::Dumper
);
66 OUString aFragmentPath
= getFragmentPathFromFirstTypeFromOfficeDoc( "diagramLayout" );
68 Reference
<drawing::XShapes
> xParentShape(getParentShape(),
70 oox::drawingml::ShapePtr
pShape(
71 new oox::drawingml::Shape( "com.sun.star.drawing.DiagramShape" ) );
72 drawingml::loadDiagram(pShape
,
78 oox::drawingml::ThemePtr
pTheme(
79 new oox::drawingml::Theme());
80 basegfx::B2DHomMatrix aMatrix
;
81 pShape
->addShape( *this,
84 aMatrix
, pShape
->getFillProperties() );
89 bool QuickDiagrammingImport::exportDocument() throw()
94 const ::oox::drawingml::Theme
* QuickDiagrammingImport::getCurrentTheme() const
100 const oox::drawingml::table::TableStyleListPtr
QuickDiagrammingImport::getTableStyles()
102 return oox::drawingml::table::TableStyleListPtr();
105 oox::vml::Drawing
* QuickDiagrammingImport::getVmlDrawing()
110 oox::drawingml::chart::ChartConverter
* QuickDiagrammingImport::getChartConverter()
115 OUString
QuickDiagrammingImport::getImplementationName() throw (css::uno::RuntimeException
, std::exception
)
117 return QuickDiagrammingImport_getImplementationName();
120 ::oox::ole::VbaProject
* QuickDiagrammingImport::implCreateVbaProject() const
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */