1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 #include "PresentationViewShellBase.hxx"
28 #include "sdresid.hxx"
29 #include "DrawDocShell.hxx"
30 #include "strings.hrc"
31 #include "UpdateLockManager.hxx"
32 #include "framework/FrameworkHelper.hxx"
33 #include "framework/PresentationModule.hxx"
34 
35 #include <sfx2/viewfrm.hxx>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/frame/XLayoutManager.hpp>
38 
39 using namespace ::com::sun::star;
40 using namespace ::com::sun::star::uno;
41 
42 namespace sd {
43 
44 class DrawDocShell;
45 
46 TYPEINIT1(PresentationViewShellBase, ViewShellBase);
47 
48 // We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
49 // new PresentationViewShellBase object has been constructed.
50 
51 SfxViewFactory* PresentationViewShellBase::pFactory;
52 SfxViewShell* __EXPORT PresentationViewShellBase::CreateInstance (
53     SfxViewFrame *_pFrame, SfxViewShell *pOldView)
54 {
55     PresentationViewShellBase* pBase =
56         new PresentationViewShellBase(_pFrame, pOldView);
57     pBase->LateInit(framework::FrameworkHelper::msPresentationViewURL);
58     return pBase;
59 }
60 void PresentationViewShellBase::RegisterFactory( sal_uInt16 nPrio )
61 {
62     pFactory = new SfxViewFactory(
63         &CreateInstance,&InitFactory,nPrio,"FullScreenPresentation");
64     InitFactory();
65 }
66 void PresentationViewShellBase::InitFactory()
67 {
68 	SFX_VIEW_REGISTRATION(DrawDocShell);
69 }
70 
71 
72 
73 
74 PresentationViewShellBase::PresentationViewShellBase (
75     SfxViewFrame* _pFrame,
76     SfxViewShell* pOldShell)
77     : ViewShellBase (_pFrame, pOldShell)
78 {
79     GetUpdateLockManager()->Disable();
80 
81     // Hide the automatic (non-context sensitive) tool bars.
82     if (_pFrame!=NULL)
83     {
84         Reference<beans::XPropertySet> xFrameSet (
85             _pFrame->GetFrame().GetFrameInterface(),
86             UNO_QUERY);
87         if (xFrameSet.is())
88         {
89             Reference<beans::XPropertySet> xLayouterSet (
90                 xFrameSet->getPropertyValue(::rtl::OUString::createFromAscii("LayoutManager")),
91                 UNO_QUERY);
92             if (xLayouterSet.is())
93             {
94                 xLayouterSet->setPropertyValue(
95                     ::rtl::OUString::createFromAscii("AutomaticToolbars"),
96                     makeAny(sal_False));
97             }
98         }
99     }
100 }
101 
102 
103 
104 
105 PresentationViewShellBase::~PresentationViewShellBase (void)
106 {
107 }
108 
109 
110 
111 void PresentationViewShellBase::InitializeFramework (void)
112 {
113     com::sun::star::uno::Reference<com::sun::star::frame::XController>
114         xController (GetController());
115     sd::framework::PresentationModule::Initialize(xController);
116 }
117 
118 } // end of namespace sd
119 
120