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