xref: /aoo4110/main/sd/source/ui/func/fuconnct.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 
28 
29 #include "fuconnct.hxx"
30 #include <sfx2/request.hxx>
31 #include <vcl/msgbox.hxx>
32 #include "View.hxx"
33 #include "ViewShell.hxx"
34 #include "drawdoc.hxx"
35 #include <svx/svxdlg.hxx>
36 #include <svx/dialogs.hrc>
37 
38 namespace sd {
39 
40 TYPEINIT1( FuConnectionDlg, FuPoor );
41 
42 /*************************************************************************
43 |*
44 |* Konstruktor
45 |*
46 \************************************************************************/
47 
FuConnectionDlg(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)48 FuConnectionDlg::FuConnectionDlg (
49     ViewShell* pViewSh,
50     ::sd::Window* pWin,
51     ::sd::View* pView,
52     SdDrawDocument* pDoc,
53     SfxRequest& rReq)
54     : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
55 {
56 }
57 
Create(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)58 FunctionReference FuConnectionDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
59 {
60 	FunctionReference xFunc( new FuConnectionDlg( pViewSh, pWin, pView, pDoc, rReq ) );
61 	xFunc->DoExecute(rReq);
62 	return xFunc;
63 }
64 
DoExecute(SfxRequest & rReq)65 void FuConnectionDlg::DoExecute( SfxRequest& rReq )
66 {
67 	SfxItemSet aNewAttr( mpDoc->GetPool() );
68 	mpView->GetAttributes( aNewAttr );
69 
70 	const SfxItemSet* pArgs = rReq.GetArgs();
71 
72 	if( !pArgs )
73 	{
74 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
75 		::std::auto_ptr<SfxAbstractDialog> pDlg( pFact ? pFact->CreateSfxDialog( NULL, aNewAttr, mpView, RID_SVXPAGE_CONNECTION) : 0);
76 
77 		if( pDlg.get() && (pDlg->Execute() == RET_OK) )
78 		{
79 			rReq.Done( *pDlg->GetOutputItemSet() );
80 			pArgs = rReq.GetArgs();
81 		}
82 	}
83 	if( pArgs )
84 		mpView->SetAttributes( *pArgs );
85 }
86 
87 } // end of namespace sd
88