1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <SdUnoOutlineView.hxx>
22 #include <DrawController.hxx>
23 #include <OutlineViewShell.hxx>
25 #include <unopage.hxx>
27 #include <cppuhelper/supportsservice.hxx>
28 #include <svx/unopage.hxx>
29 #include <vcl/svapp.hxx>
31 using namespace ::cppu
;
32 using namespace ::com::sun::star
;
33 using namespace ::com::sun::star::uno
;
37 SdUnoOutlineView::SdUnoOutlineView(
38 OutlineViewShell
& rViewShell
) throw()
39 : DrawSubControllerInterfaceBase(m_aMutex
),
40 mrOutlineViewShell(rViewShell
)
44 SdUnoOutlineView::~SdUnoOutlineView() throw()
48 void SAL_CALL
SdUnoOutlineView::disposing()
52 //----- XSelectionSupplier ----------------------------------------------------
54 sal_Bool SAL_CALL
SdUnoOutlineView::select( const Any
& )
56 // todo: add selections for text ranges
60 Any SAL_CALL
SdUnoOutlineView::getSelection()
66 void SAL_CALL
SdUnoOutlineView::addSelectionChangeListener (
67 const css::uno::Reference
<css::view::XSelectionChangeListener
>&)
70 void SAL_CALL
SdUnoOutlineView::removeSelectionChangeListener (
71 const css::uno::Reference
<css::view::XSelectionChangeListener
>&)
74 //----- XDrawView -------------------------------------------------------------
75 void SAL_CALL
SdUnoOutlineView::setCurrentPage (
76 const Reference
< drawing::XDrawPage
>& xPage
)
78 SvxDrawPage
* pDrawPage
= SvxDrawPage::getImplementation( xPage
);
79 SdrPage
*pSdrPage
= pDrawPage
? pDrawPage
->GetSdrPage() : nullptr;
80 SdPage
*pSdPage
= dynamic_cast<SdPage
*>(pSdrPage
);
82 if (pSdPage
!= nullptr)
83 mrOutlineViewShell
.SetCurrentPage(pSdPage
);
86 Reference
< drawing::XDrawPage
> SAL_CALL
SdUnoOutlineView::getCurrentPage()
88 Reference
<drawing::XDrawPage
> xPage
;
90 SdPage
* pPage
= mrOutlineViewShell
.getCurrentPage();
92 xPage
.set(pPage
->getUnoPage(), UNO_QUERY
);
97 void SdUnoOutlineView::setFastPropertyValue (
103 case DrawController::PROPERTY_CURRENTPAGE
:
105 Reference
< drawing::XDrawPage
> xPage
;
107 setCurrentPage( xPage
);
112 throw beans::UnknownPropertyException( OUString::number(nHandle
), static_cast<cppu::OWeakObject
*>(this));
116 Any SAL_CALL
SdUnoOutlineView::getFastPropertyValue (
123 case DrawController::PROPERTY_CURRENTPAGE
:
125 SdPage
* pPage
= mrOutlineViewShell
.GetActualPage();
126 if (pPage
!= nullptr)
127 aValue
<<= pPage
->getUnoPage();
130 case DrawController::PROPERTY_VIEWOFFSET
:
134 throw beans::UnknownPropertyException( OUString::number(nHandle
), static_cast<cppu::OWeakObject
*>(this));
141 OUString SAL_CALL
SdUnoOutlineView::getImplementationName( )
143 return OUString("com.sun.star.comp.sd.SdUnoOutlineView");
146 sal_Bool SAL_CALL
SdUnoOutlineView::supportsService( const OUString
& ServiceName
)
148 return cppu::supportsService( this, ServiceName
);
151 Sequence
< OUString
> SAL_CALL
SdUnoOutlineView::getSupportedServiceNames( )
153 OUString
aSN( "com.sun.star.presentation.OutlineView" );
154 uno::Sequence
< OUString
> aSeq( &aSN
, 1 );
158 } // end of namespace sd
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */