xref: /aoo4110/main/sd/source/ui/func/fucushow.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 #include "fucushow.hxx"
28 
29 #include <svx/svxids.hrc>
30 
31 #include "app.hrc"
32 #include "sdresid.hxx"
33 #include "ViewShell.hxx"
34 #include "drawdoc.hxx"
35 #include "sdpage.hxx"
36 #include <vcl/msgbox.hxx>
37 #include <sfx2/dispatch.hxx>
38 #include <sfx2/viewfrm.hxx>
39 
40 #include "sdabstdlg.hxx"
41 
42 namespace sd {
43 
44 TYPEINIT1( FuCustomShowDlg, FuPoor );
45 
46 
47 /*************************************************************************
48 |*
49 |* Konstruktor
50 |*
51 \************************************************************************/
52 
FuCustomShowDlg(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)53 FuCustomShowDlg::FuCustomShowDlg (
54     ViewShell* pViewSh,
55     ::sd::Window*	 pWin,
56     ::sd::View*	pView,
57     SdDrawDocument* pDoc,
58     SfxRequest& rReq)
59     : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
60 {
61 }
62 
Create(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)63 FunctionReference FuCustomShowDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
64 {
65 	FunctionReference xFunc( new FuCustomShowDlg( pViewSh, pWin, pView, pDoc, rReq ) );
66 	xFunc->DoExecute(rReq);
67 	return xFunc;
68 }
69 
DoExecute(SfxRequest &)70 void FuCustomShowDlg::DoExecute( SfxRequest& )
71 {
72 	SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
73 	AbstractSdCustomShowDlg* pDlg = pFact ? pFact->CreateSdCustomShowDlg( NULL, *mpDoc ) : 0;
74 	if( pDlg )
75 	{
76 		sal_uInt16 nRet = pDlg->Execute();
77 		if( pDlg->IsModified() )
78 		{
79 			mpDoc->SetChanged( sal_True );
80 			sd::PresentationSettings& rSettings = mpDoc->getPresentationSettings();
81 			rSettings.mbCustomShow = pDlg->IsCustomShow();
82 		}
83 		delete pDlg;
84 
85 		if( nRet == RET_YES )
86 		{
87 			mpViewShell->SetStartShowWithDialog();
88 
89 			mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION,
90 					SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
91 		}
92 	}
93 }
94 
95 } // end of namespace
96