LibreOffice Module sw (master)  1
rtfsdrexport.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_SW_SOURCE_FILTER_WW8_RTFSDREXPORT_HXX
21 #define INCLUDED_SW_SOURCE_FILTER_WW8_RTFSDREXPORT_HXX
22 
24 #include <editeng/outlobj.hxx>
25 #include <rtl/strbuf.hxx>
26 
27 #include <map>
28 #include <memory>
29 
30 #include "wrtww8.hxx"
31 
32 class RtfExport;
33 class RtfAttributeOutput;
34 class SwFrameFormat;
35 
37 class RtfSdrExport final : public EscherEx
38 {
40 
42 
44 
46  sal_uInt32 m_nShapeType;
47 
50 
52  OStringBuffer m_aShapeStyle;
53 
54  std::map<OString, OString> m_aShapeProps;
55 
57  std::unique_ptr<bool[]> m_pShapeTypeWritten;
58 
59  bool m_bInGroup = false;
60 
61 public:
62  explicit RtfSdrExport(RtfExport& rExport);
63  ~RtfSdrExport() override;
64 
68  void AddSdrObject(const SdrObject& rObj);
69 
71  static bool isTextBox(const SwFrameFormat& rFrameFormat);
73  void WriteOutliner(const OutlinerParaObject& rParaObj, TextTypes eType);
74 
75 private:
80  sal_Int32 StartShape();
81 
85  using EscherEx::EndShape;
86  void EndShape(sal_Int32 nShapeElement);
87 
88  void Commit(EscherPropertyContainer& rProps, const tools::Rectangle& rRect) override;
89 
90  void OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance = 0) override;
91  void CloseContainer() override;
92 
93  sal_uInt32 EnterGroup(const OUString& rShapeName, const tools::Rectangle* pBoundRect) override;
94  void LeaveGroup() override;
95 
96  void AddShape(sal_uInt32 nShapeType, ShapeFlag nShapeFlags, sal_uInt32 nShapeId = 0) override;
97 
99  void AddLineDimensions(const tools::Rectangle& rRectangle);
100 
102  void AddRectangleDimensions(OStringBuffer& rBuffer, const tools::Rectangle& rRectangle);
103 
105  void impl_writeGraphic();
106 };
107 
108 #endif // INCLUDED_SW_SOURCE_FILTER_WW8_RTFSDREXPORT_HXX
109 
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< bool[]> m_pShapeTypeWritten
Remember which shape types we had already written.
virtual void EndShape(sal_uInt16 nShapeType, sal_uInt32 nShapeID)
void OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance=0) override
void impl_writeGraphic()
Exports the pib property of the shape.
virtual EscherExHostAppData * StartShape(const css::uno::Reference< css::drawing::XShape > &rShape, const tools::Rectangle *pChildAnchor)
static bool isTextBox(const SwFrameFormat &rFrameFormat)
Is this a standalone TextFrame, or used as a TextBox of a shape?
sal_uInt32 m_nShapeType
Remember the shape type.
The class that does all the actual RTF export-related work.
Definition: rtfexport.hxx:36
ShapeFlag m_nShapeFlags
Remember the shape flags.
void LeaveGroup() override
The class that has handlers for various resource types when exporting as RTF.
sal_Int32 StartShape()
RtfAttributeOutput & m_rAttrOutput
void Commit(EscherPropertyContainer &rProps, const tools::Rectangle &rRect) override
ShapeFlag
Style of a layout element.
Definition: frmfmt.hxx:57
RtfExport & m_rExport
sal_uInt32 EnterGroup(const OUString &rShapeName, const tools::Rectangle *pBoundRect) override
TextTypes
Definition: wrtww8.hxx:160
void AddShape(sal_uInt32 nShapeType, ShapeFlag nShapeFlags, sal_uInt32 nShapeId=0) override
Handles export of drawings using RTF markup.
OStringBuffer m_aShapeStyle
Remember style, the most important shape attribute ;-)
const SdrObject * m_pSdrObject
void WriteOutliner(const OutlinerParaObject &rParaObj, TextTypes eType)
Write editeng text, e.g. shape or comment.
~RtfSdrExport() override
void AddLineDimensions(const tools::Rectangle &rRectangle)
Add starting and ending point of a line to the m_pShapeAttrList.
void AddSdrObject(const SdrObject &rObj)
Export the sdr object as Sdr.
void CloseContainer() override
std::map< OString, OString > m_aShapeProps
RtfSdrExport(RtfExport &rExport)
void EndShape(sal_Int32 nShapeElement)
void AddRectangleDimensions(OStringBuffer &rBuffer, const tools::Rectangle &rRectangle)
Add position and size to the OStringBuffer.