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>
28
29namespace com::sun::star::beans { class XPropertyChangeListener; }
30namespace com::sun::star::beans { class XPropertySetInfo; }
31namespace com::sun::star::beans { class XVetoableChangeListener; }
32
33class 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
41inline constexpr OUStringLiteral SCLINKTARGET_SERVICE = u"com.sun.star.document.LinkTarget";
42
44
45class ScLinkTargetTypesObj final : public ::cppu::WeakImplHelper<
46 css::container::XNameAccess,
47 css::lang::XServiceInfo >,
48 public SfxListener
49{
50private:
53
54public:
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
75class ScLinkTargetTypeObj final : public ::cppu::WeakImplHelper<
76 css::beans::XPropertySet,
77 css::document::XLinkTargetSupplier,
78 css::lang::XServiceInfo >,
79 public SfxListener
80{
81private:
83 sal_uInt16 nType;
84 OUString aName;
85
86public:
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
117class ScLinkTargetsObj final : public ::cppu::WeakImplHelper<
118 css::container::XNameAccess,
119 css::lang::XServiceInfo >
120{
121private:
122 css::uno::Reference< css::container::XNameAccess > xCollection;
123
124public:
125 ScLinkTargetsObj( css::uno::Reference< css::container::XNameAccess > xColl );
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 ~ScLinkTargetTypeObj() override
Definition: targuno.cxx:143
virtual OUString SAL_CALL getImplementationName() override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: targuno.cxx:151
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: targuno.cxx:237
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
ScDocShell * pDocShell
Definition: targuno.hxx:82
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: targuno.cxx:196
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getLinks() override
Definition: targuno.cxx:159
static void SetLinkTargetBitmap(css::uno::Any &rRet, sal_uInt16 nType)
Definition: targuno.cxx:215
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: targuno.cxx:190
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
ScLinkTargetTypeObj(ScDocShell *pDocSh, sal_uInt16 nT)
Definition: targuno.cxx:135
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
sal_uInt16 nType
Definition: targuno.hxx:83
Graphic / OleObject (need separate collections!)
Definition: targuno.hxx:49
ScLinkTargetTypesObj(ScDocShell *pDocSh)
Definition: targuno.cxx:69
virtual ~ScLinkTargetTypesObj() override
Definition: targuno.cxx:78
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: targuno.cxx:106
ScDocShell * pDocShell
Definition: targuno.hxx:51
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: targuno.cxx:94
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
OUString aNames[SC_LINKTARGETTYPE_COUNT]
Definition: targuno.hxx:52
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL hasElements() override
Definition: targuno.cxx:130
virtual css::uno::Type SAL_CALL getElementType() override
Definition: targuno.cxx:125
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: targuno.cxx:86
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: targuno.cxx:115
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: targuno.cxx:271
ScLinkTargetsObj(css::uno::Reference< css::container::XNameAccess > xColl)
Definition: targuno.cxx:250
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Type SAL_CALL getElementType() override
Definition: targuno.cxx:283
virtual sal_Bool SAL_CALL hasElements() override
Definition: targuno.cxx:288
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: targuno.cxx:262
virtual ~ScLinkTargetsObj() override
Definition: targuno.cxx:256
css::uno::Reference< css::container::XNameAccess > xCollection
Definition: targuno.hxx:122
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: targuno.cxx:276
float u
constexpr OUStringLiteral SCLINKTARGET_SERVICE
Definition: targuno.hxx:41
#define SC_LINKTARGETTYPE_COUNT
Definition: targuno.hxx:39
unsigned char sal_Bool