Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "fuvect.hxx"
30 : : #include <tools/poly.hxx>
31 : : #include <svx/svdograf.hxx>
32 : : #include <vcl/msgbox.hxx>
33 : : #include <svx/svdedtv.hxx>
34 : :
35 : :
36 : : #include "View.hxx"
37 : : #include "ViewShell.hxx"
38 : : #include "Window.hxx"
39 : : #include "strings.hrc"
40 : : #include "sdresid.hxx"
41 : : #include "sdabstdlg.hxx"
42 : :
43 : : namespace sd
44 : : {
45 : :
46 [ # # ][ # # ]: 0 : TYPEINIT1( FuVectorize, FuPoor );
47 : :
48 : : /*************************************************************************
49 : : |*
50 : : |* Konstruktor
51 : : |*
52 : : \************************************************************************/
53 : :
54 : 0 : FuVectorize::FuVectorize (
55 : : ViewShell* pViewSh,
56 : : ::sd::Window* pWin,
57 : : ::sd::View* pView,
58 : : SdDrawDocument* pDoc,
59 : : SfxRequest& rReq)
60 : 0 : : FuPoor (pViewSh, pWin, pView, pDoc, rReq)
61 : : {
62 : 0 : }
63 : :
64 : 0 : FunctionReference FuVectorize::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
65 : : {
66 [ # # ][ # # ]: 0 : FunctionReference xFunc( new FuVectorize( pViewSh, pWin, pView, pDoc, rReq ) );
67 [ # # ]: 0 : xFunc->DoExecute(rReq);
68 : 0 : return xFunc;
69 : : }
70 : :
71 : 0 : void FuVectorize::DoExecute( SfxRequest& )
72 : : {
73 : 0 : const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
74 : :
75 [ # # ]: 0 : if( rMarkList.GetMarkCount() == 1 )
76 : : {
77 : 0 : SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
78 : :
79 [ # # ][ # # ]: 0 : if( pObj && pObj->ISA( SdrGrafObj ) )
[ # # ]
80 : : {
81 : 0 : SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
82 [ # # ][ # # ]: 0 : AbstractSdVectorizeDlg* pDlg = pFact ? pFact->CreateSdVectorizeDlg( mpWindow, ( (SdrGrafObj*) pObj )->GetGraphic().GetBitmap(), mpDocSh ) : 0;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
[ # # ]
83 [ # # ][ # # ]: 0 : if( pDlg && pDlg->Execute() == RET_OK )
[ # # ]
84 : : {
85 : 0 : const GDIMetaFile& rMtf = pDlg->GetGDIMetaFile();
86 : 0 : SdrPageView* pPageView = mpView->GetSdrPageView();
87 : :
88 [ # # ][ # # ]: 0 : if( pPageView && rMtf.GetActionSize() )
[ # # ]
89 : : {
90 [ # # ]: 0 : SdrGrafObj* pVectObj = (SdrGrafObj*) pObj->Clone();
91 [ # # ]: 0 : String aStr( mpView->GetDescriptionOfMarkedObjects() );
92 : :
93 [ # # ]: 0 : aStr.Append( sal_Unicode(' ') );
94 [ # # ][ # # ]: 0 : aStr.Append( String( SdResId( STR_UNDO_VECTORIZE ) ) );
[ # # ][ # # ]
95 [ # # ]: 0 : mpView->BegUndo( aStr );
96 [ # # ][ # # ]: 0 : pVectObj->SetGraphic( rMtf );
[ # # ]
97 [ # # ]: 0 : mpView->ReplaceObjectAtView( pObj, *pPageView, pVectObj );
98 [ # # ][ # # ]: 0 : mpView->EndUndo();
99 : : }
100 : : }
101 [ # # ]: 0 : delete pDlg;
102 : : }
103 : : }
104 : 0 : }
105 : :
106 : : } // end of namespace sd
107 : :
108 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|