Kaydet (Commit) ff59007a authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Skeleton for new excel biff format detector service.

Not used yet.

Change-Id: I1d3c28c46ec3b1830b8d0c656717e95677df9508
üst 3405eb11
...@@ -51,6 +51,7 @@ $(eval $(call gb_Library_use_libraries,scd,\ ...@@ -51,6 +51,7 @@ $(eval $(call gb_Library_use_libraries,scd,\
$(eval $(call gb_Library_add_exception_objects,scd,\ $(eval $(call gb_Library_add_exception_objects,scd,\
sc/source/ui/unoobj/detreg \ sc/source/ui/unoobj/detreg \
sc/source/ui/unoobj/scdetect \ sc/source/ui/unoobj/scdetect \
sc/source/ui/unoobj/exceldetect \
)) ))
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "scdetect.hxx" #include "scdetect.hxx"
#include "exceldetect.hxx"
#include <cppuhelper/implementationentry.hxx> #include <cppuhelper/implementationentry.hxx>
namespace { namespace {
...@@ -33,6 +34,14 @@ static const cppu::ImplementationEntry spServices[] = ...@@ -33,6 +34,14 @@ static const cppu::ImplementationEntry spServices[] =
0, 0 0, 0
}, },
{
ScExcelBiffDetect::impl_createInstance,
ScExcelBiffDetect::impl_getStaticImplementationName,
ScExcelBiffDetect::impl_getStaticSupportedServiceNames,
cppu::createSingleComponentFactory,
0, 0
},
{ 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0 }
}; };
......
/* -*- 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: */
/* -*- 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: */
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
static OUString impl_getStaticImplementationName(); static OUString impl_getStaticImplementationName();
/* Helper for registry */ /* 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 ) impl_createInstance( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext )
throw (com::sun::star::uno::Exception); throw (com::sun::star::uno::Exception);
......
...@@ -22,4 +22,7 @@ ...@@ -22,4 +22,7 @@
<implementation name="com.sun.star.comp.calc.FormatDetector"> <implementation name="com.sun.star.comp.calc.FormatDetector">
<service name="com.sun.star.frame.ExtendedTypeDetection"/> <service name="com.sun.star.frame.ExtendedTypeDetection"/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.calc.ExcelBiffFormatDetector">
<service name="com.sun.star.frame.ExtendedTypeDetection"/>
</implementation>
</component> </component>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment