Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <com/sun/star/uno/Any.hxx>
21 :
22 : #include <unotools/intlwrapper.hxx>
23 : #include <tools/stream.hxx>
24 : #include <svl/custritm.hxx>
25 :
26 : //============================================================================
27 : //
28 : // class CntUnencodedStringItem
29 : //
30 : //============================================================================
31 :
32 : DBG_NAME(CntUnencodedStringItem)
33 :
34 : //============================================================================
35 119176 : TYPEINIT1_AUTOFACTORY(CntUnencodedStringItem, SfxPoolItem)
36 :
37 : //============================================================================
38 : // virtual
39 352738 : int CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const
40 : {
41 : DBG_CHKTHIS(CntUnencodedStringItem, 0);
42 : DBG_ASSERT(rItem.ISA(CntUnencodedStringItem),
43 : "CntUnencodedStringItem::operator ==(): Bad type");
44 : return m_aValue
45 352738 : == (static_cast< const CntUnencodedStringItem * >(&rItem))->
46 352738 : m_aValue;
47 : }
48 :
49 : //============================================================================
50 : // virtual
51 0 : int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith) const
52 : {
53 : OSL_FAIL("CntUnencodedStringItem::Compare(): No international");
54 : DBG_CHKTHIS(CntUnencodedStringItem, 0);
55 : DBG_ASSERT(rWith.ISA(CntUnencodedStringItem),
56 : "CntUnencodedStringItem::Compare(): Bad type");
57 : sal_Int32 nCmp = m_aValue.compareTo(
58 0 : static_cast< CntUnencodedStringItem const * >(&rWith)->m_aValue);
59 0 : return (nCmp == 0) ? 0 : (nCmp < 0) ? -1 : 1;
60 : }
61 :
62 : //============================================================================
63 : // virtual
64 0 : int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith,
65 : IntlWrapper const & rIntlWrapper)
66 : const
67 : {
68 : DBG_CHKTHIS(CntUnencodedStringItem, 0);
69 : DBG_ASSERT(rWith.ISA(CntUnencodedStringItem),
70 : "CntUnencodedStringItem::Compare(): Bad type");
71 : return rIntlWrapper.getCollator()->compareString( m_aValue,
72 0 : static_cast< CntUnencodedStringItem const * >(&rWith)->m_aValue );
73 : }
74 :
75 : //============================================================================
76 : // virtual
77 : SfxItemPresentation
78 0 : CntUnencodedStringItem::GetPresentation(SfxItemPresentation, SfxMapUnit,
79 : SfxMapUnit, OUString & rText,
80 : const IntlWrapper *) const
81 : {
82 : DBG_CHKTHIS(CntUnencodedStringItem, 0);
83 0 : rText = m_aValue;
84 0 : return SFX_ITEM_PRESENTATION_NAMELESS;
85 : }
86 :
87 : //============================================================================
88 : // virtual
89 23540 : bool CntUnencodedStringItem::QueryValue(com::sun::star::uno::Any& rVal, sal_uInt8)
90 : const
91 : {
92 23540 : rVal <<= OUString(m_aValue);
93 23540 : return true;
94 : }
95 :
96 : //============================================================================
97 : // virtual
98 7873 : bool CntUnencodedStringItem::PutValue(const com::sun::star::uno::Any& rVal,
99 : sal_uInt8)
100 : {
101 7873 : OUString aTheValue;
102 7873 : if (rVal >>= aTheValue)
103 : {
104 7873 : m_aValue = aTheValue;
105 7873 : return true;
106 : }
107 : OSL_FAIL("CntUnencodedStringItem::PutValue(): Wrong type");
108 0 : return false;
109 : }
110 :
111 : //============================================================================
112 : // virtual
113 0 : SfxPoolItem * CntUnencodedStringItem::Clone(SfxItemPool *) const
114 : {
115 : DBG_CHKTHIS(CntUnencodedStringItem, 0);
116 0 : return new CntUnencodedStringItem(*this);
117 : }
118 :
119 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|