Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "ImpressViewShellBase.hxx"
21 :
22 : #include "DrawDocShell.hxx"
23 : #include "sdresid.hxx"
24 : #include "strings.hrc"
25 : #include "app.hrc"
26 : #include "framework/FrameworkHelper.hxx"
27 : #include "framework/ImpressModule.hxx"
28 : #include "MasterPageObserver.hxx"
29 : #include <sfx2/request.hxx>
30 : #include <sfx2/viewfrm.hxx>
31 : #include <sfx2/viewsh.hxx>
32 :
33 : namespace sd {
34 :
35 1698 : TYPEINIT1(ImpressViewShellBase, ViewShellBase);
36 :
37 : // We have to expand the SFX_IMPL_VIEWFACTORY macro to call LateInit() after a
38 : // new ImpressViewShellBase object has been constructed.
39 :
40 : SfxViewFactory* ImpressViewShellBase::pFactory;
41 52 : SfxViewShell* ImpressViewShellBase::CreateInstance (
42 : SfxViewFrame *pFrame, SfxViewShell *pOldView)
43 : {
44 52 : ImpressViewShellBase* pBase = new ImpressViewShellBase(pFrame, pOldView);
45 52 : pBase->LateInit("");
46 52 : return pBase;
47 : }
48 36 : void ImpressViewShellBase::RegisterFactory( sal_uInt16 nPrio )
49 : {
50 36 : pFactory = new SfxViewFactory(&CreateInstance,nPrio,"Default");
51 36 : InitFactory();
52 36 : }
53 36 : void ImpressViewShellBase::InitFactory()
54 : {
55 36 : SFX_VIEW_REGISTRATION(DrawDocShell);
56 36 : }
57 :
58 52 : ImpressViewShellBase::ImpressViewShellBase (
59 : SfxViewFrame* _pFrame,
60 : SfxViewShell* pOldShell)
61 52 : : ViewShellBase (_pFrame, pOldShell)
62 : {
63 52 : MasterPageObserver::Instance().RegisterDocument (*GetDocShell()->GetDoc());
64 52 : }
65 :
66 156 : ImpressViewShellBase::~ImpressViewShellBase (void)
67 : {
68 52 : MasterPageObserver::Instance().UnregisterDocument (*GetDocShell()->GetDoc());
69 104 : }
70 :
71 0 : void ImpressViewShellBase::Execute (SfxRequest& rRequest)
72 : {
73 0 : sal_uInt16 nSlotId = rRequest.GetSlot();
74 :
75 0 : switch (nSlotId)
76 : {
77 : case SID_LEFT_PANE_DRAW:
78 : // Prevent a Draw-only slots from being executed.
79 0 : rRequest.Cancel();
80 0 : break;
81 :
82 : default:
83 : // The remaining requests are forwarded to our base class.
84 0 : ViewShellBase::Execute(rRequest);
85 0 : break;
86 : }
87 0 : }
88 :
89 52 : void ImpressViewShellBase::InitializeFramework (void)
90 : {
91 : ::com::sun::star::uno::Reference<com::sun::star::frame::XController>
92 52 : xController (GetController());
93 52 : sd::framework::ImpressModule::Initialize(xController);
94 52 : }
95 :
96 114 : } // end of namespace sd
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|