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