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: unofield.hxx,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 #ifndef _SVX_UNOFIELD_HXX
32 #define _SVX_UNOFIELD_HXX
34 #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
35 #include <com/sun/star/lang/XUnoTunnel.hpp>
37 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
38 #include <com/sun/star/beans/XPropertySet.hpp>
40 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
41 #include <com/sun/star/beans/XPropertySetInfo.hpp>
43 #ifndef _COM_SUN_STAR_TEXT_XTEXTFIELD_HPP_
44 #include <com/sun/star/text/XTextField.hpp>
46 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
47 #include <com/sun/star/lang/XServiceInfo.hpp>
49 #ifndef _CPPUHELPER_COMPONENT_HXX_
50 #include <cppuhelper/component.hxx>
53 #include <comphelper/servicehelper.hxx>
55 #include <bf_svx/mutxhelp.hxx>
57 class SfxItemPropertySet
;
59 // ids usable for the constructor
60 #define ID_DATEFIELD 0
62 #define ID_PAGEFIELD 2
63 #define ID_PAGESFIELD 3
64 #define ID_TIMEFIELD 4
65 #define ID_FILEFIELD 5
66 #define ID_TABLEFIELD 6
67 #define ID_EXT_TIMEFIELD 7
68 #define ID_EXT_FILEFIELD 8
69 #define ID_AUTHORFIELD 9
70 #define ID_MEASUREFIELD 10
71 #define ID_EXT_DATEFIELD 11
72 #define ID_UNKNOWN 12 // this must be the last entry
74 class SvxUnoFieldData_Impl
;
77 class SvxUnoTextField
: public SvxMutexHelper
,
78 public ::cppu::OComponentHelper
,
79 public ::com::sun::star::text::XTextField
,
80 public ::com::sun::star::beans::XPropertySet
,
81 public ::com::sun::star::lang::XServiceInfo
,
82 public ::com::sun::star::lang::XUnoTunnel
85 ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> mxAnchor
;
86 SfxItemPropertySet
* mpPropSet
;
87 sal_Int32 mnServiceId
;
88 SvxUnoFieldData_Impl
* mpImpl
;
91 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> maTypeSequence
;
94 SvxUnoTextField( sal_Int32 nServiceId
) throw();
95 SvxUnoTextField( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> xAnchor
, const ::rtl::OUString
& rPresentation
, const SvxFieldData
* pFieldData
) throw();
96 virtual ~SvxUnoTextField() throw();
99 virtual sal_Int32
GetFieldId( const SvxFieldData
* pFieldData
) const throw();
100 SvxFieldData
* CreateFieldData() const throw();
101 void SetAnchor( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> xAnchor
) { mxAnchor
= xAnchor
; }
103 UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextField
)
105 // ::com::sun::star::uno::XInterface
106 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
107 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
108 virtual void SAL_CALL
acquire() throw();
109 virtual void SAL_CALL
release() throw();
111 // ::com::sun::star::lang::XTypeProvider
112 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
113 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId( ) throw(::com::sun::star::uno::RuntimeException
);
116 virtual ::rtl::OUString SAL_CALL
getPresentation( sal_Bool bShowCommand
) throw(::com::sun::star::uno::RuntimeException
);
119 virtual void SAL_CALL
attach( const ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
>& xTextRange
) throw(::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
120 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> SAL_CALL
getAnchor( ) throw(::com::sun::star::uno::RuntimeException
);
122 // ::com::sun::star::lang::XComponent
123 virtual void SAL_CALL
dispose() throw(::com::sun::star::uno::RuntimeException
);
124 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw(::com::sun::star::uno::RuntimeException
);
125 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw(::com::sun::star::uno::RuntimeException
);
128 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
);
129 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
);
130 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
);
131 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
);
132 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
);
133 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
);
134 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
);
137 virtual void SAL_CALL
disposing();
140 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
);
141 virtual ::rtl::OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
);
142 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
);
145 }//end of namespace binfilter