msxml3: Change ISAXXMLReader_getLine and ISAXXMLReader_getColumn functions.
[wine] / dlls / gdiplus / stringformat.c
1 /*
2  *
3  * Copyright (C) 2007 Google (Evan Stade)
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19
20 #include <stdarg.h>
21
22 #include "windef.h"
23 #include "winbase.h"
24 #include "wingdi.h"
25 #include "winnls.h"
26
27 #include "objbase.h"
28
29 #include "gdiplus.h"
30 #include "gdiplus_private.h"
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
34
35 GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
36     GpStringFormat **format)
37 {
38     if(!format)
39         return InvalidParameter;
40
41     *format = GdipAlloc(sizeof(GpStringFormat));
42     if(!*format)   return OutOfMemory;
43
44     (*format)->attr = attr;
45     (*format)->lang = lang;
46     (*format)->trimming = StringTrimmingCharacter;
47
48     return Ok;
49 }
50
51 GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
52 {
53     if(!format)
54         return InvalidParameter;
55
56     GdipFree(format);
57
58     return Ok;
59 }
60
61 GpStatus WINGDIPAPI GdipStringFormatGetGenericDefault(GpStringFormat **format)
62 {
63     if (!format)
64         return InvalidParameter;
65
66     FIXME("stub: %p\n", format);
67
68     return NotImplemented;
69 }
70
71 GpStatus WINGDIPAPI GdipGetStringFormatAlign(GpStringFormat *format,
72     StringAlignment *align)
73 {
74     if(!format || !align)
75         return InvalidParameter;
76
77     *align = format->align;
78
79     return Ok;
80 }
81
82 GpStatus WINGDIPAPI GdipGetStringFormatFlags(GDIPCONST GpStringFormat* format,
83         INT* flags)
84 {
85     if (!(format && flags))
86         return InvalidParameter;
87
88     *flags = format->attr;
89
90     return Ok;
91 }
92
93 GpStatus WINGDIPAPI GdipGetStringFormatHotkeyPrefix(GDIPCONST GpStringFormat
94     *format, INT *hkpx)
95 {
96     if(!format || !hkpx)
97         return InvalidParameter;
98
99     *hkpx = (INT)format->hkprefix;
100
101     return Ok;
102 }
103
104 GpStatus WINGDIPAPI GdipGetStringFormatLineAlign(GpStringFormat *format,
105     StringAlignment *align)
106 {
107     if(!format || !align)
108         return InvalidParameter;
109
110     *align = format->vertalign;
111
112     return Ok;
113 }
114
115 GpStatus WINGDIPAPI GdipGetStringFormatMeasurableCharacterRangeCount(
116         GDIPCONST GpStringFormat* format, INT* count)
117 {
118     if (!(format && count))
119         return InvalidParameter;
120
121     FIXME("stub: %p %p\n", format, count);
122
123     return NotImplemented;
124 }
125
126 GpStatus WINGDIPAPI GdipGetStringFormatTrimming(GpStringFormat *format,
127     StringTrimming *trimming)
128 {
129     if(!format || !trimming)
130         return InvalidParameter;
131
132     *trimming = format->trimming;
133
134     return Ok;
135 }
136
137 GpStatus WINGDIPAPI GdipSetStringFormatAlign(GpStringFormat *format,
138     StringAlignment align)
139 {
140     if(!format)
141         return InvalidParameter;
142
143     format->align = align;
144
145     return Ok;
146 }
147
148 GpStatus WINGDIPAPI GdipSetStringFormatHotkeyPrefix(GpStringFormat *format,
149     INT hkpx)
150 {
151     if(!format || hkpx < 0 || hkpx > 2)
152         return InvalidParameter;
153
154     format->hkprefix = (HotkeyPrefix) hkpx;
155
156     return Ok;
157 }
158
159 GpStatus WINGDIPAPI GdipSetStringFormatLineAlign(GpStringFormat *format,
160     StringAlignment align)
161 {
162     if(!format)
163         return InvalidParameter;
164
165     format->vertalign = align;
166
167     return Ok;
168 }
169
170 GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges(GpStringFormat*
171         format, INT rangeCount, GDIPCONST CharacterRange* ranges)
172 {
173     if (!(format && rangeCount && ranges))
174         return InvalidParameter;
175
176     FIXME("stub: %p, %d, %p\n", format, rangeCount, ranges);
177
178     return NotImplemented;
179 }
180
181 GpStatus WINGDIPAPI GdipSetStringFormatTrimming(GpStringFormat *format,
182     StringTrimming trimming)
183 {
184     if(!format)
185         return InvalidParameter;
186
187     format->trimming = trimming;
188
189     return Ok;
190 }
191
192 GpStatus WINGDIPAPI GdipSetStringFormatFlags(GDIPCONST GpStringFormat *format, INT flags)
193 {
194     FIXME("format (%p) flags (%d)\n", format, flags);
195
196     return Ok;
197 }
198
199 GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpStringFormat **newFormat)
200 {
201     if(!format || !newFormat)
202         return InvalidParameter;
203
204     *newFormat = GdipAlloc(sizeof(GpStringFormat));
205     if(!*newFormat)    return OutOfMemory;
206
207     **newFormat = *format;
208
209     TRACE("%p %p\n",format,newFormat);
210
211     return Ok;
212 }