From 3968b5956fca5a5faf056fbe1f7e1bbadb099269 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Thu, 17 Mar 2011 10:38:39 +0100 Subject: dr80: #i117418# compiler warning: OptValue::maValue needs to be value-initializedinc --- oox/inc/oox/helper/helper.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oox/inc/oox/helper/helper.hxx b/oox/inc/oox/helper/helper.hxx index 84c501fae2e5..d171fc08a495 100644 --- a/oox/inc/oox/helper/helper.hxx +++ b/oox/inc/oox/helper/helper.hxx @@ -198,7 +198,7 @@ template< typename Type > class OptValue { public: - inline explicit OptValue() : mbHasValue( false ) {} + inline explicit OptValue() : maValue(), mbHasValue( false ) {} inline explicit OptValue( const Type& rValue ) : maValue( rValue ), mbHasValue( true ) {} inline explicit OptValue( bool bHasValue, const Type& rValue ) : maValue( rValue ), mbHasValue( bHasValue ) {} -- cgit From a4bfeb1d20a41b2fc84c2cef6cb29f0fc08a48eb Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Fri, 18 Mar 2011 09:57:40 +0100 Subject: dr80: #i116460# performance of Excel file with many outlines --- oox/source/token/properties.txt | 1 + oox/source/xls/worksheethelper.cxx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index b0726f86657e..a99718028c7a 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -473,6 +473,7 @@ VerticalSplitMode VerticalSplitPositionTwips ViewBox Visible +VisibleFlag VisibleSize VisualArea VisualEffect diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index 48ffac388cfd..76aa8174e8b8 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -1631,7 +1631,9 @@ void WorksheetData::convertRows( OutlineLevelVec& orRowLevels, if( rModel.mbHidden ) { PropertySet aPropSet( getRows( nFirstRow, nLastRow ) ); - aPropSet.setProperty( PROP_IsVisible, false ); + // #i116460# Use VisibleFlag instead of IsVisible: directly set the flag, + // without drawing layer update etc. (only possible before shapes are inserted) + aPropSet.setProperty( PROP_VisibleFlag, false ); } // outline settings for this row range -- cgit From a02e93fa19376c196f6dbac49edeace626fc2288 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Wed, 23 Mar 2011 14:41:21 +0100 Subject: dr80: #i117511# remove some assertions in xlsx/xlsb import filters --- oox/source/drawingml/shape.cxx | 3 --- oox/source/xls/autofilterbuffer.cxx | 2 +- oox/source/xls/externallinkbuffer.cxx | 13 ++++++++-- oox/source/xls/numberformatsbuffer.cxx | 8 +++--- oox/source/xls/stylesbuffer.cxx | 46 ++++++++++++++++++---------------- 5 files changed, 42 insertions(+), 30 deletions(-) diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 61956c068deb..eac2151787df 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -180,9 +180,6 @@ void Shape::addShape( if ( xShapes.is() ) addChildren( rFilterBase, *this, pTheme, xShapes, pShapeRect ? *pShapeRect : awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ), pShapeMap ); } - Reference< document::XActionLockable > xLockable( mxShape, UNO_QUERY ); - if( xLockable.is() ) - xLockable->removeActionLock(); } catch( const Exception& ) { diff --git a/oox/source/xls/autofilterbuffer.cxx b/oox/source/xls/autofilterbuffer.cxx index 7cf359f6d3c9..bfc33e82056b 100755 --- a/oox/source/xls/autofilterbuffer.cxx +++ b/oox/source/xls/autofilterbuffer.cxx @@ -842,7 +842,7 @@ bool AutoFilterBuffer::finalizeImport( const Reference< XDatabaseRange >& rxData AutoFilter* AutoFilterBuffer::getActiveAutoFilter() { // Excel expects not more than one auto filter per sheet or table - OSL_ENSURE( maAutoFilters.size() == 1, "AutoFilterBuffer::getActiveAutoFilter - too many auto filters" ); + OSL_ENSURE( maAutoFilters.size() <= 1, "AutoFilterBuffer::getActiveAutoFilter - too many auto filters" ); // stick to the last imported auto filter return maAutoFilters.empty() ? 0 : maAutoFilters.back().get(); } diff --git a/oox/source/xls/externallinkbuffer.cxx b/oox/source/xls/externallinkbuffer.cxx index 683ac3582071..9e1bf2e0125f 100644 --- a/oox/source/xls/externallinkbuffer.cxx +++ b/oox/source/xls/externallinkbuffer.cxx @@ -683,10 +683,19 @@ ExternalLinkInfo ExternalLink::getLinkInfo() const ExternalLinkInfo aLinkInfo; switch( meLinkType ) { + case LINKTYPE_SELF: + case LINKTYPE_SAME: + case LINKTYPE_INTERNAL: + aLinkInfo.Type = ::com::sun::star::sheet::ExternalLinkType::SELF; + break; case LINKTYPE_EXTERNAL: aLinkInfo.Type = ::com::sun::star::sheet::ExternalLinkType::DOCUMENT; aLinkInfo.Data <<= maTargetUrl; break; + case LINKTYPE_LIBRARY: + // parser will return library function names in OPCODE_BAD string tokens + aLinkInfo.Type = ::com::sun::star::sheet::ExternalLinkType::SPECIAL; + break; case LINKTYPE_DDE: { aLinkInfo.Type = ::com::sun::star::sheet::ExternalLinkType::DDE; @@ -1043,8 +1052,8 @@ void ExternalLinkBuffer::importExternSheet8( BiffInputStream& rStrm ) Sequence< ExternalLinkInfo > ExternalLinkBuffer::getLinkInfos() const { ::std::vector< ExternalLinkInfo > aLinkInfos; - // should not be used for BIFF12 documents - OSL_ENSURE( (getFilterType() == FILTER_OOXML) && !mbUseRefSheets, "ExternalLinkBuffer::getLinkInfos - unexpected file format" ); + // XML formula parser also used in BIFF12 documents, e.g. replacement formulas in unsupported conditional formattings + OSL_ENSURE( getFilterType() == FILTER_OOXML, "ExternalLinkBuffer::getLinkInfos - unexpected file format" ); // add entry for implicit index 0 (self reference to this document) aLinkInfos.push_back( mxSelfRef->getLinkInfo() ); for( ExternalLinkVec::const_iterator aIt = maExtLinks.begin(), aEnd = maExtLinks.end(); aIt != aEnd; ++aIt ) diff --git a/oox/source/xls/numberformatsbuffer.cxx b/oox/source/xls/numberformatsbuffer.cxx index c77381b2a1c8..f9fd44b94ee0 100644 --- a/oox/source/xls/numberformatsbuffer.cxx +++ b/oox/source/xls/numberformatsbuffer.cxx @@ -1851,14 +1851,16 @@ sal_Int32 lclCreateFormat( const Reference< XNumberFormats >& rxNumFmts, catch( Exception& ) { // BIFF2-BIFF4 stores standard format explicitly in stream - static const OUString saGeneral = CREATE_OUSTRING( "general" ); - if( rFmtCode.equalsIgnoreAsciiCase( saGeneral ) ) + if( rFmtCode.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "general" ) ) ) { nIndex = lclCreatePredefinedFormat( rxNumFmts, 0, rToLocale ); } else { - OSL_ENSURE( false, + // do not assert fractional number formats with fixed denominator + OSL_ENSURE( rFmtCode.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "#\\ ?/" ) ) || + rFmtCode.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "#\\ ?\?/" ) ) || + rFmtCode.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "#\\ ?\?\?/" ) ), OStringBuffer( "lclCreateFormat - cannot create number format '" ). append( OUStringToOString( rFmtCode, osl_getThreadTextEncoding() ) ). append( '\'' ).getStr() ); diff --git a/oox/source/xls/stylesbuffer.cxx b/oox/source/xls/stylesbuffer.cxx index 56c26d8b9f67..4733091802d4 100644 --- a/oox/source/xls/stylesbuffer.cxx +++ b/oox/source/xls/stylesbuffer.cxx @@ -2677,9 +2677,9 @@ const sal_Char* const sppcStyleNames[] = "Followed Hyperlink", "Note", // new in OOX "Warning Text", - "", - "", - "", + 0, + 0, + 0, "Title", "Heading 1", "Heading 2", @@ -2727,7 +2727,7 @@ OUString lclGetBuiltinStyleName( sal_Int32 nBuiltinId, const OUString& rName, sa OSL_ENSURE( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount), "lclGetBuiltinStyleName - unknown built-in style" ); OUStringBuffer aStyleName; aStyleName.appendAscii( spcStyleNamePrefix ); - if( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount) && (sppcStyleNames[ nBuiltinId ][ 0 ] != 0) ) + if( (0 <= nBuiltinId) && (nBuiltinId < snStyleNamesCount) && (sppcStyleNames[ nBuiltinId ] != 0) ) aStyleName.appendAscii( sppcStyleNames[ nBuiltinId ] ); else if( rName.getLength() > 0 ) aStyleName.append( rName ); @@ -2738,11 +2738,9 @@ OUString lclGetBuiltinStyleName( sal_Int32 nBuiltinId, const OUString& rName, sa return aStyleName.makeStringAndClear(); } -OUString lclGetBuiltInStyleName( const OUString& rName ) +OUString lclCreateStyleName( const CellStyleModel& rModel ) { - OUStringBuffer aStyleName; - aStyleName.appendAscii( spcStyleNamePrefix ).append( rName ); - return aStyleName.makeStringAndClear(); + return rModel.mbBuiltin ? lclGetBuiltinStyleName( rModel.mnBuiltinId, rModel.maName, rModel.mnLevel ) : rModel.maName; } bool lclIsBuiltinStyleName( const OUString& rStyleName, sal_Int32* pnBuiltinId, sal_Int32* pnNextChar ) @@ -2757,12 +2755,15 @@ bool lclIsBuiltinStyleName( const OUString& rStyleName, sal_Int32* pnBuiltinId, OUString aShortName; for( sal_Int32 nId = 0; nId < snStyleNamesCount; ++nId ) { - aShortName = OUString::createFromAscii( sppcStyleNames[ nId ] ); - if( rStyleName.matchIgnoreAsciiCase( aShortName, nPrefixLen ) && - (nNextChar < nPrefixLen + aShortName.getLength()) ) + if( sppcStyleNames[ nId ] != 0 ) { - nFoundId = nId; - nNextChar = nPrefixLen + aShortName.getLength(); + aShortName = OUString::createFromAscii( sppcStyleNames[ nId ] ); + if( rStyleName.matchIgnoreAsciiCase( aShortName, nPrefixLen ) && + (nNextChar < nPrefixLen + aShortName.getLength()) ) + { + nFoundId = nId; + nNextChar = nPrefixLen + aShortName.getLength(); + } } } } @@ -3008,10 +3009,11 @@ void CellStyleBuffer::finalizeImport() for( CellStyleVector::iterator aIt = maBuiltinStyles.begin(), aEnd = maBuiltinStyles.end(); aIt != aEnd; ++aIt ) { const CellStyleModel& rModel = (*aIt)->getModel(); - OUString aStyleName = lclGetBuiltinStyleName( rModel.mnBuiltinId, rModel.maName, rModel.mnLevel ); - OSL_ENSURE( bReserveAll || (aCellStyles.count( aStyleName ) == 0), - "CellStyleBuffer::finalizeImport - multiple styles with equal built-in identifier" ); - if( aCellStyles.count( aStyleName ) > 0 ) + OUString aStyleName = lclCreateStyleName( rModel ); + /* If a builtin style entry already exists, and we do not reserve all + existing styles, we just stick with the last definition and ignore + the preceding ones. */ + if( bReserveAll && (aCellStyles.count( aStyleName ) > 0) ) aConflictNameStyles.push_back( *aIt ); else aCellStyles[ aStyleName ] = *aIt; @@ -3022,13 +3024,14 @@ void CellStyleBuffer::finalizeImport() for( CellStyleVector::iterator aIt = maUserStyles.begin(), aEnd = maUserStyles.end(); aIt != aEnd; ++aIt ) { const CellStyleModel& rModel = (*aIt)->getModel(); + OUString aStyleName = lclCreateStyleName( rModel ); // #i1624# #i1768# ignore unnamed user styles - if( rModel.maName.getLength() > 0 ) + if( aStyleName.getLength() > 0 ) { - if( aCellStyles.count( rModel.maName ) > 0 ) + if( aCellStyles.count( aStyleName ) > 0 ) aConflictNameStyles.push_back( *aIt ); else - aCellStyles[ rModel.maName ] = *aIt; + aCellStyles[ aStyleName ] = *aIt; } } @@ -3036,11 +3039,12 @@ void CellStyleBuffer::finalizeImport() for( CellStyleVector::iterator aIt = aConflictNameStyles.begin(), aEnd = aConflictNameStyles.end(); aIt != aEnd; ++aIt ) { const CellStyleModel& rModel = (*aIt)->getModel(); + OUString aStyleName = lclCreateStyleName( rModel ); OUString aUnusedName; sal_Int32 nIndex = 0; do { - aUnusedName = OUStringBuffer( rModel.maName ).append( sal_Unicode( ' ' ) ).append( ++nIndex ).makeStringAndClear(); + aUnusedName = OUStringBuffer( aStyleName ).append( sal_Unicode( ' ' ) ).append( ++nIndex ).makeStringAndClear(); } while( aCellStyles.count( aUnusedName ) > 0 ); aCellStyles[ aUnusedName ] = *aIt; -- cgit From 45842b3d9f84bae6276e2b84264fc1a94b72eee4 Mon Sep 17 00:00:00 2001 From: "Daniel Rentz [dr]" Date: Fri, 1 Apr 2011 15:33:17 +0200 Subject: dr80: #i117511# removed one more assertion --- oox/source/xls/formulabase.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oox/source/xls/formulabase.cxx b/oox/source/xls/formulabase.cxx index 25398f9aa133..366e4a0dbde7 100755 --- a/oox/source/xls/formulabase.cxx +++ b/oox/source/xls/formulabase.cxx @@ -1283,7 +1283,7 @@ bool OpCodeProviderImpl::initFuncOpCodes( const ApiTokenMap& rIntFuncTokenMap, c // set API opcode from ODF function name bIsValid &= initFuncOpCode( *xFuncInfo, xFuncInfo->mbExternal ? rExtFuncTokenMap : rIntFuncTokenMap ); // insert the function info into the maps - if( xFuncInfo->mnApiOpCode != OPCODE_NONAME ) + if( (xFuncInfo->mnApiOpCode != OPCODE_NONAME) && (xFuncInfo->mnApiOpCode != OPCODE_BAD) ) { if( (xFuncInfo->mnApiOpCode == OPCODE_EXTERNAL) && (xFuncInfo->maExtProgName.getLength() > 0) ) maExtProgFuncs[ xFuncInfo->maExtProgName ] = xFuncInfo; -- cgit