xref: /trunk/main/sc/source/ui/drawfunc/drawsh5.cxx (revision ee09355404ff3c4e10d1b74175c316c2345ff9cc)
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 <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:
328*ee093554SAndre Fischer         case SID_FLIP_HORIZONTAL:
329cdf0e10cSrcweir             pView->MirrorAllMarkedHorizontal();
330*ee093554SAndre Fischer             rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE );
331cdf0e10cSrcweir             break;
332cdf0e10cSrcweir         case SID_MIRROR_VERTICAL:
333*ee093554SAndre Fischer         case SID_FLIP_VERTICAL:
334cdf0e10cSrcweir             pView->MirrorAllMarkedVertical();
335*ee093554SAndre Fischer             rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE );
336cdf0e10cSrcweir             break;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir         case SID_OBJECT_ALIGN_LEFT:
339cdf0e10cSrcweir         case SID_ALIGN_ANY_LEFT:
340cdf0e10cSrcweir             if (pView->IsAlignPossible())
341cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE);
342cdf0e10cSrcweir             break;
343cdf0e10cSrcweir         case SID_OBJECT_ALIGN_CENTER:
344cdf0e10cSrcweir         case SID_ALIGN_ANY_HCENTER:
345cdf0e10cSrcweir             if (pView->IsAlignPossible())
346cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE);
347cdf0e10cSrcweir             break;
348cdf0e10cSrcweir         case SID_OBJECT_ALIGN_RIGHT:
349cdf0e10cSrcweir         case SID_ALIGN_ANY_RIGHT:
350cdf0e10cSrcweir             if (pView->IsAlignPossible())
351cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE);
352cdf0e10cSrcweir             break;
353cdf0e10cSrcweir         case SID_OBJECT_ALIGN_UP:
354cdf0e10cSrcweir         case SID_ALIGN_ANY_TOP:
355cdf0e10cSrcweir             if (pView->IsAlignPossible())
356cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP);
357cdf0e10cSrcweir             break;
358cdf0e10cSrcweir         case SID_OBJECT_ALIGN_MIDDLE:
359cdf0e10cSrcweir         case SID_ALIGN_ANY_VCENTER:
360cdf0e10cSrcweir             if (pView->IsAlignPossible())
361cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER);
362cdf0e10cSrcweir             break;
363cdf0e10cSrcweir         case SID_OBJECT_ALIGN_DOWN:
364cdf0e10cSrcweir         case SID_ALIGN_ANY_BOTTOM:
365cdf0e10cSrcweir             if (pView->IsAlignPossible())
366cdf0e10cSrcweir                 pView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM);
367cdf0e10cSrcweir             break;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir         case SID_DELETE:
370cdf0e10cSrcweir         case SID_DELETE_CONTENTS:
371cdf0e10cSrcweir             pView->DeleteMarked();
372cdf0e10cSrcweir             pViewData->GetViewShell()->UpdateDrawShell();
373cdf0e10cSrcweir         break;
374cdf0e10cSrcweir 
375cdf0e10cSrcweir         case SID_CUT:
376cdf0e10cSrcweir             pView->DoCut();
377cdf0e10cSrcweir             pViewData->GetViewShell()->UpdateDrawShell();
378cdf0e10cSrcweir             break;
379cdf0e10cSrcweir 
380cdf0e10cSrcweir         case SID_COPY:
381cdf0e10cSrcweir             pView->DoCopy();
382cdf0e10cSrcweir             break;
383cdf0e10cSrcweir 
384cdf0e10cSrcweir         case SID_PASTE:
385cdf0e10cSrcweir             DBG_ERROR( "SdrView::PasteClipboard not supported anymore" );
386cdf0e10cSrcweir             // pView->PasteClipboard( pWin );
387cdf0e10cSrcweir             break;
388cdf0e10cSrcweir 
389cdf0e10cSrcweir         case SID_SELECTALL:
390cdf0e10cSrcweir             pView->MarkAll();
391cdf0e10cSrcweir             break;
392cdf0e10cSrcweir 
393cdf0e10cSrcweir         case SID_ANCHOR_PAGE:
394cdf0e10cSrcweir             pView->SetAnchor( SCA_PAGE );
395cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_PAGE );
396cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_CELL );
397cdf0e10cSrcweir             break;
398cdf0e10cSrcweir 
399cdf0e10cSrcweir         case SID_ANCHOR_CELL:
400cdf0e10cSrcweir             pView->SetAnchor( SCA_CELL );
401cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_PAGE );
402cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_CELL );
403cdf0e10cSrcweir             break;
404cdf0e10cSrcweir 
405cdf0e10cSrcweir         case SID_ANCHOR_TOGGLE:
406cdf0e10cSrcweir             {
407cdf0e10cSrcweir                 switch( pView->GetAnchor() )
408cdf0e10cSrcweir                 {
409cdf0e10cSrcweir                     case SCA_CELL:
410cdf0e10cSrcweir                     pView->SetAnchor( SCA_PAGE );
411cdf0e10cSrcweir                     break;
412cdf0e10cSrcweir                     default:
413cdf0e10cSrcweir                     pView->SetAnchor( SCA_CELL );
414cdf0e10cSrcweir                     break;
415cdf0e10cSrcweir                 }
416cdf0e10cSrcweir             }
417cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_PAGE );
418cdf0e10cSrcweir             rBindings.Invalidate( SID_ANCHOR_CELL );
419cdf0e10cSrcweir             break;
420cdf0e10cSrcweir 
421cdf0e10cSrcweir         case SID_OBJECT_ROTATE:
422cdf0e10cSrcweir             {
423cdf0e10cSrcweir                 SdrDragMode eMode;
424cdf0e10cSrcweir                 if (pView->GetDragMode() == SDRDRAG_ROTATE)
425cdf0e10cSrcweir                     eMode = SDRDRAG_MOVE;
426cdf0e10cSrcweir                 else
427cdf0e10cSrcweir                     eMode = SDRDRAG_ROTATE;
428cdf0e10cSrcweir                 pView->SetDragMode( eMode );
429cdf0e10cSrcweir                 rBindings.Invalidate( SID_OBJECT_ROTATE );
430cdf0e10cSrcweir                 rBindings.Invalidate( SID_OBJECT_MIRROR );
431cdf0e10cSrcweir                 if (eMode == SDRDRAG_ROTATE && !pView->IsFrameDragSingles())
432cdf0e10cSrcweir                 {
433cdf0e10cSrcweir                     pView->SetFrameDragSingles( sal_True );
434cdf0e10cSrcweir                     rBindings.Invalidate( SID_BEZIER_EDIT );
435cdf0e10cSrcweir                 }
436cdf0e10cSrcweir             }
437cdf0e10cSrcweir             break;
438cdf0e10cSrcweir         case SID_OBJECT_MIRROR:
439cdf0e10cSrcweir             {
440cdf0e10cSrcweir                 SdrDragMode eMode;
441cdf0e10cSrcweir                 if (pView->GetDragMode() == SDRDRAG_MIRROR)
442cdf0e10cSrcweir                     eMode = SDRDRAG_MOVE;
443cdf0e10cSrcweir                 else
444cdf0e10cSrcweir                     eMode = SDRDRAG_MIRROR;
445cdf0e10cSrcweir                 pView->SetDragMode( eMode );
446cdf0e10cSrcweir                 rBindings.Invalidate( SID_OBJECT_ROTATE );
447cdf0e10cSrcweir                 rBindings.Invalidate( SID_OBJECT_MIRROR );
448cdf0e10cSrcweir                 if (eMode == SDRDRAG_MIRROR && !pView->IsFrameDragSingles())
449cdf0e10cSrcweir                 {
450cdf0e10cSrcweir                     pView->SetFrameDragSingles( sal_True );
451cdf0e10cSrcweir                     rBindings.Invalidate( SID_BEZIER_EDIT );
452cdf0e10cSrcweir                 }
453cdf0e10cSrcweir             }
454cdf0e10cSrcweir             break;
455cdf0e10cSrcweir         case SID_BEZIER_EDIT:
456cdf0e10cSrcweir             {
457cdf0e10cSrcweir                 sal_Bool bOld = pView->IsFrameDragSingles();
458cdf0e10cSrcweir                 pView->SetFrameDragSingles( !bOld );
459cdf0e10cSrcweir                 rBindings.Invalidate( SID_BEZIER_EDIT );
460cdf0e10cSrcweir                 if (bOld && pView->GetDragMode() != SDRDRAG_MOVE)
461cdf0e10cSrcweir                 {
462cdf0e10cSrcweir                     pView->SetDragMode( SDRDRAG_MOVE );
463cdf0e10cSrcweir                     rBindings.Invalidate( SID_OBJECT_ROTATE );
464cdf0e10cSrcweir                     rBindings.Invalidate( SID_OBJECT_MIRROR );
465cdf0e10cSrcweir                 }
466cdf0e10cSrcweir             }
467cdf0e10cSrcweir             break;
468cdf0e10cSrcweir 
469cdf0e10cSrcweir         case SID_FONTWORK:
470cdf0e10cSrcweir         {
471cdf0e10cSrcweir             sal_uInt16 nId = ScGetFontWorkId();
472cdf0e10cSrcweir             SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
473cdf0e10cSrcweir 
474cdf0e10cSrcweir             if ( rReq.GetArgs() )
475cdf0e10cSrcweir                 pViewFrm->SetChildWindow( nId,
476cdf0e10cSrcweir                                            ((const SfxBoolItem&)
477cdf0e10cSrcweir                                             (rReq.GetArgs()->Get(SID_FONTWORK))).
478cdf0e10cSrcweir                                                 GetValue() );
479cdf0e10cSrcweir             else
480cdf0e10cSrcweir                 pViewFrm->ToggleChildWindow( nId );
481cdf0e10cSrcweir 
482cdf0e10cSrcweir             rBindings.Invalidate( SID_FONTWORK );
483cdf0e10cSrcweir             rReq.Done();
484cdf0e10cSrcweir         }
485cdf0e10cSrcweir         break;
486cdf0e10cSrcweir 
487cdf0e10cSrcweir         case SID_ORIGINALSIZE:
488cdf0e10cSrcweir             pView->SetMarkedOriginalSize();
489cdf0e10cSrcweir             break;
490cdf0e10cSrcweir 
491cdf0e10cSrcweir         case SID_ENABLE_HYPHENATION:
492cdf0e10cSrcweir             {
493cdf0e10cSrcweir                 SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, SID_ENABLE_HYPHENATION, sal_False);
494cdf0e10cSrcweir                 if( pItem )
495cdf0e10cSrcweir                 {
496cdf0e10cSrcweir                     SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
497cdf0e10cSrcweir                     sal_Bool bValue = ( (const SfxBoolItem*) pItem)->GetValue();
498cdf0e10cSrcweir                     aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
499cdf0e10cSrcweir                     pView->SetAttributes( aSet );
500cdf0e10cSrcweir                 }
501cdf0e10cSrcweir                 rReq.Done();
502cdf0e10cSrcweir             }
503cdf0e10cSrcweir             break;
504cdf0e10cSrcweir 
505cdf0e10cSrcweir         case SID_RENAME_OBJECT:
506cdf0e10cSrcweir             {
507cdf0e10cSrcweir                 if(1L == pView->GetMarkedObjectCount())
508cdf0e10cSrcweir                 {
509cdf0e10cSrcweir                     // #i68101#
510cdf0e10cSrcweir                     SdrObject* pSelected = pView->GetMarkedObjectByIndex(0L);
511cdf0e10cSrcweir                     OSL_ENSURE(pSelected, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
512cdf0e10cSrcweir 
513cdf0e10cSrcweir                     if(SC_LAYER_INTERN != pSelected->GetLayer())
514cdf0e10cSrcweir                     {
515cdf0e10cSrcweir                         String aName(pSelected->GetName());
516cdf0e10cSrcweir 
517cdf0e10cSrcweir                         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
518cdf0e10cSrcweir                         OSL_ENSURE(pFact, "Dialogdiet fail!");
519cdf0e10cSrcweir                         AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName);
520cdf0e10cSrcweir                         OSL_ENSURE(pDlg, "Dialogdiet fail!");
521cdf0e10cSrcweir 
522cdf0e10cSrcweir                         pDlg->SetCheckNameHdl(LINK(this, ScDrawShell, NameObjectHdl));
523cdf0e10cSrcweir 
524cdf0e10cSrcweir                         if(RET_OK == pDlg->Execute())
525cdf0e10cSrcweir                         {
526cdf0e10cSrcweir                             ScDocShell* pDocSh = pViewData->GetDocShell();
527cdf0e10cSrcweir                             pDlg->GetName(aName);
528cdf0e10cSrcweir 
529cdf0e10cSrcweir                             if(aName != pSelected->GetName())
530cdf0e10cSrcweir                             {
531cdf0e10cSrcweir                                 // handle name change
532cdf0e10cSrcweir                                 const sal_uInt16 nObjType(pSelected->GetObjIdentifier());
533cdf0e10cSrcweir 
534cdf0e10cSrcweir                                 if(OBJ_GRAF == nObjType && 0L == aName.Len())
535cdf0e10cSrcweir                                 {
536cdf0e10cSrcweir                                     //  graphics objects must have names
537cdf0e10cSrcweir                                     //  (all graphics are supposed to be in the navigator)
538cdf0e10cSrcweir                                     ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer();
539cdf0e10cSrcweir 
540cdf0e10cSrcweir                                     if(pModel)
541cdf0e10cSrcweir                                     {
542cdf0e10cSrcweir                                         aName = pModel->GetNewGraphicName();
543cdf0e10cSrcweir                                     }
544cdf0e10cSrcweir                                 }
545cdf0e10cSrcweir 
546cdf0e10cSrcweir                                 //  An undo action for renaming is missing in svdraw (99363).
547cdf0e10cSrcweir                                 //  For OLE objects (which can be identified using the persist name),
548cdf0e10cSrcweir                                 //  ScUndoRenameObject can be used until there is a common action for all objects.
549cdf0e10cSrcweir                                 if(OBJ_OLE2 == nObjType)
550cdf0e10cSrcweir                                 {
551cdf0e10cSrcweir                                     const String aPersistName = static_cast<SdrOle2Obj*>(pSelected)->GetPersistName();
552cdf0e10cSrcweir 
553cdf0e10cSrcweir                                     if(aPersistName.Len())
554cdf0e10cSrcweir                                     {
555cdf0e10cSrcweir                                         pDocSh->GetUndoManager()->AddUndoAction(
556cdf0e10cSrcweir                                             new ScUndoRenameObject(pDocSh, aPersistName, pSelected->GetName(), aName));
557cdf0e10cSrcweir                                     }
558cdf0e10cSrcweir                                 }
559cdf0e10cSrcweir 
560cdf0e10cSrcweir                                 // set new name
561cdf0e10cSrcweir                                 pSelected->SetName(aName);
562cdf0e10cSrcweir                             }
563cdf0e10cSrcweir 
564cdf0e10cSrcweir                             // ChartListenerCollectionNeedsUpdate is needed for Navigator update
565cdf0e10cSrcweir                             pDocSh->GetDocument()->SetChartListenerCollectionNeedsUpdate( sal_True );
566cdf0e10cSrcweir                             pDocSh->SetDrawModified();
567cdf0e10cSrcweir                         }
568cdf0e10cSrcweir 
569cdf0e10cSrcweir                         delete pDlg;
570cdf0e10cSrcweir                     }
571cdf0e10cSrcweir                 }
572cdf0e10cSrcweir                 break;
573cdf0e10cSrcweir             }
574cdf0e10cSrcweir 
575cdf0e10cSrcweir         // #i68101#
576cdf0e10cSrcweir         case SID_TITLE_DESCRIPTION_OBJECT:
577cdf0e10cSrcweir             {
578cdf0e10cSrcweir                 if(1L == pView->GetMarkedObjectCount())
579cdf0e10cSrcweir                 {
580cdf0e10cSrcweir                     SdrObject* pSelected = pView->GetMarkedObjectByIndex(0L);
581cdf0e10cSrcweir                     OSL_ENSURE(pSelected, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
582cdf0e10cSrcweir 
583cdf0e10cSrcweir                     if(SC_LAYER_INTERN != pSelected->GetLayer())
584cdf0e10cSrcweir                     {
585cdf0e10cSrcweir                         String aTitle(pSelected->GetTitle());
586cdf0e10cSrcweir                         String aDescription(pSelected->GetDescription());
587cdf0e10cSrcweir 
588cdf0e10cSrcweir                         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
589cdf0e10cSrcweir                         OSL_ENSURE(pFact, "Dialogdiet fail!");
590cdf0e10cSrcweir                         AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription);
591cdf0e10cSrcweir                         OSL_ENSURE(pDlg, "Dialogdiet fail!");
592cdf0e10cSrcweir 
593cdf0e10cSrcweir                         if(RET_OK == pDlg->Execute())
594cdf0e10cSrcweir                         {
595cdf0e10cSrcweir                             ScDocShell* pDocSh = pViewData->GetDocShell();
596cdf0e10cSrcweir 
597cdf0e10cSrcweir                             // handle Title and Description
598cdf0e10cSrcweir                             pDlg->GetTitle(aTitle);
599cdf0e10cSrcweir                             pDlg->GetDescription(aDescription);
600cdf0e10cSrcweir                             pSelected->SetTitle(aTitle);
601cdf0e10cSrcweir                             pSelected->SetDescription(aDescription);
602cdf0e10cSrcweir 
603cdf0e10cSrcweir                             // ChartListenerCollectionNeedsUpdate is needed for Navigator update
604cdf0e10cSrcweir                             pDocSh->GetDocument()->SetChartListenerCollectionNeedsUpdate( sal_True );
605cdf0e10cSrcweir                             pDocSh->SetDrawModified();
606cdf0e10cSrcweir                         }
607cdf0e10cSrcweir 
608cdf0e10cSrcweir                         delete pDlg;
609cdf0e10cSrcweir                     }
610cdf0e10cSrcweir                 }
611cdf0e10cSrcweir                 break;
612cdf0e10cSrcweir             }
613cdf0e10cSrcweir 
614cdf0e10cSrcweir         case SID_EXTRUSION_TOOGLE:
615cdf0e10cSrcweir         case SID_EXTRUSION_TILT_DOWN:
616cdf0e10cSrcweir         case SID_EXTRUSION_TILT_UP:
617cdf0e10cSrcweir         case SID_EXTRUSION_TILT_LEFT:
618cdf0e10cSrcweir         case SID_EXTRUSION_TILT_RIGHT:
619cdf0e10cSrcweir         case SID_EXTRUSION_3D_COLOR:
620cdf0e10cSrcweir         case SID_EXTRUSION_DEPTH:
621cdf0e10cSrcweir         case SID_EXTRUSION_DIRECTION:
622cdf0e10cSrcweir         case SID_EXTRUSION_PROJECTION:
623cdf0e10cSrcweir         case SID_EXTRUSION_LIGHTING_DIRECTION:
624cdf0e10cSrcweir         case SID_EXTRUSION_LIGHTING_INTENSITY:
625cdf0e10cSrcweir         case SID_EXTRUSION_SURFACE:
626cdf0e10cSrcweir         case SID_EXTRUSION_DEPTH_FLOATER:
627cdf0e10cSrcweir         case SID_EXTRUSION_DIRECTION_FLOATER:
628cdf0e10cSrcweir         case SID_EXTRUSION_LIGHTING_FLOATER:
629cdf0e10cSrcweir         case SID_EXTRUSION_SURFACE_FLOATER:
630cdf0e10cSrcweir         case SID_EXTRUSION_DEPTH_DIALOG:
631cdf0e10cSrcweir             svx::ExtrusionBar::execute( pView, rReq, rBindings );
632cdf0e10cSrcweir             rReq.Ignore ();
633cdf0e10cSrcweir             break;
634cdf0e10cSrcweir 
635cdf0e10cSrcweir         case SID_FONTWORK_SHAPE:
636cdf0e10cSrcweir         case SID_FONTWORK_SHAPE_TYPE:
637cdf0e10cSrcweir         case SID_FONTWORK_ALIGNMENT:
638cdf0e10cSrcweir         case SID_FONTWORK_SAME_LETTER_HEIGHTS:
639cdf0e10cSrcweir         case SID_FONTWORK_CHARACTER_SPACING:
640cdf0e10cSrcweir         case SID_FONTWORK_KERN_CHARACTER_PAIRS:
641cdf0e10cSrcweir         case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
642cdf0e10cSrcweir         case SID_FONTWORK_ALIGNMENT_FLOATER:
643cdf0e10cSrcweir         case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
644cdf0e10cSrcweir             svx::FontworkBar::execute( pView, rReq, rBindings );
645cdf0e10cSrcweir             rReq.Ignore ();
646cdf0e10cSrcweir             break;
647cdf0e10cSrcweir 
648cdf0e10cSrcweir         default:
649cdf0e10cSrcweir             break;
650cdf0e10cSrcweir     }
651cdf0e10cSrcweir }
652cdf0e10cSrcweir 
653cdf0e10cSrcweir IMPL_LINK( ScDrawShell, NameObjectHdl, AbstractSvxNameDialog*, pDialog )
654cdf0e10cSrcweir {
655cdf0e10cSrcweir     String aName;
656cdf0e10cSrcweir 
657cdf0e10cSrcweir     if( pDialog )
658cdf0e10cSrcweir         pDialog->GetName( aName );
659cdf0e10cSrcweir 
660cdf0e10cSrcweir     ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer();
661cdf0e10cSrcweir     if ( aName.Len() && pModel )
662cdf0e10cSrcweir     {
663cdf0e10cSrcweir         SCTAB nDummyTab;
664cdf0e10cSrcweir         if ( pModel->GetNamedObject( aName, 0, nDummyTab ) )
665cdf0e10cSrcweir         {
666cdf0e10cSrcweir             // existing object found -> name invalid
667cdf0e10cSrcweir             return 0;
668cdf0e10cSrcweir         }
669cdf0e10cSrcweir     }
670cdf0e10cSrcweir 
671cdf0e10cSrcweir     return 1;   // name is valid
672cdf0e10cSrcweir }
673cdf0e10cSrcweir 
674cdf0e10cSrcweir //------------------------------------------------------------------
675cdf0e10cSrcweir 
676cdf0e10cSrcweir void ScDrawShell::ExecFormText(SfxRequest& rReq)
677cdf0e10cSrcweir {
678cdf0e10cSrcweir     ScDrawView*         pDrView     = pViewData->GetScDrawView();
679cdf0e10cSrcweir     const SdrMarkList&  rMarkList   = pDrView->GetMarkedObjectList();
680cdf0e10cSrcweir 
681cdf0e10cSrcweir     if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
682cdf0e10cSrcweir     {
683cdf0e10cSrcweir         const SfxItemSet& rSet = *rReq.GetArgs();
684cdf0e10cSrcweir         const SfxPoolItem* pItem;
685cdf0e10cSrcweir 
686cdf0e10cSrcweir         if ( pDrView->IsTextEdit() )
687cdf0e10cSrcweir             pDrView->ScEndTextEdit();
688cdf0e10cSrcweir 
689cdf0e10cSrcweir         if (    SFX_ITEM_SET ==
690cdf0e10cSrcweir                 rSet.GetItemState(XATTR_FORMTXTSTDFORM, sal_True, &pItem)
691cdf0e10cSrcweir              && XFTFORM_NONE !=
692cdf0e10cSrcweir                 ((const XFormTextStdFormItem*) pItem)->GetValue() )
693cdf0e10cSrcweir         {
694cdf0e10cSrcweir 
695cdf0e10cSrcweir             sal_uInt16 nId              = SvxFontWorkChildWindow::GetChildWindowId();
696cdf0e10cSrcweir             SfxViewFrame* pViewFrm  = pViewData->GetViewShell()->GetViewFrame();
697cdf0e10cSrcweir             SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*)
698cdf0e10cSrcweir                                        (pViewFrm->
699cdf0e10cSrcweir                                             GetChildWindow(nId)->GetWindow());
700cdf0e10cSrcweir 
701cdf0e10cSrcweir             pDlg->CreateStdFormObj(*pDrView, *pDrView->GetSdrPageView(),
702cdf0e10cSrcweir                                     rSet, *rMarkList.GetMark(0)->GetMarkedSdrObj(),
703cdf0e10cSrcweir                                    ((const XFormTextStdFormItem*) pItem)->
704cdf0e10cSrcweir                                    GetValue());
705cdf0e10cSrcweir         }
706cdf0e10cSrcweir         else
707cdf0e10cSrcweir             pDrView->SetAttributes(rSet);
708cdf0e10cSrcweir     }
709cdf0e10cSrcweir }
710cdf0e10cSrcweir 
711cdf0e10cSrcweir //------------------------------------------------------------------
712cdf0e10cSrcweir 
713cdf0e10cSrcweir void ScDrawShell::ExecFormatPaintbrush( SfxRequest& rReq )
714cdf0e10cSrcweir {
715cdf0e10cSrcweir     ScViewFunc* pView = pViewData->GetView();
716cdf0e10cSrcweir     if ( pView->HasPaintBrush() )
717cdf0e10cSrcweir     {
718cdf0e10cSrcweir         // cancel paintbrush mode
719cdf0e10cSrcweir         pView->ResetBrushDocument();
720cdf0e10cSrcweir     }
721cdf0e10cSrcweir     else
722cdf0e10cSrcweir     {
723cdf0e10cSrcweir         sal_Bool bLock = sal_False;
724cdf0e10cSrcweir         const SfxItemSet *pArgs = rReq.GetArgs();
725cdf0e10cSrcweir         if( pArgs && pArgs->Count() >= 1 )
726cdf0e10cSrcweir             bLock = static_cast<const SfxBoolItem&>(pArgs->Get(SID_FORMATPAINTBRUSH)).GetValue();
727cdf0e10cSrcweir 
728cdf0e10cSrcweir         ScDrawView* pDrawView = pViewData->GetScDrawView();
729cdf0e10cSrcweir         if ( pDrawView && pDrawView->AreObjectsMarked() )
730cdf0e10cSrcweir         {
731cdf0e10cSrcweir             sal_Bool bOnlyHardAttr = sal_True;
732cdf0e10cSrcweir             SfxItemSet* pItemSet = new SfxItemSet( pDrawView->GetAttrFromMarked(bOnlyHardAttr) );
733cdf0e10cSrcweir             pView->SetDrawBrushSet( pItemSet, bLock );
734cdf0e10cSrcweir         }
735cdf0e10cSrcweir     }
736cdf0e10cSrcweir }
737cdf0e10cSrcweir 
738cdf0e10cSrcweir void ScDrawShell::StateFormatPaintbrush( SfxItemSet& rSet )
739cdf0e10cSrcweir {
740cdf0e10cSrcweir     ScDrawView* pDrawView = pViewData->GetScDrawView();
741cdf0e10cSrcweir     sal_Bool bSelection = pDrawView && pDrawView->AreObjectsMarked();
742cdf0e10cSrcweir     sal_Bool bHasPaintBrush = pViewData->GetView()->HasPaintBrush();
743cdf0e10cSrcweir 
744cdf0e10cSrcweir     if ( !bHasPaintBrush && !bSelection )
745cdf0e10cSrcweir         rSet.DisableItem( SID_FORMATPAINTBRUSH );
746cdf0e10cSrcweir     else
747cdf0e10cSrcweir         rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, bHasPaintBrush ) );
748cdf0e10cSrcweir }
749cdf0e10cSrcweir 
750cdf0e10cSrcweir ScDrawView* ScDrawShell::GetDrawView()
751cdf0e10cSrcweir {
752cdf0e10cSrcweir     return pViewData->GetView()->GetScDrawView();
753cdf0e10cSrcweir }
754cdf0e10cSrcweir 
755cdf0e10cSrcweir 
756cdf0e10cSrcweir 
757cdf0e10cSrcweir 
758