cid#1607171 Data race condition
[LibreOffice.git] / sd / source / ui / view / PresentationViewShellBase.cxx
blobaef3d5e247d92f198f59009a99e8643ca149e92d
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 <PresentationViewShellBase.hxx>
21 #include <DrawDocShell.hxx>
22 #include <DrawController.hxx>
23 #include <framework/FrameworkHelper.hxx>
24 #include <framework/PresentationModule.hxx>
26 #include <sfx2/viewfac.hxx>
27 #include <sfx2/viewfrm.hxx>
28 #include <sfx2/viewsh.hxx>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/frame/XFrame.hpp>
32 using namespace ::com::sun::star;
33 using namespace ::com::sun::star::uno;
35 namespace sd {
37 class DrawDocShell;
40 // We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
41 // new PresentationViewShellBase object has been constructed.
43 SfxViewFactory* PresentationViewShellBase::s_pFactory;
44 SfxViewShell* PresentationViewShellBase::CreateInstance (
45 SfxViewFrame& _rFrame, SfxViewShell *pOldView)
47 PresentationViewShellBase* pBase =
48 new PresentationViewShellBase(_rFrame, pOldView);
49 pBase->LateInit(framework::FrameworkHelper::msPresentationViewURL);
50 return pBase;
52 void PresentationViewShellBase::RegisterFactory( SfxInterfaceId nPrio )
54 s_pFactory = new SfxViewFactory(
55 &CreateInstance,nPrio,"FullScreenPresentation");
56 InitFactory();
58 void PresentationViewShellBase::InitFactory()
60 SFX_VIEW_REGISTRATION(DrawDocShell);
63 PresentationViewShellBase::PresentationViewShellBase (
64 SfxViewFrame& _rFrame,
65 SfxViewShell* pOldShell)
66 : ViewShellBase (_rFrame, pOldShell)
68 // Hide the automatic (non-context sensitive) tool bars.
69 Reference<beans::XPropertySet> xFrameSet (
70 _rFrame.GetFrame().GetFrameInterface(),
71 UNO_QUERY);
72 if (xFrameSet.is())
74 Reference<beans::XPropertySet> xLayouterSet(xFrameSet->getPropertyValue(u"LayoutManager"_ustr), UNO_QUERY);
75 if (xLayouterSet.is())
77 xLayouterSet->setPropertyValue(u"AutomaticToolbars"_ustr, Any(false));
82 PresentationViewShellBase::~PresentationViewShellBase()
86 void PresentationViewShellBase::InitializeFramework()
88 rtl::Reference<sd::DrawController> xController (GetDrawController());
89 sd::framework::PresentationModule::Initialize(xController);
92 } // end of namespace sd
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */