xref: /trunk/main/sc/source/ui/drawfunc/drawsh5.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sc.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir //------------------------------------------------------------------
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <editeng/eeitem.hxx>
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
38*cdf0e10cSrcweir #include <sfx2/request.hxx>
39*cdf0e10cSrcweir #include <sfx2/bindings.hxx>
40*cdf0e10cSrcweir #include <tools/urlobj.hxx>
41*cdf0e10cSrcweir //CHINA001 #include <svx/dlgname.hxx>
42*cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001
43*cdf0e10cSrcweir #include <svx/dialogs.hrc> //CHINA001
44*cdf0e10cSrcweir #include <svx/fmglob.hxx>
45*cdf0e10cSrcweir #include <svx/hlnkitem.hxx>
46*cdf0e10cSrcweir #include <svx/fontwork.hxx>
47*cdf0e10cSrcweir #include <svx/svdocapt.hxx>
48*cdf0e10cSrcweir #include <svx/svdoole2.hxx>
49*cdf0e10cSrcweir #include <svx/svdouno.hxx>
50*cdf0e10cSrcweir #include <svx/svdpage.hxx>
51*cdf0e10cSrcweir #include <svx/svdundo.hxx>
52*cdf0e10cSrcweir #include <svx/xdef.hxx>
53*cdf0e10cSrcweir #include <svx/xftsfit.hxx>
54*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
55*cdf0e10cSrcweir #include <svx/extrusionbar.hxx>
56*cdf0e10cSrcweir #include <svx/fontworkbar.hxx>
57*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir #include <com/sun/star/form/FormButtonType.hpp>
60*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
61*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp>
62*cdf0e10cSrcweir #include <com/sun/star/awt/XControlModel.hpp>
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir #include "drawsh.hxx"
65*cdf0e10cSrcweir #include "drawview.hxx"
66*cdf0e10cSrcweir #include "viewdata.hxx"
67*cdf0e10cSrcweir #include "tabvwsh.hxx"
68*cdf0e10cSrcweir #include "docsh.hxx"
69*cdf0e10cSrcweir //CHINA001 #include "strindlg.hxx"
70*cdf0e10cSrcweir #include "scresid.hxx"
71*cdf0e10cSrcweir #include "undotab.hxx"
72*cdf0e10cSrcweir #include "drwlayer.hxx"
73*cdf0e10cSrcweir #include "userdat.hxx"
74*cdf0e10cSrcweir #include "postit.hxx"
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir #include "sc.hrc"
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir using namespace com::sun::star;
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir //------------------------------------------------------------------
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir void ScDrawShell::GetHLinkState( SfxItemSet& rSet )             //  Hyperlink
83*cdf0e10cSrcweir {
84*cdf0e10cSrcweir     ScDrawView* pView = pViewData->GetScDrawView();
85*cdf0e10cSrcweir     const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
86*cdf0e10cSrcweir     sal_uLong nMarkCount = rMarkList.GetMarkCount();
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir         //  Hyperlink
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir     SvxHyperlinkItem aHLinkItem;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     if ( nMarkCount == 1 )              // URL-Button markiert ?
93*cdf0e10cSrcweir     {
94*cdf0e10cSrcweir         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
95*cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
96*cdf0e10cSrcweir         ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
97*cdf0e10cSrcweir         if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
98*cdf0e10cSrcweir         {
99*cdf0e10cSrcweir             aHLinkItem.SetURL( pInfo->GetHlink() );
100*cdf0e10cSrcweir             aHLinkItem.SetInsertMode(HLINK_FIELD);
101*cdf0e10cSrcweir         }
102*cdf0e10cSrcweir #endif
103*cdf0e10cSrcweir         SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj);
104*cdf0e10cSrcweir         if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
105*cdf0e10cSrcweir         {
106*cdf0e10cSrcweir             uno::Reference<awt::XControlModel> xControlModel = pUnoCtrl->GetUnoControlModel();
107*cdf0e10cSrcweir             DBG_ASSERT( xControlModel.is(), "UNO-Control ohne Model" );
108*cdf0e10cSrcweir             if( !xControlModel.is() )
109*cdf0e10cSrcweir                 return;
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
112*cdf0e10cSrcweir             uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir             rtl::OUString sPropButtonType  = rtl::OUString::createFromAscii( "ButtonType" );
115*cdf0e10cSrcweir             rtl::OUString sPropTargetURL   = rtl::OUString::createFromAscii( "TargetURL" );
116*cdf0e10cSrcweir             rtl::OUString sPropTargetFrame = rtl::OUString::createFromAscii( "TargetFrame" );
117*cdf0e10cSrcweir             rtl::OUString sPropLabel       = rtl::OUString::createFromAscii( "Label" );
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir             if(xInfo->hasPropertyByName( sPropButtonType ))
120*cdf0e10cSrcweir             {
121*cdf0e10cSrcweir                 uno::Any aAny = xPropSet->getPropertyValue( sPropButtonType );
122*cdf0e10cSrcweir                 form::FormButtonType eTmp;
123*cdf0e10cSrcweir                 if ( (aAny >>= eTmp) && eTmp == form::FormButtonType_URL )
124*cdf0e10cSrcweir                 {
125*cdf0e10cSrcweir                     rtl::OUString sTmp;
126*cdf0e10cSrcweir                     // Label
127*cdf0e10cSrcweir                     if(xInfo->hasPropertyByName( sPropLabel ))
128*cdf0e10cSrcweir                     {
129*cdf0e10cSrcweir                         aAny = xPropSet->getPropertyValue( sPropLabel );
130*cdf0e10cSrcweir                         if ( (aAny >>= sTmp) && sTmp.getLength() )
131*cdf0e10cSrcweir                         {
132*cdf0e10cSrcweir                             aHLinkItem.SetName(sTmp);
133*cdf0e10cSrcweir                         }
134*cdf0e10cSrcweir                     }
135*cdf0e10cSrcweir                     // URL
136*cdf0e10cSrcweir                     if(xInfo->hasPropertyByName( sPropTargetURL ))
137*cdf0e10cSrcweir                     {
138*cdf0e10cSrcweir                         aAny = xPropSet->getPropertyValue( sPropTargetURL );
139*cdf0e10cSrcweir                         if ( (aAny >>= sTmp) && sTmp.getLength() )
140*cdf0e10cSrcweir                         {
141*cdf0e10cSrcweir                             aHLinkItem.SetURL(sTmp);
142*cdf0e10cSrcweir                         }
143*cdf0e10cSrcweir                     }
144*cdf0e10cSrcweir                     // Target
145*cdf0e10cSrcweir                     if(xInfo->hasPropertyByName( sPropTargetFrame ))
146*cdf0e10cSrcweir                     {
147*cdf0e10cSrcweir                         aAny = xPropSet->getPropertyValue( sPropTargetFrame );
148*cdf0e10cSrcweir                         if ( (aAny >>= sTmp) && sTmp.getLength() )
149*cdf0e10cSrcweir                         {
150*cdf0e10cSrcweir                             aHLinkItem.SetTargetFrame(sTmp);
151*cdf0e10cSrcweir                         }
152*cdf0e10cSrcweir                     }
153*cdf0e10cSrcweir                     aHLinkItem.SetInsertMode(HLINK_BUTTON);
154*cdf0e10cSrcweir                 }
155*cdf0e10cSrcweir             }
156*cdf0e10cSrcweir         }
157*cdf0e10cSrcweir     }
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir     rSet.Put(aHLinkItem);
160*cdf0e10cSrcweir }
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir void ScDrawShell::ExecuteHLink( SfxRequest& rReq )
163*cdf0e10cSrcweir {
164*cdf0e10cSrcweir     const SfxItemSet* pReqArgs = rReq.GetArgs();
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir     sal_uInt16 nSlot = rReq.GetSlot();
167*cdf0e10cSrcweir     switch ( nSlot )
168*cdf0e10cSrcweir     {
169*cdf0e10cSrcweir         case SID_HYPERLINK_SETLINK:
170*cdf0e10cSrcweir             if( pReqArgs )
171*cdf0e10cSrcweir             {
172*cdf0e10cSrcweir                 const SfxPoolItem* pItem;
173*cdf0e10cSrcweir                 if ( pReqArgs->GetItemState( SID_HYPERLINK_SETLINK, sal_True, &pItem ) == SFX_ITEM_SET )
174*cdf0e10cSrcweir                 {
175*cdf0e10cSrcweir                     const SvxHyperlinkItem* pHyper = (const SvxHyperlinkItem*) pItem;
176*cdf0e10cSrcweir                     const String& rName     = pHyper->GetName();
177*cdf0e10cSrcweir                     const String& rURL      = pHyper->GetURL();
178*cdf0e10cSrcweir                     const String& rTarget   = pHyper->GetTargetFrame();
179*cdf0e10cSrcweir                     SvxLinkInsertMode eMode = pHyper->GetInsertMode();
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir                     sal_Bool bDone = sal_False;
182*cdf0e10cSrcweir                     if ( eMode == HLINK_FIELD || eMode == HLINK_BUTTON )
183*cdf0e10cSrcweir                     {
184*cdf0e10cSrcweir                         ScDrawView* pView = pViewData->GetScDrawView();
185*cdf0e10cSrcweir                         const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
186*cdf0e10cSrcweir                         if ( rMarkList.GetMarkCount() == 1 )
187*cdf0e10cSrcweir                         {
188*cdf0e10cSrcweir                             SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
189*cdf0e10cSrcweir                             SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, pObj );
190*cdf0e10cSrcweir                             if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
191*cdf0e10cSrcweir                             {
192*cdf0e10cSrcweir                                 uno::Reference<awt::XControlModel> xControlModel =
193*cdf0e10cSrcweir                                                         pUnoCtrl->GetUnoControlModel();
194*cdf0e10cSrcweir                                 DBG_ASSERT( xControlModel.is(), "UNO-Control ohne Model" );
195*cdf0e10cSrcweir                                 if( !xControlModel.is() )
196*cdf0e10cSrcweir                                     return;
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir                                 uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
199*cdf0e10cSrcweir                                 uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir                                 rtl::OUString sPropTargetURL =
202*cdf0e10cSrcweir                                     rtl::OUString::createFromAscii( "TargetURL" );
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir                                 // Darf man eine URL an dem Objekt setzen?
205*cdf0e10cSrcweir                                 if (xInfo->hasPropertyByName( sPropTargetURL ))
206*cdf0e10cSrcweir                                 {
207*cdf0e10cSrcweir                                     // Ja!
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir                                     rtl::OUString sPropButtonType =
210*cdf0e10cSrcweir                                         rtl::OUString::createFromAscii( "ButtonType" );
211*cdf0e10cSrcweir                                     rtl::OUString sPropTargetFrame =
212*cdf0e10cSrcweir                                         rtl::OUString::createFromAscii( "TargetFrame" );
213*cdf0e10cSrcweir                                     rtl::OUString sPropLabel =
214*cdf0e10cSrcweir                                         rtl::OUString::createFromAscii( "Label" );
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir                                     uno::Any aAny;
217*cdf0e10cSrcweir                                     if ( xInfo->hasPropertyByName( sPropLabel ) )
218*cdf0e10cSrcweir                                     {
219*cdf0e10cSrcweir                                         aAny <<= rtl::OUString(rName);
220*cdf0e10cSrcweir                                         xPropSet->setPropertyValue( sPropLabel, aAny );
221*cdf0e10cSrcweir                                     }
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir                                     ::rtl::OUString aTmp = INetURLObject::GetAbsURL( pViewData->GetDocShell()->GetMedium()->GetBaseURL(), rURL );
224*cdf0e10cSrcweir                                     aAny <<= aTmp;
225*cdf0e10cSrcweir                                     xPropSet->setPropertyValue( sPropTargetURL, aAny );
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir                                     if( rTarget.Len() && xInfo->hasPropertyByName( sPropTargetFrame ) )
228*cdf0e10cSrcweir                                     {
229*cdf0e10cSrcweir                                         aAny <<= rtl::OUString(rTarget);
230*cdf0e10cSrcweir                                         xPropSet->setPropertyValue( sPropTargetFrame, aAny );
231*cdf0e10cSrcweir                                     }
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir                                     if ( xInfo->hasPropertyByName( sPropButtonType ) )
234*cdf0e10cSrcweir                                     {
235*cdf0e10cSrcweir                                         form::FormButtonType eButtonType = form::FormButtonType_URL;
236*cdf0e10cSrcweir                                         aAny <<= eButtonType;
237*cdf0e10cSrcweir                                         xPropSet->setPropertyValue( sPropButtonType, aAny );
238*cdf0e10cSrcweir                                     }
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir                                     //! Undo ???
241*cdf0e10cSrcweir                                     pViewData->GetDocShell()->SetDocumentModified();
242*cdf0e10cSrcweir                                     bDone = sal_True;
243*cdf0e10cSrcweir                                 }
244*cdf0e10cSrcweir                             }
245*cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
246*cdf0e10cSrcweir                             else
247*cdf0e10cSrcweir                             {
248*cdf0e10cSrcweir                                 SetHlinkForObject( pObj, rURL );
249*cdf0e10cSrcweir                                 bDone = sal_True;
250*cdf0e10cSrcweir                             }
251*cdf0e10cSrcweir #endif
252*cdf0e10cSrcweir                         }
253*cdf0e10cSrcweir                     }
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir                     if (!bDone)
256*cdf0e10cSrcweir                         pViewData->GetViewShell()->
257*cdf0e10cSrcweir                             InsertURL( rName, rURL, rTarget, (sal_uInt16) eMode );
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir                     //  InsertURL an der ViewShell schaltet bei "Text" die DrawShell ab !!!
260*cdf0e10cSrcweir                 }
261*cdf0e10cSrcweir             }
262*cdf0e10cSrcweir             break;
263*cdf0e10cSrcweir         default:
264*cdf0e10cSrcweir             DBG_ERROR("falscher Slot");
265*cdf0e10cSrcweir     }
266*cdf0e10cSrcweir }
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir sal_uInt16 ScGetFontWorkId();       // wegen CLOOKs - in drtxtob2
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir //------------------------------------------------------------------
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir //
273*cdf0e10cSrcweir //          Funktionen auf Drawing-Objekten
274*cdf0e10cSrcweir //
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
277*cdf0e10cSrcweir {
278*cdf0e10cSrcweir     SfxBindings& rBindings = pViewData->GetBindings();
279*cdf0e10cSrcweir     ScTabView*   pTabView  = pViewData->GetView();
280*cdf0e10cSrcweir     ScDrawView*  pView     = pTabView->GetScDrawView();
281*cdf0e10cSrcweir     const SfxItemSet *pArgs = rReq.GetArgs();
282*cdf0e10cSrcweir     sal_uInt16 nSlotId = rReq.GetSlot();
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir     //!!!
285*cdf0e10cSrcweir     // wer weiss, wie lange das funktioniert? (->vom Abreisscontrol funktioniert es)
286*cdf0e10cSrcweir     //
287*cdf0e10cSrcweir     if (nSlotId == SID_OBJECT_ALIGN && pArgs)
288*cdf0e10cSrcweir         nSlotId = SID_OBJECT_ALIGN + ((SfxEnumItem&)pArgs->Get(SID_OBJECT_ALIGN)).GetValue() + 1;
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir     switch (nSlotId)
291*cdf0e10cSrcweir     {
292*cdf0e10cSrcweir         case SID_OBJECT_HEAVEN:
293*cdf0e10cSrcweir             pView->SetMarkedToLayer( SC_LAYER_FRONT );
294*cdf0e10cSrcweir             rBindings.Invalidate(SID_OBJECT_HEAVEN);
295*cdf0e10cSrcweir             rBindings.Invalidate(SID_OBJECT_HELL);
296*cdf0e10cSrcweir             break;
297*cdf0e10cSrcweir         case SID_OBJECT_HELL:
298*cdf0e10cSrcweir             pView->SetMarkedToLayer( SC_LAYER_BACK );
299*cdf0e10cSrcweir             rBindings.Invalidate(SID_OBJECT_HEAVEN);
300*cdf0e10cSrcweir             rBindings.Invalidate(SID_OBJECT_HELL);
301*cdf0e10cSrcweir             //  leave draw shell if nothing selected (layer may be locked)
302*cdf0e10cSrcweir             pViewData->GetViewShell()->UpdateDrawShell();
303*cdf0e10cSrcweir             break;
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir         case SID_FRAME_TO_TOP:
306*cdf0e10cSrcweir             pView->PutMarkedToTop();
307*cdf0e10cSrcweir             break;
308*cdf0e10cSrcweir         case SID_FRAME_TO_BOTTOM:
309*cdf0e10cSrcweir             pView->PutMarkedToBtm();
310*cdf0e10cSrcweir             break;
311*cdf0e10cSrcweir         case SID_FRAME_UP:
312*cdf0e10cSrcweir             pView->MovMarkedToTop();
313*cdf0e10cSrcweir             break;
314*cdf0e10cSrcweir         case SID_FRAME_DOWN:
315*cdf0e10cSrcweir             pView->MovMarkedToBtm();
316*cdf0e10cSrcweir             break;
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir         case SID_GROUP:
319*cdf0e10cSrcweir             pView->GroupMarked();
320*cdf0e10cSrcweir             break;
321*cdf0e10cSrcweir         case SID_UNGROUP:
322*cdf0e10cSrcweir             pView->UnGroupMarked();
323*cdf0e10cSrcweir             break;
324*cdf0e10cSrcweir         case SID_ENTER_GROUP:
325*cdf0e10cSrcweir             pView->EnterMarkedGroup();
326*cdf0e10cSrcweir             break;
327*cdf0e10cSrcweir         case SID_LEAVE_GROUP:
328*cdf0e10cSrcweir             pView->LeaveOneGroup();
329*cdf0e10cSrcweir             break;
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir         case SID_MIRROR_HORIZONTAL:
332*cdf0e10cSrcweir             pView->MirrorAllMarkedHorizontal();
333*cdf0e10cSrcweir             break;
334*cdf0e10cSrcweir         case SID_MIRROR_VERTICAL:
335*cdf0e10cSrcweir             pView->MirrorAllMarkedVertical();
336*cdf0e10cSrcweir             break;
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir         case SID_OBJECT_ALIGN_LEFT:
339*cdf0e10cSrcweir         case SID_ALIGN_ANY_LEFT:
340*cdf0e10cSrcweir             if (pView->IsAlignPossible())
341*cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE);
342*cdf0e10cSrcweir             break;
343*cdf0e10cSrcweir         case SID_OBJECT_ALIGN_CENTER:
344*cdf0e10cSrcweir         case SID_ALIGN_ANY_HCENTER:
345*cdf0e10cSrcweir             if (pView->IsAlignPossible())
346*cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE);
347*cdf0e10cSrcweir             break;
348*cdf0e10cSrcweir         case SID_OBJECT_ALIGN_RIGHT:
349*cdf0e10cSrcweir         case SID_ALIGN_ANY_RIGHT:
350*cdf0e10cSrcweir             if (pView->IsAlignPossible())
351*cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE);
352*cdf0e10cSrcweir             break;
353*cdf0e10cSrcweir         case SID_OBJECT_ALIGN_UP:
354*cdf0e10cSrcweir         case SID_ALIGN_ANY_TOP:
355*cdf0e10cSrcweir             if (pView->IsAlignPossible())
356*cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP);
357*cdf0e10cSrcweir             break;
358*cdf0e10cSrcweir         case SID_OBJECT_ALIGN_MIDDLE:
359*cdf0e10cSrcweir         case SID_ALIGN_ANY_VCENTER:
360*cdf0e10cSrcweir             if (pView->IsAlignPossible())
361*cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER);
362*cdf0e10cSrcweir             break;
363*cdf0e10cSrcweir         case SID_OBJECT_ALIGN_DOWN:
364*cdf0e10cSrcweir         case SID_ALIGN_ANY_BOTTOM:
365*cdf0e10cSrcweir             if (pView->IsAlignPossible())
366*cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM);
367*cdf0e10cSrcweir             break;
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir         case SID_DELETE:
370*cdf0e10cSrcweir         case SID_DELETE_CONTENTS:
371*cdf0e10cSrcweir             pView->DeleteMarked();
372*cdf0e10cSrcweir             pViewData->GetViewShell()->UpdateDrawShell();
373*cdf0e10cSrcweir         break;
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir         case SID_CUT:
376*cdf0e10cSrcweir             pView->DoCut();
377*cdf0e10cSrcweir             pViewData->GetViewShell()->UpdateDrawShell();
378*cdf0e10cSrcweir             break;
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir         case SID_COPY:
381*cdf0e10cSrcweir             pView->DoCopy();
382*cdf0e10cSrcweir             break;
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir         case SID_PASTE:
385*cdf0e10cSrcweir             DBG_ERROR( "SdrView::PasteClipboard not supported anymore" );
386*cdf0e10cSrcweir             // pView->PasteClipboard( pWin );
387*cdf0e10cSrcweir             break;
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir         case SID_SELECTALL:
390*cdf0e10cSrcweir             pView->MarkAll();
391*cdf0e10cSrcweir             break;
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir         case SID_ANCHOR_PAGE:
394*cdf0e10cSrcweir             pView->SetAnchor( SCA_PAGE );
395*cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_PAGE );
396*cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_CELL );
397*cdf0e10cSrcweir             break;
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir         case SID_ANCHOR_CELL:
400*cdf0e10cSrcweir             pView->SetAnchor( SCA_CELL );
401*cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_PAGE );
402*cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_CELL );
403*cdf0e10cSrcweir             break;
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir         case SID_ANCHOR_TOGGLE:
406*cdf0e10cSrcweir             {
407*cdf0e10cSrcweir                 switch( pView->GetAnchor() )
408*cdf0e10cSrcweir                 {
409*cdf0e10cSrcweir                     case SCA_CELL:
410*cdf0e10cSrcweir                     pView->SetAnchor( SCA_PAGE );
411*cdf0e10cSrcweir                     break;
412*cdf0e10cSrcweir                     default:
413*cdf0e10cSrcweir                     pView->SetAnchor( SCA_CELL );
414*cdf0e10cSrcweir                     break;
415*cdf0e10cSrcweir                 }
416*cdf0e10cSrcweir             }
417*cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_PAGE );
418*cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_CELL );
419*cdf0e10cSrcweir             break;
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir         case SID_OBJECT_ROTATE:
422*cdf0e10cSrcweir             {
423*cdf0e10cSrcweir                 SdrDragMode eMode;
424*cdf0e10cSrcweir                 if (pView->GetDragMode() == SDRDRAG_ROTATE)
425*cdf0e10cSrcweir                     eMode = SDRDRAG_MOVE;
426*cdf0e10cSrcweir                 else
427*cdf0e10cSrcweir                     eMode = SDRDRAG_ROTATE;
428*cdf0e10cSrcweir                 pView->SetDragMode( eMode );
429*cdf0e10cSrcweir                 rBindings.Invalidate( SID_OBJECT_ROTATE );
430*cdf0e10cSrcweir                 rBindings.Invalidate( SID_OBJECT_MIRROR );
431*cdf0e10cSrcweir                 if (eMode == SDRDRAG_ROTATE && !pView->IsFrameDragSingles())
432*cdf0e10cSrcweir                 {
433*cdf0e10cSrcweir                     pView->SetFrameDragSingles( sal_True );
434*cdf0e10cSrcweir                     rBindings.Invalidate( SID_BEZIER_EDIT );
435*cdf0e10cSrcweir                 }
436*cdf0e10cSrcweir             }
437*cdf0e10cSrcweir             break;
438*cdf0e10cSrcweir         case SID_OBJECT_MIRROR:
439*cdf0e10cSrcweir             {
440*cdf0e10cSrcweir                 SdrDragMode eMode;
441*cdf0e10cSrcweir                 if (pView->GetDragMode() == SDRDRAG_MIRROR)
442*cdf0e10cSrcweir                     eMode = SDRDRAG_MOVE;
443*cdf0e10cSrcweir                 else
444*cdf0e10cSrcweir                     eMode = SDRDRAG_MIRROR;
445*cdf0e10cSrcweir                 pView->SetDragMode( eMode );
446*cdf0e10cSrcweir                 rBindings.Invalidate( SID_OBJECT_ROTATE );
447*cdf0e10cSrcweir                 rBindings.Invalidate( SID_OBJECT_MIRROR );
448*cdf0e10cSrcweir                 if (eMode == SDRDRAG_MIRROR && !pView->IsFrameDragSingles())
449*cdf0e10cSrcweir                 {
450*cdf0e10cSrcweir                     pView->SetFrameDragSingles( sal_True );
451*cdf0e10cSrcweir                     rBindings.Invalidate( SID_BEZIER_EDIT );
452*cdf0e10cSrcweir                 }
453*cdf0e10cSrcweir             }
454*cdf0e10cSrcweir             break;
455*cdf0e10cSrcweir         case SID_BEZIER_EDIT:
456*cdf0e10cSrcweir             {
457*cdf0e10cSrcweir                 sal_Bool bOld = pView->IsFrameDragSingles();
458*cdf0e10cSrcweir                 pView->SetFrameDragSingles( !bOld );
459*cdf0e10cSrcweir                 rBindings.Invalidate( SID_BEZIER_EDIT );
460*cdf0e10cSrcweir                 if (bOld && pView->GetDragMode() != SDRDRAG_MOVE)
461*cdf0e10cSrcweir                 {
462*cdf0e10cSrcweir                     pView->SetDragMode( SDRDRAG_MOVE );
463*cdf0e10cSrcweir                     rBindings.Invalidate( SID_OBJECT_ROTATE );
464*cdf0e10cSrcweir                     rBindings.Invalidate( SID_OBJECT_MIRROR );
465*cdf0e10cSrcweir                 }
466*cdf0e10cSrcweir             }
467*cdf0e10cSrcweir             break;
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir         case SID_FONTWORK:
470*cdf0e10cSrcweir         {
471*cdf0e10cSrcweir             sal_uInt16 nId = ScGetFontWorkId();
472*cdf0e10cSrcweir             SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir             if ( rReq.GetArgs() )
475*cdf0e10cSrcweir                 pViewFrm->SetChildWindow( nId,
476*cdf0e10cSrcweir                                            ((const SfxBoolItem&)
477*cdf0e10cSrcweir                                             (rReq.GetArgs()->Get(SID_FONTWORK))).
478*cdf0e10cSrcweir                                                 GetValue() );
479*cdf0e10cSrcweir             else
480*cdf0e10cSrcweir                 pViewFrm->ToggleChildWindow( nId );
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir             rBindings.Invalidate( SID_FONTWORK );
483*cdf0e10cSrcweir             rReq.Done();
484*cdf0e10cSrcweir         }
485*cdf0e10cSrcweir         break;
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir         case SID_ORIGINALSIZE:
488*cdf0e10cSrcweir             pView->SetMarkedOriginalSize();
489*cdf0e10cSrcweir             break;
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir         case SID_ENABLE_HYPHENATION:
492*cdf0e10cSrcweir             {
493*cdf0e10cSrcweir                 SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, SID_ENABLE_HYPHENATION, sal_False);
494*cdf0e10cSrcweir                 if( pItem )
495*cdf0e10cSrcweir                 {
496*cdf0e10cSrcweir                     SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
497*cdf0e10cSrcweir                     sal_Bool bValue = ( (const SfxBoolItem*) pItem)->GetValue();
498*cdf0e10cSrcweir                     aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
499*cdf0e10cSrcweir                     pView->SetAttributes( aSet );
500*cdf0e10cSrcweir                 }
501*cdf0e10cSrcweir                 rReq.Done();
502*cdf0e10cSrcweir             }
503*cdf0e10cSrcweir             break;
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir         case SID_RENAME_OBJECT:
506*cdf0e10cSrcweir             {
507*cdf0e10cSrcweir                 if(1L == pView->GetMarkedObjectCount())
508*cdf0e10cSrcweir                 {
509*cdf0e10cSrcweir                     // #i68101#
510*cdf0e10cSrcweir                     SdrObject* pSelected = pView->GetMarkedObjectByIndex(0L);
511*cdf0e10cSrcweir                     OSL_ENSURE(pSelected, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir                     if(SC_LAYER_INTERN != pSelected->GetLayer())
514*cdf0e10cSrcweir                     {
515*cdf0e10cSrcweir                         String aName(pSelected->GetName());
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir                         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
518*cdf0e10cSrcweir                         OSL_ENSURE(pFact, "Dialogdiet fail!");
519*cdf0e10cSrcweir                         AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName);
520*cdf0e10cSrcweir                         OSL_ENSURE(pDlg, "Dialogdiet fail!");
521*cdf0e10cSrcweir 
522*cdf0e10cSrcweir                         pDlg->SetCheckNameHdl(LINK(this, ScDrawShell, NameObjectHdl));
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir                         if(RET_OK == pDlg->Execute())
525*cdf0e10cSrcweir                         {
526*cdf0e10cSrcweir                             ScDocShell* pDocSh = pViewData->GetDocShell();
527*cdf0e10cSrcweir                             pDlg->GetName(aName);
528*cdf0e10cSrcweir 
529*cdf0e10cSrcweir                             if(aName != pSelected->GetName())
530*cdf0e10cSrcweir                             {
531*cdf0e10cSrcweir                                 // handle name change
532*cdf0e10cSrcweir                                 const sal_uInt16 nObjType(pSelected->GetObjIdentifier());
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir                                 if(OBJ_GRAF == nObjType && 0L == aName.Len())
535*cdf0e10cSrcweir                                 {
536*cdf0e10cSrcweir                                     //  graphics objects must have names
537*cdf0e10cSrcweir                                     //  (all graphics are supposed to be in the navigator)
538*cdf0e10cSrcweir                                     ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer();
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir                                     if(pModel)
541*cdf0e10cSrcweir                                     {
542*cdf0e10cSrcweir                                         aName = pModel->GetNewGraphicName();
543*cdf0e10cSrcweir                                     }
544*cdf0e10cSrcweir                                 }
545*cdf0e10cSrcweir 
546*cdf0e10cSrcweir                                 //  An undo action for renaming is missing in svdraw (99363).
547*cdf0e10cSrcweir                                 //  For OLE objects (which can be identified using the persist name),
548*cdf0e10cSrcweir                                 //  ScUndoRenameObject can be used until there is a common action for all objects.
549*cdf0e10cSrcweir                                 if(OBJ_OLE2 == nObjType)
550*cdf0e10cSrcweir                                 {
551*cdf0e10cSrcweir                                     const String aPersistName = static_cast<SdrOle2Obj*>(pSelected)->GetPersistName();
552*cdf0e10cSrcweir 
553*cdf0e10cSrcweir                                     if(aPersistName.Len())
554*cdf0e10cSrcweir                                     {
555*cdf0e10cSrcweir                                         pDocSh->GetUndoManager()->AddUndoAction(
556*cdf0e10cSrcweir                                             new ScUndoRenameObject(pDocSh, aPersistName, pSelected->GetName(), aName));
557*cdf0e10cSrcweir                                     }
558*cdf0e10cSrcweir                                 }
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir                                 // set new name
561*cdf0e10cSrcweir                                 pSelected->SetName(aName);
562*cdf0e10cSrcweir                             }
563*cdf0e10cSrcweir 
564*cdf0e10cSrcweir                             // ChartListenerCollectionNeedsUpdate is needed for Navigator update
565*cdf0e10cSrcweir                             pDocSh->GetDocument()->SetChartListenerCollectionNeedsUpdate( sal_True );
566*cdf0e10cSrcweir                             pDocSh->SetDrawModified();
567*cdf0e10cSrcweir                         }
568*cdf0e10cSrcweir 
569*cdf0e10cSrcweir                         delete pDlg;
570*cdf0e10cSrcweir                     }
571*cdf0e10cSrcweir                 }
572*cdf0e10cSrcweir                 break;
573*cdf0e10cSrcweir             }
574*cdf0e10cSrcweir 
575*cdf0e10cSrcweir         // #i68101#
576*cdf0e10cSrcweir         case SID_TITLE_DESCRIPTION_OBJECT:
577*cdf0e10cSrcweir             {
578*cdf0e10cSrcweir                 if(1L == pView->GetMarkedObjectCount())
579*cdf0e10cSrcweir                 {
580*cdf0e10cSrcweir                     SdrObject* pSelected = pView->GetMarkedObjectByIndex(0L);
581*cdf0e10cSrcweir                     OSL_ENSURE(pSelected, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir                     if(SC_LAYER_INTERN != pSelected->GetLayer())
584*cdf0e10cSrcweir                     {
585*cdf0e10cSrcweir                         String aTitle(pSelected->GetTitle());
586*cdf0e10cSrcweir                         String aDescription(pSelected->GetDescription());
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir                         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
589*cdf0e10cSrcweir                         OSL_ENSURE(pFact, "Dialogdiet fail!");
590*cdf0e10cSrcweir                         AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription);
591*cdf0e10cSrcweir                         OSL_ENSURE(pDlg, "Dialogdiet fail!");
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir                         if(RET_OK == pDlg->Execute())
594*cdf0e10cSrcweir                         {
595*cdf0e10cSrcweir                             ScDocShell* pDocSh = pViewData->GetDocShell();
596*cdf0e10cSrcweir 
597*cdf0e10cSrcweir                             // handle Title and Description
598*cdf0e10cSrcweir                             pDlg->GetTitle(aTitle);
599*cdf0e10cSrcweir                             pDlg->GetDescription(aDescription);
600*cdf0e10cSrcweir                             pSelected->SetTitle(aTitle);
601*cdf0e10cSrcweir                             pSelected->SetDescription(aDescription);
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir                             // ChartListenerCollectionNeedsUpdate is needed for Navigator update
604*cdf0e10cSrcweir                             pDocSh->GetDocument()->SetChartListenerCollectionNeedsUpdate( sal_True );
605*cdf0e10cSrcweir                             pDocSh->SetDrawModified();
606*cdf0e10cSrcweir                         }
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir                         delete pDlg;
609*cdf0e10cSrcweir                     }
610*cdf0e10cSrcweir                 }
611*cdf0e10cSrcweir                 break;
612*cdf0e10cSrcweir             }
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir         case SID_EXTRUSION_TOOGLE:
615*cdf0e10cSrcweir         case SID_EXTRUSION_TILT_DOWN:
616*cdf0e10cSrcweir         case SID_EXTRUSION_TILT_UP:
617*cdf0e10cSrcweir         case SID_EXTRUSION_TILT_LEFT:
618*cdf0e10cSrcweir         case SID_EXTRUSION_TILT_RIGHT:
619*cdf0e10cSrcweir         case SID_EXTRUSION_3D_COLOR:
620*cdf0e10cSrcweir         case SID_EXTRUSION_DEPTH:
621*cdf0e10cSrcweir         case SID_EXTRUSION_DIRECTION:
622*cdf0e10cSrcweir         case SID_EXTRUSION_PROJECTION:
623*cdf0e10cSrcweir         case SID_EXTRUSION_LIGHTING_DIRECTION:
624*cdf0e10cSrcweir         case SID_EXTRUSION_LIGHTING_INTENSITY:
625*cdf0e10cSrcweir         case SID_EXTRUSION_SURFACE:
626*cdf0e10cSrcweir         case SID_EXTRUSION_DEPTH_FLOATER:
627*cdf0e10cSrcweir         case SID_EXTRUSION_DIRECTION_FLOATER:
628*cdf0e10cSrcweir         case SID_EXTRUSION_LIGHTING_FLOATER:
629*cdf0e10cSrcweir         case SID_EXTRUSION_SURFACE_FLOATER:
630*cdf0e10cSrcweir         case SID_EXTRUSION_DEPTH_DIALOG:
631*cdf0e10cSrcweir             svx::ExtrusionBar::execute( pView, rReq, rBindings );
632*cdf0e10cSrcweir             rReq.Ignore ();
633*cdf0e10cSrcweir             break;
634*cdf0e10cSrcweir 
635*cdf0e10cSrcweir         case SID_FONTWORK_SHAPE:
636*cdf0e10cSrcweir         case SID_FONTWORK_SHAPE_TYPE:
637*cdf0e10cSrcweir         case SID_FONTWORK_ALIGNMENT:
638*cdf0e10cSrcweir         case SID_FONTWORK_SAME_LETTER_HEIGHTS:
639*cdf0e10cSrcweir         case SID_FONTWORK_CHARACTER_SPACING:
640*cdf0e10cSrcweir         case SID_FONTWORK_KERN_CHARACTER_PAIRS:
641*cdf0e10cSrcweir         case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
642*cdf0e10cSrcweir         case SID_FONTWORK_ALIGNMENT_FLOATER:
643*cdf0e10cSrcweir         case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
644*cdf0e10cSrcweir             svx::FontworkBar::execute( pView, rReq, rBindings );
645*cdf0e10cSrcweir             rReq.Ignore ();
646*cdf0e10cSrcweir             break;
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir         default:
649*cdf0e10cSrcweir             break;
650*cdf0e10cSrcweir     }
651*cdf0e10cSrcweir }
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir IMPL_LINK( ScDrawShell, NameObjectHdl, AbstractSvxNameDialog*, pDialog )
654*cdf0e10cSrcweir {
655*cdf0e10cSrcweir     String aName;
656*cdf0e10cSrcweir 
657*cdf0e10cSrcweir     if( pDialog )
658*cdf0e10cSrcweir         pDialog->GetName( aName );
659*cdf0e10cSrcweir 
660*cdf0e10cSrcweir     ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer();
661*cdf0e10cSrcweir     if ( aName.Len() && pModel )
662*cdf0e10cSrcweir     {
663*cdf0e10cSrcweir         SCTAB nDummyTab;
664*cdf0e10cSrcweir         if ( pModel->GetNamedObject( aName, 0, nDummyTab ) )
665*cdf0e10cSrcweir         {
666*cdf0e10cSrcweir             // existing object found -> name invalid
667*cdf0e10cSrcweir             return 0;
668*cdf0e10cSrcweir         }
669*cdf0e10cSrcweir     }
670*cdf0e10cSrcweir 
671*cdf0e10cSrcweir     return 1;   // name is valid
672*cdf0e10cSrcweir }
673*cdf0e10cSrcweir 
674*cdf0e10cSrcweir //------------------------------------------------------------------
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir void ScDrawShell::ExecFormText(SfxRequest& rReq)
677*cdf0e10cSrcweir {
678*cdf0e10cSrcweir     ScDrawView*         pDrView     = pViewData->GetScDrawView();
679*cdf0e10cSrcweir     const SdrMarkList&  rMarkList   = pDrView->GetMarkedObjectList();
680*cdf0e10cSrcweir 
681*cdf0e10cSrcweir     if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
682*cdf0e10cSrcweir     {
683*cdf0e10cSrcweir         const SfxItemSet& rSet = *rReq.GetArgs();
684*cdf0e10cSrcweir         const SfxPoolItem* pItem;
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir         if ( pDrView->IsTextEdit() )
687*cdf0e10cSrcweir             pDrView->ScEndTextEdit();
688*cdf0e10cSrcweir 
689*cdf0e10cSrcweir         if (    SFX_ITEM_SET ==
690*cdf0e10cSrcweir                 rSet.GetItemState(XATTR_FORMTXTSTDFORM, sal_True, &pItem)
691*cdf0e10cSrcweir              && XFTFORM_NONE !=
692*cdf0e10cSrcweir                 ((const XFormTextStdFormItem*) pItem)->GetValue() )
693*cdf0e10cSrcweir         {
694*cdf0e10cSrcweir 
695*cdf0e10cSrcweir             sal_uInt16 nId              = SvxFontWorkChildWindow::GetChildWindowId();
696*cdf0e10cSrcweir             SfxViewFrame* pViewFrm  = pViewData->GetViewShell()->GetViewFrame();
697*cdf0e10cSrcweir             SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*)
698*cdf0e10cSrcweir                                        (pViewFrm->
699*cdf0e10cSrcweir                                             GetChildWindow(nId)->GetWindow());
700*cdf0e10cSrcweir 
701*cdf0e10cSrcweir             pDlg->CreateStdFormObj(*pDrView, *pDrView->GetSdrPageView(),
702*cdf0e10cSrcweir                                     rSet, *rMarkList.GetMark(0)->GetMarkedSdrObj(),
703*cdf0e10cSrcweir                                    ((const XFormTextStdFormItem*) pItem)->
704*cdf0e10cSrcweir                                    GetValue());
705*cdf0e10cSrcweir         }
706*cdf0e10cSrcweir         else
707*cdf0e10cSrcweir             pDrView->SetAttributes(rSet);
708*cdf0e10cSrcweir     }
709*cdf0e10cSrcweir }
710*cdf0e10cSrcweir 
711*cdf0e10cSrcweir //------------------------------------------------------------------
712*cdf0e10cSrcweir 
713*cdf0e10cSrcweir void ScDrawShell::ExecFormatPaintbrush( SfxRequest& rReq )
714*cdf0e10cSrcweir {
715*cdf0e10cSrcweir     ScViewFunc* pView = pViewData->GetView();
716*cdf0e10cSrcweir     if ( pView->HasPaintBrush() )
717*cdf0e10cSrcweir     {
718*cdf0e10cSrcweir         // cancel paintbrush mode
719*cdf0e10cSrcweir         pView->ResetBrushDocument();
720*cdf0e10cSrcweir     }
721*cdf0e10cSrcweir     else
722*cdf0e10cSrcweir     {
723*cdf0e10cSrcweir         sal_Bool bLock = sal_False;
724*cdf0e10cSrcweir         const SfxItemSet *pArgs = rReq.GetArgs();
725*cdf0e10cSrcweir         if( pArgs && pArgs->Count() >= 1 )
726*cdf0e10cSrcweir             bLock = static_cast<const SfxBoolItem&>(pArgs->Get(SID_FORMATPAINTBRUSH)).GetValue();
727*cdf0e10cSrcweir 
728*cdf0e10cSrcweir         ScDrawView* pDrawView = pViewData->GetScDrawView();
729*cdf0e10cSrcweir         if ( pDrawView && pDrawView->AreObjectsMarked() )
730*cdf0e10cSrcweir         {
731*cdf0e10cSrcweir             sal_Bool bOnlyHardAttr = sal_True;
732*cdf0e10cSrcweir             SfxItemSet* pItemSet = new SfxItemSet( pDrawView->GetAttrFromMarked(bOnlyHardAttr) );
733*cdf0e10cSrcweir             pView->SetDrawBrushSet( pItemSet, bLock );
734*cdf0e10cSrcweir         }
735*cdf0e10cSrcweir     }
736*cdf0e10cSrcweir }
737*cdf0e10cSrcweir 
738*cdf0e10cSrcweir void ScDrawShell::StateFormatPaintbrush( SfxItemSet& rSet )
739*cdf0e10cSrcweir {
740*cdf0e10cSrcweir     ScDrawView* pDrawView = pViewData->GetScDrawView();
741*cdf0e10cSrcweir     sal_Bool bSelection = pDrawView && pDrawView->AreObjectsMarked();
742*cdf0e10cSrcweir     sal_Bool bHasPaintBrush = pViewData->GetView()->HasPaintBrush();
743*cdf0e10cSrcweir 
744*cdf0e10cSrcweir     if ( !bHasPaintBrush && !bSelection )
745*cdf0e10cSrcweir         rSet.DisableItem( SID_FORMATPAINTBRUSH );
746*cdf0e10cSrcweir     else
747*cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, bHasPaintBrush ) );
748*cdf0e10cSrcweir }
749*cdf0e10cSrcweir 
750*cdf0e10cSrcweir ScDrawView* ScDrawShell::GetDrawView()
751*cdf0e10cSrcweir {
752*cdf0e10cSrcweir     return pViewData->GetView()->GetScDrawView();
753*cdf0e10cSrcweir }
754*cdf0e10cSrcweir 
755*cdf0e10cSrcweir 
756*cdf0e10cSrcweir 
757*cdf0e10cSrcweir 
758