1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fuvect.cxx,v $
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"
36 #include <tools/poly.hxx>
37 #ifndef _SVDOPATH_HXX //autogen
38 #include <svx/svdograf.hxx>
40 #include <vcl/msgbox.hxx>
41 #ifndef _SVX_SVDOGRAF_HXX //autogen
42 #include <svx/svdograf.hxx>
44 #ifndef _SVX_SVDEDTV_HXX //autogen
45 #include <svx/svdedtv.hxx>
50 #include "ViewShell.hxx"
52 #include "strings.hrc"
53 #include "sdresid.hxx"
54 #include "sdabstdlg.hxx"
59 TYPEINIT1( FuVectorize
, FuPoor
);
61 /*************************************************************************
65 \************************************************************************/
67 FuVectorize::FuVectorize (
73 : FuPoor (pViewSh
, pWin
, pView
, pDoc
, rReq
)
77 FunctionReference
FuVectorize::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
79 FunctionReference
xFunc( new FuVectorize( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
80 xFunc
->DoExecute(rReq
);
84 void FuVectorize::DoExecute( SfxRequest
& )
86 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
88 if( rMarkList
.GetMarkCount() == 1 )
90 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
92 if( pObj
&& pObj
->ISA( SdrGrafObj
) )
94 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
95 AbstractSdVectorizeDlg
* pDlg
= pFact
? pFact
->CreateSdVectorizeDlg( mpWindow
, ( (SdrGrafObj
*) pObj
)->GetGraphic().GetBitmap(), mpDocSh
) : 0;
96 if( pDlg
&& pDlg
->Execute() == RET_OK
)
98 const GDIMetaFile
& rMtf
= pDlg
->GetGDIMetaFile();
99 SdrPageView
* pPageView
= mpView
->GetSdrPageView();
101 if( pPageView
&& rMtf
.GetActionCount() )
103 SdrGrafObj
* pVectObj
= (SdrGrafObj
*) pObj
->Clone();
104 String
aStr( mpView
->GetDescriptionOfMarkedObjects() );
106 aStr
.Append( sal_Unicode(' ') );
107 aStr
.Append( String( SdResId( STR_UNDO_VECTORIZE
) ) );
108 mpView
->BegUndo( aStr
);
109 pVectObj
->SetGraphic( rMtf
);
110 mpView
->ReplaceObjectAtView( pObj
, *pPageView
, pVectObj
);
119 } // end of namespace sd