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 INCLUDED_SC_INC_TARGUNO_HXX
21 #define INCLUDED_SC_INC_TARGUNO_HXX
23 #include <svl/lstner.hxx>
24 #include <com/sun/star/document/XLinkTargetSupplier.hpp>
25 #include <com/sun/star/lang/XServiceName.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/beans/PropertyValues.hpp>
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/beans/PropertyValue.hpp>
30 #include <com/sun/star/beans/PropertyState.hpp>
31 #include <com/sun/star/beans/XPropertySetInfo.hpp>
32 #include <com/sun/star/beans/XMultiPropertySet.hpp>
33 #include <com/sun/star/beans/XFastPropertySet.hpp>
34 #include <com/sun/star/beans/XVetoableChangeListener.hpp>
35 #include <com/sun/star/beans/XPropertyState.hpp>
36 #include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
37 #include <com/sun/star/beans/PropertyAttribute.hpp>
38 #include <com/sun/star/beans/XPropertiesChangeListener.hpp>
39 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
40 #include <com/sun/star/beans/XPropertyAccess.hpp>
41 #include <com/sun/star/beans/XPropertyContainer.hpp>
42 #include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
43 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
44 #include <com/sun/star/container/XEnumerationAccess.hpp>
45 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
46 #include <com/sun/star/container/XNameAccess.hpp>
47 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
48 #include <com/sun/star/container/XEnumeration.hpp>
49 #include <com/sun/star/container/XElementAccess.hpp>
50 #include <com/sun/star/container/XIndexAccess.hpp>
51 #include <cppuhelper/implbase2.hxx>
52 #include <cppuhelper/implbase3.hxx>
57 #define SC_LINKTARGETTYPE_SHEET 0
58 #define SC_LINKTARGETTYPE_RANGENAME 1
59 #define SC_LINKTARGETTYPE_DBAREA 2
61 #define SC_LINKTARGETTYPE_COUNT 3
63 #define SCLINKTARGET_SERVICE "com.sun.star.document.LinkTarget"
66 //! Graphic / OleObject (need separate collections!)
69 class ScLinkTargetTypesObj
: public ::cppu::WeakImplHelper2
<
70 ::com::sun::star::container::XNameAccess
,
71 ::com::sun::star::lang::XServiceInfo
>,
75 ScDocShell
* pDocShell
;
76 OUString aNames
[SC_LINKTARGETTYPE_COUNT
];
79 ScLinkTargetTypesObj(ScDocShell
* pDocSh
);
80 virtual ~ScLinkTargetTypesObj();
82 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
84 // ::com::sun::star::container::XNameAccess
85 virtual ::com::sun::star::uno::Any SAL_CALL
getByName(const OUString
& aName
)
86 throw( ::com::sun::star::container::NoSuchElementException
,
87 ::com::sun::star::lang::WrappedTargetException
,
88 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
89 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 virtual sal_Bool SAL_CALL
hasByName(const OUString
& aName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 // ::com::sun::star::container::XElementAccess
93 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 virtual sal_Bool SAL_CALL
hasElements(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 // ::com::sun::star::lang::XServiceInfo
97 virtual OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
98 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
103 class ScLinkTargetTypeObj
: public ::cppu::WeakImplHelper3
<
104 ::com::sun::star::beans::XPropertySet
,
105 ::com::sun::star::document::XLinkTargetSupplier
,
106 ::com::sun::star::lang::XServiceInfo
>,
110 ScDocShell
* pDocShell
;
115 ScLinkTargetTypeObj(ScDocShell
* pDocSh
, sal_uInt16 nT
);
116 virtual ~ScLinkTargetTypeObj();
118 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
120 static void SetLinkTargetBitmap( ::com::sun::star::uno::Any
& rRet
, sal_uInt16 nType
);
122 // ::com::sun::star::beans::XPropertySet
123 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
124 virtual void SAL_CALL
setPropertyValue(const OUString
& aPropertyName
,
125 const ::com::sun::star::uno::Any
& aValue
)
126 throw( ::com::sun::star::beans::UnknownPropertyException
,
127 ::com::sun::star::beans::PropertyVetoException
,
128 ::com::sun::star::lang::IllegalArgumentException
,
129 ::com::sun::star::lang::WrappedTargetException
,
130 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
131 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(const OUString
& PropertyName
)
132 throw( ::com::sun::star::beans::UnknownPropertyException
,
133 ::com::sun::star::lang::WrappedTargetException
,
134 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
135 virtual void SAL_CALL
addPropertyChangeListener(const OUString
& aPropertyName
,
136 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
> & xListener
)
137 throw( ::com::sun::star::beans::UnknownPropertyException
,
138 ::com::sun::star::lang::WrappedTargetException
,
139 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
140 virtual void SAL_CALL
removePropertyChangeListener(const OUString
& aPropertyName
,
141 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
> & aListener
)
142 throw( ::com::sun::star::beans::UnknownPropertyException
,
143 ::com::sun::star::lang::WrappedTargetException
,
144 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
145 virtual void SAL_CALL
addVetoableChangeListener(const OUString
& PropertyName
,
146 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
> & aListener
)
147 throw( ::com::sun::star::beans::UnknownPropertyException
,
148 ::com::sun::star::lang::WrappedTargetException
,
149 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
150 virtual void SAL_CALL
removeVetoableChangeListener(const OUString
& PropertyName
,
151 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
> & aListener
)
152 throw( ::com::sun::star::beans::UnknownPropertyException
,
153 ::com::sun::star::lang::WrappedTargetException
,
154 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
156 // ::com::sun::star::document::XLinkTargetSupplier
157 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
getLinks(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
159 // ::com::sun::star::lang::XServiceInfo
160 virtual OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
161 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
162 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
166 class ScLinkTargetsObj
: public ::cppu::WeakImplHelper2
<
167 ::com::sun::star::container::XNameAccess
,
168 ::com::sun::star::lang::XServiceInfo
>
171 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> xCollection
;
174 ScLinkTargetsObj( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> & rColl
);
175 virtual ~ScLinkTargetsObj();
177 // ::com::sun::star::container::XNameAccess
178 virtual ::com::sun::star::uno::Any SAL_CALL
getByName(const OUString
& aName
)
179 throw( ::com::sun::star::container::NoSuchElementException
,
180 ::com::sun::star::lang::WrappedTargetException
,
181 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
182 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
183 virtual sal_Bool SAL_CALL
hasByName(const OUString
& aName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
185 // ::com::sun::star::container::XElementAccess
186 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
187 virtual sal_Bool SAL_CALL
hasElements(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
189 // ::com::sun::star::lang::XServiceInfo
190 virtual OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
191 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
192 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
198 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */