1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
):
35 DBG_CTOR(SfxVisibilityItem
, 0);
38 m_nValue
.bVisible
= bValue
;
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
))->
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;
59 SfxItemPresentation
SfxVisibilityItem::GetPresentation(SfxItemPresentation
,
60 SfxMapUnit
, SfxMapUnit
,
62 const IntlWrapper
*) const
64 rText
= GetValueTextByVal(m_nValue
.bVisible
);
65 return SFX_ITEM_PRESENTATION_NAMELESS
;
70 bool SfxVisibilityItem::QueryValue(com::sun::star::uno::Any
& rVal
, sal_uInt8
) const
77 bool SfxVisibilityItem::PutValue(const com::sun::star::uno::Any
& rVal
, sal_uInt8
)
79 if (rVal
>>= m_nValue
)
82 OSL_FAIL( "SfxInt16Item::PutValue - Wrong type!" );
87 SfxPoolItem
* SfxVisibilityItem::Create(SvStream
& rStream
, sal_uInt16
) const
89 DBG_CHKTHIS(SfxVisibilityItem
, 0);
90 return new SfxVisibilityItem(Which(), rStream
);
94 SvStream
& SfxVisibilityItem::Store(SvStream
& rStream
, sal_uInt16
) const
96 DBG_CHKTHIS(SfxVisibilityItem
, 0);
97 rStream
<< m_nValue
.bVisible
;
102 SfxPoolItem
* SfxVisibilityItem::Clone(SfxItemPool
*) const
104 DBG_CHKTHIS(SfxVisibilityItem
, 0);
105 return new SfxVisibilityItem(*this);
109 sal_uInt16
SfxVisibilityItem::GetValueCount() const
115 OUString
SfxVisibilityItem::GetValueTextByVal(sal_Bool bTheValue
) const
117 return bTheValue
? OUString("TRUE") : OUString("FALSE");
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */