xref: /AOO41X/main/sc/inc/targuno.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_TARGUNO_HXX
25cdf0e10cSrcweir #define SC_TARGUNO_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svl/lstner.hxx>
28cdf0e10cSrcweir #include <tools/string.hxx>
29cdf0e10cSrcweir #include <com/sun/star/document/XLinkTargetSupplier.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XServiceName.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
32cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValues.hpp>
33cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
34cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
35cdf0e10cSrcweir #include <com/sun/star/beans/PropertyState.hpp>
36cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp>
37cdf0e10cSrcweir #include <com/sun/star/beans/XMultiPropertySet.hpp>
38cdf0e10cSrcweir #include <com/sun/star/beans/XFastPropertySet.hpp>
39cdf0e10cSrcweir #include <com/sun/star/beans/XVetoableChangeListener.hpp>
40cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
41cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
42cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
43cdf0e10cSrcweir #include <com/sun/star/beans/XPropertiesChangeListener.hpp>
44cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
45cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp>
46cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyContainer.hpp>
47cdf0e10cSrcweir #include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
48cdf0e10cSrcweir #include <com/sun/star/beans/PropertyChangeEvent.hpp>
49cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp>
50cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
51cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
52cdf0e10cSrcweir #include <com/sun/star/container/XContentEnumerationAccess.hpp>
53cdf0e10cSrcweir #include <com/sun/star/container/XEnumeration.hpp>
54cdf0e10cSrcweir #include <com/sun/star/container/XElementAccess.hpp>
55cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp>
56cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
57cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
58cdf0e10cSrcweir 
59cdf0e10cSrcweir class ScDocShell;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir #define SC_LINKTARGETTYPE_SHEET		0
63cdf0e10cSrcweir #define SC_LINKTARGETTYPE_RANGENAME	1
64cdf0e10cSrcweir #define SC_LINKTARGETTYPE_DBAREA	2
65cdf0e10cSrcweir 
66cdf0e10cSrcweir #define SC_LINKTARGETTYPE_COUNT		3
67cdf0e10cSrcweir 
68cdf0e10cSrcweir #define SCLINKTARGET_SERVICE		"com.sun.star.document.LinkTarget"
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir //!	Graphic / OleObject (need separate collections!)
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 
74cdf0e10cSrcweir class ScLinkTargetTypesObj : public ::cppu::WeakImplHelper2<
75cdf0e10cSrcweir 								::com::sun::star::container::XNameAccess,
76cdf0e10cSrcweir 								::com::sun::star::lang::XServiceInfo >,
77cdf0e10cSrcweir 							public SfxListener
78cdf0e10cSrcweir {
79cdf0e10cSrcweir private:
80cdf0e10cSrcweir 	ScDocShell*				pDocShell;
81cdf0e10cSrcweir 	String					aNames[SC_LINKTARGETTYPE_COUNT];
82cdf0e10cSrcweir 
83cdf0e10cSrcweir public:
84cdf0e10cSrcweir 							ScLinkTargetTypesObj(ScDocShell* pDocSh);
85cdf0e10cSrcweir 	virtual					~ScLinkTargetTypesObj();
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 							// ::com::sun::star::container::XNameAccess
90cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL		getByName(const ::rtl::OUString& aName)
91cdf0e10cSrcweir 								throw(	::com::sun::star::container::NoSuchElementException,
92cdf0e10cSrcweir 										::com::sun::star::lang::WrappedTargetException,
93cdf0e10cSrcweir 										::com::sun::star::uno::RuntimeException );
94cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL		getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
95cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL			hasByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 							// ::com::sun::star::container::XElementAccess
98cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Type SAL_CALL		getElementType(void) throw( ::com::sun::star::uno::RuntimeException );
99cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL			hasElements(void) throw( ::com::sun::star::uno::RuntimeException );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 							// ::com::sun::star::lang::XServiceInfo
102cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL			getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
103cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL			supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
104cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL		getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
105cdf0e10cSrcweir };
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 
108cdf0e10cSrcweir class ScLinkTargetTypeObj : public ::cppu::WeakImplHelper3<
109cdf0e10cSrcweir 								::com::sun::star::beans::XPropertySet,
110cdf0e10cSrcweir 								::com::sun::star::document::XLinkTargetSupplier,
111cdf0e10cSrcweir 								::com::sun::star::lang::XServiceInfo >,
112cdf0e10cSrcweir 							public SfxListener
113cdf0e10cSrcweir {
114cdf0e10cSrcweir private:
115cdf0e10cSrcweir 	ScDocShell*				pDocShell;
116cdf0e10cSrcweir 	sal_uInt16				nType;
117cdf0e10cSrcweir 	String					aName;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir public:
120cdf0e10cSrcweir 							ScLinkTargetTypeObj(ScDocShell* pDocSh, sal_uInt16 nT);
121cdf0e10cSrcweir 	virtual					~ScLinkTargetTypeObj();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	static void				SetLinkTargetBitmap( ::com::sun::star::uno::Any& rRet, sal_uInt16 nType );
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 							// ::com::sun::star::beans::XPropertySet
128cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL  getPropertySetInfo(void) throw( ::com::sun::star::uno::RuntimeException );
129cdf0e10cSrcweir 	virtual void SAL_CALL	setPropertyValue(const ::rtl::OUString& aPropertyName,
130cdf0e10cSrcweir 									const ::com::sun::star::uno::Any& aValue)
131cdf0e10cSrcweir 								throw(	::com::sun::star::beans::UnknownPropertyException,
132cdf0e10cSrcweir 										::com::sun::star::beans::PropertyVetoException,
133cdf0e10cSrcweir  										::com::sun::star::lang::IllegalArgumentException,
134cdf0e10cSrcweir 										::com::sun::star::lang::WrappedTargetException,
135cdf0e10cSrcweir 										::com::sun::star::uno::RuntimeException );
136cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL		getPropertyValue(const ::rtl::OUString& PropertyName)
137cdf0e10cSrcweir 								throw(	::com::sun::star::beans::UnknownPropertyException,
138cdf0e10cSrcweir 										::com::sun::star::lang::WrappedTargetException,
139cdf0e10cSrcweir 										::com::sun::star::uno::RuntimeException );
140cdf0e10cSrcweir 	virtual void SAL_CALL			addPropertyChangeListener(const ::rtl::OUString& aPropertyName,
141cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & xListener)
142cdf0e10cSrcweir 								throw(	::com::sun::star::beans::UnknownPropertyException,
143cdf0e10cSrcweir 										::com::sun::star::lang::WrappedTargetException,
144cdf0e10cSrcweir 										::com::sun::star::uno::RuntimeException );
145cdf0e10cSrcweir 	virtual void SAL_CALL			removePropertyChangeListener(const ::rtl::OUString& aPropertyName,
146cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener)
147cdf0e10cSrcweir 								throw( 	::com::sun::star::beans::UnknownPropertyException,
148cdf0e10cSrcweir 										::com::sun::star::lang::WrappedTargetException,
149cdf0e10cSrcweir 										::com::sun::star::uno::RuntimeException );
150cdf0e10cSrcweir 	virtual void SAL_CALL			addVetoableChangeListener(const ::rtl::OUString& PropertyName,
151cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener)
152cdf0e10cSrcweir 								throw(	::com::sun::star::beans::UnknownPropertyException,
153cdf0e10cSrcweir 										::com::sun::star::lang::WrappedTargetException,
154cdf0e10cSrcweir 										::com::sun::star::uno::RuntimeException );
155cdf0e10cSrcweir 	virtual void SAL_CALL			removeVetoableChangeListener(const ::rtl::OUString& PropertyName,
156cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener)
157cdf0e10cSrcweir 								throw(	::com::sun::star::beans::UnknownPropertyException,
158cdf0e10cSrcweir 										::com::sun::star::lang::WrappedTargetException,
159cdf0e10cSrcweir 										::com::sun::star::uno::RuntimeException );
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 							// ::com::sun::star::document::XLinkTargetSupplier
162cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL  getLinks(void) throw( ::com::sun::star::uno::RuntimeException );
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 							// ::com::sun::star::lang::XServiceInfo
165cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL			getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
166cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL			supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
167cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
168cdf0e10cSrcweir };
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 
171cdf0e10cSrcweir class ScLinkTargetsObj : public ::cppu::WeakImplHelper2<
172cdf0e10cSrcweir 							::com::sun::star::container::XNameAccess,
173cdf0e10cSrcweir 							::com::sun::star::lang::XServiceInfo >
174cdf0e10cSrcweir {
175cdf0e10cSrcweir private:
176cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > 			xCollection;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir public:
179cdf0e10cSrcweir 							ScLinkTargetsObj( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & rColl );
180cdf0e10cSrcweir 	virtual					~ScLinkTargetsObj();
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 							// ::com::sun::star::container::XNameAccess
183cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL			getByName(const ::rtl::OUString& aName)
184cdf0e10cSrcweir 								throw(	::com::sun::star::container::NoSuchElementException,
185cdf0e10cSrcweir 										::com::sun::star::lang::WrappedTargetException,
186cdf0e10cSrcweir  										::com::sun::star::uno::RuntimeException );
187cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL		getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
188cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL			hasByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException );
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 							// ::com::sun::star::container::XElementAccess
191cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Type SAL_CALL		getElementType(void) throw( ::com::sun::star::uno::RuntimeException );
192cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL			hasElements(void) throw( ::com::sun::star::uno::RuntimeException );
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 							// ::com::sun::star::lang::XServiceInfo
195cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL			getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
196cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL			supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
197cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL		getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
198cdf0e10cSrcweir };
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 
201cdf0e10cSrcweir #endif
202cdf0e10cSrcweir 
203