LCOV - code coverage report
Current view: top level - sw/source/filter/ww8 - rtfstringbuffer.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 2 2 100.0 %
Date: 2014-04-11 Functions: 6 7 85.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * This file is part of the LibreOffice project.
       3             :  *
       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             :  */
       8             : 
       9             : #ifndef INCLUDED_SW_SOURCE_FILTER_WW8_RTFSTRINGBUFFER_HXX
      10             : #define INCLUDED_SW_SOURCE_FILTER_WW8_RTFSTRINGBUFFER_HXX
      11             : 
      12             : #include <rtl/strbuf.hxx>
      13             : #include <vector>
      14             : 
      15             : class SwGrfNode;
      16             : class SwFlyFrmFmt;
      17             : class RtfAttributeOutput;
      18             : 
      19             : /// Contains a buffered string or graphic during RTF export.
      20        6200 : class RtfStringBufferValue
      21             : {
      22             : public:
      23             :     /// Constructor for a string buffering.
      24             :     RtfStringBufferValue();
      25             :     /// Constructor for graphic buffering.
      26             :     RtfStringBufferValue(const SwFlyFrmFmt* pFlyFrmFmt, 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             : 
      33             :     OStringBuffer m_aBuffer;
      34             :     const SwFlyFrmFmt* m_pFlyFrmFmt;
      35             :     const SwGrfNode* m_pGrfNode;
      36             : };
      37             : 
      38             : /// Wrapper around OStringBuffers, so less hexdump of graphics have to be kept in memory during RTF export.
      39         660 : class RtfStringBuffer
      40             : {
      41             : public:
      42             :     RtfStringBuffer();
      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 bufferent 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.
      53             :     void clear();
      54             :     /// Same as ->append(), but for graphics and without expanding contents to save memory.
      55             :     void append(const SwFlyFrmFmt* pFlyFrmFmt, const SwGrfNode* pGrfNode);
      56             :     /// Append all contained buffers and clear the argument.
      57             :     void appendAndClear(RtfStringBuffer& rBuf);
      58             : private:
      59             :     typedef std::vector<RtfStringBufferValue> Values_t;
      60             :     Values_t m_aValues;
      61             : };
      62             : 
      63             : #endif // INCLUDED_SW_SOURCE_FILTER_WW8_RTFSTRINGBUFFER_HXX
      64             : 
      65             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10