xref: /AOO41X/main/svl/inc/svl/dateitem.hxx (revision 39a19a47feaddbaa21988da8c7bf801707fd3d48)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _DATETIMEITEM_HXX
24 #define _DATETIMEITEM_HXX
25 
26 #include <tools/rtti.hxx>
27 #include <tools/datetime.hxx>
28 
29 #include <svl/poolitem.hxx>
30 
31 class SvStream;
32 
33 DBG_NAMEEX(SfxDateTimeItem)
34 
35 // class SfxDateTimeItem -------------------------------------------------
36 
37 class SfxDateTimeItem : public SfxPoolItem
38 {
39 private:
40     DateTime                aDateTime;
41 
42 public:
43                             TYPEINFO();
44 
45                             SfxDateTimeItem( sal_uInt16 nWhich );
46                             SfxDateTimeItem( sal_uInt16 nWhich,
47                                              const DateTime& rDT );
48                             SfxDateTimeItem( const SfxDateTimeItem& rCpy );
49 
~SfxDateTimeItem()50                             ~SfxDateTimeItem() {
51                                 DBG_DTOR(SfxDateTimeItem, 0); }
52 
53     virtual int             operator==( const SfxPoolItem& ) const;
54     using SfxPoolItem::Compare;
55     virtual int             Compare( const SfxPoolItem &rWith ) const;
56     virtual SfxPoolItem*    Create( SvStream&, sal_uInt16 nItemVersion ) const;
57     virtual SvStream&       Store( SvStream&, sal_uInt16 nItemVersion ) const;
58     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
59 
60     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
61                                     SfxMapUnit eCoreMetric,
62                                     SfxMapUnit ePresMetric,
63                                     XubString &rText,
64                                     const IntlWrapper * pIntlWrapper = 0 )
65         const;
66 
GetDateTime() const67     const DateTime&         GetDateTime() const { return aDateTime; }
SetDateTime(const DateTime & rDT)68     void                    SetDateTime( const DateTime& rDT ) {
69                                 DBG_ASSERT( GetRefCount() == 0,
70                                             "SetDateTime() with pooled item" );
71                                 aDateTime = rDT; }
72 
73     virtual sal_Bool PutValue  ( const com::sun::star::uno::Any& rVal,
74                              sal_uInt8 nMemberId = 0 );
75     virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal,
76                              sal_uInt8 nMemberId = 0 ) const;
77 };
78 
79 class SfxColumnDateTimeItem : public SfxDateTimeItem
80 {
81 public:
82                             TYPEINFO();
83 
84                             SfxColumnDateTimeItem( sal_uInt16 nWhich );
85                             SfxColumnDateTimeItem( sal_uInt16 nWhich,
86                                              const DateTime& rDT );
87                             SfxColumnDateTimeItem( const SfxDateTimeItem& rCpy );
88 
~SfxColumnDateTimeItem()89                             ~SfxColumnDateTimeItem() {}
90 
91     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
92 
93     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
94                                     SfxMapUnit eCoreMetric,
95                                     SfxMapUnit ePresMetric,
96                                     XubString &rText,
97                                     const IntlWrapper * pIntlWrapper = 0 )
98         const;
99 };
100 
101 #endif
102 
103