LibreOffice Module sd (master) 1
SdUnoOutlineView.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <SdUnoOutlineView.hxx>
21
22#include <DrawController.hxx>
23#include <OutlineViewShell.hxx>
24#include <sdpage.hxx>
25
27#include <svx/unopage.hxx>
28
29using namespace ::cppu;
30using namespace ::com::sun::star;
31using namespace ::com::sun::star::uno;
32
33namespace sd {
34
36 OutlineViewShell& rViewShell) noexcept
37 : mrOutlineViewShell(rViewShell)
38{
39}
40
42{
43}
44
45//----- XSelectionSupplier ----------------------------------------------------
46
47sal_Bool SAL_CALL SdUnoOutlineView::select( const Any& )
48{
49 // todo: add selections for text ranges
50 return false;
51}
52
54{
55 Any aAny;
56 return aAny;
57}
58
60 const css::uno::Reference<css::view::XSelectionChangeListener>&)
61{}
62
64 const css::uno::Reference<css::view::XSelectionChangeListener>&)
65{}
66
67//----- XDrawView -------------------------------------------------------------
69 const Reference< drawing::XDrawPage >& xPage)
70{
71 SvxDrawPage* pDrawPage = comphelper::getFromUnoTunnel<SvxDrawPage>( xPage );
72 SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : nullptr;
73 SdPage *pSdPage = dynamic_cast<SdPage*>(pSdrPage);
74
75 if (pSdPage != nullptr)
77}
78
79Reference< drawing::XDrawPage > SAL_CALL SdUnoOutlineView::getCurrentPage()
80{
81 Reference<drawing::XDrawPage> xPage;
82
84 if (pPage != nullptr)
85 xPage.set(pPage->getUnoPage(), UNO_QUERY);
86
87 return xPage;
88}
89
91 sal_Int32 nHandle,
92 const Any& rValue)
93{
94 switch( nHandle )
95 {
97 {
98 Reference< drawing::XDrawPage > xPage;
99 rValue >>= xPage;
100 setCurrentPage( xPage );
101 }
102 break;
103
104 default:
105 throw beans::UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this));
106 }
107}
108
110 sal_Int32 nHandle)
111{
112 Any aValue;
113
114 switch( nHandle )
115 {
117 {
119 if (pPage != nullptr)
120 aValue <<= pPage->getUnoPage();
121 }
122 break;
124 break;
125
126 default:
127 throw beans::UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this));
128 }
129
130 return aValue;
131}
132
133// XServiceInfo
135{
136 return "com.sun.star.comp.sd.SdUnoOutlineView";
137}
138
139sal_Bool SAL_CALL SdUnoOutlineView::supportsService( const OUString& ServiceName )
140{
141 return cppu::supportsService( this, ServiceName );
142}
143
144Sequence< OUString > SAL_CALL SdUnoOutlineView::getSupportedServiceNames( )
145{
146 return { "com.sun.star.presentation.OutlineView" };
147}
148
149} // end of namespace sd
150
151/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
SdrPage * GetSdrPage() const
Show a textual overview of the text contents of all slides.
virtual SdPage * GetActualPage() override
Returns the first selected page.
Definition: outlnvsh.cxx:1544
virtual SdPage * getCurrentPage() const override
inherited from sd::ViewShell
Definition: outlnvsh.cxx:1533
void SetCurrentPage(SdPage *pPage)
Make the given page the new current page.
Definition: outlnvsh.cxx:1867
virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) override
virtual css::uno::Any SAL_CALL getSelection() override
virtual void SAL_CALL setCurrentPage(const css::uno::Reference< css::drawing::XDrawPage > &xPage) override
OutlineViewShell & mrOutlineViewShell
virtual sal_Bool SAL_CALL select(const css::uno::Any &aSelection) override
virtual void SAL_CALL removeSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &rxListener) override
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentPage() override
virtual ~SdUnoOutlineView() noexcept override
virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL addSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &rxListener) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
SdUnoOutlineView(OutlineViewShell &rViewShell) noexcept
virtual OUString SAL_CALL getImplementationName() override
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
sal_Int32 nHandle
unsigned char sal_Bool