LibreOffice Module sc (master)  1
XMLStylesExportHelper.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 
21 #include <tools/lineend.hxx>
22 #include <unonames.hxx>
23 #include "xmlexprt.hxx"
24 #include <document.hxx>
25 #include <rangeutl.hxx>
26 #include <xmloff/xmltoken.hxx>
27 #include <xmloff/xmlnamespace.hxx>
29 #include <xmloff/namespacemap.hxx>
30 #include <com/sun/star/uno/Reference.h>
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/sheet/XSheetCondition.hpp>
33 #include <com/sun/star/sheet/TableValidationVisibility.hpp>
34 #include <comphelper/extract.hxx>
36 #include <sfx2/app.hxx>
37 #include <o3tl/safeint.hxx>
38 #include <o3tl/string_view.hxx>
39 #include <osl/diagnose.h>
40 
41 using namespace com::sun::star;
42 using namespace xmloff::token;
43 
45  : aAlertStyle(sheet::ValidationAlertStyle_STOP),
46  aValidationType(sheet::ValidationType_ANY),
47  aOperator(sheet::ConditionOperator_NONE),
48  nShowList(0),
49  bShowErrorMessage(false),
50  bShowInputMessage(false),
51  bIgnoreBlanks(false)
52 {
53 }
54 
55 bool ScMyValidation::IsEqual(const ScMyValidation& aVal) const
56 {
57  return aVal.bIgnoreBlanks == bIgnoreBlanks &&
60  aVal.aBaseCell == aBaseCell &&
61  aVal.aAlertStyle == aAlertStyle &&
63  aVal.aOperator == aOperator &&
64  aVal.sErrorTitle == sErrorTitle &&
65  aVal.sInputTitle == sInputTitle &&
66  aVal.sErrorMessage == sErrorMessage &&
67  aVal.sInputMessage == sInputMessage &&
68  aVal.sFormula1 == sFormula1 &&
69  aVal.sFormula2 == sFormula2;
70 }
71 
73 {
74 }
75 
77 {
78 }
79 
81  sal_Int32& nValidationIndex)
82 {
83  uno::Reference<beans::XPropertySet> xPropertySet(aTempAny, uno::UNO_QUERY);
84  if (!xPropertySet.is())
85  return;
86 
87  OUString sErrorMessage;
88  xPropertySet->getPropertyValue(SC_UNONAME_ERRMESS) >>= sErrorMessage;
89  OUString sErrorTitle;
90  xPropertySet->getPropertyValue(SC_UNONAME_ERRTITLE) >>= sErrorTitle;
91  OUString sInputMessage;
92  xPropertySet->getPropertyValue(SC_UNONAME_INPMESS) >>= sInputMessage;
93  OUString sInputTitle;
94  xPropertySet->getPropertyValue(SC_UNONAME_INPTITLE) >>= sInputTitle;
95  bool bShowErrorMessage = ::cppu::any2bool(xPropertySet->getPropertyValue(SC_UNONAME_SHOWERR));
96  bool bShowInputMessage = ::cppu::any2bool(xPropertySet->getPropertyValue(SC_UNONAME_SHOWINP));
97  sheet::ValidationType aValidationType;
98  xPropertySet->getPropertyValue(SC_UNONAME_TYPE) >>= aValidationType;
99  if (!bShowErrorMessage && !bShowInputMessage && aValidationType == sheet::ValidationType_ANY &&
100  sErrorMessage.isEmpty() && sErrorTitle.isEmpty() && sInputMessage.isEmpty() && sInputTitle.isEmpty())
101  return;
102 
103  ScMyValidation aValidation;
104  aValidation.sErrorMessage = sErrorMessage;
105  aValidation.sErrorTitle = sErrorTitle;
106  aValidation.sInputMessage = sInputMessage;
107  aValidation.sInputTitle = sInputTitle;
108  aValidation.bShowErrorMessage = bShowErrorMessage;
109  aValidation.bShowInputMessage = bShowInputMessage;
110  aValidation.aValidationType = aValidationType;
111  aValidation.bIgnoreBlanks = ::cppu::any2bool(xPropertySet->getPropertyValue(SC_UNONAME_IGNOREBL));
112  xPropertySet->getPropertyValue(SC_UNONAME_SHOWLIST) >>= aValidation.nShowList;
113  xPropertySet->getPropertyValue(SC_UNONAME_ERRALSTY) >>= aValidation.aAlertStyle;
114  uno::Reference<sheet::XSheetCondition> xCondition(xPropertySet, uno::UNO_QUERY);
115  if (xCondition.is())
116  {
117  aValidation.sFormula1 = xCondition->getFormula1();
118  aValidation.sFormula2 = xCondition->getFormula2();
119  aValidation.aOperator = xCondition->getOperator();
120  table::CellAddress aCellAddress= xCondition->getSourcePosition();
121  aValidation.aBaseCell = ScAddress( static_cast<SCCOL>(aCellAddress.Column), static_cast<SCROW>(aCellAddress.Row), aCellAddress.Sheet );
122  }
123  //ScMyValidationRange aValidationRange;
124  bool bEqualFound(false);
125  sal_Int32 i(0);
126  sal_Int32 nCount(aValidationVec.size());
127  while (i < nCount && !bEqualFound)
128  {
129  bEqualFound = aValidationVec[i].IsEqual(aValidation);
130  if (!bEqualFound)
131  ++i;
132  }
133  if (bEqualFound)
134  nValidationIndex = i;
135  else
136  {
137  sal_Int32 nNameIndex(nCount + 1);
138  OUString sCount(OUString::number(nNameIndex));
139  aValidation.sName += "val";
140  aValidation.sName += sCount;
141  aValidationVec.push_back(aValidation);
142  nValidationIndex = nCount;
143  }
144 }
145 
147 {
148  /* ATTENTION! Should the condition to not write sheet::ValidationType_ANY
149  * ever be changed, adapt the conditional call of
150  * MarkUsedExternalReferences() in
151  * ScTableValidationObj::ScTableValidationObj() accordingly! */
152  OUString sCondition;
153  if (aValidation.aValidationType != sheet::ValidationType_ANY)
154  {
155  switch (aValidation.aValidationType)
156  {
157  //case sheet::ValidationType_CUSTOM
158  case sheet::ValidationType_DATE :
159  sCondition += "cell-content-is-date()";
160  break;
161  case sheet::ValidationType_DECIMAL :
162  sCondition += "cell-content-is-decimal-number()";
163  break;
164  case sheet::ValidationType_LIST :
165  sCondition += "cell-content-is-in-list(" + aValidation.sFormula1 + ")";
166  break;
167  case sheet::ValidationType_TEXT_LEN :
168  if (aValidation.aOperator != sheet::ConditionOperator_BETWEEN &&
169  aValidation.aOperator != sheet::ConditionOperator_NOT_BETWEEN)
170  sCondition += "cell-content-text-length()";
171  break;
172  case sheet::ValidationType_TIME :
173  sCondition += "cell-content-is-time()";
174  break;
175  case sheet::ValidationType_WHOLE :
176  sCondition += "cell-content-is-whole-number()";
177  break;
178  case sheet::ValidationType_CUSTOM :
179  sCondition += "is-true-formula(" + aValidation.sFormula1 + ")";
180  break;
181  default:
182  {
183  // added to avoid warnings
184  }
185  }
186  if (aValidation.aValidationType != sheet::ValidationType_LIST &&
187  aValidation.aValidationType != sheet::ValidationType_CUSTOM &&
188  (!aValidation.sFormula1.isEmpty() ||
189  ((aValidation.aOperator == sheet::ConditionOperator_BETWEEN ||
190  aValidation.aOperator == sheet::ConditionOperator_NOT_BETWEEN) &&
191  !aValidation.sFormula2.isEmpty())))
192  {
193  if (aValidation.aValidationType != sheet::ValidationType_TEXT_LEN)
194  sCondition += " and ";
195  if (aValidation.aOperator != sheet::ConditionOperator_BETWEEN &&
196  aValidation.aOperator != sheet::ConditionOperator_NOT_BETWEEN)
197  {
198  if (aValidation.aValidationType != sheet::ValidationType_TEXT_LEN)
199  sCondition += "cell-content()";
200  switch (aValidation.aOperator)
201  {
202  case sheet::ConditionOperator_EQUAL :
203  sCondition += "=";
204  break;
205  case sheet::ConditionOperator_GREATER :
206  sCondition += ">";
207  break;
208  case sheet::ConditionOperator_GREATER_EQUAL :
209  sCondition += ">=";
210  break;
211  case sheet::ConditionOperator_LESS :
212  sCondition += "<";
213  break;
214  case sheet::ConditionOperator_LESS_EQUAL :
215  sCondition += "<=";
216  break;
217  case sheet::ConditionOperator_NOT_EQUAL :
218  sCondition += "!=";
219  break;
220  default:
221  {
222  // added to avoid warnings
223  }
224  }
225  sCondition += aValidation.sFormula1;
226  }
227  else
228  {
229  if (aValidation.aValidationType == sheet::ValidationType_TEXT_LEN)
230  {
231  if (aValidation.aOperator == sheet::ConditionOperator_BETWEEN)
232  sCondition += "cell-content-text-length-is-between(";
233  else
234  sCondition += "cell-content-text-length-is-not-between(";
235  }
236  else
237  {
238  if (aValidation.aOperator == sheet::ConditionOperator_BETWEEN)
239  sCondition += "cell-content-is-between(";
240  else
241  sCondition += "cell-content-is-not-between(";
242  }
243  sCondition += aValidation.sFormula1 + "," + aValidation.sFormula2 + ")";
244  }
245  }
246  else
247  if (aValidation.aValidationType == sheet::ValidationType_TEXT_LEN)
248  sCondition.clear();
249  }
250  if (!sCondition.isEmpty())
251  {
252  const formula::FormulaGrammar::Grammar eGrammar = rExport.GetDocument()->GetStorageGrammar();
253  sal_uInt16 nNamespacePrefix = (eGrammar == formula::FormulaGrammar::GRAM_ODFF ? XML_NAMESPACE_OF : XML_NAMESPACE_OOOC);
254  sCondition = rExport.GetNamespaceMap().GetQNameByKey( nNamespacePrefix, sCondition, false );
255  }
256 
257  return sCondition;
258 }
259 
261 {
262  OUString sAddress;
264  return sAddress;
265 }
266 
268  const OUString& sTitle, const OUString& sOUMessage,
269  const bool bShowMessage, const bool bIsHelpMessage)
270 {
271  if (!sTitle.isEmpty())
272  rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_TITLE, sTitle);
273  if (bShowMessage)
275  else
277  std::unique_ptr<SvXMLElementExport> pMessage;
278  if (bIsHelpMessage)
279  pMessage.reset(new SvXMLElementExport(rExport, XML_NAMESPACE_TABLE, XML_HELP_MESSAGE, true, true));
280  else
281  pMessage.reset(new SvXMLElementExport(rExport, XML_NAMESPACE_TABLE, XML_ERROR_MESSAGE, true, true));
282  if (sOUMessage.isEmpty())
283  return;
284 
285  sal_Int32 i(0);
286  OUStringBuffer sTemp;
287  OUString sText(convertLineEnd(sOUMessage, LINEEND_LF));
288  bool bPrevCharWasSpace(true);
289  while(i < sText.getLength())
290  {
291  if( sText[i] == '\n')
292  {
293  SvXMLElementExport aElemP(rExport, XML_NAMESPACE_TEXT, XML_P, true, false);
294  rExport.GetTextParagraphExport()->exportCharacterData(sTemp.makeStringAndClear(), bPrevCharWasSpace);
295  bPrevCharWasSpace = true; // reset for start of next paragraph
296  }
297  else
298  sTemp.append(sText[i]);
299  ++i;
300  }
301  if (!sTemp.isEmpty())
302  {
303  SvXMLElementExport aElemP(rExport, XML_NAMESPACE_TEXT, XML_P, true, false);
304  rExport.GetTextParagraphExport()->exportCharacterData(sTemp.makeStringAndClear(), bPrevCharWasSpace);
305  }
306 }
307 
309 {
310  if (aValidationVec.empty())
311  return;
312 
313  SvXMLElementExport aElemVs(rExport, XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATIONS, true, true);
314  for (const auto& rValidation : aValidationVec)
315  {
316  rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, rValidation.sName);
317  OUString sCondition(GetCondition(rExport, rValidation));
318  if (!sCondition.isEmpty())
319  {
320  rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_CONDITION, sCondition);
321  if (rValidation.bIgnoreBlanks)
323  else
325  if (rValidation.aValidationType == sheet::ValidationType_LIST)
326  {
327  switch (rValidation.nShowList)
328  {
329  case sheet::TableValidationVisibility::INVISIBLE:
331  break;
332  case sheet::TableValidationVisibility::UNSORTED:
334  break;
335  case sheet::TableValidationVisibility::SORTEDASCENDING:
337  break;
338  default:
339  OSL_FAIL("unknown ListType");
340  }
341  }
342  }
343  rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, GetBaseCellAddress(rExport.GetDocument(), rValidation.aBaseCell));
344  SvXMLElementExport aElemV(rExport, XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, true, true);
345  if (rValidation.bShowInputMessage || !rValidation.sInputMessage.isEmpty() || !rValidation.sInputTitle.isEmpty())
346  {
347  WriteMessage(rExport, rValidation.sInputTitle, rValidation.sInputMessage, rValidation.bShowInputMessage, true);
348  }
349  if (rValidation.bShowErrorMessage || !rValidation.sErrorMessage.isEmpty() || !rValidation.sErrorTitle.isEmpty())
350  {
351  switch (rValidation.aAlertStyle)
352  {
353  case sheet::ValidationAlertStyle_INFO :
354  {
356  WriteMessage(rExport, rValidation.sErrorTitle, rValidation.sErrorMessage, rValidation.bShowErrorMessage, false);
357  }
358  break;
359  case sheet::ValidationAlertStyle_WARNING :
360  {
362  WriteMessage(rExport, rValidation.sErrorTitle, rValidation.sErrorMessage, rValidation.bShowErrorMessage, false);
363  }
364  break;
365  case sheet::ValidationAlertStyle_STOP :
366  {
368  WriteMessage(rExport, rValidation.sErrorTitle, rValidation.sErrorMessage, rValidation.bShowErrorMessage, false);
369  }
370  break;
371  case sheet::ValidationAlertStyle_MACRO :
372  {
373  {
374  //rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, aItr->sErrorTitle);
375  if (rValidation.bShowErrorMessage)
377  else
379  SvXMLElementExport aEMElem(rExport, XML_NAMESPACE_TABLE, XML_ERROR_MACRO, true, true);
380  }
381  {
382  // #i47525# for a script URL the type and the property name for the URL
383  // are both "Script", for a simple macro name the type is "StarBasic"
384  // and the property name is "MacroName".
385  bool bScriptURL = SfxApplication::IsXScriptURL( rValidation.sErrorTitle );
386 
387  static const OUStringLiteral sScript(u"Script");
388  uno::Sequence<beans::PropertyValue> aSeq( comphelper::InitPropertySequence({
389  { "EventType", uno::Any(bScriptURL ? sScript : OUString("StarBasic")) },
390  { "Library", uno::Any(OUString()) },
391  { bScriptURL ? sScript : OUString("MacroName"), uno::Any(rValidation.sErrorTitle) }
392  }));
393  // 2) export the sequence
394  rExport.GetEventExport().ExportSingleEvent( aSeq, "OnError");
395  }
396  }
397  break;
398  default:
399  {
400  // added to avoid warnings
401  }
402  }
403  }
404  }
405 }
406 
407 const OUString& ScMyValidationsContainer::GetValidationName(const sal_Int32 nIndex)
408 {
409  OSL_ENSURE( o3tl::make_unsigned(nIndex) < aValidationVec.size(), "out of range" );
410  return aValidationVec[nIndex].sName;
411 }
412 
414  const sal_Int32 nTable, const sal_Int32 nPos,
415  const sal_Int32 i, bool& bIsAutoStyle)
416 {
417  return pCellStyles->GetStyleNameIndex(nTable, i, nPos, bIsAutoStyle);
418 }
419 
420 void ScMyDefaultStyles::FillDefaultStyles(const sal_Int32 nTable,
421  const sal_Int32 nLastRow, const sal_Int32 nLastCol,
422  const ScFormatRangeStyles* pCellStyles, ScDocument* pDoc)
423 {
424  maColDefaults.clear();
425  maColDefaults.resize(nLastCol + 1);
426  if (!pDoc)
427  return ;
428 
429  SCTAB nTab = static_cast<SCTAB>(nTable);
430  pDoc->CreateColumnIfNotExists(nTab, nLastCol);
431  sal_Int32 nPos;
432  ScMyDefaultStyleList* pDefaults = &maColDefaults;
433  bool bPrevAutoStyle(false);
434  bool bIsAutoStyle;
435  sal_Int32 nPrevIndex(0);
436  sal_Int32 nRepeat(0);
437  for (sal_Int32 i = nLastCol; i >= 0; --i)
438  {
439  pDoc->GetColDefault(nTab, static_cast<SCCOL>(i), static_cast<SCROW>(nLastRow), nPos);
440  if (!nRepeat)
441  {
442  nPrevIndex = GetStyleNameIndex(pCellStyles, nTab, nPos, i, bPrevAutoStyle);
443  (*pDefaults)[i].nIndex = nPrevIndex;
444  (*pDefaults)[i].bIsAutoStyle = bPrevAutoStyle;
445  nRepeat = 1;
446  }
447  else
448  {
449  sal_Int32 nIndex = GetStyleNameIndex(pCellStyles, nTab, nPos, i, bIsAutoStyle);
450  if ((nIndex != nPrevIndex) || (bIsAutoStyle != bPrevAutoStyle))
451  {
452  nRepeat = 1;
453  nPrevIndex = GetStyleNameIndex(pCellStyles, nTab, nPos, i, bPrevAutoStyle);
454  (*pDefaults)[i].nIndex = nPrevIndex;
455  (*pDefaults)[i].bIsAutoStyle = bPrevAutoStyle;
456  }
457  else
458  {
459  (*pDefaults)[i].nIndex = nPrevIndex;
460  (*pDefaults)[i].bIsAutoStyle = bPrevAutoStyle;
461  ++nRepeat;
462  if (nRepeat > 1)
463  (*pDefaults)[i].nRepeat = nRepeat;
464  }
465  }
466  }
467 }
468 
470  : nStartColumn(0),
471  nRepeatColumns(0),
472  nRepeatRows(0),
473  nIndex(-1),
474  nValidationIndex(-1),
475  bIsAutoStyle(true)
476 {
477 }
478 
480 {
481  return (nStartColumn < rRange.nStartColumn);
482 }
483 
485  : pColDefaults(nullptr),
486  nSize(0)
487 {
488 }
489 
491  : aRowFormatRanges(pRanges->aRowFormatRanges),
492  pColDefaults(pRanges->pColDefaults),
493  nSize(pRanges->nSize)
494 {
495 }
496 
498 {
499 }
500 
502 {
503  aRowFormatRanges.clear();
504  nSize = 0;
505 }
506 
507 void ScRowFormatRanges::AddRange(const sal_Int32 nPrevStartCol, const sal_Int32 nRepeat, const sal_Int32 nPrevIndex,
508  const bool bPrevAutoStyle, const ScMyRowFormatRange& rFormatRange)
509 {
510  sal_Int32 nIndex(-1);
511  if ((nPrevIndex != rFormatRange.nIndex) ||
512  (bPrevAutoStyle != rFormatRange.bIsAutoStyle))
513  nIndex = rFormatRange.nIndex;
514 
515  bool bInserted(false);
516  if (!aRowFormatRanges.empty())
517  {
518  ScMyRowFormatRange& rRange(aRowFormatRanges.back());
519  if ((nPrevStartCol == (rRange.nStartColumn + rRange.nRepeatColumns))
520  && (rRange.bIsAutoStyle == rFormatRange.bIsAutoStyle) && (rRange.nIndex == nIndex)
521  && (rRange.nValidationIndex == rFormatRange.nValidationIndex))
522  {
523  if (rFormatRange.nRepeatRows < rRange.nRepeatRows)
524  rRange.nRepeatRows = rFormatRange.nRepeatRows;
525  rRange.nRepeatColumns += nRepeat;
526  bInserted = true;
527  }
528  }
529  if (!bInserted)
530  {
531  ScMyRowFormatRange aRange;
532  aRange.nStartColumn = nPrevStartCol;
533  aRange.nRepeatColumns = nRepeat;
534  aRange.nRepeatRows = rFormatRange.nRepeatRows;
535  aRange.nValidationIndex = rFormatRange.nValidationIndex;
536  aRange.bIsAutoStyle = rFormatRange.bIsAutoStyle;
537  aRange.nIndex = nIndex;
538  aRowFormatRanges.push_back(aRange);
539  ++nSize;
540  }
541 }
542 
544 {
545  OSL_ENSURE(pColDefaults, "no column defaults");
546  if (!pColDefaults)
547  return;
548  sal_Int32 nPrevIndex = -1;
549  bool bPrevAutoStyle = true;
550 
551  sal_uInt32 nPrevStartCol(rFormatRange.nStartColumn);
552  OSL_ENSURE( static_cast<size_t>(nPrevStartCol) < pColDefaults->size(), "nPrevStartCol out of bounds");
553  sal_uInt32 nRepeat;
554  if (static_cast<size_t>(nPrevStartCol) < pColDefaults->size())
555  {
556  nRepeat = (*pColDefaults)[nPrevStartCol].nRepeat;
557  nPrevIndex = (*pColDefaults)[nPrevStartCol].nIndex;
558  bPrevAutoStyle = (*pColDefaults)[nPrevStartCol].bIsAutoStyle;
559  }
560  else
561  {
562  /* Again, this is to prevent out-of-bounds accesses, so FIXME
563  * elsewhere! */
564  if (pColDefaults->empty())
565  {
566  nRepeat = 1;
567  nPrevIndex = -1;
568  bPrevAutoStyle = false;
569  }
570  else
571  {
572  nRepeat = (*pColDefaults)[pColDefaults->size()-1].nRepeat;
573  nPrevIndex = (*pColDefaults)[pColDefaults->size()-1].nIndex;
574  bPrevAutoStyle = (*pColDefaults)[pColDefaults->size()-1].bIsAutoStyle;
575  }
576  }
577  sal_uInt32 nEnd = nPrevStartCol + rFormatRange.nRepeatColumns;
578  for(sal_uInt32 i = nPrevStartCol + nRepeat; i < nEnd && i < pColDefaults->size(); i += (*pColDefaults)[i].nRepeat)
579  {
580  OSL_ENSURE(sal_uInt32(nPrevStartCol + nRepeat) <= nEnd, "something went wrong");
581  if ((nPrevIndex != (*pColDefaults)[i].nIndex) ||
582  (bPrevAutoStyle != (*pColDefaults)[i].bIsAutoStyle))
583  {
584  AddRange(nPrevStartCol, nRepeat, nPrevIndex, bPrevAutoStyle, rFormatRange);
585  nPrevStartCol = i;
586  nRepeat = (*pColDefaults)[i].nRepeat;
587  nPrevIndex = (*pColDefaults)[i].nIndex;
588  bPrevAutoStyle = (*pColDefaults)[i].bIsAutoStyle;
589  }
590  else
591  nRepeat += (*pColDefaults)[i].nRepeat;
592  }
593  if (sal_uInt32(nPrevStartCol + nRepeat) > nEnd)
594  nRepeat = nEnd - nPrevStartCol;
595  AddRange(nPrevStartCol, nRepeat, nPrevIndex, bPrevAutoStyle, rFormatRange);
596 
597 }
598 
600 {
601  ScMyRowFormatRangesList::iterator aItr(aRowFormatRanges.begin());
602  if (aItr != aRowFormatRanges.end())
603  {
604  aFormatRange = *aItr;
605  aRowFormatRanges.erase(aItr);
606  --nSize;
607  return true;
608  }
609  return false;
610 }
611 
613 {
614  sal_Int32 nMaxRows(0);
615  if (!aRowFormatRanges.empty())
616  {
617  auto aItr = std::min_element(aRowFormatRanges.begin(), aRowFormatRanges.end(),
618  [](const ScMyRowFormatRange& a, const ScMyRowFormatRange& b) { return a.nRepeatRows < b.nRepeatRows; });
619  nMaxRows = (*aItr).nRepeatRows;
620  }
621  else
622  {
623  OSL_FAIL("no ranges found");
624  }
625  return nMaxRows;
626 }
627 
629 {
630  aRowFormatRanges.sort();
631 }
632 
634  : nStyleNameIndex(-1)
635  , nValidationIndex(-1)
636  , nNumberFormat(0)
637  , bIsAutoStyle(true)
638 {
639 }
640 
642 {
643  if (aRangeAddress.StartRow < rRange.aRangeAddress.StartRow)
644  return true;
645  else
646  if (aRangeAddress.StartRow == rRange.aRangeAddress.StartRow)
647  return (aRangeAddress.StartColumn < rRange.aRangeAddress.StartColumn);
648  else
649  return false;
650 }
651 
653  : pColDefaults(nullptr)
654 {
655 }
656 
658 {
659 }
660 
661 void ScFormatRangeStyles::AddNewTable(const sal_Int32 nTable)
662 {
663  sal_Int32 nSize = aTables.size() - 1;
664  if (nTable > nSize)
665  for (sal_Int32 i = nSize; i < nTable; ++i)
666  {
667  aTables.emplace_back();
668  }
669 }
670 
671 bool ScFormatRangeStyles::AddStyleName(OUString const & rString, sal_Int32& rIndex, const bool bIsAutoStyle)
672 {
673  if (bIsAutoStyle)
674  {
675  aAutoStyleNames.push_back(rString);
676  rIndex = aAutoStyleNames.size() - 1;
677  return true;
678  }
679  else
680  {
681  sal_Int32 nCount(aStyleNames.size());
682  bool bFound(false);
683  sal_Int32 i(nCount - 1);
684  while ((i >= 0) && (!bFound))
685  {
686  if (aStyleNames.at(i) == rString)
687  bFound = true;
688  else
689  i--;
690  }
691  if (bFound)
692  {
693  rIndex = i;
694  return false;
695  }
696  else
697  {
698  aStyleNames.push_back(rString);
699  rIndex = aStyleNames.size() - 1;
700  return true;
701  }
702  }
703 }
704 
705 sal_Int32 ScFormatRangeStyles::GetIndexOfStyleName(std::u16string_view rString, const OUString& rPrefix, bool& bIsAutoStyle)
706 {
707  sal_Int32 nPrefixLength(rPrefix.getLength());
708  std::u16string_view sTemp(rString.substr(nPrefixLength));
709  sal_Int32 nIndex(o3tl::toInt32(sTemp));
710  if (nIndex > 0 && o3tl::make_unsigned(nIndex-1) < aAutoStyleNames.size() && aAutoStyleNames.at(nIndex - 1) == rString)
711  {
712  bIsAutoStyle = true;
713  return nIndex - 1;
714  }
715  else
716  {
717  sal_Int32 i(0);
718  bool bFound(false);
719  while (!bFound && o3tl::make_unsigned(i) < aStyleNames.size())
720  {
721  if (aStyleNames[i] == rString)
722  bFound = true;
723  else
724  ++i;
725  }
726  if (bFound)
727  {
728  bIsAutoStyle = false;
729  return i;
730  }
731  else
732  {
733  i = 0;
734  while (!bFound && o3tl::make_unsigned(i) < aAutoStyleNames.size())
735  {
736  if (aAutoStyleNames[i] == rString)
737  bFound = true;
738  else
739  ++i;
740  }
741  if (bFound)
742  {
743  bIsAutoStyle = true;
744  return i;
745  }
746  else
747  return -1;
748  }
749  }
750 }
751 
752 sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable,
753  const sal_Int32 nColumn, const sal_Int32 nRow, bool& bIsAutoStyle) const
754 {
755  OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table");
756  bIsAutoStyle = false;
757  if (o3tl::make_unsigned(nTable) >= aTables.size())
758  return -1;
759  for (const ScMyFormatRange & rFormatRange : aTables[nTable])
760  {
761  if ((rFormatRange.aRangeAddress.StartColumn <= nColumn) &&
762  (rFormatRange.aRangeAddress.EndColumn >= nColumn) &&
763  (rFormatRange.aRangeAddress.StartRow <= nRow) &&
764  (rFormatRange.aRangeAddress.EndRow >= nRow))
765  {
766  bIsAutoStyle = rFormatRange.bIsAutoStyle;
767  return rFormatRange.nStyleNameIndex;
768  }
769  }
770  return -1;
771 }
772 
773 sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nColumn, const sal_Int32 nRow,
774  bool& bIsAutoStyle, sal_Int32& nValidationIndex, sal_Int32& nNumberFormat, const sal_Int32 nRemoveBeforeRow)
775 {
776  OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table");
777  if (o3tl::make_unsigned(nTable) >= aTables.size())
778  return -1;
779  ScMyFormatRangeAddresses& rFormatRanges(aTables[nTable]);
780  ScMyFormatRangeAddresses::iterator aItr(rFormatRanges.begin());
781  ScMyFormatRangeAddresses::iterator aEndItr(rFormatRanges.end());
782  while (aItr != aEndItr)
783  {
784  if (((*aItr).aRangeAddress.StartColumn <= nColumn) &&
785  ((*aItr).aRangeAddress.EndColumn >= nColumn) &&
786  ((*aItr).aRangeAddress.StartRow <= nRow) &&
787  ((*aItr).aRangeAddress.EndRow >= nRow))
788  {
789  bIsAutoStyle = aItr->bIsAutoStyle;
790  nValidationIndex = aItr->nValidationIndex;
791  nNumberFormat = aItr->nNumberFormat;
792  OSL_ENSURE( o3tl::make_unsigned(nColumn) < pColDefaults->size(), "nColumn out of bounds");
793  if (o3tl::make_unsigned(nColumn) < pColDefaults->size() &&
794  ((*pColDefaults)[nColumn].nIndex != -1) &&
795  ((*pColDefaults)[nColumn].nIndex == (*aItr).nStyleNameIndex) &&
796  ((*pColDefaults)[nColumn].bIsAutoStyle == (*aItr).bIsAutoStyle))
797  return -1;
798  else
799  return (*aItr).nStyleNameIndex;
800  }
801  else
802  {
803  if ((*aItr).aRangeAddress.EndRow < nRemoveBeforeRow)
804  aItr = rFormatRanges.erase(aItr);
805  else
806  ++aItr;
807  }
808  }
809  return -1;
810 }
811 
812 void ScFormatRangeStyles::GetFormatRanges(const sal_Int32 nStartColumn, const sal_Int32 nEndColumn, const sal_Int32 nRow,
813  const sal_Int32 nTable, ScRowFormatRanges* pRowFormatRanges)
814 {
815  sal_Int32 nTotalColumns(nEndColumn - nStartColumn + 1);
816  OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table");
817  ScMyFormatRangeAddresses& rFormatRanges(aTables[nTable]);
818  ScMyFormatRangeAddresses::iterator aItr(rFormatRanges.begin());
819  ScMyFormatRangeAddresses::iterator aEndItr(rFormatRanges.end());
820  sal_Int32 nColumns = 0;
821  while (aItr != aEndItr && nColumns < nTotalColumns)
822  {
823  if (((*aItr).aRangeAddress.StartRow <= nRow) &&
824  ((*aItr).aRangeAddress.EndRow >= nRow))
825  {
826  if ((((*aItr).aRangeAddress.StartColumn <= nStartColumn) &&
827  ((*aItr).aRangeAddress.EndColumn >= nStartColumn)) ||
828  (((*aItr).aRangeAddress.StartColumn <= nEndColumn) &&
829  ((*aItr).aRangeAddress.EndColumn >= nEndColumn)) ||
830  (((*aItr).aRangeAddress.StartColumn >= nStartColumn) &&
831  ((*aItr).aRangeAddress.EndColumn <= nEndColumn)))
832  {
833  ScMyRowFormatRange aRange;
834  aRange.nIndex = aItr->nStyleNameIndex;
835  aRange.nValidationIndex = aItr->nValidationIndex;
836  aRange.bIsAutoStyle = aItr->bIsAutoStyle;
837  if ((aItr->aRangeAddress.StartColumn < nStartColumn) &&
838  (aItr->aRangeAddress.EndColumn >= nStartColumn))
839  {
840  if (aItr->aRangeAddress.EndColumn >= nEndColumn)
841  aRange.nRepeatColumns = nTotalColumns;
842  else
843  aRange.nRepeatColumns = aItr->aRangeAddress.EndColumn - nStartColumn + 1;
844  aRange.nStartColumn = nStartColumn;
845  }
846  else if ((aItr->aRangeAddress.StartColumn >= nStartColumn) &&
847  (aItr->aRangeAddress.EndColumn <= nEndColumn))
848  {
849  aRange.nRepeatColumns = aItr->aRangeAddress.EndColumn - aItr->aRangeAddress.StartColumn + 1;
850  aRange.nStartColumn = aItr->aRangeAddress.StartColumn;
851  }
852  else if ((aItr->aRangeAddress.StartColumn >= nStartColumn) &&
853  (aItr->aRangeAddress.StartColumn <= nEndColumn) &&
854  (aItr->aRangeAddress.EndColumn > nEndColumn))
855  {
856  aRange.nRepeatColumns = nEndColumn - aItr->aRangeAddress.StartColumn + 1;
857  aRange.nStartColumn = aItr->aRangeAddress.StartColumn;
858  }
859  aRange.nRepeatRows = aItr->aRangeAddress.EndRow - nRow + 1;
860  pRowFormatRanges->AddRange(aRange);
861  nColumns += aRange.nRepeatColumns;
862  }
863  ++aItr;
864  }
865  else
866  if(aItr->aRangeAddress.EndRow < nRow)
867  aItr = rFormatRanges.erase(aItr);
868  else
869  ++aItr;
870  }
871  pRowFormatRanges->Sort();
872 }
873 
874 void ScFormatRangeStyles::AddRangeStyleName(const table::CellRangeAddress& rCellRangeAddress,
875  const sal_Int32 nStringIndex, const bool bIsAutoStyle, const sal_Int32 nValidationIndex,
876  const sal_Int32 nNumberFormat)
877 {
878  ScMyFormatRange aFormatRange;
879  aFormatRange.aRangeAddress = rCellRangeAddress;
880  aFormatRange.nStyleNameIndex = nStringIndex;
881  aFormatRange.nValidationIndex = nValidationIndex;
882  aFormatRange.nNumberFormat = nNumberFormat;
883  aFormatRange.bIsAutoStyle = bIsAutoStyle;
884  OSL_ENSURE(o3tl::make_unsigned(rCellRangeAddress.Sheet) < aTables.size(), "wrong table");
885  ScMyFormatRangeAddresses& rFormatRanges(aTables[rCellRangeAddress.Sheet]);
886  rFormatRanges.push_back(aFormatRange);
887 }
888 
889 OUString & ScFormatRangeStyles::GetStyleNameByIndex(const sal_Int32 nIndex, const bool bIsAutoStyle)
890 {
891  if (bIsAutoStyle)
892  return aAutoStyleNames[nIndex];
893  else
894  return aStyleNames[nIndex];
895 }
896 
898 {
899  for (auto & rTable : aTables)
900  rTable.sort();
901 }
902 
904 {
905 }
906 
908 {
909 }
910 
911 sal_Int32 ScColumnRowStylesBase::AddStyleName(const OUString & rString)
912 {
913  aStyleNames.push_back(rString);
914  return aStyleNames.size() - 1;
915 }
916 
917 sal_Int32 ScColumnRowStylesBase::GetIndexOfStyleName(std::u16string_view rString, const OUString& rPrefix)
918 {
919  sal_Int32 nPrefixLength(rPrefix.getLength());
920  std::u16string_view sTemp(rString.substr(nPrefixLength));
921  sal_Int32 nIndex(o3tl::toInt32(sTemp));
922  if (nIndex > 0 && o3tl::make_unsigned(nIndex-1) < aStyleNames.size() && aStyleNames.at(nIndex - 1) == rString)
923  return nIndex - 1;
924  else
925  {
926  sal_Int32 i(0);
927  bool bFound(false);
928  while (!bFound && o3tl::make_unsigned(i) < aStyleNames.size())
929  {
930  if (aStyleNames.at(i) == rString)
931  bFound = true;
932  else
933  ++i;
934  }
935  if (bFound)
936  return i;
937  else
938  return -1;
939  }
940 }
941 
942 OUString& ScColumnRowStylesBase::GetStyleNameByIndex(const sal_Int32 nIndex)
943 {
944  return aStyleNames[nIndex];
945 }
946 
948 {
949 }
950 
952 {
953 }
954 
955 void ScColumnStyles::AddNewTable(const sal_Int32 nTable, const sal_Int32 nFields)
956 {
957  sal_Int32 nSize(aTables.size() - 1);
958  if (nTable > nSize)
959  for (sal_Int32 i = nSize; i < nTable; ++i)
960  {
961  ScMyColumnStyleVec aFieldsVec(nFields + 1, ScColumnStyle());
962  aTables.push_back(aFieldsVec);
963  }
964 }
965 
966 sal_Int32 ScColumnStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nField,
967  bool& bIsVisible)
968 {
969  OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table");
970  if (o3tl::make_unsigned(nField) < aTables[nTable].size())
971  {
972  bIsVisible = aTables[nTable][nField].bIsVisible;
973  return aTables[nTable][nField].nIndex;
974  }
975  else
976  {
977  bIsVisible = aTables[nTable][aTables[nTable].size() - 1].bIsVisible;
978  return aTables[nTable][aTables[nTable].size() - 1].nIndex;
979  }
980 }
981 
982 void ScColumnStyles::AddFieldStyleName(const sal_Int32 nTable, const sal_Int32 nField,
983  const sal_Int32 nStringIndex, const bool bIsVisible)
984 {
985  OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table");
986  OSL_ENSURE(aTables[nTable].size() >= o3tl::make_unsigned(nField), "wrong field");
987  ScColumnStyle aStyle;
988  aStyle.nIndex = nStringIndex;
989  aStyle.bIsVisible = bIsVisible;
990  if (aTables[nTable].size() == static_cast<sal_uInt32>(nField))
991  aTables[nTable].push_back(aStyle);
992  aTables[nTable][nField] = aStyle;
993 }
994 
996  mnTable(-1), mnStart(-1), mnEnd(-1), mnStyle(-1) {}
997 
998 bool ScRowStyles::Cache::hasCache(sal_Int32 nTable, sal_Int32 nField) const
999 {
1000  return mnTable == nTable && mnStart <= nField && nField < mnEnd;
1001 }
1002 
1004 {
1005 }
1006 
1008 {
1009 }
1010 
1011 void ScRowStyles::AddNewTable(const sal_Int32 nTable, const sal_Int32 nFields)
1012 {
1013  sal_Int32 nSize(aTables.size() - 1);
1014  if (nTable > nSize)
1015  for (sal_Int32 i = nSize; i < nTable; ++i)
1016  {
1017  aTables.push_back(std::make_unique<StylesType>(0, nFields+1, -1));
1018  }
1019 }
1020 
1021 sal_Int32 ScRowStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nField)
1022 {
1023  OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table");
1024  if (o3tl::make_unsigned(nTable) >= aTables.size())
1025  return -1;
1026 
1027  if (maCache.hasCache(nTable, nField))
1028  // Cache hit !
1029  return maCache.mnStyle;
1030 
1031  StylesType& r = *aTables[nTable];
1032  if (!r.is_tree_valid())
1033  r.build_tree();
1034  sal_Int32 nStyle(0);
1035  sal_Int32 nStart(0), nEnd(0);
1036  if (r.search_tree(nField, nStyle, &nStart, &nEnd).second)
1037  {
1038  // Cache this value for better performance.
1039  maCache.mnTable = nTable;
1040  maCache.mnStart = nStart;
1041  maCache.mnEnd = nEnd;
1042  maCache.mnStyle = nStyle;
1043  return nStyle;
1044  }
1045 
1046  return -1;
1047 }
1048 
1049 void ScRowStyles::AddFieldStyleName(const sal_Int32 nTable, const sal_Int32 nField,
1050  const sal_Int32 nStringIndex)
1051 {
1052  OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table");
1053  StylesType& r = *aTables[nTable];
1054  r.insert_back(nField, nField+1, nStringIndex);
1055 }
1056 
1057 void ScRowStyles::AddFieldStyleName(const sal_Int32 nTable, const sal_Int32 nStartField,
1058  const sal_Int32 nStringIndex, const sal_Int32 nEndField)
1059 {
1060  OSL_ENSURE( nStartField <= nEndField, "bad field range");
1061  OSL_ENSURE(o3tl::make_unsigned(nTable) < aTables.size(), "wrong table");
1062  StylesType& r = *aTables[nTable];
1063  r.insert_back(nStartField, nEndField+1, nStringIndex);
1064 }
1065 
1066 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator<(const ScMyFormatRange &rRange) const
static bool IsXScriptURL(const OUString &rScriptURL)
XML_NO
#define SC_UNONAME_INPMESS
Definition: unonames.hxx:359
sal_Int32 nIndex
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
void AddRange(const sal_Int32 nPrevStartCol, const sal_Int32 nRepeat, const sal_Int32 nPrevIndex, const bool bPrevAutoStyle, const ScMyRowFormatRange &rFormatRange)
bool operator<(const ScMyRowFormatRange &rRange) const
size_t mnEnd
Definition: cellvalues.cxx:24
XML_DISPLAY_LIST
static OUString GetBaseCellAddress(const ScDocument *pDoc, const ScAddress &aCell)
XML_ALLOW_EMPTY_CELL
constexpr sal_uInt16 XML_NAMESPACE_OOOC
rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport()
void AddFieldStyleName(const sal_Int32 nTable, const sal_Int32 nField, const sal_Int32 nStringIndex, const bool bIsVisible)
XML_CONTENT_VALIDATION
static void WriteMessage(ScXMLExport &rExport, const OUString &sTitle, const OUString &sMessage, const bool bShowMessage, const bool bIsHelpMessage)
virtual ~ScColumnStyles() override
#define SC_UNONAME_SHOWINP
Definition: unonames.hxx:362
void AddRangeStyleName(const css::table::CellRangeAddress &rCellRangeAddress, const sal_Int32 nStringIndex, const bool bIsAutoStyle, const sal_Int32 nValidationIndex, const sal_Int32 nNumberFormat)
XML_UNSORTED
XML_BASE_CELL_ADDRESS
sal_Int32 GetIndexOfStyleName(std::u16string_view rString, const OUString &rPrefix)
XML_CONDITION
#define SC_UNONAME_ERRMESS
Definition: unonames.hxx:356
sal_Int32 GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nField, bool &bIsVisible)
css::sheet::ConditionOperator aOperator
css::sheet::ValidationAlertStyle aAlertStyle
OUString & GetStyleNameByIndex(const sal_Int32 nIndex, const bool bIsAutoStyle)
const ScMyDefaultStyleList * pColDefaults
#define SC_UNONAME_ERRTITLE
Definition: unonames.hxx:357
ScMyFormatRangeListVec aTables
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.
exports com.sun.star. sheet
void ExportSingleEvent(const css::uno::Sequence< css::beans::PropertyValue > &rEventValues, const OUString &rApiEventName, bool bUseWhitespace=true)
#define SC_UNONAME_IGNOREBL
Definition: unonames.hxx:358
#define SC_UNONAME_ERRALSTY
Definition: unonames.hxx:355
XML_MESSAGE_TYPE
XML_WARNING
int nCount
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
sal_Int32 GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nColumn, const sal_Int32 nRow, bool &bIsAutoStyle) const
#define SC_UNONAME_SHOWERR
Definition: unonames.hxx:361
void AddFieldStyleName(const sal_Int32 nTable, const sal_Int32 nField, const sal_Int32 nStringIndex)
std::list< ScMyFormatRange > ScMyFormatRangeAddresses
void AddValidation(const css::uno::Any &aAny, sal_Int32 &nValidationIndex)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
sal_Int32 GetIndexOfStyleName(std::u16string_view rString, const OUString &rPrefix, bool &bIsAutoStyle)
sal_Int32 AddStyleName(const OUString &rString)
bool hasCache(sal_Int32 nTable, sal_Int32 nField) const
std::vector< ScColumnStyle > ScMyColumnStyleVec
::mdds::flat_segment_tree< sal_Int32, sal_Int32 > StylesType
ScMyDefaultStyleList maColDefaults
XML_ERROR_MACRO
css::sheet::ValidationType aValidationType
css::table::CellRangeAddress aRangeAddress
virtual ~ScRowStyles() override
LINEEND_LF
XML_P
int i
void GetColDefault(SCTAB nTab, SCCOL nCol, SCROW nLastRow, SCROW &nDefault)
Definition: document.cxx:4703
uno_Any a
#define SC_UNONAME_TYPE
Definition: unonames.hxx:364
XMLEventExport & GetEventExport()
constexpr sal_uInt16 XML_NAMESPACE_TEXT
XML_EXECUTE
void WriteValidations(ScXMLExport &rExport)
std::vector< OUString > aStyleNames
sal_Int32 GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nField)
static OUString GetCondition(ScXMLExport &rExport, const ScMyValidation &aValidation)
XML_HELP_MESSAGE
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
float u
virtual void AddNewTable(const sal_Int32 nTable, const sal_Int32 nFields) override
XML_DISPLAY
XML_STOP
void CreateColumnIfNotExists(SCTAB nTab, SCCOL nCol)
Definition: document10.cxx:992
size
XML_TITLE
void FillDefaultStyles(const sal_Int32 nTable, const sal_Int32 nLastRow, const sal_Int32 nLastCol, const ScFormatRangeStyles *pCellStyles, ScDocument *pDoc)
formula::FormulaGrammar::Grammar GetStorageGrammar() const
Definition: document.hxx:2532
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
OUString GetQNameByKey(sal_uInt16 nKey, const OUString &rLocalName, bool bCache=true) const
static sal_Int32 GetStyleNameIndex(const ScFormatRangeStyles *pCellStyles, const sal_Int32 nTable, const sal_Int32 nPos, const sal_Int32 i, bool &bIsAutoStyle)
XML_SORT_ASCENDING
const SvXMLNamespaceMap & GetNamespaceMap() const
const OUString & GetValidationName(const sal_Int32 nIndex)
std::vector< OUString > aAutoStyleNames
size_t mnStart
Definition: cellvalues.cxx:23
XML_TRUE
std::vector< ScMyValidation > aValidationVec
XML_CONTENT_VALIDATIONS
XML_INFORMATION
ScDocument * GetDocument()
Definition: xmlexprt.hxx:240
XML_FALSE
constexpr sal_uInt16 XML_NAMESPACE_TABLE
std::vector< OUString > aStyleNames
constexpr OUStringLiteral sScript
bool GetNext(ScMyRowFormatRange &rFormatRange)
XML_ERROR_MESSAGE
bool AddStyleName(const OUString &rString, sal_Int32 &rIndex, const bool bIsAutoStyle=true)
if(aStr!=aBuf) UpdateName_Impl(m_xFollowLb.get()
virtual void AddNewTable(const sal_Int32 nTable, const sal_Int32 nFields) override
ScMyRowFormatRangesList aRowFormatRanges
#define SC_UNONAME_SHOWLIST
Definition: unonames.hxx:363
Sequence< sal_Int8 > aSeq
constexpr sal_uInt16 XML_NAMESPACE_OF
OUString & GetStyleNameByIndex(const sal_Int32 nIndex)
void AddNewTable(const sal_Int32 nTable)
#define SC_UNONAME_INPTITLE
Definition: unonames.hxx:360
sal_Int32 GetMaxRows() const
std::vector< std::unique_ptr< StylesType > > aTables
bool IsEqual(const ScMyValidation &aVal) const
std::vector< ScMyDefaultStyle > ScMyDefaultStyleList
ScMyColumnVectorVec aTables
const ScMyDefaultStyleList * pColDefaults
void GetFormatRanges(const sal_Int32 nStartColumn, const sal_Int32 nEndColumn, const sal_Int32 nRow, const sal_Int32 nTable, ScRowFormatRanges *pFormatRanges)
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
XML_NAME
bool m_bDetectedRangeSegmentation false