1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
30 #include "sdresid.hxx"
31 #include "drawdoc.hxx"
32 #include <svx/svxdlg.hxx>
34 #include <boost/scoped_ptr.hpp>
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
);
53 void FuTransform::DoExecute( SfxRequest
& rReq
)
55 if( mpView
->AreObjectsMarked() )
57 const SfxItemSet
* pArgs
= rReq
.GetArgs();
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();
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
);
83 pDlg
->SetInputSet( &aCombSet
);
85 if( pDlg
.get() && (pDlg
->Execute() == RET_OK
) )
87 rReq
.Done( *( pDlg
->GetOutputItemSet() ) );
88 pArgs
= rReq
.GetArgs();
94 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
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();
110 OUString
aString( mpView
->GetDescriptionOfMarkedObjects() );
111 aString
+= " " + SD_RESSTR( STR_TRANSFORM
);
112 mpView
->BegUndo( aString
);
114 mpView
->SetGeoAttrToMarked( *pArgs
);
115 mpView
->SetAttributes( *pArgs
);
121 } // end of namespace sd
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */