File indexing completed on 2024-05-12 13:04:44

0001 /*
0002  * This file is part of the KDE project
0003  * SPDX-FileCopyrightText: 2013 Shantanu Tushar <shantanu@kde.org>
0004  * SPDX-FileCopyrightText: 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.0-or-later
0007  */
0008 
0009 #include "CalligraQtQuickComponentsPlugin.h"
0010 
0011 #include "CQTextDocumentCanvas.h"
0012 #include "CQImageProvider.h"
0013 //#include "CQSpreadsheetCanvas.h"
0014 #include "CQPresentationCanvas.h"
0015 #include "CQCanvasControllerItem.h"
0016 #include "CQTextToCModel.h"
0017 //#include "CQSpreadsheetListModel.h"
0018 #include "CQPresentationModel.h"
0019 #include "CQThumbnailItem.h"
0020 #include "CQPluginLoaderProxy.h"
0021 #include "CQLinkArea.h"
0022 
0023 #include <QDeclarativeEngine>
0024 #include <QDeclarativeContext>
0025 
0026 void CalligraQtQuickComponentsPlugin::registerTypes(const char* uri)
0027 {
0028     Q_ASSERT(uri == QLatin1String("org.calligra.CalligraComponents"));
0029     qmlRegisterType<CQTextDocumentCanvas> (uri, 0, 1, "TextDocumentCanvas");
0030 //    qmlRegisterType<CQSpreadsheetCanvas> (uri, 0, 1, "SpreadsheetCanvas");
0031     qmlRegisterType<CQPresentationCanvas> (uri, 0, 1, "PresentationCanvas");
0032     qmlRegisterType<CQCanvasControllerItem> (uri, 0, 1, "CanvasControllerItem");
0033     qmlRegisterType<CQTextToCModel> (uri, 0, 1, "TextToCModel");
0034 //    qmlRegisterType<CQSpreadsheetListModel> (uri, 0, 1, "SpreadsheetListModel");
0035     qmlRegisterType<CQPresentationModel>(uri, 0, 1, "PresentationModel");
0036     qmlRegisterType<CQThumbnailItem>(uri, 0, 1, "Thumbnail");
0037     qmlRegisterType<CQLinkArea>( uri, 0, 1, "LinkArea" );
0038 }
0039 
0040 void CalligraQtQuickComponentsPlugin::initializeEngine(QDeclarativeEngine* engine, const char* uri)
0041 {
0042     CQImageProvider::s_imageProvider = new CQImageProvider;
0043     engine->addImageProvider(CQImageProvider::identificationString, CQImageProvider::s_imageProvider);
0044 
0045     engine->rootContext()->setContextProperty( "Calligra", new CQPluginLoaderProxy( engine ) );
0046 
0047     QDeclarativeExtensionPlugin::initializeEngine(engine, uri);
0048 }
0049 
0050 #include "CalligraQtQuickComponentsPlugin.moc"