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 #include <vector>
31 
32 class SvStream;
33 namespace basegfx { class B2DPolyPolygon; }
34 
36 {
37  double mnWidth;
38  double mnDashLen;
39  double mnDotLen;
40  double mnDistance;
41 
43  css::drawing::LineCap meLineCap;
45 
46  sal_uInt16 mnDashCount;
47  sal_uInt16 mnDotCount;
48 
49  ImplLineInfo();
50 
51  bool operator==( const ImplLineInfo& ) const;
52 };
53 
54 
56 {
57 public:
58  LineInfo( LineStyle eLineStyle = LineStyle::Solid, double nWidth = 0 );
59  LineInfo( const LineInfo& rLineInfo );
60  LineInfo( LineInfo&& rLineInfo );
61  ~LineInfo();
62 
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 ) ); }
67 
68  void SetStyle( LineStyle eStyle );
69  LineStyle GetStyle() const { return mpImplLineInfo->meStyle; }
70 
71  void SetWidth( double nWidth );
72  double GetWidth() const { return mpImplLineInfo->mnWidth; }
73 
74  void SetDashCount( sal_uInt16 nDashCount );
75  sal_uInt16 GetDashCount() const { return mpImplLineInfo->mnDashCount; }
76 
77  void SetDashLen( double nDashLen );
78  double GetDashLen() const { return mpImplLineInfo->mnDashLen; }
79 
80  void SetDotCount( sal_uInt16 nDotCount );
81  sal_uInt16 GetDotCount() const { return mpImplLineInfo->mnDotCount; }
82 
83  void SetDotLen( double nDotLen );
84  double GetDotLen() const { return mpImplLineInfo->mnDotLen; }
85 
86  void SetDistance( double nDistance );
87  double GetDistance() const { return mpImplLineInfo->mnDistance; }
88 
90  std::vector< double > GetDotDashArray() const;
91 
92  void SetLineJoin(basegfx::B2DLineJoin eLineJoin);
93  basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; }
94 
95  void SetLineCap(css::drawing::LineCap eLineCap);
96  css::drawing::LineCap GetLineCap() const { return mpImplLineInfo->meLineCap; }
97 
98  bool IsDefault() const;
99 
100  friend SvStream& ReadLineInfo( SvStream& rIStm, LineInfo& rLineInfo );
101  friend SvStream& WriteLineInfo( SvStream& rOStm, const LineInfo& rLineInfo );
102 
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;
112 
113 private:
114  o3tl::cow_wrapper< ImplLineInfo > mpImplLineInfo;
115 };
116 
117 #endif // INCLUDED_VCL_LINEINFO_HXX
118 
119 /* 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
LineStyle
Definition: vclenum.hxx:185
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:203
double mnDotLen
Definition: lineinfo.hxx:39
SvStream & ReadLineInfo(SvStream &rIStm, LineInfo &rLineInfo)
Definition: lineinfo.cxx:142
double mnDashLen
Definition: lineinfo.hxx:38
sal_uInt16 mnDotCount
Definition: lineinfo.hxx:47
bool operator==(const ImplLineInfo &) const
Definition: lineinfo.cxx:43
LineStyle meStyle
Definition: lineinfo.hxx:44
basegfx::B2DLineJoin meLineJoin
Definition: lineinfo.hxx:42
double mnWidth
Definition: lineinfo.hxx:37
css::drawing::LineCap meLineCap
Definition: lineinfo.hxx:43
double mnDistance
Definition: lineinfo.hxx:40
SvStream & WriteLineInfo(SvStream &rOStm, const LineInfo &rLineInfo)
Definition: lineinfo.cxx:190
sal_uInt16 mnDashCount
Definition: lineinfo.hxx:46