1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 // INCLUDE ---------------------------------------------------------------
32 #include "sfx2/tplpitem.hxx"
33 #include <com/sun/star/frame/status/Template.hpp>
36 // STATIC DATA -----------------------------------------------------------
38 TYPEINIT1_AUTOFACTORY(SfxTemplateItem
, SfxFlagItem
);
40 //=========================================================================
42 SfxTemplateItem::SfxTemplateItem() :
47 SfxTemplateItem::SfxTemplateItem
49 sal_uInt16 nWhichId
, // Slot-ID
50 const String
& rStyle
, // Name of the current Styles
51 sal_uInt16 nValue
// Flags for the filters of the automatic display
52 ) : SfxFlagItem( nWhichId
, nValue
),
57 //-------------------------------------------------------------------------
60 SfxTemplateItem::SfxTemplateItem( const SfxTemplateItem
& rCopy
) :
64 aStyle( rCopy
.aStyle
)
68 //-------------------------------------------------------------------------
72 int SfxTemplateItem::operator==( const SfxPoolItem
& rCmp
) const
74 return ( SfxFlagItem::operator==( rCmp
) &&
75 aStyle
== ( (const SfxTemplateItem
&)rCmp
).aStyle
);
78 //-------------------------------------------------------------------------
80 SfxPoolItem
* SfxTemplateItem::Clone( SfxItemPool
*) const
82 return new SfxTemplateItem(*this);
85 //-------------------------------------------------------------------------
86 bool SfxTemplateItem::QueryValue( com::sun::star::uno::Any
& rVal
, sal_uInt8
/*nMemberId*/ ) const
88 ::com::sun::star::frame::status::Template aTemplate
;
90 aTemplate
.Value
= GetValue();
91 aTemplate
.StyleName
= aStyle
;
97 //-------------------------------------------------------------------------
98 bool SfxTemplateItem::PutValue( const com::sun::star::uno::Any
& rVal
, sal_uInt8
/*nMemberId*/ )
100 ::com::sun::star::frame::status::Template aTemplate
;
102 if ( rVal
>>= aTemplate
)
104 SetValue( sal::static_int_cast
< sal_uInt16
>( aTemplate
.Value
) );
105 aStyle
= aTemplate
.StyleName
;
112 //-------------------------------------------------------------------------
114 sal_uInt8
SfxTemplateItem::GetFlagCount() const
116 return sizeof(sal_uInt16
) * 8;
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */