Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * The Contents of this file are made available subject to the terms of
5 : : * either of the following licenses
6 : : *
7 : : * - GNU Lesser General Public License Version 2.1
8 : : * - Sun Industry Standards Source License Version 1.1
9 : : *
10 : : * Sun Microsystems Inc., October, 2000
11 : : *
12 : : * GNU Lesser General Public License Version 2.1
13 : : * =============================================
14 : : * Copyright 2000 by Sun Microsystems, Inc.
15 : : * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 : : *
17 : : * This library is free software; you can redistribute it and/or
18 : : * modify it under the terms of the GNU Lesser General Public
19 : : * License version 2.1, as published by the Free Software Foundation.
20 : : *
21 : : * This library is distributed in the hope that it will be useful,
22 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 : : * Lesser General Public License for more details.
25 : : *
26 : : * You should have received a copy of the GNU Lesser General Public
27 : : * License along with this library; if not, write to the Free Software
28 : : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 : : * MA 02111-1307 USA
30 : : *
31 : : *
32 : : * Sun Industry Standards Source License Version 1.1
33 : : * =================================================
34 : : * The contents of this file are subject to the Sun Industry Standards
35 : : * Source License Version 1.1 (the "License"); You may not use this file
36 : : * except in compliance with the License. You may obtain a copy of the
37 : : * License at http://www.openoffice.org/license.html.
38 : : *
39 : : * Software provided under this License is provided on an "AS IS" basis,
40 : : * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 : : * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 : : * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 : : * See the License for the specific provisions governing your rights and
44 : : * obligations concerning the Software.
45 : : *
46 : : * The Initial Developer of the Original Code is: IBM Corporation
47 : : *
48 : : * Copyright: 2008 by IBM Corporation
49 : : *
50 : : * All Rights Reserved.
51 : : *
52 : : * Contributor(s): _______________________________________
53 : : *
54 : : *
55 : : ************************************************************************/
56 : : /*************************************************************************
57 : : * @file
58 : : * Style for all draw object.
59 : : ************************************************************************/
60 : : #ifndef _XFDRAWSTYLE_HXX
61 : : #define _XFDRAWSTYLE_HXX
62 : :
63 : : #include "xfstyle.hxx"
64 : : #include "xfcolor.hxx"
65 : : #include <cassert>
66 : :
67 : : class XFDrawLineStyle;
68 : : class XFDrawAreaStyle;
69 : : class XFFontWorkStyle;
70 : :
71 : : /**
72 : : * @brief
73 : : * Style for all drawing object, which can includes line style, area style, wrap style.
74 : : * Line style includes line type, line width and line color.
75 : : * Area style can be divided into 5 kinds, color fill, hatch, bitmap, gradient.I only support
76 : : * color fill and hatch now.
77 : : */
78 : : class XFDrawStyle : public XFStyle
79 : : {
80 : : public:
81 : : XFDrawStyle();
82 : :
83 : : virtual ~XFDrawStyle();
84 : :
85 : : public:
86 : : /**
87 : : * @descr Set drawing wrap type.
88 : : */
89 : : void SetWrapType(enumXFWrap wrap, sal_Int32 nParagraphs = 0);
90 : :
91 : : /**
92 : : * @descr Set drawing object border line.
93 : : */
94 : : void SetLineStyle(double width, XFColor color = XFColor(0,0,0), sal_Int32 transparency = 0);
95 : :
96 : : /**
97 : : * @descr Set drawing obejct dash border style.
98 : : */
99 : : void SetLineDashStyle(enumXFLineStyle style, int num1, int num2, double len1, double len2, double space );
100 : :
101 : : /**
102 : : * @descr Set drawing object area fill color.
103 : : */
104 : : void SetAreaColor(XFColor& color);
105 : :
106 : : /**
107 : : * @descr Set drawing obejct area grid style.
108 : : */
109 : : void SetAreaLineStyle(enumXFAreaLineStyle style, sal_Int32 angle = 0, double space = 0.102, XFColor lineColor = XFColor(0,0,0));
110 : :
111 : : /**
112 : : * @descr Set drawing object arrow start style,only lines can have arrows.
113 : : */
114 : : void SetArrowStart(rtl::OUString start, double size=0.3, sal_Bool center = sal_False);
115 : :
116 : : /**
117 : : * @descr Set drawing obejct arrow end style,only lines can have arrows.
118 : : */
119 : : void SetArrowEnd(rtl::OUString end, double size=0.3, sal_Bool center = sal_False);
120 : :
121 : : void SetFontWorkStyle(sal_Int8 nForm, enumXFFWStyle eStyle, enumXFFWAdjust eAdjust);
122 : :
123 : : virtual enumXFStyle GetStyleFamily();
124 : :
125 : : virtual void ToXml(IXFStream *pStrm);
126 : :
127 : : private:
128 : : XFFontWorkStyle* m_pFontWorkStyle;
129 : : enumXFWrap m_eWrap;
130 : : sal_Int32 m_nWrapLines;
131 : : XFDrawLineStyle *m_pLineStyle;
132 : : XFDrawAreaStyle *m_pAreaStyle;
133 : : rtl::OUString m_strArrowStart;
134 : : rtl::OUString m_strArrowEnd;
135 : : double m_fArrowStartSize;
136 : : double m_fArrowEndSize;
137 : : sal_Bool m_bArrowStartCenter;
138 : : sal_Bool m_bArrowEndCenter;
139 : : };
140 : :
141 : : inline void XFDrawStyle::SetWrapType(enumXFWrap wrap, sal_Int32 nParagraphs)
142 : : {
143 : : m_eWrap = wrap;
144 : : m_nWrapLines = nParagraphs;
145 : : }
146 : :
147 : :
148 : 0 : inline void XFDrawStyle::SetArrowStart(rtl::OUString start, double size, sal_Bool center)
149 : : {
150 : : assert(size>0);
151 : 0 : m_strArrowStart = start;
152 : 0 : m_fArrowStartSize = size;
153 : 0 : m_bArrowStartCenter = center;
154 : 0 : }
155 : :
156 : 0 : inline void XFDrawStyle::SetArrowEnd(rtl::OUString end, double size, sal_Bool center)
157 : : {
158 : : assert(size>0);
159 : 0 : m_strArrowEnd = end;
160 : 0 : m_fArrowEndSize = size;
161 : 0 : m_bArrowEndCenter = center;
162 : 0 : }
163 : :
164 : : #endif
165 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|