Update ooo320-m1
[ooovba.git] / sc / source / filter / xml / xmlcelli.cxx
blob605635f7bbc07c252491cef7118f2dfd4171e2ab
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlcelli.cxx,v $
10 * $Revision: 1.96.128.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 // INCLUDE ---------------------------------------------------------------
36 #include "xmlcelli.hxx"
37 #include "xmlimprt.hxx"
38 #include "xmltabi.hxx"
39 #include "xmlstyli.hxx"
40 #include "xmlannoi.hxx"
41 #include "global.hxx"
42 #include "document.hxx"
43 #include "cellsuno.hxx"
44 #include "docuno.hxx"
45 #include "unonames.hxx"
46 #include "postit.hxx"
47 #include "sheetdata.hxx"
49 #include "XMLTableShapeImportHelper.hxx"
50 #include "XMLTextPContext.hxx"
51 #include "XMLStylesImportHelper.hxx"
53 #include "arealink.hxx"
54 #include <svx/linkmgr.hxx>
55 #include "convuno.hxx"
56 #include "XMLConverter.hxx"
57 #include "scerrors.hxx"
58 #include "editutil.hxx"
59 #include "cell.hxx"
61 #include <xmloff/xmltkmap.hxx>
62 #include <xmloff/xmltoken.hxx>
63 #include <xmloff/nmspmap.hxx>
64 #include <xmloff/xmluconv.hxx>
65 #include <xmloff/families.hxx>
66 #include <xmloff/numehelp.hxx>
67 #include <xmloff/xmlnmspe.hxx>
68 #include <svtools/zforlist.hxx>
69 #include <svx/svdocapt.hxx>
70 #include <svx/outlobj.hxx>
71 #include <svx/editobj.hxx>
72 #include <svx/unoapi.hxx>
73 #include <svtools/languageoptions.hxx>
75 #include <com/sun/star/frame/XModel.hpp>
76 #include <com/sun/star/text/XText.hpp>
77 #include <com/sun/star/sheet/XSpreadsheets.hpp>
78 #include <com/sun/star/sheet/XSpreadsheet.hpp>
79 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
81 #include <com/sun/star/util/XMergeable.hpp>
82 #include <com/sun/star/sheet/XSheetCondition.hpp>
83 #include <com/sun/star/table/XCellRange.hpp>
84 #include <com/sun/star/table/CellAddress.hpp>
85 #include <com/sun/star/util/NumberFormat.hpp>
86 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
87 #include <com/sun/star/util/XNumberFormatTypes.hpp>
88 #include <com/sun/star/util/Date.hpp>
89 #include <com/sun/star/lang/Locale.hpp>
90 #include <com/sun/star/text/ControlCharacter.hpp>
92 #include <rtl/ustrbuf.hxx>
93 #include <tools/date.hxx>
94 #include <i18npool/lang.h>
95 #include <comphelper/extract.hxx>
97 #define SC_CURRENCYSYMBOL "CurrencySymbol"
99 using namespace com::sun::star;
100 using namespace xmloff::token;
102 //------------------------------------------------------------------
104 ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
105 USHORT nPrfx,
106 const ::rtl::OUString& rLName,
107 const ::com::sun::star::uno::Reference<
108 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
109 const sal_Bool bTempIsCovered,
110 const sal_Int32 nTempRepeatedRows ) :
111 SvXMLImportContext( rImport, nPrfx, rLName ),
112 pContentValidationName(NULL),
113 pDetectiveObjVec(NULL),
114 pCellRangeSource(NULL),
115 fValue(0.0),
116 nMergedRows(1),
117 nMergedCols(1),
118 nRepeatedRows(nTempRepeatedRows),
119 nCellsRepeated(1),
120 rXMLImport((ScXMLImport&)rImport),
121 eGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT),
122 nCellType(util::NumberFormat::TEXT),
123 bIsMerged(sal_False),
124 bIsMatrix(sal_False),
125 bHasSubTable(sal_False),
126 bIsCovered(bTempIsCovered),
127 bIsEmpty(sal_True),
128 bHasTextImport(sal_False),
129 bIsFirstTextImport(sal_False),
130 bSolarMutexLocked(sal_False),
131 bFormulaTextResult(sal_False)
133 rXMLImport.SetRemoveLastChar(sal_False);
134 rXMLImport.GetTables().AddColumn(bTempIsCovered);
135 const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
136 rtl::OUString aLocalName;
137 rtl::OUString* pStyleName = NULL;
138 rtl::OUString* pCurrencySymbol = NULL;
139 const SvXMLTokenMap& rTokenMap = rImport.GetTableRowCellAttrTokenMap();
140 for (sal_Int16 i = 0; i < nAttrCount; ++i)
142 sal_uInt16 nAttrPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(
143 xAttrList->getNameByIndex(i), &aLocalName);
145 const rtl::OUString& sValue = xAttrList->getValueByIndex(i);
146 sal_uInt16 nToken = rTokenMap.Get(nAttrPrefix, aLocalName);
147 switch (nToken)
149 case XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME:
150 pStyleName = new rtl::OUString(sValue);
151 break;
152 case XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME:
153 DBG_ASSERT(!pContentValidationName, "here should be only one Validation Name");
154 pContentValidationName = new rtl::OUString(sValue);
155 break;
156 case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS:
157 bIsMerged = sal_True;
158 nMergedRows = sValue.toInt32();
159 break;
160 case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS:
161 bIsMerged = sal_True;
162 nMergedCols = sValue.toInt32();
163 break;
164 case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_COLS:
165 bIsMatrix = sal_True;
166 nMatrixCols = sValue.toInt32();
167 break;
168 case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_ROWS:
169 bIsMatrix = sal_True;
170 nMatrixRows = sValue.toInt32();
171 break;
172 case XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED:
173 nCellsRepeated = std::max( sValue.toInt32(), (sal_Int32) 1 );
174 break;
175 case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE:
176 nCellType = GetScImport().GetCellType(sValue);
177 bIsEmpty = sal_False;
178 break;
179 case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE:
181 if (sValue.getLength())
183 rXMLImport.GetMM100UnitConverter().convertDouble(fValue, sValue);
184 bIsEmpty = sal_False;
187 break;
188 case XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE:
190 if (sValue.getLength() && rXMLImport.SetNullDateOnUnitConverter())
192 rXMLImport.GetMM100UnitConverter().convertDateTime(fValue, sValue);
193 bIsEmpty = sal_False;
196 break;
197 case XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE:
199 if (sValue.getLength())
201 rXMLImport.GetMM100UnitConverter().convertTime(fValue, sValue);
202 bIsEmpty = sal_False;
205 break;
206 case XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE:
208 if (sValue.getLength())
210 DBG_ASSERT(!pOUTextValue, "here should be only one string value");
211 pOUTextValue.reset(sValue);
212 bIsEmpty = sal_False;
215 break;
216 case XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE:
218 if (sValue.getLength())
220 if ( IsXMLToken(sValue, XML_TRUE) )
221 fValue = 1.0;
222 else if ( IsXMLToken(sValue, XML_FALSE) )
223 fValue = 0.0;
224 else
225 rXMLImport.GetMM100UnitConverter().convertDouble(fValue, sValue);
226 bIsEmpty = sal_False;
229 break;
230 case XML_TOK_TABLE_ROW_CELL_ATTR_FORMULA:
232 if (sValue.getLength())
234 DBG_ASSERT(!pOUFormula, "here should be only one formula");
235 rtl::OUString aFormula, aFormulaNmsp;
236 rXMLImport.ExtractFormulaNamespaceGrammar( aFormula, aFormulaNmsp, eGrammar, sValue );
237 pOUFormula.reset( FormulaWithNamespace( aFormula, aFormulaNmsp ) );
240 break;
241 case XML_TOK_TABLE_ROW_CELL_ATTR_CURRENCY:
242 pCurrencySymbol = new rtl::OUString(sValue);
243 break;
244 default:
248 if (pOUFormula)
250 if (nCellType == util::NumberFormat::TEXT)
251 bFormulaTextResult = sal_True;
252 nCellType = util::NumberFormat::UNDEFINED;
254 rXMLImport.GetStylesImportHelper()->SetAttributes(pStyleName, pCurrencySymbol, nCellType);
257 ScXMLTableRowCellContext::~ScXMLTableRowCellContext()
259 if (pContentValidationName)
260 delete pContentValidationName;
261 if (pDetectiveObjVec)
262 delete pDetectiveObjVec;
263 if (pCellRangeSource)
264 delete pCellRangeSource;
267 void ScXMLTableRowCellContext::LockSolarMutex()
269 if (!bSolarMutexLocked)
271 GetScImport().LockSolarMutex();
272 bSolarMutexLocked = sal_True;
276 void ScXMLTableRowCellContext::UnlockSolarMutex()
278 if (bSolarMutexLocked)
280 GetScImport().UnlockSolarMutex();
281 bSolarMutexLocked = sal_False;
285 void ScXMLTableRowCellContext::SetCursorOnTextImport(const rtl::OUString& rOUTempText)
287 com::sun::star::table::CellAddress aCellPos = rXMLImport.GetTables().GetRealCellPos();
288 if (CellExists(aCellPos))
290 uno::Reference<table::XCellRange> xCellRange(rXMLImport.GetTables().GetCurrentXCellRange());
291 if (xCellRange.is())
293 xBaseCell.set(xCellRange->getCellByPosition(aCellPos.Column, aCellPos.Row));
294 if (xBaseCell.is())
296 xLockable.set(xBaseCell, uno::UNO_QUERY);
297 if (xLockable.is())
298 xLockable->addActionLock();
299 uno::Reference<text::XText> xText(xBaseCell, uno::UNO_QUERY);
300 if (xText.is())
302 uno::Reference<text::XTextCursor> xTextCursor(xText->createTextCursor());
303 if (xTextCursor.is())
305 xTextCursor->setString(rOUTempText);
306 xTextCursor->gotoEnd(sal_False);
307 rXMLImport.GetTextImport()->SetCursor(xTextCursor);
313 else
315 DBG_ERRORFILE("this method should only be called for a existing cell");
319 SvXMLImportContext *ScXMLTableRowCellContext::CreateChildContext( USHORT nPrefix,
320 const ::rtl::OUString& rLName,
321 const ::com::sun::star::uno::Reference<
322 ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
324 SvXMLImportContext *pContext = 0;
326 const SvXMLTokenMap& rTokenMap = rXMLImport.GetTableRowCellElemTokenMap();
327 sal_Bool bTextP(sal_False);
328 switch( rTokenMap.Get( nPrefix, rLName ) )
330 case XML_TOK_TABLE_ROW_CELL_P:
332 bIsEmpty = sal_False;
333 bTextP = sal_True;
334 com::sun::star::table::CellAddress aCellPos = rXMLImport.GetTables().GetRealCellPos();
335 if (((nCellType == util::NumberFormat::TEXT) || bFormulaTextResult) &&
336 !rXMLImport.GetTables().IsPartOfMatrix(aCellPos.Column, aCellPos.Row))
338 if (!bHasTextImport)
340 bIsFirstTextImport = sal_True;
341 bHasTextImport = sal_True;
342 pContext = new ScXMLTextPContext(rXMLImport, nPrefix, rLName, xAttrList, this);
344 else
346 // com::sun::star::table::CellAddress aCellPos = rXMLImport.GetTables().GetRealCellPos();
347 if (CellExists(aCellPos))
349 if (bIsFirstTextImport && !rXMLImport.GetRemoveLastChar())
351 if (pOUTextContent)
353 SetCursorOnTextImport(*pOUTextContent);
354 pOUTextContent.reset();
356 else
357 SetCursorOnTextImport(rtl::OUString());
358 rXMLImport.SetRemoveLastChar(sal_True);
359 uno::Reference < text::XTextCursor > xTextCursor(rXMLImport.GetTextImport()->GetCursor());
360 if (xTextCursor.is())
362 uno::Reference < text::XText > xText (xTextCursor->getText());
363 uno::Reference < text::XTextRange > xTextRange (xTextCursor, uno::UNO_QUERY);
364 if (xText.is() && xTextRange.is())
365 xText->insertControlCharacter(xTextRange, text::ControlCharacter::PARAGRAPH_BREAK, sal_False);
368 pContext = rXMLImport.GetTextImport()->CreateTextChildContext(
369 rXMLImport, nPrefix, rLName, xAttrList);
370 bIsFirstTextImport = sal_False;
375 break;
376 case XML_TOK_TABLE_ROW_CELL_TABLE:
378 const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
379 rtl::OUString aLocalName;
380 for( sal_Int16 i=0; i < nAttrCount; i++ )
382 sal_uInt16 nAttrPrefix = rXMLImport.GetNamespaceMap().GetKeyByAttrName(
383 xAttrList->getNameByIndex( i ), &aLocalName );
384 if ( nAttrPrefix == XML_NAMESPACE_TABLE
385 && IsXMLToken(aLocalName, XML_IS_SUB_TABLE))
387 bHasSubTable = IsXMLToken(xAttrList->getValueByIndex( i ), XML_TRUE);
390 DBG_ASSERT(bHasSubTable, "it should be a subtable");
391 pContext = new ScXMLTableContext( rXMLImport , nPrefix,
392 rLName, xAttrList,
393 sal_True, nMergedCols);
394 nMergedCols = 1;
395 bIsMerged = sal_False;
397 break;
398 case XML_TOK_TABLE_ROW_CELL_ANNOTATION:
400 bIsEmpty = sal_False;
401 DBG_ASSERT( !mxAnnotationData.get(), "ScXMLTableRowCellContext::CreateChildContext - multiple annotations in one cell" );
402 mxAnnotationData.reset( new ScXMLAnnotationData );
403 pContext = new ScXMLAnnotationContext( rXMLImport, nPrefix, rLName,
404 xAttrList, *mxAnnotationData, this);
406 break;
407 case XML_TOK_TABLE_ROW_CELL_DETECTIVE:
409 bIsEmpty = sal_False;
410 if (!pDetectiveObjVec)
411 pDetectiveObjVec = new ScMyImpDetectiveObjVec();
412 pContext = new ScXMLDetectiveContext(
413 rXMLImport, nPrefix, rLName, pDetectiveObjVec );
415 break;
416 case XML_TOK_TABLE_ROW_CELL_CELL_RANGE_SOURCE:
418 bIsEmpty = sal_False;
419 if (!pCellRangeSource)
420 pCellRangeSource = new ScMyImpCellRangeSource();
421 pContext = new ScXMLCellRangeSourceContext(
422 rXMLImport, nPrefix, rLName, xAttrList, pCellRangeSource );
424 break;
427 if (!pContext && !bTextP)
429 com::sun::star::table::CellAddress aCellPos = rXMLImport.GetTables().GetRealCellPos();
430 uno::Reference<drawing::XShapes> xShapes (rXMLImport.GetTables().GetCurrentXShapes());
431 if (xShapes.is())
433 if (aCellPos.Column > MAXCOL)
434 aCellPos.Column = MAXCOL;
435 if (aCellPos.Row > MAXROW)
436 aCellPos.Row = MAXROW;
437 XMLTableShapeImportHelper* pTableShapeImport = (XMLTableShapeImportHelper*)rXMLImport.GetShapeImport().get();
438 pTableShapeImport->SetOnTable(sal_False);
439 pTableShapeImport->SetCell(aCellPos);
440 pContext = rXMLImport.GetShapeImport()->CreateGroupChildContext(
441 rXMLImport, nPrefix, rLName, xAttrList, xShapes);
442 if (pContext)
444 bIsEmpty = sal_False;
445 rXMLImport.ProgressBarIncrement(sal_False);
450 if( !pContext )
451 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
453 return pContext;
456 sal_Bool ScXMLTableRowCellContext::IsMerged (const uno::Reference <table::XCellRange>& xCellRange, const sal_Int32 nCol, const sal_Int32 nRow,
457 table::CellRangeAddress& aCellAddress) const
459 table::CellAddress aCell; // don't need to set the sheet, because every sheet can contain the same count of cells.
460 aCell.Column = nCol;
461 aCell.Row = nRow;
462 if (CellExists(aCell))
464 uno::Reference<sheet::XSheetCellRange> xMergeSheetCellRange (xCellRange->getCellRangeByPosition(nCol,nRow,nCol,nRow), uno::UNO_QUERY);
465 uno::Reference<sheet::XSpreadsheet> xTable (xMergeSheetCellRange->getSpreadsheet());
466 uno::Reference<sheet::XSheetCellCursor> xMergeSheetCursor (xTable->createCursorByRange(xMergeSheetCellRange));
467 if (xMergeSheetCursor.is())
469 xMergeSheetCursor->collapseToMergedArea();
470 uno::Reference<sheet::XCellRangeAddressable> xMergeCellAddress (xMergeSheetCursor, uno::UNO_QUERY);
471 if (xMergeCellAddress.is())
473 aCellAddress = xMergeCellAddress->getRangeAddress();
474 if (aCellAddress.StartColumn == nCol && aCellAddress.EndColumn == nCol &&
475 aCellAddress.StartRow == nRow && aCellAddress.EndRow == nRow)
476 return sal_False;
477 else
478 return sal_True;
482 return sal_False;
485 void ScXMLTableRowCellContext::DoMerge(const com::sun::star::table::CellAddress& aCellPos,
486 const sal_Int32 nCols, const sal_Int32 nRows)
488 if (CellExists(aCellPos))
490 uno::Reference<table::XCellRange> xCellRange(rXMLImport.GetTables().GetCurrentXCellRange());
491 if ( xCellRange.is() )
493 table::CellRangeAddress aCellAddress;
494 if (IsMerged(xCellRange, aCellPos.Column, aCellPos.Row, aCellAddress))
496 //unmerge
497 uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow,
498 aCellAddress.EndColumn, aCellAddress.EndRow), uno::UNO_QUERY);
499 if (xMergeable.is())
500 xMergeable->merge(sal_False);
503 //merge
504 uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow,
505 aCellAddress.EndColumn + nCols, aCellAddress.EndRow + nRows), uno::UNO_QUERY);
506 if (xMergeable.is())
507 xMergeable->merge(sal_True);
512 void ScXMLTableRowCellContext::SetContentValidation(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xPropSet)
514 if (pContentValidationName)
516 ScMyImportValidation aValidation;
517 aValidation.eGrammar1 = aValidation.eGrammar2 = GetScImport().GetDocument()->GetStorageGrammar();
518 if (rXMLImport.GetValidation(*pContentValidationName, aValidation))
520 uno::Reference<beans::XPropertySet> xPropertySet(xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_VALIXML))), uno::UNO_QUERY);
521 if (xPropertySet.is())
523 if (aValidation.sErrorMessage.getLength())
524 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_ERRMESS)), uno::makeAny(aValidation.sErrorMessage));
525 if (aValidation.sErrorTitle.getLength())
526 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_ERRTITLE)), uno::makeAny(aValidation.sErrorTitle));
527 if (aValidation.sImputMessage.getLength())
528 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_INPMESS)), uno::makeAny(aValidation.sImputMessage));
529 if (aValidation.sImputTitle.getLength())
530 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_INPTITLE)), uno::makeAny(aValidation.sImputTitle));
531 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SHOWERR)), uno::makeAny(aValidation.bShowErrorMessage));
532 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SHOWINP)), uno::makeAny(aValidation.bShowImputMessage));
533 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_TYPE)), uno::makeAny(aValidation.aValidationType));
534 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_IGNOREBL)), uno::makeAny(aValidation.bIgnoreBlanks));
535 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SHOWLIST)), uno::makeAny(aValidation.nShowList));
536 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_ERRALSTY)), uno::makeAny(aValidation.aAlertStyle));
537 uno::Reference<sheet::XSheetCondition> xCondition(xPropertySet, uno::UNO_QUERY);
538 if (xCondition.is())
540 xCondition->setFormula1(aValidation.sFormula1);
541 xCondition->setFormula2(aValidation.sFormula2);
542 xCondition->setOperator(aValidation.aOperator);
543 // #b4974740# source position must be set as string, because it may
544 // refer to a sheet that hasn't been loaded yet.
545 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SOURCESTR)), uno::makeAny(aValidation.sBaseCellAddress));
546 // Transport grammar and formula namespace
547 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_FORMULANMSP1)), uno::makeAny(aValidation.sFormulaNmsp1));
548 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_FORMULANMSP2)), uno::makeAny(aValidation.sFormulaNmsp2));
549 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_GRAMMAR1)), uno::makeAny(static_cast<sal_Int32>(aValidation.eGrammar1)));
550 xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_GRAMMAR2)), uno::makeAny(static_cast<sal_Int32>(aValidation.eGrammar2)));
553 xPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_VALIXML)), uno::makeAny(xPropertySet));
555 // For now, any sheet with validity is blocked from stream-copying.
556 // Later, the validation names could be stored along with the style names.
557 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetImport().GetModel())->GetSheetSaveData();
558 pSheetData->BlockSheet( GetScImport().GetTables().GetCurrentSheet() );
563 void ScXMLTableRowCellContext::SetCellProperties(const uno::Reference<table::XCellRange>& xCellRange,
564 const table::CellAddress& aCellAddress)
566 if (CellExists(aCellAddress) && pContentValidationName && pContentValidationName->getLength())
568 sal_Int32 nBottom = aCellAddress.Row + nRepeatedRows - 1;
569 sal_Int32 nRight = aCellAddress.Column + nCellsRepeated - 1;
570 if (nBottom > MAXROW)
571 nBottom = MAXROW;
572 if (nRight > MAXCOL)
573 nRight = MAXCOL;
574 uno::Reference <beans::XPropertySet> xProperties (xCellRange->getCellRangeByPosition(aCellAddress.Column, aCellAddress.Row,
575 nRight, nBottom), uno::UNO_QUERY);
576 if (xProperties.is())
577 SetContentValidation(xProperties);
581 void ScXMLTableRowCellContext::SetCellProperties(const uno::Reference<table::XCell>& xCell)
583 if (pContentValidationName && pContentValidationName->getLength())
585 uno::Reference <beans::XPropertySet> xProperties (xCell, uno::UNO_QUERY);
586 if (xProperties.is())
587 SetContentValidation(xProperties);
591 void ScXMLTableRowCellContext::SetAnnotation(const table::CellAddress& aCellAddress)
593 ScDocument* pDoc = rXMLImport.GetDocument();
594 if( !pDoc || !mxAnnotationData.get() )
595 return;
597 LockSolarMutex();
599 ScAddress aPos;
600 ScUnoConversion::FillScAddress( aPos, aCellAddress );
601 ScPostIt* pNote = 0;
603 uno::Reference< drawing::XShapes > xShapes = rXMLImport.GetTables().GetCurrentXShapes();
604 uno::Reference< container::XIndexAccess > xShapesIA( xShapes, uno::UNO_QUERY );
605 sal_Int32 nOldShapeCount = xShapesIA.is() ? xShapesIA->getCount() : 0;
607 DBG_ASSERT( !mxAnnotationData->mxShape.is() || mxAnnotationData->mxShapes.is(),
608 "ScXMLTableRowCellContext::SetAnnotation - shape without drawing page" );
609 if( mxAnnotationData->mxShape.is() && mxAnnotationData->mxShapes.is() )
611 DBG_ASSERT( mxAnnotationData->mxShapes.get() == xShapes.get(), "ScXMLTableRowCellContext::SetAnnotation - diffenet drawing pages" );
612 SdrObject* pObject = ::GetSdrObjectFromXShape( mxAnnotationData->mxShape );
613 DBG_ASSERT( pObject, "ScXMLTableRowCellContext::SetAnnotation - cannot get SdrObject from shape" );
615 /* Try to reuse the drawing object already created (but only if the
616 note is visible, and the object is a caption object). */
617 if( mxAnnotationData->mbShown && mxAnnotationData->mbUseShapePos )
619 if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
621 OSL_ENSURE( !pCaption->GetLogicRect().IsEmpty(), "ScXMLTableRowCellContext::SetAnnotation - invalid caption rectangle" );
622 // create the cell note with the caption object
623 pNote = ScNoteUtil::CreateNoteFromCaption( *pDoc, aPos, *pCaption, true );
624 // forget pointer to object (do not create note again below)
625 pObject = 0;
629 // drawing object has not been used to create a note -> use shape data
630 if( pObject )
632 // rescue settings from drawing object before the shape is removed
633 ::std::auto_ptr< SfxItemSet > xItemSet( new SfxItemSet( pObject->GetMergedItemSet() ) );
634 ::std::auto_ptr< OutlinerParaObject > xOutlinerObj;
635 if( OutlinerParaObject* pOutlinerObj = pObject->GetOutlinerParaObject() )
636 xOutlinerObj.reset( new OutlinerParaObject( *pOutlinerObj ) );
637 Rectangle aCaptionRect;
638 if( mxAnnotationData->mbUseShapePos )
639 aCaptionRect = pObject->GetLogicRect();
640 // remove the shape from the drawing page, this invalidates pObject
641 mxAnnotationData->mxShapes->remove( mxAnnotationData->mxShape );
642 pObject = 0;
643 // update current number of existing objects
644 if( xShapesIA.is() )
645 nOldShapeCount = xShapesIA->getCount();
647 // an outliner object is required (empty note captions not allowed)
648 if( xOutlinerObj.get() )
650 // create cell note with all data from drawing object
651 pNote = ScNoteUtil::CreateNoteFromObjectData( *pDoc, aPos,
652 xItemSet.release(), xOutlinerObj.release(),
653 aCaptionRect, mxAnnotationData->mbShown, false );
657 else if( mxAnnotationData->maSimpleText.getLength() > 0 )
659 // create note from simple text
660 pNote = ScNoteUtil::CreateNoteFromString( *pDoc, aPos,
661 mxAnnotationData->maSimpleText, mxAnnotationData->mbShown, false );
664 // set author and date
665 if( pNote )
667 double fDate;
668 rXMLImport.GetMM100UnitConverter().convertDateTime( fDate, mxAnnotationData->maCreateDate );
669 SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
670 sal_uInt32 nfIndex = pNumForm->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, LANGUAGE_SYSTEM );
671 String aDate;
672 Color* pColor = 0;
673 Color** ppColor = &pColor;
674 pNumForm->GetOutputString( fDate, nfIndex, aDate, ppColor );
675 pNote->SetDate( aDate );
676 pNote->SetAuthor( mxAnnotationData->maAuthor );
679 // register a shape that has been newly created in the ScNoteUtil functions
680 if( xShapesIA.is() && (nOldShapeCount < xShapesIA->getCount()) )
682 uno::Reference< drawing::XShape > xShape;
683 rXMLImport.GetShapeImport()->shapeWithZIndexAdded( xShape, xShapesIA->getCount() );
686 // store the style names for stream copying
687 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData();
688 pSheetData->HandleNoteStyles( mxAnnotationData->maStyleName, mxAnnotationData->maTextStyle, aPos );
690 std::vector<ScXMLAnnotationStyleEntry>::const_iterator aIter = mxAnnotationData->maContentStyles.begin();
691 std::vector<ScXMLAnnotationStyleEntry>::const_iterator aEnd = mxAnnotationData->maContentStyles.end();
692 while (aIter != aEnd)
694 pSheetData->AddNoteContentStyle( aIter->mnFamily, aIter->maName, aPos, aIter->maSelection );
695 ++aIter;
699 // core implementation
700 void ScXMLTableRowCellContext::SetDetectiveObj( const table::CellAddress& rPosition )
702 if( CellExists(rPosition) && pDetectiveObjVec && pDetectiveObjVec->size() )
704 LockSolarMutex();
705 ScDetectiveFunc aDetFunc( rXMLImport.GetDocument(), rPosition.Sheet );
706 uno::Reference<container::XIndexAccess> xShapesIndex (rXMLImport.GetTables().GetCurrentXShapes(), uno::UNO_QUERY); // make draw page
707 ScMyImpDetectiveObjVec::iterator aItr(pDetectiveObjVec->begin());
708 ScMyImpDetectiveObjVec::iterator aEndItr(pDetectiveObjVec->end());
709 while(aItr != aEndItr)
711 ScAddress aScAddress;
712 ScUnoConversion::FillScAddress( aScAddress, rPosition );
713 aDetFunc.InsertObject( aItr->eObjType, aScAddress, aItr->aSourceRange, aItr->bHasError );
714 if (xShapesIndex.is())
716 sal_Int32 nShapes = xShapesIndex->getCount();
717 uno::Reference < drawing::XShape > xShape;
718 rXMLImport.GetShapeImport()->shapeWithZIndexAdded(xShape, nShapes);
720 ++aItr;
725 // core implementation
726 void ScXMLTableRowCellContext::SetCellRangeSource( const table::CellAddress& rPosition )
728 if( CellExists(rPosition) && pCellRangeSource && pCellRangeSource->sSourceStr.getLength() &&
729 pCellRangeSource->sFilterName.getLength() && pCellRangeSource->sURL.getLength() )
731 ScDocument* pDoc = rXMLImport.GetDocument();
732 if (pDoc)
734 LockSolarMutex();
735 ScRange aDestRange( static_cast<SCCOL>(rPosition.Column), static_cast<SCROW>(rPosition.Row), rPosition.Sheet,
736 static_cast<SCCOL>(rPosition.Column + pCellRangeSource->nColumns - 1),
737 static_cast<SCROW>(rPosition.Row + pCellRangeSource->nRows - 1), rPosition.Sheet );
738 String sFilterName( pCellRangeSource->sFilterName );
739 String sSourceStr( pCellRangeSource->sSourceStr );
740 ScAreaLink* pLink = new ScAreaLink( pDoc->GetDocumentShell(), pCellRangeSource->sURL,
741 sFilterName, pCellRangeSource->sFilterOptions, sSourceStr, aDestRange, pCellRangeSource->nRefresh );
742 SvxLinkManager* pLinkManager = pDoc->GetLinkManager();
743 pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, pCellRangeSource->sURL, &sFilterName, &sSourceStr );
748 bool lcl_IsEmptyOrNote( ScDocument* pDoc, const table::CellAddress& rCurrentPos )
750 ScAddress aScAddress;
751 ScUnoConversion::FillScAddress( aScAddress, rCurrentPos );
752 ScBaseCell* pCell = pDoc->GetCell( aScAddress );
753 return ( !pCell || pCell->GetCellType() == CELLTYPE_NOTE );
756 void ScXMLTableRowCellContext::EndElement()
758 if (!bHasSubTable)
760 if (bHasTextImport && rXMLImport.GetRemoveLastChar())
762 if (rXMLImport.GetTextImport()->GetCursor().is())
764 //GetImport().GetTextImport()->GetCursor()->gotoEnd(sal_False);
765 if( GetImport().GetTextImport()->GetCursor()->goLeft( 1, sal_True ) )
767 GetImport().GetTextImport()->GetText()->insertString(
768 GetImport().GetTextImport()->GetCursorAsRange(), rtl::OUString(),
769 sal_True );
771 rXMLImport.GetTextImport()->ResetCursor();
774 table::CellAddress aCellPos = rXMLImport.GetTables().GetRealCellPos();
775 if (aCellPos.Column > 0 && nRepeatedRows > 1)
776 aCellPos.Row -= (nRepeatedRows - 1);
777 uno::Reference<table::XCellRange> xCellRange(rXMLImport.GetTables().GetCurrentXCellRange());
778 if (xCellRange.is())
780 if (bIsMerged)
781 DoMerge(aCellPos, nMergedCols - 1, nMergedRows - 1);
782 if ( !pOUFormula )
784 ::boost::optional< rtl::OUString > pOUText;
786 if(nCellType == util::NumberFormat::TEXT)
788 if (xLockable.is())
789 xLockable->removeActionLock();
791 // #i61702# The formatted text content of xBaseCell / xLockable is invalidated,
792 // so it can't be used after calling removeActionLock (getString always uses the document).
794 if (CellExists(aCellPos) && ((nCellsRepeated > 1) || (nRepeatedRows > 1)))
796 if (!xBaseCell.is())
800 xBaseCell.set(xCellRange->getCellByPosition(aCellPos.Column, aCellPos.Row));
802 catch (lang::IndexOutOfBoundsException&)
804 DBG_ERRORFILE("It seems here are to many columns or rows");
807 uno::Reference <text::XText> xTempText (xBaseCell, uno::UNO_QUERY);
808 if (xTempText.is())
810 pOUText.reset(xTempText->getString());
813 if ( (!pOUTextContent && !pOUText && !pOUTextValue)
814 && ( (pOUTextContent && !pOUTextContent->getLength()) || !pOUTextContent )
815 && ( (pOUText && !pOUText->getLength()) || !pOUText )
816 && ( (pOUTextValue && !pOUTextValue->getLength()) || !pOUTextValue ))
817 bIsEmpty = sal_True;
819 sal_Bool bWasEmpty = bIsEmpty;
820 // uno::Reference <table::XCell> xCell;
821 table::CellAddress aCurrentPos( aCellPos );
822 if ((pContentValidationName && pContentValidationName->getLength()) ||
823 mxAnnotationData.get() || pDetectiveObjVec || pCellRangeSource)
824 bIsEmpty = sal_False;
826 ScMyTables& rTables = rXMLImport.GetTables();
827 for (sal_Int32 i = 0; i < nCellsRepeated; ++i)
829 aCurrentPos.Column = aCellPos.Column + i;
830 if (i > 0)
831 rTables.AddColumn(sal_False);
832 if (!bIsEmpty)
834 for (sal_Int32 j = 0; j < nRepeatedRows; ++j)
836 aCurrentPos.Row = aCellPos.Row + j;
837 if ((aCurrentPos.Column == 0) && (j > 0))
839 rTables.AddRow();
840 rTables.AddColumn(sal_False);
842 if (CellExists(aCurrentPos))
844 // test - bypass the API
845 // if (xBaseCell.is() && (aCurrentPos == aCellPos))
846 // xCell.set(xBaseCell);
847 // else
848 // {
849 // try
850 // {
851 // xCell.set(xCellRange->getCellByPosition(aCurrentPos.Column, aCurrentPos.Row));
852 // }
853 // catch (lang::IndexOutOfBoundsException&)
854 // {
855 // DBG_ERRORFILE("It seems here are to many columns or rows");
856 // }
857 // }
859 // test - bypass the API
860 // if ((!(bIsCovered) || (xCell->getType() == table::CellContentType_EMPTY)))
861 if ((!(bIsCovered) || lcl_IsEmptyOrNote( rXMLImport.GetDocument(), aCurrentPos )))
863 switch (nCellType)
865 case util::NumberFormat::TEXT:
867 sal_Bool bDoIncrement = sal_True;
868 if (rTables.IsPartOfMatrix(aCurrentPos.Column, aCurrentPos.Row))
870 LockSolarMutex();
871 // test - bypass the API
872 // ScCellObj* pCellObj = (ScCellObj*)ScCellRangesBase::getImplementation(xCell);
873 // if (pCellObj)
874 // {
875 // if(pOUTextValue && pOUTextValue->getLength())
876 // pCellObj->SetFormulaResultString(*pOUTextValue);
877 // else if (pOUTextContent && pOUTextContent->getLength())
878 // pCellObj->SetFormulaResultString(*pOUTextContent);
879 // else if ( i > 0 && pOUText && pOUText->getLength() )
880 // {
881 // pCellObj->SetFormulaResultString(*pOUText);
882 // }
883 // else
884 // bDoIncrement = sal_False;
885 // }
886 // else
887 // bDoIncrement = sal_False;
888 ScAddress aScAddress;
889 ScUnoConversion::FillScAddress( aScAddress, aCurrentPos );
890 ScBaseCell* pCell = rXMLImport.GetDocument()->GetCell( aScAddress );
891 bDoIncrement = ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA );
892 if ( bDoIncrement )
894 ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
895 if (pOUTextValue && pOUTextValue->getLength())
896 pFCell->SetHybridString( *pOUTextValue );
897 else if (pOUTextContent && pOUTextContent->getLength())
898 pFCell->SetHybridString( *pOUTextContent );
899 else if ( i > 0 && pOUText && pOUText->getLength() )
900 pFCell->SetHybridString( *pOUText );
901 else
902 bDoIncrement = sal_False;
905 else
907 // test - bypass the API
908 // uno::Reference <text::XText> xText (xCell, uno::UNO_QUERY);
909 // if (xText.is())
910 // {
911 // if(pOUTextValue && pOUTextValue->getLength())
912 // xText->setString(*pOUTextValue);
913 // else if (pOUTextContent && pOUTextContent->getLength())
914 // xText->setString(*pOUTextContent);
915 // else if ( i > 0 && pOUText && pOUText->getLength() )
916 // {
917 // xText->setString(*pOUText);
918 // }
919 // else
920 // bDoIncrement = sal_False;
921 // }
922 LockSolarMutex();
923 ScBaseCell* pNewCell = NULL;
924 ScDocument* pDoc = rXMLImport.GetDocument();
925 if (pOUTextValue && pOUTextValue->getLength())
926 pNewCell = ScBaseCell::CreateTextCell( *pOUTextValue, pDoc );
927 else if (pOUTextContent && pOUTextContent->getLength())
928 pNewCell = ScBaseCell::CreateTextCell( *pOUTextContent, pDoc );
929 else if ( i > 0 && pOUText && pOUText->getLength() )
930 pNewCell = ScBaseCell::CreateTextCell( *pOUText, pDoc );
932 bDoIncrement = pNewCell != NULL;
933 if ( bDoIncrement )
935 ScAddress aScAddress;
936 ScUnoConversion::FillScAddress( aScAddress, aCurrentPos );
937 pDoc->PutCell( aScAddress, pNewCell );
940 // #i56027# This is about setting simple text, not edit cells,
941 // so ProgressBarIncrement must be called with bEditCell = FALSE.
942 // Formatted text that is put into the cell by the child context
943 // is handled below (bIsEmpty is TRUE then).
944 if (bDoIncrement || bHasTextImport)
945 rXMLImport.ProgressBarIncrement(sal_False);
947 break;
948 case util::NumberFormat::NUMBER:
949 case util::NumberFormat::PERCENT:
950 case util::NumberFormat::CURRENCY:
951 case util::NumberFormat::TIME:
952 case util::NumberFormat::DATETIME:
953 case util::NumberFormat::LOGICAL:
955 if (rTables.IsPartOfMatrix(aCurrentPos.Column, aCurrentPos.Row))
957 LockSolarMutex();
958 // test - bypass the API
959 // ScCellObj* pCellObj = (ScCellObj*)ScCellRangesBase::getImplementation(xCell);
960 // if (pCellObj)
961 // pCellObj->SetFormulaResultDouble(fValue);
962 ScAddress aScAddress;
963 ScUnoConversion::FillScAddress( aScAddress, aCurrentPos );
964 ScBaseCell* pCell = rXMLImport.GetDocument()->GetCell( aScAddress );
965 if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
966 static_cast<ScFormulaCell*>(pCell)->SetHybridDouble( fValue );
968 else
970 // test - bypass the API
971 // xCell->setValue(fValue);
972 LockSolarMutex();
974 // #i62435# Initialize the value cell's script type
975 // if the default style's number format is latin-only.
976 // If the cell uses a different format, the script type
977 // will be reset when the style is applied.
979 ScBaseCell* pNewCell = new ScValueCell(fValue);
980 if ( rXMLImport.IsLatinDefaultStyle() )
981 pNewCell->SetScriptType( SCRIPTTYPE_LATIN );
982 rXMLImport.GetDocument()->PutCell(
983 sal::static_int_cast<SCCOL>( aCurrentPos.Column ),
984 sal::static_int_cast<SCROW>( aCurrentPos.Row ),
985 sal::static_int_cast<SCTAB>( aCurrentPos.Sheet ),
986 pNewCell );
988 rXMLImport.ProgressBarIncrement(sal_False);
990 break;
991 default:
993 DBG_ERROR("no cell type given");
995 break;
999 SetAnnotation(aCurrentPos);
1000 SetDetectiveObj( aCurrentPos );
1001 SetCellRangeSource( aCurrentPos );
1003 else
1005 if (!bWasEmpty || mxAnnotationData.get())
1007 if (aCurrentPos.Row > MAXROW)
1008 rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_ROW_OVERFLOW);
1009 else
1010 rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_COLUMN_OVERFLOW);
1015 else
1017 // #i56027# If the child context put formatted text into the cell,
1018 // bIsEmpty is TRUE and ProgressBarIncrement has to be called
1019 // with bEditCell = TRUE.
1020 if (bHasTextImport)
1021 rXMLImport.ProgressBarIncrement(sal_True);
1022 if ((i == 0) && (aCellPos.Column == 0))
1023 for (sal_Int32 j = 1; j < nRepeatedRows; ++j)
1025 rTables.AddRow();
1026 rTables.AddColumn(sal_False);
1030 if (nCellsRepeated > 1 || nRepeatedRows > 1)
1032 SetCellProperties(xCellRange, aCellPos); // set now only the validation for the complete range with the given cell as start cell
1033 //SetType(xCellRange, aCellPos);
1034 SCCOL nStartCol(aCellPos.Column < MAXCOL ? static_cast<SCCOL>(aCellPos.Column) : MAXCOL);
1035 SCROW nStartRow(aCellPos.Row < MAXROW ? static_cast<SCROW>(aCellPos.Row) : MAXROW);
1036 SCCOL nEndCol(aCellPos.Column + nCellsRepeated - 1 < MAXCOL ? static_cast<SCCOL>(aCellPos.Column + nCellsRepeated - 1) : MAXCOL);
1037 SCROW nEndRow(aCellPos.Row + nRepeatedRows - 1 < MAXROW ? static_cast<SCROW>(aCellPos.Row + nRepeatedRows - 1) : MAXROW);
1038 ScRange aScRange( nStartCol, nStartRow, aCellPos.Sheet,
1039 nEndCol, nEndRow, aCellPos.Sheet );
1040 rXMLImport.GetStylesImportHelper()->AddRange(aScRange);
1042 else if (CellExists(aCellPos))
1044 rXMLImport.GetStylesImportHelper()->AddCell(aCellPos);
1046 // test - bypass the API
1047 // SetCellProperties(xCell); // set now only the validation
1048 SetCellProperties(xCellRange, aCellPos);
1050 //SetType(xTempCell);
1053 else // if ( !pOUFormula )
1055 if (CellExists(aCellPos))
1057 uno::Reference <table::XCell> xCell;
1060 xCell.set(xCellRange->getCellByPosition(aCellPos.Column , aCellPos.Row));
1062 catch (lang::IndexOutOfBoundsException&)
1064 DBG_ERRORFILE("It seems here are to many columns or rows");
1066 if (xCell.is())
1068 SetCellProperties(xCell); // set now only the validation
1069 DBG_ASSERT(((nCellsRepeated == 1) && (nRepeatedRows == 1)), "repeated cells with formula not possible now");
1070 rXMLImport.GetStylesImportHelper()->AddCell(aCellPos);
1071 if (!bIsMatrix)
1073 LockSolarMutex();
1074 ScCellObj* pCellObj =
1075 static_cast<ScCellObj*>(ScCellRangesBase::getImplementation(
1076 xCell));
1077 if (pCellObj)
1079 pCellObj->SetFormulaWithGrammar( pOUFormula->first, pOUFormula->second, eGrammar);
1080 if (bFormulaTextResult && pOUTextValue && pOUTextValue->getLength())
1081 pCellObj->SetFormulaResultString( *pOUTextValue);
1082 else if (fValue != 0.0)
1083 pCellObj->SetFormulaResultDouble( fValue);
1086 else
1088 if (nMatrixCols > 0 && nMatrixRows > 0)
1090 rXMLImport.GetTables().AddMatrixRange(
1091 aCellPos.Column, aCellPos.Row,
1092 aCellPos.Column + nMatrixCols - 1,
1093 aCellPos.Row + nMatrixRows - 1,
1094 pOUFormula->first, pOUFormula->second, eGrammar);
1097 SetAnnotation( aCellPos );
1098 SetDetectiveObj( aCellPos );
1099 SetCellRangeSource( aCellPos );
1100 rXMLImport.ProgressBarIncrement(sal_False);
1103 else
1105 if (aCellPos.Row > MAXROW)
1106 rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_ROW_OVERFLOW);
1107 else
1108 rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_COLUMN_OVERFLOW);
1111 } // if ( !pOUFormula )
1113 UnlockSolarMutex();
1115 bIsMerged = sal_False;
1116 bHasSubTable = sal_False;
1117 nMergedCols = 1;
1118 nMergedRows = 1;
1119 nCellsRepeated = 1;