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;
33 OStringBuffer m_aBuffer
;
34 const SwFlyFrameFormat
* m_pFlyFrameFormat
;
35 const SwGrfNode
* m_pGrfNode
;
38 /// Wrapper around OStringBuffers, so less hexdump of graphics have to be kept in memory during RTF export.
43 /// Length of all the contained buffers.
44 sal_Int32
getLength() const;
45 /// Writes the contents of the buffer directly to the supplied stream.
46 void makeStringAndClear(RtfAttributeOutput
* pAttributeOutput
);
47 /// Returns the buffered strings as a string (ignores graphic elements!)
48 OString
makeStringAndClear();
49 /// Access to the last buffer.
50 OStringBuffer
& getLastBuffer();
51 OStringBuffer
* operator->();
52 /// Similar to ->setLength(0), but for all buffers.
54 /// Same as ->append(), but for graphics and without expanding contents to save memory.
55 void append(const SwFlyFrameFormat
* pFlyFrameFormat
, const SwGrfNode
* pGrfNode
);
56 /// Append all contained buffers and clear the argument.
57 void appendAndClear(RtfStringBuffer
& rBuf
);
59 typedef std::vector
<RtfStringBufferValue
> Values_t
;
63 #endif // INCLUDED_SW_SOURCE_FILTER_WW8_RTFSTRINGBUFFER_HXX
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */