bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / view / presvish.cxx
blob7182979fb944c6b025b5e634e3e3abe3e2386305
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <com/sun/star/presentation/XSlideShowController.hpp>
22 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <comphelper/processfactory.hxx>
26 #include "PresentationViewShell.hxx"
27 #include "optsitem.hxx"
28 #include "sddll.hxx"
29 #include <sfx2/request.hxx>
30 #include <sfx2/dispatch.hxx>
32 #include <sfx2/objface.hxx>
34 #include <svx/svxids.hrc>
35 #include "FrameView.hxx"
36 #include "sdresid.hxx"
37 #include "DrawDocShell.hxx"
38 #include "slideshow.hxx"
39 #include "sdattr.hxx"
40 #include "sdpage.hxx"
41 #include "drawdoc.hxx"
42 #include "drawview.hxx"
43 #include "app.hrc"
44 #include "strings.hrc"
45 #include "glob.hrc"
46 #include "ViewShellBase.hxx"
47 #include "FactoryIds.hxx"
49 #include "fupoor.hxx"
50 #include "Window.hxx"
52 #define PresentationViewShell
53 using namespace sd;
54 #include "sdslots.hxx"
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::lang;
58 using namespace ::com::sun::star::beans;
59 using namespace ::com::sun::star::presentation;
61 namespace sd {
63 SFX_IMPL_INTERFACE(PresentationViewShell, DrawViewShell)
65 void PresentationViewShell::InitInterface_Impl()
67 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_TOOLS | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER,
68 RID_DRAW_TOOLBOX);
69 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER | SFX_VISIBILITY_READONLYDOC,
70 RID_DRAW_VIEWER_TOOLBOX);
71 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OPTIONS | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_SERVER,
72 RID_DRAW_OPTIONS_TOOLBOX);
73 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_COMMONTASK | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_SERVER,
74 RID_DRAW_COMMONTASK_TOOLBOX);
77 TYPEINIT1( PresentationViewShell, DrawViewShell );
79 PresentationViewShell::PresentationViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, vcl::Window* pParentWindow, FrameView* pFrameView)
80 : DrawViewShell( pFrame, rViewShellBase, pParentWindow, PK_STANDARD, pFrameView)
82 if( GetDocSh() && GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
83 maOldVisArea = GetDocSh()->GetVisArea( ASPECT_CONTENT );
84 meShellType = ST_PRESENTATION;
87 PresentationViewShell::~PresentationViewShell()
89 if( GetDocSh() && GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED && !maOldVisArea.IsEmpty() )
90 GetDocSh()->SetVisArea( maOldVisArea );
93 void PresentationViewShell::FinishInitialization( FrameView* pFrameView )
95 DrawViewShell::Init(true);
97 // Use the frame view that comes form the view shell that initiated our
98 // creation.
99 if (pFrameView != NULL)
101 GetFrameView()->Disconnect();
102 SetFrameView (pFrameView);
103 pFrameView->Connect();
105 SetRuler(false);
106 WriteFrameViewData();
108 GetActiveWindow()->GrabFocus();
111 SvxRuler* PresentationViewShell::CreateHRuler(::sd::Window*, bool)
113 return NULL;
116 SvxRuler* PresentationViewShell::CreateVRuler(::sd::Window*)
118 return NULL;
121 void PresentationViewShell::Activate( bool bIsMDIActivate )
123 DrawViewShell::Activate( bIsMDIActivate );
125 if( bIsMDIActivate )
127 SfxBoolItem aItem( SID_NAVIGATOR_INIT, true );
129 GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR_INIT, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, &aItem, 0L );
131 rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
132 if( xSlideShow.is() )
133 xSlideShow->activate(GetViewShellBase());
135 if( HasCurrentFunction() )
136 GetCurrentFunction()->Activate();
139 if( bIsMDIActivate )
140 ReadFrameViewData( mpFrameView );
141 GetDocSh()->Connect( this );
144 void PresentationViewShell::Paint( const Rectangle& rRect, ::sd::Window* )
146 rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
147 if( xSlideShow.is() )
148 xSlideShow->paint(rRect);
151 void PresentationViewShell::Resize()
153 ViewShell::Resize(); // do not call DrawViewShell here!
155 rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
156 if( xSlideshow.is() )
157 xSlideshow->resize(maViewSize);
160 } // end of namespace sd
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */