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 "SdUnoDrawView.hxx"
31 : :
32 : : #include "DrawController.hxx"
33 : : #include "DrawDocShell.hxx"
34 : : #include "DrawViewShell.hxx"
35 : : #include "drawdoc.hxx"
36 : : #include "unolayer.hxx"
37 : : #include "unomodel.hxx"
38 : : #include "unopage.hxx"
39 : : #include "Window.hxx"
40 : : #include "pres.hxx"
41 : :
42 : : #include <cppuhelper/proptypehlp.hxx>
43 : : #include <comphelper/serviceinfohelper.hxx>
44 : : #include <sfx2/dispatch.hxx>
45 : : #include <sfx2/viewfrm.hxx>
46 : : #include <svx/svdpagv.hxx>
47 : : #include <svx/unoshape.hxx>
48 : : #include <svx/unoshcol.hxx>
49 : : #include <sfx2/zoomitem.hxx>
50 : : #include <com/sun/star/drawing/DrawViewMode.hpp>
51 : : #include <com/sun/star/drawing/XLayerManager.hpp>
52 : : #include <com/sun/star/view/DocumentZoomType.hpp>
53 : :
54 : : #include <vector>
55 : :
56 : : using rtl::OUString;
57 : :
58 : : using namespace ::com::sun::star;
59 : : using namespace ::com::sun::star::uno;
60 : : using namespace ::com::sun::star::drawing;
61 : :
62 : :
63 : : namespace sd {
64 : :
65 : 130 : SdUnoDrawView::SdUnoDrawView(
66 : : DrawController& rController,
67 : : DrawViewShell& rViewShell,
68 : : View& rView) throw()
69 : : : DrawSubControllerInterfaceBase(m_aMutex),
70 : : mrController(rController),
71 : : mrDrawViewShell(rViewShell),
72 [ + - ]: 130 : mrView(rView)
73 : : {
74 : 130 : }
75 : :
76 : :
77 : :
78 : :
79 [ + - ]: 130 : SdUnoDrawView::~SdUnoDrawView() throw()
80 : : {
81 [ - + ]: 260 : }
82 : :
83 : :
84 : :
85 : :
86 : 0 : sal_Bool SdUnoDrawView::getMasterPageMode(void) const throw()
87 : : {
88 : 0 : return (mrDrawViewShell.GetEditMode() == EM_MASTERPAGE);
89 : : }
90 : :
91 : :
92 : :
93 : :
94 : 10 : void SdUnoDrawView::setMasterPageMode (sal_Bool bMasterPageMode) throw()
95 : : {
96 [ - + ]: 10 : if ((mrDrawViewShell.GetEditMode() == EM_MASTERPAGE) != bMasterPageMode)
97 : : {
98 : : mrDrawViewShell.ChangeEditMode (
99 : : bMasterPageMode ? EM_MASTERPAGE : EM_PAGE,
100 [ # # ]: 0 : mrDrawViewShell.IsLayerModeActive());
101 : : }
102 : 10 : }
103 : :
104 : :
105 : :
106 : :
107 : 0 : sal_Bool SdUnoDrawView::getLayerMode(void) const throw()
108 : : {
109 : 0 : return mrDrawViewShell.IsLayerModeActive();
110 : : }
111 : :
112 : :
113 : :
114 : :
115 : 0 : void SdUnoDrawView::setLayerMode (sal_Bool bLayerMode) throw()
116 : : {
117 [ # # ]: 0 : if (mrDrawViewShell.IsLayerModeActive() != (bLayerMode==sal_True))
118 : : {
119 : : mrDrawViewShell.ChangeEditMode (
120 : : mrDrawViewShell.GetEditMode(),
121 : 0 : bLayerMode);
122 : : }
123 : 0 : }
124 : :
125 : :
126 : :
127 : :
128 : 0 : Reference<drawing::XLayer> SdUnoDrawView::getActiveLayer (void) throw ()
129 : : {
130 : 0 : Reference<drawing::XLayer> xCurrentLayer;
131 : :
132 : : do
133 : : {
134 : : // Retrieve the layer manager from the model.
135 : 0 : SdXImpressDocument* pModel = GetModel();
136 [ # # ]: 0 : if (pModel == NULL)
137 : : break;
138 : :
139 : 0 : SdDrawDocument* pSdModel = pModel->GetDoc();
140 [ # # ]: 0 : if (pSdModel == NULL)
141 : : break;
142 : :
143 : : // From the model get the current SdrLayer object via the layer admin.
144 : 0 : SdrLayerAdmin& rLayerAdmin = pSdModel->GetLayerAdmin ();
145 [ # # ]: 0 : SdrLayer* pLayer = rLayerAdmin.GetLayer (mrView.GetActiveLayer(), sal_True);
146 [ # # ]: 0 : if (pLayer == NULL)
147 : : break;
148 : :
149 : : // Get the corresponding XLayer object from the implementation
150 : : // object of the layer manager.
151 [ # # ][ # # ]: 0 : Reference<drawing::XLayerManager> xManager (pModel->getLayerManager(), uno::UNO_QUERY);
152 [ # # ]: 0 : SdLayerManager* pManager = SdLayerManager::getImplementation (xManager);
153 [ # # ]: 0 : if (pManager != NULL)
154 [ # # ][ # # ]: 0 : xCurrentLayer = pManager->GetLayer (pLayer);
155 : : }
156 : : while (false);
157 : :
158 : 0 : return xCurrentLayer;
159 : : }
160 : :
161 : :
162 : :
163 : :
164 : 0 : void SdUnoDrawView::setActiveLayer (const Reference<drawing::XLayer>& rxLayer) throw ()
165 : : {
166 : : // Get the SdrLayer object corresponding to the given reference.
167 [ # # ]: 0 : if ( ! rxLayer.is())
168 : 0 : return;
169 : :
170 : 0 : SdLayer* pLayer = SdLayer::getImplementation (rxLayer);
171 [ # # ]: 0 : if (pLayer == NULL)
172 : 0 : return;
173 : :
174 : 0 : SdrLayer* pSdrLayer = pLayer->GetSdrLayer();
175 [ # # ]: 0 : if (pSdrLayer == NULL)
176 : 0 : return;
177 : :
178 : : // Set the new active layer and make the change visible.
179 : 0 : mrView.SetActiveLayer (pSdrLayer->GetName());
180 : 0 : mrDrawViewShell.ResetActualLayer ();
181 : : }
182 : :
183 : :
184 : :
185 : :
186 : : // XSelectionSupplier
187 : :
188 : :
189 : 4 : sal_Bool SAL_CALL SdUnoDrawView::select( const Any& aSelection )
190 : : throw(lang::IllegalArgumentException, RuntimeException)
191 : : {
192 : 4 : bool bOk = true;
193 : :
194 [ + - ]: 4 : ::std::vector<SdrObject*> aObjects;
195 : :
196 : 4 : SdrPage* pSdrPage = NULL;
197 : :
198 : 4 : Reference< drawing::XShape > xShape;
199 [ + - ]: 4 : aSelection >>= xShape;
200 : :
201 [ - + ]: 4 : if(xShape.is())
202 : : {
203 [ # # ]: 0 : SvxShape* pShape = SvxShape::getImplementation( xShape );
204 [ # # ][ # # ]: 0 : if( pShape && (pShape->GetSdrObject() != NULL) )
[ # # ][ # # ]
205 : : {
206 [ # # ]: 0 : SdrObject* pObj = pShape->GetSdrObject();
207 [ # # ]: 0 : pSdrPage = pObj->GetPage();
208 [ # # ]: 0 : aObjects.push_back( pObj );
209 : : }
210 : : else
211 : : {
212 : 0 : bOk = false;
213 : : }
214 : : }
215 : : else
216 : : {
217 : 4 : Reference< drawing::XShapes > xShapes;
218 [ + - ]: 4 : aSelection >>= xShapes;
219 [ + + ]: 4 : if( xShapes.is() )
220 : : {
221 [ + - ][ + - ]: 2 : const sal_uInt32 nCount = xShapes->getCount();
222 [ + + ]: 4 : for( sal_uInt32 i = 0; i < nCount; i++ )
223 : : {
224 [ + - ][ + - ]: 2 : xShapes->getByIndex(i) >>= xShape;
[ + - ]
225 [ + - ]: 2 : if( xShape.is() )
226 : : {
227 [ + - ]: 2 : SvxShape* pShape = SvxShape::getImplementation(xShape);
228 [ + - ][ + - ]: 2 : if( (pShape == NULL) || (pShape->GetSdrObject() == NULL) )
[ - + ][ - + ]
229 : : {
230 : 0 : bOk = false;
231 : : break;
232 : : }
233 : :
234 [ + - ]: 2 : SdrObject* pObj = pShape->GetSdrObject();
235 : :
236 [ + - ]: 2 : if( pSdrPage == NULL )
237 : : {
238 [ + - ]: 2 : pSdrPage = pObj->GetPage();
239 : : }
240 [ # # ][ # # ]: 0 : else if( pSdrPage != pObj->GetPage() )
241 : : {
242 : 0 : bOk = false;
243 : : break;
244 : : }
245 : :
246 [ + - ]: 2 : aObjects.push_back( pObj );
247 : : }
248 : : }
249 : 4 : }
250 : : }
251 : :
252 [ + - ]: 4 : if( bOk )
253 : : {
254 [ + + ]: 4 : if( pSdrPage )
255 : : {
256 : 2 : setMasterPageMode( pSdrPage->IsMasterPage() );
257 [ + - ][ + - ]: 2 : mrDrawViewShell.SwitchPage( (pSdrPage->GetPageNum() - 1) >> 1 );
258 [ + - ]: 2 : mrDrawViewShell.WriteFrameViewData();
259 : : }
260 : :
261 : 4 : SdrPageView *pPV = mrView.GetSdrPageView();
262 : :
263 [ + - ]: 4 : if(pPV)
264 : : {
265 : : // first deselect all
266 [ + - ]: 4 : mrView.UnmarkAllObj( pPV );
267 : :
268 : 4 : ::std::vector<SdrObject*>::iterator aIter( aObjects.begin() );
269 : 4 : const ::std::vector<SdrObject*>::iterator aEnd( aObjects.end() );
270 [ + - ][ + + ]: 6 : while( aIter != aEnd )
271 : : {
272 [ + - ][ + - ]: 2 : SdrObject* pObj = (*aIter++);
273 [ + - ]: 2 : mrView.MarkObj( pObj, pPV );
274 : : }
275 : : }
276 : : else
277 : : {
278 : 0 : bOk = false;
279 : : }
280 : : }
281 : :
282 : 4 : return bOk;
283 : : }
284 : :
285 : : //----------------------------------------------------------------------
286 : :
287 : 35 : Any SAL_CALL SdUnoDrawView::getSelection()
288 : : throw(RuntimeException)
289 : : {
290 : 35 : Any aAny;
291 : :
292 [ - + ][ + - ]: 35 : if( mrView.IsTextEdit() )
293 [ # # ]: 0 : mrView.getTextSelection( aAny );
294 : :
295 : :
296 [ + - ]: 35 : if( !aAny.hasValue() )
297 : : {
298 : 35 : const SdrMarkList& rMarkList = mrView.GetMarkedObjectList();
299 : 35 : sal_uInt32 nCount = rMarkList.GetMarkCount();
300 [ + + ]: 35 : if( nCount )
301 : : {
302 [ + - ]: 4 : Reference< drawing::XShapes > xShapes( SvxShapeCollection_NewInstance(), UNO_QUERY );
303 [ + + ]: 8 : for( sal_uInt32 nNum = 0; nNum < nCount; nNum++)
304 : : {
305 [ + - ]: 4 : SdrMark *pMark = rMarkList.GetMark(nNum);
306 [ - + ]: 4 : if(pMark==NULL)
307 : 0 : continue;
308 : :
309 [ + - ]: 4 : SdrObject *pObj = pMark->GetMarkedSdrObj();
310 [ + - ][ + - ]: 4 : if(pObj==NULL || pObj->GetPage() == NULL)
[ - + ][ - + ]
311 : 0 : continue;
312 : :
313 [ + - ][ + - ]: 4 : Reference< drawing::XDrawPage > xPage( pObj->GetPage()->getUnoPage(), UNO_QUERY);
[ + - ]
314 : :
315 [ - + ]: 4 : if(!xPage.is())
316 : 0 : continue;
317 : :
318 [ + - ]: 4 : SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
319 : :
320 [ - + ]: 4 : if(pDrawPage==NULL)
321 : 0 : continue;
322 : :
323 [ + - ][ + - ]: 4 : Reference< drawing::XShape > xShape( pObj->getUnoShape(), UNO_QUERY );
324 : :
325 [ + - ]: 4 : if(xShape.is())
326 [ + - ][ + - ]: 4 : xShapes->add(xShape);
327 [ + - ]: 4 : }
328 [ + - ]: 4 : aAny <<= xShapes;
329 : : }
330 : : }
331 : :
332 : 35 : return aAny;
333 : : }
334 : :
335 : :
336 : :
337 : :
338 : 0 : void SAL_CALL SdUnoDrawView::addSelectionChangeListener (
339 : : const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
340 : : throw(css::uno::RuntimeException)
341 : : {
342 : : (void)rxListener;
343 : 0 : }
344 : :
345 : :
346 : :
347 : :
348 : 0 : void SAL_CALL SdUnoDrawView::removeSelectionChangeListener (
349 : : const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
350 : : throw(css::uno::RuntimeException)
351 : : {
352 : : (void)rxListener;
353 : 0 : }
354 : :
355 : :
356 : :
357 : :
358 : 0 : void SdUnoDrawView::setFastPropertyValue (
359 : : sal_Int32 nHandle,
360 : : const Any& rValue)
361 : : throw(css::beans::UnknownPropertyException,
362 : : css::beans::PropertyVetoException,
363 : : css::lang::IllegalArgumentException,
364 : : css::lang::WrappedTargetException,
365 : : css::uno::RuntimeException)
366 : : {
367 [ # # # # : 0 : switch( nHandle )
# # # # ]
368 : : {
369 : : case DrawController::PROPERTY_CURRENTPAGE:
370 : : {
371 : 0 : Reference< drawing::XDrawPage > xPage;
372 [ # # ]: 0 : rValue >>= xPage;
373 [ # # ]: 0 : setCurrentPage( xPage );
374 : : }
375 : 0 : break;
376 : :
377 : : case DrawController::PROPERTY_MASTERPAGEMODE:
378 : : {
379 : 0 : sal_Bool bValue = sal_False;
380 : 0 : rValue >>= bValue;
381 : 0 : setMasterPageMode( bValue );
382 : : }
383 : 0 : break;
384 : :
385 : : case DrawController::PROPERTY_LAYERMODE:
386 : : {
387 : 0 : sal_Bool bValue = sal_False;
388 : 0 : rValue >>= bValue;
389 : 0 : setLayerMode( bValue );
390 : : }
391 : :
392 : : case DrawController::PROPERTY_ACTIVE_LAYER:
393 : : {
394 : 0 : Reference<drawing::XLayer> xLayer;
395 [ # # ]: 0 : rValue >>= xLayer;
396 : 0 : setActiveLayer (xLayer);
397 : : }
398 : 0 : break;
399 : : case DrawController::PROPERTY_ZOOMVALUE:
400 : : {
401 : 0 : sal_Int16 nZoom = 0;
402 : 0 : rValue >>= nZoom;
403 [ # # ]: 0 : SetZoom( nZoom );
404 : : }
405 : 0 : break;
406 : : case DrawController::PROPERTY_ZOOMTYPE:
407 : : {
408 : 0 : sal_Int16 nType = 0;
409 : 0 : rValue >>= nType;
410 [ # # ]: 0 : SetZoomType( nType );
411 : : }
412 : 0 : break;
413 : : case DrawController::PROPERTY_VIEWOFFSET:
414 : : {
415 : 0 : awt::Point aOffset;
416 [ # # ]: 0 : rValue >>= aOffset;
417 [ # # ]: 0 : SetViewOffset( aOffset );
418 : : }
419 : 0 : break;
420 : : default:
421 [ # # ]: 0 : throw beans::UnknownPropertyException();
422 : : }
423 : 0 : }
424 : :
425 : :
426 : :
427 : :
428 : 0 : Any SAL_CALL SdUnoDrawView::getFastPropertyValue (
429 : : sal_Int32 nHandle)
430 : : throw(css::beans::UnknownPropertyException,
431 : : css::lang::WrappedTargetException,
432 : : css::uno::RuntimeException)
433 : : {
434 : 0 : Any aValue;
435 [ # # # # : 0 : switch( nHandle )
# # # #
# ]
436 : : {
437 : : case DrawController::PROPERTY_CURRENTPAGE:
438 [ # # ][ # # ]: 0 : aValue <<= (const_cast<SdUnoDrawView*>(this))->getCurrentPage();
439 : 0 : break;
440 : :
441 : : case DrawController::PROPERTY_MASTERPAGEMODE:
442 [ # # ]: 0 : aValue <<= getMasterPageMode();
443 : 0 : break;
444 : :
445 : : case DrawController::PROPERTY_LAYERMODE:
446 [ # # ]: 0 : aValue <<= getLayerMode();
447 : 0 : break;
448 : :
449 : : case DrawController::PROPERTY_ACTIVE_LAYER:
450 [ # # ]: 0 : aValue <<= (const_cast<SdUnoDrawView*>(this))->getActiveLayer();
451 : 0 : break;
452 : :
453 : : case DrawController::PROPERTY_ZOOMVALUE:
454 [ # # ][ # # ]: 0 : aValue <<= GetZoom();
455 : 0 : break;
456 : : case DrawController::PROPERTY_ZOOMTYPE:
457 [ # # ]: 0 : aValue <<= (sal_Int16)com::sun::star::view::DocumentZoomType::BY_VALUE;
458 : 0 : break;
459 : : case DrawController::PROPERTY_VIEWOFFSET:
460 [ # # ][ # # ]: 0 : aValue <<= GetViewOffset();
461 : 0 : break;
462 : :
463 : : case DrawController::PROPERTY_DRAWVIEWMODE:
464 [ # # ]: 0 : aValue = getDrawViewMode();
465 : 0 : break;
466 : :
467 : : default:
468 [ # # ]: 0 : throw beans::UnknownPropertyException();
469 : : }
470 : :
471 : 0 : return aValue;
472 : : }
473 : :
474 : :
475 : :
476 : :
477 : : // XDrawView
478 : :
479 : :
480 : 8 : void SAL_CALL SdUnoDrawView::setCurrentPage (
481 : : const Reference< drawing::XDrawPage >& xPage )
482 : : throw(RuntimeException)
483 : : {
484 : 8 : SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
485 [ + - ]: 8 : SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : NULL;
486 : :
487 [ + - ]: 8 : if(pSdrPage)
488 : : {
489 : : // End editing of text. Otherwise the edited text object would
490 : : // still be visible on the new page.
491 : 8 : mrDrawViewShell.GetView()->SdrEndTextEdit();
492 : :
493 : 8 : setMasterPageMode( pSdrPage->IsMasterPage() );
494 : 8 : mrDrawViewShell.SwitchPage( (pSdrPage->GetPageNum() - 1) >> 1 );
495 : 8 : mrDrawViewShell.WriteFrameViewData();
496 : : }
497 : 8 : }
498 : :
499 : : //----------------------------------------------------------------------
500 : :
501 : 219 : Reference< drawing::XDrawPage > SAL_CALL SdUnoDrawView::getCurrentPage()
502 : : throw(RuntimeException)
503 : : {
504 : 219 : Reference< drawing::XDrawPage > xPage;
505 : :
506 : 219 : SdrPageView *pPV = mrView.GetSdrPageView();
507 [ + - ]: 219 : SdrPage* pPage = pPV ? pPV->GetPage() : NULL;
508 : :
509 [ + - ]: 219 : if(pPage)
510 [ + - ][ + - ]: 219 : xPage = Reference< drawing::XDrawPage >::query( pPage->getUnoPage() );
[ + - ]
511 : :
512 : 219 : return xPage;
513 : : }
514 : :
515 : :
516 : 0 : sal_Int16 SdUnoDrawView::GetZoom(void) const
517 : : {
518 [ # # ]: 0 : if (mrDrawViewShell.GetActiveWindow() )
519 : : {
520 : 0 : return (sal_Int16)mrDrawViewShell.GetActiveWindow()->GetZoom();
521 : : }
522 : : else
523 : : {
524 : 0 : return 0;
525 : : }
526 : : }
527 : :
528 : 0 : void SdUnoDrawView::SetZoom( sal_Int16 nZoom )
529 : : {
530 [ # # ]: 0 : SvxZoomItem aZoomItem( SVX_ZOOM_PERCENT, nZoom );
531 : :
532 [ # # ]: 0 : SfxViewFrame* pViewFrame = mrDrawViewShell.GetViewFrame();
533 [ # # ]: 0 : if( pViewFrame )
534 : : {
535 : 0 : SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
536 [ # # ]: 0 : if( pDispatcher )
537 : : {
538 [ # # ]: 0 : pDispatcher->Execute(SID_ATTR_ZOOM,SFX_CALLMODE_SYNCHRON,&aZoomItem, 0L);
539 : : }
540 [ # # ]: 0 : }
541 : 0 : }
542 : :
543 : :
544 : 0 : void SdUnoDrawView::SetViewOffset(const awt::Point& rWinPos )
545 : : {
546 : 0 : Point aWinPos( rWinPos.X, rWinPos.Y );
547 [ # # ]: 0 : aWinPos += mrDrawViewShell.GetViewOrigin();
548 [ # # ]: 0 : mrDrawViewShell.SetWinViewPos( aWinPos, true );
549 : 0 : }
550 : :
551 : 0 : awt::Point SdUnoDrawView::GetViewOffset() const
552 : : {
553 : 0 : Point aRet;
554 : :
555 [ # # ]: 0 : aRet = mrDrawViewShell.GetWinViewPos();
556 [ # # ]: 0 : aRet -= mrDrawViewShell.GetViewOrigin();
557 : :
558 : 0 : return awt::Point( aRet.X(), aRet.Y() );
559 : : }
560 : :
561 : 0 : void SdUnoDrawView::SetZoomType ( sal_Int16 nType )
562 : : {
563 : 0 : SfxViewFrame* pViewFrame = mrDrawViewShell.GetViewFrame();
564 [ # # ]: 0 : if( pViewFrame )
565 : : {
566 : 0 : SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
567 [ # # ]: 0 : if( pDispatcher )
568 : : {
569 : : SvxZoomType eZoomType;
570 [ # # # # ]: 0 : switch( nType )
571 : : {
572 : : case com::sun::star::view::DocumentZoomType::OPTIMAL:
573 : 0 : eZoomType = SVX_ZOOM_OPTIMAL;
574 : 0 : break;
575 : :
576 : : case com::sun::star::view::DocumentZoomType::PAGE_WIDTH:
577 : : case com::sun::star::view::DocumentZoomType::PAGE_WIDTH_EXACT:
578 : 0 : eZoomType = SVX_ZOOM_PAGEWIDTH;
579 : 0 : break;
580 : :
581 : : case com::sun::star::view::DocumentZoomType::ENTIRE_PAGE:
582 : 0 : eZoomType = SVX_ZOOM_WHOLEPAGE;
583 : 0 : break;
584 : :
585 : : default:
586 : 0 : return;
587 : : }
588 [ # # ]: 0 : SvxZoomItem aZoomItem( eZoomType );
589 [ # # ][ # # ]: 0 : pDispatcher->Execute(SID_ATTR_ZOOM,SFX_CALLMODE_SYNCHRON,&aZoomItem, 0L);
590 : : }
591 : : }
592 : : }
593 : :
594 : :
595 : :
596 : :
597 : 0 : SdXImpressDocument* SdUnoDrawView::GetModel (void) const throw()
598 : : {
599 [ # # ]: 0 : if (mrView.GetDocSh()!=NULL)
600 : : {
601 [ # # ]: 0 : Reference<frame::XModel> xModel (mrView.GetDocSh()->GetModel());
602 [ # # ]: 0 : return SdXImpressDocument::getImplementation(xModel);
603 : : }
604 : : else
605 : 0 : return NULL;
606 : : }
607 : :
608 : 0 : Any SdUnoDrawView::getDrawViewMode() const
609 : : {
610 : 0 : Any aRet;
611 [ # # # # ]: 0 : switch( mrDrawViewShell.GetPageKind() )
612 : : {
613 [ # # ]: 0 : case PK_NOTES: aRet <<= DrawViewMode_NOTES; break;
614 [ # # ]: 0 : case PK_HANDOUT: aRet <<= DrawViewMode_HANDOUT; break;
615 [ # # ]: 0 : case PK_STANDARD: aRet <<= DrawViewMode_DRAW; break;
616 : : }
617 : 0 : return aRet;
618 : : }
619 : :
620 : : // XServiceInfo
621 : 0 : OUString SAL_CALL SdUnoDrawView::getImplementationName( ) throw (RuntimeException)
622 : : {
623 : 0 : return OUString( "com.sun.star.comp.sd.SdUnoDrawView") ;
624 : : }
625 : :
626 : 0 : sal_Bool SAL_CALL SdUnoDrawView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
627 : : {
628 : 0 : return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
629 : : }
630 : :
631 : 0 : Sequence< OUString > SAL_CALL SdUnoDrawView::getSupportedServiceNames( ) throw (RuntimeException)
632 : : {
633 : 0 : OUString aSN("com.sun.star.drawing.DrawingDocumentDrawView");
634 [ # # ]: 0 : uno::Sequence< OUString > aSeq( &aSN, 1 );
635 : 0 : return aSeq;
636 : : }
637 : :
638 : : } // end of namespace sd
639 : :
640 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|