File indexing completed on 2024-05-12 16:34:59

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2006 Thomas Zander <zander@kde.org>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 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 Library 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 #include "TextPlugin.h"
0020 #include "TextToolFactory.h"
0021 #include "ReferencesToolFactory.h"
0022 #include "ReviewToolFactory.h"
0023 #ifdef CREATE_TEXTDOCUMENT_INSPECTOR
0024 #include "TextDocumentInspectionDockerFactory.h"
0025 #endif
0026 #include "TextShapeFactory.h"
0027 #include "AnnotationTextShapeFactory.h"
0028 
0029 #include <KoShapeRegistry.h>
0030 #include <KoDockRegistry.h>
0031 #include <KoToolRegistry.h>
0032 
0033 #ifdef CREATE_TEXTDOCUMENT_INSPECTOR
0034 #include <KSharedConfig>
0035 #include <KConfigGroup>
0036 #endif
0037 #include <kpluginfactory.h>
0038 
0039 K_PLUGIN_FACTORY_WITH_JSON(TextPluginFactory, "calligra_shape_text.json",
0040                  registerPlugin<TextPlugin>();
0041 )
0042 
0043 TextPlugin::TextPlugin(QObject * parent, const QVariantList &)
0044         : QObject(parent)
0045 {
0046     KoToolRegistry::instance()->add(new TextToolFactory());
0047     KoToolRegistry::instance()->add(new ReviewToolFactory());
0048     KoToolRegistry::instance()->add(new ReferencesToolFactory());
0049     KoShapeRegistry::instance()->add(new TextShapeFactory());
0050     KoShapeRegistry::instance()->add(new AnnotationTextShapeFactory());
0051 
0052 #ifdef CREATE_TEXTDOCUMENT_INSPECTOR
0053     KConfigGroup debugConfigGroup( KSharedConfig::openConfig(), "Debug");
0054     const bool isInspectorEnabled  = (debugConfigGroup.readEntry("EnableTextDocumentInspector", QString()) == "true");
0055 
0056     if (isInspectorEnabled) {
0057         KoDockRegistry::instance()->add(new TextDocumentInspectionDockerFactory());
0058     }
0059 #endif
0060 }
0061 
0062 #include <TextPlugin.moc>