fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / vba / vbahyperlinks.hxx
blob03325fe5aff3754b8f9bbe497a57c879841d2639
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 INCLUDED_SC_SOURCE_UI_VBA_VBAHYPERLINKS_HXX
21 #define INCLUDED_SC_SOURCE_UI_VBA_VBAHYPERLINKS_HXX
23 #include <ooo/vba/excel/XHyperlinks.hpp>
24 #include <rtl/ref.hxx>
25 #include <vbahelper/vbacollectionimpl.hxx>
27 class ScRangeList;
29 namespace detail {
31 class ScVbaHlinkContainer;
32 typedef ::rtl::Reference< ScVbaHlinkContainer > ScVbaHlinkContainerRef;
34 /** Base class for ScVbaHyperlinks to get an initialized ScVbaHlinkContainer
35 class member before the ScVbaHyperlinks_BASE base class will be constructed.
37 struct ScVbaHlinkContainerMember
39 ScVbaHlinkContainerRef mxContainer;
41 explicit ScVbaHlinkContainerMember( ScVbaHlinkContainer* pContainer );
42 ~ScVbaHlinkContainerMember();
45 } // namespace detail
47 class ScVbaHyperlinks;
48 typedef ::rtl::Reference< ScVbaHyperlinks > ScVbaHyperlinksRef;
50 typedef CollTestImplHelper< ov::excel::XHyperlinks > ScVbaHyperlinks_BASE;
52 /** Represents a collection of hyperlinks of a worksheet or of a range.
54 When a Hyperlinks collection object has been constructed from a VBA
55 Worksheet object, it will always represent the current set of all
56 hyperlinks existing in the sheet. Insertion and deletion of hyperlinks will
57 be reflected by the instance.
59 When a Hyperlinks collection object has been constructed from a VBA Range
60 object, it will represent the set of hyperlinks that have existed at its
61 construction time, and that are located completely inside the range(s)
62 represented by the Range object. Insertion and deletion of hyperlinks will
63 *not* be reflected by that instance. The instance will always offer all
64 hyperlinks it has been constructed with, even if they no longer exist.
65 Furthermore, the instance will not offer hyperlinks inserted later, even if
66 the instance itself has been used to insert the new hyperlinks.
68 VBA code example:
70 With ThisWorkbook.Worksheets(1)
72 Set hlinks = .Hyperlinks ' global Hyperlinks object
73 Set myrange = .Range("A1:C3")
74 Set rangelinks1 = myrange.Hyperlinks ' hyperlinks of range A1:C3
76 MsgBox hlinks.Count ' 0
77 MsgBox rangelinks1.Count ' 0
79 hlinks.Add .Range("A1"), "http://example.com"
80 ' a new hyperlink has been added in cell A1
82 MsgBox hlinks.Count ' 1
83 MsgBox rangelinks1.Count ' still 0!
84 Set rangelinks2 = myrange.Hyperlinks ' hyperlinks of range A1:C3
85 MsgBox rangelinks2.Count ' 1 (constructed after Add)
87 rangelinks1.Add .Range("A2"), "http://example.com"
88 ' a new hyperlink has been constructed via the rangelinks1 object
89 ' but this addition has been done by the worksheet Hyperlinks object
91 MsgBox hlinks.Count ' 2
92 MsgBox rangelinks1.Count ' still 0!!!
93 MsgBox rangelinks2.Count ' still 1!!!
94 MsgBox myrange.Hyperlinks.Count ' 2 (constructed after Add)
96 End With
98 class ScVbaHyperlinks : private detail::ScVbaHlinkContainerMember, public ScVbaHyperlinks_BASE
100 public:
101 explicit ScVbaHyperlinks(
102 const css::uno::Reference< ov::XHelperInterface >& rxParent,
103 const css::uno::Reference< css::uno::XComponentContext >& rxContext ) throw (css::uno::RuntimeException);
105 explicit ScVbaHyperlinks(
106 const css::uno::Reference< ov::XHelperInterface >& rxParent,
107 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
108 const ScVbaHyperlinksRef& rxSheetHlinks, const ScRangeList& rScRanges ) throw (css::uno::RuntimeException);
110 virtual ~ScVbaHyperlinks();
112 // XHyperlinks
113 virtual css::uno::Reference< ov::excel::XHyperlink > SAL_CALL Add(
114 const css::uno::Any& rAnchor, const css::uno::Any& rAddress, const css::uno::Any& rSubAddress,
115 const css::uno::Any& rScreenTip, const css::uno::Any& rTextToDisplay )
116 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 virtual void SAL_CALL Delete() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 // XEnumerationAccess
121 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) SAL_OVERRIDE;
123 // XElementAccess
124 virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) SAL_OVERRIDE;
126 // ScVbaCollectionBase
127 virtual css::uno::Any createCollectionObject( const css::uno::Any& rSource ) SAL_OVERRIDE;
129 // XHelperInterface
130 VBAHELPER_DECL_XHELPERINTERFACE
132 private:
133 ScVbaHyperlinksRef mxSheetHlinks;
136 #endif
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */