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_LINEINFO_HXX
21 : #define INCLUDED_VCL_LINEINFO_HXX
22 :
23 : #include <sal/types.h>
24 : #include <vcl/dllapi.h>
25 : #include <vcl/vclenum.hxx>
26 : #include <basegfx/vector/b2enums.hxx>
27 : #include <com/sun/star/drawing/LineCap.hpp>
28 :
29 :
30 : // - ImplLineInfo -
31 :
32 :
33 : class SvStream;
34 : namespace basegfx { class B2DPolyPolygon; }
35 :
36 : struct ImplLineInfo
37 : {
38 : sal_uInt32 mnRefCount;
39 : LineStyle meStyle;
40 : long mnWidth;
41 : sal_uInt16 mnDashCount;
42 : long mnDashLen;
43 : sal_uInt16 mnDotCount;
44 : long mnDotLen;
45 : long mnDistance;
46 :
47 : basegfx::B2DLineJoin meLineJoin;
48 : com::sun::star::drawing::LineCap meLineCap;
49 :
50 : ImplLineInfo();
51 : ImplLineInfo( const ImplLineInfo& rImplLineInfo );
52 :
53 : bool operator==( const ImplLineInfo& ) const;
54 :
55 : friend SvStream& ReadImplLineInfo( SvStream& rIStm, ImplLineInfo& rImplLineInfo );
56 : friend SvStream& WriteImplLineInfo( SvStream& rOStm, const ImplLineInfo& rImplLineInfo );
57 : };
58 :
59 :
60 : // - LineInfo -
61 :
62 :
63 : class VCL_DLLPUBLIC LineInfo
64 : {
65 : private:
66 :
67 : ImplLineInfo* mpImplLineInfo;
68 :
69 : SAL_DLLPRIVATE void ImplMakeUnique();
70 :
71 : public:
72 :
73 : LineInfo( LineStyle eLineStyle = LINE_SOLID, long nWidth = 0L );
74 : LineInfo( const LineInfo& rLineInfo );
75 : ~LineInfo();
76 :
77 : LineInfo& operator=( const LineInfo& rLineInfo );
78 : bool operator==( const LineInfo& rLineInfo ) const;
79 797 : bool operator!=( const LineInfo& rLineInfo ) const { return !(LineInfo::operator==( rLineInfo ) ); }
80 : bool IsSameInstance( const LineInfo& rLineInfo ) const { return( mpImplLineInfo == rLineInfo.mpImplLineInfo ); }
81 :
82 : void SetStyle( LineStyle eStyle );
83 420450 : LineStyle GetStyle() const { return mpImplLineInfo->meStyle; }
84 :
85 : void SetWidth( long nWidth );
86 281712 : long GetWidth() const { return mpImplLineInfo->mnWidth; }
87 :
88 : void SetDashCount( sal_uInt16 nDashCount );
89 9 : sal_uInt16 GetDashCount() const { return mpImplLineInfo->mnDashCount; }
90 :
91 : void SetDashLen( long nDashLen );
92 217 : long GetDashLen() const { return mpImplLineInfo->mnDashLen; }
93 :
94 : void SetDotCount( sal_uInt16 nDotCount );
95 12 : sal_uInt16 GetDotCount() const { return mpImplLineInfo->mnDotCount; }
96 :
97 : void SetDotLen( long nDotLen );
98 223 : long GetDotLen() const { return mpImplLineInfo->mnDotLen; }
99 :
100 : void SetDistance( long nDistance );
101 223 : long GetDistance() const { return mpImplLineInfo->mnDistance; }
102 :
103 : void SetLineJoin(basegfx::B2DLineJoin eLineJoin);
104 21 : basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; }
105 :
106 : void SetLineCap(com::sun::star::drawing::LineCap eLineCap);
107 21 : com::sun::star::drawing::LineCap GetLineCap() const { return mpImplLineInfo->meLineCap; }
108 :
109 : bool IsDefault() const;
110 :
111 : friend VCL_DLLPUBLIC SvStream& ReadLineInfo( SvStream& rIStm, LineInfo& rLineInfo );
112 : friend VCL_DLLPUBLIC SvStream& WriteLineInfo( SvStream& rOStm, const LineInfo& rLineInfo );
113 :
114 : // helper to get decomposed polygon data with the LineInfo applied. The source
115 : // hairline polygon is given in io_rLinePolyPolygon. Both given polygons may
116 : // contain results; e.g. when no fat line but DasDot is defined, the result will
117 : // be in io_rLinePolyPolygon while o_rFillPolyPolygon will be empty. When fat line
118 : // is defined, it will be vice-versa. If none is defined, io_rLinePolyPolygon will
119 : // not be changed (but o_rFillPolyPolygon will be freed)
120 : void applyToB2DPolyPolygon(
121 : basegfx::B2DPolyPolygon& io_rLinePolyPolygon,
122 : basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const;
123 : };
124 :
125 : #endif // INCLUDED_VCL_LINEINFO_HXX
126 :
127 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|