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 .
21 #include <svl/flagitem.hxx>
22 #include <svl/poolitem.hxx>
23 #include <tools/stream.hxx>
25 // STATIC DATA -----------------------------------------------------------
29 sal_uInt16 nSfxFlagVal
[16] =
31 0x0001, 0x0002, 0x0004, 0x0008,
32 0x0010, 0x0020, 0x0040, 0x0080,
33 0x0100, 0x0200, 0x0400, 0x0800,
34 0x1000, 0x2000, 0x4000, 0x8000
38 // -----------------------------------------------------------------------
40 TYPEINIT1(SfxFlagItem
, SfxPoolItem
);
42 // -----------------------------------------------------------------------
44 SfxFlagItem::SfxFlagItem( sal_uInt16 nW
, sal_uInt16 nV
) :
48 DBG_CTOR(SfxFlagItem
, 0);
51 // -----------------------------------------------------------------------
53 SfxFlagItem::SfxFlagItem( const SfxFlagItem
& rItem
) :
57 DBG_CTOR(SfxFlagItem
, 0);
60 // -----------------------------------------------------------------------
62 SvStream
& SfxFlagItem::Store(SvStream
&rStream
, sal_uInt16
) const
64 DBG_CHKTHIS(SfxFlagItem
, 0);
69 // -----------------------------------------------------------------------
71 SfxItemPresentation
SfxFlagItem::GetPresentation
73 SfxItemPresentation
/*ePresentation*/,
74 SfxMapUnit
/*eCoreMetric*/,
75 SfxMapUnit
/*ePresentationMetric*/,
80 DBG_CHKTHIS(SfxFlagItem
, 0);
82 for ( sal_uInt8 nFlag
= 0; nFlag
< GetFlagCount(); ++nFlag
)
83 rText
+= GetFlag(nFlag
) ? OUString("true") : OUString("false");
84 return SFX_ITEM_PRESENTATION_NAMELESS
;
87 // -----------------------------------------------------------------------
89 sal_uInt8
SfxFlagItem::GetFlagCount() const
91 DBG_CHKTHIS(SfxFlagItem
, 0);
92 DBG_WARNING( "calling GetValueText(sal_uInt16) on SfxFlagItem -- overload!" );
96 // -----------------------------------------------------------------------
98 SfxPoolItem
* SfxFlagItem::Create(SvStream
&, sal_uInt16
) const
100 DBG_CHKTHIS(SfxFlagItem
, 0);
101 DBG_WARNING( "calling Create() on SfxFlagItem -- overload!" );
105 // -----------------------------------------------------------------------
107 int SfxFlagItem::operator==( const SfxPoolItem
& rItem
) const
109 DBG_CHKTHIS(SfxFlagItem
, 0);
110 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
111 return (((SfxFlagItem
&)rItem
).nVal
== nVal
);
114 // -----------------------------------------------------------------------
117 SfxPoolItem
* SfxFlagItem::Clone(SfxItemPool
*) const
119 DBG_CHKTHIS(SfxFlagItem
, 0);
120 return new SfxFlagItem( *this );
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */