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 _SV_SVGDATA_HXX
21 : #define _SV_SVGDATA_HXX
22 :
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>
30 :
31 : //////////////////////////////////////////////////////////////////////////////
32 :
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;
36 :
37 : //////////////////////////////////////////////////////////////////////////////
38 :
39 0 : class VCL_DLLPUBLIC SvgData : private boost::noncopyable
40 : {
41 : private:
42 : // the file and length
43 : SvgDataArray maSvgDataArray;
44 : sal_uInt32 mnSvgDataArrayLength;
45 :
46 : // The absolute Path if available
47 : rtl::OUString maPath;
48 :
49 : // on demand created content
50 : basegfx::B2DRange maRange;
51 : Primitive2DSequence maSequence;
52 : BitmapEx maReplacement;
53 :
54 : // on demand creators
55 : void ensureReplacement();
56 : void ensureSequenceAndRange();
57 :
58 : public:
59 : SvgData(const SvgDataArray& rSvgDataArray, sal_uInt32 nSvgDataArrayLength, const rtl::OUString& rPath);
60 : SvgData(const rtl::OUString& rPath);
61 :
62 : /// data read
63 0 : const SvgDataArray& getSvgDataArray() const { return maSvgDataArray; }
64 0 : sal_uInt32 getSvgDataArrayLength() const { return mnSvgDataArrayLength; }
65 0 : const rtl::OUString& getPath() const { return maPath; }
66 :
67 : /// data read and evtl. on demand creation
68 : const basegfx::B2DRange& getRange() const;
69 : const Primitive2DSequence& getPrimitive2DSequence() const;
70 : const BitmapEx& getReplacement() const;
71 : };
72 :
73 : typedef boost::shared_ptr< SvgData > SvgDataPtr;
74 :
75 : #endif // _SV_SVGDATA_HXX
76 :
77 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|