From 9ffb86c7e93c1633866ed89f0749831fd7f31a35 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 27 Mar 2013 10:41:40 +0200 Subject: fdo#46808, convert drawing::ColorTable to new style The service already existed, it just needed an IDL file. --- offapi/UnoApi_offapi.mk | 1 + offapi/com/sun/star/drawing/ColorTable.idl | 38 ++++++++++++++++++++++++++++ svx/source/accessibility/lookupcolorname.cxx | 19 ++++++-------- 3 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 offapi/com/sun/star/drawing/ColorTable.idl diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 3ad428aa9b47..b43877b1ca7a 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -116,6 +116,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/document,\ XMLOasisBasicImporter \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/drawing,\ + ColorTable \ GraphicExportFilter \ ModuleDispatcher \ ShapeCollection \ diff --git a/offapi/com/sun/star/drawing/ColorTable.idl b/offapi/com/sun/star/drawing/ColorTable.idl new file mode 100644 index 000000000000..3b9bcddd5d4c --- /dev/null +++ b/offapi/com/sun/star/drawing/ColorTable.idl @@ -0,0 +1,38 @@ +/* -*- 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_drawing_ColorTable_idl__ +#define __com_sun_star_drawing_ColorTable_idl__ + +#include + + +module com { module sun { module star { module drawing { + + +/** + @since LibreOffice 4.1 + */ +published service ColorTable : com::sun::star::container::XNameContainer; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/accessibility/lookupcolorname.cxx b/svx/source/accessibility/lookupcolorname.cxx index d0805d2f3e1a..b31f8f97f9b5 100644 --- a/svx/source/accessibility/lookupcolorname.cxx +++ b/svx/source/accessibility/lookupcolorname.cxx @@ -23,6 +23,7 @@ #include "boost/unordered_map.hpp" #include "com/sun/star/container/XNameAccess.hpp" #include "com/sun/star/container/XNameContainer.hpp" +#include "com/sun/star/drawing/ColorTable.hpp" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Reference.hxx" @@ -54,19 +55,15 @@ ColorNameMap::ColorNameMap() { try { // Create color table in which to look up the given color. - css::uno::Reference< css::container::XNameContainer > xColorTable ( - comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.drawing.ColorTable" ), - css::uno::UNO_QUERY); + css::uno::Reference< css::container::XNameContainer > xColorTable = + css::drawing::ColorTable::create( comphelper::getProcessComponentContext() ); // Get list of color names in order to iterate over the color table. - xNA = css::uno::Reference< css::container::XNameAccess >(xColorTable, css::uno::UNO_QUERY); - if (xNA.is()) - { - // Lock the solar mutex here as workarround for missing lock in - // called function. - SolarMutexGuard aGuard; - aNames = xNA->getElementNames(); - } + + // Lock the solar mutex here as workarround for missing lock in + // called function. + SolarMutexGuard aGuard; + aNames = xNA->getElementNames(); } catch (css::uno::RuntimeException const&) { -- cgit