ooo-build r13717 - in trunk: . patches/dev300



Author: kyoshida
Date: Fri Aug 29 05:18:44 2008
New Revision: 13717
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13717&view=rev

Log:
2008-08-29  Kohei Yoshida  <kyoshida novell com>

	* patches/dev300/calc-external-defined-names-offapi.diff: added new idl
	files for external reference caching.

	* patches/dev300/apply: added the above patch.
	
	* patches/dev300/calc-external-defined-names.diff: implemented new API
	for external reference caching & fixed a simple calculation error on
	'= extref + 1'.


Added:
   trunk/patches/dev300/calc-external-defined-names-offapi.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply
   trunk/patches/dev300/calc-external-defined-names.diff

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Fri Aug 29 05:18:44 2008
@@ -1709,6 +1709,7 @@
 
 # Implement external range names.
 calc-external-defined-names.diff, i#3740, i#4385, n#355685, kohei
+calc-external-defined-names-offapi.diff, i#3740, i#4385, n#355685, kohei
 calc-external-names-additional-fixes.diff, kohei
 
 [ CalcSolver ]

Added: trunk/patches/dev300/calc-external-defined-names-offapi.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/calc-external-defined-names-offapi.diff	Fri Aug 29 05:18:44 2008
@@ -0,0 +1,266 @@
+diff --git offapi/com/sun/star/sheet/ExternalDocLinks.idl offapi/com/sun/star/sheet/ExternalDocLinks.idl
+new file mode 100644
+index 0000000..765e8ff
+--- /dev/null
++++ offapi/com/sun/star/sheet/ExternalDocLinks.idl
+@@ -0,0 +1,51 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: DDELink.idl,v $
++ * $Revision: 1.9 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef __com_sun_star_sheet_ExternalDocLinks_idl__
++#define __com_sun_star_sheet_ExternalDocLinks_idl__
++
++#include <com/sun/star/sheet/XExternalDocLinks.idl>
++
++//=============================================================================
++
++module com {  module sun {  module star {  module sheet {
++
++//=============================================================================
++
++service ExternalDocLinks
++{
++    interface com::sun::star::sheet::XExternalDocLinks;
++};
++
++//=============================================================================
++
++}; }; }; };
++
++#endif
+diff --git offapi/com/sun/star/sheet/ExternalSheetCache.idl offapi/com/sun/star/sheet/ExternalSheetCache.idl
+new file mode 100644
+index 0000000..5c6362d
+--- /dev/null
++++ offapi/com/sun/star/sheet/ExternalSheetCache.idl
+@@ -0,0 +1,51 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: DDELink.idl,v $
++ * $Revision: 1.9 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef __com_sun_star_sheet_ExternalSheetCache_idl__
++#define __com_sun_star_sheet_ExternalSheetCache_idl__
++
++#include <com/sun/star/sheet/XExternalSheetCache.idl>
++
++//=============================================================================
++
++module com {  module sun {  module star {  module sheet {
++
++//=============================================================================
++
++service ExternalSheetCache
++{
++    interface com::sun::star::sheet::XExternalSheetCache;
++};
++
++//=============================================================================
++
++}; }; }; };
++
++#endif
+diff --git offapi/com/sun/star/sheet/XExternalDocLinks.idl offapi/com/sun/star/sheet/XExternalDocLinks.idl
+new file mode 100644
+index 0000000..a28fa87
+--- /dev/null
++++ offapi/com/sun/star/sheet/XExternalDocLinks.idl
+@@ -0,0 +1,57 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: DDELink.idl,v $
++ * $Revision: 1.9 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef __com_sun_star_sheet_XExternalDocLinks_idl__
++#define __com_sun_star_sheet_XExternalDocLinks_idl__
++
++#include <com/sun/star/uno/XInterface.idl>
++#include <com/sun/star/lang/IllegalArgumentException.idl>
++#include <com/sun/star/sheet/XExternalSheetCache.idl>
++
++//=============================================================================
++
++module com {  module sun {  module star {  module sheet {
++
++//=============================================================================
++
++interface XExternalDocLinks: com::sun::star::uno::XInterface
++{
++    long getDocumentLinkIndex( [in] string aDocName );
++
++    com::sun::star::sheet::XExternalSheetCache 
++        getSheetCache( [in] long DocIndex, [in] string SheetName, [in] boolean CreateNew )
++            raises (com::sun::star::lang::IllegalArgumentException);
++};
++
++//=============================================================================
++
++}; }; }; };
++
++#endif
+diff --git offapi/com/sun/star/sheet/XExternalSheetCache.idl offapi/com/sun/star/sheet/XExternalSheetCache.idl
+new file mode 100644
+index 0000000..4027eb0
+--- /dev/null
++++ offapi/com/sun/star/sheet/XExternalSheetCache.idl
+@@ -0,0 +1,61 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: DDELink.idl,v $
++ * $Revision: 1.9 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef __com_sun_star_sheet_XExternalSheetCache_idl__
++#define __com_sun_star_sheet_XExternalSheetCache_idl__
++
++#include <com/sun/star/uno/XInterface.idl>
++#include <com/sun/star/lang/IllegalArgumentException.idl>
++
++//=============================================================================
++
++module com {  module sun {  module star {  module sheet {
++
++//=============================================================================
++
++interface XExternalSheetCache: com::sun::star::uno::XInterface
++{
++    void setCellValue( [in] long nRow, [in] long nColumn, [in] any aValue )
++            raises (com::sun::star::lang::IllegalArgumentException);
++
++    any getCellValue( [in] long nRow, [in] long nColumn )
++            raises (com::sun::star::lang::IllegalArgumentException);
++
++    sequence< long > getAllRows();
++
++    sequence< long > getAllColumns( [in] long nRow )
++            raises (com::sun::star::lang::IllegalArgumentException);
++};
++
++//=============================================================================
++
++}; }; }; };
++
++#endif
+diff --git offapi/com/sun/star/sheet/makefile.mk offapi/com/sun/star/sheet/makefile.mk
+index c1d2844..da1f44d 100644
+--- offapi/com/sun/star/sheet/makefile.mk
++++ offapi/com/sun/star/sheet/makefile.mk
+@@ -123,6 +123,8 @@ IDLFILES=\
+ 	DatabaseRangesEnumeration.idl\
+ 	DDELinkMode.idl\
+ 	DocumentSettings.idl\
++	ExternalDocLinks.idl\
++	ExternalSheetCache.idl\
+ 	FillDateMode.idl\
+ 	FillDirection.idl\
+ 	FillMode.idl\
+@@ -255,6 +257,8 @@ IDLFILES=\
+ 	XDocumentAuditing.idl\
+ 	XDrillDownDataSupplier.idl\
+ 	XEnhancedMouseClickBroadcaster.idl\
++	XExternalDocLinks.idl\
++	XExternalSheetCache.idl\
+ 	XExternalSheetName.idl\
+ 	XFillAcrossSheet.idl\
+ 	XFormulaOpCodeMapper.idl\

