ooo-build r13308 - in trunk: . patches/test



Author: kyoshida
Date: Sat Jul 19 05:32:38 2008
New Revision: 13308
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13308&view=rev

Log:
2008-07-19  Kohei Yoshida  <kyoshida novell com>

	* patches/test/calc-external-defined-names.diff: correctly export cell
	and range references in external names.


Modified:
   trunk/ChangeLog
   trunk/patches/test/calc-external-defined-names.diff

Modified: trunk/patches/test/calc-external-defined-names.diff
==============================================================================
--- trunk/patches/test/calc-external-defined-names.diff	(original)
+++ trunk/patches/test/calc-external-defined-names.diff	Sat Jul 19 05:32:38 2008
@@ -1263,7 +1263,7 @@
  {
      OpCode eOpCode = rTokData.GetOpCode();
 diff --git sc/source/filter/excel/xelink.cxx sc/source/filter/excel/xelink.cxx
-index b1bacad..ba64325 100644
+index b1bacad..2b54a89 100644
 --- sc/source/filter/excel/xelink.cxx
 +++ sc/source/filter/excel/xelink.cxx
 @@ -38,6 +38,15 @@
@@ -1459,7 +1459,7 @@
      virtual void        Save( XclExpStream& rStrm );
  
  private:
-@@ -885,6 +952,29 @@ void XclExpExtNameDde::WriteAddData( XclExpStream& rStrm )
+@@ -885,6 +952,94 @@ void XclExpExtNameDde::WriteAddData( XclExpStream& rStrm )
          mxMatrix->Save( rStrm );
  }
  
@@ -1473,23 +1473,88 @@
 +
 +void XclExpExtName::WriteAddData( XclExpStream& rStrm )
 +{
-+    rStrm << static_cast<sal_uInt8>(0x09);
-+    rStrm << static_cast<sal_uInt8>(0x00);
-+    rStrm << static_cast<sal_uInt8>(0x3A);
-+    rStrm << static_cast<sal_uInt8>(0x01);
-+    rStrm << static_cast<sal_uInt8>(0x00);
-+    rStrm << static_cast<sal_uInt8>(0x01);
-+    rStrm << static_cast<sal_uInt8>(0x00);
-+    rStrm << static_cast<sal_uInt8>(0x08);
-+    rStrm << static_cast<sal_uInt8>(0x00);
-+    rStrm << static_cast<sal_uInt8>(0x02);
-+    rStrm << static_cast<sal_uInt8>(0x00);
++    // Write only if it only has a single token that is either a cell or cell 
++    // range address.  Excel just writes '02 00 1C 17' for all the other types
++    // of external names.
++
++    do
++    {
++        if (mpArray->GetLen() != 1)
++            break;
++
++        const ScToken* p = mpArray->First();
++        if (p->GetOpCode() != ocExternalName)
++            break;
++
++        switch (p->GetType())
++        {
++            case svSingleRef:
++            {
++                const SingleRefData& rRef = p->GetSingleRef();
++                if (rRef.IsTabRel())
++                    break;
++
++                sal_uInt16 nTab = rRef.nTab;
++                bool bColRel = rRef.IsColRel();
++                bool bRowRel = rRef.IsRowRel();
++                sal_uInt16 nCol = bColRel ? rRef.nRelCol : rRef.nCol;
++                sal_uInt16 nRow = bRowRel ? rRef.nRelRow : rRef.nRow;
++                if (bColRel) nCol |= 0x4000;
++                if (bRowRel) nCol |= 0x8000;
++
++                // size is always 9
++                rStrm << static_cast<sal_uInt16>(9);
++                // operator token (3A for cell reference)
++                rStrm << static_cast<sal_uInt8>(0x3A);
++                // cell address (Excel's address has 2 sheet IDs.)
++                rStrm << nTab << nTab << nRow << nCol;
++                return;
++            }
++            case svDoubleRef:
++            {
++                const ComplRefData& rRef = p->GetDoubleRef();
++                const SingleRefData& r1 = rRef.Ref1;
++                const SingleRefData& r2 = rRef.Ref2;
++                if (r1.IsTabRel() || r2.IsTabRel())
++                    break;
++
++                sal_uInt16 nTab1 = r1.nTab;
++                sal_uInt16 nTab2 = r2.nTab;
++                bool bCol1Rel = r1.IsColRel();
++                bool bRow1Rel = r1.IsRowRel();
++                bool bCol2Rel = r2.IsColRel();
++                bool bRow2Rel = r2.IsRowRel();
++
++                sal_uInt16 nCol1 = bCol1Rel ? r1.nRelCol : r1.nCol;
++                sal_uInt16 nCol2 = bCol2Rel ? r2.nRelCol : r2.nCol;
++                sal_uInt16 nRow1 = bRow1Rel ? r1.nRelRow : r1.nRow;
++                sal_uInt16 nRow2 = bRow2Rel ? r2.nRelRow : r2.nRow;
++                if (bCol1Rel) nCol1 |= 0x4000;
++                if (bRow1Rel) nCol1 |= 0x8000;
++                if (bCol2Rel) nCol2 |= 0x4000;
++                if (bRow2Rel) nCol2 |= 0x8000;
++
++                // size is always 13 (0x0D)
++                rStrm << static_cast<sal_uInt16>(13);
++                // operator token (3B for area reference)
++                rStrm << static_cast<sal_uInt8>(0x3B);
++                // range (area) address
++                rStrm << nTab1 << nTab2 << nRow1 << nRow2 << nCol1 << nCol2;
++                return;
++            }
++        }
++    }
++    while (false);
++
++    // special value for #REF! (02 00 1C 17)
++    rStrm << static_cast<sal_uInt16>(0x0002);
++    rStrm << static_cast<sal_uInt16>(0x171C);
 +}
 +
  // List of external names =====================================================
  
  XclExpExtNameBuffer::XclExpExtNameBuffer( const XclExpRoot& rRoot ) :
