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 "futransf.hxx" 29 30 #include <svx/dialogs.hrc> 31 #include <svx/polysc3d.hxx> 32 #include <vcl/msgbox.hxx> 33 #include <sfx2/request.hxx> 34 35 #include "strings.hrc" 36 #include "ViewShell.hxx" 37 #include "View.hxx" 38 #include "sdresid.hxx" 39 #include "drawdoc.hxx" 40 #include <svx/svxdlg.hxx> 41 #include <svx/dialogs.hrc> 42 43 namespace sd { 44 45 TYPEINIT1( FuTransform, FuPoor ); 46 47 /************************************************************************* 48 |* 49 |* Konstruktor 50 |* 51 \************************************************************************/ 52 53 FuTransform::FuTransform(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, 54 SdDrawDocument* pDoc, SfxRequest& rReq) 55 : FuPoor(pViewSh, pWin, pView, pDoc, rReq) 56 { 57 } 58 59 FunctionReference FuTransform::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ) 60 { 61 FunctionReference xFunc( new FuTransform( pViewSh, pWin, pView, pDoc, rReq ) ); 62 xFunc->DoExecute(rReq); 63 return xFunc; 64 } 65 66 void FuTransform::DoExecute( SfxRequest& rReq ) 67 { 68 if( mpView->AreObjectsMarked() ) 69 { 70 const SfxItemSet* pArgs = rReq.GetArgs(); 71 72 if( !pArgs ) 73 { 74 // --------- itemset for size and position -------- 75 SfxItemSet aSet( mpView->GetGeoAttrFromMarked() ); 76 77 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 78 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 79 if( rMarkList.GetMarkCount() == 1 && 80 pObj->GetObjInventor() == SdrInventor && 81 pObj->GetObjIdentifier() == OBJ_CAPTION ) 82 { 83 // --------- itemset for caption -------- 84 SfxItemSet aNewAttr( mpDoc->GetPool() ); 85 mpView->GetAttributes( aNewAttr ); 86 87 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 88 if ( pFact ) 89 { 90 std::auto_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateCaptionDialog( NULL, mpView ) ); 91 92 const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); 93 SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange ); 94 aCombSet.Put( aNewAttr ); 95 aCombSet.Put( aSet ); 96 pDlg->SetInputSet( &aCombSet ); 97 98 if( pDlg.get() && (pDlg->Execute() == RET_OK) ) 99 { 100 rReq.Done( *( pDlg->GetOutputItemSet() ) ); 101 pArgs = rReq.GetArgs(); 102 } 103 } 104 } 105 else 106 { 107 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 108 if(pFact) 109 { 110 std::auto_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateSvxTransformTabDialog( NULL, &aSet, mpView ) ); 111 if( pDlg.get() && (pDlg->Execute() == RET_OK) ) 112 { 113 rReq.Done( *( pDlg->GetOutputItemSet() ) ); 114 pArgs = rReq.GetArgs(); 115 } 116 } 117 } 118 } 119 120 if( pArgs ) 121 { 122 // Undo 123 String aString( mpView->GetDescriptionOfMarkedObjects() ); 124 aString.Append( sal_Unicode(' ') ); 125 aString.Append( String( SdResId( STR_TRANSFORM ) ) ); 126 mpView->BegUndo( aString ); 127 128 mpView->SetGeoAttrToMarked( *pArgs ); 129 mpView->SetAttributes( *pArgs ); 130 mpView->EndUndo(); 131 } 132 } 133 } 134 135 } // end of namespace sd 136