Modified: trunk/patches/dev300/calc-external-defined-names.diff
==============================================================================
--- trunk/patches/dev300/calc-external-defined-names.diff	(original)
+++ trunk/patches/dev300/calc-external-defined-names.diff	Fri Aug 29 05:18:44 2008
@@ -90,7 +90,7 @@
  /*** error constants #... ***/
  #define SC_OPCODE_START_ERRORS       30
 diff --git sc/inc/compiler.hxx sc/inc/compiler.hxx
-index 644989b..47df0ca 100644
+index 7bb6767..85fdf91 100644
 --- sc/inc/compiler.hxx
 +++ sc/inc/compiler.hxx
 @@ -45,6 +45,7 @@
@@ -169,7 +169,7 @@
      BOOL IsColRowName( const String& );
      BOOL IsBoolean( const String& );
 diff --git sc/inc/document.hxx sc/inc/document.hxx
-index 1de31e7..8c50532 100644
+index a01f09b..5d4ca1f 100644
 --- sc/inc/document.hxx
 +++ sc/inc/document.hxx
 @@ -93,6 +93,7 @@ class ScDocProtection;
@@ -188,7 +188,7 @@
  	String              aDocName;                       // opt: Dokumentname
  	String              aDocCodeName;                       // opt: Dokumentname
  	ScRangePairListRef	xColNameRanges;
-@@ -631,6 +633,8 @@ SC_DLLPUBLIC	ScDBCollection*	GetDBCollection() const;
+@@ -634,6 +636,8 @@ SC_DLLPUBLIC	ScDBCollection*	GetDBCollection() const;
  									const String& aFileName,
  									const String& aTabName );
  
@@ -197,7 +197,7 @@
      /** Creates a new sheet, and makes it linked to the specified sheet in an external document.
          @param rnTab  (out-param) Returns the sheet index, if sheet could be inserted).
          @return  TRUE = Sheet created, rnTab contains valid sheet index. */
-@@ -639,6 +643,7 @@ SC_DLLPUBLIC	ScDBCollection*	GetDBCollection() const;
+@@ -642,6 +646,7 @@ SC_DLLPUBLIC	ScDBCollection*	GetDBCollection() const;
  
  	BOOL			HasDdeLinks() const;
  	BOOL			HasAreaLinks() const;
@@ -593,6 +593,118 @@
 +
 +
 +#endif
+diff --git sc/inc/linkuno.hxx sc/inc/linkuno.hxx
+index b6fc524..1edf816 100644
+--- sc/inc/linkuno.hxx
++++ sc/inc/linkuno.hxx
+@@ -36,6 +36,8 @@
+ #include <com/sun/star/sheet/XDDELink.hpp>
+ #include <com/sun/star/sheet/XDDELinkResults.hpp>
+ #include <com/sun/star/sheet/XDDELinks.hpp>
++#include <com/sun/star/sheet/XExternalDocLinks.hpp>
++#include <com/sun/star/sheet/XExternalSheetCache.hpp>
+ #include <com/sun/star/sheet/XAreaLink.hpp>
+ #include <com/sun/star/sheet/XAreaLinks.hpp>
+ #include <com/sun/star/util/XRefreshable.hpp>
+@@ -45,10 +47,12 @@
+ #include <com/sun/star/container/XNameAccess.hpp>
+ #include <com/sun/star/container/XIndexAccess.hpp>
+ #include <com/sun/star/container/XNamed.hpp>
++#include <cppuhelper/implbase2.hxx>
+ #include <cppuhelper/implbase3.hxx>
+ #include <cppuhelper/implbase4.hxx>
+ #include <cppuhelper/implbase5.hxx>
+ 
++#include "externalrefmgr.hxx"
+ 
+ class ScAreaLink;
+ class ScDocShell;
+@@ -493,8 +497,85 @@ public:
+ 								throw(::com::sun::star::uno::RuntimeException);
+ };
+ 
++// ============================================================================
+ 
++class ScExternalSheetCacheObj : public cppu::WeakImplHelper2< 
++                                    ::com::sun::star::sheet::XExternalSheetCache,
++                                    ::com::sun::star::lang::XServiceInfo >
++{
++public:
++    explicit ScExternalSheetCacheObj(ScExternalRefCache::Table* pTable);
++    ~ScExternalSheetCacheObj();
++
++                            // XExternalSheetCache
++    virtual void SAL_CALL setCellValue(
++        sal_Int32 nRow, sal_Int32 nCol, const ::com::sun::star::uno::Any& rAny)
++        throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
++
++    virtual ::com::sun::star::uno::Any SAL_CALL getCellValue(sal_Int32 nRow, sal_Int32 nCol)
++        throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
++
++    virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getAllRows()
++        throw (::com::sun::star::uno::RuntimeException);
++
++    virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getAllColumns(sal_Int32 nRow)
++        throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
++
++                            // XServiceInfo
++    virtual ::rtl::OUString SAL_CALL getImplementationName()
++        throw (::com::sun::star::uno::RuntimeException);
++
++    virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName)
++        throw (::com::sun::star::uno::RuntimeException);
++
++    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
++        throw (::com::sun::star::uno::RuntimeException);
++
++private:
++    ScExternalSheetCacheObj();
++    ScExternalSheetCacheObj(const ScExternalSheetCacheObj&);
++
++private:
++    ScExternalRefCache::Table* mpTable;
++};
+ 
++// ============================================================================
++
++/** This is the UNO API equivalent of ScExternalRefManager. */
++class ScExternalDocLinksObj : public cppu::WeakImplHelper2< 
++                                ::com::sun::star::sheet::XExternalDocLinks,
++                                ::com::sun::star::lang::XServiceInfo >
++{
++public:
++    ScExternalDocLinksObj(ScDocShell* pDocShell);
++    ~ScExternalDocLinksObj();
++
++                            // XExternalDocLinks
++    virtual sal_Int32 SAL_CALL getDocumentLinkIndex(const ::rtl::OUString& rDocName)
++        throw (::com::sun::star::uno::RuntimeException);
++
++    virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >
++            SAL_CALL getSheetCache(sal_Int32 nDocIndex, const ::rtl::OUString& rSheetName, sal_Bool bCreateNew )
++        throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
++
++                            // XServiceInfo
++    virtual ::rtl::OUString SAL_CALL getImplementationName()
++        throw (::com::sun::star::uno::RuntimeException);
++
++    virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName)
++        throw (::com::sun::star::uno::RuntimeException);
++
++    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
++        throw (::com::sun::star::uno::RuntimeException);
++
++private:
++    ScExternalDocLinksObj();
++    ScExternalDocLinksObj(const ScExternalDocLinksObj&);
++
++private:
++    ScDocShell* mpDocShell;
++    ScExternalRefManager* mpRefMgr;
++};
+ 
+ #endif
+ 
 diff --git sc/inc/opcode.hxx sc/inc/opcode.hxx
 index 285104d..b72ebad 100644
 --- sc/inc/opcode.hxx
