1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <com/sun/star/presentation/XSlideShowController.hpp>
23 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <comphelper/processfactory.hxx>
27 #include "PresentationViewShell.hxx"
28 #include "optsitem.hxx"
30 #include <sfx2/request.hxx>
31 #include <sfx2/dispatch.hxx>
33 #include <sfx2/objface.hxx>
35 #include <svx/svxids.hrc>
37 #include "FrameView.hxx"
39 #include "sdresid.hxx"
40 #include "DrawDocShell.hxx"
41 #include "slideshow.hxx"
44 #include "drawdoc.hxx"
45 #include "drawview.hxx"
47 #include "strings.hrc"
49 #include "ViewShellBase.hxx"
50 #include "FactoryIds.hxx"
55 #define PresentationViewShell
57 #include "sdslots.hxx"
59 using namespace ::com::sun::star::uno
;
60 using namespace ::com::sun::star::lang
;
61 using namespace ::com::sun::star::beans
;
62 using namespace ::com::sun::star::presentation
;
66 // -------------------
67 // - PresentationViewShell -
68 // -------------------
70 SFX_IMPL_INTERFACE( PresentationViewShell
, DrawViewShell
, SdResId( STR_PRESVIEWSHELL
) )
72 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS
| SFX_VISIBILITY_STANDARD
|
73 SFX_VISIBILITY_FULLSCREEN
| SFX_VISIBILITY_SERVER
,
74 SdResId(RID_DRAW_TOOLBOX
));
75 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION
| SFX_VISIBILITY_DESKTOP
| SFX_VISIBILITY_STANDARD
| SFX_VISIBILITY_CLIENT
| SFX_VISIBILITY_VIEWER
| SFX_VISIBILITY_READONLYDOC
,
76 SdResId(RID_DRAW_VIEWER_TOOLBOX
) );
77 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OPTIONS
| SFX_VISIBILITY_STANDARD
|
78 SFX_VISIBILITY_SERVER
,
79 SdResId(RID_DRAW_OPTIONS_TOOLBOX
));
80 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_COMMONTASK
| SFX_VISIBILITY_STANDARD
|
81 SFX_VISIBILITY_SERVER
,
82 SdResId(RID_DRAW_COMMONTASK_TOOLBOX
));
86 TYPEINIT1( PresentationViewShell
, DrawViewShell
);
88 PresentationViewShell::PresentationViewShell( SfxViewFrame
* pFrame
, ViewShellBase
& rViewShellBase
, ::Window
* pParentWindow
, FrameView
* pFrameView
)
89 : DrawViewShell( pFrame
, rViewShellBase
, pParentWindow
, PK_STANDARD
, pFrameView
)
91 if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED
)
92 maOldVisArea
= GetDocSh()->GetVisArea( ASPECT_CONTENT
);
93 meShellType
= ST_PRESENTATION
;
96 PresentationViewShell::~PresentationViewShell (void)
98 if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED
&& !maOldVisArea
.IsEmpty() )
99 GetDocSh()->SetVisArea( maOldVisArea
);
102 void PresentationViewShell::FinishInitialization( FrameView
* pFrameView
)
104 DrawViewShell::Init(true);
106 // Use the frame view that comes form the view shell that initiated our
108 if (pFrameView
!= NULL
)
110 GetFrameView()->Disconnect();
111 SetFrameView (pFrameView
);
112 pFrameView
->Connect();
115 WriteFrameViewData();
117 GetActiveWindow()->GrabFocus();
121 SvxRuler
* PresentationViewShell::CreateHRuler(::sd::Window
*, sal_Bool
)
126 SvxRuler
* PresentationViewShell::CreateVRuler(::sd::Window
*)
132 void PresentationViewShell::Activate( sal_Bool bIsMDIActivate
)
134 DrawViewShell::Activate( bIsMDIActivate
);
138 SfxBoolItem
aItem( SID_NAVIGATOR_INIT
, sal_True
);
140 GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR_INIT
, SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
, &aItem
, 0L );
142 rtl::Reference
< SlideShow
> xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
143 if( xSlideShow
.is() )
144 xSlideShow
->activate(GetViewShellBase());
146 if( HasCurrentFunction() )
147 GetCurrentFunction()->Activate();
151 ReadFrameViewData( mpFrameView
);
152 GetDocSh()->Connect( this );
155 void PresentationViewShell::Paint( const Rectangle
& rRect
, ::sd::Window
* )
157 rtl::Reference
< SlideShow
> xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
158 if( xSlideShow
.is() )
159 xSlideShow
->paint(rRect
);
162 void PresentationViewShell::Resize (void)
164 ViewShell::Resize(); // do not call DrawViewShell here!
166 rtl::Reference
< sd::SlideShow
> xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
167 if( xSlideshow
.is() )
168 xSlideshow
->resize(maViewSize
);
171 } // end of namespace sd
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */