Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sfx2/source/dialog/tplpitem.cxx
Line
Count
Source
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
24
0
SfxPoolItem* SfxTemplateItem::CreateDefault() { return new SfxTemplateItem; }
25
26
27
SfxTemplateItem::SfxTemplateItem()
28
0
{
29
0
}
30
31
SfxTemplateItem::SfxTemplateItem
32
(
33
    sal_uInt16 nWhichId,      // Slot-ID
34
    OUString _aStyle,    // Name of the current Styles
35
    OUString _aStyleIdentifier     // Prog Name of current Style
36
0
) : SfxFlagItem( nWhichId, static_cast<sal_uInt16>(SfxStyleSearchBits::All) ),
37
0
    aStyle(std::move( _aStyle )),
38
0
    aStyleIdentifier(std::move( _aStyleIdentifier ))
39
0
{
40
0
}
41
42
// op ==
43
44
bool SfxTemplateItem::operator==( const SfxPoolItem& rCmp ) const
45
0
{
46
0
    return ( SfxFlagItem::operator==( rCmp ) &&
47
0
             aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle &&
48
0
             aStyleIdentifier == static_cast<const SfxTemplateItem&>(rCmp).aStyleIdentifier );
49
0
}
50
51
SfxTemplateItem* SfxTemplateItem::Clone( SfxItemPool *) const
52
0
{
53
0
    return new SfxTemplateItem(*this);
54
0
}
55
56
bool SfxTemplateItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
57
0
{
58
0
    css::frame::status::Template aTemplate;
59
60
0
    aTemplate.Value = static_cast<sal_uInt16>(GetValue());
61
0
    aTemplate.StyleName = aStyle;
62
0
    aTemplate.StyleNameIdentifier = aStyleIdentifier;
63
0
    rVal <<= aTemplate;
64
65
0
    return true;
66
0
}
67
68
69
bool SfxTemplateItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
70
0
{
71
0
    css::frame::status::Template aTemplate;
72
73
0
    if ( rVal >>= aTemplate )
74
0
    {
75
0
        SetValue( static_cast<SfxStyleSearchBits>(aTemplate.Value) );
76
0
        aStyle = aTemplate.StyleName;
77
0
        aStyleIdentifier = aTemplate.StyleNameIdentifier;
78
0
        return true;
79
0
    }
80
81
0
    return false;
82
0
}
83
84
85
sal_uInt8 SfxTemplateItem::GetFlagCount() const
86
0
{
87
0
    return sizeof(sal_uInt16) * 8;
88
0
}
89
90
91
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */