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