LibreOffice Module sc (master) 1
rangeutl.cxx
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#include <memory>
21#include <osl/diagnose.h>
23#include <rangeutl.hxx>
24#include <document.hxx>
25#include <global.hxx>
26#include <dbdata.hxx>
27#include <rangenam.hxx>
28#include <convuno.hxx>
29#include <externalrefmgr.hxx>
30#include <compiler.hxx>
31#include <refupdatecontext.hxx>
32
33using ::formula::FormulaGrammar;
34using namespace ::com::sun::star;
35
36bool ScRangeUtil::MakeArea( const OUString& rAreaStr,
37 ScArea& rArea,
38 const ScDocument& rDoc,
39 SCTAB nTab,
40 ScAddress::Details const & rDetails )
41{
42 // Input in rAreaStr: "$Tabelle1.$A1:$D17"
43
44 // BROKEN BROKEN BROKEN
45 // but it is only used in the consolidate dialog. Ignore for now.
46
47 bool bSuccess = false;
48 sal_Int32 nPointPos = rAreaStr.indexOf('.');
49 sal_Int32 nColonPos = rAreaStr.indexOf(':');
50 OUString aStrArea( rAreaStr );
51 ScRefAddress startPos;
52 ScRefAddress endPos;
53
54 if ( nColonPos == -1 && nPointPos != -1 )
55 {
56 aStrArea += OUString::Concat(":") + rAreaStr.subView( nPointPos+1 ); // do not include '.' in copy
57 }
58
59 bSuccess = ConvertDoubleRef( rDoc, aStrArea, nTab, startPos, endPos, rDetails );
60
61 if ( bSuccess )
62 rArea = ScArea( startPos.Tab(),
63 startPos.Col(), startPos.Row(),
64 endPos.Col(), endPos.Row() );
65
66 return bSuccess;
67}
68
69void ScRangeUtil::CutPosString( const OUString& theAreaStr,
70 OUString& thePosStr )
71{
72 OUString aPosStr;
73 // BROKEN BROKEN BROKEN
74 // but it is only used in the consolidate dialog. Ignore for now.
75
76 sal_Int32 nColonPos = theAreaStr.indexOf(':');
77
78 if ( nColonPos != -1 )
79 aPosStr = theAreaStr.copy( 0, nColonPos ); // do not include ':' in copy
80 else
81 aPosStr = theAreaStr;
82
83 thePosStr = aPosStr;
84}
85
86bool ScRangeUtil::IsAbsTabArea( const OUString& rAreaStr,
87 const ScDocument* pDoc,
88 std::unique_ptr<ScArea[]>* ppAreas,
89 sal_uInt16* pAreaCount,
90 bool /* bAcceptCellRef */,
91 ScAddress::Details const & rDetails )
92{
93 OSL_ENSURE( pDoc, "No document given!" );
94 if ( !pDoc )
95 return false;
96
97 // BROKEN BROKEN BROKEN
98 // but it is only used in the consolidate dialog. Ignore for now.
99
100 /*
101 * Expects strings like:
102 * "$Tabelle1.$A$1:$Tabelle3.$D$17"
103 * If bAcceptCellRef == sal_True then also accept strings like:
104 * "$Tabelle1.$A$1"
105 *
106 * as result a ScArea-Array is created,
107 * which is published via ppAreas and also has to be deleted this route.
108 */
109
110 bool bStrOk = false;
111 OUString aTempAreaStr(rAreaStr);
112
113 if ( -1 == aTempAreaStr.indexOf(':') )
114 {
115 aTempAreaStr += ":" + rAreaStr;
116 }
117
118 sal_Int32 nColonPos = aTempAreaStr.indexOf(':');
119
120 if ( -1 != nColonPos
121 && -1 != aTempAreaStr.indexOf('.') )
122 {
123 ScRefAddress aStartPos;
124
125 OUString aStartPosStr = aTempAreaStr.copy( 0, nColonPos );
126 OUString aEndPosStr = aTempAreaStr.copy( nColonPos+1 );
127
128 if ( ConvertSingleRef( *pDoc, aStartPosStr, 0, aStartPos, rDetails ) )
129 {
130 ScRefAddress aEndPos;
131 if ( ConvertSingleRef( *pDoc, aEndPosStr, aStartPos.Tab(), aEndPos, rDetails ) )
132 {
133 aStartPos.SetRelCol( false );
134 aStartPos.SetRelRow( false );
135 aStartPos.SetRelTab( false );
136 aEndPos.SetRelCol( false );
137 aEndPos.SetRelRow( false );
138 aEndPos.SetRelTab( false );
139
140 bStrOk = true;
141
142 if ( ppAreas && pAreaCount ) // Array returned ?
143 {
144 SCTAB nStartTab = aStartPos.Tab();
145 SCTAB nEndTab = aEndPos.Tab();
146 sal_uInt16 nTabCount = static_cast<sal_uInt16>(nEndTab-nStartTab+1);
147 ppAreas->reset(new ScArea[nTabCount]);
148 SCTAB nTab = 0;
149 sal_uInt16 i = 0;
150 ScArea theArea( 0, aStartPos.Col(), aStartPos.Row(),
151 aEndPos.Col(), aEndPos.Row() );
152
153 nTab = nStartTab;
154 for ( i=0; i<nTabCount; i++ )
155 {
156 (*ppAreas)[i] = theArea;
157 (*ppAreas)[i].nTab = nTab;
158 nTab++;
159 }
160 *pAreaCount = nTabCount;
161 }
162 }
163 }
164 }
165
166 return bStrOk;
167}
168
169bool ScRangeUtil::IsAbsArea( const OUString& rAreaStr,
170 const ScDocument& rDoc,
171 SCTAB nTab,
172 OUString* pCompleteStr,
173 ScRefAddress* pStartPos,
174 ScRefAddress* pEndPos,
175 ScAddress::Details const & rDetails )
176{
177 ScRefAddress startPos;
178 ScRefAddress endPos;
179
180 bool bIsAbsArea = ConvertDoubleRef( rDoc, rAreaStr, nTab, startPos, endPos, rDetails );
181
182 if ( bIsAbsArea )
183 {
184 startPos.SetRelCol( false );
185 startPos.SetRelRow( false );
186 startPos.SetRelTab( false );
187 endPos .SetRelCol( false );
188 endPos .SetRelRow( false );
189 endPos .SetRelTab( false );
190
191 if ( pCompleteStr )
192 {
193 *pCompleteStr = startPos.GetRefString( rDoc, MAXTAB+1, rDetails );
194 *pCompleteStr += ":";
195 *pCompleteStr += endPos.GetRefString( rDoc, nTab, rDetails );
196 }
197
198 if ( pStartPos && pEndPos )
199 {
200 *pStartPos = startPos;
201 *pEndPos = endPos;
202 }
203 }
204
205 return bIsAbsArea;
206}
207
208bool ScRangeUtil::IsAbsPos( const OUString& rPosStr,
209 const ScDocument& rDoc,
210 SCTAB nTab,
211 OUString* pCompleteStr,
212 ScRefAddress* pPosTripel,
213 ScAddress::Details const & rDetails )
214{
215 ScRefAddress thePos;
216
217 bool bIsAbsPos = ConvertSingleRef( rDoc, rPosStr, nTab, thePos, rDetails );
218 thePos.SetRelCol( false );
219 thePos.SetRelRow( false );
220 thePos.SetRelTab( false );
221
222 if ( bIsAbsPos )
223 {
224 if ( pPosTripel )
225 *pPosTripel = thePos;
226 if ( pCompleteStr )
227 *pCompleteStr = thePos.GetRefString( rDoc, MAXTAB+1, rDetails );
228 }
229
230 return bIsAbsPos;
231}
232
234 const OUString& rName,
235 const ScDocument& rDoc,
236 SCTAB nCurTab,
237 ScRange& rRange,
238 RutlNameScope eScope,
239 ScAddress::Details const & rDetails,
240 bool bUseDetailsPos )
241{
242 bool bResult = false;
243 if (rName.isEmpty())
244 return bResult;
245
246 SCTAB nTab = 0;
247 SCCOL nColStart = 0;
248 SCCOL nColEnd = 0;
249 SCROW nRowStart = 0;
250 SCROW nRowEnd = 0;
251
252 if (eScope == RUTL_NAMES || eScope == RUTL_NAMES_LOCAL || eScope == RUTL_NAMES_GLOBAL)
253 {
254 OUString aName(rName);
255 SCTAB nTable = nCurTab;
256
257 if (eScope != RUTL_NAMES_GLOBAL)
258 {
259 // First handle UI names like "local1 (Sheet1)", which point to a
260 // local range name.
261 const sal_Int32 nEndPos = aName.getLength() - 1;
262 if (rName[nEndPos] == ')')
263 {
264 const sal_Int32 nStartPos = aName.indexOf(" (");
265 if (nStartPos != -1)
266 {
267 OUString aSheetName = aName.copy(nStartPos+2, nEndPos-nStartPos-2);
268 if (rDoc.GetTable(aSheetName, nTable))
269 {
270 aName = aName.copy(0, nStartPos);
271 eScope = RUTL_NAMES_LOCAL;
272 }
273 else
274 nTable = nCurTab;
275 }
276 }
277 }
278
280 ScRangeData* pData = nullptr;
281 if (eScope != RUTL_NAMES_GLOBAL)
282 {
283 // Check for local range names.
284 ScRangeName* pRangeNames = rDoc.GetRangeName( nTable );
285 if ( pRangeNames )
286 pData = pRangeNames->findByUpperName(aName);
287 }
288 if (!pData && eScope != RUTL_NAMES_LOCAL)
290 if (pData)
291 {
292 OUString aStrArea;
293 ScRefAddress aStartPos;
294 ScRefAddress aEndPos;
295
296 // tdf#138646: use the current grammar of the document and passed
297 // address convention.
298 // tdf#145077: create range string according to current cell cursor
299 // position if expression has relative references and details say so.
300 if (bUseDetailsPos)
301 aStrArea = pData->GetSymbol( ScAddress( rDetails.nCol, rDetails.nRow, nCurTab),
302 FormulaGrammar::mergeToGrammar(rDoc.GetGrammar(), rDetails.eConv));
303 else
304 aStrArea = pData->GetSymbol(
305 FormulaGrammar::mergeToGrammar(rDoc.GetGrammar(), rDetails.eConv));
306
307 if ( IsAbsArea( aStrArea, rDoc, nTable,
308 nullptr, &aStartPos, &aEndPos, rDetails ) )
309 {
310 nTab = aStartPos.Tab();
311 nColStart = aStartPos.Col();
312 nRowStart = aStartPos.Row();
313 nColEnd = aEndPos.Col();
314 nRowEnd = aEndPos.Row();
315 bResult = true;
316 }
317 else
318 {
319 CutPosString( aStrArea, aStrArea );
320
321 if ( IsAbsPos( aStrArea, rDoc, nTable,
322 nullptr, &aStartPos, rDetails ) )
323 {
324 nTab = aStartPos.Tab();
325 nColStart = nColEnd = aStartPos.Col();
326 nRowStart = nRowEnd = aStartPos.Row();
327 bResult = true;
328 }
329 }
330 }
331 }
332 else if( eScope==RUTL_DBASE )
333 {
335 ScDBData* pData = rDbNames.findByUpperName(ScGlobal::getCharClass().uppercase(rName));
336 if (pData)
337 {
338 pData->GetArea(nTab, nColStart, nRowStart, nColEnd, nRowEnd);
339 bResult = true;
340 }
341 }
342 else
343 {
344 OSL_FAIL( "ScRangeUtil::MakeRangeFromName" );
345 }
346
347 if( bResult )
348 {
349 rRange = ScRange( nColStart, nRowStart, nTab, nColEnd, nRowEnd, nTab );
350 }
351
352 return bResult;
353}
354
356 OUString& rString,
357 const OUString& rNewStr,
358 bool bAppendStr,
359 sal_Unicode cSeparator)
360{
361 if( bAppendStr )
362 {
363 if( !rNewStr.isEmpty() )
364 {
365 if( !rString.isEmpty() )
366 rString += OUStringChar(cSeparator);
367 rString += rNewStr;
368 }
369 }
370 else
371 rString = rNewStr;
372}
373
375 std::u16string_view rString,
376 sal_Unicode cSearchChar,
377 sal_Int32 nOffset,
378 sal_Unicode cQuote )
379{
380 sal_Int32 nLength = rString.size();
381 sal_Int32 nIndex = nOffset;
382 bool bQuoted = false;
383 bool bExitLoop = false;
384
385 while( !bExitLoop && (nIndex >= 0 && nIndex < nLength) )
386 {
387 sal_Unicode cCode = rString[ nIndex ];
388 bExitLoop = (cCode == cSearchChar) && !bQuoted;
389 bQuoted = (bQuoted != (cCode == cQuote));
390 if( !bExitLoop )
391 nIndex++;
392 }
393 return (nIndex < nLength) ? nIndex : -1;
394}
395
397 std::u16string_view rString,
398 sal_Unicode cSearchChar,
399 sal_Int32 nOffset )
400{
401 sal_Int32 nLength = rString.size();
402 sal_Int32 nIndex = nOffset;
403 bool bExitLoop = false;
404
405 while( !bExitLoop && (nIndex >= 0 && nIndex < nLength) )
406 {
407 bExitLoop = (rString[ nIndex ] != cSearchChar);
408 if( !bExitLoop )
409 nIndex++;
410 }
411 return (nIndex < nLength) ? nIndex : -1;
412}
413
415 OUString& rToken,
416 std::u16string_view rString,
417 sal_Int32& nOffset,
418 sal_Unicode cSeparator,
419 sal_Unicode cQuote)
420{
421 sal_Int32 nLength = rString.size();
422 if( nOffset == -1 || nOffset >= nLength )
423 {
424 rToken.clear();
425 nOffset = -1;
426 }
427 else
428 {
429 sal_Int32 nTokenEnd = IndexOf( rString, cSeparator, nOffset, cQuote );
430 if( nTokenEnd < 0 )
431 nTokenEnd = nLength;
432 rToken = rString.substr( nOffset, nTokenEnd - nOffset );
433
434 sal_Int32 nNextBegin = IndexOfDifferent( rString, cSeparator, nTokenEnd );
435 nOffset = (nNextBegin < 0) ? nLength : nNextBegin;
436 }
437}
438
439void ScRangeStringConverter::AppendTableName(OUStringBuffer& rBuf, const OUString& rTabName)
440{
441 // quote character is always "'"
442 OUString aQuotedTab(rTabName);
443 ScCompiler::CheckTabQuotes(aQuotedTab);
444 rBuf.append(aQuotedTab);
445}
446
447sal_Int32 ScRangeStringConverter::GetTokenCount( std::u16string_view rString, sal_Unicode cSeparator )
448{
449 OUString sToken;
450 sal_Int32 nCount = 0;
451 sal_Int32 nOffset = 0;
452 while( nOffset >= 0 )
453 {
454 GetTokenByOffset( sToken, rString, nOffset, '\'', cSeparator );
455 if( nOffset >= 0 )
456 nCount++;
457 }
458 return nCount;
459}
460
462 ScAddress& rAddress,
463 std::u16string_view rAddressStr,
464 const ScDocument& rDocument,
465 FormulaGrammar::AddressConvention eConv,
466 sal_Int32& nOffset,
467 sal_Unicode cSeparator,
468 sal_Unicode cQuote )
469{
470 OUString sToken;
471 GetTokenByOffset( sToken, rAddressStr, nOffset, cSeparator, cQuote );
472 if( nOffset >= 0 )
473 {
474 if ((rAddress.Parse( sToken, rDocument, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID)
475 return true;
477 if (eConv != eConvUI)
478 return ((rAddress.Parse(sToken, rDocument, eConvUI) & ScRefFlags::VALID) == ScRefFlags::VALID);
479 }
480 return false;
481}
482
484 ScRange& rRange,
485 std::u16string_view rRangeStr,
486 const ScDocument& rDocument,
487 FormulaGrammar::AddressConvention eConv,
488 sal_Int32& nOffset,
489 sal_Unicode cSeparator,
490 sal_Unicode cQuote )
491{
492 OUString sToken;
493 bool bResult(false);
494 GetTokenByOffset( sToken, rRangeStr, nOffset, cSeparator, cQuote );
495 if( nOffset >= 0 )
496 {
497 sal_Int32 nIndex = IndexOf( sToken, ':', 0, cQuote );
498 OUString aUIString(sToken);
499
500 if( nIndex < 0 )
501 {
502 if ( aUIString[0] == '.' )
503 aUIString = aUIString.copy( 1 );
504 bResult = (rRange.aStart.Parse( aUIString, rDocument, eConv) & ScRefFlags::VALID) ==
507 if (!bResult && eConv != eConvUI)
508 bResult = (rRange.aStart.Parse(aUIString, rDocument, eConvUI) & ScRefFlags::VALID) ==
510 rRange.aEnd = rRange.aStart;
511 }
512 else
513 {
514 if ( aUIString[0] == '.' )
515 {
516 aUIString = aUIString.copy( 1 );
517 --nIndex;
518 }
519
520 if ( nIndex < aUIString.getLength() - 1 &&
521 aUIString[ nIndex + 1 ] == '.' )
522 aUIString = aUIString.replaceAt( nIndex + 1, 1, u"" );
523
524 bResult = ((rRange.Parse(aUIString, rDocument, eConv) & ScRefFlags::VALID) ==
526
527 // #i77703# chart ranges in the file format contain both sheet names, even for an external reference sheet.
528 // This isn't parsed by ScRange, so try to parse the two Addresses then.
529 if (!bResult)
530 {
531 bResult = ((rRange.aStart.Parse( aUIString.copy(0, nIndex), rDocument, eConv)
533 &&
534 ((rRange.aEnd.Parse( aUIString.copy(nIndex+1), rDocument, eConv)
536
538 if (!bResult && eConv != eConvUI)
539 {
540 bResult = ((rRange.aStart.Parse( aUIString.copy(0, nIndex), rDocument, eConvUI)
542 &&
543 ((rRange.aEnd.Parse( aUIString.copy(nIndex+1), rDocument, eConvUI)
545 }
546 }
547 }
548 }
549 return bResult;
550}
551
553 ScRangeList& rRangeList,
554 std::u16string_view rRangeListStr,
555 const ScDocument& rDocument,
556 FormulaGrammar::AddressConvention eConv,
557 sal_Unicode cSeparator,
558 sal_Unicode cQuote )
559{
560 bool bRet = true;
561 OSL_ENSURE( !rRangeListStr.empty(), "ScXMLConverter::GetRangeListFromString - empty string!" );
562 sal_Int32 nOffset = 0;
563 while( nOffset >= 0 )
564 {
565 ScRange aRange;
566 if (
567 GetRangeFromString( aRange, rRangeListStr, rDocument, eConv, nOffset, cSeparator, cQuote ) &&
568 (nOffset >= 0)
569 )
570 {
571 rRangeList.push_back( aRange );
572 }
573 else if (nOffset > -1)
574 bRet = false;
575 }
576 return bRet;
577}
578
580 ScArea& rArea,
581 std::u16string_view rRangeStr,
582 const ScDocument& rDocument,
583 FormulaGrammar::AddressConvention eConv,
584 sal_Int32& nOffset,
585 sal_Unicode cSeparator )
586{
587 ScRange aScRange;
588 bool bResult(false);
589 if( GetRangeFromString( aScRange, rRangeStr, rDocument, eConv, nOffset, cSeparator ) && (nOffset >= 0) )
590 {
591 rArea.nTab = aScRange.aStart.Tab();
592 rArea.nColStart = aScRange.aStart.Col();
593 rArea.nRowStart = aScRange.aStart.Row();
594 rArea.nColEnd = aScRange.aEnd.Col();
595 rArea.nRowEnd = aScRange.aEnd.Row();
596 bResult = true;
597 }
598 return bResult;
599}
600
602 table::CellRangeAddress& rRange,
603 std::u16string_view rRangeStr,
604 const ScDocument& rDocument,
605 FormulaGrammar::AddressConvention eConv,
606 sal_Int32& nOffset,
607 sal_Unicode cSeparator )
608{
609 ScRange aScRange;
610 bool bResult(false);
611 if( GetRangeFromString( aScRange, rRangeStr, rDocument, eConv, nOffset, cSeparator ) && (nOffset >= 0) )
612 {
613 ScUnoConversion::FillApiRange( rRange, aScRange );
614 bResult = true;
615 }
616 return bResult;
617}
618
620 OUString& rString,
621 const ScAddress& rAddress,
622 const ScDocument* pDocument,
623 FormulaGrammar::AddressConvention eConv,
624 sal_Unicode cSeparator,
625 bool bAppendStr,
626 ScRefFlags nFormatFlags )
627{
628 if (pDocument && pDocument->HasTable(rAddress.Tab()))
629 {
630 OUString sAddress(rAddress.Format(nFormatFlags, pDocument, eConv));
631 AssignString( rString, sAddress, bAppendStr, cSeparator );
632 }
633}
634
636 OUString& rString,
637 const ScRange& rRange,
638 const ScDocument* pDocument,
639 FormulaGrammar::AddressConvention eConv,
640 sal_Unicode cSeparator,
641 bool bAppendStr,
642 ScRefFlags nFormatFlags )
643{
644 if (pDocument && pDocument->HasTable(rRange.aStart.Tab()))
645 {
646 ScAddress aStartAddress( rRange.aStart );
647 ScAddress aEndAddress( rRange.aEnd );
648 OUString sStartAddress(aStartAddress.Format(nFormatFlags, pDocument, eConv));
649 OUString sEndAddress(aEndAddress.Format(nFormatFlags, pDocument, eConv));
651 rString, sStartAddress + ":" + sEndAddress, bAppendStr, cSeparator);
652 }
653}
654
656 OUString& rString,
657 const ScRangeList* pRangeList,
658 const ScDocument* pDocument,
659 FormulaGrammar::AddressConvention eConv,
660 sal_Unicode cSeparator )
661{
662 OUString sRangeListStr;
663 if( pRangeList )
664 {
665 for( size_t nIndex = 0, nCount = pRangeList->size(); nIndex < nCount; nIndex++ )
666 {
667 const ScRange & rRange = (*pRangeList)[nIndex];
668 GetStringFromRange( sRangeListStr, rRange, pDocument, eConv, cSeparator, true );
669 }
670 }
671 rString = sRangeListStr;
672}
673
675 OUString& rString,
676 const ScArea& rArea,
677 const ScDocument* pDocument,
678 FormulaGrammar::AddressConvention eConv,
679 sal_Unicode cSeparator,
680 bool bAppendStr,
681 ScRefFlags nFormatFlags )
682{
683 ScRange aRange( rArea.nColStart, rArea.nRowStart, rArea.nTab, rArea.nColEnd, rArea.nRowEnd, rArea.nTab );
684 GetStringFromRange( rString, aRange, pDocument, eConv, cSeparator, bAppendStr, nFormatFlags );
685}
686
688 OUString& rString,
689 const table::CellAddress& rAddress,
690 const ScDocument* pDocument,
691 FormulaGrammar::AddressConvention eConv,
692 sal_Unicode cSeparator,
693 bool bAppendStr )
694{
695 ScAddress aScAddress( static_cast<SCCOL>(rAddress.Column), static_cast<SCROW>(rAddress.Row), rAddress.Sheet );
696 GetStringFromAddress( rString, aScAddress, pDocument, eConv, cSeparator, bAppendStr );
697}
698
700 OUString& rString,
701 const table::CellRangeAddress& rRange,
702 const ScDocument* pDocument,
703 FormulaGrammar::AddressConvention eConv,
704 sal_Unicode cSeparator,
705 bool bAppendStr,
706 ScRefFlags nFormatFlags )
707{
708 ScRange aScRange( static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), rRange.Sheet,
709 static_cast<SCCOL>(rRange.EndColumn), static_cast<SCROW>(rRange.EndRow), rRange.Sheet );
710 GetStringFromRange( rString, aScRange, pDocument, eConv, cSeparator, bAppendStr, nFormatFlags );
711}
712
714 OUString& rString,
715 const uno::Sequence< table::CellRangeAddress >& rRangeSeq,
716 const ScDocument* pDocument,
717 FormulaGrammar::AddressConvention eConv,
718 sal_Unicode cSeparator )
719{
720 OUString sRangeListStr;
721 for( const table::CellRangeAddress& rRange : rRangeSeq )
722 {
723 GetStringFromRange( sRangeListStr, rRange, pDocument, eConv, cSeparator, true );
724 }
725 rString = sRangeListStr;
726}
727
729 OUStringBuffer& rBuf, const ScDocument& rDoc, const ScAddress& rCell,
730 const ScAddress::ExternalInfo& rExtInfo)
731{
732 if (rExtInfo.mbExternal)
733 {
735 const OUString* pFilePath = pRefMgr->getExternalFileName(rExtInfo.mnFileId, true);
736 if (!pFilePath)
737 return;
738
739 sal_Unicode cQuote = '\'';
740 rBuf.append(cQuote);
741 rBuf.append(*pFilePath);
742 rBuf.append(cQuote);
743 rBuf.append('#');
744 rBuf.append('$');
746 rBuf.append('.');
747
748 OUString aAddr(rCell.Format(ScRefFlags::ADDR_ABS, nullptr, rDoc.GetAddressConvention()));
749 rBuf.append(aAddr);
750 }
751 else
752 {
753 OUString aAddr(rCell.Format(ScRefFlags::ADDR_ABS_3D, &rDoc, rDoc.GetAddressConvention()));
754 rBuf.append(aAddr);
755 }
756}
757
759 OUStringBuffer& rBuf, const ScDocument& rDoc, const ScAddress& rCell1, const ScAddress& rCell2,
760 const ScAddress::ExternalInfo& rExtInfo1, const ScAddress::ExternalInfo& rExtInfo2)
761{
762 if (rExtInfo1.mbExternal)
763 {
764 OSL_ENSURE(rExtInfo2.mbExternal, "2nd address is not external!?");
765 OSL_ENSURE(rExtInfo1.mnFileId == rExtInfo2.mnFileId, "File IDs do not match between 1st and 2nd addresses.");
766
768 const OUString* pFilePath = pRefMgr->getExternalFileName(rExtInfo1.mnFileId, true);
769 if (!pFilePath)
770 return;
771
772 sal_Unicode cQuote = '\'';
773 rBuf.append(cQuote);
774 rBuf.append(*pFilePath);
775 rBuf.append(cQuote);
776 rBuf.append('#');
777 rBuf.append('$');
779 rBuf.append('.');
780
781 OUString aAddr(rCell1.Format(ScRefFlags::ADDR_ABS, nullptr, rDoc.GetAddressConvention()));
782 rBuf.append(aAddr);
783
784 rBuf.append(":");
785
786 if (rExtInfo1.maTabName != rExtInfo2.maTabName)
787 {
788 rBuf.append('$');
790 rBuf.append('.');
791 }
792
793 aAddr = rCell2.Format(ScRefFlags::ADDR_ABS, nullptr, rDoc.GetAddressConvention());
794 rBuf.append(aAddr);
795 }
796 else
797 {
798 ScRange aRange;
799 aRange.aStart = rCell1;
800 aRange.aEnd = rCell2;
801 OUString aAddr(aRange.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention()));
802 rBuf.append(aAddr);
803 }
804}
805
806void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, std::u16string_view rXMLRange, const ScDocument& rDoc )
807{
808 FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
810
811 OUStringBuffer aRetStr;
812 sal_Int32 nOffset = 0;
813 bool bFirst = true;
814
815 while (nOffset >= 0)
816 {
817 OUString aToken;
818 GetTokenByOffset(aToken, rXMLRange, nOffset);
819 if (nOffset < 0)
820 break;
821
822 sal_Int32 nSepPos = IndexOf(aToken, ':', 0);
823 if (nSepPos >= 0)
824 {
825 // Cell range
826 OUString aBeginCell = aToken.copy(0, nSepPos);
827 OUString aEndCell = aToken.copy(nSepPos+1);
828
829 if (aBeginCell.isEmpty() || aEndCell.isEmpty())
830 // both cell addresses must exist for this to work.
831 continue;
832
833 sal_Int32 nEndCellDotPos = aEndCell.indexOf('.');
834 if (nEndCellDotPos <= 0)
835 {
836 // initialize buffer with table name...
837 sal_Int32 nDotPos = IndexOf(aBeginCell, '.', 0);
838 OUStringBuffer aBuf(aBeginCell.subView(0, nDotPos));
839
840 if (nEndCellDotPos == 0)
841 {
842 // workaround for old syntax (probably pre-chart2 age?)
843 // e.g. Sheet1.A1:.B2
844 aBuf.append(aEndCell);
845 }
846 else if (nEndCellDotPos < 0)
847 {
848 // sheet name in the end cell is omitted (e.g. Sheet2.A1:B2).
849 aBuf.append("." + aEndCell);
850 }
851 aEndCell = aBuf.makeStringAndClear();
852 }
853
854 ScAddress::ExternalInfo aExtInfo1, aExtInfo2;
855 ScAddress aCell1, aCell2;
856 ScRefFlags nRet = aCell1.Parse(aBeginCell, rDoc, FormulaGrammar::CONV_OOO, &aExtInfo1);
857 if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
858 {
859 // first cell is invalid.
860 if (eConv == FormulaGrammar::CONV_OOO)
861 continue;
862
863 nRet = aCell1.Parse(aBeginCell, rDoc, eConv, &aExtInfo1);
864 if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
865 // first cell is really invalid.
866 continue;
867 }
868
869 nRet = aCell2.Parse(aEndCell, rDoc, FormulaGrammar::CONV_OOO, &aExtInfo2);
870 if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
871 {
872 // second cell is invalid.
873 if (eConv == FormulaGrammar::CONV_OOO)
874 continue;
875
876 nRet = aCell2.Parse(aEndCell, rDoc, eConv, &aExtInfo2);
877 if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
878 // second cell is really invalid.
879 continue;
880 }
881
882 if (aExtInfo1.mnFileId != aExtInfo2.mnFileId || aExtInfo1.mbExternal != aExtInfo2.mbExternal)
883 // external info inconsistency.
884 continue;
885
886 // All looks good!
887
888 if (bFirst)
889 bFirst = false;
890 else
891 aRetStr.append(cSepNew);
892
893 lcl_appendCellRangeAddress(aRetStr, rDoc, aCell1, aCell2, aExtInfo1, aExtInfo2);
894 }
895 else
896 {
897 // Chart always saves ranges using CONV_OOO convention.
899 ScAddress aCell;
900 ScRefFlags nRet = aCell.Parse(aToken, rDoc, ::formula::FormulaGrammar::CONV_OOO, &aExtInfo);
901 if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO )
902 {
903 nRet = aCell.Parse(aToken, rDoc, eConv, &aExtInfo);
904 if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
905 continue;
906 }
907
908 // Looks good!
909
910 if (bFirst)
911 bFirst = false;
912 else
913 aRetStr.append(cSepNew);
914
915 lcl_appendCellAddress(aRetStr, rDoc, aCell, aExtInfo);
916 }
917 }
918
919 rString = aRetStr.makeStringAndClear();
920}
921
924{
925 // This may be called with an external 'doc'#name but wouldn't find any.
926
927 // Dot '.' is not allowed in range names, if present only lookup if it's a
928 // sheet-local name. Same for '!' Excel syntax.
929 // If eConv == FormulaGrammar::CONV_A1_XL_A1 then try both, first our own.
930 sal_Int32 nIndex = -1;
931 if (eConv == FormulaGrammar::CONV_OOO || eConv == FormulaGrammar::CONV_A1_XL_A1)
932 nIndex = ScGlobal::FindUnquoted( rString, '.');
933 if (nIndex < 0 && (eConv == FormulaGrammar::CONV_A1_XL_A1
934 || eConv == FormulaGrammar::CONV_XL_A1
935 || eConv == FormulaGrammar::CONV_XL_R1C1
936 || eConv == FormulaGrammar::CONV_XL_OOX))
937 nIndex = ScGlobal::FindUnquoted( rString, '!');
938
939 if (nIndex >= 0)
940 {
941 if (nIndex == 0)
942 return nullptr; // Can't be a name.
943
944 OUString aTab( rString.copy( 0, nIndex));
945 ScGlobal::EraseQuotes( aTab, '\'');
946 SCTAB nLocalTab;
947 if (!rDoc.GetTable( aTab, nLocalTab))
948 return nullptr;
949
950 ScRangeName* pLocalRangeName = rDoc.GetRangeName(nLocalTab);
951 if (!pLocalRangeName)
952 return nullptr;
953
954 const OUString aName( rString.copy( nIndex+1));
955 return pLocalRangeName->findByUpperName( ScGlobal::getCharClass().uppercase( aName));
956 }
957
958 ScRangeName* pLocalRangeName = rDoc.GetRangeName(nTab);
959 ScRangeData* pData = nullptr;
960 OUString aUpperName = ScGlobal::getCharClass().uppercase(rString);
961 if(pLocalRangeName)
962 {
963 pData = pLocalRangeName->findByUpperName(aUpperName);
964 }
965 if (!pData)
966 {
967 ScRangeName* pGlobalRangeName = rDoc.GetRangeName();
968 if (pGlobalRangeName)
969 {
970 pData = pGlobalRangeName->findByUpperName(aUpperName);
971 }
972 }
973 return pData;
974}
975
977 SCCOL colStart, SCROW rowStart,
978 SCCOL colEnd, SCROW rowEnd ) :
979 nTab ( tab ),
980 nColStart( colStart ), nRowStart( rowStart ),
981 nColEnd ( colEnd ), nRowEnd ( rowEnd )
982{
983}
984
985bool ScArea::operator==( const ScArea& r ) const
986{
987 return ( (nTab == r.nTab)
988 && (nColStart == r.nColStart)
989 && (nRowStart == r.nRowStart)
990 && (nColEnd == r.nColEnd)
991 && (nRowEnd == r.nRowEnd) );
992}
993
995 pRangeName(rDoc.GetRangeName()),
996 pDBCollection(rDoc.GetDBCollection()),
997 bFirstPass(true)
998{
999 if (pRangeName)
1000 {
1002 maRNEnd = pRangeName->end();
1003 }
1004}
1005
1006bool ScAreaNameIterator::Next( OUString& rName, ScRange& rRange )
1007{
1008 for (;;)
1009 {
1010 if ( bFirstPass ) // first the area names
1011 {
1012 if ( pRangeName && maRNPos != maRNEnd )
1013 {
1014 const ScRangeData& rData = *maRNPos->second;
1015 ++maRNPos;
1016 bool bValid = rData.IsValidReference(rRange);
1017 if (bValid)
1018 {
1019 rName = rData.GetName();
1020 return true; // found
1021 }
1022 }
1023 else
1024 {
1025 bFirstPass = false;
1026 if (pDBCollection)
1027 {
1029 maDBPos = rDBs.begin();
1030 maDBEnd = rDBs.end();
1031 }
1032 }
1033 }
1034
1035 if ( !bFirstPass ) // then the DB areas
1036 {
1037 if (pDBCollection && maDBPos != maDBEnd)
1038 {
1039 const ScDBData& rData = **maDBPos;
1040 ++maDBPos;
1041 rData.GetArea(rRange);
1042 rName = rData.GetName();
1043 return true; // found
1044 }
1045 else
1046 return false; // nothing left
1047 }
1048 }
1049}
1050
1052{
1053 if (rCxt.mnInsertPos <= rAddr.Tab())
1054 {
1055 rAddr.IncTab(rCxt.mnSheets);
1056 }
1057}
1058
1060{
1061 if (rCxt.mnDeletePos <= rAddr.Tab())
1062 {
1063 rAddr.SetTab( std::max<SCTAB>(0, rAddr.Tab() - rCxt.mnSheets));
1064 }
1065}
1066
1067/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool ConvertSingleRef(const ScDocument &rDoc, const OUString &rRefString, SCTAB nDefTab, ScRefAddress &rRefAddress, const ScAddress::Details &rDetails, ScAddress::ExternalInfo *pExtInfo)
Definition: address.cxx:1489
bool ConvertDoubleRef(const ScDocument &rDoc, const OUString &rRefString, SCTAB nDefTab, ScRefAddress &rStartRefAddress, ScRefAddress &rEndRefAddress, const ScAddress::Details &rDetails, ScAddress::ExternalInfo *pExtInfo)
Definition: address.cxx:1511
ScRefFlags
Definition: address.hxx:158
const SCTAB MAXTAB
Definition: address.hxx:70
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
void IncTab(SCTAB nDelta=1)
Definition: address.hxx:320
SCTAB Tab() const
Definition: address.hxx:283
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
Definition: address.cxx:2074
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const Details &rDetails=detailsOOOa1, ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, sal_Int32 *pSheetEndPos=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1537
SCROW Row() const
Definition: address.hxx:274
void SetTab(SCTAB nTabP)
Definition: address.hxx:295
SCCOL Col() const
Definition: address.hxx:279
ScRangeName::const_iterator maRNPos
Definition: rangeutl.hxx:261
ScRangeName * pRangeName
Definition: rangeutl.hxx:259
ScDBCollection * pDBCollection
Definition: rangeutl.hxx:260
bool Next(OUString &rName, ScRange &rRange)
Definition: rangeutl.cxx:1006
ScDBCollection::NamedDBs::const_iterator maDBEnd
Definition: rangeutl.hxx:264
ScAreaNameIterator(const ScDocument &rDoc)
Definition: rangeutl.cxx:994
ScRangeName::const_iterator maRNEnd
Definition: rangeutl.hxx:262
ScDBCollection::NamedDBs::const_iterator maDBPos
Definition: rangeutl.hxx:263
SCCOL nColEnd
Definition: rangeutl.hxx:250
SCTAB nTab
Definition: rangeutl.hxx:247
SCCOL nColStart
Definition: rangeutl.hxx:248
ScArea(SCTAB tab=0, SCCOL colStart=0, SCROW rowStart=0, SCCOL colEnd=0, SCROW rowEnd=0)
Definition: rangeutl.cxx:976
SCROW nRowEnd
Definition: rangeutl.hxx:251
SCROW nRowStart
Definition: rangeutl.hxx:249
bool operator==(const ScArea &r) const
Definition: rangeutl.cxx:985
static void CheckTabQuotes(OUString &aTabName, const formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO)
all
Definition: compiler.cxx:1954
Stores global named database ranges.
Definition: dbdata.hxx:243
ScDBData * findByUpperName(const OUString &rName)
Definition: dbdata.cxx:1221
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:324
const OUString & GetName() const
Definition: dbdata.hxx:127
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:298
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:244
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:492
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
Definition: documen3.cxx:625
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
Definition: document.hxx:1010
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
Definition: document.hxx:827
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:171
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Definition: document.cxx:2502
const OUString * getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal=false)
It returns a pointer to the name of the URI associated with a given external file ID.
static SC_DLLPUBLIC void EraseQuotes(OUString &rString, sal_Unicode cQuote, bool bUnescapeEmbedded=true)
Erases the character cQuote from rString, if it exists at beginning AND end.
Definition: global.cxx:733
static SC_DLLPUBLIC sal_Int32 FindUnquoted(const OUString &rString, sal_Unicode cChar, sal_Int32 nStart=0)
Finds an unquoted instance of cChar in rString, starting at offset nStart.
Definition: global.cxx:749
static SC_DLLPUBLIC const CharClass & getCharClass()
Definition: global.cxx:1064
void GetName(OUString &rName) const
Definition: rangenam.hxx:110
SC_DLLPUBLIC bool IsValidReference(ScRange &rRef) const
Definition: rangenam.cxx:387
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1137
size_t size() const
Definition: rangelst.hxx:89
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
Definition: rangenam.cxx:704
SC_DLLPUBLIC const_iterator end() const
Definition: rangenam.hxx:246
SC_DLLPUBLIC const_iterator begin() const
Definition: rangenam.hxx:245
static void GetStringFromRange(OUString &rString, const ScRange &rRange, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ', bool bAppendStr=false, ScRefFlags nFormatFlags=ScRefFlags::VALID|ScRefFlags::TAB_3D)
static bool GetAddressFromString(ScAddress &rAddress, std::u16string_view rAddressStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator=' ', sal_Unicode cQuote='\'')
String to Range core.
Definition: rangeutl.cxx:461
static ScRangeData * GetRangeDataFromString(const OUString &rString, const SCTAB nTab, const ScDocument &rDoc, formula::FormulaGrammar::AddressConvention eConv)
String to RangeData core.
Definition: rangeutl.cxx:922
static void GetStringFromXMLRangeString(OUString &rString, std::u16string_view rXMLRange, const ScDocument &rDoc)
XML Range to Calc Range.
Definition: rangeutl.cxx:806
static bool GetRangeFromString(ScRange &rRange, std::u16string_view rRangeStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator=' ', sal_Unicode cQuote='\'')
static void GetStringFromRangeList(OUString &rString, const ScRangeList *pRangeList, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ')
static bool GetRangeListFromString(ScRangeList &rRangeList, std::u16string_view rRangeListStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ', sal_Unicode cQuote='\'')
Definition: rangeutl.cxx:552
static sal_Int32 IndexOfDifferent(std::u16string_view rString, sal_Unicode cSearchChar, sal_Int32 nOffset)
Definition: rangeutl.cxx:396
static void GetStringFromArea(OUString &rString, const ScArea &rArea, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator, bool bAppendStr=false, ScRefFlags nFormatFlags=ScRefFlags::VALID|ScRefFlags::TAB_3D)
Definition: rangeutl.cxx:674
static sal_Int32 GetTokenCount(std::u16string_view rString, sal_Unicode cSeparator=' ')
Definition: rangeutl.cxx:447
static sal_Int32 IndexOf(std::u16string_view rString, sal_Unicode cSearchChar, sal_Int32 nOffset, sal_Unicode cQuote='\'')
Definition: rangeutl.cxx:374
static void AssignString(OUString &rString, const OUString &rNewStr, bool bAppendStr, sal_Unicode cSeparator=' ')
helper methods
Definition: rangeutl.cxx:355
static bool GetAreaFromString(ScArea &rArea, std::u16string_view rRangeStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator=' ')
Definition: rangeutl.cxx:579
static void GetTokenByOffset(OUString &rToken, std::u16string_view rString, sal_Int32 &nOffset, sal_Unicode cSeparator=' ', sal_Unicode cQuote='\'')
Definition: rangeutl.cxx:414
static void GetStringFromAddress(OUString &rString, const ScAddress &rAddress, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ', bool bAppendStr=false, ScRefFlags nFormatFlags=ScRefFlags::VALID|ScRefFlags::TAB_3D)
Range to String core.
static void AppendTableName(OUStringBuffer &rBuf, const OUString &rTabName)
Definition: rangeutl.cxx:439
static bool IsAbsArea(const OUString &rAreaStr, const ScDocument &rDoc, SCTAB nTab, OUString *pCompleteStr, ScRefAddress *pStartPos=nullptr, ScRefAddress *pEndPos=nullptr, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1)
Definition: rangeutl.cxx:169
static bool IsAbsTabArea(const OUString &rAreaStr, const ScDocument *pDoc, std::unique_ptr< ScArea[]> *ppAreas, sal_uInt16 *pAreaCount, bool bAcceptCellRef=false, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1)
Definition: rangeutl.cxx:86
static bool IsAbsPos(const OUString &rPosStr, const ScDocument &rDoc, SCTAB nTab, OUString *pCompleteStr, ScRefAddress *pPosTripel=nullptr, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1)
Definition: rangeutl.cxx:208
static bool MakeArea(const OUString &rAreaStr, ScArea &rArea, const ScDocument &rDoc, SCTAB nTab, ScAddress::Details const &rDetails)
Definition: rangeutl.cxx:36
static bool MakeRangeFromName(const OUString &rName, const ScDocument &rDoc, SCTAB nCurTab, ScRange &rRange, RutlNameScope eScope=RUTL_NAMES, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1, bool bUseDetailsPos=false)
Definition: rangeutl.cxx:233
static void CutPosString(const OUString &theAreaStr, OUString &thePosStr)
Definition: rangeutl.cxx:69
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2170
ScAddress aEnd
Definition: address.hxx:498
ScRefFlags Parse(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, ScAddress::ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1700
ScAddress aStart
Definition: address.hxx:497
SCCOL Col() const
Definition: address.hxx:886
OUString GetRefString(const ScDocument &rDocument, SCTAB nActTab, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1) const
Definition: address.cxx:2488
void SetRelTab(bool bNewRelTab)
Definition: address.hxx:871
void SetRelCol(bool bNewRelCol)
Definition: address.hxx:863
SCTAB Tab() const
Definition: address.hxx:894
SCROW Row() const
Definition: address.hxx:890
void SetRelRow(bool bNewRelRow)
Definition: address.hxx:867
static void FillApiRange(css::table::CellRangeAddress &rApiRange, const ScRange &rScRange)
Definition: convuno.hxx:87
static sal_Unicode GetNativeSymbolChar(OpCode eOp)
int nCount
sal_Int32 nIndex
OUString aName
aBuf
std::unique_ptr< sal_Int32[]> pData
int i
ocSep
static void lcl_appendCellAddress(OUStringBuffer &rBuf, const ScDocument &rDoc, const ScAddress &rCell, const ScAddress::ExternalInfo &rExtInfo)
Definition: rangeutl.cxx:728
static void lcl_appendCellRangeAddress(OUStringBuffer &rBuf, const ScDocument &rDoc, const ScAddress &rCell1, const ScAddress &rCell2, const ScAddress::ExternalInfo &rExtInfo1, const ScAddress::ExternalInfo &rExtInfo2)
Definition: rangeutl.cxx:758
RutlNameScope
Definition: rangeutl.hxx:36
@ RUTL_DBASE
Definition: rangeutl.hxx:41
@ RUTL_NAMES_GLOBAL
Definition: rangeutl.hxx:40
@ RUTL_NAMES_LOCAL
Definition: rangeutl.hxx:39
@ RUTL_NAMES
Definition: rangeutl.hxx:38
formula::FormulaGrammar::AddressConvention eConv
Definition: address.hxx:225
static void UpdateDeleteTab(ScAddress &rAddr, const sc::RefUpdateDeleteTabContext &rCxt)
This is for the base-cell-address of a defined name or conditional format, not for references.
Definition: rangeutl.cxx:1059
static void UpdateInsertTab(ScAddress &rAddr, const sc::RefUpdateInsertTabContext &rCxt)
Definition: rangeutl.cxx:1051
sal_uInt16 sal_Unicode
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
sal_Int32 nLength