xref: /trunk/main/sd/source/ui/view/drviews2.cxx (revision d5370dc8b91641fa460c79c207c7018af41d7460)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "DrawViewShell.hxx"
28cdf0e10cSrcweir #include "ViewShellImplementation.hxx"
29cdf0e10cSrcweir #include <vcl/waitobj.hxx>
30cdf0e10cSrcweir #include <svx/svdograf.hxx>
31cdf0e10cSrcweir #ifndef _SVXIDS_HRC
32cdf0e10cSrcweir #include <svx/svxids.hrc>
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #include <svx/svdpagv.hxx>
35cdf0e10cSrcweir #include <svx/svdundo.hxx>
36cdf0e10cSrcweir #ifndef _ZOOMITEM_HXX
37cdf0e10cSrcweir #include <svx/zoomitem.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _EDITDATA_HXX
40cdf0e10cSrcweir #include <editeng/editdata.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #include <basic/sberrors.hxx>
43cdf0e10cSrcweir #include <vcl/msgbox.hxx>
44cdf0e10cSrcweir #include <sfx2/request.hxx>
45cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
46cdf0e10cSrcweir #include <svx/xfillit0.hxx>
47cdf0e10cSrcweir #include <svx/xflclit.hxx>
48cdf0e10cSrcweir #include <svl/aeitem.hxx>
49cdf0e10cSrcweir #include <editeng/eeitem.hxx>
50cdf0e10cSrcweir #include <basic/sbstar.hxx>
51cdf0e10cSrcweir #include <editeng/flditem.hxx>
52cdf0e10cSrcweir #include <svx/xlineit0.hxx>
53cdf0e10cSrcweir #include <svx/xfillit0.hxx>
54cdf0e10cSrcweir 
55cdf0e10cSrcweir #ifndef _SDOUTL_HXX //autogen
56cdf0e10cSrcweir #include <svx/svdoutl.hxx>
57cdf0e10cSrcweir #endif
58cdf0e10cSrcweir #include <svx/xlnwtit.hxx>
59cdf0e10cSrcweir #include <svx/svdoattr.hxx>
60cdf0e10cSrcweir #include <svx/xlnstwit.hxx>
61cdf0e10cSrcweir #include <svx/sdtmfitm.hxx>
62cdf0e10cSrcweir #include <svx/sdtagitm.hxx>
63cdf0e10cSrcweir #include <svx/xlnedwit.hxx>
64cdf0e10cSrcweir #include <svx/fontworkbar.hxx>
65cdf0e10cSrcweir 
66cdf0e10cSrcweir #include <svx/svxdlg.hxx>
67cdf0e10cSrcweir #include <svx/dialogs.hrc>
68cdf0e10cSrcweir 
69cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
70cdf0e10cSrcweir #include "sdgrffilter.hxx"
71cdf0e10cSrcweir 
72cdf0e10cSrcweir #include "app.hrc"
73cdf0e10cSrcweir #include "glob.hrc"
74cdf0e10cSrcweir #include "helpids.h"
75cdf0e10cSrcweir #include "sdattr.hxx"
76cdf0e10cSrcweir #include "drawview.hxx"
77cdf0e10cSrcweir #include "Window.hxx"
78cdf0e10cSrcweir #include "drawdoc.hxx"
79cdf0e10cSrcweir #include "DrawDocShell.hxx"
80cdf0e10cSrcweir #include "sdpage.hxx"
81cdf0e10cSrcweir #include "fuscale.hxx"
82cdf0e10cSrcweir #include "sdresid.hxx"
83cdf0e10cSrcweir #include "GraphicViewShell.hxx"
84cdf0e10cSrcweir #include "unmodpg.hxx"
85cdf0e10cSrcweir #include "slideshow.hxx"
86cdf0e10cSrcweir #include "fuvect.hxx"
87cdf0e10cSrcweir #include "stlpool.hxx"
88cdf0e10cSrcweir 
89cdf0e10cSrcweir // #90356#
90cdf0e10cSrcweir #include "optsitem.hxx"
91cdf0e10cSrcweir #include "sdabstdlg.hxx"
92cdf0e10cSrcweir #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
93cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPages.hpp>
94cdf0e10cSrcweir 
95cdf0e10cSrcweir #include <strings.hrc>
96cdf0e10cSrcweir 
97cdf0e10cSrcweir using namespace ::com::sun::star;
98cdf0e10cSrcweir using namespace ::com::sun::star::uno;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir namespace sd {
101cdf0e10cSrcweir 
102cdf0e10cSrcweir /*************************************************************************
103cdf0e10cSrcweir |*
104cdf0e10cSrcweir |* SfxRequests fuer temporaere Funktionen
105cdf0e10cSrcweir |*
106cdf0e10cSrcweir \************************************************************************/
107cdf0e10cSrcweir 
108cdf0e10cSrcweir void DrawViewShell::FuTemporary(SfxRequest& rReq)
109cdf0e10cSrcweir {
110cdf0e10cSrcweir     // Waehrend einer Native-Diashow wird nichts ausgefuehrt!
111cdf0e10cSrcweir     if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq.GetSlot() != SID_NAVIGATOR))
112cdf0e10cSrcweir         return;
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     DBG_ASSERT( mpDrawView, "sd::DrawViewShell::FuTemporary(), no draw view!" );
115cdf0e10cSrcweir     if( !mpDrawView )
116cdf0e10cSrcweir         return;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     CheckLineTo (rReq);
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     DeactivateCurrentFunction();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     sal_uInt16 nSId = rReq.GetSlot();
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     // Slot wird gemapped (ToolboxImages/-Slots)
125cdf0e10cSrcweir     MapSlot( nSId );
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     switch ( nSId )
128cdf0e10cSrcweir     {
129cdf0e10cSrcweir         // Flaechen und Linien-Attribute:
130cdf0e10cSrcweir         // Sollten (wie StateMethode) eine eigene
131cdf0e10cSrcweir         // Execute-Methode besitzen
132cdf0e10cSrcweir         case SID_ATTR_FILL_STYLE:
133cdf0e10cSrcweir         case SID_ATTR_FILL_COLOR:
134cdf0e10cSrcweir         case SID_ATTR_FILL_GRADIENT:
135cdf0e10cSrcweir         case SID_ATTR_FILL_HATCH:
136cdf0e10cSrcweir         case SID_ATTR_FILL_BITMAP:
137cdf0e10cSrcweir         case SID_ATTR_FILL_SHADOW:
138*d5370dc8SArmin Le Grand         case SID_ATTR_FILL_TRANSPARENCE:
139*d5370dc8SArmin Le Grand         case SID_ATTR_FILL_FLOATTRANSPARENCE:
140cdf0e10cSrcweir 
141cdf0e10cSrcweir         case SID_ATTR_LINE_STYLE:
142cdf0e10cSrcweir         case SID_ATTR_LINE_DASH:
143cdf0e10cSrcweir         case SID_ATTR_LINE_WIDTH:
144cdf0e10cSrcweir         case SID_ATTR_LINE_COLOR:
145cdf0e10cSrcweir         case SID_ATTR_LINEEND_STYLE:
146*d5370dc8SArmin Le Grand         case SID_ATTR_LINE_START:
147*d5370dc8SArmin Le Grand         case SID_ATTR_LINE_END:
148*d5370dc8SArmin Le Grand         case SID_ATTR_LINE_TRANSPARENCE:
149*d5370dc8SArmin Le Grand         case SID_ATTR_LINE_JOINT:
150*d5370dc8SArmin Le Grand         case SID_ATTR_LINE_CAP:
151cdf0e10cSrcweir 
152cdf0e10cSrcweir         case SID_ATTR_TEXT_FITTOSIZE:
153cdf0e10cSrcweir         {
154cdf0e10cSrcweir             if( rReq.GetArgs() )
155cdf0e10cSrcweir             {
156cdf0e10cSrcweir                 sal_Bool bMergeUndo = sal_False;
157cdf0e10cSrcweir                 ::svl::IUndoManager* pUndoManager = GetDocSh()->GetUndoManager();
158cdf0e10cSrcweir 
159cdf0e10cSrcweir                 // Anpassungen Start/EndWidth #63083#
160cdf0e10cSrcweir                 if(nSId == SID_ATTR_LINE_WIDTH)
161cdf0e10cSrcweir                 {
162cdf0e10cSrcweir                     SdrObject* pObj = NULL;
163cdf0e10cSrcweir                     const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
164cdf0e10cSrcweir                     sal_uLong nCount = rMarkList.GetMarkCount();
1651dc0a253SArmin Le Grand                     const sal_Int32 nNewLineWidth(((const XLineWidthItem&)rReq.GetArgs()->Get(XATTR_LINEWIDTH)).GetValue());
1661dc0a253SArmin Le Grand                     const bool bUndo(mpDrawView->IsUndoEnabled());
167cdf0e10cSrcweir 
168cdf0e10cSrcweir                     for (sal_uLong i=0; i<nCount; i++)
169cdf0e10cSrcweir                     {
170cdf0e10cSrcweir                         SfxItemSet aAttr(GetDoc()->GetPool());
171cdf0e10cSrcweir                         pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
172cdf0e10cSrcweir                         aAttr.Put(pObj->GetMergedItemSet());
173cdf0e10cSrcweir 
174cdf0e10cSrcweir                         sal_Int32 nActLineWidth = ((const XLineWidthItem&)aAttr.Get(XATTR_LINEWIDTH)).GetValue();
175cdf0e10cSrcweir 
176cdf0e10cSrcweir                         if(nActLineWidth != nNewLineWidth)
177cdf0e10cSrcweir                         {
178cdf0e10cSrcweir                             sal_Bool bSetItemSet(sal_False);
179cdf0e10cSrcweir 
180cdf0e10cSrcweir                             // #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
181cdf0e10cSrcweir                             if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINESTARTWIDTH))
182cdf0e10cSrcweir                             {
183cdf0e10cSrcweir                                 sal_Int32 nValAct = ((const XLineStartWidthItem&)aAttr.Get(XATTR_LINESTARTWIDTH)).GetValue();
184cdf0e10cSrcweir                                 sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
185cdf0e10cSrcweir                                 if(nValNew < 0)
186cdf0e10cSrcweir                                     nValNew = 0;
187cdf0e10cSrcweir                                 bSetItemSet = sal_True;
188cdf0e10cSrcweir                                 aAttr.Put(XLineStartWidthItem(nValNew));
189cdf0e10cSrcweir                             }
190cdf0e10cSrcweir 
191cdf0e10cSrcweir                             // #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
192cdf0e10cSrcweir                             if(SFX_ITEM_DONTCARE != aAttr.GetItemState(XATTR_LINEENDWIDTH))
193cdf0e10cSrcweir                             {
194cdf0e10cSrcweir                                 sal_Int32 nValAct = ((const XLineEndWidthItem&)aAttr.Get(XATTR_LINEENDWIDTH)).GetValue();
195cdf0e10cSrcweir                                 sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
196cdf0e10cSrcweir                                 if(nValNew < 0)
197cdf0e10cSrcweir                                     nValNew = 0;
198cdf0e10cSrcweir                                 bSetItemSet = sal_True;
199cdf0e10cSrcweir                                 aAttr.Put(XLineEndWidthItem(nValNew));
200cdf0e10cSrcweir                             }
201cdf0e10cSrcweir 
202cdf0e10cSrcweir                             if(bSetItemSet)
2031dc0a253SArmin Le Grand                             {
2041dc0a253SArmin Le Grand                                 if(bUndo)
2051dc0a253SArmin Le Grand                                 {
2061dc0a253SArmin Le Grand                                     if(!bMergeUndo)
2071dc0a253SArmin Le Grand                                     {
2081dc0a253SArmin Le Grand                                         pUndoManager->EnterListAction( String(), String() );
2091dc0a253SArmin Le Grand                                         mpDrawView->BegUndo();
2101dc0a253SArmin Le Grand                                         bMergeUndo = sal_True;
2111dc0a253SArmin Le Grand                                     }
2121dc0a253SArmin Le Grand 
2131dc0a253SArmin Le Grand                                     mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
2141dc0a253SArmin Le Grand                                 }
2151dc0a253SArmin Le Grand 
216cdf0e10cSrcweir                                 pObj->SetMergedItemSet(aAttr);
217cdf0e10cSrcweir                             }
218cdf0e10cSrcweir                         }
219cdf0e10cSrcweir                     }
220cdf0e10cSrcweir 
2211dc0a253SArmin Le Grand                     if(bMergeUndo)
2221dc0a253SArmin Le Grand                     {
2231dc0a253SArmin Le Grand                         mpDrawView->EndUndo();
2241dc0a253SArmin Le Grand                     }
2251dc0a253SArmin Le Grand                 }
2261dc0a253SArmin Le Grand 
227cdf0e10cSrcweir                 if (nSId == SID_ATTR_FILL_SHADOW)
228cdf0e10cSrcweir                 {
229cdf0e10cSrcweir                     // Ggf. werden transparente Objekte wei?gefuellt
230cdf0e10cSrcweir                     SdrObject* pObj = NULL;
231cdf0e10cSrcweir                     const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
232cdf0e10cSrcweir                     sal_uLong nCount = rMarkList.GetMarkCount();
233cdf0e10cSrcweir                     const bool bUndo = mpDrawView->IsUndoEnabled();
234cdf0e10cSrcweir 
235cdf0e10cSrcweir                     for (sal_uLong i=0; i<nCount; i++)
236cdf0e10cSrcweir                     {
237cdf0e10cSrcweir                         SfxItemSet aAttr(GetDoc()->GetPool());
238cdf0e10cSrcweir                         pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
239cdf0e10cSrcweir 
240cdf0e10cSrcweir                         // #i25616#
241cdf0e10cSrcweir                         if(!pObj->ISA(SdrGrafObj))
242cdf0e10cSrcweir                         {
243cdf0e10cSrcweir                             aAttr.Put(pObj->GetMergedItemSet());
244cdf0e10cSrcweir 
2451dc0a253SArmin Le Grand                             const XFillStyleItem& rFillStyle = (const XFillStyleItem&) aAttr.Get(XATTR_FILLSTYLE);
2461dc0a253SArmin Le Grand                             const XLineStyleItem& rLineStyle = (const XLineStyleItem&) aAttr.Get(XATTR_LINESTYLE);
247cdf0e10cSrcweir 
2481dc0a253SArmin Le Grand                             if(XFILL_NONE == rFillStyle.GetValue() && XLINE_NONE == rLineStyle.GetValue())
249cdf0e10cSrcweir                             {
250cdf0e10cSrcweir                                 if( bUndo )
251cdf0e10cSrcweir                                 {
252cdf0e10cSrcweir                                     // Vorlage hat keine Fuellung,
253cdf0e10cSrcweir                                     // daher hart attributieren: Fuellung setzen
254cdf0e10cSrcweir                                     if (!bMergeUndo)
255cdf0e10cSrcweir                                     {
256cdf0e10cSrcweir                                         bMergeUndo = sal_True;
257cdf0e10cSrcweir                                         pUndoManager->EnterListAction( String(), String() );
258cdf0e10cSrcweir                                         mpDrawView->BegUndo();
259cdf0e10cSrcweir                                     }
260cdf0e10cSrcweir 
261cdf0e10cSrcweir                                     mpDrawView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
262cdf0e10cSrcweir                                 }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir                                 aAttr.Put(XFillStyleItem(XFILL_SOLID));
265cdf0e10cSrcweir                                 aAttr.Put(XFillColorItem(String(), COL_WHITE));
266cdf0e10cSrcweir 
267cdf0e10cSrcweir                                 pObj->SetMergedItemSet(aAttr);
268cdf0e10cSrcweir                             }
269cdf0e10cSrcweir                         }
270cdf0e10cSrcweir                     }
271cdf0e10cSrcweir 
272cdf0e10cSrcweir                     if (bMergeUndo)
273cdf0e10cSrcweir                     {
274cdf0e10cSrcweir                         mpDrawView->EndUndo();
275cdf0e10cSrcweir                     }
276cdf0e10cSrcweir                 }
277cdf0e10cSrcweir 
278cdf0e10cSrcweir                 mpDrawView->SetAttributes(*rReq.GetArgs());
279cdf0e10cSrcweir 
280cdf0e10cSrcweir                 if (bMergeUndo)
281cdf0e10cSrcweir                 {
282cdf0e10cSrcweir                     pUndoManager->LeaveListAction();
283cdf0e10cSrcweir                 }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir                 rReq.Done();
286cdf0e10cSrcweir             }
287cdf0e10cSrcweir             else
288cdf0e10cSrcweir             {
289cdf0e10cSrcweir                 switch( rReq.GetSlot() )
290cdf0e10cSrcweir                 {
291cdf0e10cSrcweir                     case SID_ATTR_FILL_SHADOW:
292cdf0e10cSrcweir                     case SID_ATTR_FILL_STYLE:
293cdf0e10cSrcweir                     case SID_ATTR_FILL_COLOR:
294cdf0e10cSrcweir                     case SID_ATTR_FILL_GRADIENT:
295cdf0e10cSrcweir                     case SID_ATTR_FILL_HATCH:
296cdf0e10cSrcweir                     case SID_ATTR_FILL_BITMAP:
297*d5370dc8SArmin Le Grand                     case SID_ATTR_FILL_TRANSPARENCE:
298*d5370dc8SArmin Le Grand                     case SID_ATTR_FILL_FLOATTRANSPARENCE:
299cdf0e10cSrcweir                         GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON );
300cdf0e10cSrcweir                         break;
301cdf0e10cSrcweir                     case SID_ATTR_LINE_STYLE:
302cdf0e10cSrcweir                     case SID_ATTR_LINE_DASH:
303cdf0e10cSrcweir                     case SID_ATTR_LINE_WIDTH:
304cdf0e10cSrcweir                     case SID_ATTR_LINE_COLOR:
305*d5370dc8SArmin Le Grand                     case SID_ATTR_LINE_TRANSPARENCE:
306*d5370dc8SArmin Le Grand                     case SID_ATTR_LINE_JOINT:
307*d5370dc8SArmin Le Grand                     case SID_ATTR_LINE_CAP:
308cdf0e10cSrcweir                         GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SFX_CALLMODE_ASYNCHRON );
309cdf0e10cSrcweir                         break;
310cdf0e10cSrcweir                     case SID_ATTR_TEXT_FITTOSIZE:
311cdf0e10cSrcweir                         GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG, SFX_CALLMODE_ASYNCHRON );
312cdf0e10cSrcweir                         break;
313cdf0e10cSrcweir                 }
314cdf0e10cSrcweir             }
315cdf0e10cSrcweir             Cancel();
316cdf0e10cSrcweir         }
317cdf0e10cSrcweir         break;
318cdf0e10cSrcweir 
319cdf0e10cSrcweir         case SID_HYPHENATION:
320cdf0e10cSrcweir         {
321cdf0e10cSrcweir             // const SfxPoolItem* pItem = rReq.GetArg( SID_HYPHENATION );
322cdf0e10cSrcweir             //  ^-- Soll so nicht benutzt werden (Defaults sind falsch) !
323cdf0e10cSrcweir             SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, SID_HYPHENATION, sal_False);
324cdf0e10cSrcweir 
325cdf0e10cSrcweir             if( pItem )
326cdf0e10cSrcweir             {
327cdf0e10cSrcweir                 SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
328cdf0e10cSrcweir                 sal_Bool bValue = ( (const SfxBoolItem*) pItem)->GetValue();
329cdf0e10cSrcweir                 aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
330cdf0e10cSrcweir                 mpDrawView->SetAttributes( aSet );
331cdf0e10cSrcweir             }
332cdf0e10cSrcweir             else // nur zum Test
333cdf0e10cSrcweir             {
334cdf0e10cSrcweir                 DBG_ERROR(" Kein Wert fuer Silbentrennung!");
335cdf0e10cSrcweir                 SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
336cdf0e10cSrcweir                 sal_Bool bValue = sal_True;
337cdf0e10cSrcweir                 aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
338cdf0e10cSrcweir                 mpDrawView->SetAttributes( aSet );
339cdf0e10cSrcweir             }
340cdf0e10cSrcweir             rReq.Done();
341cdf0e10cSrcweir             Cancel();
342cdf0e10cSrcweir         }
343cdf0e10cSrcweir         break;
344cdf0e10cSrcweir 
345cdf0e10cSrcweir         case SID_INSERTPAGE:
346cdf0e10cSrcweir         case SID_INSERTPAGE_QUICK:
347cdf0e10cSrcweir         case SID_DUPLICATE_PAGE:
348cdf0e10cSrcweir         {
349cdf0e10cSrcweir             SdPage* pNewPage = CreateOrDuplicatePage (rReq, mePageKind, GetActualPage());
350cdf0e10cSrcweir             Cancel();
351cdf0e10cSrcweir             if(HasCurrentFunction(SID_BEZIER_EDIT) )
352cdf0e10cSrcweir                 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
353cdf0e10cSrcweir             if (pNewPage != NULL)
354cdf0e10cSrcweir                 SwitchPage((pNewPage->GetPageNum()-1)/2);
355cdf0e10cSrcweir             rReq.Done ();
356cdf0e10cSrcweir         }
357cdf0e10cSrcweir         break;
358cdf0e10cSrcweir 
359cdf0e10cSrcweir         case SID_INSERT_MASTER_PAGE:
360cdf0e10cSrcweir         {
361cdf0e10cSrcweir             // Use the API to create a new page.
362cdf0e10cSrcweir             Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier (
363cdf0e10cSrcweir                 GetDoc()->getUnoModel(), UNO_QUERY);
364cdf0e10cSrcweir             if (xMasterPagesSupplier.is())
365cdf0e10cSrcweir             {
366cdf0e10cSrcweir                 Reference<drawing::XDrawPages> xMasterPages (
367cdf0e10cSrcweir                     xMasterPagesSupplier->getMasterPages());
368cdf0e10cSrcweir                 if (xMasterPages.is())
369cdf0e10cSrcweir                 {
370cdf0e10cSrcweir                     sal_uInt16 nIndex = GetCurPageId();
371cdf0e10cSrcweir                     xMasterPages->insertNewByIndex (nIndex);
372cdf0e10cSrcweir 
373cdf0e10cSrcweir                     // Create shapes for the default layout.
374cdf0e10cSrcweir                     SdPage* pMasterPage = GetDoc()->GetMasterSdPage(
375cdf0e10cSrcweir                         nIndex, PK_STANDARD);
376cdf0e10cSrcweir                     pMasterPage->CreateTitleAndLayout (sal_True,sal_True);
377cdf0e10cSrcweir                 }
378cdf0e10cSrcweir             }
379cdf0e10cSrcweir 
380cdf0e10cSrcweir             Cancel();
381cdf0e10cSrcweir             if(HasCurrentFunction(SID_BEZIER_EDIT))
382cdf0e10cSrcweir                 GetViewFrame()->GetDispatcher()->Execute(
383cdf0e10cSrcweir                     SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
384cdf0e10cSrcweir             rReq.Done ();
385cdf0e10cSrcweir         }
386cdf0e10cSrcweir         break;
387cdf0e10cSrcweir 
388cdf0e10cSrcweir         case SID_MODIFYPAGE:
389cdf0e10cSrcweir         {
390cdf0e10cSrcweir             if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES ||
391cdf0e10cSrcweir                 (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE) )
392cdf0e10cSrcweir             {
393cdf0e10cSrcweir                 if ( mpDrawView->IsTextEdit() )
394cdf0e10cSrcweir                 {
395cdf0e10cSrcweir                     mpDrawView->SdrEndTextEdit();
396cdf0e10cSrcweir                 }
397cdf0e10cSrcweir                 sal_uInt16 nPage = maTabControl.GetCurPageId() - 1;
398cdf0e10cSrcweir                 mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind);
399cdf0e10cSrcweir                 ::sd::ViewShell::mpImpl->ProcessModifyPageSlot (
400cdf0e10cSrcweir                     rReq,
401cdf0e10cSrcweir                     mpActualPage,
402cdf0e10cSrcweir                     mePageKind);
403cdf0e10cSrcweir             }
404cdf0e10cSrcweir 
405cdf0e10cSrcweir             Cancel();
406cdf0e10cSrcweir             rReq.Done ();
407cdf0e10cSrcweir         }
408cdf0e10cSrcweir         break;
409cdf0e10cSrcweir 
410cdf0e10cSrcweir         case SID_ASSIGN_LAYOUT:
411cdf0e10cSrcweir         {
412cdf0e10cSrcweir             if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES || (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE))
413cdf0e10cSrcweir             {
414cdf0e10cSrcweir                 if ( mpDrawView->IsTextEdit() )
415cdf0e10cSrcweir                     mpDrawView->SdrEndTextEdit();
416cdf0e10cSrcweir 
417cdf0e10cSrcweir                 ::sd::ViewShell::mpImpl->AssignLayout(rReq, mePageKind);
418cdf0e10cSrcweir             }
419cdf0e10cSrcweir             Cancel();
420cdf0e10cSrcweir             rReq.Done ();
421cdf0e10cSrcweir         }
422cdf0e10cSrcweir         break;
423cdf0e10cSrcweir 
424cdf0e10cSrcweir         case SID_RENAMEPAGE:
425cdf0e10cSrcweir         case SID_RENAME_MASTER_PAGE:
426cdf0e10cSrcweir         {
427cdf0e10cSrcweir             if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
428cdf0e10cSrcweir             {
429cdf0e10cSrcweir                 if ( mpDrawView->IsTextEdit() )
430cdf0e10cSrcweir                 {
431cdf0e10cSrcweir                     mpDrawView->SdrEndTextEdit();
432cdf0e10cSrcweir                 }
433cdf0e10cSrcweir 
434cdf0e10cSrcweir                 sal_uInt16 nPageId = maTabControl.GetCurPageId();
435cdf0e10cSrcweir                 SdPage* pCurrentPage = ( GetEditMode() == EM_PAGE )
436cdf0e10cSrcweir                     ? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() )
437cdf0e10cSrcweir                     : GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() );
438cdf0e10cSrcweir 
439cdf0e10cSrcweir                 String aTitle( SdResId( STR_TITLE_RENAMESLIDE ) );
440cdf0e10cSrcweir                 String aDescr( SdResId( STR_DESC_RENAMESLIDE ) );
441cdf0e10cSrcweir                 String aPageName = pCurrentPage->GetName();
442cdf0e10cSrcweir 
443cdf0e10cSrcweir                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
444cdf0e10cSrcweir                 DBG_ASSERT(pFact, "Dialogdiet fail!");
445cdf0e10cSrcweir                 AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( GetActiveWindow(), aPageName, aDescr );
446cdf0e10cSrcweir                 DBG_ASSERT(aNameDlg, "Dialogdiet fail!");
447cdf0e10cSrcweir                 aNameDlg->SetText( aTitle );
448cdf0e10cSrcweir                 aNameDlg->SetCheckNameHdl( LINK( this, DrawViewShell, RenameSlideHdl ), true );
449cdf0e10cSrcweir                 aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
450cdf0e10cSrcweir 
451cdf0e10cSrcweir                 if( aNameDlg->Execute() == RET_OK )
452cdf0e10cSrcweir                 {
453cdf0e10cSrcweir                     String aNewName;
454cdf0e10cSrcweir                     aNameDlg->GetName( aNewName );
455cdf0e10cSrcweir                     if( ! aNewName.Equals( aPageName ) )
456cdf0e10cSrcweir                     {
457cdf0e10cSrcweir #ifdef DBG_UTIL
458cdf0e10cSrcweir                         bool bResult =
459cdf0e10cSrcweir #endif
460cdf0e10cSrcweir                             RenameSlide( nPageId, aNewName );
461cdf0e10cSrcweir                         DBG_ASSERT( bResult, "Couldn't rename slide" );
462cdf0e10cSrcweir                     }
463cdf0e10cSrcweir                 }
464cdf0e10cSrcweir                 delete aNameDlg;
465cdf0e10cSrcweir             }
466cdf0e10cSrcweir 
467cdf0e10cSrcweir             Cancel();
468cdf0e10cSrcweir             rReq.Ignore ();
469cdf0e10cSrcweir         }
470cdf0e10cSrcweir         break;
471cdf0e10cSrcweir 
472cdf0e10cSrcweir         case SID_RENAMEPAGE_QUICK:
473cdf0e10cSrcweir         {
474cdf0e10cSrcweir             if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES )
475cdf0e10cSrcweir             {
476cdf0e10cSrcweir                 if ( mpDrawView->IsTextEdit() )
477cdf0e10cSrcweir                 {
478cdf0e10cSrcweir                     mpDrawView->SdrEndTextEdit();
479cdf0e10cSrcweir                 }
480cdf0e10cSrcweir 
481cdf0e10cSrcweir                 maTabControl.StartEditMode( maTabControl.GetCurPageId() );
482cdf0e10cSrcweir             }
483cdf0e10cSrcweir 
484cdf0e10cSrcweir             Cancel();
485cdf0e10cSrcweir             rReq.Ignore ();
486cdf0e10cSrcweir         }
487cdf0e10cSrcweir         break;
488cdf0e10cSrcweir 
489cdf0e10cSrcweir         case SID_PAGESIZE :  // entweder dieses (kein menueeintrag o. ae. !!)
490cdf0e10cSrcweir         {
491cdf0e10cSrcweir             const SfxItemSet *pArgs = rReq.GetArgs ();
492cdf0e10cSrcweir 
493cdf0e10cSrcweir             if (pArgs)
494cdf0e10cSrcweir                 if (pArgs->Count () == 3)
495cdf0e10cSrcweir                 {
496cdf0e10cSrcweir                     SFX_REQUEST_ARG (rReq, pWidth, SfxUInt32Item, ID_VAL_PAGEWIDTH, sal_False);
497cdf0e10cSrcweir                     SFX_REQUEST_ARG (rReq, pHeight, SfxUInt32Item, ID_VAL_PAGEHEIGHT, sal_False);
498cdf0e10cSrcweir                     SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False);
499cdf0e10cSrcweir 
500cdf0e10cSrcweir                     Size aSize (pWidth->GetValue (), pHeight->GetValue ());
501cdf0e10cSrcweir 
502cdf0e10cSrcweir                     SetupPage (aSize, 0, 0, 0, 0, sal_True, sal_False, pScaleAll->GetValue ());
503cdf0e10cSrcweir                     rReq.Ignore ();
504cdf0e10cSrcweir                     break;
505cdf0e10cSrcweir                 }
506cdf0e10cSrcweir 
507cdf0e10cSrcweir             StarBASIC::FatalError (SbERR_WRONG_ARGS);
508cdf0e10cSrcweir             rReq.Ignore ();
509cdf0e10cSrcweir             break;
510cdf0e10cSrcweir         }
511cdf0e10cSrcweir 
512cdf0e10cSrcweir         case SID_PAGEMARGIN :  // oder dieses (kein menueeintrag o. ae. !!)
513cdf0e10cSrcweir         {
514cdf0e10cSrcweir             const SfxItemSet *pArgs = rReq.GetArgs ();
515cdf0e10cSrcweir 
516cdf0e10cSrcweir             if (pArgs)
517cdf0e10cSrcweir                 if (pArgs->Count () == 5)
518cdf0e10cSrcweir                 {
519cdf0e10cSrcweir                     SFX_REQUEST_ARG (rReq, pLeft, SfxUInt32Item, ID_VAL_PAGELEFT, sal_False);
520cdf0e10cSrcweir                     SFX_REQUEST_ARG (rReq, pRight, SfxUInt32Item, ID_VAL_PAGERIGHT, sal_False);
521cdf0e10cSrcweir                     SFX_REQUEST_ARG (rReq, pUpper, SfxUInt32Item, ID_VAL_PAGETOP, sal_False);
522cdf0e10cSrcweir                     SFX_REQUEST_ARG (rReq, pLower, SfxUInt32Item, ID_VAL_PAGEBOTTOM, sal_False);
523cdf0e10cSrcweir                     SFX_REQUEST_ARG (rReq, pScaleAll, SfxBoolItem, ID_VAL_SCALEOBJECTS, sal_False);
524cdf0e10cSrcweir 
525cdf0e10cSrcweir                     Size aEmptySize (0, 0);
526cdf0e10cSrcweir 
527cdf0e10cSrcweir                     SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (),
528cdf0e10cSrcweir                                pUpper->GetValue (), pLower->GetValue (),
529cdf0e10cSrcweir                                sal_False, sal_True, pScaleAll->GetValue ());
530cdf0e10cSrcweir                     rReq.Ignore ();
531cdf0e10cSrcweir                     break;
532cdf0e10cSrcweir                 }
533cdf0e10cSrcweir 
534cdf0e10cSrcweir             StarBASIC::FatalError (SbERR_WRONG_ARGS);
535cdf0e10cSrcweir             rReq.Ignore ();
536cdf0e10cSrcweir             break;
537cdf0e10cSrcweir         }
538cdf0e10cSrcweir 
539cdf0e10cSrcweir         case SID_ATTR_ZOOMSLIDER:
540cdf0e10cSrcweir         {
541cdf0e10cSrcweir             const SfxItemSet* pArgs = rReq.GetArgs();
542cdf0e10cSrcweir 
543cdf0e10cSrcweir             if (pArgs && pArgs->Count () == 1 )
544cdf0e10cSrcweir             {
545cdf0e10cSrcweir                 SFX_REQUEST_ARG (rReq, pScale, SfxUInt16Item, SID_ATTR_ZOOMSLIDER, sal_False);
546cdf0e10cSrcweir                 if (CHECK_RANGE (5, pScale->GetValue (), 3000))
547cdf0e10cSrcweir                 {
548cdf0e10cSrcweir                     SetZoom (pScale->GetValue ());
549cdf0e10cSrcweir 
550cdf0e10cSrcweir                     SfxBindings& rBindings = GetViewFrame()->GetBindings();
551cdf0e10cSrcweir                     rBindings.Invalidate( SID_ATTR_ZOOM );
552cdf0e10cSrcweir                     rBindings.Invalidate( SID_ZOOM_IN );
553cdf0e10cSrcweir                     rBindings.Invalidate( SID_ZOOM_OUT );
554cdf0e10cSrcweir                     rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
555cdf0e10cSrcweir 
556cdf0e10cSrcweir                 }
557cdf0e10cSrcweir             }
558cdf0e10cSrcweir 
559cdf0e10cSrcweir             Cancel();
560cdf0e10cSrcweir             rReq.Done ();
561cdf0e10cSrcweir             break;
562cdf0e10cSrcweir         }
563cdf0e10cSrcweir         case SID_ZOOMING :  // kein Menueintrag, sondern aus dem Zoomdialog generiert
564cdf0e10cSrcweir         {
565cdf0e10cSrcweir             const SfxItemSet* pArgs = rReq.GetArgs();
566cdf0e10cSrcweir 
567cdf0e10cSrcweir             if (pArgs)
568cdf0e10cSrcweir                 if (pArgs->Count () == 1)
569cdf0e10cSrcweir                 {
570cdf0e10cSrcweir                     SFX_REQUEST_ARG (rReq, pScale, SfxUInt32Item, ID_VAL_ZOOM, sal_False);
571cdf0e10cSrcweir                     if (CHECK_RANGE (10, pScale->GetValue (), 1000))
572cdf0e10cSrcweir                     {
573cdf0e10cSrcweir                         SetZoom (pScale->GetValue ());
574cdf0e10cSrcweir 
575cdf0e10cSrcweir                         SfxBindings& rBindings = GetViewFrame()->GetBindings();
576cdf0e10cSrcweir                         rBindings.Invalidate( SID_ATTR_ZOOM );
577cdf0e10cSrcweir                         rBindings.Invalidate( SID_ZOOM_IN );
578cdf0e10cSrcweir                         rBindings.Invalidate( SID_ZOOM_OUT );
579cdf0e10cSrcweir                         rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
580cdf0e10cSrcweir                     }
581cdf0e10cSrcweir                     else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
582cdf0e10cSrcweir 
583cdf0e10cSrcweir                     rReq.Ignore ();
584cdf0e10cSrcweir                     break;
585cdf0e10cSrcweir                 }
586cdf0e10cSrcweir 
587cdf0e10cSrcweir             StarBASIC::FatalError (SbERR_WRONG_ARGS);
588cdf0e10cSrcweir             rReq.Ignore ();
589cdf0e10cSrcweir             break;
590cdf0e10cSrcweir         }
591cdf0e10cSrcweir 
592cdf0e10cSrcweir         case SID_ATTR_ZOOM:
593cdf0e10cSrcweir         {
594cdf0e10cSrcweir             const SfxItemSet* pArgs = rReq.GetArgs();
595cdf0e10cSrcweir             mbZoomOnPage = sal_False;
596cdf0e10cSrcweir 
597cdf0e10cSrcweir             if ( pArgs )
598cdf0e10cSrcweir             {
599cdf0e10cSrcweir                 SvxZoomType eZT = ( ( const SvxZoomItem& ) pArgs->
600cdf0e10cSrcweir                                             Get( SID_ATTR_ZOOM ) ).GetType();
601cdf0e10cSrcweir                 switch( eZT )
602cdf0e10cSrcweir                 {
603cdf0e10cSrcweir                     case SVX_ZOOM_PERCENT:
604cdf0e10cSrcweir                         SetZoom( (long) ( ( const SvxZoomItem& ) pArgs->
605cdf0e10cSrcweir                                             Get( SID_ATTR_ZOOM ) ).GetValue() );
606cdf0e10cSrcweir                         break;
607cdf0e10cSrcweir 
608cdf0e10cSrcweir                     case SVX_ZOOM_OPTIMAL:
609cdf0e10cSrcweir                         GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL,
610cdf0e10cSrcweir                                     SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
611cdf0e10cSrcweir                         break;
612cdf0e10cSrcweir 
613cdf0e10cSrcweir                     case SVX_ZOOM_PAGEWIDTH:
614cdf0e10cSrcweir                         GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH,
615cdf0e10cSrcweir                                     SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
616cdf0e10cSrcweir                         break;
617cdf0e10cSrcweir 
618cdf0e10cSrcweir                     case SVX_ZOOM_WHOLEPAGE:
619cdf0e10cSrcweir                         GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE,
620cdf0e10cSrcweir                                     SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
621cdf0e10cSrcweir                         break;
622cdf0e10cSrcweir                     case SVX_ZOOM_PAGEWIDTH_NOBORDER:
623cdf0e10cSrcweir                         DBG_ERROR("sd::DrawViewShell::FuTemporary(), SVX_ZOOM_PAGEWIDTH_NOBORDER not handled!" );
624cdf0e10cSrcweir                         break;
625cdf0e10cSrcweir                 }
626cdf0e10cSrcweir                 rReq.Ignore ();
627cdf0e10cSrcweir             }
628cdf0e10cSrcweir             else
629cdf0e10cSrcweir             {
630cdf0e10cSrcweir                 // hier den Zoom-Dialog oeffnen
631cdf0e10cSrcweir                 SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
632cdf0e10cSrcweir             }
633cdf0e10cSrcweir             Cancel();
634cdf0e10cSrcweir         }
635cdf0e10cSrcweir         break;
636cdf0e10cSrcweir 
637cdf0e10cSrcweir         case SID_CHANGEBEZIER:
638cdf0e10cSrcweir         case SID_CHANGEPOLYGON:
639cdf0e10cSrcweir             if ( mpDrawView->IsTextEdit() )
640cdf0e10cSrcweir             {
641cdf0e10cSrcweir                 mpDrawView->SdrEndTextEdit();
642cdf0e10cSrcweir                 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
643cdf0e10cSrcweir             }
644cdf0e10cSrcweir 
645cdf0e10cSrcweir             if ( mpDrawView->IsPresObjSelected() )
646cdf0e10cSrcweir             {
647cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
648cdf0e10cSrcweir                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
649cdf0e10cSrcweir             }
650cdf0e10cSrcweir             else
651cdf0e10cSrcweir             {
652cdf0e10cSrcweir                 if( rReq.GetSlot() == SID_CHANGEBEZIER )
653cdf0e10cSrcweir                 {
654cdf0e10cSrcweir                     WaitObject aWait( (Window*)GetActiveWindow() );
655cdf0e10cSrcweir                     mpDrawView->ConvertMarkedToPathObj(sal_False);
656cdf0e10cSrcweir                 }
657cdf0e10cSrcweir                 else
658cdf0e10cSrcweir                 {
659cdf0e10cSrcweir                     if( mpDrawView->IsVectorizeAllowed() )
660ddde725dSArmin Le Grand                     {
661cdf0e10cSrcweir                         SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
662ddde725dSArmin Le Grand                     }
663cdf0e10cSrcweir                     else
664cdf0e10cSrcweir                     {
665cdf0e10cSrcweir                         WaitObject aWait( (Window*)GetActiveWindow() );
666cdf0e10cSrcweir                         mpDrawView->ConvertMarkedToPolyObj(sal_False);
667cdf0e10cSrcweir                     }
668cdf0e10cSrcweir                 }
669cdf0e10cSrcweir 
670cdf0e10cSrcweir                 Invalidate(SID_CHANGEBEZIER);
671cdf0e10cSrcweir                 Invalidate(SID_CHANGEPOLYGON);
672cdf0e10cSrcweir             }
673cdf0e10cSrcweir             Cancel();
674cdf0e10cSrcweir 
675cdf0e10cSrcweir             if( HasCurrentFunction(SID_BEZIER_EDIT) )
676cdf0e10cSrcweir             {   // ggf. die richtige Editfunktion aktivieren
677cdf0e10cSrcweir                 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT,
678cdf0e10cSrcweir                                         SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
679cdf0e10cSrcweir             }
680cdf0e10cSrcweir             rReq.Ignore ();
681cdf0e10cSrcweir             break;
682cdf0e10cSrcweir 
683cdf0e10cSrcweir         case SID_CONVERT_TO_CONTOUR:
684cdf0e10cSrcweir             if ( mpDrawView->IsTextEdit() )
685cdf0e10cSrcweir             {
686cdf0e10cSrcweir                 mpDrawView->SdrEndTextEdit();
687cdf0e10cSrcweir                 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
688cdf0e10cSrcweir             }
689cdf0e10cSrcweir 
690cdf0e10cSrcweir             if ( mpDrawView->IsPresObjSelected() )
691cdf0e10cSrcweir             {
692cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
693cdf0e10cSrcweir                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
694cdf0e10cSrcweir             }
695cdf0e10cSrcweir             else
696cdf0e10cSrcweir             {
697cdf0e10cSrcweir                 WaitObject aWait( (Window*)GetActiveWindow() );
698cdf0e10cSrcweir                 mpDrawView->ConvertMarkedToPathObj(sal_True);
699cdf0e10cSrcweir 
700cdf0e10cSrcweir                 Invalidate(SID_CONVERT_TO_CONTOUR);
701cdf0e10cSrcweir             }
702cdf0e10cSrcweir             Cancel();
703cdf0e10cSrcweir 
704cdf0e10cSrcweir             rReq.Ignore ();
705cdf0e10cSrcweir             break;
706cdf0e10cSrcweir 
707cdf0e10cSrcweir         case SID_CONVERT_TO_METAFILE:
708cdf0e10cSrcweir         case SID_CONVERT_TO_BITMAP:
709cdf0e10cSrcweir         {
710cdf0e10cSrcweir             // End text edit mode when it is active because the metafile or
711cdf0e10cSrcweir             // bitmap that will be created does not support it.
712cdf0e10cSrcweir             if ( mpDrawView->IsTextEdit() )
713cdf0e10cSrcweir             {
714cdf0e10cSrcweir                 mpDrawView->SdrEndTextEdit();
715cdf0e10cSrcweir                 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
716cdf0e10cSrcweir             }
717cdf0e10cSrcweir 
718cdf0e10cSrcweir             if ( mpDrawView->IsPresObjSelected(true,true,true) )
719cdf0e10cSrcweir             {
720cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
721cdf0e10cSrcweir                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
722cdf0e10cSrcweir             }
723cdf0e10cSrcweir             else
724cdf0e10cSrcweir             {
725cdf0e10cSrcweir                 WaitObject aWait( (Window*)GetActiveWindow() );
726cdf0e10cSrcweir 
727cdf0e10cSrcweir                 // switch on undo for the next operations
728cdf0e10cSrcweir                 mpDrawView->BegUndo(
729cdf0e10cSrcweir                     String(
730cdf0e10cSrcweir                     SdResId (nSId==SID_CONVERT_TO_METAFILE ? STR_UNDO_CONVERT_TO_METAFILE : STR_UNDO_CONVERT_TO_BITMAP)));
731cdf0e10cSrcweir 
732cdf0e10cSrcweir                 // create SdrGrafObj from metafile/bitmap
733cdf0e10cSrcweir                 Graphic aGraphic;
734cdf0e10cSrcweir                 switch (nSId)
735cdf0e10cSrcweir                 {
736cdf0e10cSrcweir                     case SID_CONVERT_TO_METAFILE:
737cdf0e10cSrcweir                     {
738bb18ee55SArmin Le Grand                         GDIMetaFile aMetaFile(mpDrawView->GetMarkedObjMetaFile());
739cdf0e10cSrcweir                         aGraphic = Graphic(aMetaFile);
740cdf0e10cSrcweir                     }
741cdf0e10cSrcweir                     break;
742cdf0e10cSrcweir                     case SID_CONVERT_TO_BITMAP:
743cdf0e10cSrcweir                     {
744ddde725dSArmin Le Grand                         bool bDone(false);
745ddde725dSArmin Le Grand 
746bb18ee55SArmin Le Grand                         // I have to get the image here directly since GetMarkedObjBitmapEx works
747ddde725dSArmin Le Grand                         // based on Bitmaps, but not on BitmapEx, thus throwing away the alpha
748bb18ee55SArmin Le Grand                         // channel. Argh! GetMarkedObjBitmapEx itself is too widely used to safely
749ddde725dSArmin Le Grand                         // change that, e.g. in the exchange formats. For now I can only add this
750ddde725dSArmin Le Grand                         // exception to get good results for Svgs. This is how the code gets more
751ddde725dSArmin Le Grand                         // and more crowded, at last I made a remark for myself to change this
752ddde725dSArmin Le Grand                         // as one of the next tasks.
753ddde725dSArmin Le Grand                         if(1 == mpDrawView->GetMarkedObjectCount())
754ddde725dSArmin Le Grand                         {
755ddde725dSArmin Le Grand                             const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(mpDrawView->GetMarkedObjectByIndex(0));
756ddde725dSArmin Le Grand 
757ddde725dSArmin Le Grand                             if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg())
758ddde725dSArmin Le Grand                             {
759ddde725dSArmin Le Grand                                 aGraphic = Graphic(pSdrGrafObj->GetGraphic().getSvgData()->getReplacement());
760ddde725dSArmin Le Grand                                 bDone = true;
761ddde725dSArmin Le Grand                             }
762ddde725dSArmin Le Grand                         }
763ddde725dSArmin Le Grand 
764ddde725dSArmin Le Grand                         if(!bDone)
765ddde725dSArmin Le Grand                         {
766bb18ee55SArmin Le Grand                             aGraphic = Graphic(mpDrawView->GetMarkedObjBitmapEx());
767cdf0e10cSrcweir                         }
768ddde725dSArmin Le Grand                     }
769cdf0e10cSrcweir                     break;
770cdf0e10cSrcweir                 }
771cdf0e10cSrcweir 
772cdf0e10cSrcweir                 // create new object
773cdf0e10cSrcweir                 SdrGrafObj* pGraphicObj = new SdrGrafObj (aGraphic);
774cdf0e10cSrcweir 
775cdf0e10cSrcweir                 // get some necessary info and ensure it
776cdf0e10cSrcweir                 const SdrMarkList& rMarkList(mpDrawView->GetMarkedObjectList());
777cdf0e10cSrcweir                 const sal_uInt32 nMarkCount(rMarkList.GetMarkCount());
778cdf0e10cSrcweir                 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
779cdf0e10cSrcweir                 OSL_ENSURE(nMarkCount, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
780cdf0e10cSrcweir                 OSL_ENSURE(pPageView, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
781cdf0e10cSrcweir 
782cdf0e10cSrcweir                 // fit rectangle of new graphic object to selection's mark rect
783cdf0e10cSrcweir                 Rectangle aAllMarkedRect;
784cdf0e10cSrcweir                 rMarkList.TakeBoundRect(pPageView, aAllMarkedRect);
785cdf0e10cSrcweir                 pGraphicObj->SetLogicRect(aAllMarkedRect);
786cdf0e10cSrcweir 
787cdf0e10cSrcweir                 // #i71540# to keep the order, it is necessary to replace the lowest object
788cdf0e10cSrcweir                 // of the selection with the new object. This also means that with multi
789cdf0e10cSrcweir                 // selection, all other objects need to be deleted first
790cdf0e10cSrcweir                 SdrMark* pFirstMark = rMarkList.GetMark(0L);
791cdf0e10cSrcweir                 SdrObject* pReplacementCandidate = pFirstMark->GetMarkedSdrObj();
792cdf0e10cSrcweir 
793cdf0e10cSrcweir                 if(nMarkCount > 1L)
794cdf0e10cSrcweir                 {
795cdf0e10cSrcweir                     // take first object out of selection
796cdf0e10cSrcweir                     mpDrawView->MarkObj(pReplacementCandidate, pPageView, true, true);
797cdf0e10cSrcweir 
798cdf0e10cSrcweir                     // clear remaining selection
799cdf0e10cSrcweir                     mpDrawView->DeleteMarkedObj();
800cdf0e10cSrcweir                 }
801cdf0e10cSrcweir 
802cdf0e10cSrcweir                 // now replace lowest object with new one
803cdf0e10cSrcweir                 mpDrawView->ReplaceObjectAtView(pReplacementCandidate, *pPageView, pGraphicObj);
804cdf0e10cSrcweir 
805cdf0e10cSrcweir                 // switch off undo
806cdf0e10cSrcweir                 mpDrawView->EndUndo();
807cdf0e10cSrcweir             }
808cdf0e10cSrcweir         }
809cdf0e10cSrcweir 
810cdf0e10cSrcweir         Cancel();
811cdf0e10cSrcweir 
812cdf0e10cSrcweir         rReq.Done ();
813cdf0e10cSrcweir         break;
814cdf0e10cSrcweir 
815cdf0e10cSrcweir         case SID_SET_DEFAULT:
816cdf0e10cSrcweir         {
817cdf0e10cSrcweir             SfxItemSet* pSet = NULL;
818cdf0e10cSrcweir 
819cdf0e10cSrcweir             if (mpDrawView->IsTextEdit())
820cdf0e10cSrcweir             {
821cdf0e10cSrcweir                 ::Outliner* pOutl = mpDrawView->GetTextEditOutliner();
822cdf0e10cSrcweir                 if (pOutl)
823cdf0e10cSrcweir                 {
824cdf0e10cSrcweir                     pOutl->RemoveFields(sal_True, (TypeId) SvxURLField::StaticType());
825cdf0e10cSrcweir                 }
826cdf0e10cSrcweir 
827cdf0e10cSrcweir                 pSet = new SfxItemSet( GetPool(), EE_ITEMS_START, EE_ITEMS_END );
828cdf0e10cSrcweir                 mpDrawView->SetAttributes( *pSet, sal_True );
829cdf0e10cSrcweir             }
830cdf0e10cSrcweir             else
831cdf0e10cSrcweir             {
832cdf0e10cSrcweir                 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
833cdf0e10cSrcweir                 sal_uLong nCount = rMarkList.GetMarkCount();
834cdf0e10cSrcweir 
835cdf0e10cSrcweir                 // In diese Liste werden fuer jedes Praesentationsobjekt ein SfxItemSet
836cdf0e10cSrcweir                 // der harten Attribute sowie der UserCall eingetragen, da diese beim nachfolgenden
837cdf0e10cSrcweir                 // mpDrawView->SetAttributes( *pSet, sal_True ) verloren gehen und spaeter restauriert
838cdf0e10cSrcweir                 // werden muessen
839cdf0e10cSrcweir                 List* pAttrList = new List();
840cdf0e10cSrcweir                 SdPage* pPresPage = (SdPage*) mpDrawView->GetSdrPageView()->GetPage();
841cdf0e10cSrcweir                 sal_uLong i;
842cdf0e10cSrcweir 
843cdf0e10cSrcweir                 for ( i = 0; i < nCount; i++ )
844cdf0e10cSrcweir                 {
845cdf0e10cSrcweir                     SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
846cdf0e10cSrcweir 
847cdf0e10cSrcweir                     if( pPresPage->IsPresObj( pObj ) )
848cdf0e10cSrcweir                     {
849cdf0e10cSrcweir                         SfxItemSet* pNewSet = new SfxItemSet( GetDoc()->GetPool(), SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, 0 );
850cdf0e10cSrcweir                         pNewSet->Put(pObj->GetMergedItemSet());
851cdf0e10cSrcweir                         pAttrList->Insert( pNewSet, LIST_APPEND );
852cdf0e10cSrcweir                         pAttrList->Insert( pObj->GetUserCall(), LIST_APPEND );
853cdf0e10cSrcweir                     }
854cdf0e10cSrcweir                 }
855cdf0e10cSrcweir 
856cdf0e10cSrcweir                 pSet = new SfxItemSet( GetPool() );
857cdf0e10cSrcweir                 mpDrawView->SetAttributes( *pSet, sal_True );
858cdf0e10cSrcweir 
859cdf0e10cSrcweir                 sal_uLong j = 0;
860cdf0e10cSrcweir 
861cdf0e10cSrcweir                 for ( i = 0; i < nCount; i++ )
862cdf0e10cSrcweir                 {
863cdf0e10cSrcweir                     SfxStyleSheet* pSheet = NULL;
864cdf0e10cSrcweir                     SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
865cdf0e10cSrcweir 
866cdf0e10cSrcweir                     if (pObj->GetObjIdentifier() == OBJ_TITLETEXT)
867cdf0e10cSrcweir                     {
868cdf0e10cSrcweir                         pSheet = mpActualPage->GetStyleSheetForPresObj(PRESOBJ_TITLE);
869cdf0e10cSrcweir                         if (pSheet)
870cdf0e10cSrcweir                             pObj->SetStyleSheet(pSheet, sal_False);
871cdf0e10cSrcweir                     }
872cdf0e10cSrcweir                     else if(pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
873cdf0e10cSrcweir                     {
874cdf0e10cSrcweir                         for (sal_uInt16 nLevel = 1; nLevel < 10; nLevel++)
875cdf0e10cSrcweir                         {
876cdf0e10cSrcweir                             pSheet = mpActualPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
877cdf0e10cSrcweir                             DBG_ASSERT(pSheet, "Vorlage fuer Gliederungsobjekt nicht gefunden");
878cdf0e10cSrcweir                             if (pSheet)
879cdf0e10cSrcweir                             {
880cdf0e10cSrcweir                                 pObj->StartListening(*pSheet);
881cdf0e10cSrcweir 
882cdf0e10cSrcweir                                 if( nLevel == 1 )
883cdf0e10cSrcweir                                     // Textrahmen hoert auf StyleSheet der Ebene1
884cdf0e10cSrcweir                                     pObj->NbcSetStyleSheet(pSheet, sal_False);
885cdf0e10cSrcweir 
886cdf0e10cSrcweir                             }
887cdf0e10cSrcweir                         }
888cdf0e10cSrcweir                     }
889cdf0e10cSrcweir 
890cdf0e10cSrcweir                     if( pPresPage->IsPresObj( pObj ) )
891cdf0e10cSrcweir                     {
892cdf0e10cSrcweir                         SfxItemSet* pNewSet = (SfxItemSet*) pAttrList->GetObject(j++);
893cdf0e10cSrcweir                         SdrObjUserCall* pUserCall = (SdrObjUserCall*) pAttrList->GetObject(j++);
894cdf0e10cSrcweir 
895cdf0e10cSrcweir                         if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT ) == SFX_ITEM_ON )
896cdf0e10cSrcweir                         {
897cdf0e10cSrcweir                             pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_MINFRAMEHEIGHT));
898cdf0e10cSrcweir                         }
899cdf0e10cSrcweir 
900cdf0e10cSrcweir                         if ( pNewSet && pNewSet->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) == SFX_ITEM_ON )
901cdf0e10cSrcweir                         {
902cdf0e10cSrcweir                             pObj->SetMergedItem(pNewSet->Get(SDRATTR_TEXT_AUTOGROWHEIGHT));
903cdf0e10cSrcweir                         }
904cdf0e10cSrcweir 
905cdf0e10cSrcweir                         if( pUserCall )
906cdf0e10cSrcweir                             pObj->SetUserCall( pUserCall );
907cdf0e10cSrcweir 
908cdf0e10cSrcweir                         delete pNewSet;
909cdf0e10cSrcweir                     }
910cdf0e10cSrcweir                 }
911cdf0e10cSrcweir 
912cdf0e10cSrcweir                 delete pAttrList;
913cdf0e10cSrcweir             }
914cdf0e10cSrcweir 
915cdf0e10cSrcweir             delete pSet;
916cdf0e10cSrcweir             Cancel();
917cdf0e10cSrcweir         }
918cdf0e10cSrcweir         break;
919cdf0e10cSrcweir 
920cdf0e10cSrcweir         case SID_DELETE_SNAPITEM:
921cdf0e10cSrcweir         {
922cdf0e10cSrcweir             SdrPageView* pPV;
923cdf0e10cSrcweir             Point   aMPos = GetActiveWindow()->PixelToLogic( maMousePos );
924cdf0e10cSrcweir             sal_uInt16  nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( Size(
925cdf0e10cSrcweir                 FuPoor::HITPIX, 0 ) ).Width();
926cdf0e10cSrcweir             sal_uInt16  nHelpLine;
927cdf0e10cSrcweir 
928cdf0e10cSrcweir             mbMousePosFreezed = sal_False;
929cdf0e10cSrcweir 
930cdf0e10cSrcweir             if( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) )
931cdf0e10cSrcweir             {
932cdf0e10cSrcweir                 pPV->DeleteHelpLine( nHelpLine );
933cdf0e10cSrcweir             }
934cdf0e10cSrcweir             Cancel();
935cdf0e10cSrcweir             rReq.Ignore ();
936cdf0e10cSrcweir         }
937cdf0e10cSrcweir         break;
938cdf0e10cSrcweir 
939cdf0e10cSrcweir         case SID_DELETE_PAGE:
940cdf0e10cSrcweir         case SID_DELETE_MASTER_PAGE:
941cdf0e10cSrcweir             DeleteActualPage();
942cdf0e10cSrcweir             Cancel();
943cdf0e10cSrcweir             rReq.Ignore ();
944cdf0e10cSrcweir         break;
945cdf0e10cSrcweir 
946cdf0e10cSrcweir         case SID_DELETE_LAYER:
947cdf0e10cSrcweir             DeleteActualLayer();
948cdf0e10cSrcweir             Cancel();
949cdf0e10cSrcweir             rReq.Ignore ();
950cdf0e10cSrcweir         break;
951cdf0e10cSrcweir 
952cdf0e10cSrcweir         case SID_ORIGINAL_SIZE:
953cdf0e10cSrcweir             mpDrawView->SetMarkedOriginalSize();
954cdf0e10cSrcweir             Cancel();
955cdf0e10cSrcweir             rReq.Done();
956cdf0e10cSrcweir         break;
957cdf0e10cSrcweir 
958cdf0e10cSrcweir         case SID_DRAW_FONTWORK:
959cdf0e10cSrcweir         case SID_DRAW_FONTWORK_VERTICAL:
960cdf0e10cSrcweir         {
961cdf0e10cSrcweir             svx::FontworkBar::execute( mpView, rReq, GetViewFrame()->GetBindings() );       // SJ: can be removed  (I think)
962cdf0e10cSrcweir             Cancel();
963cdf0e10cSrcweir             rReq.Done();
964cdf0e10cSrcweir         }
965cdf0e10cSrcweir         break;
966cdf0e10cSrcweir 
967cdf0e10cSrcweir         case SID_SAVEGRAPHIC:
968cdf0e10cSrcweir         {
969cdf0e10cSrcweir             const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
970cdf0e10cSrcweir             if( rMarkList.GetMarkCount() == 1 )
971cdf0e10cSrcweir             {
972cdf0e10cSrcweir                 SdrGrafObj *pGrafObj = dynamic_cast< SdrGrafObj* >( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
973cdf0e10cSrcweir                 if(pGrafObj )
974cdf0e10cSrcweir                 {
975cdf0e10cSrcweir                     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape( pGrafObj->getUnoShape(), com::sun::star::uno::UNO_QUERY );
976cdf0e10cSrcweir                     SdGRFFilter::SaveGraphic( xShape );
977cdf0e10cSrcweir                 }
978cdf0e10cSrcweir             }
979cdf0e10cSrcweir             Cancel();
980cdf0e10cSrcweir             rReq.Ignore();
981cdf0e10cSrcweir         }
982cdf0e10cSrcweir         break;
983cdf0e10cSrcweir 
984cdf0e10cSrcweir         default:
985cdf0e10cSrcweir         {
986cdf0e10cSrcweir             // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
987cdf0e10cSrcweir             // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8)
988cdf0e10cSrcweir             // gewandert.
989cdf0e10cSrcweir             FuTemp01(rReq);
990cdf0e10cSrcweir         }
991cdf0e10cSrcweir         break;
992cdf0e10cSrcweir     }
993cdf0e10cSrcweir 
994cdf0e10cSrcweir     if(HasCurrentFunction())
995cdf0e10cSrcweir     {
996cdf0e10cSrcweir         GetCurrentFunction()->Activate();
997cdf0e10cSrcweir     }
998cdf0e10cSrcweir }
999cdf0e10cSrcweir 
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir 
1002cdf0e10cSrcweir 
1003cdf0e10cSrcweir /** This method consists basically of three parts:
1004cdf0e10cSrcweir     1. Process the arguments of the SFX request.
1005cdf0e10cSrcweir     2. Use the model to create a new page or duplicate an existing one.
1006cdf0e10cSrcweir     3. Update the tab control and switch to the new page.
1007cdf0e10cSrcweir */
1008cdf0e10cSrcweir SdPage* DrawViewShell::CreateOrDuplicatePage (
1009cdf0e10cSrcweir     SfxRequest& rRequest,
1010cdf0e10cSrcweir     PageKind ePageKind,
1011cdf0e10cSrcweir     SdPage* pPage,
1012cdf0e10cSrcweir     const sal_Int32 nInsertPosition)
1013cdf0e10cSrcweir {
1014cdf0e10cSrcweir     SdPage* pNewPage = NULL;
1015cdf0e10cSrcweir     if (ePageKind == PK_STANDARD && meEditMode != EM_MASTERPAGE)
1016cdf0e10cSrcweir     {
1017cdf0e10cSrcweir         if ( mpDrawView->IsTextEdit() )
1018cdf0e10cSrcweir         {
1019cdf0e10cSrcweir             mpDrawView->SdrEndTextEdit();
1020cdf0e10cSrcweir         }
1021cdf0e10cSrcweir         pNewPage = ViewShell::CreateOrDuplicatePage (rRequest, ePageKind, pPage, nInsertPosition);
1022cdf0e10cSrcweir     }
1023cdf0e10cSrcweir     return pNewPage;
1024cdf0e10cSrcweir }
1025cdf0e10cSrcweir 
1026cdf0e10cSrcweir } // end of namespace sd
1027