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