bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / unoidl / SdUnoOutlineView.cxx
blob6c16c50d64b815ec98a93a3cbe060adfe4301a42
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
24 #include <sdpage.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;
35 namespace sd {
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
57 return false;
60 Any SAL_CALL SdUnoOutlineView::getSelection()
62 Any aAny;
63 return aAny;
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();
91 if (pPage != nullptr)
92 xPage.set(pPage->getUnoPage(), UNO_QUERY);
94 return xPage;
97 void SdUnoOutlineView::setFastPropertyValue (
98 sal_Int32 nHandle,
99 const Any& rValue)
101 switch( nHandle )
103 case DrawController::PROPERTY_CURRENTPAGE:
105 Reference< drawing::XDrawPage > xPage;
106 rValue >>= xPage;
107 setCurrentPage( xPage );
109 break;
111 default:
112 throw beans::UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this));
116 Any SAL_CALL SdUnoOutlineView::getFastPropertyValue (
117 sal_Int32 nHandle)
119 Any aValue;
121 switch( nHandle )
123 case DrawController::PROPERTY_CURRENTPAGE:
125 SdPage* pPage = mrOutlineViewShell.GetActualPage();
126 if (pPage != nullptr)
127 aValue <<= pPage->getUnoPage();
129 break;
130 case DrawController::PROPERTY_VIEWOFFSET:
131 break;
133 default:
134 throw beans::UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this));
137 return aValue;
140 // XServiceInfo
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 );
155 return aSeq;
158 } // end of namespace sd
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */