cid#1607171 Data race condition
[LibreOffice.git] / sd / source / ui / view / ImpressViewShellBase.cxx
blob17baf9ccf50710a6b563038ac2e2f355fc3576af
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <ImpressViewShellBase.hxx>
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>
34 namespace sd {
37 // We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
38 // new ImpressViewShellBase object has been constructed.
40 SfxViewFactory* ImpressViewShellBase::s_pFactory;
41 SfxViewShell* ImpressViewShellBase::CreateInstance (
42 SfxViewFrame& rFrame, SfxViewShell *pOldView)
44 ImpressViewShellBase* pBase = new ImpressViewShellBase(rFrame, pOldView);
45 pBase->LateInit(comphelper::LibreOfficeKit::isActive() ? framework::FrameworkHelper::msImpressViewURL : u""_ustr);
46 return pBase;
48 void ImpressViewShellBase::RegisterFactory( SfxInterfaceId nPrio )
50 s_pFactory = new SfxViewFactory(&CreateInstance,nPrio,"Default");
51 InitFactory();
53 void ImpressViewShellBase::InitFactory()
55 SFX_VIEW_REGISTRATION(DrawDocShell);
58 ImpressViewShellBase::ImpressViewShellBase (
59 SfxViewFrame& _rFrame,
60 SfxViewShell* pOldShell)
61 : ViewShellBase (_rFrame, pOldShell)
63 MasterPageObserver::Instance().RegisterDocument (*GetDocShell()->GetDoc());
66 ImpressViewShellBase::~ImpressViewShellBase()
68 MasterPageObserver::Instance().UnregisterDocument (*GetDocShell()->GetDoc());
71 void ImpressViewShellBase::Execute (SfxRequest& rRequest)
73 sal_uInt16 nSlotId = rRequest.GetSlot();
75 switch (nSlotId)
77 case SID_LEFT_PANE_DRAW:
78 // Prevent a Draw-only slots from being executed.
79 rRequest.Cancel();
80 break;
82 default:
83 // The remaining requests are forwarded to our base class.
84 ViewShellBase::Execute(rRequest);
85 break;
89 void ImpressViewShellBase::InitializeFramework()
91 rtl::Reference<sd::DrawController> xController(GetDrawController());
92 sd::framework::ImpressModule::Initialize(xController);
95 } // end of namespace sd
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */