1*5b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5b190011SAndrew Rist  * distributed with this work for additional information
6*5b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5b190011SAndrew Rist  * "License"); you may not use this file except in compliance
9*5b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*5b190011SAndrew Rist  *
11*5b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*5b190011SAndrew Rist  *
13*5b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5b190011SAndrew Rist  * software distributed under the License is distributed on an
15*5b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
17*5b190011SAndrew Rist  * specific language governing permissions and limitations
18*5b190011SAndrew Rist  * under the License.
19*5b190011SAndrew Rist  *
20*5b190011SAndrew Rist  *************************************************************/
21*5b190011SAndrew Rist 
22*5b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <comphelper/serviceinfohelper.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "SdUnoOutlineView.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "DrawController.hxx"
32cdf0e10cSrcweir #include "OutlineViewShell.hxx"
33cdf0e10cSrcweir #include "sdpage.hxx"
34cdf0e10cSrcweir #include "unopage.hxx"
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <cppuhelper/proptypehlp.hxx>
37cdf0e10cSrcweir #include <svx/unopage.hxx>
38cdf0e10cSrcweir #include <vos/mutex.hxx>
39cdf0e10cSrcweir #include <vcl/svapp.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir using ::rtl::OUString;
42cdf0e10cSrcweir using namespace ::vos;
43cdf0e10cSrcweir using namespace ::cppu;
44cdf0e10cSrcweir using namespace ::com::sun::star;
45cdf0e10cSrcweir using namespace ::com::sun::star::uno;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir namespace sd {
50cdf0e10cSrcweir 
SdUnoOutlineView(DrawController & rController,OutlineViewShell & rViewShell,View & rView)51cdf0e10cSrcweir SdUnoOutlineView::SdUnoOutlineView(
52cdf0e10cSrcweir     DrawController& rController,
53cdf0e10cSrcweir     OutlineViewShell& rViewShell,
54cdf0e10cSrcweir     View& rView) throw()
55cdf0e10cSrcweir     :	DrawSubControllerInterfaceBase(m_aMutex),
56cdf0e10cSrcweir         mrController(rController),
57cdf0e10cSrcweir         mrOutlineViewShell(rViewShell),
58cdf0e10cSrcweir         mrView(rView)
59cdf0e10cSrcweir {
60cdf0e10cSrcweir }
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
~SdUnoOutlineView(void)65cdf0e10cSrcweir SdUnoOutlineView::~SdUnoOutlineView (void) throw()
66cdf0e10cSrcweir {
67cdf0e10cSrcweir }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 
disposing(void)72cdf0e10cSrcweir void SAL_CALL SdUnoOutlineView::disposing (void)
73cdf0e10cSrcweir {
74cdf0e10cSrcweir }
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 
79cdf0e10cSrcweir //----- XSelectionSupplier ----------------------------------------------------
80cdf0e10cSrcweir 
select(const Any &)81cdf0e10cSrcweir sal_Bool SAL_CALL SdUnoOutlineView::select( const Any&  )
82cdf0e10cSrcweir 	throw(lang::IllegalArgumentException, RuntimeException)
83cdf0e10cSrcweir {
84cdf0e10cSrcweir 	// todo: add selections for text ranges
85cdf0e10cSrcweir 	return sal_False;
86cdf0e10cSrcweir }
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 
getSelection()90cdf0e10cSrcweir Any SAL_CALL SdUnoOutlineView::getSelection()
91cdf0e10cSrcweir 	throw(RuntimeException)
92cdf0e10cSrcweir {
93cdf0e10cSrcweir 	Any aAny;
94cdf0e10cSrcweir 	return aAny;
95cdf0e10cSrcweir }
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 
addSelectionChangeListener(const css::uno::Reference<css::view::XSelectionChangeListener> & rxListener)99cdf0e10cSrcweir void SAL_CALL SdUnoOutlineView::addSelectionChangeListener (
100cdf0e10cSrcweir     const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
101cdf0e10cSrcweir     throw(css::uno::RuntimeException)
102cdf0e10cSrcweir {
103cdf0e10cSrcweir     (void)rxListener;
104cdf0e10cSrcweir }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 
removeSelectionChangeListener(const css::uno::Reference<css::view::XSelectionChangeListener> & rxListener)109cdf0e10cSrcweir void SAL_CALL SdUnoOutlineView::removeSelectionChangeListener (
110cdf0e10cSrcweir     const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener)
111cdf0e10cSrcweir     throw(css::uno::RuntimeException)
112cdf0e10cSrcweir {
113cdf0e10cSrcweir     (void)rxListener;
114cdf0e10cSrcweir }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 
119cdf0e10cSrcweir //----- XDrawView -------------------------------------------------------------
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
setCurrentPage(const Reference<drawing::XDrawPage> & xPage)122cdf0e10cSrcweir void SAL_CALL SdUnoOutlineView::setCurrentPage (
123cdf0e10cSrcweir     const Reference< drawing::XDrawPage >& xPage)
124cdf0e10cSrcweir 	throw(RuntimeException)
125cdf0e10cSrcweir {
126cdf0e10cSrcweir     SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage );
127cdf0e10cSrcweir     SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : NULL;
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     if (pSdrPage != NULL)
130cdf0e10cSrcweir         mrOutlineViewShell.SetCurrentPage(dynamic_cast<SdPage*>(pSdrPage));
131cdf0e10cSrcweir }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 
getCurrentPage(void)136cdf0e10cSrcweir Reference< drawing::XDrawPage > SAL_CALL SdUnoOutlineView::getCurrentPage (void)
137cdf0e10cSrcweir 	throw(RuntimeException)
138cdf0e10cSrcweir {
139cdf0e10cSrcweir 	Reference<drawing::XDrawPage>  xPage;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     SdPage* pPage = mrOutlineViewShell.getCurrentPage();
142cdf0e10cSrcweir     if (pPage != NULL)
143cdf0e10cSrcweir         xPage = Reference<drawing::XDrawPage>::query(pPage->getUnoPage());
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	return xPage;
146cdf0e10cSrcweir }
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 
150cdf0e10cSrcweir /*
151cdf0e10cSrcweir // Return sal_True, value change
152cdf0e10cSrcweir sal_Bool SdUnoOutlineView::convertFastPropertyValue (
153cdf0e10cSrcweir 	Any & rConvertedValue,
154cdf0e10cSrcweir 	Any & rOldValue,
155cdf0e10cSrcweir 	sal_Int32 nHandle,
156cdf0e10cSrcweir 	const Any& rValue)
157cdf0e10cSrcweir     throw ( com::sun::star::lang::IllegalArgumentException)
158cdf0e10cSrcweir {
159cdf0e10cSrcweir     sal_Bool bResult = sal_False;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 	switch( nHandle )
162cdf0e10cSrcweir 	{
163cdf0e10cSrcweir 		case DrawController::PROPERTY_CURRENTPAGE:
164cdf0e10cSrcweir 			{
165cdf0e10cSrcweir 				Reference< drawing::XDrawPage > xOldPage( getCurrentPage() );
166cdf0e10cSrcweir 				Reference< drawing::XDrawPage > xNewPage;
167cdf0e10cSrcweir 				::cppu::convertPropertyValue( xNewPage, rValue );
168cdf0e10cSrcweir 				if( xOldPage != xNewPage )
169cdf0e10cSrcweir 				{
170cdf0e10cSrcweir 					rConvertedValue <<= xNewPage;
171cdf0e10cSrcweir 					rOldValue <<= xOldPage;
172cdf0e10cSrcweir 					bResult = sal_True;
173cdf0e10cSrcweir 				}
174cdf0e10cSrcweir 			}
175cdf0e10cSrcweir             break;
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 		default:
178cdf0e10cSrcweir             break;
179cdf0e10cSrcweir 	}
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     return bResult;
182cdf0e10cSrcweir }
183cdf0e10cSrcweir */
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 
setFastPropertyValue(sal_Int32 nHandle,const Any & rValue)186cdf0e10cSrcweir void SdUnoOutlineView::setFastPropertyValue (
187cdf0e10cSrcweir 	sal_Int32 nHandle,
188cdf0e10cSrcweir         const Any& rValue)
189cdf0e10cSrcweir     throw(css::beans::UnknownPropertyException,
190cdf0e10cSrcweir         css::beans::PropertyVetoException,
191cdf0e10cSrcweir         css::lang::IllegalArgumentException,
192cdf0e10cSrcweir         css::lang::WrappedTargetException,
193cdf0e10cSrcweir         css::uno::RuntimeException)
194cdf0e10cSrcweir {
195cdf0e10cSrcweir 	switch( nHandle )
196cdf0e10cSrcweir 	{
197cdf0e10cSrcweir         case DrawController::PROPERTY_CURRENTPAGE:
198cdf0e10cSrcweir         {
199cdf0e10cSrcweir             Reference< drawing::XDrawPage > xPage;
200cdf0e10cSrcweir             rValue >>= xPage;
201cdf0e10cSrcweir             setCurrentPage( xPage );
202cdf0e10cSrcweir         }
203cdf0e10cSrcweir         break;
204cdf0e10cSrcweir 
205cdf0e10cSrcweir         default:
206cdf0e10cSrcweir             throw beans::UnknownPropertyException();
207cdf0e10cSrcweir 	}
208cdf0e10cSrcweir }
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 
disposing(const::com::sun::star::lang::EventObject &)213cdf0e10cSrcweir void SAL_CALL SdUnoOutlineView::disposing (const ::com::sun::star::lang::EventObject& )
214cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
215cdf0e10cSrcweir {
216cdf0e10cSrcweir }
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 
getFastPropertyValue(sal_Int32 nHandle)221cdf0e10cSrcweir Any SAL_CALL SdUnoOutlineView::getFastPropertyValue (
222cdf0e10cSrcweir     sal_Int32 nHandle)
223cdf0e10cSrcweir     throw(css::beans::UnknownPropertyException,
224cdf0e10cSrcweir         css::lang::WrappedTargetException,
225cdf0e10cSrcweir         css::uno::RuntimeException)
226cdf0e10cSrcweir {
227cdf0e10cSrcweir     Any aValue;
228cdf0e10cSrcweir 
229cdf0e10cSrcweir     switch( nHandle )
230cdf0e10cSrcweir     {
231cdf0e10cSrcweir         case DrawController::PROPERTY_CURRENTPAGE:
232cdf0e10cSrcweir         {
233cdf0e10cSrcweir             SdPage* pPage = const_cast<OutlineViewShell&>(mrOutlineViewShell).GetActualPage();
234cdf0e10cSrcweir             if (pPage != NULL)
235cdf0e10cSrcweir                 aValue <<= pPage->getUnoPage();
236cdf0e10cSrcweir         }
237cdf0e10cSrcweir         break;
238cdf0e10cSrcweir 		case DrawController::PROPERTY_VIEWOFFSET:
239cdf0e10cSrcweir 			break;
240cdf0e10cSrcweir 
241cdf0e10cSrcweir         default:
242cdf0e10cSrcweir             throw beans::UnknownPropertyException();
243cdf0e10cSrcweir     }
244cdf0e10cSrcweir 
245cdf0e10cSrcweir     return aValue;
246cdf0e10cSrcweir }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir 
249cdf0e10cSrcweir // XServiceInfo
getImplementationName()250cdf0e10cSrcweir OUString SAL_CALL SdUnoOutlineView::getImplementationName(  ) throw (RuntimeException)
251cdf0e10cSrcweir {
252cdf0e10cSrcweir 	return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sd.SdUnoOutlineView") );
253cdf0e10cSrcweir }
254cdf0e10cSrcweir 
supportsService(const OUString & ServiceName)255cdf0e10cSrcweir sal_Bool SAL_CALL SdUnoOutlineView::supportsService( const OUString& ServiceName ) throw (RuntimeException)
256cdf0e10cSrcweir {
257cdf0e10cSrcweir 	return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
258cdf0e10cSrcweir }
259cdf0e10cSrcweir 
getSupportedServiceNames()260cdf0e10cSrcweir Sequence< OUString > SAL_CALL SdUnoOutlineView::getSupportedServiceNames(  ) throw (RuntimeException)
261cdf0e10cSrcweir {
262cdf0e10cSrcweir 	OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlineView") );
263cdf0e10cSrcweir 	uno::Sequence< OUString > aSeq( &aSN, 1 );
264cdf0e10cSrcweir 	return aSeq;
265cdf0e10cSrcweir }
266cdf0e10cSrcweir 
267cdf0e10cSrcweir } // end of namespace sd
268