1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sd.hxx" 30 31 #include <comphelper/serviceinfohelper.hxx> 32 33 #include "SdUnoOutlineView.hxx" 34 35 #include "DrawController.hxx" 36 #include "OutlineViewShell.hxx" 37 #include "sdpage.hxx" 38 #include "unopage.hxx" 39 40 #include <cppuhelper/proptypehlp.hxx> 41 #include <svx/unopage.hxx> 42 #include <vos/mutex.hxx> 43 #include <vcl/svapp.hxx> 44 45 using ::rtl::OUString; 46 using namespace ::vos; 47 using namespace ::cppu; 48 using namespace ::com::sun::star; 49 using namespace ::com::sun::star::uno; 50 51 52 53 namespace sd { 54 55 SdUnoOutlineView::SdUnoOutlineView( 56 DrawController& rController, 57 OutlineViewShell& rViewShell, 58 View& rView) throw() 59 : DrawSubControllerInterfaceBase(m_aMutex), 60 mrController(rController), 61 mrOutlineViewShell(rViewShell), 62 mrView(rView) 63 { 64 } 65 66 67 68 69 SdUnoOutlineView::~SdUnoOutlineView (void) throw() 70 { 71 } 72 73 74 75 76 void SAL_CALL SdUnoOutlineView::disposing (void) 77 { 78 } 79 80 81 82 83 //----- XSelectionSupplier ---------------------------------------------------- 84 85 sal_Bool SAL_CALL SdUnoOutlineView::select( const Any& ) 86 throw(lang::IllegalArgumentException, RuntimeException) 87 { 88 // todo: add selections for text ranges 89 return sal_False; 90 } 91 92 93 94 Any SAL_CALL SdUnoOutlineView::getSelection() 95 throw(RuntimeException) 96 { 97 Any aAny; 98 return aAny; 99 } 100 101 102 103 void SAL_CALL SdUnoOutlineView::addSelectionChangeListener ( 104 const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener) 105 throw(css::uno::RuntimeException) 106 { 107 (void)rxListener; 108 } 109 110 111 112 113 void SAL_CALL SdUnoOutlineView::removeSelectionChangeListener ( 114 const css::uno::Reference<css::view::XSelectionChangeListener>& rxListener) 115 throw(css::uno::RuntimeException) 116 { 117 (void)rxListener; 118 } 119 120 121 122 123 //----- XDrawView ------------------------------------------------------------- 124 125 126 void SAL_CALL SdUnoOutlineView::setCurrentPage ( 127 const Reference< drawing::XDrawPage >& xPage) 128 throw(RuntimeException) 129 { 130 SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xPage ); 131 SdrPage *pSdrPage = pDrawPage ? pDrawPage->GetSdrPage() : NULL; 132 133 if (pSdrPage != NULL) 134 mrOutlineViewShell.SetCurrentPage(dynamic_cast<SdPage*>(pSdrPage)); 135 } 136 137 138 139 140 Reference< drawing::XDrawPage > SAL_CALL SdUnoOutlineView::getCurrentPage (void) 141 throw(RuntimeException) 142 { 143 Reference<drawing::XDrawPage> xPage; 144 145 SdPage* pPage = mrOutlineViewShell.getCurrentPage(); 146 if (pPage != NULL) 147 xPage = Reference<drawing::XDrawPage>::query(pPage->getUnoPage()); 148 149 return xPage; 150 } 151 152 153 154 /* 155 // Return sal_True, value change 156 sal_Bool SdUnoOutlineView::convertFastPropertyValue ( 157 Any & rConvertedValue, 158 Any & rOldValue, 159 sal_Int32 nHandle, 160 const Any& rValue) 161 throw ( com::sun::star::lang::IllegalArgumentException) 162 { 163 sal_Bool bResult = sal_False; 164 165 switch( nHandle ) 166 { 167 case DrawController::PROPERTY_CURRENTPAGE: 168 { 169 Reference< drawing::XDrawPage > xOldPage( getCurrentPage() ); 170 Reference< drawing::XDrawPage > xNewPage; 171 ::cppu::convertPropertyValue( xNewPage, rValue ); 172 if( xOldPage != xNewPage ) 173 { 174 rConvertedValue <<= xNewPage; 175 rOldValue <<= xOldPage; 176 bResult = sal_True; 177 } 178 } 179 break; 180 181 default: 182 break; 183 } 184 185 return bResult; 186 } 187 */ 188 189 190 void SdUnoOutlineView::setFastPropertyValue ( 191 sal_Int32 nHandle, 192 const Any& rValue) 193 throw(css::beans::UnknownPropertyException, 194 css::beans::PropertyVetoException, 195 css::lang::IllegalArgumentException, 196 css::lang::WrappedTargetException, 197 css::uno::RuntimeException) 198 { 199 switch( nHandle ) 200 { 201 case DrawController::PROPERTY_CURRENTPAGE: 202 { 203 Reference< drawing::XDrawPage > xPage; 204 rValue >>= xPage; 205 setCurrentPage( xPage ); 206 } 207 break; 208 209 default: 210 throw beans::UnknownPropertyException(); 211 } 212 } 213 214 215 216 217 void SAL_CALL SdUnoOutlineView::disposing (const ::com::sun::star::lang::EventObject& ) 218 throw (::com::sun::star::uno::RuntimeException) 219 { 220 } 221 222 223 224 225 Any SAL_CALL SdUnoOutlineView::getFastPropertyValue ( 226 sal_Int32 nHandle) 227 throw(css::beans::UnknownPropertyException, 228 css::lang::WrappedTargetException, 229 css::uno::RuntimeException) 230 { 231 Any aValue; 232 233 switch( nHandle ) 234 { 235 case DrawController::PROPERTY_CURRENTPAGE: 236 { 237 SdPage* pPage = const_cast<OutlineViewShell&>(mrOutlineViewShell).GetActualPage(); 238 if (pPage != NULL) 239 aValue <<= pPage->getUnoPage(); 240 } 241 break; 242 case DrawController::PROPERTY_VIEWOFFSET: 243 break; 244 245 default: 246 throw beans::UnknownPropertyException(); 247 } 248 249 return aValue; 250 } 251 252 253 // XServiceInfo 254 OUString SAL_CALL SdUnoOutlineView::getImplementationName( ) throw (RuntimeException) 255 { 256 return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sd.SdUnoOutlineView") ); 257 } 258 259 sal_Bool SAL_CALL SdUnoOutlineView::supportsService( const OUString& ServiceName ) throw (RuntimeException) 260 { 261 return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); 262 } 263 264 Sequence< OUString > SAL_CALL SdUnoOutlineView::getSupportedServiceNames( ) throw (RuntimeException) 265 { 266 OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlineView") ); 267 uno::Sequence< OUString > aSeq( &aSN, 1 ); 268 return aSeq; 269 } 270 271 } // end of namespace sd 272