Kaydet (Commit) 5c3d9180 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

forms: Convert also com.sun.star.form.XForms.

Plus some associated cleanup.

Change-Id: I0a923198c23e2e4ecbc91e5b56cfac31b7f71256
üst 5d05f7ed
......@@ -108,7 +108,6 @@ $(eval $(call gb_Library_add_exception_objects,frm,\
forms/source/misc/limitedformats \
forms/source/misc/listenercontainers \
forms/source/misc/property \
forms/source/misc/services \
forms/source/resource/frm_resource \
forms/source/richtext/attributedispatcher \
forms/source/richtext/clipboarddispatcher \
......
......@@ -49,7 +49,6 @@ protected:
void disableFormattedWriteFake() { m_bWritingFormattedFake = false; }
bool lastReadWasFormattedFake() const { return (getLastReadVersion() & PF_FAKE_FORMATTED_FIELD) != 0; }
friend InterfaceRef SAL_CALL OEditModel_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
friend class OFormattedFieldWrapper;
friend class OFormattedModel; // temporary
......
......@@ -30,8 +30,7 @@
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
namespace frm
{
using namespace frm;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
......@@ -44,17 +43,6 @@ using namespace ::com::sun::star::io;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
Reference<XInterface> SAL_CALL OFormattedFieldWrapper_CreateInstance_ForceFormatted(const Reference<XMultiServiceFactory>& _rxFactory)
{
return OFormattedFieldWrapper::createFormattedFieldWrapper( comphelper::getComponentContext(_rxFactory), true);
}
InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory)
{
return OFormattedFieldWrapper::createFormattedFieldWrapper( comphelper::getComponentContext(_rxFactory), false);
}
OFormattedFieldWrapper::OFormattedFieldWrapper(const Reference<XComponentContext>& _rxFactory)
:m_xContext(_rxFactory)
{
......@@ -353,8 +341,6 @@ void OFormattedFieldWrapper::ensureAggregate()
decrement(m_refCount);
}
}
extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
com_sun_star_form_OFormattedFieldWrapper_get_implementation(::com::sun::star::uno::XComponentContext* component,
::com::sun::star::uno::Sequence<css::uno::Any> const &)
......
......@@ -59,9 +59,6 @@ protected:
protected:
virtual ~OFormattedFieldWrapper();
friend InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance_ForceFormatted(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
friend InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
public:
// UNO
DECLARE_UNO3_AGG_DEFAULTS(OFormattedFieldWrapper, OWeakAggObject)
......
......@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "FormsCollection.hxx"
#include "services.hxx"
#include <comphelper/sequence.hxx>
......@@ -25,42 +24,28 @@
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/form/XForm.hpp>
namespace frm
{
using namespace frm;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::form;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
InterfaceRef SAL_CALL OFormsCollection_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory)
{
return *(new OFormsCollection( comphelper::getComponentContext(_rxFactory) ));
}
OUString SAL_CALL OFormsCollection::getServiceName() throw(RuntimeException, std::exception)
{
return OUString("com.sun.star.form.Forms");
}
Sequence< sal_Int8 > SAL_CALL OFormsCollection::getImplementationId( ) throw(RuntimeException, std::exception)
{
return css::uno::Sequence<sal_Int8>();
}
Sequence<Type> SAL_CALL OFormsCollection::getTypes() throw(RuntimeException, std::exception)
{
return concatSequences(OInterfaceContainer::getTypes(), FormsCollectionComponentBase::getTypes(), OFormsCollection_BASE::getTypes());
}
OFormsCollection::OFormsCollection(const Reference<XComponentContext>& _rxFactory)
:FormsCollectionComponentBase( m_aMutex )
,OInterfaceContainer( _rxFactory, m_aMutex, cppu::UnoType<XForm>::get() )
......@@ -68,7 +53,6 @@ OFormsCollection::OFormsCollection(const Reference<XComponentContext>& _rxFactor
{
}
OFormsCollection::OFormsCollection( const OFormsCollection& _cloneSource )
:FormsCollectionComponentBase( m_aMutex )
,OInterfaceContainer( m_aMutex, _cloneSource )
......@@ -76,7 +60,6 @@ OFormsCollection::OFormsCollection( const OFormsCollection& _cloneSource )
{
}
OFormsCollection::~OFormsCollection()
{
if (!FormsCollectionComponentBase::rBHelper.bDisposed)
......@@ -86,7 +69,6 @@ OFormsCollection::~OFormsCollection()
}
}
Any SAL_CALL OFormsCollection::queryAggregation(const Type& _rType) throw(RuntimeException, std::exception)
{
Any aReturn = OFormsCollection_BASE::queryInterface(_rType);
......@@ -151,18 +133,14 @@ void OFormsCollection::setParent(const InterfaceRef& Parent) throw( NoSupportExc
m_xParent = Parent;
}
InterfaceRef OFormsCollection::getParent() throw( RuntimeException, std::exception )
{
return m_xParent;
}
} // namespace frm
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
com_sun_star_form_OFormsCollection_get_implementation(css::uno::XComponentContext* context,
css::uno::Sequence<css::uno::Any> const &)
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new frm::OFormsCollection(context));
}
......
This diff is collapsed.
/* -*- 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/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <config_features.h>
#include "services.hxx"
#include "frm_module.hxx"
#include <cppuhelper/factory.hxx>
#include <osl/diagnose.h>
#include <uno/mapping.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
static Sequence< OUString > s_aClassImplementationNames;
static Sequence<Sequence< OUString > > s_aClassServiceNames;
// need to use sal_Int64 instead of ComponentInstantiation, as ComponentInstantiation has no cppuType, so
// it can't be used with sequences
static Sequence<sal_Int64> s_aFactories;
void registerClassInfo(
const OUString& _rClassImplName, // the ImplName of the class
const Sequence< OUString >& _rServiceNames, // the services supported by this class
::cppu::ComponentInstantiation _pCreateFunction // the method for instantiating such a class
)
{
sal_Int32 nCurrentLength = s_aClassImplementationNames.getLength();
OSL_ENSURE((nCurrentLength == s_aClassServiceNames.getLength())
&& (nCurrentLength == s_aFactories.getLength()),
"forms::registerClassInfo : invalid class infos !");
s_aClassImplementationNames.realloc(nCurrentLength + 1);
s_aClassServiceNames.realloc(nCurrentLength + 1);
s_aFactories.realloc(nCurrentLength + 1);
s_aClassImplementationNames.getArray()[nCurrentLength] = _rClassImplName;
s_aClassServiceNames.getArray()[nCurrentLength] = _rServiceNames;
s_aFactories.getArray()[nCurrentLength] = reinterpret_cast<sal_Int64>(_pCreateFunction);
}
void ensureClassInfos()
{
if (s_aClassImplementationNames.getLength())
// nothing to do
return;
Sequence< OUString > aServices;
aServices.realloc(1);
aServices[0] = "com.sun.star.xforms.XForms";
registerClassInfo(
"com.sun.star.form.XForms",
aServices,
frm::XForms_CreateInstance);
}
extern "C"
{
SAL_DLLPUBLIC_EXPORT void* SAL_CALL frm_component_getFactory(const sal_Char* _pImplName, void* _pServiceManager, void* /*_pRegistryKey*/)
{
if (!_pServiceManager || !_pImplName)
return NULL;
// a lot of stuff which is implemented "manually" here in this file
void* pRet = NULL;
// collect the class infos
ensureClassInfos();
// both our static sequences should have the same length ...
sal_Int32 nClasses = s_aClassImplementationNames.getLength();
OSL_ENSURE((s_aClassServiceNames.getLength() == nClasses) &&
(s_aFactories.getLength() == nClasses),
"forms::component_getFactory : invalid class infos !");
// loop through the sequences and register the service providers
const OUString* pClasses = s_aClassImplementationNames.getConstArray();
const Sequence< OUString >* pServices = s_aClassServiceNames.getConstArray();
const sal_Int64* pFunctionsAsInts = s_aFactories.getConstArray();
for (sal_Int32 i=0; i<nClasses; ++i, ++pClasses, ++pServices, ++pFunctionsAsInts)
{
if (rtl_ustr_ascii_compare(pClasses->getStr(), _pImplName) == 0)
{
::cppu::ComponentInstantiation aCurrentCreateFunction =
reinterpret_cast< ::cppu::ComponentInstantiation>(*pFunctionsAsInts);
Reference<XSingleServiceFactory> xFactory(
::cppu::createSingleFactory(
static_cast<css::lang::XMultiServiceFactory*>(
_pServiceManager),
*pClasses,
aCurrentCreateFunction,
*pServices
)
);
if (xFactory.is())
{
xFactory->acquire();
pRet = xFactory.get();
break;
}
}
}
// the real way - use the OModule
if ( !pRet )
{
// let the module look for the component
Reference< XInterface > xRet;
xRet = ::frm::OFormsModule::getComponentFactory(
OUString::createFromAscii( _pImplName ),
static_cast< XMultiServiceFactory* >( _pServiceManager ) );
if ( xRet.is() )
xRet->acquire();
pRet = xRet.get();
}
return pRet;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -17,42 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "services.hxx"
#include "binding.hxx"
#include "model.hxx"
#include "NameContainer.hxx"
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
using com::sun::star::uno::Reference;
using com::sun::star::uno::XInterface;
using com::sun::star::lang::XMultiServiceFactory;
using com::sun::star::uno::RuntimeException;
using com::sun::star::form::binding::XValueBinding;
using com::sun::star::beans::XPropertySet;
using com::sun::star::container::XNameContainer;
using namespace ::com::sun::star;
namespace frm
extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* SAL_CALL
com_sun_star_form_XForms_get_implementation(uno::XComponentContext*,
uno::Sequence<uno::Any> const &)
{
Reference<XInterface> Model_CreateInstance(
const Reference<XMultiServiceFactory>& )
{
return static_cast<XPropertySet*>( static_cast<PropertySetBase*>( new xforms::Model ) );
}
Reference<XInterface> XForms_CreateInstance(
const Reference<XMultiServiceFactory>& )
{
return static_cast<XNameContainer*>( new NameContainer<Reference<XPropertySet> >() );
}
return cppu::acquire(new NameContainer<uno::Reference<beans::XPropertySet> >());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -288,7 +288,8 @@
<service name="com.sun.star.form.component.TimeField"/>
<service name="stardiv.one.form.component.TimeField"/>
</implementation>
<implementation name="com.sun.star.form.XForms">
<implementation name="com.sun.star.form.XForms"
constructor="com_sun_star_form_XForms_get_implementation">
<service name="com.sun.star.xforms.XForms"/>
</implementation>
</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