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 INCLUDED_VCL_LINEINFO_HXX
21 #define INCLUDED_VCL_LINEINFO_HXX
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>
34 namespace basegfx
{ class B2DPolyPolygon
; }
38 sal_uInt32 mnRefCount
;
41 sal_uInt16 mnDashCount
;
43 sal_uInt16 mnDotCount
;
47 basegfx::B2DLineJoin meLineJoin
;
48 com::sun::star::drawing::LineCap meLineCap
;
51 ImplLineInfo( const ImplLineInfo
& rImplLineInfo
);
53 bool operator==( const ImplLineInfo
& ) const;
55 friend SvStream
& ReadImplLineInfo( SvStream
& rIStm
, ImplLineInfo
& rImplLineInfo
);
56 friend SvStream
& WriteImplLineInfo( SvStream
& rOStm
, const ImplLineInfo
& rImplLineInfo
);
63 class VCL_DLLPUBLIC LineInfo
67 ImplLineInfo
* mpImplLineInfo
;
69 SAL_DLLPRIVATE
void ImplMakeUnique();
73 LineInfo( LineStyle eLineStyle
= LINE_SOLID
, long nWidth
= 0L );
74 LineInfo( const LineInfo
& rLineInfo
);
77 LineInfo
& operator=( const LineInfo
& rLineInfo
);
78 bool operator==( const LineInfo
& rLineInfo
) const;
79 bool operator!=( const LineInfo
& rLineInfo
) const { return !(LineInfo::operator==( rLineInfo
) ); }
80 bool IsSameInstance( const LineInfo
& rLineInfo
) const { return( mpImplLineInfo
== rLineInfo
.mpImplLineInfo
); }
82 void SetStyle( LineStyle eStyle
);
83 LineStyle
GetStyle() const { return mpImplLineInfo
->meStyle
; }
85 void SetWidth( long nWidth
);
86 long GetWidth() const { return mpImplLineInfo
->mnWidth
; }
88 void SetDashCount( sal_uInt16 nDashCount
);
89 sal_uInt16
GetDashCount() const { return mpImplLineInfo
->mnDashCount
; }
91 void SetDashLen( long nDashLen
);
92 long GetDashLen() const { return mpImplLineInfo
->mnDashLen
; }
94 void SetDotCount( sal_uInt16 nDotCount
);
95 sal_uInt16
GetDotCount() const { return mpImplLineInfo
->mnDotCount
; }
97 void SetDotLen( long nDotLen
);
98 long GetDotLen() const { return mpImplLineInfo
->mnDotLen
; }
100 void SetDistance( long nDistance
);
101 long GetDistance() const { return mpImplLineInfo
->mnDistance
; }
103 void SetLineJoin(basegfx::B2DLineJoin eLineJoin
);
104 basegfx::B2DLineJoin
GetLineJoin() const { return mpImplLineInfo
->meLineJoin
; }
106 void SetLineCap(com::sun::star::drawing::LineCap eLineCap
);
107 com::sun::star::drawing::LineCap
GetLineCap() const { return mpImplLineInfo
->meLineCap
; }
109 bool IsDefault() const;
111 friend VCL_DLLPUBLIC SvStream
& ReadLineInfo( SvStream
& rIStm
, LineInfo
& rLineInfo
);
112 friend VCL_DLLPUBLIC SvStream
& WriteLineInfo( SvStream
& rOStm
, const LineInfo
& rLineInfo
);
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;
125 #endif // INCLUDED_VCL_LINEINFO_HXX
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */