LibreOffice Module vcl (master)  1
vectorgraphicdata.hxx
Go to the documentation of this file.
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_VECTORGRAPHICDATA_HXX
21 #define INCLUDED_VCL_VECTORGRAPHICDATA_HXX
22 
24 #include <com/sun/star/uno/Sequence.hxx>
25 #include <vcl/bitmapex.hxx>
26 #include <rtl/ustring.hxx>
27 #include <deque>
28 #include <memory>
29 
30 namespace com { namespace sun { namespace star { namespace graphic { class XPrimitive2D; } } } }
31 struct WmfExternal;
32 
33 typedef css::uno::Sequence<sal_Int8> VectorGraphicDataArray;
34 
35 
36 // helper to convert any Primitive2DSequence to a good quality BitmapEx,
37 // using default parameters and graphic::XPrimitive2DRenderer
38 
40  const std::deque< css::uno::Reference< css::graphic::XPrimitive2D > >& rSequence,
41  const basegfx::B2DRange& rTargetRange,
42  const sal_uInt32 nMaximumQuadraticPixels = 500000);
43 
44 
46 {
47  Svg = 0,
48  Emf = 1,
49  Wmf = 2
50 };
51 
53 {
54 private:
55  // the file and length
57 
58  // The absolute Path if available
59  OUString const maPath;
60 
61  // on demand created content
64  std::deque< css::uno::Reference< css::graphic::XPrimitive2D > > maSequence;
68 
69  // extra:
70  std::unique_ptr<WmfExternal> mpExternalHeader;
71 
72  // on demand creators
73  void ensureReplacement();
74  void ensureSequenceAndRange();
75 
76  VectorGraphicData(const VectorGraphicData&) = delete;
77  VectorGraphicData& operator=(const VectorGraphicData&) = delete;
78 
79 public:
81  const VectorGraphicDataArray& rVectorGraphicDataArray,
82  const OUString& rPath,
83  VectorGraphicDataType eVectorDataType);
85  const OUString& rPath,
86  VectorGraphicDataType eVectorDataType);
88 
90  bool operator==(const VectorGraphicData& rCandidate) const;
91 
93  void setWmfExternalHeader(const WmfExternal& aExtHeader);
94 
96  const VectorGraphicDataArray& getVectorGraphicDataArray() const { return maVectorGraphicDataArray; }
97  sal_uInt32 getVectorGraphicDataArrayLength() const { return maVectorGraphicDataArray.getLength(); }
98  enum class State { UNPARSED, PARSED };
99  std::pair<State, size_t> getSizeBytes() const;
100  const OUString& getPath() const { return maPath; }
101  const VectorGraphicDataType& getVectorGraphicDataType() const { return meVectorGraphicDataType; }
102 
104  const basegfx::B2DRange& getRange() const;
105  const std::deque< css::uno::Reference< css::graphic::XPrimitive2D > >& getPrimitive2DSequence() const;
106  const BitmapEx& getReplacement() const;
107  BitmapChecksum GetChecksum() const;
108 };
109 
110 typedef std::shared_ptr< VectorGraphicData > VectorGraphicDataPtr;
111 
112 #endif // INCLUDED_VCL_VECTORGRAPHICDATA_HXX
113 
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
VectorGraphicDataType
sal_uInt64 BitmapChecksum
Definition: checksum.hxx:30
const VectorGraphicDataArray & getVectorGraphicDataArray() const
data read
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
const OUString & getPath() const
OUString const maPath
const VectorGraphicDataType & getVectorGraphicDataType() const
VectorGraphicDataArray maVectorGraphicDataArray
BitmapEx VCL_DLLPUBLIC convertPrimitive2DSequenceToBitmapEx(const std::deque< css::uno::Reference< css::graphic::XPrimitive2D > > &rSequence, const basegfx::B2DRange &rTargetRange, const sal_uInt32 nMaximumQuadraticPixels=500000)
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:203
basegfx::B2DRange maRange
B2DRange getRange(const B2DPolygon &rCandidate)
std::shared_ptr< VectorGraphicData > VectorGraphicDataPtr
css::uno::Sequence< sal_Int8 > VectorGraphicDataArray
std::unique_ptr< WmfExternal > mpExternalHeader
VectorGraphicDataType const meVectorGraphicDataType
sal_uInt32 getVectorGraphicDataArrayLength() const
std::deque< css::uno::Reference< css::graphic::XPrimitive2D > > maSequence