Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "fuvect.hxx"
21 : #include <tools/poly.hxx>
22 : #include <svx/svdograf.hxx>
23 : #include <vcl/msgbox.hxx>
24 : #include <svx/svdedtv.hxx>
25 :
26 :
27 : #include "View.hxx"
28 : #include "ViewShell.hxx"
29 : #include "Window.hxx"
30 : #include "strings.hrc"
31 : #include "sdresid.hxx"
32 : #include "sdabstdlg.hxx"
33 :
34 : namespace sd
35 : {
36 :
37 0 : TYPEINIT1( FuVectorize, FuPoor );
38 :
39 : /*************************************************************************
40 : |*
41 : |* Konstruktor
42 : |*
43 : \************************************************************************/
44 :
45 0 : FuVectorize::FuVectorize (
46 : ViewShell* pViewSh,
47 : ::sd::Window* pWin,
48 : ::sd::View* pView,
49 : SdDrawDocument* pDoc,
50 : SfxRequest& rReq)
51 0 : : FuPoor (pViewSh, pWin, pView, pDoc, rReq)
52 : {
53 0 : }
54 :
55 0 : FunctionReference FuVectorize::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
56 : {
57 0 : FunctionReference xFunc( new FuVectorize( pViewSh, pWin, pView, pDoc, rReq ) );
58 0 : xFunc->DoExecute(rReq);
59 0 : return xFunc;
60 : }
61 :
62 0 : void FuVectorize::DoExecute( SfxRequest& )
63 : {
64 0 : const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
65 :
66 0 : if( rMarkList.GetMarkCount() == 1 )
67 : {
68 0 : SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
69 :
70 0 : if( pObj && pObj->ISA( SdrGrafObj ) )
71 : {
72 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
73 0 : AbstractSdVectorizeDlg* pDlg = pFact ? pFact->CreateSdVectorizeDlg( mpWindow, ( (SdrGrafObj*) pObj )->GetGraphic().GetBitmap(), mpDocSh ) : 0;
74 0 : if( pDlg && pDlg->Execute() == RET_OK )
75 : {
76 0 : const GDIMetaFile& rMtf = pDlg->GetGDIMetaFile();
77 0 : SdrPageView* pPageView = mpView->GetSdrPageView();
78 :
79 0 : if( pPageView && rMtf.GetActionSize() )
80 : {
81 0 : SdrGrafObj* pVectObj = (SdrGrafObj*) pObj->Clone();
82 0 : String aStr( mpView->GetDescriptionOfMarkedObjects() );
83 :
84 0 : aStr.Append( sal_Unicode(' ') );
85 0 : aStr.Append( String( SdResId( STR_UNDO_VECTORIZE ) ) );
86 0 : mpView->BegUndo( aStr );
87 0 : pVectObj->SetGraphic( rMtf );
88 0 : mpView->ReplaceObjectAtView( pObj, *pPageView, pVectObj );
89 0 : mpView->EndUndo();
90 : }
91 : }
92 0 : delete pDlg;
93 : }
94 : }
95 0 : }
96 :
97 9 : } // end of namespace sd
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|