merged tag ooo/OOO330_m14
[LibreOffice.git] / sc / inc / targuno.hxx
blob857f4c0c25e2cfc8459e4375e73811dbc80b4456
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SC_TARGUNO_HXX
29 #define SC_TARGUNO_HXX
31 #include <svl/lstner.hxx>
32 #include <tools/string.hxx>
33 #include <com/sun/star/document/XLinkTargetSupplier.hpp>
34 #include <com/sun/star/lang/XServiceName.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/beans/PropertyValues.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <com/sun/star/beans/PropertyValue.hpp>
39 #include <com/sun/star/beans/PropertyState.hpp>
40 #include <com/sun/star/beans/XPropertySetInfo.hpp>
41 #include <com/sun/star/beans/XMultiPropertySet.hpp>
42 #include <com/sun/star/beans/XFastPropertySet.hpp>
43 #include <com/sun/star/beans/XVetoableChangeListener.hpp>
44 #include <com/sun/star/beans/XPropertyState.hpp>
45 #include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
46 #include <com/sun/star/beans/PropertyAttribute.hpp>
47 #include <com/sun/star/beans/XPropertiesChangeListener.hpp>
48 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
49 #include <com/sun/star/beans/XPropertyAccess.hpp>
50 #include <com/sun/star/beans/XPropertyContainer.hpp>
51 #include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
52 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
53 #include <com/sun/star/container/XEnumerationAccess.hpp>
54 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
55 #include <com/sun/star/container/XNameAccess.hpp>
56 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
57 #include <com/sun/star/container/XEnumeration.hpp>
58 #include <com/sun/star/container/XElementAccess.hpp>
59 #include <com/sun/star/container/XIndexAccess.hpp>
60 #include <cppuhelper/implbase2.hxx>
61 #include <cppuhelper/implbase3.hxx>
63 class ScDocShell;
66 #define SC_LINKTARGETTYPE_SHEET 0
67 #define SC_LINKTARGETTYPE_RANGENAME 1
68 #define SC_LINKTARGETTYPE_DBAREA 2
70 #define SC_LINKTARGETTYPE_COUNT 3
72 #define SCLINKTARGET_SERVICE "com.sun.star.document.LinkTarget"
75 //! Graphic / OleObject (need separate collections!)
78 class ScLinkTargetTypesObj : public ::cppu::WeakImplHelper2<
79 ::com::sun::star::container::XNameAccess,
80 ::com::sun::star::lang::XServiceInfo >,
81 public SfxListener
83 private:
84 ScDocShell* pDocShell;
85 String aNames[SC_LINKTARGETTYPE_COUNT];
87 public:
88 ScLinkTargetTypesObj(ScDocShell* pDocSh);
89 virtual ~ScLinkTargetTypesObj();
91 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
93 // ::com::sun::star::container::XNameAccess
94 virtual ::com::sun::star::uno::Any SAL_CALL getByName(const ::rtl::OUString& aName)
95 throw( ::com::sun::star::container::NoSuchElementException,
96 ::com::sun::star::lang::WrappedTargetException,
97 ::com::sun::star::uno::RuntimeException );
98 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
99 virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException );
101 // ::com::sun::star::container::XElementAccess
102 virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException );
103 virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException );
105 // ::com::sun::star::lang::XServiceInfo
106 virtual ::rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
107 virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
108 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
112 class ScLinkTargetTypeObj : public ::cppu::WeakImplHelper3<
113 ::com::sun::star::beans::XPropertySet,
114 ::com::sun::star::document::XLinkTargetSupplier,
115 ::com::sun::star::lang::XServiceInfo >,
116 public SfxListener
118 private:
119 ScDocShell* pDocShell;
120 sal_uInt16 nType;
121 String aName;
123 public:
124 ScLinkTargetTypeObj(ScDocShell* pDocSh, sal_uInt16 nT);
125 virtual ~ScLinkTargetTypeObj();
127 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
129 static void SetLinkTargetBitmap( ::com::sun::star::uno::Any& rRet, sal_uInt16 nType );
131 // ::com::sun::star::beans::XPropertySet
132 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(void) throw( ::com::sun::star::uno::RuntimeException );
133 virtual void SAL_CALL setPropertyValue(const ::rtl::OUString& aPropertyName,
134 const ::com::sun::star::uno::Any& aValue)
135 throw( ::com::sun::star::beans::UnknownPropertyException,
136 ::com::sun::star::beans::PropertyVetoException,
137 ::com::sun::star::lang::IllegalArgumentException,
138 ::com::sun::star::lang::WrappedTargetException,
139 ::com::sun::star::uno::RuntimeException );
140 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& PropertyName)
141 throw( ::com::sun::star::beans::UnknownPropertyException,
142 ::com::sun::star::lang::WrappedTargetException,
143 ::com::sun::star::uno::RuntimeException );
144 virtual void SAL_CALL addPropertyChangeListener(const ::rtl::OUString& aPropertyName,
145 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & xListener)
146 throw( ::com::sun::star::beans::UnknownPropertyException,
147 ::com::sun::star::lang::WrappedTargetException,
148 ::com::sun::star::uno::RuntimeException );
149 virtual void SAL_CALL removePropertyChangeListener(const ::rtl::OUString& aPropertyName,
150 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener)
151 throw( ::com::sun::star::beans::UnknownPropertyException,
152 ::com::sun::star::lang::WrappedTargetException,
153 ::com::sun::star::uno::RuntimeException );
154 virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& PropertyName,
155 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener)
156 throw( ::com::sun::star::beans::UnknownPropertyException,
157 ::com::sun::star::lang::WrappedTargetException,
158 ::com::sun::star::uno::RuntimeException );
159 virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& PropertyName,
160 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener)
161 throw( ::com::sun::star::beans::UnknownPropertyException,
162 ::com::sun::star::lang::WrappedTargetException,
163 ::com::sun::star::uno::RuntimeException );
165 // ::com::sun::star::document::XLinkTargetSupplier
166 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks(void) throw( ::com::sun::star::uno::RuntimeException );
168 // ::com::sun::star::lang::XServiceInfo
169 virtual ::rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
170 virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
171 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
175 class ScLinkTargetsObj : public ::cppu::WeakImplHelper2<
176 ::com::sun::star::container::XNameAccess,
177 ::com::sun::star::lang::XServiceInfo >
179 private:
180 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xCollection;
182 public:
183 ScLinkTargetsObj( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & rColl );
184 virtual ~ScLinkTargetsObj();
186 // ::com::sun::star::container::XNameAccess
187 virtual ::com::sun::star::uno::Any SAL_CALL getByName(const ::rtl::OUString& aName)
188 throw( ::com::sun::star::container::NoSuchElementException,
189 ::com::sun::star::lang::WrappedTargetException,
190 ::com::sun::star::uno::RuntimeException );
191 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
192 virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException );
194 // ::com::sun::star::container::XElementAccess
195 virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException );
196 virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException );
198 // ::com::sun::star::lang::XServiceInfo
199 virtual ::rtl::OUString SAL_CALL getImplementationName(void) 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(void) throw( ::com::sun::star::uno::RuntimeException );
205 #endif