LibreOffice Module sfx2 (master) 1
tplpitem.cxx
Go to the documentation of this file.
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#include <sfx2/tplpitem.hxx>
21#include <com/sun/star/frame/status/Template.hpp>
22#include <utility>
23
25
26
28{
29}
30
32(
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 ))
39{
40}
41
42// op ==
43
45{
46 return ( SfxFlagItem::operator==( rCmp ) &&
47 aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle &&
48 aStyleIdentifier == static_cast<const SfxTemplateItem&>(rCmp).aStyleIdentifier );
49}
50
52{
53 return new SfxTemplateItem(*this);
54}
55
56bool SfxTemplateItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
57{
58 css::frame::status::Template aTemplate;
59
60 aTemplate.Value = static_cast<sal_uInt16>(GetValue());
61 aTemplate.StyleName = aStyle;
62 aTemplate.StyleNameIdentifier = aStyleIdentifier;
63 rVal <<= aTemplate;
64
65 return true;
66}
67
68
69bool SfxTemplateItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
70{
71 css::frame::status::Template aTemplate;
72
73 if ( rVal >>= aTemplate )
74 {
75 SetValue( static_cast<SfxStyleSearchBits>(aTemplate.Value) );
76 aStyle = aTemplate.StyleName;
77 aStyleIdentifier = aTemplate.StyleNameIdentifier;
78 return true;
79 }
80
81 return false;
82}
83
84
86{
87 return sizeof(sal_uInt16) * 8;
88}
89
90
91/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SfxTemplateItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: tplpitem.cxx:51
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: tplpitem.cxx:69
virtual sal_uInt8 GetFlagCount() const override
Definition: tplpitem.cxx:85
void SetValue(SfxStyleSearchBits n)
Definition: tplpitem.hxx:48
virtual bool operator==(const SfxPoolItem &) const override
Definition: tplpitem.cxx:44
OUString aStyleIdentifier
Definition: tplpitem.hxx:31
static SfxPoolItem * CreateDefault()
Definition: tplpitem.cxx:24
OUString aStyle
Definition: tplpitem.hxx:30
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: tplpitem.cxx:56
SfxStyleSearchBits GetValue() const
Definition: tplpitem.hxx:47
SfxStyleSearchBits
unsigned char sal_uInt8