Branch data 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 [ - + ][ + + ]: 230678 : TYPEINIT1_AUTOFACTORY(CntUnencodedStringItem, SfxPoolItem)
[ # # ]
36 : :
37 : : //============================================================================
38 : : // virtual
39 : 523841 : 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 : : == (static_cast< const CntUnencodedStringItem * >(&rItem))->
46 : 523841 : 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 [ # # # ]: 0 : switch (m_aValue.CompareTo(static_cast< CntUnencodedStringItem const * >(
58 : : &rWith)->
59 : 0 : m_aValue))
60 : : {
61 : : case COMPARE_LESS:
62 : 0 : return -1;
63 : :
64 : : case COMPARE_EQUAL:
65 : 0 : return 0;
66 : :
67 : : default: // COMPARE_GREATER
68 : 0 : return 1;
69 : : }
70 : : }
71 : :
72 : : //============================================================================
73 : : // virtual
74 : 0 : int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith,
75 : : IntlWrapper const & rIntlWrapper)
76 : : const
77 : : {
78 : : DBG_CHKTHIS(CntUnencodedStringItem, 0);
79 : : DBG_ASSERT(rWith.ISA(CntUnencodedStringItem),
80 : : "CntUnencodedStringItem::Compare(): Bad type");
81 : : return rIntlWrapper.getCollator()->compareString( m_aValue,
82 [ # # ][ # # ]: 0 : static_cast< CntUnencodedStringItem const * >(&rWith)->m_aValue );
[ # # ]
83 : : }
84 : :
85 : : //============================================================================
86 : : // virtual
87 : : SfxItemPresentation
88 : 0 : CntUnencodedStringItem::GetPresentation(SfxItemPresentation, SfxMapUnit,
89 : : SfxMapUnit, XubString & rText,
90 : : const IntlWrapper *) const
91 : : {
92 : : DBG_CHKTHIS(CntUnencodedStringItem, 0);
93 : 0 : rText = m_aValue;
94 : 0 : return SFX_ITEM_PRESENTATION_NAMELESS;
95 : : }
96 : :
97 : : //============================================================================
98 : : // virtual
99 : 35491 : bool CntUnencodedStringItem::QueryValue(com::sun::star::uno::Any& rVal, sal_uInt8)
100 : : const
101 : : {
102 [ + - ]: 35491 : rVal <<= rtl::OUString(m_aValue);
103 : 35491 : return true;
104 : : }
105 : :
106 : : //============================================================================
107 : : // virtual
108 : 11768 : bool CntUnencodedStringItem::PutValue(const com::sun::star::uno::Any& rVal,
109 : : sal_uInt8)
110 : : {
111 : 11768 : rtl::OUString aTheValue;
112 [ + - ]: 11768 : if (rVal >>= aTheValue)
113 : : {
114 [ + - ][ + - ]: 11768 : m_aValue = UniString(aTheValue);
[ + - ]
115 : 11768 : return true;
116 : : }
117 : : OSL_FAIL("CntUnencodedStringItem::PutValue(): Wrong type");
118 : 11768 : return false;
119 : : }
120 : :
121 : : //============================================================================
122 : : // virtual
123 : 0 : SfxPoolItem * CntUnencodedStringItem::Clone(SfxItemPool *) const
124 : : {
125 : : DBG_CHKTHIS(CntUnencodedStringItem, 0);
126 [ # # ]: 0 : return new CntUnencodedStringItem(*this);
127 : : }
128 : :
129 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|