xref: /aoo41x/main/sw/source/ui/shells/drawsh.cxx (revision 1e9c32af)
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/extrusionbar.hxx>
39cdf0e10cSrcweir #include <svx/fontworkbar.hxx>
40cdf0e10cSrcweir #include <svx/tbxcustomshapes.hxx>
41cdf0e10cSrcweir #include <uitool.hxx>
42cdf0e10cSrcweir #include <wview.hxx>
43cdf0e10cSrcweir #include <swmodule.hxx>
44cdf0e10cSrcweir #include <swwait.hxx>
45cdf0e10cSrcweir #include <docstat.hxx>
46cdf0e10cSrcweir #include <IDocumentStatistics.hxx>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
49cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #include <svx/xtable.hxx>
52ef076a15SArmin Le Grand #include <svx/svdoashp.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:
172cdf0e10cSrcweir 			bMirror = sal_False;
173cdf0e10cSrcweir 			/* no break */
174cdf0e10cSrcweir         case FN_FLIP_VERT_GRAFIC:
175cdf0e10cSrcweir 			rSh.MirrorSelection( bMirror );
176cdf0e10cSrcweir 			break;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 		case SID_FONTWORK:
179cdf0e10cSrcweir 		{
180cdf0e10cSrcweir             FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView()));
181cdf0e10cSrcweir             SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
182cdf0e10cSrcweir             SfxViewFrame* pVFrame = GetView().GetViewFrame();
183cdf0e10cSrcweir 			if (pArgs)
184cdf0e10cSrcweir 			{
185cdf0e10cSrcweir 				pVFrame->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
186cdf0e10cSrcweir 					((const SfxBoolItem&)(pArgs->Get(SID_FONTWORK))).GetValue());
187cdf0e10cSrcweir 			}
188cdf0e10cSrcweir 			else
189cdf0e10cSrcweir 				pVFrame->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
190cdf0e10cSrcweir 			pVFrame->GetBindings().Invalidate(SID_FONTWORK);
191cdf0e10cSrcweir 		}
192cdf0e10cSrcweir 		break;
193cdf0e10cSrcweir 		case FN_FORMAT_FOOTNOTE_DLG:
194cdf0e10cSrcweir 		{
195cdf0e10cSrcweir             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
196cdf0e10cSrcweir             DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
197cdf0e10cSrcweir 
198cdf0e10cSrcweir             VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), GetView().GetWrtShell(), DLG_DOC_FOOTNOTE );
199cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
200cdf0e10cSrcweir 			pDlg->Execute();
201cdf0e10cSrcweir 			delete pDlg;
202cdf0e10cSrcweir 			break;
203cdf0e10cSrcweir 		}
204cdf0e10cSrcweir 		case FN_NUMBERING_OUTLINE_DLG:
205cdf0e10cSrcweir 		{
206cdf0e10cSrcweir 			SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
207cdf0e10cSrcweir 			SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
208cdf0e10cSrcweir             DBG_ASSERT(pFact, "Dialogdiet fail!");
209cdf0e10cSrcweir             SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
210cdf0e10cSrcweir 														GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
211cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
212cdf0e10cSrcweir 			pDlg->Execute();
213cdf0e10cSrcweir 			delete pDlg;
214cdf0e10cSrcweir 			rReq.Done();
215cdf0e10cSrcweir 		}
216cdf0e10cSrcweir 		break;
217cdf0e10cSrcweir 		case SID_OPEN_XML_FILTERSETTINGS:
218cdf0e10cSrcweir 		{
219cdf0e10cSrcweir 			try
220cdf0e10cSrcweir 			{
221cdf0e10cSrcweir 				uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
222cdf0e10cSrcweir 				if( xDialog.is() )
223cdf0e10cSrcweir 				{
224cdf0e10cSrcweir 					xDialog->execute();
225cdf0e10cSrcweir 				}
226cdf0e10cSrcweir 			}
227cdf0e10cSrcweir 			catch( uno::Exception& )
228cdf0e10cSrcweir 			{
229cdf0e10cSrcweir 			}
230cdf0e10cSrcweir 			rReq.Ignore ();
231cdf0e10cSrcweir 		}
232cdf0e10cSrcweir 		break;
233cdf0e10cSrcweir 		case FN_WORDCOUNT_DIALOG:
234cdf0e10cSrcweir 		{
235cdf0e10cSrcweir 			SwDocStat aCurr;
236cdf0e10cSrcweir 			SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
237cdf0e10cSrcweir 			{
238cdf0e10cSrcweir 				SwWait aWait( *GetView().GetDocShell(), sal_True );
239cdf0e10cSrcweir 				rSh.StartAction();
240cdf0e10cSrcweir 				rSh.CountWords( aCurr );
241cdf0e10cSrcweir 				rSh.UpdateDocStat( aDocStat );
242cdf0e10cSrcweir 				rSh.EndAction();
243cdf0e10cSrcweir 			}
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 			SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
246cdf0e10cSrcweir 			DBG_ASSERT(pFact, "Dialogdiet fail!");
247cdf0e10cSrcweir 			AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() );
248cdf0e10cSrcweir 			pDialog->SetValues(aCurr, aDocStat );
249cdf0e10cSrcweir 			pDialog->Execute();
250cdf0e10cSrcweir 			delete pDialog;
251cdf0e10cSrcweir 		}
252cdf0e10cSrcweir 		break;
253cdf0e10cSrcweir 		case SID_EXTRUSION_TOOGLE:
254cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_DOWN:
255cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_UP:
256cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_LEFT:
257cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_RIGHT:
258cdf0e10cSrcweir 		case SID_EXTRUSION_3D_COLOR:
259cdf0e10cSrcweir 		case SID_EXTRUSION_DEPTH:
260cdf0e10cSrcweir 		case SID_EXTRUSION_DIRECTION:
261cdf0e10cSrcweir 		case SID_EXTRUSION_PROJECTION:
262cdf0e10cSrcweir 		case SID_EXTRUSION_LIGHTING_DIRECTION:
263cdf0e10cSrcweir 		case SID_EXTRUSION_LIGHTING_INTENSITY:
264cdf0e10cSrcweir 		case SID_EXTRUSION_SURFACE:
265cdf0e10cSrcweir 		case SID_EXTRUSION_DEPTH_FLOATER:
266cdf0e10cSrcweir 		case SID_EXTRUSION_DIRECTION_FLOATER:
267cdf0e10cSrcweir 		case SID_EXTRUSION_LIGHTING_FLOATER:
268cdf0e10cSrcweir 		case SID_EXTRUSION_SURFACE_FLOATER:
269cdf0e10cSrcweir 		case SID_EXTRUSION_DEPTH_DIALOG:
270cdf0e10cSrcweir 			svx::ExtrusionBar::execute( pSdrView, rReq, rBnd );
271cdf0e10cSrcweir 			rReq.Ignore ();
272cdf0e10cSrcweir 			break;
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 		case SID_FONTWORK_SHAPE:
275cdf0e10cSrcweir 		case SID_FONTWORK_SHAPE_TYPE:
276cdf0e10cSrcweir 		case SID_FONTWORK_ALIGNMENT:
277cdf0e10cSrcweir 		case SID_FONTWORK_SAME_LETTER_HEIGHTS:
278cdf0e10cSrcweir 		case SID_FONTWORK_CHARACTER_SPACING:
279cdf0e10cSrcweir 		case SID_FONTWORK_KERN_CHARACTER_PAIRS:
280cdf0e10cSrcweir 		case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
281cdf0e10cSrcweir 		case SID_FONTWORK_ALIGNMENT_FLOATER:
282cdf0e10cSrcweir 		case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
283cdf0e10cSrcweir 			svx::FontworkBar::execute( pSdrView, rReq, rBnd );
284cdf0e10cSrcweir 			rReq.Ignore ();
285cdf0e10cSrcweir 			break;
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 		default:
288cdf0e10cSrcweir 			DBG_ASSERT(!this, "falscher Dispatcher");
289cdf0e10cSrcweir 			return;
290cdf0e10cSrcweir 	}
291cdf0e10cSrcweir 	if (pSdrView->GetModel()->IsChanged())
292cdf0e10cSrcweir 		rSh.SetModified();
293cdf0e10cSrcweir 	else if (bChanged)
294cdf0e10cSrcweir 		pSdrView->GetModel()->SetChanged(sal_True);
295cdf0e10cSrcweir }
296cdf0e10cSrcweir 
297cdf0e10cSrcweir /*--------------------------------------------------------------------
298cdf0e10cSrcweir 	Beschreibung:
299cdf0e10cSrcweir  --------------------------------------------------------------------*/
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 
303cdf0e10cSrcweir void SwDrawShell::GetState(SfxItemSet& rSet)
304cdf0e10cSrcweir {
305cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
306cdf0e10cSrcweir 	SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
307cdf0e10cSrcweir 	SfxWhichIter aIter( rSet );
308cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
309cdf0e10cSrcweir 	sal_Bool bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT);
310cdf0e10cSrcweir 
311cdf0e10cSrcweir 	if (!bProtected)	// Im Parent nachsehen
312cdf0e10cSrcweir 		bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 	while( nWhich )
315cdf0e10cSrcweir 	{
316cdf0e10cSrcweir 		switch( nWhich )
317cdf0e10cSrcweir 		{
318cdf0e10cSrcweir 			case SID_OBJECT_HELL:
319cdf0e10cSrcweir 				if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 0 || bProtected )
320cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
321cdf0e10cSrcweir 				break;
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 			case SID_OBJECT_HEAVEN:
324cdf0e10cSrcweir 				if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 1 || bProtected )
325cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
326cdf0e10cSrcweir 				break;
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 			case FN_TOOL_HIERARCHIE:
329cdf0e10cSrcweir 				if ( !rSh.IsObjSelected() || bProtected )
330cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
331cdf0e10cSrcweir 				break;
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 			case SID_OBJECT_ROTATE:
334cdf0e10cSrcweir 			{
335cdf0e10cSrcweir 				const sal_Bool bIsRotate = GetView().IsDrawRotate();
336cdf0e10cSrcweir 				if ( (!bIsRotate && !pSdrView->IsRotateAllowed()) || bProtected )
337cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
338cdf0e10cSrcweir 				else
339cdf0e10cSrcweir 					rSet.Put( SfxBoolItem( nWhich, bIsRotate ) );
340cdf0e10cSrcweir 			}
341cdf0e10cSrcweir 			break;
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 			case SID_BEZIER_EDIT:
344cdf0e10cSrcweir 				if (!Disable(rSet, nWhich))
345cdf0e10cSrcweir 					rSet.Put( SfxBoolItem( nWhich, !GetView().IsDrawSelMode()));
346cdf0e10cSrcweir 			break;
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 			case FN_FLIP_HORZ_GRAFIC:
349cdf0e10cSrcweir 				if ( !pSdrView->IsMirrorAllowed() || bProtected )
350cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
351cdf0e10cSrcweir 				break;
352cdf0e10cSrcweir 
353cdf0e10cSrcweir 			case FN_FLIP_VERT_GRAFIC:
354cdf0e10cSrcweir 				if ( !pSdrView->IsMirrorAllowed() || bProtected )
355cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
356cdf0e10cSrcweir 				break;
357cdf0e10cSrcweir 
358cdf0e10cSrcweir 			case SID_FONTWORK:
359cdf0e10cSrcweir 			{
360cdf0e10cSrcweir 				if (bProtected)
361cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
362cdf0e10cSrcweir 				else
363cdf0e10cSrcweir 				{
364cdf0e10cSrcweir 					const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
365cdf0e10cSrcweir 					rSet.Put(SfxBoolItem( nWhich , GetView().GetViewFrame()->HasChildWindow(nId)));
366cdf0e10cSrcweir 				}
367cdf0e10cSrcweir 			}
368cdf0e10cSrcweir 			break;
369cdf0e10cSrcweir 		}
370cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
371cdf0e10cSrcweir 	}
372cdf0e10cSrcweir 	svx::ExtrusionBar::getState( pSdrView, rSet );
373cdf0e10cSrcweir 	svx::FontworkBar::getState( pSdrView, rSet );
374cdf0e10cSrcweir }
375cdf0e10cSrcweir 
376cdf0e10cSrcweir /*--------------------------------------------------------------------
377cdf0e10cSrcweir 	Beschreibung:
378cdf0e10cSrcweir  --------------------------------------------------------------------*/
379cdf0e10cSrcweir 
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 
382cdf0e10cSrcweir SwDrawShell::SwDrawShell(SwView &_rView) :
383cdf0e10cSrcweir     SwDrawBaseShell(_rView)
384cdf0e10cSrcweir {
385cdf0e10cSrcweir 	SetHelpId(SW_DRAWSHELL);
386cdf0e10cSrcweir 	SetName(String::CreateFromAscii("Draw"));
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir /*************************************************************************
390cdf0e10cSrcweir |*
391cdf0e10cSrcweir |* SfxRequests fuer FontWork bearbeiten
392cdf0e10cSrcweir |*
393cdf0e10cSrcweir \************************************************************************/
394cdf0e10cSrcweir 
395cdf0e10cSrcweir 
396cdf0e10cSrcweir 
397cdf0e10cSrcweir void SwDrawShell::ExecFormText(SfxRequest& rReq)
398cdf0e10cSrcweir {
399cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
400cdf0e10cSrcweir 	SdrView*	pDrView = rSh.GetDrawView();
401cdf0e10cSrcweir 	sal_Bool		bChanged = pDrView->GetModel()->IsChanged();
402cdf0e10cSrcweir 	pDrView->GetModel()->SetChanged(sal_False);
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
405cdf0e10cSrcweir 
406cdf0e10cSrcweir 	if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
407cdf0e10cSrcweir 	{
408cdf0e10cSrcweir 		const SfxItemSet& rSet = *rReq.GetArgs();
409cdf0e10cSrcweir 		const SfxPoolItem* pItem;
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 		if ( pDrView->IsTextEdit() )
412cdf0e10cSrcweir 		{
413cdf0e10cSrcweir 			pDrView->SdrEndTextEdit( sal_True );
414cdf0e10cSrcweir 			GetView().AttrChangedNotify(&rSh);
415cdf0e10cSrcweir 		}
416cdf0e10cSrcweir 
417*1e9c32afSArmin Le Grand 		pDrView->SetAttributes(rSet);
418cdf0e10cSrcweir 	}
419cdf0e10cSrcweir 	if (pDrView->GetModel()->IsChanged())
420cdf0e10cSrcweir 		rSh.SetModified();
421cdf0e10cSrcweir 	else
422cdf0e10cSrcweir 		if (bChanged)
423cdf0e10cSrcweir 			pDrView->GetModel()->SetChanged(sal_True);
424cdf0e10cSrcweir }
425cdf0e10cSrcweir 
426cdf0e10cSrcweir /*************************************************************************
427cdf0e10cSrcweir |*
428cdf0e10cSrcweir |* Statuswerte fuer FontWork zurueckgeben
429cdf0e10cSrcweir |*
430cdf0e10cSrcweir \************************************************************************/
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 
433cdf0e10cSrcweir 
434cdf0e10cSrcweir void SwDrawShell::GetFormTextState(SfxItemSet& rSet)
435cdf0e10cSrcweir {
436cdf0e10cSrcweir 	SwWrtShell &rSh = GetShell();
437cdf0e10cSrcweir 	SdrView* pDrView = rSh.GetDrawView();
438cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
439cdf0e10cSrcweir 	const SdrObject* pObj = NULL;
440cdf0e10cSrcweir 	SvxFontWorkDialog* pDlg = NULL;
441cdf0e10cSrcweir 
442cdf0e10cSrcweir 	const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
443cdf0e10cSrcweir 
444cdf0e10cSrcweir 	SfxViewFrame* pVFrame = GetView().GetViewFrame();
445cdf0e10cSrcweir 	if ( pVFrame->HasChildWindow(nId) )
446cdf0e10cSrcweir 		pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow());
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 	if ( rMarkList.GetMarkCount() == 1 )
449cdf0e10cSrcweir 		pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
450cdf0e10cSrcweir 
451ef076a15SArmin Le Grand     const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
452ef076a15SArmin Le Grand     const bool bDeactivate(
453ef076a15SArmin Le Grand         !pObj ||
454ef076a15SArmin Le Grand         !pTextObj ||
455ef076a15SArmin Le Grand         !pTextObj->HasText() ||
456ef076a15SArmin Le Grand         dynamic_cast< const SdrObjCustomShape* >(pObj)); // #121538# no FontWork for CustomShapes
457ef076a15SArmin Le Grand 
458ef076a15SArmin Le Grand     if(bDeactivate)
459cdf0e10cSrcweir 	{
460ef076a15SArmin Le Grand         rSet.DisableItem(XATTR_FORMTXTSTYLE);
461ef076a15SArmin Le Grand         rSet.DisableItem(XATTR_FORMTXTADJUST);
462ef076a15SArmin Le Grand         rSet.DisableItem(XATTR_FORMTXTDISTANCE);
463ef076a15SArmin Le Grand         rSet.DisableItem(XATTR_FORMTXTSTART);
464ef076a15SArmin Le Grand         rSet.DisableItem(XATTR_FORMTXTMIRROR);
465ef076a15SArmin Le Grand         rSet.DisableItem(XATTR_FORMTXTHIDEFORM);
466ef076a15SArmin Le Grand         rSet.DisableItem(XATTR_FORMTXTOUTLINE);
467ef076a15SArmin Le Grand         rSet.DisableItem(XATTR_FORMTXTSHADOW);
468ef076a15SArmin Le Grand         rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR);
469ef076a15SArmin Le Grand         rSet.DisableItem(XATTR_FORMTXTSHDWXVAL);
470ef076a15SArmin Le Grand         rSet.DisableItem(XATTR_FORMTXTSHDWYVAL);
471cdf0e10cSrcweir 	}
472cdf0e10cSrcweir 	else
473cdf0e10cSrcweir 	{
474cdf0e10cSrcweir 		if ( pDlg )
475cdf0e10cSrcweir 			pDlg->SetColorTable(XColorTable::GetStdColorTable());
476cdf0e10cSrcweir 
477cdf0e10cSrcweir 		pDrView->GetAttributes( rSet );
478cdf0e10cSrcweir 	}
479cdf0e10cSrcweir }
480cdf0e10cSrcweir 
481cdf0e10cSrcweir 
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 
484