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 : * Date style. The date format for date field.
59 : ************************************************************************/
60 : #ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFDATESTYLE_HXX
61 : #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFDATESTYLE_HXX
62 :
63 : #include "xfglobal.hxx"
64 : #include "xfstyle.hxx"
65 : #include "xftimestyle.hxx"
66 : #include "xfstylecont.hxx"
67 : #include <vector>
68 :
69 30 : class XFDatePart : public XFTimePart
70 : {
71 : public:
72 : XFDatePart();
73 : public:
74 : void SetTexture(bool bTexture);
75 :
76 : virtual void ToXml(IXFStream *pStrm) SAL_OVERRIDE;
77 :
78 : private:
79 : bool m_bTexture;
80 : };
81 :
82 : class XFDateStyle : public XFStyle
83 : {
84 : public:
85 : XFDateStyle();
86 :
87 : virtual ~XFDateStyle();
88 :
89 : public:
90 :
91 : void SetFixed(bool fixed);
92 :
93 : void SetLanguage(const OUString& lang);
94 :
95 : void SetCountry(const OUString& country);
96 :
97 : void SetAutoOrder(bool bAutoOrder);
98 :
99 : void AddYear( bool bLongFmt = true );
100 :
101 : void AddMonth( bool bLongFmt = true, bool bTexture = false );
102 :
103 : void AddMonthDay( bool bLongFmt = true );
104 :
105 : void AddWeekDay( bool bLongFmt = true );
106 :
107 : void AddYearWeek();
108 :
109 : void AddEra(bool bLongFmt = false);
110 :
111 : void AddQuarter(bool bLongFmt = false);
112 :
113 : void AddHour( bool bLongFmt = true );
114 :
115 : void AddMinute( bool bLongFmt = true );
116 :
117 : void AddSecond( bool bLongFmt = true, sal_Int16 nDecimalPos = 2);
118 :
119 : void AddAmPm(bool bAmPm);
120 :
121 : void AddText( const OUString& part );
122 :
123 : virtual enumXFStyle GetStyleFamily() SAL_OVERRIDE;
124 :
125 : virtual void ToXml(IXFStream *pStrm) SAL_OVERRIDE;
126 :
127 : private:
128 : bool m_bFixed;
129 : bool m_bAutoOrder;
130 : OUString m_strLanguage;
131 : OUString m_strCountry;
132 : XFStyleContainer m_aParts;
133 : };
134 :
135 3 : inline void XFDatePart::SetTexture(bool bTexture)
136 : {
137 3 : m_bTexture = bTexture;
138 3 : }
139 :
140 : inline void XFDateStyle::SetFixed(bool fixed)
141 : {
142 : m_bFixed = fixed;
143 : }
144 :
145 : inline void XFDateStyle::SetLanguage(const OUString& lang)
146 : {
147 : m_strLanguage = lang;
148 : }
149 :
150 : inline void XFDateStyle::SetCountry(const OUString& country)
151 : {
152 : m_strCountry = country;
153 : }
154 :
155 : inline void XFDateStyle::SetAutoOrder(bool bAutoOrder)
156 : {
157 : m_bAutoOrder = bAutoOrder;
158 : }
159 :
160 3 : inline void XFDateStyle::AddYear( bool bLongFmt )
161 : {
162 3 : XFDatePart *part = new XFDatePart();
163 3 : part->SetPartType(enumXFDateYear);
164 3 : part->SetLongFmt(bLongFmt);
165 3 : m_aParts.AddStyle(part);
166 3 : }
167 :
168 3 : inline void XFDateStyle::AddMonth( bool bLongFmt, bool bTexture )
169 : {
170 3 : XFDatePart *part = new XFDatePart();
171 3 : part->SetPartType(enumXFDateMonth);
172 3 : part->SetLongFmt(bLongFmt);
173 3 : part->SetTexture(bTexture);
174 3 : m_aParts.AddStyle(part);
175 3 : }
176 :
177 3 : inline void XFDateStyle::AddMonthDay( bool bLongFmt )
178 : {
179 3 : XFDatePart *part = new XFDatePart();
180 3 : part->SetPartType(enumXFDateMonthDay);
181 3 : part->SetLongFmt(bLongFmt);
182 3 : m_aParts.AddStyle(part);
183 3 : }
184 :
185 0 : inline void XFDateStyle::AddWeekDay( bool bLongFmt )
186 : {
187 0 : XFDatePart *part = new XFDatePart();
188 0 : part->SetPartType(enumXFDateWeekDay);
189 0 : part->SetLongFmt(bLongFmt);
190 0 : m_aParts.AddStyle(part);
191 0 : }
192 :
193 : inline void XFDateStyle::AddYearWeek()
194 : {
195 : XFDatePart *part = new XFDatePart();
196 : part->SetPartType(enumXFDateYearWeek);
197 : m_aParts.AddStyle(part);
198 : }
199 :
200 0 : inline void XFDateStyle::AddEra(bool bLongFmt)
201 : {
202 0 : XFDatePart *part = new XFDatePart();
203 0 : part->SetPartType(enumXFDateEra);
204 0 : part->SetLongFmt(bLongFmt);
205 0 : m_aParts.AddStyle(part);
206 0 : }
207 :
208 : inline void XFDateStyle::AddQuarter(bool bLongFmt)
209 : {
210 : XFDatePart *part = new XFDatePart();
211 : part->SetPartType(enumXFDateQuarter);
212 : part->SetLongFmt(bLongFmt);
213 : m_aParts.AddStyle(part);
214 : }
215 :
216 6 : inline void XFDateStyle::AddText( const OUString& text )
217 : {
218 6 : XFDatePart *part = new XFDatePart();
219 6 : part->SetPartType(enumXFDateText);
220 6 : part->SetText(text);
221 6 : m_aParts.AddStyle(part);
222 6 : }
223 :
224 0 : inline void XFDateStyle::AddHour( bool bLongFmt )
225 : {
226 0 : XFDatePart *part = new XFDatePart();
227 0 : part->SetPartType(enumXFDateHour);
228 0 : part->SetLongFmt(bLongFmt);
229 0 : m_aParts.AddStyle(part);
230 0 : }
231 :
232 0 : inline void XFDateStyle::AddMinute( bool bLongFmt )
233 : {
234 0 : XFDatePart *part = new XFDatePart();
235 0 : part->SetPartType(enumXFDateMinute);
236 0 : part->SetLongFmt(bLongFmt);
237 0 : m_aParts.AddStyle(part);
238 0 : }
239 :
240 0 : inline void XFDateStyle::AddSecond( bool bLongFmt, sal_Int16 pos)
241 : {
242 0 : XFDatePart *part = new XFDatePart();
243 0 : part->SetPartType(enumXFDateSecond);
244 0 : part->SetLongFmt(bLongFmt);
245 0 : part->SetDecimalPos(pos);
246 0 : m_aParts.AddStyle(part);
247 0 : }
248 :
249 0 : inline void XFDateStyle::AddAmPm(bool /*bAmPm*/)
250 : {
251 0 : XFDatePart *part = new XFDatePart();
252 0 : part->SetPartType(enumXFDateAmPm);
253 0 : m_aParts.AddStyle(part);
254 0 : }
255 :
256 : #endif
257 :
258 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|