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 #include "precompiled_sd.hxx"
29 
30 #include "ImpressViewShellBase.hxx"
31 
32 #include "DrawDocShell.hxx"
33 #include "sdresid.hxx"
34 #include "strings.hrc"
35 #include "app.hrc"
36 #include "framework/FrameworkHelper.hxx"
37 #include "framework/ImpressModule.hxx"
38 #include "MasterPageObserver.hxx"
39 #include <sfx2/request.hxx>
40 
41 namespace sd {
42 
43 TYPEINIT1(ImpressViewShellBase, ViewShellBase);
44 
45 // We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
46 // new ImpressViewShellBase object has been constructed.
47 
48 SfxViewFactory* ImpressViewShellBase::pFactory;
49 SfxViewShell* __EXPORT ImpressViewShellBase::CreateInstance (
50     SfxViewFrame *pFrame, SfxViewShell *pOldView)
51 {
52     ImpressViewShellBase* pBase = new ImpressViewShellBase(pFrame, pOldView);
53     pBase->LateInit(::rtl::OUString());
54     return pBase;
55 }
56 void ImpressViewShellBase::RegisterFactory( sal_uInt16 nPrio )
57 {
58     pFactory = new SfxViewFactory(
59         &CreateInstance,&InitFactory,nPrio,"Default");
60     InitFactory();
61 }
62 void ImpressViewShellBase::InitFactory()
63 {
64 	SFX_VIEW_REGISTRATION(DrawDocShell);
65 }
66 
67 
68 
69 
70 
71 
72 
73 
74 ImpressViewShellBase::ImpressViewShellBase (
75     SfxViewFrame* _pFrame,
76     SfxViewShell* pOldShell)
77     : ViewShellBase (_pFrame, pOldShell)
78 {
79     MasterPageObserver::Instance().RegisterDocument (*GetDocShell()->GetDoc());
80 }
81 
82 
83 
84 
85 ImpressViewShellBase::~ImpressViewShellBase (void)
86 {
87     MasterPageObserver::Instance().UnregisterDocument (*GetDocShell()->GetDoc());
88 }
89 
90 
91 
92 
93 void ImpressViewShellBase::Execute (SfxRequest& rRequest)
94 {
95 	sal_uInt16 nSlotId = rRequest.GetSlot();
96 
97 	switch (nSlotId)
98     {
99         case SID_LEFT_PANE_DRAW:
100             // Prevent a Draw-only slots from being executed.
101             rRequest.Cancel();
102             break;
103 
104         default:
105             // The remaining requests are forwarded to our base class.
106             ViewShellBase::Execute(rRequest);
107             break;
108     }
109 }
110 
111 
112 
113 
114 void ImpressViewShellBase::InitializeFramework (void)
115 {
116     ::com::sun::star::uno::Reference<com::sun::star::frame::XController>
117         xController (GetController());
118     sd::framework::ImpressModule::Initialize(xController);
119 }
120 
121 } // end of namespace sd
122 
123