Update ooo320-m1
[ooovba.git] / sd / source / ui / func / fumeasur.cxx
blobbef4d59783ae69d06a704f1397977c63dccca581
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fumeasur.cxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
35 #include "fumeasur.hxx"
36 #include <vcl/msgbox.hxx>
37 #include <sfx2/request.hxx>
38 #include "View.hxx"
39 #include "ViewShell.hxx"
40 #include "drawdoc.hxx"
41 #include <svx/svxdlg.hxx>
42 #include <svx/dialogs.hrc>
44 namespace sd {
46 TYPEINIT1( FuMeasureDlg, FuPoor );
48 /*************************************************************************
50 |* Konstruktor
52 \************************************************************************/
54 FuMeasureDlg::FuMeasureDlg (
55 ViewShell* pViewSh,
56 ::sd::Window* pWin,
57 ::sd::View* pView,
58 SdDrawDocument* pDoc,
59 SfxRequest& rReq)
60 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
64 FunctionReference FuMeasureDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
66 FunctionReference xFunc( new FuMeasureDlg( pViewSh, pWin, pView, pDoc, rReq ) );
67 xFunc->DoExecute(rReq);
68 return xFunc;
71 void FuMeasureDlg::DoExecute( SfxRequest& rReq )
73 SfxItemSet aNewAttr( mpDoc->GetPool() );
74 mpView->GetAttributes( aNewAttr );
76 const SfxItemSet* pArgs = rReq.GetArgs();
78 if( !pArgs )
80 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
81 ::std::auto_ptr<SfxAbstractDialog> pDlg( pFact ? pFact->CreateSfxDialog( NULL, aNewAttr, mpView, RID_SVXPAGE_MEASURE) : 0 );
83 if( pDlg.get() && (pDlg->Execute() == RET_OK) )
85 rReq.Done( *pDlg->GetOutputItemSet() );
86 pArgs = rReq.GetArgs();
90 if( pArgs )
91 mpView->SetAttributes( *pArgs );
95 } // end of namespace sd