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/XServiceInfo.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/container/XNameAccess.hpp>
28 #include <cppuhelper/implbase.hxx>
30 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{ class XPropertyChangeListener
; } } } }
31 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{ class XPropertySetInfo
; } } } }
32 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{ class XVetoableChangeListener
; } } } }
36 #define SC_LINKTARGETTYPE_SHEET 0
37 #define SC_LINKTARGETTYPE_RANGENAME 1
38 #define SC_LINKTARGETTYPE_DBAREA 2
40 #define SC_LINKTARGETTYPE_COUNT 3
42 #define SCLINKTARGET_SERVICE "com.sun.star.document.LinkTarget"
44 //! Graphic / OleObject (need separate collections!)
46 class ScLinkTargetTypesObj final
: public ::cppu::WeakImplHelper
<
47 css::container::XNameAccess
,
48 css::lang::XServiceInfo
>,
52 ScDocShell
* pDocShell
;
53 OUString aNames
[SC_LINKTARGETTYPE_COUNT
];
56 ScLinkTargetTypesObj(ScDocShell
* pDocSh
);
57 virtual ~ScLinkTargetTypesObj() override
;
59 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
61 // css::container::XNameAccess
62 virtual css::uno::Any SAL_CALL
getByName(const OUString
& aName
) override
;
63 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
64 virtual sal_Bool SAL_CALL
hasByName(const OUString
& aName
) override
;
66 // css::container::XElementAccess
67 virtual css::uno::Type SAL_CALL
getElementType() override
;
68 virtual sal_Bool SAL_CALL
hasElements() override
;
70 // css::lang::XServiceInfo
71 virtual OUString SAL_CALL
getImplementationName() override
;
72 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
73 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
76 class ScLinkTargetTypeObj final
: public ::cppu::WeakImplHelper
<
77 css::beans::XPropertySet
,
78 css::document::XLinkTargetSupplier
,
79 css::lang::XServiceInfo
>,
83 ScDocShell
* pDocShell
;
84 sal_uInt16
const nType
;
88 ScLinkTargetTypeObj(ScDocShell
* pDocSh
, sal_uInt16 nT
);
89 virtual ~ScLinkTargetTypeObj() override
;
91 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
93 static void SetLinkTargetBitmap( css::uno::Any
& rRet
, sal_uInt16 nType
);
95 // css::beans::XPropertySet
96 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
;
97 virtual void SAL_CALL
setPropertyValue(const OUString
& aPropertyName
,
98 const css::uno::Any
& aValue
) override
;
99 virtual css::uno::Any SAL_CALL
getPropertyValue(const OUString
& PropertyName
) override
;
100 virtual void SAL_CALL
addPropertyChangeListener(const OUString
& aPropertyName
,
101 const css::uno::Reference
< css::beans::XPropertyChangeListener
> & xListener
) override
;
102 virtual void SAL_CALL
removePropertyChangeListener(const OUString
& aPropertyName
,
103 const css::uno::Reference
< css::beans::XPropertyChangeListener
> & aListener
) override
;
104 virtual void SAL_CALL
addVetoableChangeListener(const OUString
& PropertyName
,
105 const css::uno::Reference
< css::beans::XVetoableChangeListener
> & aListener
) override
;
106 virtual void SAL_CALL
removeVetoableChangeListener(const OUString
& PropertyName
,
107 const css::uno::Reference
< css::beans::XVetoableChangeListener
> & aListener
) override
;
109 // css::document::XLinkTargetSupplier
110 virtual css::uno::Reference
< css::container::XNameAccess
> SAL_CALL
getLinks() override
;
112 // css::lang::XServiceInfo
113 virtual OUString SAL_CALL
getImplementationName() override
;
114 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
115 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
118 class ScLinkTargetsObj final
: public ::cppu::WeakImplHelper
<
119 css::container::XNameAccess
,
120 css::lang::XServiceInfo
>
123 css::uno::Reference
< css::container::XNameAccess
> xCollection
;
126 ScLinkTargetsObj( const css::uno::Reference
< css::container::XNameAccess
> & rColl
);
127 virtual ~ScLinkTargetsObj() override
;
129 // css::container::XNameAccess
130 virtual css::uno::Any SAL_CALL
getByName(const OUString
& aName
) override
;
131 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
132 virtual sal_Bool SAL_CALL
hasByName(const OUString
& aName
) override
;
134 // css::container::XElementAccess
135 virtual css::uno::Type SAL_CALL
getElementType() override
;
136 virtual sal_Bool SAL_CALL
hasElements() override
;
138 // css::lang::XServiceInfo
139 virtual OUString SAL_CALL
getImplementationName() override
;
140 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
141 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */