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