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