File indexing completed on 2024-05-05 17:09:07

0001 /*
0002  * This file is part of the KDE project
0003  * Copyright (C) 2013 Shantanu Tushar <shantanu@kde.org>
0004  * Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Library General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Library General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Library General Public License
0017  * along with this library; see the file COPYING.LIB.  If not, write to
0018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019  * Boston, MA 02110-1301, USA.
0020  */
0021 
0022 #include "CalligraQtQuickComponentsPlugin.h"
0023 
0024 #include "CQTextDocumentCanvas.h"
0025 #include "CQImageProvider.h"
0026 //#include "CQSpreadsheetCanvas.h"
0027 #include "CQPresentationCanvas.h"
0028 #include "CQCanvasControllerItem.h"
0029 #include "CQTextToCModel.h"
0030 //#include "CQSpreadsheetListModel.h"
0031 #include "CQPresentationModel.h"
0032 #include "CQThumbnailItem.h"
0033 #include "CQPluginLoaderProxy.h"
0034 #include "CQLinkArea.h"
0035 
0036 #include <QDeclarativeEngine>
0037 #include <QDeclarativeContext>
0038 
0039 void CalligraQtQuickComponentsPlugin::registerTypes(const char* uri)
0040 {
0041     Q_ASSERT(uri == QLatin1String("org.calligra.CalligraComponents"));
0042     qmlRegisterType<CQTextDocumentCanvas> (uri, 0, 1, "TextDocumentCanvas");
0043 //    qmlRegisterType<CQSpreadsheetCanvas> (uri, 0, 1, "SpreadsheetCanvas");
0044     qmlRegisterType<CQPresentationCanvas> (uri, 0, 1, "PresentationCanvas");
0045     qmlRegisterType<CQCanvasControllerItem> (uri, 0, 1, "CanvasControllerItem");
0046     qmlRegisterType<CQTextToCModel> (uri, 0, 1, "TextToCModel");
0047 //    qmlRegisterType<CQSpreadsheetListModel> (uri, 0, 1, "SpreadsheetListModel");
0048     qmlRegisterType<CQPresentationModel>(uri, 0, 1, "PresentationModel");
0049     qmlRegisterType<CQThumbnailItem>(uri, 0, 1, "Thumbnail");
0050     qmlRegisterType<CQLinkArea>( uri, 0, 1, "LinkArea" );
0051 }
0052 
0053 void CalligraQtQuickComponentsPlugin::initializeEngine(QDeclarativeEngine* engine, const char* uri)
0054 {
0055     CQImageProvider::s_imageProvider = new CQImageProvider;
0056     engine->addImageProvider(CQImageProvider::identificationString, CQImageProvider::s_imageProvider);
0057 
0058     engine->rootContext()->setContextProperty( "Calligra", new CQPluginLoaderProxy( engine ) );
0059 
0060     QDeclarativeExtensionPlugin::initializeEngine(engine, uri);
0061 }
0062 
0063 #include "CalligraQtQuickComponentsPlugin.moc"