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: targuno.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 SC_TARGUNO_HXX
32 #define SC_TARGUNO_HXX
34 #include <svtools/lstner.hxx>
35 #include <tools/string.hxx>
36 #include <com/sun/star/document/XLinkTargetSupplier.hpp>
37 #include <com/sun/star/lang/XServiceName.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/beans/PropertyValues.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/beans/PropertyValue.hpp>
42 #include <com/sun/star/beans/PropertyState.hpp>
43 #include <com/sun/star/beans/XPropertySetInfo.hpp>
44 #include <com/sun/star/beans/XMultiPropertySet.hpp>
45 #include <com/sun/star/beans/XFastPropertySet.hpp>
46 #include <com/sun/star/beans/XVetoableChangeListener.hpp>
47 #include <com/sun/star/beans/XPropertyState.hpp>
48 #include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
49 #include <com/sun/star/beans/PropertyAttribute.hpp>
50 #include <com/sun/star/beans/XPropertiesChangeListener.hpp>
51 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
52 #include <com/sun/star/beans/XPropertyAccess.hpp>
53 #include <com/sun/star/beans/XPropertyContainer.hpp>
54 #include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
55 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
56 #include <com/sun/star/container/XEnumerationAccess.hpp>
57 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
58 #include <com/sun/star/container/XNameAccess.hpp>
59 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
60 #include <com/sun/star/container/XEnumeration.hpp>
61 #include <com/sun/star/container/XElementAccess.hpp>
62 #include <com/sun/star/container/XIndexAccess.hpp>
63 #include <cppuhelper/implbase2.hxx>
64 #include <cppuhelper/implbase3.hxx>
69 #define SC_LINKTARGETTYPE_SHEET 0
70 #define SC_LINKTARGETTYPE_RANGENAME 1
71 #define SC_LINKTARGETTYPE_DBAREA 2
73 #define SC_LINKTARGETTYPE_COUNT 3
75 #define SCLINKTARGET_SERVICE "com.sun.star.document.LinkTarget"
78 //! Graphic / OleObject (need separate collections!)
81 class ScLinkTargetTypesObj
: public ::cppu::WeakImplHelper2
<
82 ::com::sun::star::container::XNameAccess
,
83 ::com::sun::star::lang::XServiceInfo
>,
87 ScDocShell
* pDocShell
;
88 String aNames
[SC_LINKTARGETTYPE_COUNT
];
91 ScLinkTargetTypesObj(ScDocShell
* pDocSh
);
92 virtual ~ScLinkTargetTypesObj();
94 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
96 // ::com::sun::star::container::XNameAccess
97 virtual ::com::sun::star::uno::Any SAL_CALL
getByName(const ::rtl::OUString
& aName
)
98 throw( ::com::sun::star::container::NoSuchElementException
,
99 ::com::sun::star::lang::WrappedTargetException
,
100 ::com::sun::star::uno::RuntimeException
);
101 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames(void) throw( ::com::sun::star::uno::RuntimeException
);
102 virtual sal_Bool SAL_CALL
hasByName(const ::rtl::OUString
& aName
) throw( ::com::sun::star::uno::RuntimeException
);
104 // ::com::sun::star::container::XElementAccess
105 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType(void) throw( ::com::sun::star::uno::RuntimeException
);
106 virtual sal_Bool SAL_CALL
hasElements(void) throw( ::com::sun::star::uno::RuntimeException
);
108 // ::com::sun::star::lang::XServiceInfo
109 virtual ::rtl::OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
);
110 virtual sal_Bool SAL_CALL
supportsService(const ::rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
111 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
);
115 class ScLinkTargetTypeObj
: public ::cppu::WeakImplHelper3
<
116 ::com::sun::star::beans::XPropertySet
,
117 ::com::sun::star::document::XLinkTargetSupplier
,
118 ::com::sun::star::lang::XServiceInfo
>,
122 ScDocShell
* pDocShell
;
127 ScLinkTargetTypeObj(ScDocShell
* pDocSh
, sal_uInt16 nT
);
128 virtual ~ScLinkTargetTypeObj();
130 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
132 static void SetLinkTargetBitmap( ::com::sun::star::uno::Any
& rRet
, sal_uInt16 nType
);
134 // ::com::sun::star::beans::XPropertySet
135 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo(void) throw( ::com::sun::star::uno::RuntimeException
);
136 virtual void SAL_CALL
setPropertyValue(const ::rtl::OUString
& aPropertyName
,
137 const ::com::sun::star::uno::Any
& aValue
)
138 throw( ::com::sun::star::beans::UnknownPropertyException
,
139 ::com::sun::star::beans::PropertyVetoException
,
140 ::com::sun::star::lang::IllegalArgumentException
,
141 ::com::sun::star::lang::WrappedTargetException
,
142 ::com::sun::star::uno::RuntimeException
);
143 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(const ::rtl::OUString
& PropertyName
)
144 throw( ::com::sun::star::beans::UnknownPropertyException
,
145 ::com::sun::star::lang::WrappedTargetException
,
146 ::com::sun::star::uno::RuntimeException
);
147 virtual void SAL_CALL
addPropertyChangeListener(const ::rtl::OUString
& aPropertyName
,
148 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
> & xListener
)
149 throw( ::com::sun::star::beans::UnknownPropertyException
,
150 ::com::sun::star::lang::WrappedTargetException
,
151 ::com::sun::star::uno::RuntimeException
);
152 virtual void SAL_CALL
removePropertyChangeListener(const ::rtl::OUString
& aPropertyName
,
153 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
> & aListener
)
154 throw( ::com::sun::star::beans::UnknownPropertyException
,
155 ::com::sun::star::lang::WrappedTargetException
,
156 ::com::sun::star::uno::RuntimeException
);
157 virtual void SAL_CALL
addVetoableChangeListener(const ::rtl::OUString
& PropertyName
,
158 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
> & aListener
)
159 throw( ::com::sun::star::beans::UnknownPropertyException
,
160 ::com::sun::star::lang::WrappedTargetException
,
161 ::com::sun::star::uno::RuntimeException
);
162 virtual void SAL_CALL
removeVetoableChangeListener(const ::rtl::OUString
& PropertyName
,
163 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
> & aListener
)
164 throw( ::com::sun::star::beans::UnknownPropertyException
,
165 ::com::sun::star::lang::WrappedTargetException
,
166 ::com::sun::star::uno::RuntimeException
);
168 // ::com::sun::star::document::XLinkTargetSupplier
169 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
getLinks(void) throw( ::com::sun::star::uno::RuntimeException
);
171 // ::com::sun::star::lang::XServiceInfo
172 virtual ::rtl::OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
);
173 virtual sal_Bool SAL_CALL
supportsService(const ::rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
174 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
);
178 class ScLinkTargetsObj
: public ::cppu::WeakImplHelper2
<
179 ::com::sun::star::container::XNameAccess
,
180 ::com::sun::star::lang::XServiceInfo
>
183 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> xCollection
;
186 ScLinkTargetsObj( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> & rColl
);
187 virtual ~ScLinkTargetsObj();
189 // ::com::sun::star::container::XNameAccess
190 virtual ::com::sun::star::uno::Any SAL_CALL
getByName(const ::rtl::OUString
& aName
)
191 throw( ::com::sun::star::container::NoSuchElementException
,
192 ::com::sun::star::lang::WrappedTargetException
,
193 ::com::sun::star::uno::RuntimeException
);
194 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames(void) throw( ::com::sun::star::uno::RuntimeException
);
195 virtual sal_Bool SAL_CALL
hasByName(const ::rtl::OUString
& aName
) throw( ::com::sun::star::uno::RuntimeException
);
197 // ::com::sun::star::container::XElementAccess
198 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType(void) throw( ::com::sun::star::uno::RuntimeException
);
199 virtual sal_Bool SAL_CALL
hasElements(void) throw( ::com::sun::star::uno::RuntimeException
);
201 // ::com::sun::star::lang::XServiceInfo
202 virtual ::rtl::OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
);
203 virtual sal_Bool SAL_CALL
supportsService(const ::rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
204 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
);