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>
26 #include <cppuhelper/supportsservice.hxx>
27 #include <svx/unopage.hxx>
29 using namespace ::cppu
;
30 using namespace ::com::sun::star
;
31 using namespace ::com::sun::star::uno
;
35 SdUnoOutlineView::SdUnoOutlineView(
36 OutlineViewShell
& rViewShell
) throw()
37 : DrawSubControllerInterfaceBase(m_aMutex
),
38 mrOutlineViewShell(rViewShell
)
42 SdUnoOutlineView::~SdUnoOutlineView() throw()
46 void SAL_CALL
SdUnoOutlineView::disposing()
50 //----- XSelectionSupplier ----------------------------------------------------
52 sal_Bool SAL_CALL
SdUnoOutlineView::select( const Any
& )
54 // todo: add selections for text ranges
58 Any SAL_CALL
SdUnoOutlineView::getSelection()
64 void SAL_CALL
SdUnoOutlineView::addSelectionChangeListener (
65 const css::uno::Reference
<css::view::XSelectionChangeListener
>&)
68 void SAL_CALL
SdUnoOutlineView::removeSelectionChangeListener (
69 const css::uno::Reference
<css::view::XSelectionChangeListener
>&)
72 //----- XDrawView -------------------------------------------------------------
73 void SAL_CALL
SdUnoOutlineView::setCurrentPage (
74 const Reference
< drawing::XDrawPage
>& xPage
)
76 SvxDrawPage
* pDrawPage
= comphelper::getUnoTunnelImplementation
<SvxDrawPage
>( xPage
);
77 SdrPage
*pSdrPage
= pDrawPage
? pDrawPage
->GetSdrPage() : nullptr;
78 SdPage
*pSdPage
= dynamic_cast<SdPage
*>(pSdrPage
);
80 if (pSdPage
!= nullptr)
81 mrOutlineViewShell
.SetCurrentPage(pSdPage
);
84 Reference
< drawing::XDrawPage
> SAL_CALL
SdUnoOutlineView::getCurrentPage()
86 Reference
<drawing::XDrawPage
> xPage
;
88 SdPage
* pPage
= mrOutlineViewShell
.getCurrentPage();
90 xPage
.set(pPage
->getUnoPage(), UNO_QUERY
);
95 void SdUnoOutlineView::setFastPropertyValue (
101 case DrawController::PROPERTY_CURRENTPAGE
:
103 Reference
< drawing::XDrawPage
> xPage
;
105 setCurrentPage( xPage
);
110 throw beans::UnknownPropertyException( OUString::number(nHandle
), static_cast<cppu::OWeakObject
*>(this));
114 Any SAL_CALL
SdUnoOutlineView::getFastPropertyValue (
121 case DrawController::PROPERTY_CURRENTPAGE
:
123 SdPage
* pPage
= mrOutlineViewShell
.GetActualPage();
124 if (pPage
!= nullptr)
125 aValue
<<= pPage
->getUnoPage();
128 case DrawController::PROPERTY_VIEWOFFSET
:
132 throw beans::UnknownPropertyException( OUString::number(nHandle
), static_cast<cppu::OWeakObject
*>(this));
139 OUString SAL_CALL
SdUnoOutlineView::getImplementationName( )
141 return "com.sun.star.comp.sd.SdUnoOutlineView";
144 sal_Bool SAL_CALL
SdUnoOutlineView::supportsService( const OUString
& ServiceName
)
146 return cppu::supportsService( this, ServiceName
);
149 Sequence
< OUString
> SAL_CALL
SdUnoOutlineView::getSupportedServiceNames( )
151 return { "com.sun.star.presentation.OutlineView" };
154 } // end of namespace sd
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */