cid#1607171 Data race condition
[LibreOffice.git] / sd / source / ui / view / GraphicViewShellBase.cxx
blob72df33e98f2e7854034afbedfe0ba48227cac4f0
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 <GraphicViewShellBase.hxx>
22 #include <GraphicDocShell.hxx>
23 #include <DrawController.hxx>
24 #include <app.hrc>
25 #include <framework/DrawModule.hxx>
26 #include <framework/FrameworkHelper.hxx>
27 #include <sfx2/request.hxx>
28 #include <sfx2/viewfac.hxx>
29 #include <sfx2/viewfrm.hxx>
30 #include <sfx2/viewsh.hxx>
32 namespace sd
34 // We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
35 // new GraphicViewShellBase object has been constructed.
37 SfxViewFactory* GraphicViewShellBase::s_pFactory;
38 SfxViewShell* GraphicViewShellBase::CreateInstance(SfxViewFrame& rFrame, SfxViewShell* pOldView)
40 GraphicViewShellBase* pBase = new GraphicViewShellBase(rFrame, pOldView);
41 pBase->LateInit(framework::FrameworkHelper::msDrawViewURL);
42 return pBase;
44 void GraphicViewShellBase::RegisterFactory(SfxInterfaceId nPrio)
46 s_pFactory = new SfxViewFactory(&CreateInstance, nPrio, "Default");
47 InitFactory();
49 void GraphicViewShellBase::InitFactory() { SFX_VIEW_REGISTRATION(GraphicDocShell); }
51 GraphicViewShellBase::GraphicViewShellBase(SfxViewFrame& _rFrame, SfxViewShell* pOldShell)
52 : ViewShellBase(_rFrame, pOldShell)
56 GraphicViewShellBase::~GraphicViewShellBase() {}
58 void GraphicViewShellBase::Execute(SfxRequest& rRequest)
60 sal_uInt16 nSlotId = rRequest.GetSlot();
62 switch (nSlotId)
64 case SID_BOTTOM_PANE_IMPRESS:
65 case SID_SLIDE_SORTER_MULTI_PANE_GUI:
66 case SID_SLIDE_SORTER_MODE:
67 case SID_SLIDE_MASTER_MODE:
68 case SID_OUTLINE_MODE:
69 case SID_NOTES_MODE:
70 case SID_NOTES_MASTER_MODE:
71 case SID_HANDOUT_MASTER_MODE:
72 // Prevent some Impress-only slots from being executed.
73 rRequest.Cancel();
74 break;
76 case SID_SWITCH_SHELL:
77 case SID_LEFT_PANE_DRAW:
78 case SID_LEFT_PANE_IMPRESS:
79 default:
80 // The remaining requests are forwarded to our base class.
81 ViewShellBase::Execute(rRequest);
82 break;
86 void GraphicViewShellBase::InitializeFramework()
88 rtl::Reference<sd::DrawController> xController(GetDrawController());
89 sd::framework::DrawModule::Initialize(xController);
92 } // end of namespace sd
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */