[PATCH 5/7] Continuing converting.

Daniel Bankston daniel.dev.libreoffice at gmail.com
Fri Apr 13 17:12:39 PDT 2012


---
 sc/source/filter/inc/defnamesbuffer.hxx  |    2 +-
 sc/source/filter/inc/sheetdatabuffer.hxx |    2 +-
 sc/source/filter/oox/defnamesbuffer.cxx  |   13 ++++++++-----
 sc/source/filter/oox/sheetdatabuffer.cxx |   15 +++++++++------
 sc/source/filter/oox/workbookhelper.cxx  |   19 +++++++++++--------
 5 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/sc/source/filter/inc/defnamesbuffer.hxx b/sc/source/filter/inc/defnamesbuffer.hxx
index 654206c..398380f 100644
--- a/sc/source/filter/inc/defnamesbuffer.hxx
+++ b/sc/source/filter/inc/defnamesbuffer.hxx
@@ -161,7 +161,7 @@ private:
 
     //~ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange >
                         //~ mxNamedRange;       /// XNamedRange interface of the defined name.
-    ScRangeData*        mpScRangeData       /// ScRangeData of the defined name.
+    ScRangeData*        mpScRangeData;       /// ScRangeData of the defined name.
     sal_Int32           mnTokenIndex;       /// Name index used in API token array.
     sal_Int16           mnCalcSheet;        /// Calc sheet index for sheet-local names.
     sal_Unicode         mcBuiltinId;        /// Identifier for built-in defined names.
diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx b/sc/source/filter/inc/sheetdatabuffer.hxx
index dcf42bc..8efaa43 100644
--- a/sc/source/filter/inc/sheetdatabuffer.hxx
+++ b/sc/source/filter/inc/sheetdatabuffer.hxx
@@ -35,7 +35,7 @@
 #include "worksheethelper.hxx"
 
 namespace com { namespace sun { namespace star {
-    namespace sheet { class XNamedRange; }
+    //~ namespace sheet { class XNamedRange; }
     namespace util { struct DateTime; }
 } } }
 
diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx
index f6955f5..ff8310e 100644
--- a/sc/source/filter/oox/defnamesbuffer.cxx
+++ b/sc/source/filter/oox/defnamesbuffer.cxx
@@ -44,6 +44,8 @@
 #include "externallinkbuffer.hxx"
 #include "formulaparser.hxx"
 #include "worksheetbuffer.hxx"
