bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / func / futransf.cxx
blob24f6a82f83e2f574d8d1cd5583ae703e7d92e973
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "futransf.hxx"
22 #include <svx/dialogs.hrc>
23 #include <svx/polysc3d.hxx>
24 #include <vcl/msgbox.hxx>
25 #include <sfx2/request.hxx>
27 #include "strings.hrc"
28 #include "ViewShell.hxx"
29 #include "View.hxx"
30 #include "sdresid.hxx"
31 #include "drawdoc.hxx"
32 #include <svx/svxdlg.hxx>
34 #include <boost/scoped_ptr.hpp>
36 namespace sd {
38 TYPEINIT1( FuTransform, FuPoor );
40 FuTransform::FuTransform(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
41 SdDrawDocument* pDoc, SfxRequest& rReq)
42 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
46 rtl::Reference<FuPoor> FuTransform::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
48 rtl::Reference<FuPoor> xFunc( new FuTransform( pViewSh, pWin, pView, pDoc, rReq ) );
49 xFunc->DoExecute(rReq);
50 return xFunc;
53 void FuTransform::DoExecute( SfxRequest& rReq )
55 if( mpView->AreObjectsMarked() )
57 const SfxItemSet* pArgs = rReq.GetArgs();
59 if( !pArgs )
61 // --------- itemset for size and position --------
62 SfxItemSet aSet( mpView->GetGeoAttrFromMarked() );
64 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
65 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
66 if( rMarkList.GetMarkCount() == 1 &&
67 pObj->GetObjInventor() == SdrInventor &&
68 pObj->GetObjIdentifier() == OBJ_CAPTION )
70 // --------- itemset for caption --------
71 SfxItemSet aNewAttr( mpDoc->GetPool() );
72 mpView->GetAttributes( aNewAttr );
74 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
75 if ( pFact )
77 boost::scoped_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateCaptionDialog( NULL, mpView ) );
79 const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
80 SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange );
81 aCombSet.Put( aNewAttr );
82 aCombSet.Put( aSet );
83 pDlg->SetInputSet( &aCombSet );
85 if( pDlg.get() && (pDlg->Execute() == RET_OK) )
87 rReq.Done( *( pDlg->GetOutputItemSet() ) );
88 pArgs = rReq.GetArgs();
92 else
94 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
95 if(pFact)
97 boost::scoped_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateSvxTransformTabDialog( NULL, &aSet, mpView ) );
98 if( pDlg.get() && (pDlg->Execute() == RET_OK) )
100 rReq.Done( *( pDlg->GetOutputItemSet() ) );
101 pArgs = rReq.GetArgs();
107 if( pArgs )
109 // Undo
110 OUString aString( mpView->GetDescriptionOfMarkedObjects() );
111 aString += " " + SD_RESSTR( STR_TRANSFORM );
112 mpView->BegUndo( aString );
114 mpView->SetGeoAttrToMarked( *pArgs );
115 mpView->SetAttributes( *pArgs );
116 mpView->EndUndo();
121 } // end of namespace sd
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */