GPU-Calc: remove Alloc_Host_Ptr for clmem of NAN vector
[LibreOffice.git] / svl / source / items / visitem.cxx
blob140a8b22a5e5c91b87360c266109bd8a9562cce7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svl/visitem.hxx>
21 #include <com/sun/star/uno/Any.hxx>
22 #include <tools/stream.hxx>
25 // class SfxVisibilityItem
28 DBG_NAME(SfxVisibilityItem)
30 TYPEINIT1_AUTOFACTORY(SfxVisibilityItem, SfxPoolItem);
32 SfxVisibilityItem::SfxVisibilityItem(sal_uInt16 which, SvStream & rStream):
33 SfxPoolItem(which)
35 DBG_CTOR(SfxVisibilityItem, 0);
36 sal_Bool bValue = 0;
37 rStream >> bValue;
38 m_nValue.bVisible = bValue;
41 // virtual
42 int SfxVisibilityItem::operator ==(const SfxPoolItem & rItem) const
44 DBG_CHKTHIS(SfxVisibilityItem, 0);
45 DBG_ASSERT(SfxPoolItem::operator ==(rItem), "unequal type");
46 return m_nValue.bVisible == (static_cast< const SfxVisibilityItem * >(&rItem))->
47 m_nValue.bVisible;
50 // virtual
51 int SfxVisibilityItem::Compare(const SfxPoolItem & rWith) const
53 DBG_ASSERT(rWith.ISA(SfxVisibilityItem), "SfxVisibilityItem::Compare(): Bad type");
54 return m_nValue.bVisible == static_cast< SfxVisibilityItem const * >(&rWith)->m_nValue.bVisible ?
55 0 : m_nValue.bVisible ? -1 : 1;
58 // virtual
59 SfxItemPresentation SfxVisibilityItem::GetPresentation(SfxItemPresentation,
60 SfxMapUnit, SfxMapUnit,
61 OUString & rText,
62 const IntlWrapper *) const
64 rText = GetValueTextByVal(m_nValue.bVisible);
65 return SFX_ITEM_PRESENTATION_NAMELESS;
69 // virtual
70 bool SfxVisibilityItem::QueryValue(com::sun::star::uno::Any& rVal, sal_uInt8) const
72 rVal <<= m_nValue;
73 return true;
76 // virtual
77 bool SfxVisibilityItem::PutValue(const com::sun::star::uno::Any& rVal, sal_uInt8)
79 if (rVal >>= m_nValue)
80 return true;
82 OSL_FAIL( "SfxInt16Item::PutValue - Wrong type!" );
83 return false;
86 // virtual
87 SfxPoolItem * SfxVisibilityItem::Create(SvStream & rStream, sal_uInt16) const
89 DBG_CHKTHIS(SfxVisibilityItem, 0);
90 return new SfxVisibilityItem(Which(), rStream);
93 // virtual
94 SvStream & SfxVisibilityItem::Store(SvStream & rStream, sal_uInt16) const
96 DBG_CHKTHIS(SfxVisibilityItem, 0);
97 rStream << m_nValue.bVisible;
98 return rStream;
101 // virtual
102 SfxPoolItem * SfxVisibilityItem::Clone(SfxItemPool *) const
104 DBG_CHKTHIS(SfxVisibilityItem, 0);
105 return new SfxVisibilityItem(*this);
108 // virtual
109 sal_uInt16 SfxVisibilityItem::GetValueCount() const
111 return 2;
114 // virtual
115 OUString SfxVisibilityItem::GetValueTextByVal(sal_Bool bTheValue) const
117 return bTheValue ? OUString("TRUE") : OUString("FALSE");
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */