dba33i: #i111146# migrated all SFX-based applications to use named views
[LibreOffice.git] / sd / source / ui / view / ImpressViewShellBase.cxx
blob69906fbfd5d87f9da0695ca1bcfb8ac368333c75
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #include "precompiled_sd.hxx"
30 #include "ImpressViewShellBase.hxx"
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>
41 namespace sd {
43 TYPEINIT1(ImpressViewShellBase, ViewShellBase);
45 // We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
46 // new ImpressViewShellBase object has been constructed.
49 SFX_IMPL_VIEWFACTORY(ImpressViewShellBase, SdResId(STR_DEFAULTVIEW))
51 SFX_VIEW_REGISTRATION(DrawDocShell);
54 SfxViewFactory* ImpressViewShellBase::pFactory;
55 SfxViewShell* __EXPORT ImpressViewShellBase::CreateInstance (
56 SfxViewFrame *pFrame, SfxViewShell *pOldView)
58 ImpressViewShellBase* pBase = new ImpressViewShellBase(pFrame, pOldView);
59 pBase->LateInit(::rtl::OUString());
60 return pBase;
62 void ImpressViewShellBase::RegisterFactory( USHORT nPrio )
64 pFactory = new SfxViewFactory(
65 &CreateInstance,&InitFactory,nPrio,"Default");
66 InitFactory();
68 void ImpressViewShellBase::InitFactory()
70 SFX_VIEW_REGISTRATION(DrawDocShell);
80 ImpressViewShellBase::ImpressViewShellBase (
81 SfxViewFrame* _pFrame,
82 SfxViewShell* pOldShell)
83 : ViewShellBase (_pFrame, pOldShell)
85 MasterPageObserver::Instance().RegisterDocument (*GetDocShell()->GetDoc());
91 ImpressViewShellBase::~ImpressViewShellBase (void)
93 MasterPageObserver::Instance().UnregisterDocument (*GetDocShell()->GetDoc());
99 void ImpressViewShellBase::Execute (SfxRequest& rRequest)
101 USHORT nSlotId = rRequest.GetSlot();
103 switch (nSlotId)
105 case SID_LEFT_PANE_DRAW:
106 // Prevent a Draw-only slots from being executed.
107 rRequest.Cancel();
108 break;
110 default:
111 // The remaining requests are forwarded to our base class.
112 ViewShellBase::Execute(rRequest);
113 break;
120 void ImpressViewShellBase::InitializeFramework (void)
122 ::com::sun::star::uno::Reference<com::sun::star::frame::XController>
123 xController (GetController());
124 sd::framework::ImpressModule::Initialize(xController);
127 } // end of namespace sd