@@ -714,8 +826,20 @@
      ScToken* AddExternal( const sal_Unicode* pStr );
      /** Xcl import may play dirty tricks with OpCode!=ocExternal.
          Others don't use! */
+diff --git sc/inc/unonames.hxx sc/inc/unonames.hxx
+index b2c45ac..51ebf60 100644
+--- sc/inc/unonames.hxx
++++ sc/inc/unonames.hxx
+@@ -47,6 +47,7 @@
+ //	document
+ #define SC_UNO_AREALINKS			"AreaLinks"
+ #define SC_UNO_DDELINKS				"DDELinks"
++#define SC_UNO_EXTERNALDOCLINKS     "ExternalDocLinks"
+ #define SC_UNO_COLLABELRNG			"ColumnLabelRanges"
+ #define SC_UNO_DATABASERNG			"DatabaseRanges"
+ #define SC_UNO_NAMEDRANGES			"NamedRanges"
 diff --git sc/source/core/data/cell.cxx sc/source/core/data/cell.cxx
-index 538f982..ba0a973 100644
+index 1c7ac08..4611515 100644
 --- sc/source/core/data/cell.cxx
 +++ sc/source/core/data/cell.cxx
 @@ -689,7 +689,12 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rNewPos,
@@ -1528,7 +1652,7 @@
  }
  
 diff --git sc/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx
-index ee424fd..82bbbc1 100644
+index 918332d..d9b0549 100644
 --- sc/source/core/tool/compiler.cxx
 +++ sc/source/core/tool/compiler.cxx
 @@ -74,9 +74,11 @@
@@ -1543,7 +1667,7 @@
  
  #if OSL_DEBUG_LEVEL > 1
  // For some unknown reason the identical dbg_dump utilities in
-@@ -1164,7 +1166,7 @@ static bool lcl_isValidQuotedText( const String& rFormula, xub_StrLen nSrcPos, P
+@@ -1191,7 +1193,7 @@ static bool lcl_isValidQuotedText( const String& rFormula, xub_StrLen nSrcPos, P
                  {
                      rRes.TokenType = KParseType::SINGLE_QUOTE_NAME;
                      rRes.EndPos = nPos+1;
@@ -1552,7 +1676,7 @@
                  }
                  ++nPos;
              }
-@@ -1172,9 +1174,197 @@ static bool lcl_isValidQuotedText( const String& rFormula, xub_StrLen nSrcPos, P
+@@ -1199,9 +1201,197 @@ static bool lcl_isValidQuotedText( const String& rFormula, xub_StrLen nSrcPos, P
          }
      }
  
@@ -1750,7 +1874,7 @@
  struct Convention_A1 : public ScCompiler::Convention
  {
      Convention_A1( ScAddress::Convention eConv ) : ScCompiler::Convention( eConv ) { }
-@@ -1188,14 +1378,14 @@ struct Convention_A1 : public ScCompiler::Convention
+@@ -1215,14 +1405,14 @@ struct Convention_A1 : public ScCompiler::Convention
                                 const CharClass* pCharClass) const
      {
          ParseResult aRet;
@@ -1767,7 +1891,7 @@
          return pCharClass->parseAnyToken( rFormula,
                  nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed );
      }
-@@ -1378,6 +1568,86 @@ struct ConventionOOO_A1 : public Convention_A1
+@@ -1405,6 +1595,86 @@ struct ConventionOOO_A1 : public Convention_A1
  
          return sal_Unicode(0);
      }
