Warning, file /office/calligra/libs/flake/KoFilterEffectRegistry.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the KDE project 0002 * Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Library General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public License 0015 * along with this library; see the file COPYING.LIB. If not, write to 0016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #include "KoFilterEffectRegistry.h" 0021 0022 #include <QGlobalStatic> 0023 0024 #include "KoFilterEffect.h" 0025 #include <KoPluginLoader.h> 0026 0027 #include <FlakeDebug.h> 0028 #include <KoXmlReader.h> 0029 0030 Q_GLOBAL_STATIC(KoFilterEffectRegistry, s_instance) 0031 0032 KoFilterEffectRegistry::KoFilterEffectRegistry() 0033 : d(0) 0034 { 0035 } 0036 0037 void KoFilterEffectRegistry::init() 0038 { 0039 KoPluginLoader::PluginsConfig config; 0040 config.whiteList = "FilterEffectPlugins"; 0041 config.blacklist = "FilterEffectPluginsDisabled"; 0042 KoPluginLoader::load(QStringLiteral("calligra/shapefiltereffects"), config); 0043 } 0044 0045 0046 KoFilterEffectRegistry::~KoFilterEffectRegistry() 0047 { 0048 qDeleteAll(doubleEntries()); 0049 qDeleteAll(values()); 0050 } 0051 0052 KoFilterEffectRegistry* KoFilterEffectRegistry::instance() 0053 { 0054 if (!s_instance.exists()) { 0055 s_instance->init(); 0056 } 0057 return s_instance; 0058 } 0059 0060 KoFilterEffect * KoFilterEffectRegistry::createFilterEffectFromXml(const KoXmlElement & element, const KoFilterEffectLoadingContext &context) 0061 { 0062 KoFilterEffectFactoryBase * factory = get(element.tagName()); 0063 if (!factory) 0064 return 0; 0065 0066 KoFilterEffect * filterEffect = factory->createFilterEffect(); 0067 if (filterEffect->load(element, context)) 0068 return filterEffect; 0069 0070 delete filterEffect; 0071 return 0; 0072 }