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
30cdf0e10cSrcweir #include "DrawController.hxx"
31cdf0e10cSrcweir #include <com/sun/star/embed/EmbedStates.hpp>
32cdf0e10cSrcweir
33cdf0e10cSrcweir #include "comphelper/anytostring.hxx"
34cdf0e10cSrcweir #include "comphelper/scopeguard.hxx"
35cdf0e10cSrcweir #include "cppuhelper/exc_hlp.hxx"
36cdf0e10cSrcweir #include "rtl/ref.hxx"
37cdf0e10cSrcweir
38cdf0e10cSrcweir #ifndef _SVXIDS_HRC
39cdf0e10cSrcweir #include <svx/svxids.hrc>
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #include <svx/svdpagv.hxx>
42cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
43cdf0e10cSrcweir #include <sfx2/bindings.hxx>
44cdf0e10cSrcweir #include <svx/svdoole2.hxx>
45cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
46cdf0e10cSrcweir #include <vcl/scrbar.hxx>
47cdf0e10cSrcweir #include <svx/svdograf.hxx>
48cdf0e10cSrcweir #include <svx/svdopage.hxx>
49cdf0e10cSrcweir #include <vcl/msgbox.hxx>
50cdf0e10cSrcweir #include <sot/storage.hxx>
51cdf0e10cSrcweir #include <svx/fmshell.hxx>
52cdf0e10cSrcweir #include <svx/globl3d.hxx>
53cdf0e10cSrcweir #include <svx/fmglob.hxx>
54cdf0e10cSrcweir #include <editeng/outliner.hxx>
55cdf0e10cSrcweir
56cdf0e10cSrcweir #include "misc.hxx"
57cdf0e10cSrcweir
58cdf0e10cSrcweir #ifdef STARIMAGE_AVAILABLE
59cdf0e10cSrcweir #ifndef _SIMDLL_HXX
60cdf0e10cSrcweir #include <sim2/simdll.hxx>
61cdf0e10cSrcweir #endif
62cdf0e10cSrcweir #endif
63cdf0e10cSrcweir
64cdf0e10cSrcweir #include <svx/dialogs.hrc>
65cdf0e10cSrcweir
66cdf0e10cSrcweir #include "view/viewoverlaymanager.hxx"
67cdf0e10cSrcweir
68cdf0e10cSrcweir #include "glob.hrc"
69cdf0e10cSrcweir #include "app.hrc"
70cdf0e10cSrcweir #include "res_bmp.hrc"
71cdf0e10cSrcweir #include "strings.hrc"
72cdf0e10cSrcweir #include "helpids.h"
73cdf0e10cSrcweir
74cdf0e10cSrcweir #include "app.hxx"
75cdf0e10cSrcweir #include "fupoor.hxx"
76cdf0e10cSrcweir #include "sdresid.hxx"
77cdf0e10cSrcweir #include "fusel.hxx"
78cdf0e10cSrcweir #include "sdpage.hxx"
79cdf0e10cSrcweir #include "FrameView.hxx"
80cdf0e10cSrcweir #include "stlpool.hxx"
81cdf0e10cSrcweir #include "Window.hxx"
82cdf0e10cSrcweir #ifndef SD_DRAWVIEW_HXX
83cdf0e10cSrcweir #include "drawview.hxx"
84cdf0e10cSrcweir #endif
85cdf0e10cSrcweir #include "drawdoc.hxx"
86cdf0e10cSrcweir #include "DrawDocShell.hxx"
87cdf0e10cSrcweir #include "Ruler.hxx"
88cdf0e10cSrcweir #include "Client.hxx"
89cdf0e10cSrcweir #include "slideshow.hxx"
90cdf0e10cSrcweir #include "optsitem.hxx"
91cdf0e10cSrcweir #include "fusearch.hxx"
92cdf0e10cSrcweir #include "Outliner.hxx"
93cdf0e10cSrcweir #include "AnimationChildWindow.hxx"
94cdf0e10cSrcweir #include "SdUnoDrawView.hxx"
95cdf0e10cSrcweir #include "ToolBarManager.hxx"
96cdf0e10cSrcweir #include "FormShellManager.hxx"
97cdf0e10cSrcweir #include "ViewShellBase.hxx"
98cdf0e10cSrcweir #include "LayerDialogChildWindow.hxx"
99cdf0e10cSrcweir #include "LayerTabBar.hxx"
100cdf0e10cSrcweir #include "ViewShellManager.hxx"
101cdf0e10cSrcweir #include "ViewShellHint.hxx"
102cdf0e10cSrcweir
103cdf0e10cSrcweir #include <sfx2/request.hxx>
104cdf0e10cSrcweir #include <boost/bind.hpp>
105cdf0e10cSrcweir
106cdf0e10cSrcweir #ifdef _MSC_VER
107cdf0e10cSrcweir #if (_MSC_VER < 1400)
108cdf0e10cSrcweir #pragma optimize ( "", off )
109cdf0e10cSrcweir #endif
110cdf0e10cSrcweir #endif
111cdf0e10cSrcweir
112cdf0e10cSrcweir using namespace com::sun::star;
113cdf0e10cSrcweir
114cdf0e10cSrcweir namespace sd {
115cdf0e10cSrcweir
Activate(sal_Bool bIsMDIActivate)116cdf0e10cSrcweir void DrawViewShell::Activate(sal_Bool bIsMDIActivate)
117cdf0e10cSrcweir {
118cdf0e10cSrcweir ViewShell::Activate(bIsMDIActivate);
119cdf0e10cSrcweir }
120cdf0e10cSrcweir
UIActivating(SfxInPlaceClient * pCli)121cdf0e10cSrcweir void DrawViewShell::UIActivating( SfxInPlaceClient* pCli )
122cdf0e10cSrcweir {
123cdf0e10cSrcweir ViewShell::UIActivating(pCli);
124cdf0e10cSrcweir
125cdf0e10cSrcweir // #94252# Disable own controls
126cdf0e10cSrcweir maTabControl.Disable();
127cdf0e10cSrcweir if (GetLayerTabControl() != NULL)
128cdf0e10cSrcweir GetLayerTabControl()->Disable();
129cdf0e10cSrcweir }
130cdf0e10cSrcweir
UIDeactivated(SfxInPlaceClient * pCli)131cdf0e10cSrcweir void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir // #94252# Enable own controls
134cdf0e10cSrcweir maTabControl.Enable();
135cdf0e10cSrcweir if (GetLayerTabControl() != NULL)
136cdf0e10cSrcweir GetLayerTabControl()->Enable();
137cdf0e10cSrcweir
138cdf0e10cSrcweir ViewShell::UIDeactivated(pCli);
139cdf0e10cSrcweir }
140cdf0e10cSrcweir
141cdf0e10cSrcweir
142cdf0e10cSrcweir /*************************************************************************
143cdf0e10cSrcweir |*
144cdf0e10cSrcweir |* Deactivate()
145cdf0e10cSrcweir |*
146cdf0e10cSrcweir \************************************************************************/
147cdf0e10cSrcweir
Deactivate(sal_Bool bIsMDIActivate)148cdf0e10cSrcweir void DrawViewShell::Deactivate(sal_Bool bIsMDIActivate)
149cdf0e10cSrcweir {
1508a5c5726SAndre Fischer // Temporarily disable context broadcasting while the Deactivate()
1518a5c5726SAndre Fischer // call is forwarded to our base class.
1528a5c5726SAndre Fischer const bool bIsContextBroadcasterEnabled (SfxShell::SetContextBroadcasterEnabled(false));
1538a5c5726SAndre Fischer
1548a5c5726SAndre Fischer ViewShell::Deactivate(bIsMDIActivate);
1558a5c5726SAndre Fischer
1568a5c5726SAndre Fischer SfxShell::SetContextBroadcasterEnabled(bIsContextBroadcasterEnabled);
157cdf0e10cSrcweir }
158cdf0e10cSrcweir
159cdf0e10cSrcweir namespace
160cdf0e10cSrcweir {
161cdf0e10cSrcweir class LockUI
162cdf0e10cSrcweir {
163cdf0e10cSrcweir private:
164cdf0e10cSrcweir void Lock(bool bLock);
165cdf0e10cSrcweir SfxViewFrame *mpFrame;
166cdf0e10cSrcweir public:
LockUI(SfxViewFrame * pFrame)167cdf0e10cSrcweir LockUI(SfxViewFrame *pFrame) : mpFrame(pFrame) { Lock(true); }
~LockUI()168cdf0e10cSrcweir ~LockUI() { Lock(false); }
169cdf0e10cSrcweir
170cdf0e10cSrcweir };
171cdf0e10cSrcweir
Lock(bool bLock)172cdf0e10cSrcweir void LockUI::Lock(bool bLock)
173cdf0e10cSrcweir {
174cdf0e10cSrcweir if (!mpFrame)
175cdf0e10cSrcweir return;
176cdf0e10cSrcweir mpFrame->Enable( !bLock );
177cdf0e10cSrcweir }
178cdf0e10cSrcweir }
179cdf0e10cSrcweir
180cdf0e10cSrcweir /*************************************************************************
181cdf0e10cSrcweir |*
182cdf0e10cSrcweir |* Wird gerufen, wenn sich der Selektionszustand der View aendert
183cdf0e10cSrcweir |*
184cdf0e10cSrcweir \************************************************************************/
SelectionHasChanged(void)185cdf0e10cSrcweir void DrawViewShell::SelectionHasChanged (void)
186cdf0e10cSrcweir {
187cdf0e10cSrcweir Invalidate();
188cdf0e10cSrcweir
189cdf0e10cSrcweir //Update3DWindow(); // 3D-Controller
190cdf0e10cSrcweir SfxBoolItem aItem( SID_3D_STATE, sal_True );
191cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute(
192cdf0e10cSrcweir SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
193cdf0e10cSrcweir
194cdf0e10cSrcweir SdrOle2Obj* pOleObj = NULL;
195cdf0e10cSrcweir SdrGrafObj* pGrafObj = NULL;
196cdf0e10cSrcweir
197cdf0e10cSrcweir if ( mpDrawView->AreObjectsMarked() )
198cdf0e10cSrcweir {
199cdf0e10cSrcweir const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
200cdf0e10cSrcweir
201cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1)
202cdf0e10cSrcweir {
203cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0);
204cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj();
205cdf0e10cSrcweir
206cdf0e10cSrcweir sal_uInt32 nInv = pObj->GetObjInventor();
207cdf0e10cSrcweir sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
208cdf0e10cSrcweir
209cdf0e10cSrcweir if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2)
210cdf0e10cSrcweir {
211cdf0e10cSrcweir pOleObj = (SdrOle2Obj*) pObj;
212cdf0e10cSrcweir UpdateIMapDlg( pObj );
213cdf0e10cSrcweir }
214cdf0e10cSrcweir else if (nSdrObjKind == OBJ_GRAF)
215cdf0e10cSrcweir {
216cdf0e10cSrcweir pGrafObj = (SdrGrafObj*) pObj;
217cdf0e10cSrcweir UpdateIMapDlg( pObj );
218cdf0e10cSrcweir }
219cdf0e10cSrcweir }
220cdf0e10cSrcweir }
221cdf0e10cSrcweir
222cdf0e10cSrcweir ViewShellBase& rBase = GetViewShellBase();
223cdf0e10cSrcweir rBase.SetVerbs( uno::Sequence< embed::VerbDescriptor >() );
224cdf0e10cSrcweir
225cdf0e10cSrcweir try
226cdf0e10cSrcweir {
227cdf0e10cSrcweir Client* pIPClient = static_cast<Client*>(rBase.GetIPClient());
228cdf0e10cSrcweir if ( pIPClient && pIPClient->IsObjectInPlaceActive() )
229cdf0e10cSrcweir {
230cdf0e10cSrcweir /**********************************************************************
231cdf0e10cSrcweir * Ggf. OLE-Objekt beruecksichtigen und deaktivieren
232cdf0e10cSrcweir **********************************************************************/
233cdf0e10cSrcweir
234cdf0e10cSrcweir // this means we recently deselected an inplace active ole object so
235cdf0e10cSrcweir // we need to deselect it now
236cdf0e10cSrcweir if (!pOleObj)
237cdf0e10cSrcweir {
238cdf0e10cSrcweir //#i47279# disable frame until after object has completed unload
239cdf0e10cSrcweir LockUI aUILock(GetViewFrame());
240cdf0e10cSrcweir pIPClient->DeactivateObject();
241cdf0e10cSrcweir //HMHmpDrView->ShowMarkHdl();
242cdf0e10cSrcweir }
243cdf0e10cSrcweir else
244cdf0e10cSrcweir {
245cdf0e10cSrcweir uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef();
246cdf0e10cSrcweir if ( xObj.is() )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir rBase.SetVerbs( xObj->getSupportedVerbs() );
249cdf0e10cSrcweir }
250cdf0e10cSrcweir else
251cdf0e10cSrcweir {
252cdf0e10cSrcweir rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() );
253cdf0e10cSrcweir }
254cdf0e10cSrcweir }
255cdf0e10cSrcweir }
256cdf0e10cSrcweir else
257cdf0e10cSrcweir {
258cdf0e10cSrcweir if ( pOleObj )
259cdf0e10cSrcweir {
260cdf0e10cSrcweir uno::Reference < embed::XEmbeddedObject > xObj = pOleObj->GetObjRef();
261cdf0e10cSrcweir if ( xObj.is() )
262cdf0e10cSrcweir {
263cdf0e10cSrcweir rBase.SetVerbs( xObj->getSupportedVerbs() );
264cdf0e10cSrcweir }
265cdf0e10cSrcweir else
266cdf0e10cSrcweir {
267cdf0e10cSrcweir rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() );
268cdf0e10cSrcweir }
269cdf0e10cSrcweir }
270cdf0e10cSrcweir else
271cdf0e10cSrcweir {
272cdf0e10cSrcweir rBase.SetVerbs( uno::Sequence < embed::VerbDescriptor >() );
273cdf0e10cSrcweir }
274cdf0e10cSrcweir }
275cdf0e10cSrcweir }
276cdf0e10cSrcweir catch( ::com::sun::star::uno::Exception& e )
277cdf0e10cSrcweir {
278cdf0e10cSrcweir (void)e;
279cdf0e10cSrcweir DBG_ERROR(
280cdf0e10cSrcweir (rtl::OString("sd::DrawViewShell::SelectionHasChanged(), "
281cdf0e10cSrcweir "exception caught: ") +
282cdf0e10cSrcweir rtl::OUStringToOString(
283cdf0e10cSrcweir comphelper::anyToString( cppu::getCaughtException() ),
284cdf0e10cSrcweir RTL_TEXTENCODING_UTF8 )).getStr() );
285cdf0e10cSrcweir }
286cdf0e10cSrcweir
287cdf0e10cSrcweir if( HasCurrentFunction() )
288cdf0e10cSrcweir {
289cdf0e10cSrcweir GetCurrentFunction()->SelectionHasChanged();
290cdf0e10cSrcweir }
291cdf0e10cSrcweir else
292cdf0e10cSrcweir {
293cdf0e10cSrcweir GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this,*mpDrawView);
294cdf0e10cSrcweir }
295cdf0e10cSrcweir
296cdf0e10cSrcweir // #96124# Invalidate for every subshell
297cdf0e10cSrcweir GetViewShellBase().GetViewShellManager()->InvalidateAllSubShells(this);
298cdf0e10cSrcweir
299cdf0e10cSrcweir mpDrawView->UpdateSelectionClipboard( sal_False );
300cdf0e10cSrcweir
301cdf0e10cSrcweir GetViewShellBase().GetDrawController().FireSelectionChangeListener();
302cdf0e10cSrcweir }
303cdf0e10cSrcweir
304cdf0e10cSrcweir
305cdf0e10cSrcweir /*************************************************************************
306cdf0e10cSrcweir |*
307cdf0e10cSrcweir |* Zoomfaktor setzen
308cdf0e10cSrcweir |*
309cdf0e10cSrcweir \************************************************************************/
310cdf0e10cSrcweir
SetZoom(long nZoom)311cdf0e10cSrcweir void DrawViewShell::SetZoom( long nZoom )
312cdf0e10cSrcweir {
313cdf0e10cSrcweir // Make sure that the zoom factor will not be recalculated on
314cdf0e10cSrcweir // following window resizings.
315cdf0e10cSrcweir mbZoomOnPage = sal_False;
316cdf0e10cSrcweir ViewShell::SetZoom( nZoom );
317cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
318cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
319cdf0e10cSrcweir mpViewOverlayManager->onZoomChanged();
320cdf0e10cSrcweir }
321cdf0e10cSrcweir
322cdf0e10cSrcweir /*************************************************************************
323cdf0e10cSrcweir |*
324cdf0e10cSrcweir |* Zoomrechteck fuer aktives Fenster einstellen
325cdf0e10cSrcweir |*
326cdf0e10cSrcweir \************************************************************************/
327cdf0e10cSrcweir
SetZoomRect(const Rectangle & rZoomRect)328cdf0e10cSrcweir void DrawViewShell::SetZoomRect( const Rectangle& rZoomRect )
329cdf0e10cSrcweir {
330cdf0e10cSrcweir ViewShell::SetZoomRect( rZoomRect );
331cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
332cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
333cdf0e10cSrcweir mpViewOverlayManager->onZoomChanged();
334cdf0e10cSrcweir }
335cdf0e10cSrcweir
336cdf0e10cSrcweir /*************************************************************************
337cdf0e10cSrcweir |*
338cdf0e10cSrcweir |* PrepareClose, ggfs. Texteingabe beenden, damit andere Viewshells ein
339cdf0e10cSrcweir |* aktualisiertes Textobjekt vorfinden
340cdf0e10cSrcweir |*
341cdf0e10cSrcweir \************************************************************************/
342cdf0e10cSrcweir
PrepareClose(sal_Bool bUI,sal_Bool bForBrowsing)343cdf0e10cSrcweir sal_uInt16 DrawViewShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
344cdf0e10cSrcweir {
345cdf0e10cSrcweir if ( ViewShell::PrepareClose(bUI, bForBrowsing) != sal_True )
346cdf0e10cSrcweir return sal_False;
347cdf0e10cSrcweir
348cdf0e10cSrcweir sal_Bool bRet = sal_True;
349cdf0e10cSrcweir
350cdf0e10cSrcweir if( bRet && HasCurrentFunction() )
351cdf0e10cSrcweir {
352cdf0e10cSrcweir sal_uInt16 nID = GetCurrentFunction()->GetSlotID();
353cdf0e10cSrcweir if (nID == SID_TEXTEDIT || nID == SID_ATTR_CHAR)
354cdf0e10cSrcweir {
355cdf0e10cSrcweir mpDrawView->SdrEndTextEdit();
356cdf0e10cSrcweir }
357cdf0e10cSrcweir }
358cdf0e10cSrcweir else if( !bRet )
359cdf0e10cSrcweir {
360cdf0e10cSrcweir maCloseTimer.SetTimeoutHdl( LINK( this, DrawViewShell, CloseHdl ) );
361cdf0e10cSrcweir maCloseTimer.SetTimeout( 20 );
362cdf0e10cSrcweir maCloseTimer.Start();
363cdf0e10cSrcweir }
364cdf0e10cSrcweir
365cdf0e10cSrcweir return bRet;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir
368cdf0e10cSrcweir /*************************************************************************
369cdf0e10cSrcweir |*
370cdf0e10cSrcweir |* Status (Enabled/Disabled) von Menue-SfxSlots setzen
371cdf0e10cSrcweir |*
372cdf0e10cSrcweir \************************************************************************/
373cdf0e10cSrcweir
ChangeEditMode(EditMode eEMode,bool bIsLayerModeActive)374cdf0e10cSrcweir void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
375cdf0e10cSrcweir {
376cdf0e10cSrcweir if (meEditMode != eEMode || mbIsLayerModeActive != bIsLayerModeActive)
377cdf0e10cSrcweir {
378cdf0e10cSrcweir ViewShellManager::UpdateLock aLock (GetViewShellBase().GetViewShellManager());
379cdf0e10cSrcweir
380cdf0e10cSrcweir sal_uInt16 nActualPageNum = 0;
381cdf0e10cSrcweir
382cdf0e10cSrcweir GetViewShellBase().GetDrawController().FireChangeEditMode (eEMode == EM_MASTERPAGE);
383cdf0e10cSrcweir GetViewShellBase().GetDrawController().FireChangeLayerMode (bIsLayerModeActive);
384cdf0e10cSrcweir
385cdf0e10cSrcweir if ( mpDrawView->IsTextEdit() )
386cdf0e10cSrcweir {
387cdf0e10cSrcweir mpDrawView->SdrEndTextEdit();
388cdf0e10cSrcweir }
389cdf0e10cSrcweir
390cdf0e10cSrcweir LayerTabBar* pLayerBar = GetLayerTabControl();
391cdf0e10cSrcweir if (pLayerBar != NULL)
392cdf0e10cSrcweir pLayerBar->EndEditMode();
393cdf0e10cSrcweir maTabControl.EndEditMode();
394cdf0e10cSrcweir
395cdf0e10cSrcweir if (mePageKind == PK_HANDOUT)
396cdf0e10cSrcweir {
397cdf0e10cSrcweir // Bei Handzetteln nur MasterPage zulassen
398cdf0e10cSrcweir eEMode = EM_MASTERPAGE;
399cdf0e10cSrcweir }
400cdf0e10cSrcweir
40165be1ea2SAndre Fischer GetViewShellBase().GetDrawController().BroadcastContextChange();
40265be1ea2SAndre Fischer
403cdf0e10cSrcweir meEditMode = eEMode;
404*2d19362eSArmin Le Grand
405*2d19362eSArmin Le Grand if(pLayerBar)
406*2d19362eSArmin Le Grand {
407*2d19362eSArmin Le Grand // #87182# only switch activation mode of LayerTabBar when there is one,
408*2d19362eSArmin Le Grand // else it will not get initialized with the current set of Layers as needed
409cdf0e10cSrcweir mbIsLayerModeActive = bIsLayerModeActive;
410*2d19362eSArmin Le Grand }
411cdf0e10cSrcweir
412cdf0e10cSrcweir // Determine whether to show the master view toolbar. The master
413cdf0e10cSrcweir // page mode has to be active and the shell must not be a handout
414cdf0e10cSrcweir // view.
415cdf0e10cSrcweir bool bShowMasterViewToolbar (meEditMode == EM_MASTERPAGE
416cdf0e10cSrcweir && GetShellType() != ViewShell::ST_HANDOUT);
417cdf0e10cSrcweir
418cdf0e10cSrcweir // If the master view toolbar is not shown we hide it before
419cdf0e10cSrcweir // switching the edit mode.
420cdf0e10cSrcweir if (::sd::ViewShell::mpImpl->mbIsInitialized
421cdf0e10cSrcweir && IsMainViewShell()
422cdf0e10cSrcweir && ! bShowMasterViewToolbar)
423cdf0e10cSrcweir {
424cdf0e10cSrcweir GetViewShellBase().GetToolBarManager()->ResetToolBars(ToolBarManager::TBG_MASTER_MODE);
425cdf0e10cSrcweir }
426cdf0e10cSrcweir
427cdf0e10cSrcweir if (meEditMode == EM_PAGE)
428cdf0e10cSrcweir {
429cdf0e10cSrcweir /******************************************************************
430cdf0e10cSrcweir * PAGEMODE
431cdf0e10cSrcweir ******************************************************************/
432cdf0e10cSrcweir
433cdf0e10cSrcweir maTabControl.Clear();
434cdf0e10cSrcweir
435cdf0e10cSrcweir SdPage* pPage;
436cdf0e10cSrcweir String aPageName;
437cdf0e10cSrcweir sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
438cdf0e10cSrcweir
439cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nPageCnt; i++)
440cdf0e10cSrcweir {
441cdf0e10cSrcweir pPage = GetDoc()->GetSdPage(i, mePageKind);
442cdf0e10cSrcweir aPageName = pPage->GetName();
443cdf0e10cSrcweir maTabControl.InsertPage(i + 1, aPageName);
444cdf0e10cSrcweir
445cdf0e10cSrcweir if ( pPage->IsSelected() && nActualPageNum == 0 )
446cdf0e10cSrcweir {
447cdf0e10cSrcweir nActualPageNum = i;
448cdf0e10cSrcweir }
449cdf0e10cSrcweir }
450cdf0e10cSrcweir
451cdf0e10cSrcweir maTabControl.SetCurPageId(nActualPageNum + 1);
452cdf0e10cSrcweir
453cdf0e10cSrcweir SwitchPage(nActualPageNum);
454cdf0e10cSrcweir }
455cdf0e10cSrcweir else
456cdf0e10cSrcweir {
457cdf0e10cSrcweir /******************************************************************
458cdf0e10cSrcweir * MASTERPAGE
459cdf0e10cSrcweir ******************************************************************/
460cdf0e10cSrcweir GetViewFrame()->SetChildWindow(
461cdf0e10cSrcweir AnimationChildWindow::GetChildWindowId(), sal_False );
462cdf0e10cSrcweir
463cdf0e10cSrcweir if (!mpActualPage)
464cdf0e10cSrcweir {
465cdf0e10cSrcweir // Sofern es keine mpActualPage gibt, wird die erste genommen
466cdf0e10cSrcweir mpActualPage = GetDoc()->GetSdPage(0, mePageKind);
467cdf0e10cSrcweir }
468cdf0e10cSrcweir
469cdf0e10cSrcweir maTabControl.Clear();
470cdf0e10cSrcweir sal_uInt16 nActualMasterPageNum = 0;
471cdf0e10cSrcweir sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
472cdf0e10cSrcweir
473cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nMasterPageCnt; i++)
474cdf0e10cSrcweir {
475cdf0e10cSrcweir SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind);
476cdf0e10cSrcweir String aLayoutName(pMaster->GetLayoutName());
477cdf0e10cSrcweir aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
478cdf0e10cSrcweir
479cdf0e10cSrcweir maTabControl.InsertPage(i + 1, aLayoutName);
480cdf0e10cSrcweir
481cdf0e10cSrcweir if (&(mpActualPage->TRG_GetMasterPage()) == pMaster)
482cdf0e10cSrcweir {
483cdf0e10cSrcweir nActualMasterPageNum = i;
484cdf0e10cSrcweir }
485cdf0e10cSrcweir }
486cdf0e10cSrcweir
487cdf0e10cSrcweir maTabControl.SetCurPageId(nActualMasterPageNum + 1);
488cdf0e10cSrcweir SwitchPage(nActualMasterPageNum);
489cdf0e10cSrcweir }
490cdf0e10cSrcweir
491cdf0e10cSrcweir // If the master view toolbar is to be shown we turn it on after the
492cdf0e10cSrcweir // edit mode has been changed.
493cdf0e10cSrcweir if (::sd::ViewShell::mpImpl->mbIsInitialized
494cdf0e10cSrcweir && IsMainViewShell()
495cdf0e10cSrcweir && bShowMasterViewToolbar)
496cdf0e10cSrcweir {
497cdf0e10cSrcweir GetViewShellBase().GetToolBarManager()->SetToolBar(
498cdf0e10cSrcweir ToolBarManager::TBG_MASTER_MODE,
499cdf0e10cSrcweir ToolBarManager::msMasterViewToolBar);
500cdf0e10cSrcweir }
501cdf0e10cSrcweir
502cdf0e10cSrcweir if ( ! mbIsLayerModeActive)
503cdf0e10cSrcweir {
504cdf0e10cSrcweir maTabControl.Show();
505cdf0e10cSrcweir // Set the tab control only for draw pages. For master page
506cdf0e10cSrcweir // this has been done already above.
507cdf0e10cSrcweir if (meEditMode == EM_PAGE)
508cdf0e10cSrcweir maTabControl.SetCurPageId (nActualPageNum + 1);
509cdf0e10cSrcweir }
510cdf0e10cSrcweir /*AF: The LayerDialogChildWindow is not used anymore (I hope).
511cdf0e10cSrcweir if (GetViewFrame()->KnowsChildWindow(
512cdf0e10cSrcweir LayerDialogChildWindow::GetChildWindowId()))
513cdf0e10cSrcweir {
514cdf0e10cSrcweir GetViewFrame()->SetChildWindow(
515cdf0e10cSrcweir LayerDialogChildWindow::GetChildWindowId(),
516cdf0e10cSrcweir IsLayerModeActive());
517cdf0e10cSrcweir }
518cdf0e10cSrcweir */
519cdf0e10cSrcweir ResetActualLayer();
520cdf0e10cSrcweir
521cdf0e10cSrcweir Invalidate( SID_PAGEMODE );
522cdf0e10cSrcweir Invalidate( SID_LAYERMODE );
523cdf0e10cSrcweir Invalidate( SID_MASTERPAGE );
524cdf0e10cSrcweir Invalidate( SID_DELETE_MASTER_PAGE );
525cdf0e10cSrcweir Invalidate( SID_DELETE_PAGE );
526cdf0e10cSrcweir Invalidate( SID_SLIDE_MASTERPAGE );
527cdf0e10cSrcweir Invalidate( SID_TITLE_MASTERPAGE );
528cdf0e10cSrcweir Invalidate( SID_NOTES_MASTERPAGE );
529cdf0e10cSrcweir Invalidate( SID_HANDOUT_MASTERPAGE );
5300a7c867cSAndre Fischer
5312a3f8a0eSAndre Fischer SetContextName(GetSidebarContextName());
532cdf0e10cSrcweir }
533cdf0e10cSrcweir }
534cdf0e10cSrcweir
535cdf0e10cSrcweir
536cdf0e10cSrcweir
537cdf0e10cSrcweir
IsLayerModeActive(void) const538cdf0e10cSrcweir bool DrawViewShell::IsLayerModeActive (void) const
539cdf0e10cSrcweir {
540cdf0e10cSrcweir return mbIsLayerModeActive;
541cdf0e10cSrcweir }
542cdf0e10cSrcweir
543cdf0e10cSrcweir
544cdf0e10cSrcweir
545cdf0e10cSrcweir
546cdf0e10cSrcweir /*************************************************************************
547cdf0e10cSrcweir |*
548cdf0e10cSrcweir |* Groesse des TabControls und der ModeButtons zurueckgeben
549cdf0e10cSrcweir |*
550cdf0e10cSrcweir \************************************************************************/
551cdf0e10cSrcweir
GetHCtrlWidth()552cdf0e10cSrcweir long DrawViewShell::GetHCtrlWidth()
553cdf0e10cSrcweir {
554cdf0e10cSrcweir // return maTabControl.GetSizePixel().Width();
555cdf0e10cSrcweir return 0;
556cdf0e10cSrcweir }
557cdf0e10cSrcweir
558cdf0e10cSrcweir
559cdf0e10cSrcweir /*************************************************************************
560cdf0e10cSrcweir |*
561cdf0e10cSrcweir |* Horizontales Lineal erzeugen
562cdf0e10cSrcweir |*
563cdf0e10cSrcweir \************************************************************************/
564cdf0e10cSrcweir
CreateHRuler(::sd::Window * pWin,sal_Bool bIsFirst)565cdf0e10cSrcweir SvxRuler* DrawViewShell::CreateHRuler (::sd::Window* pWin, sal_Bool bIsFirst)
566cdf0e10cSrcweir {
567cdf0e10cSrcweir Ruler* pRuler;
568cdf0e10cSrcweir WinBits aWBits;
569cdf0e10cSrcweir sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT;
570cdf0e10cSrcweir
571cdf0e10cSrcweir if ( bIsFirst )
572cdf0e10cSrcweir {
573cdf0e10cSrcweir aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER | WB_EXTRAFIELD;
574cdf0e10cSrcweir nFlags |= ( SVXRULER_SUPPORT_SET_NULLOFFSET |
575cdf0e10cSrcweir SVXRULER_SUPPORT_TABS |
576cdf0e10cSrcweir SVXRULER_SUPPORT_PARAGRAPH_MARGINS ); // Neu
577cdf0e10cSrcweir }
578cdf0e10cSrcweir else
579cdf0e10cSrcweir aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER;
580cdf0e10cSrcweir
581cdf0e10cSrcweir pRuler = new Ruler (*this, GetParentWindow(), pWin, nFlags,
582cdf0e10cSrcweir GetViewFrame()->GetBindings(), aWBits);
583cdf0e10cSrcweir pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit());
584cdf0e10cSrcweir
585cdf0e10cSrcweir // Metric ...
586cdf0e10cSrcweir sal_uInt16 nMetric = (sal_uInt16)GetDoc()->GetUIUnit();
587cdf0e10cSrcweir
588cdf0e10cSrcweir if( nMetric == 0xffff )
589cdf0e10cSrcweir nMetric = (sal_uInt16)GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit();
590cdf0e10cSrcweir
591cdf0e10cSrcweir pRuler->SetUnit( FieldUnit( nMetric ) );
592cdf0e10cSrcweir
593cdf0e10cSrcweir // ... und auch DefTab am Lineal einstellen
594cdf0e10cSrcweir pRuler->SetDefTabDist( GetDoc()->GetDefaultTabulator() ); // Neu
595cdf0e10cSrcweir
596cdf0e10cSrcweir Fraction aUIScale(pWin->GetMapMode().GetScaleX());
597cdf0e10cSrcweir aUIScale *= GetDoc()->GetUIScale();
598cdf0e10cSrcweir pRuler->SetZoom(aUIScale);
599cdf0e10cSrcweir
600cdf0e10cSrcweir return pRuler;
601cdf0e10cSrcweir }
602cdf0e10cSrcweir
603cdf0e10cSrcweir /*************************************************************************
604cdf0e10cSrcweir |*
605cdf0e10cSrcweir |* Vertikales Lineal erzeugen
606cdf0e10cSrcweir |*
607cdf0e10cSrcweir \************************************************************************/
608cdf0e10cSrcweir
CreateVRuler(::sd::Window * pWin)609cdf0e10cSrcweir SvxRuler* DrawViewShell::CreateVRuler(::sd::Window* pWin)
610cdf0e10cSrcweir {
611cdf0e10cSrcweir Ruler* pRuler;
612cdf0e10cSrcweir WinBits aWBits = WB_VSCROLL | WB_3DLOOK | WB_BORDER;
613cdf0e10cSrcweir sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT;
614cdf0e10cSrcweir
615cdf0e10cSrcweir pRuler = new Ruler(*this, GetParentWindow(), pWin, nFlags,
616cdf0e10cSrcweir GetViewFrame()->GetBindings(), aWBits);
617cdf0e10cSrcweir pRuler->SetSourceUnit(pWin->GetMapMode().GetMapUnit());
618cdf0e10cSrcweir
619cdf0e10cSrcweir // #96629# Metric same as HRuler, use document setting
620cdf0e10cSrcweir sal_uInt16 nMetric = (sal_uInt16)GetDoc()->GetUIUnit();
621cdf0e10cSrcweir
622cdf0e10cSrcweir if( nMetric == 0xffff )
623cdf0e10cSrcweir nMetric = (sal_uInt16)GetViewShellBase().GetViewFrame()->GetDispatcher()->GetModule()->GetFieldUnit();
624cdf0e10cSrcweir
625cdf0e10cSrcweir pRuler->SetUnit( FieldUnit( nMetric ) );
626cdf0e10cSrcweir
627cdf0e10cSrcweir Fraction aUIScale(pWin->GetMapMode().GetScaleY());
628cdf0e10cSrcweir aUIScale *= GetDoc()->GetUIScale();
629cdf0e10cSrcweir pRuler->SetZoom(aUIScale);
630cdf0e10cSrcweir
631cdf0e10cSrcweir return pRuler;
632cdf0e10cSrcweir }
633cdf0e10cSrcweir
634cdf0e10cSrcweir /*************************************************************************
635cdf0e10cSrcweir |*
636cdf0e10cSrcweir |* Horizontales Lineal aktualisieren
637cdf0e10cSrcweir |*
638cdf0e10cSrcweir \************************************************************************/
639cdf0e10cSrcweir
UpdateHRuler()640cdf0e10cSrcweir void DrawViewShell::UpdateHRuler()
641cdf0e10cSrcweir {
642cdf0e10cSrcweir Invalidate( SID_ATTR_LONG_LRSPACE );
643cdf0e10cSrcweir Invalidate( SID_RULER_PAGE_POS );
644cdf0e10cSrcweir Invalidate( SID_RULER_OBJECT );
645cdf0e10cSrcweir Invalidate( SID_RULER_TEXT_RIGHT_TO_LEFT );
646cdf0e10cSrcweir
647cdf0e10cSrcweir if (mpHorizontalRuler.get() != NULL)
648cdf0e10cSrcweir mpHorizontalRuler->ForceUpdate();
649cdf0e10cSrcweir }
650cdf0e10cSrcweir
651cdf0e10cSrcweir /*************************************************************************
652cdf0e10cSrcweir |*
653cdf0e10cSrcweir |* Vertikales Lineal aktualisieren
654cdf0e10cSrcweir |*
655cdf0e10cSrcweir \************************************************************************/
656cdf0e10cSrcweir
UpdateVRuler()657cdf0e10cSrcweir void DrawViewShell::UpdateVRuler()
658cdf0e10cSrcweir {
659cdf0e10cSrcweir Invalidate( SID_ATTR_LONG_LRSPACE );
660cdf0e10cSrcweir Invalidate( SID_RULER_PAGE_POS );
661cdf0e10cSrcweir Invalidate( SID_RULER_OBJECT );
662cdf0e10cSrcweir
663cdf0e10cSrcweir if (mpVerticalRuler.get() != NULL)
664cdf0e10cSrcweir mpVerticalRuler->ForceUpdate();
665cdf0e10cSrcweir }
666cdf0e10cSrcweir
667cdf0e10cSrcweir /*************************************************************************
668cdf0e10cSrcweir |*
669cdf0e10cSrcweir |* Metrik setzen
670cdf0e10cSrcweir |*
671cdf0e10cSrcweir \************************************************************************/
672cdf0e10cSrcweir
SetUIUnit(FieldUnit eUnit)673cdf0e10cSrcweir void DrawViewShell::SetUIUnit(FieldUnit eUnit)
674cdf0e10cSrcweir {
675cdf0e10cSrcweir ViewShell::SetUIUnit(eUnit);
676cdf0e10cSrcweir }
677cdf0e10cSrcweir
678cdf0e10cSrcweir /*************************************************************************
679cdf0e10cSrcweir |*
680cdf0e10cSrcweir |* TabControl nach Splitteraenderung aktualisieren
681cdf0e10cSrcweir |*
682cdf0e10cSrcweir \************************************************************************/
683cdf0e10cSrcweir
IMPL_LINK(DrawViewShell,TabSplitHdl,TabBar *,pTab)684cdf0e10cSrcweir IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab )
685cdf0e10cSrcweir {
686cdf0e10cSrcweir const long int nMax = maViewSize.Width() - maScrBarWH.Width()
687cdf0e10cSrcweir - maTabControl.GetPosPixel().X() ;
688cdf0e10cSrcweir
689cdf0e10cSrcweir Size aTabSize = maTabControl.GetSizePixel();
690cdf0e10cSrcweir aTabSize.Width() = Min(pTab->GetSplitSize(), (long)(nMax-1));
691cdf0e10cSrcweir
692cdf0e10cSrcweir maTabControl.SetSizePixel(aTabSize);
693*2d19362eSArmin Le Grand
694*2d19362eSArmin Le Grand if(GetLayerTabControl()) // #87182#
695*2d19362eSArmin Le Grand {
696cdf0e10cSrcweir GetLayerTabControl()->SetSizePixel(aTabSize);
697*2d19362eSArmin Le Grand }
698cdf0e10cSrcweir
699cdf0e10cSrcweir Point aPos = maTabControl.GetPosPixel();
700cdf0e10cSrcweir aPos.X() += aTabSize.Width();
701cdf0e10cSrcweir
702cdf0e10cSrcweir Size aScrSize(nMax - aTabSize.Width(), maScrBarWH.Height());
703cdf0e10cSrcweir mpHorizontalScrollBar->SetPosSizePixel(aPos, aScrSize);
704cdf0e10cSrcweir
705cdf0e10cSrcweir return 0;
706cdf0e10cSrcweir }
707cdf0e10cSrcweir
708cdf0e10cSrcweir /// inherited from sd::ViewShell
getCurrentPage() const709cdf0e10cSrcweir SdPage* DrawViewShell::getCurrentPage() const
710cdf0e10cSrcweir {
711cdf0e10cSrcweir const sal_Int32 nPageCount = (meEditMode == EM_PAGE)?
712cdf0e10cSrcweir GetDoc()->GetSdPageCount(mePageKind):
713cdf0e10cSrcweir GetDoc()->GetMasterSdPageCount(mePageKind);
714cdf0e10cSrcweir
715cdf0e10cSrcweir sal_Int32 nCurrentPage = maTabControl.GetCurPageId() - 1;
716cdf0e10cSrcweir DBG_ASSERT( (nPageCount>0) && (nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!" );
717cdf0e10cSrcweir if( (nPageCount < 0) || (nCurrentPage>=nPageCount) )
718cdf0e10cSrcweir nCurrentPage = 0; // play safe here
719cdf0e10cSrcweir
720cdf0e10cSrcweir if (meEditMode == EM_PAGE)
721cdf0e10cSrcweir {
722cdf0e10cSrcweir return GetDoc()->GetSdPage((sal_uInt16)nCurrentPage, mePageKind);
723cdf0e10cSrcweir }
724cdf0e10cSrcweir else // EM_MASTERPAGE
725cdf0e10cSrcweir {
726cdf0e10cSrcweir return GetDoc()->GetMasterSdPage((sal_uInt16)nCurrentPage, mePageKind);
727cdf0e10cSrcweir }
728cdf0e10cSrcweir }
729cdf0e10cSrcweir
730cdf0e10cSrcweir /*************************************************************************
731cdf0e10cSrcweir |*
732cdf0e10cSrcweir |* neue aktuelle Seite auswaehlen, falls sich die Seitenfolge geaendert
733cdf0e10cSrcweir |* hat (z. B. durch Undo)
734cdf0e10cSrcweir |*
735cdf0e10cSrcweir \************************************************************************/
736cdf0e10cSrcweir
ResetActualPage()737cdf0e10cSrcweir void DrawViewShell::ResetActualPage()
738cdf0e10cSrcweir {
739cdf0e10cSrcweir sal_uInt16 nCurrentPage = maTabControl.GetCurPageId() - 1;
740cdf0e10cSrcweir sal_uInt16 nPageCount = (meEditMode == EM_PAGE)?GetDoc()->GetSdPageCount(mePageKind):GetDoc()->GetMasterSdPageCount(mePageKind);
741cdf0e10cSrcweir if (nPageCount > 0)
742cdf0e10cSrcweir nCurrentPage = Min((sal_uInt16)(nPageCount - 1), nCurrentPage);
743cdf0e10cSrcweir else
744cdf0e10cSrcweir nCurrentPage = 0;
745cdf0e10cSrcweir
746cdf0e10cSrcweir if (meEditMode == EM_PAGE)
747cdf0e10cSrcweir {
748cdf0e10cSrcweir
749cdf0e10cSrcweir // Update fuer TabControl
750cdf0e10cSrcweir maTabControl.Clear();
751cdf0e10cSrcweir
752cdf0e10cSrcweir SdPage* pPage = NULL;
753cdf0e10cSrcweir String aPageName;
754cdf0e10cSrcweir
755cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nPageCount; i++)
756cdf0e10cSrcweir {
757cdf0e10cSrcweir pPage = GetDoc()->GetSdPage(i, mePageKind);
758cdf0e10cSrcweir aPageName = pPage->GetName();
759cdf0e10cSrcweir maTabControl.InsertPage(i + 1, aPageName);
760cdf0e10cSrcweir
761cdf0e10cSrcweir // Selektionskennungen der Seiten korrigieren
762cdf0e10cSrcweir GetDoc()->SetSelected(pPage, i == nCurrentPage);
763cdf0e10cSrcweir }
764cdf0e10cSrcweir
765cdf0e10cSrcweir maTabControl.SetCurPageId(nCurrentPage + 1);
766cdf0e10cSrcweir }
767cdf0e10cSrcweir else // EM_MASTERPAGE
768cdf0e10cSrcweir {
769cdf0e10cSrcweir SdPage* pActualPage = GetDoc()->GetMasterSdPage(nCurrentPage, mePageKind);
770cdf0e10cSrcweir maTabControl.Clear();
771cdf0e10cSrcweir sal_uInt16 nActualMasterPageNum = 0;
772cdf0e10cSrcweir
773cdf0e10cSrcweir sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
774cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nMasterPageCnt; i++)
775cdf0e10cSrcweir {
776cdf0e10cSrcweir SdPage* pMaster = GetDoc()->GetMasterSdPage(i, mePageKind);
777cdf0e10cSrcweir String aLayoutName(pMaster->GetLayoutName());
778cdf0e10cSrcweir aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
779cdf0e10cSrcweir maTabControl.InsertPage(i + 1, aLayoutName);
780cdf0e10cSrcweir
781cdf0e10cSrcweir if (pActualPage == pMaster)
782cdf0e10cSrcweir nActualMasterPageNum = i;
783cdf0e10cSrcweir }
784cdf0e10cSrcweir
785cdf0e10cSrcweir maTabControl.SetCurPageId(nActualMasterPageNum + 1);
786cdf0e10cSrcweir SwitchPage(nActualMasterPageNum);
787cdf0e10cSrcweir }
788cdf0e10cSrcweir
789cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHPAGE,
790cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
791cdf0e10cSrcweir }
792cdf0e10cSrcweir
793cdf0e10cSrcweir /*************************************************************************
794cdf0e10cSrcweir |*
795cdf0e10cSrcweir |* Verb auf OLE-Objekt anwenden
796cdf0e10cSrcweir |*
797cdf0e10cSrcweir \************************************************************************/
798cdf0e10cSrcweir
799cdf0e10cSrcweir
DoVerb(long nVerb)800cdf0e10cSrcweir ErrCode DrawViewShell::DoVerb(long nVerb)
801cdf0e10cSrcweir {
802cdf0e10cSrcweir if ( mpDrawView->AreObjectsMarked() )
803cdf0e10cSrcweir {
804cdf0e10cSrcweir const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
805cdf0e10cSrcweir
806cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1)
807cdf0e10cSrcweir {
808cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0);
809cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj();
810cdf0e10cSrcweir
811cdf0e10cSrcweir sal_uInt32 nInv = pObj->GetObjInventor();
812cdf0e10cSrcweir sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
813cdf0e10cSrcweir
814cdf0e10cSrcweir if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2)
815cdf0e10cSrcweir {
816cdf0e10cSrcweir ActivateObject( (SdrOle2Obj*) pObj, nVerb);
817cdf0e10cSrcweir }
818cdf0e10cSrcweir #ifdef STARIMAGE_AVAILABLE
819cdf0e10cSrcweir else if (nInv = SdrInventor && nSdrObjKind == OBJ_GRAF &&
820cdf0e10cSrcweir ((SdrGrafObj*) pObj)->GetGraphicType() == GRAPHIC_BITMAP &&
821cdf0e10cSrcweir SFX_APP()->HasFeature(SFX_FEATURE_SIMAGE))
822cdf0e10cSrcweir {
823cdf0e10cSrcweir SdrGrafObj* pSdrGrafObj = (SdrGrafObj*) pObj;
824cdf0e10cSrcweir short nOK = RET_YES;
825cdf0e10cSrcweir
826cdf0e10cSrcweir if ( pSdrGrafObj->GetFileName().Len() )
827cdf0e10cSrcweir {
828cdf0e10cSrcweir // Graphik ist gelinkt, soll der Link aufgehoben werden?
829cdf0e10cSrcweir QueryBox aBox(pWindow, WB_YES_NO | WB_DEF_YES,
830cdf0e10cSrcweir String( SdResId(STR_REMOVE_LINK) ) );
831cdf0e10cSrcweir nOK = aBox.Execute();
832cdf0e10cSrcweir
833cdf0e10cSrcweir if (nOK == RET_YES)
834cdf0e10cSrcweir {
835cdf0e10cSrcweir // Link aufheben (File- und Filtername zuruecksetzen)
836cdf0e10cSrcweir pSdrGrafObj->SetGraphicLink(String(), String());
837cdf0e10cSrcweir }
838cdf0e10cSrcweir }
839cdf0e10cSrcweir
840cdf0e10cSrcweir if (nOK == RET_YES)
841cdf0e10cSrcweir {
842cdf0e10cSrcweir /**************************************************************
843cdf0e10cSrcweir * OLE-Objekt erzeugen, StarImage starten
844cdf0e10cSrcweir * Grafik-Objekt loeschen (durch OLE-Objekt ersetzt)
845cdf0e10cSrcweir **************************************************************/
846cdf0e10cSrcweir //HMHmpDrView->HideMarkHdl();
847cdf0e10cSrcweir
848cdf0e10cSrcweir SvStorageRef aStor = new SvStorage(String());
849cdf0e10cSrcweir SvInPlaceObjectRef aNewIPObj = &((SvFactory*)SvInPlaceObject::ClassFactory())
850cdf0e10cSrcweir ->CreateAndInit(SimModuleDummy::GetID(SOFFICE_FILEFORMAT_CURRENT), aStor);
851cdf0e10cSrcweir if ( aNewIPObj.Is() )
852cdf0e10cSrcweir {
853cdf0e10cSrcweir SdrGrafObj* pTempSdrGrafObj = (SdrGrafObj*) pSdrGrafObj->Clone ();
854cdf0e10cSrcweir
855cdf0e10cSrcweir SvEmbeddedInfoObject * pInfo;
856cdf0e10cSrcweir pInfo = GetViewFrame()->GetObjectShell()->
857cdf0e10cSrcweir InsertObject( aNewIPObj, String() );
858cdf0e10cSrcweir
859cdf0e10cSrcweir String aName;
860cdf0e10cSrcweir if (pInfo)
861cdf0e10cSrcweir {
862cdf0e10cSrcweir aName = pInfo->GetObjName();
863cdf0e10cSrcweir }
864cdf0e10cSrcweir
865cdf0e10cSrcweir Rectangle aRect = pObj->GetLogicRect();
866cdf0e10cSrcweir SdrOle2Obj* pSdrOle2Obj = new SdrOle2Obj( aNewIPObj,
867cdf0e10cSrcweir aName, aRect );
868cdf0e10cSrcweir
869cdf0e10cSrcweir SdrPageView* pPV = mpDrawView->GetSdrPageView();
870cdf0e10cSrcweir
871cdf0e10cSrcweir pPV->GetObjList()->InsertObject( pSdrOle2Obj );
872cdf0e10cSrcweir mpDrawView->ReplaceObjectAtView( pObj, *pPV, pTempSdrGrafObj );
873cdf0e10cSrcweir
874cdf0e10cSrcweir pSdrOle2Obj->SetLogicRect(aRect);
875cdf0e10cSrcweir aNewIPObj->SetVisAreaSize(aRect.GetSize());
876cdf0e10cSrcweir
877cdf0e10cSrcweir SimDLL::Update(aNewIPObj, pTempSdrGrafObj->GetGraphic(), pWindow);
878cdf0e10cSrcweir ActivateObject(pSdrOle2Obj, SVVERB_SHOW);
879cdf0e10cSrcweir
880cdf0e10cSrcweir Client* pClient = (Client*) GetIPClient();
881cdf0e10cSrcweir
882cdf0e10cSrcweir if (pClient)
883cdf0e10cSrcweir pClient->SetSdrGrafObj( pTempSdrGrafObj );
884cdf0e10cSrcweir }
885cdf0e10cSrcweir }
886cdf0e10cSrcweir }
887cdf0e10cSrcweir #endif
888cdf0e10cSrcweir }
889cdf0e10cSrcweir }
890cdf0e10cSrcweir
891cdf0e10cSrcweir return 0;
892cdf0e10cSrcweir }
893cdf0e10cSrcweir
894cdf0e10cSrcweir
895cdf0e10cSrcweir /*************************************************************************
896cdf0e10cSrcweir |*
897cdf0e10cSrcweir |* OLE-Object aktivieren
898cdf0e10cSrcweir |*
899cdf0e10cSrcweir \************************************************************************/
900cdf0e10cSrcweir
ActivateObject(SdrOle2Obj * pObj,long nVerb)901cdf0e10cSrcweir sal_Bool DrawViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
902cdf0e10cSrcweir {
903cdf0e10cSrcweir sal_Bool bActivated = sal_False;
904cdf0e10cSrcweir
905cdf0e10cSrcweir if ( !GetDocSh()->IsUIActive() )
906cdf0e10cSrcweir {
907cdf0e10cSrcweir ToolBarManager::UpdateLock aLock (GetViewShellBase().GetToolBarManager());
908cdf0e10cSrcweir
909cdf0e10cSrcweir bActivated = ViewShell::ActivateObject(pObj, nVerb);
910cdf0e10cSrcweir
911cdf0e10cSrcweir OSL_ASSERT(GetViewShell()!=NULL);
912cdf0e10cSrcweir Client* pClient = static_cast<Client*>(GetViewShell()->GetIPClient());
913cdf0e10cSrcweir if (pClient)
914cdf0e10cSrcweir pClient->SetSdrGrafObj(NULL);
915cdf0e10cSrcweir }
916cdf0e10cSrcweir
917cdf0e10cSrcweir return(bActivated);
918cdf0e10cSrcweir }
919cdf0e10cSrcweir
920cdf0e10cSrcweir /*************************************************************************
921cdf0e10cSrcweir |*
922cdf0e10cSrcweir |* Auf gewuenschte Seite schalten
923cdf0e10cSrcweir |* Der Parameter nSelectedPage bezieht sich auf den aktuellen EditMode
924cdf0e10cSrcweir |*
925cdf0e10cSrcweir \************************************************************************/
926cdf0e10cSrcweir
LclResetFlag(bool & rbFlag)927cdf0e10cSrcweir void LclResetFlag (bool& rbFlag) {rbFlag = false;}
928cdf0e10cSrcweir
SwitchPage(sal_uInt16 nSelectedPage)929cdf0e10cSrcweir sal_Bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
930cdf0e10cSrcweir {
931cdf0e10cSrcweir /** Under some circumstances there are nested calls to SwitchPage() and
932cdf0e10cSrcweir may crash the application (activation of form controls when the
933cdf0e10cSrcweir shell of the edit view is not on top of the shell stack, see issue
934cdf0e10cSrcweir 83888 for details.) Therefore the nested calls are ignored (they
935cdf0e10cSrcweir would jump to the wrong page anyway.)
936cdf0e10cSrcweir */
937cdf0e10cSrcweir if (mbIsInSwitchPage)
938cdf0e10cSrcweir return sal_False;
939cdf0e10cSrcweir mbIsInSwitchPage = true;
940cdf0e10cSrcweir comphelper::ScopeGuard aGuard (::boost::bind(LclResetFlag, ::boost::ref(mbIsInSwitchPage)));
941cdf0e10cSrcweir
942cdf0e10cSrcweir if (GetActiveWindow()->IsInPaint())
943cdf0e10cSrcweir {
944cdf0e10cSrcweir // Switching the current page while a Paint is being executed is
945cdf0e10cSrcweir // dangerous. So, post it for later execution and return.
946cdf0e10cSrcweir maAsynchronousSwitchPageCall.Post(::boost::bind(
947cdf0e10cSrcweir ::std::mem_fun(&DrawViewShell::SwitchPage),
948cdf0e10cSrcweir this,
949cdf0e10cSrcweir nSelectedPage));
950cdf0e10cSrcweir return sal_False;
951cdf0e10cSrcweir }
952cdf0e10cSrcweir
953cdf0e10cSrcweir sal_Bool bOK = sal_False;
954cdf0e10cSrcweir
955cdf0e10cSrcweir // With the current implementation of FuSlideShow there is a problem
956cdf0e10cSrcweir // when it dsplays the show in a window: When the show is stopped it
957cdf0e10cSrcweir // returns at one point in time SDRPAGE_NOTFOUND as current page index.
958cdf0e10cSrcweir // Because FuSlideShow is currently being rewritten this bug is fixed
959cdf0e10cSrcweir // here.
960cdf0e10cSrcweir // This is not as bad a hack as it may look because making SwitchPage()
961cdf0e10cSrcweir // more robust with respect to invalid page numbers is a good thing
962cdf0e10cSrcweir // anyway.
963cdf0e10cSrcweir if (nSelectedPage == SDRPAGE_NOTFOUND)
964cdf0e10cSrcweir {
965cdf0e10cSrcweir nSelectedPage = 0;
966cdf0e10cSrcweir }
967cdf0e10cSrcweir else
968cdf0e10cSrcweir {
969cdf0e10cSrcweir // Make sure that the given page index points to an existing page. Move
970cdf0e10cSrcweir // the index into the valid range if necessary.
971cdf0e10cSrcweir sal_uInt16 nPageCount = (meEditMode == EM_PAGE)
972cdf0e10cSrcweir ? GetDoc()->GetSdPageCount(mePageKind)
973cdf0e10cSrcweir : GetDoc()->GetMasterSdPageCount(mePageKind);
974cdf0e10cSrcweir if (nSelectedPage >= nPageCount)
975cdf0e10cSrcweir nSelectedPage = nPageCount-1;
976cdf0e10cSrcweir }
977cdf0e10cSrcweir
978cdf0e10cSrcweir if (IsSwitchPageAllowed())
979cdf0e10cSrcweir {
980cdf0e10cSrcweir ModifyGuard aGuard2( GetDoc() );
981cdf0e10cSrcweir
982cdf0e10cSrcweir bOK = sal_True;
983cdf0e10cSrcweir
984cdf0e10cSrcweir if (mpActualPage)
985cdf0e10cSrcweir {
986cdf0e10cSrcweir SdPage* pNewPage = NULL;
987cdf0e10cSrcweir
988cdf0e10cSrcweir if (meEditMode == EM_MASTERPAGE)
989cdf0e10cSrcweir {
990cdf0e10cSrcweir if( GetDoc()->GetMasterSdPageCount(mePageKind) > nSelectedPage )
991cdf0e10cSrcweir pNewPage = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind);
992cdf0e10cSrcweir
993cdf0e10cSrcweir if( pNewPage )
994cdf0e10cSrcweir {
995cdf0e10cSrcweir SdrPageView* pPV = mpDrawView->GetSdrPageView();
996cdf0e10cSrcweir
997cdf0e10cSrcweir String sPageText (pNewPage->GetLayoutName());
998cdf0e10cSrcweir sPageText.Erase(sPageText.SearchAscii(SD_LT_SEPARATOR));
999cdf0e10cSrcweir if (pPV
1000cdf0e10cSrcweir && pNewPage == dynamic_cast< SdPage* >( pPV->GetPage() )
1001cdf0e10cSrcweir && sPageText == maTabControl.GetPageText(nSelectedPage+1))
1002cdf0e10cSrcweir {
1003cdf0e10cSrcweir // this slide is already visible
1004cdf0e10cSrcweir return sal_True;
1005cdf0e10cSrcweir }
1006cdf0e10cSrcweir }
1007cdf0e10cSrcweir }
1008cdf0e10cSrcweir else
1009cdf0e10cSrcweir {
1010cdf0e10cSrcweir OSL_ASSERT(mpFrameView!=NULL);
1011cdf0e10cSrcweir mpFrameView->SetSelectedPage(nSelectedPage);
1012cdf0e10cSrcweir
1013cdf0e10cSrcweir if (GetDoc()->GetSdPageCount(mePageKind) > nSelectedPage)
1014cdf0e10cSrcweir pNewPage = GetDoc()->GetSdPage(nSelectedPage, mePageKind);
1015cdf0e10cSrcweir
1016cdf0e10cSrcweir if (mpActualPage == pNewPage)
1017cdf0e10cSrcweir {
1018cdf0e10cSrcweir SdrPageView* pPV = mpDrawView->GetSdrPageView();
1019cdf0e10cSrcweir
1020cdf0e10cSrcweir SdPage* pCurrentPage = dynamic_cast< SdPage* >( pPV->GetPage());
1021cdf0e10cSrcweir if (pPV
1022cdf0e10cSrcweir && pNewPage == pCurrentPage
1023cdf0e10cSrcweir && pNewPage->GetName() == maTabControl.GetPageText(nSelectedPage+1))
1024cdf0e10cSrcweir {
1025cdf0e10cSrcweir // this slide is already visible
1026cdf0e10cSrcweir return sal_True;
1027cdf0e10cSrcweir }
1028cdf0e10cSrcweir }
1029cdf0e10cSrcweir }
1030cdf0e10cSrcweir }
1031cdf0e10cSrcweir
1032cdf0e10cSrcweir if( mpDrawView )
1033cdf0e10cSrcweir mpDrawView->SdrEndTextEdit();
1034cdf0e10cSrcweir
1035cdf0e10cSrcweir mpActualPage = NULL;
1036cdf0e10cSrcweir
1037cdf0e10cSrcweir if (meEditMode == EM_PAGE)
1038cdf0e10cSrcweir {
1039cdf0e10cSrcweir mpActualPage = GetDoc()->GetSdPage(nSelectedPage, mePageKind);
1040cdf0e10cSrcweir }
1041cdf0e10cSrcweir else
1042cdf0e10cSrcweir {
1043cdf0e10cSrcweir SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind);
1044cdf0e10cSrcweir
1045cdf0e10cSrcweir // Passt die selektierte Seite zur MasterPage?
1046cdf0e10cSrcweir sal_uInt16 nPageCount = GetDoc()->GetSdPageCount(mePageKind);
1047cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nPageCount; i++)
1048cdf0e10cSrcweir {
1049cdf0e10cSrcweir SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
1050cdf0e10cSrcweir if(pPage && pPage->IsSelected() && pMaster == &(pPage->TRG_GetMasterPage()))
1051cdf0e10cSrcweir {
1052cdf0e10cSrcweir mpActualPage = pPage;
1053cdf0e10cSrcweir break;
1054cdf0e10cSrcweir }
1055cdf0e10cSrcweir }
1056cdf0e10cSrcweir
1057cdf0e10cSrcweir if (!mpActualPage)
1058cdf0e10cSrcweir {
1059cdf0e10cSrcweir // Die erste Seite nehmen, welche zur MasterPage passt
1060cdf0e10cSrcweir for (sal_uInt16 i = 0; i < nPageCount; i++)
1061cdf0e10cSrcweir {
1062cdf0e10cSrcweir SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
1063cdf0e10cSrcweir if(pPage && pMaster == &(pPage->TRG_GetMasterPage()))
1064cdf0e10cSrcweir {
1065cdf0e10cSrcweir mpActualPage = pPage;
1066cdf0e10cSrcweir break;
1067cdf0e10cSrcweir }
1068cdf0e10cSrcweir }
1069cdf0e10cSrcweir }
1070cdf0e10cSrcweir }
1071cdf0e10cSrcweir
1072cdf0e10cSrcweir for (sal_uInt16 i = 0; i < GetDoc()->GetSdPageCount(mePageKind); i++)
1073cdf0e10cSrcweir {
1074cdf0e10cSrcweir // Alle Seiten deselektieren
1075cdf0e10cSrcweir GetDoc()->SetSelected( GetDoc()->GetSdPage(i, mePageKind), sal_False);
1076cdf0e10cSrcweir }
1077cdf0e10cSrcweir
1078cdf0e10cSrcweir if (!mpActualPage)
1079cdf0e10cSrcweir {
1080cdf0e10cSrcweir // Sofern es keine mpActualPage gibt, wird die erste genommen
1081cdf0e10cSrcweir mpActualPage = GetDoc()->GetSdPage(0, mePageKind);
1082cdf0e10cSrcweir }
1083cdf0e10cSrcweir
1084cdf0e10cSrcweir // diese Seite auch selektieren (mpActualPage zeigt immer auf Zeichenseite,
1085cdf0e10cSrcweir // nie auf eine Masterpage)
1086cdf0e10cSrcweir GetDoc()->SetSelected(mpActualPage, sal_True);
1087cdf0e10cSrcweir
1088cdf0e10cSrcweir rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) );
1089cdf0e10cSrcweir if( !xSlideshow.is() || !xSlideshow->isRunning() || ( xSlideshow->getAnimationMode() != ANIMATIONMODE_SHOW ) )
1090cdf0e10cSrcweir {
1091cdf0e10cSrcweir // VisArea zuziehen, um ggf. Objekte zu deaktivieren
1092cdf0e10cSrcweir // !!! only if we are not in presentation mode (#96279) !!!
1093cdf0e10cSrcweir OSL_ASSERT (GetViewShell()!=NULL);
1094cdf0e10cSrcweir GetViewShell()->DisconnectAllClients();
1095cdf0e10cSrcweir VisAreaChanged(Rectangle(Point(), Size(1, 1)));
1096cdf0e10cSrcweir }
1097cdf0e10cSrcweir
1098cdf0e10cSrcweir if (meEditMode == EM_PAGE)
1099cdf0e10cSrcweir {
1100cdf0e10cSrcweir /**********************************************************************
1101cdf0e10cSrcweir * PAGEMODE
1102cdf0e10cSrcweir **********************************************************************/
1103cdf0e10cSrcweir GetDoc()->SetSelected(mpActualPage, sal_True);
1104cdf0e10cSrcweir
1105cdf0e10cSrcweir SdrPageView* pPageView = mpDrawView->GetSdrPageView();
1106cdf0e10cSrcweir
1107cdf0e10cSrcweir if (pPageView)
1108cdf0e10cSrcweir {
1109cdf0e10cSrcweir mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
1110cdf0e10cSrcweir mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
1111cdf0e10cSrcweir mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
1112cdf0e10cSrcweir
1113cdf0e10cSrcweir if (mePageKind == PK_NOTES)
1114cdf0e10cSrcweir {
1115cdf0e10cSrcweir mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
1116cdf0e10cSrcweir }
1117cdf0e10cSrcweir else if (mePageKind == PK_HANDOUT)
1118cdf0e10cSrcweir {
1119cdf0e10cSrcweir mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
1120cdf0e10cSrcweir }
1121cdf0e10cSrcweir else
1122cdf0e10cSrcweir {
1123cdf0e10cSrcweir mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
1124cdf0e10cSrcweir }
1125cdf0e10cSrcweir }
1126cdf0e10cSrcweir
1127cdf0e10cSrcweir mpDrawView->HideSdrPage();
1128cdf0e10cSrcweir mpDrawView->ShowSdrPage(mpActualPage);
1129cdf0e10cSrcweir GetViewShellBase().GetDrawController().FireSwitchCurrentPage(mpActualPage);
1130cdf0e10cSrcweir
1131cdf0e10cSrcweir SdrPageView* pNewPageView = mpDrawView->GetSdrPageView();
1132cdf0e10cSrcweir
1133cdf0e10cSrcweir if (pNewPageView)
1134cdf0e10cSrcweir {
1135cdf0e10cSrcweir pNewPageView->SetVisibleLayers( mpFrameView->GetVisibleLayers() );
1136cdf0e10cSrcweir pNewPageView->SetPrintableLayers( mpFrameView->GetPrintableLayers() );
1137cdf0e10cSrcweir pNewPageView->SetLockedLayers( mpFrameView->GetLockedLayers() );
1138cdf0e10cSrcweir
1139cdf0e10cSrcweir if (mePageKind == PK_NOTES)
1140cdf0e10cSrcweir {
1141cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetNotesHelpLines() );
1142cdf0e10cSrcweir }
1143cdf0e10cSrcweir else if (mePageKind == PK_HANDOUT)
1144cdf0e10cSrcweir {
1145cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetHandoutHelpLines() );
1146cdf0e10cSrcweir }
1147cdf0e10cSrcweir else
1148cdf0e10cSrcweir {
1149cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() );
1150cdf0e10cSrcweir }
1151cdf0e10cSrcweir }
1152cdf0e10cSrcweir
1153cdf0e10cSrcweir maTabControl.SetCurPageId(nSelectedPage+1);
1154cdf0e10cSrcweir String aPageName = mpActualPage->GetName();
1155cdf0e10cSrcweir
1156cdf0e10cSrcweir if (maTabControl.GetPageText(nSelectedPage+1) != aPageName)
1157cdf0e10cSrcweir {
1158cdf0e10cSrcweir maTabControl.SetPageText(nSelectedPage+1, aPageName);
1159cdf0e10cSrcweir }
1160cdf0e10cSrcweir }
1161cdf0e10cSrcweir else
1162cdf0e10cSrcweir {
1163cdf0e10cSrcweir /**********************************************************************
1164cdf0e10cSrcweir * MASTERPAGE
1165cdf0e10cSrcweir **********************************************************************/
1166cdf0e10cSrcweir SdrPageView* pPageView = mpDrawView->GetSdrPageView();
1167cdf0e10cSrcweir
1168cdf0e10cSrcweir if (pPageView)
1169cdf0e10cSrcweir {
1170cdf0e10cSrcweir mpFrameView->SetVisibleLayers( pPageView->GetVisibleLayers() );
1171cdf0e10cSrcweir mpFrameView->SetPrintableLayers( pPageView->GetPrintableLayers() );
1172cdf0e10cSrcweir mpFrameView->SetLockedLayers( pPageView->GetLockedLayers() );
1173cdf0e10cSrcweir
1174cdf0e10cSrcweir if (mePageKind == PK_NOTES)
1175cdf0e10cSrcweir {
1176cdf0e10cSrcweir mpFrameView->SetNotesHelpLines( pPageView->GetHelpLines() );
1177cdf0e10cSrcweir }
1178cdf0e10cSrcweir else if (mePageKind == PK_HANDOUT)
1179cdf0e10cSrcweir {
1180cdf0e10cSrcweir mpFrameView->SetHandoutHelpLines( pPageView->GetHelpLines() );
1181cdf0e10cSrcweir }
1182cdf0e10cSrcweir else
1183cdf0e10cSrcweir {
1184cdf0e10cSrcweir mpFrameView->SetStandardHelpLines( pPageView->GetHelpLines() );
1185cdf0e10cSrcweir }
1186cdf0e10cSrcweir }
1187cdf0e10cSrcweir
1188cdf0e10cSrcweir mpDrawView->HideSdrPage();
1189cdf0e10cSrcweir
1190cdf0e10cSrcweir SdPage* pMaster = GetDoc()->GetMasterSdPage(nSelectedPage, mePageKind);
1191cdf0e10cSrcweir
1192cdf0e10cSrcweir if( !pMaster ) // Falls es diese Page nicht geben sollte
1193cdf0e10cSrcweir pMaster = GetDoc()->GetMasterSdPage(0, mePageKind);
1194cdf0e10cSrcweir
1195cdf0e10cSrcweir sal_uInt16 nNum = pMaster->GetPageNum();
1196cdf0e10cSrcweir mpDrawView->ShowSdrPage(mpDrawView->GetModel()->GetMasterPage(nNum));
1197cdf0e10cSrcweir
1198cdf0e10cSrcweir GetViewShellBase().GetDrawController().FireSwitchCurrentPage(pMaster);
1199cdf0e10cSrcweir
1200cdf0e10cSrcweir SdrPageView* pNewPageView = mpDrawView->GetSdrPageView();
1201cdf0e10cSrcweir
1202cdf0e10cSrcweir if (pNewPageView)
1203cdf0e10cSrcweir {
1204cdf0e10cSrcweir pNewPageView->SetVisibleLayers( mpFrameView->GetVisibleLayers() );
1205cdf0e10cSrcweir pNewPageView->SetPrintableLayers( mpFrameView->GetPrintableLayers() );
1206cdf0e10cSrcweir pNewPageView->SetLockedLayers( mpFrameView->GetLockedLayers() );
1207cdf0e10cSrcweir
1208cdf0e10cSrcweir if (mePageKind == PK_NOTES)
1209cdf0e10cSrcweir {
1210cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetNotesHelpLines() );
1211cdf0e10cSrcweir }
1212cdf0e10cSrcweir else if (mePageKind == PK_HANDOUT)
1213cdf0e10cSrcweir {
1214cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetHandoutHelpLines() );
1215cdf0e10cSrcweir }
1216cdf0e10cSrcweir else
1217cdf0e10cSrcweir {
1218cdf0e10cSrcweir pNewPageView->SetHelpLines( mpFrameView->GetStandardHelpLines() );
1219cdf0e10cSrcweir }
1220cdf0e10cSrcweir }
1221cdf0e10cSrcweir
1222cdf0e10cSrcweir String aLayoutName(pMaster->GetLayoutName());
1223cdf0e10cSrcweir aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
1224cdf0e10cSrcweir
1225cdf0e10cSrcweir maTabControl.SetCurPageId(nSelectedPage+1);
1226cdf0e10cSrcweir
1227cdf0e10cSrcweir if (maTabControl.GetPageText(nSelectedPage+1) != aLayoutName)
1228cdf0e10cSrcweir {
1229cdf0e10cSrcweir maTabControl.SetPageText(nSelectedPage+1, aLayoutName);
1230cdf0e10cSrcweir }
1231cdf0e10cSrcweir
1232cdf0e10cSrcweir if( mePageKind == PK_HANDOUT )
1233cdf0e10cSrcweir {
1234cdf0e10cSrcweir // set pages for all available handout presentation objects
1235cdf0e10cSrcweir sd::ShapeList& rShapeList = pMaster->GetPresentationShapeList();
1236cdf0e10cSrcweir SdrObject* pObj = 0;
1237cdf0e10cSrcweir
1238cdf0e10cSrcweir while( (pObj = rShapeList.getNextShape(pObj)) != 0 )
1239cdf0e10cSrcweir {
1240cdf0e10cSrcweir if( pMaster->GetPresObjKind(pObj) == PRESOBJ_HANDOUT )
1241cdf0e10cSrcweir {
1242cdf0e10cSrcweir // #i105146# We want no content to be displayed for PK_HANDOUT,
1243cdf0e10cSrcweir // so just never set a page as content
1244cdf0e10cSrcweir static_cast<SdrPageObj*>(pObj)->SetReferencedPage(0);
1245cdf0e10cSrcweir }
1246cdf0e10cSrcweir }
1247cdf0e10cSrcweir }
1248cdf0e10cSrcweir }
1249cdf0e10cSrcweir
1250cdf0e10cSrcweir Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
1251cdf0e10cSrcweir Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
1252cdf0e10cSrcweir VisAreaChanged(aVisAreaWin);
1253cdf0e10cSrcweir mpDrawView->VisAreaChanged(GetActiveWindow());
1254cdf0e10cSrcweir
1255cdf0e10cSrcweir // Damit der Navigator (und das Effekte-Window) das mitbekommt (/-men)
1256cdf0e10cSrcweir SfxBindings& rBindings = GetViewFrame()->GetBindings();
1257cdf0e10cSrcweir rBindings.Invalidate(SID_NAVIGATOR_PAGENAME, sal_True, sal_False);
1258cdf0e10cSrcweir rBindings.Invalidate(SID_STATUS_PAGE, sal_True, sal_False);
1259cdf0e10cSrcweir rBindings.Invalidate(SID_DELETE_MASTER_PAGE, sal_True, sal_False);
1260cdf0e10cSrcweir rBindings.Invalidate(SID_DELETE_PAGE, sal_True, sal_False);
1261cdf0e10cSrcweir rBindings.Invalidate(SID_ASSIGN_LAYOUT,sal_True,sal_False);
1262cdf0e10cSrcweir rBindings.Invalidate(SID_INSERTPAGE,sal_True,sal_False);
1263cdf0e10cSrcweir UpdatePreview( mpActualPage );
1264cdf0e10cSrcweir
1265cdf0e10cSrcweir mpDrawView->AdjustMarkHdl();
1266cdf0e10cSrcweir }
1267cdf0e10cSrcweir
1268cdf0e10cSrcweir return (bOK);
1269cdf0e10cSrcweir }
1270cdf0e10cSrcweir
1271cdf0e10cSrcweir
1272cdf0e10cSrcweir /*************************************************************************
1273cdf0e10cSrcweir |*
1274cdf0e10cSrcweir |* Pruefen, ob ein Seitenwechsel erlaubt ist
1275cdf0e10cSrcweir |*
1276cdf0e10cSrcweir \************************************************************************/
1277cdf0e10cSrcweir
IsSwitchPageAllowed() const1278cdf0e10cSrcweir sal_Bool DrawViewShell::IsSwitchPageAllowed() const
1279cdf0e10cSrcweir {
1280cdf0e10cSrcweir bool bOK = true;
1281cdf0e10cSrcweir
1282cdf0e10cSrcweir FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
1283cdf0e10cSrcweir if (pFormShell!=NULL && !pFormShell->PrepareClose (sal_False))
1284cdf0e10cSrcweir bOK = false;
1285cdf0e10cSrcweir
1286cdf0e10cSrcweir return bOK;
1287cdf0e10cSrcweir }
1288cdf0e10cSrcweir
1289cdf0e10cSrcweir /*************************************************************************
1290cdf0e10cSrcweir |*
1291cdf0e10cSrcweir |* neue aktuelle Seite auswaehlen, falls sich die Seitenfolge geaendert
1292cdf0e10cSrcweir |* hat (z. B. durch Undo)
1293cdf0e10cSrcweir |*
1294cdf0e10cSrcweir \************************************************************************/
1295cdf0e10cSrcweir
ResetActualLayer()1296cdf0e10cSrcweir void DrawViewShell::ResetActualLayer()
1297cdf0e10cSrcweir {
1298cdf0e10cSrcweir LayerTabBar* pLayerBar = GetLayerTabControl();
1299cdf0e10cSrcweir if (pLayerBar != NULL)
1300cdf0e10cSrcweir {
1301cdf0e10cSrcweir // remember old layer cound and current layer id
1302cdf0e10cSrcweir // this is needed when one layer is renamed to
1303cdf0e10cSrcweir // restore current layer
1304cdf0e10cSrcweir sal_uInt16 nOldLayerCnt = pLayerBar->GetPageCount();
1305cdf0e10cSrcweir sal_uInt16 nOldLayerId = pLayerBar->GetCurPageId();
1306cdf0e10cSrcweir
1307cdf0e10cSrcweir /*************************************************************
1308cdf0e10cSrcweir * Update fuer LayerTab
1309cdf0e10cSrcweir *************************************************************/
1310cdf0e10cSrcweir pLayerBar->Clear();
1311cdf0e10cSrcweir
1312cdf0e10cSrcweir String aName;
1313cdf0e10cSrcweir String aActiveLayer = mpDrawView->GetActiveLayer();
1314cdf0e10cSrcweir String aBackgroundLayer( SdResId(STR_LAYER_BCKGRND) );
1315cdf0e10cSrcweir String aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ) );
1316cdf0e10cSrcweir String aLayoutLayer( SdResId(STR_LAYER_LAYOUT) );
1317cdf0e10cSrcweir String aControlsLayer( SdResId(STR_LAYER_CONTROLS) );
1318cdf0e10cSrcweir String aMeasureLinesLayer( SdResId(STR_LAYER_MEASURELINES) );
1319cdf0e10cSrcweir sal_uInt16 nActiveLayer = SDRLAYER_NOTFOUND;
1320cdf0e10cSrcweir SdrLayerAdmin& rLayerAdmin = GetDoc()->GetLayerAdmin();
1321cdf0e10cSrcweir sal_uInt16 nLayerCnt = rLayerAdmin.GetLayerCount();
1322cdf0e10cSrcweir
1323cdf0e10cSrcweir for ( sal_uInt16 nLayer = 0; nLayer < nLayerCnt; nLayer++ )
1324cdf0e10cSrcweir {
1325cdf0e10cSrcweir aName = rLayerAdmin.GetLayer(nLayer)->GetName();
1326cdf0e10cSrcweir
1327cdf0e10cSrcweir if ( aName == aActiveLayer )
1328cdf0e10cSrcweir {
1329cdf0e10cSrcweir nActiveLayer = nLayer;
1330cdf0e10cSrcweir }
1331cdf0e10cSrcweir
1332cdf0e10cSrcweir if ( aName != aBackgroundLayer )
1333cdf0e10cSrcweir {
1334cdf0e10cSrcweir if (meEditMode == EM_MASTERPAGE)
1335cdf0e10cSrcweir {
1336cdf0e10cSrcweir // Layer der Page nicht auf MasterPage anzeigen
1337cdf0e10cSrcweir if (aName != aLayoutLayer &&
1338cdf0e10cSrcweir aName != aControlsLayer &&
1339cdf0e10cSrcweir aName != aMeasureLinesLayer)
1340cdf0e10cSrcweir {
1341cdf0e10cSrcweir pLayerBar->InsertPage(nLayer+1, aName);
1342cdf0e10cSrcweir
1343cdf0e10cSrcweir TabBarPageBits nBits = 0;
1344cdf0e10cSrcweir SdrPageView* pPV = mpDrawView->GetSdrPageView();
1345cdf0e10cSrcweir
1346cdf0e10cSrcweir if (pPV && !pPV->IsLayerVisible(aName))
1347cdf0e10cSrcweir {
1348cdf0e10cSrcweir // Unsichtbare Layer werden anders dargestellt
1349cdf0e10cSrcweir nBits = TPB_SPECIAL;
1350cdf0e10cSrcweir }
1351cdf0e10cSrcweir
1352cdf0e10cSrcweir pLayerBar->SetPageBits(nLayer+1, nBits);
1353cdf0e10cSrcweir }
1354cdf0e10cSrcweir }
1355cdf0e10cSrcweir else
1356cdf0e10cSrcweir {
1357cdf0e10cSrcweir // Layer der MasterPage nicht auf Page anzeigen
1358cdf0e10cSrcweir if ( aName != aBackgroundObjLayer )
1359cdf0e10cSrcweir {
1360cdf0e10cSrcweir pLayerBar->InsertPage(nLayer+1, aName);
1361cdf0e10cSrcweir
1362cdf0e10cSrcweir TabBarPageBits nBits = 0;
1363cdf0e10cSrcweir
1364cdf0e10cSrcweir if (!mpDrawView->GetSdrPageView()->IsLayerVisible(aName))
1365cdf0e10cSrcweir {
1366cdf0e10cSrcweir // Unsichtbare Layer werden anders dargestellt
1367cdf0e10cSrcweir nBits = TPB_SPECIAL;
1368cdf0e10cSrcweir }
1369cdf0e10cSrcweir
1370cdf0e10cSrcweir pLayerBar->SetPageBits(nLayer+1, nBits);
1371cdf0e10cSrcweir }
1372cdf0e10cSrcweir }
1373cdf0e10cSrcweir }
1374cdf0e10cSrcweir }
1375cdf0e10cSrcweir
1376cdf0e10cSrcweir if ( nActiveLayer == SDRLAYER_NOTFOUND )
1377cdf0e10cSrcweir {
1378cdf0e10cSrcweir if( nOldLayerCnt == pLayerBar->GetPageCount() )
1379cdf0e10cSrcweir {
1380cdf0e10cSrcweir nActiveLayer = nOldLayerId - 1;
1381cdf0e10cSrcweir }
1382cdf0e10cSrcweir else
1383cdf0e10cSrcweir {
1384cdf0e10cSrcweir nActiveLayer = ( meEditMode == EM_MASTERPAGE ) ? 2 : 0;
1385cdf0e10cSrcweir }
1386cdf0e10cSrcweir
1387cdf0e10cSrcweir mpDrawView->SetActiveLayer( pLayerBar->GetPageText(nActiveLayer + 1) );
1388cdf0e10cSrcweir }
1389cdf0e10cSrcweir
1390cdf0e10cSrcweir pLayerBar->SetCurPageId(nActiveLayer + 1);
1391cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate( SID_MODIFYLAYER );
1392cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate( SID_DELETE_LAYER );
1393cdf0e10cSrcweir }
1394cdf0e10cSrcweir }
1395cdf0e10cSrcweir
1396cdf0e10cSrcweir /*************************************************************************
1397cdf0e10cSrcweir |*
1398cdf0e10cSrcweir |* Verzoegertes Close ausfuehren
1399cdf0e10cSrcweir |*
1400cdf0e10cSrcweir \************************************************************************/
1401cdf0e10cSrcweir
IMPL_LINK(DrawViewShell,CloseHdl,Timer *,pTimer)1402cdf0e10cSrcweir IMPL_LINK( DrawViewShell, CloseHdl, Timer*, pTimer )
1403cdf0e10cSrcweir {
1404cdf0e10cSrcweir pTimer->Stop();
1405cdf0e10cSrcweir GetViewFrame()->GetBindings().Execute( SID_CLOSEWIN );
1406cdf0e10cSrcweir return 0L;
1407cdf0e10cSrcweir }
1408cdf0e10cSrcweir
1409cdf0e10cSrcweir /*************************************************************************
1410cdf0e10cSrcweir |*
1411cdf0e10cSrcweir |* AcceptDrop
1412cdf0e10cSrcweir |*
1413cdf0e10cSrcweir \************************************************************************/
1414cdf0e10cSrcweir
AcceptDrop(const AcceptDropEvent & rEvt,DropTargetHelper & rTargetHelper,::sd::Window * pTargetWindow,sal_uInt16 nPage,sal_uInt16 nLayer)1415cdf0e10cSrcweir sal_Int8 DrawViewShell::AcceptDrop (
1416cdf0e10cSrcweir const AcceptDropEvent& rEvt,
1417cdf0e10cSrcweir DropTargetHelper& rTargetHelper,
1418cdf0e10cSrcweir ::sd::Window* pTargetWindow,
1419cdf0e10cSrcweir sal_uInt16 nPage,
1420cdf0e10cSrcweir sal_uInt16 nLayer )
1421cdf0e10cSrcweir {
1422cdf0e10cSrcweir if( nPage != SDRPAGE_NOTFOUND )
1423cdf0e10cSrcweir nPage = GetDoc()->GetSdPage( nPage, mePageKind )->GetPageNum();
1424cdf0e10cSrcweir
1425cdf0e10cSrcweir if( SlideShow::IsRunning( GetViewShellBase() ) )
1426cdf0e10cSrcweir return DND_ACTION_NONE;
1427cdf0e10cSrcweir
1428cdf0e10cSrcweir return mpDrawView->AcceptDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer );
1429cdf0e10cSrcweir }
1430cdf0e10cSrcweir
1431cdf0e10cSrcweir /*************************************************************************
1432cdf0e10cSrcweir |*
1433cdf0e10cSrcweir |* ExecuteDrop
1434cdf0e10cSrcweir |*
1435cdf0e10cSrcweir \************************************************************************/
1436cdf0e10cSrcweir
ExecuteDrop(const ExecuteDropEvent & rEvt,DropTargetHelper & rTargetHelper,::sd::Window * pTargetWindow,sal_uInt16 nPage,sal_uInt16 nLayer)1437cdf0e10cSrcweir sal_Int8 DrawViewShell::ExecuteDrop (
1438cdf0e10cSrcweir const ExecuteDropEvent& rEvt,
1439cdf0e10cSrcweir DropTargetHelper& rTargetHelper,
1440cdf0e10cSrcweir ::sd::Window* pTargetWindow,
1441cdf0e10cSrcweir sal_uInt16 nPage,
1442cdf0e10cSrcweir sal_uInt16 nLayer)
1443cdf0e10cSrcweir {
1444cdf0e10cSrcweir if( nPage != SDRPAGE_NOTFOUND )
1445cdf0e10cSrcweir nPage = GetDoc()->GetSdPage( nPage, mePageKind )->GetPageNum();
1446cdf0e10cSrcweir
1447cdf0e10cSrcweir if( SlideShow::IsRunning( GetViewShellBase() ) )
1448cdf0e10cSrcweir return DND_ACTION_NONE;
1449cdf0e10cSrcweir
1450cdf0e10cSrcweir Broadcast(ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START));
1451cdf0e10cSrcweir sal_Int8 nResult (mpDrawView->ExecuteDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer ));
1452cdf0e10cSrcweir Broadcast(ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END));
1453cdf0e10cSrcweir
1454cdf0e10cSrcweir return nResult;
1455cdf0e10cSrcweir }
1456cdf0e10cSrcweir
1457cdf0e10cSrcweir } // end of namespace sd
1458cdf0e10cSrcweir
1459cdf0e10cSrcweir #ifdef _MSC_VER
1460cdf0e10cSrcweir #if (_MSC_VER < 1400)
1461cdf0e10cSrcweir #pragma optimize ( "", on )
1462cdf0e10cSrcweir #endif
1463cdf0e10cSrcweir #endif
1464