Kaydet (Commit) fb0f7c24 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, convert singleton util::theOfficeInstallationDirectories

.. to new-style UNO.

And deprecate old service in favour of singleton.

Change-Id: I67244097c22af02530214d7c529dd0d32f5964c1
üst 57dbe20c
...@@ -362,6 +362,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\ ...@@ -362,6 +362,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\
NumberFormatsSupplier \ NumberFormatsSupplier \
PathSubstitution \ PathSubstitution \
TextSearch \ TextSearch \
theOfficeInstallationDirectories \
UriAbbreviation \ UriAbbreviation \
URLTransformer \ URLTransformer \
)) ))
......
...@@ -39,24 +39,10 @@ module com { module sun { module star { module util { ...@@ -39,24 +39,10 @@ module com { module sun { module star { module util {
installations. installations.
@since OOo 2.0 @since OOo 2.0
@deprecated rather use the singleton theOfficeInstallationDirectories
*/ */
published service OfficeInstallationDirectories published service OfficeInstallationDirectories {
{ interface XOfficeInstallationDirectories;
/** provides access to the current office installation directories (office
base installation and user data).
*/
interface com::sun::star::util::XOfficeInstallationDirectories;
};
/** A singleton that provides access to the current office installation
directories.
@see OfficeInstallationDirectories
*/
published singleton theOfficeInstallationDirectories
{
service com::sun::star::util::OfficeInstallationDirectories;
}; };
......
/* -*- 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 .
*/
#ifndef __com_sun_star_util_theOfficeInstallationDirectories_idl__
#define __com_sun_star_util_theOfficeInstallationDirectories_idl__
#include <com/sun/star/util/XOfficeInstallationDirectories.idl>
module com { module sun { module star { module util {
/** encapsulates access to the current office installation directory and
office user data directory, provides functionality to create URLs
containing relocatable (not absolute) references to the current office
installation directory and user data directory and vice versa.
<p>This functionality is useful when data containing references to the
current office installation directory or user data directory must be made
persistent and re-read later. In many cases, storing the reference
directly would destroy the relocatability of an office installation and the
possibility to share one office user data directory among parallel office
installations.
*/
published singleton theOfficeInstallationDirectories : XOfficeInstallationDirectories;
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <com/sun/star/beans/XPropertyContainer.hpp> #include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/beans/StringPair.hpp> #include <com/sun/star/beans/StringPair.hpp>
#include <com/sun/star/util/theMacroExpander.hpp> #include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/util/theOfficeInstallationDirectories.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/document/XTypeDetection.hpp> #include <com/sun/star/document/XTypeDetection.hpp>
...@@ -2830,15 +2831,7 @@ void SfxURLRelocator_Impl::initOfficeInstDirs() ...@@ -2830,15 +2831,7 @@ void SfxURLRelocator_Impl::initOfficeInstDirs()
uno::Reference< XComponentContext > xCtx( uno::Reference< XComponentContext > xCtx(
comphelper::getComponentContext( mxFactory ) ); comphelper::getComponentContext( mxFactory ) );
xCtx->getValueByName( mxOfficeInstDirs = theOfficeInstallationDirectories::get(xCtx);
rtl::OUString(
"/singletons/"
"com.sun.star.util.theOfficeInstallationDirectories" ) )
>>= mxOfficeInstDirs;
OSL_ENSURE( mxOfficeInstDirs.is(),
"Unable to obtain office installation directory "
"singleton!" );
} }
} }
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp> #include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/util/XOfficeInstallationDirectories.hpp> #include <com/sun/star/util/theOfficeInstallationDirectories.hpp>
#include <ucbhelper/content.hxx> #include <ucbhelper/content.hxx>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
#include <salhelper/simplereferenceobject.hxx> #include <salhelper/simplereferenceobject.hxx>
...@@ -829,13 +829,7 @@ namespace svt ...@@ -829,13 +829,7 @@ namespace svt
{ {
uno::Reference< uno::XComponentContext > xCtx( uno::Reference< uno::XComponentContext > xCtx(
comphelper::getProcessComponentContext() ); comphelper::getProcessComponentContext() );
xCtx->getValueByName( m_xOfficeInstDirs = util::theOfficeInstallationDirectories::get(xCtx);
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"/singletons/com.sun.star.util.theOfficeInstallationDirectories" ) ) )
>>= m_xOfficeInstDirs;
OSL_ENSURE( m_xOfficeInstDirs.is(),
"Unable to obtain office directories singleton!" );
} }
} }
return m_xOfficeInstDirs; return m_xOfficeInstDirs;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/util/XOfficeInstallationDirectories.hpp> #include <com/sun/star/util/theOfficeInstallationDirectories.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/contentidentifier.hxx>
#include "hierarchyprovider.hxx" #include "hierarchyprovider.hxx"
...@@ -268,13 +268,7 @@ HierarchyContentProvider::getOfficeInstallationDirectories() ...@@ -268,13 +268,7 @@ HierarchyContentProvider::getOfficeInstallationDirectories()
{ {
OSL_ENSURE( m_xContext.is(), "No service manager!" ); OSL_ENSURE( m_xContext.is(), "No service manager!" );
m_xContext->getValueByName( m_xOfficeInstDirs = util::theOfficeInstallationDirectories::get(m_xContext);
rtl::OUString( "/singletons/com.sun.star.util.theOfficeInstallationDirectories" ) )
>>= m_xOfficeInstDirs;
// Be silent. singleton only available in an Office environment.
// OSL_ENSURE( m_xOfficeInstDirs.is(),
// "Unable to obtain office directories singleton!" );
} }
} }
return m_xOfficeInstDirs; return m_xOfficeInstDirs;
......
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