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"
25 #include "unopage.hxx"
27 #include <cppuhelper/proptypehlp.hxx>
28 #include <cppuhelper/supportsservice.hxx>
29 #include <svx/unopage.hxx>
30 #include <osl/mutex.hxx>
31 #include <vcl/svapp.hxx>
33 using namespace ::cppu
;
34 using namespace ::com::sun::star
;
35 using namespace ::com::sun::star::uno
;
39 SdUnoOutlineView::SdUnoOutlineView(
40 OutlineViewShell
& rViewShell
) throw()
41 : DrawSubControllerInterfaceBase(m_aMutex
),
42 mrOutlineViewShell(rViewShell
)
46 SdUnoOutlineView::~SdUnoOutlineView() throw()
50 void SAL_CALL
SdUnoOutlineView::disposing()
54 //----- XSelectionSupplier ----------------------------------------------------
56 sal_Bool SAL_CALL
SdUnoOutlineView::select( const Any
& )
57 throw(lang::IllegalArgumentException
, RuntimeException
, std::exception
)
59 // todo: add selections for text ranges
63 Any SAL_CALL
SdUnoOutlineView::getSelection()
64 throw(RuntimeException
, std::exception
)
70 void SAL_CALL
SdUnoOutlineView::addSelectionChangeListener (
71 const css::uno::Reference
<css::view::XSelectionChangeListener
>& rxListener
)
72 throw(css::uno::RuntimeException
, std::exception
)
77 void SAL_CALL
SdUnoOutlineView::removeSelectionChangeListener (
78 const css::uno::Reference
<css::view::XSelectionChangeListener
>& rxListener
)
79 throw(css::uno::RuntimeException
, std::exception
)
84 //----- XDrawView -------------------------------------------------------------
85 void SAL_CALL
SdUnoOutlineView::setCurrentPage (
86 const Reference
< drawing::XDrawPage
>& xPage
)
87 throw(RuntimeException
, std::exception
)
89 SvxDrawPage
* pDrawPage
= SvxDrawPage::getImplementation( xPage
);
90 SdrPage
*pSdrPage
= pDrawPage
? pDrawPage
->GetSdrPage() : NULL
;
91 SdPage
*pSdPage
= dynamic_cast<SdPage
*>(pSdrPage
);
94 mrOutlineViewShell
.SetCurrentPage(pSdPage
);
97 Reference
< drawing::XDrawPage
> SAL_CALL
SdUnoOutlineView::getCurrentPage()
98 throw(RuntimeException
, std::exception
)
100 Reference
<drawing::XDrawPage
> xPage
;
102 SdPage
* pPage
= mrOutlineViewShell
.getCurrentPage();
104 xPage
= Reference
<drawing::XDrawPage
>::query(pPage
->getUnoPage());
109 void SdUnoOutlineView::setFastPropertyValue (
112 throw(css::beans::UnknownPropertyException
,
113 css::beans::PropertyVetoException
,
114 css::lang::IllegalArgumentException
,
115 css::lang::WrappedTargetException
,
116 css::uno::RuntimeException
, std::exception
)
120 case DrawController::PROPERTY_CURRENTPAGE
:
122 Reference
< drawing::XDrawPage
> xPage
;
124 setCurrentPage( xPage
);
129 throw beans::UnknownPropertyException();
133 Any SAL_CALL
SdUnoOutlineView::getFastPropertyValue (
135 throw(css::beans::UnknownPropertyException
,
136 css::lang::WrappedTargetException
,
137 css::uno::RuntimeException
, std::exception
)
143 case DrawController::PROPERTY_CURRENTPAGE
:
145 SdPage
* pPage
= const_cast<OutlineViewShell
&>(mrOutlineViewShell
).GetActualPage();
147 aValue
<<= pPage
->getUnoPage();
150 case DrawController::PROPERTY_VIEWOFFSET
:
154 throw beans::UnknownPropertyException();
161 OUString SAL_CALL
SdUnoOutlineView::getImplementationName( ) throw (RuntimeException
, std::exception
)
163 return OUString("com.sun.star.comp.sd.SdUnoOutlineView");
166 sal_Bool SAL_CALL
SdUnoOutlineView::supportsService( const OUString
& ServiceName
) throw (RuntimeException
, std::exception
)
168 return cppu::supportsService( this, ServiceName
);
171 Sequence
< OUString
> SAL_CALL
SdUnoOutlineView::getSupportedServiceNames( ) throw (RuntimeException
, std::exception
)
173 OUString
aSN( "com.sun.star.presentation.OutlineView" );
174 uno::Sequence
< OUString
> aSeq( &aSN
, 1 );
178 } // end of namespace sd
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */