1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SV_SVGDATA_HXX
21 #define _SV_SVGDATA_HXX
23 #include <basegfx/range/b2drange.hxx>
24 #include <boost/shared_array.hpp>
25 #include <boost/shared_ptr.hpp>
26 #include <boost/utility.hpp>
27 #include <com/sun/star/graphic/XPrimitive2D.hpp>
28 #include <vcl/bitmapex.hxx>
29 #include <rtl/ustring.hxx>
31 //////////////////////////////////////////////////////////////////////////////
33 typedef boost::shared_array
< sal_uInt8
> SvgDataArray
;
34 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::graphic::XPrimitive2D
> Primitive2DReference
;
35 typedef ::com::sun::star::uno::Sequence
< Primitive2DReference
> Primitive2DSequence
;
37 //////////////////////////////////////////////////////////////////////////////
38 // helper to convert any Primitive2DSequence to a good quality BitmapEx,
39 // using default parameters and graphic::XPrimitive2DRenderer
41 BitmapEx VCL_DLLPUBLIC
convertPrimitive2DSequenceToBitmapEx(
42 const Primitive2DSequence
& rSequence
,
43 const basegfx::B2DRange
& rTargetRange
,
44 const sal_uInt32 nMaximumQuadraticPixels
= 500000);
46 //////////////////////////////////////////////////////////////////////////////
48 class VCL_DLLPUBLIC SvgData
: private boost::noncopyable
51 // the file and length
52 SvgDataArray maSvgDataArray
;
53 sal_uInt32 mnSvgDataArrayLength
;
55 // The absolute Path if available
58 // on demand created content
59 basegfx::B2DRange maRange
;
60 Primitive2DSequence maSequence
;
61 BitmapEx maReplacement
;
64 void ensureReplacement();
65 void ensureSequenceAndRange();
68 SvgData(const SvgDataArray
& rSvgDataArray
, sal_uInt32 nSvgDataArrayLength
, const OUString
& rPath
);
69 SvgData(const OUString
& rPath
);
72 const SvgDataArray
& getSvgDataArray() const { return maSvgDataArray
; }
73 sal_uInt32
getSvgDataArrayLength() const { return mnSvgDataArrayLength
; }
74 const OUString
& getPath() const { return maPath
; }
76 /// data read and evtl. on demand creation
77 const basegfx::B2DRange
& getRange() const;
78 const Primitive2DSequence
& getPrimitive2DSequence() const;
79 const BitmapEx
& getReplacement() const;
82 typedef boost::shared_ptr
< SvgData
> SvgDataPtr
;
84 #endif // _SV_SVGDATA_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */