Warning, file /office/calligra/libs/rdf/KoDocumentRdfEditWidget.h 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) 2010 KO GmbH <ben.martin@kogmbh.com> 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 0020 #ifndef __koDocumentRdfEditWidget_h__ 0021 #define __koDocumentRdfEditWidget_h__ 0022 0023 #include "kordf_export.h" 0024 #include "RdfForward.h" 0025 // Calligra 0026 #include <KoPageWidgetItem.h> 0027 // Qt 0028 #include <QWidget> 0029 0030 class KoDocumentRdf; 0031 class KoSemanticStylesheet; 0032 class QComboBox; 0033 0034 /** 0035 * @short A widget to let the user view and edit the Rdf for with the document 0036 * @author Ben Martin <ben.martin@kogmbh.com> 0037 * @see KoDocumentRdf 0038 * 0039 * This is initially used by the KoDocumentInfoDlg class to add a new page 0040 * that shows you and editable interface for your Rdf. The class was kept 0041 * as its own QWidget so that it can be moved to other dialogs and or shown 0042 * in many places. 0043 * 0044 * The widget lets the user edit Rdf that is stored both inline in content.xml 0045 * as well as from manifest.rdf and other external Rdf files from the OASIS 0046 * document. 0047 * 0048 */ 0049 class KORDF_EXPORT KoDocumentRdfEditWidget : public QWidget, public KoPageWidgetItem 0050 { 0051 Q_OBJECT 0052 public: 0053 0054 /** 0055 * The constructor 0056 * @param docRdf a pointer to the KoDocumentRdf to show/edit 0057 */ 0058 explicit KoDocumentRdfEditWidget(KoDocumentRdf *docRdf); 0059 0060 /** The destructor */ 0061 virtual ~KoDocumentRdfEditWidget(); 0062 0063 /** Add this widget to a user interface where you want Rdf editing */ 0064 QWidget *widget(); 0065 0066 bool shouldDialogCloseBeVetoed(); 0067 0068 /** OK button in dialog, if this returns false then do not close the dialog */ 0069 void apply(); 0070 0071 QString name() const; 0072 QString iconName() const; 0073 0074 public Q_SLOTS: 0075 0076 /** 0077 * Create a new triple in the model and UI in the Triples page. 0078 */ 0079 void addTriple(); 0080 0081 /** 0082 * copy the triples which are currently selected in the Triples 0083 * page. new triples will have a unique identifier appended to 0084 * their object to avoid attempting to insert the same 0085 * subj,pred,obj twice. 0086 */ 0087 void copyTriples(); 0088 0089 /** 0090 * Delete the selected triples in the Triples page 0091 */ 0092 void deleteTriples(); 0093 0094 /** 0095 * Create a new namespace 0096 */ 0097 void addNamespace(); 0098 0099 /** 0100 * Delete the selected namespaces 0101 */ 0102 void deleteNamespace(); 0103 0104 /** 0105 * Execute the SPARQL query the user has provided. 0106 * 0107 * query is taken from m_ui->m_sparqlQuery 0108 * results are added to m_ui->m_sparqlResultView 0109 */ 0110 void sparqlExecute(); 0111 0112 private Q_SLOTS: 0113 0114 /** 0115 * This methods set the default stylesheet to the 0116 * user selection for each type of KoRdfSemanticItem. 0117 */ 0118 void onDefaultSheetButtonClicked(); 0119 void onDefaultAllSheetButtonClicked(); 0120 0121 /** 0122 * Show a context menu for the semantic treeview 0123 */ 0124 void showSemanticViewContextMenu(const QPoint &at); 0125 0126 /** 0127 * The user edited a semantic item, update the view. 0128 */ 0129 void semanticObjectUpdated(hKoRdfBasicSemanticItem item); 0130 0131 private: 0132 0133 hKoSemanticStylesheet stylesheetFromComboBox(QComboBox *w) const; 0134 void applyStylesheetFromComboBox(QComboBox *comboBox) const; 0135 0136 private: 0137 class KoDocumentRdfEditWidgetPrivate; 0138 KoDocumentRdfEditWidgetPrivate *const d; 0139 0140 }; 0141 0142 #endif