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 24 #ifndef _SVX_UNOFIELD_HXX 25 #define _SVX_UNOFIELD_HXX 26 27 #include <com/sun/star/lang/XUnoTunnel.hpp> 28 #include <com/sun/star/beans/XPropertySet.hpp> 29 #include <com/sun/star/beans/XPropertySetInfo.hpp> 30 #include <com/sun/star/text/XTextField.hpp> 31 #include <com/sun/star/lang/XServiceInfo.hpp> 32 #include <cppuhelper/component.hxx> 33 #include "editeng/editengdllapi.h" 34 35 #include <comphelper/servicehelper.hxx> 36 37 #include <editeng/mutxhelp.hxx> 38 39 // ids usable for the constructor 40 #define ID_DATEFIELD 0 41 #define ID_URLFIELD 1 42 #define ID_PAGEFIELD 2 43 #define ID_PAGESFIELD 3 44 #define ID_TIMEFIELD 4 45 #define ID_FILEFIELD 5 46 #define ID_TABLEFIELD 6 47 #define ID_EXT_TIMEFIELD 7 48 #define ID_EXT_FILEFIELD 8 49 #define ID_AUTHORFIELD 9 50 #define ID_MEASUREFIELD 10 51 #define ID_EXT_DATEFIELD 11 52 #define ID_HEADERFIELD 12 53 #define ID_FOOTERFIELD 13 54 #define ID_DATETIMEFIELD 14 55 #define ID_UNKNOWN 15 // this must be the last entry 56 57 class SvxUnoFieldData_Impl; 58 class SfxItemPropertySet; 59 class SvxFieldData; 60 61 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > EDITENG_DLLPUBLIC SAL_CALL SvxUnoTextCreateTextField( 62 const ::rtl::OUString& ServiceSpecifier ); 63 64 class EDITENG_DLLPUBLIC SvxUnoTextField : public SvxMutexHelper, 65 public ::cppu::OComponentHelper, 66 public ::com::sun::star::text::XTextField, 67 public ::com::sun::star::beans::XPropertySet, 68 public ::com::sun::star::lang::XServiceInfo, 69 public ::com::sun::star::lang::XUnoTunnel 70 { 71 private: 72 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > mxAnchor; 73 const SfxItemPropertySet* mpPropSet; 74 sal_Int32 mnServiceId; 75 SvxUnoFieldData_Impl* mpImpl; 76 77 protected: 78 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; 79 80 public: 81 SvxUnoTextField( sal_Int32 nServiceId ) throw(); 82 SvxUnoTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor, const ::rtl::OUString& rPresentation, const SvxFieldData* pFieldData ) throw(); 83 virtual ~SvxUnoTextField() throw(); 84 85 // Intern 86 virtual sal_Int32 GetFieldId( const SvxFieldData* pFieldData ) const throw(); 87 SvxFieldData* CreateFieldData() const throw(); SetAnchor(::com::sun::star::uno::Reference<::com::sun::star::text::XTextRange> xAnchor)88 void SetAnchor( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor ) { mxAnchor = xAnchor; } 89 90 UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextField ) 91 92 // ::com::sun::star::uno::XInterface 93 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ); 94 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ); 95 virtual void SAL_CALL acquire() throw(); 96 virtual void SAL_CALL release() throw(); 97 98 // ::com::sun::star::lang::XTypeProvider 99 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ); 100 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ); 101 102 // XTextField 103 virtual ::rtl::OUString SAL_CALL getPresentation( sal_Bool bShowCommand ); 104 105 // XTextContent 106 virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ); 107 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ); 108 109 // ::com::sun::star::lang::XComponent 110 virtual void SAL_CALL dispose(); 111 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ); 112 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ); 113 114 // XPropertySet 115 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ); 116 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ); 117 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ); 118 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ); 119 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ); 120 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ); 121 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ); 122 123 // OComponentHelper 124 virtual void SAL_CALL disposing(); 125 126 // XServiceInfo 127 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ); 128 virtual ::rtl::OUString SAL_CALL getImplementationName(); 129 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 130 }; 131 132 #endif 133