Coverage Report

Created: 2026-11-06 11:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sd/source/ui/view/ImpressViewShellBase.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 <ImpressViewShellBase.hxx>
21
22
#include <DrawDocShell.hxx>
23
#include <DrawController.hxx>
24
#include <app.hrc>
25
#include <framework/FrameworkHelper.hxx>
26
#include <framework/ImpressModule.hxx>
27
#include <MasterPageObserver.hxx>
28
#include <sfx2/request.hxx>
29
#include <sfx2/viewfac.hxx>
30
#include <sfx2/viewfrm.hxx>
31
#include <sfx2/viewsh.hxx>
32
#include <comphelper/lok.hxx>
33
34
namespace sd {
35
36
37
// We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
38
// new ImpressViewShellBase object has been constructed.
39
40
std::map<SfxInterfaceId, std::unique_ptr<SfxViewFactory>> ImpressViewShellBase::s_pFactories;
41
SfxViewShell* ImpressViewShellBase::CreateInstance (
42
    SfxViewFrame& rFrame, SfxViewShell *pOldView)
43
0
{
44
0
    ImpressViewShellBase* pBase = new ImpressViewShellBase(rFrame, pOldView);
45
0
    pBase->LateInit(comphelper::LibreOfficeKit::isActive() ? framework::FrameworkHelper::msImpressViewURL : u""_ustr);
46
0
    return pBase;
47
0
}
48
void ImpressViewShellBase::RegisterFactory( SfxInterfaceId nPrio )
49
5
{
50
5
    assert(s_pFactories.find(nPrio) == s_pFactories.end());
51
5
    s_pFactories[nPrio] = std::make_unique<SfxViewFactory>(&CreateInstance,nPrio,"Default");
52
5
    DrawDocShell::Factory().RegisterViewFactory( *s_pFactories[nPrio] );
53
5
}
54
55
ImpressViewShellBase::ImpressViewShellBase (
56
    SfxViewFrame& _rFrame,
57
    SfxViewShell* pOldShell)
58
0
    : ViewShellBase (_rFrame, pOldShell)
59
0
{
60
0
    MasterPageObserver::Instance().RegisterDocument (*GetDocShell()->GetDoc());
61
0
}
62
63
ImpressViewShellBase::~ImpressViewShellBase()
64
0
{
65
0
    MasterPageObserver::Instance().UnregisterDocument (*GetDocShell()->GetDoc());
66
0
}
67
68
void ImpressViewShellBase::Execute (SfxRequest& rRequest)
69
0
{
70
0
    sal_uInt16 nSlotId = rRequest.GetSlot();
71
72
0
    switch (nSlotId)
73
0
    {
74
0
        case SID_LEFT_PANE_DRAW:
75
            // Prevent a Draw-only slots from being executed.
76
0
            rRequest.Cancel();
77
0
            break;
78
79
0
        default:
80
            // The remaining requests are forwarded to our base class.
81
0
            ViewShellBase::Execute(rRequest);
82
0
            break;
83
0
    }
84
0
}
85
86
void ImpressViewShellBase::InitializeFramework()
87
0
{
88
0
    rtl::Reference<sd::DrawController> xController(GetDrawController());
89
0
    sd::framework::ImpressModule::Initialize(xController);
90
0
}
91
92
} // end of namespace sd
93
94
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */