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>
22 #include <unotools/charclass.hxx>
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 
33 using ::formula::FormulaGrammar;
34 using namespace ::com::sun::star;
35 
36 bool 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 
69 void 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 
86 bool 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 
169 bool 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 
208 bool 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 {
241  bool bResult = false;
242  if (rName.isEmpty())
243  return bResult;
244 
245  SCTAB nTab = 0;
246  SCCOL nColStart = 0;
247  SCCOL nColEnd = 0;
248  SCROW nRowStart = 0;
249  SCROW nRowEnd = 0;
250 
251  if (eScope == RUTL_NAMES || eScope == RUTL_NAMES_LOCAL || eScope == RUTL_NAMES_GLOBAL)
252  {
253  OUString aName(rName);
254  SCTAB nTable = nCurTab;
255 
256  if (eScope != RUTL_NAMES_GLOBAL)
257  {
258  // First handle UI names like "local1 (Sheet1)", which point to a
259  // local range name.
260  const sal_Int32 nEndPos = aName.getLength() - 1;
261  if (rName[nEndPos] == ')')
262  {
263  const sal_Int32 nStartPos = aName.indexOf(" (");
264  if (nStartPos != -1)
265  {
266  OUString aSheetName = aName.copy(nStartPos+2, nEndPos-nStartPos-2);
267  if (rDoc.GetTable(aSheetName, nTable))
268  {
269  aName = aName.copy(0, nStartPos);
270  eScope = RUTL_NAMES_LOCAL;
271  }
272  else
273  nTable = nCurTab;
274  }
275  }
276  }
277 
278  aName = ScGlobal::getCharClassPtr()->uppercase(aName);
279  ScRangeData* pData = nullptr;
280  if (eScope != RUTL_NAMES_GLOBAL)
281  {
282  // Check for local range names.
283  ScRangeName* pRangeNames = rDoc.GetRangeName( nTable );
284  if ( pRangeNames )
285  pData = pRangeNames->findByUpperName(aName);
286  }
287  if (!pData && eScope != RUTL_NAMES_LOCAL)
288  pData = rDoc.GetRangeName()->findByUpperName(aName);
289  if (pData)
290  {
291  OUString aStrArea;
292  ScRefAddress aStartPos;
293  ScRefAddress aEndPos;
294 
295  // tdf#138646 - consider the current grammar and address convention of the document
296  pData->GetSymbol(aStrArea,
297  FormulaGrammar::mergeToGrammar(rDoc.GetGrammar(), rDetails.eConv));
298 
299  if ( IsAbsArea( aStrArea, rDoc, nTable,
300  nullptr, &aStartPos, &aEndPos, rDetails ) )
301  {
302  nTab = aStartPos.Tab();
303  nColStart = aStartPos.Col();
304  nRowStart = aStartPos.Row();
305  nColEnd = aEndPos.Col();
306  nRowEnd = aEndPos.Row();
307  bResult = true;
308  }
309  else
310  {
311  CutPosString( aStrArea, aStrArea );
312 
313  if ( IsAbsPos( aStrArea, rDoc, nTable,
314  nullptr, &aStartPos, rDetails ) )
315  {
316  nTab = aStartPos.Tab();
317  nColStart = nColEnd = aStartPos.Col();
318  nRowStart = nRowEnd = aStartPos.Row();
319  bResult = true;
320  }
321  }
322  }
323  }
324  else if( eScope==RUTL_DBASE )
325  {
327  ScDBData* pData = rDbNames.findByUpperName(ScGlobal::getCharClassPtr()->uppercase(rName));
328  if (pData)
329  {
330  pData->GetArea(nTab, nColStart, nRowStart, nColEnd, nRowEnd);
331  bResult = true;
332  }
333  }
334  else
335  {
336  OSL_FAIL( "ScRangeUtil::MakeRangeFromName" );
337  }
338 
339  if( bResult )
340  {
341  rRange = ScRange( nColStart, nRowStart, nTab, nColEnd, nRowEnd, nTab );
342  }
343 
344  return bResult;
345 }
346 
348  OUString& rString,
349  const OUString& rNewStr,
350  bool bAppendStr,
351  sal_Unicode cSeparator)
352 {
353  if( bAppendStr )
354  {
355  if( !rNewStr.isEmpty() )
356  {
357  if( !rString.isEmpty() )
358  rString += OUStringChar(cSeparator);
359  rString += rNewStr;
360  }
361  }
362  else
363  rString = rNewStr;
364 }
365 
367  const OUString& rString,
368  sal_Unicode cSearchChar,
369  sal_Int32 nOffset,
370  sal_Unicode cQuote )
371 {
372  sal_Int32 nLength = rString.getLength();
373  sal_Int32 nIndex = nOffset;
374  bool bQuoted = false;
375  bool bExitLoop = false;
376 
377  while( !bExitLoop && (nIndex >= 0 && nIndex < nLength) )
378  {
379  sal_Unicode cCode = rString[ nIndex ];
380  bExitLoop = (cCode == cSearchChar) && !bQuoted;
381  bQuoted = (bQuoted != (cCode == cQuote));
382  if( !bExitLoop )
383  nIndex++;
384  }
385  return (nIndex < nLength) ? nIndex : -1;
386 }
387 
389  const OUString& rString,
390  sal_Unicode cSearchChar,
391  sal_Int32 nOffset )
392 {
393  sal_Int32 nLength = rString.getLength();
394  sal_Int32 nIndex = nOffset;
395  bool bExitLoop = false;
396 
397  while( !bExitLoop && (nIndex >= 0 && nIndex < nLength) )
398  {
399  bExitLoop = (rString[ nIndex ] != cSearchChar);
400  if( !bExitLoop )
401  nIndex++;
402  }
403  return (nIndex < nLength) ? nIndex : -1;
404 }
405 
407  OUString& rToken,
408  const OUString& rString,
409  sal_Int32& nOffset,
410  sal_Unicode cSeparator,
411  sal_Unicode cQuote)
412 {
413  sal_Int32 nLength = rString.getLength();
414  if( nOffset == -1 || nOffset >= nLength )
415  {
416  rToken.clear();
417  nOffset = -1;
418  }
419  else
420  {
421  sal_Int32 nTokenEnd = IndexOf( rString, cSeparator, nOffset, cQuote );
422  if( nTokenEnd < 0 )
423  nTokenEnd = nLength;
424  rToken = rString.copy( nOffset, nTokenEnd - nOffset );
425 
426  sal_Int32 nNextBegin = IndexOfDifferent( rString, cSeparator, nTokenEnd );
427  nOffset = (nNextBegin < 0) ? nLength : nNextBegin;
428  }
429 }
430 
431 void ScRangeStringConverter::AppendTableName(OUStringBuffer& rBuf, const OUString& rTabName)
432 {
433  // quote character is always "'"
434  OUString aQuotedTab(rTabName);
435  ScCompiler::CheckTabQuotes(aQuotedTab);
436  rBuf.append(aQuotedTab);
437 }
438 
439 sal_Int32 ScRangeStringConverter::GetTokenCount( const OUString& rString, sal_Unicode cSeparator )
440 {
441  OUString sToken;
442  sal_Int32 nCount = 0;
443  sal_Int32 nOffset = 0;
444  while( nOffset >= 0 )
445  {
446  GetTokenByOffset( sToken, rString, nOffset, '\'', cSeparator );
447  if( nOffset >= 0 )
448  nCount++;
449  }
450  return nCount;
451 }
452 
454  ScAddress& rAddress,
455  const OUString& rAddressStr,
456  const ScDocument& rDocument,
457  FormulaGrammar::AddressConvention eConv,
458  sal_Int32& nOffset,
459  sal_Unicode cSeparator,
460  sal_Unicode cQuote )
461 {
462  OUString sToken;
463  GetTokenByOffset( sToken, rAddressStr, nOffset, cSeparator, cQuote );
464  if( nOffset >= 0 )
465  {
466  if ((rAddress.Parse( sToken, rDocument, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID)
467  return true;
469  if (eConv != eConvUI)
470  return ((rAddress.Parse(sToken, rDocument, eConvUI) & ScRefFlags::VALID) == ScRefFlags::VALID);
471  }
472  return false;
473 }
474 
476  ScRange& rRange,
477  const OUString& rRangeStr,
478  const ScDocument& rDocument,
479  FormulaGrammar::AddressConvention eConv,
480  sal_Int32& nOffset,
481  sal_Unicode cSeparator,
482  sal_Unicode cQuote )
483 {
484  OUString sToken;
485  bool bResult(false);
486  GetTokenByOffset( sToken, rRangeStr, nOffset, cSeparator, cQuote );
487  if( nOffset >= 0 )
488  {
489  sal_Int32 nIndex = IndexOf( sToken, ':', 0, cQuote );
490  OUString aUIString(sToken);
491 
492  if( nIndex < 0 )
493  {
494  if ( aUIString[0] == '.' )
495  aUIString = aUIString.copy( 1 );
496  bResult = (rRange.aStart.Parse( aUIString, rDocument, eConv) & ScRefFlags::VALID) ==
499  if (!bResult && eConv != eConvUI)
500  bResult = (rRange.aStart.Parse(aUIString, rDocument, eConvUI) & ScRefFlags::VALID) ==
502  rRange.aEnd = rRange.aStart;
503  }
504  else
505  {
506  if ( aUIString[0] == '.' )
507  {
508  aUIString = aUIString.copy( 1 );
509  --nIndex;
510  }
511 
512  if ( nIndex < aUIString.getLength() - 1 &&
513  aUIString[ nIndex + 1 ] == '.' )
514  aUIString = aUIString.replaceAt( nIndex + 1, 1, "" );
515 
516  bResult = ((rRange.Parse(aUIString, rDocument, eConv) & ScRefFlags::VALID) ==
518 
519  // #i77703# chart ranges in the file format contain both sheet names, even for an external reference sheet.
520  // This isn't parsed by ScRange, so try to parse the two Addresses then.
521  if (!bResult)
522  {
523  bResult = ((rRange.aStart.Parse( aUIString.copy(0, nIndex), rDocument, eConv)
525  &&
526  ((rRange.aEnd.Parse( aUIString.copy(nIndex+1), rDocument, eConv)
528 
530  if (!bResult && eConv != eConvUI)
531  {
532  bResult = ((rRange.aStart.Parse( aUIString.copy(0, nIndex), rDocument, eConvUI)
534  &&
535  ((rRange.aEnd.Parse( aUIString.copy(nIndex+1), rDocument, eConvUI)
537  }
538  }
539  }
540  }
541  return bResult;
542 }
543 
545  ScRangeList& rRangeList,
546  const OUString& rRangeListStr,
547  const ScDocument& rDocument,
548  FormulaGrammar::AddressConvention eConv,
549  sal_Unicode cSeparator,
550  sal_Unicode cQuote )
551 {
552  bool bRet = true;
553  OSL_ENSURE( !rRangeListStr.isEmpty(), "ScXMLConverter::GetRangeListFromString - empty string!" );
554  sal_Int32 nOffset = 0;
555  while( nOffset >= 0 )
556  {
557  ScRange aRange;
558  if (
559  GetRangeFromString( aRange, rRangeListStr, rDocument, eConv, nOffset, cSeparator, cQuote ) &&
560  (nOffset >= 0)
561  )
562  {
563  rRangeList.push_back( aRange );
564  }
565  else if (nOffset > -1)
566  bRet = false;
567  }
568  return bRet;
569 }
570 
572  ScArea& rArea,
573  const OUString& rRangeStr,
574  const ScDocument& rDocument,
575  FormulaGrammar::AddressConvention eConv,
576  sal_Int32& nOffset,
577  sal_Unicode cSeparator )
578 {
579  ScRange aScRange;
580  bool bResult(false);
581  if( GetRangeFromString( aScRange, rRangeStr, rDocument, eConv, nOffset, cSeparator ) && (nOffset >= 0) )
582  {
583  rArea.nTab = aScRange.aStart.Tab();
584  rArea.nColStart = aScRange.aStart.Col();
585  rArea.nRowStart = aScRange.aStart.Row();
586  rArea.nColEnd = aScRange.aEnd.Col();
587  rArea.nRowEnd = aScRange.aEnd.Row();
588  bResult = true;
589  }
590  return bResult;
591 }
592 
594  table::CellRangeAddress& rRange,
595  const OUString& rRangeStr,
596  const ScDocument& rDocument,
597  FormulaGrammar::AddressConvention eConv,
598  sal_Int32& nOffset,
599  sal_Unicode cSeparator )
600 {
601  ScRange aScRange;
602  bool bResult(false);
603  if( GetRangeFromString( aScRange, rRangeStr, rDocument, eConv, nOffset, cSeparator ) && (nOffset >= 0) )
604  {
605  ScUnoConversion::FillApiRange( rRange, aScRange );
606  bResult = true;
607  }
608  return bResult;
609 }
610 
612  OUString& rString,
613  const ScAddress& rAddress,
614  const ScDocument* pDocument,
615  FormulaGrammar::AddressConvention eConv,
616  sal_Unicode cSeparator,
617  bool bAppendStr,
618  ScRefFlags nFormatFlags )
619 {
620  if (pDocument && pDocument->HasTable(rAddress.Tab()))
621  {
622  OUString sAddress(rAddress.Format(nFormatFlags, pDocument, eConv));
623  AssignString( rString, sAddress, bAppendStr, cSeparator );
624  }
625 }
626 
628  OUString& rString,
629  const ScRange& rRange,
630  const ScDocument* pDocument,
631  FormulaGrammar::AddressConvention eConv,
632  sal_Unicode cSeparator,
633  bool bAppendStr,
634  ScRefFlags nFormatFlags )
635 {
636  if (pDocument && pDocument->HasTable(rRange.aStart.Tab()))
637  {
638  ScAddress aStartAddress( rRange.aStart );
639  ScAddress aEndAddress( rRange.aEnd );
640  OUString sStartAddress(aStartAddress.Format(nFormatFlags, pDocument, eConv));
641  OUString sEndAddress(aEndAddress.Format(nFormatFlags, pDocument, eConv));
642  AssignString(
643  rString, sStartAddress + ":" + sEndAddress, bAppendStr, cSeparator);
644  }
645 }
646 
648  OUString& rString,
649  const ScRangeList* pRangeList,
650  const ScDocument* pDocument,
651  FormulaGrammar::AddressConvention eConv,
652  sal_Unicode cSeparator )
653 {
654  OUString sRangeListStr;
655  if( pRangeList )
656  {
657  for( size_t nIndex = 0, nCount = pRangeList->size(); nIndex < nCount; nIndex++ )
658  {
659  const ScRange & rRange = (*pRangeList)[nIndex];
660  GetStringFromRange( sRangeListStr, rRange, pDocument, eConv, cSeparator, true );
661  }
662  }
663  rString = sRangeListStr;
664 }
665 
667  OUString& rString,
668  const ScArea& rArea,
669  const ScDocument* pDocument,
670  FormulaGrammar::AddressConvention eConv,
671  sal_Unicode cSeparator,
672  bool bAppendStr,
673  ScRefFlags nFormatFlags )
674 {
675  ScRange aRange( rArea.nColStart, rArea.nRowStart, rArea.nTab, rArea.nColEnd, rArea.nRowEnd, rArea.nTab );
676  GetStringFromRange( rString, aRange, pDocument, eConv, cSeparator, bAppendStr, nFormatFlags );
677 }
678 
680  OUString& rString,
681  const table::CellAddress& rAddress,
682  const ScDocument* pDocument,
683  FormulaGrammar::AddressConvention eConv,
684  sal_Unicode cSeparator,
685  bool bAppendStr )
686 {
687  ScAddress aScAddress( static_cast<SCCOL>(rAddress.Column), static_cast<SCROW>(rAddress.Row), rAddress.Sheet );
688  GetStringFromAddress( rString, aScAddress, pDocument, eConv, cSeparator, bAppendStr );
689 }
690 
692  OUString& rString,
693  const table::CellRangeAddress& rRange,
694  const ScDocument* pDocument,
695  FormulaGrammar::AddressConvention eConv,
696  sal_Unicode cSeparator,
697  bool bAppendStr,
698  ScRefFlags nFormatFlags )
699 {
700  ScRange aScRange( static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), rRange.Sheet,
701  static_cast<SCCOL>(rRange.EndColumn), static_cast<SCROW>(rRange.EndRow), rRange.Sheet );
702  GetStringFromRange( rString, aScRange, pDocument, eConv, cSeparator, bAppendStr, nFormatFlags );
703 }
704 
706  OUString& rString,
707  const uno::Sequence< table::CellRangeAddress >& rRangeSeq,
708  const ScDocument* pDocument,
709  FormulaGrammar::AddressConvention eConv,
710  sal_Unicode cSeparator )
711 {
712  OUString sRangeListStr;
713  for( const table::CellRangeAddress& rRange : rRangeSeq )
714  {
715  GetStringFromRange( sRangeListStr, rRange, pDocument, eConv, cSeparator, true );
716  }
717  rString = sRangeListStr;
718 }
719 
721  OUStringBuffer& rBuf, const ScDocument& rDoc, const ScAddress& rCell,
722  const ScAddress::ExternalInfo& rExtInfo)
723 {
724  if (rExtInfo.mbExternal)
725  {
727  const OUString* pFilePath = pRefMgr->getExternalFileName(rExtInfo.mnFileId, true);
728  if (!pFilePath)
729  return;
730 
731  sal_Unicode cQuote = '\'';
732  rBuf.append(cQuote);
733  rBuf.append(*pFilePath);
734  rBuf.append(cQuote);
735  rBuf.append('#');
736  rBuf.append('$');
738  rBuf.append('.');
739 
740  OUString aAddr(rCell.Format(ScRefFlags::ADDR_ABS, nullptr, rDoc.GetAddressConvention()));
741  rBuf.append(aAddr);
742  }
743  else
744  {
745  OUString aAddr(rCell.Format(ScRefFlags::ADDR_ABS_3D, &rDoc, rDoc.GetAddressConvention()));
746  rBuf.append(aAddr);
747  }
748 }
749 
751  OUStringBuffer& rBuf, const ScDocument& rDoc, const ScAddress& rCell1, const ScAddress& rCell2,
752  const ScAddress::ExternalInfo& rExtInfo1, const ScAddress::ExternalInfo& rExtInfo2)
753 {
754  if (rExtInfo1.mbExternal)
755  {
756  OSL_ENSURE(rExtInfo2.mbExternal, "2nd address is not external!?");
757  OSL_ENSURE(rExtInfo1.mnFileId == rExtInfo2.mnFileId, "File IDs do not match between 1st and 2nd addresses.");
758 
760  const OUString* pFilePath = pRefMgr->getExternalFileName(rExtInfo1.mnFileId, true);
761  if (!pFilePath)
762  return;
763 
764  sal_Unicode cQuote = '\'';
765  rBuf.append(cQuote);
766  rBuf.append(*pFilePath);
767  rBuf.append(cQuote);
768  rBuf.append('#');
769  rBuf.append('$');
771  rBuf.append('.');
772 
773  OUString aAddr(rCell1.Format(ScRefFlags::ADDR_ABS, nullptr, rDoc.GetAddressConvention()));
774  rBuf.append(aAddr);
775 
776  rBuf.append(":");
777 
778  if (rExtInfo1.maTabName != rExtInfo2.maTabName)
779  {
780  rBuf.append('$');
782  rBuf.append('.');
783  }
784 
785  aAddr = rCell2.Format(ScRefFlags::ADDR_ABS, nullptr, rDoc.GetAddressConvention());
786  rBuf.append(aAddr);
787  }
788  else
789  {
790  ScRange aRange;
791  aRange.aStart = rCell1;
792  aRange.aEnd = rCell2;
793  OUString aAddr(aRange.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention()));
794  rBuf.append(aAddr);
795  }
796 }
797 
798 void ScRangeStringConverter::GetStringFromXMLRangeString( OUString& rString, const OUString& rXMLRange, const ScDocument& rDoc )
799 {
800  FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
802 
803  OUStringBuffer aRetStr;
804  sal_Int32 nOffset = 0;
805  bool bFirst = true;
806 
807  while (nOffset >= 0)
808  {
809  OUString aToken;
810  GetTokenByOffset(aToken, rXMLRange, nOffset);
811  if (nOffset < 0)
812  break;
813 
814  sal_Int32 nSepPos = IndexOf(aToken, ':', 0);
815  if (nSepPos >= 0)
816  {
817  // Cell range
818  OUString aBeginCell = aToken.copy(0, nSepPos);
819  OUString aEndCell = aToken.copy(nSepPos+1);
820 
821  if (aBeginCell.isEmpty() || aEndCell.isEmpty())
822  // both cell addresses must exist for this to work.
823  continue;
824 
825  sal_Int32 nEndCellDotPos = aEndCell.indexOf('.');
826  if (nEndCellDotPos <= 0)
827  {
828  // initialize buffer with table name...
829  sal_Int32 nDotPos = IndexOf(aBeginCell, '.', 0);
830  OUStringBuffer aBuf(aBeginCell.subView(0, nDotPos));
831 
832  if (nEndCellDotPos == 0)
833  {
834  // workaround for old syntax (probably pre-chart2 age?)
835  // e.g. Sheet1.A1:.B2
836  aBuf.append(aEndCell);
837  }
838  else if (nEndCellDotPos < 0)
839  {
840  // sheet name in the end cell is omitted (e.g. Sheet2.A1:B2).
841  aBuf.append('.');
842  aBuf.append(aEndCell);
843  }
844  aEndCell = aBuf.makeStringAndClear();
845  }
846 
847  ScAddress::ExternalInfo aExtInfo1, aExtInfo2;
848  ScAddress aCell1, aCell2;
849  ScRefFlags nRet = aCell1.Parse(aBeginCell, rDoc, FormulaGrammar::CONV_OOO, &aExtInfo1);
850  if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
851  {
852  // first cell is invalid.
853  if (eConv == FormulaGrammar::CONV_OOO)
854  continue;
855 
856  nRet = aCell1.Parse(aBeginCell, rDoc, eConv, &aExtInfo1);
857  if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
858  // first cell is really invalid.
859  continue;
860  }
861 
862  nRet = aCell2.Parse(aEndCell, rDoc, FormulaGrammar::CONV_OOO, &aExtInfo2);
863  if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
864  {
865  // second cell is invalid.
866  if (eConv == FormulaGrammar::CONV_OOO)
867  continue;
868 
869  nRet = aCell2.Parse(aEndCell, rDoc, eConv, &aExtInfo2);
870  if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
871  // second cell is really invalid.
872  continue;
873  }
874 
875  if (aExtInfo1.mnFileId != aExtInfo2.mnFileId || aExtInfo1.mbExternal != aExtInfo2.mbExternal)
876  // external info inconsistency.
877  continue;
878 
879  // All looks good!
880 
881  if (bFirst)
882  bFirst = false;
883  else
884  aRetStr.append(cSepNew);
885 
886  lcl_appendCellRangeAddress(aRetStr, rDoc, aCell1, aCell2, aExtInfo1, aExtInfo2);
887  }
888  else
889  {
890  // Chart always saves ranges using CONV_OOO convention.
891  ScAddress::ExternalInfo aExtInfo;
892  ScAddress aCell;
893  ScRefFlags nRet = aCell.Parse(aToken, rDoc, ::formula::FormulaGrammar::CONV_OOO, &aExtInfo);
894  if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO )
895  {
896  nRet = aCell.Parse(aToken, rDoc, eConv, &aExtInfo);
897  if ((nRet & ScRefFlags::VALID) == ScRefFlags::ZERO)
898  continue;
899  }
900 
901  // Looks good!
902 
903  if (bFirst)
904  bFirst = false;
905  else
906  aRetStr.append(cSepNew);
907 
908  lcl_appendCellAddress(aRetStr, rDoc, aCell, aExtInfo);
909  }
910  }
911 
912  rString = aRetStr.makeStringAndClear();
913 }
914 
917 {
918  // This may be called with an external 'doc'#name but wouldn't find any.
919 
920  // Dot '.' is not allowed in range names, if present only lookup if it's a
921  // sheet-local name. Same for '!' Excel syntax.
922  // If eConv == FormulaGrammar::CONV_A1_XL_A1 then try both, first our own.
923  sal_Int32 nIndex = -1;
924  if (eConv == FormulaGrammar::CONV_OOO || eConv == FormulaGrammar::CONV_A1_XL_A1)
925  nIndex = ScGlobal::FindUnquoted( rString, '.');
926  if (nIndex < 0 && (eConv == FormulaGrammar::CONV_A1_XL_A1
927  || eConv == FormulaGrammar::CONV_XL_A1
928  || eConv == FormulaGrammar::CONV_XL_R1C1
929  || eConv == FormulaGrammar::CONV_XL_OOX))
930  nIndex = ScGlobal::FindUnquoted( rString, '!');
931 
932  if (nIndex >= 0)
933  {
934  if (nIndex == 0)
935  return nullptr; // Can't be a name.
936 
937  OUString aTab( rString.copy( 0, nIndex));
938  ScGlobal::EraseQuotes( aTab, '\'');
939  SCTAB nLocalTab;
940  if (!rDoc.GetTable( aTab, nLocalTab))
941  return nullptr;
942 
943  ScRangeName* pLocalRangeName = rDoc.GetRangeName(nLocalTab);
944  if (!pLocalRangeName)
945  return nullptr;
946 
947  const OUString aName( rString.copy( nIndex+1));
948  return pLocalRangeName->findByUpperName( ScGlobal::getCharClassPtr()->uppercase( aName));
949  }
950 
951  ScRangeName* pLocalRangeName = rDoc.GetRangeName(nTab);
952  ScRangeData* pData = nullptr;
953  OUString aUpperName = ScGlobal::getCharClassPtr()->uppercase(rString);
954  if(pLocalRangeName)
955  {
956  pData = pLocalRangeName->findByUpperName(aUpperName);
957  }
958  if (!pData)
959  {
960  ScRangeName* pGlobalRangeName = rDoc.GetRangeName();
961  if (pGlobalRangeName)
962  {
963  pData = pGlobalRangeName->findByUpperName(aUpperName);
964  }
965  }
966  return pData;
967 }
968 
970  SCCOL colStart, SCROW rowStart,
971  SCCOL colEnd, SCROW rowEnd ) :
972  nTab ( tab ),
973  nColStart( colStart ), nRowStart( rowStart ),
974  nColEnd ( colEnd ), nRowEnd ( rowEnd )
975 {
976 }
977 
978 bool ScArea::operator==( const ScArea& r ) const
979 {
980  return ( (nTab == r.nTab)
981  && (nColStart == r.nColStart)
982  && (nRowStart == r.nRowStart)
983  && (nColEnd == r.nColEnd)
984  && (nRowEnd == r.nRowEnd) );
985 }
986 
988  pRangeName(rDoc.GetRangeName()),
989  pDBCollection(rDoc.GetDBCollection()),
990  bFirstPass(true)
991 {
992  if (pRangeName)
993  {
994  maRNPos = pRangeName->begin();
995  maRNEnd = pRangeName->end();
996  }
997 }
998 
999 bool ScAreaNameIterator::Next( OUString& rName, ScRange& rRange )
1000 {
1001  for (;;)
1002  {
1003  if ( bFirstPass ) // first the area names
1004  {
1005  if ( pRangeName && maRNPos != maRNEnd )
1006  {
1007  const ScRangeData& rData = *maRNPos->second;
1008  ++maRNPos;
1009  bool bValid = rData.IsValidReference(rRange);
1010  if (bValid)
1011  {
1012  rName = rData.GetName();
1013  return true; // found
1014  }
1015  }
1016  else
1017  {
1018  bFirstPass = false;
1019  if (pDBCollection)
1020  {
1022  maDBPos = rDBs.begin();
1023  maDBEnd = rDBs.end();
1024  }
1025  }
1026  }
1027 
1028  if ( !bFirstPass ) // then the DB areas
1029  {
1030  if (pDBCollection && maDBPos != maDBEnd)
1031  {
1032  const ScDBData& rData = **maDBPos;
1033  ++maDBPos;
1034  rData.GetArea(rRange);
1035  rName = rData.GetName();
1036  return true; // found
1037  }
1038  else
1039  return false; // nothing left
1040  }
1041  }
1042 }
1043 
1045 {
1046  if (rCxt.mnInsertPos <= rAddr.Tab())
1047  {
1048  rAddr.IncTab(rCxt.mnSheets);
1049  }
1050 }
1051 
1053 {
1054  if (rCxt.mnDeletePos <= rAddr.Tab())
1055  {
1056  rAddr.IncTab(-rCxt.mnSheets);
1057  }
1058 }
1059 
1060 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool Next(OUString &rName, ScRange &rRange)
Definition: rangeutl.cxx:999
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
Definition: address.cxx:2116
SCCOL nColEnd
Definition: rangeutl.hxx:249
SCCOL nColStart
Definition: rangeutl.hxx:247
static void UpdateInsertTab(ScAddress &rAddr, const sc::RefUpdateInsertTabContext &rCxt)
Definition: rangeutl.cxx:1044
sal_Int32 nIndex
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
Definition: document.hxx:813
ScAddress aStart
Definition: address.hxx:499
SCROW nRowStart
Definition: rangeutl.hxx:248
RutlNameScope
Definition: rangeutl.hxx:35
void IncTab(SCTAB nDelta=1)
Definition: address.hxx:307
SCROW Row() const
Definition: address.hxx:261
static bool GetAddressFromString(ScAddress &rAddress, const OUString &rAddressStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator= ' ', sal_Unicode cQuote= '\'')
String to Range core.
Definition: rangeutl.cxx:453
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:750
std::unique_ptr< ContentProperties > pData
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)
bool ConvertSingleRef(const ScDocument &rDoc, const OUString &rRefString, SCTAB nDefTab, ScRefAddress &rRefAddress, const ScAddress::Details &rDetails, ScAddress::ExternalInfo *pExtInfo)
Definition: address.cxx:1500
void SetRelTab(bool bNewRelTab)
Definition: address.hxx:877
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:168
ScRangeName * pRangeName
Definition: rangeutl.hxx:258
aBuf
const ContentProperties & rData
ScAddress aEnd
Definition: address.hxx:500
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
Definition: document.hxx:983
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:494
static ScRangeData * GetRangeDataFromString(const OUString &rString, const SCTAB nTab, const ScDocument &rDoc, formula::FormulaGrammar::AddressConvention eConv)
String to RangeData core.
Definition: rangeutl.cxx:915
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:698
static bool GetAreaFromString(ScArea &rArea, const OUString &rRangeStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator= ' ')
Definition: rangeutl.cxx:571
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.
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...
ScArea(SCTAB tab=0, SCCOL colStart=0, SCROW rowStart=0, SCCOL colEnd=0, SCROW rowEnd=0)
Definition: rangeutl.cxx:969
sal_uInt16 sal_Unicode
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:682
formula::FormulaGrammar::AddressConvention eConv
Definition: address.hxx:212
int nCount
SCROW nRowEnd
Definition: rangeutl.hxx:250
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:259
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
Definition: documen3.cxx:623
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1142
bool operator==(const ScArea &r) const
Definition: rangeutl.cxx:978
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Definition: document.cxx:190
SCTAB Tab() const
Definition: address.hxx:270
SC_DLLPUBLIC const_iterator begin() const
Definition: rangenam.cxx:777
void GetName(OUString &rName) const
Definition: rangenam.hxx:110
static sal_Unicode GetNativeSymbolChar(OpCode eOp)
static sal_Int32 GetTokenCount(const OUString &rString, sal_Unicode cSeparator= ' ')
Definition: rangeutl.cxx:439
static bool GetRangeFromString(ScRange &rRange, const OUString &rRangeStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator= ' ', sal_Unicode cQuote= '\'')
ocSep
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:666
static void AssignString(OUString &rString, const OUString &rNewStr, bool bAppendStr, sal_Unicode cSeparator= ' ')
helper methods
Definition: rangeutl.cxx:347
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
Definition: rangenam.cxx:679
SC_DLLPUBLIC const_iterator end() const
Definition: rangenam.cxx:782
static bool MakeArea(const OUString &rAreaStr, ScArea &rArea, const ScDocument &rDoc, SCTAB nTab, ScAddress::Details const &rDetails)
Definition: rangeutl.cxx:36
ScRangeName::const_iterator maRNPos
Definition: rangeutl.hxx:260
SC_DLLPUBLIC void GetSymbol(OUString &rSymbol, const formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_DEFAULT) const
Definition: rangenam.cxx:243
int i
sal_Int16 SCCOL
Definition: types.hxx:21
SC_DLLPUBLIC 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:2212
static void GetStringFromRangeList(OUString &rString, const ScRangeList *pRangeList, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator= ' ')
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
size_t size() const
Definition: rangelst.hxx:89
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
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
static sal_Int32 IndexOfDifferent(const OUString &rString, sal_Unicode cSearchChar, sal_Int32 nOffset)
Definition: rangeutl.cxx:388
const OUString & GetName() const
Definition: dbdata.hxx:121
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
const SCTAB MAXTAB
Definition: address.hxx:70
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:300
SCCOL Col() const
Definition: address.hxx:266
static bool MakeRangeFromName(const OUString &rName, const ScDocument &rDoc, SCTAB nCurTab, ScRange &rRange, RutlNameScope eScope=RUTL_NAMES, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1)
Definition: rangeutl.cxx:233
ScDBCollection * pDBCollection
Definition: rangeutl.hxx:259
ScDBData * findByUpperName(const OUString &rName)
Definition: dbdata.cxx:1147
ScRangeName::const_iterator maRNEnd
Definition: rangeutl.hxx:261
Stores global named database ranges.
Definition: dbdata.hxx:234
ScDBCollection::NamedDBs::const_iterator maDBPos
Definition: rangeutl.hxx:262
static void AppendTableName(OUStringBuffer &rBuf, const OUString &rTabName)
Definition: rangeutl.cxx:431
sal_Int32 SCROW
Definition: types.hxx:17
ScAreaNameIterator(const ScDocument &rDoc)
Definition: rangeutl.cxx:987
SCROW Row() const
Definition: address.hxx:896
OUString aName
static void UpdateDeleteTab(ScAddress &rAddr, const sc::RefUpdateDeleteTabContext &rCxt)
Definition: rangeutl.cxx:1052
ScDBCollection::NamedDBs::const_iterator maDBEnd
Definition: rangeutl.hxx:263
SC_DLLPUBLIC 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:1742
SCCOL Col() const
Definition: address.hxx:892
static SC_DLLPUBLIC const CharClass * getCharClassPtr()
Definition: global.cxx:1009
SC_DLLPUBLIC bool IsValidReference(ScRange &rRef) const
Definition: rangenam.cxx:382
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:314
static bool GetRangeListFromString(ScRangeList &rRangeList, const OUString &rRangeListStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator= ' ', sal_Unicode cQuote= '\'')
Definition: rangeutl.cxx:544
void SetRelCol(bool bNewRelCol)
Definition: address.hxx:869
bool ConvertDoubleRef(const ScDocument &rDoc, const OUString &rRefString, SCTAB nDefTab, ScRefAddress &rStartRefAddress, ScRefAddress &rEndRefAddress, const ScAddress::Details &rDetails, ScAddress::ExternalInfo *pExtInfo)
Definition: address.cxx:1522
static void FillApiRange(css::table::CellRangeAddress &rApiRange, const ScRange &rScRange)
Definition: convuno.hxx:87
SCTAB nTab
Definition: rangeutl.hxx:246
static sal_Int32 IndexOf(const OUString &rString, sal_Unicode cSearchChar, sal_Int32 nOffset, sal_Unicode cQuote= '\'')
Definition: rangeutl.cxx:366
SCTAB Tab() const
Definition: address.hxx:900
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:1548
sal_Int32 nLength
OUString GetRefString(const ScDocument &rDocument, SCTAB nActTab, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1) const
Definition: address.cxx:2520
ScRefFlags
Definition: address.hxx:144
static void lcl_appendCellAddress(OUStringBuffer &rBuf, const ScDocument &rDoc, const ScAddress &rCell, const ScAddress::ExternalInfo &rExtInfo)
Definition: rangeutl.cxx:720
static void GetStringFromXMLRangeString(OUString &rString, const OUString &rXMLRange, const ScDocument &rDoc)
XML Range to Calc Range.
Definition: rangeutl.cxx:798
static void CheckTabQuotes(OUString &aTabName, const formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO)
all
Definition: compiler.cxx:1929
static void GetTokenByOffset(OUString &rToken, const OUString &rString, sal_Int32 &nOffset, sal_Unicode cSeparator= ' ', sal_Unicode cQuote= '\'')
Definition: rangeutl.cxx:406
static void CutPosString(const OUString &theAreaStr, OUString &thePosStr)
Definition: rangeutl.cxx:69
sal_Int16 SCTAB
Definition: types.hxx:22
void SetRelRow(bool bNewRelRow)
Definition: address.hxx:873