1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
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
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.
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.
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,
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.
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.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
55 ************************************************************************/
56 /*************************************************************************
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
63 #include <xfilter/xfstyle.hxx>
64 #include <xfilter/xftimestyle.hxx>
65 #include <xfilter/xfstylecont.hxx>
67 class XFDatePart
: public XFTimePart
73 void SetTexture(bool bTexture
);
75 virtual void ToXml(IXFStream
* pStrm
) override
;
81 class XFDateStyle
: public XFStyle
86 virtual ~XFDateStyle() override
;
89 void AddYear(bool bLongFmt
= true);
91 void AddMonth(bool bLongFmt
= true, bool bTexture
= false);
93 void AddMonthDay(bool bLongFmt
= true);
95 void AddWeekDay(bool bLongFmt
= true);
99 void AddHour(bool bLongFmt
= true);
101 void AddMinute(bool bLongFmt
= true);
103 void AddSecond(bool bLongFmt
= true);
107 void AddText(const OUString
& part
);
109 virtual enumXFStyle
GetStyleFamily() override
;
111 virtual void ToXml(IXFStream
* pStrm
) override
;
114 XFStyleContainer m_aParts
;
117 inline void XFDatePart::SetTexture(bool bTexture
) { m_bTexture
= bTexture
; }
119 inline void XFDateStyle::AddYear(bool bLongFmt
)
121 std::unique_ptr
<XFDatePart
> part(new XFDatePart());
122 part
->SetPartType(enumXFDateYear
);
123 part
->SetLongFmt(bLongFmt
);
124 m_aParts
.AddStyle(std::move(part
));
127 inline void XFDateStyle::AddMonth(bool bLongFmt
, bool bTexture
)
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
));
136 inline void XFDateStyle::AddMonthDay(bool bLongFmt
)
138 std::unique_ptr
<XFDatePart
> part(new XFDatePart());
139 part
->SetPartType(enumXFDateMonthDay
);
140 part
->SetLongFmt(bLongFmt
);
141 m_aParts
.AddStyle(std::move(part
));
144 inline void XFDateStyle::AddWeekDay(bool bLongFmt
)
146 std::unique_ptr
<XFDatePart
> part(new XFDatePart());
147 part
->SetPartType(enumXFDateWeekDay
);
148 part
->SetLongFmt(bLongFmt
);
149 m_aParts
.AddStyle(std::move(part
));
152 inline void XFDateStyle::AddEra()
154 std::unique_ptr
<XFDatePart
> part(new XFDatePart());
155 part
->SetPartType(enumXFDateEra
);
156 part
->SetLongFmt(false);
157 m_aParts
.AddStyle(std::move(part
));
160 inline void XFDateStyle::AddText(const OUString
& text
)
162 std::unique_ptr
<XFDatePart
> part(new XFDatePart());
163 part
->SetPartType(enumXFDateText
);
165 m_aParts
.AddStyle(std::move(part
));
168 inline void XFDateStyle::AddHour(bool bLongFmt
)
170 std::unique_ptr
<XFDatePart
> part(new XFDatePart());
171 part
->SetPartType(enumXFDateHour
);
172 part
->SetLongFmt(bLongFmt
);
173 m_aParts
.AddStyle(std::move(part
));
176 inline void XFDateStyle::AddMinute(bool bLongFmt
)
178 std::unique_ptr
<XFDatePart
> part(new XFDatePart());
179 part
->SetPartType(enumXFDateMinute
);
180 part
->SetLongFmt(bLongFmt
);
181 m_aParts
.AddStyle(std::move(part
));
184 inline void XFDateStyle::AddSecond(bool bLongFmt
)
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
));
193 inline void XFDateStyle::AddAmPm()
195 std::unique_ptr
<XFDatePart
> part(new XFDatePart());
196 part
->SetPartType(enumXFDateAmPm
);
197 m_aParts
.AddStyle(std::move(part
));
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */