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 "oox/drawingml/diagram/diagram.hxx"
23 : #include "oox/dump/pptxdumper.hxx"
24 :
25 : #include <com/sun/star/drawing/XShape.hpp>
26 :
27 : using ::rtl::OUString;
28 : using namespace ::com::sun::star;
29 : using namespace ::com::sun::star::uno;
30 : using namespace ::com::sun::star::xml::sax;
31 : using namespace oox::core;
32 :
33 : namespace oox { namespace ppt {
34 :
35 14 : OUString SAL_CALL QuickDiagrammingImport_getImplementationName() throw()
36 : {
37 14 : return CREATE_OUSTRING( "com.sun.star.comp.Impress.oox.QuickDiagrammingImport" );
38 : }
39 :
40 0 : uno::Sequence< OUString > SAL_CALL QuickDiagrammingImport_getSupportedServiceNames() throw()
41 : {
42 0 : const OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.ooxpptx.dgm.import" );
43 0 : const Sequence< OUString > aSeq( &aServiceName, 1 );
44 0 : return aSeq;
45 : }
46 :
47 0 : uno::Reference< uno::XInterface > SAL_CALL QuickDiagrammingImport_createInstance( const Reference< XComponentContext >& rxContext ) throw( Exception )
48 : {
49 0 : return (cppu::OWeakObject*)new QuickDiagrammingImport( rxContext );
50 : }
51 :
52 0 : QuickDiagrammingImport::QuickDiagrammingImport( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
53 0 : : XmlFilterBase( rxContext )
54 0 : {}
55 :
56 0 : bool QuickDiagrammingImport::importDocument() throw()
57 : {
58 : /* to activate the PPTX dumper, define the environment variable
59 : OOO_PPTXDUMPER and insert the full path to the file
60 : file:///<path-to-oox-module>/source/dump/pptxdumper.ini. */
61 : OOX_DUMP_FILE( ::oox::dump::pptx::Dumper );
62 :
63 0 : OUString aEmpty;
64 0 : OUString aFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "diagramLayout" ) );
65 :
66 0 : Reference<drawing::XShapes> xParentShape(getParentShape(),
67 0 : UNO_QUERY_THROW);
68 : oox::drawingml::ShapePtr pShape(
69 0 : new oox::drawingml::Shape( "com.sun.star.drawing.DiagramShape" ) );
70 : drawingml::loadDiagram(pShape,
71 : *this,
72 : aEmpty,
73 : aFragmentPath,
74 : aEmpty,
75 0 : aEmpty);
76 : oox::drawingml::ThemePtr pTheme(
77 0 : new oox::drawingml::Theme());
78 0 : basegfx::B2DHomMatrix aMatrix;
79 : pShape->addShape( *this,
80 0 : pTheme.get(),
81 : xParentShape,
82 0 : aMatrix );
83 :
84 0 : return true;
85 : }
86 :
87 0 : bool QuickDiagrammingImport::exportDocument() throw()
88 : {
89 0 : return false;
90 : }
91 :
92 0 : const ::oox::drawingml::Theme* QuickDiagrammingImport::getCurrentTheme() const
93 : {
94 : // TODO
95 0 : return 0;
96 : }
97 :
98 0 : sal_Int32 QuickDiagrammingImport::getSchemeClr( sal_Int32 /*nColorSchemeToken*/ ) const
99 : {
100 : // TODO
101 0 : return 0;
102 : }
103 :
104 0 : const oox::drawingml::table::TableStyleListPtr QuickDiagrammingImport::getTableStyles()
105 : {
106 0 : return oox::drawingml::table::TableStyleListPtr();
107 : }
108 :
109 0 : oox::vml::Drawing* QuickDiagrammingImport::getVmlDrawing()
110 : {
111 0 : return 0;
112 : }
113 :
114 0 : oox::drawingml::chart::ChartConverter* QuickDiagrammingImport::getChartConverter()
115 : {
116 0 : return 0;
117 : }
118 :
119 0 : OUString QuickDiagrammingImport::implGetImplementationName() const
120 : {
121 0 : return QuickDiagrammingImport_getImplementationName();
122 : }
123 :
124 0 : ::oox::ole::VbaProject* QuickDiagrammingImport::implCreateVbaProject() const
125 : {
126 0 : return 0;
127 : }
128 :
129 51 : }}
130 :
131 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|