xref: /AOO41X/main/sc/source/ui/drawfunc/drawsh.cxx (revision b3f79822e811ac3493b185030a72c3c5a51f32d8)
1*b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b3f79822SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b3f79822SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b3f79822SAndrew Rist  * distributed with this work for additional information
6*b3f79822SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b3f79822SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b3f79822SAndrew Rist  * "License"); you may not use this file except in compliance
9*b3f79822SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*b3f79822SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*b3f79822SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b3f79822SAndrew Rist  * software distributed under the License is distributed on an
15*b3f79822SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3f79822SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b3f79822SAndrew Rist  * specific language governing permissions and limitations
18*b3f79822SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*b3f79822SAndrew Rist  *************************************************************/
21*b3f79822SAndrew Rist 
22*b3f79822SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #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:
142cdf0e10cSrcweir 		case SID_ATTR_LINE_DASH:
143cdf0e10cSrcweir 		case SID_ATTR_LINE_WIDTH:
144cdf0e10cSrcweir 		case SID_ATTR_LINE_COLOR:
145cdf0e10cSrcweir 		case SID_ATTR_FILL_STYLE:
146cdf0e10cSrcweir 		case SID_ATTR_FILL_COLOR:
147cdf0e10cSrcweir 		case SID_ATTR_FILL_GRADIENT:
148cdf0e10cSrcweir 		case SID_ATTR_FILL_HATCH:
149cdf0e10cSrcweir 		case SID_ATTR_FILL_BITMAP:
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 		// #i25616#
152cdf0e10cSrcweir 		case SID_ATTR_FILL_SHADOW:
153cdf0e10cSrcweir 			{
154cdf0e10cSrcweir 				// Wenn ToolBar vertikal :
155cdf0e10cSrcweir 				if ( !rReq.GetArgs() )
156cdf0e10cSrcweir 				{
157cdf0e10cSrcweir 					switch ( nSlot )
158cdf0e10cSrcweir 					{
159cdf0e10cSrcweir 						case SID_ATTR_LINE_STYLE:
160cdf0e10cSrcweir 						case SID_ATTR_LINE_DASH:
161cdf0e10cSrcweir 						case SID_ATTR_LINE_WIDTH:
162cdf0e10cSrcweir 						case SID_ATTR_LINE_COLOR:
163cdf0e10cSrcweir 							ExecuteLineDlg( rReq );
164cdf0e10cSrcweir 							break;
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 						case SID_ATTR_FILL_STYLE:
167cdf0e10cSrcweir 						case SID_ATTR_FILL_COLOR:
168cdf0e10cSrcweir 						case SID_ATTR_FILL_GRADIENT:
169cdf0e10cSrcweir 						case SID_ATTR_FILL_HATCH:
170cdf0e10cSrcweir 						case SID_ATTR_FILL_BITMAP:
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 						// #i25616#
173cdf0e10cSrcweir 						case SID_ATTR_FILL_SHADOW:
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 							ExecuteAreaDlg( rReq );
176cdf0e10cSrcweir 							break;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 						default:
179cdf0e10cSrcweir 							break;
180cdf0e10cSrcweir 					}
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 					//=====
183cdf0e10cSrcweir 					return;
184cdf0e10cSrcweir 					//=====
185cdf0e10cSrcweir 				}
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 				if( pView->AreObjectsMarked() )
188cdf0e10cSrcweir 					pView->SetAttrToMarked( *rReq.GetArgs(), sal_False );
189cdf0e10cSrcweir 				else
190cdf0e10cSrcweir 					pView->SetDefaultAttr( *rReq.GetArgs(), sal_False);
191cdf0e10cSrcweir 				pView->InvalidateAttribs();
192cdf0e10cSrcweir 			}
193cdf0e10cSrcweir 			break;
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 		case SID_ATTRIBUTES_LINE:
196cdf0e10cSrcweir 			ExecuteLineDlg( rReq );
197cdf0e10cSrcweir 			break;
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 		case SID_ATTRIBUTES_AREA:
200cdf0e10cSrcweir 			ExecuteAreaDlg( rReq );
201cdf0e10cSrcweir 			break;
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 		case SID_DRAWTEXT_ATTR_DLG:
204cdf0e10cSrcweir 			ExecuteTextAttrDlg( rReq );
205cdf0e10cSrcweir 			break;
206cdf0e10cSrcweir 
207cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
208cdf0e10cSrcweir         case SID_DRAW_HLINK_EDIT:
209cdf0e10cSrcweir             if ( pSingleSelectedObj )
210cdf0e10cSrcweir                 pViewData->GetDispatcher().Execute( SID_HYPERLINK_DIALOG );
211cdf0e10cSrcweir             break;
212cdf0e10cSrcweir 
213cdf0e10cSrcweir         case SID_DRAW_HLINK_DELETE:
214cdf0e10cSrcweir             if ( pSingleSelectedObj )
215cdf0e10cSrcweir                 SetHlinkForObject( pSingleSelectedObj, rtl::OUString() );
216cdf0e10cSrcweir             break;
217cdf0e10cSrcweir 
218cdf0e10cSrcweir         case SID_OPEN_HYPERLINK:
219cdf0e10cSrcweir             if ( nMarkCount == 1 )
220cdf0e10cSrcweir             {
221cdf0e10cSrcweir                 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
222cdf0e10cSrcweir                 if ( pObj->IsGroupObject() )
223cdf0e10cSrcweir                 {
224cdf0e10cSrcweir                     SdrPageView* pPV = 0;
225cdf0e10cSrcweir                     SdrObject* pHit = 0;
226cdf0e10cSrcweir                     if ( pView->PickObj( pWin->PixelToLogic( pViewData->GetMousePosPixel() ), pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
227cdf0e10cSrcweir                         pObj = pHit;
228cdf0e10cSrcweir                 }
229cdf0e10cSrcweir 
230cdf0e10cSrcweir                 ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
231cdf0e10cSrcweir                 if ( pInfo && (pInfo->GetHlink().getLength() > 0) )
232cdf0e10cSrcweir                     ScGlobal::OpenURL( pInfo->GetHlink(), String::EmptyString() );
233cdf0e10cSrcweir             }
234cdf0e10cSrcweir             break;
235cdf0e10cSrcweir #endif
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 		case SID_ATTR_TRANSFORM:
238cdf0e10cSrcweir 			{
239cdf0e10cSrcweir 				if ( pView->AreObjectsMarked() )
240cdf0e10cSrcweir 				{
241cdf0e10cSrcweir 					const SfxItemSet* pArgs = rReq.GetArgs();
242cdf0e10cSrcweir 
243cdf0e10cSrcweir 					if( !pArgs )
244cdf0e10cSrcweir 					{
245cdf0e10cSrcweir                         // const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
246cdf0e10cSrcweir 						if( rMarkList.GetMark(0) != 0 )
247cdf0e10cSrcweir 						{
248cdf0e10cSrcweir 							SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
249cdf0e10cSrcweir 							if( pObj->GetObjIdentifier() == OBJ_CAPTION )
250cdf0e10cSrcweir 							{
251cdf0e10cSrcweir 								// --------- Itemset fuer Caption --------
252cdf0e10cSrcweir 								SfxItemSet aNewAttr(pDoc->GetItemPool());
253cdf0e10cSrcweir 								pView->GetAttributes(aNewAttr);
254cdf0e10cSrcweir 								// --------- Itemset fuer Groesse und Position --------
255cdf0e10cSrcweir 								SfxItemSet aNewGeoAttr(pView->GetGeoAttrFromMarked());
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 								//SvxCaptionTabDialog* pDlg = new SvxCaptionTabDialog(pWin, pView);
258cdf0e10cSrcweir 								//change for cui CHINA001
259cdf0e10cSrcweir 								SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
260cdf0e10cSrcweir 								if ( pFact )
261cdf0e10cSrcweir 								{
262cdf0e10cSrcweir 									SfxAbstractTabDialog *pDlg = pFact->CreateCaptionDialog( pWin, pView );
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 									const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
265cdf0e10cSrcweir 									SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange );
266cdf0e10cSrcweir 									aCombSet.Put( aNewAttr );
267cdf0e10cSrcweir 									aCombSet.Put( aNewGeoAttr );
268cdf0e10cSrcweir 									pDlg->SetInputSet( &aCombSet );
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 									if (pDlg->Execute() == RET_OK)
271cdf0e10cSrcweir 									{
272cdf0e10cSrcweir 										rReq.Done(*(pDlg->GetOutputItemSet()));
273cdf0e10cSrcweir 										pView->SetAttributes(*pDlg->GetOutputItemSet());
274cdf0e10cSrcweir 										pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet());
275cdf0e10cSrcweir                                     }
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 									delete pDlg;
278cdf0e10cSrcweir 								}// change for cui
279cdf0e10cSrcweir 							}
280cdf0e10cSrcweir 							else
281cdf0e10cSrcweir 							{
282cdf0e10cSrcweir 								SfxItemSet aNewAttr(pView->GetGeoAttrFromMarked());
283cdf0e10cSrcweir 								//CHINA001 SvxTransformTabDialog* pDlg = new SvxTransformTabDialog(pWin, &aNewAttr, pView);
284cdf0e10cSrcweir 								SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
285cdf0e10cSrcweir 								if(pFact)
286cdf0e10cSrcweir 								{
287cdf0e10cSrcweir 									SfxAbstractTabDialog* pDlg = pFact->CreateSvxTransformTabDialog( pWin, &aNewAttr,pView );
288cdf0e10cSrcweir 									DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
289cdf0e10cSrcweir 									if (pDlg->Execute() == RET_OK)
290cdf0e10cSrcweir 									{
291cdf0e10cSrcweir 										rReq.Done(*(pDlg->GetOutputItemSet()));
292cdf0e10cSrcweir 										pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet());
293cdf0e10cSrcweir 									}
294cdf0e10cSrcweir 									delete pDlg;
295cdf0e10cSrcweir 								}
296cdf0e10cSrcweir 							}
297cdf0e10cSrcweir 						}
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 
300cdf0e10cSrcweir 					}
301cdf0e10cSrcweir 					else
302cdf0e10cSrcweir 						pView->SetGeoAttrToMarked( *pArgs );
303cdf0e10cSrcweir 				}
304cdf0e10cSrcweir 			}
305cdf0e10cSrcweir 			break;
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 		default:
308cdf0e10cSrcweir 			break;
309cdf0e10cSrcweir 	}
310cdf0e10cSrcweir }
311cdf0e10cSrcweir 
312cdf0e10cSrcweir void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, Window* pWin )
313cdf0e10cSrcweir {
314cdf0e10cSrcweir     SvxMacroItem aItem ( SFX_APP()->GetPool().GetWhich( SID_ATTR_MACROITEM ) );
315cdf0e10cSrcweir     ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, sal_True );
316cdf0e10cSrcweir     if ( pInfo->GetMacro().getLength() > 0 )
317cdf0e10cSrcweir     {
318cdf0e10cSrcweir         SvxMacroTableDtor aTab;
319cdf0e10cSrcweir         String sMacro(  pInfo->GetMacro() );
320cdf0e10cSrcweir         aTab.Insert( SFX_EVENT_MOUSECLICK_OBJECT, new SvxMacro( sMacro, String() ) );
321cdf0e10cSrcweir         aItem.SetMacroTable( aTab );
322cdf0e10cSrcweir     }
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 	// create empty itemset for macro-dlg
325cdf0e10cSrcweir     SfxItemSet* pItemSet = new SfxItemSet(SFX_APP()->GetPool(), SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 );
326cdf0e10cSrcweir     pItemSet->Put ( aItem, SID_ATTR_MACROITEM );
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 	SfxEventNamesItem aNamesItem(SID_EVENTCONFIG);
329cdf0e10cSrcweir 	aNamesItem.AddEvent( ScResId(RID_SCSTR_ONCLICK), String(), SFX_EVENT_MOUSECLICK_OBJECT );
330cdf0e10cSrcweir 	pItemSet->Put( aNamesItem, SID_EVENTCONFIG );
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 	com::sun::star::uno::Reference < com::sun::star::frame::XFrame > xFrame;
333cdf0e10cSrcweir 	if (GetViewShell())
334cdf0e10cSrcweir 		xFrame = GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface();
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 	SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
337cdf0e10cSrcweir 	SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pWin, *pItemSet, xFrame, SID_EVENTCONFIG );
338cdf0e10cSrcweir 	if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
339cdf0e10cSrcweir     {
340cdf0e10cSrcweir         const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
341cdf0e10cSrcweir         const SfxPoolItem* pItem;
342cdf0e10cSrcweir         if( SFX_ITEM_SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, sal_False, &pItem ))
343cdf0e10cSrcweir         {
344cdf0e10cSrcweir             rtl::OUString sMacro;
345cdf0e10cSrcweir             SvxMacro* pMacro = ((SvxMacroItem*)pItem)->GetMacroTable().Get( SFX_EVENT_MOUSECLICK_OBJECT );
346cdf0e10cSrcweir             if ( pMacro )
347cdf0e10cSrcweir 				sMacro = pMacro->GetMacName();
348cdf0e10cSrcweir 
349cdf0e10cSrcweir             if ( pObj->IsGroupObject() )
350cdf0e10cSrcweir             {
351cdf0e10cSrcweir                 SdrObjList* pOL = pObj->GetSubList();
352cdf0e10cSrcweir                 sal_uLong nObj = pOL->GetObjCount();
353cdf0e10cSrcweir                 for ( sal_uLong index=0; index<nObj; ++index )
354cdf0e10cSrcweir                 {
355cdf0e10cSrcweir                     pInfo = ScDrawLayer::GetMacroInfo( pOL->GetObj(index), sal_True );
356cdf0e10cSrcweir                     pInfo->SetMacro( sMacro );
357cdf0e10cSrcweir                 }
358cdf0e10cSrcweir             }
359cdf0e10cSrcweir             else
360cdf0e10cSrcweir                 pInfo->SetMacro( sMacro );
361cdf0e10cSrcweir             lcl_setModified( GetObjectShell() );
362cdf0e10cSrcweir         }
363cdf0e10cSrcweir     }
364cdf0e10cSrcweir 
365cdf0e10cSrcweir 	delete pMacroDlg;
366cdf0e10cSrcweir 	delete pItemSet;
367cdf0e10cSrcweir }
368cdf0e10cSrcweir 
369cdf0e10cSrcweir void ScDrawShell::ExecuteLineDlg( SfxRequest& rReq, sal_uInt16 nTabPage )
370cdf0e10cSrcweir {
371cdf0e10cSrcweir 	ScDrawView*			pView		= pViewData->GetScDrawView();
372cdf0e10cSrcweir 	sal_Bool 				bHasMarked	= pView->AreObjectsMarked();
373cdf0e10cSrcweir 	const SdrObject* 	pObj		= NULL;
374cdf0e10cSrcweir 	const SdrMarkList&	rMarkList	= pView->GetMarkedObjectList();
375cdf0e10cSrcweir 
376cdf0e10cSrcweir 	if( rMarkList.GetMarkCount() == 1 )
377cdf0e10cSrcweir 		pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 	SfxItemSet	aNewAttr( pView->GetDefaultAttr() );
380cdf0e10cSrcweir 	if( bHasMarked )
381cdf0e10cSrcweir 		pView->MergeAttrFromMarked( aNewAttr, sal_False );
382cdf0e10cSrcweir 
383cdf0e10cSrcweir //CHINA001	SvxLineTabDialog* pDlg
384cdf0e10cSrcweir //CHINA001	= new SvxLineTabDialog( pViewData->GetDialogParent(),
385cdf0e10cSrcweir //CHINA001	&aNewAttr,
386cdf0e10cSrcweir //CHINA001	pViewData->GetDocument()->GetDrawLayer(),
387cdf0e10cSrcweir //CHINA001	pObj,
388cdf0e10cSrcweir //CHINA001	bHasMarked );
389cdf0e10cSrcweir 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
390cdf0e10cSrcweir 		DBG_ASSERT(pFact, "Dialogdiet Factory fail!");//CHINA001
391cdf0e10cSrcweir 		SfxAbstractTabDialog * pDlg = pFact->CreateSvxLineTabDialog( pViewData->GetDialogParent(),
392cdf0e10cSrcweir 					&aNewAttr,
393cdf0e10cSrcweir 				pViewData->GetDocument()->GetDrawLayer(),
394cdf0e10cSrcweir 				pObj,
395cdf0e10cSrcweir 				bHasMarked);
396cdf0e10cSrcweir 		DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
397cdf0e10cSrcweir 	if ( nTabPage != 0xffff )
398cdf0e10cSrcweir 		pDlg->SetCurPageId( nTabPage );
399cdf0e10cSrcweir 
400cdf0e10cSrcweir 	if ( pDlg->Execute() == RET_OK )
401cdf0e10cSrcweir 	{
402cdf0e10cSrcweir 		if( bHasMarked )
403cdf0e10cSrcweir 			pView->SetAttrToMarked( *pDlg->GetOutputItemSet(), sal_False );
404cdf0e10cSrcweir 		else
405cdf0e10cSrcweir 			pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), sal_False );
406cdf0e10cSrcweir 
407cdf0e10cSrcweir 		pView->InvalidateAttribs();
408cdf0e10cSrcweir 		rReq.Done();
409cdf0e10cSrcweir 	}
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 	delete pDlg;
412cdf0e10cSrcweir }
413cdf0e10cSrcweir 
414cdf0e10cSrcweir void ScDrawShell::ExecuteAreaDlg( SfxRequest& rReq, sal_uInt16 nTabPage )
415cdf0e10cSrcweir {
416cdf0e10cSrcweir 	ScDrawView*	pView		= pViewData->GetScDrawView();
417cdf0e10cSrcweir 	sal_Bool		bHasMarked	= pView->AreObjectsMarked();
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 	SfxItemSet	aNewAttr( pView->GetDefaultAttr() );
420cdf0e10cSrcweir 	if( bHasMarked )
421cdf0e10cSrcweir 		pView->MergeAttrFromMarked( aNewAttr, sal_False );
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 	//CHINA001 SvxAreaTabDialog* pDlg
424cdf0e10cSrcweir 	//CHINA001 	= new SvxAreaTabDialog( pViewData->GetDialogParent(),
425cdf0e10cSrcweir //CHINA001 								&aNewAttr,
426cdf0e10cSrcweir //CHINA001 								pViewData->GetDocument()->GetDrawLayer(),
427cdf0e10cSrcweir //CHINA001 								pView );
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 	SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
430cdf0e10cSrcweir 	DBG_ASSERT(pFact, "Dialogdiet Factory fail!");//CHINA001
431cdf0e10cSrcweir 	AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog( pViewData->GetDialogParent(),
432cdf0e10cSrcweir 																	&aNewAttr,
433cdf0e10cSrcweir 															pViewData->GetDocument()->GetDrawLayer(),
434cdf0e10cSrcweir 															pView);
435cdf0e10cSrcweir 	DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
436cdf0e10cSrcweir 
437cdf0e10cSrcweir     // #i74099# by default, the dialog deletes the current color table if a different one is loaded
438cdf0e10cSrcweir     // (see SwDrawShell::ExecDrawDlg)
439cdf0e10cSrcweir     const SvxColorTableItem* pColorItem =
440cdf0e10cSrcweir         static_cast<const SvxColorTableItem*>( pViewData->GetSfxDocShell()->GetItem(SID_COLOR_TABLE) );
441cdf0e10cSrcweir     if (pColorItem->GetColorTable() == XColorTable::GetStdColorTable())
442cdf0e10cSrcweir         pDlg->DontDeleteColorTable();
443cdf0e10cSrcweir 
444cdf0e10cSrcweir 	if ( nTabPage != 0xffff )
445cdf0e10cSrcweir 		pDlg->SetCurPageId( nTabPage );
446cdf0e10cSrcweir 
447cdf0e10cSrcweir 	if ( pDlg->Execute() == RET_OK )
448cdf0e10cSrcweir 	{
449cdf0e10cSrcweir 		if( bHasMarked )
450cdf0e10cSrcweir 			pView->SetAttrToMarked( *pDlg->GetOutputItemSet(), sal_False );
451cdf0e10cSrcweir 		else
452cdf0e10cSrcweir 			pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), sal_False );
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 		pView->InvalidateAttribs();
455cdf0e10cSrcweir 		rReq.Done();
456cdf0e10cSrcweir 	}
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 	delete pDlg;
459cdf0e10cSrcweir }
460cdf0e10cSrcweir 
461cdf0e10cSrcweir void ScDrawShell::ExecuteTextAttrDlg( SfxRequest& rReq, sal_uInt16 /* nTabPage */ )
462cdf0e10cSrcweir {
463cdf0e10cSrcweir 	ScDrawView*	pView		= pViewData->GetScDrawView();
464cdf0e10cSrcweir 	sal_Bool		bHasMarked	= pView->AreObjectsMarked();
465cdf0e10cSrcweir 	SfxItemSet	aNewAttr	( pView->GetDefaultAttr() );
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 	if( bHasMarked )
468cdf0e10cSrcweir 		pView->MergeAttrFromMarked( aNewAttr, sal_False );
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 	SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
471cdf0e10cSrcweir 	SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( pViewData->GetDialogParent(), &aNewAttr, pView );
472cdf0e10cSrcweir 
473cdf0e10cSrcweir 	sal_uInt16 nResult = pDlg->Execute();
474cdf0e10cSrcweir 
475cdf0e10cSrcweir 	if ( RET_OK == nResult )
476cdf0e10cSrcweir 	{
477cdf0e10cSrcweir 		if ( bHasMarked )
478cdf0e10cSrcweir 			pView->SetAttributes( *pDlg->GetOutputItemSet() );
479cdf0e10cSrcweir 		else
480cdf0e10cSrcweir 			pView->SetDefaultAttr( *pDlg->GetOutputItemSet(), sal_False );
481cdf0e10cSrcweir 
482cdf0e10cSrcweir 		pView->InvalidateAttribs();
483cdf0e10cSrcweir 		rReq.Done();
484cdf0e10cSrcweir 	}
485cdf0e10cSrcweir 	delete( pDlg );
486cdf0e10cSrcweir }
487cdf0e10cSrcweir 
488cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
489cdf0e10cSrcweir void ScDrawShell::SetHlinkForObject( SdrObject* pObj, const rtl::OUString& rHlnk )
490cdf0e10cSrcweir {
491cdf0e10cSrcweir     if ( pObj )
492cdf0e10cSrcweir     {
493cdf0e10cSrcweir         ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, sal_True );
494cdf0e10cSrcweir         pInfo->SetHlink( rHlnk );
495cdf0e10cSrcweir         lcl_setModified( GetObjectShell() );
496cdf0e10cSrcweir     }
497cdf0e10cSrcweir }
498cdf0e10cSrcweir #endif
499cdf0e10cSrcweir 
500