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