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 .
21 #include <comphelper/serviceinfohelper.hxx>
23 #include "SdUnoOutlineView.hxx"
25 #include "DrawController.hxx"
26 #include "OutlineViewShell.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
;
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
78 Any SAL_CALL
SdUnoOutlineView::getSelection()
79 throw(RuntimeException
)
87 void SAL_CALL
SdUnoOutlineView::addSelectionChangeListener (
88 const css::uno::Reference
<css::view::XSelectionChangeListener
>& rxListener
)
89 throw(css::uno::RuntimeException
)
97 void SAL_CALL
SdUnoOutlineView::removeSelectionChangeListener (
98 const css::uno::Reference
<css::view::XSelectionChangeListener
>& rxListener
)
99 throw(css::uno::RuntimeException
)
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();
131 xPage
= Reference
<drawing::XDrawPage
>::query(pPage
->getUnoPage());
136 void SdUnoOutlineView::setFastPropertyValue (
139 throw(css::beans::UnknownPropertyException
,
140 css::beans::PropertyVetoException
,
141 css::lang::IllegalArgumentException
,
142 css::lang::WrappedTargetException
,
143 css::uno::RuntimeException
)
147 case DrawController::PROPERTY_CURRENTPAGE
:
149 Reference
< drawing::XDrawPage
> xPage
;
151 setCurrentPage( xPage
);
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 (
173 throw(css::beans::UnknownPropertyException
,
174 css::lang::WrappedTargetException
,
175 css::uno::RuntimeException
)
181 case DrawController::PROPERTY_CURRENTPAGE
:
183 SdPage
* pPage
= const_cast<OutlineViewShell
&>(mrOutlineViewShell
).GetActualPage();
185 aValue
<<= pPage
->getUnoPage();
188 case DrawController::PROPERTY_VIEWOFFSET
:
192 throw beans::UnknownPropertyException();
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 );
217 } // end of namespace sd
219 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */