1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SVX_XDASH_HXX 25 #define _SVX_XDASH_HXX 26 27 //------------- 28 // class XDash 29 //------------- 30 31 #include <svx/xenum.hxx> 32 #include "svx/svxdllapi.h" 33 34 #include <vector> 35 36 class SVX_DLLPUBLIC XDash 37 { 38 protected: 39 XDashStyle eDash; 40 sal_uInt16 nDots; 41 sal_uIntPtr nDotLen; 42 sal_uInt16 nDashes; 43 sal_uIntPtr nDashLen; 44 sal_uIntPtr nDistance; 45 46 public: 47 XDash(XDashStyle eDash = XDASH_RECT, 48 sal_uInt16 nDots = 1, sal_uIntPtr nDotLen = 20, 49 sal_uInt16 nDashes = 1, sal_uIntPtr nDashLen = 20, sal_uIntPtr nDistance = 20); 50 51 bool operator==(const XDash& rDash) const; 52 SetDashStyle(XDashStyle eNewStyle)53 void SetDashStyle(XDashStyle eNewStyle) { eDash = eNewStyle; } SetDots(sal_uInt16 nNewDots)54 void SetDots(sal_uInt16 nNewDots) { nDots = nNewDots; } SetDotLen(sal_uIntPtr nNewDotLen)55 void SetDotLen(sal_uIntPtr nNewDotLen) { nDotLen = nNewDotLen; } SetDashes(sal_uInt16 nNewDashes)56 void SetDashes(sal_uInt16 nNewDashes) { nDashes = nNewDashes; } SetDashLen(sal_uIntPtr nNewDashLen)57 void SetDashLen(sal_uIntPtr nNewDashLen) { nDashLen = nNewDashLen; } SetDistance(sal_uIntPtr nNewDistance)58 void SetDistance(sal_uIntPtr nNewDistance) { nDistance = nNewDistance; } 59 GetDashStyle() const60 XDashStyle GetDashStyle() const { return eDash; } GetDots() const61 sal_uInt16 GetDots() const { return nDots; } GetDotLen() const62 sal_uIntPtr GetDotLen() const { return nDotLen; } GetDashes() const63 sal_uInt16 GetDashes() const { return nDashes; } GetDashLen() const64 sal_uIntPtr GetDashLen() const { return nDashLen; } GetDistance() const65 sal_uIntPtr GetDistance() const { return nDistance; } 66 67 // XDash is translated into an array of doubles which describe the lengths of the 68 // dashes, dots and empty passages. It returns the complete length of the full DashDot 69 // sequence and fills the given vetor of doubles accordingly (also resizing, so deleting it). 70 double CreateDotDashArray(::std::vector< double >& rDotDashArray, double fLineWidth) const; 71 }; 72 73 #endif 74