From 0fb1ba1bd8474f08065871686cf201cdfc5a25e8 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 24 Nov 2017 00:13:47 +0300 Subject: [PATCH] plugin extracted --- demo_r1/demo_reports/change_alignment.lrxml | 105 ++ ...t1_report_header_group_subdetail_TOC.lrxml | 141 ++- designer_plugin/designer_plugin.pro | 44 + designer_plugin/limereport.pri | 257 ++++ designer_plugin/lrdesignerplugin.cpp | 31 + designer_plugin/lrdesignerplugin.h | 20 + designer_plugin/main.cpp | 13 + include/lrrenderengine.h | 91 ++ limerender/limerender.h | 120 ++ limerender/limerender.pri | 156 +++ limerender/limerender.pro | 124 ++ limerender/limerender_p.h | 192 +++ limerender/lrreportrender.cpp | 1104 +++++++++++++++++ limereport.pro | 2 +- .../items/editors/lrfonteditorwidget.cpp | 125 +- limereport/items/editors/lrfonteditorwidget.h | 60 +- .../items/editors/lritemeditorwidget.cpp | 42 +- limereport/items/editors/lritemeditorwidget.h | 33 +- .../editors/lritemsborderseditorwidget.cpp | 64 +- .../editors/lritemsborderseditorwidget.h | 40 +- .../editors/lrtextalignmenteditorwidget.cpp | 159 ++- .../editors/lrtextalignmenteditorwidget.h | 57 +- limereport/limereport.pri | 201 +-- limereport/lrdesignelementsfactory.h | 2 +- limereport/lrdesignerplugininterface.h | 30 + limereport/lrpreviewreportwindow.cpp | 4 +- limereport/lrreportdesignwidget.cpp | 37 +- limereport/lrreportdesignwidget.h | 6 +- limereport/lrreportdesignwindow.cpp | 20 +- limereport/lrreportdesignwindow.h | 4 +- limereport/lrreportengine.cpp | 64 +- limereport/lrreportengine_p.h | 39 +- limereport/scripteditor/lrscripteditor.cpp | 2 +- limereport/scripteditor/lrscripteditor.h | 6 +- 34 files changed, 3025 insertions(+), 370 deletions(-) create mode 100644 demo_r1/demo_reports/change_alignment.lrxml create mode 100644 designer_plugin/designer_plugin.pro create mode 100644 designer_plugin/limereport.pri create mode 100644 designer_plugin/lrdesignerplugin.cpp create mode 100644 designer_plugin/lrdesignerplugin.h create mode 100644 designer_plugin/main.cpp create mode 100644 include/lrrenderengine.h create mode 100644 limerender/limerender.h create mode 100644 limerender/limerender.pri create mode 100644 limerender/limerender.pro create mode 100644 limerender/limerender_p.h create mode 100644 limerender/lrreportrender.cpp create mode 100644 limereport/lrdesignerplugininterface.h diff --git a/demo_r1/demo_reports/change_alignment.lrxml b/demo_r1/demo_reports/change_alignment.lrxml new file mode 100644 index 0000000..507954e --- /dev/null +++ b/demo_r1/demo_reports/change_alignment.lrxml @@ -0,0 +1,105 @@ + + + + + + + page1 + + + + + + + + Reportpage1 + + + + TextItem1 + + + + + Reportpage1 + + + + + + + $S{ +const Alignment = { + Left : 1, + Right: 2, + HCenter: 4, + Justify: 8, + Top: 32, + Bottom: 64, + VCenter: 128 +} + +THIS.alignment = (Alignment.Right | Alignment.Bottom); + "Test" +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + datasources + + + + + + + + + + + + + + diff --git a/demo_r1/demo_reports/demoReport1_report_header_group_subdetail_TOC.lrxml b/demo_r1/demo_reports/demoReport1_report_header_group_subdetail_TOC.lrxml index 732b484..141b5b0 100644 --- a/demo_r1/demo_reports/demoReport1_report_header_group_subdetail_TOC.lrxml +++ b/demo_r1/demo_reports/demoReport1_report_header_group_subdetail_TOC.lrxml @@ -5,23 +5,23 @@ page2 - + - + TOC - + DataBand1 - + TextItem1 - + @@ -32,12 +32,12 @@ - $D{tableofcontens.Content} + $D{tableofcontents.Content} - + @@ -61,7 +61,7 @@ TextItem2 - + @@ -74,17 +74,17 @@ $S{ getFieldByKeyField( - "tableofcontens", + "tableofcontents", "Page number", "Content Key", - "$D{tableofcontens.Content Key}" + "$D{tableofcontents.Content Key}" ) } - + @@ -120,7 +120,7 @@ getFieldByKeyField( - tableofcontens + tableofcontents @@ -152,27 +152,29 @@ getFieldByKeyField( + + page1 - + - + ReportPage1 - + ReportHeader1 - + TextItem1 - + @@ -189,7 +191,7 @@ Report - + @@ -213,7 +215,7 @@ Report ImageItem1 - + @@ -228,6 +230,7 @@ Report + @@ -236,7 +239,7 @@ Report ShapeItem1 - + @@ -258,7 +261,7 @@ Report ShapeItem2 - + @@ -280,7 +283,7 @@ Report TextItem9 - + @@ -296,7 +299,7 @@ Report - + @@ -320,7 +323,7 @@ Report TextItem10 - + @@ -336,7 +339,7 @@ Report - + @@ -377,11 +380,11 @@ Report DataBand1 - + TextItem3 - + @@ -397,7 +400,7 @@ Report - + @@ -421,7 +424,7 @@ Report TextItem4 - + @@ -437,7 +440,7 @@ Report - + @@ -461,7 +464,7 @@ Report TextItem12 - + @@ -477,7 +480,7 @@ Report - + @@ -501,7 +504,7 @@ Report TextItem16 - + @@ -517,7 +520,7 @@ Report - + @@ -541,7 +544,7 @@ Report TextItem17 - + @@ -557,7 +560,7 @@ Report - + @@ -607,11 +610,11 @@ Report GroupBandHeader1 - + TextItem2 - + @@ -627,7 +630,7 @@ Report - + @@ -651,7 +654,7 @@ Report ShapeItem3 - + @@ -673,7 +676,7 @@ Report TextItem11 - + @@ -689,7 +692,7 @@ Report - + @@ -735,11 +738,11 @@ Report SubDetailBand1 - + TextItem5 - + @@ -755,7 +758,7 @@ Report - + @@ -779,7 +782,7 @@ Report TextItem6 - + @@ -795,7 +798,7 @@ Report - + @@ -819,7 +822,7 @@ Report TextItem7 - + @@ -835,7 +838,7 @@ Report - + @@ -859,7 +862,7 @@ Report TextItem13 - + @@ -875,7 +878,7 @@ Report - + @@ -921,11 +924,11 @@ Report SubDetailFooterBand1 - + TextItem8 - + @@ -941,7 +944,7 @@ Report - + @@ -965,7 +968,7 @@ Report TextItem14 - + @@ -981,7 +984,7 @@ Report - + @@ -1005,7 +1008,7 @@ Report TextItem15 - + @@ -1021,7 +1024,7 @@ Report - + @@ -1045,7 +1048,7 @@ Report ShapeItem4 - + @@ -1085,11 +1088,11 @@ Report PageFooter1 - + TextItem18 - + @@ -1105,7 +1108,7 @@ Report - + @@ -1146,11 +1149,11 @@ Report PageHeader18 - + TextItem19 - + @@ -1166,7 +1169,7 @@ Report - + @@ -1225,6 +1228,8 @@ Report + + @@ -1278,15 +1283,15 @@ var firstLevel = "&nbsp;&nbsp;&nbsp;&nbsp;"; var secondLevel = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; function SB1AfterData(){ - addTableOfContensItem(getField("orders.OrderID"),firstLevel+getField("orders.OrderID")); + addTableOfContentsItem(getField("orders.OrderID"),firstLevel+getField("orders.OrderID")); } function SB2AfterData(){ - addTableOfContensItem(getField("orders.OrderID")+getField("orderItems.ProductName"), secondLevel+"<i>"+getField("orderItems.ProductName")+"</i>"); + addTableOfContentsItem(getField("orders.OrderID")+getField("orderItems.ProductName"), secondLevel+"<i>"+getField("orderItems.ProductName")+"</i>"); } function SB3AfterData(){ - addTableOfContensItem(getField("orders.CompanyName"), "<b>"+getField("orders.CompanyName")+"</b>"); + addTableOfContentsItem(getField("orders.CompanyName"), "<b>"+getField("orders.CompanyName")+"</b>"); } diff --git a/designer_plugin/designer_plugin.pro b/designer_plugin/designer_plugin.pro new file mode 100644 index 0000000..9c0ebcb --- /dev/null +++ b/designer_plugin/designer_plugin.pro @@ -0,0 +1,44 @@ +include(../common.pri) +include(limereport.pri) +QT += core gui + +contains(CONFIG,release) { + TARGET = LRDesigner_plugin +} else { + TARGET = LRDesigner_plugind +} + +TEMPLATE = lib +CONFIG += plugin + +HEADERS += \ + lrdesignerplugin.h +SOURCES += \ + lrdesignerplugin.cpp + +INCLUDEPATH += $$PWD/../include +DEPENDPATH += $$PWD/../include + +macx{ + CONFIG += lib_bundle + CONFIG += -dll +} + +DESTDIR = $${DEST_LIBS} +unix { + target.path = $${DESTDIR} + INSTALLS = target +} + + +contains(CONFIG,zint){ + message(zint) + INCLUDEPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt + DEPENDPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt + LIBS += -L$${DEST_LIBS} + contains(CONFIG,release) { + LIBS += -lQtZint + } else { + LIBS += -lQtZintd + } +} diff --git a/designer_plugin/limereport.pri b/designer_plugin/limereport.pri new file mode 100644 index 0000000..f1455ed --- /dev/null +++ b/designer_plugin/limereport.pri @@ -0,0 +1,257 @@ +include(../common.pri) + +DEFINES += IS_REPORT_DESIGNER + +contains(CONFIG,dialogdesigner){ + include($$REPORT_PATH/dialogdesigner/dialogdesigner.pri) +} + +DEFINES += INSPECT_BASEDESIGN + +INCLUDEPATH += \ + $$REPORT_PATH/ \ + $$REPORT_PATH/items \ + $$REPORT_PATH/bands \ + $$REPORT_PATH/base \ + $$REPORT_PATH/objectinspector \ + $$REPORT_PATH/databrowser \ + $$REPORT_PATH/scripteditor \ + $$REPORT_PATH/../designer_plugin + +SOURCES += \ + $$REPORT_PATH/bands/lrpageheader.cpp \ + $$REPORT_PATH/bands/lrpagefooter.cpp \ + $$REPORT_PATH/bands/lrreportheader.cpp \ + $$REPORT_PATH/bands/lrreportfooter.cpp \ + $$REPORT_PATH/bands/lrdataband.cpp \ + $$REPORT_PATH/bands/lrgroupbands.cpp \ + $$REPORT_PATH/bands/lrsubdetailband.cpp \ + $$REPORT_PATH/bands/lrtearoffband.cpp \ + $$REPORT_PATH/databrowser/lrdatabrowser.cpp \ + $$REPORT_PATH/databrowser/lrsqleditdialog.cpp \ + $$REPORT_PATH/databrowser/lrconnectiondialog.cpp \ + $$REPORT_PATH/databrowser/lrvariabledialog.cpp \ + $$REPORT_PATH/databrowser/lrdatabrowsertree.cpp \ + $$REPORT_PATH/serializators/lrxmlqrectserializator.cpp \ + $$REPORT_PATH/serializators/lrxmlbasetypesserializators.cpp \ + $$REPORT_PATH/serializators/lrxmlreader.cpp \ + $$REPORT_PATH/serializators/lrxmlwriter.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.cpp \ + $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.cpp \ + $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrfonteditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrimageeditor.cpp \ + $$REPORT_PATH/objectinspector/editors/lrcoloreditor.cpp \ + $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.cpp \ + $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.cpp \ + $$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \ + $$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \ + $$REPORT_PATH/objectinspector/lrpropertydelegate.cpp \ + $$REPORT_PATH/objectsbrowser/lrobjectbrowser.cpp \ + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp \ + $$REPORT_PATH/scripteditor/lrscripteditor.cpp \ + $$REPORT_PATH/scripteditor/lrcodeeditor.cpp \ + $$REPORT_PATH/scripteditor/lrscripthighlighter.cpp \ + $$REPORT_PATH/items/lrsubitemparentpropitem.cpp \ + $$REPORT_PATH/items/lralignpropitem.cpp \ + $$REPORT_PATH/items/lrhorizontallayout.cpp \ + $$REPORT_PATH/items/editors/lritemeditorwidget.cpp \ + $$REPORT_PATH/items/editors/lrfonteditorwidget.cpp \ + $$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.cpp \ + $$REPORT_PATH/items/editors/lritemsaligneditorwidget.cpp \ + $$REPORT_PATH/items/editors/lritemsborderseditorwidget.cpp \ + $$REPORT_PATH/items/lrsimpletagparser.cpp \ + $$REPORT_PATH/items/lrimageitem.cpp \ + $$REPORT_PATH/items/lrtextitemeditor.cpp \ + $$REPORT_PATH/items/lrshapeitem.cpp \ + $$REPORT_PATH/items/lrtextitem.cpp \ + $$REPORT_PATH/translationeditor/translationeditor.cpp \ + $$REPORT_PATH/lrbanddesignintf.cpp \ + $$REPORT_PATH/lrpageitemdesignintf.cpp \ + $$REPORT_PATH/lrpagedesignintf.cpp \ + $$REPORT_PATH/lrbandsmanager.cpp \ + $$REPORT_PATH/lrglobal.cpp \ + $$REPORT_PATH/lritemdesignintf.cpp \ + $$REPORT_PATH/lrdatadesignintf.cpp \ + $$REPORT_PATH/lrreportdesignwidget.cpp \ + $$REPORT_PATH/lrbasedesignintf.cpp \ + $$REPORT_PATH/lrreportengine.cpp \ + $$REPORT_PATH/lrdatasourcemanager.cpp \ + $$REPORT_PATH/lrreportdesignwindow.cpp \ +# $$REPORT_PATH/lrreportrender.cpp \ + $$REPORT_PATH/lrscriptenginemanager.cpp \ + $$REPORT_PATH/lrpreviewreportwindow.cpp \ + $$REPORT_PATH/lrpreviewreportwidget.cpp \ + $$REPORT_PATH/lrgraphicsviewzoom.cpp \ + $$REPORT_PATH/lrvariablesholder.cpp \ + $$REPORT_PATH/lrgroupfunctions.cpp \ + $$REPORT_PATH/lrsimplecrypt.cpp \ + $$REPORT_PATH/lraboutdialog.cpp \ + $$REPORT_PATH/lrsettingdialog.cpp \ + $$REPORT_PATH/lritemscontainerdesignitf.cpp \ + $$REPORT_PATH/lrcolorindicator.cpp \ + $$REPORT_PATH/items/lrchartitem.cpp \ + $$REPORT_PATH/items/lrchartitemeditor.cpp \ + $$REPORT_PATH/lrreporttranslation.cpp \ + $$REPORT_PATH/translationeditor/languageselectdialog.cpp + +contains(CONFIG, staticlib){ + SOURCES += $$REPORT_PATH/lrfactoryinitializer.cpp +} + +contains(CONFIG, zint){ + SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp +} + +HEADERS += \ + $$REPORT_PATH/base/lrsingleton.h \ + $$REPORT_PATH/base/lrsimpleabstractfactory.h \ + $$REPORT_PATH/base/lrattribsabstractfactory.h \ + $$REPORT_PATH/bands/lrpageheader.h \ + $$REPORT_PATH/bands/lrpagefooter.h \ + $$REPORT_PATH/bands/lrreportheader.h \ + $$REPORT_PATH/bands/lrreportfooter.h \ + $$REPORT_PATH/bands/lrdataband.h \ + $$REPORT_PATH/bands/lrtearoffband.h \ + $$REPORT_PATH/bands/lrsubdetailband.h \ + $$REPORT_PATH/bands/lrgroupbands.h \ + $$REPORT_PATH/databrowser/lrdatabrowser.h \ + $$REPORT_PATH/databrowser/lrsqleditdialog.h \ + $$REPORT_PATH/databrowser/lrconnectiondialog.h \ + $$REPORT_PATH/databrowser/lrvariabledialog.h \ + $$REPORT_PATH/databrowser/lrdatabrowsertree.h \ + $$REPORT_PATH/serializators/lrserializatorintf.h \ + $$REPORT_PATH/serializators/lrstorageintf.h \ + $$REPORT_PATH/serializators/lrxmlqrectserializator.h \ + $$REPORT_PATH/serializators/lrxmlserializatorsfactory.h \ + $$REPORT_PATH/serializators/lrxmlbasetypesserializators.h \ + $$REPORT_PATH/serializators/lrxmlreader.h \ + $$REPORT_PATH/serializators/lrxmlwriter.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.h \ + $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.h \ + $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.h \ + $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.h \ + $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.h \ + $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.h \ + $$REPORT_PATH/objectinspector/editors/lrimageeditor.h \ + $$REPORT_PATH/objectinspector/editors/lrcoloreditor.h \ + $$REPORT_PATH/objectinspector/editors/lrfonteditor.h \ + $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.h \ + $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.h \ + $$REPORT_PATH/objectinspector/lrobjectitemmodel.h \ + $$REPORT_PATH/objectinspector/lrobjectpropitem.h \ + $$REPORT_PATH/objectinspector/lrpropertydelegate.h \ + $$REPORT_PATH/objectsbrowser/lrobjectbrowser.h \ + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \ + $$REPORT_PATH/scripteditor/lrscripteditor.h \ + $$REPORT_PATH/scripteditor/lrcodeeditor.h \ + $$REPORT_PATH/scripteditor/lrscripthighlighter.h \ + $$REPORT_PATH/items/editors/lritemeditorwidget.h \ + $$REPORT_PATH/items/editors/lrfonteditorwidget.h \ + $$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.h \ + $$REPORT_PATH/items/editors/lritemsaligneditorwidget.h \ + $$REPORT_PATH/items/editors/lritemsborderseditorwidget.h \ + $$REPORT_PATH/items/lrtextitem.h \ + $$REPORT_PATH/items/lrsubitemparentpropitem.h \ + $$REPORT_PATH/items/lralignpropitem.h \ + $$REPORT_PATH/items/lrhorizontallayout.h \ + $$REPORT_PATH/items/lrtextitemeditor.h \ + $$REPORT_PATH/items/lrshapeitem.h \ + $$REPORT_PATH/items/lrimageitem.h \ + $$REPORT_PATH/items/lrsimpletagparser.h \ + $$REPORT_PATH/translationeditor/translationeditor.h \ + $$REPORT_PATH/lrfactoryinitializer.h \ + $$REPORT_PATH/lrbanddesignintf.h \ + $$REPORT_PATH/lrpageitemdesignintf.h \ + $$REPORT_PATH/lrbandsmanager.h \ + $$REPORT_PATH/lrglobal.h \ + $$REPORT_PATH/lrdatadesignintf.h \ + $$REPORT_PATH/lrcollection.h \ + $$REPORT_PATH/lrpagedesignintf.h \ + $$REPORT_PATH/lrreportdesignwidget.h \ + $$REPORT_PATH/lrreportengine_p.h \ + $$REPORT_PATH/lrdatasourcemanager.h \ + $$REPORT_PATH/lrreportdesignwindow.h \ +# $$REPORT_PATH/lrreportrender.h \ + $$REPORT_PATH/lrpreviewreportwindow.h \ + $$REPORT_PATH/lrpreviewreportwidget.h \ + $$REPORT_PATH/lrpreviewreportwidget_p.h \ + $$REPORT_PATH/lrgraphicsviewzoom.h \ + $$REPORT_PATH/lrbasedesignintf.h \ + $$REPORT_PATH/lritemdesignintf.h \ + $$REPORT_PATH/lrdesignelementsfactory.h \ + $$REPORT_PATH/lrscriptenginemanager.h \ + $$REPORT_PATH/lrvariablesholder.h \ + $$REPORT_PATH/lrgroupfunctions.h \ + $$REPORT_PATH/lrreportengine.h \ + $$REPORT_PATH/lrdatasourcemanagerintf.h \ + $$REPORT_PATH/lrscriptenginemanagerintf.h \ + $$REPORT_PATH/lrsimplecrypt.h \ + $$REPORT_PATH/lraboutdialog.h \ + $$REPORT_PATH/lrcallbackdatasourceintf.h \ + $$REPORT_PATH/lrsettingdialog.h \ + $$REPORT_PATH/lrpreviewreportwidget_p.h \ + $$REPORT_PATH/lritemscontainerdesignitf.h \ + $$REPORT_PATH/lrcolorindicator.h \ + $$REPORT_PATH/items/lrchartitem.h \ + $$REPORT_PATH/items/lrchartitemeditor.h \ + $$REPORT_PATH/lrreporttranslation.h \ + $$REPORT_PATH/translationeditor/languageselectdialog.h + +contains(CONFIG, staticlib){ + HEADERS += $$REPORT_PATH/lrfactoryinitializer.h +} + +contains(CONFIG,zint){ + HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h +} + +FORMS += \ + $$REPORT_PATH/databrowser/lrsqleditdialog.ui \ + $$REPORT_PATH/databrowser/lrconnectiondialog.ui \ + $$REPORT_PATH/databrowser/lrdatabrowser.ui \ + $$REPORT_PATH/databrowser/lrvariabledialog.ui \ + $$REPORT_PATH/objectinspector/editors/ltextitempropertyeditor.ui \ + $$REPORT_PATH/lrpreviewreportwindow.ui \ + $$REPORT_PATH/lrpreviewreportwidget.ui \ + $$REPORT_PATH/items/lrtextitemeditor.ui \ + $$REPORT_PATH/lraboutdialog.ui \ + $$REPORT_PATH/lrsettingdialog.ui \ + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.ui \ + $$REPORT_PATH/items/lrchartitemeditor.ui \ + $$REPORT_PATH/translationeditor/translationeditor.ui \ + $$REPORT_PATH/translationeditor/languageselectdialog.ui \ + $$REPORT_PATH/scripteditor/lrscripteditor.ui + +RESOURCES += \ + $$REPORT_PATH/objectinspector/lobjectinspector.qrc \ + $$REPORT_PATH/databrowser/lrdatabrowser.qrc \ + $$REPORT_PATH/report.qrc \ + $$REPORT_PATH/items/items.qrc \ + $$REPORT_PATH/scriptbrowser/lrscriptbrowser.qrc \ + $$REPORT_PATH/translationeditor/translationeditor.qrc diff --git a/designer_plugin/lrdesignerplugin.cpp b/designer_plugin/lrdesignerplugin.cpp new file mode 100644 index 0000000..a957399 --- /dev/null +++ b/designer_plugin/lrdesignerplugin.cpp @@ -0,0 +1,31 @@ +#include "lrdesignerplugin.h" + +#include +#include "lrreportdesignwindow.h" + +DesignerFactoryPlugin::~DesignerFactoryPlugin() { +} + +QString DesignerFactoryPlugin::getString() const { + return "Hello, Plugin!"; +} + +QVariant DesignerFactoryPlugin::getVar() const { + return QRect( 10, 10, 500, 500 ); +} + +QMainWindow* DesignerFactoryPlugin::getDesignerWindow(LimeReport::ReportEnginePrivateInterface* report, QWidget* parent, QSettings* settings) +{ + LimeReport::ReportDesignWindow* designerWindow = new LimeReport::ReportDesignWindow(report, parent, settings); + + settings->beginGroup("DesignerWindow"); + designerWindow->setAttribute(Qt::WA_DeleteOnClose,true); + designerWindow->setWindowIcon(QIcon(":report/images/logo32")); + designerWindow->setShowProgressDialog(settings->value("showProgressDialog").toBool()); + settings->endGroup(); + + return designerWindow; +} + +//Q_EXPORT_PLUGIN2( LimeReportPluginInterface, DesignerFactoryPlugin ) + diff --git a/designer_plugin/lrdesignerplugin.h b/designer_plugin/lrdesignerplugin.h new file mode 100644 index 0000000..d7064d5 --- /dev/null +++ b/designer_plugin/lrdesignerplugin.h @@ -0,0 +1,20 @@ +#ifndef LRDESIGNERPLUGIN_H +#define LRDESIGNERPLUGIN_H + +#include +#include + +class DesignerFactoryPlugin : public QObject, public LimeReportPluginInterface { + Q_OBJECT + Q_PLUGIN_METADATA(IID "ru.limereport.DersignerFactoryInterface") + Q_INTERFACES( LimeReportPluginInterface ) + +public: + ~DesignerFactoryPlugin(); + + QString getString() const; + QVariant getVar() const; + QMainWindow* getDesignerWindow(LimeReport::ReportEnginePrivateInterface* report, QWidget* parent, QSettings* settings); +}; + +#endif diff --git a/designer_plugin/main.cpp b/designer_plugin/main.cpp new file mode 100644 index 0000000..6ecf8ef --- /dev/null +++ b/designer_plugin/main.cpp @@ -0,0 +1,13 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + LimeReport::ReportEngine report; + if (a.arguments().count()>1){ + report.loadFromFile(a.arguments().at(1)); + } + report.designReport(); + return a.exec(); +} diff --git a/include/lrrenderengine.h b/include/lrrenderengine.h new file mode 100644 index 0000000..ccbecd4 --- /dev/null +++ b/include/lrrenderengine.h @@ -0,0 +1,91 @@ +#ifndef LRRENDERENGINE_H +#define LRRENDERENGINE_H + +#include +#include +#include + +#include "lrglobal.h" +#include "lrdatasourcemanagerintf.h" +#include "lrscriptenginemanagerintf.h" +#include "lrpreviewreportwidget.h" + +namespace LimeReport{ + +class PrintRange{ +public: + int fromPage() const { return m_fromPage;} + int toPage() const { return m_toPage;} + QPrintDialog::PrintRange rangeType() const { return m_rangeType;} + PrintRange(QAbstractPrintDialog::PrintRange rangeType=QPrintDialog::AllPages, int fromPage=0, int toPage=0); + void setRangeType(QAbstractPrintDialog::PrintRange rangeType){ m_rangeType=rangeType;} + void setFromPage(int fromPage){ m_fromPage = fromPage;} + void setToPage(int toPage){ m_toPage = toPage;} +private: + QPrintDialog::PrintRange m_rangeType; + int m_fromPage; + int m_toPage; +}; + +class DataSourceManager; +class PageDesignIntf; +class PageItemDesignIntf; +class PreviewReportWidget; + +typedef QList< QSharedPointer > ReportPages; + +class RenderEnginePrivate; + +class LIMEREPORT_EXPORT RenderEngine: public QObject{ + Q_OBJECT + friend class PreviewReportWidget; +public: + static void setSettings(QSettings *value){m_settings=value;} +public: + explicit RenderEngine(QObject *parent = 0); + explicit RenderEngine(RenderEnginePrivate* dd, QObject *parent = 0); + ~RenderEngine(); + bool printReport(QPrinter *printer=0); + bool printPages(ReportPages pages, QPrinter *printer); + void printToFile(const QString& fileName); + PageDesignIntf *createPreviewScene(QObject *parent = 0); + bool printToPDF(const QString& fileName); + void previewReport(PreviewHints hints = PreviewBarsUserSetting); + IDataSourceManager* dataManager(); + IScriptEngineManager* scriptManager(); + bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false); + bool loadFromByteArray(QByteArray *data); + bool loadFromString(const QString& data); + QString reportFileName(); + void setReportFileName(const QString& fileName); + QString lastError(); + PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); + void setPreviewWindowTitle(const QString& title); + void setPreviewWindowIcon(const QIcon& icon); + void setResultEditable(bool value); + bool resultIsEditable(); + bool isBusy(); + void setPassPharse(QString& passPharse); + QList aviableLanguages(); + bool setReportLanguage(QLocale::Language language); + Qt::LayoutDirection previewLayoutDirection(); + void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); + QSettings* settings(){ return m_settings;} +signals: + void renderStarted(); + void renderFinished(); + void renderPageFinished(int renderedPageCount); + void onLoad(bool& loaded); +public slots: + void cancelRender(); +protected: + QObject* d_ptr; +private: + static QSettings* m_settings; + void init(); +private: + Q_DECLARE_PRIVATE(RenderEngine) +}; + +} // namespace LimeReport +#endif // LRRENDERENGINE_H diff --git a/limerender/limerender.h b/limerender/limerender.h new file mode 100644 index 0000000..213adec --- /dev/null +++ b/limerender/limerender.h @@ -0,0 +1,120 @@ +/*************************************************************************** + * This file is part of the Lime Report project * + * Copyright (C) 2015 by Alexander Arin * + * arin_a@bk.ru * + * * + ** GNU General Public License Usage ** + * * + * This library is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + ** GNU Lesser General Public License ** + * * + * This library is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library. * + * If not, see . * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ****************************************************************************/ +#ifndef LRLIMERENDER_H +#define LRLIMERENDER_H + +#include +#include +#include +//#include + +#include "lrreportrender.h" +#include "limerender_p.h" +#include "lrglobal.h" +#include "lrdatasourcemanagerintf.h" +#include "lrscriptenginemanagerintf.h" +#include "lrpreviewreportwidget.h" + +class QPrinter; + +namespace LimeReport { + +//class PrintRange{ +//public: +// int fromPage() const { return m_fromPage;} +// int toPage() const { return m_toPage;} +// QPrintDialog::PrintRange rangeType() const { return m_rangeType;} +// PrintRange(QAbstractPrintDialog::PrintRange rangeType=QPrintDialog::AllPages, int fromPage=0, int toPage=0); +// void setRangeType(QAbstractPrintDialog::PrintRange rangeType){ m_rangeType=rangeType;} +// void setFromPage(int fromPage){ m_fromPage = fromPage;} +// void setToPage(int toPage){ m_toPage = toPage;} +//private: +// QPrintDialog::PrintRange m_rangeType; +// int m_fromPage; +// int m_toPage; +//}; + +class DataSourceManager; +class LimeRenderPrivate; +class PageDesignIntf; +class PageItemDesignIntf; +class PreviewReportWidget; + +typedef QList< QSharedPointer > ReportPages; + +class LIMEREPORT_EXPORT LimeRender : public QObject{ + Q_OBJECT + friend class PreviewReportWidget; +public: + static void setSettings(QSettings *value){m_settings=value;} +public: + explicit LimeRender(QObject *parent = 0); + ~LimeRender(); + bool printReport(QPrinter *printer=0); + bool printPages(ReportPages pages, QPrinter *printer); + void printToFile(const QString& fileName); + PageDesignIntf *createPreviewScene(QObject *parent = 0); + bool printToPDF(const QString& fileName); + void previewReport(PreviewHints hints = PreviewBarsUserSetting); + IDataSourceManager* dataManager(); + IScriptEngineManager* scriptManager(); + bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false); + bool loadFromByteArray(QByteArray *data); + bool loadFromString(const QString& data); + QString lastError(); + PreviewReportWidget *createPreviewWidget(QWidget *parent = 0); + void setPreviewWindowTitle(const QString& title); + void setPreviewWindowIcon(const QIcon& icon); + void setResultEditable(bool value); + bool resultIsEditable(); + bool isBusy(); + void setPassPharse(QString& passPharse); + QList aviableLanguages(); + bool setReportLanguage(QLocale::Language language); + Qt::LayoutDirection previewLayoutDirection(); + void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); +signals: + void renderStarted(); + void renderFinished(); + void renderPageFinished(int renderedPageCount); + void onLoad(bool& loaded); +public slots: + void cancelRender(); +protected: + LimeRenderPrivate * const d_ptr; + LimeRender(LimeRenderPrivate &dd, QObject * parent=0); +private: + Q_DECLARE_PRIVATE(LimeRender) + static QSettings* m_settings; +}; + +} // namespace LimeReport + +#endif // LRLIMERENDER_H diff --git a/limerender/limerender.pri b/limerender/limerender.pri new file mode 100644 index 0000000..1fffc27 --- /dev/null +++ b/limerender/limerender.pri @@ -0,0 +1,156 @@ +include(../common.pri) + +DEFINES += IS_RENDER_BUILD + +INCLUDEPATH += \ + $$REPORT_PATH/ \ + $$REPORT_PATH/items \ + $$REPORT_PATH/bands \ + $$REPORT_PATH/base \ + $$REPORT_PATH/scripteditor + +SOURCES += \ + $$REPORT_PATH/bands/lrpageheader.cpp \ + $$REPORT_PATH/bands/lrpagefooter.cpp \ + $$REPORT_PATH/bands/lrreportheader.cpp \ + $$REPORT_PATH/bands/lrreportfooter.cpp \ + $$REPORT_PATH/bands/lrdataband.cpp \ + $$REPORT_PATH/bands/lrgroupbands.cpp \ + $$REPORT_PATH/bands/lrsubdetailband.cpp \ + $$REPORT_PATH/bands/lrtearoffband.cpp \ + $$REPORT_PATH/serializators/lrxmlqrectserializator.cpp \ + $$REPORT_PATH/serializators/lrxmlbasetypesserializators.cpp \ + $$REPORT_PATH/serializators/lrxmlreader.cpp \ + $$REPORT_PATH/serializators/lrxmlwriter.cpp \ + $$REPORT_PATH/scripteditor/lrscripteditor.cpp \ + $$REPORT_PATH/scripteditor/lrcodeeditor.cpp \ + $$REPORT_PATH/scripteditor/lrscripthighlighter.cpp \ + $$REPORT_PATH/items/lrhorizontallayout.cpp \ + $$REPORT_PATH/items/editors/lritemeditorwidget.cpp \ + $$REPORT_PATH/items/editors/lrfonteditorwidget.cpp \ + $$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.cpp \ + $$REPORT_PATH/items/editors/lritemsaligneditorwidget.cpp \ + $$REPORT_PATH/items/editors/lritemsborderseditorwidget.cpp \ + $$REPORT_PATH/items/lrsimpletagparser.cpp \ + $$REPORT_PATH/items/lrimageitem.cpp \ + $$REPORT_PATH/items/lrtextitemeditor.cpp \ + $$REPORT_PATH/items/lrshapeitem.cpp \ + $$REPORT_PATH/items/lrtextitem.cpp \ + $$REPORT_PATH/lrbanddesignintf.cpp \ + $$REPORT_PATH/lrpageitemdesignintf.cpp \ + $$REPORT_PATH/lrpagedesignintf.cpp \ + $$REPORT_PATH/lrbandsmanager.cpp \ + $$REPORT_PATH/lrglobal.cpp \ + $$REPORT_PATH/lritemdesignintf.cpp \ + $$REPORT_PATH/lrdatadesignintf.cpp \ + $$REPORT_PATH/lrbasedesignintf.cpp \ + $$REPORT_PATH/lrdatasourcemanager.cpp \ + $$REPORT_PATH/lrreportrender.cpp \ + $$REPORT_PATH/lrscriptenginemanager.cpp \ + $$REPORT_PATH/lrpreviewreportwindow.cpp \ + $$REPORT_PATH/lrpreviewreportwidget.cpp \ + $$REPORT_PATH/lrgraphicsviewzoom.cpp \ + $$REPORT_PATH/lrvariablesholder.cpp \ + $$REPORT_PATH/lrgroupfunctions.cpp \ + $$REPORT_PATH/lrsimplecrypt.cpp \ + $$REPORT_PATH/lraboutdialog.cpp \ + $$REPORT_PATH/lritemscontainerdesignitf.cpp \ + $$REPORT_PATH/lrcolorindicator.cpp \ + $$REPORT_PATH/items/lrchartitem.cpp \ + $$REPORT_PATH/lrreporttranslation.cpp +# $$PWD/lrreportrender.cpp + + +contains(CONFIG, staticlib){ + SOURCES += $$REPORT_PATH/lrfactoryinitializer.cpp +} + +contains(CONFIG, zint){ + SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp +} + +HEADERS += \ + $$REPORT_PATH/base/lrsingleton.h \ + $$REPORT_PATH/base/lrsimpleabstractfactory.h \ + $$REPORT_PATH/base/lrattribsabstractfactory.h \ + $$REPORT_PATH/bands/lrpageheader.h \ + $$REPORT_PATH/bands/lrpagefooter.h \ + $$REPORT_PATH/bands/lrreportheader.h \ + $$REPORT_PATH/bands/lrreportfooter.h \ + $$REPORT_PATH/bands/lrdataband.h \ + $$REPORT_PATH/bands/lrtearoffband.h \ + $$REPORT_PATH/bands/lrsubdetailband.h \ + $$REPORT_PATH/bands/lrgroupbands.h \ + $$REPORT_PATH/serializators/lrserializatorintf.h \ + $$REPORT_PATH/serializators/lrstorageintf.h \ + $$REPORT_PATH/serializators/lrxmlqrectserializator.h \ + $$REPORT_PATH/serializators/lrxmlserializatorsfactory.h \ + $$REPORT_PATH/serializators/lrxmlbasetypesserializators.h \ + $$REPORT_PATH/serializators/lrxmlreader.h \ + $$REPORT_PATH/serializators/lrxmlwriter.h \ + $$REPORT_PATH/scripteditor/lrscripteditor.h \ + $$REPORT_PATH/scripteditor/lrcodeeditor.h \ + $$REPORT_PATH/scripteditor/lrscripthighlighter.h \ + $$REPORT_PATH/items/editors/lritemeditorwidget.h \ + $$REPORT_PATH/items/editors/lrfonteditorwidget.h \ + $$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.h \ + $$REPORT_PATH/items/editors/lritemsaligneditorwidget.h \ + $$REPORT_PATH/items/editors/lritemsborderseditorwidget.h \ + $$REPORT_PATH/items/lrtextitem.h \ + $$REPORT_PATH/items/lrhorizontallayout.h \ + $$REPORT_PATH/items/lrtextitemeditor.h \ + $$REPORT_PATH/items/lrshapeitem.h \ + $$REPORT_PATH/items/lrimageitem.h \ + $$REPORT_PATH/items/lrsimpletagparser.h \ + $$REPORT_PATH/lrfactoryinitializer.h \ + $$REPORT_PATH/lrbanddesignintf.h \ + $$REPORT_PATH/lrpageitemdesignintf.h \ + $$REPORT_PATH/lrbandsmanager.h \ + $$REPORT_PATH/lrglobal.h \ + $$REPORT_PATH/lrdatadesignintf.h \ + $$REPORT_PATH/lrcollection.h \ + $$REPORT_PATH/lrpagedesignintf.h \ + $$REPORT_PATH/lrdatasourcemanager.h \ + $$REPORT_PATH/lrreportrender.h \ + $$REPORT_PATH/lrpreviewreportwindow.h \ + $$REPORT_PATH/lrpreviewreportwidget.h \ + $$REPORT_PATH/lrpreviewreportwidget_p.h \ + $$REPORT_PATH/lrgraphicsviewzoom.h \ + $$REPORT_PATH/lrbasedesignintf.h \ + $$REPORT_PATH/lritemdesignintf.h \ + $$REPORT_PATH/lrdesignelementsfactory.h \ + $$REPORT_PATH/lrscriptenginemanager.h \ + $$REPORT_PATH/lrvariablesholder.h \ + $$REPORT_PATH/lrgroupfunctions.h \ + $$REPORT_PATH/lrdatasourcemanagerintf.h \ + $$REPORT_PATH/lrscriptenginemanagerintf.h \ + $$REPORT_PATH/lrsimplecrypt.h \ + $$REPORT_PATH/lraboutdialog.h \ + $$REPORT_PATH/lrcallbackdatasourceintf.h \ + $$REPORT_PATH/lrpreviewreportwidget_p.h \ + $$REPORT_PATH/lritemscontainerdesignitf.h \ + $$REPORT_PATH/lrcolorindicator.h \ + $$REPORT_PATH/items/lrchartitem.h \ + $$REPORT_PATH/lrreporttranslation.h +# $$PWD/limerender.h \ +# $$PWD/limerender_p.h + +contains(CONFIG, staticlib){ + HEADERS += $$REPORT_PATH/lrfactoryinitializer.h +} + +contains(CONFIG,zint){ + HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h +} + +FORMS += \ + $$REPORT_PATH/lrpreviewreportwindow.ui \ + $$REPORT_PATH/lrpreviewreportwidget.ui \ + $$REPORT_PATH/items/lrtextitemeditor.ui \ + $$REPORT_PATH/lraboutdialog.ui \ + $$REPORT_PATH/scripteditor/lrscripteditor.ui + +RESOURCES += \ + $$REPORT_PATH/report.qrc \ + $$REPORT_PATH/items/items.qrc + diff --git a/limerender/limerender.pro b/limerender/limerender.pro new file mode 100644 index 0000000..12f8bd3 --- /dev/null +++ b/limerender/limerender.pro @@ -0,0 +1,124 @@ +contains(CONFIG,release) { + TARGET = limerender +} else { + TARGET = limerenderd +} + +TEMPLATE = lib + +contains(CONFIG, static_build){ + CONFIG += staticlib +} + +!contains(CONFIG, staticlib){ + CONFIG += lib + CONFIG += dll +} + +CONFIG += create_prl +CONFIG += link_prl + +macx{ + CONFIG -= dll + CONFIG += lib_bundle + CONFIG += plugin +} + +DEFINES += LIMEREPORT_EXPORTS + +contains(CONFIG, staticlib){ + DEFINES += HAVE_STATIC_BUILD + message(STATIC_BUILD) + DEFINES -= LIMEREPORT_EXPORTS +} + +EXTRA_FILES += \ + $$PWD/../limereport/lrglobal.cpp \ + $$PWD/../limereport/lrglobal.h \ + $$PWD/../limereport/lrdatasourcemanagerintf.h \ + $$PWD/../limereport/lrreportengine.h \ + $$PWD/../limereport/lrscriptenginemanagerintf.h \ + $$PWD/../limereport/lrcallbackdatasourceintf.h \ + $$PWD/../limereport/lrpreviewreportwidget.h + +include(limerender.pri) + +unix:{ + DESTDIR = $${DEST_LIBS} + linux{ + QMAKE_POST_LINK += mkdir -p $$quote($${DEST_INCLUDE_DIR}) $$escape_expand(\\n\\t) # qmake need make mkdir -p on subdirs more than root/ + for(FILE,EXTRA_FILES){ + QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DEST_INCLUDE_DIR}) $$escape_expand(\\n\\t) # inside of libs make /include/files + } + } + macx{ + for(FILE,EXTRA_FILES){ + QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($${DEST_INCLUDE_DIR}) $$escape_expand(\\n\\t) + } + QMAKE_POST_LINK += mkdir -p $$quote($${DESTDIR}/include) $$escape_expand(\\n\\t) + } + QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($${DEST_INCLUDE_DIR}) $$quote($${DESTDIR}) +} + +win32 { + EXTRA_FILES ~= s,/,\\,g + BUILD_DIR ~= s,/,\\,g + DESTDIR = $${DEST_LIBS} + DEST_DIR = $$DESTDIR/include + DEST_DIR ~= s,/,\\,g + DEST_INCLUDE_DIR ~= s,/,\\,g + + for(FILE,EXTRA_FILES){ + QMAKE_POST_LINK += $$QMAKE_COPY \"$$FILE\" \"$${DEST_INCLUDE_DIR}\" $$escape_expand(\\n\\t) + } + QMAKE_POST_LINK += $$QMAKE_COPY_DIR \"$${DEST_INCLUDE_DIR}\" \"$${DEST_DIR}\" +} + +contains(CONFIG,zint){ + message(zint) + INCLUDEPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt + DEPENDPATH += $$ZINT_PATH/backend $$ZINT_PATH/backend_qt + LIBS += -L$${DEST_LIBS} + contains(CONFIG,release) { + LIBS += -lQtZint + } else { + LIBS += -lQtZintd + } +} + +####Automatically build required translation files (*.qm) + +contains(CONFIG,build_translations){ + LANGUAGES = ru es_ES ar + + defineReplace(prependAll) { + for(a,$$1):result += $$2$${a}$$3 + return($$result) + } + + TRANSLATIONS = $$prependAll(LANGUAGES, \"$$TRANSLATIONS_PATH/limereport_,.ts\") + + qtPrepareTool(LUPDATE, lupdate) + +greaterThan(QT_MAJOR_VERSION, 4) { + ts.commands = $$LUPDATE $$shell_quote($$PWD) -ts $$TRANSLATIONS +} +lessThan(QT_MAJOR_VERSION, 5){ + ts.commands = $$LUPDATE $$quote($$PWD) -ts $$TRANSLATIONS +} + TRANSLATIONS_FILES = + qtPrepareTool(LRELEASE, lrelease) + for(tsfile, TRANSLATIONS) { + qmfile = $$tsfile + qmfile ~= s,".ts\"$",".qm\"", + qm.commands += $$LRELEASE -removeidentical $$tsfile -qm $$qmfile $$escape_expand(\\n\\t) + tmp_command = $$LRELEASE -removeidentical $$tsfile -qm $$qmfile $$escape_expand(\\n\\t) + TRANSLATIONS_FILES += $$qmfile + } + qm.depends = ts + OTHER_FILES += $$TRANSLATIONS + QMAKE_EXTRA_TARGETS += qm ts + POST_TARGETDEPS += qm +} + +#### EN AUTOMATIC TRANSLATIONS diff --git a/limerender/limerender_p.h b/limerender/limerender_p.h new file mode 100644 index 0000000..af650b4 --- /dev/null +++ b/limerender/limerender_p.h @@ -0,0 +1,192 @@ +/*************************************************************************** + * This file is part of the Lime Report project * + * Copyright (C) 2015 by Alexander Arin * + * arin_a@bk.ru * + * * + ** GNU General Public License Usage ** + * * + * This library is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + ** GNU Lesser General Public License ** + * * + * This library is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library. * + * If not, see . * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ****************************************************************************/ +#ifndef LRLIMERENDER_P_H +#define LRLIMERENDER_P_H + +#include +#include +#include + +#include "limerender.h" +#include "lrcollection.h" +#include "lrglobal.h" +#include "lrdatasourcemanager.h" +#include "lrbanddesignintf.h" +#include "serializators/lrstorageintf.h" +#include "lrscriptenginemanager.h" +#include "lrreporttranslation.h" + +class QFileSystemWatcher; + +namespace LimeReport{ + +class PageDesignIntf; +class PrintRange; +class ReportDesignWindow; + +//TODO: Add on render callback + +class LimeRenderPrivate : public QObject, public ICollectionContainer, public ITranslationContainer +{ + Q_OBJECT + Q_DECLARE_PUBLIC(ReportEngine) + Q_PROPERTY(ACollectionProperty pages READ fakeCollectionReader()) + Q_PROPERTY(QObject* datasourcesManager READ dataManager) + Q_PROPERTY(QObject* scriptContext READ scriptContext) + Q_PROPERTY(bool suppressFieldAndVarError READ suppressFieldAndVarError WRITE setSuppressFieldAndVarError) + Q_PROPERTY(ATranslationProperty translation READ fakeTranslationReader) + friend class PreviewReportWidget; +public: + static void printReport(ItemsReaderIntf::Ptr reader, QPrinter &printer); + static void printReport(ReportPages pages, QPrinter &printer); + Q_INVOKABLE QStringList aviableReportTranslations(); + Q_INVOKABLE void setReportTranslation(const QString& languageName); +public: + explicit LimeRenderPrivate(QObject *parent = 0); + virtual ~LimeRenderPrivate(); + + PageDesignIntf* appendPage(const QString& pageName=""); + bool deletePage(PageDesignIntf *page); + PageDesignIntf* createPreviewPage(); + PageDesignIntf* pageAt(int index){return (index<=(m_pages.count()-1)) ? m_pages.at(index):0;} + int pageCount() {return m_pages.count();} + DataSourceManager* dataManager(){return m_datasources;} + ScriptEngineContext* scriptContext(){return m_scriptEngineContext;} + ScriptEngineManager* scriptManager(); + IDataSourceManager* dataManagerIntf(){return m_datasources;} + + IScriptEngineManager* scriptManagerIntf(){ + ScriptEngineManager::instance().setDataManager(dataManager()); + return &ScriptEngineManager::instance(); + } + + void clearReport(); + bool printReport(QPrinter *printer=0); + bool printPages(ReportPages pages, QPrinter *printer); + void printToFile(const QString& fileName); + bool printToPDF(const QString& fileName); + void previewReport(PreviewHints hints = PreviewBarsUserSetting); + void setSettings(QSettings* value); + QSettings* settings(); + bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange); + bool loadFromByteArray(QByteArray *data, const QString& name = ""); + bool loadFromString(const QString& report, const QString& name = ""); + QString lastError(); + ReportEngine * q_ptr; + bool emitLoadReport(); + bool hasActivePreview(){return m_activePreview;} + PageDesignIntf *createPreviewScene(QObject *parent); + PreviewReportWidget *createPreviewWidget(QWidget *parent); + QIcon previewWindowIcon() const; + void setPreviewWindowIcon(const QIcon &previewWindowIcon); + QString previewWindowTitle() const; + void setPreviewWindowTitle(const QString &previewWindowTitle); + + bool suppressFieldAndVarError() const; + void setSuppressFieldAndVarError(bool suppressFieldAndVarError); + bool isBusy(); + bool resultIsEditable() const; + void setResultEditable(bool value); + + void setPassPhrase(const QString &passPhrase); + bool addTranslationLanguage(QLocale::Language language); + bool removeTranslationLanguage(QLocale::Language language); + bool setReportLanguage(QLocale::Language language); + QList aviableLanguages(); + ReportTranslation* reportTranslation(QLocale::Language language); + void reorderPages(const QList &reorderedPages); + void clearSelection(); + Qt::LayoutDirection previewLayoutDirection(); + void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection); +signals: + void pagesLoadFinished(); + void datasourceCollectionLoadFinished(const QString& collectionName); + void cleared(); + void renderStarted(); + void renderFinished(); + void renderPageFinished(int renderedPageCount); + void onLoad(bool& loaded); +public slots: + bool slotLoadFromFile(const QString& fileName); + void cancelRender(); +protected: + PageDesignIntf* createPage(const QString& pageName=""); +protected slots: + void slotDataSourceCollectionLoaded(const QString& collectionName); +private slots: + void slotPreviewWindowDestroyed(QObject *window); +private: + //ICollectionContainer + virtual QObject* createElement(const QString&,const QString&); + virtual int elementsCount(const QString&); + virtual QObject* elementAt(const QString&, int index); + virtual void collectionLoadFinished(const QString&); + void saveError(QString message); + void showError(QString message); + //ICollectionContainer + //ITranslationContainer + Translations* translations(){ return &m_translations;} + void updateTranslations(); + //ITranslationContainer + ReportPages renderToPages(); + QString renderToString(); + PageDesignIntf* getPageByName(const QString& pageName); + ATranslationProperty fakeTranslationReader(){ return ATranslationProperty();} +private: + QList m_pages; + DataSourceManager* m_datasources; + ScriptEngineContext* m_scriptEngineContext; + ReportRender::Ptr m_reportRender; + QString m_fileName; + QString m_lastError; + QSettings* m_settings; + bool m_ownedSettings; + QScopedPointer m_printer; + bool m_printerSelected; + bool m_showProgressDialog; + QString m_reportsDir; + QString m_reportName; + QMainWindow* m_activePreview; + QIcon m_previewWindowIcon; + QString m_previewWindowTitle; + QPointer m_designerWindow; + ReportSettings m_reportSettings; + bool m_LimeRendering; + bool m_resultIsEditable; + QString m_passPhrase; + QFileSystemWatcher *m_fileWatcher; + Translations m_translations; + QLocale::Language m_reportLanguage; + void activateLanguage(QLocale::Language language); + Qt::LayoutDirection m_previewLayoutDirection; +}; + +} +#endif // LRLIMERENDER_P_H diff --git a/limerender/lrreportrender.cpp b/limerender/lrreportrender.cpp new file mode 100644 index 0000000..782db29 --- /dev/null +++ b/limerender/lrreportrender.cpp @@ -0,0 +1,1104 @@ +/*************************************************************************** + * This file is part of the Lime Report project * + * Copyright (C) 2015 by Alexander Arin * + * arin_a@bk.ru * + * * + ** GNU General Public License Usage ** + * * + * This library is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + ** GNU Lesser General Public License ** + * * + * This library is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library. * + * If not, see . * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + ****************************************************************************/ +#include +#include +#include +#include +#include +#include +#include + +#include "time.h" + +#include "limerender_p.h" +#include "limerender.h" + +#include "lrpagedesignintf.h" +#include "lrdatasourcemanager.h" +#include "lrreportrender.h" +#include "serializators/lrxmlwriter.h" +#include "serializators/lrxmlreader.h" +#include "lrpreviewreportwindow.h" +#include "lrpreviewreportwidget.h" +#include "lrpreviewreportwidget_p.h" + +#ifdef HAVE_STATIC_BUILD +#include "lrfactoryinitializer.h" +#endif +namespace LimeReport{ + +QSettings* LimeRender::m_settings = 0; + +LimeRenderPrivate::LimeRenderPrivate(QObject *parent) : + QObject(parent), m_fileName(""), m_settings(0), m_ownedSettings(false), + m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false), + m_showProgressDialog(true), m_reportName(""), m_activePreview(0), + m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), + m_LimeRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy"), + m_fileWatcher( new QFileSystemWatcher( this ) ), m_reportLanguage(QLocale::AnyLanguage) +{ +#ifdef HAVE_STATIC_BUILD + initResources(); + initReportItems(); + initObjectInspectorProperties(); + initSerializators(); +#endif + m_datasources = new DataSourceManager(this); + m_datasources->setReportSettings(&m_reportSettings); + m_scriptEngineContext = new ScriptEngineContext(this); + + ICallbackDatasource* tableOfContens = m_datasources->createCallbackDatasource("tableofcontens"); + connect(tableOfContens, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)), + m_scriptEngineContext->tableOfContens(), SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&))); + + m_datasources->setObjectName("datasources"); + connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString))); + connect(m_fileWatcher,SIGNAL(fileChanged(const QString &)),this,SLOT(slotLoadFromFile(const QString &))); +} + +LimeRenderPrivate::~LimeRenderPrivate() +{ + if (m_activePreview){ + m_activePreview->close(); + } + foreach(PageDesignIntf* page,m_pages) delete page; + m_pages.clear(); + + foreach(ReportTranslation* translation, m_translations) + delete translation; + m_translations.clear(); + + if (m_ownedSettings&&m_settings) delete m_settings; +} + +QObject* LimeRenderPrivate::createElement(const QString &, const QString &) +{ + return appendPage(); +} + +QObject *LimeRenderPrivate::elementAt(const QString &, int index) +{ + return pageAt(index); +} + +PageDesignIntf *LimeRenderPrivate::createPage(const QString &pageName) +{ + PageDesignIntf* page =new PageDesignIntf(); + page->setObjectName(pageName); + page->pageItem()->setObjectName("Report"+pageName); + page->setReportRender(this); + page->setReportSettings(&m_reportSettings); + return page; +} + +PageDesignIntf *LimeRenderPrivate::appendPage(const QString &pageName) +{ + PageDesignIntf* page = createPage(pageName); + m_pages.append(page); + return page; +} + +bool LimeRenderPrivate::deletePage(PageDesignIntf *page){ + QList::iterator it = m_pages.begin(); + while (it != m_pages.end()){ + if (*it == page) { + it = m_pages.erase(it); + return true; + } else ++it; + } + return false; +} + +PageDesignIntf *LimeRenderPrivate::createPreviewPage() +{ + return createPage(); +} + +int LimeRenderPrivate::elementsCount(const QString &) +{ + return m_pages.count(); +} + +void LimeRenderPrivate::collectionLoadFinished(const QString &) +{ + foreach (PageDesignIntf* page, m_pages) { + page->setReportRender(this); + page->setReportSettings(&m_reportSettings); + page->setSceneRect(-Const::SCENE_MARGIN,-Const::SCENE_MARGIN, + page->pageItem()->width()+Const::SCENE_MARGIN*2, + page->pageItem()->height()+Const::SCENE_MARGIN*2); + } + emit pagesLoadFinished(); +} + +void LimeRenderPrivate::saveError(QString message) +{ + m_lastError = message; +} + +void LimeRenderPrivate::showError(QString message) +{ + QMessageBox::critical(0,tr("Error"),message); +} + +void LimeRenderPrivate::updateTranslations() +{ + foreach(ReportTranslation* translation, m_translations.values()){ + foreach(PageDesignIntf* page, m_pages){ + translation->updatePageTranslation(page); + } + } +} + +void LimeRenderPrivate::slotDataSourceCollectionLoaded(const QString &collectionName) +{ + emit datasourceCollectionLoadFinished(collectionName); +} + +void LimeRenderPrivate::slotPreviewWindowDestroyed(QObject* window) +{ + if (m_activePreview == window){ + m_activePreview = 0; + } +} + +void LimeRenderPrivate::clearReport() +{ + foreach(PageDesignIntf* page,m_pages) delete page; + m_pages.clear(); + foreach(ReportTranslation* reportTranslation, m_translations) + delete reportTranslation; + m_translations.clear(); + m_datasources->clear(DataSourceManager::Owned); + m_fileName=""; + m_scriptEngineContext->clear(); + m_reportSettings.setDefaultValues(); + + emit cleared(); +} + +void LimeRenderPrivate::printReport(ItemsReaderIntf::Ptr reader, QPrinter& printer) +{ + LimeReport::PageDesignIntf renderPage; + renderPage.setItemMode(PrintMode); + if (reader->first()){ + reader->readItem(renderPage.pageItem()); + printer.setFullPage(renderPage.pageItem()->fullPage()); + printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation()); + renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect()); + + if (renderPage.pageItem()->pageSize()==PageItemDesignIntf::Custom){ + QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)? + QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()): + renderPage.pageItem()->sizeMM(); + printer.setPaperSize(pageSize,QPrinter::Millimeter); + } else { + printer.setPaperSize((QPrinter::PageSize)renderPage.pageItem()->pageSize()); + } + + QPainter painter(&printer); + renderPage.render(&painter); + + while (reader->next()){ + printer.newPage(); + renderPage.removeAllItems(); + reader->readItem(renderPage.pageItem()); + renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect()); + renderPage.render(&painter); + } + } +} + +void LimeRenderPrivate::printReport(ReportPages pages, QPrinter &printer) +{ + LimeReport::PageDesignIntf renderPage; + renderPage.setItemMode(PrintMode); + QPainter* painter=0; + + bool isFirst = true; + int currenPage = 1; + + + qreal leftMargin, topMargin, rightMargin, bottomMargin; + printer.getPageMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin, QPrinter::Millimeter); + + QRectF printerPageRect = printer.pageRect(QPrinter::Millimeter); + printerPageRect = QRectF(0,0,(printerPageRect.size().width() + rightMargin + leftMargin) * Const::mmFACTOR, + (printerPageRect.size().height() + bottomMargin +topMargin) * Const::mmFACTOR); + + foreach(PageItemDesignIntf::Ptr page, pages){ + + if ( + (printer.printRange() == QPrinter::AllPages) || + ( (printer.printRange()==QPrinter::PageRange) && + (currenPage>=printer.fromPage()) && + (currenPage<=printer.toPage()) + ) + ) + { + + QPointF pagePos = page->pos(); + + page->setPos(0,0); + renderPage.setPageItem(page); + renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect()); + if (renderPage.pageItem()->oldPrintMode()){ + printer.setPageMargins(renderPage.pageItem()->leftMargin(), + renderPage.pageItem()->topMargin(), + renderPage.pageItem()->rightMargin(), + renderPage.pageItem()->bottomMargin(), + QPrinter::Millimeter); + printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation()); + QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)? + QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()): + renderPage.pageItem()->sizeMM(); + printer.setPaperSize(pageSize,QPrinter::Millimeter); + } else { + printer.setFullPage(renderPage.pageItem()->fullPage()); + printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation()); + if (renderPage.pageItem()->pageSize()==PageItemDesignIntf::Custom){ + QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)? + QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()): + renderPage.pageItem()->sizeMM(); + if (page->getSetPageSizeToPrinter()) + printer.setPaperSize(pageSize,QPrinter::Millimeter); + } else { + if (page->getSetPageSizeToPrinter()) + printer.setPaperSize((QPrinter::PageSize)renderPage.pageItem()->pageSize()); + } + } + + if (!isFirst){ + printer.newPage(); + } else { + isFirst=false; + painter = new QPainter(&printer); + } + + if (printerPageRect.width() < page->geometry().width()){ + qreal pageWidth = page->geometry().width(); + QRectF currentPrintingRect = printerPageRect; + while (pageWidth>0){ + renderPage.render(painter, printer.pageRect(), currentPrintingRect); + currentPrintingRect.adjust(printerPageRect.size().width(),0,printerPageRect.size().width(),0); + pageWidth -= printerPageRect.size().width(); + if (pageWidth>0) printer.newPage(); + } + + } else { + renderPage.render(painter); + } + + + page->setPos(pagePos); + } + + currenPage++; + } + delete painter; +} + +QStringList LimeRenderPrivate::aviableReportTranslations() +{ + QStringList result; + foreach (QLocale::Language language, aviableLanguages()){ + result << QLocale::languageToString(language); + } + return result; +} + +void LimeRenderPrivate::setReportTranslation(const QString &languageName) +{ + foreach(QLocale::Language language, aviableLanguages()){ + if (QLocale::languageToString(language).compare(languageName) == 0){ + setReportLanguage(language); + } + } +}; + +bool LimeRenderPrivate::printReport(QPrinter* printer) +{ + if (!printer&&!m_printerSelected){ + QPrinterInfo pi; + if (!pi.defaultPrinter().isNull()) +#ifdef HAVE_QT4 + m_printer.data()->setPrinterName(pi.defaultPrinter().printerName()); +#endif +#ifdef HAVE_QT5 + m_printer.data()->setPrinterName(pi.defaultPrinterName()); +#endif + QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); + m_printerSelected = dialog.exec()!=QDialog::Rejected; + } + if (!printer&&!m_printerSelected) return false; + + printer =(printer)?printer:m_printer.data(); + if (printer&&printer->isValid()){ + try{ + dataManager()->setDesignTime(false); + ReportPages pages = renderToPages(); + dataManager()->setDesignTime(true); + if (pages.count()>0){ + printReport(pages,*printer); + } + } catch(ReportError &exception){ + saveError(exception.what()); + } + return true; + } else return false; +} + +bool LimeRenderPrivate::printPages(ReportPages pages, QPrinter *printer) +{ + if (!printer&&!m_printerSelected){ + QPrinterInfo pi; + if (!pi.defaultPrinter().isNull()) +#ifdef HAVE_QT4 + m_printer.data()->setPrinterName(pi.defaultPrinter().printerName()); +#endif +#ifdef HAVE_QT5 + m_printer.data()->setPrinterName(pi.defaultPrinterName()); +#endif + QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); + m_printerSelected = dialog.exec()!=QDialog::Rejected; + } + if (!printer&&!m_printerSelected) return false; + + printer =(printer)?printer:m_printer.data(); + if (printer&&printer->isValid()){ + try{ + if (pages.count()>0){ + printReport( + pages, + *printer + ); + } + } catch(ReportError &exception){ + saveError(exception.what()); + } + return true; + } else return false; +} + +void LimeRenderPrivate::printToFile(const QString &fileName) +{ + if (!fileName.isEmpty()){ + QFile file(fileName); + if (file.open(QIODevice::WriteOnly)){ + QTextStream out(&file); + try { + dataManager()->setDesignTime(false); + out<setDesignTime(true); + } catch( ReportError &exception){ + saveError(exception.what()); + } + } + file.close(); + } +} + +bool LimeRenderPrivate::printToPDF(const QString &fileName) +{ + if (!fileName.isEmpty()){ + QFileInfo fi(fileName); + QString fn = fileName; + if (fi.suffix().isEmpty()) + fn+=".pdf"; + QPrinter printer; + printer.setOutputFileName(fn); + printer.setOutputFormat(QPrinter::PdfFormat); + return printReport(&printer); + } + return false; +} + +void LimeRenderPrivate::previewReport(PreviewHints hints) +{ +// QTime start = QTime::currentTime(); + try{ + dataManager()->setDesignTime(false); + ReportPages pages = renderToPages(); + dataManager()->setDesignTime(true); + if (pages.count()>0){ + Q_Q(LimeRender); + PreviewReportWindow* w = new PreviewReportWindow(q,0,settings()); + w->setWindowFlags(Qt::Dialog|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint| Qt::WindowMinMaxButtonsHint); + w->setAttribute(Qt::WA_DeleteOnClose,true); + w->setWindowModality(Qt::ApplicationModal); + //w->setWindowIcon(QIcon(":/report/images/main.ico")); + w->setWindowIcon(m_previewWindowIcon); + w->setWindowTitle(m_previewWindowTitle); + w->setSettings(settings()); + w->setPages(pages); + w->setLayoutDirection(m_previewLayoutDirection); + if (!dataManager()->errorsList().isEmpty()){ + w->setErrorMessages(dataManager()->errorsList()); + } + + if (!hints.testFlag(PreviewBarsUserSetting)){ + w->setMenuVisible(!hints.testFlag(HidePreviewMenuBar)); + w->setStatusBarVisible(!hints.testFlag(HidePreviewStatusBar)); + w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar)); + } + + w->setHideResultEditButton(resultIsEditable()); + + m_activePreview = w; + connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroyed(QObject*))); + w->exec(); + } + } catch (ReportError &exception){ + saveError(exception.what()); + showError(exception.what()); + } +} + +PreviewReportWidget* LimeRenderPrivate::createPreviewWidget(QWidget* parent){ + + Q_Q(LimeRender); + PreviewReportWidget* widget = new PreviewReportWidget(q, parent); + try{ + dataManager()->setDesignTime(false); + ReportPages pages = renderToPages(); + dataManager()->setDesignTime(true); + if (pages.count()>0) + widget->d_ptr->setPages(pages); + } catch (ReportError &exception){ + saveError(exception.what()); + showError(exception.what()); + } + return widget; +} + +PageDesignIntf* LimeRenderPrivate::createPreviewScene(QObject* parent){ + PageDesignIntf* result = 0; + try { + ReportPages pages = renderToPages(); + result = new PageDesignIntf(parent); + result->setPageItems(pages); + } catch (ReportError &exception){ + saveError(exception.what()); + showError(exception.what()); + } + return result; +} + +bool LimeRenderPrivate::emitLoadReport() +{ + bool result = false; + emit onLoad(result); + return result; +} + +bool LimeRenderPrivate::slotLoadFromFile(const QString &fileName) +{ + PreviewReportWindow *currentPreview = qobject_cast(m_activePreview); + + if (!QFile::exists(fileName)) + { + if ( hasActivePreview() ) + { + QMessageBox::information( NULL, + tr( "Report File Change" ), + tr( "The report file \"%1\" has changed names or been deleted.\n\nThis preview is no longer valid." ).arg( fileName ) + ); + + clearReport(); + + currentPreview->close(); + } + + return false; + } + + clearReport(); + + ItemsReaderIntf::Ptr reader = FileXMLReader::create(fileName); + reader->setPassPhrase(m_passPhrase); + if (reader->first()){ + if (reader->readItem(this)){ + m_fileName=fileName; + QFileInfo fi(fileName); + m_reportName = fi.fileName(); + + QString dbSettingFileName = fi.absolutePath()+"/"+fi.baseName()+".db"; + if (QFile::exists(dbSettingFileName)){ + QSettings dbcredentals(dbSettingFileName, QSettings::IniFormat); + foreach (ConnectionDesc* connection, dataManager()->conections()) { + if (!connection->keepDBCredentials()){ + dbcredentals.beginGroup(connection->name()); + connection->setUserName(dbcredentals.value("user").toString()); + connection->setPassword(dbcredentals.value("password").toString()); + dbcredentals.endGroup(); + } + } + } + + dataManager()->connectAutoConnections(); + + if ( hasActivePreview() ) + { + currentPreview->reloadPreview(); + } + return true; + }; + } + m_lastError = reader->lastError(); + return false; +} + +void LimeRenderPrivate::cancelRender() +{ + if (m_LimeRender) + m_LimeRender->cancelRender(); + m_LimeRendering = false; +} + +PageDesignIntf* LimeRender::createPreviewScene(QObject* parent){ + Q_D(LimeRender); + return d->createPreviewScene(parent); +} + +void LimeRenderPrivate::setSettings(QSettings* value) +{ + if (value){ + if (m_ownedSettings&&m_settings) + delete m_settings; + m_settings = value; + m_ownedSettings = false; + } +} + +QSettings*LimeRenderPrivate::settings() +{ + if (m_settings){ + return m_settings; + } else { + m_settings = new QSettings("LimeReport",QApplication::applicationName()); + m_ownedSettings=true; + return m_settings; + } +} + +bool LimeRenderPrivate::loadFromFile(const QString &fileName, bool autoLoadPreviewOnChange) +{ + // only watch one file at a time + if ( !m_fileWatcher->files().isEmpty() ) + { + m_fileWatcher->removePaths( m_fileWatcher->files() ); + } + + if ( autoLoadPreviewOnChange ) + { + m_fileWatcher->addPath( fileName ); + } + + return slotLoadFromFile( fileName ); +} + +bool LimeRenderPrivate::loadFromByteArray(QByteArray* data, const QString &name){ + clearReport(); + + ItemsReaderIntf::Ptr reader = ByteArrayXMLReader::create(data); + reader->setPassPhrase(m_passPhrase); + if (reader->first()){ + if (reader->readItem(this)){ + m_fileName = ""; + m_reportName = name; + return true; + }; + } + return false; +} + +bool LimeRenderPrivate::loadFromString(const QString &report, const QString &name) +{ + clearReport(); + + ItemsReaderIntf::Ptr reader = StringXMLreader::create(report); + reader->setPassPhrase(m_passPhrase); + if (reader->first()){ + if (reader->readItem(this)){ + m_fileName = ""; + m_reportName = name; + return true; + }; + } + return false; +} + +QString LimeRenderPrivate::renderToString() +{ + LimeReport::LimeRender render; + dataManager()->connectAllDatabases(); + dataManager()->setDesignTime(false); + if (m_pages.count()){ + render.setDatasources(dataManager()); + render.setScriptContext(scriptContext()); + return render.renderPageToString(m_pages.at(0)); + }else return QString(); +} + +PageDesignIntf* LimeRenderPrivate::getPageByName(const QString& pageName) +{ + foreach(PageDesignIntf* page, m_pages){ + if ( page->objectName().compare(pageName, Qt::CaseInsensitive) == 0) + return page; + } + return 0; +} + +Qt::LayoutDirection LimeRenderPrivate::previewLayoutDirection() +{ + return m_previewLayoutDirection; +} + +void LimeRenderPrivate::setPreviewLayoutDirection(const Qt::LayoutDirection& layoutDirection) +{ + m_previewLayoutDirection = layoutDirection; +} + +void LimeRenderPrivate::setPassPhrase(const QString &passPhrase) +{ + m_passPhrase = passPhrase; +} + +void LimeRenderPrivate::reorderPages(const QList& reorderedPages) +{ + m_pages.clear(); + foreach(PageDesignIntf* page, reorderedPages){ + m_pages.append(page); + } +} + +void LimeRenderPrivate::clearSelection() +{ + foreach (PageDesignIntf* page, m_pages) { + foreach(QGraphicsItem* item, page->selectedItems()){ + item->setSelected(false); + } + } +} + +bool LimeRenderPrivate::addTranslationLanguage(QLocale::Language language) +{ + if (!m_translations.keys().contains(language)){ + ReportTranslation* translation = 0; + if (!m_translations.contains(QLocale::AnyLanguage)){ + translation = new ReportTranslation(QLocale::AnyLanguage,m_pages); + m_translations.insert(QLocale::AnyLanguage,translation); + } + translation = new ReportTranslation(language,m_pages); + m_translations.insert(language, translation); + return true; + } else { + m_lastError = tr("Language %1 already exists").arg(QLocale::languageToString(language)); + return false; + } +} + +bool LimeRenderPrivate::removeTranslationLanguage(QLocale::Language language) +{ + return m_translations.remove(language) != 0; +} + +void LimeRenderPrivate::activateLanguage(QLocale::Language language) +{ + if (!m_translations.keys().contains(language)) return; + ReportTranslation* translation = m_translations.value(language); + + foreach(PageTranslation* pageTranslation, translation->pagesTranslation()){ + PageDesignIntf* page = getPageByName(pageTranslation->pageName); + if (page){ + foreach(ItemTranslation* itemTranslation, pageTranslation->itemsTranslation){ + BaseDesignIntf* item = page->pageItem()->childByName(itemTranslation->itemName); + if (item) { + foreach(PropertyTranslation* propertyTranslation, itemTranslation->propertyesTranslation){ + item->setProperty(propertyTranslation->propertyName.toLatin1(), propertyTranslation->value); + } + } + } + } + } +} + +bool LimeRenderPrivate::setReportLanguage(QLocale::Language language){ + m_reportLanguage = language; + if (!m_translations.keys().contains(language)) return false; +// activateLanguage(language); + return true; +} + +QList LimeRenderPrivate::aviableLanguages() +{ + return m_translations.keys(); +} + +ReportTranslation*LimeRenderPrivate::reportTranslation(QLocale::Language language) +{ + return m_translations.value(language); +} + +bool LimeRenderPrivate::resultIsEditable() const +{ + return m_resultIsEditable; +} + +void LimeRenderPrivate::setResultEditable(bool value) +{ + m_resultIsEditable = value; +} + +bool LimeRenderPrivate::suppressFieldAndVarError() const +{ + return m_reportSettings.suppressAbsentFieldsAndVarsWarnings(); +} + +void LimeRenderPrivate::setSuppressFieldAndVarError(bool suppressFieldAndVarError) +{ + m_reportSettings.setSuppressAbsentFieldsAndVarsWarnings(suppressFieldAndVarError); +} + +bool LimeRenderPrivate::isBusy() +{ + return m_LimeRendering; +} + +QString LimeRenderPrivate::previewWindowTitle() const +{ + return m_previewWindowTitle; +} + +void LimeRenderPrivate::setPreviewWindowTitle(const QString &previewWindowTitle) +{ + m_previewWindowTitle = previewWindowTitle; +} + +QIcon LimeRenderPrivate::previewWindowIcon() const +{ + return m_previewWindowIcon; +} + +void LimeRenderPrivate::setPreviewWindowIcon(const QIcon &previewWindowIcon) +{ + m_previewWindowIcon = previewWindowIcon; +} + +ReportPages LimeRenderPrivate::renderToPages() +{ + if (m_LimeRendering) return ReportPages(); + m_LimeRender = LimeRender::Ptr(new LimeRender); + + dataManager()->clearErrors(); + dataManager()->connectAllDatabases(); + dataManager()->setDesignTime(false); + dataManager()->updateDatasourceModel(); + + connect(m_LimeRender.data(),SIGNAL(pageRendered(int)), + this, SIGNAL(renderPageFinished(int))); + + if (m_pages.count()){ +#ifdef HAVE_UI_LOADER + m_scriptEngineContext->initDialogs(); +#endif + ReportPages result; + m_LimeRendering = true; + + m_LimeRender->setDatasources(dataManager()); + m_LimeRender->setScriptContext(scriptContext()); + + foreach (PageDesignIntf* page, m_pages) { + scriptContext()->baseDesignIntfToScript(page->pageItem()->objectName(), page->pageItem()); + } + + scriptContext()->qobjectToScript("engine",this); + + if (m_scriptEngineContext->runInitScript()){ + + activateLanguage(m_reportLanguage); + emit renderStarted(); + + foreach(PageDesignIntf* page , m_pages){ + if (!page->pageItem()->isTOC()){ + page->setReportSettings(&m_reportSettings); + result.append(m_LimeRender->renderPageToPages(page)); + } + } + + +// m_LimeRender->secondRenderPass(result); + + for (int i=0; ipageItem()->isTOC()){ + page->setReportSettings(&m_reportSettings); + if (i==0){ + PageDesignIntf* secondPage = 0; + if (m_pages.count()>1) secondPage = m_pages.at(1); + ReportPages pages = m_LimeRender->renderTOC( + page, + true, + secondPage && secondPage->pageItem()->resetPageNumber() + ); + for (int j=0; jrenderPageToPages(page)); + } + } + } + + m_LimeRender->secondRenderPass(result); + + emit renderFinished(); + m_LimeRender.clear(); + } + m_LimeRendering = false; + activateLanguage(QLocale::AnyLanguage); + return result; + } else { + return ReportPages(); + } +} + +QString LimeRenderPrivate::lastError() +{ + return m_lastError; +} + +LimeRender::LimeRender(QObject *parent) + : QObject(parent), d_ptr(new LimeRenderPrivate()) +{ + Q_D(LimeRender); + d->q_ptr=this; + connect(d, SIGNAL(renderStarted()), this, SIGNAL(renderStarted())); + connect(d, SIGNAL(renderPageFinished(int)), + this, SIGNAL(renderPageFinished(int))); + connect(d, SIGNAL(renderFinished()), this, SIGNAL(renderFinished())); + connect(d, SIGNAL(onLoad(bool&)), this, SIGNAL(onLoad(bool&))); +} + +LimeRender::~LimeRender() +{ + delete d_ptr; +} + +bool LimeRender::printReport(QPrinter *printer) +{ + Q_D(LimeRender); + return d->printReport(printer); +} + +bool LimeRender::printPages(ReportPages pages, QPrinter *printer){ + Q_D(LimeRender); + return d->printPages(pages,printer); +} + +void LimeRender::printToFile(const QString &fileName) +{ + Q_D(LimeRender); + d->printToFile(fileName); +} + +bool LimeRender::printToPDF(const QString &fileName) +{ + Q_D(LimeRender); + return d->printToPDF(fileName); +} + +void LimeRender::previewReport(PreviewHints hints) +{ + Q_D(LimeRender); + if (m_settings) + d->setSettings(m_settings); + d->previewReport(hints); +} + +void LimeRender::designReport() +{ + Q_D(LimeRender); + if (m_settings) + d->setSettings(m_settings); + d->designReport(); +} + +PreviewReportWidget* LimeRender::createPreviewWidget(QWidget *parent) +{ + Q_D(LimeRender); + return d->createPreviewWidget(parent); +} + +void LimeRender::setPreviewWindowTitle(const QString &title) +{ + Q_D(LimeRender); + d->setPreviewWindowTitle(title); +} + +void LimeRender::setPreviewWindowIcon(const QIcon &icon) +{ + Q_D(LimeRender); + d->setPreviewWindowIcon(icon); +} + +void LimeRender::setResultEditable(bool value) +{ + Q_D(LimeRender); + d->setResultEditable(value); +} + +bool LimeRender::resultIsEditable() +{ + Q_D(LimeRender); + return d->resultIsEditable(); +} + +bool LimeRender::isBusy() +{ + Q_D(LimeRender); + return d->isBusy(); +} + +void LimeRender::setPassPharse(QString &passPharse) +{ + Q_D(LimeRender); + d->setPassPhrase(passPharse); +} + +QList LimeRender::aviableLanguages() +{ + Q_D(LimeRender); + return d->aviableLanguages(); +} + +bool LimeRender::setReportLanguage(QLocale::Language language) +{ + Q_D(LimeRender); + return d->setReportLanguage(language); +} + +void LimeRender::setShowProgressDialog(bool value) +{ + Q_D(LimeRender); + d->setShowProgressDialog(value); +} + +IDataSourceManager *LimeRender::dataManager() +{ + Q_D(LimeRender); + return d->dataManagerIntf(); +} + +IScriptEngineManager *LimeRender::scriptManager() +{ + Q_D(LimeRender); + return d->scriptManagerIntf(); +} + +bool LimeRender::loadFromFile(const QString &fileName, bool autoLoadPreviewOnChange) +{ + Q_D(LimeRender); + return d->loadFromFile(fileName, autoLoadPreviewOnChange); +} + +bool LimeRender::loadFromByteArray(QByteArray* data){ + Q_D(LimeRender); + return d->loadFromByteArray(data); +} + +bool LimeRender::loadFromString(const QString &data) +{ + Q_D(LimeRender); + return d->loadFromString(data); +} + +QString LimeRender::reportFileName() +{ + Q_D(LimeRender); + return d->reportFileName(); +} + +void LimeRender::setReportFileName(const QString &fileName) +{ + Q_D(LimeRender); + return d->setReportFileName(fileName); +} + +QString LimeRender::lastError() +{ + Q_D(LimeRender); + return d->lastError(); +} + +void LimeRender::setCurrentReportsDir(const QString &dirName) +{ + Q_D(LimeRender); + return d->setCurrentReportsDir(dirName); +} + +void LimeRender::setReportName(const QString &name) +{ + Q_D(LimeRender); + return d->setReportName(name); +} + +QString LimeRender::reportName() +{ + Q_D(LimeRender); + return d->reportName(); +} + +void LimeRender::cancelRender() +{ + Q_D(LimeRender); + d->cancelRender(); +} + +LimeRender::LimeRender(LimeRenderPrivate &dd, QObject *parent) + :QObject(parent),d_ptr(&dd) +{ + Q_D(LimeRender); + d->q_ptr=this; + connect(d, SIGNAL(renderStarted()), this, SIGNAL(renderStarted())); + connect(d, SIGNAL(renderPageFinished(int)), + this, SIGNAL(renderPageFinished(int))); + connect(d, SIGNAL(renderFinished()), this, SIGNAL(renderFinished())); +} + +ScriptEngineManager*LimeReport::LimeRenderPrivate::scriptManager(){ + ScriptEngineManager::instance().setContext(scriptContext()); + ScriptEngineManager::instance().setDataManager(dataManager()); + return &ScriptEngineManager::instance(); +} + +}// namespace LimeReport + diff --git a/limereport.pro b/limereport.pro index 84179ac..0615e31 100644 --- a/limereport.pro +++ b/limereport.pro @@ -15,7 +15,7 @@ SUBDIRS += \ CONFIG += ordered -SUBDIRS += demo_r1 demo_r2 designer +SUBDIRS += demo_r1 demo_r2 designer designer_plugin diff --git a/limereport/items/editors/lrfonteditorwidget.cpp b/limereport/items/editors/lrfonteditorwidget.cpp index a2d7dbc..beef254 100644 --- a/limereport/items/editors/lrfonteditorwidget.cpp +++ b/limereport/items/editors/lrfonteditorwidget.cpp @@ -31,23 +31,31 @@ namespace LimeReport{ -FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, const QString &title, QWidget *parent) - : ItemEditorWidget(reportEditor,title,parent), m_ignoreSlots(false) { - initEditor(); -} +//#ifdef IS_REPORT_DESIGNER +//FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, const QString &title, QWidget *parent) +// : ItemEditorWidget(reportEditor,title,parent), m_ignoreSlots(false) { +// initEditor(); +//} -FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, QWidget *parent) - :ItemEditorWidget(reportEditor,parent), m_ignoreSlots(false) { - initEditor(); -} +//FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, QWidget *parent) +// :ItemEditorWidget(reportEditor,parent), m_ignoreSlots(false) { +// initEditor(); +//} +//#endif -FontEditorWidget::FontEditorWidget(PageDesignIntf *page, const QString &title, QWidget *parent) - :ItemEditorWidget(page,title,parent), m_ignoreSlots(false) { - initEditor(); -} +//FontEditorWidget::FontEditorWidget(PageDesignIntf *page, const QString &title, QWidget *parent) +// :ItemEditorWidget(page,title,parent), m_ignoreSlots(false) { +// initEditor(); +//} -FontEditorWidget::FontEditorWidget(LimeReport::PageDesignIntf *page, QWidget *parent) - :ItemEditorWidget(page,parent), m_ignoreSlots(false){ +//FontEditorWidget::FontEditorWidget(LimeReport::PageDesignIntf *page, QWidget *parent) +// :ItemEditorWidget(page,parent), m_ignoreSlots(false){ +// initEditor(); +//} + +FontEditorWidget::FontEditorWidget(const QString& title, QWidget* parent) + :ItemEditorWidget(title, parent), m_ignoreSlots(false) +{ initEditor(); } @@ -101,10 +109,13 @@ void FontEditorWidget::initEditor() connect(m_fontUnderline,SIGNAL(toggled(bool)),this,SLOT(slotFontAttribsChanged(bool))); addAction(m_fontUnderline); - if (reportEditor()){ - connect(reportEditor(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), - this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant))); - } +//#ifdef IS_REPORT_DESIGNER +// if (reportEditor()){ +// connect(reportEditor(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), +// this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant))); +// } +//#endif + } void FontEditorWidget::updateValues(const QFont& font) @@ -118,34 +129,41 @@ void FontEditorWidget::updateValues(const QFont& font) m_ignoreSlots=false; } +bool FontEditorWidget::ignoreSlots() const +{ + return m_ignoreSlots; +} + void FontEditorWidget::slotFontChanged(const QFont &font) { - if (reportEditor() && !m_ignoreSlots) reportEditor()->setFont(font); - if (page()) page()->setFont(font); + // if (page()) page()->setFont(font); } void FontEditorWidget::slotFontSizeChanged(const QString &value) { if (m_ignoreSlots) return; - QFont resFont(fontNameEditor()->currentFont()); - resFont.setPointSize(value.toInt()); - - if (reportEditor()) reportEditor()->setFont(resFont); - if (page()) page()->setFont(resFont); + m_resFont = fontNameEditor()->currentFont(); + m_resFont.setPointSize(value.toInt()); +//#ifdef IS_REPORT_DESIGNER +// if (reportEditor()) reportEditor()->setFont(resFont); +//#endif +// if (page()) page()->setFont(resFont); } void FontEditorWidget::slotFontAttribsChanged(bool) { if (m_ignoreSlots) return; - QFont resFont(m_fontNameEditor->currentFont()); - resFont.setBold(m_fontBold->isChecked()); - resFont.setItalic(m_fontItalic->isChecked()); - resFont.setUnderline(m_fontUnderline->isChecked()); - if (reportEditor()) reportEditor()->setFont(resFont); - if (page()) page()->setFont(resFont); + m_resFont = m_fontNameEditor->currentFont(); + m_resFont.setBold(m_fontBold->isChecked()); + m_resFont.setItalic(m_fontItalic->isChecked()); + m_resFont.setUnderline(m_fontUnderline->isChecked()); +//#ifdef IS_REPORT_DESIGNER +// if (reportEditor()) reportEditor()->setFont(resFont); +//#endif +// if (page()) page()->setFont(resFont); } @@ -159,4 +177,49 @@ void FontEditorWidget::slotPropertyChanged(const QString &objectName, const QStr } +void FontEditorWidgetForPage::slotFontChanged(const QFont& font) +{ + m_page->setFont(font); +} + +void FontEditorWidgetForPage::slotFontSizeChanged(const QString& value) +{ + FontEditorWidget::slotFontSizeChanged(value); + m_page->setFont(resFont()); +} + +void FontEditorWidgetForPage::slotFontAttribsChanged(bool value) +{ + FontEditorWidget::slotFontAttribsChanged(value); + m_page->setFont(resFont()); +} + +#ifdef IS_REPORT_DESIGNER +void FontEditorWidgetForDesigner::initEditor() +{ + FontEditorWidget::initEditor(); + connect(m_reportEditor,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), + this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant))); +} + +void FontEditorWidgetForDesigner::slotFontChanged(const QFont& font) +{ + if (!ignoreSlots()) m_reportEditor->setFont(font); +} + +void FontEditorWidgetForDesigner::slotFontSizeChanged(const QString& value) +{ + FontEditorWidget::slotFontSizeChanged(value); + m_reportEditor->setFont(resFont()); +} + +void FontEditorWidgetForDesigner::slotFontAttribsChanged(bool value) +{ + FontEditorWidget::slotFontAttribsChanged(value); + m_reportEditor->setFont(resFont()); +} + +#endif + + } //namespace LimeReport diff --git a/limereport/items/editors/lrfonteditorwidget.h b/limereport/items/editors/lrfonteditorwidget.h index 23f9ab7..4269b3e 100644 --- a/limereport/items/editors/lrfonteditorwidget.h +++ b/limereport/items/editors/lrfonteditorwidget.h @@ -35,7 +35,10 @@ #include #include +#ifdef IS_REPORT_DESIGNER #include "lrreportdesignwidget.h" +#endif + #include "lritemeditorwidget.h" namespace LimeReport{ @@ -43,20 +46,27 @@ namespace LimeReport{ class FontEditorWidget :public ItemEditorWidget{ Q_OBJECT public: - explicit FontEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0); - explicit FontEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0); - explicit FontEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0); - explicit FontEditorWidget(PageDesignIntf* page, QWidget *parent = 0); + explicit FontEditorWidget(const QString &title, QWidget *parent = 0); +//#ifdef IS_REPORT_DESIGNER +// explicit FontEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0); +// explicit FontEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0); +//#endif +// explicit FontEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0); +// explicit FontEditorWidget(PageDesignIntf* page, QWidget *parent = 0); + bool ignoreSlots() const; protected: void setItemEvent(BaseDesignIntf *item); QFontComboBox* fontNameEditor(){return m_fontNameEditor;} -private slots: - void slotFontChanged(const QFont& font); - void slotFontSizeChanged(const QString& value); - void slotFontAttribsChanged(bool); + virtual void initEditor(); +protected slots: + virtual void slotFontChanged(const QFont& font); + virtual void slotFontSizeChanged(const QString& value); + virtual void slotFontAttribsChanged(bool); void slotPropertyChanged(const QString& objectName, const QString& property, const QVariant &oldValue, const QVariant &newValue); +protected: + QFont resFont(){return m_resFont;} private: - void initEditor(); + void updateValues(const QFont &font); QFontComboBox* m_fontNameEditor; @@ -68,9 +78,41 @@ private: QAction* m_fontUnderline; bool m_ignoreSlots; + QFont m_resFont; }; +class FontEditorWidgetForPage : public FontEditorWidget{ + Q_OBJECT +public: + explicit FontEditorWidgetForPage(PageDesignIntf* page, const QString &title, QWidget *parent = 0) + : FontEditorWidget(title, parent), m_page(page){} +protected slots: + virtual void slotFontChanged(const QFont& font); + virtual void slotFontSizeChanged(const QString& value); + virtual void slotFontAttribsChanged(bool value); +private: + PageDesignIntf* m_page; +}; + +#ifdef IS_REPORT_DESIGNER +class FontEditorWidgetForDesigner : public FontEditorWidget{ + Q_OBJECT +public: + explicit FontEditorWidgetForDesigner(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0) + : FontEditorWidget(title, parent), m_reportEditor(reportEditor){} + +protected: + void initEditor(); +protected slots: + virtual void slotFontChanged(const QFont& font); + virtual void slotFontSizeChanged(const QString& value); + virtual void slotFontAttribsChanged(bool value); +private: + ReportDesignWidget* m_reportEditor; +}; +#endif + } //namespace LimeReport #endif // LRFONTEDITORWIDGET_H diff --git a/limereport/items/editors/lritemeditorwidget.cpp b/limereport/items/editors/lritemeditorwidget.cpp index d335697..86287a7 100644 --- a/limereport/items/editors/lritemeditorwidget.cpp +++ b/limereport/items/editors/lritemeditorwidget.cpp @@ -31,25 +31,35 @@ namespace LimeReport{ -ItemEditorWidget::ItemEditorWidget(ReportDesignWidget* reportEditor, const QString& title, QWidget* parent) - :QToolBar(title,parent), m_reportEditor(reportEditor), m_item(0), m_page(0) -{ -} +//#ifdef IS_REPORT_DESIGNER +//ItemEditorWidget::ItemEditorWidget(ReportDesignWidget* reportEditor, const QString& title, QWidget* parent) +// :QToolBar(title,parent), m_reportEditor(reportEditor), m_item(0), m_page(0) +//{ +//} -ItemEditorWidget::ItemEditorWidget(ReportDesignWidget* reportEditor, QWidget* parent) - :QToolBar(parent), m_reportEditor(reportEditor), m_item(0), m_page(0) -{ -} +//ItemEditorWidget::ItemEditorWidget(ReportDesignWidget* reportEditor, QWidget* parent) +// :QToolBar(parent), m_reportEditor(reportEditor), m_item(0), m_page(0) +//{ +//} +//#endif -ItemEditorWidget::ItemEditorWidget(PageDesignIntf* page, const QString& title, QWidget* parent) - :QToolBar(title,parent), m_reportEditor(0), m_item(0), m_page(page) -{ -} +//ItemEditorWidget::ItemEditorWidget(PageDesignIntf* page, const QString& title, QWidget* parent) +// :QToolBar(title,parent), +//#ifdef IS_REPORT_DESIGNER +// m_reportEditor(0), +//#endif +// m_item(0), m_page(page) +//{ +//} -ItemEditorWidget::ItemEditorWidget(PageDesignIntf* page, QWidget* parent) - :QToolBar(parent), m_reportEditor(0), m_item(0), m_page(page) -{ -} +//ItemEditorWidget::ItemEditorWidget(PageDesignIntf* page, QWidget* parent) +// :QToolBar(parent), +//#ifdef IS_REPORT_DESIGNER +// m_reportEditor(0), +//#endif +// m_item(0), m_page(page) +//{ +//} void ItemEditorWidget::setItem(BaseDesignIntf* item) { diff --git a/limereport/items/editors/lritemeditorwidget.h b/limereport/items/editors/lritemeditorwidget.h index 5214756..7bf2404 100644 --- a/limereport/items/editors/lritemeditorwidget.h +++ b/limereport/items/editors/lritemeditorwidget.h @@ -31,7 +31,11 @@ #define LRITEMEDITORWIDGET_H #include + +#ifdef IS_REPORT_DESIGNER #include "lrreportdesignwidget.h" +#endif +#include "lrpagedesignintf.h" namespace LimeReport { @@ -39,26 +43,35 @@ class ItemEditorWidget : public QToolBar { Q_OBJECT public: - explicit ItemEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0); - explicit ItemEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0); - explicit ItemEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0); - explicit ItemEditorWidget(PageDesignIntf* page, QWidget *parent = 0); - + explicit ItemEditorWidget(const QString &title, QWidget *parent = 0) + : QToolBar(title, parent), m_item(0){} +//#ifdef IS_REPORT_DESIGNER +// explicit ItemEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0); +// explicit ItemEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0); +//#endif +// explicit ItemEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0); +// explicit ItemEditorWidget(PageDesignIntf* page, QWidget *parent = 0); void setItem(BaseDesignIntf *item); - void setReportEditor(ReportDesignWidget* editor){m_reportEditor = editor;} +//#ifdef IS_REPORT_DESIGNER +// void setReportEditor(ReportDesignWidget* editor){m_reportEditor = editor;} +//#endif protected: virtual void setItemEvent(BaseDesignIntf*){} virtual void properyChangedEvent(const QString& propertName, const QVariant& oldValue, const QVariant& newValue); BaseDesignIntf* item(){return m_item;} - ReportDesignWidget* reportEditor(){return m_reportEditor;} - PageDesignIntf* page(){return m_page;} +//#ifdef IS_REPORT_DESIGNER +// ReportDesignWidget* reportEditor(){return m_reportEditor;} +//#endif +// PageDesignIntf* page(){return m_page;} private slots: void slotItemDestroyed(QObject* item); void slotPropertyChanged(const QString& propertName, const QVariant& oldValue, const QVariant& newValue); private: - ReportDesignWidget* m_reportEditor; +//#ifdef IS_REPORT_DESIGNER +// ReportDesignWidget* m_reportEditor; +//#endif BaseDesignIntf* m_item; - PageDesignIntf* m_page; +// PageDesignIntf* m_page; }; } // namespace LimeReport diff --git a/limereport/items/editors/lritemsborderseditorwidget.cpp b/limereport/items/editors/lritemsborderseditorwidget.cpp index afdf766..2a2f771 100644 --- a/limereport/items/editors/lritemsborderseditorwidget.cpp +++ b/limereport/items/editors/lritemsborderseditorwidget.cpp @@ -31,19 +31,19 @@ #include namespace LimeReport{ +//#ifdef IS_REPORT_DESIGNER +//ItemsBordersEditorWidget::ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, const QString& title, QWidget* parent) +// : ItemEditorWidget(reportEditor,title,parent), m_changing(false) +//{ +// initEditor(); +//} -ItemsBordersEditorWidget::ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, const QString& title, QWidget* parent) - : ItemEditorWidget(reportEditor,title,parent), m_changing(false) -{ - initEditor(); -} - -ItemsBordersEditorWidget::ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, QWidget* parent) - : ItemEditorWidget(reportEditor,parent), m_changing(false) -{ - initEditor(); -} - +//ItemsBordersEditorWidget::ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, QWidget* parent) +// : ItemEditorWidget(reportEditor,parent), m_changing(false) +//{ +// initEditor(); +//} +//#endif void ItemsBordersEditorWidget::setItemEvent(BaseDesignIntf* item) { QVariant borders=item->property("borders"); @@ -65,8 +65,10 @@ void ItemsBordersEditorWidget::properyChangedEvent(const QString& property, cons void ItemsBordersEditorWidget::noBordesClicked() { - if (reportEditor()) - reportEditor()->setBorders(0); +//#ifdef IS_REPORT_DESIGNER +// if (reportEditor()) +// reportEditor()->setBorders(0); +//#endif updateValues(0); } @@ -78,14 +80,15 @@ void ItemsBordersEditorWidget::allBordesClicked() BaseDesignIntf::BottomLine; updateValues((BaseDesignIntf::BorderLines)borders); - if (reportEditor()) - reportEditor()->setBorders((BaseDesignIntf::BorderLines)borders); +//#ifdef IS_REPORT_DESIGNER +// if (reportEditor()) +// reportEditor()->setBorders((BaseDesignIntf::BorderLines)borders); +//#endif } void ItemsBordersEditorWidget::buttonClicked(bool) { - if (!m_changing&&reportEditor()) - reportEditor()->setBorders(createBorders()); + } void ItemsBordersEditorWidget::initEditor() @@ -151,4 +154,29 @@ BaseDesignIntf::BorderLines ItemsBordersEditorWidget::createBorders() return (BaseDesignIntf::BorderLines)borders; } +bool ItemsBordersEditorWidget::changing() const +{ + return m_changing; +} + +#ifdef IS_REPORT_DESIGNER +void ItemsBordersEditorWidgetForDesigner::buttonClicked(bool) +{ + if (!changing()) + m_reportEditor->setBorders(createBorders()); +} + +void ItemsBordersEditorWidgetForDesigner::noBordesClicked() +{ + m_reportEditor->setBorders(0); + ItemsBordersEditorWidget::noBordesClicked(); +} + +void ItemsBordersEditorWidgetForDesigner::allBordesClicked() +{ + ItemsBordersEditorWidget::allBordesClicked(); + m_reportEditor->setBorders(createBorders()); +} +#endif + } //namespace LimeReport diff --git a/limereport/items/editors/lritemsborderseditorwidget.h b/limereport/items/editors/lritemsborderseditorwidget.h index 296107e..ff10d14 100644 --- a/limereport/items/editors/lritemsborderseditorwidget.h +++ b/limereport/items/editors/lritemsborderseditorwidget.h @@ -36,23 +36,32 @@ namespace LimeReport{ + + class ItemsBordersEditorWidget : public ItemEditorWidget { Q_OBJECT public: - explicit ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0); - explicit ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0); -private slots: - void noBordesClicked(); - void allBordesClicked(); - void buttonClicked(bool); + explicit ItemsBordersEditorWidget(const QString &title, QWidget *parent = 0) + : ItemEditorWidget(title, parent), m_changing(false), m_borders(0){ + initEditor(); + } +//#ifdef IS_REPORT_DESIGNER +// explicit ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0); +// explicit ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0); +//#endif + bool changing() const; +protected slots: + virtual void noBordesClicked(); + virtual void allBordesClicked(); + virtual void buttonClicked(bool); protected: void setItemEvent(BaseDesignIntf *item); void properyChangedEvent(const QString &property, const QVariant &oldValue, const QVariant &newValue); + BaseDesignIntf::BorderLines createBorders(); private: void initEditor(); void updateValues(BaseDesignIntf::BorderLines borders); - BaseDesignIntf::BorderLines createBorders(); QAction* m_noLines; QAction* m_leftLine; QAction* m_rightLine; @@ -60,8 +69,25 @@ private: QAction* m_bottomLine; QAction* m_allLines; bool m_changing; + int m_borders; }; + +#ifdef IS_REPORT_DESIGNER +class ItemsBordersEditorWidgetForDesigner : public ItemsBordersEditorWidget{ + Q_OBJECT +public: + explicit ItemsBordersEditorWidgetForDesigner(ReportDesignWidget* reportEditor, const QString &title="", QWidget *parent = 0) + : ItemsBordersEditorWidget(title,parent), m_reportEditor(reportEditor){} +protected slots: + void buttonClicked(bool); + void noBordesClicked(); + void allBordesClicked(); +private: + ReportDesignWidget* m_reportEditor; +}; +#endif + }//namespace LimeReport #endif // LRITEMSBORDERSEDITORWIDGET_H diff --git a/limereport/items/editors/lrtextalignmenteditorwidget.cpp b/limereport/items/editors/lrtextalignmenteditorwidget.cpp index 50da901..3ba282d 100644 --- a/limereport/items/editors/lrtextalignmenteditorwidget.cpp +++ b/limereport/items/editors/lrtextalignmenteditorwidget.cpp @@ -30,30 +30,36 @@ #include "lrtextalignmenteditorwidget.h" namespace LimeReport{ - -TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, const QString &title, QWidget *parent) - :ItemEditorWidget(reportEditor,title,parent), m_textAttibutesIsChanging(false) +TextAlignmentEditorWidget::TextAlignmentEditorWidget(const QString& title, QWidget* parent) + :ItemEditorWidget(title, parent), m_textAttibutesIsChanging(false), m_flag(0) { initEditor(); } -TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, QWidget *parent) - :ItemEditorWidget(reportEditor,parent), m_textAttibutesIsChanging(false) -{ - initEditor(); -} +//#ifdef IS_REPORT_DESIGNER +//TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, const QString &title, QWidget *parent) +// :ItemEditorWidget(reportEditor,title,parent), m_textAttibutesIsChanging(false) +//{ +// initEditor(); +//} -TextAlignmentEditorWidget::TextAlignmentEditorWidget(PageDesignIntf* page, const QString& title, QWidget* parent) - :ItemEditorWidget(page,title,parent), m_textAttibutesIsChanging(false) -{ - initEditor(); -} +//TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, QWidget *parent) +// :ItemEditorWidget(reportEditor,parent), m_textAttibutesIsChanging(false) +//{ +// initEditor(); +//} +//#endif +//TextAlignmentEditorWidget::TextAlignmentEditorWidget(PageDesignIntf* page, const QString& title, QWidget* parent) +// :ItemEditorWidget(page,title,parent), m_textAttibutesIsChanging(false) +//{ +// initEditor(); +//} -TextAlignmentEditorWidget::TextAlignmentEditorWidget(PageDesignIntf* page, QWidget* parent) - :ItemEditorWidget(page,parent), m_textAttibutesIsChanging(false) -{ - initEditor(); -} +//TextAlignmentEditorWidget::TextAlignmentEditorWidget(PageDesignIntf* page, QWidget* parent) +// :ItemEditorWidget(page,parent), m_textAttibutesIsChanging(false) +//{ +// initEditor(); +//} void TextAlignmentEditorWidget::setItemEvent(BaseDesignIntf *item) { @@ -109,21 +115,22 @@ void TextAlignmentEditorWidget::initEditor() m_textAliginBottom->setCheckable(true); connect(m_textAliginBottom,SIGNAL(toggled(bool)),this,SLOT(slotTextVAttribsChanged(bool))); addAction(m_textAliginBottom); - - if (reportEditor()){ - connect(reportEditor(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), - this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant))); - } - if (page()){ - connect(page(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), - this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant))); - } +//#ifdef IS_REPORT_DESIGNER +// if (reportEditor()){ +// connect(reportEditor(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), +// this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant))); +// } +//#endif +// if (page()){ +// connect(page(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), +// this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant))); +// } setEnabled(false); } void TextAlignmentEditorWidget::updateValues(const Qt::Alignment &align) { - m_textAttibutesIsChanging=true; + m_textAttibutesIsChanging=true; m_textAliginLeft->setChecked((align & Qt::AlignLeft)==Qt::AlignLeft); m_textAliginRight->setChecked((align & Qt::AlignRight)==Qt::AlignRight); m_textAliginHCenter->setChecked((align & Qt::AlignHCenter)==Qt::AlignHCenter); @@ -157,17 +164,18 @@ void TextAlignmentEditorWidget::slotTextHAttribsChanged(bool) m_textAliginRight->setChecked(sender()==m_textAliginRight); m_textAliginJustify->setChecked(sender()==m_textAliginJustify); - int flag = 0; - if (sender()==m_textAliginLeft) flag |= Qt::AlignLeft; - if (sender()==m_textAliginHCenter) flag |= Qt::AlignHCenter; - if (sender()==m_textAliginRight) flag |= Qt::AlignRight; - if (sender()==m_textAliginJustify) flag |= Qt::AlignJustify; - - if (reportEditor()) reportEditor()->setTextAlign(true,Qt::AlignmentFlag(flag)); - if (page()) { - //page()->setTextAlign(createAlignment()); - page()->changeSelectedGrpoupTextAlignPropperty(true,Qt::AlignmentFlag(flag)); - } + m_flag = 0; + if (sender()==m_textAliginLeft) m_flag |= Qt::AlignLeft; + if (sender()==m_textAliginHCenter) m_flag |= Qt::AlignHCenter; + if (sender()==m_textAliginRight) m_flag |= Qt::AlignRight; + if (sender()==m_textAliginJustify) m_flag |= Qt::AlignJustify; +//#ifdef IS_REPORT_DESIGNER +// if (reportEditor()) reportEditor()->setTextAlign(true,Qt::AlignmentFlag(flag)); +//#endif +// if (page()) { +// //page()->setTextAlign(createAlignment()); +// page()->changeSelectedGrpoupTextAlignPropperty(true,Qt::AlignmentFlag(flag)); +// } m_textAttibutesIsChanging = false; } @@ -180,13 +188,14 @@ void TextAlignmentEditorWidget::slotTextVAttribsChanged(bool) m_textAliginVCenter->setChecked(sender()==m_textAliginVCenter); m_textAliginBottom->setChecked(sender()==m_textAliginBottom); - int flag = 0; - if (sender()==m_textAliginTop) flag |= Qt::AlignTop; - if (sender()==m_textAliginVCenter) flag |= Qt::AlignVCenter; - if (sender()==m_textAliginBottom) flag |= Qt::AlignBottom; - - if (reportEditor()) reportEditor()->setTextAlign(false,Qt::AlignmentFlag(flag)); - if (page()) page()->changeSelectedGrpoupTextAlignPropperty(false,Qt::AlignmentFlag(flag) ); + m_flag = 0; + if (sender()==m_textAliginTop) m_flag |= Qt::AlignTop; + if (sender()==m_textAliginVCenter) m_flag |= Qt::AlignVCenter; + if (sender()==m_textAliginBottom) m_flag |= Qt::AlignBottom; +//#ifdef IS_REPORT_DESIGNER +// if (reportEditor()) reportEditor()->setTextAlign(false,Qt::AlignmentFlag(flag)); +//#endif +// if (page()) page()->changeSelectedGrpoupTextAlignPropperty(false,Qt::AlignmentFlag(flag) ); m_textAttibutesIsChanging = false; } @@ -200,5 +209,63 @@ void TextAlignmentEditorWidget::slotPropertyChanged(const QString &objectName, c } } +int TextAlignmentEditorWidget::flag() const +{ + return m_flag; +} + +void TextAlignmentEditorWidgetForPage::initEditor() +{ + TextAlignmentEditorWidget::initEditor(); + connect(m_page,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), + this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant))); +} + +void TextAlignmentEditorWidgetForPage::slotTextHAttribsChanged(bool value) +{ + + TextAlignmentEditorWidget::slotTextHAttribsChanged(value); + if (m_textAttibutesIsChanging) return; + m_textAttibutesIsChanging = true; + m_page->changeSelectedGrpoupTextAlignPropperty(true,Qt::AlignmentFlag(flag())); + m_textAttibutesIsChanging = false; +} + +void TextAlignmentEditorWidgetForPage::slotTextVAttribsChanged(bool value) +{ + TextAlignmentEditorWidget::slotTextVAttribsChanged(value); + if (m_textAttibutesIsChanging) return; + m_textAttibutesIsChanging = true; + m_page->changeSelectedGrpoupTextAlignPropperty(false,Qt::AlignmentFlag(flag()) ); + m_textAttibutesIsChanging = false; +} + +#ifdef IS_REPORT_DESIGNER +void TextAlignmentEditorWidgetForDesigner::initEditor() +{ + TextAlignmentEditorWidget::initEditor(); + connect(m_reportEditor,SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)), + this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant))); + +} + +void TextAlignmentEditorWidgetForDesigner::slotTextHAttribsChanged(bool value) +{ + TextAlignmentEditorWidget::slotTextHAttribsChanged(value); + if (m_textAttibutesIsChanging) return; + m_textAttibutesIsChanging = true; + m_reportEditor->setTextAlign(true,Qt::AlignmentFlag(flag())); + m_textAttibutesIsChanging = false; +} + +void TextAlignmentEditorWidgetForDesigner::slotTextVAttribsChanged(bool value) +{ + TextAlignmentEditorWidget::slotTextVAttribsChanged(value); + if (m_textAttibutesIsChanging) return; + m_textAttibutesIsChanging = true; + m_reportEditor->setTextAlign(false,Qt::AlignmentFlag(flag())); + m_textAttibutesIsChanging = false; +} +#endif } //namespace LimeReport diff --git a/limereport/items/editors/lrtextalignmenteditorwidget.h b/limereport/items/editors/lrtextalignmenteditorwidget.h index 93fd39d..0934406 100644 --- a/limereport/items/editors/lrtextalignmenteditorwidget.h +++ b/limereport/items/editors/lrtextalignmenteditorwidget.h @@ -41,23 +41,26 @@ class TextAlignmentEditorWidget:public ItemEditorWidget { Q_OBJECT public: - explicit TextAlignmentEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0); - explicit TextAlignmentEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0); - explicit TextAlignmentEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0); - explicit TextAlignmentEditorWidget(PageDesignIntf* page, QWidget *parent = 0); + explicit TextAlignmentEditorWidget(const QString &title, QWidget *parent = 0); +//#ifdef IS_REPORT_DESIGNER +// explicit TextAlignmentEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0); +// explicit TextAlignmentEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0); +//#endif +// explicit TextAlignmentEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0); +// explicit TextAlignmentEditorWidget(PageDesignIntf* page, QWidget *parent = 0); + int flag() const; protected: void setItemEvent(BaseDesignIntf *item); + virtual void initEditor(); + bool m_textAttibutesIsChanging; private: - void initEditor(); void updateValues(const Qt::Alignment& align); Qt::Alignment createAlignment(); -private slots: - void slotTextHAttribsChanged(bool); - void slotTextVAttribsChanged(bool); - void slotPropertyChanged(const QString& objectName, const QString& property, const QVariant &oldValue, const QVariant &newValue); +protected slots: + virtual void slotTextHAttribsChanged(bool); + virtual void slotTextVAttribsChanged(bool); + virtual void slotPropertyChanged(const QString& objectName, const QString& property, const QVariant &oldValue, const QVariant &newValue); private: - bool m_textAttibutesIsChanging; - QAction* m_textAliginLeft; QAction* m_textAliginRight; QAction* m_textAliginHCenter; @@ -66,8 +69,40 @@ private: QAction* m_textAliginBottom; QAction* m_textAliginVCenter; + int m_flag; + }; +class TextAlignmentEditorWidgetForPage: public TextAlignmentEditorWidget{ + Q_OBJECT +public: + TextAlignmentEditorWidgetForPage(PageDesignIntf* page, const QString &title, QWidget *parent = 0) + :TextAlignmentEditorWidget(title, parent), m_page(page){} +protected: + void initEditor(); +protected slots: + void slotTextHAttribsChanged(bool value); + void slotTextVAttribsChanged(bool value); +private: + PageDesignIntf* m_page; +}; + +#ifdef IS_REPORT_DESIGNER +class TextAlignmentEditorWidgetForDesigner: public TextAlignmentEditorWidget{ + Q_OBJECT +public: + TextAlignmentEditorWidgetForDesigner(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0) + :TextAlignmentEditorWidget(title, parent), m_reportEditor(reportEditor){} +protected: + void initEditor(); +protected slots: + void slotTextHAttribsChanged(bool value); + void slotTextVAttribsChanged(bool value); +private: + ReportDesignWidget* m_reportEditor; +}; +#endif + } //namespace LimeReport #endif // LRTEXTALIGNMENTEDITORWIDGET_H diff --git a/limereport/limereport.pri b/limereport/limereport.pri index 385ad4d..cf9c5af 100644 --- a/limereport/limereport.pri +++ b/limereport/limereport.pri @@ -1,8 +1,8 @@ include(../common.pri) -contains(CONFIG,dialogdesigner){ - include($$REPORT_PATH/dialogdesigner/dialogdesigner.pri) -} +#contains(CONFIG,dialogdesigner){ +# include($$REPORT_PATH/dialogdesigner/dialogdesigner.pri) +#} DEFINES += INSPECT_BASEDESIGN @@ -11,9 +11,10 @@ INCLUDEPATH += \ $$REPORT_PATH/items \ $$REPORT_PATH/bands \ $$REPORT_PATH/base \ - $$REPORT_PATH/objectinspector \ - $$REPORT_PATH/databrowser \ +# $$REPORT_PATH/objectinspector \ +# $$REPORT_PATH/databrowser \ $$REPORT_PATH/scripteditor +# $$REPORT_PATH/../designer_plugin SOURCES += \ $$REPORT_PATH/bands/lrpageheader.cpp \ @@ -24,59 +25,59 @@ SOURCES += \ $$REPORT_PATH/bands/lrgroupbands.cpp \ $$REPORT_PATH/bands/lrsubdetailband.cpp \ $$REPORT_PATH/bands/lrtearoffband.cpp \ - $$REPORT_PATH/databrowser/lrdatabrowser.cpp \ - $$REPORT_PATH/databrowser/lrsqleditdialog.cpp \ - $$REPORT_PATH/databrowser/lrconnectiondialog.cpp \ - $$REPORT_PATH/databrowser/lrvariabledialog.cpp \ - $$REPORT_PATH/databrowser/lrdatabrowsertree.cpp \ +# $$REPORT_PATH/databrowser/lrdatabrowser.cpp \ +# $$REPORT_PATH/databrowser/lrsqleditdialog.cpp \ +# $$REPORT_PATH/databrowser/lrconnectiondialog.cpp \ +# $$REPORT_PATH/databrowser/lrvariabledialog.cpp \ +# $$REPORT_PATH/databrowser/lrdatabrowsertree.cpp \ $$REPORT_PATH/serializators/lrxmlqrectserializator.cpp \ $$REPORT_PATH/serializators/lrxmlbasetypesserializators.cpp \ $$REPORT_PATH/serializators/lrxmlreader.cpp \ $$REPORT_PATH/serializators/lrxmlwriter.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.cpp \ - $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.cpp \ - $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrfonteditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrimageeditor.cpp \ - $$REPORT_PATH/objectinspector/editors/lrcoloreditor.cpp \ - $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.cpp \ - $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.cpp \ - $$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \ - $$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \ - $$REPORT_PATH/objectinspector/lrpropertydelegate.cpp \ - $$REPORT_PATH/objectsbrowser/lrobjectbrowser.cpp \ - $$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.cpp \ +# $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.cpp \ +# $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.cpp \ +# $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.cpp \ +# $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.cpp \ +# $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.cpp \ +# $$REPORT_PATH/objectinspector/editors/lrfonteditor.cpp \ +# $$REPORT_PATH/objectinspector/editors/lrimageeditor.cpp \ +# $$REPORT_PATH/objectinspector/editors/lrcoloreditor.cpp \ +# $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.cpp \ +# $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.cpp \ +# $$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \ +# $$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \ +# $$REPORT_PATH/objectinspector/lrpropertydelegate.cpp \ +# $$REPORT_PATH/objectsbrowser/lrobjectbrowser.cpp \ +# $$REPORT_PATH/scriptbrowser/lrscriptbrowser.cpp \ $$REPORT_PATH/scripteditor/lrscripteditor.cpp \ $$REPORT_PATH/scripteditor/lrcodeeditor.cpp \ $$REPORT_PATH/scripteditor/lrscripthighlighter.cpp \ - $$REPORT_PATH/items/lrsubitemparentpropitem.cpp \ - $$REPORT_PATH/items/lralignpropitem.cpp \ +# $$REPORT_PATH/items/lrsubitemparentpropitem.cpp \ +# $$REPORT_PATH/items/lralignpropitem.cpp \ $$REPORT_PATH/items/lrhorizontallayout.cpp \ $$REPORT_PATH/items/editors/lritemeditorwidget.cpp \ $$REPORT_PATH/items/editors/lrfonteditorwidget.cpp \ $$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.cpp \ - $$REPORT_PATH/items/editors/lritemsaligneditorwidget.cpp \ - $$REPORT_PATH/items/editors/lritemsborderseditorwidget.cpp \ +# $$REPORT_PATH/items/editors/lritemsaligneditorwidget.cpp \ +# $$REPORT_PATH/items/editors/lritemsborderseditorwidget.cpp \ $$REPORT_PATH/items/lrsimpletagparser.cpp \ $$REPORT_PATH/items/lrimageitem.cpp \ $$REPORT_PATH/items/lrtextitemeditor.cpp \ $$REPORT_PATH/items/lrshapeitem.cpp \ $$REPORT_PATH/items/lrtextitem.cpp \ - $$REPORT_PATH/translationeditor/translationeditor.cpp \ +# $$REPORT_PATH/translationeditor/translationeditor.cpp \ $$REPORT_PATH/lrbanddesignintf.cpp \ $$REPORT_PATH/lrpageitemdesignintf.cpp \ $$REPORT_PATH/lrpagedesignintf.cpp \ @@ -84,11 +85,11 @@ SOURCES += \ $$REPORT_PATH/lrglobal.cpp \ $$REPORT_PATH/lritemdesignintf.cpp \ $$REPORT_PATH/lrdatadesignintf.cpp \ - $$REPORT_PATH/lrreportdesignwidget.cpp \ +# $$REPORT_PATH/lrreportdesignwidget.cpp \ $$REPORT_PATH/lrbasedesignintf.cpp \ $$REPORT_PATH/lrreportengine.cpp \ $$REPORT_PATH/lrdatasourcemanager.cpp \ - $$REPORT_PATH/lrreportdesignwindow.cpp \ +# $$REPORT_PATH/lrreportdesignwindow.cpp \ $$REPORT_PATH/lrreportrender.cpp \ $$REPORT_PATH/lrscriptenginemanager.cpp \ $$REPORT_PATH/lrpreviewreportwindow.cpp \ @@ -104,7 +105,7 @@ SOURCES += \ $$REPORT_PATH/items/lrchartitem.cpp \ $$REPORT_PATH/items/lrchartitemeditor.cpp \ $$REPORT_PATH/lrreporttranslation.cpp \ - $$REPORT_PATH/translationeditor/languageselectdialog.cpp +# $$REPORT_PATH/translationeditor/languageselectdialog.cpp contains(CONFIG, staticlib){ SOURCES += $$REPORT_PATH/lrfactoryinitializer.cpp @@ -126,11 +127,11 @@ HEADERS += \ $$REPORT_PATH/bands/lrtearoffband.h \ $$REPORT_PATH/bands/lrsubdetailband.h \ $$REPORT_PATH/bands/lrgroupbands.h \ - $$REPORT_PATH/databrowser/lrdatabrowser.h \ - $$REPORT_PATH/databrowser/lrsqleditdialog.h \ - $$REPORT_PATH/databrowser/lrconnectiondialog.h \ - $$REPORT_PATH/databrowser/lrvariabledialog.h \ - $$REPORT_PATH/databrowser/lrdatabrowsertree.h \ +# $$REPORT_PATH/databrowser/lrdatabrowser.h \ +# $$REPORT_PATH/databrowser/lrsqleditdialog.h \ +# $$REPORT_PATH/databrowser/lrconnectiondialog.h \ +# $$REPORT_PATH/databrowser/lrvariabledialog.h \ +# $$REPORT_PATH/databrowser/lrdatabrowsertree.h \ $$REPORT_PATH/serializators/lrserializatorintf.h \ $$REPORT_PATH/serializators/lrstorageintf.h \ $$REPORT_PATH/serializators/lrxmlqrectserializator.h \ @@ -138,50 +139,50 @@ HEADERS += \ $$REPORT_PATH/serializators/lrxmlbasetypesserializators.h \ $$REPORT_PATH/serializators/lrxmlreader.h \ $$REPORT_PATH/serializators/lrxmlwriter.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.h \ - $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.h \ - $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.h \ - $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.h \ - $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.h \ - $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.h \ - $$REPORT_PATH/objectinspector/editors/lrimageeditor.h \ - $$REPORT_PATH/objectinspector/editors/lrcoloreditor.h \ - $$REPORT_PATH/objectinspector/editors/lrfonteditor.h \ - $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.h \ - $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.h \ - $$REPORT_PATH/objectinspector/lrobjectitemmodel.h \ - $$REPORT_PATH/objectinspector/lrobjectpropitem.h \ - $$REPORT_PATH/objectinspector/lrpropertydelegate.h \ - $$REPORT_PATH/objectsbrowser/lrobjectbrowser.h \ - $$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrcontentpropitem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.h \ +# $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.h \ +# $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.h \ +# $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.h \ +# $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.h \ +# $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.h \ +# $$REPORT_PATH/objectinspector/editors/lrimageeditor.h \ +# $$REPORT_PATH/objectinspector/editors/lrcoloreditor.h \ +# $$REPORT_PATH/objectinspector/editors/lrfonteditor.h \ +# $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.h \ +# $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.h \ +# $$REPORT_PATH/objectinspector/lrobjectitemmodel.h \ +# $$REPORT_PATH/objectinspector/lrobjectpropitem.h \ +# $$REPORT_PATH/objectinspector/lrpropertydelegate.h \ +# $$REPORT_PATH/objectsbrowser/lrobjectbrowser.h \ +# $$REPORT_PATH/scriptbrowser/lrscriptbrowser.h \ $$REPORT_PATH/scripteditor/lrscripteditor.h \ $$REPORT_PATH/scripteditor/lrcodeeditor.h \ $$REPORT_PATH/scripteditor/lrscripthighlighter.h \ $$REPORT_PATH/items/editors/lritemeditorwidget.h \ $$REPORT_PATH/items/editors/lrfonteditorwidget.h \ $$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.h \ - $$REPORT_PATH/items/editors/lritemsaligneditorwidget.h \ - $$REPORT_PATH/items/editors/lritemsborderseditorwidget.h \ +# $$REPORT_PATH/items/editors/lritemsaligneditorwidget.h \ +# $$REPORT_PATH/items/editors/lritemsborderseditorwidget.h \ $$REPORT_PATH/items/lrtextitem.h \ - $$REPORT_PATH/items/lrsubitemparentpropitem.h \ - $$REPORT_PATH/items/lralignpropitem.h \ +# $$REPORT_PATH/items/lrsubitemparentpropitem.h \ +# $$REPORT_PATH/items/lralignpropitem.h \ $$REPORT_PATH/items/lrhorizontallayout.h \ $$REPORT_PATH/items/lrtextitemeditor.h \ $$REPORT_PATH/items/lrshapeitem.h \ $$REPORT_PATH/items/lrimageitem.h \ $$REPORT_PATH/items/lrsimpletagparser.h \ - $$REPORT_PATH/translationeditor/translationeditor.h \ +# $$REPORT_PATH/translationeditor/translationeditor.h \ $$REPORT_PATH/lrfactoryinitializer.h \ $$REPORT_PATH/lrbanddesignintf.h \ $$REPORT_PATH/lrpageitemdesignintf.h \ @@ -190,10 +191,10 @@ HEADERS += \ $$REPORT_PATH/lrdatadesignintf.h \ $$REPORT_PATH/lrcollection.h \ $$REPORT_PATH/lrpagedesignintf.h \ - $$REPORT_PATH/lrreportdesignwidget.h \ +# $$REPORT_PATH/lrreportdesignwidget.h \ $$REPORT_PATH/lrreportengine_p.h \ $$REPORT_PATH/lrdatasourcemanager.h \ - $$REPORT_PATH/lrreportdesignwindow.h \ +# $$REPORT_PATH/lrreportdesignwindow.h \ $$REPORT_PATH/lrreportrender.h \ $$REPORT_PATH/lrpreviewreportwindow.h \ $$REPORT_PATH/lrpreviewreportwidget.h \ @@ -216,9 +217,9 @@ HEADERS += \ $$REPORT_PATH/lritemscontainerdesignitf.h \ $$REPORT_PATH/lrcolorindicator.h \ $$REPORT_PATH/items/lrchartitem.h \ - $$REPORT_PATH/items/lrchartitemeditor.h \ - $$REPORT_PATH/lrreporttranslation.h \ - $$REPORT_PATH/translationeditor/languageselectdialog.h + $$REPORT_PATH/items/lrchartitemeditor.h +# $$REPORT_PATH/lrreporttranslation.h \ +# $$REPORT_PATH/translationeditor/languageselectdialog.h contains(CONFIG, staticlib){ HEADERS += $$REPORT_PATH/lrfactoryinitializer.h @@ -229,26 +230,26 @@ contains(CONFIG,zint){ } FORMS += \ - $$REPORT_PATH/databrowser/lrsqleditdialog.ui \ - $$REPORT_PATH/databrowser/lrconnectiondialog.ui \ - $$REPORT_PATH/databrowser/lrdatabrowser.ui \ - $$REPORT_PATH/databrowser/lrvariabledialog.ui \ - $$REPORT_PATH/objectinspector/editors/ltextitempropertyeditor.ui \ +# $$REPORT_PATH/databrowser/lrsqleditdialog.ui \ +# $$REPORT_PATH/databrowser/lrconnectiondialog.ui \ +# $$REPORT_PATH/databrowser/lrdatabrowser.ui \ +# $$REPORT_PATH/databrowser/lrvariabledialog.ui \ +# $$REPORT_PATH/objectinspector/editors/ltextitempropertyeditor.ui \ $$REPORT_PATH/lrpreviewreportwindow.ui \ $$REPORT_PATH/lrpreviewreportwidget.ui \ $$REPORT_PATH/items/lrtextitemeditor.ui \ $$REPORT_PATH/lraboutdialog.ui \ $$REPORT_PATH/lrsettingdialog.ui \ - $$REPORT_PATH/scriptbrowser/lrscriptbrowser.ui \ +# $$REPORT_PATH/scriptbrowser/lrscriptbrowser.ui \ $$REPORT_PATH/items/lrchartitemeditor.ui \ - $$REPORT_PATH/translationeditor/translationeditor.ui \ - $$REPORT_PATH/translationeditor/languageselectdialog.ui \ +# $$REPORT_PATH/translationeditor/translationeditor.ui \ +# $$REPORT_PATH/translationeditor/languageselectdialog.ui \ $$REPORT_PATH/scripteditor/lrscripteditor.ui RESOURCES += \ - $$REPORT_PATH/objectinspector/lobjectinspector.qrc \ - $$REPORT_PATH/databrowser/lrdatabrowser.qrc \ +# $$REPORT_PATH/objectinspector/lobjectinspector.qrc \ +# $$REPORT_PATH/databrowser/lrdatabrowser.qrc \ $$REPORT_PATH/report.qrc \ - $$REPORT_PATH/items/items.qrc \ - $$REPORT_PATH/scriptbrowser/lrscriptbrowser.qrc \ - $$REPORT_PATH/translationeditor/translationeditor.qrc + $$REPORT_PATH/items/items.qrc +# $$REPORT_PATH/scriptbrowser/lrscriptbrowser.qrc \ +# $$REPORT_PATH/translationeditor/translationeditor.qrc diff --git a/limereport/lrdesignelementsfactory.h b/limereport/lrdesignelementsfactory.h index 3afc554..9a647a2 100644 --- a/limereport/lrdesignelementsfactory.h +++ b/limereport/lrdesignelementsfactory.h @@ -31,7 +31,7 @@ #define LRDESIGNELEMENTSFACTORY_H #include "lrbanddesignintf.h" -#include "lrpageheader.h" +//#include "lrpageheader.h" #include "lrattribsabstractfactory.h" #include "lrsimpleabstractfactory.h" #include "lrsingleton.h" diff --git a/limereport/lrdesignerplugininterface.h b/limereport/lrdesignerplugininterface.h new file mode 100644 index 0000000..b5b80a2 --- /dev/null +++ b/limereport/lrdesignerplugininterface.h @@ -0,0 +1,30 @@ +#ifndef LRDESIGNERPLUGININTERFACE_H +#define LRDESIGNERPLUGININTERFACE_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE +class QSettings; +class QMainWindow; +QT_END_NAMESPACE + +namespace LimeReport { + class ReportDesignWindow; + class ReportEnginePrivateInterface; +} + +class LimeReportPluginInterface { +public: + virtual ~LimeReportPluginInterface() { } + + virtual QString getString() const = 0; + virtual QVariant getVar() const = 0; + virtual QMainWindow* getDesignerWindow(LimeReport::ReportEnginePrivateInterface* report, QWidget *parent = 0, QSettings* settings=0) = 0; +}; + +Q_DECLARE_INTERFACE( LimeReportPluginInterface, "ru.limereport.LimeReport.DesignerPluginInterface/1.0" ) + +#endif // LRDESIGNERPLUGININTERFACE_H diff --git a/limereport/lrpreviewreportwindow.cpp b/limereport/lrpreviewreportwindow.cpp index 49a3e89..32b0b5d 100644 --- a/limereport/lrpreviewreportwindow.cpp +++ b/limereport/lrpreviewreportwindow.cpp @@ -66,10 +66,10 @@ PreviewReportWindow::PreviewReportWindow(ReportEngine *report, QWidget *parent, connect(m_previewReportWidget->d_ptr->m_previewPage,SIGNAL(selectionChanged()),this,SLOT(slotSelectionChanged())); connect(m_pagesNavigator,SIGNAL(valueChanged(int)),this,SLOT(slotPageNavigatorChanged(int))); - m_fontEditor = new FontEditorWidget(m_previewReportWidget->d_ptr->m_previewPage,tr("Font"),this); + m_fontEditor = new FontEditorWidgetForPage(m_previewReportWidget->d_ptr->m_previewPage,tr("Font"),this); m_fontEditor->setObjectName("fontTools"); m_fontEditor->setIconSize(ui->toolBar->iconSize()); - m_textAlignmentEditor = new TextAlignmentEditorWidget(m_previewReportWidget->d_ptr->m_previewPage,tr("Text align"),this); + m_textAlignmentEditor = new TextAlignmentEditorWidgetForPage(m_previewReportWidget->d_ptr->m_previewPage,tr("Text align"),this); m_textAlignmentEditor->setObjectName("textAlignmentTools"); m_textAlignmentEditor->setIconSize(ui->toolBar->iconSize()); addToolBar(Qt::TopToolBarArea,m_fontEditor); diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index ff342b3..8b68570 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -51,7 +51,7 @@ namespace LimeReport { // ReportDesignIntf -ReportDesignWidget::ReportDesignWidget(ReportEngine *report, QMainWindow *mainWindow, QWidget *parent) : +ReportDesignWidget::ReportDesignWidget(ReportEnginePrivateInterface* report, QMainWindow *mainWindow, QWidget *parent) : QWidget(parent), #ifdef HAVE_QTDESIGNER_INTEGRATION m_dialogDesignerManager(new DialogDesignerManager(this)), @@ -72,20 +72,20 @@ ReportDesignWidget::ReportDesignWidget(ReportEngine *report, QMainWindow *mainWi mainLayout->addWidget(m_tabWidget); setLayout(mainLayout); - if (!report) { - m_report=new ReportEnginePrivate(this); - m_report->setObjectName("report"); - m_report->appendPage("page1"); - } - else { - m_report=report->d_ptr; +// if (!report) { +// m_report=new ReportEnginePrivate(this); +// m_report->setObjectName("report"); +// m_report->appendPage("page1"); +// } +// else { + m_report=report;//report->d_ptr; if (!m_report->pageCount()) m_report->appendPage("page1"); - } +// } createTabs(); - connect(m_report,SIGNAL(pagesLoadFinished()),this,SLOT(slotPagesLoadFinished())); - connect(m_report,SIGNAL(cleared()),this,SIGNAL(cleared())); + connect(dynamic_cast(m_report), SIGNAL(pagesLoadFinished()),this,SLOT(slotPagesLoadFinished())); + connect(dynamic_cast(m_report), SIGNAL(cleared()),this,SIGNAL(cleared())); connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentTabChanged(int))); #ifdef HAVE_UI_LOADER connect(m_report->scriptContext(), SIGNAL(dialogDeleted(QString)), this, SLOT(slotDialogDeleted(QString))); @@ -241,9 +241,11 @@ void ReportDesignWidget::createTabs(){ view->setFrameShape(QFrame::NoFrame); view->setScene(m_report->pageAt(i)); - foreach(QGraphicsItem* item, m_report->pageAt(i)->selectedItems()){ - item->setSelected(false); - } +// foreach(QGraphicsItem* item, m_report->pageAt(i)->selectedItems()){ +// item->setSelected(false); +// } + + m_report->pageAt(i)->clearSelection(); view->centerOn(0,0); view->scale(0.5,0.5); @@ -796,7 +798,8 @@ void ReportDesignWidget::slotCurrentTabChanged(int index) QGraphicsView* view = dynamic_cast(m_tabWidget->widget(index)); if (view) { if (view->scene()){ - foreach (QGraphicsItem* item, view->scene()->selectedItems()) item->setSelected(false); + //foreach (QGraphicsItem* item, view->scene()->selectedItems()) item->setSelected(false); + view->scene()->clearSelection(); } m_zoomer->setView(view); } @@ -807,7 +810,7 @@ void ReportDesignWidget::slotCurrentTabChanged(int index) updateDialogs(); #endif if (activeTabType() == Translations){ - m_traslationEditor->setReportEngine(report()); + m_traslationEditor->setReportEngine(dynamic_cast(report())); } if (activeTabType() == Script){ @@ -816,6 +819,8 @@ void ReportDesignWidget::slotCurrentTabChanged(int index) } emit activePageChanged(); + + if (view) view->centerOn(0,0); } #ifdef HAVE_QTDESIGNER_INTEGRATION diff --git a/limereport/lrreportdesignwidget.h b/limereport/lrreportdesignwidget.h index 81c13fd..e38338b 100644 --- a/limereport/lrreportdesignwidget.h +++ b/limereport/lrreportdesignwidget.h @@ -84,7 +84,7 @@ public: Translations, TabTypeCount }; - ReportDesignWidget(ReportEngine* report, QMainWindow *mainWindow, QWidget *parent = 0); + ReportDesignWidget(ReportEnginePrivateInterface* report, QMainWindow *mainWindow, QWidget *parent = 0); ~ReportDesignWidget(); void createStartPage(); void clear(); @@ -105,7 +105,7 @@ public: QList selectedItems(); QStringList datasourcesNames(); void scale( qreal sx, qreal sy); - ReportEnginePrivate* report(){return m_report;} + ReportEnginePrivateInterface* report(){return m_report;} QString reportFileName(); bool isNeedToSave(); bool emitLoadReport(); @@ -200,7 +200,7 @@ protected: private: bool eventFilter(QObject *target, QEvent *event); private: - ReportEnginePrivate* m_report; + ReportEnginePrivateInterface* m_report; QGraphicsView *m_view; ScriptEditor* m_scriptEditor; TranslationEditor* m_traslationEditor; diff --git a/limereport/lrreportdesignwindow.cpp b/limereport/lrreportdesignwindow.cpp index fc611e3..b0ca4be 100644 --- a/limereport/lrreportdesignwindow.cpp +++ b/limereport/lrreportdesignwindow.cpp @@ -62,7 +62,7 @@ namespace LimeReport{ ReportDesignWindow* ReportDesignWindow::m_instance=0; -ReportDesignWindow::ReportDesignWindow(ReportEngine *report, QWidget *parent, QSettings* settings) : +ReportDesignWindow::ReportDesignWindow(ReportEnginePrivateInterface* report, QWidget *parent, QSettings* settings) : QMainWindow(parent), m_textAttibutesIsChanging(false), m_settings(settings), m_ownedSettings(false), m_progressDialog(0), m_showProgressDialog(true), m_editorTabType(ReportDesignWidget::Page), m_reportItemIsLocked(false) { @@ -309,11 +309,11 @@ void ReportDesignWindow::createToolBars() //m_mainToolBar->addAction(m_printReportAction); - m_fontEditorBar = new FontEditorWidget(m_reportDesignWidget,tr("Font"),this); + m_fontEditorBar = new FontEditorWidgetForDesigner(m_reportDesignWidget,tr("Font"),this); m_fontEditorBar->setIconSize(m_mainToolBar->iconSize()); m_fontEditorBar->setObjectName("fontTools"); addToolBar(m_fontEditorBar); - m_textAlignmentEditorBar = new TextAlignmentEditorWidget(m_reportDesignWidget,tr("Text alignment"),this); + m_textAlignmentEditorBar = new TextAlignmentEditorWidgetForDesigner(m_reportDesignWidget,tr("Text alignment"),this); m_textAlignmentEditorBar->setIconSize(m_mainToolBar->iconSize()); m_textAlignmentEditorBar->setObjectName("textAlignmentTools"); addToolBar(m_textAlignmentEditorBar); @@ -324,7 +324,7 @@ void ReportDesignWindow::createToolBars() m_itemsAlignmentEditorBar->insertAction(m_itemsAlignmentEditorBar->actions().at(1),m_useMagnetAction); m_itemsAlignmentEditorBar->insertSeparator(m_itemsAlignmentEditorBar->actions().at(2)); addToolBar(m_itemsAlignmentEditorBar); - m_itemsBordersEditorBar = new ItemsBordersEditorWidget(m_reportDesignWidget,tr("Borders"),this); + m_itemsBordersEditorBar = new ItemsBordersEditorWidgetForDesigner(m_reportDesignWidget,tr("Borders"),this); m_itemsBordersEditorBar->setIconSize(m_mainToolBar->iconSize()); m_itemsBordersEditorBar->setObjectName("itemsBorderTools"); addToolBar(m_itemsBordersEditorBar); @@ -459,7 +459,7 @@ void ReportDesignWindow::createMainMenu() m_recentFilesMenu->setDisabled(m_recentFiles.isEmpty()); } -void ReportDesignWindow::initReportEditor(ReportEngine* report) +void ReportDesignWindow::initReportEditor(ReportEnginePrivateInterface* report) { m_reportDesignWidget=new ReportDesignWidget(report,this,this); setCentralWidget(m_reportDesignWidget); @@ -472,16 +472,16 @@ void ReportDesignWindow::initReportEditor(ReportEngine* report) connect(m_reportDesignWidget,SIGNAL(itemInserted(LimeReport::PageDesignIntf*,QPointF,QString)), this,SLOT(slotItemInserted(LimeReport::PageDesignIntf*,QPointF,QString))); connect(m_reportDesignWidget,SIGNAL(itemInsertCanceled(QString)),this,SLOT(slotItemInsertCanceled(QString))); - connect(m_reportDesignWidget->report(),SIGNAL(datasourceCollectionLoadFinished(QString)),this,SLOT(slotUpdateDataBrowser(QString))); + connect(dynamic_cast(report), SIGNAL(datasourceCollectionLoadFinished(QString)),this,SLOT(slotUpdateDataBrowser(QString))); connect(m_reportDesignWidget,SIGNAL(commandHistoryChanged()),this,SLOT(slotCommandHistoryChanged())); connect(m_reportDesignWidget,SIGNAL(activePageChanged()),this,SLOT(slotActivePageChanged())); connect(m_reportDesignWidget, SIGNAL(bandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)), this, SLOT(slotBandAdded(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*))); connect(m_reportDesignWidget, SIGNAL(bandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*)), this, SLOT(slotBandDeleted(LimeReport::PageDesignIntf*,LimeReport::BandDesignIntf*))); - connect(m_reportDesignWidget->report(), SIGNAL(renderStarted()), this, SLOT(renderStarted())); - connect(m_reportDesignWidget->report(), SIGNAL(renderPageFinished(int)), this, SLOT(renderPageFinished(int))); - connect(m_reportDesignWidget->report(), SIGNAL(renderFinished()), this, SLOT(renderFinished())); + connect(dynamic_cast(report), SIGNAL(renderStarted()), this, SLOT(renderStarted())); + connect(dynamic_cast(report), SIGNAL(renderPageFinished(int)), this, SLOT(renderPageFinished(int))); + connect(dynamic_cast(report), SIGNAL(renderFinished()), this, SLOT(renderFinished())); connect(m_reportDesignWidget, SIGNAL(pageAdded(PageDesignIntf*)), this, SLOT(slotPageAdded(PageDesignIntf*))); connect(m_reportDesignWidget, SIGNAL(pageDeleted()), this, SLOT(slotPageDeleted())); } @@ -1311,7 +1311,7 @@ void ReportDesignWindow::renderStarted() { if (m_showProgressDialog){ m_progressDialog = new QProgressDialog(tr("Rendering report"),tr("Abort"),0,0,this); - m_progressDialog->open(m_reportDesignWidget->report(),SLOT(cancelRender())); + m_progressDialog->open(dynamic_cast(m_reportDesignWidget->report()), SLOT(cancelRender())); QApplication::processEvents(); } } diff --git a/limereport/lrreportdesignwindow.h b/limereport/lrreportdesignwindow.h index a01db94..ef435f6 100644 --- a/limereport/lrreportdesignwindow.h +++ b/limereport/lrreportdesignwindow.h @@ -59,7 +59,7 @@ class ReportDesignWindow : public QMainWindow { Q_OBJECT public: - explicit ReportDesignWindow(ReportEngine *report, QWidget *parent = 0, QSettings* settings=0); + explicit ReportDesignWindow(ReportEnginePrivateInterface *report, QWidget *parent = 0, QSettings* settings=0); ~ReportDesignWindow(); static ReportDesignWindow* instance(){return m_instance;} @@ -140,7 +140,7 @@ private: void createItemsActions(); void createObjectInspector(); void createObjectsBrowser(); - void initReportEditor(ReportEngine *report); + void initReportEditor(ReportEnginePrivateInterface* report); void createDataWindow(); void createScriptWindow(); #ifdef HAVE_QTDESIGNER_INTEGRATION diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 5768951..500223a 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include "time.h" @@ -42,8 +43,9 @@ #include "lrpagedesignintf.h" #include "lrdatasourcemanager.h" -#include "lrdatabrowser.h" -#include "lrreportdesignwindow.h" +//#include "lrdatabrowser.h" +//#include "lrreportdesignwindow.h" + #include "serializators/lrxmlwriter.h" #include "serializators/lrxmlreader.h" @@ -51,6 +53,8 @@ #include "lrpreviewreportwindow.h" #include "lrpreviewreportwidget.h" #include "lrpreviewreportwidget_p.h" + + #ifdef HAVE_STATIC_BUILD #include "lrfactoryinitializer.h" #endif @@ -64,7 +68,7 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_showProgressDialog(true), m_reportName(""), m_activePreview(0), m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")), m_reportRendering(false), m_resultIsEditable(true), m_passPhrase("HjccbzHjlbyfCkjy"), - m_fileWatcher( new QFileSystemWatcher( this ) ), m_reportLanguage(QLocale::AnyLanguage) + m_fileWatcher( new QFileSystemWatcher( this ) ), m_reportLanguage(QLocale::AnyLanguage), m_designerFactory(0) { #ifdef HAVE_STATIC_BUILD initResources(); @@ -83,6 +87,29 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) : m_datasources->setObjectName("datasources"); connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString))); connect(m_fileWatcher,SIGNAL(fileChanged(const QString &)),this,SLOT(slotLoadFromFile(const QString &))); + + QDir pluginsDir( "../lib" ); + foreach( const QString& pluginName, pluginsDir.entryList( QDir::Files ) ) { + qDebug() << "==============================================================================="; + qDebug() << "Found:" << pluginName; + + QPluginLoader loader( pluginsDir.absoluteFilePath( pluginName ) ); + if( loader.load() ) { + if( LimeReportPluginInterface* myPlugin = qobject_cast< LimeReportPluginInterface* >( loader.instance() ) ) { + qDebug() << "Testing: \n" << + "(1)" << myPlugin->getString() << "\n" << + "(2)" << myPlugin->getVar(); + m_designerFactory = myPlugin; + } + //loader.unload(); + } else { + qDebug() << "Failed to load :("; + qDebug() << loader.errorString(); + } + + qDebug() << ""; + } + } ReportEnginePrivate::~ReportEnginePrivate() @@ -619,21 +646,32 @@ PageDesignIntf* ReportEngine::createPreviewScene(QObject* parent){ void ReportEnginePrivate::designReport() { if (!m_designerWindow) { - Q_Q(ReportEngine); - m_designerWindow = new LimeReport::ReportDesignWindow(q,QApplication::activeWindow(),settings()); - m_designerWindow->setAttribute(Qt::WA_DeleteOnClose,true); - m_designerWindow->setWindowIcon(QIcon(":report/images/logo32")); - m_designerWindow->setShowProgressDialog(m_showProgressDialog); +// Q_Q(ReportEngine); + if (m_designerFactory){ + settings()->beginGroup("DesignerWindow"); + settings()->setValue("showProgressDialog",m_showProgressDialog); + settings()->endGroup(); + m_designerWindow = m_designerFactory->getDesignerWindow(this,QApplication::activeWindow(),settings()); + //m_designerWindow->setAttribute(Qt::WA_DeleteOnClose,true); + //m_designerWindow->setWindowIcon(QIcon(":report/images/logo32")); + //m_designerWindow->setShowProgressDialog(m_showProgressDialog); + } else { + //m_designerWindow = new LimeReport::ReportDesignWindow(this,QApplication::activeWindow(),settings()); + //m_designerWindow->setAttribute(Qt::WA_DeleteOnClose,true); + //m_designerWindow->setWindowIcon(QIcon(":report/images/logo32")); + //m_designerWindow->setShowProgressDialog(m_showProgressDialog); + } } m_datasources->updateDatasourceModel(); #ifdef Q_OS_WIN m_designerWindow->setWindowModality(Qt::ApplicationModal); #endif - if (QApplication::activeWindow()==0){ - m_designerWindow->show();; - } else { - m_designerWindow->showModal(); - } +// if (QApplication::activeWindow()==0){ +// m_designerWindow->show();; +// } else { +// m_designerWindow->showModal(); +// } + m_designerWindow->show(); } void ReportEnginePrivate::setSettings(QSettings* value) diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 49505ca..0dba7ad 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -42,6 +42,7 @@ #include "serializators/lrstorageintf.h" #include "lrscriptenginemanager.h" #include "lrreporttranslation.h" +#include "lrdesignerplugininterface.h" class QFileSystemWatcher; @@ -53,7 +54,40 @@ class ReportDesignWindow; //TODO: Add on render callback -class ReportEnginePrivate : public QObject, public ICollectionContainer, public ITranslationContainer +class ReportEnginePrivateInterface { +public: + virtual PageDesignIntf* appendPage(const QString& pageName="") = 0; + virtual bool deletePage(PageDesignIntf *page) = 0; + virtual void reorderPages(const QList &reorderedPages) = 0; + virtual int pageCount() = 0; + virtual PageDesignIntf* pageAt(int index) = 0; + virtual void clearReport() = 0; + virtual ScriptEngineContext* scriptContext() = 0; + virtual ScriptEngineManager* scriptManager() = 0; + virtual DataSourceManager* dataManager() = 0; + virtual QString reportFileName() = 0; + virtual void setReportFileName(const QString& reportFileName) = 0; + virtual void emitSaveFinished() = 0; + virtual bool isNeedToSave() = 0; + virtual void emitSaveReport() = 0; + virtual bool saveToFile() = 0; + virtual bool saveToFile(const QString& fileName) = 0; + virtual bool isSaved() = 0; + virtual QString reportName() = 0; + virtual bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange) = 0; + virtual bool emitLoadReport() = 0; + virtual void clearSelection() = 0; + virtual bool printReport(QPrinter *printer=0) = 0; + virtual void previewReport(PreviewHints hints = PreviewBarsUserSetting) = 0; + virtual void setCurrentReportsDir(const QString& dirName) = 0; + virtual QString currentReportsDir() = 0; + virtual bool suppressFieldAndVarError() const = 0; + virtual void setSuppressFieldAndVarError(bool suppressFieldAndVarError) = 0; + +}; + +class ReportEnginePrivate : public QObject, public ICollectionContainer, public ITranslationContainer, + public ReportEnginePrivateInterface { Q_OBJECT Q_DECLARE_PUBLIC(ReportEngine) @@ -195,7 +229,7 @@ private: QMainWindow* m_activePreview; QIcon m_previewWindowIcon; QString m_previewWindowTitle; - QPointer m_designerWindow; + QPointer m_designerWindow; ReportSettings m_reportSettings; bool m_reportRendering; bool m_resultIsEditable; @@ -205,6 +239,7 @@ private: QLocale::Language m_reportLanguage; void activateLanguage(QLocale::Language language); Qt::LayoutDirection m_previewLayoutDirection; + LimeReportPluginInterface* m_designerFactory; }; } diff --git a/limereport/scripteditor/lrscripteditor.cpp b/limereport/scripteditor/lrscripteditor.cpp index 4db2fac..667a238 100644 --- a/limereport/scripteditor/lrscripteditor.cpp +++ b/limereport/scripteditor/lrscripteditor.cpp @@ -48,7 +48,7 @@ void ScriptEditor::initEditor(DataSourceManager* dm) } } -void ScriptEditor::setReportEngine(ReportEnginePrivate* reportEngine) +void ScriptEditor::setReportEngine(ReportEnginePrivateInterface* reportEngine) { m_reportEngine = reportEngine; DataSourceManager* dm = m_reportEngine->dataManager(); diff --git a/limereport/scripteditor/lrscripteditor.h b/limereport/scripteditor/lrscripteditor.h index b67be79..f9b8db7 100644 --- a/limereport/scripteditor/lrscripteditor.h +++ b/limereport/scripteditor/lrscripteditor.h @@ -9,7 +9,7 @@ namespace LimeReport{ -class ReportEnginePrivate; +class ReportEnginePrivateInterface; class BaseDesignIntf; class PageDesignIntf; class BandDesignIntf; @@ -25,7 +25,7 @@ class ScriptEditor : public QWidget public: explicit ScriptEditor(QWidget *parent = 0); ~ScriptEditor(); - void setReportEngine(ReportEnginePrivate* reportEngine); + void setReportEngine(LimeReport::ReportEnginePrivateInterface* reportEngine); void setReportPage(PageDesignIntf* page); void setPageBand(BandDesignIntf* band); void initCompleter(); @@ -48,7 +48,7 @@ private: void addItemToCompleater(const QString& pageName, BaseDesignIntf* item, QStringList& dataWords); private: Ui::ScriptEditor *ui; - ReportEnginePrivate* m_reportEngine; + ReportEnginePrivateInterface* m_reportEngine; PageDesignIntf* m_page; QCompleter* m_completer;