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/implbase.hxx>
55 #define SC_LINKTARGETTYPE_SHEET 0
56 #define SC_LINKTARGETTYPE_RANGENAME 1
57 #define SC_LINKTARGETTYPE_DBAREA 2
59 #define SC_LINKTARGETTYPE_COUNT 3
61 #define SCLINKTARGET_SERVICE "com.sun.star.document.LinkTarget"
63 //! Graphic / OleObject (need separate collections!)
65 class ScLinkTargetTypesObj
: public ::cppu::WeakImplHelper
<
66 css::container::XNameAccess
,
67 css::lang::XServiceInfo
>,
71 ScDocShell
* pDocShell
;
72 OUString aNames
[SC_LINKTARGETTYPE_COUNT
];
75 ScLinkTargetTypesObj(ScDocShell
* pDocSh
);
76 virtual ~ScLinkTargetTypesObj() override
;
78 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
80 // css::container::XNameAccess
81 virtual css::uno::Any SAL_CALL
getByName(const OUString
& aName
)
82 throw( css::container::NoSuchElementException
,
83 css::lang::WrappedTargetException
,
84 css::uno::RuntimeException
, std::exception
) override
;
85 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() throw( css::uno::RuntimeException
, std::exception
) override
;
86 virtual sal_Bool SAL_CALL
hasByName(const OUString
& aName
) throw( css::uno::RuntimeException
, std::exception
) override
;
88 // css::container::XElementAccess
89 virtual css::uno::Type SAL_CALL
getElementType() throw( css::uno::RuntimeException
, std::exception
) override
;
90 virtual sal_Bool SAL_CALL
hasElements() throw( css::uno::RuntimeException
, std::exception
) override
;
92 // css::lang::XServiceInfo
93 virtual OUString SAL_CALL
getImplementationName() throw( css::uno::RuntimeException
, std::exception
) override
;
94 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( css::uno::RuntimeException
, std::exception
) override
;
95 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw( css::uno::RuntimeException
, std::exception
) override
;
98 class ScLinkTargetTypeObj
: public ::cppu::WeakImplHelper
<
99 css::beans::XPropertySet
,
100 css::document::XLinkTargetSupplier
,
101 css::lang::XServiceInfo
>,
105 ScDocShell
* pDocShell
;
110 ScLinkTargetTypeObj(ScDocShell
* pDocSh
, sal_uInt16 nT
);
111 virtual ~ScLinkTargetTypeObj() override
;
113 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
115 static void SetLinkTargetBitmap( css::uno::Any
& rRet
, sal_uInt16 nType
);
117 // css::beans::XPropertySet
118 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw( css::uno::RuntimeException
, std::exception
) override
;
119 virtual void SAL_CALL
setPropertyValue(const OUString
& aPropertyName
,
120 const css::uno::Any
& aValue
)
121 throw( css::beans::UnknownPropertyException
,
122 css::beans::PropertyVetoException
,
123 css::lang::IllegalArgumentException
,
124 css::lang::WrappedTargetException
,
125 css::uno::RuntimeException
, std::exception
) override
;
126 virtual css::uno::Any SAL_CALL
getPropertyValue(const OUString
& PropertyName
)
127 throw( css::beans::UnknownPropertyException
,
128 css::lang::WrappedTargetException
,
129 css::uno::RuntimeException
, std::exception
) override
;
130 virtual void SAL_CALL
addPropertyChangeListener(const OUString
& aPropertyName
,
131 const css::uno::Reference
< css::beans::XPropertyChangeListener
> & xListener
)
132 throw( css::beans::UnknownPropertyException
,
133 css::lang::WrappedTargetException
,
134 css::uno::RuntimeException
, std::exception
) override
;
135 virtual void SAL_CALL
removePropertyChangeListener(const OUString
& aPropertyName
,
136 const css::uno::Reference
< css::beans::XPropertyChangeListener
> & aListener
)
137 throw( css::beans::UnknownPropertyException
,
138 css::lang::WrappedTargetException
,
139 css::uno::RuntimeException
, std::exception
) override
;
140 virtual void SAL_CALL
addVetoableChangeListener(const OUString
& PropertyName
,
141 const css::uno::Reference
< css::beans::XVetoableChangeListener
> & aListener
)
142 throw( css::beans::UnknownPropertyException
,
143 css::lang::WrappedTargetException
,
144 css::uno::RuntimeException
, std::exception
) override
;
145 virtual void SAL_CALL
removeVetoableChangeListener(const OUString
& PropertyName
,
146 const css::uno::Reference
< css::beans::XVetoableChangeListener
> & aListener
)
147 throw( css::beans::UnknownPropertyException
,
148 css::lang::WrappedTargetException
,
149 css::uno::RuntimeException
, std::exception
) override
;
151 // css::document::XLinkTargetSupplier
152 virtual css::uno::Reference
< css::container::XNameAccess
> SAL_CALL
getLinks() throw( css::uno::RuntimeException
, std::exception
) override
;
154 // css::lang::XServiceInfo
155 virtual OUString SAL_CALL
getImplementationName() throw( css::uno::RuntimeException
, std::exception
) override
;
156 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( css::uno::RuntimeException
, std::exception
) override
;
157 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw( css::uno::RuntimeException
, std::exception
) override
;
160 class ScLinkTargetsObj
: public ::cppu::WeakImplHelper
<
161 css::container::XNameAccess
,
162 css::lang::XServiceInfo
>
165 css::uno::Reference
< css::container::XNameAccess
> xCollection
;
168 ScLinkTargetsObj( const css::uno::Reference
< css::container::XNameAccess
> & rColl
);
169 virtual ~ScLinkTargetsObj() override
;
171 // css::container::XNameAccess
172 virtual css::uno::Any SAL_CALL
getByName(const OUString
& aName
)
173 throw( css::container::NoSuchElementException
,
174 css::lang::WrappedTargetException
,
175 css::uno::RuntimeException
, std::exception
) override
;
176 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() throw( css::uno::RuntimeException
, std::exception
) override
;
177 virtual sal_Bool SAL_CALL
hasByName(const OUString
& aName
) throw( css::uno::RuntimeException
, std::exception
) override
;
179 // css::container::XElementAccess
180 virtual css::uno::Type SAL_CALL
getElementType() throw( css::uno::RuntimeException
, std::exception
) override
;
181 virtual sal_Bool SAL_CALL
hasElements() throw( css::uno::RuntimeException
, std::exception
) override
;
183 // css::lang::XServiceInfo
184 virtual OUString SAL_CALL
getImplementationName() throw( css::uno::RuntimeException
, std::exception
) override
;
185 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( css::uno::RuntimeException
, std::exception
) override
;
186 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw( css::uno::RuntimeException
, std::exception
) override
;
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */