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 <memory>
21 #include "xmlcelli.hxx"
22 #include "xmlimprt.hxx"
23 #include "xmlannoi.hxx"
24 #include <global.hxx>
25 #include <cellvalue.hxx>
26 #include <document.hxx>
27 #include <docuno.hxx>
28 #include <postit.hxx>
29 #include <sheetdata.hxx>
30 #include <cellform.hxx>
31 #include <validat.hxx>
32 #include <patattr.hxx>
33 #include <scitems.hxx>
34 #include <docpool.hxx>
35 
38 #include "celltextparacontext.hxx"
40 
41 #include <arealink.hxx>
42 #include <sfx2/linkmgr.hxx>
43 #include <scerrors.hxx>
44 #include <editutil.hxx>
45 #include <formulacell.hxx>
46 #include "editattributemap.hxx"
47 #include <tokenarray.hxx>
48 #include <scmatrix.hxx>
49 #include <documentimport.hxx>
50 #include <externalrefmgr.hxx>
51 
52 #include <xmloff/maptype.hxx>
53 #include <xmloff/xmltkmap.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/zforlist.hxx>
62 #include <svx/svdocapt.hxx>
63 #include <editeng/eeitem.hxx>
64 #include <editeng/outlobj.hxx>
65 #include <editeng/wghtitem.hxx>
66 #include <editeng/colritem.hxx>
67 #include <editeng/fhgtitem.hxx>
68 #include <editeng/postitem.hxx>
69 #include <editeng/flditem.hxx>
70 #include <editeng/fontitem.hxx>
71 #include <editeng/udlnitem.hxx>
72 #include <editeng/wrlmitem.hxx>
76 #include <editeng/contouritem.hxx>
77 #include <editeng/shdditem.hxx>
78 #include <editeng/kernitem.hxx>
79 #include <editeng/autokernitem.hxx>
82 #include <editeng/langitem.hxx>
83 #include <svx/unoapi.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 <sal/log.hxx>
95 #include <i18nlangtag/lang.h>
96 
98 #include <comphelper/lok.hxx>
99 
100 using namespace com::sun::star;
101 using namespace xmloff::token;
102 
104  maItemSet(rEditEngine.GetEmptyItemSet()) {}
105 
106 ScXMLTableRowCellContext::Field::Field(std::unique_ptr<SvxFieldData> pData) : mpData(std::move(pData)) {}
107 
109 {
110 }
111 
114  const bool bTempIsCovered,
115  const sal_Int32 nTempRepeatedRows ) :
116  ScXMLImportContext( rImport ),
117  mpEditEngine(GetScImport().GetEditEngine()),
118  mnCurParagraph(0),
119  fValue(0.0),
120  nMergedRows(1),
121  nMatrixRows(0),
122  nRepeatedRows(nTempRepeatedRows),
123  nMergedCols(1),
124  nMatrixCols(0),
125  nColsRepeated(1),
126  rXMLImport(rImport),
127  eGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT),
128  nCellType(util::NumberFormat::TEXT),
129  bIsMerged(false),
130  bIsMatrix(false),
131  bIsCovered(bTempIsCovered),
132  bIsEmpty(true),
133  mbNewValueType(false),
134  mbErrorValue(false),
135  bSolarMutexLocked(false),
136  bFormulaTextResult(false),
137  mbPossibleErrorCell(false),
139  mbEditEngineHasText(false),
140  mbHasFormatRuns(false),
141  mbHasStyle(false),
143 {
144  rtl::math::setNan(&fValue); // NaN by default
145 
146  rXMLImport.GetTables().AddColumn(bTempIsCovered);
147 
148  std::optional<OUString> xStyleName;
149  std::optional<OUString> xCurrencySymbol;
150  if ( rAttrList.is() )
151  {
152  for (auto &it : *rAttrList)
153  {
154  switch ( it.getToken() )
155  {
157  xStyleName = it.toString();
158  mbHasStyle = true;
159  break;
161  OSL_ENSURE(!maContentValidationName, "here should be only one Validation Name");
162  if (!it.isEmpty())
163  maContentValidationName = it.toString();
164  break;
166  bIsMerged = true;
167  nMergedRows = static_cast<SCROW>(it.toInt32());
168  break;
170  bIsMerged = true;
171  nMergedCols = static_cast<SCCOL>(it.toInt32());
172  break;
174  bIsMatrix = true;
175  nMatrixCols = static_cast<SCCOL>(it.toInt32());
176  break;
178  bIsMatrix = true;
179  nMatrixRows = static_cast<SCROW>(it.toInt32());
180  break;
182  nColsRepeated = static_cast<SCCOL>(std::min<sal_Int32>( MAXCOLCOUNT,
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::getUnoTunnelImplementation<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 
632  const OUString& rLName,
633  const css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList )
634 {
635  SvXMLImportContext *pContext = nullptr;
636 
638  bool bTextP(false);
639  switch( rTokenMap.Get( nPrefix, rLName ) )
640  {
642  {
643  bTextP = true;
644  }
645  break;
647  {
648  bIsEmpty = false;
649  OSL_ENSURE(
651  "ScXMLTableRowCellContext::CreateChildContext - multiple annotations in one cell");
653  pContext = new ScXMLAnnotationContext( rXMLImport, nPrefix, rLName,
654  xAttrList, *mxAnnotationData);
655  }
656  break;
657  }
658 
659  if (!pContext && !bTextP)
660  {
662  uno::Reference<drawing::XShapes> xShapes (rXMLImport.GetTables().GetCurrentXShapes());
663  if (xShapes.is())
664  {
666  if (aCellPos.Col() > pDoc->MaxCol())
667  aCellPos.SetCol(pDoc->MaxCol());
668  if (aCellPos.Row() > pDoc->MaxRow())
669  aCellPos.SetRow(pDoc->MaxRow());
670  XMLTableShapeImportHelper* pTableShapeImport =
671  static_cast< XMLTableShapeImportHelper* >( rXMLImport.GetShapeImport().get() );
672  pTableShapeImport->SetOnTable(false);
673  pTableShapeImport->SetCell(aCellPos);
674  pContext = rXMLImport.GetShapeImport()->CreateGroupChildContext(
675  rXMLImport, nPrefix, rLName, xAttrList, xShapes);
676  if (pContext)
677  {
678  bIsEmpty = false;
680  }
681  }
682  }
683 
684  return pContext;
685 }
686 
687 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL ScXMLTableRowCellContext::createFastChildContext(
688  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
689 {
690  SvXMLImportContext *pContext = nullptr;
691  sax_fastparser::FastAttributeList *pAttribList =
693 
694  // bool bTextP(false);
695  switch (nElement)
696  {
697  case XML_ELEMENT( TEXT, XML_P ):
698  {
699  bIsEmpty = false;
700  // bTextP = true;
701 
702  pContext = new ScXMLCellTextParaContext(rXMLImport, *this);
703  }
704  break;
706  {
707  SAL_WARN("sc", "ScXMLTableRowCellContext::createFastChildContext: subtables are not supported");
708  }
709  break;
711  {
712  bIsEmpty = false;
713  if (!pDetectiveObjVec)
715  pContext = new ScXMLDetectiveContext(
716  rXMLImport, pDetectiveObjVec.get() );
717  }
718  break;
720  {
721  bIsEmpty = false;
722  if (!pCellRangeSource)
724  pContext = new ScXMLCellRangeSourceContext(
725  rXMLImport, pAttribList, pCellRangeSource.get() );
726  }
727  break;
728  }
729 
730  return pContext;
731 }
732 
733 void ScXMLTableRowCellContext::DoMerge( const ScAddress& rScAddress, const SCCOL nCols, const SCROW nRows )
734 {
735  SCCOL mergeToCol = rScAddress.Col() + nCols;
736  SCROW mergeToRow = rScAddress.Row() + nRows;
738  bool bInBounds = rScAddress.Col() <= pDoc->MaxCol() && rScAddress.Row() <= pDoc->MaxRow() &&
739  mergeToCol <= pDoc->MaxCol() && mergeToRow <= pDoc->MaxRow();
740  if( bInBounds )
741  {
742  pDoc->DoMerge( rScAddress.Tab(),
743  rScAddress.Col(), rScAddress.Row(), mergeToCol, mergeToRow );
744  }
745 }
746 
747 namespace {
748 
749 ScValidationMode validationTypeToMode( const sheet::ValidationType eVType )
750 {
752  switch( eVType )
753  {
754  case sheet::ValidationType_WHOLE: eMode = SC_VALID_WHOLE; break;
755  case sheet::ValidationType_DECIMAL: eMode = SC_VALID_DECIMAL; break;
756  case sheet::ValidationType_DATE: eMode = SC_VALID_DATE; break;
757  case sheet::ValidationType_TIME: eMode = SC_VALID_TIME; break;
758  case sheet::ValidationType_TEXT_LEN: eMode = SC_VALID_TEXTLEN; break;
759  case sheet::ValidationType_LIST: eMode = SC_VALID_LIST; break;
760  case sheet::ValidationType_CUSTOM: eMode = SC_VALID_CUSTOM; break;
761  default: eMode = SC_VALID_ANY; break;
762  }
763  return eMode;
764 }
765 
766 ScValidErrorStyle validAlertToValidError( const sheet::ValidationAlertStyle eVAlertStyle )
767 {
768  ScValidErrorStyle eVErrStyle;
769  switch( eVAlertStyle )
770  {
771  case sheet::ValidationAlertStyle_STOP: eVErrStyle = SC_VALERR_STOP; break;
772  case sheet::ValidationAlertStyle_WARNING: eVErrStyle = SC_VALERR_WARNING; break;
773  case sheet::ValidationAlertStyle_MACRO: eVErrStyle = SC_VALERR_MACRO; break;
774  default: eVErrStyle = SC_VALERR_INFO; break;
775  //should INFO be the default? seems to be the most unobtrusive choice.
776  }
777  return eVErrStyle;
778 }
779 
780 }
781 
783 {
785  return;
786 
788  ScMyImportValidation aValidation;
789  aValidation.eGrammar1 = aValidation.eGrammar2 = pDoc->GetStorageGrammar();
790  if( !rXMLImport.GetValidation(*maContentValidationName, aValidation) )
791  return;
792 
793  ScValidationData aScValidationData(
794  validationTypeToMode(aValidation.aValidationType),
796  aValidation.sFormula1, aValidation.sFormula2, *pDoc, ScAddress(),
797  aValidation.sFormulaNmsp1, aValidation.sFormulaNmsp2,
798  aValidation.eGrammar1, aValidation.eGrammar2
799  );
800 
801  aScValidationData.SetIgnoreBlank( aValidation.bIgnoreBlanks );
802  aScValidationData.SetListType( aValidation.nShowList );
803 
804  // set strings for error / input even if disabled (and disable afterwards)
805  aScValidationData.SetInput( aValidation.sInputTitle, aValidation.sInputMessage );
806  if( !aValidation.bShowInputMessage )
807  aScValidationData.ResetInput();
808  aScValidationData.SetError( aValidation.sErrorTitle, aValidation.sErrorMessage, validAlertToValidError(aValidation.aAlertStyle) );
809  if( !aValidation.bShowErrorMessage )
810  aScValidationData.ResetError();
811 
812  if( !aValidation.sBaseCellAddress.isEmpty() )
813  aScValidationData.SetSrcString( aValidation.sBaseCellAddress );
814 
815  sal_uLong nIndex = pDoc->AddValidationEntry( aScValidationData );
816 
817  ScPatternAttr aPattern( pDoc->GetPool() );
818  aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nIndex ) );
819  if( rScRange.aStart == rScRange.aEnd ) //for a single cell
820  {
821  pDoc->ApplyPattern( rScRange.aStart.Col(), rScRange.aStart.Row(),
822  rScRange.aStart.Tab(), aPattern );
823  }
824  else //for repeating cells
825  {
826  pDoc->ApplyPatternAreaTab( rScRange.aStart.Col(), rScRange.aStart.Row(),
827  rScRange.aEnd.Col(), rScRange.aEnd.Row(),
828  rScRange.aStart.Tab(), aPattern );
829  }
830 
831  // is the below still needed?
832  // For now, any sheet with validity is blocked from stream-copying.
833  // Later, the validation names could be stored along with the style names.
834  ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetImport().GetModel())->GetSheetSaveData();
835  pSheetData->BlockSheet( GetScImport().GetTables().GetCurrentSheet() );
836 }
837 
839 {
840  SetContentValidation( ScRange(rCellPos, rCellPos) );
841 }
842 
844 {
846  if (!pDoc || !mxAnnotationData)
847  return;
848 
849  LockSolarMutex();
850 
851  ScPostIt* pNote = nullptr;
852 
853  uno::Reference< drawing::XShapes > xShapes = rXMLImport.GetTables().GetCurrentXShapes();
854  sal_Int32 nOldShapeCount = xShapes.is() ? xShapes->getCount() : 0;
855 
856  OSL_ENSURE( !mxAnnotationData->mxShape.is() || mxAnnotationData->mxShapes.is(),
857  "ScXMLTableRowCellContext::SetAnnotation - shape without drawing page" );
858  if( mxAnnotationData->mxShape.is() && mxAnnotationData->mxShapes.is() )
859  {
860  OSL_ENSURE( mxAnnotationData->mxShapes.get() == xShapes.get(), "ScXMLTableRowCellContext::SetAnnotation - different drawing pages" );
861  SdrObject* pObject = ::GetSdrObjectFromXShape( mxAnnotationData->mxShape );
862  OSL_ENSURE( pObject, "ScXMLTableRowCellContext::SetAnnotation - cannot get SdrObject from shape" );
863 
864  /* Try to reuse the drawing object already created (but only if the
865  note is visible, and the object is a caption object). */
866  if( mxAnnotationData->mbShown && mxAnnotationData->mbUseShapePos && !comphelper::LibreOfficeKit::isActive())
867  {
868  if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
869  {
870  OSL_ENSURE( !pCaption->GetLogicRect().IsEmpty(), "ScXMLTableRowCellContext::SetAnnotation - invalid caption rectangle" );
871  // create the cell note with the caption object
872  pNote = ScNoteUtil::CreateNoteFromCaption( *pDoc, rPos, pCaption );
873  // forget pointer to object (do not create note again below)
874  pObject = nullptr;
875  }
876  }
877 
878  // drawing object has not been used to create a note -> use shape data
879  if( pObject )
880  {
881  // rescue settings from drawing object before the shape is removed
882  ::std::unique_ptr< SfxItemSet > xItemSet( new SfxItemSet( pObject->GetMergedItemSet() ) );
883  ::std::unique_ptr< OutlinerParaObject > xOutlinerObj;
884  if( OutlinerParaObject* pOutlinerObj = pObject->GetOutlinerParaObject() )
885  xOutlinerObj.reset( new OutlinerParaObject( *pOutlinerObj ) );
886  tools::Rectangle aCaptionRect;
887  if( mxAnnotationData->mbUseShapePos )
888  aCaptionRect = pObject->GetLogicRect();
889  // remove the shape from the drawing page, this invalidates pObject
890  mxAnnotationData->mxShapes->remove( mxAnnotationData->mxShape );
891  pObject = nullptr;
892  // update current number of existing objects
893  if( xShapes.is() )
894  nOldShapeCount = xShapes->getCount();
895 
896  // an outliner object is required (empty note captions not allowed)
897  if (xOutlinerObj)
898  {
899  // create cell note with all data from drawing object
901  {
902  pNote = ScNoteUtil::CreateNoteFromObjectData( *pDoc, rPos,
903  std::move(xItemSet), xOutlinerObj.release(),
904  aCaptionRect, mxAnnotationData->mbShown );
905  }
906  else
907  {
908  pNote = ScNoteUtil::CreateNoteFromObjectData( *pDoc, rPos,
909  std::move(xItemSet), xOutlinerObj.release(),
910  aCaptionRect, false );
911  }
912 
913  }
914  }
915  }
916  else if( !mxAnnotationData->maSimpleText.isEmpty() )
917  {
918  // create note from simple text
919  pNote = ScNoteUtil::CreateNoteFromString( *pDoc, rPos,
920  mxAnnotationData->maSimpleText, mxAnnotationData->mbShown, false );
921  }
922 
923  // set author and date
924  if( pNote )
925  {
926  double fDate;
928  {
929  SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
930  sal_uInt32 nfIndex = pNumForm->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, LANGUAGE_SYSTEM );
931  OUString aDate;
932  const Color* pColor = nullptr;
933  pNumForm->GetOutputString( fDate, nfIndex, aDate, &pColor );
934  pNote->SetDate( aDate );
935  }
936  pNote->SetAuthor( mxAnnotationData->maAuthor );
937  }
938 
939  // register a shape that has been newly created in the ScNoteUtil functions
940  if( xShapes.is() && (nOldShapeCount < xShapes->getCount()) )
941  {
942  uno::Reference< drawing::XShape > xShape;
943  rXMLImport.GetShapeImport()->shapeWithZIndexAdded( xShape, xShapes->getCount() );
944  }
945 
946  // store the style names for stream copying
947  ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(rXMLImport.GetModel())->GetSheetSaveData();
948  pSheetData->HandleNoteStyles( mxAnnotationData->maStyleName, mxAnnotationData->maTextStyle, rPos );
949 
950  for (const auto& rContentStyle : mxAnnotationData->maContentStyles)
951  {
952  pSheetData->AddNoteContentStyle( rContentStyle.mnFamily, rContentStyle.maName, rPos, rContentStyle.maSelection );
953  }
954 }
955 
956 // core implementation
958 {
960  if( !pDoc || !cellExists(*pDoc, rPosition) || !pDetectiveObjVec || pDetectiveObjVec->empty() )
961  return;
962 
963  LockSolarMutex();
964  ScDetectiveFunc aDetFunc( *pDoc, rPosition.Tab() );
965  uno::Reference<container::XIndexAccess> xShapesIndex = rXMLImport.GetTables().GetCurrentXShapes(); // make draw page
966  for(const auto& rDetectiveObj : *pDetectiveObjVec)
967  {
968  aDetFunc.InsertObject( rDetectiveObj.eObjType, rPosition, rDetectiveObj.aSourceRange, rDetectiveObj.bHasError );
969  if (xShapesIndex.is())
970  {
971  sal_Int32 nShapes = xShapesIndex->getCount();
972  uno::Reference < drawing::XShape > xShape;
973  rXMLImport.GetShapeImport()->shapeWithZIndexAdded(xShape, nShapes);
974  }
975  }
976 }
977 
978 // core implementation
980 {
982  if( !pDoc || !cellExists(*pDoc, rPosition) || !pCellRangeSource || pCellRangeSource->sSourceStr.isEmpty() ||
983  pCellRangeSource->sFilterName.isEmpty() || pCellRangeSource->sURL.isEmpty() )
984  return;
985 
986  LockSolarMutex();
987  ScRange aDestRange( rPosition.Col(), rPosition.Row(), rPosition.Tab(),
988  rPosition.Col() + static_cast<SCCOL>(pCellRangeSource->nColumns - 1),
989  rPosition.Row() + static_cast<SCROW>(pCellRangeSource->nRows - 1), rPosition.Tab() );
990  OUString sFilterName( pCellRangeSource->sFilterName );
991  OUString sSourceStr( pCellRangeSource->sSourceStr );
993  sFilterName, pCellRangeSource->sFilterOptions, sSourceStr, aDestRange, pCellRangeSource->nRefresh );
994  sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
995  pLinkManager->InsertFileLink( *pLink, sfx2::SvBaseLinkObjectType::ClientFile, pCellRangeSource->sURL, &sFilterName, &sSourceStr );
996 }
997 
999 {
1000  if(!pFCell)
1001  return;
1002 
1003  bool bMayForceNumberformat = true;
1004 
1005  if(mbErrorValue)
1006  {
1007  // don't do anything here
1008  // we need to recalc anyway
1009  }
1010  else if( bFormulaTextResult && maStringValue )
1011  {
1012  if( !IsPossibleErrorString() )
1013  {
1014  ScDocument* pDoc = rXMLImport.GetDocument();
1016  pFCell->ResetDirty();
1017  // A General format doesn't force any other format for a string
1018  // result, don't attempt to recalculate this later.
1019  bMayForceNumberformat = false;
1020  }
1021  }
1022  else if (std::isfinite(fValue))
1023  {
1024  pFCell->SetHybridDouble(fValue);
1025  if (mbPossibleEmptyDisplay && fValue == 0.0)
1026  {
1027  // Needs to be recalculated to propagate, otherwise would be
1028  // propagated as empty string. So don't ResetDirty().
1030  }
1031  else
1032  pFCell->ResetDirty();
1033  }
1034 
1035  if (bMayForceNumberformat)
1036  // Re-calculate to get number format only when style is not set.
1037  pFCell->SetNeedNumberFormat(!mbHasStyle);
1038 }
1039 
1041  const SCCOL nCurrentCol, const ::std::optional< OUString >& pOUText )
1042 {
1043  ScDocument* pDoc = rXMLImport.GetDocument();
1044  bool bDoIncrement = true;
1045  //matrix reference cells that contain text formula results;
1046  //cell was already put in document, just need to set text here.
1047  if( pDoc && rXMLImport.GetTables().IsPartOfMatrix(rCurrentPos) )
1048  {
1049  ScRefCellValue aCell(*pDoc, rCurrentPos);
1050  bDoIncrement = aCell.meType == CELLTYPE_FORMULA;
1051  if ( bDoIncrement )
1052  {
1053  ScFormulaCell* pFCell = aCell.mpFormula;
1054  OUString aCellString;
1055  if (maStringValue)
1056  aCellString = *maStringValue;
1057  else if (mbEditEngineHasText)
1058  aCellString = GetFirstParagraph();
1059  else if ( nCurrentCol > 0 && pOUText && !pOUText->isEmpty() )
1060  aCellString = *pOUText;
1061  else
1062  bDoIncrement = false;
1063 
1064  if(mbErrorValue)
1065  bDoIncrement = false;
1066 
1067  if(!aCellString.isEmpty())
1068  {
1069  if (bDoIncrement && !IsPossibleErrorString() && pFCell)
1070  {
1071  pFCell->SetHybridString(pDoc->GetSharedStringPool().intern(aCellString));
1072  pFCell->ResetDirty();
1073  }
1074  else
1075  {
1076  ScAddress aTopLeftMatrixCell;
1077  if (pFCell && pFCell->GetMatrixOrigin(*pDoc, aTopLeftMatrixCell))
1078  {
1079  ScFormulaCell* pMatrixCell = pDoc->GetFormulaCell(aTopLeftMatrixCell);
1080  if (pMatrixCell)
1081  pMatrixCell->SetDirty();
1082  }
1083  else
1084  SAL_WARN("sc", "matrix cell without matrix");
1085  }
1086  }
1087  }
1088  }
1089  else //regular text cells
1090  {
1092  if (maStringValue)
1093  {
1094  rDoc.setStringCell(rCurrentPos, *maStringValue);
1095  bDoIncrement = true;
1096  }
1097  else if (mbEditEngineHasText)
1098  {
1099  if (maFirstParagraph)
1100  {
1101  // This is a normal text without format runs.
1102  rDoc.setStringCell(rCurrentPos, *maFirstParagraph);
1103  }
1104  else
1105  {
1106  // This text either has format runs, has field(s), or consists of multiple lines.
1107  for (const auto& rxFormat : maFormats)
1108  mpEditEngine->QuickSetAttribs(rxFormat->maItemSet, rxFormat->maSelection);
1109 
1110  for (const auto& rxField : maFields)
1111  mpEditEngine->QuickInsertField(SvxFieldItem(*rxField->mpData, EE_FEATURE_FIELD), rxField->maSelection);
1112 
1113  // This edit engine uses the SfxItemPool instance returned
1114  // from pDoc->GetEditPool() to create the text object, which
1115  // is a prerequisite for using this constructor of ScEditCell.
1116  rDoc.setEditCell(rCurrentPos, mpEditEngine->CreateTextObject());
1117  }
1118  bDoIncrement = true;
1119  }
1120  else if ( nCurrentCol > 0 && pOUText && !pOUText->isEmpty() )
1121  {
1122  rDoc.setStringCell(rCurrentPos, *pOUText);
1123  bDoIncrement = true;
1124  }
1125  else
1126  bDoIncrement = false;
1127  }
1128 
1129  // #i56027# This is about setting simple text, not edit cells,
1130  // so ProgressBarIncrement must be called with bEditCell = FALSE.
1131  // Formatted text that is put into the cell by the child context
1132  // is handled in AddCellsToTable() (bIsEmpty is true then).
1133  if (bDoIncrement)
1135 }
1136 
1138 {
1139  //matrix reference cells that contain value formula results;
1140  //cell was already put in document, just need to set value here.
1141  if( rXMLImport.GetTables().IsPartOfMatrix(rCurrentPos) )
1142  {
1143  ScRefCellValue aCell(*rXMLImport.GetDocument(), rCurrentPos);
1144  if (aCell.meType == CELLTYPE_FORMULA)
1145  {
1146  ScFormulaCell* pFCell = aCell.mpFormula;
1147  SetFormulaCell(pFCell);
1148  if (pFCell)
1149  pFCell->SetNeedNumberFormat( true );
1150  }
1151  }
1152  else //regular value cell
1153  {
1154  // fdo#62250 absent values are not NaN, set to 0.0
1155  // PutValueCell() is called only for a known cell value type,
1156  // bIsEmpty==false in all these cases, no sense to check it here.
1157  if (!std::isfinite( fValue))
1158  fValue = 0.0;
1159 
1160  // #i62435# Initialize the value cell's script type if the default
1161  // style's number format is latin-only. If the cell uses a different
1162  // format, the script type will be reset when the style is applied.
1163 
1164  rXMLImport.GetDoc().setNumericCell(rCurrentPos, fValue);
1165  }
1167 }
1168 
1169 namespace {
1170 
1171 bool isEmptyOrNote( const ScDocument* pDoc, const ScAddress& rCurrentPos )
1172 {
1173  CellType eType = pDoc->GetCellType(rCurrentPos);
1174  return (eType == CELLTYPE_NONE);
1175 }
1176 
1177 }
1178 
1180  const ::std::optional< OUString >& pOUText, ScAddress& rCurrentPos )
1181 {
1182  ScDocument* pDoc = rXMLImport.GetDocument();
1183  ScMyTables& rTables = rXMLImport.GetTables();
1184  bool bWasEmpty = bIsEmpty;
1185  for (SCCOL i = 0; i < nColsRepeated; ++i)
1186  {
1187  rCurrentPos.SetCol( rCellPos.Col() + i );
1188 
1189  // it makes no sense to import data after the last supported column
1190  // fdo#58539 & gnome#627150
1191  if(rCurrentPos.Col() > pDoc->MaxCol())
1192  break;
1193 
1194  if (i > 0)
1195  rTables.AddColumn(false);
1196  if (!bIsEmpty)
1197  {
1198  for (SCROW j = 0; j < nRepeatedRows; ++j)
1199  {
1200  rCurrentPos.SetRow( rCellPos.Row() + j );
1201 
1202  // it makes no sense to import data after last supported row
1203  // fdo#58539 & gnome#627150
1204  if(rCurrentPos.Row() > pDoc->MaxRow())
1205  break;
1206 
1207  if( (rCurrentPos.Col() == 0) && (j > 0) )
1208  {
1209  rTables.AddRow();
1210  rTables.AddColumn(false);
1211  }
1212  if( cellExists(*pDoc, rCurrentPos) )
1213  {
1214  if( !bIsCovered || isEmptyOrNote(pDoc, rCurrentPos) )
1215  {
1216  switch (nCellType)
1217  {
1218  case util::NumberFormat::TEXT:
1219  {
1220  PutTextCell( rCurrentPos, i, pOUText );
1221  }
1222  break;
1223  case util::NumberFormat::NUMBER:
1225  case util::NumberFormat::CURRENCY:
1226  case util::NumberFormat::TIME:
1227  case util::NumberFormat::DATETIME:
1228  case util::NumberFormat::LOGICAL:
1229  {
1230  PutValueCell( rCurrentPos );
1231  }
1232  break;
1233  default:
1234  {
1235  OSL_FAIL("no cell type given");
1236  }
1237  break;
1238  }
1239  }
1240 
1241  SetAnnotation( rCurrentPos );
1242  SetDetectiveObj( rCurrentPos );
1243  SetCellRangeSource( rCurrentPos );
1244  }
1245  else
1246  {
1247  if (!bWasEmpty || mxAnnotationData)
1248  {
1249  if (rCurrentPos.Row() > pDoc->MaxRow())
1251  else
1253  }
1254  }
1255  }
1256  }
1257  else
1258  {
1259  if ((i == 0) && (rCellPos.Col() == 0))
1260  {
1261  for (sal_Int32 j = 1; j < nRepeatedRows; ++j)
1262  {
1263  rTables.AddRow();
1264  rTables.AddColumn(false);
1265  }
1266  }
1267  }
1268  }
1269 }
1270 
1272 {
1273  return ( (nColsRepeated > 1) || (nRepeatedRows > 1) );
1274 }
1275 
1276 namespace {
1277 
1278 // from ScCellObj::GetOutputString_Imp(). all of it may not be necessary.
1279 OUString getOutputString( ScDocument* pDoc, const ScAddress& aCellPos )
1280 {
1281  if (!pDoc)
1282  return OUString();
1283 
1284  ScRefCellValue aCell(*pDoc, aCellPos);
1285  switch (aCell.meType)
1286  {
1287  case CELLTYPE_NONE:
1288  return OUString();
1289  case CELLTYPE_EDIT:
1290  {
1291  // GetString on EditCell replaces linebreaks with spaces;
1292  // however here we need line breaks
1293  const EditTextObject* pData = aCell.mpEditText;
1294  EditEngine& rEngine = pDoc->GetEditEngine();
1295  rEngine.SetText(*pData);
1296  return rEngine.GetText();
1297  // also don't format EditCells per NumberFormatter
1298  }
1299  break;
1300  default:
1301  {
1302  // like in GetString for document (column)
1303  const Color* pColor;
1304  sal_uInt32 nNumFmt = pDoc->GetNumberFormat(aCellPos);
1305  OUString aStr;
1306  ScCellFormat::GetString(aCell, nNumFmt, aStr, &pColor, *pDoc->GetFormatTable(), *pDoc);
1307  return aStr;
1308  }
1309  }
1310 }
1311 
1312 }
1313 
1315 {
1316  ::std::optional< OUString > pOUText;
1317 
1318  ScDocument* pDoc = rXMLImport.GetDocument();
1319  if( nCellType == util::NumberFormat::TEXT )
1320  {
1321  if( !bIsEmpty && !maStringValue && !mbEditEngineHasText && cellExists(*pDoc, rCellPos) && CellsAreRepeated() )
1322  pOUText = getOutputString(pDoc, rCellPos);
1323 
1324  if (!mbEditEngineHasText && !pOUText && !maStringValue)
1325  bIsEmpty = true;
1326  }
1327 
1328  ScAddress aCurrentPos( rCellPos );
1329  if( mxAnnotationData || pDetectiveObjVec || pCellRangeSource ) // has special content
1330  bIsEmpty = false;
1331 
1332  AddTextAndValueCell( rCellPos, pOUText, aCurrentPos );
1333 
1334  if( CellsAreRepeated() )
1335  {
1336  SCCOL nStartCol( std::min(rCellPos.Col(), pDoc->MaxCol()) );
1337  SCROW nStartRow( std::min(rCellPos.Row(), pDoc->MaxRow()) );
1338  SCCOL nEndCol( std::min<SCCOL>(rCellPos.Col() + nColsRepeated - 1, pDoc->MaxCol()) );
1339  SCROW nEndRow( std::min(rCellPos.Row() + nRepeatedRows - 1, pDoc->MaxRow()) );
1340  ScRange aScRange( nStartCol, nStartRow, rCellPos.Tab(), nEndCol, nEndRow, rCellPos.Tab() );
1341  SetContentValidation( aScRange );
1342  rXMLImport.GetStylesImportHelper()->AddRange( aScRange );
1343  }
1344  else if( cellExists(*pDoc, rCellPos) )
1345  {
1347  SetContentValidation( rCellPos );
1348  }
1349 }
1350 
1352 {
1353  ScDocument* pDoc = rXMLImport.GetDocument();
1354  ScDocumentImport& rDocImport = rXMLImport.GetDoc();
1355 
1356  OUString aText = maFormula->first;
1357 
1358  ScExternalRefManager::ApiGuard aExtRefGuard(*pDoc);
1359 
1360  if ( aText.isEmpty() )
1361  return;
1362 
1363  // temporary formula string as string tokens
1364  std::unique_ptr<ScTokenArray> pCode(new ScTokenArray(*pDoc));
1365 
1366  // Check the special case of a single error constant without leading
1367  // '=' and create an error formula cell without tokens.
1369  if (nError != FormulaError::NONE)
1370  {
1371  pCode->SetCodeError(nError);
1372  }
1373  else
1374  {
1375  // 5.2 and earlier wrote broken "Err:xxx" as formula to designate
1376  // an error formula cell.
1377  if (aText.startsWithIgnoreAsciiCase("Err:") && aText.getLength() <= 9 &&
1378  ((nError =
1379  GetScImport().GetFormulaErrorConstant( "#ERR" + aText.copy(4) + "!")) != FormulaError::NONE))
1380  {
1381  pCode->SetCodeError(nError);
1382  }
1383  else
1384  {
1385  OUString aFormulaNmsp = maFormula->second;
1387  aFormulaNmsp.clear();
1388  pCode->AssignXMLString( aText, aFormulaNmsp );
1389  rDocImport.getDoc().IncXMLImportedFormulaCount( aText.getLength() );
1390  }
1391  }
1392 
1393  ScFormulaCell* pNewCell = new ScFormulaCell(*pDoc, rCellPos, std::move(pCode), eGrammar, ScMatrixMode::NONE);
1394  SetFormulaCell(pNewCell);
1395  rDocImport.setFormulaCell(rCellPos, pNewCell);
1396 }
1397 
1399 {
1400  ScDocument* pDoc = rXMLImport.GetDocument();
1401  if( cellExists(*pDoc, rCellPos) )
1402  {
1403  SetContentValidation( rCellPos );
1404  SAL_WARN_IF((nColsRepeated != 1) || (nRepeatedRows != 1), "sc", "repeated cells with formula not possible now");
1406 
1407  //add matrix
1408  if(bIsMatrix)
1409  {
1410  if (nMatrixCols > 0 && nMatrixRows > 0)
1411  {
1412  //matrix cells are put in the document, but we must set the
1413  //value/text of each matrix cell later
1415  rCellPos.Col(), rCellPos.Row(),
1416  std::min<SCCOL>(rCellPos.Col() + nMatrixCols - 1, pDoc->MaxCol()),
1417  std::min<SCROW>(rCellPos.Row() + nMatrixRows - 1, pDoc->MaxRow()),
1418  maFormula->first, maFormula->second, eGrammar);
1419 
1420  // Set the value/text of the top-left matrix position in its
1421  // cached result. For import, we only need to set the correct
1422  // matrix geometry and the value type of the top-left element.
1423  ScFormulaCell* pFCell = pDoc->GetFormulaCell(rCellPos);
1424  if (pFCell)
1425  {
1428  {
1429  if (!IsPossibleErrorString())
1430  {
1431  pFCell->SetResultMatrix(
1434  pFCell->ResetDirty();
1435  }
1436  }
1437  else if (std::isfinite(fValue))
1438  {
1439  pFCell->SetResultMatrix(
1441  pFCell->ResetDirty();
1442  }
1443  }
1444  }
1445  }
1446  else
1447  PutFormulaCell( rCellPos );
1448 
1449  SetAnnotation( rCellPos );
1450  SetDetectiveObj( rCellPos );
1451  SetCellRangeSource( rCellPos );
1453  }
1454  else
1455  {
1456  if (rCellPos.Row() > pDoc->MaxRow())
1458  else
1460  }
1461 }
1462 
1463 //There are cases where a formula cell is exported with an office:value of 0 or
1464 //no office:value at all, but the formula cell will have a text:p value which
1465 //contains the intended formula result.
1466 //These cases include when a formula result:
1467 // - is blank
1468 // - has a constant error value beginning with "#" (such as "#VALUE!" or "#N/A")
1469 // - has an "Err:[###]" (where "[###]" is an error number)
1470 // Libreoffice 4.1+ with ODF1.2 extended write however calcext:value-type="error" in that case
1472 {
1473  if (!mbEditEngineHasText)
1474  return;
1475 
1476  const OUString aStr = GetFirstParagraph();
1477 
1478  if (mbNewValueType)
1479  {
1480  if (aStr.isEmpty())
1481  mbPossibleEmptyDisplay = true;
1482  return;
1483  }
1484 
1485  if (aStr.isEmpty())
1486  {
1487  mbPossibleErrorCell = true;
1488  mbPossibleEmptyDisplay = true;
1489  }
1490  else if (aStr.startsWith("Err:"))
1491  mbPossibleErrorCell = true;
1492  else if (aStr.startsWith("#"))
1494 }
1495 
1497 {
1499  return false;
1500  else if(mbNewValueType && mbErrorValue)
1501  return true;
1503  GetScImport().GetFormulaErrorConstant(*maStringValue) != FormulaError::NONE);
1504 }
1505 
1506 void SAL_CALL ScXMLTableRowCellContext::endFastElement(sal_Int32 /*nElement*/)
1507 {
1510  {
1512  }
1513 
1515  if( aCellPos.Col() > 0 && nRepeatedRows > 1 )
1516  aCellPos.SetRow( aCellPos.Row() - (nRepeatedRows - 1) );
1517  if( bIsMerged )
1518  DoMerge( aCellPos, nMergedCols - 1, nMergedRows - 1 );
1519 
1520  if (maFormula)
1521  AddFormulaCell(aCellPos);
1522  else
1523  AddNonFormulaCell(aCellPos);
1524 
1525  //if LockSolarMutex got used, we presumably need to ensure an UnlockSolarMutex
1526  if (bSolarMutexLocked)
1527  {
1529  bSolarMutexLocked = false;
1530  }
1531 
1532  bIsMerged = false;
1533  nMergedCols = 1;
1534  nMergedRows = 1;
1535  nColsRepeated = 1;
1536 }
1537 
1538 /* 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:113
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:887
bool IsXMLToken(const OUString &rString, enum XMLTokenEnum eToken)
OUString sFormulaNmsp2
Definition: xmlimprt.hxx:180
OUString GetText(LineEnd eEnd=LINEEND_LF) const
bool CellsAreRepeated() const
Definition: xmlcelli.cxx:1271
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:1179
sal_Int32 nIndex
XML_NUMBER_ROWS_SPANNED
void IncXMLImportedFormulaCount(sal_uLong nVal)
Definition: document.hxx:2358
ScAddress aStart
Definition: address.hxx:500
constexpr TypedWhichId< SvxAutoKernItem > EE_CHAR_PAIRKERNING(EE_CHAR_START+11)
SharedString intern(const OUString &rStr)
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
Definition: documen2.cxx:563
XML_VALUE_TYPE
XML_STYLE_NAME
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:882
void PutFormulaCell(const ScAddress &rScCurrentPos)
Definition: xmlcelli.cxx:1351
ScXMLTableRowCellContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, const bool bIsCovered, const sal_Int32 nRepeatedRows)
Definition: xmlcelli.cxx:112
Provide mapping from ODF text formatting styles to EditEngine's, for rich-text cell content import...
SCROW Row() const
Definition: address.hxx:262
ScEditEngineDefaulter * mpEditEngine
unformatted first paragraph, for better performance.
Definition: xmlcelli.hxx:70
void SetAnnotation(const ScAddress &rPosition)
Definition: xmlcelli.cxx:843
OUString sFormulaNmsp1
Definition: xmlimprt.hxx:179
void SetOnTable(const bool bTempOnTable)
std::unique_ptr< ContentProperties > pData
void PutValueCell(const ScAddress &rScCurrentPos)
Definition: xmlcelli.cxx:1137
sal_uInt32 GetFormatIndex(NfIndexTableOffset, LanguageType eLnge=LANGUAGE_DONTKNOW)
ScDocument * GetDocument()
Definition: xmlimprt.hxx:296
SC_DLLPUBLIC const ScFormulaCell * GetFormulaCell(const ScAddress &rPos) const
Definition: document.cxx:3723
void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)
const ::std::vector< XMLPropertyState > & GetProperties() const
XML_DETECTIVE
ScValidErrorStyle
Definition: validat.hxx:51
sal_uIntPtr sal_uLong
void PushParagraphSpan(const OUString &rSpan, const OUString &rStyleName)
Definition: xmlcelli.cxx:312
ScMyTables & GetTables()
Definition: xmlimprt.hxx:299
SvXMLImport & GetImport()
constexpr OUStringLiteral PERCENT(u"Percent")
XML_VALUE
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
const SfxItemSet & GetItemSet() const
ParaFormatsType maFormats
Definition: xmlcelli.hxx:74
SC_DLLPUBLIC void GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt32 &rFormat) const
Definition: document.cxx:3641
ScAddress aEnd
Definition: address.hxx:501
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
const SvXMLTokenMap & GetTableRowCellElemTokenMap()
Definition: xmlimprt.cxx:466
std::optional< OUString > maContentValidationName
office:string-value attribute
Definition: xmlcelli.hxx:67
const ScXMLEditAttributeMap & GetEditAttributeMap() const
Definition: xmlimprt.cxx:1839
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:104
ScMyStylesImportHelper * GetStylesImportHelper()
Definition: xmlimprt.hxx:354
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
const SCCOL MAXCOLCOUNT
Definition: address.hxx:64
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:84
void setEditCell(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6061
void SetListType(sal_Int16 nListType)
Definition: validat.hxx:118
css::sheet::ConditionOperator aOperator
Definition: xmlimprt.hxx:184
void SetDetectiveObj(const ScAddress &rPosition)
Definition: xmlcelli.cxx:957
bool SetNullDateOnUnitConverter()
Definition: xmlimprt.cxx:1312
void PushParagraphFieldDocTitle(const OUString &rStyleName)
Definition: xmlcelli.cxx:587
void DoMerge(const ScAddress &rScCellPos, const SCCOL nCols, const SCROW nRows)
Definition: xmlcelli.cxx:733
LINESTYLE_NONE
void AddColumn(bool bIsCovered)
Definition: xmlsubti.cxx:175
void SetText(const OUString &rStr)
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:873
void SetSrcString(const OUString &rNew)
Definition: conditio.cxx:460
void SetAttributes(std::optional< OUString > pStyleName, std::optional< OUString > pCurrency, const sal_Int16 nCellType)
void LockSolarMutex()
Definition: xmlimprt.cxx:1697
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
Additional class containing cell annotation data.
Definition: postit.hxx:160
XML_NUMBER_COLUMNS_REPEATED
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:1225
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:26
SfxItemSet maItemSet
Mode eMode
ScFormulaCell * mpFormula
Definition: cellvalue.hxx:111
SCTAB Tab() const
Definition: address.hxx:271
void SetRow(SCROW nRowP)
Definition: address.hxx:275
XML_NUMBER_COLUMNS_SPANNED
sal_Int32 nEndPos
FormulaError GetFormulaErrorConstant(const OUString &rStr) const
Definition: xmlimprt.cxx:1817
void SetNeedNumberFormat(bool bVal)
void SetCol(SCCOL nColP)
Definition: address.hxx:279
XML_FALSE
ScValidationMode
Definition: validat.hxx:39
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)
void InsertFileLink(sfx2::SvBaseLink &, SvBaseLinkObjectType nFileType, const OUString &rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
DocumentType eType
bool GetValidation(const OUString &sName, ScMyImportValidation &aValidation)
Definition: xmlimprt.cxx:773
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.
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:872
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:438
sal_Int32 nEndPara
std::optional< FormulaWithNamespace > maFormula
Definition: xmlcelli.hxx:65
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
Definition: editutil.cxx:559
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:22
constexpr TypedWhichId< SvxCharReliefItem > EE_CHAR_RELIEF(EE_CHAR_START+26)
XML_CURRENCY
void convertDateTime(OUStringBuffer &rBuffer, const double &fDateTime, bool const bAddTimeIf0AM=false)
std::pair< OUString, OUString > FormulaWithNamespace
Definition: xmlcelli.hxx:63
SC_DLLPUBLIC void ApplyPattern(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr &rAttr)
Definition: document.cxx:4763
std::unique_ptr< EditTextObject > CreateTextObject()
WEIGHT_NORMAL
css::sheet::ValidationType aValidationType
Definition: xmlimprt.hxx:183
XML_SUB_TABLE
XML_STRING_VALUE
void SetCell(const ScAddress &rAddress)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
#define LANGUAGE_DONTKNOW
std::unique_ptr< ScMyImpDetectiveObjVec > pDetectiveObjVec
Definition: xmlcelli.hxx:78
SC_DLLPUBLIC void ApplyPatternAreaTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScPatternAttr &rAttr)
Definition: document.cxx:4786
sal_uInt16 Get(sal_uInt16 nPrefix, const OUString &rLName) const
void PutTextCell(const ScAddress &rScCurrentPos, const SCCOL nCurrentCol, const ::std::optional< OUString > &pOUText)
Definition: xmlcelli.cxx:1040
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:415
ScXMLImport & rXMLImport
Definition: xmlcelli.hxx:83
formula::FormulaGrammar::Grammar GetStorageGrammar() const
Definition: document.hxx:2439
ScXMLImport & GetScImport()
static sal_Int16 GetCellType(const char *rStrValue, const sal_Int32 nStrLength)
Definition: xmlimprt.cxx:727
constexpr sal_uInt16 EE_CHAR_END(EE_CHAR_START+32)
ITALIC_NONE
OUStringBuffer maParagraph
Definition: xmlcelli.hxx:71
SC_DLLPUBLIC void DoMerge(SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool bDeleteCaptions=true)
Definition: documen3.cxx:2052
bool IsPartOfMatrix(const ScAddress &rScAddress) const
Definition: xmlsubti.cxx:280
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:687
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:1758
XML_CELL_RANGE_SOURCE
FormulaError
SCCOL Col() const
Definition: address.hxx:267
sal_Int32 GetParagraphCount() const
void AddNonFormulaCell(const ScAddress &rScCellPos)
Definition: xmlcelli.cxx:1314
std::optional< OUString > maStringValue
table:formula attribute
Definition: xmlcelli.hxx:66
OUString sBaseCellAddress
Definition: xmlimprt.hxx:181
void SetHybridEmptyDisplayedAsString()
For import only: set an empty cell result to be displayed as empty string.
XML_NUMBER_MATRIX_ROWS_SPANNED
formula::FormulaGrammar::Grammar eGrammar2
Definition: xmlimprt.hxx:186
bool GetMatrixOrigin(const ScDocument &rDoc, ScAddress &rPos) const
const ScAddress & GetCurrentCellPos() const
Definition: xmlsubti.hxx:81
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CTL(EE_CHAR_START+16)
TABLE
CellType meType
Definition: cellvalue.hxx:106
SC_DLLPUBLIC sal_uLong AddValidationEntry(const ScValidationData &rNew)
Definition: documen4.cxx:716
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:18
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
XML_NUMBER_MATRIX_COLUMNS_SPANNED
void ResetInput()
Definition: validat.cxx:150
OUString sErrorMessage
Definition: xmlimprt.hxx:176
void SetContentValidation(const ScRange &rScRange)
Definition: xmlcelli.cxx:782
void SetCellRangeSource(const ScAddress &rPosition)
Definition: xmlcelli.cxx:979
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
XML_BOOLEAN_VALUE
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
css::uno::Reference< css::drawing::XShapes > const & GetCurrentXShapes()
Definition: xmlsubti.cxx:231
CellType
Definition: global.hxx:282
#define SCWARN_IMPORT_ROW_OVERFLOW
Definition: scerrors.hxx:63
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:1715
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
void AddFormulaCell(const ScAddress &rScCellPos)
Definition: xmlcelli.cxx:1398
css::sheet::ValidationAlertStyle aAlertStyle
Definition: xmlimprt.hxx:182
XML_P
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:77
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
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlcelli.cxx:631
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:68
#define SCWARN_IMPORT_COLUMN_OVERFLOW
Definition: scerrors.hxx:64
void SetHybridDouble(double n)
For import only: set a double result.
XML_TRUE
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:1506
OUString sInputMessage
Definition: xmlimprt.hxx:174
formula::FormulaGrammar::Grammar eGrammar1
Definition: xmlimprt.hxx:185
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:1396
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1058
#define SAL_WARN(area, stream)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
XML_CONTENT_VALIDATION_NAME
constexpr sal_uInt16 EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
static void GetString(const ScRefCellValue &rCell, sal_uInt32 nFormat, OUString &rString, const Color **ppColor, SvNumberFormatter &rFormatter, const ScDocument &rDoc, bool bNullVals=true, bool bFormula=false, bool bUseStarFormat=false)
Definition: cellform.cxx:33
static ScPostIt * CreateNoteFromObjectData(ScDocument &rDoc, const ScAddress &rPos, std::unique_ptr< SfxItemSet > pItemSet, OutlinerParaObject *pOutlinerObj, const tools::Rectangle &rCaptionRect, bool bShown)
Creates a cell note based on the passed caption object data.
Definition: postit.cxx:1241
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
::std::vector< ScMyImpDetectiveObj > ScMyImpDetectiveObjVec
This context handles element inside .
void setNumericCell(const ScAddress &rPos, double fVal)
STRIKEOUT_NONE
XML_DATE_VALUE
void ProgressBarIncrement()
Definition: xmlimprt.cxx:1748
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
Definition: documen2.cxx:215
XML_TIME_VALUE
SvXMLStylesContext * GetAutoStyles()
const Entry * getEntryByAPIName(const OUString &rAPIName) const
void AddRow()
Definition: xmlsubti.cxx:164
aStr
std::unique_ptr< ScMyImpCellRangeSource > pCellRangeSource
Definition: xmlcelli.hxx:79
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:454
ScDocumentImport & GetDoc()
Definition: xmlimprt.cxx:722
void SetFormulaCell(ScFormulaCell *pFCell) const
Definition: xmlcelli.cxx:998
SC_DLLPUBLIC void GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab, CellType &rCellType) const
Definition: document.cxx:3747
bool IsPossibleErrorString() const
Definition: xmlcelli.cxx:1496
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:23
Use this guard when performing something from the API that might query values from external reference...
void Clear()
rtl::Reference< XMLShapeImportHelper > const & GetShapeImport()
ParaFormat(const ScEditEngineDefaulter &rEditEngine)
Definition: xmlcelli.cxx:103
void SetRangeOverflowType(ErrCode nType)
Definition: xmlimprt.cxx:1738
ScDocument & getDoc()
sal_Int32 nStartPos
XML_FORMULA