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