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