xref: /aoo41x/main/svl/source/items/custritm.cxx (revision 40df464e)
1*40df464eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*40df464eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*40df464eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*40df464eSAndrew Rist  * distributed with this work for additional information
6*40df464eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*40df464eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*40df464eSAndrew Rist  * "License"); you may not use this file except in compliance
9*40df464eSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*40df464eSAndrew Rist  *
11*40df464eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*40df464eSAndrew Rist  *
13*40df464eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*40df464eSAndrew Rist  * software distributed under the License is distributed on an
15*40df464eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*40df464eSAndrew Rist  * KIND, either express or implied.  See the License for the
17*40df464eSAndrew Rist  * specific language governing permissions and limitations
18*40df464eSAndrew Rist  * under the License.
19*40df464eSAndrew Rist  *
20*40df464eSAndrew Rist  *************************************************************/
21*40df464eSAndrew Rist 
22*40df464eSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svl.hxx"
26cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <unotools/intlwrapper.hxx>
29cdf0e10cSrcweir #include <tools/stream.hxx>
30cdf0e10cSrcweir #include <svl/custritm.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //============================================================================
33cdf0e10cSrcweir //
34cdf0e10cSrcweir //  class CntUnencodedStringItem
35cdf0e10cSrcweir //
36cdf0e10cSrcweir //============================================================================
37cdf0e10cSrcweir 
38cdf0e10cSrcweir DBG_NAME(CntUnencodedStringItem)
39cdf0e10cSrcweir 
40cdf0e10cSrcweir //============================================================================
41cdf0e10cSrcweir TYPEINIT1_AUTOFACTORY(CntUnencodedStringItem, SfxPoolItem)
42cdf0e10cSrcweir 
43cdf0e10cSrcweir //============================================================================
44cdf0e10cSrcweir // virtual
45cdf0e10cSrcweir int CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const
46cdf0e10cSrcweir {
47cdf0e10cSrcweir 	DBG_CHKTHIS(CntUnencodedStringItem, 0);
48cdf0e10cSrcweir 	DBG_ASSERT(rItem.ISA(CntUnencodedStringItem),
49cdf0e10cSrcweir 			   "CntUnencodedStringItem::operator ==(): Bad type");
50cdf0e10cSrcweir 	return m_aValue
51cdf0e10cSrcweir 	        == SAL_STATIC_CAST(const CntUnencodedStringItem *, &rItem)->
52cdf0e10cSrcweir 	            m_aValue;
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir //============================================================================
56cdf0e10cSrcweir // virtual
Compare(SfxPoolItem const & rWith) const57cdf0e10cSrcweir int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith) const
58cdf0e10cSrcweir {
59cdf0e10cSrcweir 	DBG_ERROR("CntUnencodedStringItem::Compare(): No international");
60cdf0e10cSrcweir 	DBG_CHKTHIS(CntUnencodedStringItem, 0);
61cdf0e10cSrcweir 	DBG_ASSERT(rWith.ISA(CntUnencodedStringItem),
62cdf0e10cSrcweir 				"CntUnencodedStringItem::Compare(): Bad type");
63cdf0e10cSrcweir 	switch (m_aValue.CompareTo(static_cast< CntUnencodedStringItem const * >(
64cdf0e10cSrcweir 		                               &rWith)->
65cdf0e10cSrcweir 							       m_aValue))
66cdf0e10cSrcweir 	{
67cdf0e10cSrcweir 		case COMPARE_LESS:
68cdf0e10cSrcweir 			return -1;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 		case COMPARE_EQUAL:
71cdf0e10cSrcweir 			return 0;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 		default: // COMPARE_GREATER
74cdf0e10cSrcweir 			return 1;
75cdf0e10cSrcweir 	}
76cdf0e10cSrcweir }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir //============================================================================
79cdf0e10cSrcweir // virtual
Compare(SfxPoolItem const & rWith,IntlWrapper const & rIntlWrapper) const80cdf0e10cSrcweir int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith,
81cdf0e10cSrcweir                                     IntlWrapper const & rIntlWrapper)
82cdf0e10cSrcweir 	const
83cdf0e10cSrcweir {
84cdf0e10cSrcweir 	DBG_CHKTHIS(CntUnencodedStringItem, 0);
85cdf0e10cSrcweir 	DBG_ASSERT(rWith.ISA(CntUnencodedStringItem),
86cdf0e10cSrcweir 			   "CntUnencodedStringItem::Compare(): Bad type");
87cdf0e10cSrcweir     return rIntlWrapper.getCollator()->compareString( m_aValue,
88cdf0e10cSrcweir         static_cast< CntUnencodedStringItem const * >(&rWith)->m_aValue );
89cdf0e10cSrcweir }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir //============================================================================
92cdf0e10cSrcweir // virtual
93cdf0e10cSrcweir SfxItemPresentation
GetPresentation(SfxItemPresentation,SfxMapUnit,SfxMapUnit,XubString & rText,const IntlWrapper *) const94cdf0e10cSrcweir CntUnencodedStringItem::GetPresentation(SfxItemPresentation, SfxMapUnit,
95cdf0e10cSrcweir 										SfxMapUnit, XubString & rText,
96cdf0e10cSrcweir                                         const IntlWrapper *) const
97cdf0e10cSrcweir {
98cdf0e10cSrcweir 	DBG_CHKTHIS(CntUnencodedStringItem, 0);
99cdf0e10cSrcweir 	rText = m_aValue;
100cdf0e10cSrcweir 	return SFX_ITEM_PRESENTATION_NAMELESS;
101cdf0e10cSrcweir }
102cdf0e10cSrcweir 
103cdf0e10cSrcweir //============================================================================
104cdf0e10cSrcweir // virtual
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8) const105cdf0e10cSrcweir sal_Bool CntUnencodedStringItem::QueryValue(com::sun::star::uno::Any& rVal, sal_uInt8)
106cdf0e10cSrcweir 	const
107cdf0e10cSrcweir {
108cdf0e10cSrcweir 	rVal <<= rtl::OUString(m_aValue);
109cdf0e10cSrcweir 	return true;
110cdf0e10cSrcweir }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir //============================================================================
113cdf0e10cSrcweir // virtual
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8)114cdf0e10cSrcweir sal_Bool CntUnencodedStringItem::PutValue(const com::sun::star::uno::Any& rVal,
115cdf0e10cSrcweir 						   			  sal_uInt8)
116cdf0e10cSrcweir {
117cdf0e10cSrcweir 	rtl::OUString aTheValue;
118cdf0e10cSrcweir 	if (rVal >>= aTheValue)
119cdf0e10cSrcweir 	{
120cdf0e10cSrcweir 		m_aValue = UniString(aTheValue);
121cdf0e10cSrcweir 		return true;
122cdf0e10cSrcweir 	}
123cdf0e10cSrcweir 	DBG_ERROR("CntUnencodedStringItem::PutValue(): Wrong type");
124cdf0e10cSrcweir 	return false;
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir //============================================================================
128cdf0e10cSrcweir // virtual
Clone(SfxItemPool *) const129cdf0e10cSrcweir SfxPoolItem * CntUnencodedStringItem::Clone(SfxItemPool *) const
130cdf0e10cSrcweir {
131cdf0e10cSrcweir 	DBG_CHKTHIS(CntUnencodedStringItem, 0);
132cdf0e10cSrcweir 	return new CntUnencodedStringItem(*this);
133cdf0e10cSrcweir }
134cdf0e10cSrcweir 
135