xref: /aoo4110/main/svl/inc/svl/rngitem.hxx (revision b1cdbd2c)
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 
24 #ifndef _SFXRNGITEM_HXX
25 
26 #ifndef NUMTYPE
27 
28 #define NUMTYPE	sal_uInt16
29 #define SfxXRangeItem SfxRangeItem
30 #define SfxXRangesItem SfxUShortRangesItem
31 #include <svl/rngitem.hxx>
32 #undef NUMTYPE
33 #undef SfxXRangeItem
34 #undef SfxXRangesItem
35 
36 #ifndef _SFXITEMS_HXX
37 #define NUMTYPE	sal_uLong
38 #define SfxXRangeItem SfxULongRangeItem
39 #define SfxXRangesItem SfxULongRangesItem
40 #include <svl/rngitem.hxx>
41 #undef NUMTYPE
42 #undef SfxXRangeItem
43 #undef SfxXRangesItem
44 #endif
45 
46 #define _SFXRNGITEM_HXX
47 
48 #else
49 #include "svl/svldllapi.h"
50 #include <svl/poolitem.hxx>
51 
52 class SvStream;
53 
54 // -----------------------------------------------------------------------
55 
56 class SVL_DLLPUBLIC SfxXRangeItem : public SfxPoolItem
57 {
58 private:
59 	NUMTYPE 					nFrom;
60 	NUMTYPE 					nTo;
61 public:
62 								TYPEINFO();
63 								SfxXRangeItem();
64 								SfxXRangeItem( sal_uInt16 nWID, NUMTYPE nFrom, NUMTYPE nTo );
65 								SfxXRangeItem( sal_uInt16 nWID, SvStream &rStream );
66 								SfxXRangeItem( const SfxXRangeItem& rItem );
67 	virtual int 				operator==( const SfxPoolItem& ) const;
68 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
69 									SfxMapUnit eCoreMetric,
70 									SfxMapUnit ePresMetric,
71 									XubString &rText,
72                                     const IntlWrapper * = 0 ) const;
73 	virtual SfxPoolItem*    	Clone( SfxItemPool *pPool = 0 ) const;
From()74 	inline NUMTYPE&				From() { return nFrom; }
From() const75 	inline NUMTYPE				From() const { return nFrom; }
To()76 	inline NUMTYPE&				To() { return nTo; }
To() const77 	inline NUMTYPE				To() const { return nTo; }
HasRange() const78 	inline sal_Bool					HasRange() const { return nTo>nFrom; }
79 	virtual SfxPoolItem*		Create( SvStream &, sal_uInt16 nVersion ) const;
80 	virtual SvStream&			Store( SvStream &, sal_uInt16 nItemVersion ) const;
81 };
82 
83 // -----------------------------------------------------------------------
84 
85 class SVL_DLLPUBLIC SfxXRangesItem : public SfxPoolItem
86 {
87 private:
88 	NUMTYPE*					_pRanges;
89 
90 public:
91 								TYPEINFO();
92 								SfxXRangesItem();
93 								SfxXRangesItem( sal_uInt16 nWID, const NUMTYPE *pRanges );
94 								SfxXRangesItem( sal_uInt16 nWID, SvStream &rStream );
95 								SfxXRangesItem( const SfxXRangesItem& rItem );
96 	virtual 					~SfxXRangesItem();
97 	virtual int 				operator==( const SfxPoolItem& ) const;
98 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
99 									SfxMapUnit eCoreMetric,
100 									SfxMapUnit ePresMetric,
101 									XubString &rText,
102                                     const IntlWrapper * = 0 ) const;
103 	virtual SfxPoolItem*    	Clone( SfxItemPool *pPool = 0 ) const;
GetRanges() const104 	inline const NUMTYPE*		GetRanges() const { return _pRanges; }
105 	virtual SfxPoolItem*		Create( SvStream &, sal_uInt16 nVersion ) const;
106 	virtual SvStream&			Store( SvStream &, sal_uInt16 nItemVersion ) const;
107 };
108 
109 #endif
110 #endif
111