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