GPU-Calc: remove Alloc_Host_Ptr for clmem of NAN vector
[LibreOffice.git] / sc / source / ui / vba / vbahyperlinks.hxx
blobdbd1cd2f9d889f18d9c6e87ce55e8e527057044f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 SC_VBA_HYPERLINKS_HXX
21 #define SC_VBA_HYPERLINKS_HXX
23 #include <ooo/vba/excel/XHyperlinks.hpp>
24 #include <rtl/ref.hxx>
25 #include <vbahelper/vbacollectionimpl.hxx>
27 class ScRangeList;
29 // ============================================================================
31 namespace detail {
33 class ScVbaHlinkContainer;
34 typedef ::rtl::Reference< ScVbaHlinkContainer > ScVbaHlinkContainerRef;
36 /** Base class for ScVbaHyperlinks to get an initialized ScVbaHlinkContainer
37 class member before the ScVbaHyperlinks_BASE base class will be constructed.
39 struct ScVbaHlinkContainerMember
41 ScVbaHlinkContainerRef mxContainer;
43 explicit ScVbaHlinkContainerMember( ScVbaHlinkContainer* pContainer );
44 ~ScVbaHlinkContainerMember();
47 } // namespace detail
49 // ============================================================================
51 class ScVbaHyperlinks;
52 typedef ::rtl::Reference< ScVbaHyperlinks > ScVbaHyperlinksRef;
54 typedef CollTestImplHelper< ov::excel::XHyperlinks > ScVbaHyperlinks_BASE;
56 /** Represents a collection of hyperlinks of a worksheet or of a range.
58 When a Hyperlinks collection object has been constructed from a VBA
59 Worksheet object, it will always represent the current set of all
60 hyperlinks existing in the sheet. Insertion and deletion of hyperlinks will
61 be reflected by the instance.
63 When a Hyperlinks collection object has been constructed from a VBA Range
64 object, it will represent the set of hyperlinks that have existed at its
65 construction time, and that are located completely inside the range(s)
66 represented by the Range object. Insertion and deletion of hyperlinks will
67 *not* be reflected by that instance. The instance will always offer all
68 hyperlinks it has been constructed with, even if they no longer exist.
69 Furthermore, the instance will not offer hyperlinks inserted later, even if
70 the instance itself has been used to insert the new hyperlinks.
72 VBA code example:
74 With ThisWorkbook.Worksheets(1)
76 Set hlinks = .Hyperlinks ' global Hyperlinks object
77 Set myrange = .Range("A1:C3")
78 Set rangelinks1 = myrange.Hyperlinks ' hyperlinks of range A1:C3
80 MsgBox hlinks.Count ' 0
81 MsgBox rangelinks1.Count ' 0
83 hlinks.Add .Range("A1"), "http://example.com"
84 ' a new hyperlink has been added in cell A1
86 MsgBox hlinks.Count ' 1
87 MsgBox rangelinks1.Count ' still 0!
88 Set rangelinks2 = myrange.Hyperlinks ' hyperlinks of range A1:C3
89 MsgBox rangelinks2.Count ' 1 (constructed after Add)
91 rangelinks1.Add .Range("A2"), "http://example.com"
92 ' a new hyperlink has been constructed via the rangelinks1 object
93 ' but this addition has been done by the worksheet Hyperlinks object
95 MsgBox hlinks.Count ' 2
96 MsgBox rangelinks1.Count ' still 0!!!
97 MsgBox rangelinks2.Count ' still 1!!!
98 MsgBox myrange.Hyperlinks.Count ' 2 (constructed after Add)
100 End With
102 class ScVbaHyperlinks : private detail::ScVbaHlinkContainerMember, public ScVbaHyperlinks_BASE
104 public:
105 explicit ScVbaHyperlinks(
106 const css::uno::Reference< ov::XHelperInterface >& rxParent,
107 const css::uno::Reference< css::uno::XComponentContext >& rxContext ) throw (css::uno::RuntimeException);
109 explicit ScVbaHyperlinks(
110 const css::uno::Reference< ov::XHelperInterface >& rxParent,
111 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
112 const ScVbaHyperlinksRef& rxSheetHlinks, const ScRangeList& rScRanges ) throw (css::uno::RuntimeException);
114 virtual ~ScVbaHyperlinks();
116 // XHyperlinks
117 virtual css::uno::Reference< ov::excel::XHyperlink > SAL_CALL Add(
118 const css::uno::Any& rAnchor, const css::uno::Any& rAddress, const css::uno::Any& rSubAddress,
119 const css::uno::Any& rScreenTip, const css::uno::Any& rTextToDisplay )
120 throw (css::uno::RuntimeException);
122 virtual void SAL_CALL Delete() throw (css::uno::RuntimeException);
124 // XEnumerationAccess
125 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
127 // XElementAccess
128 virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
130 // ScVbaCollectionBase
131 virtual css::uno::Any createCollectionObject( const css::uno::Any& rSource );
133 // XHelperInterface
134 VBAHELPER_DECL_XHELPERINTERFACE
136 private:
137 ScVbaHyperlinksRef mxSheetHlinks;
140 // ============================================================================
142 #endif
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */