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