LibreOffice Module oox (master)  1
shapes.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_OOX_EXPORT_SHAPES_HXX
21 #define INCLUDED_OOX_EXPORT_SHAPES_HXX
22 
23 #include <cstddef>
24 #include <memory>
25 #include <unordered_map>
26 
27 #include <com/sun/star/awt/Size.hpp>
28 #include <com/sun/star/table/BorderLine2.hpp>
29 #include <com/sun/star/uno/Reference.hxx>
30 #include <oox/dllapi.h>
31 #include <oox/export/drawingml.hxx>
32 #include <oox/export/utils.hxx>
33 #include <rtl/ustring.hxx>
34 #include <sal/types.h>
35 #include <sax/fshelper.hxx>
36 #include <tools/fract.hxx>
37 #include <vcl/mapmod.hxx>
38 
39 namespace com::sun::star {
40 namespace beans {
41  class XPropertySet;
42 }
43 namespace drawing {
44  class XShape;
45 }
46 
47 namespace embed {
48  class XEmbeddedObject;
49 }
50 namespace io {
51  class XInputStream;
52 }
53 namespace uno {
54  class XComponentContext;
55  class XInterface;
56 }
57 }
58 
59 namespace oox::core {
60  class XmlFilterBase;
61 }
62 
63 class Graphic;
64 
65 namespace oox {
66 
67 OOX_DLLPUBLIC css::uno::Reference<css::io::XInputStream> GetOLEObjectStream(
68  css::uno::Reference<css::uno::XComponentContext> const& xContext,
69  css::uno::Reference<css::embed::XEmbeddedObject> const& xObj,
70  OUString const& i_rProgID,
71  OUString & o_rMediaType,
72  OUString & o_rRelationType,
73  OUString & o_rSuffix,
74  const char *& o_rpProgID);
75 
76 }
77 
78 namespace oox::drawingml {
79 
81 
82 private:
84 
85 public:
86  typedef std::unordered_map< css::uno::Reference< css::drawing::XShape>, sal_Int32> ShapeHashMap;
87 
88 protected:
89  sal_Int32 mnShapeIdMax;
90 
91  void WriteGraphicObjectShapePart( const css::uno::Reference< css::drawing::XShape >& xShape, const Graphic *pGraphic=nullptr );
92 
93  OUString GetShapeName(const css::uno::Reference< css::drawing::XShape >& xShape);
94 
95 private:
96  sal_Int32 mnXmlNamespace;
97  MapMode maMapModeSrc, maMapModeDest;
98  std::shared_ptr<URLTransformer> mpURLTransformer;
99 
100  css::awt::Size MapSize( const css::awt::Size& ) const;
101 
102  ShapeHashMap maShapeMap;
103  ShapeHashMap* mpShapeMap;
104 
105 public:
106 
107  ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS,
108  ShapeHashMap* pShapeMap, ::oox::core::XmlFilterBase* pFB,
109  DocumentType eDocumentType = DOCUMENT_PPTX,
110  DMLTextExport* pTextExport = nullptr );
111  virtual ~ShapeExport() {}
112 
113  void SetURLTranslator(const std::shared_ptr<URLTransformer>& pTransformer);
114 
115  static bool NonEmptyText( const css::uno::Reference< css::uno::XInterface >& xIface );
116 
117  ShapeExport&
118  WritePolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape, bool bClosed );
119  ShapeExport&
120  WriteClosedPolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape );
121  ShapeExport&
122  WriteConnectorShape( const css::uno::Reference< css::drawing::XShape >& xShape );
123  ShapeExport&
124  WriteCustomShape( const css::uno::Reference< css::drawing::XShape >& xShape );
125  ShapeExport&
126  WriteEllipseShape( const css::uno::Reference< css::drawing::XShape >& xShape );
127  ShapeExport&
128  WriteGraphicObjectShape( const css::uno::Reference< css::drawing::XShape >& xShape );
129  ShapeExport&
130  WriteGroupShape( const css::uno::Reference< css::drawing::XShape >& xShape );
131  ShapeExport&
132  WriteLineShape( const css::uno::Reference< css::drawing::XShape >& xShape );
133  ShapeExport&
134  WriteNonVisualDrawingProperties( const css::uno::Reference< css::drawing::XShape >& xShape, const char* sName );
135  virtual ShapeExport&
136  WriteNonVisualProperties( const css::uno::Reference< css::drawing::XShape >& xShape );
137  ShapeExport&
138  WriteOpenPolyPolygonShape( const css::uno::Reference< css::drawing::XShape >& xShape );
139  ShapeExport&
140  WriteRectangleShape( const css::uno::Reference< css::drawing::XShape >& xShape );
141 
181  ShapeExport& WriteShape( const css::uno::Reference< css::drawing::XShape >& xShape );
182  ShapeExport& WriteTextBox( const css::uno::Reference< css::uno::XInterface >& xIface, sal_Int32 nXmlNamespace, bool bWritePropertiesAsLstStyles = false );
183  virtual ShapeExport&
184  WriteTextShape( const css::uno::Reference< css::drawing::XShape >& xShape );
185  ShapeExport&
186  WriteTableShape( const css::uno::Reference< css::drawing::XShape >& xShape );
187  void WriteMathShape(css::uno::Reference<css::drawing::XShape> const& xShape);
188  ShapeExport&
189  WriteOLE2Shape( const css::uno::Reference< css::drawing::XShape >& xShape );
190  virtual ShapeExport&
191  WriteUnknownShape( const css::uno::Reference< css::drawing::XShape >& xShape );
192 
193  void WriteTable( const css::uno::Reference< css::drawing::XShape >& rXShape );
194 
195  void WriteTableCellProperties(const css::uno::Reference< css::beans::XPropertySet >& rXPropSet);
196 
197  void WriteBorderLine(const sal_Int32 XML_line, const css::table::BorderLine2& rBorderLine);
198  void WriteTableCellBorders(const css::uno::Reference< css::beans::XPropertySet >& rXPropSet);
199 
200  sal_Int32 GetNewShapeID( const css::uno::Reference< css::drawing::XShape >& rShape );
201  sal_Int32 GetNewShapeID( const css::uno::Reference< css::drawing::XShape >& rShape, ::oox::core::XmlFilterBase* pFB );
202  sal_Int32 GetShapeID( const css::uno::Reference< css::drawing::XShape >& rShape );
203  static sal_Int32 GetShapeID( const css::uno::Reference< css::drawing::XShape >& rShape, ShapeHashMap* pShapeMap );
204 };
205 
206 }
207 
208 #endif // INCLUDED_OOX_EXPORT_SHAPES_HXX
209 
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Interface to be implemented by the parent exporter that knows how to handle shape text...
Definition: drawingml.hxx:122
const char * sName
Definition: olehelper.cxx:92
exports com.sun.star. io
exports com.sun.star. embed
std::shared_ptr< URLTransformer > mpURLTransformer
Definition: shapes.hxx:98
exports com.sun.star. drawing
class SAL_NO_VTABLE XPropertySet
std::shared_ptr< FastSerializerHelper > FSHelperPtr
exports com.sun.star. beans
ShapeHashMap * mpShapeMap
Definition: shapes.hxx:103
#define OOX_DLLPUBLIC
Definition: dllapi.h:28
uno::Reference< io::XInputStream > GetOLEObjectStream(uno::Reference< uno::XComponentContext > const &xContext, uno::Reference< embed::XEmbeddedObject > const &xObj, OUString const &i_rProgID, OUString &o_rMediaType, OUString &o_rRelationType, OUString &o_rSuffix, const char *&o_rpProgID)
Definition: shapes.cxx:272
std::unordered_map< css::uno::Reference< css::drawing::XShape >, sal_Int32 > ShapeHashMap
Definition: shapes.hxx:86