1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 
31 #include "PresentationViewShellBase.hxx"
32 #include "sdresid.hxx"
33 #include "DrawDocShell.hxx"
34 #include "strings.hrc"
35 #include "UpdateLockManager.hxx"
36 #include "framework/FrameworkHelper.hxx"
37 #include "framework/PresentationModule.hxx"
38 
39 #include <sfx2/viewfrm.hxx>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/frame/XLayoutManager.hpp>
42 
43 using namespace ::com::sun::star;
44 using namespace ::com::sun::star::uno;
45 
46 namespace sd {
47 
48 class DrawDocShell;
49 
50 TYPEINIT1(PresentationViewShellBase, ViewShellBase);
51 
52 // We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
53 // new PresentationViewShellBase object has been constructed.
54 
55 SfxViewFactory* PresentationViewShellBase::pFactory;
56 SfxViewShell* __EXPORT PresentationViewShellBase::CreateInstance (
57     SfxViewFrame *_pFrame, SfxViewShell *pOldView)
58 {
59     PresentationViewShellBase* pBase =
60         new PresentationViewShellBase(_pFrame, pOldView);
61     pBase->LateInit(framework::FrameworkHelper::msPresentationViewURL);
62     return pBase;
63 }
64 void PresentationViewShellBase::RegisterFactory( sal_uInt16 nPrio )
65 {
66     pFactory = new SfxViewFactory(
67         &CreateInstance,&InitFactory,nPrio,"FullScreenPresentation");
68     InitFactory();
69 }
70 void PresentationViewShellBase::InitFactory()
71 {
72 	SFX_VIEW_REGISTRATION(DrawDocShell);
73 }
74 
75 
76 
77 
78 PresentationViewShellBase::PresentationViewShellBase (
79     SfxViewFrame* _pFrame,
80     SfxViewShell* pOldShell)
81     : ViewShellBase (_pFrame, pOldShell)
82 {
83     GetUpdateLockManager()->Disable();
84 
85     // Hide the automatic (non-context sensitive) tool bars.
86     if (_pFrame!=NULL)
87     {
88         Reference<beans::XPropertySet> xFrameSet (
89             _pFrame->GetFrame().GetFrameInterface(),
90             UNO_QUERY);
91         if (xFrameSet.is())
92         {
93             Reference<beans::XPropertySet> xLayouterSet (
94                 xFrameSet->getPropertyValue(::rtl::OUString::createFromAscii("LayoutManager")),
95                 UNO_QUERY);
96             if (xLayouterSet.is())
97             {
98                 xLayouterSet->setPropertyValue(
99                     ::rtl::OUString::createFromAscii("AutomaticToolbars"),
100                     makeAny(sal_False));
101             }
102         }
103     }
104 }
105 
106 
107 
108 
109 PresentationViewShellBase::~PresentationViewShellBase (void)
110 {
111 }
112 
113 
114 
115 void PresentationViewShellBase::InitializeFramework (void)
116 {
117     com::sun::star::uno::Reference<com::sun::star::frame::XController>
118         xController (GetController());
119     sd::framework::PresentationModule::Initialize(xController);
120 }
121 
122 } // end of namespace sd
123 
124