1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24#ifndef __com_sun_star_sheet_XNamedRanges_idl__ 25#define __com_sun_star_sheet_XNamedRanges_idl__ 26 27#ifndef __com_sun_star_container_XNameAccess_idl__ 28#include <com/sun/star/container/XNameAccess.idl> 29#endif 30 31#ifndef __com_sun_star_table_CellAddress_idl__ 32#include <com/sun/star/table/CellAddress.idl> 33#endif 34 35#ifndef __com_sun_star_table_CellRangeAddress_idl__ 36#include <com/sun/star/table/CellRangeAddress.idl> 37#endif 38 39#ifndef __com_sun_star_sheet_Border_idl__ 40#include <com/sun/star/sheet/Border.idl> 41#endif 42 43//============================================================================= 44 45module com { module sun { module star { module sheet { 46 47 48published struct RangeScopeName 49{ 50 //------------------------------------------------------------------------- 51 52 /** is the OpCode of the token. 53 54 @see com::sun::star::sheet::XFormulaOpCodeMapper 55 */ 56 string ScopeName; 57 58 //------------------------------------------------------------------------- 59 60 /** is additional data in the token, depending on the OpCode. 61 62 @see com::sun::star::sheet::NamedRange::TokenIndex 63 @see com::sun::star::sheet::DatabaseRange::TokenIndex 64 */ 65 string RangeName; 66}; 67//============================================================================= 68 69/** provides access to the members in a collection of named ranges and to 70 insert and remove them. 71 72 @see com::sun::star::sheet::NamedRanges 73 @see com::sun::star::sheet::NamedRange 74 */ 75published interface XNamedRanges: com::sun::star::container::XNameAccess 76{ 77 //------------------------------------------------------------------------- 78 79 /** adds a new named range to the collection. 80 81 @param aName 82 the new name of the named range. 83 84 @param aContent 85 the formula expression. 86 87 <p>A cell range address is one possible content of a named 88 range.</p> 89 90 @param aPosition 91 specifies the base address for relative cell references. 92 93 @param nType 94 a combination of flags that specify the type of a named range, 95 as defined in <type>NamedRangeFlag</type>. 96 97 <p>This parameter will be zero for any common named range.</p> 98 */ 99 void addNewByName( 100 [in] string aName, 101 [in] string aContent, 102 [in] com::sun::star::table::CellAddress aPosition, 103 [in] long nType ); 104 105 //------------------------------------------------------------------------- 106 107 /** creates named cell ranges from titles in a cell range. 108 109 <p>The names for the named ranges are taken from title cells in the 110 top or bottom row, or from the cells of the left or right column 111 of the range (depending on the parameter <const>aBorder</const>. 112 The named ranges refer to single columns or rows in the inner 113 part of the original range, excluding the labels.</p> 114 115 <p>Example: The source range is A1:B3. The named ranges shall be 116 created using row titles. This requires <member>Border::TOP</member> 117 for the second parameter. The method creates two named ranges. The 118 name of the first is equal to the content of cell A1 and contains the 119 range $Sheet.$A$2:$A$3 (excluding the title cell). The latter named 120 range is named using cell B1 and contains the cell range address 121 $Sheet.$B$2:$B$3.</p> 122 123 @param aSource 124 the cell range used to create the named ranges. 125 126 @param aBorder 127 specifies the location of the title cells. 128 */ 129 void addNewFromTitles( 130 [in] com::sun::star::table::CellRangeAddress aSource, 131 [in] com::sun::star::sheet::Border aBorder ); 132 133 //------------------------------------------------------------------------- 134 135 /** removes a named range from the collection. 136 */ 137 void removeByName( [in] string aName ); 138 139 //------------------------------------------------------------------------- 140 141 /** writes a list of all named ranges into the document. 142 143 <p>The first column of the list contains the names. The second 144 column contains the contents of the named ranges.</p> 145 146 @param aOutputPosition 147 specifies the top left cell of the output range. 148 */ 149 void outputList( [in] com::sun::star::table::CellAddress aOutputPosition ); 150 151 void addNewByScopeName( 152 [in] string aScopeName, 153 [in] string aRangeName, 154 [in] string aContent, 155 [in] com::sun::star::table::CellAddress aPosition, 156 [in] long nType ); 157 158 void removeByScopeName( [in] string aScopeName, [in] string aRangeName ); 159 160 boolean hasByScopeName( [in] string aScopeName, [in] string aRangeName ); 161 162 any getByScopeName( [in] string aScopeName, [in] string aRangeName ) 163 raises( com::sun::star::container::NoSuchElementException, 164 com::sun::star::lang::WrappedTargetException ); 165 166 sequence<RangeScopeName> getElementScopeNames(); 167 168}; 169 170//============================================================================= 171 172}; }; }; }; 173 174#endif 175 176