1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: presvish.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include <com/sun/star/presentation/XSlideShowController.hpp>
36 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <comphelper/processfactory.hxx>
40 #include "PresentationViewShell.hxx"
41 #include "optsitem.hxx"
43 #include <sfx2/request.hxx>
44 #include <sfx2/topfrm.hxx>
45 #ifndef _SFX_DISPATCH_HXX
46 #include <sfx2/dispatch.hxx>
49 #include <sfx2/objface.hxx>
51 #include <svx/svxids.hrc>
53 #include "FrameView.hxx"
55 #include "sdresid.hxx"
56 #include "DrawDocShell.hxx"
57 #include "slideshow.hxx"
60 #include "drawdoc.hxx"
61 #include "drawview.hxx"
63 #include "strings.hrc"
65 #include "ViewShellBase.hxx"
66 #include "FactoryIds.hxx"
69 #include "slideshow.hxx"
73 #define PresentationViewShell
75 #include "sdslots.hxx"
77 using ::rtl::OUString
;
78 using namespace ::com::sun::star::uno
;
79 using namespace ::com::sun::star::lang
;
80 using namespace ::com::sun::star::beans
;
81 using namespace ::com::sun::star::presentation
;
85 // -------------------
86 // - PresentationViewShell -
87 // -------------------
89 SFX_IMPL_INTERFACE( PresentationViewShell
, DrawViewShell
, SdResId( STR_PRESVIEWSHELL
) )
91 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS
| SFX_VISIBILITY_STANDARD
|
92 SFX_VISIBILITY_FULLSCREEN
| SFX_VISIBILITY_SERVER
,
93 SdResId(RID_DRAW_TOOLBOX
));
94 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION
| SFX_VISIBILITY_DESKTOP
| SFX_VISIBILITY_STANDARD
| SFX_VISIBILITY_CLIENT
| SFX_VISIBILITY_VIEWER
| SFX_VISIBILITY_READONLYDOC
,
95 SdResId(RID_DRAW_VIEWER_TOOLBOX
) );
96 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OPTIONS
| SFX_VISIBILITY_STANDARD
|
97 SFX_VISIBILITY_SERVER
,
98 SdResId(RID_DRAW_OPTIONS_TOOLBOX
));
99 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_COMMONTASK
| SFX_VISIBILITY_STANDARD
|
100 SFX_VISIBILITY_SERVER
,
101 SdResId(RID_DRAW_COMMONTASK_TOOLBOX
));
105 TYPEINIT1( PresentationViewShell
, DrawViewShell
);
107 PresentationViewShell::PresentationViewShell( SfxViewFrame
* pFrame
, ViewShellBase
& rViewShellBase
, ::Window
* pParentWindow
, FrameView
* pFrameView
)
108 : DrawViewShell( pFrame
, rViewShellBase
, pParentWindow
, PK_STANDARD
, pFrameView
)
110 if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED
)
111 maOldVisArea
= GetDocSh()->GetVisArea( ASPECT_CONTENT
);
112 meShellType
= ST_PRESENTATION
;
115 PresentationViewShell::~PresentationViewShell (void)
117 if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED
&& !maOldVisArea
.IsEmpty() )
118 GetDocSh()->SetVisArea( maOldVisArea
);
121 void PresentationViewShell::FinishInitialization( FrameView
* pFrameView
)
123 DrawViewShell::Init(true);
125 // Use the frame view that comes form the view shell that initiated our
127 if (pFrameView
!= NULL
)
129 GetFrameView()->Disconnect();
130 SetFrameView (pFrameView
);
131 pFrameView
->Connect();
134 // SwitchPage (nPageNumber);
135 WriteFrameViewData();
137 GetActiveWindow()->GrabFocus();
141 SvxRuler
* PresentationViewShell::CreateHRuler(::sd::Window
*, BOOL
)
146 SvxRuler
* PresentationViewShell::CreateVRuler(::sd::Window
*)
152 void PresentationViewShell::Activate( BOOL bIsMDIActivate
)
154 DrawViewShell::Activate( bIsMDIActivate
);
158 //HMH::sd::View* pView = GetView();
159 SfxBoolItem
aItem( SID_NAVIGATOR_INIT
, TRUE
);
161 GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR_INIT
, SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
, &aItem
, 0L );
163 rtl::Reference
< SlideShow
> xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
164 if( xSlideShow
.is() )
165 xSlideShow
->activate(GetViewShellBase());
167 if( HasCurrentFunction() )
168 GetCurrentFunction()->Activate();
172 ReadFrameViewData( mpFrameView
);
173 GetDocSh()->Connect( this );
176 void PresentationViewShell::Paint( const Rectangle
& rRect
, ::sd::Window
* )
178 rtl::Reference
< SlideShow
> xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
179 if( xSlideShow
.is() )
180 xSlideShow
->paint(rRect
);
183 void PresentationViewShell::Resize (void)
185 ViewShell::Resize(); // do not call DrawViewShell here!
187 rtl::Reference
< sd::SlideShow
> xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
188 if( xSlideshow
.is() )
189 xSlideshow
->resize(maViewSize
);
192 } // end of namespace sd