xref: /trunk/main/sw/source/ui/shells/drawsh.cxx (revision efeef26f81c84063fb0a91bde3856d4a51172d90)
1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*efeef26fSAndrew Rist  * distributed with this work for additional information
6*efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*efeef26fSAndrew Rist  * specific language governing permissions and limitations
18*efeef26fSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*efeef26fSAndrew Rist  *************************************************************/
21*efeef26fSAndrew Rist 
22*efeef26fSAndrew 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:
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 
417cdf0e10cSrcweir         if ( rSet.GetItemState(XATTR_FORMTXTSTDFORM, sal_True, &pItem) ==
418cdf0e10cSrcweir              SFX_ITEM_SET &&
419cdf0e10cSrcweir             ((const XFormTextStdFormItem*) pItem)->GetValue() != XFTFORM_NONE )
420cdf0e10cSrcweir         {
421cdf0e10cSrcweir 
422cdf0e10cSrcweir             const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
423cdf0e10cSrcweir 
424cdf0e10cSrcweir             SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*)(GetView().GetViewFrame()->
425cdf0e10cSrcweir                                         GetChildWindow(nId)->GetWindow());
426cdf0e10cSrcweir 
427cdf0e10cSrcweir             pDlg->CreateStdFormObj(*pDrView, *pDrView->GetSdrPageView(),
428cdf0e10cSrcweir                                     rSet, *rMarkList.GetMark(0)->GetMarkedSdrObj(),
429cdf0e10cSrcweir                                    ((const XFormTextStdFormItem*) pItem)->
430cdf0e10cSrcweir                                    GetValue());
431cdf0e10cSrcweir 
432cdf0e10cSrcweir         }
433cdf0e10cSrcweir         else
434cdf0e10cSrcweir             pDrView->SetAttributes(rSet);
435cdf0e10cSrcweir     }
436cdf0e10cSrcweir     if (pDrView->GetModel()->IsChanged())
437cdf0e10cSrcweir         rSh.SetModified();
438cdf0e10cSrcweir     else
439cdf0e10cSrcweir         if (bChanged)
440cdf0e10cSrcweir             pDrView->GetModel()->SetChanged(sal_True);
441cdf0e10cSrcweir }
442cdf0e10cSrcweir 
443cdf0e10cSrcweir /*************************************************************************
444cdf0e10cSrcweir |*
445cdf0e10cSrcweir |* Statuswerte fuer FontWork zurueckgeben
446cdf0e10cSrcweir |*
447cdf0e10cSrcweir \************************************************************************/
448cdf0e10cSrcweir 
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 
451cdf0e10cSrcweir void SwDrawShell::GetFormTextState(SfxItemSet& rSet)
452cdf0e10cSrcweir {
453cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
454cdf0e10cSrcweir     SdrView* pDrView = rSh.GetDrawView();
455cdf0e10cSrcweir     const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
456cdf0e10cSrcweir     const SdrObject* pObj = NULL;
457cdf0e10cSrcweir     SvxFontWorkDialog* pDlg = NULL;
458cdf0e10cSrcweir 
459cdf0e10cSrcweir     const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
460cdf0e10cSrcweir 
461cdf0e10cSrcweir     SfxViewFrame* pVFrame = GetView().GetViewFrame();
462cdf0e10cSrcweir     if ( pVFrame->HasChildWindow(nId) )
463cdf0e10cSrcweir         pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow());
464cdf0e10cSrcweir 
465cdf0e10cSrcweir     if ( rMarkList.GetMarkCount() == 1 )
466cdf0e10cSrcweir         pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
467cdf0e10cSrcweir 
468cdf0e10cSrcweir     if ( pObj == NULL || !pObj->ISA(SdrTextObj) ||
469cdf0e10cSrcweir         !((SdrTextObj*) pObj)->HasText() )
470cdf0e10cSrcweir     {
471cdf0e10cSrcweir #define XATTR_ANZ 12
472cdf0e10cSrcweir         static const sal_uInt16 nXAttr[ XATTR_ANZ ] =
473cdf0e10cSrcweir         {
474cdf0e10cSrcweir             XATTR_FORMTXTSTYLE, XATTR_FORMTXTADJUST, XATTR_FORMTXTDISTANCE,
475cdf0e10cSrcweir             XATTR_FORMTXTSTART, XATTR_FORMTXTMIRROR, XATTR_FORMTXTSTDFORM,
476cdf0e10cSrcweir             XATTR_FORMTXTHIDEFORM, XATTR_FORMTXTOUTLINE, XATTR_FORMTXTSHADOW,
477cdf0e10cSrcweir             XATTR_FORMTXTSHDWCOLOR, XATTR_FORMTXTSHDWXVAL, XATTR_FORMTXTSHDWYVAL
478cdf0e10cSrcweir         };
479cdf0e10cSrcweir         for( sal_uInt16 i = 0; i < XATTR_ANZ; )
480cdf0e10cSrcweir             rSet.DisableItem( nXAttr[ i++ ] );
481cdf0e10cSrcweir     }
482cdf0e10cSrcweir     else
483cdf0e10cSrcweir     {
484cdf0e10cSrcweir         if ( pDlg )
485cdf0e10cSrcweir             pDlg->SetColorTable(XColorTable::GetStdColorTable());
486cdf0e10cSrcweir 
487cdf0e10cSrcweir         pDrView->GetAttributes( rSet );
488cdf0e10cSrcweir     }
489cdf0e10cSrcweir }
490cdf0e10cSrcweir 
491cdf0e10cSrcweir 
492cdf0e10cSrcweir 
493cdf0e10cSrcweir 
494