Hi,
With regards to adapting UNO services to "new style", the case of
com.sun.star.sdb.tools.ConnectionTools.
It used to be invoked as follows (in file dbaccess/source/core/dataaccess/connection.cxx, method ):
m_xConnectionTools.set(
m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.sdb.tools.ConnectionTools",
aArguments, m_aContext),
UNO_QUERY_THROW );
The "convert to new style" commit (002aab309055b7feeeeeb25c1835b6abe6646729)
changed that to:
m_xConnectionTools = css::sdb::tools::ConnectionTools::create( m_aContext );
Which ignores aArguments, which creates a regression because
aArguments actually contained information that was needed...
So, I've added:
assert(Reference< XInitialization >(m_xConnectionTools, UNO_QUERY).is());
Reference< XInitialization > xInit(m_xConnectionTools, UNO_QUERY_THROW );
xInit->initialize(aArguments);
This seems to work.
But my question is: is this the new idiomatic way to invoke a service
with arguments, or can I make some change to the newly-introduced
offapi/com/sun/star/sdb/tools/ConnectionTools.idl so that the service
has e.g. some createWithArguments method instead of only "create"? Or
is there some wrapper that will do the above xInit-dance for me or
some such?
--
Lionel
Context
- new-style service and create with arguments · Lionel Elie Mamane
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.