1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _OOX_EXPORT_VMLEXPORT_HXX_
21 #define _OOX_EXPORT_VMLEXPORT_HXX_
23 #include <oox/dllapi.h>
24 #include <oox/export/drawingml.hxx>
25 #include <sax/fshelper.hxx>
26 #include <filter/msfilter/escherex.hxx>
27 #include <editeng/outlobj.hxx>
34 /// Interface to be implemented by the parent exporter that knows how to handle shape text.
35 class OOX_DLLPUBLIC VMLTextExport
38 virtual void WriteOutliner(const OutlinerParaObject
& rParaObj
) = 0;
39 virtual oox::drawingml::DrawingML
& GetDrawingML() = 0;
42 virtual ~VMLTextExport() {}
45 class OOX_DLLPUBLIC VMLExport
: public EscherEx
47 /// Fast serializer to output the data
48 ::sax_fastparser::FSHelperPtr m_pSerializer
;
50 /// Parent exporter, used for text callback.
51 VMLTextExport
* m_pTextExport
;
53 /// The object we're exporting.
54 const SdrObject
* m_pSdrObject
;
56 /// Fill the shape attributes as they come.
57 ::sax_fastparser::FastAttributeList
*m_pShapeAttrList
;
59 /// Remember the shape type.
60 sal_uInt32 m_nShapeType
;
62 /// Remember the shape flags.
63 sal_uInt32 m_nShapeFlags
;
65 /// Remember style, the most important shape attribute ;-)
66 OStringBuffer
*m_pShapeStyle
;
68 /// Remember which shape types we had already written.
69 bool *m_pShapeTypeWritten
;
72 VMLExport( ::sax_fastparser::FSHelperPtr pSerializer
, VMLTextExport
* pTextExport
= 0 );
75 ::sax_fastparser::FSHelperPtr
76 GetFS() { return m_pSerializer
; }
78 /// Export the sdr object as VML.
80 /// Call this when you need to export the object as VML.
81 sal_uInt32
AddSdrObject( const SdrObject
& rObj
);
84 /// Add an attribute to the generated <v:shape/> element.
86 /// This should be called from within StartShape() to ensure that the
87 /// added attribute is preserved.
88 void AddShapeAttribute( sal_Int32 nAttribute
, const OString
& sValue
);
90 using EscherEx::StartShape
;
91 using EscherEx::EndShape
;
93 /// Start the shape for which we just collected the information.
95 /// Returns the element's tag number, -1 means we wrote nothing.
96 virtual sal_Int32
StartShape();
100 /// The parameter is just what we got from StartShape().
101 virtual void EndShape( sal_Int32 nShapeElement
);
103 virtual void Commit( EscherPropertyContainer
& rProps
, const Rectangle
& rRect
);
107 virtual void OpenContainer( sal_uInt16 nEscherContainer
, int nRecInstance
= 0 );
108 virtual void CloseContainer();
110 virtual sal_uInt32
EnterGroup( const OUString
& rShapeName
, const Rectangle
* pBoundRect
= 0 );
111 virtual void LeaveGroup();
113 virtual void AddShape( sal_uInt32 nShapeType
, sal_uInt32 nShapeFlags
, sal_uInt32 nShapeId
= 0 );
116 /// Create an OString representing the id from a numerical id.
117 static OString
ShapeIdString( sal_uInt32 nId
);
119 /// Add starting and ending point of a line to the m_pShapeAttrList.
120 void AddLineDimensions( const Rectangle
& rRectangle
);
122 /// Add position and size to the OStringBuffer.
123 void AddRectangleDimensions( OStringBuffer
& rBuffer
, const Rectangle
& rRectangle
);
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */