From b0a07d94095883c17ab444801a27d30819aec201 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 2 Mar 2020 15:13:37 +0200 Subject: remove some dead code GpgComponentFactory is unused since: commit 06d7dbb3568889aa50f46d6307a39fa53a17313b Date: Sun May 21 14:28:57 2017 +0200 gpg4libre: share static xmlsec lib between nss and gpg tableautoformatfield.cxx should have been removed in: commit 5990beed9aba690ea9487e2c4a64615b7504a0a1 Date: Fri Aug 29 16:37:43 2014 +0200 Dead code xmlRow is unused since initial import Change-Id: Ief186e9ef46238cc8cdb49f4adde52a45a98cbc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89830 Tested-by: Jenkins Reviewed-by: Noel Grandin --- bin/find-files-not-referenced-by-makefile.py | 53 ++++++++ include/test/sheet/tableautoformatfield.hxx | 33 ----- reportdesign/source/filter/xml/xmlRow.cxx | 166 ------------------------- test/source/sheet/tableautoformatfield.cxx | 65 ---------- xmlsecurity/source/gpg/GpgComponentFactory.cxx | 46 ------- 5 files changed, 53 insertions(+), 310 deletions(-) create mode 100755 bin/find-files-not-referenced-by-makefile.py delete mode 100644 include/test/sheet/tableautoformatfield.hxx delete mode 100644 reportdesign/source/filter/xml/xmlRow.cxx delete mode 100644 test/source/sheet/tableautoformatfield.cxx delete mode 100644 xmlsecurity/source/gpg/GpgComponentFactory.cxx diff --git a/bin/find-files-not-referenced-by-makefile.py b/bin/find-files-not-referenced-by-makefile.py new file mode 100755 index 000000000000..70232ed1c459 --- /dev/null +++ b/bin/find-files-not-referenced-by-makefile.py @@ -0,0 +1,53 @@ +#!/usr/bin/python2 + +# Look for CXX files that are not referenced by any makefile + +import subprocess +import sys + +sourceFiles = set() + +a = subprocess.Popen("git ls-files", stdout=subprocess.PIPE, shell=True) +with a.stdout as txt: + for filename in txt: + if filename.find(".cxx") != -1 \ + and filename.find("precompiled") == -1 \ + and filename.find("/workben") == -1 \ + and not filename.startswith("odk/examples/") \ + and not filename.startswith("bridges/") \ + and not filename.startswith("compilerplugins/") \ + and filename.find("/qa/") == -1 \ + and filename.find("/test/") == -1 \ + and not filename.startswith("testtools/") \ + and not filename.startswith("vcl/") \ + and not filename.startswith("cli_ure/"): + sourceFiles.add(filename.strip()) + +a = subprocess.Popen("git ls-files */*.mk", stdout=subprocess.PIPE, shell=True) +with a.stdout as txt: + for makefilename in txt: + makefilename = makefilename.strip() + with open(makefilename, "r") as makefile: + moduleName = makefilename[:makefilename.find("/")] + state = 0 + for line in makefile: + line = line.strip() + if state == 0 and "_add_exception_objects" in line: + state = 1 + elif state == 1 and line != "))": + s = line.replace("\\","").replace(")", "").strip() + # parse line like: $(call gb_Helper_optional,AVMEDIA,svx/source/sidebar/media/MediaPlaybackPanel) \ + idx = s.rfind(",") + if idx != -1: + s = s[idx+1:].strip() + sourceFiles.discard(s + ".cxx") + elif state == 1: + state = 0 + + + + +print "files not listed in makefile" +print "----------------------------" +for x in sorted(sourceFiles): + print x diff --git a/include/test/sheet/tableautoformatfield.hxx b/include/test/sheet/tableautoformatfield.hxx deleted file mode 100644 index 854b1c569bb1..000000000000 --- a/include/test/sheet/tableautoformatfield.hxx +++ /dev/null @@ -1,33 +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/. - */ - -#ifndef INCLUDED_TEST_SHEET_TABLEAUTOFORMATFIELD_HXX -#define INCLUDED_TEST_SHEET_TABLEAUTOFORMATFIELD_HXX - -#include - -namespace apitest { - -class TableAutoFormatField -{ -public: - //don't use virtual init() here - css::uno::Reference< css::beans::XPropertySet > initTest(); - - virtual css::uno::Reference< > getServiceFactory() = 0; - - void testRotateReference(); - void testVertJustify(); -}; - -} - -#endif // INCLUDED_TEST_SHEET_TABLEAUTOFORMATFIELD_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/filter/xml/xmlRow.cxx b/reportdesign/source/filter/xml/xmlRow.cxx deleted file mode 100644 index 7183f7062f56..000000000000 --- a/reportdesign/source/filter/xml/xmlRow.cxx +++ /dev/null @@ -1,166 +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 . - */ - -#include "xmlColumn.hxx" -#include -#include "xmlfilter.hxx" -#include -#include -#include -#include "xmlEnums.hxx" -#include "xmlStyleImport.hxx" -#include -#include -#include "strings.hxx" - -namespace rptxml -{ - using namespace ::comphelper; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::xml::sax; - - -OXMLRow::OXMLRow( ORptFilter& rImport - ,sal_uInt16 nPrfx - ,const OUString& _sLocalName - ,const Reference< XAttributeList > & _xAttrList - ,OXMLTable* _pContainer) : - SvXMLImportContext( rImport, nPrfx, _sLocalName ) - ,m_pContainer(_pContainer) -{ - - OSL_ENSURE(_xAttrList.is(),"Attribute list is NULL!"); - - const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap(); - const SvXMLTokenMap& rTokenMap = rImport.GetColumnTokenMap(); - - const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0; - for(sal_Int16 i = 0; i < nLength; ++i) - { - OUString sLocalName; - const OUString sAttrName = _xAttrList->getNameByIndex( i ); - const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName ); - const OUString sValue = _xAttrList->getValueByIndex( i ); - - switch( rTokenMap.Get( nPrefix, sLocalName ) ) - { - case XML_TOK_COLUMN_STYLE_NAME: - m_sStyleName = sValue; - break; - case XML_TOK_NUMBER_ROWS_SPANNED: - m_pContainer->setRowSpanned(sValue.toInt32()); - break; - default: - break; - } - } - -} - - -OXMLRow::~OXMLRow() -{ -} - -SvXMLImportContext* OXMLRow::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const Reference< XAttributeList > & xAttrList ) -{ - SvXMLImportContext *pContext = 0; - ORptFilter& rImport = GetOwnImport(); - const SvXMLTokenMap& rTokenMap = rImport.GetControlPropertyElemTokenMap(); - - switch( rTokenMap.Get( nPrefix, rLocalName ) ) - { - case XML_TOK_COLUMN: - rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = new OXMLRow( rImport, nPrefix, rLocalName,xAttrList,m_pContainer); - break; - case XML_TOK_ROW: - rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = new OXMLRow( rImport, nPrefix, rLocalName,xAttrList,m_pContainer); - break; - case XML_TOK_CELL: - rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = new OXMLRow( rImport, nPrefix, rLocalName,xAttrList,m_pContainer); - break; - case XML_TOK_COV_CELL: - rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = new OXMLRow( rImport, nPrefix, rLocalName,xAttrList,m_pContainer); - break; - default: - break; - } - - if( !pContext ) - pContext = xxx( GetImport(), nPrefix, rLocalName ); - - return pContext; -} - -void OXMLRow::EndElement() -{ - if ( m_sStyleName.getLength() ) - { - const SvXMLStylesContext* pAutoStyles = GetImport().GetAutoStyles(); - if ( pAutoStyles ) - { - PropertySetInfo* pInfo = new PropertySetInfo(); - static PropertyMapEntry pMap[] = - { - {PROPERTY_WIDTH, static_cast(PROPERTY_WIDTH.length), 0, &::cppu::UnoType::get() ,PropertyAttribute::BOUND,0}, - {PROPERTY_HEIGHT, static_cast(PROPERTY_HEIGHT.length), 0, &::cppu::UnoType::get() ,PropertyAttribute::BOUND,0}, - { NULL, 0, 0, NULL, 0, 0 } - }; - pInfo->add(pMap); - Reference xProp = GenericPropertySet_CreateInstance(pInfo); - XMLPropStyleContext* pAutoStyle = dynamic_cast< const XMLPropStyleContext *>(pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_COLUMN,m_sStyleName)); - if ( pAutoStyle ) - { - pAutoStyle->FillPropertySet(xProp); - sal_Int32 nWidth = 0; - xProp->getPropertyValue(PROPERTY_WIDTH) >>= nWidth; - m_pContainer->addWidth(nWidth); - } - else - { - pAutoStyle = dynamic_cast< const XMLPropStyleContext *>(pAutoStyles->FindStyleChildContext(XmlStyleFamily::TABLE_ROW,m_sStyleName)); - if ( pAutoStyle ) - { - pAutoStyle->FillPropertySet(xProp); - sal_Int32 nHeight = 0; - xProp->getPropertyValue(PROPERTY_HEIGHT) >>= nHeight; - m_pContainer->addHeight(nHeight); - } - } - } - } -} - -ORptFilter& OXMLRow::GetOwnImport() -{ - return static_cast(GetImport()); -} - -} // namespace rptxml - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/test/source/sheet/tableautoformatfield.cxx b/test/source/sheet/tableautoformatfield.cxx deleted file mode 100644 index 63387e5e388c..000000000000 --- a/test/source/sheet/tableautoformatfield.cxx +++ /dev/null @@ -1,65 +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/. - */ - -#include - -#include -#include "cppunit/extensions/HelperMacros.h" - -using namespace com::sun::star::uno; - -namespace apitest { - -uno::Reference< beans::XPropertySet > TableAutoFormatField::initTest() -{ - uno::Reference< container::XIndexAccess > xAutoFormatFields( getServiceFactory()->createInstance("com.sun.star.sheet.TableAutoFormats"), UNO_QUERY_THROW ); - uno::Reference< container::XIndexAccess > xIndex( xAutoFormatFields->getByIndex(0), UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xReturn( xIndex->getByIndex(0), UNO_QUERY_THROW ); - return xReturn; -} - -void TableAutoFormatField::testRotateReference() -{ - uno::Reference< beans::XPropertySet > xTableAutoFormatField = initTest(); - OUString aRotateReference("RotateReference"); - uno::Any aOldRotateReference = xTableAutoFormatField->getPropertyValue(aRotateReference); - sal_Int32 aValue = 0; - CPPUNIT_ASSERT(aOldRotateReference >>= aValue); - std::cout << "Old RotateReferene Value: " << aValue << std::endl; - - uno::Any aNewRotateReference; - aNewRotateReference <<= static_cast(3); - xTableAutoFormatField->setPropertyValue(aRotateReference, aNewRotateReference); - uno::Any aRotateReferenceControllValue = xTableAutoFormatField->getPropertyValue(aRotateReference); - CPPUNIT_ASSERT(aRotateReferenceControllValue >>= aValue); - std::cout << "New VertJustify value: " << aValue << std::endl; - CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue == 3); -} - -void TableAutoFormatField::testVertJustify() -{ - uno::Reference< beans::XPropertySet > xTableAutoFormatField = initTest(); - OUString aVertJustify("VertJustify"); - uno::Any aOldVertJustify = xTableAutoFormatField->getPropertyValue(aVertJustify); - sal_Int32 aValue = 0; - CPPUNIT_ASSERT(aOldVertJustify >>= aValue); - std::cout << "Old VertJustify value: " << aValue << std::endl; - - uno::Any aNewVertJustify; - aNewVertJustify <<= static_cast(3); - xTableAutoFormatField->setPropertyValue(aVertJustify, aNewVertJustify); - uno::Any aVertJustifyControllValue = xTableAutoFormatField->getPropertyValue(aVertJustify); - CPPUNIT_ASSERT(aVertJustifyControllValue >>= aValue); - std::cout << "New VertJustify value: " << aValue << std::endl; - CPPUNIT_ASSERT_MESSAGE("value has not been changed", aValue == 3); -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/gpg/GpgComponentFactory.cxx b/xmlsecurity/source/gpg/GpgComponentFactory.cxx deleted file mode 100644 index ef539a04b981..000000000000 --- a/xmlsecurity/source/gpg/GpgComponentFactory.cxx +++ /dev/null @@ -1,46 +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/. - */ - -#include - -#include - -#include "xmlsignature_gpgimpl.hxx" - -using namespace ::cppu; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_gpg_component_getFactory( const char* pImplName , void* pServiceManager , void* /*pRegistryKey*/ ) -{ - void* pRet = nullptr; - Reference< XSingleServiceFactory > xFactory ; - - if( pImplName != nullptr && pServiceManager != nullptr ) - { - if( XMLSignature_GpgImpl::impl_getImplementationName().equalsAscii( pImplName ) ) - { - xFactory = XMLSignature_GpgImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - } - } - - if( xFactory.is() ) { - xFactory->acquire() ; - pRet = xFactory.get() ; - } - - return pRet ; -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3