[Libreoffice-commits] .: 5 commits - sc/source
sc/source/core/data/cell.cxx|5 - sc/source/filter/oox/formulabuffer.cxx | 15 --- sc/source/filter/oox/workbookhelper.cxx |6 +++--- sc/source/filter/xml/xmlcelli.cxx |6 +++--- 4 files changed, 14 insertions(+), 18 deletions(-) New commits: commit d7524b9e8bff832b305ca9ec735664607c50224f 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 720f2af..b04c9d2 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -122,7 +122,8 @@ void FormulaBuffer::applyCellFormula( ScDocument rDoc, const ApiTokenSequence ScAddress aCellPos; ScUnoConversion::FillScAddress( aCellPos, rAddress ); ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens ); -ScBaseCell* pNewCell = new ScFormulaCell( rDoc, aCellPos, aTokenArray ); +ScFormulaCell* pNewCell = new ScFormulaCell( rDoc, aCellPos, aTokenArray ); +pNewCell-StartListeningTo( rDoc ); rDoc.PutCell( aCellPos, pNewCell, sal_True ); } commit 63b5af3d1f355a5f9649302058b32124ab262a20 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 58919b0..2369dce 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 ) commit 86024f7ff841e016c4b4616802eaadc744a5b8bf Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Fri Jan 4 19:46:43 2013 +0100 remove unnecessary german comment Change-Id: I954015fb76089ae7d83344e8d99f6bc04587016f diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx index bbf8976..3718976 100644 --- a/sc/source/core/data/cell.cxx +++ b/sc/source/core/data/cell.cxx @@ -1826,11 +1826,6 @@ void ScFormulaCell::SetDirty( bool bDirtyFlag ) SetDirtyVar(); else { -// Mehrfach-FormulaTracking in Load und in CompileAll -// nach CopyScenario und CopyBlockFromClip vermeiden. -// Wenn unbedingtes FormulaTracking noetig, vor SetDirty bDirty=false -// setzen, z.B. in CompileTokenArray - // Multiple Formulas avoid tracking in Load and Copy compileAll // by Scenario and Copy Block From Clip. // If unconditional required Formula tracking is set before SetDirty commit 9358e8f4622dd287daf9aa9a9f2bb6f7468122f8 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Fri Jan 4 18:38:10 2013 +0100 correct indentation Change-Id: I9b57ac13a8d508c260666535ee60783dee889508 diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 70efcaf..720f2af 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -118,12 +118,12 @@ 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,
[Libreoffice-commits] .: 5 commits - sc/source
sc/source/filter/xml/xmlcelli.cxx | 21 + sc/source/filter/xml/xmlcoli.cxx |3 ++- sc/source/filter/xml/xmlrowi.cxx |8 sc/source/filter/xml/xmlrowi.hxx |2 ++ 4 files changed, 29 insertions(+), 5 deletions(-) New commits: commit cf019c9a7baceec3b4dc849d7cba8923c6d2a425 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Fri Jan 4 03:28:32 2013 +0100 OSL_ENSURE - SAL_WARN_IF in xmlcelli.cxx Change-Id: Ia60e07dca17cbc728385c411f67bd3d9041b15ee diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index fac1191..58919b0 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1064,7 +1064,7 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress rCellPos ) if( cellExists(rCellPos) ) { SetContentValidation( rCellPos ); -OSL_ENSURE(((nColsRepeated == 1) (nRepeatedRows == 1)), repeated cells with formula not possible now); +SAL_WARN_IF((nColsRepeated != 1) || (nRepeatedRows != 1), sc, repeated cells with formula not possible now); rXMLImport.GetStylesImportHelper()-AddCell(rCellPos); //add matrix commit 94f7417b038fad6f2a92d1c7c5f8f00c3e64711b Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Fri Jan 4 03:27:01 2013 +0100 don't overflow SCCOL during repeated cell import, fdo#58539 This is the fix for the third and last crash with gnome#627150 Change-Id: Iaf8611500fdb485017814b35789332c6c89530c0 diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index f3eca23..fac1191 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -167,7 +167,8 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport rImport, nMatrixRows = static_castSCROW(sValue.toInt32()); break; case XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED: -nColsRepeated = static_castSCCOL(std::max( sValue.toInt32(), static_castsal_Int32(1) )); +nColsRepeated = static_castSCCOL(std::minsal_Int32( MAXCOLCOUNT, +std::max( sValue.toInt32(), static_castsal_Int32(1) ) )); break; case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE: nCellType = GetScImport().GetCellType(sValue); commit 9bcfb6f06bf5a4708b8858469b4118af4222db5a Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Fri Jan 4 03:17:13 2013 +0100 add some more safety checks for row and column import from ODS Change-Id: Ic714c65cfe93198c462ba55752223f4e60e5aad9 diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 5a5d73f..f3eca23 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -833,6 +833,12 @@ void ScXMLTableRowCellContext::AddTextAndValueCells( const ScAddress rCellPos, for (SCCOL i = 0; i nColsRepeated; ++i) { rCurrentPos.SetCol( rCellPos.Col() + i ); + +// it makes no sense to import data after the last supported column +// fdo#58539 gnome#627150 +if(rCurrentPos.Col() MAXCOL) +break; + if (i 0) rTables.AddColumn(false); if (!bIsEmpty) @@ -840,6 +846,12 @@ void ScXMLTableRowCellContext::AddTextAndValueCells( const ScAddress rCellPos, for (SCROW j = 0; j nRepeatedRows; ++j) { rCurrentPos.SetRow( rCellPos.Row() + j ); + +// it makes no sense to import data after last supported row +// fdo#58539 gnome#627150 +if(rCurrentPos.Row() MAXROW) +break; + if( (rCurrentPos.Col() == 0) (j 0) ) { rTables.AddRow(); diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx index 688300e..ed89294 100644 --- a/sc/source/filter/xml/xmlcoli.cxx +++ b/sc/source/filter/xml/xmlcoli.cxx @@ -66,7 +66,8 @@ ScXMLTableColContext::ScXMLTableColContext( ScXMLImport rImport, { case XML_TOK_TABLE_COL_ATTR_REPEATED: { -nColCount = sValue.toInt32(); +nColCount = std::maxsal_Int32(sValue.toInt32(), 1); +nColCount = std::minsal_Int32(nColCount, MAXCOLCOUNT); } break; case XML_TOK_TABLE_COL_ATTR_STYLE_NAME: diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx index 67d1f23..a4434e1 100644 --- a/sc/source/filter/xml/xmlrowi.cxx +++ b/sc/source/filter/xml/xmlrowi.cxx @@ -83,6 +83,7 @@ ScXMLTableRowContext::ScXMLTableRowContext( ScXMLImport rImport, case XML_TOK_TABLE_ROW_ATTR_REPEATED: { nRepeatedRows = std::max( sValue.toInt32(), (sal_Int32) 1 ); +nRepeatedRows = std::min(
[Libreoffice-commits] .: 5 commits - sc/source
sc/source/filter/excel/xecontent.cxx | 65 ++--- sc/source/filter/excel/xestream.cxx|2 - sc/source/filter/excel/xestyle.cxx |2 - sc/source/filter/inc/xecontent.hxx |2 - sc/source/filter/xml/xmlcondformat.cxx | 32 sc/source/filter/xml/xmlexprt.cxx | 20 ++ 6 files changed, 107 insertions(+), 16 deletions(-) New commits: commit c2e91c7d8cb027f3f8f06130e3d6552a0c6750ab Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Mon Nov 5 01:24:45 2012 +0100 fix several bugs around cond format export to ooxml Change-Id: I4d9c8ea0cc778f5620136548324054b625938887 diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index ffca41e..557538e 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -824,7 +824,7 @@ const char* GetOperatorString(ScConditionMode eMode, bool bFrmla2) break; case SC_COND_NONE: default: -pRet = ; +pRet = equal; break; } return pRet; @@ -852,6 +852,14 @@ const char* GetTypeString(ScConditionMode eMode) return containsErrors; case SC_COND_NOERROR: return notContainsErrors; +case SC_COND_BEGINS_WITH: +return beginsWith; +case SC_COND_ENDS_WITH: +return endsWith; +case SC_COND_CONTAINS_TEXT: +return containsText; +case SC_COND_NOT_CONTAINS_TEXT: +return notContainsText; default: return cellIs; } @@ -873,6 +881,22 @@ bool IsTopBottomRule(ScConditionMode eMode) return false; } +bool IsTextRule(ScConditionMode eMode) +{ +switch(eMode) +{ +case SC_COND_BEGINS_WITH: +case SC_COND_ENDS_WITH: +case SC_COND_CONTAINS_TEXT: +case SC_COND_NOT_CONTAINS_TEXT: +return true; +default: +break; +} + +return false; +} + } void XclExpCFImpl::SaveXml( XclExpXmlStream rStrm ) @@ -884,13 +908,23 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream rStrm ) || eOperation == SC_COND_BOTTOM_PERCENT; sal_Int32 nPercent = eOperation == SC_COND_TOP_PERCENT || eOperation == SC_COND_BOTTOM_PERCENT; -rtl::OString aRank; +rtl::OString aRank(0); if(IsTopBottomRule(eOperation)) { // position and formula grammar are not important // we only store a number there aRank = XclXmlUtils::ToOString(mrFormatEntry.GetExpression(ScAddress(0,0,0), 0)); } +rtl::OString aText; +if(IsTextRule(eOperation)) +{ +// we need to write the text without quotes +// we have to actually get the string from +// the token array for that +ScTokenArray* pTokenArray = mrFormatEntry.CreateTokenArry(0); +if(pTokenArray-GetLen()) +aText = XclXmlUtils::ToOString(pTokenArray-First()-GetString()); +} sax_fastparser::FSHelperPtr rWorksheet = rStrm.GetCurrentStream(); rWorksheet-startElement( XML_cfRule, @@ -901,16 +935,20 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream rStrm ) XML_bottom, OString::valueOf( nBottom ).getStr(), XML_percent, OString::valueOf( nPercent ).getStr(), XML_rank, aRank.getStr(), +XML_text, aText.getStr(), XML_dxfId, OString::valueOf( GetDxfs().GetDxfId( mrFormatEntry.GetStyle() ) ).getStr(), FSEND ); -rWorksheet-startElement( XML_formula, FSEND ); -rWorksheet-write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(), mrFormatEntry.CreateTokenArry( 0 ) )); -rWorksheet-endElement( XML_formula ); -if (bFmla2) +if(!IsTextRule(eOperation) !IsTopBottomRule(eOperation)) { rWorksheet-startElement( XML_formula, FSEND ); -rWorksheet-write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(), mrFormatEntry.CreateTokenArry( 1 ) )); +rWorksheet-write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(), mrFormatEntry.CreateTokenArry( 0 ) )); rWorksheet-endElement( XML_formula ); +if (bFmla2) +{ +rWorksheet-startElement( XML_formula, FSEND ); +rWorksheet-write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(), mrFormatEntry.CreateTokenArry( 1 ) )); +rWorksheet-endElement( XML_formula ); +} } // OOXTODO: XML_extLst rWorksheet-endElement( XML_cfRule ); @@ -1025,7 +1063,7 @@ void XclExpColScaleCol::SaveXml( XclExpXmlStream rStrm ) // -XclExpCondfmt::XclExpCondfmt( const XclExpRoot rRoot, const ScConditionalFormat rCondFormat, XclExtLstRef xExtLst ) : +XclExpCondfmt::XclExpCondfmt( const XclExpRoot rRoot, const ScConditionalFormat
[Libreoffice-commits] .: 5 commits - sc/source
sc/source/core/data/column.cxx | 122 +++-- 1 file changed, 57 insertions(+), 65 deletions(-) New commits: commit 157b804ba1dad4b857bd723c454ab907b623a980 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Nov 1 20:16:15 2012 -0400 Add comments to make it easier to follow this non-obvious code. Change-Id: Ib3d3e5b57799c22916845899839ddcc9a81e9b98 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 1321cd2..5debdd1 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1484,6 +1484,7 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn rCol) SCSIZE i; Search( nStartRow, i); // i points to start row or position thereafter SCSIZE nStartPos = i; +// First, copy the cell instances to the new column. for ( ; i maItems.size() maItems[i].nRow = nEndRow; ++i) { SCROW nRow = maItems[i].nRow; @@ -1531,15 +1532,16 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn rCol) nStartPos = (*it).first; nStopPos = (*it).second; for (i=nStartPos; inStopPos; ++i) -maItems[i].pCell = pNoteCell; +maItems[i].pCell = pNoteCell; // Assign the dumpy cell instance to all slots. for (i=nStartPos; inStopPos; ++i) { rAddress.SetRow( maItems[i].nRow ); pDocument-AreaBroadcast( aHint ); } +// Erase the slots containing pointers to the dummy cell instance. maItems.erase(maItems.begin() + nStartPos, maItems.begin() + nStopPos); } -pNoteCell-Delete(); +pNoteCell-Delete(); // Delete the dummy cell instance. } } commit f978013f9b8d5256aa029a3572d905bebb55c5f4 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Nov 1 20:11:22 2012 -0400 Remove the correct range, or else maItems would end up with invalid pointer. nStopPos is non-inclusive, and STL's erase() method also expects a non-inclusive end position (like any other STL methods do). It's wrong to -1 here which would end up not erasing the last element containing a pointer to the deleted cell instance. Change-Id: Ia3ef4469b50695038836ff7b9b48172256032786 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 14e01f7..1321cd2 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1537,7 +1537,7 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn rCol) rAddress.SetRow( maItems[i].nRow ); pDocument-AreaBroadcast( aHint ); } -maItems.erase(maItems.begin() + nStartPos, maItems.begin() + nStopPos - 1); +maItems.erase(maItems.begin() + nStartPos, maItems.begin() + nStopPos); } pNoteCell-Delete(); } commit 1c2ef32a78e1b59a7cb49218d78cf5abc70c8518 Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Nov 1 20:03:06 2012 -0400 Now this bConsecutive flag makes no sense. Treat as if this flag is always false. Change-Id: Ie1364ac54f95263aa316bf81f631e607843934d5 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index b1f81af..14e01f7 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1481,7 +1481,6 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn rCol) return; ::std::vectorSCROW aRows; -bool bConsecutive = true; SCSIZE i; Search( nStartRow, i); // i points to start row or position thereafter SCSIZE nStartPos = i; @@ -1498,9 +1497,6 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn rCol) typedef ::std::pairSCSIZE,SCSIZE PosPair; typedef ::std::vectorPosPair EntryPosPairs; EntryPosPairs aEntries; -if (bConsecutive) -aEntries.push_back( PosPair(nStartPos, nStopPos)); -else { bool bFirst = true; nStopPos = 0; commit 79979dd23104bf35aaa18bc3e80449fe5537499c Author: Kohei Yoshida kohei.yosh...@gmail.com Date: Thu Nov 1 18:52:24 2012 -0400 This if statement is never true. SCROW nRow = maItems[i].nRow; and nRow will never be modified afterwards. So if (nRow != maItems[i].nRow) is never true. Change-Id: I4f867a704d50138aee8c5e7f37464880470098c2 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 657..b1f81af 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1490,11 +1490,6 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn rCol) SCROW nRow = maItems[i].nRow; aRows.push_back( nRow); rCol.Insert( nRow, maItems[i].pCell); -if (nRow != maItems[i].nRow) -{ // Listener inserted -
[Libreoffice-commits] .: 5 commits - sc/source
sc/source/ui/unoobj/chart2uno.cxx | 111 +- 1 file changed, 62 insertions(+), 49 deletions(-) New commits: commit 8269e88b9b9ba508f53489269031e5d41074fc60 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Sun Mar 25 04:38:20 2012 +0200 Revert simplify code - remove unnecessary and complicated allocation This reverts commit 3ffdb45ae047f12480e73fdd4b28fe35f1e8d48c. diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 1c637fb..5ff808b 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -717,6 +717,7 @@ void Chart2Positioner::createPositionMap() bool bNoGlue = (meGlue == GLUETYPE_NONE); SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptrTable pCols(new Table); +auto_ptrFormulaToken pNewAddress; auto_ptrTable pNewRowTable(new Table); SAL_WNODEPRECATED_DECLARATIONS_POP Table* pCol = NULL; @@ -783,18 +784,19 @@ void Chart2Positioner::createPositionMap() aCellData.nRow = nRow; aCellData.nTab = nTab; -if (pCol-Get(nInsRow) == NULL) -{ -if (bExternal) -pCol-Insert(nInsRow, new ScExternalSingleRefToken(nFileId, aTabName, aCellData)); -else -pCol-Insert(nInsRow, new ScSingleRefToken(aCellData)); -} +if (bExternal) +pNewAddress.reset(new ScExternalSingleRefToken(nFileId, aTabName, aCellData)); +else +pNewAddress.reset(new ScSingleRefToken(aCellData)); + +if (pCol-Insert(nInsRow, pNewAddress.get())) +pNewAddress.release(); // To prevent the instance from being destroyed. } } } nNoGlueRow += nRow2 - nRow1 + 1; } +pNewAddress.reset(NULL); pNewRowTable.reset(NULL); bool bFillRowHeader = mbRowHeaders; commit 3079cebfe62a482cb82a67a77e436b85f6249b9c Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Sun Mar 25 04:38:02 2012 +0200 Revert restructure insert code as a precursor to further simplification This reverts commit 4aa72e0dee42c80667083c0b86a3d0ec5381c1ae. diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index e2f7059..1c637fb 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -761,13 +761,13 @@ void Chart2Positioner::createPositionMap() } else { -pCol = static_castTable*(pCols-Get(nInsCol)); -if (!pCol) +if (pCols-Insert(nInsCol, pNewRowTable.get())) { -pCol = pNewRowTable.get(); -pCols-Insert(nInsCol, pNewRowTable.release()); +pCol = pNewRowTable.release(); pNewRowTable.reset(new Table); } +else +pCol = static_castTable*(pCols-Get(nInsCol)); } sal_uInt32 nInsRow = static_castsal_uInt32(bNoGlue ? nNoGlueRow : nRow1); @@ -786,7 +786,7 @@ void Chart2Positioner::createPositionMap() if (pCol-Get(nInsRow) == NULL) { if (bExternal) -pCol-Insert(nInsRow, new ScExternalSingleRefToken(nFileId, aTabName, aCellData)) +pCol-Insert(nInsRow, new ScExternalSingleRefToken(nFileId, aTabName, aCellData)); else pCol-Insert(nInsRow, new ScSingleRefToken(aCellData)); } commit d1fcea677a0d814ca92a00717a4ff7090291f6cd Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Sun Mar 25 04:37:41 2012 +0200 Revert if/else branches contain same code This reverts commit 13bf19769e6e0522d920594225b9baa2c1b7dd63. diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 1a04ce4..e2f7059 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -749,12 +749,25 @@ void Chart2Positioner::createPositionMap() for (SCCOL nCol = nCol1; nCol = nCol2; ++nCol, ++nInsCol) { -pCol = static_castTable*(pCols-Get(nInsCol)); -if (!pCol) +if (bNoGlue || meGlue == GLUETYPE_ROWS) { -pCol = pNewRowTable.get(); -pCols-Insert(nInsCol, pNewRowTable.release()); -pNewRowTable.reset(new Table); +pCol = static_castTable*(pCols-Get(nInsCol)); +if (!pCol) +{ +pCol =
[Libreoffice-commits] .: 5 commits - sc/source sfx2/inc sfx2/source sot/inc svtools/inc svtools/source sw/source tools/inc unusedcode.easy
sc/source/ui/app/inputhdl.cxx |1 sc/source/ui/view/output.cxx |4 -- sc/source/ui/view/output2.cxx |3 - sfx2/inc/sfx2/docfile.hxx |3 - sfx2/source/doc/docfile.cxx| 11 +- sot/inc/sot/object.hxx |4 -- svtools/inc/svtools/accessibilityoptions.hxx |5 +-- svtools/source/config/accessibilityoptions.cxx |9 + sw/source/ui/table/tautofmt.cxx|3 - tools/inc/tools/ref.hxx| 41 + unusedcode.easy|1 11 files changed, 10 insertions(+), 75 deletions(-) New commits: commit a09d551182d61d67313a7d97a25ab251c88f92e9 Author: Caolán McNamara caol...@redhat.com Date: Fri Mar 23 13:23:32 2012 + we dont' need any SvCompatWeakBase use in SfxMedium AKAICS diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index 55cd3a2..53846f3 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -110,8 +110,6 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase public: -SvCompatWeakHdl*GetHdl(); - SfxMedium(); SfxMedium( const String rName, StreamMode nOpenMode, @@ -299,7 +297,6 @@ public: }; SV_DECL_IMPL_REF( SfxMedium ) -SV_DECL_COMPAT_WEAK( SfxMedium ) typedef ::std::vector SfxMedium* SfxMediumList; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index c7e60da..ba7ffb8 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -253,7 +253,7 @@ void SAL_CALL SfxMediumHandler_Impl::handle( const com::sun::star::uno::Referenc } // -class SfxMedium_Impl : public SvCompatWeakBase +class SfxMedium_Impl { public: ::ucbhelper::Content aContent; @@ -323,8 +323,7 @@ public: //-- SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) - : SvCompatWeakBase( pAntiImplP ), -bUpdatePickList(sal_True), + : bUpdatePickList(sal_True), bIsTemp( sal_False ), bForceSynchron( sal_False ), bDownloadDone( sal_True ), @@ -3039,12 +3038,6 @@ SvKeyValueIterator* SfxMedium::GetHeaderAttributes_Impl() return pImp-xAttributes; } -// - -SvCompatWeakHdl* SfxMedium::GetHdl() -{ -return pImp-GetHdl(); -} ::com::sun::star::uno::Reference ::com::sun::star::io::XInputStream SfxMedium::GetInputStream() { diff --git a/unusedcode.easy b/unusedcode.easy index 08c0f96..b8d6b87 100755 --- a/unusedcode.easy +++ b/unusedcode.easy @@ -125,7 +125,6 @@ SfxFoundCacheArr_Impl::Insert(SfxFoundCache_Impl const*, unsigned short) SfxFoundCacheArr_Impl::Insert(SfxFoundCache_Impl const**, unsigned short) SfxFoundCacheArr_Impl::Remove(SfxFoundCache_Impl const*, unsigned short) SfxFoundCacheArr_Impl::Remove(unsigned short, unsigned short) -SfxMedium::GetHdl() SfxModuleArr_Impl::DeleteAndDestroy(unsigned short, unsigned short) SfxNavigatorWrapper::GetChildWindowId() SfxPartChildWnd_Impl::GetChildWindowId() commit 4a893297a8f755851477f07145f726aa3e6f9c9e Author: Caolán McNamara caol...@redhat.com Date: Fri Mar 23 12:45:46 2012 + weird use of volatile diff --git a/svtools/inc/svtools/accessibilityoptions.hxx b/svtools/inc/svtools/accessibilityoptions.hxx index 7783eb7..766af7c 100644 --- a/svtools/inc/svtools/accessibilityoptions.hxx +++ b/svtools/inc/svtools/accessibilityoptions.hxx @@ -40,8 +40,8 @@ class SVT_DLLPUBLIC SvtAccessibilityOptions: public utl::detail::Options, private SfxListener { private: -static SvtAccessibilityOptions_Impl* volatile sm_pSingleImplConfig; -static sal_Int32 volatile sm_nAccessibilityRefCount; +static SvtAccessibilityOptions_Impl* sm_pSingleImplConfig; +static sal_Int32 sm_nAccessibilityRefCount; public: SvtAccessibilityOptions(); diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index 44ab3e4..44a9646 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -94,8 +94,8 @@ public: // initialization of static members -- -SvtAccessibilityOptions_Impl* volatile SvtAccessibilityOptions::sm_pSingleImplConfig =NULL; -sal_Int32 volatile SvtAccessibilityOptions::sm_nAccessibilityRefCount(0); +SvtAccessibilityOptions_Impl* SvtAccessibilityOptions::sm_pSingleImplConfig =NULL; +sal_Int32 SvtAccessibilityOptions::sm_nAccessibilityRefCount(0); namespace { commit 8b3bfa53c9ed62ea4d744ae0d874241b8fb27a81 Author: Caolán McNamara caol...@redhat.com Date: Fri Mar 23 12:39:16 2012
[Libreoffice-commits] .: 5 commits - sc/source
sc/source/core/data/dptablecache.cxx | 38 +++ sc/source/core/data/dptabres.cxx |4 +++ 2 files changed, 12 insertions(+), 30 deletions(-) New commits: commit 1d4971d77afa492bfdbfd18113eff4f77b3100e3 Author: Kohei Yoshida kohei.yosh...@suse.com Date: Tue Nov 15 00:19:54 2011 -0500 Beware that the sequence can be empty. And when it's empty, it causes an invalid array access later on. diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 84ce258..c1a1824 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -1369,6 +1369,10 @@ void ScDPResultMember::FillMemberResults( uno::Sequencesheet::MemberResult* pS // IsVisible() test is in ScDPResultDimension::FillMemberResults // (not on data layout dimension) +if (!pSequences-getLength()) +// empty sequence. Bail out. +return; + long nSize = GetSize(nMeasure); sheet::MemberResult* pArray = pSequences-getArray(); OSL_ENSURE( rPos+nSize = pSequences-getLength(), bumm ); commit 690e14ad035e642f4382d20b8b7b792762338126 Author: Kohei Yoshida kohei.yosh...@suse.com Date: Mon Nov 14 23:21:02 2011 -0500 Unused local var. diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx index ecfab69..5bbef8f 100644 --- a/sc/source/core/data/dptablecache.cxx +++ b/sc/source/core/data/dptablecache.cxx @@ -607,7 +607,6 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam rParam) const const ScDPItemData* pCellData = GetItemDataById( nSourceField, nId ); bool bOk = false; -bool bTestEqual = false; if (rEntry.GetQueryItem().meType == ScQueryEntry::ByEmpty) { @@ -670,8 +669,6 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam rParam) const bMatch = false;// RegExp must match entire cell string if (bRealRegExp) bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch); -else -bTestEqual = bMatch; } if (!bRealRegExp) { commit 10afa30240edec37a052ee87ff5b5e36c615abcd Author: Kohei Yoshida kohei.yosh...@suse.com Date: Mon Nov 14 23:19:21 2011 -0500 Used std::vector instead of C-style array. diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx index cbf9065..ecfab69 100644 --- a/sc/source/core/data/dptablecache.cxx +++ b/sc/source/core/data/dptablecache.cxx @@ -582,12 +582,8 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam rParam) const return true; bool bMatchWholeCell = mpDoc-GetDocOptions().IsMatchWholeCell(); -//--- - -const SCSIZE nFixedBools = 32; -bool aBool[nFixedBools]; SCSIZE nEntryCount = rParam.GetEntryCount(); -bool* pPasst = ( nEntryCount = nFixedBools ? aBool[0] : new bool[nEntryCount] ); +std::vectorbool aPassed(nEntryCount, false); long nPos = -1; CollatorWrapper* pCollator = (rParam.bCaseSens ? ScGlobal::GetCaseCollator() : @@ -753,31 +749,26 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam rParam) const if (nPos == -1) { nPos++; -pPasst[nPos] = bOk; +aPassed[nPos] = bOk; } else { if (rEntry.eConnect == SC_AND) { -pPasst[nPos] = pPasst[nPos] bOk; +aPassed[nPos] = aPassed[nPos] bOk; } else { nPos++; -pPasst[nPos] = bOk; +aPassed[nPos] = bOk; } } } for (long j=1; j = nPos; j++) -{ -pPasst[0] = pPasst[0] || pPasst[j]; -} - -bool bRet = pPasst[0]; -if (pPasst != aBool[0]) -delete [] pPasst; +aPassed[0] = aPassed[0] || aPassed[j]; +bool bRet = aPassed[0]; return bRet; } commit 011878812eac685b76a925fa9ffb17a152c27e6a Author: Kohei Yoshida kohei.yosh...@suse.com Date: Mon Nov 14 23:13:26 2011 -0500 This can be for loop instead. diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx index 2810b51..cbf9065 100644 --- a/sc/source/core/data/dptablecache.cxx +++ b/sc/source/core/data/dptablecache.cxx @@ -589,14 +589,13 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam rParam) const SCSIZE nEntryCount = rParam.GetEntryCount(); bool* pPasst = ( nEntryCount = nFixedBools ? aBool[0] : new bool[nEntryCount] ); -longnPos = -1; -SCSIZE i= 0; +long nPos = -1; CollatorWrapper* pCollator = (rParam.bCaseSens ? ScGlobal::GetCaseCollator() : ScGlobal::GetCollator() ); ::utl::TransliterationWrapper* pTransliteration = (rParam.bCaseSens ?