LibreOffice Module oox (master)  1
vmldrawing.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_VML_VMLDRAWING_HXX
21 #define INCLUDED_OOX_VML_VMLDRAWING_HXX
22 
23 #include <map>
24 #include <memory>
25 #include <vector>
26 
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <oox/dllapi.h>
30 #include <rtl/ustring.hxx>
31 #include <sal/types.h>
32 
33 namespace com::sun::star {
34  namespace awt { struct Rectangle; }
35  namespace drawing { class XDrawPage; }
36  namespace drawing { class XShape; }
37  namespace drawing { class XShapes; }
38 }
39 
40 namespace oox {
41  namespace core { class XmlFilterBase; }
42  namespace ole { class EmbeddedControl; }
43  namespace ole { class EmbeddedForm; }
44  namespace vml { class ShapeContainer; }
45 }
46 
47 namespace oox::vml {
48 
49 class ShapeBase;
50 
51 
54 {
58 };
59 
60 
63 {
64  OUString maShapeId;
65  OUString maName;
66  bool mbAutoLoad;
67  const bool mbDmlShape;
68 
69  explicit OleObjectInfo( bool bDmlShape = false );
70 
72  void setShapeId( sal_Int32 nShapeId );
73 };
74 
75 // =========================================/===================================
76 
79 {
80  OUString maShapeId;
81  OUString maFragmentPath;
82  OUString maName;
84 
85  explicit ControlInfo();
86 
88  void setShapeId( sal_Int32 nShapeId );
89 };
90 
91 
94 {
95 public:
96  explicit Drawing(
97  ::oox::core::XmlFilterBase& rFilter,
98  const css::uno::Reference< css::drawing::XDrawPage >& rxDrawPage,
100 
101  virtual ~Drawing();
102 
106  DrawingType getType() const { return meType; }
108  ShapeContainer& getShapes() { return *mxShapes; }
110  const ShapeContainer& getShapes() const { return *mxShapes; }
112  ::oox::ole::EmbeddedForm& getControlForm() const;
113 
116  void registerBlockId( sal_Int32 nBlockId );
119  void registerOleObject( const OleObjectInfo& rOleObject );
122  void registerControl( const ControlInfo& rControl );
123 
125  void finalizeFragmentImport();
126 
129  void convertAndInsert() const;
130 
132  sal_Int32 getLocalShapeIndex( const OUString& rShapeId ) const;
134  const OleObjectInfo* getOleObjectInfo( const OUString& rShapeId ) const;
136  const ControlInfo* getControlInfo( const OUString& rShapeId ) const;
137 
140  css::uno::Reference< css::drawing::XShape >
141  createAndInsertXShape(
142  const OUString& rService,
143  const css::uno::Reference< css::drawing::XShapes >& rxShapes,
144  const css::awt::Rectangle& rShapeRect ) const;
145 
148  css::uno::Reference< css::drawing::XShape >
149  createAndInsertXControlShape(
150  const ::oox::ole::EmbeddedControl& rControl,
151  const css::uno::Reference< css::drawing::XShapes >& rxShapes,
152  const css::awt::Rectangle& rShapeRect,
153  sal_Int32& rnCtrlIndex ) const;
154 
156  virtual bool isShapeSupported( const ShapeBase& rShape ) const;
157 
160  virtual OUString getShapeBaseName( const ShapeBase& rShape ) const;
161 
164  virtual bool convertClientAnchor(
165  css::awt::Rectangle& orShapeRect,
166  const OUString& rShapeAnchor ) const;
167 
170  virtual css::uno::Reference< css::drawing::XShape >
171  createAndInsertClientXShape(
172  const ShapeBase& rShape,
173  const css::uno::Reference< css::drawing::XShapes >& rxShapes,
174  const css::awt::Rectangle& rShapeRect ) const;
175 
180  virtual void notifyXShapeInserted(
181  const css::uno::Reference< css::drawing::XShape >& rxShape,
182  const css::awt::Rectangle& rShapeRect,
183  const ShapeBase& rShape, bool bGroupChild );
184 
185 private:
186  typedef ::std::vector< sal_Int32 > BlockIdVector;
187  typedef ::std::map< OUString, OleObjectInfo > OleObjectInfoMap;
188  typedef ::std::map< OUString, ControlInfo > ControlInfoMap;
189 
191  css::uno::Reference< css::drawing::XDrawPage >
193  mutable std::unique_ptr<::oox::ole::EmbeddedForm> mxCtrlForm;
194  mutable BlockIdVector maBlockIds;
195  std::unique_ptr<ShapeContainer> mxShapes;
196  OleObjectInfoMap maOleObjects;
197  ControlInfoMap maControls;
199 };
200 
201 
202 } // namespace oox::vml
203 
204 #endif
205 
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString maShapeId
Shape identifier for shape lookup.
Definition: vmldrawing.hxx:64
A shape object that is part of a drawing.
Definition: vmlshape.hxx:233
::std::vector< sal_Int32 > BlockIdVector
Definition: vmldrawing.hxx:186
A wrapper for a control form embedded directly in a draw page.
Definition: axcontrol.hxx:959
ShapeContainer & getShapes()
Returns read/write access to the container of shapes and templates.
Definition: vmldrawing.hxx:108
::std::map< OUString, OleObjectInfo > OleObjectInfoMap
Definition: vmldrawing.hxx:187
BlockIdVector maBlockIds
Block identifiers used by this drawing.
Definition: vmldrawing.hxx:194
exports com.sun.star. awt
DrawingType
Enumerates different types of VML drawings.
Definition: vmldrawing.hxx:53
OleObjectInfoMap maOleObjects
Info about all embedded OLE objects, mapped by shape id.
Definition: vmldrawing.hxx:196
std::unique_ptr<::oox::ole::EmbeddedForm > mxCtrlForm
The control form used to process embedded controls.
Definition: vmldrawing.hxx:193
css::uno::Reference< css::drawing::XDrawPage > mxDrawPage
UNO draw page used to insert the shapes.
Definition: vmldrawing.hxx:192
const ShapeContainer & getShapes() const
Returns read access to the container of shapes and templates.
Definition: vmldrawing.hxx:110
::cppu::WeakComponentImplHelper< css::report::XShape, css::lang::XServiceInfo > ShapeBase
exports com.sun.star. drawing
Contains information about a form control embedded in a draw page.
Definition: vmldrawing.hxx:78
DocumentType eType
Container that holds a list of shapes and shape templates.
bool mbTextContentShape
Whether this control shape will be imported to Writer or not (has AnchorType property or not)...
Definition: vmldrawing.hxx:83
Contains information about an OLE object embedded in a draw page.
Definition: vmldrawing.hxx:62
PowerPoint: OLE objects are part of DrawingML.
Definition: vmldrawing.hxx:57
::oox::core::XmlFilterBase & getFilter() const
Returns the filter object that imports/exports this VML drawing.
Definition: vmldrawing.hxx:104
DrawingType getType() const
Returns the application type containing the drawing.
Definition: vmldrawing.hxx:106
OUString maName
Programmatical name of the form control.
Definition: vmldrawing.hxx:82
Excel: OLE objects are part of VML.
Definition: vmldrawing.hxx:56
PropType meType
Definition: dffdumper.cxx:161
ControlInfoMap maControls
Info about all embedded form controls, mapped by control name.
Definition: vmldrawing.hxx:197
Contains generic information about an OLE object.
::std::map< OUString, ControlInfo > ControlInfoMap
Definition: vmldrawing.hxx:188
OUString maFragmentPath
Path to the fragment describing the form control properties.
Definition: vmldrawing.hxx:81
Word: One shape per drawing.
Definition: vmldrawing.hxx:55
OUString maName
Programmatical name of the OLE object.
Definition: vmldrawing.hxx:65
OUString maShapeId
Shape identifier for shape lookup.
Definition: vmldrawing.hxx:80
const DrawingType meType
Application type containing the drawing.
Definition: vmldrawing.hxx:198
::oox::core::XmlFilterBase & mrFilter
Filter object that imports/exports the VML drawing.
Definition: vmldrawing.hxx:190
#define OOX_DLLPUBLIC
Definition: dllapi.h:28
Represents the collection of VML shapes for a complete draw page.
Definition: vmldrawing.hxx:93
const PowerPointImport & mrFilter
Definition: pptimport.cxx:253
const bool mbDmlShape
True = DrawingML shape (PowerPoint), false = VML shape (Excel/Word).
Definition: vmldrawing.hxx:67
std::unique_ptr< ShapeContainer > mxShapes
All shapes and shape templates.
Definition: vmldrawing.hxx:195