LibreOffice Module oox (master) 1
vmlexport.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_VMLEXPORT_HXX
21#define INCLUDED_OOX_EXPORT_VMLEXPORT_HXX
22
23#include <sal/config.h>
24
25#include <string_view>
26
27#include <com/sun/star/uno/Reference.hxx>
28#include <editeng/outlobj.hxx>
30#include <oox/dllapi.h>
31#include <rtl/strbuf.hxx>
32#include <rtl/string.hxx>
33#include <rtl/ustring.hxx>
34#include <sal/types.h>
35#include <sax/fshelper.hxx>
36#include <vcl/checksum.hxx>
37#include <rtl/ref.hxx>
38
39namespace com::sun::star {
40 namespace drawing {
41 class XShape;
42 }
43}
44
45namespace oox::drawingml {
46 class DrawingML;
47}
48
49
50namespace sax_fastparser {
51 class FastAttributeList;
52}
53
54class Point;
55namespace tools { class Rectangle; }
56class SdrObject;
57
58namespace oox::vml {
59
62{
63public:
64 virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
67 virtual void WriteVMLTextBox(css::uno::Reference<css::drawing::XShape> xShape) = 0;
68protected:
70 virtual ~VMLTextExport() {}
71};
72
74{
77
80
82 sal_Int16 m_eHOri, m_eVOri, m_eHRel, m_eVRel;
84 bool m_bInline; // css::text::TextContentAnchorType_AS_CHARACTER
85 bool m_IsFollowingTextFlow = false;
86
89
92
94 sal_uInt32 m_nShapeType;
95
98
100 OStringBuffer m_ShapeStyle;
101
103 OStringBuffer m_TextboxStyle;
104
106 OString m_sShapeId;
107
109 std::vector<bool> m_aShapeTypeWritten;
110
113
116
121
124
127
128public:
129 VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport = nullptr);
130 virtual ~VMLExport() override;
131
132 const ::sax_fastparser::FSHelperPtr&
133 GetFS() const { return m_pSerializer; }
134
135 void SetFS(const ::sax_fastparser::FSHelperPtr& pSerializer);
136
140 OString const & AddSdrObject( const SdrObject& rObj,
141 bool const bIsFollowingTextFlow = false,
142 sal_Int16 eHOri = -1, sal_Int16 eVOri = -1, sal_Int16 eHRel = -1,
143 sal_Int16 eVRel = -1,
144 sax_fastparser::FastAttributeList* pWrapAttrList = nullptr,
145 const bool bOOxmlExport = false, sal_uInt32 nId = 0);
146 OString const & AddInlineSdrObject( const SdrObject& rObj, const bool bOOxmlExport );
147 virtual void AddSdrObjectVMLObject( const SdrObject& rObj) override;
148 static bool IsWaterMarkShape(std::u16string_view rStr);
149
150 void SetSkipwzName(bool bSkipwzName) { m_bSkipwzName = bSkipwzName; }
151 void SetHashMarkForType(bool bUseHashMarkForType) { m_bUseHashMarkForType = bUseHashMarkForType; }
152 void OverrideShapeIDGen(bool bOverrideShapeIdGeneration,
153 const OString& sShapeIDPrefix = OString());
154 static OString GetVMLShapeTypeDefinition(std::string_view sShapeID, const bool bIsPictureFrame);
155
156protected:
161 void AddShapeAttribute( sal_Int32 nAttribute, const OString& sValue );
162
164 using EscherEx::EndShape;
165
167 virtual sal_uInt32 GenerateShapeId() override;
168
172 virtual sal_Int32 StartShape();
173
177 virtual void EndShape( sal_Int32 nShapeElement );
178 virtual void Commit( EscherPropertyContainer& rProps, const tools::Rectangle& rRect ) override;
179
180private:
181
182 virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 ) override;
183 virtual void CloseContainer() override;
184
185 virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const tools::Rectangle* pBoundRect ) override;
186 virtual void LeaveGroup() override;
187
188 virtual void AddShape( sal_uInt32 nShapeType, ShapeFlag nShapeFlags, sal_uInt32 nShapeId = 0 ) override;
189
190private:
192 OString ShapeIdString( sal_uInt32 nId );
193
195 void AddFlipXY( );
196
198 void AddLineDimensions( const tools::Rectangle& rRectangle );
199
201 void AddRectangleDimensions( OStringBuffer& rBuffer, const tools::Rectangle& rRectangle, bool rbAbsolutePos = true );
202};
203
204
205} // namespace oox::vml
206
207#endif
208
209/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void EndShape(sal_uInt16 nShapeType, sal_uInt32 nShapeID)
virtual EscherExHostAppData * StartShape(const css::uno::Reference< css::drawing::XShape > &rShape, const tools::Rectangle *pChildAnchor)
sal_uInt32 m_nShapeType
Remember the shape type.
Definition: vmlexport.hxx:94
OString m_sShapeId
Remember the generated shape id.
Definition: vmlexport.hxx:106
ShapeFlag m_nShapeFlags
Remember the shape flags.
Definition: vmlexport.hxx:97
::sax_fastparser::FSHelperPtr m_pSerializer
Fast serializer to output the data.
Definition: vmlexport.hxx:76
OStringBuffer m_TextboxStyle
style for textbox
Definition: vmlexport.hxx:103
OString m_sShapeIDPrefix
Prefix for overridden shape id generation (used if m_bOverrideShapeIdGeneration is true)
Definition: vmlexport.hxx:123
const ::sax_fastparser::FSHelperPtr & GetFS() const
Definition: vmlexport.hxx:133
const SdrObject * m_pSdrObject
The object we're exporting.
Definition: vmlexport.hxx:88
std::vector< bool > m_aShapeTypeWritten
Remember which shape types we had already written.
Definition: vmlexport.hxx:109
sal_Int16 m_eHOri
Anchoring - Writer specific properties.
Definition: vmlexport.hxx:82
bool m_bUseHashMarkForType
Use '#' mark for type attribute (check Type Attribute of VML shape in OOXML documentation)
Definition: vmlexport.hxx:115
bool m_bOverrideShapeIdGeneration
There is a shapeid generation mechanism in EscherEx, but it does not seem to work so override the exi...
Definition: vmlexport.hxx:120
sal_uInt64 m_nShapeIDCounter
Counter for generating shape ids (used if m_bOverrideShapeIdGeneration is true)
Definition: vmlexport.hxx:126
bool m_bSkipwzName
It seems useless to write out an XML_ID attribute next to XML_id which defines the actual shape id.
Definition: vmlexport.hxx:112
void SetSkipwzName(bool bSkipwzName)
Definition: vmlexport.hxx:150
void SetHashMarkForType(bool bUseHashMarkForType)
Definition: vmlexport.hxx:151
OStringBuffer m_ShapeStyle
Remember style, the most important shape attribute ;-)
Definition: vmlexport.hxx:100
VMLTextExport * m_pTextExport
Parent exporter, used for text callback.
Definition: vmlexport.hxx:79
rtl::Reference<::sax_fastparser::FastAttributeList > m_pShapeAttrList
Fill the shape attributes as they come.
Definition: vmlexport.hxx:91
rtl::Reference< sax_fastparser::FastAttributeList > m_pWrapAttrList
Definition: vmlexport.hxx:83
Interface to be implemented by the parent exporter that knows how to handle shape text.
Definition: vmlexport.hxx:62
virtual void WriteOutliner(const OutlinerParaObject &rParaObj)=0
virtual oox::drawingml::DrawingML & GetDrawingML()=0
virtual void WriteVMLTextBox(css::uno::Reference< css::drawing::XShape > xShape)=0
Write the contents of the textbox that is associated to this shape in VML format.
#define OOX_DLLPUBLIC
Definition: dllapi.h:28
ShapeFlag
std::shared_ptr< FastSerializerHelper > FSHelperPtr
sal_Int16 nId
Definition: olehelper.cxx:98