[Libreoffice-commits] .: Branch 'integration/dev300_m106' - oox/inc oox/source

Jan Holesovsky kendy at kemper.freedesktop.org
Mon May 23 08:31:14 PDT 2011


 oox/inc/oox/helper/propertyset.hxx  |    3 -
 oox/inc/oox/xls/richstring.hxx      |    2 
 oox/source/xls/drawingbase.cxx      |    3 -
 oox/source/xls/drawingfragment.cxx  |  103 ------------------------------------
 oox/source/xls/richstring.cxx       |   11 +--
 oox/source/xls/sheetdatacontext.cxx |   52 ------------------
 oox/source/xls/worksheethelper.cxx  |   71 ------------------------
 7 files changed, 10 insertions(+), 235 deletions(-)

New commits:
commit f66e2ba9ca62a51ba501cb11badb1169c5814c21
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon May 23 15:25:26 2011 +0200

    oox builds again after the m106 merge.

diff --git a/oox/inc/oox/helper/propertyset.hxx b/oox/inc/oox/helper/propertyset.hxx
index 6db094a..f4a8282 100644
--- a/oox/inc/oox/helper/propertyset.hxx
+++ b/oox/inc/oox/helper/propertyset.hxx
@@ -101,7 +101,8 @@ public:
 
     /** Gets the specified boolean property from the property set.
         @return  true = property contains true; false = property contains false or error occurred. */
-    bool                getBoolProperty( sal_Int32 nPropId ) const;
+    inline bool         getBoolProperty( sal_Int32 nPropId ) const
+                            { bool bValue = false; return getProperty( bValue, nPropId ) && bValue; }
 
     /** Gets the specified properties from the property set. Tries to use the XMultiPropertySet interface.
         @param orValues  (out-parameter) The related property values.
diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx
index f956705..15a5ad4 100644
--- a/oox/inc/oox/xls/richstring.hxx
+++ b/oox/inc/oox/xls/richstring.hxx
@@ -81,7 +81,7 @@ public:
 
     void                writeFontProperties(
         const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText,
-        sal_Int32 nXfId ) const;
+        const Font* pFont ) const;
 
 private:
     ::rtl::OUString     maText;         /// Portion text.
diff --git a/oox/source/xls/drawingbase.cxx b/oox/source/xls/drawingbase.cxx
index 920c166..592d432 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 3ef7039..66e371d 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 d82bd59..584e80d 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 d841bb2..93fa18e 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 b83cd61..186a903 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
 
 // ============================================================================


More information about the Libreoffice-commits mailing list