ooo-build r13734 - in trunk: . patches/dev300
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r13734 - in trunk: . patches/dev300
- Date: Sat, 30 Aug 2008 00:51:31 +0000 (UTC)
Author: kyoshida
Date: Sat Aug 30 00:51:31 2008
New Revision: 13734
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13734&view=rev
Log:
2008-08-29 Kohei Yoshida <kyoshida novell com>
* patches/dev300/calc-external-defined-names.diff:
* patches/dev300/calc-external-defined-names-offapi.diff: implemented
the API with the new style services and interfaces.
Modified:
trunk/ChangeLog
trunk/patches/dev300/calc-external-defined-names-offapi.diff
trunk/patches/dev300/calc-external-defined-names.diff
Modified: trunk/patches/dev300/calc-external-defined-names-offapi.diff
==============================================================================
--- trunk/patches/dev300/calc-external-defined-names-offapi.diff (original)
+++ trunk/patches/dev300/calc-external-defined-names-offapi.diff Sat Aug 30 00:51:31 2008
@@ -1,9 +1,68 @@
+diff --git offapi/com/sun/star/sheet/ExternalDocLink.idl offapi/com/sun/star/sheet/ExternalDocLink.idl
+new file mode 100644
+index 0000000..7320905
+--- /dev/null
++++ offapi/com/sun/star/sheet/ExternalDocLink.idl
+@@ -0,0 +1,53 @@
++/*************************************************************************
++ *
++ * 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_ExternalDocLink_idl__
++#define __com_sun_star_sheet_ExternalDocLink_idl__
++
++#include <com/sun/star/sheet/XExternalDocLink.idl>
++
++module com { module sun { module star { module sheet {
++
++/** Represents a single external document link.
++
++ <p>An external document link contains cached data used for external cell
++ and cell range references as well as external range names.</p>
++
++ @see com::sun::star::sheet::XExternalDocLink
++
++ @since OOo 3.1.0
++ */
++service ExternalDocLink : XExternalDocLink
++{
++};
++
++}; }; }; };
++
++#endif
diff --git offapi/com/sun/star/sheet/ExternalDocLinks.idl offapi/com/sun/star/sheet/ExternalDocLinks.idl
new file mode 100644
-index 0000000..765e8ff
+index 0000000..105cb8f
--- /dev/null
+++ offapi/com/sun/star/sheet/ExternalDocLinks.idl
-@@ -0,0 +1,51 @@
+@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -38,29 +97,33 @@
+#define __com_sun_star_sheet_ExternalDocLinks_idl__
+
+#include <com/sun/star/sheet/XExternalDocLinks.idl>
-+
-+//=============================================================================
++#include <com/sun/star/sheet/XSpreadsheetDocument.idl>
+
+module com { module sun { module star { module sheet {
+
-+//=============================================================================
++/** Represents a collection of external document links.
++
++ <p>An external document link contains cached data used for external cell
++ and cell range references as well as external range names.</p>
+
-+service ExternalDocLinks
++ @see com::sun::star::sheet::ExternalDocLink
++ @see com::sun::star::sheet::XExternalDocLinks
++
++ @since OOo 3.1.0
++ */
++service ExternalDocLinks : XExternalDocLinks
+{
-+ 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
+index 0000000..17af156
--- /dev/null
+++ offapi/com/sun/star/sheet/ExternalSheetCache.idl
-@@ -0,0 +1,51 @@
+@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -96,28 +159,100 @@
+
+#include <com/sun/star/sheet/XExternalSheetCache.idl>
+
-+//=============================================================================
-+
+module com { module sun { module star { module sheet {
+
-+//=============================================================================
-+
-+service ExternalSheetCache
++/** A single sheet cache for an external document.
++
++ <p>This cached data is used for external cell and cell range references,
++ as well as external range names. An <type scope="com::sun::star::sheet">ExternalDocLink</type>
++ instance contains a set of these sheet caches.</p>
++
++ @see com::sun::star::sheet::ExternalDocLink
++ @see com::sun::star::sheet::XExternalSheetCache
++
++ @since OOo 3.1.0
++ */
++service ExternalSheetCache : XExternalSheetCache
+{
-+ interface com::sun::star::sheet::XExternalSheetCache;
+};
+
-+//=============================================================================
++}; }; }; };
++
++#endif
+diff --git offapi/com/sun/star/sheet/XExternalDocLink.idl offapi/com/sun/star/sheet/XExternalDocLink.idl
+new file mode 100644
+index 0000000..65928c5
+--- /dev/null
++++ offapi/com/sun/star/sheet/XExternalDocLink.idl
+@@ -0,0 +1,62 @@
++/*************************************************************************
++ *
++ * 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_XExternalDocLink_idl__
++#define __com_sun_star_sheet_XExternalDocLink_idl__
++
++#include <com/sun/star/sheet/XExternalSheetCache.idl>
++
++module com { module sun { module star { module sheet {
++
++/** Primary interface for the <type scope="com::sun::star::sheet">ExternalDocLink</type> service.
++
++ @see com::sun::star::sheet::ExternalDocLink
++
++ @since OOo 3.1.0
++ */
++interface XExternalDocLink
++{
++ /** <p>This method adds a new sheet cache instance to the extternal document
++ link for a specified sheet name. If a sheet cache instance already
++ exists for the specified name, then the existing instance is returned.</p>
++
++ <p>Note that a sheet name lookup is performed in a case-insensitive
++ fashion.</p>
++
++ @param aSheetName sheet name
++
++ @return com::sun::star::sheet::XExternalSheetCache sheet cache instance
++ */
++ com::sun::star::sheet::XExternalSheetCache addSheetCache( [in] string aSheetName );
++};
+
+}; }; }; };
+
+#endif
diff --git offapi/com/sun/star/sheet/XExternalDocLinks.idl offapi/com/sun/star/sheet/XExternalDocLinks.idl
new file mode 100644
-index 0000000..a28fa87
+index 0000000..384d405
--- /dev/null
+++ offapi/com/sun/star/sheet/XExternalDocLinks.idl
-@@ -0,0 +1,57 @@
+@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -151,36 +286,45 @@
+#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>
-+
-+//=============================================================================
++#include <com/sun/star/sheet/XExternalDocLink.idl>
++#include <com/sun/star/container/XNameAccess.idl>
++#include <com/sun/star/container/XIndexAccess.idl>
++#include <com/sun/star/container/XEnumerationAccess.idl>
+
+module com { module sun { module star { module sheet {
+
-+//=============================================================================
-+
-+interface XExternalDocLinks: com::sun::star::uno::XInterface
++/** Primary interface for the <type scope="com::sun::star::sheet">ExternalDocLinks</type> service.
++
++ @see com::sun::star::sheet::ExternalDocLinks
++
++ @since OOo 3.1.0
++ */
++interface XExternalDocLinks
+{
-+ 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);
++ interface com::sun::star::container::XNameAccess;
++ interface com::sun::star::container::XIndexAccess;
++ interface com::sun::star::container::XEnumerationAccess;
++
++ /** This method adds a new external document link by its URL, and returns
++ its instance. If an document instance already exists for the specified URL,
++ then that instance gets returned instead of creating a new one.
++
++ @param aDocName document URL (e.g. file:///path/to/document.ods)
++
++ @return com::sun::star::sheet::XExternalDocLink external document link instance
++ */
++ com::sun::star::sheet::XExternalDocLink addDocLink( [in] string aDocName );
+};
+
-+//=============================================================================
-+
+}; }; }; };
+
+#endif
diff --git offapi/com/sun/star/sheet/XExternalSheetCache.idl offapi/com/sun/star/sheet/XExternalSheetCache.idl
new file mode 100644
-index 0000000..4027eb0
+index 0000000..0c35f7f
--- /dev/null
+++ offapi/com/sun/star/sheet/XExternalSheetCache.idl
-@@ -0,0 +1,61 @@
+@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -214,51 +358,76 @@
+#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
++/** Primary interface for the <type scope="com::sun::star::sheet">ExternalSheetCache</type> service.
++
++ @see com::sun::star::sheet::ExternalSheetCache
++
++ @since OOo 3.1.0
++ */
++interface XExternalSheetCache
+{
++ /** It sets a cached value for a specified cell position. The value is expected
++ to be either of type <type>string</type> or of type <type>double</type>. No
++ other data types are supported.
++
++ @param nRow row position (0-based)
++ @param nColumn column position (0-based)
++ @param aValue cell value to be cached
++ */
+ void setCellValue( [in] long nRow, [in] long nColumn, [in] any aValue )
+ raises (com::sun::star::lang::IllegalArgumentException);
+
++ /** It retrieves a cached value from a specified cell position. The cached
++ value can be either <type>string</type> or <type>double</type>.
++
++ @return any cached cell value
++ */
+ any getCellValue( [in] long nRow, [in] long nColumn )
+ raises (com::sun::star::lang::IllegalArgumentException);
+
++ /** It returns a list of all row numbers where a cached cell or cells exist.
++ The row numbers are sorted in ascending order.
++
++ @return sequence<long> list of all row numbers with cached cell(s)
++ */
+ sequence< long > getAllRows();
+
++ /** Given a row number, this method returns a list of all columns numbers
++ that store cached cell values in that row. The column numbers are
++ sorted in ascending order.
++
++ @return sequence<long> list of all columns numbers with cached cell values
++ */
+ 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
+index c1d2844..16dffda 100644
--- offapi/com/sun/star/sheet/makefile.mk
+++ offapi/com/sun/star/sheet/makefile.mk
-@@ -123,6 +123,8 @@ IDLFILES=\
+@@ -123,6 +123,9 @@ IDLFILES=\
DatabaseRangesEnumeration.idl\
DDELinkMode.idl\
DocumentSettings.idl\
++ ExternalDocLink.idl\
+ ExternalDocLinks.idl\
+ ExternalSheetCache.idl\
FillDateMode.idl\
FillDirection.idl\
FillMode.idl\
-@@ -255,6 +257,8 @@ IDLFILES=\
+@@ -255,6 +258,9 @@ IDLFILES=\
XDocumentAuditing.idl\
XDrillDownDataSupplier.idl\
XEnhancedMouseClickBroadcaster.idl\
++ XExternalDocLink.idl\
+ XExternalDocLinks.idl\
+ XExternalSheetCache.idl\
XExternalSheetName.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 Sat Aug 30 00:51:31 2008
@@ -594,40 +594,42 @@
+
+#endif
diff --git sc/inc/linkuno.hxx sc/inc/linkuno.hxx
-index b6fc524..1edf816 100644
+index b6fc524..926fed7 100644
--- sc/inc/linkuno.hxx
+++ sc/inc/linkuno.hxx
-@@ -36,6 +36,8 @@
+@@ -36,6 +36,9 @@
#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/XExternalDocLink.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 @@
+@@ -45,10 +48,15 @@
#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/implbase1.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/implbase5.hxx>
+#include "externalrefmgr.hxx"
++
++#include <hash_map>
++#include <vector>
class ScAreaLink;
class ScDocShell;
-@@ -493,8 +497,85 @@ public:
+@@ -493,8 +501,108 @@ public:
throw(::com::sun::star::uno::RuntimeException);
};
+// ============================================================================
-
-+class ScExternalSheetCacheObj : public cppu::WeakImplHelper2<
-+ ::com::sun::star::sheet::XExternalSheetCache,
-+ ::com::sun::star::lang::XServiceInfo >
++
++class ScExternalSheetCacheObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalSheetCache >
+{
+public:
+ explicit ScExternalSheetCacheObj(ScExternalRefCache::Table* pTable);
@@ -647,16 +649,6 @@
+ 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&);
@@ -664,43 +656,78 @@
+private:
+ ScExternalRefCache::Table* mpTable;
+};
-
++
+// ============================================================================
+
++class ScExternalDocLinkObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalDocLink >
++{
++public:
++ ScExternalDocLinkObj(ScExternalRefManager* pRefMgr, sal_uInt16 nFileId);
++ ~ScExternalDocLinkObj();
++
++ // XExternalDocLink
++ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >
++ SAL_CALL addSheetCache( const ::rtl::OUString& aSheetName )
++ throw (::com::sun::star::uno::RuntimeException);
++
++private:
++ ScExternalRefManager* mpRefMgr;
++ sal_uInt16 mnFileId;
++};
++
++// ============================================================================
+
+/** This is the UNO API equivalent of ScExternalRefManager. */
-+class ScExternalDocLinksObj : public cppu::WeakImplHelper2<
-+ ::com::sun::star::sheet::XExternalDocLinks,
-+ ::com::sun::star::lang::XServiceInfo >
++class ScExternalDocLinksObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalDocLinks >
+{
+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);
++ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLink >
++ SAL_CALL addDocLink( const ::rtl::OUString& aDocName )
++ throw (::com::sun::star::uno::RuntimeException);
++
++ // XNameAccess
++ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
++ throw(::com::sun::star::container::NoSuchElementException,
++ ::com::sun::star::lang::WrappedTargetException,
++ ::com::sun::star::uno::RuntimeException);
++ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
++ throw(::com::sun::star::uno::RuntimeException);
++ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
++ throw(::com::sun::star::uno::RuntimeException);
++
++ // XIndexAccess
++ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
++ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex )
++ throw(::com::sun::star::lang::IndexOutOfBoundsException,
++ ::com::sun::star::lang::WrappedTargetException,
++ ::com::sun::star::uno::RuntimeException);
++
++ // XEnumerationAccess
++ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
++ createEnumeration() throw(::com::sun::star::uno::RuntimeException);
++
++ // XElementAccess
++ virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
++ throw(::com::sun::star::uno::RuntimeException);
++ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ ScExternalDocLinksObj();
+ ScExternalDocLinksObj(const ScExternalDocLinksObj&);
+
+private:
-+ ScDocShell* mpDocShell;
-+ ScExternalRefManager* mpRefMgr;
++ typedef ::std::hash_map<
++ ::rtl::OUString,
++ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLink >,
++ ::rtl::OUStringHash > DocLinkMap;
++ DocLinkMap maDocLinks;
++ ::std::vector< ::rtl::OUString > maDocNames;
++ ScDocShell* mpDocShell;
++ ScExternalRefManager* mpRefMgr;
+};
#endif
@@ -9111,7 +9138,7 @@
{
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
+index 52a5a62..96a074e 100644
--- sc/source/ui/unoobj/linkuno.cxx
+++ sc/source/ui/unoobj/linkuno.cxx
@@ -48,8 +48,20 @@
@@ -9135,16 +9162,7 @@
//------------------------------------------------------------------------
-@@ -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(
+@@ -1480,4 +1492,223 @@ uno::Reference< sheet::XDDELink > ScDDELinksObj::addDDELink(
return xLink;
}
@@ -9163,6 +9181,7 @@
+void SAL_CALL ScExternalSheetCacheObj::setCellValue(sal_Int32 nRow, sal_Int32 nCol, const Any& rValue)
+ throw (IllegalArgumentException, RuntimeException)
+{
++ ScUnoGuard aGuard;
+ if (nRow < 0 || nCol < 0)
+ throw IllegalArgumentException();
+
@@ -9183,6 +9202,7 @@
+Any SAL_CALL ScExternalSheetCacheObj::getCellValue(sal_Int32 nRow, sal_Int32 nCol)
+ throw (IllegalArgumentException, RuntimeException)
+{
++ ScUnoGuard aGuard;
+ if (nRow < 0 || nCol < 0)
+ throw IllegalArgumentException();
+
@@ -9214,6 +9234,7 @@
+Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllRows()
+ throw (RuntimeException)
+{
++ ScUnoGuard aGuard;
+ vector<SCROW> aRows;
+ mpTable->getAllRows(aRows);
+ size_t nSize = aRows.size();
@@ -9227,6 +9248,7 @@
+Sequence< sal_Int32 > SAL_CALL ScExternalSheetCacheObj::getAllColumns(sal_Int32 nRow)
+ throw (IllegalArgumentException, RuntimeException)
+{
++ ScUnoGuard aGuard;
+ if (nRow < 0)
+ throw IllegalArgumentException();
+
@@ -9242,6 +9264,27 @@
+
+// ============================================================================
+
++ScExternalDocLinkObj::ScExternalDocLinkObj(ScExternalRefManager* pRefMgr, sal_uInt16 nFileId) :
++ mpRefMgr(pRefMgr), mnFileId(nFileId)
++{
++}
++
++ScExternalDocLinkObj::~ScExternalDocLinkObj()
++{
++}
++
++Reference< sheet::XExternalSheetCache > SAL_CALL ScExternalDocLinkObj::addSheetCache(
++ const OUString& aSheetName )
++ throw (RuntimeException)
++{
++ ScUnoGuard aGuard;
++ ScExternalRefCache::Table* pTable = mpRefMgr->getCacheTable(mnFileId, aSheetName, true);
++ Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(pTable));
++ return aSheetCache;
++}
++
++// ============================================================================
++
+ScExternalDocLinksObj::ScExternalDocLinksObj(ScDocShell* pDocShell) :
+ mpDocShell(pDocShell),
+ mpRefMgr(pDocShell->GetDocument()->GetExternalRefManager())
@@ -9252,29 +9295,98 @@
+{
+}
+
-+sal_Int32 SAL_CALL ScExternalDocLinksObj::getDocumentLinkIndex(const OUString& rDocName)
++Reference< sheet::XExternalDocLink > SAL_CALL ScExternalDocLinksObj::addDocLink(
++ const OUString& aDocName )
+ throw (RuntimeException)
+{
-+ sal_uInt16 nFileId = mpRefMgr->getExternalFileId(rDocName);
-+ return static_cast<sal_Int32>(nFileId);
++ ScUnoGuard aGuard;
++ sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocName);
++ Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpRefMgr, nFileId));
++ maDocLinks.insert( DocLinkMap::value_type(aDocName, aDocLink) );
++ maDocNames.push_back(aDocName);
++ return aDocLink;
+}
+
-+Reference< sheet::XExternalSheetCache > SAL_CALL ScExternalDocLinksObj::getSheetCache(
-+ sal_Int32 nDocIndex, const OUString& rSheetName, sal_Bool bCreateNew)
-+ throw (IllegalArgumentException, RuntimeException)
++Any SAL_CALL ScExternalDocLinksObj::getByName(const::rtl::OUString &aName)
++ throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
+{
-+ Reference< sheet::XExternalSheetCache > aSheetCache;
-+ if (nDocIndex < 0)
-+ throw IllegalArgumentException();
++ ScUnoGuard aGuard;
++ DocLinkMap::const_iterator itr = maDocLinks.find(aName);
++ if (itr == maDocLinks.end())
++ throw container::NoSuchElementException();
++
++ Any aAny;
++ aAny <<= itr->second;
++ return aAny;
++}
++
++Sequence< OUString > SAL_CALL ScExternalDocLinksObj::getElementNames()
++ throw (RuntimeException)
++{
++ ScUnoGuard aGuard;
++ size_t n = maDocNames.size();
++ Sequence<OUString> aSeq(n);
++ for (size_t i = 0; i < n; ++i)
++ aSeq[i] = maDocNames[i];
++ return aSeq;
++}
+
-+ sal_uInt16 nFileId = static_cast<sal_uInt16>(nDocIndex);
-+ ScExternalRefCache::Table* pTable = mpRefMgr->getCacheTable(nFileId, rSheetName, bCreateNew);
++sal_Bool SAL_CALL ScExternalDocLinksObj::hasByName(const OUString &aName)
++ throw (RuntimeException)
++{
++ ScUnoGuard aGuard;
++ return static_cast<sal_Bool>(maDocLinks.count(aName) > 0);
++}
+
-+ if (!pTable)
-+ throw IllegalArgumentException();
++sal_Int32 SAL_CALL ScExternalDocLinksObj::getCount()
++ throw (RuntimeException)
++{
++ ScUnoGuard aGuard;
++ return static_cast<sal_Int32>(maDocLinks.size());
++}
++
++Any SAL_CALL ScExternalDocLinksObj::getByIndex(sal_Int32 nIndex)
++ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, RuntimeException)
++{
++ ScUnoGuard aGuard;
++ if (nIndex < 0 || nIndex >= static_cast<sal_Int32>(maDocNames.size()))
++ throw lang::IndexOutOfBoundsException();
++
++ const OUString& rDocName = maDocNames[nIndex];
++ DocLinkMap::const_iterator itr = maDocLinks.find(rDocName);
++ if (itr == maDocLinks.end())
++ // This should never happen!
++ throw lang::IndexOutOfBoundsException();
++
++ Any aAny;
++ aAny <<= itr->second;
++ return aAny;
++}
++
++Reference< container::XEnumeration >SAL_CALL ScExternalDocLinksObj::createEnumeration()
++ throw (RuntimeException)
++{
++ ScUnoGuard aGuard;
++ Reference< container::XEnumeration > aRef(
++ new ScIndexEnumeration(this, OUString::createFromAscii(
++ "com.sun.star.sheet.ExternalDocLinks")));
++ return aRef;
++}
++
++uno::Type SAL_CALL ScExternalDocLinksObj::getElementType()
++ throw (RuntimeException)
++{
++ ScUnoGuard aGuard;
++ return getCppuType(static_cast<Reference<sheet::XExternalDocLinks>*>(0));
++}
+
-+ return Reference< sheet::XExternalSheetCache > (new ScExternalSheetCacheObj(pTable));
++sal_Bool SAL_CALL ScExternalDocLinksObj::hasElements()
++ throw (RuntimeException)
++{
++ ScUnoGuard aGuard;
++ return static_cast<sal_Bool>(!maDocLinks.empty());
+}
++
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]