Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
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 [ - + ][ + + ]: 1836 : 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 : 26 : SfxViewShell* ImpressViewShellBase::CreateInstance (
50 : : SfxViewFrame *pFrame, SfxViewShell *pOldView)
51 : : {
52 [ + - ]: 26 : ImpressViewShellBase* pBase = new ImpressViewShellBase(pFrame, pOldView);
53 [ + - ]: 26 : pBase->LateInit("");
54 : 26 : return pBase;
55 : : }
56 : 22 : void ImpressViewShellBase::RegisterFactory( sal_uInt16 nPrio )
57 : : {
58 [ + - ]: 22 : pFactory = new SfxViewFactory(&CreateInstance,nPrio,"Default");
59 : 22 : InitFactory();
60 : 22 : }
61 : 22 : void ImpressViewShellBase::InitFactory()
62 : : {
63 : 22 : SFX_VIEW_REGISTRATION(DrawDocShell);
64 : 22 : }
65 : :
66 : :
67 : :
68 : :
69 : :
70 : :
71 : :
72 : :
73 : 26 : ImpressViewShellBase::ImpressViewShellBase (
74 : : SfxViewFrame* _pFrame,
75 : : SfxViewShell* pOldShell)
76 : 26 : : ViewShellBase (_pFrame, pOldShell)
77 : : {
78 [ + - ][ + - ]: 26 : MasterPageObserver::Instance().RegisterDocument (*GetDocShell()->GetDoc());
[ + - ][ + - ]
79 : 26 : }
80 : :
81 : :
82 : :
83 : :
84 : 26 : ImpressViewShellBase::~ImpressViewShellBase (void)
85 : : {
86 [ + - ][ + - ]: 26 : MasterPageObserver::Instance().UnregisterDocument (*GetDocShell()->GetDoc());
[ + - ][ + - ]
87 [ - + ]: 52 : }
88 : :
89 : :
90 : :
91 : :
92 : 0 : void ImpressViewShellBase::Execute (SfxRequest& rRequest)
93 : : {
94 : 0 : sal_uInt16 nSlotId = rRequest.GetSlot();
95 : :
96 [ # # ]: 0 : switch (nSlotId)
97 : : {
98 : : case SID_LEFT_PANE_DRAW:
99 : : // Prevent a Draw-only slots from being executed.
100 : 0 : rRequest.Cancel();
101 : 0 : break;
102 : :
103 : : default:
104 : : // The remaining requests are forwarded to our base class.
105 : 0 : ViewShellBase::Execute(rRequest);
106 : 0 : break;
107 : : }
108 : 0 : }
109 : :
110 : :
111 : :
112 : :
113 : 26 : void ImpressViewShellBase::InitializeFramework (void)
114 : : {
115 : : ::com::sun::star::uno::Reference<com::sun::star::frame::XController>
116 [ + - ]: 26 : xController (GetController());
117 [ + - ]: 26 : sd::framework::ImpressModule::Initialize(xController);
118 : 26 : }
119 : :
120 : : } // end of namespace sd
121 : :
122 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|