LibreOffice Module sc (master)  1
xmlcelli.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <limits>
21 #include <memory>
22 #include "xmlcelli.hxx"
23 #include "xmlimprt.hxx"
24 #include "xmlannoi.hxx"
25 #include <global.hxx>
26 #include <cellvalue.hxx>
27 #include <document.hxx>
28 #include <docuno.hxx>
29 #include <postit.hxx>
30 #include <sheetdata.hxx>
31 #include <cellform.hxx>
32 #include <validat.hxx>
33 #include <patattr.hxx>
34 #include <scitems.hxx>
35 #include <docpool.hxx>
36 
39 #include "celltextparacontext.hxx"
41 
42 #include <arealink.hxx>
43 #include <sfx2/linkmgr.hxx>
44 #include <scerrors.hxx>
45 #include <editutil.hxx>
46 #include <formulacell.hxx>
47 #include "editattributemap.hxx"
48 #include <tokenarray.hxx>
49 #include <scmatrix.hxx>
50 #include <documentimport.hxx>
51 #include <externalrefmgr.hxx>
52 
53 #include <xmloff/maptype.hxx>
54 #include <xmloff/xmltoken.hxx>
55 #include <xmloff/xmlprmap.hxx>
56 #include <xmloff/xmluconv.hxx>
57 #include <xmloff/families.hxx>
58 #include <xmloff/xmlnamespace.hxx>
59 #include <xmloff/prstylei.hxx>
60 #include <xmloff/xmlimppr.hxx>
61 #include <svl/numformat.hxx>
62 #include <svl/zforlist.hxx>
63 #include <svx/svdocapt.hxx>
64 #include <editeng/eeitem.hxx>
65 #include <editeng/outlobj.hxx>
66 #include <editeng/wghtitem.hxx>
67 #include <editeng/colritem.hxx>
68 #include <editeng/fhgtitem.hxx>
69 #include <editeng/postitem.hxx>
70 #include <editeng/flditem.hxx>
71 #include <editeng/fontitem.hxx>
72 #include <editeng/udlnitem.hxx>
73 #include <editeng/wrlmitem.hxx>
77 #include <editeng/contouritem.hxx>
78 #include <editeng/shdditem.hxx>
79 #include <editeng/kernitem.hxx>
80 #include <editeng/autokernitem.hxx>
83 #include <editeng/langitem.hxx>
84 #include <svl/sharedstringpool.hxx>
85 #include <sax/tools/converter.hxx>
86 #include <sax/fastattribs.hxx>
87 
88 #include <com/sun/star/util/NumberFormat.hpp>
89 
90 #include <com/sun/star/sheet/ValidationType.hpp>
91 #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
92 
93 #include <rtl/ustrbuf.hxx>
94 #include <osl/diagnose.h>
95 #include <sal/log.hxx>
96 #include <i18nlangtag/lang.h>
97 
99 #include <comphelper/lok.hxx>
100 
101 using namespace com::sun::star;
102 using namespace xmloff::token;
103 
105  maItemSet(rEditEngine.GetEmptyItemSet()) {}
106 
107 ScXMLTableRowCellContext::Field::Field(std::unique_ptr<SvxFieldData> pData) : mpData(std::move(pData)) {}
108 
110 {
111 }
112 
115  const bool bTempIsCovered,
116  const sal_Int32 nTempRepeatedRows ) :
117  ScXMLImportContext( rImport ),
118  mpEditEngine(GetScImport().GetEditEngine()),
119  mnCurParagraph(0),
120  fValue(std::numeric_limits<double>::quiet_NaN()),
121  nMergedRows(1),
122  nMatrixRows(0),
123  nRepeatedRows(nTempRepeatedRows),
124  nMergedCols(1),
125  nMatrixCols(0),
126  nColsRepeated(1),
127  rXMLImport(rImport),
128  eGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT),
129  nCellType(util::NumberFormat::TEXT),
130  bIsMerged(false),
131  bIsMatrix(false),
132  bIsCovered(bTempIsCovered),
133  bIsEmpty(true),
142  mbHasStyle(false),
144 {
145  rXMLImport.GetTables().AddColumn(bTempIsCovered);
146 
147  std::optional<OUString> xStyleName;
148  std::optional<OUString> xCurrencySymbol;
149  if ( rAttrList.is() )
150  {
151  for (auto &it : *rAttrList)
152  {
153  switch ( it.getToken() )
154  {
156  xStyleName = it.toString();
157  mbHasStyle = true;
158  break;
160  OSL_ENSURE(!maContentValidationName, "here should be only one Validation Name");
161  if (!it.isEmpty())
162  maContentValidationName = it.toString();
163  break;
165  bIsMerged = true;
166  nMergedRows = static_cast<SCROW>(it.toInt32());
167  break;
169  bIsMerged = true;
170  nMergedCols = static_cast<SCCOL>(it.toInt32());
171  break;
173  bIsMatrix = true;
174  nMatrixCols = static_cast<SCCOL>(it.toInt32());
175  break;
177  bIsMatrix = true;
178  nMatrixRows = static_cast<SCROW>(it.toInt32());
179  break;
181  nColsRepeated = static_cast<SCCOL>(
182  std::min<sal_Int32>( rImport.GetDocument()->GetSheetLimits().GetMaxColCount(),
183  std::max( it.toInt32(), static_cast<sal_Int32>(1) ) ));
184  break;
186  nCellType = ScXMLImport::GetCellType(it.toCString(), it.getLength());
187  bIsEmpty = false;
188  break;
189  case XML_ELEMENT( CALC_EXT, XML_VALUE_TYPE ):
190  if(it.isString( "error" ) )
191  mbErrorValue = true;
192  else
193  nCellType = ScXMLImport::GetCellType(it.toCString(), it.getLength());
194  bIsEmpty = false;
195  mbNewValueType = true;
196  break;
197  case XML_ELEMENT( OFFICE, XML_VALUE ):
198  {
199  if (!it.isEmpty())
200  {
201  fValue = it.toDouble();
202  bIsEmpty = false;
203 
204  //if office:value="0", let's get the text:p in case this is
205  //a special case in HasSpecialCaseFormulaText(). If it
206  //turns out not to be a special case, we'll use the 0 value.
207  if(fValue == 0.0)
208  bFormulaTextResult = true;
209  }
210  }
211  break;
213  {
214  if (!it.isEmpty() && rXMLImport.SetNullDateOnUnitConverter())
215  {
217  bIsEmpty = false;
218  }
219  }
220  break;
222  {
223  if (!it.isEmpty())
224  {
226  bIsEmpty = false;
227  }
228  }
229  break;
231  {
232  if (!it.isEmpty())
233  {
234  OSL_ENSURE(!maStringValue, "here should be only one string value");
235  maStringValue = it.toString();
236  bIsEmpty = false;
237  }
238  }
239  break;
241  {
242  if (!it.isEmpty())
243  {
244  if ( IsXMLToken( it, XML_TRUE ) )
245  fValue = 1.0;
246  else if ( IsXMLToken( it, XML_FALSE ) )
247  fValue = 0.0;
248  else
249  fValue = it.toDouble();
250  bIsEmpty = false;
251  }
252  }
253  break;
254  case XML_ELEMENT( TABLE, XML_FORMULA ):
255  {
256  if (!it.isEmpty())
257  {
258  OSL_ENSURE(!maFormula, "here should be only one formula");
259  OUString aFormula, aFormulaNmsp;
260  rXMLImport.ExtractFormulaNamespaceGrammar( aFormula, aFormulaNmsp, eGrammar, it.toString() );
261  maFormula = FormulaWithNamespace(aFormula, aFormulaNmsp);
262  }
263  }
264  break;
266  xCurrencySymbol = it.toString();
267  break;
268  default:
269  ;
270  }
271  }
272  }
273 
274  if (maFormula)
275  {
276  if (nCellType == util::NumberFormat::TEXT)
277  bFormulaTextResult = true;
278  if(nCellType == util::NumberFormat::DATETIME)
279  nCellType = util::NumberFormat::UNDEFINED;
280  //if bIsEmpty is true at this point, then there is no office value.
281  //we must get the text:p (even if it is empty) in case this a special
282  //case in HasSpecialCaseFormulaText().
283  if(bIsEmpty)
284  bFormulaTextResult = true;
285  }
286  rXMLImport.GetStylesImportHelper()->SetAttributes(std::move(xStyleName), std::move(xCurrencySymbol), nCellType);
287 }
288 
290 {
291 }
292 
294 {
295  if (!bSolarMutexLocked)
296  {
298  bSolarMutexLocked = true;
299  }
300 }
301 
302 namespace {
303 
304 bool cellExists( const ScDocument& rDoc, const ScAddress& rCellPos )
305 {
306  return( rCellPos.Col() >= 0 && rCellPos.Row() >= 0 &&
307  rCellPos.Col() <= rDoc.MaxCol() && rCellPos.Row() <= rDoc.MaxRow() );
308 }
309 
310 }
311 
312 void ScXMLTableRowCellContext::PushParagraphSpan(const OUString& rSpan, const OUString& rStyleName)
313 {
314  sal_Int32 nBegin = maParagraph.getLength();
315  sal_Int32 nEnd = nBegin + rSpan.getLength();
316  maParagraph.append(rSpan);
317 
318  PushFormat(nBegin, nEnd, rStyleName);
319 }
320 
321 void ScXMLTableRowCellContext::PushParagraphField(std::unique_ptr<SvxFieldData> pData, const OUString& rStyleName)
322 {
323  mbHasFormatRuns = true;
324  maFields.push_back(std::make_unique<Field>(std::move(pData)));
325  Field& rField = *maFields.back();
326 
327  sal_Int32 nPos = maParagraph.getLength();
328  maParagraph.append('\1'); // Placeholder text for inserted field item.
331  rField.maSelection.nStartPos = nPos;
332  rField.maSelection.nEndPos = nPos+1;
333 
334  PushFormat(nPos, nPos+1, rStyleName);
335 }
336 
337 void ScXMLTableRowCellContext::PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, const OUString& rStyleName)
338 {
339  if (rStyleName.isEmpty())
340  return;
341 
342  // Get the style information from xmloff.
343  rtl::Reference<XMLPropertySetMapper> xMapper = GetImport().GetTextImport()->GetTextImportPropertySetMapper()->getPropertySetMapper();
344  if (!xMapper.is())
345  // We can't do anything without the mapper.
346  return;
347 
348  sal_Int32 nEntryCount = xMapper->GetEntryCount();
349 
350  SvXMLStylesContext* pAutoStyles = GetImport().GetAutoStyles();
351  if (!pAutoStyles)
352  return;
353 
354  // Style name for text span corresponds with the name of an automatic style.
355  const XMLPropStyleContext* pStyle = dynamic_cast<const XMLPropStyleContext*>(
356  pAutoStyles->FindStyleChildContext(XmlStyleFamily::TEXT_TEXT, rStyleName));
357 
358  if (!pStyle)
359  // No style by that name found.
360  return;
361 
362  const std::vector<XMLPropertyState>& rProps = pStyle->GetProperties();
363  if (rProps.empty())
364  return;
365 
366  const ScXMLEditAttributeMap& rEditAttrMap = GetScImport().GetEditAttributeMap();
367 
368  mbHasFormatRuns = true;
369  maFormats.push_back(std::make_unique<ParaFormat>(*mpEditEngine));
370  ParaFormat& rFmt = *maFormats.back();
372  rFmt.maSelection.nStartPos = nBegin;
373  rFmt.maSelection.nEndPos = nEnd;
374 
375  // Store the used text styles for export.
376  ScSheetSaveData* pSheetData = comphelper::getFromUnoTunnel<ScModelObj>(rXMLImport.GetModel())->GetSheetSaveData();
378  pSheetData->AddTextStyle(rStyleName, aCellPos, rFmt.maSelection);
379 
380  std::unique_ptr<SfxPoolItem> pPoolItem;
381  sal_uInt16 nLastItemID = EE_CHAR_END + 1;
382 
383  for (const auto& rProp : rProps)
384  {
385  if (rProp.mnIndex == -1 || rProp.mnIndex >= nEntryCount)
386  continue;
387 
388  const OUString& rName = xMapper->GetEntryAPIName(rProp.mnIndex);
389  const ScXMLEditAttributeMap::Entry* pEntry = rEditAttrMap.getEntryByAPIName(rName);
390  if (!pEntry)
391  continue;
392 
393  if (nLastItemID != pEntry->mnItemID && pPoolItem)
394  {
395  // Flush the last item when the item ID changes.
396  rFmt.maItemSet.Put(*pPoolItem);
397  pPoolItem.reset();
398  }
399 
400  switch (pEntry->mnItemID)
401  {
402  case EE_CHAR_FONTINFO:
405  {
406  // Font properties need to be consolidated into a single item.
407  if (!pPoolItem)
408  pPoolItem.reset(new SvxFontItem(pEntry->mnItemID));
409 
410  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
411  }
412  break;
413  case EE_CHAR_WEIGHT:
414  case EE_CHAR_WEIGHT_CJK:
415  case EE_CHAR_WEIGHT_CTL:
416  {
417  if (!pPoolItem)
418  pPoolItem.reset(new SvxWeightItem(WEIGHT_NORMAL, pEntry->mnItemID));
419 
420  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
421  }
422  break;
423  case EE_CHAR_FONTHEIGHT:
426  {
427  if (!pPoolItem)
428  pPoolItem.reset(new SvxFontHeightItem(240, 100, pEntry->mnItemID));
429 
430  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
431  }
432  break;
433  case EE_CHAR_ITALIC:
434  case EE_CHAR_ITALIC_CJK:
435  case EE_CHAR_ITALIC_CTL:
436  {
437  if (!pPoolItem)
438  pPoolItem.reset(new SvxPostureItem(ITALIC_NONE, pEntry->mnItemID));
439 
440  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
441  }
442  break;
443  case EE_CHAR_UNDERLINE:
444  {
445  if (!pPoolItem)
446  pPoolItem.reset(new SvxUnderlineItem(LINESTYLE_NONE, pEntry->mnItemID));
447 
448  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
449  }
450  break;
451  case EE_CHAR_OVERLINE:
452  {
453  if (!pPoolItem)
454  pPoolItem.reset(new SvxOverlineItem(LINESTYLE_NONE, pEntry->mnItemID));
455 
456  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
457  }
458  break;
459  case EE_CHAR_COLOR:
460  {
461  if (!pPoolItem)
462  pPoolItem.reset(new SvxColorItem(pEntry->mnItemID));
463 
464  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
465  }
466  break;
467  case EE_CHAR_WLM:
468  {
469  if (!pPoolItem)
470  pPoolItem.reset(new SvxWordLineModeItem(false, pEntry->mnItemID));
471 
472  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
473  }
474  break;
475  case EE_CHAR_STRIKEOUT:
476  {
477  if (!pPoolItem)
478  pPoolItem.reset(new SvxCrossedOutItem(STRIKEOUT_NONE, pEntry->mnItemID));
479 
480  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
481  }
482  break;
483  case EE_CHAR_RELIEF:
484  {
485  if (!pPoolItem)
486  pPoolItem.reset(new SvxCharReliefItem(FontRelief::NONE, pEntry->mnItemID));
487 
488  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
489  }
490  break;
491  case EE_CHAR_OUTLINE:
492  {
493  if (!pPoolItem)
494  pPoolItem.reset(new SvxContourItem(false, pEntry->mnItemID));
495 
496  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
497  }
498  break;
499  case EE_CHAR_SHADOW:
500  {
501  if (!pPoolItem)
502  pPoolItem.reset(new SvxShadowedItem(false, pEntry->mnItemID));
503 
504  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
505  }
506  break;
507  case EE_CHAR_KERNING:
508  {
509  if (!pPoolItem)
510  pPoolItem.reset(new SvxKerningItem(0, pEntry->mnItemID));
511 
512  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
513  }
514  break;
515  case EE_CHAR_PAIRKERNING:
516  {
517  if (!pPoolItem)
518  pPoolItem.reset(new SvxAutoKernItem(false, pEntry->mnItemID));
519 
520  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
521  }
522  break;
523  case EE_CHAR_FONTWIDTH:
524  {
525  if (!pPoolItem)
526  pPoolItem.reset(new SvxCharScaleWidthItem(100, pEntry->mnItemID));
527 
528  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
529  }
530  break;
531  case EE_CHAR_ESCAPEMENT:
532  {
533  if (!pPoolItem)
534  pPoolItem.reset(new SvxEscapementItem(pEntry->mnItemID));
535 
536  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
537  }
538  break;
540  {
541  if (!pPoolItem)
542  pPoolItem.reset(new SvxEmphasisMarkItem(FontEmphasisMark::NONE, pEntry->mnItemID));
543 
544  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
545  }
546  break;
547  case EE_CHAR_LANGUAGE:
550  {
551  if (!pPoolItem)
552  pPoolItem.reset(new SvxLanguageItem(LANGUAGE_DONTKNOW, pEntry->mnItemID));
553 
554  pPoolItem->PutValue(rProp.maValue, pEntry->mnFlag);
555  }
556  break;
557  default:
558  ;
559  }
560 
561  nLastItemID = pEntry->mnItemID;
562  }
563 
564  if (pPoolItem)
565  rFmt.maItemSet.Put(*pPoolItem);
566 }
567 
569 {
570  if (!maFirstParagraph)
571  return mpEditEngine->GetText(0);
572 
573  return *maFirstParagraph;
574 }
575 
576 void ScXMLTableRowCellContext::PushParagraphFieldDate(const OUString& rStyleName)
577 {
578  PushParagraphField(std::make_unique<SvxDateField>(), rStyleName);
579 }
580 
582 {
584  PushParagraphField(std::make_unique<SvxTableField>(nTab), rStyleName);
585 }
586 
588 {
589  PushParagraphField(std::make_unique<SvxFileField>(), rStyleName);
590 }
591 
593  const OUString& rURL, const OUString& rRep, const OUString& rStyleName, const OUString& rTargetFrame)
594 {
595  OUString aAbsURL = GetScImport().GetAbsoluteReference(rURL);
596  std::unique_ptr<SvxURLField> pURLField(new SvxURLField(aAbsURL, rRep, SvxURLFormat::Repr));
597  pURLField->SetTargetFrame(rTargetFrame);
598  PushParagraphField(std::move(pURLField), rStyleName);
599 }
600 
602 {
603  // EditEngine always has at least one paragraph even when its content is empty.
604 
606  {
607  if (maFirstParagraph)
608  {
609  // Flush the cached first paragraph first.
610  mpEditEngine->Clear();
612  maFirstParagraph.reset();
613  }
615  }
616  else if (mbHasFormatRuns)
617  {
618  mpEditEngine->Clear();
619  mpEditEngine->SetTextCurrentDefaults(maParagraph.makeStringAndClear());
620  mbEditEngineHasText = true;
621  }
622  else if (mnCurParagraph == 0)
623  {
624  maFirstParagraph = maParagraph.makeStringAndClear();
625  mbEditEngineHasText = true;
626  }
627 
628  ++mnCurParagraph;
629 }
630 
631 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableRowCellContext::createFastChildContext(
632  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
633 {
634  SvXMLImportContext *pContext = nullptr;
635  sax_fastparser::FastAttributeList *pAttribList =
637 
638  bool bTextP(false);
639  switch (nElement)
640  {
641  case XML_ELEMENT( TEXT, XML_P ):
642  {
643  bIsEmpty = false;
644  bTextP = true;
645 
646  pContext = new ScXMLCellTextParaContext(rXMLImport, *this);
647  }
648  break;
650  {
651  SAL_WARN("sc", "ScXMLTableRowCellContext::createFastChildContext: subtables are not supported");
652  }
653  break;
655  {
656  bIsEmpty = false;
657  if (!pDetectiveObjVec)
659  pContext = new ScXMLDetectiveContext(
660  rXMLImport, pDetectiveObjVec.get() );
661  }
662  break;
664  {
665  bIsEmpty = false;
666  if (!pCellRangeSource)
668  pContext = new ScXMLCellRangeSourceContext(
669  rXMLImport, pAttribList, pCellRangeSource.get() );
670  }
671  break;
673  {
674  bIsEmpty = false;
675  OSL_ENSURE(
677  "ScXMLTableRowCellContext::CreateChildContext - multiple annotations in one cell");
679  pContext = new ScXMLAnnotationContext( rXMLImport, nElement,
680  xAttrList, *mxAnnotationData);
681  }
682  break;
683  }
684 
685  if (!pContext && !bTextP)
686  {
688  uno::Reference<drawing::XShapes> xShapes (rXMLImport.GetTables().GetCurrentXShapes());
689  if (xShapes.is())
690  {
692  if (aCellPos.Col() > pDoc->MaxCol())
693  aCellPos.SetCol(pDoc->MaxCol());
694  if (aCellPos.Row() > pDoc->MaxRow())
695  aCellPos.SetRow(pDoc->MaxRow());
696  XMLTableShapeImportHelper* pTableShapeImport =
697  static_cast< XMLTableShapeImportHelper* >( rXMLImport.GetShapeImport().get() );
698  pTableShapeImport->SetOnTable(false);
699  pTableShapeImport->SetCell(aCellPos);
701  rXMLImport, nElement, xAttrList, xShapes);
702  if (pContext)
703  {
704  bIsEmpty = false;
706  }
707  }
708  }
709 
710  return pContext;
711 }
712 
713 void ScXMLTableRowCellContext::DoMerge( const ScAddress& rScAddress, const SCCOL nCols, const SCROW nRows )
714 {
715  SCCOL mergeToCol = rScAddress.Col() + nCols;
716  SCROW mergeToRow = rScAddress.Row() + nRows;
718  bool bInBounds = rScAddress.Col() <= pDoc->MaxCol() && rScAddress.Row() <= pDoc->MaxRow() &&
719  mergeToCol <= pDoc->MaxCol() && mergeToRow <= pDoc->MaxRow();
720  if( bInBounds )
721  {
722  pDoc->DoMerge( rScAddress.Tab(),
723  rScAddress.Col(), rScAddress.Row(), mergeToCol, mergeToRow );
724  }
725 }
726 
727 namespace {
728 
729 ScValidationMode validationTypeToMode( const sheet::ValidationType eVType )
730 {
732  switch( eVType )
733  {
734  case sheet::ValidationType_WHOLE: eMode = SC_VALID_WHOLE; break;
735  case sheet::ValidationType_DECIMAL: eMode = SC_VALID_DECIMAL; break;
736  case sheet::ValidationType_DATE: eMode = SC_VALID_DATE; break;
737  case sheet::ValidationType_TIME: eMode = SC_VALID_TIME; break;
738  case sheet::ValidationType_TEXT_LEN: eMode = SC_VALID_TEXTLEN; break;
739  case sheet::ValidationType_LIST: eMode = SC_VALID_LIST; break;
740  case sheet::ValidationType_CUSTOM: eMode = SC_VALID_CUSTOM; break;
741  default: eMode = SC_VALID_ANY; break;
742  }
743  return eMode;
744 }
745 
746 ScValidErrorStyle validAlertToValidError( const sheet::ValidationAlertStyle eVAlertStyle )
747 {
748  ScValidErrorStyle eVErrStyle;
749  switch( eVAlertStyle )
750  {
751  case sheet::ValidationAlertStyle_STOP: eVErrStyle = SC_VALERR_STOP; break;
752  case sheet::ValidationAlertStyle_WARNING: eVErrStyle = SC_VALERR_WARNING; break;
753  case sheet::ValidationAlertStyle_MACRO: eVErrStyle = SC_VALERR_MACRO; break;
754  default: eVErrStyle = SC_VALERR_INFO; break;
755  //should INFO be the default? seems to be the most unobtrusive choice.
756  }
757  return eVErrStyle;
758 }
759 
760 }
761 
763 {
765  return;
766 
768  ScMyImportValidation aValidation;
769  aValidation.eGrammar1 = aValidation.eGrammar2 = pDoc->GetStorageGrammar();
770  if( !rXMLImport.GetValidation(*maContentValidationName, aValidation) )
771  return;
772 
773  ScValidationData aScValidationData(
774  validationTypeToMode(aValidation.aValidationType),
776  aValidation.sFormula1, aValidation.sFormula2, *pDoc, ScAddress(),
777  aValidation.sFormulaNmsp1, aValidation.sFormulaNmsp2,
778  aValidation.eGrammar1, aValidation.eGrammar2
779  );
780 
781  aScValidationData.SetIgnoreBlank( aValidation.bIgnoreBlanks );
782  aScValidationData.SetListType( aValidation.nShowList );
783 
784  // set strings for error / input even if disabled (and disable afterwards)
785  aScValidationData.SetInput( aValidation.sInputTitle, aValidation.sInputMessage );
786  if( !aValidation.bShowInputMessage )
787  aScValidationData.ResetInput();
788  aScValidationData.SetError( aValidation.sErrorTitle, aValidation.sErrorMessage, validAlertToValidError(aValidation.aAlertStyle) );
789  if( !aValidation.bShowErrorMessage )
790  aScValidationData.ResetError();
791 
792  if( !aValidation.sBaseCellAddress.isEmpty() )
793  aScValidationData.SetSrcString( aValidation.sBaseCellAddress );
794 
795  sal_uLong nIndex = pDoc->AddValidationEntry( aScValidationData );
796 
797  ScPatternAttr aPattern( pDoc->GetPool() );
798  aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nIndex ) );
799  if( rScRange.aStart == rScRange.aEnd ) //for a single cell
800  {
801  pDoc->ApplyPattern( rScRange.aStart.Col(), rScRange.aStart.Row(),
802  rScRange.aStart.Tab(), aPattern );
803  }
804  else //for repeating cells
805  {
806  pDoc->ApplyPatternAreaTab( rScRange.aStart.Col(), rScRange.aStart.Row(),
807  rScRange.aEnd.Col(), rScRange.aEnd.Row(),
808  rScRange.aStart.Tab(), aPattern );
809  }
810 
811  // is the below still needed?
812  // For now, any sheet with validity is blocked from stream-copying.
813  // Later, the validation names could be stored along with the style names.
814  ScSheetSaveData* pSheetData = comphelper::getFromUnoTunnel<ScModelObj>(GetImport().GetModel())->GetSheetSaveData();
815  pSheetData->BlockSheet( GetScImport().GetTables().GetCurrentSheet() );
816 }
817 
819 {
820  SetContentValidation( ScRange(rCellPos, rCellPos) );
821 }
822 
824 {
826  if (!pDoc || !mxAnnotationData)
827  return;
828 
829  LockSolarMutex();
830 
831  ScPostIt* pNote = nullptr;
832 
833  uno::Reference< drawing::XShapes > xShapes = rXMLImport.GetTables().GetCurrentXShapes();
834  sal_Int32 nOldShapeCount = xShapes.is() ? xShapes->getCount() : 0;
835 
836  OSL_ENSURE( !mxAnnotationData->mxShape.is() || mxAnnotationData->mxShapes.is(),
837  "ScXMLTableRowCellContext::SetAnnotation - shape without drawing page" );
838  if( mxAnnotationData->mxShape.is() && mxAnnotationData->mxShapes.is() )
839  {
840  OSL_ENSURE( mxAnnotationData->mxShapes.get() == xShapes.get(), "ScXMLTableRowCellContext::SetAnnotation - different drawing pages" );
842  OSL_ENSURE( pObject, "ScXMLTableRowCellContext::SetAnnotation - cannot get SdrObject from shape" );
843 
844  /* Try to reuse the drawing object already created (but only if the
845  note is visible, and the object is a caption object). */
846  if( mxAnnotationData->mbShown && mxAnnotationData->mbUseShapePos && !comphelper::LibreOfficeKit::isActive())
847  {
848  if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
849  {
850  OSL_ENSURE( !pCaption->GetLogicRect().IsEmpty(), "ScXMLTableRowCellContext::SetAnnotation - invalid caption rectangle" );
851  // create the cell note with the caption object
852  pNote = ScNoteUtil::CreateNoteFromCaption( *pDoc, rPos, pCaption );
853  // forget pointer to object (do not create note again below)
854  pObject = nullptr;
855  }
856  }
857 
858  // drawing object has not been used to create a note -> use shape data
859  if( pObject )
860  {
861  // rescue settings from drawing object before the shape is removed
862  SfxItemSet aItemSet( pObject->GetMergedItemSet() );
864  if (auto p = pObject->GetOutlinerParaObject())
865  pOutlinerObj = *p;
866  tools::Rectangle aCaptionRect;
867  if( mxAnnotationData->mbUseShapePos )
868  aCaptionRect = pObject->GetLogicRect();
869  // remove the shape from the drawing page, this invalidates pObject
870  mxAnnotationData->mxShapes->remove( mxAnnotationData->mxShape );
871  pObject = nullptr;
872  // update current number of existing objects
873  if( xShapes.is() )
874  nOldShapeCount = xShapes->getCount();
875 
876  // an outliner object is required (empty note captions not allowed)
877  if (pOutlinerObj)
878  {
879  // create cell note with all data from drawing object
881  {
882  pNote = ScNoteUtil::CreateNoteFromObjectData( *pDoc, rPos,
883  std::move(aItemSet), *pOutlinerObj,
884  aCaptionRect, mxAnnotationData->mbShown );
885  }
886  else
887  {
888  pNote = ScNoteUtil::CreateNoteFromObjectData( *pDoc, rPos,
889  std::move(aItemSet), *pOutlinerObj,
890  aCaptionRect, false );
891  }
892 
893  }
894  }
895  }
896  else if( !mxAnnotationData->maSimpleText.isEmpty() )
897  {
898  // create note from simple text
899  pNote = ScNoteUtil::CreateNoteFromString( *pDoc, rPos,
900  mxAnnotationData->maSimpleText, mxAnnotationData->mbShown, false );
901  }
902 
903  // set author and date
904  if( pNote )
905  {
906  double fDate;
908  {
909  SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
910  sal_uInt32 nfIndex = pNumForm->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, LANGUAGE_SYSTEM );
911  OUString aDate;
912  const Color* pColor = nullptr;
913  pNumForm->GetOutputString( fDate, nfIndex, aDate, &pColor );
914  pNote->SetDate( aDate );
915  }
916  pNote->SetAuthor( mxAnnotationData->maAuthor );
917  }
918 
919  // register a shape that has been newly created in the ScNoteUtil functions
920  if( xShapes.is() && (nOldShapeCount < xShapes->getCount()) )
921  {
922  uno::Reference< drawing::XShape > xShape;
923  rXMLImport.GetShapeImport()->shapeWithZIndexAdded( xShape, xShapes->getCount() );
924  }
925 
926  // store the style names for stream copying
927  ScSheetSaveData* pSheetData = comphelper::getFromUnoTunnel<ScModelObj>(rXMLImport.GetModel())->GetSheetSaveData();
928  pSheetData->HandleNoteStyles( mxAnnotationData->maStyleName, mxAnnotationData->maTextStyle, rPos );
929 
930  for (const auto& rContentStyle : mxAnnotationData->maContentStyles)
931  {
932  pSheetData->AddNoteContentStyle( rContentStyle.mnFamily, rContentStyle.maName, rPos, rContentStyle.maSelection );
933  }
934 }
935 
936 // core implementation
938 {
940  if( !pDoc || !cellExists(*pDoc, rPosition) || !pDetectiveObjVec || pDetectiveObjVec->empty() )
941  return;
942 
943  LockSolarMutex();
944  ScDetectiveFunc aDetFunc( *pDoc, rPosition.Tab() );
945  uno::Reference<container::XIndexAccess> xShapesIndex = rXMLImport.GetTables().GetCurrentXShapes(); // make draw page
946  for(const auto& rDetectiveObj : *pDetectiveObjVec)
947  {
948  aDetFunc.InsertObject( rDetectiveObj.eObjType, rPosition, rDetectiveObj.aSourceRange, rDetectiveObj.bHasError );
949  if (xShapesIndex.is())
950  {
951  sal_Int32 nShapes = xShapesIndex->getCount();
952  uno::Reference < drawing::XShape > xShape;
953  rXMLImport.GetShapeImport()->shapeWithZIndexAdded(xShape, nShapes);
954  }
955  }
956 }
957 
958 // core implementation
960 {
962  if( !pDoc || !cellExists(*pDoc, rPosition) || !pCellRangeSource || pCellRangeSource->sSourceStr.isEmpty() ||
963  pCellRangeSource->sFilterName.isEmpty() || pCellRangeSource->sURL.isEmpty() )
964  return;
965 
966  LockSolarMutex();
967  ScRange aDestRange( rPosition.Col(), rPosition.Row(), rPosition.Tab(),
968  rPosition.Col() + static_cast<SCCOL>(pCellRangeSource->nColumns - 1),
969  rPosition.Row() + static_cast<SCROW>(pCellRangeSource->nRows - 1), rPosition.Tab() );
970  OUString sFilterName( pCellRangeSource->sFilterName );
971  OUString sSourceStr( pCellRangeSource->sSourceStr );
973  sFilterName, pCellRangeSource->sFilterOptions, sSourceStr, aDestRange, pCellRangeSource->nRefresh );
974  sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
975  pLinkManager->InsertFileLink( *pLink, sfx2::SvBaseLinkObjectType::ClientFile, pCellRangeSource->sURL, &sFilterName, &sSourceStr );
976 }
977 
979 {
980  if(!pFCell)
981  return;
982 
983  bool bMayForceNumberformat = true;
984 
985  if(mbErrorValue)
986  {
987  // don't do anything here
988  // we need to recalc anyway
989  }
990  else if( bFormulaTextResult && maStringValue )
991  {
992  if( !IsPossibleErrorString() )
993  {
996  pFCell->ResetDirty();
997  // A General format doesn't force any other format for a string
998  // result, don't attempt to recalculate this later.
999  bMayForceNumberformat = false;
1000  }
1001  }
1002  else if (std::isfinite(fValue))
1003  {
1004  pFCell->SetHybridDouble(fValue);
1005  if (mbPossibleEmptyDisplay && fValue == 0.0)
1006  {
1007  // Needs to be recalculated to propagate, otherwise would be
1008  // propagated as empty string. So don't ResetDirty().
1010  }
1011  else
1012  pFCell->ResetDirty();
1013  }
1014 
1015  if (bMayForceNumberformat)
1016  // Re-calculate to get number format only when style is not set.
1017  pFCell->SetNeedNumberFormat(!mbHasStyle);
1018 }
1019 
1021  const SCCOL nCurrentCol, const ::std::optional< OUString >& pOUText )
1022 {
1023  ScDocument* pDoc = rXMLImport.GetDocument();
1024  bool bDoIncrement = true;
1025  //matrix reference cells that contain text formula results;
1026  //cell was already put in document, just need to set text here.
1027  if( pDoc && rXMLImport.GetTables().IsPartOfMatrix(rCurrentPos) )
1028  {
1029  ScRefCellValue aCell(*pDoc, rCurrentPos);
1030  bDoIncrement = aCell.meType == CELLTYPE_FORMULA;
1031  if ( bDoIncrement )
1032  {
1033  ScFormulaCell* pFCell = aCell.mpFormula;
1034  OUString aCellString;
1035  if (maStringValue)
1036  aCellString = *maStringValue;
1037  else if (mbEditEngineHasText)
1038  aCellString = GetFirstParagraph();
1039  else if ( nCurrentCol > 0 && pOUText && !pOUText->isEmpty() )
1040  aCellString = *pOUText;
1041  else
1042  bDoIncrement = false;
1043 
1044  if(mbErrorValue)
1045  bDoIncrement = false;
1046 
1047  if(!aCellString.isEmpty())
1048  {
1049  if (bDoIncrement && !IsPossibleErrorString() && pFCell)
1050  {
1051  pFCell->SetHybridString(pDoc->GetSharedStringPool().intern(aCellString));
1052  pFCell->ResetDirty();
1053  }
1054  else
1055  {
1056  ScAddress aTopLeftMatrixCell;
1057  if (pFCell && pFCell->GetMatrixOrigin(*pDoc, aTopLeftMatrixCell))
1058  {
1059  ScFormulaCell* pMatrixCell = pDoc->GetFormulaCell(aTopLeftMatrixCell);
1060  if (pMatrixCell)
1061  pMatrixCell->SetDirty();
1062  }
1063  else
1064  SAL_WARN("sc", "matrix cell without matrix");
1065  }
1066  }
1067  }
1068  }
1069  else //regular text cells
1070  {
1072  if (maStringValue)
1073  {
1074  rDoc.setStringCell(rCurrentPos, *maStringValue);
1075  bDoIncrement = true;
1076  }
1077  else if (mbEditEngineHasText)
1078  {
1079  if (maFirstParagraph)
1080  {
1081  // This is a normal text without format runs.
1082  rDoc.setStringCell(rCurrentPos, *maFirstParagraph);
1083  }
1084  else
1085  {
1086  // This text either has format runs, has field(s), or consists of multiple lines.
1087  for (const auto& rxFormat : maFormats)
1088  mpEditEngine->QuickSetAttribs(rxFormat->maItemSet, rxFormat->maSelection);
1089 
1090  for (const auto& rxField : maFields)
1091  mpEditEngine->QuickInsertField(SvxFieldItem(*rxField->mpData, EE_FEATURE_FIELD), rxField->maSelection);
1092 
1093  // This edit engine uses the SfxItemPool instance returned
1094  // from pDoc->GetEditPool() to create the text object, which
1095  // is a prerequisite for using this constructor of ScEditCell.
1096  rDoc.setEditCell(rCurrentPos, mpEditEngine->CreateTextObject());
1097  }
1098  bDoIncrement = true;
1099  }
1100  else if ( nCurrentCol > 0 && pOUText && !pOUText->isEmpty() )
1101  {
1102  rDoc.setStringCell(rCurrentPos, *pOUText);
1103  bDoIncrement = true;
1104  }
1105  else
1106  bDoIncrement = false;
1107  }
1108 
1109  // #i56027# This is about setting simple text, not edit cells,
1110  // so ProgressBarIncrement must be called with bEditCell = FALSE.
1111  // Formatted text that is put into the cell by the child context
1112  // is handled in AddCellsToTable() (bIsEmpty is true then).
1113  if (bDoIncrement)
1115 }
1116 
1118 {
1119  //matrix reference cells that contain value formula results;
1120  //cell was already put in document, just need to set value here.
1121  if( rXMLImport.GetTables().IsPartOfMatrix(rCurrentPos) )
1122  {
1123  ScRefCellValue aCell(*rXMLImport.GetDocument(), rCurrentPos);
1124  if (aCell.meType == CELLTYPE_FORMULA)
1125  {
1126  ScFormulaCell* pFCell = aCell.mpFormula;
1127  SetFormulaCell(pFCell);
1128  if (pFCell)
1129  pFCell->SetNeedNumberFormat( true );
1130  }
1131  }
1132  else //regular value cell
1133  {
1134  // fdo#62250 absent values are not NaN, set to 0.0
1135  // PutValueCell() is called only for a known cell value type,
1136  // bIsEmpty==false in all these cases, no sense to check it here.
1137  if (!std::isfinite( fValue))
1138  fValue = 0.0;
1139 
1140  // #i62435# Initialize the value cell's script type if the default
1141  // style's number format is latin-only. If the cell uses a different
1142  // format, the script type will be reset when the style is applied.
1143 
1144  rXMLImport.GetDoc().setNumericCell(rCurrentPos, fValue);
1145  }
1147 }
1148 
1149 namespace {
1150 
1151 bool isEmptyOrNote( const ScDocument* pDoc, const ScAddress& rCurrentPos )
1152 {
1153  CellType eType = pDoc->GetCellType(rCurrentPos);
1154  return (eType == CELLTYPE_NONE);
1155 }
1156 
1157 }
1158 
1160  const ::std::optional< OUString >& pOUText, ScAddress& rCurrentPos )
1161 {
1162  ScDocument* pDoc = rXMLImport.GetDocument();
1163  ScMyTables& rTables = rXMLImport.GetTables();
1164  bool bWasEmpty = bIsEmpty;
1165  for (SCCOL i = 0; i < nColsRepeated; ++i)
1166  {
1167  rCurrentPos.SetCol( rCellPos.Col() + i );
1168 
1169  // it makes no sense to import data after the last supported column
1170  // fdo#58539 & gnome#627150
1171  if(rCurrentPos.Col() > pDoc->MaxCol())
1172  {
1174  break;
1175  }
1176 
1177  if (i > 0)
1178  rTables.AddColumn(false);
1179  if (!bIsEmpty)
1180  {
1181  for (SCROW j = 0; j < nRepeatedRows; ++j)
1182  {
1183  rCurrentPos.SetRow( rCellPos.Row() + j );
1184 
1185  // it makes no sense to import data after last supported row
1186  // fdo#58539 & gnome#627150
1187  if(rCurrentPos.Row() > pDoc->MaxRow())
1188  {
1190  break;
1191  }
1192 
1193  if( (rCurrentPos.Col() == 0) && (j > 0) )
1194  {
1195  rTables.AddRow();
1196  rTables.AddColumn(false);
1197  }
1198  if( cellExists(*pDoc, rCurrentPos) )
1199  {
1200  if( !bIsCovered || isEmptyOrNote(pDoc, rCurrentPos) )
1201  {
1202  switch (nCellType)
1203  {
1204  case util::NumberFormat::TEXT:
1205  {
1206  PutTextCell( rCurrentPos, i, pOUText );
1207  }
1208  break;
1209  case util::NumberFormat::NUMBER:
1211  case util::NumberFormat::CURRENCY:
1212  case util::NumberFormat::TIME:
1213  case util::NumberFormat::DATETIME:
1214  case util::NumberFormat::LOGICAL:
1215  {
1216  PutValueCell( rCurrentPos );
1217  }
1218  break;
1219  default:
1220  {
1221  OSL_FAIL("no cell type given");
1222  }
1223  break;
1224  }
1225  }
1226 
1227  SetAnnotation( rCurrentPos );
1228  SetDetectiveObj( rCurrentPos );
1229  SetCellRangeSource( rCurrentPos );
1230  }
1231  else
1232  {
1233  if (!bWasEmpty || mxAnnotationData)
1234  {
1235  if (rCurrentPos.Row() > pDoc->MaxRow())
1237  else
1239  }
1240  }
1241  }
1242  }
1243  else
1244  {
1245  if ((i == 0) && (rCellPos.Col() == 0))
1246  {
1247  for (sal_Int32 j = 1; j < nRepeatedRows; ++j)
1248  {
1249  rTables.AddRow();
1250  rTables.AddColumn(false);
1251  }
1252  }
1253  }
1254  }
1255 }
1256 
1258 {
1259  return ( (nColsRepeated > 1) || (nRepeatedRows > 1) );
1260 }
1261 
1262 namespace {
1263 
1264 // from ScCellObj::GetOutputString_Imp(). all of it may not be necessary.
1265 OUString getOutputString( ScDocument* pDoc, const ScAddress& aCellPos )
1266 {
1267  if (!pDoc)
1268  return OUString();
1269 
1270  ScRefCellValue aCell(*pDoc, aCellPos);
1271  switch (aCell.meType)
1272  {
1273  case CELLTYPE_NONE:
1274  return OUString();
1275  case CELLTYPE_EDIT:
1276  {
1277  // GetString on EditCell replaces linebreaks with spaces;
1278  // however here we need line breaks
1279  const EditTextObject* pData = aCell.mpEditText;
1280  EditEngine& rEngine = pDoc->GetEditEngine();
1281  rEngine.SetText(*pData);
1282  return rEngine.GetText();
1283  // also don't format EditCells per NumberFormatter
1284  }
1285  break;
1286  default:
1287  {
1288  // like in GetString for document (column)
1289  const Color* pColor;
1290  sal_uInt32 nNumFmt = pDoc->GetNumberFormat(aCellPos);
1291  return ScCellFormat::GetString(aCell, nNumFmt, &pColor, *pDoc->GetFormatTable(), *pDoc);
1292  }
1293  }
1294 }
1295 
1296 }
1297 
1299 {
1300  ::std::optional< OUString > pOUText;
1301 
1302  ScDocument* pDoc = rXMLImport.GetDocument();
1303  if( nCellType == util::NumberFormat::TEXT )
1304  {
1305  if( !bIsEmpty && !maStringValue && !mbEditEngineHasText && cellExists(*pDoc, rCellPos) && CellsAreRepeated() )
1306  pOUText = getOutputString(pDoc, rCellPos);
1307 
1308  if (!mbEditEngineHasText && !pOUText && !maStringValue)
1309  bIsEmpty = true;
1310  }
1311 
1312  ScAddress aCurrentPos( rCellPos );
1313  if( mxAnnotationData || pDetectiveObjVec || pCellRangeSource ) // has special content
1314  bIsEmpty = false;
1315 
1316  AddTextAndValueCell( rCellPos, pOUText, aCurrentPos );
1317 
1318  if( CellsAreRepeated() )
1319  {
1320  SCCOL nStartCol( std::min(rCellPos.Col(), pDoc->MaxCol()) );
1321  SCROW nStartRow( std::min(rCellPos.Row(), pDoc->MaxRow()) );
1322  SCCOL nEndCol( std::min<SCCOL>(rCellPos.Col() + nColsRepeated - 1, pDoc->MaxCol()) );
1323  SCROW nEndRow( std::min(rCellPos.Row() + nRepeatedRows - 1, pDoc->MaxRow()) );
1324  ScRange aScRange( nStartCol, nStartRow, rCellPos.Tab(), nEndCol, nEndRow, rCellPos.Tab() );
1325  SetContentValidation( aScRange );
1326  rXMLImport.GetStylesImportHelper()->AddRange( aScRange );
1327  }
1328  else if( cellExists(*pDoc, rCellPos) )
1329  {
1331  SetContentValidation( rCellPos );
1332  }
1333 }
1334 
1336 {
1337  ScDocument* pDoc = rXMLImport.GetDocument();
1338  ScDocumentImport& rDocImport = rXMLImport.GetDoc();
1339 
1340  OUString aText = maFormula->first;
1341 
1342  ScExternalRefManager::ApiGuard aExtRefGuard(*pDoc);
1343 
1344  if ( aText.isEmpty() )
1345  return;
1346 
1347  // temporary formula string as string tokens
1348  std::unique_ptr<ScTokenArray> pCode(new ScTokenArray(*pDoc));
1349 
1350  // Check the special case of a single error constant without leading
1351  // '=' and create an error formula cell without tokens.
1353  if (nError != FormulaError::NONE)
1354  {
1355  pCode->SetCodeError(nError);
1356  }
1357  else
1358  {
1359  // 5.2 and earlier wrote broken "Err:xxx" as formula to designate
1360  // an error formula cell.
1361  if (aText.startsWithIgnoreAsciiCase("Err:") && aText.getLength() <= 9 &&
1362  ((nError =
1363  GetScImport().GetFormulaErrorConstant( OUString::Concat("#ERR") + aText.subView(4) + "!")) != FormulaError::NONE))
1364  {
1365  pCode->SetCodeError(nError);
1366  }
1367  else
1368  {
1369  OUString aFormulaNmsp = maFormula->second;
1371  aFormulaNmsp.clear();
1372  pCode->AssignXMLString( aText, aFormulaNmsp );
1373  rDocImport.getDoc().IncXMLImportedFormulaCount( aText.getLength() );
1374  }
1375  }
1376 
1377  ScFormulaCell* pNewCell = new ScFormulaCell(*pDoc, rCellPos, std::move(pCode), eGrammar, ScMatrixMode::NONE);
1378  SetFormulaCell(pNewCell);
1379  rDocImport.setFormulaCell(rCellPos, pNewCell);
1380 }
1381 
1383 {
1384  ScDocument* pDoc = rXMLImport.GetDocument();
1385  if( cellExists(*pDoc, rCellPos) )
1386  {
1387  SetContentValidation( rCellPos );
1388  SAL_WARN_IF((nColsRepeated != 1) || (nRepeatedRows != 1), "sc", "repeated cells with formula not possible now");
1390 
1391  //add matrix
1392  if(bIsMatrix)
1393  {
1394  if (nMatrixCols > 0 && nMatrixRows > 0)
1395  {
1396  //matrix cells are put in the document, but we must set the
1397  //value/text of each matrix cell later
1399  rCellPos.Col(), rCellPos.Row(),
1400  std::min<SCCOL>(rCellPos.Col() + nMatrixCols - 1, pDoc->MaxCol()),
1401  std::min<SCROW>(rCellPos.Row() + nMatrixRows - 1, pDoc->MaxRow()),
1402  maFormula->first, maFormula->second, eGrammar);
1403 
1404  // Set the value/text of the top-left matrix position in its
1405  // cached result. For import, we only need to set the correct
1406  // matrix geometry and the value type of the top-left element.
1407  ScFormulaCell* pFCell = pDoc->GetFormulaCell(rCellPos);
1408  if (pFCell)
1409  {
1412  {
1413  if (!IsPossibleErrorString())
1414  {
1415  pFCell->SetResultMatrix(
1418  pFCell->ResetDirty();
1419  }
1420  }
1421  else if (std::isfinite(fValue))
1422  {
1423  pFCell->SetResultMatrix(
1425  pFCell->ResetDirty();
1426  }
1427  }
1428  }
1429  }
1430  else
1431  PutFormulaCell( rCellPos );
1432 
1433  SetAnnotation( rCellPos );
1434  SetDetectiveObj( rCellPos );
1435  SetCellRangeSource( rCellPos );
1437  }
1438  else
1439  {
1440  if (rCellPos.Row() > pDoc->MaxRow())
1442  else
1444  }
1445 }
1446 
1447 //There are cases where a formula cell is exported with an office:value of 0 or
1448 //no office:value at all, but the formula cell will have a text:p value which
1449 //contains the intended formula result.
1450 //These cases include when a formula result:
1451 // - is blank
1452 // - has a constant error value beginning with "#" (such as "#VALUE!" or "#N/A")
1453 // - has an "Err:[###]" (where "[###]" is an error number)
1454 // Libreoffice 4.1+ with ODF1.2 extended write however calcext:value-type="error" in that case
1456 {
1457  if (!mbEditEngineHasText)
1458  return;
1459 
1460  const OUString aStr = GetFirstParagraph();
1461 
1462  if (mbNewValueType)
1463  {
1464  if (aStr.isEmpty())
1465  mbPossibleEmptyDisplay = true;
1466  return;
1467  }
1468 
1469  if (aStr.isEmpty())
1470  {
1471  mbPossibleErrorCell = true;
1472  mbPossibleEmptyDisplay = true;
1473  }
1474  else if (aStr.startsWith("Err:"))
1475  mbPossibleErrorCell = true;
1476  else if (aStr.startsWith("#"))
1478 }
1479 
1481 {
1483  return false;
1484  else if(mbNewValueType && mbErrorValue)
1485  return true;
1487  GetScImport().GetFormulaErrorConstant(*maStringValue) != FormulaError::NONE);
1488 }
1489 
1490 void SAL_CALL ScXMLTableRowCellContext::endFastElement(sal_Int32 /*nElement*/)
1491 {
1494  {
1496  }
1497 
1499  if( aCellPos.Col() > 0 && nRepeatedRows > 1 )
1500  aCellPos.SetRow( aCellPos.Row() - (nRepeatedRows - 1) );
1501  if( bIsMerged )
1502  DoMerge( aCellPos, nMergedCols - 1, nMergedRows - 1 );
1503 
1504  if (maFormula)
1505  AddFormulaCell(aCellPos);
1506  else
1507  AddNonFormulaCell(aCellPos);
1508 
1509  //if LockSolarMutex got used, we presumably need to ensure an UnlockSolarMutex
1510  if (bSolarMutexLocked)
1511  {
1513  bSolarMutexLocked = false;
1514  }
1515 
1516  bIsMerged = false;
1517  nMergedCols = 1;
1518  nMergedRows = 1;
1519  nColsRepeated = 1;
1520 }
1521 
1522 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
exports com.sun.star.lib. util
Matrix data type that can store values of mixed types.
Definition: scmatrix.hxx:112
void HandleNoteStyles(const OUString &rStyleName, const OUString &rTextName, const ScAddress &rCellPos)
Definition: sheetdata.cxx:61
void SetAuthor(const OUString &rAuthor)
Sets a new author date for this note.
Definition: postit.cxx:890
OUString sFormulaNmsp2
Definition: xmlimprt.hxx:97
OUString GetText(LineEnd eEnd=LINEEND_LF) const
bool CellsAreRepeated() const
Definition: xmlcelli.cxx:1257
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
void AddCell(const ScAddress &rAddress)
OUString GetFirstParagraph() const
Definition: xmlcelli.cxx:568
virtual ~ScXMLTableRowCellContext() override
Definition: xmlcelli.cxx:289
sal_Int32 nStartPara
void AddTextAndValueCell(const ScAddress &rScCellPos, const ::std::optional< OUString > &pOUText, ScAddress &rScCurrentPos)
Definition: xmlcelli.cxx:1159
sal_Int32 nIndex
XML_NUMBER_COLUMNS_SPANNED
ScAddress aStart
Definition: address.hxx:497
constexpr TypedWhichId< SvxAutoKernItem > EE_CHAR_PAIRKERNING(EE_CHAR_START+11)
SharedString intern(const OUString &rStr)
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
Definition: documen2.cxx:582
constexpr TypedWhichId< SvxKerningItem > EE_CHAR_KERNING(EE_CHAR_START+12)
void SetDate(const OUString &rDate)
Sets a new creation date for this note.
Definition: postit.cxx:885
void PutFormulaCell(const ScAddress &rScCurrentPos)
Definition: xmlcelli.cxx:1335
ScXMLTableRowCellContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, const bool bIsCovered, const sal_Int32 nRepeatedRows)
Definition: xmlcelli.cxx:113
Provide mapping from ODF text formatting styles to EditEngine's, for rich-text cell content import...
SCROW Row() const
Definition: address.hxx:274
ScEditEngineDefaulter * mpEditEngine
unformatted first paragraph, for better performance.
Definition: xmlcelli.hxx:68
void SetAnnotation(const ScAddress &rPosition)
Definition: xmlcelli.cxx:823
OUString sFormulaNmsp1
Definition: xmlimprt.hxx:96
void SetOnTable(const bool bTempOnTable)
void PutValueCell(const ScAddress &rScCurrentPos)
Definition: xmlcelli.cxx:1117
sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge=LANGUAGE_DONTKNOW)
ScDocument * GetDocument()
Definition: xmlimprt.hxx:205
std::unique_ptr< sal_Int32[]> pData
XML_NUMBER_MATRIX_ROWS_SPANNED
SC_DLLPUBLIC const ScFormulaCell * GetFormulaCell(const ScAddress &rPos) const
Definition: document.cxx:3758
void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)
const ::std::vector< XMLPropertyState > & GetProperties() const
ScValidErrorStyle
Definition: validat.hxx:50
void InsertFileLink(sfx2::SvBaseLink &, SvBaseLinkObjectType nFileType, std::u16string_view rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
sal_uIntPtr sal_uLong
void PushParagraphSpan(const OUString &rSpan, const OUString &rStyleName)
Definition: xmlcelli.cxx:312
SCCOL GetMaxColCount() const
Definition: sheetlimits.hxx:68
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
ScMyTables & GetTables()
Definition: xmlimprt.hxx:208
SvXMLImport & GetImport()
constexpr OUStringLiteral PERCENT(u"Percent")
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
XML_VALUE_TYPE
ScAddress aEnd
Definition: address.hxx:498
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
XML_VALUE
std::optional< OUString > maContentValidationName
office:string-value attribute
Definition: xmlcelli.hxx:65
const ScXMLEditAttributeMap & GetEditAttributeMap() const
Definition: xmlimprt.cxx:1649
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CJK(EE_CHAR_START+15)
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:103
ScMyStylesImportHelper * GetStylesImportHelper()
Definition: xmlimprt.hxx:250
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
Accessor class to ScDocument.
EmbeddedObjectRef * pObject
void BlockSheet(SCTAB nTab)
Definition: sheetdata.cxx:92
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
formula::FormulaGrammar::Grammar eGrammar
Definition: xmlcelli.hxx:82
XML_ANNOTATION
void setEditCell(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
XML_NUMBER_ROWS_SPANNED
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6157
void SetListType(sal_Int16 nListType)
Definition: validat.hxx:117
css::sheet::ConditionOperator aOperator
Definition: xmlimprt.hxx:101
void SetDetectiveObj(const ScAddress &rPosition)
Definition: xmlcelli.cxx:937
XML_FORMULA
bool SetNullDateOnUnitConverter()
Definition: xmlimprt.cxx:1089
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
void PushParagraphFieldDocTitle(const OUString &rStyleName)
Definition: xmlcelli.cxx:587
void DoMerge(const ScAddress &rScCellPos, const SCCOL nCols, const SCROW nRows)
Definition: xmlcelli.cxx:713
LINESTYLE_NONE
void AddColumn(bool bIsCovered)
Definition: xmlsubti.cxx:173
void SetText(const OUString &rStr)
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:894
void SetSrcString(const OUString &rNew)
Definition: conditio.cxx:462
void SetAttributes(std::optional< OUString > pStyleName, std::optional< OUString > pCurrency, const sal_Int16 nCellType)
XML_BOOLEAN_VALUE
void LockSolarMutex()
Definition: xmlimprt.cxx:1507
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
Additional class containing cell annotation data.
Definition: postit.hxx:160
void AddTextStyle(const OUString &rName, const ScAddress &rCellPos, const ESelection &rSelection)
Definition: sheetdata.cxx:87
void SetInput(const OUString &rTitle, const OUString &rMsg)
Definition: validat.cxx:160
static ScPostIt * CreateNoteFromCaption(ScDocument &rDoc, const ScAddress &rPos, SdrCaptionObj *pCaption)
Creates a cell note using the passed caption drawing object.
Definition: postit.cxx:1228
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:25
SfxItemSet maItemSet
Mode eMode
ScFormulaCell * mpFormula
Definition: cellvalue.hxx:110
SCTAB Tab() const
Definition: address.hxx:283
void SetRow(SCROW nRowP)
Definition: address.hxx:287
static OUString GetString(const ScRefCellValue &rCell, sal_uInt32 nFormat, const Color **ppColor, SvNumberFormatter &rFormatter, const ScDocument &rDoc, bool bNullVals=true, bool bFormula=false, bool bUseStarFormat=false)
Definition: cellform.cxx:31
sal_Int32 nEndPos
FormulaError GetFormulaErrorConstant(const OUString &rStr) const
Definition: xmlimprt.cxx:1627
void SetNeedNumberFormat(bool bVal)
void SetCol(SCCOL nColP)
Definition: address.hxx:291
ScValidationMode
Definition: validat.hxx:38
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
void SetDirty(bool bDirtyFlag=true)
static ScPostIt * CreateNoteFromObjectData(ScDocument &rDoc, const ScAddress &rPos, SfxItemSet &&oItemSet, const OutlinerParaObject &rOutlinerObj, const tools::Rectangle &rCaptionRect, bool bShown)
Creates a cell note based on the passed caption object data.
Definition: postit.cxx:1244
OUString sInputTitle
Definition: xmlimprt.hxx:90
DocumentType eType
bool GetValidation(const OUString &sName, ScMyImportValidation &aValidation)
Definition: xmlimprt.cxx:557
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALIDDATA(153)
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
This class exists only to provide GetScImport() to its derived classes.
XML_NUMBER_COLUMNS_REPEATED
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:893
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:457
sal_Int32 nEndPara
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3782
std::optional< FormulaWithNamespace > maFormula
Definition: xmlcelli.hxx:63
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
Definition: editutil.cxx:603
XML_P
void AddNoteContentStyle(XmlStyleFamily nFamily, const OUString &rName, const ScAddress &rCellPos, const ESelection &rSelection)
Definition: sheetdata.cxx:79
int i
void PushParagraphField(std::unique_ptr< SvxFieldData > pData, const OUString &rStyleName)
Definition: xmlcelli.cxx:321
#define LANGUAGE_SYSTEM
constexpr TypedWhichId< SvxCharScaleWidthItem > EE_CHAR_FONTWIDTH(EE_CHAR_START+3)
sal_Int16 SCCOL
Definition: types.hxx:21
constexpr TypedWhichId< SvxCharReliefItem > EE_CHAR_RELIEF(EE_CHAR_START+26)
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:899
void convertDateTime(OUStringBuffer &rBuffer, const double &fDateTime, bool const bAddTimeIf0AM=false)
std::pair< OUString, OUString > FormulaWithNamespace
Definition: xmlcelli.hxx:61
SC_DLLPUBLIC void ApplyPattern(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr &rAttr)
Definition: document.cxx:4828
std::unique_ptr< EditTextObject > CreateTextObject()
WEIGHT_NORMAL
css::sheet::ValidationType aValidationType
Definition: xmlimprt.hxx:100
SfxItemSet & GetItemSet()
Definition: patattr.hxx:155
void SetCell(const ScAddress &rAddress)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
XML_CONTENT_VALIDATION_NAME
#define LANGUAGE_DONTKNOW
std::unique_ptr< ScMyImpDetectiveObjVec > pDetectiveObjVec
Definition: xmlcelli.hxx:76
SC_DLLPUBLIC void ApplyPatternAreaTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScPatternAttr &rAttr)
Definition: document.cxx:4851
void PutTextCell(const ScAddress &rScCurrentPos, const SCCOL nCurrentCol, const ::std::optional< OUString > &pOUText)
Definition: xmlcelli.cxx:1020
NF_DATE_SYS_DDMMYYYY
static void convertDuration(OUStringBuffer &rBuffer, const double fTime)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CTL(EE_CHAR_START+24)
void SetIgnoreBlank(bool bSet)
Definition: conditio.cxx:417
ScXMLImport & rXMLImport
Definition: xmlcelli.hxx:81
formula::FormulaGrammar::Grammar GetStorageGrammar() const
Definition: document.hxx:2531
ScXMLImport & GetScImport()
static sal_Int16 GetCellType(const char *rStrValue, const sal_Int32 nStrLength)
Definition: xmlimprt.cxx:511
void IncXMLImportedFormulaCount(sal_uInt64 nVal)
Definition: document.hxx:2450
constexpr sal_uInt16 EE_CHAR_END(EE_CHAR_START+32)
ITALIC_NONE
OUStringBuffer maParagraph
Definition: xmlcelli.hxx:69
SC_DLLPUBLIC void DoMerge(SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool bDeleteCaptions=true)
Definition: documen3.cxx:2072
bool IsPartOfMatrix(const ScAddress &rScAddress) const
Definition: xmlsubti.cxx:279
XML_STRING_VALUE
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlcelli.cxx:631
void AddMatrixRange(const SCCOL nStartColumn, const SCROW nStartRow, const SCCOL nEndColumn, const SCROW nEndRow, const OUString &rFormula, const OUString &rFormulaNmsp, const formula::FormulaGrammar::Grammar)
Definition: xmlsubti.cxx:258
void ExtractFormulaNamespaceGrammar(OUString &rFormula, OUString &rFormulaNmsp,::formula::FormulaGrammar::Grammar &reGrammar, const OUString &rAttrValue, bool bRestrictToExternalNmsp=false) const
Extracts the formula string, the formula grammar namespace URL, and a grammar enum value from the pas...
Definition: xmlimprt.cxx:1568
FormulaError
SCCOL Col() const
Definition: address.hxx:279
sal_Int32 GetParagraphCount() const
void AddNonFormulaCell(const ScAddress &rScCellPos)
Definition: xmlcelli.cxx:1298
std::optional< OUString > maStringValue
table:formula attribute
Definition: xmlcelli.hxx:64
OUString sBaseCellAddress
Definition: xmlimprt.hxx:98
void SetHybridEmptyDisplayedAsString()
For import only: set an empty cell result to be displayed as empty string.
XML_TRUE
formula::FormulaGrammar::Grammar eGrammar2
Definition: xmlimprt.hxx:103
bool GetMatrixOrigin(const ScDocument &rDoc, ScAddress &rPos) const
const ScAddress & GetCurrentCellPos() const
Definition: xmlsubti.hxx:80
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CTL(EE_CHAR_START+16)
TABLE
CellType meType
Definition: cellvalue.hxx:105
SC_DLLPUBLIC sal_uLong AddValidationEntry(const ScValidationData &rNew)
Definition: documen4.cxx:733
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void setFormulaCell(const ScAddress &rPos, const OUString &rFormula, formula::FormulaGrammar::Grammar eGrammar, const double *pResult=nullptr)
sal_Int32 SCROW
Definition: types.hxx:17
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
void PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, const OUString &rStyleName)
Definition: xmlcelli.cxx:337
void ResetInput()
Definition: validat.cxx:150
OUString sErrorMessage
Definition: xmlimprt.hxx:93
void SetContentValidation(const ScRange &rScRange)
Definition: xmlcelli.cxx:762
XML_FALSE
void SetCellRangeSource(const ScAddress &rPosition)
Definition: xmlcelli.cxx:959
void SetResultMatrix(SCCOL nCols, SCROW nRows, const ScConstMatrixRef &pMat, const formula::FormulaToken *pUL)
OUString GetAbsoluteReference(const OUString &rValue) const
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
#define SAL_WARN_IF(condition, area, stream)
SvBaseLink * pLink
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
std::vector< std::unique_ptr< ParaFormat > > maFormats
Definition: xmlcelli.hxx:72
css::uno::Reference< css::drawing::XShapes > const & GetCurrentXShapes()
Definition: xmlsubti.cxx:230
CellType
Definition: global.hxx:269
#define SCWARN_IMPORT_ROW_OVERFLOW
Definition: scerrors.hxx:62
void InsertParagraph(sal_Int32 nPara, const EditTextObject &rTxtObj, const bool bAppend=false)
void setStringCell(const ScAddress &rPos, const OUString &rStr)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CTL(EE_CHAR_START+22)
void UnlockSolarMutex()
Definition: xmlimprt.cxx:1525
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
void AddFormulaCell(const ScAddress &rScCellPos)
Definition: xmlcelli.cxx:1382
css::sheet::ValidationAlertStyle aAlertStyle
Definition: xmlimprt.hxx:99
void SetError(const OUString &rTitle, const OUString &rMsg, ScValidErrorStyle eStyle)
Definition: validat.cxx:167
constexpr TypedWhichId< SvxWordLineModeItem > EE_CHAR_WLM(EE_CHAR_START+13)
void PushParagraphFieldURL(const OUString &rURL, const OUString &rRep, const OUString &rStyleName, const OUString &rTargetFrame)
Definition: xmlcelli.cxx:592
void SetHybridString(const svl::SharedString &r)
For import only: set a string result.
#define XML_ELEMENT(prefix, name)
constexpr TypedWhichId< SvxEmphasisMarkItem > EE_CHAR_EMPHASISMARK(EE_CHAR_START+25)
std::unique_ptr< ScXMLAnnotationData > mxAnnotationData
Definition: xmlcelli.hxx:75
constexpr TypedWhichId< SvxOverlineItem > EE_CHAR_OVERLINE(EE_CHAR_START+29)
void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)
const SvXMLUnitConverter & GetMM100UnitConverter() const
const css::uno::Reference< css::frame::XModel > & GetModel() const
void * p
XML_STYLE_NAME
XML_CELL_RANGE_SOURCE
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
void PushParagraphFieldSheetName(const OUString &rStyleName)
Definition: xmlcelli.cxx:581
std::optional< OUString > maFirstParagraph
Definition: xmlcelli.hxx:66
#define SCWARN_IMPORT_COLUMN_OVERFLOW
Definition: scerrors.hxx:63
void SetHybridDouble(double n)
For import only: set a double result.
XML_NUMBER_MATRIX_COLUMNS_SPANNED
Field(const Field &)=delete
void PushParagraphFieldDate(const OUString &rStyleName)
Definition: xmlcelli.cxx:576
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlcelli.cxx:1490
OUString sInputMessage
Definition: xmlimprt.hxx:91
formula::FormulaGrammar::Grammar eGrammar1
Definition: xmlimprt.hxx:102
XML_DATE_VALUE
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CJK(EE_CHAR_START+23)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
static ScConditionMode GetModeFromApi(css::sheet::ConditionOperator nOperator)
Definition: conditio.cxx:1400
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1083
#define SAL_WARN(area, stream)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
static ScPostIt * CreateNoteFromString(ScDocument &rDoc, const ScAddress &rPos, const OUString &rNoteText, bool bShown, bool bAlwaysCreateCaption, sal_uInt32 nPostItId=0)
Creates a cell note based on the passed string and inserts it into the document.
Definition: postit.cxx:1276
XML_TIME_VALUE
::std::vector< ScMyImpDetectiveObj > ScMyImpDetectiveObjVec
XML_CURRENCY
static SvXMLShapeContext * CreateGroupChildContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape=false)
This context handles element inside .
void setNumericCell(const ScAddress &rPos, double fVal)
STRIKEOUT_NONE
XML_DETECTIVE
void ProgressBarIncrement()
Definition: xmlimprt.cxx:1558
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
Definition: documen2.cxx:227
SvXMLStylesContext * GetAutoStyles()
const Entry * getEntryByAPIName(const OUString &rAPIName) const
void AddRow()
Definition: xmlsubti.cxx:162
aStr
std::unique_ptr< ScMyImpCellRangeSource > pCellRangeSource
Definition: xmlcelli.hxx:77
TEXT
void ResetError()
Definition: validat.cxx:155
void GetOutputString(const double &fOutNumber, sal_uInt32 nFIndex, OUString &sOutString, const Color **ppColor, bool bUseStarFormat=false)
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
Definition: documen2.cxx:473
ScDocumentImport & GetDoc()
Definition: xmlimprt.cxx:506
void SetFormulaCell(ScFormulaCell *pFCell) const
Definition: xmlcelli.cxx:978
bool IsPossibleErrorString() const
Definition: xmlcelli.cxx:1480
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
Use this guard when performing something from the API that might query values from external reference...
OUString sErrorTitle
Definition: xmlimprt.hxx:92
XML_SUB_TABLE
void Clear()
rtl::Reference< XMLShapeImportHelper > const & GetShapeImport()
ParaFormat(const ScEditEngineDefaulter &rEditEngine)
Definition: xmlcelli.cxx:104
void SetRangeOverflowType(ErrCode nType)
Definition: xmlimprt.cxx:1548
SC_DLLPUBLIC sal_uInt32 GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3678
bool m_bDetectedRangeSegmentation false
ScDocument & getDoc()
sal_Int32 nStartPos