Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_LINEINFO_HXX
30 : : #define _SV_LINEINFO_HXX
31 : :
32 : : #include <vcl/dllapi.h>
33 : : #include <tools/gen.hxx>
34 : : #include <vcl/vclenum.hxx>
35 : : #include <basegfx/vector/b2enums.hxx>
36 : :
37 : : // ----------------
38 : : // - ImplLineInfo -
39 : : // ----------------
40 : :
41 : : class SvStream;
42 : : namespace basegfx { class B2DPolyPolygon; }
43 : :
44 : : struct ImplLineInfo
45 : : {
46 : : sal_uLong mnRefCount;
47 : : LineStyle meStyle;
48 : : long mnWidth;
49 : : sal_uInt16 mnDashCount;
50 : : long mnDashLen;
51 : : sal_uInt16 mnDotCount;
52 : : long mnDotLen;
53 : : long mnDistance;
54 : :
55 : : basegfx::B2DLineJoin meLineJoin;
56 : :
57 : : ImplLineInfo();
58 : : ImplLineInfo( const ImplLineInfo& rImplLineInfo );
59 : :
60 : : bool operator==( const ImplLineInfo& ) const;
61 : :
62 : : friend SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo );
63 : : friend SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo );
64 : : };
65 : :
66 : : // ------------
67 : : // - LineInfo -
68 : : // ------------
69 : :
70 : : class VCL_DLLPUBLIC LineInfo
71 : : {
72 : : private:
73 : :
74 : : ImplLineInfo* mpImplLineInfo;
75 : :
76 : : SAL_DLLPRIVATE void ImplMakeUnique();
77 : :
78 : : public:
79 : :
80 : : LineInfo( LineStyle eLineStyle = LINE_SOLID, long nWidth = 0L );
81 : : LineInfo( const LineInfo& rLineInfo );
82 : : ~LineInfo();
83 : :
84 : : LineInfo& operator=( const LineInfo& rLineInfo );
85 : : sal_Bool operator==( const LineInfo& rLineInfo ) const;
86 : 2247 : sal_Bool operator!=( const LineInfo& rLineInfo ) const { return !(LineInfo::operator==( rLineInfo ) ); }
87 : : sal_Bool IsSameInstance( const LineInfo& rLineInfo ) const { return( mpImplLineInfo == rLineInfo.mpImplLineInfo ); }
88 : :
89 : : void SetStyle( LineStyle eStyle );
90 : 559321 : LineStyle GetStyle() const { return mpImplLineInfo->meStyle; }
91 : :
92 : : void SetWidth( long nWidth );
93 : 374765 : long GetWidth() const { return mpImplLineInfo->mnWidth; }
94 : :
95 : : void SetDashCount( sal_uInt16 nDashCount );
96 : 0 : sal_uInt16 GetDashCount() const { return mpImplLineInfo->mnDashCount; }
97 : :
98 : : void SetDashLen( long nDashLen );
99 : 0 : long GetDashLen() const { return mpImplLineInfo->mnDashLen; }
100 : :
101 : : void SetDotCount( sal_uInt16 nDotCount );
102 : 0 : sal_uInt16 GetDotCount() const { return mpImplLineInfo->mnDotCount; }
103 : :
104 : : void SetDotLen( long nDotLen );
105 : 0 : long GetDotLen() const { return mpImplLineInfo->mnDotLen; }
106 : :
107 : : void SetDistance( long nDistance );
108 : 0 : long GetDistance() const { return mpImplLineInfo->mnDistance; }
109 : :
110 : : void SetLineJoin(basegfx::B2DLineJoin eLineJoin);
111 : 248 : basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; }
112 : :
113 [ + - ][ + - ]: 49633 : sal_Bool IsDefault() const { return( !mpImplLineInfo->mnWidth && ( LINE_SOLID == mpImplLineInfo->meStyle ) ); }
114 : :
115 : : friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, LineInfo& rLineInfo );
116 : : friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const LineInfo& rLineInfo );
117 : :
118 : : // helper to get decomposed polygon data with the LineInfo applied. The source
119 : : // hairline polygon is given in io_rLinePolyPolygon. Both given polygons may
120 : : // contain results; e.g. when no fat line but DasDot is defined, the resut will
121 : : // be in io_rLinePolyPolygon while o_rFillPolyPolygon will be empty. When fat line
122 : : // is defined, it will be vice-versa. If none is defined, io_rLinePolyPolygon will
123 : : // not be changed (but o_rFillPolyPolygon will be freed)
124 : : void applyToB2DPolyPolygon(
125 : : basegfx::B2DPolyPolygon& io_rLinePolyPolygon,
126 : : basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const;
127 : : };
128 : :
129 : : #endif // _SV_LINEINFO_HXX
130 : :
131 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|