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