+#include "tokenarray.hxx"
+#include "tokenuno.hxx"
 
 namespace oox {
 namespace xls {
@@ -443,9 +445,10 @@ void DefinedName::convertFormula()
     //~ Reference< XFormulaTokens > xTokens( mxNamedRange, UNO_QUERY );
     //~ if( !xTokens.is() )
         //~ return;
-    ScTokenArray* pTokenArray = mpScRangeData->getCode();
-    Sequence< FormulaToken > = aFTokenSeq;
-    ScTokenConversion::ConvertToTokenSequence( this->getScDocument(), aFTokenSeq, *pTokenArray );
+    const ScTokenArray* pTokenArray = mpScRangeData->GetCode();
+    Sequence< FormulaToken > aFTokenSeq;
+    ScDocument* pDocTest = &this->getScDocument();
+    (void)ScTokenConversion::ConvertToTokenSequence( *pDocTest, aFTokenSeq, *pTokenArray );
     // set built-in names (print ranges, repeated titles, filter ranges)
     if( !isGlobalName() ) switch( mcBuiltinId )
     {
@@ -502,8 +505,8 @@ void DefinedName::convertFormula()
 //~ }
 bool DefinedName::getAbsoluteRange( CellRangeAddress& orRange ) const
 {
-    ScTokenArray* pTokenArray = mpScRangeData->getCode();
-    Sequence< FormulaToken > = aFTokenSeq;
+    ScTokenArray* pTokenArray = mpScRangeData->GetCode();
+    Sequence< FormulaToken > aFTokenSeq;
     ScTokenConversion::ConvertToTokenSequence( this->getScDocument(), aFTokenSeq, *pTokenArray );
     return getFormulaParser().extractCellRange( orRange, aFTokenSeq, false );
 }
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index 4abf946..29d6dfe 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -588,15 +588,18 @@ void SheetDataBuffer::createSharedFormula( const BinAddress& rMapKey, const ApiT
         append( static_cast< sal_Int32 >( getSheetIndex() + 1 ) ).
         append( sal_Unicode( '_' ) ).append( rMapKey.mnRow ).
         append( sal_Unicode( '_' ) ).append( rMapKey.mnCol ).makeStringAndClear();
-    Reference< XNamedRange > xNamedRange = createNamedRangeObject( aName, rTokens, 0 );
-    OSL_ENSURE( xNamedRange.is(), "SheetDataBuffer::createSharedFormula - cannot create shared formula" );
-    PropertySet aNameProps( xNamedRange );
-    aNameProps.setProperty( PROP_IsSharedFormula, true );
+    //~ Reference< XNamedRange > xNamedRange = createNamedRangeObject( aName, rTokens, 0 );
+    //~ OSL_ENSURE( xNamedRange.is(), "SheetDataBuffer::createSharedFormula - cannot create shared formula" );
+    ScRangeData* pScRangeData = createNamedRangeObject( aName, rTokens, 0 );
+    //~ PropertySet aNameProps( xNamedRange );
+    //~ aNameProps.setProperty( PROP_IsSharedFormula, true );
 
     // get and store the token index of the defined name
     OSL_ENSURE( maSharedFormulas.count( rMapKey ) == 0, "SheetDataBuffer::createSharedFormula - shared formula exists already" );
-    sal_Int32 nTokenIndex = 0;
-    if( aNameProps.getProperty( nTokenIndex, PROP_TokenIndex ) && (nTokenIndex >= 0) ) try
+    //~ sal_Int32 nTokenIndex = 0;
+    //~ if( aNameProps.getProperty( nTokenIndex, PROP_TokenIndex ) && (nTokenIndex >= 0) ) try
+    sal_Int32 nTokenIndex = static_cast< sal_Int32 >( pScRangeData->GetIndex() );
+    if( nTokenIndex >= 0 ) try
     {
         // store the token index in the map
         maSharedFormulas[ rMapKey ] = nTokenIndex;
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 3dbc478..1d46c52 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -169,7 +169,7 @@ public:
     ScRangeData* createNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags ) const;
     /** Creates and returns a defined name on the-fly in the correct Calc sheet. */
     //~ Reference< XNamedRange > createLocalNamedRangeObject( OUString& orName, const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const;
-    ScRangeData* createLocalNamedRangeObject( OUString& orName, Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const;
+    ScRangeData* createLocalNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const;
     /** Creates and returns a database range on-the-fly in the Calc document. */
     Reference< XDatabaseRange > createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const;
     /** Creates and returns an unnamed database range on-the-fly in the Calc document. */
@@ -360,7 +360,7 @@ Reference< XStyle > WorkbookGlobals::getStyleObject( const OUString& rStyleName,
     OSL_ENSURE( xStyle.is(), "WorkbookGlobals::getStyleObject - cannot access style object" );
     return xStyle;
 }
-void lcl_addNewByNameAndTokens( ScDocument& rDoc, ScRangeName* pNames, const OUString& rName, const Sequence<FormulaToken>& rTokens, sal_Int16 nIndex, sal_Int32 nUnoType )
+ScRangeData* lcl_addNewByNameAndTokens( ScDocument& rDoc, ScRangeName* pNames, const OUString& rName, const Sequence<FormulaToken>& rTokens, sal_Int16 nIndex, sal_Int32 nUnoType )
 {
     bool bDone = false;
     sal_uInt16 nNewType = RT_NAME;
@@ -378,6 +378,7 @@ void lcl_addNewByNameAndTokens( ScDocument& rDoc, ScRangeName* pNames, const OUS
         bDone = true;
     if (!bDone)
         throw RuntimeException();
+    return pNew;
 }
 
 //~ Reference< XNamedRange > WorkbookGlobals::createNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags ) const
@@ -385,6 +386,7 @@ ScRangeData* WorkbookGlobals::createNamedRangeObject( OUString& orName, const Se
 {
     // create the name and insert it into the Calc document
     Reference< XNamedRange > xNamedRange;
+    ScRangeData* pScRangeData;
     if( !orName.isEmpty() ) try
     {
         // find an unused name
@@ -395,7 +397,7 @@ ScRangeData* WorkbookGlobals::createNamedRangeObject( OUString& orName, const Se
         // create the named range
         ScDocument& rDoc =  getScDocument();
         ScRangeName* pNames = rDoc.GetRangeName();
-        lcl_addNewByNameAndTokens( rDoc, pNames, orName, rTokens, nIndex, nNameFlags );
+        pScRangeData = lcl_addNewByNameAndTokens( rDoc, pNames, orName, rTokens, nIndex, nNameFlags );
         //~ xNamedRange.set( xNamedRanges->getByName( orName ), UNO_QUERY );
     }
     catch( Exception& )
@@ -403,14 +405,15 @@ ScRangeData* WorkbookGlobals::createNamedRangeObject( OUString& orName, const Se
     }
     //~ OSL_ENSURE( xNamedRange.is(), "WorkbookGlobals::createNamedRangeObject - cannot create defined name" );
     //~ return xNamedRange;
-    return pNames;
+    return pScRangeData;
 }
 
 //~ Reference< XNamedRange > WorkbookGlobals::createLocalNamedRangeObject( OUString& orName, const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken>&  rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const
-ScRangeData* WorkbookGlobals::createLocalNamedRangeObject( OUString& orName, const Sequence< FormulaToken>&  rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const
+ScRangeData* WorkbookGlobals::createLocalNamedRangeObject( OUString& orName, const Sequence< FormulaToken >&  rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const
 {
     // create the name and insert it into the Calc document
     Reference< XNamedRange > xNamedRange;
+    ScRangeData* pScRangeData;
     if( !orName.isEmpty() ) try
     {
         // find an unused name
@@ -425,7 +428,7 @@ ScRangeData* WorkbookGlobals::createLocalNamedRangeObject( OUString& orName, con
         // create the named range
         ScDocument& rDoc =  getScDocument();
         ScRangeName* pNames = rDoc.GetRangeName( nTab );
-        lcl_addNewByNameAndTokens( rDoc, pNames, orName, rTokens, nIndex, nNameFlags );
+        pScRangeData = lcl_addNewByNameAndTokens( rDoc, pNames, orName, rTokens, nIndex, nNameFlags );
         //~ xNamedRange.set( xNamedRanges->getByName( orName ), UNO_QUERY );
     }
     catch( Exception& )
@@ -433,7 +436,7 @@ ScRangeData* WorkbookGlobals::createLocalNamedRangeObject( OUString& orName, con
     }
     //~ OSL_ENSURE( xNamedRange.is(), "WorkbookGlobals::createLocalNamedRangeObject - cannot create defined name" );
     //~ return xNamedRange;
-    return pNames;
+    return pScRangeData;
 }
 
 Reference< XDatabaseRange > WorkbookGlobals::createDatabaseRangeObject( OUString& orName, const CellRangeAddress& rRangeAddr ) const
@@ -756,7 +759,7 @@ ScRangeData* WorkbookHelper::createNamedRangeObject( OUString& orName, const Seq
 }
 
 //~ Reference< XNamedRange > WorkbookHelper::createLocalNamedRangeObject( OUString& orName, const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const
-ScRangeData* WorkbookHelper::createLocalNamedRangeObject( OUString& orName, Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const
+ScRangeData* WorkbookHelper::createLocalNamedRangeObject( OUString& orName, const Sequence< FormulaToken>& rTokens, sal_Int32 nIndex, sal_Int32 nNameFlags, sal_Int32 nTab ) const
 {
     return mrBookGlob.createLocalNamedRangeObject( orName, rTokens, nIndex, nNameFlags, nTab );
 }
-- 
1.7.1


--------------030003000301040704050906
Content-Type: text/x-patch;
 name="0006-can-t-build-core.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0006-can-t-build-core.patch"



More information about the LibreOffice mailing list