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