Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sfx2/source/doc/objitem.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
21
#include <sfx2/objsh.hxx>
22
#include <sfx2/objitem.hxx>
23
#include <com/sun/star/frame/XModel.hpp>
24
#include <com/sun/star/frame/XModel3.hpp>
25
26
27
0
SfxPoolItem* SfxObjectShellItem::CreateDefault() { return new SfxObjectShellItem; }
28
29
0
SfxPoolItem* SfxObjectItem::CreateDefault() { return new SfxObjectItem; }
30
31
bool SfxObjectShellItem::operator==( const SfxPoolItem &rItem ) const
32
0
{
33
0
     return SfxPoolItem::operator==(rItem) &&
34
0
        static_cast<const SfxObjectShellItem&>(rItem).pObjSh == pObjSh;
35
0
}
36
37
SfxObjectShellItem* SfxObjectShellItem::Clone( SfxItemPool *) const
38
0
{
39
0
    return new SfxObjectShellItem( *this );
40
0
}
41
42
bool SfxObjectShellItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
43
0
{
44
0
    if ( pObjSh )
45
0
    {
46
        // This item MUST provide a model. Please don't change this, there are UNO-based
47
        // implementations which need it!!
48
0
        rVal <<= pObjSh->GetModel();
49
0
    }
50
0
    else
51
0
    {
52
0
        rVal <<= css::uno::Reference< css::frame::XModel >();
53
0
    }
54
0
    return true;
55
0
}
56
57
bool SfxObjectShellItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
58
0
{
59
    // This item MUST have a model. Please don't change this, there are UNO-based
60
    // implementations which need it!!
61
0
    css::uno::Reference< css::frame::XModel > xModel;
62
63
0
    if ( rVal >>= xModel )
64
0
    {
65
0
        pObjSh = SfxObjectShell::GetShellFromComponent(xModel);
66
0
        return true;
67
0
    }
68
69
0
    return true;
70
0
}
71
72
SfxObjectItem::SfxObjectItem( sal_uInt16 nWhichId, SfxShell *pSh )
73
0
:   SfxPoolItem( nWhichId ),
74
0
    _pSh( pSh )
75
0
{}
76
77
bool SfxObjectItem::operator==( const SfxPoolItem &rItem ) const
78
0
{
79
0
     return SfxPoolItem::operator==(rItem) &&
80
0
        static_cast<const SfxObjectItem&>(rItem)._pSh == _pSh;
81
0
}
82
83
SfxObjectItem* SfxObjectItem::Clone( SfxItemPool *) const
84
0
{
85
0
    return new SfxObjectItem( *this );
86
0
}
87
88
bool SfxObjectItem::QueryValue(css::uno::Any&, sal_uInt8) const
89
0
{
90
0
    return false;
91
0
}
92
93
bool SfxObjectItem::PutValue(const css::uno::Any&, sal_uInt8)
94
0
{
95
0
  return false;
96
0
}
97
98
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */