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 : : #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
30 : : #include <com/sun/star/beans/XPropertySet.hpp>
31 : : #include <com/sun/star/chart2/XChartDocument.hpp>
32 : : #include <com/sun/star/drawing/FillStyle.hpp>
33 : : #include <com/sun/star/drawing/LineStyle.hpp>
34 : :
35 : : #include "ViewShell.hxx"
36 : : #include "ViewShellHint.hxx"
37 : :
38 : : #include "ViewShellImplementation.hxx"
39 : : #include "FactoryIds.hxx"
40 : :
41 : : #include <svx/svxids.hrc>
42 : : #include <vcl/scrbar.hxx>
43 : : #include <svx/svdpagv.hxx>
44 : : #include <sfx2/dispatch.hxx>
45 : : #include <sfx2/app.hxx>
46 : : #include <svx/ruler.hxx>
47 : : #include <editeng/outliner.hxx>
48 : : #include <svtools/ehdl.hxx>
49 : : #include <svx/svdoole2.hxx>
50 : : #include <svtools/sfxecode.hxx>
51 : : #include <svx/fmshell.hxx>
52 : : #include <rtl/ustrbuf.hxx>
53 : : #include <unotools/moduleoptions.hxx>
54 : : #include <svx/dialogs.hrc>
55 : : #include <sot/clsids.hxx>
56 : :
57 : : #include "strings.hrc"
58 : : #include "app.hrc"
59 : : #include "unokywds.hxx"
60 : :
61 : : #include "sdundogr.hxx"
62 : : #include "FrameView.hxx"
63 : : #include "undopage.hxx"
64 : : #include "sdresid.hxx"
65 : : #include "drawdoc.hxx"
66 : : #include "View.hxx"
67 : : #include "fupoor.hxx"
68 : : #include "Client.hxx"
69 : : #include "DrawDocShell.hxx"
70 : : #include "fusearch.hxx"
71 : : #include "slideshow.hxx"
72 : : #include "sdpage.hxx"
73 : : #include "DrawViewShell.hxx"
74 : : #include "ViewShellBase.hxx"
75 : :
76 : : #include "Window.hxx"
77 : :
78 : : #include <sfx2/viewfrm.hxx>
79 : : #include <svtools/soerr.hxx>
80 : : #include <toolkit/helper/vclunohelper.hxx>
81 : :
82 : : #ifdef _MSC_VER
83 : : #pragma optimize ( "", off )
84 : : #endif
85 : :
86 : : using namespace com::sun::star;
87 : :
88 : 25 : const String aEmptyStr;
89 : :
90 : : namespace sd {
91 : :
92 : : /*************************************************************************
93 : : |*
94 : : |* Scrollbar-Update: Thumbpos und VisibleSize anpassen
95 : : |*
96 : : \************************************************************************/
97 : :
98 : 960 : void ViewShell::UpdateScrollBars()
99 : : {
100 [ + + ]: 960 : if (mpHorizontalScrollBar.get() != NULL)
101 : : {
102 : 930 : long nW = (long)(mpContentWindow->GetVisibleWidth() * 32000);
103 : 930 : long nX = (long)(mpContentWindow->GetVisibleX() * 32000);
104 : 930 : mpHorizontalScrollBar->SetVisibleSize(nW);
105 : 930 : mpHorizontalScrollBar->SetThumbPos(nX);
106 : 930 : nW = 32000 - nW;
107 : 930 : long nLine = (long) (mpContentWindow->GetScrlLineWidth() * nW);
108 : 930 : long nPage = (long) (mpContentWindow->GetScrlPageWidth() * nW);
109 : 930 : mpHorizontalScrollBar->SetLineSize(nLine);
110 : 930 : mpHorizontalScrollBar->SetPageSize(nPage);
111 : : }
112 : :
113 [ + + ]: 960 : if (mpVerticalScrollBar.get() != NULL)
114 : : {
115 : 930 : long nH = (long)(mpContentWindow->GetVisibleHeight() * 32000);
116 : 930 : long nY = (long)(mpContentWindow->GetVisibleY() * 32000);
117 : :
118 [ - + ]: 930 : if(IsPageFlipMode()) // ie in zoom mode where no panning
119 : : {
120 : 0 : SdPage* pPage = static_cast<DrawViewShell*>(this)->GetActualPage();
121 : 0 : sal_uInt16 nCurPage = (pPage->GetPageNum() - 1) / 2;
122 : 0 : sal_uInt16 nTotalPages = GetDoc()->GetSdPageCount(pPage->GetPageKind());
123 [ # # ]: 0 : mpVerticalScrollBar->SetRange(Range(0,256*nTotalPages));
124 : 0 : mpVerticalScrollBar->SetVisibleSize(256);
125 : 0 : mpVerticalScrollBar->SetThumbPos(256*nCurPage);
126 : 0 : mpVerticalScrollBar->SetLineSize(256);
127 : 0 : mpVerticalScrollBar->SetPageSize(256);
128 : : }
129 : : else
130 : : {
131 [ + - ]: 930 : mpVerticalScrollBar->SetRange(Range(0,32000));
132 : 930 : mpVerticalScrollBar->SetVisibleSize(nH);
133 : 930 : mpVerticalScrollBar->SetThumbPos(nY);
134 : 930 : nH = 32000 - nH;
135 : 930 : long nLine = (long) (mpContentWindow->GetScrlLineHeight() * nH);
136 : 930 : long nPage = (long) (mpContentWindow->GetScrlPageHeight() * nH);
137 : 930 : mpVerticalScrollBar->SetLineSize(nLine);
138 : 930 : mpVerticalScrollBar->SetPageSize(nPage);
139 : : }
140 : : }
141 : :
142 [ + + ]: 960 : if (mbHasRulers)
143 : : {
144 : 674 : UpdateHRuler();
145 : 674 : UpdateVRuler();
146 : : }
147 : :
148 : 960 : }
149 : : /*************************************************************************
150 : : |*
151 : : |* Handling fuer horizontale Scrollbars
152 : : |*
153 : : \************************************************************************/
154 : :
155 : 4 : IMPL_LINK_INLINE_START(ViewShell, HScrollHdl, ScrollBar *, pHScroll )
156 : : {
157 : 4 : return VirtHScrollHdl(pHScroll);
158 : : }
159 : 4 : IMPL_LINK_INLINE_END(ViewShell, HScrollHdl, ScrollBar *, pHScroll )
160 : :
161 : : /*************************************************************************
162 : : |*
163 : : |* virtueller Scroll-Handler fuer horizontale Scrollbars
164 : : |*
165 : : \************************************************************************/
166 : :
167 : 4 : long ViewShell::VirtHScrollHdl(ScrollBar* pHScroll)
168 : : {
169 : 4 : long nDelta = pHScroll->GetDelta();
170 : :
171 [ + - ]: 4 : if (nDelta != 0)
172 : : {
173 : 4 : double fX = (double) pHScroll->GetThumbPos() / pHScroll->GetRange().Len();
174 : :
175 : : // alle Fenster der Spalte scrollen
176 : 4 : ::sd::View* pView = GetView();
177 : 4 : OutlinerView* pOLV = NULL;
178 : :
179 [ + - ]: 4 : if (pView)
180 : 4 : pOLV = pView->GetTextEditOutlinerView();
181 : :
182 [ - + ]: 4 : if (pOLV)
183 [ # # ]: 0 : pOLV->HideCursor();
184 : :
185 [ + - ]: 4 : mpContentWindow->SetVisibleXY(fX, -1);
186 : :
187 [ + - ][ + - ]: 4 : Rectangle aVisArea = GetDocSh()->GetVisArea(ASPECT_CONTENT);
188 [ + - ][ + - ]: 4 : Point aVisAreaPos = GetActiveWindow()->PixelToLogic( Point(0,0) );
189 : 4 : aVisArea.SetPos(aVisAreaPos);
190 [ + - ][ + - ]: 4 : GetDocSh()->SetVisArea(aVisArea);
191 : :
192 [ + - ]: 4 : Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
193 [ + - ][ + - ]: 4 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
[ + - ]
194 [ + - ]: 4 : VisAreaChanged(aVisAreaWin);
195 : :
196 [ + - ]: 4 : if (pView)
197 : : {
198 [ + - ][ + - ]: 4 : pView->VisAreaChanged(GetActiveWindow());
199 : : }
200 : :
201 [ - + ]: 4 : if (pOLV)
202 [ # # ]: 0 : pOLV->ShowCursor();
203 : :
204 [ + - ]: 4 : if (mbHasRulers)
205 [ + - ]: 4 : UpdateHRuler();
206 : :
207 : : }
208 : :
209 : 4 : return 0;
210 : : }
211 : :
212 : : /*************************************************************************
213 : : |*
214 : : |* Handling fuer vertikale Scrollbars
215 : : |*
216 : : \************************************************************************/
217 : :
218 : 0 : IMPL_LINK_INLINE_START(ViewShell, VScrollHdl, ScrollBar *, pVScroll )
219 : : {
220 : 0 : return VirtVScrollHdl(pVScroll);
221 : : }
222 : 0 : IMPL_LINK_INLINE_END(ViewShell, VScrollHdl, ScrollBar *, pVScroll )
223 : :
224 : : /*************************************************************************
225 : : |*
226 : : |* Handling fuer vertikale Scrollbars
227 : : |*
228 : : \************************************************************************/
229 : :
230 : 0 : long ViewShell::VirtVScrollHdl(ScrollBar* pVScroll)
231 : : {
232 [ # # ]: 0 : if(IsPageFlipMode())
233 : : {
234 : 0 : SdPage* pPage = static_cast<DrawViewShell*>(this)->GetActualPage();
235 : 0 : sal_uInt16 nCurPage = (pPage->GetPageNum() - 1) >> 1;
236 : 0 : sal_uInt16 nNewPage = (sal_uInt16)pVScroll->GetThumbPos()/256;
237 [ # # ]: 0 : if( nCurPage != nNewPage )
238 : 0 : static_cast<DrawViewShell*>(this)->SwitchPage(nNewPage);
239 : : }
240 : : else //panning mode
241 : : {
242 : 0 : double fY = (double) pVScroll->GetThumbPos() / pVScroll->GetRange().Len();
243 : :
244 : 0 : ::sd::View* pView = GetView();
245 : 0 : OutlinerView* pOLV = NULL;
246 : :
247 [ # # ]: 0 : if (pView)
248 : 0 : pOLV = pView->GetTextEditOutlinerView();
249 : :
250 [ # # ]: 0 : if (pOLV)
251 [ # # ]: 0 : pOLV->HideCursor();
252 : :
253 [ # # ]: 0 : mpContentWindow->SetVisibleXY(-1, fY);
254 : :
255 [ # # ][ # # ]: 0 : Rectangle aVisArea = GetDocSh()->GetVisArea(ASPECT_CONTENT);
256 [ # # ][ # # ]: 0 : Point aVisAreaPos = GetActiveWindow()->PixelToLogic( Point(0,0) );
257 : 0 : aVisArea.SetPos(aVisAreaPos);
258 [ # # ][ # # ]: 0 : GetDocSh()->SetVisArea(aVisArea);
259 : :
260 [ # # ]: 0 : Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
261 [ # # ][ # # ]: 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
[ # # ]
262 [ # # ]: 0 : VisAreaChanged(aVisAreaWin);
263 : :
264 [ # # ]: 0 : if (pView)
265 : : {
266 [ # # ][ # # ]: 0 : pView->VisAreaChanged(GetActiveWindow());
267 : : }
268 : :
269 [ # # ]: 0 : if (pOLV)
270 [ # # ]: 0 : pOLV->ShowCursor();
271 : :
272 [ # # ]: 0 : if (mbHasRulers)
273 [ # # ]: 0 : UpdateVRuler();
274 : :
275 : : }
276 : :
277 : 0 : return 0;
278 : : }
279 : :
280 : 0 : SvxRuler* ViewShell::CreateHRuler(::sd::Window* , sal_Bool )
281 : : {
282 : 0 : return NULL;
283 : : }
284 : :
285 : 0 : SvxRuler* ViewShell::CreateVRuler(::sd::Window* )
286 : : {
287 : 0 : return NULL;
288 : : }
289 : :
290 : 0 : void ViewShell::UpdateHRuler()
291 : : {
292 : 0 : }
293 : :
294 : 0 : void ViewShell::UpdateVRuler()
295 : : {
296 : 0 : }
297 : :
298 : 0 : long ViewShell::GetHCtrlWidth()
299 : : {
300 : 0 : return 0;
301 : : }
302 : :
303 : : /*************************************************************************
304 : : |*
305 : : |* Eine bestimmte Anzahl von Zeilen scrollen (wird beim automatischen
306 : : |* Scrollen (Zeichen/Draggen) verwendet)
307 : : |*
308 : : \************************************************************************/
309 : :
310 : 0 : void ViewShell::ScrollLines(long nLinesX, long nLinesY)
311 : : {
312 [ # # ]: 0 : if ( nLinesX )
313 : : {
314 : 0 : nLinesX *= mpHorizontalScrollBar->GetLineSize();
315 : : }
316 [ # # ]: 0 : if ( nLinesY )
317 : : {
318 : 0 : nLinesY *= mpVerticalScrollBar->GetLineSize();
319 : : }
320 : :
321 : 0 : Scroll(nLinesX, nLinesY);
322 : 0 : }
323 : :
324 : : /*************************************************************************
325 : : |*
326 : : |* Window um nScrollX, nScrollY scrollen
327 : : |*
328 : : \************************************************************************/
329 : :
330 : 0 : void ViewShell::Scroll(long nScrollX, long nScrollY)
331 : : {
332 [ # # ]: 0 : if (nScrollX)
333 : : {
334 : 0 : long nNewThumb = mpHorizontalScrollBar->GetThumbPos() + nScrollX;
335 [ # # ]: 0 : mpHorizontalScrollBar->SetThumbPos(nNewThumb);
336 : : }
337 [ # # ]: 0 : if (nScrollY)
338 : : {
339 : 0 : long nNewThumb = mpVerticalScrollBar->GetThumbPos() + nScrollY;
340 [ # # ]: 0 : mpVerticalScrollBar->SetThumbPos(nNewThumb);
341 : : }
342 : 0 : double fX = (double) mpHorizontalScrollBar->GetThumbPos() /
343 : 0 : mpHorizontalScrollBar->GetRange().Len();
344 : 0 : double fY = (double) mpVerticalScrollBar->GetThumbPos() /
345 : 0 : mpVerticalScrollBar->GetRange().Len();
346 : :
347 [ # # ][ # # ]: 0 : GetActiveWindow()->SetVisibleXY(fX, fY);
348 : :
349 [ # # ][ # # ]: 0 : Rectangle aVisArea = GetDocSh()->GetVisArea(ASPECT_CONTENT);
350 [ # # ][ # # ]: 0 : Point aVisAreaPos = GetActiveWindow()->PixelToLogic( Point(0,0) );
351 : 0 : aVisArea.SetPos(aVisAreaPos);
352 [ # # ][ # # ]: 0 : GetDocSh()->SetVisArea(aVisArea);
353 : :
354 [ # # ]: 0 : Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
355 [ # # ][ # # ]: 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
[ # # ]
356 [ # # ]: 0 : VisAreaChanged(aVisAreaWin);
357 : :
358 : 0 : ::sd::View* pView = GetView();
359 [ # # ]: 0 : if (pView)
360 : : {
361 [ # # ][ # # ]: 0 : pView->VisAreaChanged(GetActiveWindow());
362 : : }
363 : :
364 [ # # ]: 0 : if (mbHasRulers)
365 : : {
366 [ # # ]: 0 : UpdateHRuler();
367 [ # # ]: 0 : UpdateVRuler();
368 : : }
369 : 0 : }
370 : :
371 : : /*************************************************************************
372 : : |*
373 : : |* Den Zoomfaktor fuer alle Split-Windows setzen
374 : : |*
375 : : \************************************************************************/
376 : :
377 : 0 : void ViewShell::SetZoom(long nZoom)
378 : : {
379 [ # # ]: 0 : Fraction aUIScale(nZoom, 100);
380 [ # # ][ # # ]: 0 : aUIScale *= GetDoc()->GetUIScale();
381 : :
382 [ # # ]: 0 : if (mpHorizontalRuler.get() != NULL)
383 [ # # ]: 0 : mpHorizontalRuler->SetZoom(aUIScale);
384 : :
385 [ # # ]: 0 : if (mpVerticalRuler.get() != NULL)
386 [ # # ]: 0 : mpVerticalRuler->SetZoom(aUIScale);
387 : :
388 [ # # ]: 0 : if (mpContentWindow.get() != NULL)
389 : : {
390 [ # # ]: 0 : mpContentWindow->SetZoomIntegral(nZoom);
391 : :
392 : : // #i74769# Here is a 2nd way (besides Window::Scroll) to set the visible prt
393 : : // of the window. It needs - like Scroll(SCROLL_CHILDREN) does - also to move
394 : : // the child windows. I am trying INVALIDATE_CHILDREN here which makes things better,
395 : : // but does not solve the problem completely. Neet to ask PL.
396 [ # # ]: 0 : mpContentWindow->Invalidate(INVALIDATE_CHILDREN);
397 : : }
398 : :
399 [ # # ]: 0 : Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
400 [ # # ][ # # ]: 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
[ # # ]
401 [ # # ]: 0 : VisAreaChanged(aVisAreaWin);
402 : :
403 : 0 : ::sd::View* pView = GetView();
404 [ # # ]: 0 : if (pView)
405 : : {
406 [ # # ][ # # ]: 0 : pView->VisAreaChanged(GetActiveWindow());
407 : : }
408 : :
409 [ # # ]: 0 : UpdateScrollBars();
410 : 0 : }
411 : :
412 : : /*************************************************************************
413 : : |*
414 : : |* Zoomrechteck fuer aktives Fenster einstellen und alle Split-Windows
415 : : |* auf den gleichen Zoomfaktor setzen
416 : : |*
417 : : \************************************************************************/
418 : :
419 : 447 : void ViewShell::SetZoomRect(const Rectangle& rZoomRect)
420 : : {
421 [ + - ][ + - ]: 447 : long nZoom = GetActiveWindow()->SetZoomRect(rZoomRect);
422 [ + - ]: 447 : Fraction aUIScale(nZoom, 100);
423 [ + - ][ + - ]: 447 : aUIScale *= GetDoc()->GetUIScale();
424 : :
425 [ + - ][ + - ]: 447 : Point aPos = GetActiveWindow()->GetWinViewPos();
426 : :
427 [ + + ]: 447 : if (mpHorizontalRuler.get() != NULL)
428 [ + - ]: 319 : mpHorizontalRuler->SetZoom(aUIScale);
429 : :
430 [ + + ]: 447 : if (mpVerticalRuler.get() != NULL)
431 [ + - ]: 319 : mpVerticalRuler->SetZoom(aUIScale);
432 : :
433 [ + - ]: 447 : if (mpContentWindow.get() != NULL)
434 : : {
435 [ + - ]: 447 : Point aNewPos = mpContentWindow->GetWinViewPos();
436 : 447 : aNewPos.X() = aPos.X();
437 : 447 : aNewPos.Y() = aPos.Y();
438 [ + - ]: 447 : mpContentWindow->SetZoomIntegral(nZoom);
439 [ + - ]: 447 : mpContentWindow->SetWinViewPos(aNewPos);
440 [ + - ]: 447 : mpContentWindow->UpdateMapOrigin();
441 : :
442 : : // #i74769# see above
443 [ + - ]: 447 : mpContentWindow->Invalidate(INVALIDATE_CHILDREN);
444 : : }
445 : :
446 [ + - ]: 447 : Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
447 [ + - ][ + - ]: 447 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
[ + - ]
448 [ + - ]: 447 : VisAreaChanged(aVisAreaWin);
449 : :
450 : 447 : ::sd::View* pView = GetView();
451 [ + - ]: 447 : if (pView)
452 : : {
453 [ + - ][ + - ]: 447 : pView->VisAreaChanged(GetActiveWindow());
454 : : }
455 : :
456 [ + - ]: 447 : UpdateScrollBars();
457 : 447 : }
458 : :
459 : : /*************************************************************************
460 : : |*
461 : : |* Abbildungsparameter fuer alle Split-Windows initialisieren
462 : : |*
463 : : \************************************************************************/
464 : :
465 : 166 : void ViewShell::InitWindows(const Point& rViewOrigin, const Size& rViewSize,
466 : : const Point& rWinPos, sal_Bool bUpdate)
467 : : {
468 [ + - ]: 166 : if (mpContentWindow.get() != NULL)
469 : : {
470 [ + - ]: 166 : mpContentWindow->SetViewOrigin(rViewOrigin);
471 [ + - ]: 166 : mpContentWindow->SetViewSize(rViewSize);
472 [ + - ]: 166 : mpContentWindow->SetWinViewPos(rWinPos);
473 : :
474 [ + + ]: 166 : if ( bUpdate )
475 : : {
476 [ + - ]: 36 : mpContentWindow->UpdateMapOrigin();
477 [ + - ]: 36 : mpContentWindow->Invalidate();
478 : : }
479 : : }
480 : :
481 [ + - ]: 166 : Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
482 [ + - ][ + - ]: 166 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
[ + - ]
483 [ + - ]: 166 : VisAreaChanged(aVisAreaWin);
484 : :
485 : 166 : ::sd::View* pView = GetView();
486 [ + - ]: 166 : if (pView)
487 : : {
488 [ + - ][ + - ]: 166 : pView->VisAreaChanged(GetActiveWindow());
489 : : }
490 : 166 : }
491 : :
492 : : /*************************************************************************
493 : : |*
494 : : |* Alle Split-Windows unter dem uebergebenen Rechteck invalidieren
495 : : |*
496 : : \************************************************************************/
497 : :
498 : 142 : void ViewShell::InvalidateWindows()
499 : : {
500 [ + - ]: 142 : if (mpContentWindow.get() != NULL)
501 : 142 : mpContentWindow->Invalidate();
502 : 142 : }
503 : :
504 : :
505 : : /*************************************************************************
506 : : |*
507 : : |* Auf allen Split-Windows ein Markierungsrechteck mit dem
508 : : |* uebergebenen Pen zeichnen
509 : : |*
510 : : \************************************************************************/
511 : :
512 : 0 : void ViewShell::DrawMarkRect(const Rectangle& rRect) const
513 : : {
514 [ # # ]: 0 : if (mpContentWindow.get() != NULL)
515 : : {
516 : 0 : mpContentWindow->InvertTracking(rRect, SHOWTRACK_OBJECT | SHOWTRACK_WINDOW);
517 : : }
518 : 0 : }
519 : :
520 : : /*************************************************************************
521 : : |*
522 : : |* Groesse und Raender aller Seiten setzen
523 : : |*
524 : : \************************************************************************/
525 : :
526 : 0 : void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize,
527 : : long nLeft, long nRight,
528 : : long nUpper, long nLower, sal_Bool bScaleAll,
529 : : Orientation eOrientation, sal_uInt16 nPaperBin,
530 : : sal_Bool bBackgroundFullSize)
531 : : {
532 : 0 : SdPage* pPage = 0;
533 : 0 : SdUndoGroup* pUndoGroup = NULL;
534 [ # # ][ # # ]: 0 : pUndoGroup = new SdUndoGroup(GetDoc());
[ # # ]
535 [ # # ][ # # ]: 0 : String aString(SdResId(STR_UNDO_CHANGE_PAGEFORMAT));
536 [ # # ]: 0 : pUndoGroup->SetComment(aString);
537 [ # # ]: 0 : SfxViewShell* pViewShell = GetViewShell();
538 : : OSL_ASSERT (pViewShell!=NULL);
539 : :
540 [ # # ][ # # ]: 0 : sal_uInt16 i, nPageCnt = GetDoc()->GetMasterSdPageCount(ePageKind);
541 : :
542 [ # # ][ # # ]: 0 : Broadcast (ViewShellHint(ViewShellHint::HINT_PAGE_RESIZE_START));
[ # # ]
543 : :
544 [ # # ]: 0 : for (i = 0; i < nPageCnt; i++)
545 : : {
546 : : /**********************************************************************
547 : : * Erst alle MasterPages bearbeiten
548 : : **********************************************************************/
549 [ # # ][ # # ]: 0 : pPage = GetDoc()->GetMasterSdPage(i, ePageKind);
550 : :
551 : : SdUndoAction* pUndo = new SdPageFormatUndoAction(GetDoc(), pPage,
552 : 0 : pPage->GetSize(),
553 : 0 : pPage->GetLftBorder(), pPage->GetRgtBorder(),
554 : 0 : pPage->GetUppBorder(), pPage->GetLwrBorder(),
555 : 0 : pPage->IsScaleObjects(),
556 : 0 : pPage->GetOrientation(),
557 : 0 : pPage->GetPaperBin(),
558 : 0 : pPage->IsBackgroundFullSize(),
559 : : rNewSize,
560 : : nLeft, nRight,
561 : : nUpper, nLower,
562 : : bScaleAll,
563 : : eOrientation,
564 : : nPaperBin,
565 [ # # ][ # # ]: 0 : bBackgroundFullSize);
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
[ # # ]
566 [ # # ]: 0 : pUndoGroup->AddAction(pUndo);
567 : :
568 [ # # ][ # # ]: 0 : if (rNewSize.Width() > 0 ||
[ # # ][ # # ]
[ # # ][ # # ]
569 : : nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0)
570 : : {
571 [ # # ]: 0 : Rectangle aNewBorderRect(nLeft, nUpper, nRight, nLower);
572 [ # # ]: 0 : pPage->ScaleObjects(rNewSize, aNewBorderRect, bScaleAll);
573 : :
574 [ # # ]: 0 : if (rNewSize.Width() > 0)
575 [ # # ]: 0 : pPage->SetSize(rNewSize);
576 : : }
577 : :
578 [ # # ][ # # ]: 0 : if( nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0 )
[ # # ][ # # ]
579 : : {
580 [ # # ]: 0 : pPage->SetBorder(nLeft, nUpper, nRight, nLower);
581 : : }
582 : :
583 [ # # ]: 0 : pPage->SetOrientation(eOrientation);
584 : 0 : pPage->SetPaperBin( nPaperBin );
585 [ # # ]: 0 : pPage->SetBackgroundFullSize( bBackgroundFullSize );
586 : :
587 [ # # ]: 0 : if ( ePageKind == PK_STANDARD )
588 [ # # ][ # # ]: 0 : GetDoc()->GetMasterSdPage(i, PK_NOTES)->CreateTitleAndLayout();
[ # # ]
589 : :
590 [ # # ]: 0 : pPage->CreateTitleAndLayout();
591 : : }
592 : :
593 [ # # ][ # # ]: 0 : nPageCnt = GetDoc()->GetSdPageCount(ePageKind);
594 : :
595 [ # # ]: 0 : for (i = 0; i < nPageCnt; i++)
596 : : {
597 : : /**********************************************************************
598 : : * Danach alle Pages bearbeiten
599 : : **********************************************************************/
600 [ # # ][ # # ]: 0 : pPage = GetDoc()->GetSdPage(i, ePageKind);
601 : :
602 : : SdUndoAction* pUndo = new SdPageFormatUndoAction(GetDoc(), pPage,
603 : 0 : pPage->GetSize(),
604 : 0 : pPage->GetLftBorder(), pPage->GetRgtBorder(),
605 : 0 : pPage->GetUppBorder(), pPage->GetLwrBorder(),
606 : 0 : pPage->IsScaleObjects(),
607 : 0 : pPage->GetOrientation(),
608 : 0 : pPage->GetPaperBin(),
609 : 0 : pPage->IsBackgroundFullSize(),
610 : : rNewSize,
611 : : nLeft, nRight,
612 : : nUpper, nLower,
613 : : bScaleAll,
614 : : eOrientation,
615 : : nPaperBin,
616 [ # # ][ # # ]: 0 : bBackgroundFullSize);
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
[ # # ]
617 [ # # ]: 0 : pUndoGroup->AddAction(pUndo);
618 : :
619 [ # # ][ # # ]: 0 : if (rNewSize.Width() > 0 ||
[ # # ][ # # ]
[ # # ][ # # ]
620 : : nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0)
621 : : {
622 [ # # ]: 0 : Rectangle aNewBorderRect(nLeft, nUpper, nRight, nLower);
623 [ # # ]: 0 : pPage->ScaleObjects(rNewSize, aNewBorderRect, bScaleAll);
624 : :
625 [ # # ]: 0 : if (rNewSize.Width() > 0)
626 [ # # ]: 0 : pPage->SetSize(rNewSize);
627 : : }
628 : :
629 [ # # ][ # # ]: 0 : if( nLeft >= 0 || nRight >= 0 || nUpper >= 0 || nLower >= 0 )
[ # # ][ # # ]
630 : : {
631 [ # # ]: 0 : pPage->SetBorder(nLeft, nUpper, nRight, nLower);
632 : : }
633 : :
634 [ # # ]: 0 : pPage->SetOrientation(eOrientation);
635 : 0 : pPage->SetPaperBin( nPaperBin );
636 [ # # ]: 0 : pPage->SetBackgroundFullSize( bBackgroundFullSize );
637 : :
638 [ # # ]: 0 : if ( ePageKind == PK_STANDARD )
639 : : {
640 [ # # ][ # # ]: 0 : SdPage* pNotesPage = GetDoc()->GetSdPage(i, PK_NOTES);
641 [ # # ]: 0 : pNotesPage->SetAutoLayout( pNotesPage->GetAutoLayout() );
642 : : }
643 : :
644 [ # # ]: 0 : pPage->SetAutoLayout( pPage->GetAutoLayout() );
645 : : }
646 : :
647 : : // Handoutseite an neues Format der Standardseiten anpassen
648 [ # # ][ # # ]: 0 : if( (ePageKind == PK_STANDARD) || (ePageKind == PK_HANDOUT) )
649 [ # # ][ # # ]: 0 : GetDoc()->GetSdPage(0, PK_HANDOUT)->CreateTitleAndLayout(sal_True);
[ # # ]
650 : :
651 : : // Undo Gruppe dem Undo Manager uebergeben
652 [ # # ]: 0 : pViewShell->GetViewFrame()->GetObjectShell()
653 [ # # ][ # # ]: 0 : ->GetUndoManager()->AddUndoAction(pUndoGroup);
654 : :
655 [ # # ]: 0 : long nWidth = pPage->GetSize().Width();
656 [ # # ]: 0 : long nHeight = pPage->GetSize().Height();
657 : :
658 : 0 : Point aPageOrg = Point(nWidth, nHeight / 2);
659 : 0 : Size aViewSize = Size(nWidth * 3, nHeight * 2);
660 : :
661 [ # # ]: 0 : InitWindows(aPageOrg, aViewSize, Point(-1, -1), sal_True);
662 : :
663 : 0 : Point aVisAreaPos;
664 : :
665 [ # # ][ # # ]: 0 : if ( GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
666 : : {
667 [ # # ][ # # ]: 0 : aVisAreaPos = GetDocSh()->GetVisArea(ASPECT_CONTENT).TopLeft();
668 : : }
669 : :
670 : 0 : ::sd::View* pView = GetView();
671 [ # # ]: 0 : if (pView)
672 : : {
673 [ # # ]: 0 : pView->SetWorkArea(Rectangle(Point() - aVisAreaPos - aPageOrg, aViewSize));
674 : : }
675 : :
676 [ # # ]: 0 : UpdateScrollBars();
677 : :
678 [ # # ][ # # ]: 0 : Point aNewOrigin(pPage->GetLftBorder(), pPage->GetUppBorder());
679 : :
680 [ # # ]: 0 : if (pView)
681 : : {
682 [ # # ]: 0 : pView->GetSdrPageView()->SetPageOrigin(aNewOrigin);
683 : : }
684 : :
685 [ # # ]: 0 : pViewShell->GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET);
686 : :
687 : : // auf (neue) Seitengroesse zoomen
688 : : pViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE,
689 [ # # ]: 0 : SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
690 : :
691 [ # # ][ # # ]: 0 : Broadcast (ViewShellHint(ViewShellHint::HINT_PAGE_RESIZE_END));
[ # # ][ # # ]
692 : 0 : }
693 : :
694 : : /*************************************************************************
695 : : |*
696 : : |* Zoom-Faktor fuer InPlace einstellen
697 : : |*
698 : : \************************************************************************/
699 : :
700 : 0 : void ViewShell::SetZoomFactor(const Fraction& rZoomX, const Fraction&)
701 : : {
702 : 0 : long nZoom = (long)((double) rZoomX * 100);
703 : 0 : SetZoom(nZoom);
704 : 0 : }
705 : :
706 : :
707 : : /*************************************************************************
708 : : |*
709 : : |* Aktives Fenster setzen
710 : : |*
711 : : \************************************************************************/
712 : :
713 : 1052 : void ViewShell::SetActiveWindow (::sd::Window* pWin)
714 : : {
715 : 1052 : SfxViewShell* pViewShell = GetViewShell();
716 : : OSL_ASSERT (pViewShell!=NULL);
717 : :
718 [ + - ]: 1052 : if (pViewShell->GetWindow() != pWin)
719 : : {
720 : : // #i31551# was wrong, it may have been a problem with the repaint at that time.
721 : : // For transparent form controls, it is necessary to have that flag set, all apps
722 : : // do set it. Enabling again.
723 [ + - ]: 1052 : if (pWin)
724 : : {
725 : 1052 : pWin->EnableChildTransparentMode();
726 : : }
727 : : }
728 : :
729 [ + + ]: 1052 : if (mpActiveWindow != pWin)
730 : 286 : mpActiveWindow = pWin;
731 : :
732 : : // The rest of this function is not guarded anymore against calling this
733 : : // method with an already active window because the functions may still
734 : : // point to the old window when the new one has already been assigned to
735 : : // pWindow elsewhere.
736 : 1052 : ::sd::View* pView = GetView();
737 [ + + ]: 1052 : if (pView)
738 : : {
739 : 766 : pView->SetActualWin(pWin);
740 : : }
741 [ + + ]: 1052 : if(HasCurrentFunction())
742 : : {
743 : 766 : GetCurrentFunction()->SetWindow(pWin);
744 : : }
745 : 1052 : }
746 : :
747 : :
748 : :
749 : : /*************************************************************************
750 : : |*
751 : : |* RequestHelp event
752 : : |*
753 : : \************************************************************************/
754 : :
755 : 0 : sal_Bool ViewShell::RequestHelp(const HelpEvent& rHEvt, ::sd::Window*)
756 : : {
757 : 0 : sal_Bool bReturn = sal_False;
758 : :
759 [ # # ]: 0 : if (rHEvt.GetMode())
760 : : {
761 [ # # ]: 0 : if( GetView() )
762 : 0 : bReturn = GetView()->getSmartTags().RequestHelp(rHEvt);
763 : :
764 [ # # ][ # # ]: 0 : if(!bReturn && HasCurrentFunction())
[ # # ]
765 : : {
766 [ # # ]: 0 : bReturn = GetCurrentFunction()->RequestHelp(rHEvt);
767 : : }
768 : : }
769 : :
770 : 0 : return(bReturn);
771 : : }
772 : :
773 : :
774 : :
775 : :
776 : 572 : FrameView* ViewShell::GetFrameView (void)
777 : : {
778 : 572 : return mpFrameView;
779 : : }
780 : :
781 : :
782 : :
783 : :
784 : 0 : void ViewShell::SetFrameView (FrameView* pNewFrameView)
785 : : {
786 : 0 : mpFrameView = pNewFrameView;
787 : 0 : ReadFrameViewData (mpFrameView);
788 : 0 : }
789 : :
790 : :
791 : :
792 : :
793 : : /*************************************************************************
794 : : |*
795 : : |* Read FrameViews data and set actual views data
796 : : |*
797 : : \************************************************************************/
798 : :
799 : 26 : void ViewShell::ReadFrameViewData(FrameView*)
800 : : {
801 : 26 : }
802 : :
803 : :
804 : :
805 : : /*************************************************************************
806 : : |*
807 : : |* Write actual views data to FrameView
808 : : |*
809 : : \************************************************************************/
810 : :
811 : 78 : void ViewShell::WriteFrameViewData()
812 : : {
813 : 78 : }
814 : :
815 : : /*************************************************************************
816 : : |*
817 : : |* OLE-Object aktivieren
818 : : |*
819 : : \************************************************************************/
820 : :
821 : 0 : sal_Bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
822 : : {
823 : 0 : ErrCode aErrCode = 0;
824 : :
825 [ # # ][ # # ]: 0 : SfxErrorContext aEC(ERRCTX_SO_DOVERB, GetActiveWindow(), RID_SO_ERRCTX);
826 : 0 : sal_Bool bAbort = sal_False;
827 [ # # ][ # # ]: 0 : GetDocSh()->SetWaitCursor( sal_True );
828 [ # # ]: 0 : SfxViewShell* pViewShell = GetViewShell();
829 : : OSL_ASSERT (pViewShell!=NULL);
830 : 0 : bool bChangeDefaultsForChart = false;
831 : 0 : rtl::OUString aName;
832 : :
833 [ # # ]: 0 : uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef();
834 [ # # ]: 0 : if ( !xObj.is() )
835 : : {
836 : : /**********************************************************
837 : : * Leeres OLE-Objekt mit OLE-Objekt versehen
838 : : **********************************************************/
839 [ # # ]: 0 : aName = pObj->GetProgName();
840 : 0 : ::rtl::OUString aObjName;
841 [ # # ]: 0 : SvGlobalName aClass;
842 : :
843 [ # # ][ # # ]: 0 : if( aName == "StarChart" || aName == "StarOrg" )
[ # # ]
844 : : {
845 [ # # ][ # # ]: 0 : if( SvtModuleOptions().IsChart() )
[ # # ][ # # ]
846 : : {
847 [ # # ][ # # ]: 0 : aClass = SvGlobalName( SO3_SCH_CLASSID );
[ # # ]
848 : 0 : bChangeDefaultsForChart = true;
849 : : }
850 : : }
851 [ # # ]: 0 : else if( aName == "StarCalc" )
852 : : {
853 [ # # ][ # # ]: 0 : if( SvtModuleOptions().IsCalc() )
[ # # ][ # # ]
854 [ # # ][ # # ]: 0 : aClass = SvGlobalName( SO3_SC_CLASSID );
[ # # ]
855 : : }
856 [ # # ]: 0 : else if( aName == "StarMath" )
857 : : {
858 [ # # ][ # # ]: 0 : if( SvtModuleOptions().IsMath() )
[ # # ][ # # ]
859 [ # # ][ # # ]: 0 : aClass = SvGlobalName( SO3_SM_CLASSID );
[ # # ]
860 : : }
861 : :
862 [ # # ][ # # ]: 0 : if ( aClass != SvGlobalName() )
[ # # ][ # # ]
863 [ # # ][ # # ]: 0 : xObj = GetDocSh()->GetEmbeddedObjectContainer().CreateEmbeddedObject( aClass.GetByteSequence(), aObjName );
[ # # ][ # # ]
[ # # ][ # # ]
864 : :
865 [ # # ]: 0 : if( !xObj.is() )
866 : : {
867 : 0 : aName = "";
868 : :
869 : : // Dialog "OLE-Objekt einfuegen" aufrufen
870 [ # # ][ # # ]: 0 : GetDocSh()->SetWaitCursor( sal_False );
871 : : pViewShell->GetViewFrame()->GetDispatcher()->Execute(
872 : : SID_INSERT_OBJECT,
873 [ # # ]: 0 : SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
874 [ # # ][ # # ]: 0 : xObj = pObj->GetObjRef();
875 [ # # ][ # # ]: 0 : GetDocSh()->SetWaitCursor( sal_True );
876 : :
877 [ # # ]: 0 : if (!xObj.is())
878 : : {
879 : 0 : bAbort = sal_True;
880 : : }
881 : : }
882 : :
883 [ # # ]: 0 : if ( xObj.is() )
884 : : {
885 : : /******************************************************
886 : : * OLE-Objekt ist nicht mehr leer
887 : : ******************************************************/
888 [ # # ]: 0 : pObj->SetEmptyPresObj(sal_False);
889 [ # # ]: 0 : pObj->SetOutlinerParaObject(NULL);
890 [ # # ]: 0 : pObj->SetGraphic(NULL);
891 : :
892 : : /******************************************************
893 : : * Das leere OLE-Objekt bekommt ein neues IPObj
894 : : ******************************************************/
895 [ # # ]: 0 : if (!aName.isEmpty())
896 : : {
897 [ # # ]: 0 : pObj->SetObjRef(xObj);
898 [ # # ]: 0 : pObj->SetName(aObjName);
899 [ # # ][ # # ]: 0 : pObj->SetPersistName(aObjName);
[ # # ]
900 : : }
901 : : else
902 : : {
903 : : // Das Einfuegen hat der Dialog schon gemacht
904 [ # # ]: 0 : pObj->SetObjRef(xObj);
905 : : }
906 : :
907 [ # # ]: 0 : Rectangle aRect = pObj->GetLogicRect();
908 : :
909 [ # # ][ # # ]: 0 : if ( pObj->GetAspect() != embed::Aspects::MSOLE_ICON )
910 : : {
911 : 0 : awt::Size aSz;
912 [ # # ]: 0 : aSz.Width = aRect.GetWidth();
913 [ # # ]: 0 : aSz.Height = aRect.GetHeight();
914 [ # # ][ # # ]: 0 : xObj->setVisualAreaSize( pObj->GetAspect(), aSz );
[ # # ]
915 : : }
916 : :
917 [ # # ][ # # ]: 0 : GetViewShellBase().SetVerbs( xObj->getSupportedVerbs() );
[ # # ][ # # ]
[ # # ]
918 : :
919 : 0 : nVerb = SVVERB_SHOW;
920 : : }
921 : : else
922 : : {
923 : 0 : aErrCode = ERRCODE_SFX_OLEGENERAL;
924 [ # # ]: 0 : }
925 : : }
926 : :
927 [ # # ]: 0 : if( aErrCode == 0 )
928 : : {
929 : 0 : ::sd::View* pView = GetView();
930 : :
931 [ # # ][ # # ]: 0 : if (pView->IsTextEdit())
932 : : {
933 [ # # ]: 0 : pView->SdrEndTextEdit();
934 : : }
935 : :
936 : : SfxInPlaceClient* pSdClient =
937 : : static_cast<Client*>(pViewShell->FindIPClient(
938 [ # # ][ # # ]: 0 : pObj->GetObjRef(), GetActiveWindow()));
[ # # ]
939 : :
940 [ # # ]: 0 : if ( !pSdClient )
941 : : {
942 [ # # ][ # # ]: 0 : pSdClient = new Client(pObj, this, GetActiveWindow());
[ # # ]
943 : : }
944 : :
945 [ # # ]: 0 : Rectangle aRect = pObj->GetLogicRect();
946 [ # # ]: 0 : Size aDrawSize = aRect.GetSize();
947 : :
948 [ # # ][ # # ]: 0 : MapMode aMapMode( GetDoc()->GetScaleUnit() );
949 [ # # ]: 0 : Size aObjAreaSize = pObj->GetOrigObjSize( &aMapMode );
950 [ # # ][ # # ]: 0 : if( pObj->IsChart() ) //charts never should be stretched see #i84323# for example
951 : 0 : aObjAreaSize = aDrawSize;
952 : :
953 [ # # ]: 0 : Fraction aScaleWidth (aDrawSize.Width(), aObjAreaSize.Width() );
954 [ # # ]: 0 : Fraction aScaleHeight(aDrawSize.Height(), aObjAreaSize.Height() );
955 [ # # ]: 0 : aScaleWidth.ReduceInaccurate(10); // kompatibel zum SdrOle2Obj
956 [ # # ]: 0 : aScaleHeight.ReduceInaccurate(10);
957 [ # # ]: 0 : pSdClient->SetSizeScale(aScaleWidth, aScaleHeight);
958 : :
959 : : // sichtbarer Ausschnitt wird nur inplace veraendert!
960 [ # # ]: 0 : aRect.SetSize(aObjAreaSize);
961 : : // the object area size must be set after scaling, since it triggers the resizing
962 [ # # ]: 0 : pSdClient->SetObjArea(aRect);
963 : :
964 [ # # ][ # # ]: 0 : if( bChangeDefaultsForChart && xObj.is())
[ # # ]
965 : : {
966 [ # # ]: 0 : AdaptDefaultsForChart( xObj );
967 : : }
968 : :
969 [ # # ]: 0 : pSdClient->DoVerb(nVerb); // ErrCode wird ggf. vom Sfx ausgegeben
970 : 0 : pViewShell->GetViewFrame()->GetBindings().Invalidate(
971 [ # # ][ # # ]: 0 : SID_NAVIGATOR_STATE, sal_True, sal_False);
972 : : }
973 : :
974 [ # # ][ # # ]: 0 : GetDocSh()->SetWaitCursor( sal_False );
975 : :
976 [ # # ][ # # ]: 0 : if (aErrCode != 0 && !bAbort)
977 : : {
978 [ # # ][ # # ]: 0 : ErrorHandler::HandleError(* new StringErrorInfo(aErrCode, String() ) );
[ # # ][ # # ]
[ # # ][ # # ]
979 : : }
980 : :
981 [ # # ]: 0 : return aErrCode == 0;
982 : : }
983 : :
984 : : /*************************************************************************
985 : : |*
986 : : |* umschliessendes Rechteck aller (Split-)Fenster zurueckgeben.
987 : : |*
988 : : \************************************************************************/
989 : :
990 : 0 : const Rectangle& ViewShell::GetAllWindowRect()
991 : : {
992 : : maAllWindowRectangle.SetPos(
993 [ # # ]: 0 : mpContentWindow->OutputToScreenPixel(Point(0,0)));
994 : 0 : return maAllWindowRectangle;
995 : : }
996 : :
997 : : /*************************************************************************
998 : : |*
999 : : |* Read user data
1000 : : |*
1001 : : \************************************************************************/
1002 : 0 : void ViewShell::ReadUserData(const String&)
1003 : : {
1004 : : // Auf an FrameView gemerkte VisArea zoomen
1005 : : GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_VISAREA,
1006 : 0 : SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
1007 : 0 : }
1008 : :
1009 : : /*************************************************************************
1010 : : |*
1011 : : |* Write user data
1012 : : |*
1013 : : \************************************************************************/
1014 : :
1015 : 0 : void ViewShell::WriteUserData(String&)
1016 : : {
1017 : : // Das Schreiben unserer Daten erfolgt stets in WriteFrameViewData()
1018 : 0 : WriteFrameViewData();
1019 : 0 : }
1020 : :
1021 : :
1022 : : /*************************************************************************
1023 : : |*
1024 : : |* Lineale ein- / ausschalten
1025 : : |*
1026 : : \************************************************************************/
1027 : :
1028 : 104 : void ViewShell::SetRuler(sal_Bool bRuler)
1029 : : {
1030 [ + - ][ + - ]: 104 : mbHasRulers = ( bRuler && !GetDocSh()->IsPreview() ); // no rulers on preview mode
1031 : :
1032 [ - + ]: 104 : if (mpHorizontalRuler.get() != NULL)
1033 : : {
1034 [ # # ]: 0 : if (mbHasRulers)
1035 : : {
1036 : 0 : mpHorizontalRuler->Show();
1037 : : }
1038 : : else
1039 : : {
1040 : 0 : mpHorizontalRuler->Hide();
1041 : : }
1042 : : }
1043 : :
1044 [ - + ]: 104 : if (mpVerticalRuler.get() != NULL)
1045 : : {
1046 [ # # ]: 0 : if (mbHasRulers)
1047 : : {
1048 : 0 : mpVerticalRuler->Show();
1049 : : }
1050 : : else
1051 : : {
1052 : 0 : mpVerticalRuler->Hide();
1053 : : }
1054 : : }
1055 : :
1056 : : OSL_ASSERT(GetViewShell()!=NULL);
1057 [ - + ]: 104 : if (IsMainViewShell())
1058 : 0 : GetViewShell()->InvalidateBorder();
1059 : 104 : }
1060 : :
1061 : : /*************************************************************************
1062 : : |*
1063 : : |* AcceptDrop
1064 : : |*
1065 : : \************************************************************************/
1066 : :
1067 : 0 : sal_Int8 ViewShell::AcceptDrop (
1068 : : const AcceptDropEvent& rEvt,
1069 : : DropTargetHelper& rTargetHelper,
1070 : : ::sd::Window* pTargetWindow,
1071 : : sal_uInt16 nPage,
1072 : : sal_uInt16 nLayer)
1073 : : {
1074 : 0 : ::sd::View* pView = GetView();
1075 [ # # ]: 0 : return( pView ? pView->AcceptDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer ) : DND_ACTION_NONE );
1076 : : }
1077 : :
1078 : : /*************************************************************************
1079 : : |*
1080 : : |* ExecuteDrop
1081 : : |*
1082 : : \************************************************************************/
1083 : :
1084 : 0 : sal_Int8 ViewShell::ExecuteDrop (
1085 : : const ExecuteDropEvent& rEvt,
1086 : : DropTargetHelper& rTargetHelper,
1087 : : ::sd::Window* pTargetWindow,
1088 : : sal_uInt16 nPage,
1089 : : sal_uInt16 nLayer)
1090 : : {
1091 : 0 : ::sd::View* pView = GetView();
1092 [ # # ]: 0 : return( pView ? pView->ExecuteDrop( rEvt, rTargetHelper, pTargetWindow, nPage, nLayer ) : DND_ACTION_NONE );
1093 : : }
1094 : :
1095 : : #ifdef _MSC_VER
1096 : : #pragma optimize ( "", on )
1097 : : #endif
1098 : :
1099 : 134 : void ViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence <
1100 : : ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse)
1101 : : {
1102 : 134 : const sal_Int32 nIndex = rSequence.getLength();
1103 [ + - ]: 134 : rSequence.realloc( nIndex + 1 );
1104 : :
1105 : : OSL_ASSERT (GetViewShell()!=NULL);
1106 : : // Get the view id from the view shell in the center pane. This will
1107 : : // usually be the called view shell, but to be on the safe side we call
1108 : : // the main view shell explicitly.
1109 : 134 : sal_uInt16 nViewID (IMPRESS_FACTORY_ID);
1110 [ + - ][ + - ]: 134 : if (GetViewShellBase().GetMainViewShell().get() != NULL)
[ + - ][ + - ]
1111 [ + - ][ + - ]: 134 : nViewID = GetViewShellBase().GetMainViewShell()->mpImpl->GetViewId();
[ + - ][ + - ]
1112 [ + - ]: 134 : rSequence[nIndex].Name = rtl::OUString( sUNO_View_ViewId );
1113 : 134 : rtl::OUStringBuffer sBuffer( "view" );
1114 [ + - ]: 134 : sBuffer.append( static_cast<sal_Int32>(nViewID));
1115 [ + - ][ + - ]: 134 : rSequence[nIndex].Value <<= sBuffer.makeStringAndClear();
[ + - ]
1116 : :
1117 [ + - ]: 134 : mpFrameView->WriteUserDataSequence( rSequence, bBrowse );
1118 : 134 : }
1119 : :
1120 : :
1121 : 130 : void ViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
1122 : : {
1123 : 130 : mpFrameView->ReadUserDataSequence( rSequence, bBrowse );
1124 : 130 : }
1125 : :
1126 : 903 : void ViewShell::VisAreaChanged(const Rectangle& rRect)
1127 : : {
1128 : : OSL_ASSERT (GetViewShell()!=NULL);
1129 : 903 : GetViewShell()->VisAreaChanged(rRect);
1130 : 903 : }
1131 : :
1132 : 0 : void ViewShell::SetWinViewPos(const Point& rWinPos, bool bUpdate)
1133 : : {
1134 [ # # ]: 0 : if (mpContentWindow.get() != NULL)
1135 : : {
1136 [ # # ]: 0 : mpContentWindow->SetWinViewPos(rWinPos);
1137 : :
1138 [ # # ]: 0 : if ( bUpdate )
1139 : : {
1140 [ # # ]: 0 : mpContentWindow->UpdateMapOrigin();
1141 [ # # ]: 0 : mpContentWindow->Invalidate();
1142 : : }
1143 : : }
1144 : :
1145 [ # # ]: 0 : if (mbHasRulers)
1146 : : {
1147 [ # # ]: 0 : UpdateHRuler();
1148 [ # # ]: 0 : UpdateVRuler();
1149 : : }
1150 : :
1151 [ # # ]: 0 : UpdateScrollBars();
1152 : :
1153 [ # # ]: 0 : Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
1154 [ # # ][ # # ]: 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
[ # # ]
1155 [ # # ]: 0 : VisAreaChanged(aVisAreaWin);
1156 : :
1157 : 0 : ::sd::View* pView = GetView();
1158 [ # # ]: 0 : if (pView)
1159 : : {
1160 [ # # ][ # # ]: 0 : pView->VisAreaChanged(GetActiveWindow());
1161 : : }
1162 : 0 : }
1163 : :
1164 : 0 : Point ViewShell::GetWinViewPos() const
1165 : : {
1166 : 0 : return mpContentWindow->GetWinViewPos();
1167 : : }
1168 : :
1169 : 0 : Point ViewShell::GetViewOrigin() const
1170 : : {
1171 : 0 : return mpContentWindow->GetViewOrigin();
1172 : : }
1173 : :
1174 : 0 : void ViewShell::AdaptDefaultsForChart(
1175 : : const uno::Reference < embed::XEmbeddedObject > & xEmbObj )
1176 : : {
1177 [ # # ]: 0 : if( xEmbObj.is())
1178 : : {
1179 [ # # ][ # # ]: 0 : uno::Reference< chart2::XChartDocument > xChartDoc( xEmbObj->getComponent(), uno::UNO_QUERY );
[ # # ]
1180 : : OSL_ENSURE( xChartDoc.is(), "Trying to set chart property to non-chart OLE" );
1181 [ # # ]: 0 : if( !xChartDoc.is())
1182 : 0 : return;
1183 : :
1184 : : try
1185 : : {
1186 : : // set background to transparent (none)
1187 [ # # ][ # # ]: 0 : uno::Reference< beans::XPropertySet > xPageProp( xChartDoc->getPageBackground());
1188 [ # # ]: 0 : if( xPageProp.is())
1189 [ # # ][ # # ]: 0 : xPageProp->setPropertyValue( "FillStyle" , uno::makeAny( drawing::FillStyle_NONE ));
[ # # ]
1190 : : // set no border
1191 [ # # ]: 0 : if( xPageProp.is())
1192 [ # # ][ # # ]: 0 : xPageProp->setPropertyValue( "LineStyle" , uno::makeAny( drawing::LineStyle_NONE ));
[ # # ][ # # ]
1193 : : }
1194 [ # # ]: 0 : catch( const uno::Exception & )
1195 : : {
1196 : : OSL_FAIL( "Exception caught in AdaptDefaultsForChart" );
1197 [ # # ]: 0 : }
1198 : : }
1199 : : }
1200 : :
1201 [ + - ][ + - ]: 75 : } // end of namespace sd
1202 : :
1203 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|