workaround segfault in compiler on macos-clang-intel
[LibreOffice.git] / include / vcl / lineinfo.hxx
blob0644359954b9ae2e3687d1002038cfe6ac306287
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
28 #include <o3tl/cow_wrapper.hxx>
30 #include <vector>
32 class SvStream;
33 namespace basegfx { class B2DPolyPolygon; }
35 struct ImplLineInfo
37 double mnWidth;
38 double mnDashLen;
39 double mnDotLen;
40 double mnDistance;
42 basegfx::B2DLineJoin meLineJoin;
43 css::drawing::LineCap meLineCap;
44 LineStyle meStyle;
46 sal_uInt16 mnDashCount;
47 sal_uInt16 mnDotCount;
49 ImplLineInfo();
51 bool operator==( const ImplLineInfo& ) const;
55 class VCL_DLLPUBLIC LineInfo
57 public:
58 LineInfo( LineStyle eLineStyle = LineStyle::Solid, double nWidth = 0 );
59 LineInfo( const LineInfo& rLineInfo );
60 LineInfo( LineInfo&& rLineInfo );
61 ~LineInfo();
63 LineInfo& operator=( const LineInfo& rLineInfo );
64 LineInfo& operator=( LineInfo&& rLineInfo );
65 bool operator==( const LineInfo& rLineInfo ) const;
66 bool operator!=( const LineInfo& rLineInfo ) const { return !(LineInfo::operator==( rLineInfo ) ); }
68 void SetStyle( LineStyle eStyle );
69 LineStyle GetStyle() const { return mpImplLineInfo->meStyle; }
71 void SetWidth( double nWidth );
72 double GetWidth() const { return mpImplLineInfo->mnWidth; }
74 void SetDashCount( sal_uInt16 nDashCount );
75 sal_uInt16 GetDashCount() const { return mpImplLineInfo->mnDashCount; }
77 void SetDashLen( double nDashLen );
78 double GetDashLen() const { return mpImplLineInfo->mnDashLen; }
80 void SetDotCount( sal_uInt16 nDotCount );
81 sal_uInt16 GetDotCount() const { return mpImplLineInfo->mnDotCount; }
83 void SetDotLen( double nDotLen );
84 double GetDotLen() const { return mpImplLineInfo->mnDotLen; }
86 void SetDistance( double nDistance );
87 double GetDistance() const { return mpImplLineInfo->mnDistance; }
89 /// Get an array of "on" and "off" lengths for stroke dashing
90 std::vector< double > GetDotDashArray() const;
92 void SetLineJoin(basegfx::B2DLineJoin eLineJoin);
93 basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; }
95 void SetLineCap(css::drawing::LineCap eLineCap);
96 css::drawing::LineCap GetLineCap() const { return mpImplLineInfo->meLineCap; }
98 bool IsDefault() const;
100 friend SvStream& ReadLineInfo( SvStream& rIStm, LineInfo& rLineInfo );
101 friend SvStream& WriteLineInfo( SvStream& rOStm, const LineInfo& rLineInfo );
103 // helper to get decomposed polygon data with the LineInfo applied. The source
104 // hairline polygon is given in io_rLinePolyPolygon. Both given polygons may
105 // contain results; e.g. when no fat line but DashDot is defined, the result will
106 // be in io_rLinePolyPolygon while o_rFillPolyPolygon will be empty. When fat line
107 // is defined, it will be vice-versa. If none is defined, io_rLinePolyPolygon will
108 // not be changed (but o_rFillPolyPolygon will be freed)
109 void applyToB2DPolyPolygon(
110 basegfx::B2DPolyPolygon& io_rLinePolyPolygon,
111 basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const;
113 private:
114 o3tl::cow_wrapper< ImplLineInfo > mpImplLineInfo;
117 #endif // INCLUDED_VCL_LINEINFO_HXX
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */