diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-05-23 15:25:26 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-05-23 15:25:26 +0200 |
commit | b6f723660177e50250058159e96436a25bb925dc (patch) | |
tree | 0b4ebb7a82c0b936e5594aa1a30db6b75fc5ebfd /oox/source/xls | |
parent | a41acbe3896fef5cb07e10611144ae7af3f59874 (diff) |
oox builds again after the m106 merge.
Diffstat (limited to 'oox/source/xls')
-rwxr-xr-x | oox/source/xls/drawingbase.cxx | 3 | ||||
-rw-r--r-- | oox/source/xls/drawingfragment.cxx | 103 | ||||
-rw-r--r-- | oox/source/xls/richstring.cxx | 11 | ||||
-rw-r--r-- | oox/source/xls/sheetdatacontext.cxx | 52 | ||||
-rw-r--r-- | oox/source/xls/worksheethelper.cxx | 71 |
5 files changed, 7 insertions, 233 deletions
diff --git a/oox/source/xls/drawingbase.cxx b/oox/source/xls/drawingbase.cxx index fc2ab64059c8..555ce91c966b 100755 --- a/oox/source/xls/drawingbase.cxx +++ b/oox/source/xls/drawingbase.cxx @@ -168,8 +168,7 @@ void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, cons void ShapeAnchor::importVmlAnchor( const OUString& rAnchor ) { - meAnchorType = ANCHOR_TWOCELL; /// VML uses two-cell anchors only - meCellAnchorType = CELLANCHOR_PIXEL; /// VML uses screen pixels for offset values + meAnchorType = ANCHOR_VML; ::std::vector< OUString > aTokens; sal_Int32 nIndex = 0; diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx index c048a3e7d60d..2dd693c7bf67 100644 --- a/oox/source/xls/drawingfragment.cxx +++ b/oox/source/xls/drawingfragment.cxx @@ -86,111 +86,8 @@ sal_Int64 lclCalcEmu( const UnitConverter& rUnitConv, sal_Int64 nValue, Unit eFr } // namespace -// ---------------------------------------------------------------------------- - -AnchorClientDataModel::AnchorClientDataModel() : - mbLocksWithSheet( true ), - mbPrintsWithSheet( true ) -{ -} - // ============================================================================ -ShapeAnchor::ShapeAnchor( const WorksheetHelper& rHelper ) : - WorksheetHelper( rHelper ), - meAnchorType( ANCHOR_INVALID ), - mnEditAs( XML_twoCell ) -{ -} - -void ShapeAnchor::importAnchor( sal_Int32 nElement, const AttributeList& rAttribs ) -{ - switch( nElement ) - { - case XDR_TOKEN( absoluteAnchor ): - meAnchorType = ANCHOR_ABSOLUTE; - break; - case XDR_TOKEN( oneCellAnchor ): - meAnchorType = ANCHOR_ONECELL; - break; - case XDR_TOKEN( twoCellAnchor ): - meAnchorType = ANCHOR_TWOCELL; - mnEditAs = rAttribs.getToken( XML_editAs, XML_twoCell ); - break; - default: - OSL_FAIL( "ShapeAnchor::importAnchor - unexpected element" ); - } -} - -void ShapeAnchor::importPos( const AttributeList& rAttribs ) -{ - OSL_ENSURE( meAnchorType == ANCHOR_ABSOLUTE, "ShapeAnchor::importPos - unexpected 'xdr:pos' element" ); - maPos.X = rAttribs.getHyper( XML_x, 0 ); - maPos.Y = rAttribs.getHyper( XML_y, 0 ); -} - -void ShapeAnchor::importExt( const AttributeList& rAttribs ) -{ - OSL_ENSURE( (meAnchorType == ANCHOR_ABSOLUTE) || (meAnchorType == ANCHOR_ONECELL), "ShapeAnchor::importExt - unexpected 'xdr:ext' element" ); - maSize.Width = rAttribs.getHyper( XML_cx, 0 ); - maSize.Height = rAttribs.getHyper( XML_cy, 0 ); -} - -void ShapeAnchor::importClientData( const AttributeList& rAttribs ) -{ - maClientData.mbLocksWithSheet = rAttribs.getBool( XML_fLocksWithSheet, true ); - maClientData.mbPrintsWithSheet = rAttribs.getBool( XML_fPrintsWithSheet, true ); -} - -void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue ) -{ - CellAnchorModel* pAnchorCell = 0; - switch( nParentContext ) - { - case XDR_TOKEN( from ): - OSL_ENSURE( (meAnchorType == ANCHOR_ONECELL) || (meAnchorType == ANCHOR_TWOCELL), "ShapeAnchor::setCellPos - unexpected 'xdr:from' element" ); - pAnchorCell = &maFrom; - break; - case XDR_TOKEN( to ): - OSL_ENSURE( meAnchorType == ANCHOR_TWOCELL, "ShapeAnchor::setCellPos - unexpected 'xdr:to' element" ); - pAnchorCell = &maTo; - break; - default: - OSL_FAIL( "ShapeAnchor::setCellPos - unexpected parent element" ); - } - if( pAnchorCell ) switch( nElement ) - { - case XDR_TOKEN( col ): pAnchorCell->mnCol = rValue.toInt32(); break; - case XDR_TOKEN( row ): pAnchorCell->mnRow = rValue.toInt32(); break; - case XDR_TOKEN( colOff ): pAnchorCell->mnColOffset = rValue.toInt64(); break; - case XDR_TOKEN( rowOff ): pAnchorCell->mnRowOffset = rValue.toInt64(); break; - default: OSL_FAIL( "ShapeAnchor::setCellPos - unexpected element" ); - } -} - -void ShapeAnchor::importVmlAnchor( const OUString& rAnchor ) -{ - meAnchorType = ANCHOR_VML; - - ::std::vector< OUString > aTokens; - sal_Int32 nIndex = 0; - while( nIndex >= 0 ) - aTokens.push_back( rAnchor.getToken( 0, ',', nIndex ).trim() ); - - OSL_ENSURE( aTokens.size() >= 8, "ShapeAnchor::importVmlAnchor - missing anchor tokens" ); - if( aTokens.size() >= 8 ) - { - maFrom.mnCol = aTokens[ 0 ].toInt32(); - maFrom.mnColOffset = aTokens[ 1 ].toInt32(); - maFrom.mnRow = aTokens[ 2 ].toInt32(); - maFrom.mnRowOffset = aTokens[ 3 ].toInt32(); - maTo.mnCol = aTokens[ 4 ].toInt32(); - maTo.mnColOffset = aTokens[ 5 ].toInt32(); - maTo.mnRow = aTokens[ 6 ].toInt32(); - maTo.mnRowOffset = aTokens[ 7 ].toInt32(); - } -} - // ============================================================================ ShapeMacroAttacher::ShapeMacroAttacher( const OUString& rMacroName, const Reference< XShape >& rxShape ) : diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx index 132eab6339af..6a2bbd9eab1a 100644 --- a/oox/source/xls/richstring.cxx +++ b/oox/source/xls/richstring.cxx @@ -120,18 +120,15 @@ void RichStringPortion::convert( const Reference< XText >& rxText, const Font* p } } -void RichStringPortion::writeFontProperties( const Reference<XText>& rxText, sal_Int32 nXfId ) const +void RichStringPortion::writeFontProperties( const Reference<XText>& rxText, const Font* pFont ) const { PropertySet aPropSet(rxText); if (mxFont.get()) mxFont->writeToPropertySet(aPropSet, FONT_PROPTYPE_TEXT); - if (const Font* pFont = getStyles().getFontFromCellXf(nXfId).get()) - { - if (pFont->needsRichTextFormat()) - pFont->writeToPropertySet(aPropSet, FONT_PROPTYPE_TEXT); - } + if (lclNeedsRichTextFormat(pFont)) + pFont->writeToPropertySet(aPropSet, FONT_PROPTYPE_TEXT); } // ---------------------------------------------------------------------------- @@ -550,7 +547,7 @@ void RichString::convert( const Reference< XText >& rxText, const Font* pFirstPo // It's much faster this way. RichStringPortion& rPtn = *maTextPortions.front(); rxText->setString(rPtn.getText()); - rPtn.writeFontProperties(rxText, nXfId); + rPtn.writeFontProperties(rxText, pFirstPortionFont); return; } diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx index 045596e9fac9..569126e0ebad 100644 --- a/oox/source/xls/sheetdatacontext.cxx +++ b/oox/source/xls/sheetdatacontext.cxx @@ -163,56 +163,8 @@ void SheetDataContext::onCharacters( const OUString& rChars ) maCellValue = rChars; break; case XLS_TOKEN( f ): - if( maCurrCell.mxCell.is() ) try - { - switch( maCurrCell.mnFormulaType ) - { - case XML_normal: - if( rChars.getLength() > 0 ) - { - Reference< XFormulaTokens > xTokens( maCurrCell.mxCell, UNO_QUERY_THROW ); - CellFormulaContext aContext( xTokens, maCurrCell.maAddress ); - getFormulaParser().importFormula( aContext, rChars ); - } - break; - - case XML_array: - if( (maCurrCell.maFormulaRef.getLength() > 0) && (rChars.getLength() > 0) ) - { - CellRangeAddress aArrayRange; - Reference< XArrayFormulaTokens > xTokens( getCellRange( maCurrCell.maFormulaRef, &aArrayRange ), UNO_QUERY_THROW ); - ArrayFormulaContext aContext( xTokens, aArrayRange ); - getFormulaParser().importFormula( aContext, rChars ); - } - break; - - case XML_shared: - if( maCurrCell.mnSharedId >= 0 ) - { - if( rChars.getLength() > 0 ) - getSharedFormulas().importSharedFmla( rChars, maCurrCell.maFormulaRef, maCurrCell.mnSharedId, maCurrCell.maAddress ); - Reference< XFormulaTokens > xTokens( maCurrCell.mxCell, UNO_QUERY_THROW ); - ExtCellFormulaContext aContext( *this, xTokens, maCurrCell.maAddress ); - getSharedFormulas().setSharedFormulaCell( aContext, maCurrCell.mnSharedId ); - } - break; - - case XML_dataTable: - if( maCurrCell.maFormulaRef.getLength() > 0 ) - { - CellRangeAddress aTableRange; - if( getAddressConverter().convertToCellRange( aTableRange, maCurrCell.maFormulaRef, getSheetIndex(), true, true ) ) - setTableOperation( aTableRange, maTableData ); - } - break; - - default: - OSL_FAIL( "SheetDataContext::onEndElement - unknown formula type" ); - } - } - catch( Exception& ) - { - } + if( maFmlaData.mnFormulaType != XML_TOKEN_INVALID ) + maTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, rChars ); break; } } diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index 921cfeb893c3..068c89cde2d9 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -109,77 +109,6 @@ void lclUpdateProgressBar( const ISegmentProgressBarRef& rxProgressBar, double f rxProgressBar->setPosition( fPosition ); } -// ---------------------------------------------------------------------------- - -struct ValueRange -{ - sal_Int32 mnFirst; - sal_Int32 mnLast; - - inline explicit ValueRange( sal_Int32 nValue ) : mnFirst( nValue ), mnLast( nValue ) {} - inline explicit ValueRange( sal_Int32 nFirst, sal_Int32 nLast ) : mnFirst( nFirst ), mnLast( nLast ) {} -}; - -typedef ::std::vector< ValueRange > ValueRangeVector; - -// ---------------------------------------------------------------------------- - -struct ValueRangeComp -{ - inline bool operator()( const ValueRange& rRange, sal_Int32 nValue ) const { return rRange.mnLast < nValue; } -}; - - -// ---------------------------------------------------------------------------- - -class ValueRangeSet -{ -public: - inline explicit ValueRangeSet() {} - - void insert( sal_Int32 nValue ); - void intersect( ValueRangeVector& orRanges, sal_Int32 nFirst, sal_Int32 nLast ) const; - -private: - ValueRangeVector maData; -}; - -void ValueRangeSet::insert( sal_Int32 nValue ) -{ - // find the first range that contains nValue or that follows nValue - ValueRangeVector::iterator aBeg = maData.begin(); - ValueRangeVector::iterator aEnd = maData.end(); - ValueRangeVector::iterator aNext = ::std::lower_bound( aBeg, aEnd, nValue, ValueRangeComp() ); - - // nothing to do if found range contains nValue - if( (aNext == aEnd) || (nValue < aNext->mnFirst) ) - { - ValueRangeVector::iterator aPrev = (aNext == aBeg) ? aEnd : (aNext - 1); - bool bJoinPrev = (aPrev != aEnd) && (aPrev->mnLast + 1 == nValue); - bool bJoinNext = (aNext != aEnd) && (aNext->mnFirst - 1 == nValue); - if( bJoinPrev && bJoinNext ) - { - aPrev->mnLast = aNext->mnLast; - maData.erase( aNext ); - } - else if( bJoinPrev ) - ++aPrev->mnLast; - else if( bJoinNext ) - --aNext->mnFirst; - else - maData.insert( aNext, ValueRange( nValue ) ); - } -} - -void ValueRangeSet::intersect( ValueRangeVector& orRanges, sal_Int32 nFirst, sal_Int32 nLast ) const -{ - orRanges.clear(); - // find the range that contains nFirst or the first range that follows nFirst - ValueRangeVector::const_iterator aIt = ::std::lower_bound( maData.begin(), maData.end(), nFirst, ValueRangeComp() ); - for( ValueRangeVector::const_iterator aEnd = maData.end(); (aIt != aEnd) && (aIt->mnFirst <= nLast); ++aIt ) - orRanges.push_back( ValueRange( ::std::max( aIt->mnFirst, nFirst ), ::std::min( aIt->mnLast, nLast ) ) ); -} - } // namespace // ============================================================================ |