android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / filter / ww8 / rtfstringbuffer.hxx
blob67ad6664433d1000178d882fe9c33723fc3631c5
1 /*
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/.
7 */
9 #ifndef INCLUDED_SW_SOURCE_FILTER_WW8_RTFSTRINGBUFFER_HXX
10 #define INCLUDED_SW_SOURCE_FILTER_WW8_RTFSTRINGBUFFER_HXX
12 #include <rtl/strbuf.hxx>
13 #include <vector>
15 class SwGrfNode;
16 class SwFlyFrameFormat;
17 class RtfAttributeOutput;
19 /// Contains a buffered string or graphic during RTF export.
20 class RtfStringBufferValue
22 public:
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);
29 /// This one doesn't.
30 OString makeStringAndClear();
31 bool isGraphic() const;
32 OStringBuffer& getBuffer() { return m_aBuffer; }
33 const OStringBuffer& getBuffer() const { return m_aBuffer; }
35 private:
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.
42 class RtfStringBuffer
44 public:
45 RtfStringBuffer();
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.
56 void clear();
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);
62 private:
63 using Values_t = std::vector<RtfStringBufferValue>;
64 Values_t m_aValues;
67 #endif // INCLUDED_SW_SOURCE_FILTER_WW8_RTFSTRINGBUFFER_HXX
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */