Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sd/source/ui/unoidl/SdUnoOutlineView.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 <SdUnoOutlineView.hxx>
21
22
#include <DrawController.hxx>
23
#include <OutlineViewShell.hxx>
24
#include <sdpage.hxx>
25
26
#include <cppuhelper/supportsservice.hxx>
27
#include <svx/unopage.hxx>
28
29
using namespace ::cppu;
30
using namespace ::com::sun::star;
31
using namespace ::com::sun::star::uno;
32
33
namespace sd {
34
35
SdUnoOutlineView::SdUnoOutlineView(
36
    OutlineViewShell& rViewShell) noexcept
37
0
    :   mrOutlineViewShell(rViewShell)
38
0
{
39
0
}
Unexecuted instantiation: sd::SdUnoOutlineView::SdUnoOutlineView(sd::OutlineViewShell&)
Unexecuted instantiation: sd::SdUnoOutlineView::SdUnoOutlineView(sd::OutlineViewShell&)
40
41
SdUnoOutlineView::~SdUnoOutlineView() noexcept
42
0
{
43
0
}
44
45
//----- XSelectionSupplier ----------------------------------------------------
46
47
sal_Bool SAL_CALL SdUnoOutlineView::select( const Any&  )
48
0
{
49
    // todo: add selections for text ranges
50
0
    return false;
51
0
}
52
53
Any SAL_CALL SdUnoOutlineView::getSelection()
54
0
{
55
0
    Any aAny;
56
0
    return aAny;
57
0
}
58
59
void SAL_CALL SdUnoOutlineView::addSelectionChangeListener (
60
    const css::uno::Reference<css::view::XSelectionChangeListener>&)
61
0
{}
62
63
void SAL_CALL SdUnoOutlineView::removeSelectionChangeListener (
64
    const css::uno::Reference<css::view::XSelectionChangeListener>&)
65
0
{}
66
67
//----- XDrawView -------------------------------------------------------------
68
void SAL_CALL SdUnoOutlineView::setCurrentPage (
69
    const Reference< drawing::XDrawPage >& xPage)
70
0
{
71
0
    SvxDrawPage* pDrawPage = comphelper::getFromUnoTunnel<SvxDrawPage>( xPage );
72
0
    SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : nullptr;
73
0
    SdPage *pSdPage = dynamic_cast<SdPage*>(pSdrPage);
74
75
0
    if (pSdPage != nullptr)
76
0
        mrOutlineViewShell.SetCurrentPage(pSdPage);
77
0
}
78
79
Reference< drawing::XDrawPage > SAL_CALL SdUnoOutlineView::getCurrentPage()
80
0
{
81
0
    Reference<drawing::XDrawPage>  xPage;
82
83
0
    SdPage* pPage = mrOutlineViewShell.getCurrentPage();
84
0
    if (pPage != nullptr)
85
0
        xPage.set(pPage->getUnoPage(), UNO_QUERY);
86
87
0
    return xPage;
88
0
}
89
90
void SdUnoOutlineView::setFastPropertyValue (
91
    sal_Int32 nHandle,
92
        const Any& rValue)
93
0
{
94
0
    switch( nHandle )
95
0
    {
96
0
        case DrawController::PROPERTY_CURRENTPAGE:
97
0
        {
98
0
            Reference< drawing::XDrawPage > xPage;
99
0
            rValue >>= xPage;
100
0
            setCurrentPage( xPage );
101
0
        }
102
0
        break;
103
104
0
        default:
105
0
            throw beans::UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this));
106
0
    }
107
0
}
108
109
Any SAL_CALL SdUnoOutlineView::getFastPropertyValue (
110
    sal_Int32 nHandle)
111
0
{
112
0
    Any aValue;
113
114
0
    switch( nHandle )
115
0
    {
116
0
        case DrawController::PROPERTY_CURRENTPAGE:
117
0
        {
118
0
            SdPage* pPage = mrOutlineViewShell.GetActualPage();
119
0
            if (pPage != nullptr)
120
0
                aValue <<= pPage->getUnoPage();
121
0
        }
122
0
        break;
123
0
        case DrawController::PROPERTY_VIEWOFFSET:
124
0
            break;
125
126
0
        default:
127
0
            throw beans::UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this));
128
0
    }
129
130
0
    return aValue;
131
0
}
132
133
// XServiceInfo
134
OUString SAL_CALL SdUnoOutlineView::getImplementationName(  )
135
0
{
136
0
    return u"com.sun.star.comp.sd.SdUnoOutlineView"_ustr;
137
0
}
138
139
sal_Bool SAL_CALL SdUnoOutlineView::supportsService( const OUString& ServiceName )
140
0
{
141
0
    return cppu::supportsService( this, ServiceName );
142
0
}
143
144
Sequence< OUString > SAL_CALL SdUnoOutlineView::getSupportedServiceNames(  )
145
0
{
146
0
    return { u"com.sun.star.presentation.OutlineView"_ustr };
147
0
}
148
149
} // end of namespace sd
150
151
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */