filter/source/config/fragments/types/calc_MS_Excel_40.xcu | 2 filter/source/config/fragments/types/calc_MS_Excel_40_VorlageTemplate.xcu | 2 filter/source/config/fragments/types/calc_MS_Excel_5095.xcu | 2 filter/source/config/fragments/types/calc_MS_Excel_5095_VorlageTemplate.xcu | 2 filter/source/config/fragments/types/calc_MS_Excel_95.xcu | 2 filter/source/config/fragments/types/calc_MS_Excel_95_VorlageTemplate.xcu | 2 filter/source/config/fragments/types/calc_MS_Excel_97.xcu | 2 filter/source/config/fragments/types/calc_MS_Excel_97_VorlageTemplate.xcu | 2 oox/inc/oox/xls/richstring.hxx | 1 oox/source/xls/commentsbuffer.cxx | 2 oox/source/xls/richstring.cxx | 16 ++-- oox/source/xls/worksheethelper.cxx | 5 + sc/inc/dptabsrc.hxx | 1 sc/source/core/data/dptabsrc.cxx | 16 ++++ sc/source/core/data/table1.cxx | 1 sc/source/core/data/table5.cxx | 4 + sc/source/filter/excel/impop.cxx | 4 - sc/source/ui/unoobj/scdetect.cxx | 38 ++++++++-- sc/source/ui/view/drawutil.cxx | 12 +++ sc/source/ui/view/drawvie4.cxx | 2 sc/source/ui/view/drawview.cxx | 2 sc/source/ui/view/gridwin3.cxx | 2 sc/source/ui/view/gridwin4.cxx | 4 + 23 files changed, 99 insertions(+), 27 deletions(-)
New commits: commit 31012ab9d7035f942486c87ecc1a79b4d6579975 Author: Eike Rathke <er...@redhat.com> Date: Fri Nov 25 00:59:12 2011 +0100 Fixed #i116848# Shapes are at wrong position # Original author: Niklas Nebel <n...@openoffice.org> Taken from OOO340 repository, changeset 7ebd38de6d70 introduced with CWS dr78. diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 1e6f330..cdd8abb 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -245,7 +245,7 @@ void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const if (nEndCol<20) nEndCol = 20; if (nEndRow<20) - nEndRow = 1000; + nEndRow = 20; Fraction aZoom(1,1); ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev, aZoom,aZoom, diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index bfd65dd..0494dcb 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -332,7 +332,7 @@ void ScDrawView::RecalcScale() if (nEndCol<20) nEndCol = 20; if (nEndRow<20) - nEndRow = 1000; + nEndRow = 20; // #i116848# instead of a large row number for an empty sheet, heights are multiplied in CalcScale ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev,aZoomX,aZoomY,nPPTX,nPPTY, aScaleX,aScaleY ); diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index 4e3189c..69a2b6a 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -266,7 +266,7 @@ MapMode ScGridWindow::GetDrawMapMode( bool bForce ) SCROW nEndRow = 0; pDoc->GetTableArea( nTab, nEndCol, nEndRow ); if (nEndCol<20) nEndCol = 20; - if (nEndRow<20) nEndRow = 1000; + if (nEndRow<20) nEndRow = 20; ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, this, pViewData->GetZoomX(),pViewData->GetZoomY(), pViewData->GetPPTX(),pViewData->GetPPTY(), commit 8a838b9fbf46ece9680824cd3a044ab7338bf306 Author: Eike Rathke <er...@redhat.com> Date: Fri Nov 25 00:04:53 2011 +0100 calc69: #i118068# handle all-hidden case in ScDrawUtil::CalcScale # Original author: Niklas Nebel <n...@openoffice.org> * found as LGPLv3-only fix at svn rev 1172138 (http://svn.apache.org/viewvc?view=revision&revision=1172138) Plus the original comment from the replaced code why it is there, to fix #i116848# diff --git a/sc/source/ui/view/drawutil.cxx b/sc/source/ui/view/drawutil.cxx index 54b4ef9..1cb5c74 100644 --- a/sc/source/ui/view/drawutil.cxx +++ b/sc/source/ui/view/drawutil.cxx @@ -82,6 +82,18 @@ void ScDrawUtil::CalcScale( ScDocument* pDoc, SCTAB nTab, nPixelY += ScViewData::ToPixel(nHeight, nPPTY); } + // #i116848# To get a large-enough number for PixelToLogic, multiply the integer values + // instead of using a larger number of rows + if ( nTwipsY ) + { + long nMultiply = 2000000 / nTwipsY; + if ( nMultiply > 1 ) + { + nTwipsY *= nMultiply; + nPixelY *= nMultiply; + } + } + MapMode aHMMMode( MAP_100TH_MM, Point(), rZoomX, rZoomY ); Point aPixelLog = pDev->PixelToLogic( Point( nPixelX,nPixelY ), aHMMMode ); commit 73d344c18ead9a905871541d5d0d37c56c598a03 Author: Eike Rathke <er...@redhat.com> Date: Thu Nov 24 23:44:05 2011 +0100 calc69: #i117952# invalidate page breaks when print range is removed # Original author: Niklas Nebel <n...@openoffice.org> * found as LGPLv3-only fix at svn rev 1172137 (http://svn.apache.org/viewvc?view=revision&revision=1172137) diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index e88fba6..b746ffc 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1792,6 +1792,7 @@ void ScTable::RestorePrintRanges( const ScPrintSaverTab& rSaveTab ) SetRepeatColRange( rSaveTab.GetRepeatCol() ); SetRepeatRowRange( rSaveTab.GetRepeatRow() ); + InvalidatePageBreaks(); // #i117952# forget page breaks for an old print range UpdatePageBreaks(NULL); } diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index c6999dc..e5d8dc8 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -1085,6 +1085,10 @@ Size ScTable::GetPageSize() const void ScTable::SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow ) { + // #i117952# page break calculation uses these values (set from ScPrintFunc), not pRepeatColRange/pRepeatRowRange + if ( nStartCol != nRepeatStartX || nEndCol != nRepeatEndX || nStartRow != nRepeatStartY || nEndRow != nRepeatEndY ) + InvalidatePageBreaks(); + nRepeatStartX = nStartCol; nRepeatEndX = nEndCol; nRepeatStartY = nStartRow; commit 871b87f9d3787967bfe1ff9dd9314d7b2a0f19c3 Author: Eike Rathke <er...@redhat.com> Date: Thu Nov 24 23:36:57 2011 +0100 calc69: #i117893# call GetSizePixel before setting bIsInPaint # Original author: Niklas Nebel <n...@openoffice.org> * found as LGPLv3-only fix at svn rev 1172136 (http://svn.apache.org/viewvc?view=revision&revision=1172136) diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index e1d582c..1f82d64 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -342,6 +342,10 @@ void ScGridWindow::Paint( const Rectangle& rRect ) return; } + // #i117893# If GetSizePixel needs to call the resize handler, the resulting nested Paint call + // (possibly for a larger rectangle) has to be allowed. Call GetSizePixel before setting bIsInPaint. + GetSizePixel(); + if (bIsInPaint) return; commit a70f7bfc5ee22aa54c98cb8aab69b5eb97a86bbd Author: Eike Rathke <er...@redhat.com> Date: Thu Nov 24 23:33:32 2011 +0100 calc69: #i117836# repair import of multiline cells and cells with leading font escapement # Original author: Daniel Rentz [dr] <daniel.re...@oracle.com> * found as LGPLv3-only fix at svn rev 1172134 (http://svn.apache.org/viewvc?view=revision&revision=1172134) diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx index cf20fba..8efffdf 100644 --- a/oox/inc/oox/xls/richstring.hxx +++ b/oox/inc/oox/xls/richstring.hxx @@ -276,6 +276,7 @@ public: formatting for the first text portion, e.g. font escapement. */ void convert( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText, + bool bReplaceOld, const Font* pFirstPortionFont = 0 ) const; private: diff --git a/oox/source/xls/commentsbuffer.cxx b/oox/source/xls/commentsbuffer.cxx index c8a8d7d..55dd28b 100644 --- a/oox/source/xls/commentsbuffer.cxx +++ b/oox/source/xls/commentsbuffer.cxx @@ -284,7 +284,7 @@ void Comment::finalizeImport() // insert text and convert text formatting maModel.mxText->finalizeImport(); Reference< XText > xAnnoText( xAnnoShape, UNO_QUERY_THROW ); - maModel.mxText->convert( xAnnoText ); + maModel.mxText->convert( xAnnoText, true ); } catch( Exception& ) { diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx index 6a2bbd9..7b025e5 100644 --- a/oox/source/xls/richstring.cxx +++ b/oox/source/xls/richstring.cxx @@ -110,9 +110,10 @@ void RichStringPortion::convert( const Reference< XText >& rxText, const Font* p mxFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT ); } - /* Some font attributes cannot be set to cell formattiing in Calc but - require to use rich formatting, e.g. font escapement. */ - if( lclNeedsRichTextFormat( pFont ) ) + /* Some font attributes cannot be set to cell formatting in Calc but + require to use rich formatting, e.g. font escapement. But do not + use the passed font if this portion has its own font. */ + else if( lclNeedsRichTextFormat( pFont ) ) { PropertySet aPropSet( xRange ); pFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT ); @@ -534,12 +535,12 @@ bool RichString::extractPlainString( OUString& orString, const Font* pFirstPorti if( (maTextPortions.size() == 1) && !maTextPortions.front()->hasFont() && !lclNeedsRichTextFormat( pFirstPortionFont ) ) { orString = maTextPortions.front()->getText(); - return true; + return orString.indexOf( '\x0A' ) < 0; } return false; } -void RichString::convert( const Reference< XText >& rxText, const Font* pFirstPortionFont ) const +void RichString::convert( const Reference< XText >& rxText, bool bReplaceOld, const Font* pFirstPortionFont ) const { if (maTextPortions.size() == 1) { @@ -551,12 +552,11 @@ void RichString::convert( const Reference< XText >& rxText, const Font* pFirstPo return; } - bool bReplace = true; for( PortionVector::const_iterator aIt = maTextPortions.begin(), aEnd = maTextPortions.end(); aIt != aEnd; ++aIt ) { - (*aIt)->convert( rxText, pFirstPortionFont, bReplace ); + (*aIt)->convert( rxText, pFirstPortionFont, bReplaceOld ); pFirstPortionFont = 0; // use passed font for first portion only - bReplace = false; // do not replace first portion text with following portions + bReplaceOld = false; // do not replace first portion text with following portions } } diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index a74e24f..02802a3 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -1679,7 +1679,10 @@ void WorksheetHelper::putRichString( const CellAddress& rAddress, const RichStri { Reference< XText > xText( getCell( rAddress ), UNO_QUERY ); OSL_ENSURE( xText.is(), "WorksheetHelper::putRichString - missing text interface" ); - rString.convert( xText, pFirstPortionFont ); + /* Passing false will always append the portions to the XText. This is + essential for special rich formatting attributes at the leading text + portion supported by edit cells only, e.g. font escapement. */ + rString.convert( xText, false, pFirstPortionFont ); } void WorksheetHelper::putFormulaTokens( const CellAddress& rAddress, const ApiTokenSequence& rTokens ) const commit 36018b12c460dd0e537f2a1aff8cb78a356cafbd Author: Eike Rathke <er...@redhat.com> Date: Thu Nov 24 23:01:47 2011 +0100 calc68: #i117728# allocate row/column outline buffers according to BIFF sheet size, not Calc sheet size # Original author: Daniel Rentz [dr] <daniel.re...@oracle.com> * found as LGPLv3-only fix at svn rev 1166947 (http://svn.apache.org/viewvc?view=revision&revision=1166947) diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index dec262a..f30a4cb 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -1311,8 +1311,8 @@ void ImportExcel::PostDocLoad( void ) XclImpOutlineDataBuffer::XclImpOutlineDataBuffer( const XclImpRoot& rRoot, SCTAB nScTab ) : XclImpRoot( rRoot ), - mxColOutlineBuff( new XclImpOutlineBuffer( MAXCOLCOUNT ) ), - mxRowOutlineBuff( new XclImpOutlineBuffer( MAXROWCOUNT ) ), + mxColOutlineBuff( new XclImpOutlineBuffer( rRoot.GetXclMaxPos().Col() + 1 ) ), + mxRowOutlineBuff( new XclImpOutlineBuffer( rRoot.GetXclMaxPos().Row() + 1 ) ), mxColRowBuff( new XclImpColRowSettings( rRoot ) ), mnScTab( nScTab ) { commit d0cd63da64948d9a3ad885b696e44d5c5fcfd1ab Author: Eike Rathke <er...@redhat.com> Date: Thu Nov 24 22:27:45 2011 +0100 adapted FormatDetector patch to reality diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx index 1fe317c..b2f9101 100644 --- a/sc/source/ui/unoobj/scdetect.cxx +++ b/sc/source/ui/unoobj/scdetect.cxx @@ -117,8 +117,7 @@ static const sal_Char pFilterExcel95[] = "MS Excel 95"; static const sal_Char pFilterEx95Temp[] = "MS Excel 95 Vorlage/Template"; static const sal_Char pFilterExcel97[] = "MS Excel 97"; static const sal_Char pFilterEx97Temp[] = "MS Excel 97 Vorlage/Template"; -static const sal_Char __FAR_DATA pFilterExcelXML[] = "MS Excel 2003 XML"; -static const sal_Char pFilter2003XML[] = "MS Excel 2003 XML"; +static const sal_Char pFilterExcelXML[] = "MS Excel 2003 XML"; static const sal_Char pFilterDBase[] = "dBase"; static const sal_Char pFilterDif[] = "DIF"; static const sal_Char pFilterSylk[] = "SYLK"; @@ -761,16 +760,11 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream ) else if ( bIsXLS && bMaybeText ) { aHeader = comphelper::string::stripStart(aHeader, ' '); - if( aHeader.CompareTo( "<?xml", 5 ) == COMPARE_EQUAL ) - pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilter2003XML) ); - else - { - // Detect Excel 2003 XML here only if XLS was preselected. - // The configured detection for Excel 2003 XML is still in XMLFilterDetect. - pFilter = lcl_DetectExcelXML( rStr, aMatcher ); - if (!pFilter) - pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterAscii) ); - } + // Detect Excel 2003 XML here only if XLS was preselected. + // The configured detection for Excel 2003 XML is still in XMLFilterDetect. + pFilter = lcl_DetectExcelXML( rStr, aMatcher ); + if (!pFilter) + pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterAscii) ); bFakeXLS = true; } else if ( pPreselectedFilter->GetName().EqualsAscii(pFilterDBase) && lcl_MayBeDBase( rStr ) ) commit a185c4c15b16a9db61019aa0c94f3e67ca81699d Author: Eike Rathke <er...@redhat.com> Date: Thu Nov 24 22:21:41 2011 +0100 calc67: #i117735# use calc FormatDetector for XLS again, handle Excel 2003 XML directly in XLS detection # Original author: Niklas Nebel <n...@openoffice.org> * found as LGPLv3-only fix at svn rev 1167327 (http://svn.apache.org/viewvc?view=revision&revision=1167327) diff --git a/filter/source/config/fragments/types/calc_MS_Excel_40.xcu b/filter/source/config/fragments/types/calc_MS_Excel_40.xcu index 939a0a4..b45c21f 100644 --- a/filter/source/config/fragments/types/calc_MS_Excel_40.xcu +++ b/filter/source/config/fragments/types/calc_MS_Excel_40.xcu @@ -1,5 +1,5 @@ <node oor:name="calc_MS_Excel_40" oor:op="replace" > - <prop oor:name="DetectService"><value>com.sun.star.comp.oox.xls.BiffDetector</value></prop> + <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>xls xlw xlc xlm</value></prop> <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop> diff --git a/filter/source/config/fragments/types/calc_MS_Excel_40_VorlageTemplate.xcu b/filter/source/config/fragments/types/calc_MS_Excel_40_VorlageTemplate.xcu index 291382d..42bb10e 100644 --- a/filter/source/config/fragments/types/calc_MS_Excel_40_VorlageTemplate.xcu +++ b/filter/source/config/fragments/types/calc_MS_Excel_40_VorlageTemplate.xcu @@ -1,5 +1,5 @@ <node oor:name="calc_MS_Excel_40_VorlageTemplate" oor:op="replace" > - <prop oor:name="DetectService"><value>com.sun.star.comp.oox.xls.BiffDetector</value></prop> + <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>xlt</value></prop> <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop> diff --git a/filter/source/config/fragments/types/calc_MS_Excel_5095.xcu b/filter/source/config/fragments/types/calc_MS_Excel_5095.xcu index 5656b73..3f450f0 100644 --- a/filter/source/config/fragments/types/calc_MS_Excel_5095.xcu +++ b/filter/source/config/fragments/types/calc_MS_Excel_5095.xcu @@ -1,5 +1,5 @@ <node oor:name="calc_MS_Excel_5095" oor:op="replace" > - <prop oor:name="DetectService"><value>com.sun.star.comp.oox.xls.BiffDetector</value></prop> + <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>xls xlc xlm xlw</value></prop> <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop> diff --git a/filter/source/config/fragments/types/calc_MS_Excel_5095_VorlageTemplate.xcu b/filter/source/config/fragments/types/calc_MS_Excel_5095_VorlageTemplate.xcu index 9c1799d..8dbb02c 100644 --- a/filter/source/config/fragments/types/calc_MS_Excel_5095_VorlageTemplate.xcu +++ b/filter/source/config/fragments/types/calc_MS_Excel_5095_VorlageTemplate.xcu @@ -1,5 +1,5 @@ <node oor:name="calc_MS_Excel_5095_VorlageTemplate" oor:op="replace" > - <prop oor:name="DetectService"><value>com.sun.star.comp.oox.xls.BiffDetector</value></prop> + <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>xlt</value></prop> <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop> diff --git a/filter/source/config/fragments/types/calc_MS_Excel_95.xcu b/filter/source/config/fragments/types/calc_MS_Excel_95.xcu index 8e02ea8..0ea10dd 100644 --- a/filter/source/config/fragments/types/calc_MS_Excel_95.xcu +++ b/filter/source/config/fragments/types/calc_MS_Excel_95.xcu @@ -1,5 +1,5 @@ <node oor:name="calc_MS_Excel_95" oor:op="replace" > - <prop oor:name="DetectService"><value>com.sun.star.comp.oox.xls.BiffDetector</value></prop> + <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>xls xlc xlm xlw</value></prop> <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop> diff --git a/filter/source/config/fragments/types/calc_MS_Excel_95_VorlageTemplate.xcu b/filter/source/config/fragments/types/calc_MS_Excel_95_VorlageTemplate.xcu index bc80367..fb3e410 100644 --- a/filter/source/config/fragments/types/calc_MS_Excel_95_VorlageTemplate.xcu +++ b/filter/source/config/fragments/types/calc_MS_Excel_95_VorlageTemplate.xcu @@ -1,5 +1,5 @@ <node oor:name="calc_MS_Excel_95_VorlageTemplate" oor:op="replace" > - <prop oor:name="DetectService"><value>com.sun.star.comp.oox.xls.BiffDetector</value></prop> + <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>xlt</value></prop> <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop> diff --git a/filter/source/config/fragments/types/calc_MS_Excel_97.xcu b/filter/source/config/fragments/types/calc_MS_Excel_97.xcu index 0f7b643..bb232c3 100644 --- a/filter/source/config/fragments/types/calc_MS_Excel_97.xcu +++ b/filter/source/config/fragments/types/calc_MS_Excel_97.xcu @@ -1,5 +1,5 @@ <node oor:name="calc_MS_Excel_97" oor:op="replace" > - <prop oor:name="DetectService"><value>com.sun.star.comp.oox.xls.BiffDetector</value></prop> + <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>xls xlc xlm xlw xlk</value></prop> <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop> diff --git a/filter/source/config/fragments/types/calc_MS_Excel_97_VorlageTemplate.xcu b/filter/source/config/fragments/types/calc_MS_Excel_97_VorlageTemplate.xcu index ff390ce..26f4bca 100644 --- a/filter/source/config/fragments/types/calc_MS_Excel_97_VorlageTemplate.xcu +++ b/filter/source/config/fragments/types/calc_MS_Excel_97_VorlageTemplate.xcu @@ -1,5 +1,5 @@ <node oor:name="calc_MS_Excel_97_VorlageTemplate" oor:op="replace" > - <prop oor:name="DetectService"><value>com.sun.star.comp.oox.xls.BiffDetector</value></prop> + <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop> <prop oor:name="URLPattern"/> <prop oor:name="Extensions"><value>xlt</value></prop> <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop> diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx index 1132a76..1fe317c 100644 --- a/sc/source/ui/unoobj/scdetect.cxx +++ b/sc/source/ui/unoobj/scdetect.cxx @@ -117,6 +117,7 @@ static const sal_Char pFilterExcel95[] = "MS Excel 95"; static const sal_Char pFilterEx95Temp[] = "MS Excel 95 Vorlage/Template"; static const sal_Char pFilterExcel97[] = "MS Excel 97"; static const sal_Char pFilterEx97Temp[] = "MS Excel 97 Vorlage/Template"; +static const sal_Char __FAR_DATA pFilterExcelXML[] = "MS Excel 2003 XML"; static const sal_Char pFilter2003XML[] = "MS Excel 2003 XML"; static const sal_Char pFilterDBase[] = "dBase"; static const sal_Char pFilterDif[] = "DIF"; @@ -160,6 +161,35 @@ static sal_Bool lcl_MayBeAscii( SvStream& rStream ) return nMask != 0; } +static const SfxFilter* lcl_DetectExcelXML( SvStream& rStream, SfxFilterMatcher& rMatcher ) +{ + const SfxFilter* pFound = NULL; + rStream.Seek(STREAM_SEEK_TO_BEGIN); + + const size_t nBufSize = 4000; + sal_uInt8 aBuffer[ nBufSize ]; + sal_uLong nBytesRead = rStream.Read( aBuffer, nBufSize ); + sal_uLong nXMLStart = 0; + + // Skip UTF-8 BOM if present. + // No need to handle UTF-16 etc (also rejected in XMLFilterDetect). + if ( nBytesRead >= 3 && aBuffer[0] == 0xEF && aBuffer[1] == 0xBB && aBuffer[2] == 0xBF ) + nXMLStart = 3; + + if ( nBytesRead >= nXMLStart + 5 && rtl_compareMemory( aBuffer+nXMLStart, "<?xml", 5 ) == 0 ) + { + // Be consistent with XMLFilterDetect service: Check for presence of "Workbook" in XML file. + + rtl::OString aTryStr( "Workbook" ); + rtl::OString aFileString(reinterpret_cast<const sal_Char*>(aBuffer), nBytesRead); + + if (aFileString.indexOf(aTryStr) >= 0) + pFound = rMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterExcelXML) ); + } + + return pFound; +} + static sal_Bool lcl_MayBeDBase( SvStream& rStream ) { // Look for dbf marker, see connectivity/source/inc/dbase/DTable.hxx @@ -734,7 +764,13 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream ) if( aHeader.CompareTo( "<?xml", 5 ) == COMPARE_EQUAL ) pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilter2003XML) ); else - pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterAscii) ); + { + // Detect Excel 2003 XML here only if XLS was preselected. + // The configured detection for Excel 2003 XML is still in XMLFilterDetect. + pFilter = lcl_DetectExcelXML( rStr, aMatcher ); + if (!pFilter) + pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilterAscii) ); + } bFakeXLS = true; } else if ( pPreselectedFilter->GetName().EqualsAscii(pFilterDBase) && lcl_MayBeDBase( rStr ) ) commit f37a539b79f601e047fefee06357b5538c6c81b0 Author: Eike Rathke <er...@redhat.com> Date: Thu Nov 24 21:44:40 2011 +0100 calc67: #i117661# filterByPageDimension: don't overwrite source filter with page field selection # Original author: Niklas Nebel <n...@openoffice.org> * found as LGPLv3-only fix at svn rev 1167326 (http://svn.apache.org/viewvc?view=revision&revision=1167326) diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx index 0519bd2..79986f7 100644 --- a/sc/inc/dptabsrc.hxx +++ b/sc/inc/dptabsrc.hxx @@ -132,6 +132,7 @@ private: std::vector<ScDPLevel*> aColLevelList; std::vector<ScDPLevel*> aRowLevelList; sal_Bool bResultOverflow; + bool bPageFiltered; // set if page field filters have been applied to cache table SAL_WNODEPRECATED_DECLARATIONS_PUSH ::std::auto_ptr<rtl::OUString> mpGrandTotalName; diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index b0ac477..928cb86 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -139,6 +139,7 @@ ScDPSource::ScDPSource( ScDPTableData* pD ) : pColResults( NULL ), pRowResults( NULL ), bResultOverflow( false ), + bPageFiltered( false ), mpGrandTotalName(NULL) { pData->SetEmptyFlags( bIgnoreEmptyRows, bRepeatIfEmpty ); @@ -576,6 +577,7 @@ void ScDPSource::disposeData() nColDimCount = nRowDimCount = nDataDimCount = nPageDimCount = 0; pData->DisposeData(); // cached entries etc. + bPageFiltered = false; bResultOverflow = false; } @@ -728,6 +730,19 @@ void ScDPSource::GetCategoryDimensionIndices(boost::unordered_set<sal_Int32>& rC void ScDPSource::FilterCacheTableByPageDimensions() { + // #i117661# Repeated calls to ScDPCacheTable::filterByPageDimension are invalid because + // rows are only hidden, never shown again. If FilterCacheTableByPageDimensions is called + // again, the cache table must be re-initialized. Currently, CreateRes_Impl always uses + // a fresh cache because ScDBDocFunc::DataPilotUpdate calls InvalidateData. + + if (bPageFiltered) + { + DBG_ERRORFILE("tried to apply page field filters several times"); + + pData->DisposeData(); + pData->CreateCacheTable(); // re-initialize the cache table + bPageFiltered = false; + } // filter table by page dimensions. vector<ScDPCacheTable::Criterion> aCriteria; @@ -774,6 +789,7 @@ void ScDPSource::FilterCacheTableByPageDimensions() boost::unordered_set<sal_Int32> aCatDims; GetCategoryDimensionIndices(aCatDims); pData->FilterCacheTable(aCriteria, aCatDims); + bPageFiltered = true; } } _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits