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_SVX_XDASH_HXX
21 #define INCLUDED_SVX_XDASH_HXX
22 
23 
24 // class XDash
25 
26 
27 #include <svx/svxdllapi.h>
28 #include <com/sun/star/drawing/DashStyle.hpp>
29 
30 #include <vector>
31 
32 class SVX_DLLPUBLIC XDash final
33 {
34     css::drawing::DashStyle  eDash;
35     sal_uInt32               nDotLen;
36     sal_uInt16               nDots;
37     sal_uInt16               nDashes;
38     sal_uInt32               nDashLen;
39     sal_uInt32               nDistance;
40 
41 public:
42           XDash(css::drawing::DashStyle eDash = css::drawing::DashStyle_RECT,
43                 sal_uInt16 nDots = 1, sal_uInt32 nDotLen = 20,
44                 sal_uInt16 nDashes = 1, sal_uInt32 nDashLen = 20, sal_uInt32 nDistance = 20);
45 
46     bool operator==(const XDash& rDash) const;
47 
SetDashStyle(css::drawing::DashStyle eNewStyle)48     void SetDashStyle(css::drawing::DashStyle eNewStyle) { eDash = eNewStyle; }
SetDots(sal_uInt16 nNewDots)49     void SetDots(sal_uInt16 nNewDots)                    { nDots = nNewDots; }
SetDotLen(sal_uInt32 nNewDotLen)50     void SetDotLen(sal_uInt32 nNewDotLen)                { nDotLen = nNewDotLen; }
SetDashes(sal_uInt16 nNewDashes)51     void SetDashes(sal_uInt16 nNewDashes)                { nDashes = nNewDashes; }
SetDashLen(sal_uInt32 nNewDashLen)52     void SetDashLen(sal_uInt32 nNewDashLen)              { nDashLen = nNewDashLen; }
SetDistance(sal_uInt32 nNewDistance)53     void SetDistance(sal_uInt32 nNewDistance)            { nDistance = nNewDistance; }
54 
GetDashStyle() const55     css::drawing::DashStyle  GetDashStyle() const        { return eDash; }
GetDots() const56     sal_uInt16               GetDots() const             { return nDots; }
GetDotLen() const57     sal_uInt32               GetDotLen() const           { return nDotLen; }
GetDashes() const58     sal_uInt16               GetDashes() const           { return nDashes; }
GetDashLen() const59     sal_uInt32               GetDashLen() const          { return nDashLen; }
GetDistance() const60     sal_uInt32               GetDistance() const         { return nDistance; }
61 
62     // XDash is translated into an array of doubles which describe the lengths of the
63     // dashes, dots and empty passages. It returns the complete length of the full DashDot
64     // sequence and fills the given vetor of doubles accordingly (also resizing, so deleting it).
65     double CreateDotDashArray(::std::vector< double >& rDotDashArray, double fLineWidth) const;
66 };
67 
68 #endif
69 
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
71