-@@ -920,6 +1010,12 @@ sal_uInt16 XclExpExtNameBuffer::InsertDde(
+@@ -920,6 +1075,12 @@ sal_uInt16 XclExpExtNameBuffer::InsertDde(
      return nIndex;
  }
  
@@ -1502,7 +1567,7 @@
  void XclExpExtNameBuffer::Save( XclExpStream& rStrm )
  {
      maNameList.Save( rStrm );
-@@ -1066,6 +1162,77 @@ void XclExpXct::StoreCellRange( const XclExpRoot& rRoot, const ScRange& rRange )
+@@ -1066,6 +1227,78 @@ void XclExpXct::StoreCellRange( const XclExpRoot& rRoot, const ScRange& rRange )
      maUsedCells.SetMultiMarkArea( rRange );
  }
  
@@ -1551,7 +1616,8 @@
 +    pMtx->GetDimensions(nCols, nRows);
 +    const ScAddress& s = rRange.aStart;
 +    const ScAddress& e = rRange.aEnd;
-+    if (nCols != e.Col() - s.Col() + 1 || nRows != e.Row() - s.Row() + 1)
++    if (static_cast<SCCOL>(nCols) != e.Col() - s.Col() + 1 || 
++        static_cast<SCROW>(nRows) != e.Row() - s.Row() + 1)
 +    {
 +        // size mis-match!
 +        return;
@@ -1580,7 +1646,7 @@
  void XclExpXct::Save( XclExpStream& rStrm )
  {
      XclExpRecord::Save( rStrm );
-@@ -1206,6 +1373,41 @@ void XclExpSupbook::StoreCellRange( const ScRange& rRange, sal_uInt16 nSBTab )
+@@ -1206,6 +1439,41 @@ void XclExpSupbook::StoreCellRange( const ScRange& rRange, sal_uInt16 nSBTab )
          xXct->StoreCellRange( GetRoot(), rRange );
  }
  
@@ -1622,7 +1688,7 @@
  sal_uInt16 XclExpSupbook::InsertTabName( const String& rTabName )
  {
      DBG_ASSERT( meType == EXC_SBTYPE_EXTERN, "XclExpSupbook::InsertTabName - don't insert sheet names here" );
-@@ -1226,6 +1428,11 @@ sal_uInt16 XclExpSupbook::InsertDde( const String& rItem )
+@@ -1226,6 +1494,11 @@ sal_uInt16 XclExpSupbook::InsertDde( const String& rItem )
      return GetExtNameBuffer().InsertDde( maUrl, maDdeTopic, rItem );
  }
  
@@ -1634,7 +1700,7 @@
  void XclExpSupbook::Save( XclExpStream& rStrm )
  {
      // SUPBOOK record
-@@ -1352,6 +1559,131 @@ void XclExpSupbookBuffer::StoreCellRange( const ScRange& rRange )
+@@ -1352,6 +1625,131 @@ void XclExpSupbookBuffer::StoreCellRange( const ScRange& rRange )
      }
  }
  
@@ -1766,7 +1832,7 @@
  bool XclExpSupbookBuffer::InsertAddIn(
          sal_uInt16& rnSupbook, sal_uInt16& rnExtName, const String& rName )
  {
-@@ -1383,6 +1715,20 @@ bool XclExpSupbookBuffer::InsertDde(
+@@ -1383,6 +1781,20 @@ bool XclExpSupbookBuffer::InsertDde(
      return rnExtName > 0;
  }
  
@@ -1787,7 +1853,7 @@
  void XclExpSupbookBuffer::Save( XclExpStream& rStrm )
  {
      maSupbookList.Save( rStrm );
-@@ -1490,6 +1836,16 @@ void XclExpLinkManagerImpl5::StoreCellRange( const SingleRefData& /*rRef1*/, con
+@@ -1490,6 +1902,16 @@ void XclExpLinkManagerImpl5::StoreCellRange( const SingleRefData& /*rRef1*/, con
      // not implemented
  }
  
@@ -1804,7 +1870,7 @@
  bool XclExpLinkManagerImpl5::InsertAddIn(
          sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rName )
  {
-@@ -1510,6 +1866,14 @@ bool XclExpLinkManagerImpl5::InsertDde(
+@@ -1510,6 +1932,14 @@ bool XclExpLinkManagerImpl5::InsertDde(
      return false;
  }
  
@@ -1819,7 +1885,7 @@
  void XclExpLinkManagerImpl5::Save( XclExpStream& rStrm )
  {
      if( sal_uInt16 nExtSheetCount = GetExtSheetCount() )
-@@ -1652,6 +2016,19 @@ void XclExpLinkManagerImpl8::StoreCellRange( const SingleRefData& rRef1, const S
+@@ -1652,6 +2082,19 @@ void XclExpLinkManagerImpl8::StoreCellRange( const SingleRefData& rRef1, const S
      }
  }
  
@@ -1839,7 +1905,7 @@
  bool XclExpLinkManagerImpl8::InsertAddIn(
          sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rName )
  {
-@@ -1677,6 +2054,18 @@ bool XclExpLinkManagerImpl8::InsertDde(
+@@ -1677,6 +2120,18 @@ bool XclExpLinkManagerImpl8::InsertDde(
      return false;
  }
  
@@ -1858,7 +1924,7 @@
  void XclExpLinkManagerImpl8::Save( XclExpStream& rStrm )
  {
      if( !maXtiVec.empty() )
-@@ -1755,6 +2144,16 @@ void XclExpLinkManager::StoreCellRange( const ComplRefData& rRef )
+@@ -1755,6 +2210,16 @@ void XclExpLinkManager::StoreCellRange( const ComplRefData& rRef )
      mxImpl->StoreCellRange( rRef.Ref1, rRef.Ref2 );
  }
  
@@ -1875,7 +1941,7 @@
  bool XclExpLinkManager::InsertAddIn(
          sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const String& rName )
  {
-@@ -1768,6 +2167,13 @@ bool XclExpLinkManager::InsertDde(
+@@ -1768,6 +2233,13 @@ bool XclExpLinkManager::InsertDde(
      return mxImpl->InsertDde( rnExtSheet, rnExtName, rApplic, rTopic, rItem );
  }
  



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]