bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / unoidl / SdUnoOutlineView.cxx
blob282b080be86b9fe6d79bf8f28aeb61bf62e780f3
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 .
21 #include <comphelper/serviceinfohelper.hxx>
23 #include "SdUnoOutlineView.hxx"
25 #include "DrawController.hxx"
26 #include "OutlineViewShell.hxx"
27 #include "sdpage.hxx"
28 #include "unopage.hxx"
30 #include <cppuhelper/proptypehlp.hxx>
31 #include <svx/unopage.hxx>
32 #include <osl/mutex.hxx>
33 #include <vcl/svapp.hxx>
35 using namespace ::cppu;
36 using namespace ::com::sun::star;
37 using namespace ::com::sun::star::uno;
41 namespace sd {
43 SdUnoOutlineView::SdUnoOutlineView(
44 OutlineViewShell& rViewShell) throw()
45 : DrawSubControllerInterfaceBase(m_aMutex),
46 mrOutlineViewShell(rViewShell)
53 SdUnoOutlineView::~SdUnoOutlineView (void) throw()
60 void SAL_CALL SdUnoOutlineView::disposing (void)
67 //----- XSelectionSupplier ----------------------------------------------------
69 sal_Bool SAL_CALL SdUnoOutlineView::select( const Any& )
70 throw(lang::IllegalArgumentException, RuntimeException)
72 // todo: add selections for text ranges
73 return sal_False;
78 Any SAL_CALL SdUnoOutlineView::getSelection()
79 throw(RuntimeException)
81 Any aAny;
82 return aAny;
87 void SAL_CALL SdUnoOutlineView::addSelectionChangeListener (
88 const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
89 throw(css::uno::RuntimeException)
91 (void)rxListener;
97 void SAL_CALL SdUnoOutlineView::removeSelectionChangeListener (
98 const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
99 throw(css::uno::RuntimeException)
101 (void)rxListener;
107 //----- XDrawView -------------------------------------------------------------
110 void SAL_CALL SdUnoOutlineView::setCurrentPage (
111 const Reference< drawing::XDrawPage >& xPage)
112 throw(RuntimeException)
114 SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
115 SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : NULL;
117 if (pSdrPage != NULL)
118 mrOutlineViewShell.SetCurrentPage(dynamic_cast<SdPage*>(pSdrPage));
124 Reference< drawing::XDrawPage > SAL_CALL SdUnoOutlineView::getCurrentPage (void)
125 throw(RuntimeException)
127 Reference<drawing::XDrawPage> xPage;
129 SdPage* pPage = mrOutlineViewShell.getCurrentPage();
130 if (pPage != NULL)
131 xPage = Reference<drawing::XDrawPage>::query(pPage->getUnoPage());
133 return xPage;
136 void SdUnoOutlineView::setFastPropertyValue (
137 sal_Int32 nHandle,
138 const Any& rValue)
139 throw(css::beans::UnknownPropertyException,
140 css::beans::PropertyVetoException,
141 css::lang::IllegalArgumentException,
142 css::lang::WrappedTargetException,
143 css::uno::RuntimeException)
145 switch( nHandle )
147 case DrawController::PROPERTY_CURRENTPAGE:
149 Reference< drawing::XDrawPage > xPage;
150 rValue >>= xPage;
151 setCurrentPage( xPage );
153 break;
155 default:
156 throw beans::UnknownPropertyException();
163 void SAL_CALL SdUnoOutlineView::disposing (const ::com::sun::star::lang::EventObject& )
164 throw (::com::sun::star::uno::RuntimeException)
171 Any SAL_CALL SdUnoOutlineView::getFastPropertyValue (
172 sal_Int32 nHandle)
173 throw(css::beans::UnknownPropertyException,
174 css::lang::WrappedTargetException,
175 css::uno::RuntimeException)
177 Any aValue;
179 switch( nHandle )
181 case DrawController::PROPERTY_CURRENTPAGE:
183 SdPage* pPage = const_cast<OutlineViewShell&>(mrOutlineViewShell).GetActualPage();
184 if (pPage != NULL)
185 aValue <<= pPage->getUnoPage();
187 break;
188 case DrawController::PROPERTY_VIEWOFFSET:
189 break;
191 default:
192 throw beans::UnknownPropertyException();
195 return aValue;
199 // XServiceInfo
200 OUString SAL_CALL SdUnoOutlineView::getImplementationName( ) throw (RuntimeException)
202 return OUString("com.sun.star.comp.sd.SdUnoOutlineView");
205 sal_Bool SAL_CALL SdUnoOutlineView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
207 return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
210 Sequence< OUString > SAL_CALL SdUnoOutlineView::getSupportedServiceNames( ) throw (RuntimeException)
212 OUString aSN( "com.sun.star.presentation.OutlineView" );
213 uno::Sequence< OUString > aSeq( &aSN, 1 );
214 return aSeq;
217 } // end of namespace sd
219 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */