summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-02-04 22:45:24 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-02-05 01:24:21 -0500
commitff59007adbaadddcf7411e15d9c24eaad32c985f (patch)
treefc7e4bede47c43fc1a9dbbb647fbd11c5c663556 /sc
parent3405eb11dded8dc6c7e2463dfd83873d62528fbd (diff)
Skeleton for new excel biff format detector service.
Not used yet. Change-Id: I1d3c28c46ec3b1830b8d0c656717e95677df9508
Diffstat (limited to 'sc')
-rw-r--r--sc/Library_scd.mk1
-rw-r--r--sc/source/ui/unoobj/detreg.cxx9
-rw-r--r--sc/source/ui/unoobj/exceldetect.cxx64
-rw-r--r--sc/source/ui/unoobj/exceldetect.hxx46
-rw-r--r--sc/source/ui/unoobj/scdetect.hxx2
-rw-r--r--sc/util/scd.component3
6 files changed, 124 insertions, 1 deletions
diff --git a/sc/Library_scd.mk b/sc/Library_scd.mk
index 815ce7d26d70..93fe6b7f1667 100644
--- a/sc/Library_scd.mk
+++ b/sc/Library_scd.mk
@@ -51,6 +51,7 @@ $(eval $(call gb_Library_use_libraries,scd,\
$(eval $(call gb_Library_add_exception_objects,scd,\
sc/source/ui/unoobj/detreg \
sc/source/ui/unoobj/scdetect \
+ sc/source/ui/unoobj/exceldetect \
))
# vim: set noet sw=4 ts=4:
diff --git a/sc/source/ui/unoobj/detreg.cxx b/sc/source/ui/unoobj/detreg.cxx
index 8d7ad3118044..6edc743bc1ca 100644
--- a/sc/source/ui/unoobj/detreg.cxx
+++ b/sc/source/ui/unoobj/detreg.cxx
@@ -19,6 +19,7 @@
#include "scdetect.hxx"
+#include "exceldetect.hxx"
#include <cppuhelper/implementationentry.hxx>
namespace {
@@ -33,6 +34,14 @@ static const cppu::ImplementationEntry spServices[] =
0, 0
},
+ {
+ ScExcelBiffDetect::impl_createInstance,
+ ScExcelBiffDetect::impl_getStaticImplementationName,
+ ScExcelBiffDetect::impl_getStaticSupportedServiceNames,
+ cppu::createSingleComponentFactory,
+ 0, 0
+ },
+
{ 0, 0, 0, 0, 0, 0 }
};
diff --git a/sc/source/ui/unoobj/exceldetect.cxx b/sc/source/ui/unoobj/exceldetect.cxx
new file mode 100644
index 000000000000..f11cf176537f
--- /dev/null
+++ b/sc/source/ui/unoobj/exceldetect.cxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "exceldetect.hxx"
+
+using namespace com::sun::star;
+
+ScExcelBiffDetect::ScExcelBiffDetect( const uno::Reference<uno::XComponentContext>& /*xContext*/ ) {}
+ScExcelBiffDetect::~ScExcelBiffDetect() {}
+
+OUString ScExcelBiffDetect::getImplementationName() throw (uno::RuntimeException)
+{
+ return impl_getStaticImplementationName();
+}
+
+sal_Bool ScExcelBiffDetect::supportsService( const OUString& aName ) throw (uno::RuntimeException)
+{
+ uno::Sequence<OUString> aSrvNames = getSupportedServiceNames();
+ const OUString* pArray = aSrvNames.getConstArray();
+ for (sal_Int32 i = 0; i < aSrvNames.getLength(); ++i, ++pArray)
+ {
+ if (*pArray == aName)
+ return true;
+ }
+ return false;
+}
+
+uno::Sequence<OUString> ScExcelBiffDetect::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return impl_getStaticSupportedServiceNames();
+}
+
+OUString ScExcelBiffDetect::detect( uno::Sequence<beans::PropertyValue>& lDescriptor )
+ throw (uno::RuntimeException)
+{
+ return OUString();
+}
+
+uno::Sequence<OUString> ScExcelBiffDetect::impl_getStaticSupportedServiceNames()
+{
+ uno::Sequence<OUString> aNames(1);
+ aNames[0] = "com.sun.star.frame.ExtendedTypeDetection";
+ return aNames;
+}
+
+OUString ScExcelBiffDetect::impl_getStaticImplementationName()
+{
+ return OUString("com.sun.star.comp.calc.ExcelBiffFormatDetector");
+}
+
+uno::Reference<uno::XInterface> ScExcelBiffDetect::impl_createInstance(
+ const uno::Reference<uno::XComponentContext>& xContext )
+ throw (com::sun::star::uno::Exception)
+{
+ return static_cast<cppu::OWeakObject*>(new ScExcelBiffDetect(xContext));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/exceldetect.hxx b/sc/source/ui/unoobj/exceldetect.hxx
new file mode 100644
index 000000000000..d47d01691aba
--- /dev/null
+++ b/sc/source/ui/unoobj/exceldetect.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __SC_EXCELDETECT_HXX__
+#define __SC_EXCELDETECT_HXX__
+
+#include <cppuhelper/implbase2.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+}}}}
+
+class ScExcelBiffDetect : public cppu::WeakImplHelper2<com::sun::star::document::XExtendedFilterDetection, com::sun::star::lang::XServiceInfo>
+{
+public:
+ ScExcelBiffDetect( const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& xContext );
+ virtual ~ScExcelBiffDetect();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw( com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const OUString& aName ) throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( com::sun::star::uno::RuntimeException );
+
+ // XExtendedFilterDetection
+ virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& lDescriptor )
+ throw (com::sun::star::uno::RuntimeException);
+
+ static com::sun::star::uno::Sequence<OUString> impl_getStaticSupportedServiceNames();
+ static OUString impl_getStaticImplementationName();
+ static com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
+ impl_createInstance( const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& xContext )
+ throw (com::sun::star::uno::Exception);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/scdetect.hxx b/sc/source/ui/unoobj/scdetect.hxx
index a248f06eabab..63702f88eb8f 100644
--- a/sc/source/ui/unoobj/scdetect.hxx
+++ b/sc/source/ui/unoobj/scdetect.hxx
@@ -53,7 +53,7 @@ public:
static OUString impl_getStaticImplementationName();
/* Helper for registry */
- static com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
+ static com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
impl_createInstance( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext )
throw (com::sun::star::uno::Exception);
diff --git a/sc/util/scd.component b/sc/util/scd.component
index 4ed09965e631..767429abeeff 100644
--- a/sc/util/scd.component
+++ b/sc/util/scd.component
@@ -22,4 +22,7 @@
<implementation name="com.sun.star.comp.calc.FormatDetector">
<service name="com.sun.star.frame.ExtendedTypeDetection"/>
</implementation>
+ <implementation name="com.sun.star.comp.calc.ExcelBiffFormatDetector">
+ <service name="com.sun.star.frame.ExtendedTypeDetection"/>
+ </implementation>
</component>