1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sd.hxx" 30 31 32 #include "futransf.hxx" 33 34 #include <svx/dialogs.hrc> 35 #include <svx/polysc3d.hxx> 36 #include <vcl/msgbox.hxx> 37 #include <sfx2/request.hxx> 38 39 #include "strings.hrc" 40 #include "ViewShell.hxx" 41 #include "View.hxx" 42 #include "sdresid.hxx" 43 #include "drawdoc.hxx" 44 #include <svx/svxdlg.hxx> 45 #include <svx/dialogs.hrc> 46 47 namespace sd { 48 49 TYPEINIT1( FuTransform, FuPoor ); 50 51 /************************************************************************* 52 |* 53 |* Konstruktor 54 |* 55 \************************************************************************/ 56 57 FuTransform::FuTransform(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, 58 SdDrawDocument* pDoc, SfxRequest& rReq) 59 : FuPoor(pViewSh, pWin, pView, pDoc, rReq) 60 { 61 } 62 63 FunctionReference FuTransform::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ) 64 { 65 FunctionReference xFunc( new FuTransform( pViewSh, pWin, pView, pDoc, rReq ) ); 66 xFunc->DoExecute(rReq); 67 return xFunc; 68 } 69 70 void FuTransform::DoExecute( SfxRequest& rReq ) 71 { 72 if( mpView->AreObjectsMarked() ) 73 { 74 const SfxItemSet* pArgs = rReq.GetArgs(); 75 76 if( !pArgs ) 77 { 78 // --------- itemset for size and position -------- 79 SfxItemSet aSet( mpView->GetGeoAttrFromMarked() ); 80 81 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 82 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 83 if( rMarkList.GetMarkCount() == 1 && 84 pObj->GetObjInventor() == SdrInventor && 85 pObj->GetObjIdentifier() == OBJ_CAPTION ) 86 { 87 // --------- itemset for caption -------- 88 SfxItemSet aNewAttr( mpDoc->GetPool() ); 89 mpView->GetAttributes( aNewAttr ); 90 91 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 92 if ( pFact ) 93 { 94 std::auto_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateCaptionDialog( NULL, mpView ) ); 95 96 const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); 97 SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange ); 98 aCombSet.Put( aNewAttr ); 99 aCombSet.Put( aSet ); 100 pDlg->SetInputSet( &aCombSet ); 101 102 if( pDlg.get() && (pDlg->Execute() == RET_OK) ) 103 { 104 rReq.Done( *( pDlg->GetOutputItemSet() ) ); 105 pArgs = rReq.GetArgs(); 106 } 107 } 108 } 109 else 110 { 111 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 112 if(pFact) 113 { 114 std::auto_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateSvxTransformTabDialog( NULL, &aSet, mpView ) ); 115 if( pDlg.get() && (pDlg->Execute() == RET_OK) ) 116 { 117 rReq.Done( *( pDlg->GetOutputItemSet() ) ); 118 pArgs = rReq.GetArgs(); 119 } 120 } 121 } 122 } 123 124 if( pArgs ) 125 { 126 // Undo 127 String aString( mpView->GetDescriptionOfMarkedObjects() ); 128 aString.Append( sal_Unicode(' ') ); 129 aString.Append( String( SdResId( STR_TRANSFORM ) ) ); 130 mpView->BegUndo( aString ); 131 132 mpView->SetGeoAttrToMarked( *pArgs ); 133 mpView->SetAttributes( *pArgs ); 134 mpView->EndUndo(); 135 } 136 } 137 } 138 139 } // end of namespace sd 140