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 #pragma once
21 
22 #include <svl/lstner.hxx>
23 #include <com/sun/star/document/XLinkTargetSupplier.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/container/XNameAccess.hpp>
27 #include <cppuhelper/implbase.hxx>
28 
29 namespace com::sun::star::beans { class XPropertyChangeListener; }
30 namespace com::sun::star::beans { class XPropertySetInfo; }
31 namespace com::sun::star::beans { class XVetoableChangeListener; }
32 
33 class ScDocShell;
34 
35 #define SC_LINKTARGETTYPE_SHEET 0
36 #define SC_LINKTARGETTYPE_RANGENAME 1
37 #define SC_LINKTARGETTYPE_DBAREA 2
38 
39 #define SC_LINKTARGETTYPE_COUNT 3
40 
41 #define SCLINKTARGET_SERVICE "com.sun.star.document.LinkTarget"
42 
44 
45 class ScLinkTargetTypesObj final : public ::cppu::WeakImplHelper<
46  css::container::XNameAccess,
47  css::lang::XServiceInfo >,
48  public SfxListener
49 {
50 private:
53 
54 public:
56  virtual ~ScLinkTargetTypesObj() override;
57 
58  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
59 
60  // css::container::XNameAccess
61  virtual css::uno::Any SAL_CALL getByName(const OUString& aName) override;
62  virtual css::uno::Sequence< OUString> SAL_CALL getElementNames() override;
63  virtual sal_Bool SAL_CALL hasByName(const OUString& aName) override;
64 
65  // css::container::XElementAccess
66  virtual css::uno::Type SAL_CALL getElementType() override;
67  virtual sal_Bool SAL_CALL hasElements() override;
68 
69  // css::lang::XServiceInfo
70  virtual OUString SAL_CALL getImplementationName() override;
71  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
72  virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override;
73 };
74 
75 class ScLinkTargetTypeObj final : public ::cppu::WeakImplHelper<
76  css::beans::XPropertySet,
77  css::document::XLinkTargetSupplier,
78  css::lang::XServiceInfo >,
79  public SfxListener
80 {
81 private:
83  sal_uInt16 nType;
84  OUString aName;
85 
86 public:
87  ScLinkTargetTypeObj(ScDocShell* pDocSh, sal_uInt16 nT);
88  virtual ~ScLinkTargetTypeObj() override;
89 
90  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
91 
92  static void SetLinkTargetBitmap( css::uno::Any& rRet, sal_uInt16 nType );
93 
94  // css::beans::XPropertySet
95  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
96  virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName,
97  const css::uno::Any& aValue) override;
98  virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName) override;
99  virtual void SAL_CALL addPropertyChangeListener(const OUString& aPropertyName,
100  const css::uno::Reference< css::beans::XPropertyChangeListener > & xListener) override;
101  virtual void SAL_CALL removePropertyChangeListener(const OUString& aPropertyName,
102  const css::uno::Reference< css::beans::XPropertyChangeListener > & aListener) override;
103  virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName,
104  const css::uno::Reference< css::beans::XVetoableChangeListener > & aListener) override;
105  virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName,
106  const css::uno::Reference< css::beans::XVetoableChangeListener > & aListener) override;
107 
108  // css::document::XLinkTargetSupplier
109  virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override;
110 
111  // css::lang::XServiceInfo
112  virtual OUString SAL_CALL getImplementationName() override;
113  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
114  virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override;
115 };
116 
117 class ScLinkTargetsObj final : public ::cppu::WeakImplHelper<
118  css::container::XNameAccess,
119  css::lang::XServiceInfo >
120 {
121 private:
122  css::uno::Reference< css::container::XNameAccess > xCollection;
123 
124 public:
125  ScLinkTargetsObj( const css::uno::Reference< css::container::XNameAccess > & rColl );
126  virtual ~ScLinkTargetsObj() override;
127 
128  // css::container::XNameAccess
129  virtual css::uno::Any SAL_CALL getByName(const OUString& aName) override;
130  virtual css::uno::Sequence< OUString> SAL_CALL getElementNames() override;
131  virtual sal_Bool SAL_CALL hasByName(const OUString& aName) override;
132 
133  // css::container::XElementAccess
134  virtual css::uno::Type SAL_CALL getElementType() override;
135  virtual sal_Bool SAL_CALL hasElements() override;
136 
137  // css::lang::XServiceInfo
138  virtual OUString SAL_CALL getImplementationName() override;
139  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
140  virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override;
141 };
142 
143 /* 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:39
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:52
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:122
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:51
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:45
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:82
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:83
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