@@ -1854,7 +1978,7 @@
  };
  
  
-@@ -1499,11 +1769,128 @@ struct ConventionXL
+@@ -1526,11 +1796,128 @@ struct ConventionXL
          }
          return sal_Unicode(0);
      }
@@ -1983,7 +2107,7 @@
      void MakeRefStr( rtl::OUStringBuffer&   rBuf,
                       const ScCompiler&      rComp,
                       const ComplRefData& rRef,
-@@ -1557,22 +1944,11 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
+@@ -1584,22 +1971,11 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
              }
          }
  
@@ -2008,7 +2132,7 @@
          }
      }
  
-@@ -1580,8 +1956,10 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
+@@ -1607,8 +1983,10 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
                                         xub_StrLen nSrcPos,
                                         const CharClass* pCharClass) const
      {
@@ -2020,7 +2144,7 @@
              return aRet;
  
          static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER |
-@@ -1597,6 +1975,67 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
+@@ -1624,6 +2002,67 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
      {
          return ConventionXL::getSpecialSymbol(eSymType);
      }
@@ -2088,7 +2212,7 @@
  };
  
  static const ConventionXL_A1 ConvXL_A1;
-@@ -1706,8 +2145,10 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
+@@ -1733,8 +2172,10 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
                                 xub_StrLen nSrcPos,
                                 const CharClass* pCharClass) const
      {
@@ -2100,7 +2224,7 @@
              return aRet;
  
          static const sal_Int32 nStartFlags = KParseTokens::ANY_LETTER_OR_NUMBER |
-@@ -1724,6 +2165,95 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
+@@ -1751,6 +2192,95 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
      {
          return ConventionXL::getSpecialSymbol(eSymType);
      }
@@ -2196,7 +2320,7 @@
  };
  
  static const ConventionXL_R1C1 ConvXL_R1C1;
-@@ -2181,7 +2711,7 @@ xub_StrLen ScCompiler::NextSymbol(bool bInArray)
+@@ -2208,7 +2738,7 @@ xub_StrLen ScCompiler::NextSymbol(bool bInArray)
                      static const int kQuote = kInc * 2;
                      static const int kPast = kInc * 3;
                      bool bAddToSymbol = true;
