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>
56 #define SC_LINKTARGETTYPE_SHEET 0
57 #define SC_LINKTARGETTYPE_RANGENAME 1
58 #define SC_LINKTARGETTYPE_DBAREA 2
60 #define SC_LINKTARGETTYPE_COUNT 3
62 #define SCLINKTARGET_SERVICE "com.sun.star.document.LinkTarget"
64 //! Graphic / OleObject (need separate collections!)
66 class ScLinkTargetTypesObj
: public ::cppu::WeakImplHelper2
<
67 ::com::sun::star::container::XNameAccess
,
68 ::com::sun::star::lang::XServiceInfo
>,
72 ScDocShell
* pDocShell
;
73 OUString aNames
[SC_LINKTARGETTYPE_COUNT
];
76 ScLinkTargetTypesObj(ScDocShell
* pDocSh
);
77 virtual ~ScLinkTargetTypesObj();
79 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
81 // ::com::sun::star::container::XNameAccess
82 virtual ::com::sun::star::uno::Any SAL_CALL
getByName(const OUString
& aName
)
83 throw( ::com::sun::star::container::NoSuchElementException
,
84 ::com::sun::star::lang::WrappedTargetException
,
85 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
87 virtual sal_Bool SAL_CALL
hasByName(const OUString
& aName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
89 // ::com::sun::star::container::XElementAccess
90 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
91 virtual sal_Bool SAL_CALL
hasElements() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 // ::com::sun::star::lang::XServiceInfo
94 virtual OUString SAL_CALL
getImplementationName() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 class ScLinkTargetTypeObj
: public ::cppu::WeakImplHelper3
<
100 ::com::sun::star::beans::XPropertySet
,
101 ::com::sun::star::document::XLinkTargetSupplier
,
102 ::com::sun::star::lang::XServiceInfo
>,
106 ScDocShell
* pDocShell
;
111 ScLinkTargetTypeObj(ScDocShell
* pDocSh
, sal_uInt16 nT
);
112 virtual ~ScLinkTargetTypeObj();
114 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
116 static void SetLinkTargetBitmap( ::com::sun::star::uno::Any
& rRet
, sal_uInt16 nType
);
118 // ::com::sun::star::beans::XPropertySet
119 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
120 virtual void SAL_CALL
setPropertyValue(const OUString
& aPropertyName
,
121 const ::com::sun::star::uno::Any
& aValue
)
122 throw( ::com::sun::star::beans::UnknownPropertyException
,
123 ::com::sun::star::beans::PropertyVetoException
,
124 ::com::sun::star::lang::IllegalArgumentException
,
125 ::com::sun::star::lang::WrappedTargetException
,
126 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(const OUString
& PropertyName
)
128 throw( ::com::sun::star::beans::UnknownPropertyException
,
129 ::com::sun::star::lang::WrappedTargetException
,
130 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
131 virtual void SAL_CALL
addPropertyChangeListener(const OUString
& aPropertyName
,
132 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
> & xListener
)
133 throw( ::com::sun::star::beans::UnknownPropertyException
,
134 ::com::sun::star::lang::WrappedTargetException
,
135 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
136 virtual void SAL_CALL
removePropertyChangeListener(const OUString
& aPropertyName
,
137 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
> & aListener
)
138 throw( ::com::sun::star::beans::UnknownPropertyException
,
139 ::com::sun::star::lang::WrappedTargetException
,
140 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
141 virtual void SAL_CALL
addVetoableChangeListener(const OUString
& PropertyName
,
142 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
> & aListener
)
143 throw( ::com::sun::star::beans::UnknownPropertyException
,
144 ::com::sun::star::lang::WrappedTargetException
,
145 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
146 virtual void SAL_CALL
removeVetoableChangeListener(const 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
, std::exception
) SAL_OVERRIDE
;
152 // ::com::sun::star::document::XLinkTargetSupplier
153 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
getLinks() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
155 // ::com::sun::star::lang::XServiceInfo
156 virtual OUString SAL_CALL
getImplementationName() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
157 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
158 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
161 class ScLinkTargetsObj
: public ::cppu::WeakImplHelper2
<
162 ::com::sun::star::container::XNameAccess
,
163 ::com::sun::star::lang::XServiceInfo
>
166 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> xCollection
;
169 ScLinkTargetsObj( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> & rColl
);
170 virtual ~ScLinkTargetsObj();
172 // ::com::sun::star::container::XNameAccess
173 virtual ::com::sun::star::uno::Any SAL_CALL
getByName(const OUString
& aName
)
174 throw( ::com::sun::star::container::NoSuchElementException
,
175 ::com::sun::star::lang::WrappedTargetException
,
176 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
177 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
178 virtual sal_Bool SAL_CALL
hasByName(const OUString
& aName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
180 // ::com::sun::star::container::XElementAccess
181 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
182 virtual sal_Bool SAL_CALL
hasElements() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
184 // ::com::sun::star::lang::XServiceInfo
185 virtual OUString SAL_CALL
getImplementationName() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
186 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
187 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */