diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-12-15 00:15:37 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-12-14 21:35:23 +0100 |
commit | 877205ccb1a66bec26817e9c51c53acca715c64b (patch) | |
tree | c00efbf3811b3c070e182124506a39ba3baced27 | |
parent | ad65448f3a3c1186c2c86970cbb7df1c48f81ba7 (diff) |
Simplify OOo2OasisTransformer
Change-Id: I212c3196060e4038cb265d10c841ebbbeb736ec4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178478
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | xmloff/source/transform/OOo2Oasis.cxx | 33 | ||||
-rw-r--r-- | xmloff/source/transform/OOo2Oasis.hxx | 26 | ||||
-rw-r--r-- | xmloff/source/transform/Transformer.hxx | 34 | ||||
-rw-r--r-- | xmloff/source/transform/TransformerBase.hxx | 10 |
4 files changed, 13 insertions, 90 deletions
diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx index a10203b1eb33..e29c43b7f1d5 100644 --- a/xmloff/source/transform/OOo2Oasis.cxx +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -1554,7 +1554,7 @@ OUString OOo2OasisTransformer::GetEventName( const OUString& rName, bool ) OOo2OasisTransformer::OOo2OasisTransformer( OUString aImplName, OUString aSubServiceName ) noexcept : - XMLTransformerBase( aActionTable, aTokenMap ), + OOo2OasisTransformer_BASE( aActionTable, aTokenMap ), m_aImplName(std::move(aImplName)), m_aSubServiceName(std::move(aSubServiceName)), m_pEventMap( nullptr ) @@ -1615,27 +1615,6 @@ OOo2OasisTransformer::~OOo2OasisTransformer() noexcept XMLEventOOoTransformerContext::FlushEventMap( m_pEventMap ); } -Any OOo2OasisTransformer::queryInterface( const Type& rType ) -{ - Any aRet; - if ( rType == cppu::UnoType<XImporter>::get()) - { - Reference<XImporter> xThis( this ); - aRet <<= xThis; - } - else if ( rType == cppu::UnoType<XFilter>::get()) - { - Reference<XFilter> xThis( this ); - aRet <<= xThis; - } - else - { - aRet = XMLTransformerBase::queryInterface(rType); - } - - return aRet; -} - // XImporter void SAL_CALL OOo2OasisTransformer::setTargetDocument( const Reference< XComponent >& xDoc ) @@ -1746,16 +1725,6 @@ Sequence< OUString > SAL_CALL OOo2OasisTransformer::getSupportedServiceNames( ) return { }; } -// XTypeProvider -Sequence< css::uno::Type > SAL_CALL OOo2OasisTransformer::getTypes() -{ - return cppu::OTypeCollection( - cppu::UnoType<XImporter>::get(), - cppu::UnoType<XFilter>::get(), - XMLTransformerBase::getTypes() - ).getTypes(); -} - // Service registration extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* diff --git a/xmloff/source/transform/OOo2Oasis.hxx b/xmloff/source/transform/OOo2Oasis.hxx index 3d7fb89c524c..0fb278197d98 100644 --- a/xmloff/source/transform/OOo2Oasis.hxx +++ b/xmloff/source/transform/OOo2Oasis.hxx @@ -26,10 +26,10 @@ class XMLTransformerOOoEventMap_Impl; -class OOo2OasisTransformer : - public XMLTransformerBase, - public css::document::XImporter, - public css::document::XFilter +using OOo2OasisTransformer_BASE = cppu::ImplInheritanceHelper<XMLTransformerBase, + css::document::XImporter, + css::document::XFilter>; +class OOo2OasisTransformer : public OOo2OasisTransformer_BASE { OUString const m_aImplName; OUString const m_aSubServiceName; @@ -50,21 +50,6 @@ public: OUString aSubServiceName ) noexcept; virtual ~OOo2OasisTransformer() noexcept override; - // XInterface - - // (XInterface methods need to be implemented to disambiguate - // between those inherited through XMLTransformerBase and - // the new interfaces). - - virtual css::uno::Any SAL_CALL queryInterface( - const css::uno::Type& aType ) override; - - virtual void SAL_CALL acquire( ) noexcept override - { XMLTransformerBase::acquire(); }; - - virtual void SAL_CALL release( ) noexcept override - { XMLTransformerBase::release(); }; - // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; @@ -74,9 +59,6 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - // XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; - // XImporter virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override; diff --git a/xmloff/source/transform/Transformer.hxx b/xmloff/source/transform/Transformer.hxx deleted file mode 100644 index 1c7569350c8f..000000000000 --- a/xmloff/source/transform/Transformer.hxx +++ /dev/null @@ -1,34 +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/. - * - * 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 . - */ - -#pragma once - -#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/implbase.hxx> - -class XMLTransformer : public ::cppu::WeakImplHelper< - css::xml::sax::XExtendedDocumentHandler, - css::lang::XServiceInfo, - css::lang::XInitialization> -{ -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/transform/TransformerBase.hxx b/xmloff/source/transform/TransformerBase.hxx index 8fb4e6adfd69..a5e6261883f8 100644 --- a/xmloff/source/transform/TransformerBase.hxx +++ b/xmloff/source/transform/TransformerBase.hxx @@ -24,15 +24,19 @@ #include <vector> #include <memory> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> #include <com/sun/star/xml/sax/XLocator.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XModel.hpp> + +#include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> #include <xmloff/xmltoken.hxx> #include <xmloff/namespacemap.hxx> -#include "Transformer.hxx" #include "TransformerActions.hxx" #include "TransformerTokenMap.hxx" @@ -49,7 +53,9 @@ class XMLMutableAttributeList; const sal_uInt16 INVALID_ACTIONS = 0xffff; -class XMLTransformerBase : public XMLTransformer +class XMLTransformerBase : public cppu::WeakImplHelper<css::xml::sax::XExtendedDocumentHandler, + css::lang::XServiceInfo, + css::lang::XInitialization> { friend class XMLTransformerContext; |