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