LCOV - code coverage report
Current view: top level - include/vcl - svgdata.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 4 75.0 %
Date: 2015-06-13 12:38:46 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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_VCL_SVGDATA_HXX
      21             : #define INCLUDED_VCL_SVGDATA_HXX
      22             : 
      23             : #include <basegfx/range/b2drange.hxx>
      24             : #include <boost/shared_array.hpp>
      25             : #include <com/sun/star/graphic/XPrimitive2D.hpp>
      26             : #include <vcl/bitmapex.hxx>
      27             : #include <rtl/ustring.hxx>
      28             : 
      29             : 
      30             : typedef boost::shared_array< sal_uInt8 > SvgDataArray;
      31             : typedef ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XPrimitive2D > Primitive2DReference;
      32             : typedef ::com::sun::star::uno::Sequence< Primitive2DReference > Primitive2DSequence;
      33             : 
      34             : 
      35             : // helper to convert any Primitive2DSequence to a good quality BitmapEx,
      36             : // using default parameters and graphic::XPrimitive2DRenderer
      37             : 
      38             : BitmapEx VCL_DLLPUBLIC convertPrimitive2DSequenceToBitmapEx(
      39             :     const Primitive2DSequence& rSequence,
      40             :     const basegfx::B2DRange& rTargetRange,
      41             :     const sal_uInt32 nMaximumQuadraticPixels = 500000);
      42             : 
      43             : 
      44         295 : class VCL_DLLPUBLIC SvgData
      45             : {
      46             : private:
      47             :     // the file and length
      48             :     SvgDataArray            maSvgDataArray;
      49             :     sal_uInt32              mnSvgDataArrayLength;
      50             : 
      51             :     // The absolute Path if available
      52             :     OUString           maPath;
      53             : 
      54             :     // on demand created content
      55             :     basegfx::B2DRange       maRange;
      56             :     Primitive2DSequence     maSequence;
      57             :     BitmapEx                maReplacement;
      58             : 
      59             :     // on demand creators
      60             :     void ensureReplacement();
      61             :     void ensureSequenceAndRange();
      62             : 
      63             :     SvgData(const SvgData&) SAL_DELETED_FUNCTION;
      64             :     SvgData& operator=(const SvgData&) SAL_DELETED_FUNCTION;
      65             : 
      66             : public:
      67             :     SvgData(const SvgDataArray& rSvgDataArray, sal_uInt32 nSvgDataArrayLength, const OUString& rPath);
      68             :     SvgData(const OUString& rPath);
      69             : 
      70             :     /// data read
      71           4 :     const SvgDataArray& getSvgDataArray() const { return maSvgDataArray; }
      72          12 :     sal_uInt32 getSvgDataArrayLength() const { return mnSvgDataArrayLength; }
      73           0 :     const OUString& getPath() const { return maPath; }
      74             : 
      75             :     /// data read and evtl. on demand creation
      76             :     const basegfx::B2DRange& getRange() const;
      77             :     const Primitive2DSequence& getPrimitive2DSequence() const;
      78             :     const BitmapEx& getReplacement() const;
      79             : };
      80             : 
      81             : typedef std::shared_ptr< SvgData > SvgDataPtr;
      82             : 
      83             : #endif // INCLUDED_VCL_SVGDATA_HXX
      84             : 
      85             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11