LibreOffice Module sc (master)  1
targuno.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SC_INC_TARGUNO_HXX
21 #define INCLUDED_SC_INC_TARGUNO_HXX
22 
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>
29 
30 namespace com::sun::star::beans { class XPropertyChangeListener; }
31 namespace com::sun::star::beans { class XPropertySetInfo; }
32 namespace com::sun::star::beans { class XVetoableChangeListener; }
33 
34 class ScDocShell;
35 
36 #define SC_LINKTARGETTYPE_SHEET 0
37 #define SC_LINKTARGETTYPE_RANGENAME 1
38 #define SC_LINKTARGETTYPE_DBAREA 2
39 
40 #define SC_LINKTARGETTYPE_COUNT 3
41 
42 #define SCLINKTARGET_SERVICE "com.sun.star.document.LinkTarget"
43 
45 
46 class ScLinkTargetTypesObj final : public ::cppu::WeakImplHelper<
47  css::container::XNameAccess,
48  css::lang::XServiceInfo >,
49  public SfxListener
50 {
51 private:
54 
55 public:
57  virtual ~ScLinkTargetTypesObj() override;
58 
59  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
60 
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;
65 
66  // css::container::XElementAccess
67  virtual css::uno::Type SAL_CALL getElementType() override;
68  virtual sal_Bool SAL_CALL hasElements() override;
69 
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;
74 };
75 
76 class ScLinkTargetTypeObj final : public ::cppu::WeakImplHelper<
77  css::beans::XPropertySet,
78  css::document::XLinkTargetSupplier,
79  css::lang::XServiceInfo >,
80  public SfxListener
81 {
82 private:
84  sal_uInt16 nType;
85  OUString aName;
86 
87 public:
88  ScLinkTargetTypeObj(ScDocShell* pDocSh, sal_uInt16 nT);
89  virtual ~ScLinkTargetTypeObj() override;
90 
91  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
92 
93  static void SetLinkTargetBitmap( css::uno::Any& rRet, sal_uInt16 nType );
94 
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;
108 
109  // css::document::XLinkTargetSupplier
110  virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override;
111 
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;
116 };
117 
118 class ScLinkTargetsObj final : public ::cppu::WeakImplHelper<
119  css::container::XNameAccess,
120  css::lang::XServiceInfo >
121 {
122 private:
123  css::uno::Reference< css::container::XNameAccess > xCollection;
124 
125 public:
126  ScLinkTargetsObj( const css::uno::Reference< css::container::XNameAccess > & rColl );
127  virtual ~ScLinkTargetsObj() override;
128 
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;
133 
134  // css::container::XElementAccess
135  virtual css::uno::Type SAL_CALL getElementType() override;
136  virtual sal_Bool SAL_CALL hasElements() override;
137 
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;
142 };
143 
144 #endif
145 
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: targuno.cxx:192
virtual OUString SAL_CALL getImplementationName() override
virtual OUString SAL_CALL getImplementationName() override
#define SC_LINKTARGETTYPE_COUNT
Definition: targuno.hxx:40
static void SetLinkTargetBitmap(css::uno::Any &rRet, sal_uInt16 nType)
Definition: targuno.cxx:218
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: targuno.cxx:265
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: targuno.cxx:88
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: targuno.cxx:274
virtual ~ScLinkTargetTypesObj() override
Definition: targuno.cxx:80
virtual css::uno::Type SAL_CALL getElementType() override
Definition: targuno.cxx:127
ScLinkTargetsObj(const css::uno::Reference< css::container::XNameAccess > &rColl)
Definition: targuno.cxx:253
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
OUString aNames[SC_LINKTARGETTYPE_COUNT]
Definition: targuno.hxx:53
virtual css::uno::Type SAL_CALL getElementType() override
Definition: targuno.cxx:286
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: targuno.cxx:108
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: targuno.cxx:279
css::uno::Reference< css::container::XNameAccess > xCollection
Definition: targuno.hxx:123
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: targuno.cxx:96
unsigned char sal_Bool
ScDocShell * pDocShell
Definition: targuno.hxx:52
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: targuno.cxx:199
Graphic / OleObject (need separate collections!)
Definition: targuno.hxx:46
virtual ~ScLinkTargetTypeObj() override
Definition: targuno.cxx:145
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: targuno.cxx:153
virtual sal_Bool SAL_CALL hasElements() override
Definition: targuno.cxx:291
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override
Definition: targuno.cxx:161
ScDocShell * pDocShell
Definition: targuno.hxx:83
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: targuno.cxx:117
ScLinkTargetTypeObj(ScDocShell *pDocSh, sal_uInt16 nT)
Definition: targuno.cxx:137
ScLinkTargetTypesObj(ScDocShell *pDocSh)
Definition: targuno.cxx:71
virtual sal_Bool SAL_CALL hasElements() override
Definition: targuno.cxx:132
sal_uInt16 nType
Definition: targuno.hxx:84
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: targuno.cxx:240
virtual ~ScLinkTargetsObj() override
Definition: targuno.cxx:259