LibreOffice Module lotuswordpro (master) 1
xfdatestyle.hxx
Go to the documentation of this file.
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_INC_XFILTER_XFDATESTYLE_HXX
61#define INCLUDED_LOTUSWORDPRO_INC_XFILTER_XFDATESTYLE_HXX
62
63#include <xfilter/xfstyle.hxx>
66
67class XFDatePart : public XFTimePart
68{
69public:
70 XFDatePart();
71
72public:
73 void SetTexture(bool bTexture);
74
75 virtual void ToXml(IXFStream* pStrm) override;
76
77private:
79};
80
81class XFDateStyle : public XFStyle
82{
83public:
85
86 virtual ~XFDateStyle() override;
87
88public:
89 void AddYear(bool bLongFmt = true);
90
91 void AddMonth(bool bLongFmt = true, bool bTexture = false);
92
93 void AddMonthDay(bool bLongFmt = true);
94
95 void AddWeekDay(bool bLongFmt = true);
96
97 void AddEra();
98
99 void AddHour(bool bLongFmt = true);
100
101 void AddMinute(bool bLongFmt = true);
102
103 void AddSecond(bool bLongFmt = true);
104
105 void AddAmPm();
106
107 void AddText(const OUString& part);
108
109 virtual enumXFStyle GetStyleFamily() override;
110
111 virtual void ToXml(IXFStream* pStrm) override;
112
113private:
115};
116
117inline void XFDatePart::SetTexture(bool bTexture) { m_bTexture = bTexture; }
118
119inline void XFDateStyle::AddYear(bool bLongFmt)
120{
121 std::unique_ptr<XFDatePart> part(new XFDatePart());
122 part->SetPartType(enumXFDateYear);
123 part->SetLongFmt(bLongFmt);
124 m_aParts.AddStyle(std::move(part));
125}
126
127inline void XFDateStyle::AddMonth(bool bLongFmt, bool bTexture)
128{
129 std::unique_ptr<XFDatePart> part(new XFDatePart());
130 part->SetPartType(enumXFDateMonth);
131 part->SetLongFmt(bLongFmt);
132 part->SetTexture(bTexture);
133 m_aParts.AddStyle(std::move(part));
134}
135
136inline void XFDateStyle::AddMonthDay(bool bLongFmt)
137{
138 std::unique_ptr<XFDatePart> part(new XFDatePart());
139 part->SetPartType(enumXFDateMonthDay);
140 part->SetLongFmt(bLongFmt);
141 m_aParts.AddStyle(std::move(part));
142}
143
144inline void XFDateStyle::AddWeekDay(bool bLongFmt)
145{
146 std::unique_ptr<XFDatePart> part(new XFDatePart());
147 part->SetPartType(enumXFDateWeekDay);
148 part->SetLongFmt(bLongFmt);
149 m_aParts.AddStyle(std::move(part));
150}
151
153{
154 std::unique_ptr<XFDatePart> part(new XFDatePart());
155 part->SetPartType(enumXFDateEra);
156 part->SetLongFmt(false);
157 m_aParts.AddStyle(std::move(part));
158}
159
160inline void XFDateStyle::AddText(const OUString& text)
161{
162 std::unique_ptr<XFDatePart> part(new XFDatePart());
163 part->SetPartType(enumXFDateText);
164 part->SetText(text);
165 m_aParts.AddStyle(std::move(part));
166}
167
168inline void XFDateStyle::AddHour(bool bLongFmt)
169{
170 std::unique_ptr<XFDatePart> part(new XFDatePart());
171 part->SetPartType(enumXFDateHour);
172 part->SetLongFmt(bLongFmt);
173 m_aParts.AddStyle(std::move(part));
174}
175
176inline void XFDateStyle::AddMinute(bool bLongFmt)
177{
178 std::unique_ptr<XFDatePart> part(new XFDatePart());
179 part->SetPartType(enumXFDateMinute);
180 part->SetLongFmt(bLongFmt);
181 m_aParts.AddStyle(std::move(part));
182}
183
184inline void XFDateStyle::AddSecond(bool bLongFmt)
185{
186 std::unique_ptr<XFDatePart> part(new XFDatePart());
187 part->SetPartType(enumXFDateSecond);
188 part->SetLongFmt(bLongFmt);
189 part->SetDecimalPos(0);
190 m_aParts.AddStyle(std::move(part));
191}
192
194{
195 std::unique_ptr<XFDatePart> part(new XFDatePart());
196 part->SetPartType(enumXFDateAmPm);
197 m_aParts.AddStyle(std::move(part));
198}
199
200#endif
201
202/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Stream wrapper for sax writer.
Definition: ixfstream.hxx:72
void SetTexture(bool bTexture)
bool m_bTexture
Definition: xfdatestyle.hxx:78
virtual void ToXml(IXFStream *pStrm) override
Definition: xfdatestyle.cxx:68
void AddMinute(bool bLongFmt=true)
void AddSecond(bool bLongFmt=true)
virtual enumXFStyle GetStyleFamily() override
@descr get style family.
XFStyleContainer m_aParts
void AddText(const OUString &part)
void AddWeekDay(bool bLongFmt=true)
void AddHour(bool bLongFmt=true)
void AddAmPm()
void AddYear(bool bLongFmt=true)
virtual ~XFDateStyle() override
void AddMonthDay(bool bLongFmt=true)
virtual void ToXml(IXFStream *pStrm) override
void AddMonth(bool bLongFmt=true, bool bTexture=false)
@descr container object for styles.
Definition: xfstylecont.hxx:85
IXFStyleRet AddStyle(std::unique_ptr< IXFStyle > pStyle)
@descr Add style to container.
Definition: xfstylecont.cxx:83
implements ixfstyle interface.
Definition: xfstyle.hxx:70
def text(shape, orig_st)
enumXFStyle
Definition: xfdefs.hxx:80
@ enumXFDateSecond
Definition: xfdefs.hxx:250
@ enumXFDateMonthDay
Definition: xfdefs.hxx:243
@ enumXFDateMonth
Definition: xfdefs.hxx:242
@ enumXFDateMinute
Definition: xfdefs.hxx:249
@ enumXFDateAmPm
Definition: xfdefs.hxx:251
@ enumXFDateText
Definition: xfdefs.hxx:252
@ enumXFDateHour
Definition: xfdefs.hxx:248
@ enumXFDateEra
Definition: xfdefs.hxx:246
@ enumXFDateYear
Definition: xfdefs.hxx:241
@ enumXFDateWeekDay
Definition: xfdefs.hxx:244