Bump version to 24.04.3.4
[LibreOffice.git] / sfx2 / source / dialog / tplpitem.cxx
bloba453323bbb80f3fa4d53ba178bff91c593b27e9b
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>
22 #include <utility>
24 SfxPoolItem* SfxTemplateItem::CreateDefault() { return new SfxTemplateItem; }
27 SfxTemplateItem::SfxTemplateItem()
31 SfxTemplateItem::SfxTemplateItem
33 sal_uInt16 nWhichId, // Slot-ID
34 OUString _aStyle, // Name of the current Styles
35 OUString _aStyleIdentifier // Prog Name of current Style
36 ) : SfxFlagItem( nWhichId, static_cast<sal_uInt16>(SfxStyleSearchBits::All) ),
37 aStyle(std::move( _aStyle )),
38 aStyleIdentifier(std::move( _aStyleIdentifier ))
42 // op ==
44 bool SfxTemplateItem::operator==( const SfxPoolItem& rCmp ) const
46 return ( SfxFlagItem::operator==( rCmp ) &&
47 aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle &&
48 aStyleIdentifier == static_cast<const SfxTemplateItem&>(rCmp).aStyleIdentifier );
51 SfxTemplateItem* SfxTemplateItem::Clone( SfxItemPool *) const
53 return new SfxTemplateItem(*this);
56 bool SfxTemplateItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
58 css::frame::status::Template aTemplate;
60 aTemplate.Value = static_cast<sal_uInt16>(GetValue());
61 aTemplate.StyleName = aStyle;
62 aTemplate.StyleNameIdentifier = aStyleIdentifier;
63 rVal <<= aTemplate;
65 return true;
69 bool SfxTemplateItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
71 css::frame::status::Template aTemplate;
73 if ( rVal >>= aTemplate )
75 SetValue( static_cast<SfxStyleSearchBits>(aTemplate.Value) );
76 aStyle = aTemplate.StyleName;
77 aStyleIdentifier = aTemplate.StyleNameIdentifier;
78 return true;
81 return false;
85 sal_uInt8 SfxTemplateItem::GetFlagCount() const
87 return sizeof(sal_uInt16) * 8;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */