1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SC_TARGUNO_HXX
21 #define SC_TARGUNO_HXX
23 #include <svl/lstner.hxx>
24 #include <tools/string.hxx>
25 #include <com/sun/star/document/XLinkTargetSupplier.hpp>
26 #include <com/sun/star/lang/XServiceName.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/beans/PropertyValues.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/beans/PropertyValue.hpp>
31 #include <com/sun/star/beans/PropertyState.hpp>
32 #include <com/sun/star/beans/XPropertySetInfo.hpp>
33 #include <com/sun/star/beans/XMultiPropertySet.hpp>
34 #include <com/sun/star/beans/XFastPropertySet.hpp>
35 #include <com/sun/star/beans/XVetoableChangeListener.hpp>
36 #include <com/sun/star/beans/XPropertyState.hpp>
37 #include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
38 #include <com/sun/star/beans/PropertyAttribute.hpp>
39 #include <com/sun/star/beans/XPropertiesChangeListener.hpp>
40 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
41 #include <com/sun/star/beans/XPropertyAccess.hpp>
42 #include <com/sun/star/beans/XPropertyContainer.hpp>
43 #include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
44 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
45 #include <com/sun/star/container/XEnumerationAccess.hpp>
46 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
47 #include <com/sun/star/container/XNameAccess.hpp>
48 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
49 #include <com/sun/star/container/XEnumeration.hpp>
50 #include <com/sun/star/container/XElementAccess.hpp>
51 #include <com/sun/star/container/XIndexAccess.hpp>
52 #include <cppuhelper/implbase2.hxx>
53 #include <cppuhelper/implbase3.hxx>
58 #define SC_LINKTARGETTYPE_SHEET 0
59 #define SC_LINKTARGETTYPE_RANGENAME 1
60 #define SC_LINKTARGETTYPE_DBAREA 2
62 #define SC_LINKTARGETTYPE_COUNT 3
64 #define SCLINKTARGET_SERVICE "com.sun.star.document.LinkTarget"
67 //! Graphic / OleObject (need separate collections!)
70 class ScLinkTargetTypesObj
: public ::cppu::WeakImplHelper2
<
71 ::com::sun::star::container::XNameAccess
,
72 ::com::sun::star::lang::XServiceInfo
>,
76 ScDocShell
* pDocShell
;
77 String aNames
[SC_LINKTARGETTYPE_COUNT
];
80 ScLinkTargetTypesObj(ScDocShell
* pDocSh
);
81 virtual ~ScLinkTargetTypesObj();
83 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
85 // ::com::sun::star::container::XNameAccess
86 virtual ::com::sun::star::uno::Any SAL_CALL
getByName(const ::rtl::OUString
& aName
)
87 throw( ::com::sun::star::container::NoSuchElementException
,
88 ::com::sun::star::lang::WrappedTargetException
,
89 ::com::sun::star::uno::RuntimeException
);
90 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames(void) throw( ::com::sun::star::uno::RuntimeException
);
91 virtual sal_Bool SAL_CALL
hasByName(const ::rtl::OUString
& aName
) throw( ::com::sun::star::uno::RuntimeException
);
93 // ::com::sun::star::container::XElementAccess
94 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType(void) throw( ::com::sun::star::uno::RuntimeException
);
95 virtual sal_Bool SAL_CALL
hasElements(void) throw( ::com::sun::star::uno::RuntimeException
);
97 // ::com::sun::star::lang::XServiceInfo
98 virtual ::rtl::OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
);
99 virtual sal_Bool SAL_CALL
supportsService(const ::rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
100 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
);
104 class ScLinkTargetTypeObj
: public ::cppu::WeakImplHelper3
<
105 ::com::sun::star::beans::XPropertySet
,
106 ::com::sun::star::document::XLinkTargetSupplier
,
107 ::com::sun::star::lang::XServiceInfo
>,
111 ScDocShell
* pDocShell
;
116 ScLinkTargetTypeObj(ScDocShell
* pDocSh
, sal_uInt16 nT
);
117 virtual ~ScLinkTargetTypeObj();
119 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
121 static void SetLinkTargetBitmap( ::com::sun::star::uno::Any
& rRet
, sal_uInt16 nType
);
123 // ::com::sun::star::beans::XPropertySet
124 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo(void) throw( ::com::sun::star::uno::RuntimeException
);
125 virtual void SAL_CALL
setPropertyValue(const ::rtl::OUString
& aPropertyName
,
126 const ::com::sun::star::uno::Any
& aValue
)
127 throw( ::com::sun::star::beans::UnknownPropertyException
,
128 ::com::sun::star::beans::PropertyVetoException
,
129 ::com::sun::star::lang::IllegalArgumentException
,
130 ::com::sun::star::lang::WrappedTargetException
,
131 ::com::sun::star::uno::RuntimeException
);
132 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(const ::rtl::OUString
& PropertyName
)
133 throw( ::com::sun::star::beans::UnknownPropertyException
,
134 ::com::sun::star::lang::WrappedTargetException
,
135 ::com::sun::star::uno::RuntimeException
);
136 virtual void SAL_CALL
addPropertyChangeListener(const ::rtl::OUString
& aPropertyName
,
137 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
> & xListener
)
138 throw( ::com::sun::star::beans::UnknownPropertyException
,
139 ::com::sun::star::lang::WrappedTargetException
,
140 ::com::sun::star::uno::RuntimeException
);
141 virtual void SAL_CALL
removePropertyChangeListener(const ::rtl::OUString
& aPropertyName
,
142 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
> & aListener
)
143 throw( ::com::sun::star::beans::UnknownPropertyException
,
144 ::com::sun::star::lang::WrappedTargetException
,
145 ::com::sun::star::uno::RuntimeException
);
146 virtual void SAL_CALL
addVetoableChangeListener(const ::rtl::OUString
& PropertyName
,
147 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
> & aListener
)
148 throw( ::com::sun::star::beans::UnknownPropertyException
,
149 ::com::sun::star::lang::WrappedTargetException
,
150 ::com::sun::star::uno::RuntimeException
);
151 virtual void SAL_CALL
removeVetoableChangeListener(const ::rtl::OUString
& PropertyName
,
152 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
> & aListener
)
153 throw( ::com::sun::star::beans::UnknownPropertyException
,
154 ::com::sun::star::lang::WrappedTargetException
,
155 ::com::sun::star::uno::RuntimeException
);
157 // ::com::sun::star::document::XLinkTargetSupplier
158 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
getLinks(void) throw( ::com::sun::star::uno::RuntimeException
);
160 // ::com::sun::star::lang::XServiceInfo
161 virtual ::rtl::OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
);
162 virtual sal_Bool SAL_CALL
supportsService(const ::rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
163 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
);
167 class ScLinkTargetsObj
: public ::cppu::WeakImplHelper2
<
168 ::com::sun::star::container::XNameAccess
,
169 ::com::sun::star::lang::XServiceInfo
>
172 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> xCollection
;
175 ScLinkTargetsObj( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> & rColl
);
176 virtual ~ScLinkTargetsObj();
178 // ::com::sun::star::container::XNameAccess
179 virtual ::com::sun::star::uno::Any SAL_CALL
getByName(const ::rtl::OUString
& aName
)
180 throw( ::com::sun::star::container::NoSuchElementException
,
181 ::com::sun::star::lang::WrappedTargetException
,
182 ::com::sun::star::uno::RuntimeException
);
183 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames(void) throw( ::com::sun::star::uno::RuntimeException
);
184 virtual sal_Bool SAL_CALL
hasByName(const ::rtl::OUString
& aName
) throw( ::com::sun::star::uno::RuntimeException
);
186 // ::com::sun::star::container::XElementAccess
187 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType(void) throw( ::com::sun::star::uno::RuntimeException
);
188 virtual sal_Bool SAL_CALL
hasElements(void) throw( ::com::sun::star::uno::RuntimeException
);
190 // ::com::sun::star::lang::XServiceInfo
191 virtual ::rtl::OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
);
192 virtual sal_Bool SAL_CALL
supportsService(const ::rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
193 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
);
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */