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 "fuvect.hxx" 29 #include <tools/poly.hxx> 30 #ifndef _SVDOPATH_HXX //autogen 31 #include <svx/svdograf.hxx> 32 #endif 33 #include <vcl/msgbox.hxx> 34 #ifndef _SVX_SVDOGRAF_HXX //autogen 35 #include <svx/svdograf.hxx> 36 #endif 37 #ifndef _SVX_SVDEDTV_HXX //autogen 38 #include <svx/svdedtv.hxx> 39 #endif 40 41 42 #include "View.hxx" 43 #include "ViewShell.hxx" 44 #include "Window.hxx" 45 #include "strings.hrc" 46 #include "sdresid.hxx" 47 #include "sdabstdlg.hxx" 48 49 namespace sd 50 { 51 52 TYPEINIT1( FuVectorize, FuPoor ); 53 54 /************************************************************************* 55 |* 56 |* Konstruktor 57 |* 58 \************************************************************************/ 59 60 FuVectorize::FuVectorize ( 61 ViewShell* pViewSh, 62 ::sd::Window* pWin, 63 ::sd::View* pView, 64 SdDrawDocument* pDoc, 65 SfxRequest& rReq) 66 : FuPoor (pViewSh, pWin, pView, pDoc, rReq) 67 { 68 } 69 70 FunctionReference FuVectorize::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ) 71 { 72 FunctionReference xFunc( new FuVectorize( pViewSh, pWin, pView, pDoc, rReq ) ); 73 xFunc->DoExecute(rReq); 74 return xFunc; 75 } 76 77 void FuVectorize::DoExecute( SfxRequest& ) 78 { 79 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 80 81 if( rMarkList.GetMarkCount() == 1 ) 82 { 83 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 84 85 if( pObj && pObj->ISA( SdrGrafObj ) ) 86 { 87 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); 88 AbstractSdVectorizeDlg* pDlg = pFact ? pFact->CreateSdVectorizeDlg( mpWindow, ( (SdrGrafObj*) pObj )->GetGraphic().GetBitmap(), mpDocSh ) : 0; 89 if( pDlg && pDlg->Execute() == RET_OK ) 90 { 91 const GDIMetaFile& rMtf = pDlg->GetGDIMetaFile(); 92 SdrPageView* pPageView = mpView->GetSdrPageView(); 93 94 if( pPageView && rMtf.GetActionCount() ) 95 { 96 SdrGrafObj* pVectObj = (SdrGrafObj*) pObj->Clone(); 97 String aStr( mpView->GetDescriptionOfMarkedObjects() ); 98 99 aStr.Append( sal_Unicode(' ') ); 100 aStr.Append( String( SdResId( STR_UNDO_VECTORIZE ) ) ); 101 mpView->BegUndo( aStr ); 102 pVectObj->SetGraphic( rMtf ); 103 mpView->ReplaceObjectAtView( pObj, *pPageView, pVectObj ); 104 mpView->EndUndo(); 105 } 106 } 107 delete pDlg; 108 } 109 } 110 } 111 112 } // end of namespace sd 113