Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "oox/ppt/dgmimport.hxx"
21 : #include "oox/drawingml/theme.hxx"
22 : #include "drawingml/diagram/diagram.hxx"
23 : #include "oox/dump/pptxdumper.hxx"
24 :
25 : #include <com/sun/star/drawing/XShape.hpp>
26 : #include <com/sun/star/uno/XComponentContext.hpp>
27 :
28 : #include <services.hxx>
29 :
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;
34 :
35 : namespace oox { namespace ppt {
36 :
37 144 : OUString SAL_CALL QuickDiagrammingImport_getImplementationName()
38 : {
39 144 : return OUString( "com.sun.star.comp.Impress.oox.QuickDiagrammingImport" );
40 : }
41 :
42 0 : uno::Sequence< OUString > SAL_CALL QuickDiagrammingImport_getSupportedServiceNames()
43 : {
44 0 : const OUString aServiceName = "com.sun.star.comp.ooxpptx.dgm.import";
45 0 : const Sequence< OUString > aSeq( &aServiceName, 1 );
46 0 : return aSeq;
47 : }
48 :
49 0 : uno::Reference< uno::XInterface > SAL_CALL QuickDiagrammingImport_createInstance( const Reference< XComponentContext >& rxContext ) throw( Exception )
50 : {
51 0 : return (cppu::OWeakObject*)new QuickDiagrammingImport( rxContext );
52 : }
53 :
54 0 : QuickDiagrammingImport::QuickDiagrammingImport( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
55 0 : : XmlFilterBase( rxContext )
56 0 : {}
57 :
58 0 : bool QuickDiagrammingImport::importDocument() throw (css::uno::RuntimeException, std::exception)
59 : {
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 );
64 :
65 0 : OUString aEmpty;
66 0 : OUString aFragmentPath = getFragmentPathFromFirstTypeFromOfficeDoc( "diagramLayout" );
67 :
68 0 : Reference<drawing::XShapes> xParentShape(getParentShape(),
69 0 : UNO_QUERY_THROW);
70 : oox::drawingml::ShapePtr pShape(
71 0 : new oox::drawingml::Shape( "com.sun.star.drawing.DiagramShape" ) );
72 : drawingml::loadDiagram(pShape,
73 : *this,
74 : aEmpty,
75 : aFragmentPath,
76 : aEmpty,
77 0 : aEmpty);
78 : oox::drawingml::ThemePtr pTheme(
79 0 : new oox::drawingml::Theme());
80 0 : basegfx::B2DHomMatrix aMatrix;
81 : pShape->addShape( *this,
82 0 : pTheme.get(),
83 : xParentShape,
84 0 : aMatrix, pShape->getFillProperties() );
85 :
86 0 : return true;
87 : }
88 :
89 0 : bool QuickDiagrammingImport::exportDocument() throw()
90 : {
91 0 : return false;
92 : }
93 :
94 0 : const ::oox::drawingml::Theme* QuickDiagrammingImport::getCurrentTheme() const
95 : {
96 : // TODO
97 0 : return 0;
98 : }
99 :
100 0 : sal_Int32 QuickDiagrammingImport::getSchemeClr( sal_Int32 /*nColorSchemeToken*/ ) const
101 : {
102 : // TODO
103 0 : return 0;
104 : }
105 :
106 0 : const oox::drawingml::table::TableStyleListPtr QuickDiagrammingImport::getTableStyles()
107 : {
108 0 : return oox::drawingml::table::TableStyleListPtr();
109 : }
110 :
111 0 : oox::vml::Drawing* QuickDiagrammingImport::getVmlDrawing()
112 : {
113 0 : return 0;
114 : }
115 :
116 0 : oox::drawingml::chart::ChartConverter* QuickDiagrammingImport::getChartConverter()
117 : {
118 0 : return 0;
119 : }
120 :
121 0 : OUString QuickDiagrammingImport::implGetImplementationName() const
122 : {
123 0 : return QuickDiagrammingImport_getImplementationName();
124 : }
125 :
126 0 : ::oox::ole::VbaProject* QuickDiagrammingImport::implCreateVbaProject() const
127 : {
128 0 : return 0;
129 : }
130 :
131 408 : }}
132 :
133 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|