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 :
21 : #include <svl/flagitem.hxx>
22 : #include <svl/poolitem.hxx>
23 : #include <tools/stream.hxx>
24 :
25 : sal_uInt16 nSfxFlagVal[16] =
26 : {
27 : 0x0001, 0x0002, 0x0004, 0x0008,
28 : 0x0010, 0x0020, 0x0040, 0x0080,
29 : 0x0100, 0x0200, 0x0400, 0x0800,
30 : 0x1000, 0x2000, 0x4000, 0x8000
31 : };
32 :
33 :
34 :
35 :
36 0 : TYPEINIT1(SfxFlagItem, SfxPoolItem);
37 :
38 :
39 :
40 0 : SfxFlagItem::SfxFlagItem( sal_uInt16 nW, sal_uInt16 nV ) :
41 : SfxPoolItem( nW ),
42 0 : nVal(nV)
43 : {
44 0 : }
45 :
46 :
47 :
48 0 : SfxFlagItem::SfxFlagItem( const SfxFlagItem& rItem ) :
49 : SfxPoolItem( rItem ),
50 0 : nVal( rItem.nVal )
51 : {
52 0 : }
53 :
54 :
55 :
56 0 : SvStream& SfxFlagItem::Store(SvStream &rStream, sal_uInt16) const
57 : {
58 0 : rStream.WriteUInt16( nVal );
59 0 : return rStream;
60 : }
61 :
62 :
63 :
64 0 : SfxItemPresentation SfxFlagItem::GetPresentation
65 : (
66 : SfxItemPresentation /*ePresentation*/,
67 : SfxMapUnit /*eCoreMetric*/,
68 : SfxMapUnit /*ePresentationMetric*/,
69 : OUString& rText,
70 : const IntlWrapper *
71 : ) const
72 : {
73 0 : rText = OUString();
74 0 : for ( sal_uInt8 nFlag = 0; nFlag < GetFlagCount(); ++nFlag )
75 0 : rText += GetFlag(nFlag) ? OUString("true") : OUString("false");
76 0 : return SFX_ITEM_PRESENTATION_NAMELESS;
77 : }
78 :
79 :
80 :
81 0 : sal_uInt8 SfxFlagItem::GetFlagCount() const
82 : {
83 : DBG_WARNING( "calling GetValueText(sal_uInt16) on SfxFlagItem -- overload!" );
84 0 : return 0;
85 : }
86 :
87 :
88 :
89 0 : SfxPoolItem* SfxFlagItem::Create(SvStream &, sal_uInt16) const
90 : {
91 : DBG_WARNING( "calling Create() on SfxFlagItem -- overload!" );
92 0 : return 0;
93 : }
94 :
95 :
96 :
97 0 : bool SfxFlagItem::operator==( const SfxPoolItem& rItem ) const
98 : {
99 : DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
100 0 : return (((SfxFlagItem&)rItem).nVal == nVal);
101 : }
102 :
103 :
104 :
105 :
106 0 : SfxPoolItem* SfxFlagItem::Clone(SfxItemPool *) const
107 : {
108 0 : return new SfxFlagItem( *this );
109 : }
110 :
111 :
112 :
113 :
114 :
115 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|