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