@@ -2205,7 +2329,7 @@
                      {
                          // eat it, no sheet name
                          bAddToSymbol = false;
-@@ -2196,7 +2726,7 @@ xub_StrLen ScCompiler::NextSymbol(bool bInArray)
+@@ -2223,7 +2753,7 @@ xub_StrLen ScCompiler::NextSymbol(bool bInArray)
                      }
                      else if (nRefInSheetName < kPast)
                      {
@@ -2214,7 +2338,7 @@
                              nRefInSheetName += kDollar;
                          else if ('\'' == c)
                          {
-@@ -2518,7 +3048,8 @@ BOOL ScCompiler::IsDoubleReference( const String& rName )
+@@ -2545,7 +3075,8 @@ BOOL ScCompiler::IsDoubleReference( const String& rName )
  {
      ScRange aRange( aPos, aPos );
      const ScAddress::Details aDetails( pConv->meConv, aPos );
@@ -2224,7 +2348,7 @@
      if( nFlags & SCA_VALID )
      {
          ScRawToken aToken;
-@@ -2537,7 +3068,14 @@ BOOL ScCompiler::IsDoubleReference( const String& rName )
+@@ -2564,7 +3095,14 @@ BOOL ScCompiler::IsDoubleReference( const String& rName )
              aRef.Ref2.SetTabDeleted( TRUE );        // #REF!
          aRef.Ref2.SetFlag3D( ( nFlags & SCA_TAB2_3D ) != 0 );
          aRef.CalcRelFromAbs( aPos );
@@ -2240,7 +2364,7 @@
          pRawToken = aToken.Clone();
      }
  
-@@ -2549,7 +3087,8 @@ BOOL ScCompiler::IsSingleReference( const String& rName )
+@@ -2576,7 +3114,8 @@ BOOL ScCompiler::IsSingleReference( const String& rName )
  {
      ScAddress aAddr( aPos );
      const ScAddress::Details aDetails( pConv->meConv, aPos );
@@ -2250,7 +2374,7 @@
      // Something must be valid in order to recognize Sheet1.blah or blah.a1
      // as a (wrong) reference.
      if( nFlags & ( SCA_VALID_COL|SCA_VALID_ROW|SCA_VALID_TAB ) )
-@@ -2573,7 +3112,11 @@ BOOL ScCompiler::IsSingleReference( const String& rName )
+@@ -2600,7 +3139,11 @@ BOOL ScCompiler::IsSingleReference( const String& rName )
              nFlags |= SCA_VALID;
          }
          aRef.CalcRelFromAbs( aPos );
@@ -2263,7 +2387,7 @@
          pRawToken = aToken.Clone();
      }
  
-@@ -2681,6 +3224,27 @@ BOOL ScCompiler::IsNamedRange( const String& rUpperName )
+@@ -2708,6 +3251,27 @@ BOOL ScCompiler::IsNamedRange( const String& rUpperName )
          return FALSE;
  }
  
@@ -2291,7 +2415,7 @@
  BOOL ScCompiler::IsDBRange( const String& rName )
  {
      USHORT n;
-@@ -3216,7 +3780,7 @@ BOOL ScCompiler::NextNewToken( bool bInArray )
+@@ -3243,7 +3807,7 @@ BOOL ScCompiler::NextNewToken( bool bInArray )
          if (mnPredetectedReference)
          {
              String aStr( cSymbol);
@@ -2300,7 +2424,7 @@
              {
                  /* TODO: it would be nice to generate a #REF! error here, which
                   * would need an ocBad token with additional error value.
-@@ -3279,6 +3843,7 @@ BOOL ScCompiler::NextNewToken( bool bInArray )
+@@ -3306,6 +3870,7 @@ BOOL ScCompiler::NextNewToken( bool bInArray )
                && !(bAllowBooleans && IsBoolean( aUpper ))
                && !IsValue( aUpper )
                && !IsNamedRange( aUpper )
@@ -2308,7 +2432,7 @@
                && !IsDBRange( aUpper )
                && !IsColRowName( aUpper )
                && !(bMayBeFuncName && IsMacro( aUpper ))
-@@ -3614,6 +4179,67 @@ BOOL ScCompiler::GetToken()
+@@ -3641,6 +4206,66 @@ BOOL ScCompiler::GetToken()
      }
      if( pToken->GetOpCode() == ocSubTotal )
          glSubTotal = TRUE;
@@ -2347,7 +2471,7 @@
 +                if (pNew)
 +                {
 +                    pToken = pNew->Clone();
-+                    return false;
++                    return true;
 +                }
 +            }
 +            break;
@@ -2364,7 +2488,6 @@
 +                ScTokenArray* pNew = pRefMgr->getDoubleRefTokens(pToken->GetIndex(), pToken->GetString(), aRange, &aPos);
 +                if (pNew)
 +                {
-+                    // This is already a new instance - no need to clone it.
 +                    PushTokenArray(pNew->Clone(), true);
 +                    return GetToken();
 +                }
@@ -2376,7 +2499,7 @@
      else if( pToken->GetOpCode() == ocName )
      {
          ScRangeData* pRangeData = pDoc->GetRangeName()->FindIndex( pToken->GetIndex() );
-@@ -5611,111 +6237,140 @@ ScToken* ScCompiler::CreateStringFromToken( rtl::OUStringBuffer& rBuffer, ScToke
+@@ -5638,111 +6263,140 @@ ScToken* ScCompiler::CreateStringFromToken( rtl::OUStringBuffer& rBuffer, ScToke
          DBG_ERRORFILE("unknown OpCode");
          rBuffer.append(ScGlobal::GetRscString(STR_NO_NAME_REF));
      }
@@ -8964,6 +9087,194 @@
          $(SLO)$/tablink.obj   	\
          $(SLO)$/arealink.obj   	\
          $(SLO)$/dbdocfun.obj 	\
+diff --git sc/source/ui/unoobj/docuno.cxx sc/source/ui/unoobj/docuno.cxx
+index 5a8c983..6a2fabf 100644
+--- sc/source/ui/unoobj/docuno.cxx
++++ sc/source/ui/unoobj/docuno.cxx
+@@ -123,6 +123,7 @@ const SfxItemPropertyMap* lcl_GetDocOptPropertyMap()
+         {MAP_CHAR_LEN(SC_UNO_COLLABELRNG),       0, &getCppuType((uno::Reference<sheet::XLabelRanges>*)0),    0, 0},
+         {MAP_CHAR_LEN(SC_UNO_DDELINKS),          0, &getCppuType((uno::Reference<container::XNameAccess>*)0), 0, 0},
+         {MAP_CHAR_LEN(SC_UNO_DEFTABSTOP),        0, &getCppuType((sal_Int16*)0),                              0, 0},
++        {MAP_CHAR_LEN(SC_UNO_EXTERNALDOCLINKS),  0, &getCppuType((uno::Reference<sheet::XExternalDocLinks>*)0), 0, 0},
+         {MAP_CHAR_LEN(SC_UNO_FORBIDDEN),         0, &getCppuType((uno::Reference<i18n::XForbiddenCharacters>*)0), beans::PropertyAttribute::READONLY, 0},
+         {MAP_CHAR_LEN(SC_UNO_HASDRAWPAGES),      0, &getBooleanCppuType(),                                    beans::PropertyAttribute::READONLY, 0},
+         {MAP_CHAR_LEN(SC_UNO_IGNORECASE),        0, &getBooleanCppuType(),                                    0, 0},
+@@ -1537,6 +1538,10 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const rtl::OUString& aPropertyNa
+ 		{
+ 			aRet <<= uno::Reference<container::XNameAccess>(new ScDDELinksObj( pDocShell ));
+ 		}
++        else if ( aString.EqualsAscii( SC_UNO_EXTERNALDOCLINKS ) )
++        {
++            aRet <<= uno::Reference<sheet::XExternalDocLinks>(new ScExternalDocLinksObj(pDocShell));
++        }
+ 		else if ( aString.EqualsAscii( SC_UNO_SHEETLINKS ) )
+ 		{
+ 			aRet <<= uno::Reference<container::XNameAccess>(new ScSheetLinksObj( pDocShell ));
+diff --git sc/source/ui/unoobj/linkuno.cxx sc/source/ui/unoobj/linkuno.cxx
+index 52a5a62..6afccbb 100644
+--- sc/source/ui/unoobj/linkuno.cxx
++++ sc/source/ui/unoobj/linkuno.cxx
+@@ -48,8 +48,20 @@
+ #include "hints.hxx"
+ #include "unonames.hxx"
+ #include "rangeseq.hxx"
++#include "token.hxx"
++
++#include <vector>
+ 
+ using namespace com::sun::star;
++using ::com::sun::star::uno::Any;
++using ::com::sun::star::uno::Reference;
++using ::com::sun::star::uno::Sequence;
++using ::com::sun::star::uno::UNO_QUERY;
++using ::com::sun::star::uno::UNO_QUERY_THROW;
++using ::com::sun::star::lang::IllegalArgumentException;
++using ::com::sun::star::uno::RuntimeException;
++using ::rtl::OUString;
++using ::std::vector;
+ 
+ //------------------------------------------------------------------------
+ 
+@@ -78,6 +90,8 @@ SC_SIMPLE_SERVICE_INFO( ScDDELinkObj, "ScDDELinkObj", "com.sun.star.sheet.DDELin
+ SC_SIMPLE_SERVICE_INFO( ScDDELinksObj, "ScDDELinksObj", "com.sun.star.sheet.DDELinks" )
+ SC_SIMPLE_SERVICE_INFO( ScSheetLinkObj, "ScSheetLinkObj", "com.sun.star.sheet.SheetLink" )
+ SC_SIMPLE_SERVICE_INFO( ScSheetLinksObj, "ScSheetLinksObj", "com.sun.star.sheet.SheetLinks" )
++SC_SIMPLE_SERVICE_INFO( ScExternalSheetCacheObj, "ScExternalSheetCacheObj", "com.sun.star.sheet.ExternalSheetCache" );
++SC_SIMPLE_SERVICE_INFO( ScExternalDocLinksObj, "ScExternalRefLinksObj", "com.sun.star.sheet.ExternalDocLinks" );
+ 
+ //------------------------------------------------------------------------
+ 
+@@ -1480,4 +1494,129 @@ uno::Reference< sheet::XDDELink > ScDDELinksObj::addDDELink(
+     return xLink;
+ }
+ 
+-//------------------------------------------------------------------------
++// ============================================================================
++
++ScExternalSheetCacheObj::ScExternalSheetCacheObj(ScExternalRefCache::Table* pTable) :
++    mpTable(pTable)
++{
++}
++
++ScExternalSheetCacheObj::~ScExternalSheetCacheObj()
++{
++}
++
++void SAL_CALL ScExternalSheetCacheObj::setCellValue(sal_Int32 nRow, sal_Int32 nCol, const Any& rValue)
++    throw (IllegalArgumentException, RuntimeException)
++{
++    if (nRow < 0 || nCol < 0)
++        throw IllegalArgumentException();
++
++    ScExternalRefCache::TokenRef pToken;
++    double fVal;
++    OUString aVal;
++    if (rValue >>= fVal)
++        pToken.reset(new ScDoubleToken(fVal));
++    else if (rValue >>= aVal)
++        pToken.reset(new ScStringToken(aVal));
++    else
++        // unidentified value type.
++        return;
++
++    mpTable->setCell(static_cast<SCROW>(nRow), static_cast<SCCOL>(nCol), pToken);
++}
++
++Any SAL_CALL ScExternalSheetCacheObj::getCellValue(sal_Int32 nRow, sal_Int32 nCol)
++    throw (IllegalArgumentException, RuntimeException)
++{
++    if (nRow < 0 || nCol < 0)
++        throw IllegalArgumentException();
++
++    ScToken* pToken = mpTable->getCell(nRow, nCol).get();
++    if (!pToken)
++        throw IllegalArgumentException();
++
++    Any aValue;
++    switch (pToken->GetType())
++    {
++        case svDouble:
++        {
++            double fVal = pToken->GetDouble();
++            aValue <<= fVal;
++        }
++        break;
++        case svString:
++        {
++            OUString aVal = pToken->GetString();
++            aValue <<= aVal;
++        }
++        break;
++        default:
++            throw IllegalArgumentException();
++    }
++    return aValue;
++}
++
++Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllRows()
++    throw (RuntimeException)
++{
++    vector<SCROW> aRows;
++    mpTable->getAllRows(aRows);
++    size_t nSize = aRows.size();
++    Sequence<sal_Int32> aRowsSeq(nSize);
++    for (size_t i = 0; i < nSize; ++i)
++        aRowsSeq[i] = aRows[i];
++
++    return aRowsSeq;
++}
++
++Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllColumns(sal_Int32 nRow)
++    throw (IllegalArgumentException, RuntimeException)
++{
++    if (nRow < 0)
++        throw IllegalArgumentException();
++
++    vector<SCCOL> aCols;
++    mpTable->getAllCols(static_cast<SCROW>(nRow), aCols);
++    size_t nSize = aCols.size();
++    Sequence<sal_Int32> aColsSeq(nSize);
++    for (size_t i = 0; i < nSize; ++i)
++        aColsSeq[i] = aCols[i];
++
++    return aColsSeq;
++}
++
++// ============================================================================
++
++ScExternalDocLinksObj::ScExternalDocLinksObj(ScDocShell* pDocShell) :
++    mpDocShell(pDocShell),
++    mpRefMgr(pDocShell->GetDocument()->GetExternalRefManager())
++{
++}
++
++ScExternalDocLinksObj::~ScExternalDocLinksObj()
++{
++}
++
++sal_Int32 SAL_CALL ScExternalDocLinksObj::getDocumentLinkIndex(const OUString& rDocName)
++        throw (RuntimeException)
++{
++    sal_uInt16 nFileId = mpRefMgr->getExternalFileId(rDocName);
++    return static_cast<sal_Int32>(nFileId);
++}
++
++Reference< sheet::XExternalSheetCache > SAL_CALL ScExternalDocLinksObj::getSheetCache(
++    sal_Int32 nDocIndex, const OUString& rSheetName, sal_Bool bCreateNew)
++        throw (IllegalArgumentException, RuntimeException)
++{
++    Reference< sheet::XExternalSheetCache > aSheetCache;
++    if (nDocIndex < 0)
++        throw IllegalArgumentException();
++
++    sal_uInt16 nFileId = static_cast<sal_uInt16>(nDocIndex);
++    ScExternalRefCache::Table* pTable = mpRefMgr->getCacheTable(nFileId, rSheetName, bCreateNew);
++
++    if (!pTable)
++        throw IllegalArgumentException();
++
++    return Reference< sheet::XExternalSheetCache > (new ScExternalSheetCacheObj(pTable));
++}
 diff --git sc/source/ui/view/tabvwsh4.cxx sc/source/ui/view/tabvwsh4.cxx
 index 436f0eb..2bf1f26 100644
 --- sc/source/ui/view/tabvwsh4.cxx



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