xref: /aoo41x/main/sw/source/ui/shells/drawsh.cxx (revision cdf0e10c)
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_sw.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include <tools/shl.hxx>
33*cdf0e10cSrcweir #include <svx/svdview.hxx>
34*cdf0e10cSrcweir #include <svx/svdotext.hxx>
35*cdf0e10cSrcweir #include <svl/whiter.hxx>
36*cdf0e10cSrcweir #include <svx/fontwork.hxx>
37*cdf0e10cSrcweir #include <sfx2/request.hxx>
38*cdf0e10cSrcweir #include <sfx2/bindings.hxx>
39*cdf0e10cSrcweir #include <sfx2/objface.hxx>
40*cdf0e10cSrcweir #include <svl/itemiter.hxx>
41*cdf0e10cSrcweir #include <svl/srchitem.hxx>
42*cdf0e10cSrcweir #include <svx/xftsfit.hxx>
43*cdf0e10cSrcweir #include <svx/extrusionbar.hxx>
44*cdf0e10cSrcweir #include <svx/fontworkbar.hxx>
45*cdf0e10cSrcweir #include <svx/tbxcustomshapes.hxx>
46*cdf0e10cSrcweir #include <uitool.hxx>
47*cdf0e10cSrcweir #include <wview.hxx>
48*cdf0e10cSrcweir #include <swmodule.hxx>
49*cdf0e10cSrcweir #include <swwait.hxx>
50*cdf0e10cSrcweir #include <docstat.hxx>
51*cdf0e10cSrcweir #include <IDocumentStatistics.hxx>
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
54*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir #include <svx/xtable.hxx>
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir #include "swundo.hxx"
59*cdf0e10cSrcweir #include "wrtsh.hxx"
60*cdf0e10cSrcweir #include "cmdid.h"
61*cdf0e10cSrcweir #include "globals.hrc"
62*cdf0e10cSrcweir #include "helpid.h"
63*cdf0e10cSrcweir #include "popup.hrc"
64*cdf0e10cSrcweir #include "shells.hrc"
65*cdf0e10cSrcweir #include "drwbassh.hxx"
66*cdf0e10cSrcweir #include "drawsh.hxx"
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir #define SwDrawShell
69*cdf0e10cSrcweir #include <sfx2/msg.hxx>
70*cdf0e10cSrcweir #include "swslots.hxx"
71*cdf0e10cSrcweir #include "swabstdlg.hxx" //CHINA001
72*cdf0e10cSrcweir #include "misc.hrc"
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir using namespace ::com::sun::star;
75*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir SFX_IMPL_INTERFACE(SwDrawShell, SwDrawBaseShell, SW_RES(STR_SHELLNAME_DRAW))
78*cdf0e10cSrcweir {
79*cdf0e10cSrcweir 	SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRAW_POPUPMENU));
80*cdf0e10cSrcweir 	SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_DRAW_TOOLBOX));
81*cdf0e10cSrcweir 	SFX_CHILDWINDOW_REGISTRATION(SvxFontWorkChildWindow::GetChildWindowId());
82*cdf0e10cSrcweir }
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir TYPEINIT1(SwDrawShell,SwDrawBaseShell)
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir /*--------------------------------------------------------------------
87*cdf0e10cSrcweir 	Beschreibung:
88*cdf0e10cSrcweir  --------------------------------------------------------------------*/
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir void SwDrawShell::Execute(SfxRequest &rReq)
92*cdf0e10cSrcweir {
93*cdf0e10cSrcweir 	SwWrtShell			&rSh = GetShell();
94*cdf0e10cSrcweir 	SdrView				*pSdrView = rSh.GetDrawView();
95*cdf0e10cSrcweir 	const SfxItemSet	*pArgs = rReq.GetArgs();
96*cdf0e10cSrcweir 	SfxBindings			&rBnd  = GetView().GetViewFrame()->GetBindings();
97*cdf0e10cSrcweir 	sal_uInt16				 nSlotId = rReq.GetSlot();
98*cdf0e10cSrcweir 	sal_Bool				 bChanged = pSdrView->GetModel()->IsChanged();
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 	pSdrView->GetModel()->SetChanged(sal_False);
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 	const SfxPoolItem* pItem;
103*cdf0e10cSrcweir 	if(pArgs)
104*cdf0e10cSrcweir 		pArgs->GetItemState(nSlotId, sal_False, &pItem);
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     sal_Bool bMirror = sal_True;
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 	switch (nSlotId)
109*cdf0e10cSrcweir 	{
110*cdf0e10cSrcweir 		case SID_OBJECT_ROTATE:
111*cdf0e10cSrcweir 			if (rSh.IsObjSelected() && pSdrView->IsRotateAllowed())
112*cdf0e10cSrcweir 			{
113*cdf0e10cSrcweir 				if (GetView().IsDrawRotate())
114*cdf0e10cSrcweir 					rSh.SetDragMode(SDRDRAG_MOVE);
115*cdf0e10cSrcweir 				else
116*cdf0e10cSrcweir 					rSh.SetDragMode(SDRDRAG_ROTATE);
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 				GetView().FlipDrawRotate();
119*cdf0e10cSrcweir 			}
120*cdf0e10cSrcweir 			break;
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 		case SID_BEZIER_EDIT:
123*cdf0e10cSrcweir 			if (GetView().IsDrawRotate())
124*cdf0e10cSrcweir 			{
125*cdf0e10cSrcweir 				rSh.SetDragMode(SDRDRAG_MOVE);
126*cdf0e10cSrcweir 				GetView().FlipDrawRotate();
127*cdf0e10cSrcweir 			}
128*cdf0e10cSrcweir 			GetView().FlipDrawSelMode();
129*cdf0e10cSrcweir 			pSdrView->SetFrameDragSingles(GetView().IsDrawSelMode());
130*cdf0e10cSrcweir 			GetView().AttrChangedNotify(&rSh); // Shellwechsel...
131*cdf0e10cSrcweir 			break;
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir 		case SID_OBJECT_HELL:
134*cdf0e10cSrcweir 			if (rSh.IsObjSelected())
135*cdf0e10cSrcweir 			{
136*cdf0e10cSrcweir 				rSh.StartUndo( UNDO_START );
137*cdf0e10cSrcweir 				SetWrapMode(FN_FRAME_WRAPTHRU_TRANSP);
138*cdf0e10cSrcweir 				rSh.SelectionToHell();
139*cdf0e10cSrcweir 				rSh.EndUndo( UNDO_END );
140*cdf0e10cSrcweir 				rBnd.Invalidate(SID_OBJECT_HEAVEN);
141*cdf0e10cSrcweir 			}
142*cdf0e10cSrcweir 			break;
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir 		case SID_OBJECT_HEAVEN:
145*cdf0e10cSrcweir 			if (rSh.IsObjSelected())
146*cdf0e10cSrcweir 			{
147*cdf0e10cSrcweir 				rSh.StartUndo( UNDO_START );
148*cdf0e10cSrcweir 				SetWrapMode(FN_FRAME_WRAPTHRU);
149*cdf0e10cSrcweir 				rSh.SelectionToHeaven();
150*cdf0e10cSrcweir 				rSh.EndUndo( UNDO_END );
151*cdf0e10cSrcweir 				rBnd.Invalidate(SID_OBJECT_HELL);
152*cdf0e10cSrcweir 			}
153*cdf0e10cSrcweir 			break;
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 		case FN_TOOL_HIERARCHIE:
156*cdf0e10cSrcweir 			if (rSh.IsObjSelected())
157*cdf0e10cSrcweir 			{
158*cdf0e10cSrcweir 				rSh.StartUndo( UNDO_START );
159*cdf0e10cSrcweir 				if (rSh.GetLayerId() == 0)
160*cdf0e10cSrcweir 				{
161*cdf0e10cSrcweir 					SetWrapMode(FN_FRAME_WRAPTHRU);
162*cdf0e10cSrcweir 					rSh.SelectionToHeaven();
163*cdf0e10cSrcweir 				}
164*cdf0e10cSrcweir 				else
165*cdf0e10cSrcweir 				{
166*cdf0e10cSrcweir 					SetWrapMode(FN_FRAME_WRAPTHRU_TRANSP);
167*cdf0e10cSrcweir 					rSh.SelectionToHell();
168*cdf0e10cSrcweir 				}
169*cdf0e10cSrcweir 				rSh.EndUndo( UNDO_END );
170*cdf0e10cSrcweir                 rBnd.Invalidate( SID_OBJECT_HELL );
171*cdf0e10cSrcweir                 rBnd.Invalidate( SID_OBJECT_HEAVEN );
172*cdf0e10cSrcweir 			}
173*cdf0e10cSrcweir 			break;
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir         case FN_FLIP_HORZ_GRAFIC:
176*cdf0e10cSrcweir 			bMirror = sal_False;
177*cdf0e10cSrcweir 			/* no break */
178*cdf0e10cSrcweir         case FN_FLIP_VERT_GRAFIC:
179*cdf0e10cSrcweir 			rSh.MirrorSelection( bMirror );
180*cdf0e10cSrcweir 			break;
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 		case SID_FONTWORK:
183*cdf0e10cSrcweir 		{
184*cdf0e10cSrcweir             FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView()));
185*cdf0e10cSrcweir             SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
186*cdf0e10cSrcweir             SfxViewFrame* pVFrame = GetView().GetViewFrame();
187*cdf0e10cSrcweir 			if (pArgs)
188*cdf0e10cSrcweir 			{
189*cdf0e10cSrcweir 				pVFrame->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
190*cdf0e10cSrcweir 					((const SfxBoolItem&)(pArgs->Get(SID_FONTWORK))).GetValue());
191*cdf0e10cSrcweir 			}
192*cdf0e10cSrcweir 			else
193*cdf0e10cSrcweir 				pVFrame->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
194*cdf0e10cSrcweir 			pVFrame->GetBindings().Invalidate(SID_FONTWORK);
195*cdf0e10cSrcweir 		}
196*cdf0e10cSrcweir 		break;
197*cdf0e10cSrcweir 		case FN_FORMAT_FOOTNOTE_DLG:
198*cdf0e10cSrcweir 		{
199*cdf0e10cSrcweir             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
200*cdf0e10cSrcweir             DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir             VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), GetView().GetWrtShell(), DLG_DOC_FOOTNOTE );
203*cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
204*cdf0e10cSrcweir 			pDlg->Execute();
205*cdf0e10cSrcweir 			delete pDlg;
206*cdf0e10cSrcweir 			break;
207*cdf0e10cSrcweir 		}
208*cdf0e10cSrcweir 		case FN_NUMBERING_OUTLINE_DLG:
209*cdf0e10cSrcweir 		{
210*cdf0e10cSrcweir 			SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
211*cdf0e10cSrcweir 			SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
212*cdf0e10cSrcweir             DBG_ASSERT(pFact, "Dialogdiet fail!");
213*cdf0e10cSrcweir             SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
214*cdf0e10cSrcweir 														GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
215*cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
216*cdf0e10cSrcweir 			pDlg->Execute();
217*cdf0e10cSrcweir 			delete pDlg;
218*cdf0e10cSrcweir 			rReq.Done();
219*cdf0e10cSrcweir 		}
220*cdf0e10cSrcweir 		break;
221*cdf0e10cSrcweir 		case SID_OPEN_XML_FILTERSETTINGS:
222*cdf0e10cSrcweir 		{
223*cdf0e10cSrcweir 			try
224*cdf0e10cSrcweir 			{
225*cdf0e10cSrcweir 				uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
226*cdf0e10cSrcweir 				if( xDialog.is() )
227*cdf0e10cSrcweir 				{
228*cdf0e10cSrcweir 					xDialog->execute();
229*cdf0e10cSrcweir 				}
230*cdf0e10cSrcweir 			}
231*cdf0e10cSrcweir 			catch( uno::Exception& )
232*cdf0e10cSrcweir 			{
233*cdf0e10cSrcweir 			}
234*cdf0e10cSrcweir 			rReq.Ignore ();
235*cdf0e10cSrcweir 		}
236*cdf0e10cSrcweir 		break;
237*cdf0e10cSrcweir 		case FN_WORDCOUNT_DIALOG:
238*cdf0e10cSrcweir 		{
239*cdf0e10cSrcweir 			SwDocStat aCurr;
240*cdf0e10cSrcweir 			SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
241*cdf0e10cSrcweir 			{
242*cdf0e10cSrcweir 				SwWait aWait( *GetView().GetDocShell(), sal_True );
243*cdf0e10cSrcweir 				rSh.StartAction();
244*cdf0e10cSrcweir 				rSh.CountWords( aCurr );
245*cdf0e10cSrcweir 				rSh.UpdateDocStat( aDocStat );
246*cdf0e10cSrcweir 				rSh.EndAction();
247*cdf0e10cSrcweir 			}
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 			SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
250*cdf0e10cSrcweir 			DBG_ASSERT(pFact, "Dialogdiet fail!");
251*cdf0e10cSrcweir 			AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() );
252*cdf0e10cSrcweir 			pDialog->SetValues(aCurr, aDocStat );
253*cdf0e10cSrcweir 			pDialog->Execute();
254*cdf0e10cSrcweir 			delete pDialog;
255*cdf0e10cSrcweir 		}
256*cdf0e10cSrcweir 		break;
257*cdf0e10cSrcweir 		case SID_EXTRUSION_TOOGLE:
258*cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_DOWN:
259*cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_UP:
260*cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_LEFT:
261*cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_RIGHT:
262*cdf0e10cSrcweir 		case SID_EXTRUSION_3D_COLOR:
263*cdf0e10cSrcweir 		case SID_EXTRUSION_DEPTH:
264*cdf0e10cSrcweir 		case SID_EXTRUSION_DIRECTION:
265*cdf0e10cSrcweir 		case SID_EXTRUSION_PROJECTION:
266*cdf0e10cSrcweir 		case SID_EXTRUSION_LIGHTING_DIRECTION:
267*cdf0e10cSrcweir 		case SID_EXTRUSION_LIGHTING_INTENSITY:
268*cdf0e10cSrcweir 		case SID_EXTRUSION_SURFACE:
269*cdf0e10cSrcweir 		case SID_EXTRUSION_DEPTH_FLOATER:
270*cdf0e10cSrcweir 		case SID_EXTRUSION_DIRECTION_FLOATER:
271*cdf0e10cSrcweir 		case SID_EXTRUSION_LIGHTING_FLOATER:
272*cdf0e10cSrcweir 		case SID_EXTRUSION_SURFACE_FLOATER:
273*cdf0e10cSrcweir 		case SID_EXTRUSION_DEPTH_DIALOG:
274*cdf0e10cSrcweir 			svx::ExtrusionBar::execute( pSdrView, rReq, rBnd );
275*cdf0e10cSrcweir 			rReq.Ignore ();
276*cdf0e10cSrcweir 			break;
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir 		case SID_FONTWORK_SHAPE:
279*cdf0e10cSrcweir 		case SID_FONTWORK_SHAPE_TYPE:
280*cdf0e10cSrcweir 		case SID_FONTWORK_ALIGNMENT:
281*cdf0e10cSrcweir 		case SID_FONTWORK_SAME_LETTER_HEIGHTS:
282*cdf0e10cSrcweir 		case SID_FONTWORK_CHARACTER_SPACING:
283*cdf0e10cSrcweir 		case SID_FONTWORK_KERN_CHARACTER_PAIRS:
284*cdf0e10cSrcweir 		case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
285*cdf0e10cSrcweir 		case SID_FONTWORK_ALIGNMENT_FLOATER:
286*cdf0e10cSrcweir 		case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
287*cdf0e10cSrcweir 			svx::FontworkBar::execute( pSdrView, rReq, rBnd );
288*cdf0e10cSrcweir 			rReq.Ignore ();
289*cdf0e10cSrcweir 			break;
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir 		default:
292*cdf0e10cSrcweir 			DBG_ASSERT(!this, "falscher Dispatcher");
293*cdf0e10cSrcweir 			return;
294*cdf0e10cSrcweir 	}
295*cdf0e10cSrcweir 	if (pSdrView->GetModel()->IsChanged())
296*cdf0e10cSrcweir 		rSh.SetModified();
297*cdf0e10cSrcweir 	else if (bChanged)
298*cdf0e10cSrcweir 		pSdrView->GetModel()->SetChanged(sal_True);
299*cdf0e10cSrcweir }
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir /*--------------------------------------------------------------------
302*cdf0e10cSrcweir 	Beschreibung:
303*cdf0e10cSrcweir  --------------------------------------------------------------------*/
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir void SwDrawShell::GetState(SfxItemSet& rSet)
308*cdf0e10cSrcweir {
309*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
310*cdf0e10cSrcweir 	SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
311*cdf0e10cSrcweir 	SfxWhichIter aIter( rSet );
312*cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
313*cdf0e10cSrcweir 	sal_Bool bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT);
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 	if (!bProtected)	// Im Parent nachsehen
316*cdf0e10cSrcweir 		bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir 	while( nWhich )
319*cdf0e10cSrcweir 	{
320*cdf0e10cSrcweir 		switch( nWhich )
321*cdf0e10cSrcweir 		{
322*cdf0e10cSrcweir 			case SID_OBJECT_HELL:
323*cdf0e10cSrcweir 				if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 0 || bProtected )
324*cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
325*cdf0e10cSrcweir 				break;
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 			case SID_OBJECT_HEAVEN:
328*cdf0e10cSrcweir 				if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 1 || bProtected )
329*cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
330*cdf0e10cSrcweir 				break;
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir 			case FN_TOOL_HIERARCHIE:
333*cdf0e10cSrcweir 				if ( !rSh.IsObjSelected() || bProtected )
334*cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
335*cdf0e10cSrcweir 				break;
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir 			case SID_OBJECT_ROTATE:
338*cdf0e10cSrcweir 			{
339*cdf0e10cSrcweir 				const sal_Bool bIsRotate = GetView().IsDrawRotate();
340*cdf0e10cSrcweir 				if ( (!bIsRotate && !pSdrView->IsRotateAllowed()) || bProtected )
341*cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
342*cdf0e10cSrcweir 				else
343*cdf0e10cSrcweir 					rSet.Put( SfxBoolItem( nWhich, bIsRotate ) );
344*cdf0e10cSrcweir 			}
345*cdf0e10cSrcweir 			break;
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir 			case SID_BEZIER_EDIT:
348*cdf0e10cSrcweir 				if (!Disable(rSet, nWhich))
349*cdf0e10cSrcweir 					rSet.Put( SfxBoolItem( nWhich, !GetView().IsDrawSelMode()));
350*cdf0e10cSrcweir 			break;
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 			case FN_FLIP_HORZ_GRAFIC:
353*cdf0e10cSrcweir 				if ( !pSdrView->IsMirrorAllowed() || bProtected )
354*cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
355*cdf0e10cSrcweir 				break;
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir 			case FN_FLIP_VERT_GRAFIC:
358*cdf0e10cSrcweir 				if ( !pSdrView->IsMirrorAllowed() || bProtected )
359*cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
360*cdf0e10cSrcweir 				break;
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir 			case SID_FONTWORK:
363*cdf0e10cSrcweir 			{
364*cdf0e10cSrcweir 				if (bProtected)
365*cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
366*cdf0e10cSrcweir 				else
367*cdf0e10cSrcweir 				{
368*cdf0e10cSrcweir 					const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
369*cdf0e10cSrcweir 					rSet.Put(SfxBoolItem( nWhich , GetView().GetViewFrame()->HasChildWindow(nId)));
370*cdf0e10cSrcweir 				}
371*cdf0e10cSrcweir 			}
372*cdf0e10cSrcweir 			break;
373*cdf0e10cSrcweir 		}
374*cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
375*cdf0e10cSrcweir 	}
376*cdf0e10cSrcweir 	svx::ExtrusionBar::getState( pSdrView, rSet );
377*cdf0e10cSrcweir 	svx::FontworkBar::getState( pSdrView, rSet );
378*cdf0e10cSrcweir }
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir /*--------------------------------------------------------------------
381*cdf0e10cSrcweir 	Beschreibung:
382*cdf0e10cSrcweir  --------------------------------------------------------------------*/
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir SwDrawShell::SwDrawShell(SwView &_rView) :
387*cdf0e10cSrcweir     SwDrawBaseShell(_rView)
388*cdf0e10cSrcweir {
389*cdf0e10cSrcweir 	SetHelpId(SW_DRAWSHELL);
390*cdf0e10cSrcweir 	SetName(String::CreateFromAscii("Draw"));
391*cdf0e10cSrcweir }
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir /*************************************************************************
394*cdf0e10cSrcweir |*
395*cdf0e10cSrcweir |* SfxRequests fuer FontWork bearbeiten
396*cdf0e10cSrcweir |*
397*cdf0e10cSrcweir \************************************************************************/
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir void SwDrawShell::ExecFormText(SfxRequest& rReq)
402*cdf0e10cSrcweir {
403*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
404*cdf0e10cSrcweir 	SdrView*	pDrView = rSh.GetDrawView();
405*cdf0e10cSrcweir 	sal_Bool		bChanged = pDrView->GetModel()->IsChanged();
406*cdf0e10cSrcweir 	pDrView->GetModel()->SetChanged(sal_False);
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir 	if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
411*cdf0e10cSrcweir 	{
412*cdf0e10cSrcweir 		const SfxItemSet& rSet = *rReq.GetArgs();
413*cdf0e10cSrcweir 		const SfxPoolItem* pItem;
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir 		if ( pDrView->IsTextEdit() )
416*cdf0e10cSrcweir 		{
417*cdf0e10cSrcweir 			pDrView->SdrEndTextEdit( sal_True );
418*cdf0e10cSrcweir 			GetView().AttrChangedNotify(&rSh);
419*cdf0e10cSrcweir 		}
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir 		if ( rSet.GetItemState(XATTR_FORMTXTSTDFORM, sal_True, &pItem) ==
422*cdf0e10cSrcweir 			 SFX_ITEM_SET &&
423*cdf0e10cSrcweir 			((const XFormTextStdFormItem*) pItem)->GetValue() != XFTFORM_NONE )
424*cdf0e10cSrcweir 		{
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir 			const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir 			SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*)(GetView().GetViewFrame()->
429*cdf0e10cSrcweir 										GetChildWindow(nId)->GetWindow());
430*cdf0e10cSrcweir 
431*cdf0e10cSrcweir 			pDlg->CreateStdFormObj(*pDrView, *pDrView->GetSdrPageView(),
432*cdf0e10cSrcweir 									rSet, *rMarkList.GetMark(0)->GetMarkedSdrObj(),
433*cdf0e10cSrcweir 								   ((const XFormTextStdFormItem*) pItem)->
434*cdf0e10cSrcweir 								   GetValue());
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir 		}
437*cdf0e10cSrcweir 		else
438*cdf0e10cSrcweir 			pDrView->SetAttributes(rSet);
439*cdf0e10cSrcweir 	}
440*cdf0e10cSrcweir 	if (pDrView->GetModel()->IsChanged())
441*cdf0e10cSrcweir 		rSh.SetModified();
442*cdf0e10cSrcweir 	else
443*cdf0e10cSrcweir 		if (bChanged)
444*cdf0e10cSrcweir 			pDrView->GetModel()->SetChanged(sal_True);
445*cdf0e10cSrcweir }
446*cdf0e10cSrcweir 
447*cdf0e10cSrcweir /*************************************************************************
448*cdf0e10cSrcweir |*
449*cdf0e10cSrcweir |* Statuswerte fuer FontWork zurueckgeben
450*cdf0e10cSrcweir |*
451*cdf0e10cSrcweir \************************************************************************/
452*cdf0e10cSrcweir 
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir void SwDrawShell::GetFormTextState(SfxItemSet& rSet)
456*cdf0e10cSrcweir {
457*cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
458*cdf0e10cSrcweir 	SdrView* pDrView = rSh.GetDrawView();
459*cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
460*cdf0e10cSrcweir 	const SdrObject* pObj = NULL;
461*cdf0e10cSrcweir 	SvxFontWorkDialog* pDlg = NULL;
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir 	const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir 	SfxViewFrame* pVFrame = GetView().GetViewFrame();
466*cdf0e10cSrcweir 	if ( pVFrame->HasChildWindow(nId) )
467*cdf0e10cSrcweir 		pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow());
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir 	if ( rMarkList.GetMarkCount() == 1 )
470*cdf0e10cSrcweir 		pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir 	if ( pObj == NULL || !pObj->ISA(SdrTextObj) ||
473*cdf0e10cSrcweir 		!((SdrTextObj*) pObj)->HasText() )
474*cdf0e10cSrcweir 	{
475*cdf0e10cSrcweir #define	XATTR_ANZ 12
476*cdf0e10cSrcweir 		static const sal_uInt16 nXAttr[ XATTR_ANZ ] =
477*cdf0e10cSrcweir 		{
478*cdf0e10cSrcweir 			XATTR_FORMTXTSTYLE, XATTR_FORMTXTADJUST, XATTR_FORMTXTDISTANCE,
479*cdf0e10cSrcweir 			XATTR_FORMTXTSTART, XATTR_FORMTXTMIRROR, XATTR_FORMTXTSTDFORM,
480*cdf0e10cSrcweir 			XATTR_FORMTXTHIDEFORM, XATTR_FORMTXTOUTLINE, XATTR_FORMTXTSHADOW,
481*cdf0e10cSrcweir 			XATTR_FORMTXTSHDWCOLOR, XATTR_FORMTXTSHDWXVAL, XATTR_FORMTXTSHDWYVAL
482*cdf0e10cSrcweir 		};
483*cdf0e10cSrcweir 		for( sal_uInt16 i = 0; i < XATTR_ANZ; )
484*cdf0e10cSrcweir 			rSet.DisableItem( nXAttr[ i++ ] );
485*cdf0e10cSrcweir 	}
486*cdf0e10cSrcweir 	else
487*cdf0e10cSrcweir 	{
488*cdf0e10cSrcweir 		if ( pDlg )
489*cdf0e10cSrcweir 			pDlg->SetColorTable(XColorTable::GetStdColorTable());
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir 		pDrView->GetAttributes( rSet );
492*cdf0e10cSrcweir 	}
493*cdf0e10cSrcweir }
494*cdf0e10cSrcweir 
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir 
497*cdf0e10cSrcweir 
498