1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: custritm.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
33 #include <com/sun/star/uno/Any.hxx>
35 #include <unotools/intlwrapper.hxx>
36 #include <tools/stream.hxx>
37 #include <svtools/custritm.hxx>
39 //============================================================================
41 // class CntUnencodedStringItem
43 //============================================================================
45 DBG_NAME(CntUnencodedStringItem
)
47 //============================================================================
48 TYPEINIT1_AUTOFACTORY(CntUnencodedStringItem
, SfxPoolItem
)
50 //============================================================================
52 int CntUnencodedStringItem::operator ==(const SfxPoolItem
& rItem
) const
54 DBG_CHKTHIS(CntUnencodedStringItem
, 0);
55 DBG_ASSERT(rItem
.ISA(CntUnencodedStringItem
),
56 "CntUnencodedStringItem::operator ==(): Bad type");
58 == SAL_STATIC_CAST(const CntUnencodedStringItem
*, &rItem
)->
62 //============================================================================
64 int CntUnencodedStringItem::Compare(SfxPoolItem
const & rWith
) const
66 DBG_ERROR("CntUnencodedStringItem::Compare(): No international");
67 DBG_CHKTHIS(CntUnencodedStringItem
, 0);
68 DBG_ASSERT(rWith
.ISA(CntUnencodedStringItem
),
69 "CntUnencodedStringItem::Compare(): Bad type");
70 switch (m_aValue
.CompareTo(static_cast< CntUnencodedStringItem
const * >(
80 default: // COMPARE_GREATER
85 //============================================================================
87 int CntUnencodedStringItem::Compare(SfxPoolItem
const & rWith
,
88 IntlWrapper
const & rIntlWrapper
)
91 DBG_CHKTHIS(CntUnencodedStringItem
, 0);
92 DBG_ASSERT(rWith
.ISA(CntUnencodedStringItem
),
93 "CntUnencodedStringItem::Compare(): Bad type");
94 return rIntlWrapper
.getCollator()->compareString( m_aValue
,
95 static_cast< CntUnencodedStringItem
const * >(&rWith
)->m_aValue
);
98 //============================================================================
101 CntUnencodedStringItem::GetPresentation(SfxItemPresentation
, SfxMapUnit
,
102 SfxMapUnit
, XubString
& rText
,
103 const IntlWrapper
*) const
105 DBG_CHKTHIS(CntUnencodedStringItem
, 0);
107 return SFX_ITEM_PRESENTATION_NAMELESS
;
110 //============================================================================
112 BOOL
CntUnencodedStringItem::QueryValue(com::sun::star::uno::Any
& rVal
, BYTE
)
115 rVal
<<= rtl::OUString(m_aValue
);
119 //============================================================================
121 BOOL
CntUnencodedStringItem::PutValue(const com::sun::star::uno::Any
& rVal
,
124 rtl::OUString aTheValue
;
125 if (rVal
>>= aTheValue
)
127 m_aValue
= UniString(aTheValue
);
130 DBG_ERROR("CntUnencodedStringItem::PutValue(): Wrong type");
134 //============================================================================
136 SfxPoolItem
* CntUnencodedStringItem::Clone(SfxItemPool
*) const
138 DBG_CHKTHIS(CntUnencodedStringItem
, 0);
139 return new CntUnencodedStringItem(*this);