bump product version to 5.0.4.1
[LibreOffice.git] / sfx2 / source / dialog / tplpitem.cxx
blobc31ac82b117b711f6d86c743cdfa977f368d9b6b
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 <sfx2/tplpitem.hxx>
21 #include <com/sun/star/frame/status/Template.hpp>
24 // STATIC DATA -----------------------------------------------------------
26 TYPEINIT1_AUTOFACTORY(SfxTemplateItem, SfxFlagItem);
30 SfxTemplateItem::SfxTemplateItem() :
31 SfxFlagItem()
35 SfxTemplateItem::SfxTemplateItem
37 sal_uInt16 nWhichId, // Slot-ID
38 const OUString& rStyle, // Name of the current Styles
39 sal_uInt16 nValue // Flags for the filters of the automatic display
40 ) : SfxFlagItem( nWhichId, nValue ),
41 aStyle( rStyle )
47 // copy constuctor
48 SfxTemplateItem::SfxTemplateItem( const SfxTemplateItem& rCopy ) :
50 SfxFlagItem( rCopy ),
52 aStyle( rCopy.aStyle )
58 // op ==
60 bool SfxTemplateItem::operator==( const SfxPoolItem& rCmp ) const
62 return ( SfxFlagItem::operator==( rCmp ) &&
63 aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle );
68 SfxPoolItem* SfxTemplateItem::Clone( SfxItemPool *) const
70 return new SfxTemplateItem(*this);
74 bool SfxTemplateItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
76 ::com::sun::star::frame::status::Template aTemplate;
78 aTemplate.Value = GetValue();
79 aTemplate.StyleName = aStyle;
80 rVal <<= aTemplate;
82 return true;
86 bool SfxTemplateItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
88 ::com::sun::star::frame::status::Template aTemplate;
90 if ( rVal >>= aTemplate )
92 SetValue( sal::static_int_cast< sal_uInt16 >( aTemplate.Value ) );
93 aStyle = aTemplate.StyleName;
94 return true;
97 return false;
102 sal_uInt8 SfxTemplateItem::GetFlagCount() const
104 return sizeof(sal_uInt16) * 8;
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */