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