xref: /AOO41X/main/sc/source/ui/drawfunc/drawsh.cxx (revision d5370dc8b91641fa460c79c207c7018af41d7460)
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 #include <svx/svxdlg.hxx> //CHINA001
28cdf0e10cSrcweir #include <svx/dialogs.hrc> //CHINA001
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include "scitems.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <editeng/eeitem.hxx>
33cdf0e10cSrcweir #include <svx/fontwork.hxx>
34cdf0e10cSrcweir //#include <svx/labdlg.hxx>	CHINA001
35cdf0e10cSrcweir #include <svl/srchitem.hxx>
36cdf0e10cSrcweir #include <svx/tabarea.hxx>
37cdf0e10cSrcweir #include <svx/tabline.hxx>
38cdf0e10cSrcweir //CHINA001 #include <svx/transfrm.hxx>
39cdf0e10cSrcweir #include <sfx2/app.hxx>
40cdf0e10cSrcweir #include <sfx2/objface.hxx>
41cdf0e10cSrcweir #include <sfx2/objsh.hxx>
42cdf0e10cSrcweir #include <sfx2/request.hxx>
43cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
44cdf0e10cSrcweir #include <svl/whiter.hxx>
45cdf0e10cSrcweir #include <vcl/msgbox.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include "drawsh.hxx"
48cdf0e10cSrcweir #include "drwlayer.hxx"
49cdf0e10cSrcweir #include "sc.hrc"
50cdf0e10cSrcweir #include "viewdata.hxx"
51cdf0e10cSrcweir #include "document.hxx"
52cdf0e10cSrcweir #include "docpool.hxx"
53cdf0e10cSrcweir #include "drawview.hxx"
54cdf0e10cSrcweir #include "scresid.hxx"
55cdf0e10cSrcweir #include <svx/svdobj.hxx>
56cdf0e10cSrcweir //add header of cui CHINA001
57cdf0e10cSrcweir #include <svx/svxdlg.hxx>
58cdf0e10cSrcweir #include <svx/dialogs.hrc>
59cdf0e10cSrcweir #include <svx/drawitem.hxx>
60cdf0e10cSrcweir #include <svx/xtable.hxx>
61cdf0e10cSrcweir 
62cdf0e10cSrcweir #define ScDrawShell
63cdf0e10cSrcweir #include "scslots.hxx"
64cdf0e10cSrcweir 
65cdf0e10cSrcweir #include "userdat.hxx"
66cdf0e10cSrcweir #include <sfx2/objsh.hxx>
67cdf0e10cSrcweir #include <svl/macitem.hxx>
68cdf0e10cSrcweir #include <sfx2/evntconf.hxx>
69cdf0e10cSrcweir #include <sfx2/viewsh.hxx>
70cdf0e10cSrcweir #include <com/sun/star/util/XModifiable.hpp>
71cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
72cdf0e10cSrcweir 
73cdf0e10cSrcweir //------------------------------------------------------------------
74cdf0e10cSrcweir 
75cdf0e10cSrcweir TYPEINIT1( ScDrawShell, SfxShell );
76cdf0e10cSrcweir 
77cdf0e10cSrcweir SFX_IMPL_INTERFACE(ScDrawShell, SfxShell, ScResId(SCSTR_DRAWSHELL) )
78cdf0e10cSrcweir {
79cdf0e10cSrcweir 	SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_SERVER,
80cdf0e10cSrcweir 								ScResId(RID_DRAW_OBJECTBAR) );
81cdf0e10cSrcweir 	SFX_POPUPMENU_REGISTRATION( ScResId(RID_POPUP_DRAW) );
82cdf0e10cSrcweir 	SFX_CHILDWINDOW_REGISTRATION( SvxFontWorkChildWindow::GetChildWindowId() );
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
86cdf0e10cSrcweir // abschalten der nicht erwuenschten Acceleratoren:
87cdf0e10cSrcweir 
88cdf0e10cSrcweir void ScDrawShell::StateDisableItems( SfxItemSet &rSet )
89cdf0e10cSrcweir {
90cdf0e10cSrcweir 	SfxWhichIter aIter(rSet);
91cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	while (nWhich)
94cdf0e10cSrcweir 	{
95cdf0e10cSrcweir 		rSet.DisableItem( nWhich );
96cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
97cdf0e10cSrcweir 	}
98cdf0e10cSrcweir }
99cdf0e10cSrcweir 
100cdf0e10cSrcweir void lcl_setModified( SfxObjectShell*  pShell )
101cdf0e10cSrcweir {
102cdf0e10cSrcweir     if ( pShell )
103cdf0e10cSrcweir     {
104cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::util::XModifiable > xModif( pShell->GetModel(), com::sun::star::uno::UNO_QUERY );
105cdf0e10cSrcweir         if ( xModif.is() )
106cdf0e10cSrcweir             xModif->setModified( sal_True );
107cdf0e10cSrcweir     }
108cdf0e10cSrcweir }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
111cdf0e10cSrcweir {
112cdf0e10cSrcweir 	sal_uInt16				nSlot		= rReq.GetSlot();
113cdf0e10cSrcweir 	Window* 			pWin		= pViewData->GetActiveWin();
114cdf0e10cSrcweir //	SfxViewFrame*		pViewFrame	= SfxViewShell::Current()->GetViewFrame(); //!!! koennte knallen
115cdf0e10cSrcweir 	ScDrawView* 		pView		= pViewData->GetScDrawView();
116cdf0e10cSrcweir 	SdrModel*			pDoc		= pViewData->GetDocument()->GetDrawLayer();
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
119cdf0e10cSrcweir     sal_uLong nMarkCount = rMarkList.GetMarkCount();
120cdf0e10cSrcweir     SdrObject* pSingleSelectedObj = NULL;
121cdf0e10cSrcweir     if ( nMarkCount > 0 )
122cdf0e10cSrcweir         pSingleSelectedObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	switch ( nSlot )
125cdf0e10cSrcweir 	{
126cdf0e10cSrcweir         case SID_ASSIGNMACRO:
127cdf0e10cSrcweir             {
128cdf0e10cSrcweir                 if ( pSingleSelectedObj )
129cdf0e10cSrcweir                     ExecuteMacroAssign( pSingleSelectedObj, pWin );
130cdf0e10cSrcweir             }
131cdf0e10cSrcweir             break;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 		case SID_TEXT_STANDARD:	// Harte Textattributierung loeschen
134cdf0e10cSrcweir 			{
135cdf0e10cSrcweir 				SfxItemSet aEmptyAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END);
136cdf0e10cSrcweir 				pView->SetAttributes(aEmptyAttr, sal_True);
137cdf0e10cSrcweir 			}
138cdf0e10cSrcweir 			break;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 		case SID_ATTR_LINE_STYLE:
141cdf0e10cSrcweir 		case SID_ATTR_LINEEND_STYLE:
142*d5370dc8SArmin Le Grand         case SID_ATTR_LINE_START:
143*d5370dc8SArmin Le Grand         case SID_ATTR_LINE_END:
144cdf0e10cSrcweir 		case SID_ATTR_LINE_DASH:
145cdf0e10cSrcweir 		case SID_ATTR_LINE_WIDTH:
146cdf0e10cSrcweir 		case SID_ATTR_LINE_COLOR:
147*d5370dc8SArmin Le Grand         case SID_ATTR_LINE_TRANSPARENCE:
148*d5370dc8SArmin Le Grand         case SID_ATTR_LINE_JOINT:
149*d5370dc8SArmin Le Grand         case SID_ATTR_LINE_CAP:
150cdf0e10cSrcweir 		case SID_ATTR_FILL_STYLE:
151cdf0e10cSrcweir 		case SID_ATTR_FILL_COLOR:
152cdf0e10cSrcweir 		case SID_ATTR_FILL_GRADIENT:
153cdf0e10cSrcweir 		case SID_ATTR_FILL_HATCH:
154cdf0e10cSrcweir 		case SID_ATTR_FILL_BITMAP:
155*d5370dc8SArmin Le Grand 		case SID_ATTR_FILL_TRANSPARENCE:
156*d5370dc8SArmin Le Grand 		case SID_ATTR_FILL_FLOATTRANSPARENCE:
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 		// #i25616#
159cdf0e10cSrcweir 		case SID_ATTR_FILL_SHADOW:
160cdf0e10cSrcweir 			{
161cdf0e10cSrcweir 				// Wenn ToolBar vertikal :
162cdf0e10cSrcweir 				if ( !rReq.GetArgs() )
163cdf0e10cSrcweir 				{
164cdf0e10cSrcweir 					switch ( nSlot )
165cdf0e10cSrcweir 					{
166cdf0e10cSrcweir 						case SID_ATTR_LINE_STYLE:
167cdf0e10cSrcweir 						case SID_ATTR_LINE_DASH:
168cdf0e10cSrcweir 						case SID_ATTR_LINE_WIDTH:
169cdf0e10cSrcweir 						case SID_ATTR_LINE_COLOR:
170*d5370dc8SArmin Le Grand                         case SID_ATTR_LINE_TRANSPARENCE:
171*d5370dc8SArmin Le Grand                         case SID_ATTR_LINE_JOINT:
172*d5370dc8SArmin Le Grand                         case SID_ATTR_LINE_CAP:
173cdf0e10cSrcweir 							ExecuteLineDlg( rReq );
174cdf0e10cSrcweir 							break;
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 						case SID_ATTR_FILL_STYLE:
177cdf0e10cSrcweir 						case SID_ATTR_FILL_COLOR:
178cdf0e10cSrcweir 						case SID_ATTR_FILL_GRADIENT:
179cdf0e10cSrcweir 						case SID_ATTR_FILL_HATCH:
180cdf0e10cSrcweir 						case SID_ATTR_FILL_BITMAP:
181*d5370dc8SArmin Le Grand 		                case SID_ATTR_FILL_TRANSPARENCE:
182*d5370dc8SArmin Le Grand 		                case SID_ATTR_FILL_FLOATTRANSPARENCE:
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 						// #i25616#
185cdf0e10cSrcweir 						case SID_ATTR_FILL_SHADOW:
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 							ExecuteAreaDlg( rReq );
188cdf0e10cSrcweir 							break;
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 						default:
191cdf0e10cSrcweir 							break;
192cdf0e10cSrcweir 					}
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 					//=====
195cdf0e10cSrcweir 					return;
196cdf0e10cSrcweir 					//=====
197cdf0e10cSrcweir 				}
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 				if( pView->AreObjectsMarked() )
200cdf0e10cSrcweir 					pView->SetAttrToMarked( *rReq.GetArgs(), sal_False );
201cdf0e10cSrcweir 				else
202cdf0e10cSrcweir 					pView->SetDefaultAttr( *rReq.GetArgs(), sal_False);
203cdf0e10cSrcweir 				pView->InvalidateAttribs();
204cdf0e10cSrcweir 			}
205cdf0e10cSrcweir 			break;
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 		case SID_ATTRIBUTES_LINE:
208cdf0e10cSrcweir 			ExecuteLineDlg( rReq );
209cdf0e10cSrcweir 			break;
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 		case SID_ATTRIBUTES_AREA:
212cdf0e10cSrcweir 			ExecuteAreaDlg( rReq );
213cdf0e10cSrcweir 			break;
214cdf0e10cSrcweir 
215cdf0e10cSrcweir 		case SID_DRAWTEXT_ATTR_DLG:
216cdf0e10cSrcweir 			ExecuteTextAttrDlg( rReq );
217cdf0e10cSrcweir 			break;
218cdf0e10cSrcweir 
219cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
220cdf0e10cSrcweir         case SID_DRAW_HLINK_EDIT:
221cdf0e10cSrcweir             if ( pSingleSelectedObj )
222cdf0e10cSrcweir                 pViewData->GetDispatcher().Execute( SID_HYPERLINK_DIALOG );
223cdf0e10cSrcweir             break;
224cdf0e10cSrcweir 
225cdf0e10cSrcweir         case SID_DRAW_HLINK_DELETE:
226cdf0e10cSrcweir             if ( pSingleSelectedObj )
227cdf0e10cSrcweir                 SetHlinkForObject( pSingleSelectedObj, rtl::OUString() );
228cdf0e10cSrcweir             break;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir         case SID_OPEN_HYPERLINK:
231cdf0e10cSrcweir             if ( nMarkCount == 1 )
232cdf0e10cSrcweir             {
233cdf0e10cSrcweir                 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
234cdf0e10cSrcweir                 if ( pObj->IsGroupObject() )
235cdf0e10cSrcweir                 {
236cdf0e10cSrcweir                     SdrPageView* pPV = 0;
237cdf0e10cSrcweir                     SdrObject* pHit = 0;
238cdf0e10cSrcweir                     if ( pView->PickObj( pWin->PixelToLogic( pViewData->GetMousePosPixel() ), pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
239cdf0e10cSrcweir                         pObj = pHit;
240cdf0e10cSrcweir                 }
241cdf0e10cSrcweir 
242cdf0e10cSrcweir                 ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
243cdf0e10cSrcweir                 if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
244cdf0e10cSrcweir                     ScGlobal::OpenURL( pInfo->GetHlink(), String::EmptyString() );
245cdf0e10cSrcweir             }
246cdf0e10cSrcweir             break;
247cdf0e10cSrcweir #endif
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 		case SID_ATTR_TRANSFORM:
250cdf0e10cSrcweir 			{
251cdf0e10cSrcweir 				if ( pView->AreObjectsMarked() )
252cdf0e10cSrcweir 				{
253cdf0e10cSrcweir 					const SfxItemSet* pArgs = rReq.GetArgs();
254cdf0e10cSrcweir 
255cdf0e10cSrcweir 					if( !pArgs )
256cdf0e10cSrcweir 					{
257cdf0e10cSrcweir                         // const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
258cdf0e10cSrcweir 						if( rMarkList.GetMark(0) != 0 )
259cdf0e10cSrcweir 						{
260cdf0e10cSrcweir 							SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
261cdf0e10cSrcweir 							if( pObj->GetObjIdentifier() == OBJ_CAPTION )
262cdf0e10cSrcweir 							{
263cdf0e10cSrcweir 								// --------- Itemset fuer Caption --------
264cdf0e10cSrcweir 								SfxItemSet aNewAttr(pDoc->GetItemPool());
265cdf0e10cSrcweir 								pView->GetAttributes(aNewAttr);
266cdf0e10cSrcweir 								// --------- Itemset fuer Groesse und Position --------
267cdf0e10cSrcweir 								SfxItemSet aNewGeoAttr(pView->GetGeoAttrFromMarked());
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 								//SvxCaptionTabDialog* pDlg = new SvxCaptionTabDialog(pWin, pView);
270cdf0e10cSrcweir 								//change for cui CHINA001
271cdf0e10cSrcweir 								SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
272cdf0e10cSrcweir 								if ( pFact )
273cdf0e10cSrcweir 								{
274cdf0e10cSrcweir 									SfxAbstractTabDialog *pDlg = pFact->CreateCaptionDialog( pWin, pView );
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 									const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
277cdf0e10cSrcweir 									SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange );
278cdf0e10cSrcweir 									aCombSet.Put( aNewAttr );
279cdf0e10cSrcweir 									aCombSet.Put( aNewGeoAttr );
280cdf0e10cSrcweir 									pDlg->SetInputSet( &aCombSet );
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 									if (pDlg->Execute() == RET_OK)
283cdf0e10cSrcweir 									{
284cdf0e10cSrcweir 										rReq.Done(*(pDlg->GetOutputItemSet()));
285cdf0e10cSrcweir 										pView->SetAttributes(*pDlg->GetOutputItemSet());
286cdf0e10cSrcweir 										pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet());
287cdf0e10cSrcweir                                     }
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 									delete pDlg;
290cdf0e10cSrcweir 								}// change for cui
291cdf0e10cSrcweir 							}
292cdf0e10cSrcweir 							else
293cdf0e10cSrcweir 							{
294cdf0e10cSrcweir 								SfxItemSet aNewAttr(pView->GetGeoAttrFromMarked());
295cdf0e10cSrcweir 								//CHINA001 SvxTransformTabDialog* pDlg = new SvxTransformTabDialog(pWin, &aNewAttr, pView);
296cdf0e10cSrcweir 								SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
297cdf0e10cSrcweir 								if(pFact)
298cdf0e10cSrcweir 								{
299cdf0e10cSrcweir 									SfxAbstractTabDialog* pDlg = pFact->CreateSvxTransformTabDialog( pWin, &aNewAttr,pView );
300cdf0e10cSrcweir 									DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
301cdf0e10cSrcweir 									if (pDlg->Execute() == RET_OK)
302cdf0e10cSrcweir 									{
303cdf0e10cSrcweir 										rReq.Done(*(pDlg->GetOutputItemSet()));
304cdf0e10cSrcweir 										pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet());
305cdf0e10cSrcweir 									}
306cdf0e10cSrcweir 									delete pDlg;
307cdf0e10cSrcweir 								}
308cdf0e10cSrcweir 							}
309cdf0e10cSrcweir 						}
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 					}
313cdf0e10cSrcweir 					else
314cdf0e10cSrcweir 						pView->SetGeoAttrToMarked( *pArgs );
315cdf0e10cSrcweir 				}
316cdf0e10cSrcweir 			}
317cdf0e10cSrcweir 			break;
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 		default:
320cdf0e10cSrcweir 			break;
321cdf0e10cSrcweir 	}
322cdf0e10cSrcweir }
323cdf0e10cSrcweir 
324cdf0e10cSrcweir void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, Window* pWin )
325cdf0e10cSrcweir {
326cdf0e10cSrcweir     SvxMacroItem aItem ( SFX_APP()->GetPool().GetWhich( SID_ATTR_MACROITEM ) );
327cdf0e10cSrcweir     ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, sal_True );
328cdf0e10cSrcweir     if ( pInfo->GetMacro().getLength() > 0 )
329cdf0e10cSrcweir     {
330cdf0e10cSrcweir         SvxMacroTableDtor aTab;
331cdf0e10cSrcweir         String sMacro(  pInfo->GetMacro() );
332cdf0e10cSrcweir         aTab.Insert( SFX_EVENT_MOUSECLICK_OBJECT, new SvxMacro( sMacro, String() ) );
333cdf0e10cSrcweir         aItem.SetMacroTable( aTab );
334cdf0e10cSrcweir     }
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 	// create empty itemset for macro-dlg
337cdf0e10cSrcweir     SfxItemSet* pItemSet = new SfxItemSet(SFX_APP()->GetPool(), SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 );
338cdf0e10cSrcweir     pItemSet->Put ( aItem, SID_ATTR_MACROITEM );
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 	SfxEventNamesItem aNamesItem(SID_EVENTCONFIG);
341cdf0e10cSrcweir 	aNamesItem.AddEvent( ScResId(RID_SCSTR_ONCLICK), String(), SFX_EVENT_MOUSECLICK_OBJECT );
342cdf0e10cSrcweir 	pItemSet->Put( aNamesItem, SID_EVENTCONFIG );
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 	com::sun::star::uno::Reference < com::sun::star::frame::XFrame > xFrame;
345cdf0e10cSrcweir 	if (GetViewShell())
346cdf0e10cSrcweir 		xFrame = GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface();
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 	SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
349cdf0e10cSrcweir 	SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pWin, *pItemSet, xFrame, SID_EVENTCONFIG );
350cdf0e10cSrcweir 	if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
351cdf0e10cSrcweir     {
352cdf0e10cSrcweir         const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
353cdf0e10cSrcweir         const SfxPoolItem* pItem;
354cdf0e10cSrcweir         if( SFX_ITEM_SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, sal_False, &pItem ))
355cdf0e10cSrcweir         {
356cdf0e10cSrcweir             rtl::OUString sMacro;
357cdf0e10cSrcweir             SvxMacro* pMacro = ((SvxMacroItem*)pItem)->GetMacroTable().Get( SFX_EVENT_MOUSECLICK_OBJECT );
358cdf0e10cSrcweir             if ( pMacro )
359cdf0e10cSrcweir 				sMacro = pMacro->GetMacName();
360cdf0e10cSrcweir 
361cdf0e10cSrcweir             if ( pObj->IsGroupObject() )
362cdf0e10cSrcweir             {
363cdf0e10cSrcweir                 SdrObjList* pOL = pObj->GetSubList();
364cdf0e10cSrcweir                 sal_uLong nObj = pOL->GetObjCount();
365cdf0e10cSrcweir                 for ( sal_uLong index=0; index<nObj; ++index )
366cdf0e10cSrcweir                 {
367cdf0e10cSrcweir                     pInfo = ScDrawLayer::GetMacroInfo( pOL->GetObj(index), sal_True );
368cdf0e10cSrcweir                     pInfo->SetMacro( sMacro );
369cdf0e10cSrcweir                 }
370cdf0e10cSrcweir             }
371cdf0e10cSrcweir             else
372cdf0e10cSrcweir                 pInfo->SetMacro( sMacro );
373cdf0e10cSrcweir             lcl_setModified( GetObjectShell() );
374cdf0e10cSrcweir         }
375cdf0e10cSrcweir     }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir 	delete pMacroDlg;
378cdf0e10cSrcweir 	delete pItemSet;
379cdf0e10cSrcweir }
380cdf0e10cSrcweir 
381cdf0e10cSrcweir void ScDrawShell::ExecuteLineDlg( SfxRequest& rReq, sal_uInt16 nTabPage )
382cdf0e10cSrcweir {
383cdf0e10cSrcweir 	ScDrawView*			pView		= pViewData->GetScDrawView();
384cdf0e10cSrcweir 	sal_Bool 				bHasMarked	= pView->AreObjectsMarked();
385cdf0e10cSrcweir 	const SdrObject* 	pObj		= NULL;
386cdf0e10cSrcweir 	const SdrMarkList&	rMarkList	= pView->GetMarkedObjectList();
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 	if( rMarkList.GetMarkCount() == 1 )
389cdf0e10cSrcweir 		pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 	SfxItemSet	aNewAttr( pView->GetDefaultAttr() );
392cdf0e10cSrcweir 	if( bHasMarked )
393cdf0e10cSrcweir 		pView->MergeAttrFromMarked( aNewAttr, sal_False );
394cdf0e10cSrcweir 
395cdf0e10cSrcweir //CHINA001	SvxLineTabDialog* pDlg
396cdf0e10cSrcweir //CHINA001	= new SvxLineTabDialog( pViewData->GetDialogParent(),
397cdf0e10cSrcweir //CHINA001	&aNewAttr,
398cdf0e10cSrcweir //CHINA001	pViewData->GetDocument()->GetDrawLayer(),
399cdf0e10cSrcweir //CHINA001	pObj,
400cdf0e10cSrcweir //CHINA001	bHasMarked );
401cdf0e10cSrcweir 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
402cdf0e10cSrcweir 		DBG_ASSERT(pFact, "Dialogdiet Factory fail!");//CHINA001
403cdf0e10cSrcweir 		SfxAbstractTabDialog * pDlg = pFact->CreateSvxLineTabDialog( pViewData->GetDialogParent(),
404cdf0e10cSrcweir 					&aNewAttr,
405cdf0e10cSrcweir 				pViewData->GetDocument()->GetDrawLayer(),
406cdf0e10cSrcweir 				pObj,
407cdf0e10cSrcweir 				bHasMarked);
408cdf0e10cSrcweir 		DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
409cdf0e10cSrcweir 	if ( nTabPage != 0xffff )
410cdf0e10cSrcweir 		pDlg->SetCurPageId( nTabPage );
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 	if ( pDlg->Execute() == RET_OK )
413cdf0e10cSrcweir 	{
414cdf0e10cSrcweir 		if( bHasMarked )
415cdf0e10cSrcweir 			pView->SetAttrToMarked( *pDlg->GetOutputItemSet(), sal_False );
416cdf0e10cSrcweir 		else
417cdf0e10cSrcweir 			pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), sal_False );
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 		pView->InvalidateAttribs();
420cdf0e10cSrcweir 		rReq.Done();
421cdf0e10cSrcweir 	}
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 	delete pDlg;
424cdf0e10cSrcweir }
425cdf0e10cSrcweir 
426cdf0e10cSrcweir void ScDrawShell::ExecuteAreaDlg( SfxRequest& rReq, sal_uInt16 nTabPage )
427cdf0e10cSrcweir {
428cdf0e10cSrcweir 	ScDrawView*	pView		= pViewData->GetScDrawView();
429cdf0e10cSrcweir 	sal_Bool		bHasMarked	= pView->AreObjectsMarked();
430cdf0e10cSrcweir 
431cdf0e10cSrcweir 	SfxItemSet	aNewAttr( pView->GetDefaultAttr() );
432cdf0e10cSrcweir 	if( bHasMarked )
433cdf0e10cSrcweir 		pView->MergeAttrFromMarked( aNewAttr, sal_False );
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 	//CHINA001 SvxAreaTabDialog* pDlg
436cdf0e10cSrcweir 	//CHINA001 	= new SvxAreaTabDialog( pViewData->GetDialogParent(),
437cdf0e10cSrcweir //CHINA001 								&aNewAttr,
438cdf0e10cSrcweir //CHINA001 								pViewData->GetDocument()->GetDrawLayer(),
439cdf0e10cSrcweir //CHINA001 								pView );
440cdf0e10cSrcweir 
441cdf0e10cSrcweir 	SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
442cdf0e10cSrcweir 	DBG_ASSERT(pFact, "Dialogdiet Factory fail!");//CHINA001
443cdf0e10cSrcweir 	AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog( pViewData->GetDialogParent(),
444cdf0e10cSrcweir 																	&aNewAttr,
445cdf0e10cSrcweir 															pViewData->GetDocument()->GetDrawLayer(),
446cdf0e10cSrcweir 															pView);
447cdf0e10cSrcweir 	DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
448cdf0e10cSrcweir 
449cdf0e10cSrcweir     // #i74099# by default, the dialog deletes the current color table if a different one is loaded
450cdf0e10cSrcweir     // (see SwDrawShell::ExecDrawDlg)
451cdf0e10cSrcweir     const SvxColorTableItem* pColorItem =
452cdf0e10cSrcweir         static_cast<const SvxColorTableItem*>( pViewData->GetSfxDocShell()->GetItem(SID_COLOR_TABLE) );
453cdf0e10cSrcweir     if (pColorItem->GetColorTable() == XColorTable::GetStdColorTable())
454cdf0e10cSrcweir         pDlg->DontDeleteColorTable();
455cdf0e10cSrcweir 
456cdf0e10cSrcweir 	if ( nTabPage != 0xffff )
457cdf0e10cSrcweir 		pDlg->SetCurPageId( nTabPage );
458cdf0e10cSrcweir 
459cdf0e10cSrcweir 	if ( pDlg->Execute() == RET_OK )
460cdf0e10cSrcweir 	{
461cdf0e10cSrcweir 		if( bHasMarked )
462cdf0e10cSrcweir 			pView->SetAttrToMarked( *pDlg->GetOutputItemSet(), sal_False );
463cdf0e10cSrcweir 		else
464cdf0e10cSrcweir 			pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), sal_False );
465cdf0e10cSrcweir 
466cdf0e10cSrcweir 		pView->InvalidateAttribs();
467cdf0e10cSrcweir 		rReq.Done();
468cdf0e10cSrcweir 	}
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 	delete pDlg;
471cdf0e10cSrcweir }
472cdf0e10cSrcweir 
473cdf0e10cSrcweir void ScDrawShell::ExecuteTextAttrDlg( SfxRequest& rReq, sal_uInt16 /* nTabPage */ )
474cdf0e10cSrcweir {
475cdf0e10cSrcweir 	ScDrawView*	pView		= pViewData->GetScDrawView();
476cdf0e10cSrcweir 	sal_Bool		bHasMarked	= pView->AreObjectsMarked();
477cdf0e10cSrcweir 	SfxItemSet	aNewAttr	( pView->GetDefaultAttr() );
478cdf0e10cSrcweir 
479cdf0e10cSrcweir 	if( bHasMarked )
480cdf0e10cSrcweir 		pView->MergeAttrFromMarked( aNewAttr, sal_False );
481cdf0e10cSrcweir 
482cdf0e10cSrcweir 	SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
483cdf0e10cSrcweir 	SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( pViewData->GetDialogParent(), &aNewAttr, pView );
484cdf0e10cSrcweir 
485cdf0e10cSrcweir 	sal_uInt16 nResult = pDlg->Execute();
486cdf0e10cSrcweir 
487cdf0e10cSrcweir 	if ( RET_OK == nResult )
488cdf0e10cSrcweir 	{
489cdf0e10cSrcweir 		if ( bHasMarked )
490cdf0e10cSrcweir 			pView->SetAttributes( *pDlg->GetOutputItemSet() );
491cdf0e10cSrcweir 		else
492cdf0e10cSrcweir 			pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), sal_False );
493cdf0e10cSrcweir 
494cdf0e10cSrcweir 		pView->InvalidateAttribs();
495cdf0e10cSrcweir 		rReq.Done();
496cdf0e10cSrcweir 	}
497cdf0e10cSrcweir 	delete( pDlg );
498cdf0e10cSrcweir }
499cdf0e10cSrcweir 
500cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
501cdf0e10cSrcweir void ScDrawShell::SetHlinkForObject( SdrObject* pObj, const rtl::OUString& rHlnk )
502cdf0e10cSrcweir {
503cdf0e10cSrcweir     if ( pObj )
504cdf0e10cSrcweir     {
505cdf0e10cSrcweir         ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, sal_True );
506cdf0e10cSrcweir         pInfo->SetHlink( rHlnk );
507cdf0e10cSrcweir         lcl_setModified( GetObjectShell() );
508cdf0e10cSrcweir     }
509cdf0e10cSrcweir }
510cdf0e10cSrcweir #endif
511cdf0e10cSrcweir 
512