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
) noexcept
37 : mrOutlineViewShell(rViewShell
)
41 SdUnoOutlineView::~SdUnoOutlineView() noexcept
45 //----- XSelectionSupplier ----------------------------------------------------
47 sal_Bool SAL_CALL
SdUnoOutlineView::select( const Any
& )
49 // todo: add selections for text ranges
53 Any SAL_CALL
SdUnoOutlineView::getSelection()
59 void SAL_CALL
SdUnoOutlineView::addSelectionChangeListener (
60 const css::uno::Reference
<css::view::XSelectionChangeListener
>&)
63 void SAL_CALL
SdUnoOutlineView::removeSelectionChangeListener (
64 const css::uno::Reference
<css::view::XSelectionChangeListener
>&)
67 //----- XDrawView -------------------------------------------------------------
68 void SAL_CALL
SdUnoOutlineView::setCurrentPage (
69 const Reference
< drawing::XDrawPage
>& xPage
)
71 SvxDrawPage
* pDrawPage
= comphelper::getFromUnoTunnel
<SvxDrawPage
>( xPage
);
72 SdrPage
*pSdrPage
= pDrawPage
? pDrawPage
->GetSdrPage() : nullptr;
73 SdPage
*pSdPage
= dynamic_cast<SdPage
*>(pSdrPage
);
75 if (pSdPage
!= nullptr)
76 mrOutlineViewShell
.SetCurrentPage(pSdPage
);
79 Reference
< drawing::XDrawPage
> SAL_CALL
SdUnoOutlineView::getCurrentPage()
81 Reference
<drawing::XDrawPage
> xPage
;
83 SdPage
* pPage
= mrOutlineViewShell
.getCurrentPage();
85 xPage
.set(pPage
->getUnoPage(), UNO_QUERY
);
90 void SdUnoOutlineView::setFastPropertyValue (
96 case DrawController::PROPERTY_CURRENTPAGE
:
98 Reference
< drawing::XDrawPage
> xPage
;
100 setCurrentPage( xPage
);
105 throw beans::UnknownPropertyException( OUString::number(nHandle
), static_cast<cppu::OWeakObject
*>(this));
109 Any SAL_CALL
SdUnoOutlineView::getFastPropertyValue (
116 case DrawController::PROPERTY_CURRENTPAGE
:
118 SdPage
* pPage
= mrOutlineViewShell
.GetActualPage();
119 if (pPage
!= nullptr)
120 aValue
<<= pPage
->getUnoPage();
123 case DrawController::PROPERTY_VIEWOFFSET
:
127 throw beans::UnknownPropertyException( OUString::number(nHandle
), static_cast<cppu::OWeakObject
*>(this));
134 OUString SAL_CALL
SdUnoOutlineView::getImplementationName( )
136 return u
"com.sun.star.comp.sd.SdUnoOutlineView"_ustr
;
139 sal_Bool SAL_CALL
SdUnoOutlineView::supportsService( const OUString
& ServiceName
)
141 return cppu::supportsService( this, ServiceName
);
144 Sequence
< OUString
> SAL_CALL
SdUnoOutlineView::getSupportedServiceNames( )
146 return { u
"com.sun.star.presentation.OutlineView"_ustr
};
149 } // end of namespace sd
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */