[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 2 commits - sc/source
sc/source/filter/oox/formulabuffer.cxx | 13 +++-- sc/source/filter/xml/xmlcelli.cxx |6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) New commits: commit 7b1ab8f2cf8b07e713c8511984c55e30d70c12d0 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Fri Jan 4 20:06:07 2013 +0100 don't forget the dependency tree during OOXML import, fdo#58863 Change-Id: I8863faddd1bca0b55764d09c4ef9f959264b53ae diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 70efcaf..bd8598f 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -118,12 +118,13 @@ void FormulaBuffer::finalizeImport() void FormulaBuffer::applyCellFormula( ScDocument rDoc, const ApiTokenSequence rTokens, const ::com::sun::star::table::CellAddress rAddress ) { -ScTokenArray aTokenArray; -ScAddress aCellPos; -ScUnoConversion::FillScAddress( aCellPos, rAddress ); -ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens ); -ScBaseCell* pNewCell = new ScFormulaCell( rDoc, aCellPos, aTokenArray ); -rDoc.PutCell( aCellPos, pNewCell, sal_True ); +ScTokenArray aTokenArray; +ScAddress aCellPos; +ScUnoConversion::FillScAddress( aCellPos, rAddress ); +ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens ); +ScFormulaCell* pNewCell = new ScFormulaCell( rDoc, aCellPos, aTokenArray ); +pNewCell-StartListeningTo( rDoc ); +rDoc.PutCell( aCellPos, pNewCell, sal_True ); } void FormulaBuffer::applyCellFormulas( const std::vector TokenAddressItem rVector ) commit 4e0766f1707434aa34fcd71601d5a74c3865a9df Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Fri Jan 4 20:04:54 2013 +0100 don't forget the dependency tree during formula import Change-Id: I0a9137e4f72477c0cffde6056d8952aa08e13f35 diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index d58b9f5..5e745e9 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1025,16 +1025,16 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress rCellPos ) if ( aText[0] == '=' aText.getLength() 1 ) { // temporary formula string as string tokens -ScTokenArray* pCode = new ScTokenArray; +boost::scoped_ptrScTokenArray pCode(new ScTokenArray); pCode-AddStringXML( aText ); if( (eGrammar == formula::FormulaGrammar::GRAM_EXTERNAL) !aFormulaNmsp.isEmpty() ) pCode-AddStringXML( aFormulaNmsp ); pDoc-IncXMLImportedFormulaCount( aText.getLength() ); -pNewCell = new ScFormulaCell( pDoc, rCellPos, pCode, eGrammar, MM_NONE ); -delete pCode; +pNewCell = new ScFormulaCell( pDoc, rCellPos, pCode.get(), eGrammar, MM_NONE ); ScFormulaCell* pFCell = static_castScFormulaCell*(pNewCell); +pFCell-StartListeningTo(pDoc); SetFormulaCell(pFCell); } else if ( aText[0] == '\'' aText.getLength() 1 ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 2 commits - sc/source xmloff/source
sc/source/filter/xml/xmlsubti.cxx |2 ++ sc/source/filter/xml/xmlsubti.hxx |2 +- xmloff/source/style/xmlnumfi.cxx |4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) New commits: commit f373868e16a1d83ceda531e4965cb00eaa523b8a Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Thu Jan 3 02:18:25 2013 +0100 limit the number of imported digits, fdo#58539 This should fix the crash with gnome#627420. Change-Id: Ibfff498282dc1c6fe9124ced645392107ef8829f diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index 28a4ec6..1ffae17 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -916,6 +916,8 @@ static void lcl_EnquoteIfNecessary( rtl::OUStringBuffer rContent, const SvXMLNu // SvXMLNumFmtElementContext // +const sal_Int32 MAX_SECOND_DIGITS = 20; // fdo#58539 gnome#627420: limit number of digits during import + SvXMLNumFmtElementContext::SvXMLNumFmtElementContext( SvXMLImport rImport, sal_uInt16 nPrfx, const rtl::OUString rLName, SvXMLNumFormatContext rParentContext, sal_uInt16 nNewType, @@ -948,7 +950,7 @@ SvXMLNumFmtElementContext::SvXMLNumFmtElementContext( SvXMLImport rImport, { case XML_TOK_ELEM_ATTR_DECIMAL_PLACES: if (::sax::Converter::convertNumber( nAttrVal, sValue, 0 )) -aNumInfo.nDecimals = nAttrVal; +aNumInfo.nDecimals = std::minsal_Int32(nAttrVal, MAX_SECOND_DIGITS); break; case XML_TOK_ELEM_ATTR_MIN_INTEGER_DIGITS: if (::sax::Converter::convertNumber( nAttrVal, sValue, 0 )) commit 74de75156f1ac6de427b62f000c6dcd248f914f6 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Thu Jan 3 01:41:45 2013 +0100 don't overflow column number during import, fdo#58539 This should fix the crash with kde#245919 Change-Id: I7c3af01e27233d2f94d5585247c59e7d5b6ea8ca diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx index 2dddb90..1950e3c 100644 --- a/sc/source/filter/xml/xmlsubti.cxx +++ b/sc/source/filter/xml/xmlsubti.cxx @@ -220,6 +220,8 @@ void ScMyTables::AddColStyle(const sal_Int32 nRepeat, const rtl::OUString rCell { rImport.GetStylesImportHelper()-AddColumnStyle(rCellStyleName, nCurrentColCount, nRepeat); nCurrentColCount += nRepeat; +SAL_WARN_IF(nCurrentColCount MAXCOL, sc, more columns than fit into SCCOL); +nCurrentColCount = std::minsal_Int32( nCurrentColCount, MAXCOL ); } uno::Reference drawing::XDrawPage ScMyTables::GetCurrentXDrawPage() diff --git a/sc/source/filter/xml/xmlsubti.hxx b/sc/source/filter/xml/xmlsubti.hxx index 2cdea77..b770771 100644 --- a/sc/source/filter/xml/xmlsubti.hxx +++ b/sc/source/filter/xml/xmlsubti.hxx @@ -87,7 +87,7 @@ public: ScXMLTabProtectionData GetCurrentProtectionData() { return maProtectionData; } rtl::OUString GetCurrentSheetName() const { return sCurrentSheetName; } SCTAB GetCurrentSheet() const { return (maCurrentCellPos.Tab() = 0) ? maCurrentCellPos.Tab() : 0; } -SCCOL GetCurrentColCount() const { return nCurrentColCount; } +SCCOL GetCurrentColCount() const { return std::minsal_Int32(nCurrentColCount, MAXCOL); } SCROW GetCurrentRow() const { return (maCurrentCellPos.Row() = 0) ? maCurrentCellPos.Row() : 0; } ::com::sun::star::uno::Reference ::com::sun::star::sheet::XSpreadsheet GetCurrentXSheet() const { return xCurrentSheet; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 2 commits - sc/source
sc/source/core/data/documen4.cxx | 32 ++-- sc/source/filter/xml/xmlcelli.cxx |4 ++-- 2 files changed, 12 insertions(+), 24 deletions(-) New commits: commit dfdbf14006d4baf822f399821dfb9d5412f8ab9e Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Thu Jan 3 17:46:18 2013 +0100 make sure the column index is valid, fdo#58539 This is the first part of the fix for gnome#627150 Change-Id: I02cd8c553dd6b9a026c0ea38d77c6831fef6498e diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 7e064ae..b3bb256 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -119,6 +119,8 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, { PutInOrder(nCol1, nCol2); PutInOrder(nRow1, nRow2); +nCol2 = std::minSCCOL(nCol2, MAXCOL); +nRow2 = std::minSCROW(nRow2, MAXROW); if (!rMark.GetSelectCount()) { SAL_WARN(sc, ScDocument::InsertMatrixFormula Keine Tabelle markiert); diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index e27267d..41bd60c 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1063,8 +1063,8 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress rCellPos ) //value/text of each matrix cell later rXMLImport.GetTables().AddMatrixRange( rCellPos.Col(), rCellPos.Row(), -rCellPos.Col() + nMatrixCols - 1, -rCellPos.Row() + nMatrixRows - 1, +std::minSCCOL(rCellPos.Col() + nMatrixCols - 1, MAXCOL), +std::minSCROW(rCellPos.Row() + nMatrixRows - 1, MAXROW), pOUFormula-first, pOUFormula-second, eGrammar); //set the value/text of the first matrix position (top-left). commit 99f3e0807d911f1190664692a04db9cded8260c9 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Thu Jan 3 15:16:57 2013 +0100 simplify this code a little bit and restore some of the old optimizations Change-Id: I1b42ed135bd3f8dfb663740a1bd2dbfa1216a388 diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index cc3b181..7e064ae 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -119,29 +119,14 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, { PutInOrder(nCol1, nCol2); PutInOrder(nRow1, nRow2); -SCTAB i, nTab1; -SCCOL j; -SCROW k; -i = 0; -bool bStop = false; -SCTAB nMax = static_castSCTAB(maTabs.size()); -ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end(); -for (; itr != itrEnd *itr nMax; ++itr) +if (!rMark.GetSelectCount()) { -if (maTabs[i]) -{ -i = *itr; -bStop = true; -break; -} -} -nTab1 = i; -if (!bStop) -{ -OSL_FAIL(ScDocument::InsertMatrixFormula Keine Tabelle markiert); +SAL_WARN(sc, ScDocument::InsertMatrixFormula Keine Tabelle markiert); return; } +SCTAB nTab1 = *rMark.begin(); + ScFormulaCell* pCell; ScAddress aPos( nCol1, nRow1, nTab1 ); if (pArr) @@ -149,7 +134,8 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, else pCell = new ScFormulaCell( this, aPos, rFormula, eGram, MM_FORMULA ); pCell-SetMatColsRows( nCol2 - nCol1 + 1, nRow2 - nRow1 + 1, bDirtyFlag ); -itr = rMark.begin(); +ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end(); +SCTAB nMax = static_castSCTAB(maTabs.size()); for (; itr != itrEnd *itr nMax; ++itr) { if (maTabs[*itr]) @@ -186,9 +172,9 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, aRefData.nRelTab = *itr - nTab1; t-GetSingleRef() = aRefData; } -for (j = nCol1; j = nCol2; j++) +for (SCCOL j = nCol1; j = nCol2; j++) { -for (k = nRow1; k = nRow2; k++) +for (SCROW k = nRow1; k = nRow2; k++) { if (j != nCol1 || k != nRow1) // nicht in der ersten Zelle { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 2 commits - sc/source
sc/source/filter/excel/xichart.cxx |2 +- sc/source/filter/oox/defnamesbuffer.cxx |1 + 2 files changed, 2 insertions(+), 1 deletion(-) New commits: commit f204cd9b52ec7af3e0d20f5c88f09737b38b9e7d Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Jan 3 00:27:08 2013 -0500 fdo#58539: Check for mxValueLink being NULL before dereferencing. Or else Calc would crash while loading the xls document from gnome519788. As an aside, this xls document appears to be corrupt. Trying to open it in Excel (XP and 2007) causes Excel to offer to repair it, while fails in both versions. Excel XP is somehow able to open it with some content preserved. No such luck with Excel 2007. Change-Id: I04616a4c926862461a2efdd99ccabe36122d6825 diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 1aa9d45..8310deb 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -2057,7 +2057,7 @@ Reference XDataSeries XclImpChSeries::CreateDataSeries() const aSeriesProp.SetBoolProperty( EXC_CHPROP_VARYCOLORSBY, rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE ); #endif // #i91271# always set area formatting for every point in pie/doughnut charts -if( mxSeriesFmt ((bVarPointFmt mxSeriesFmt-IsAutoArea()) || (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE)) ) +if (mxSeriesFmt mxValueLink ((bVarPointFmt mxSeriesFmt-IsAutoArea()) || (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_PIE))) { for( sal_uInt16 nPointIdx = 0, nPointCount = mxValueLink-GetCellCount(); nPointIdx nPointCount; ++nPointIdx ) { commit eee87edf551f7a9f8c4da4267e5710edafd1725d Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Wed Jan 2 23:56:43 2013 -0500 fdo#58539: Properly initialize a member pointer value. Or else it would crash when loading the doc from fdo#55174. Change-Id: I21eb77f97dcab467c185dacaf9f00753bb4fc18c diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx index d735ac4..488b7e3 100644 --- a/sc/source/filter/oox/defnamesbuffer.cxx +++ b/sc/source/filter/oox/defnamesbuffer.cxx @@ -285,6 +285,7 @@ ApiTokenSequence DefinedNameBase::importBiffFormula( sal_Int16 nBaseSheet, BiffI DefinedName::DefinedName( const WorkbookHelper rHelper ) : DefinedNameBase( rHelper ), +mpScRangeData(NULL), mnTokenIndex( -1 ), mcBuiltinId( BIFF_DEFNAME_UNKNOWN ), mnFmlaSize( 0 ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 2 commits - sc/source
sc/source/core/data/conditio.cxx |4 ++-- sc/source/ui/view/cellsh1.cxx|1 + 2 files changed, 3 insertions(+), 2 deletions(-) New commits: commit 3ea8026aefc358483292b459aaaead830e1f667d Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Mon Dec 31 04:27:44 2012 +0100 handle strings correctly in ScCondFormatEntry::GetExpression, fdo#58781 Change-Id: I418837d4363c14779a4b2a7ce78c8b9e8df7f0d1 diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index b0e99cb..843eda5 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1289,9 +1289,9 @@ rtl::OUString ScConditionEntry::GetExpression( const ScAddress rCursor, sal_uIn } else if (bIsStr1) { -aRet = ; +aRet = \; aRet += aStrVal1; -aRet += ; +aRet += \; } else mpDoc-GetFormatTable()-GetInputLineString(nVal1, nNumFmt, aRet); commit 2eebc768c4d48f384f14142516df7d8b3a751097 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Mon Dec 31 04:25:14 2012 +0100 don't add a new cond format if we just want to edit one, related fdo#58781 Change-Id: I2f48daa9b317c59515366206f9f17c7d219db5d0 diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 91054f1..68be16dd 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1827,6 +1827,7 @@ void ScCellShell::ExecuteEdit( SfxRequest rReq ) const ScConditionalFormat* pCondFormat = pList-GetFormat(rCondFormats[0]); assert(pCondFormat); const ScRangeList rCondFormatRange = pCondFormat-GetRange(); +nKey = pCondFormat-GetKey(); pCondFormatDlg.reset( new ScCondFormatDlg( pTabViewShell-GetDialogParent(), pDoc, pCondFormat, rCondFormatRange, aPos, condformat::dialog::NONE ) ); } else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 2 commits - sc/source
sc/source/core/data/conditio.cxx | 34 ++--- sc/source/ui/condformat/condformatdlgentry.cxx | 10 +-- 2 files changed, 32 insertions(+), 12 deletions(-) New commits: commit 9604cbdb015ec4724f0c7eb1120fc02d5b65d935 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Dec 18 23:05:29 2012 +0100 some small fixes for UI around date cond formats diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 3fc1612..b516670 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -1170,6 +1170,9 @@ ScDateFrmtEntry::ScDateFrmtEntry( Window* pParent, ScDocument* pDoc, const ScCon { sal_Int32 nPos = static_castsal_Int32(pFormat-GetDateType()); maLbDateEntry.SelectEntryPos(nPos); + +rtl::OUString aStyleName = pFormat-GetStyleName(); +maLbStyle.SelectEntry(aStyleName); } } @@ -1180,6 +1183,7 @@ void ScDateFrmtEntry::Init() FillStyleListBox( mpDoc, maLbStyle ); maLbStyle.SetSelectHdl( LINK( this, ScDateFrmtEntry, StyleSelectHdl ) ); +maLbStyle.SelectEntryPos(1); } void ScDateFrmtEntry::SetActive() @@ -1193,9 +1197,9 @@ void ScDateFrmtEntry::SetActive() void ScDateFrmtEntry::SetInactive() { -maLbDateEntry.Show(); -maFtStyle.Show(); -maWdPreview.Show(); +maLbDateEntry.Hide(); +maFtStyle.Hide(); +maWdPreview.Hide(); Deselect(); } commit edccbb232a9190f33d6a55e7833608f99a6566fe Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Dec 18 22:59:35 2012 +0100 handle last week/next week betweek different years, fdo#58340 diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 935ff48..f72fa73 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1684,24 +1684,40 @@ bool ScCondDateFormatEntry::IsValid( const ScAddress rPos ) const return true; break; case condformat::LASTWEEK: -if( rActDate.GetYear() == aCellDate.GetYear() ) +if( rActDate.GetDayOfWeek() != SUNDAY ) { -if( rActDate.GetWeekOfYear( SUNDAY ) == aCellDate.GetWeekOfYear( SUNDAY ) + 1 ) -return true; +Date aBegin(rActDate - 8 - static_castlong(rActDate.GetDayOfWeek())); +Date aEnd(rActDate - 2 -static_castlong(rActDate.GetDayOfWeek())); +return aCellDate.IsBetween( aBegin, aEnd ); +} +else +{ +Date aBegin(rActDate - 8); +Date aEnd(rActDate - 1); +return aCellDate.IsBetween( aBegin, aEnd ); } break; case condformat::THISWEEK: -if( rActDate.GetYear() == aCellDate.GetYear() ) +if( rActDate.GetDayOfWeek() != SUNDAY ) { -if( rActDate.GetWeekOfYear( SUNDAY ) == aCellDate.GetWeekOfYear( SUNDAY ) ) -return true; +Date aBegin(rActDate - 1 - static_castlong(rActDate.GetDayOfWeek())); +Date aEnd(rActDate + 5 - static_castlong(rActDate.GetDayOfWeek())); +return aCellDate.IsBetween( aBegin, aEnd ); +} +else +{ +Date aEnd( rActDate + 6); +return aCellDate.IsBetween( rActDate, aEnd ); } break; case condformat::NEXTWEEK: -if( rActDate.GetYear() == aCellDate.GetYear() ) +if( rActDate.GetDayOfWeek() != SUNDAY ) { -if( rActDate.GetWeekOfYear( SUNDAY ) == aCellDate.GetWeekOfYear( SUNDAY ) - 1 ) -return true; +return aCellDate.IsBetween( rActDate + 6 - static_castlong(rActDate.GetDayOfWeek()), rActDate + 12 - static_castlong(rActDate.GetDayOfWeek()) ); +} +else +{ +return aCellDate.IsBetween( rActDate + 7, rActDate + 13 ); } break; case condformat::LASTMONTH: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits