diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-05-13 23:04:53 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-05-13 23:04:53 +0200 |
commit | a41acbe3896fef5cb07e10611144ae7af3f59874 (patch) | |
tree | e329ab032c96725ab989b325a1dc05ce3fda4afc /oox | |
parent | Make SVG export filter building again. (diff) | |
download | core-a41acbe3896fef5cb07e10611144ae7af3f59874.tar.gz core-a41acbe3896fef5cb07e10611144ae7af3f59874.zip |
Making oox to build - work in progress.
Diffstat (limited to 'oox')
-rwxr-xr-x | oox/inc/oox/xls/drawingbase.hxx | 3 | ||||
-rw-r--r-- | oox/source/ole/vbacontrol.cxx | 2 | ||||
-rw-r--r-- | oox/source/vml/vmlinputstream.cxx | 4 | ||||
-rw-r--r-- | oox/source/xls/commentsbuffer.cxx | 15 | ||||
-rw-r--r-- | oox/source/xls/drawingfragment.cxx | 240 | ||||
-rw-r--r-- | oox/source/xls/formulaparser.cxx | 6 | ||||
-rw-r--r-- | oox/source/xls/richstring.cxx | 4 |
7 files changed, 15 insertions, 259 deletions
diff --git a/oox/inc/oox/xls/drawingbase.hxx b/oox/inc/oox/xls/drawingbase.hxx index 01bf43a6434f..61d60ad7534b 100755 --- a/oox/inc/oox/xls/drawingbase.hxx +++ b/oox/inc/oox/xls/drawingbase.hxx @@ -118,7 +118,8 @@ private: ANCHOR_INVALID, /// Anchor type is unknown. ANCHOR_ABSOLUTE, /// Absolute anchor (top-left corner and size in absolute units). ANCHOR_ONECELL, /// One-cell anchor (top-left corner at cell, size in absolute units). - ANCHOR_TWOCELL /// Two-cell anchor (top-left and bottom-right corner at cell). + ANCHOR_TWOCELL, /// Two-cell anchor (top-left and bottom-right corner at cell). + ANCHOR_VML }; /** Specifies how cell positions from CellAnchorModel have to be processed. */ diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 909010f8aec6..fc750ca53821 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -876,7 +876,7 @@ void VbaUserForm::importForm( if( convertProperties( xDialogModel, maConverter, 0 ) ) { // export the dialog to XML and insert it into the dialog library - Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, mxCompContext, rxDocModel ), UNO_SET_THROW ); + Reference< XInputStreamProvider > xDialogSource( ::xmlscript::exportDialogModel( xDialogNC, mxContext, rxDocModel ), UNO_SET_THROW ); OSL_ENSURE( !rxDialogLib->hasByName( aFormName ), "VbaUserForm::importForm - multiple dialogs with equal name" ); ContainerHelper::insertByName( rxDialogLib, aFormName, Any( xDialogSource ) ); } diff --git a/oox/source/vml/vmlinputstream.cxx b/oox/source/vml/vmlinputstream.cxx index 4202ffd193fe..bec1654b2097 100644 --- a/oox/source/vml/vmlinputstream.cxx +++ b/oox/source/vml/vmlinputstream.cxx @@ -377,10 +377,6 @@ void InputStream::updateBuffer() throw (IOException, RuntimeException) // no CDATA part - process the contents of the element lclProcessElement( aBuffer, aElement ); } - else - { - pcCurr = pcEnd; - } } maBuffer = aBuffer.makeStringAndClear(); diff --git a/oox/source/xls/commentsbuffer.cxx b/oox/source/xls/commentsbuffer.cxx index 0b143686775c..06a77df7685d 100644 --- a/oox/source/xls/commentsbuffer.cxx +++ b/oox/source/xls/commentsbuffer.cxx @@ -251,21 +251,7 @@ void Comment::finalizeImport() switch( getFilterType() ) { case FILTER_OOXML: - if( const ::oox::vml::ShapeBase* pNoteShape = getVmlDrawing().getNoteShape( aNotePos ) ) { - Reference< XSheetAnnotationsSupplier > xAnnosSupp( getSheet(), UNO_QUERY_THROW ); - Reference< XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), UNO_SET_THROW ); - xAnnos->insertNew( aNotePos, aNoteText ); - // receive craeted note from cell (insertNew does not return the note) - Reference< XSheetAnnotationAnchor > xAnnoAnchor( getCell( aNotePos ), UNO_QUERY_THROW ); - Reference< XSheetAnnotation > xAnno( xAnnoAnchor->getAnnotation(), UNO_SET_THROW ); - Reference< XSheetAnnotationShapeSupplier > xAnnoShapeSupp( xAnno, UNO_QUERY_THROW ); - Reference< XShape > xAnnoShape( xAnnoShapeSupp->getAnnotationShape(), UNO_SET_THROW ); - Reference <XText> xText( xAnnoShape, UNO_QUERY_THROW ); - Reference <XTextRange> xTextRange( xText, UNO_QUERY_THROW ); - xTextRange->setString( OUString() ); // Clear contents - maModel.mxText->convert( xText, -1 ); - // Add shape formatting properties (autoFill, colHidden and rowHidden are dropped) PropertySet aCommentPr( xAnnoShape ); aCommentPr.setProperty( PROP_TextFitToSize, maModel.mbAutoScale ); @@ -278,7 +264,6 @@ void Comment::finalizeImport() xAnnoShape->setSize( Size( maModel.maAnchor.Width, maModel.maAnchor.Height ) ); } - // convert shape formatting if( const ::oox::vml::ShapeBase* pNoteShape = getVmlDrawing().getNoteShape( aNotePos ) ) { diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx index ffd77155dc5f..c048a3e7d60d 100644 --- a/oox/source/xls/drawingfragment.cxx +++ b/oox/source/xls/drawingfragment.cxx @@ -86,16 +86,6 @@ sal_Int64 lclCalcEmu( const UnitConverter& rUnitConv, sal_Int64 nValue, Unit eFr } // namespace -// ============================================================================ - -AnchorCellModel::AnchorCellModel() : - mnCol( -1 ), - mnRow( -1 ), - mnColOffset( 0 ), - mnRowOffset( 0 ) -{ -} - // ---------------------------------------------------------------------------- AnchorClientDataModel::AnchorClientDataModel() : @@ -108,7 +98,7 @@ AnchorClientDataModel::AnchorClientDataModel() : ShapeAnchor::ShapeAnchor( const WorksheetHelper& rHelper ) : WorksheetHelper( rHelper ), - meType( ANCHOR_INVALID ), + meAnchorType( ANCHOR_INVALID ), mnEditAs( XML_twoCell ) { } @@ -118,13 +108,13 @@ void ShapeAnchor::importAnchor( sal_Int32 nElement, const AttributeList& rAttrib switch( nElement ) { case XDR_TOKEN( absoluteAnchor ): - meType = ANCHOR_ABSOLUTE; + meAnchorType = ANCHOR_ABSOLUTE; break; case XDR_TOKEN( oneCellAnchor ): - meType = ANCHOR_ONECELL; + meAnchorType = ANCHOR_ONECELL; break; case XDR_TOKEN( twoCellAnchor ): - meType = ANCHOR_TWOCELL; + meAnchorType = ANCHOR_TWOCELL; mnEditAs = rAttribs.getToken( XML_editAs, XML_twoCell ); break; default: @@ -134,14 +124,14 @@ void ShapeAnchor::importAnchor( sal_Int32 nElement, const AttributeList& rAttrib void ShapeAnchor::importPos( const AttributeList& rAttribs ) { - OSL_ENSURE( meType == ANCHOR_ABSOLUTE, "ShapeAnchor::importPos - unexpected 'xdr:pos' element" ); + 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( (meType == ANCHOR_ABSOLUTE) || (meType == ANCHOR_ONECELL), "ShapeAnchor::importExt - unexpected 'xdr:ext' element" ); + 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 ); } @@ -154,15 +144,15 @@ void ShapeAnchor::importClientData( const AttributeList& rAttribs ) void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue ) { - AnchorCellModel* pAnchorCell = 0; + CellAnchorModel* pAnchorCell = 0; switch( nParentContext ) { case XDR_TOKEN( from ): - OSL_ENSURE( (meType == ANCHOR_ONECELL) || (meType == ANCHOR_TWOCELL), "ShapeAnchor::setCellPos - unexpected 'xdr:from' element" ); + OSL_ENSURE( (meAnchorType == ANCHOR_ONECELL) || (meAnchorType == ANCHOR_TWOCELL), "ShapeAnchor::setCellPos - unexpected 'xdr:from' element" ); pAnchorCell = &maFrom; break; case XDR_TOKEN( to ): - OSL_ENSURE( meType == ANCHOR_TWOCELL, "ShapeAnchor::setCellPos - unexpected 'xdr:to' element" ); + OSL_ENSURE( meAnchorType == ANCHOR_TWOCELL, "ShapeAnchor::setCellPos - unexpected 'xdr:to' element" ); pAnchorCell = &maTo; break; default: @@ -180,7 +170,7 @@ void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, cons void ShapeAnchor::importVmlAnchor( const OUString& rAnchor ) { - meType = ANCHOR_VML; + meAnchorType = ANCHOR_VML; ::std::vector< OUString > aTokens; sal_Int32 nIndex = 0; @@ -201,216 +191,6 @@ void ShapeAnchor::importVmlAnchor( const OUString& rAnchor ) } } -bool ShapeAnchor::isValidAnchor() const -{ - bool bValid = false; - switch( meType ) - { - case ANCHOR_ABSOLUTE: - OSL_ENSURE( maPos.isValid(), "ShapeAnchor::isValidAnchor - invalid position" ); - OSL_ENSURE( maSize.isValid(), "ShapeAnchor::isValidAnchor - invalid size" ); - bValid = maPos.isValid() && maSize.isValid() && (maSize.Width > 0) && (maSize.Height > 0); - break; - case ANCHOR_ONECELL: - OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::isValidAnchor - invalid from position" ); - OSL_ENSURE( maSize.isValid(), "ShapeAnchor::isValidAnchor - invalid size" ); - bValid = maFrom.isValid() && maSize.isValid() && (maSize.Width > 0) && (maSize.Height > 0); - break; - case ANCHOR_TWOCELL: - case ANCHOR_VML: - OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::isValidAnchor - invalid from position" ); - OSL_ENSURE( maTo.isValid(), "ShapeAnchor::isValidAnchor - invalid to position" ); - bValid = maFrom.isValid() && maTo.isValid() && - ((maFrom.mnCol < maTo.mnCol) || ((maFrom.mnCol == maTo.mnCol) && (maFrom.mnColOffset < maTo.mnColOffset))) && - ((maFrom.mnRow < maTo.mnRow) || ((maFrom.mnRow == maTo.mnRow) && (maFrom.mnRowOffset < maTo.mnRowOffset))); - break; - case ANCHOR_INVALID: - OSL_FAIL( "ShapeAnchor::isValidAnchor - invalid anchor" ); - break; - } - return bValid; -} - -Rectangle ShapeAnchor::calcApiLocation( const Size& rApiSheetSize, const AnchorSizeModel& rEmuSheetSize ) const -{ - AddressConverter& rAddrConv = getAddressConverter(); - UnitConverter& rUnitConv = getUnitConverter(); - Rectangle aApiLoc( -1, -1, -1, -1 ); - Unit eUnitX = (meType == ANCHOR_VML) ? UNIT_SCREENX : UNIT_EMU; - Unit eUnitY = (meType == ANCHOR_VML) ? UNIT_SCREENY : UNIT_EMU; - - // calculate shape position - switch( meType ) - { - case ANCHOR_ABSOLUTE: - OSL_ENSURE( maPos.isValid(), "ShapeAnchor::calcApiLocation - invalid position" ); - if( maPos.isValid() && (maPos.X < rEmuSheetSize.Width) && (maPos.Y < rEmuSheetSize.Height) ) - { - aApiLoc.X = rUnitConv.scaleToMm100( static_cast< double >( maPos.X ), UNIT_EMU ); - aApiLoc.Y = rUnitConv.scaleToMm100( static_cast< double >( maPos.Y ), UNIT_EMU ); - } - break; - case ANCHOR_ONECELL: - case ANCHOR_TWOCELL: - case ANCHOR_VML: - OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::calcApiLocation - invalid position" ); - if( maFrom.isValid() && rAddrConv.checkCol( maFrom.mnCol, true ) && rAddrConv.checkRow( maFrom.mnRow, true ) ) - { - Point aPoint = getCellPosition( maFrom.mnCol, maFrom.mnRow ); - aApiLoc.X = aPoint.X + rUnitConv.scaleToMm100( static_cast< double >( maFrom.mnColOffset ), eUnitX ); - aApiLoc.Y = aPoint.Y + rUnitConv.scaleToMm100( static_cast< double >( maFrom.mnRowOffset ), eUnitY ); - } - break; - case ANCHOR_INVALID: - OSL_FAIL( "ShapeAnchor::calcApiLocation - invalid anchor" ); - break; - } - - // calculate shape size - if( (aApiLoc.X >= 0) && (aApiLoc.Y >= 0) ) switch( meType ) - { - case ANCHOR_ABSOLUTE: - case ANCHOR_ONECELL: - OSL_ENSURE( maSize.isValid(), "ShapeAnchor::calcApiLocation - invalid size" ); - if( maSize.isValid() ) - { - aApiLoc.Width = ::std::min< sal_Int32 >( - rUnitConv.scaleToMm100( static_cast< double >( maSize.Width ), UNIT_EMU ), - rApiSheetSize.Width - aApiLoc.X ); - aApiLoc.Height = ::std::min< sal_Int32 >( - rUnitConv.scaleToMm100( static_cast< double >( maSize.Height ), UNIT_EMU ), - rApiSheetSize.Height - aApiLoc.Y ); - } - break; - case ANCHOR_TWOCELL: - case ANCHOR_VML: - OSL_ENSURE( maTo.isValid(), "ShapeAnchor::calcApiLocation - invalid position" ); - if( maTo.isValid() ) - { - /* Pass a valid cell address to getCellPosition(), otherwise - nothing is returned, even if either row or column is valid. */ - CellAddress aToCell = rAddrConv.createValidCellAddress( BinAddress( maTo.mnCol, maTo.mnRow ), getSheetIndex(), true ); - Point aPoint = getCellPosition( aToCell.Column, aToCell.Row ); - // width - aApiLoc.Width = rApiSheetSize.Width - aApiLoc.X; - if( aToCell.Column == maTo.mnCol ) - { - aPoint.X += rUnitConv.scaleToMm100( static_cast< double >( maTo.mnColOffset ), eUnitX ); - aApiLoc.Width = ::std::min< sal_Int32 >( aPoint.X - aApiLoc.X + 1, aApiLoc.Width ); - } - // height - aApiLoc.Height = rApiSheetSize.Height - aApiLoc.Y; - if( aToCell.Row == maTo.mnRow ) - { - aPoint.Y += rUnitConv.scaleToMm100( static_cast< double >( maTo.mnRowOffset ), eUnitY ); - aApiLoc.Height = ::std::min< sal_Int32 >( aPoint.Y - aApiLoc.Y + 1, aApiLoc.Height ); - } - } - break; - case ANCHOR_INVALID: - break; - } - - return aApiLoc; -} - -Rectangle ShapeAnchor::calcEmuLocation( const AnchorSizeModel& rEmuSheetSize ) const -{ - AddressConverter& rAddrConv = getAddressConverter(); - UnitConverter& rUnitConv = getUnitConverter(); - - Size aSheetSize( - getLimitedValue< sal_Int32, sal_Int64 >( rEmuSheetSize.Width, 0, SAL_MAX_INT32 ), - getLimitedValue< sal_Int32, sal_Int64 >( rEmuSheetSize.Height, 0, SAL_MAX_INT32 ) ); - Rectangle aLoc( -1, -1, -1, -1 ); - Unit eUnitX = (meType == ANCHOR_VML) ? UNIT_SCREENX : UNIT_EMU; - Unit eUnitY = (meType == ANCHOR_VML) ? UNIT_SCREENY : UNIT_EMU; - - // calculate shape position - switch( meType ) - { - case ANCHOR_ABSOLUTE: - OSL_ENSURE( maPos.isValid(), "ShapeAnchor::calcEmuLocation - invalid position" ); - if( maPos.isValid() && (maPos.X < aSheetSize.Width) && (maPos.Y < aSheetSize.Height) ) - { - aLoc.X = static_cast< sal_Int32 >( maPos.X ); - aLoc.Y = static_cast< sal_Int32 >( maPos.Y ); - } - break; - case ANCHOR_ONECELL: - case ANCHOR_TWOCELL: - case ANCHOR_VML: - OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::calcEmuLocation - invalid position" ); - if( maFrom.isValid() && rAddrConv.checkCol( maFrom.mnCol, true ) && rAddrConv.checkRow( maFrom.mnRow, true ) ) - { - Point aPoint = getCellPosition( maFrom.mnCol, maFrom.mnRow ); - sal_Int64 nX = static_cast< sal_Int64 >( rUnitConv.scaleFromMm100( aPoint.X, UNIT_EMU ) ) + lclCalcEmu( rUnitConv, maFrom.mnColOffset, eUnitX ); - sal_Int64 nY = static_cast< sal_Int64 >( rUnitConv.scaleFromMm100( aPoint.Y, UNIT_EMU ) ) + lclCalcEmu( rUnitConv, maFrom.mnRowOffset, eUnitY ); - if( (nX < aSheetSize.Width) && (nY < aSheetSize.Height) ) - { - aLoc.X = static_cast< sal_Int32 >( nX ); - aLoc.Y = static_cast< sal_Int32 >( nY ); - } - } - break; - case ANCHOR_INVALID: - OSL_FAIL( "ShapeAnchor::calcEmuLocation - invalid anchor" ); - break; - } - - // calculate shape size - if( (aLoc.X >= 0) && (aLoc.Y >= 0) ) switch( meType ) - { - case ANCHOR_ABSOLUTE: - case ANCHOR_ONECELL: - OSL_ENSURE( maSize.isValid(), "ShapeAnchor::calcEmuLocation - invalid size" ); - if( maSize.isValid() ) - { - aLoc.Width = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( maSize.Width, aSheetSize.Width - aLoc.X ) ); - aLoc.Height = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( maSize.Height, aSheetSize.Height - aLoc.Y ) ); - } - break; - case ANCHOR_TWOCELL: - case ANCHOR_VML: - OSL_ENSURE( maTo.isValid(), "ShapeAnchor::calcEmuLocation - invalid position" ); - if( maTo.isValid() ) - { - /* Pass a valid cell address to getCellPosition(), otherwise - nothing is returned, even if either row or column is valid. */ - CellAddress aToCell = rAddrConv.createValidCellAddress( BinAddress( maTo.mnCol, maTo.mnRow ), getSheetIndex(), true ); - Point aPoint = getCellPosition( aToCell.Column, aToCell.Row ); - sal_Int64 nX = static_cast< sal_Int64 >( rUnitConv.scaleFromMm100( aPoint.X, UNIT_EMU ) ); - sal_Int64 nY = static_cast< sal_Int64 >( rUnitConv.scaleFromMm100( aPoint.Y, UNIT_EMU ) ); - // width - aLoc.Width = aSheetSize.Width - aLoc.X; - if( aToCell.Column == maTo.mnCol ) - { - nX += lclCalcEmu( rUnitConv, maTo.mnColOffset, eUnitX ); - aLoc.Width = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( nX - aLoc.X + 1, aLoc.Width ) ); - } - // height - aLoc.Height = aSheetSize.Height - aLoc.Y; - if( aToCell.Row == maTo.mnRow ) - { - nY += lclCalcEmu( rUnitConv, maTo.mnRowOffset, eUnitY ); - aLoc.Height = static_cast< sal_Int32 >( ::std::min< sal_Int64 >( nY - aLoc.Y + 1, aLoc.Height ) ); - } - } - break; - case ANCHOR_INVALID: - break; - } - - // add 0.75 mm (27,000 EMUs) in X direction to correct display error - if( aLoc.X >= 0 ) - aLoc.X += 27000; - // remove 0.25 mm (9,000 EMUs) in Y direction to correct display error - if( aLoc.Y >= 9000 ) - aLoc.Y -= 9000; - - return aLoc; -} - // ============================================================================ ShapeMacroAttacher::ShapeMacroAttacher( const OUString& rMacroName, const Reference< XShape >& rxShape ) : diff --git a/oox/source/xls/formulaparser.cxx b/oox/source/xls/formulaparser.cxx index a37064e4e8d9..688c45b1cf3a 100644 --- a/oox/source/xls/formulaparser.cxx +++ b/oox/source/xls/formulaparser.cxx @@ -622,12 +622,6 @@ ApiTokenSequence FormulaParserImpl::importBiffFormula( const CellAddress&, Formu return ApiTokenSequence(); } -void FormulaParserImpl::setFormula( FormulaContext& rContext, const ApiTokenSequence& rTokens ) -{ - initializeImport( rContext ); - finalizeImport( rTokens ); -} - OUString FormulaParserImpl::resolveOleTarget( sal_Int32 nRefId, bool bUseRefSheets ) const { const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId, bUseRefSheets ).get(); diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx index 5ae29587156f..132eab6339af 100644 --- a/oox/source/xls/richstring.cxx +++ b/oox/source/xls/richstring.cxx @@ -544,11 +544,11 @@ bool RichString::extractPlainString( OUString& orString, const Font* pFirstPorti void RichString::convert( const Reference< XText >& rxText, const Font* pFirstPortionFont ) const { - if (maFontPortions.size() == 1) + if (maTextPortions.size() == 1) { // Set text directly to the cell when the string has only one portion. // It's much faster this way. - RichStringPortion& rPtn = *maFontPortions.front(); + RichStringPortion& rPtn = *maTextPortions.front(); rxText->setString(rPtn.getText()); rPtn.writeFontProperties(rxText, nXfId); return; |