1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SdUnoOutlineView.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include "SdUnoOutlineView.hxx"
36 #include "DrawController.hxx"
37 #include "OutlineViewShell.hxx"
39 #include "unopage.hxx"
41 #include <cppuhelper/proptypehlp.hxx>
42 #include <svx/unopage.hxx>
43 #include <vos/mutex.hxx>
44 #include <vcl/svapp.hxx>
46 using ::rtl::OUString
;
47 using namespace ::vos
;
48 using namespace ::cppu
;
49 using namespace ::com::sun::star
;
50 using namespace ::com::sun::star::uno
;
56 SdUnoOutlineView::SdUnoOutlineView(
57 DrawController
& rController
,
58 OutlineViewShell
& rViewShell
,
60 : DrawSubControllerInterfaceBase(m_aMutex
),
61 mrController(rController
),
62 mrOutlineViewShell(rViewShell
),
70 SdUnoOutlineView::~SdUnoOutlineView (void) throw()
77 void SAL_CALL
SdUnoOutlineView::disposing (void)
84 //----- XSelectionSupplier ----------------------------------------------------
86 sal_Bool SAL_CALL
SdUnoOutlineView::select( const Any
& )
87 throw(lang::IllegalArgumentException
, RuntimeException
)
89 // todo: add selections for text ranges
95 Any SAL_CALL
SdUnoOutlineView::getSelection()
96 throw(RuntimeException
)
104 void SAL_CALL
SdUnoOutlineView::addSelectionChangeListener (
105 const css::uno::Reference
<css::view::XSelectionChangeListener
>& rxListener
)
106 throw(css::uno::RuntimeException
)
114 void SAL_CALL
SdUnoOutlineView::removeSelectionChangeListener (
115 const css::uno::Reference
<css::view::XSelectionChangeListener
>& rxListener
)
116 throw(css::uno::RuntimeException
)
124 //----- XDrawView -------------------------------------------------------------
127 void SAL_CALL
SdUnoOutlineView::setCurrentPage (
128 const Reference
< drawing::XDrawPage
>& xPage
)
129 throw(RuntimeException
)
131 SvxDrawPage
* pDrawPage
= SvxDrawPage::getImplementation( xPage
);
132 SdrPage
*pSdrPage
= pDrawPage
? pDrawPage
->GetSdrPage() : NULL
;
134 if (pSdrPage
!= NULL
)
135 mrOutlineViewShell
.SetCurrentPage(dynamic_cast<SdPage
*>(pSdrPage
));
141 Reference
< drawing::XDrawPage
> SAL_CALL
SdUnoOutlineView::getCurrentPage (void)
142 throw(RuntimeException
)
144 Reference
<drawing::XDrawPage
> xPage
;
146 SdPage
* pPage
= mrOutlineViewShell
.getCurrentPage();
148 xPage
= Reference
<drawing::XDrawPage
>::query(pPage
->getUnoPage());
156 // Return sal_True, value change
157 sal_Bool SdUnoOutlineView::convertFastPropertyValue (
158 Any & rConvertedValue,
162 throw ( com::sun::star::lang::IllegalArgumentException)
164 sal_Bool bResult = sal_False;
168 case DrawController::PROPERTY_CURRENTPAGE:
170 Reference< drawing::XDrawPage > xOldPage( getCurrentPage() );
171 Reference< drawing::XDrawPage > xNewPage;
172 ::cppu::convertPropertyValue( xNewPage, rValue );
173 if( xOldPage != xNewPage )
175 rConvertedValue <<= xNewPage;
176 rOldValue <<= xOldPage;
191 void SdUnoOutlineView::setFastPropertyValue (
194 throw(css::beans::UnknownPropertyException
,
195 css::beans::PropertyVetoException
,
196 css::lang::IllegalArgumentException
,
197 css::lang::WrappedTargetException
,
198 css::uno::RuntimeException
)
202 case DrawController::PROPERTY_CURRENTPAGE
:
204 Reference
< drawing::XDrawPage
> xPage
;
206 setCurrentPage( xPage
);
211 throw beans::UnknownPropertyException();
218 void SAL_CALL
SdUnoOutlineView::disposing (const ::com::sun::star::lang::EventObject
& )
219 throw (::com::sun::star::uno::RuntimeException
)
226 Any SAL_CALL
SdUnoOutlineView::getFastPropertyValue (
228 throw(css::beans::UnknownPropertyException
,
229 css::lang::WrappedTargetException
,
230 css::uno::RuntimeException
)
236 case DrawController::PROPERTY_CURRENTPAGE
:
238 SdPage
* pPage
= const_cast<OutlineViewShell
&>(mrOutlineViewShell
).GetActualPage();
240 aValue
<<= pPage
->getUnoPage();
245 throw beans::UnknownPropertyException();
254 } // end of namespace sd