2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 #ifndef INCLUDED_SW_SOURCE_FILTER_WW8_RTFSTRINGBUFFER_HXX
10 #define INCLUDED_SW_SOURCE_FILTER_WW8_RTFSTRINGBUFFER_HXX
12 #include <rtl/strbuf.hxx>
16 class SwFlyFrameFormat
;
17 class RtfAttributeOutput
;
19 /// Contains a buffered string or graphic during RTF export.
20 class RtfStringBufferValue
23 /// Constructor for a string buffering.
24 RtfStringBufferValue();
25 /// Constructor for graphic buffering.
26 RtfStringBufferValue(const SwFlyFrameFormat
* pFlyFrameFormat
, const SwGrfNode
* pGrfNode
);
27 /// This version handles graphics.
28 void makeStringAndClear(RtfAttributeOutput
* pAttributeOutput
);
30 OString
makeStringAndClear();
31 bool isGraphic() const;
32 OStringBuffer
& getBuffer() { return m_aBuffer
; }
33 const OStringBuffer
& getBuffer() const { return m_aBuffer
; }
36 OStringBuffer m_aBuffer
;
37 const SwFlyFrameFormat
* m_pFlyFrameFormat
= nullptr;
38 const SwGrfNode
* m_pGrfNode
= nullptr;
41 /// Wrapper around OStringBuffers, so less hexdump of graphics have to be kept in memory during RTF export.
46 /// Length of all the contained buffers.
47 sal_Int32
getLength() const;
48 /// Writes the contents of the buffer directly to the supplied stream.
49 void makeStringAndClear(RtfAttributeOutput
* pAttributeOutput
);
50 /// Returns the buffered strings as a string (ignores graphic elements!)
51 OString
makeStringAndClear();
52 /// Access to the last buffer.
53 OStringBuffer
& getLastBuffer();
54 OStringBuffer
* operator->();
55 /// Similar to ->setLength(0), but for all buffers.
57 /// Same as ->append(), but for graphics and without expanding contents to save memory.
58 void append(const SwFlyFrameFormat
* pFlyFrameFormat
, const SwGrfNode
* pGrfNode
);
59 /// Append all contained buffers and clear the argument.
60 void appendAndClear(RtfStringBuffer
& rBuf
);
63 using Values_t
= std::vector
<RtfStringBufferValue
>;
67 #endif // INCLUDED_SW_SOURCE_FILTER_WW8_RTFSTRINGBUFFER_HXX
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */