1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _SD_UNOPAGE_HXX 24 #define _SD_UNOPAGE_HXX 25 26 #include <com/sun/star/document/XLinkTargetSupplier.hpp> 27 #include <com/sun/star/container/XIndexAccess.hpp> 28 #include <com/sun/star/container/XNamed.hpp> 29 #include <com/sun/star/drawing/XMasterPageTarget.hpp> 30 #include <com/sun/star/presentation/XPresentationPage.hpp> 31 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> 32 #include <com/sun/star/beans/XMultiPropertySet.hpp> 33 #include <com/sun/star/office/XAnnotationAccess.hpp> 34 35 #include <svl/itemprop.hxx> 36 37 #ifndef _SVX_UNOPAGE_HXX 38 #include <svx/unopage.hxx> 39 #endif 40 #include <svx/fmdpage.hxx> 41 #include <svx/svdpool.hxx> 42 43 #include <comphelper/servicehelper.hxx> 44 45 #include "unosrch.hxx" 46 47 class SdPage; 48 class SvxShape; 49 class SdrObject; 50 struct SfxItemPropertySimpleEntry; 51 52 #ifdef SVX_LIGHT 53 #define SvxFmDrawPage SvxDrawPage 54 #endif 55 56 /*********************************************************************** 57 * * 58 ***********************************************************************/ 59 class SdGenericDrawPage : public SvxFmDrawPage, 60 public SdUnoSearchReplaceShape, 61 public ::com::sun::star::drawing::XShapeCombiner, 62 public ::com::sun::star::drawing::XShapeBinder, 63 public ::com::sun::star::container::XNamed, 64 public ::com::sun::star::beans::XPropertySet, 65 public ::com::sun::star::beans::XMultiPropertySet, 66 public ::com::sun::star::animations::XAnimationNodeSupplier, 67 public ::com::sun::star::office::XAnnotationAccess, 68 public ::com::sun::star::document::XLinkTargetSupplier 69 { 70 private: 71 SdXImpressDocument* mpModel; 72 SdrModel* mpSdrModel; 73 sal_Int16 mnTempPageNumber; // for printing handouts 74 75 protected: 76 friend class SdXImpressDocument; 77 78 const SvxItemPropertySet* mpPropSet; 79 80 virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException); 81 virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw(); 82 83 rtl::OUString getBookmarkURL() const; 84 void setBookmarkURL( rtl::OUString& rURL ); 85 86 void SetLftBorder( sal_Int32 nValue ); 87 void SetRgtBorder( sal_Int32 nValue ); 88 void SetUppBorder( sal_Int32 nValue ); 89 void SetLwrBorder( sal_Int32 nValue ); 90 91 void SetWidth( sal_Int32 nWidth ); 92 void SetHeight( sal_Int32 nHeight ); 93 94 bool mbIsImpressDocument; 95 96 virtual void disposing() throw(); 97 98 ::com::sun::star::uno::Any getNavigationOrder(); 99 void setNavigationOrder( const ::com::sun::star::uno::Any& rValue ); 100 101 void throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException ); 102 103 public: 104 SdGenericDrawPage( SdXImpressDocument* pModel, SdPage* pInPage, const SvxItemPropertySet* pSet ) throw(); 105 virtual ~SdGenericDrawPage() throw(); 106 107 // intern 108 sal_Bool isValid() { return (SvxDrawPage::mpPage != NULL) && (mpModel != NULL); } 109 110 SdPage* GetPage() const { return (SdPage*)SvxDrawPage::mpPage; } 111 SdXImpressDocument* GetModel() const; 112 113 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); 114 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); 115 116 // this is called whenever a SdrObject must be created for a empty api shape wrapper 117 virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(); 118 119 // SvxFmDrawPage 120 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw (); 121 122 // XInterface 123 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 124 virtual void SAL_CALL release() throw(); 125 126 // XShapeCombiner 127 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL combine( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw(::com::sun::star::uno::RuntimeException); 128 virtual void SAL_CALL split( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xGroup ) throw(::com::sun::star::uno::RuntimeException); 129 130 // XShapeBinder 131 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL bind( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw(::com::sun::star::uno::RuntimeException); 132 virtual void SAL_CALL unbind( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException); 133 134 // XPropertySet 135 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); 136 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 137 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 138 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 139 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 140 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 141 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 142 143 // XMultiPropertySet 144 virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 145 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); 146 virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 147 virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 148 virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 149 150 // XLinkTargetSupplier 151 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks( ) throw(::com::sun::star::uno::RuntimeException); 152 153 // XServiceInfo 154 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 155 156 // XAnimationNodeSupplier 157 virtual ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > SAL_CALL getAnimationNode( ) throw (::com::sun::star::uno::RuntimeException); 158 159 // XAnnotationAccess: 160 virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > SAL_CALL createAndInsertAnnotation() throw (::com::sun::star::uno::RuntimeException); 161 virtual void SAL_CALL removeAnnotation(const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > & annotation) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException); 162 virtual ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() throw (::com::sun::star::uno::RuntimeException); 163 }; 164 165 /*********************************************************************** 166 * * 167 ***********************************************************************/ 168 169 class SdDrawPage : public ::com::sun::star::drawing::XMasterPageTarget, 170 public ::com::sun::star::presentation::XPresentationPage, 171 public SdGenericDrawPage 172 { 173 private: 174 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; 175 176 protected: 177 virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException); 178 virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw(); 179 public: 180 SdDrawPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw(); 181 virtual ~SdDrawPage() throw(); 182 183 UNO3_GETIMPLEMENTATION_DECL( SdDrawPage ) 184 185 static ::rtl::OUString getPageApiName( SdPage* pPage ); 186 static ::rtl::OUString getPageApiNameFromUiName( const String& rUIName ); 187 static String getUiNameFromPageApiName( const ::rtl::OUString& rApiName ); 188 189 // XInterface 190 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 191 virtual void SAL_CALL acquire() throw(); 192 virtual void SAL_CALL release() throw(); 193 194 // XTypeProvider 195 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); 196 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); 197 198 // XServiceInfo 199 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); 200 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 201 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 202 203 // XMasterPageTarget 204 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getMasterPage( ) throw(::com::sun::star::uno::RuntimeException); 205 virtual void SAL_CALL setMasterPage( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xMasterPage ) throw(::com::sun::star::uno::RuntimeException); 206 207 // XPresentationPage 208 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage( ) throw(::com::sun::star::uno::RuntimeException); 209 210 // XNamed 211 virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); 212 virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); 213 214 // XIndexAccess 215 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; 216 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 217 218 // XElementAccess 219 virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); 220 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); 221 222 // XShapes 223 virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException); 224 virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException); 225 }; 226 227 /*********************************************************************** 228 * * 229 ***********************************************************************/ 230 231 class SdMasterPage : public ::com::sun::star::presentation::XPresentationPage, 232 public SdGenericDrawPage 233 { 234 private: 235 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; 236 protected: 237 virtual void setBackground( const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::lang::IllegalArgumentException ); 238 virtual void getBackground( ::com::sun::star::uno::Any& rValue ) throw(); 239 240 public: 241 SdMasterPage( SdXImpressDocument* pModel, SdPage* pInPage ) throw(); 242 virtual ~SdMasterPage() throw(); 243 244 UNO3_GETIMPLEMENTATION_DECL(SdMasterPage) 245 246 // XInterface 247 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 248 virtual void SAL_CALL acquire() throw(); 249 virtual void SAL_CALL release() throw(); 250 251 // XTypeProvider 252 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); 253 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); 254 255 // XServiceInfo 256 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); 257 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 258 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 259 260 // XIndexAccess 261 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; 262 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 263 264 // XElementAccess 265 virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); 266 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); 267 268 // XPresentationPage 269 virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL getNotesPage( ) throw(::com::sun::star::uno::RuntimeException); 270 271 // XNamed 272 virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException); 273 virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); 274 275 // XShapes 276 virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException); 277 virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException); 278 }; 279 280 281 /*********************************************************************** 282 * * 283 ***********************************************************************/ 284 #include <cppuhelper/implbase2.hxx> 285 286 class SdPageLinkTargets : public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess, 287 ::com::sun::star::lang::XServiceInfo > 288 { 289 private: 290 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxPage; 291 SdGenericDrawPage* mpUnoPage; 292 293 public: 294 SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw(); 295 virtual ~SdPageLinkTargets() throw(); 296 297 // intern 298 SdrObject* FindObject( const String& rName ) const throw(); 299 300 // XServiceInfo 301 virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); 302 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 303 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 304 305 // XNameAccess 306 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 307 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw(::com::sun::star::uno::RuntimeException); 308 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); 309 310 // XElementAccess 311 virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); 312 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); 313 }; 314 315 #endif // _SD_UNOPAGE_HXX 316