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