mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54:39 +03:00
init commit
This commit is contained in:
parent
836a03d68b
commit
2c50a9a791
@ -736,13 +736,17 @@ void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
|
|||||||
ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols;
|
ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols;
|
||||||
switch(pass){
|
switch(pass){
|
||||||
case FirstPass:
|
case FirstPass:
|
||||||
context=expandUserVariables(context, pass, expandType, dataManager);
|
if (!fillInSecondPass()){
|
||||||
context=expandScripts(context, dataManager);
|
context=expandUserVariables(context, pass, expandType, dataManager);
|
||||||
context=expandDataFields(context, expandType, dataManager);
|
context=expandScripts(context, dataManager);
|
||||||
|
context=expandDataFields(context, expandType, dataManager);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SecondPass:;
|
case SecondPass:;
|
||||||
context=expandUserVariables(context, pass, expandType, dataManager);
|
context=expandUserVariables(context, pass, expandType, dataManager);
|
||||||
context=expandScripts(context, dataManager);
|
context=expandScripts(context, dataManager);
|
||||||
|
if (fillInSecondPass())
|
||||||
|
context=expandDataFields(context, expandType, dataManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expandType == NoEscapeSymbols && !m_varValue.isNull() &&m_valueType!=Default) {
|
if (expandType == NoEscapeSymbols && !m_varValue.isNull() &&m_valueType!=Default) {
|
||||||
|
@ -178,6 +178,13 @@ QString BandDesignIntf::translateBandName(const BaseDesignIntf* item) const{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BandDesignIntf::copyBookmarks(BandDesignIntf* sourceBand)
|
||||||
|
{
|
||||||
|
foreach(QString key, sourceBand->bookmarks()){
|
||||||
|
addBookmark(key,sourceBand->getBookMark(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -801,6 +808,12 @@ qreal BandDesignIntf::bottomSpace() const
|
|||||||
return m_bottomSpace.isValid() ? m_bottomSpace.value() : height()-findMaxBottom();
|
return m_bottomSpace.isValid() ? m_bottomSpace.value() : height()-findMaxBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariant BandDesignIntf::getBookMark(const QString& key){
|
||||||
|
if (m_bookmarks.contains(key))
|
||||||
|
return m_bookmarks.value(key);
|
||||||
|
else return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QString& newName)
|
void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QString& newName)
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
|
@ -238,6 +238,12 @@ public:
|
|||||||
void setUseAlternateBackgroundColor(bool useAlternateBackgroundColor);
|
void setUseAlternateBackgroundColor(bool useAlternateBackgroundColor);
|
||||||
void replaceGroupsFunction(BandDesignIntf *band);
|
void replaceGroupsFunction(BandDesignIntf *band);
|
||||||
qreal bottomSpace() const;
|
qreal bottomSpace() const;
|
||||||
|
|
||||||
|
void addBookmark(const QString& key, const QVariant& value){ m_bookmarks.insert(key, value);}
|
||||||
|
QList<QString> bookmarks(){ return m_bookmarks.keys();}
|
||||||
|
QVariant getBookMark(const QString& key);
|
||||||
|
void copyBookmarks(BandDesignIntf* sourceBand);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void bandRendered(BandDesignIntf* band);
|
void bandRendered(BandDesignIntf* band);
|
||||||
void bandRegistred();
|
void bandRegistred();
|
||||||
@ -262,6 +268,7 @@ protected:
|
|||||||
void preparePopUpMenu(QMenu &menu);
|
void preparePopUpMenu(QMenu &menu);
|
||||||
void processPopUpAction(QAction *action);
|
void processPopUpAction(QAction *action);
|
||||||
QString translateBandName(const BaseDesignIntf *item) const;
|
QString translateBandName(const BaseDesignIntf *item) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void childBandDeleted(QObject* band);
|
void childBandDeleted(QObject* band);
|
||||||
void slotPropertyObjectNameChanged(const QString&,const QString&);
|
void slotPropertyObjectNameChanged(const QString&,const QString&);
|
||||||
@ -296,6 +303,7 @@ private:
|
|||||||
QColor m_alternateBackgroundColor;
|
QColor m_alternateBackgroundColor;
|
||||||
bool m_useAlternateBackgroundColor;
|
bool m_useAlternateBackgroundColor;
|
||||||
InitializedValue m_bottomSpace;
|
InitializedValue m_bottomSpace;
|
||||||
|
QMap<QString,QVariant> m_bookmarks;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DataBandDesignIntf : public BandDesignIntf{
|
class DataBandDesignIntf : public BandDesignIntf{
|
||||||
|
@ -79,7 +79,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
|
|||||||
m_borderColor(Qt::black),
|
m_borderColor(Qt::black),
|
||||||
m_reportSettings(0),
|
m_reportSettings(0),
|
||||||
m_patternName(""),
|
m_patternName(""),
|
||||||
m_patternItem(0)
|
m_patternItem(0),
|
||||||
|
m_fillInSecondPass(false)
|
||||||
{
|
{
|
||||||
setGeometry(QRectF(0, 0, m_width, m_height));
|
setGeometry(QRectF(0, 0, m_width, m_height));
|
||||||
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
|
||||||
@ -702,6 +703,21 @@ void BaseDesignIntf::turnOnSelectionMarker(bool value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BaseDesignIntf::fillInSecondPass() const
|
||||||
|
{
|
||||||
|
return m_fillInSecondPass;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseDesignIntf::setFillInSecondPass(bool fillInSecondPass)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (m_fillInSecondPass != fillInSecondPass){
|
||||||
|
m_fillInSecondPass = fillInSecondPass;
|
||||||
|
notify("fillInSecondPass",!fillInSecondPass,fillInSecondPass);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
QString BaseDesignIntf::patternName() const
|
QString BaseDesignIntf::patternName() const
|
||||||
{
|
{
|
||||||
return (m_patternName.isEmpty()) ? objectName() : m_patternName;
|
return (m_patternName.isEmpty()) ? objectName() : m_patternName;
|
||||||
|
@ -96,6 +96,7 @@ class BaseDesignIntf :
|
|||||||
Q_PROPERTY(int borderLineSize READ borderLineSize WRITE setBorderLineSize)
|
Q_PROPERTY(int borderLineSize READ borderLineSize WRITE setBorderLineSize)
|
||||||
Q_PROPERTY(bool isVisible READ isVisible WRITE setItemVisible DESIGNABLE false)
|
Q_PROPERTY(bool isVisible READ isVisible WRITE setItemVisible DESIGNABLE false)
|
||||||
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
|
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
|
||||||
|
Q_PROPERTY(bool fillInSecondPass READ fillInSecondPass WRITE setFillInSecondPass)
|
||||||
friend class ReportRender;
|
friend class ReportRender;
|
||||||
public:
|
public:
|
||||||
enum BGMode { TransparentMode, OpaqueMode};
|
enum BGMode { TransparentMode, OpaqueMode};
|
||||||
@ -276,6 +277,8 @@ public:
|
|||||||
BaseDesignIntf* patternItem() const;
|
BaseDesignIntf* patternItem() const;
|
||||||
void setPatternItem(BaseDesignIntf* patternItem);
|
void setPatternItem(BaseDesignIntf* patternItem);
|
||||||
virtual QMap<QString, QString> getStringForTranslation();
|
virtual QMap<QString, QString> getStringForTranslation();
|
||||||
|
bool fillInSecondPass() const;
|
||||||
|
void setFillInSecondPass(bool fillInSecondPass);
|
||||||
|
|
||||||
Q_INVOKABLE QString setItemWidth(qreal width);
|
Q_INVOKABLE QString setItemWidth(qreal width);
|
||||||
Q_INVOKABLE QString setItemHeight(qreal height);
|
Q_INVOKABLE QString setItemHeight(qreal height);
|
||||||
@ -286,7 +289,6 @@ public:
|
|||||||
Q_INVOKABLE QString setItemPosX(qreal xValue);
|
Q_INVOKABLE QString setItemPosX(qreal xValue);
|
||||||
Q_INVOKABLE QString setItemPosY(qreal yValue);
|
Q_INVOKABLE QString setItemPosY(qreal yValue);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//ICollectionContainer
|
//ICollectionContainer
|
||||||
@ -405,6 +407,7 @@ private:
|
|||||||
ReportSettings* m_reportSettings;
|
ReportSettings* m_reportSettings;
|
||||||
QString m_patternName;
|
QString m_patternName;
|
||||||
BaseDesignIntf* m_patternItem;
|
BaseDesignIntf* m_patternItem;
|
||||||
|
bool m_fillInSecondPass;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
||||||
|
@ -75,6 +75,11 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
|
|||||||
m_datasources = new DataSourceManager(this);
|
m_datasources = new DataSourceManager(this);
|
||||||
m_datasources->setReportSettings(&m_reportSettings);
|
m_datasources->setReportSettings(&m_reportSettings);
|
||||||
m_scriptEngineContext = new ScriptEngineContext(this);
|
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");
|
m_datasources->setObjectName("datasources");
|
||||||
connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString)));
|
connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString)));
|
||||||
connect(m_fileWatcher,SIGNAL(fileChanged(const QString &)),this,SLOT(slotLoadFromFile(const QString &)));
|
connect(m_fileWatcher,SIGNAL(fileChanged(const QString &)),this,SLOT(slotLoadFromFile(const QString &)));
|
||||||
@ -917,6 +922,8 @@ ReportPages ReportEnginePrivate::renderToPages()
|
|||||||
|
|
||||||
bool isFirst = true;
|
bool isFirst = true;
|
||||||
|
|
||||||
|
// m_reportRender->secondRenderPass(result);
|
||||||
|
|
||||||
foreach(PageDesignIntf* page , m_pages){
|
foreach(PageDesignIntf* page , m_pages){
|
||||||
if (page->pageItem()->getIsTOC()){
|
if (page->pageItem()->getIsTOC()){
|
||||||
page->setReportSettings(&m_reportSettings);
|
page->setReportSettings(&m_reportSettings);
|
||||||
@ -933,6 +940,7 @@ ReportPages ReportEnginePrivate::renderToPages()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_reportRender->secondRenderPass(result);
|
m_reportRender->secondRenderPass(result);
|
||||||
|
|
||||||
emit renderFinished();
|
emit renderFinished();
|
||||||
m_reportRender.clear();
|
m_reportRender.clear();
|
||||||
}
|
}
|
||||||
@ -1174,6 +1182,7 @@ ReportEngine::ReportEngine(ReportEnginePrivate &dd, QObject *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ScriptEngineManager*LimeReport::ReportEnginePrivate::scriptManager(){
|
ScriptEngineManager*LimeReport::ReportEnginePrivate::scriptManager(){
|
||||||
|
ScriptEngineManager::instance().setContext(scriptContext());
|
||||||
ScriptEngineManager::instance().setDataManager(dataManager());
|
ScriptEngineManager::instance().setDataManager(dataManager());
|
||||||
return &ScriptEngineManager::instance();
|
return &ScriptEngineManager::instance();
|
||||||
}
|
}
|
||||||
|
@ -420,6 +420,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
|
|||||||
}
|
}
|
||||||
|
|
||||||
patternBand->emitBandRendered(bandClone);
|
patternBand->emitBandRendered(bandClone);
|
||||||
|
m_scriptEngineContext->setCurrentBand(bandClone);
|
||||||
emit(patternBand->afterRender());
|
emit(patternBand->afterRender());
|
||||||
|
|
||||||
if ( isLast && bandClone->keepFooterTogether() && bandClone->sliceLastRow() ){
|
if ( isLast && bandClone->keepFooterTogether() && bandClone->sliceLastRow() ){
|
||||||
@ -1025,12 +1026,23 @@ BandDesignIntf* ReportRender::sliceBand(BandDesignIntf *band, BandDesignIntf* pa
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReportRender::updateTOC(BaseDesignIntf* item, int pageNumber){
|
||||||
|
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(item);
|
||||||
|
if (band){
|
||||||
|
TableOfContens* toc = m_scriptEngineContext->tableOfContens();
|
||||||
|
foreach (QString key, band->bookmarks()){
|
||||||
|
toc->setItem(key, band->getBookMark(key).toString(), pageNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ReportRender::secondRenderPass(ReportPages renderedPages)
|
void ReportRender::secondRenderPass(ReportPages renderedPages)
|
||||||
{
|
{
|
||||||
for(int i=0; i<renderedPages.count(); ++i){
|
for(int i=0; i<renderedPages.count(); ++i){
|
||||||
PageItemDesignIntf::Ptr page = renderedPages.at(i);
|
PageItemDesignIntf::Ptr page = renderedPages.at(i);
|
||||||
m_datasources->setReportVariable("#PAGE_COUNT",findLastPageNumber(i));
|
m_datasources->setReportVariable("#PAGE_COUNT",findLastPageNumber(i));
|
||||||
foreach(BaseDesignIntf* item, page->childBaseItems()){
|
foreach(BaseDesignIntf* item, page->childBaseItems()){
|
||||||
|
if (!m_scriptEngineContext->tableOfContens()->isEmpty()) updateTOC(item, i+1);
|
||||||
item->updateItemSize(m_datasources, SecondPass);
|
item->updateItemSize(m_datasources, SecondPass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1044,10 +1056,13 @@ BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, i
|
|||||||
if (!bottomBandPart->isEmpty()){
|
if (!bottomBandPart->isEmpty()){
|
||||||
if (patternBand->keepFooterTogether())
|
if (patternBand->keepFooterTogether())
|
||||||
closeFooterGroup(patternBand);
|
closeFooterGroup(patternBand);
|
||||||
|
if (upperBandPart->isEmpty())
|
||||||
|
bottomBandPart->copyBookmarks(band);
|
||||||
}
|
}
|
||||||
if (!upperBandPart->isEmpty()){
|
if (!upperBandPart->isEmpty()){
|
||||||
upperBandPart->updateItemSize(m_datasources, FirstPass, height);
|
upperBandPart->updateItemSize(m_datasources, FirstPass, height);
|
||||||
registerBand(upperBandPart);
|
registerBand(upperBandPart);
|
||||||
|
upperBandPart->copyBookmarks(band);
|
||||||
} else delete upperBandPart;
|
} else delete upperBandPart;
|
||||||
|
|
||||||
if (band->columnsCount()>1 &&
|
if (band->columnsCount()>1 &&
|
||||||
@ -1068,6 +1083,7 @@ BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand)
|
|||||||
BandDesignIntf* bandClone = dynamic_cast<BandDesignIntf*>(patternBand->cloneItem(PreviewMode));
|
BandDesignIntf* bandClone = dynamic_cast<BandDesignIntf*>(patternBand->cloneItem(PreviewMode));
|
||||||
|
|
||||||
m_scriptEngineContext->baseDesignIntfToScript(patternBand->page()->pageItem()->objectName(), bandClone);
|
m_scriptEngineContext->baseDesignIntfToScript(patternBand->page()->pageItem()->objectName(), bandClone);
|
||||||
|
m_scriptEngineContext->setCurrentBand(bandClone);
|
||||||
emit(patternBand->beforeRender());
|
emit(patternBand->beforeRender());
|
||||||
|
|
||||||
if (patternBand->isFooter()){
|
if (patternBand->isFooter()){
|
||||||
@ -1308,6 +1324,7 @@ void ReportRender::savePage(bool isLast)
|
|||||||
}
|
}
|
||||||
|
|
||||||
moveTearOffBand();
|
moveTearOffBand();
|
||||||
|
m_scriptEngineContext->setCurrentPage(m_renderPageItem);
|
||||||
emit m_patternPageItem->afterRender();
|
emit m_patternPageItem->afterRender();
|
||||||
if (isLast) emit m_patternPageItem->afterLastPageRendered();
|
if (isLast) emit m_patternPageItem->afterLastPageRendered();
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ private:
|
|||||||
qreal maxColumnHeight();
|
qreal maxColumnHeight();
|
||||||
void renameChildItems(BaseDesignIntf *item);
|
void renameChildItems(BaseDesignIntf *item);
|
||||||
void renderGroupFooterByHeader(BandDesignIntf *groupHeader);
|
void renderGroupFooterByHeader(BandDesignIntf *groupHeader);
|
||||||
|
void updateTOC(BaseDesignIntf* item, int pageNumber);
|
||||||
private:
|
private:
|
||||||
DataSourceManager* m_datasources;
|
DataSourceManager* m_datasources;
|
||||||
ScriptEngineContext* m_scriptEngineContext;
|
ScriptEngineContext* m_scriptEngineContext;
|
||||||
@ -189,6 +190,7 @@ private:
|
|||||||
unsigned long long m_curentNameIndex;
|
unsigned long long m_curentNameIndex;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace LimeReport
|
} // namespace LimeReport
|
||||||
#endif // LRREPORTRENDER_H
|
#endif // LRREPORTRENDER_H
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "lrdatasourcemanager.h"
|
#include "lrdatasourcemanager.h"
|
||||||
#include "lrbasedesignintf.h"
|
#include "lrbasedesignintf.h"
|
||||||
|
#include "lrbanddesignintf.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QColor)
|
Q_DECLARE_METATYPE(QColor)
|
||||||
Q_DECLARE_METATYPE(QFont)
|
Q_DECLARE_METATYPE(QFont)
|
||||||
@ -201,8 +202,6 @@ ScriptEngineManager::~ScriptEngineManager()
|
|||||||
{
|
{
|
||||||
delete m_model;
|
delete m_model;
|
||||||
m_model = 0;
|
m_model = 0;
|
||||||
delete m_tableOfContens;
|
|
||||||
m_tableOfContens = 0;
|
|
||||||
delete m_scriptEngine;
|
delete m_scriptEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,9 +344,12 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){
|
|||||||
);
|
);
|
||||||
addFunction(describer);
|
addFunction(describer);
|
||||||
}
|
}
|
||||||
ICallbackDatasource* tableOfContens = m_dataManager->createCallbackDatasource("tableofcontens");
|
|
||||||
connect(tableOfContens, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
|
// qDebug()<<"is script context exists before set datamanager is called"<< (m_context == 0);
|
||||||
m_tableOfContens, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
|
|
||||||
|
// ICallbackDatasource* tableOfContens = m_dataManager->createCallbackDatasource("tableofcontens");
|
||||||
|
// connect(tableOfContens, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
|
||||||
|
// m_tableOfContens, SLOT(slotOneSlotDS(LimeReport::CallbackInfo,QVariant&)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -431,8 +433,8 @@ QString ScriptEngineManager::expandDataFields(QString context, ExpandType expand
|
|||||||
fieldValue = replaceHTMLSymbols(varValue.toString());
|
fieldValue = replaceHTMLSymbols(varValue.toString());
|
||||||
else fieldValue = varValue.toString();
|
else fieldValue = varValue.toString();
|
||||||
}
|
}
|
||||||
|
if (varValue.isValid())
|
||||||
context.replace(rx.cap(0),fieldValue);
|
context.replace(rx.cap(0),fieldValue);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
QString error;
|
QString error;
|
||||||
@ -540,7 +542,20 @@ QVariant ScriptEngineManager::evaluateScript(const QString& script){
|
|||||||
|
|
||||||
void ScriptEngineManager::addTableOfContensItem(const QString& uniqKey, const QString& content, int pageNumber, int indent)
|
void ScriptEngineManager::addTableOfContensItem(const QString& uniqKey, const QString& content, int pageNumber, int indent)
|
||||||
{
|
{
|
||||||
m_tableOfContens->setItem(uniqKey, content, pageNumber, indent);
|
Q_ASSERT(m_context != 0);
|
||||||
|
if (m_context){
|
||||||
|
BandDesignIntf* currentBand = m_context->getCurrentBand();
|
||||||
|
m_context->tableOfContens()->setItem(uniqKey, content, pageNumber, indent);
|
||||||
|
if (currentBand)
|
||||||
|
currentBand->addBookmark(uniqKey, content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptEngineManager::clearTableOfContens(){
|
||||||
|
if (m_context) {
|
||||||
|
if (m_context->tableOfContens())
|
||||||
|
m_context->tableOfContens()->clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngineManager::updateModel()
|
void ScriptEngineManager::updateModel()
|
||||||
@ -813,7 +828,6 @@ ScriptEngineManager::ScriptEngineManager()
|
|||||||
createClearTableOfContensFunction();
|
createClearTableOfContensFunction();
|
||||||
|
|
||||||
m_model = new ScriptEngineModel(this);
|
m_model = new ScriptEngineModel(this);
|
||||||
m_tableOfContens = new TableOfContens();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScriptExtractor::parse()
|
bool ScriptExtractor::parse()
|
||||||
@ -1049,6 +1063,7 @@ void ScriptEngineContext::clear()
|
|||||||
m_createdDialogs.clear();
|
m_createdDialogs.clear();
|
||||||
#endif
|
#endif
|
||||||
m_initScript.clear();
|
m_initScript.clear();
|
||||||
|
m_tableOfContens->clear();
|
||||||
m_lastError="";
|
m_lastError="";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1131,6 +1146,36 @@ DialogDescriber* ScriptEngineContext::findDialogContainer(const QString& dialogN
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TableOfContens* ScriptEngineContext::tableOfContens() const
|
||||||
|
{
|
||||||
|
return m_tableOfContens;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptEngineContext::setTableOfContens(TableOfContens* tableOfContens)
|
||||||
|
{
|
||||||
|
m_tableOfContens = tableOfContens;
|
||||||
|
}
|
||||||
|
|
||||||
|
PageItemDesignIntf* ScriptEngineContext::getCurrentPage() const
|
||||||
|
{
|
||||||
|
return m_currentPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptEngineContext::setCurrentPage(PageItemDesignIntf* currentPage)
|
||||||
|
{
|
||||||
|
m_currentPage = currentPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
BandDesignIntf* ScriptEngineContext::getCurrentBand() const
|
||||||
|
{
|
||||||
|
return m_currentBand;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptEngineContext::setCurrentBand(BandDesignIntf* currentBand)
|
||||||
|
{
|
||||||
|
m_currentBand = currentBand;
|
||||||
|
}
|
||||||
|
|
||||||
QDialog* ScriptEngineContext::getDialog(const QString& dialogName)
|
QDialog* ScriptEngineContext::getDialog(const QString& dialogName)
|
||||||
{
|
{
|
||||||
QDialog* dialog = findDialog(dialogName);
|
QDialog* dialog = findDialog(dialogName);
|
||||||
@ -1221,6 +1266,9 @@ bool ScriptEngineContext::runInitScript(){
|
|||||||
|
|
||||||
ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine();
|
ScriptEngineType* engine = ScriptEngineManager::instance().scriptEngine();
|
||||||
ScriptEngineManager::instance().clearTableOfContens();
|
ScriptEngineManager::instance().clearTableOfContens();
|
||||||
|
ScriptEngineManager::instance().setContext(this);
|
||||||
|
m_tableOfContens->clear();
|
||||||
|
|
||||||
#ifndef USE_QJSENGINE
|
#ifndef USE_QJSENGINE
|
||||||
engine->pushContext();
|
engine->pushContext();
|
||||||
#endif
|
#endif
|
||||||
@ -1477,7 +1525,8 @@ void TableOfContens::setItem(const QString& uniqKey, const QString& content, int
|
|||||||
item = m_hash.value(uniqKey);
|
item = m_hash.value(uniqKey);
|
||||||
item->content = content;
|
item->content = content;
|
||||||
item->pageNumber = pageNumber;
|
item->pageNumber = pageNumber;
|
||||||
item->indent = indent;
|
if (indent>0)
|
||||||
|
item->indent = indent;
|
||||||
} else {
|
} else {
|
||||||
item = new ContentItem;
|
item = new ContentItem;
|
||||||
item->content = content;
|
item->content = content;
|
||||||
|
@ -56,6 +56,8 @@ namespace LimeReport{
|
|||||||
|
|
||||||
class DataSourceManager;
|
class DataSourceManager;
|
||||||
class BaseDesignIntf;
|
class BaseDesignIntf;
|
||||||
|
class PageItemDesignIntf;
|
||||||
|
class BandDesignIntf;
|
||||||
|
|
||||||
struct ContentItem {
|
struct ContentItem {
|
||||||
QString content;
|
QString content;
|
||||||
@ -66,9 +68,11 @@ struct ContentItem {
|
|||||||
class TableOfContens : public QObject{
|
class TableOfContens : public QObject{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
TableOfContens(QObject* parent = 0):QObject(parent){}
|
||||||
~TableOfContens();
|
~TableOfContens();
|
||||||
void setItem(const QString& uniqKey, const QString& content, int pageNumber, int indent = 0);
|
void setItem(const QString& uniqKey, const QString& content, int pageNumber, int indent = 0);
|
||||||
void clear();
|
void clear();
|
||||||
|
bool isEmpty(){ return m_tableOfContens.isEmpty();}
|
||||||
private slots:
|
private slots:
|
||||||
void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant &data);
|
void slotOneSlotDS(LimeReport::CallbackInfo info, QVariant &data);
|
||||||
private:
|
private:
|
||||||
@ -164,7 +168,7 @@ public:
|
|||||||
#ifdef HAVE_UI_LOADER
|
#ifdef HAVE_UI_LOADER
|
||||||
typedef QSharedPointer<QDialog> DialogPtr;
|
typedef QSharedPointer<QDialog> DialogPtr;
|
||||||
#endif
|
#endif
|
||||||
explicit ScriptEngineContext(QObject* parent=0):QObject(parent){}
|
explicit ScriptEngineContext(QObject* parent=0):QObject(parent), m_tableOfContens(new TableOfContens(this)){}
|
||||||
#ifdef HAVE_UI_LOADER
|
#ifdef HAVE_UI_LOADER
|
||||||
void addDialog(const QString& name, const QByteArray& description);
|
void addDialog(const QString& name, const QByteArray& description);
|
||||||
bool changeDialog(const QString& name, const QByteArray &description);
|
bool changeDialog(const QString& name, const QByteArray &description);
|
||||||
@ -182,6 +186,14 @@ public:
|
|||||||
QString initScript() const;
|
QString initScript() const;
|
||||||
void setInitScript(const QString& initScript);
|
void setInitScript(const QString& initScript);
|
||||||
bool runInitScript();
|
bool runInitScript();
|
||||||
|
|
||||||
|
BandDesignIntf* getCurrentBand() const;
|
||||||
|
void setCurrentBand(BandDesignIntf* currentBand);
|
||||||
|
PageItemDesignIntf* getCurrentPage() const;
|
||||||
|
void setCurrentPage(PageItemDesignIntf* currentPage);
|
||||||
|
TableOfContens* tableOfContens() const;
|
||||||
|
void setTableOfContens(TableOfContens* tableOfContens);
|
||||||
|
|
||||||
#ifdef HAVE_UI_LOADER
|
#ifdef HAVE_UI_LOADER
|
||||||
signals:
|
signals:
|
||||||
void dialogNameChanged(QString dialogName);
|
void dialogNameChanged(QString dialogName);
|
||||||
@ -205,6 +217,9 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
QString m_lastError;
|
QString m_lastError;
|
||||||
QString m_initScript;
|
QString m_initScript;
|
||||||
|
BandDesignIntf* m_currentBand;
|
||||||
|
PageItemDesignIntf* m_currentPage;
|
||||||
|
TableOfContens* m_tableOfContens;
|
||||||
};
|
};
|
||||||
|
|
||||||
class JSFunctionDesc{
|
class JSFunctionDesc{
|
||||||
@ -306,7 +321,7 @@ public:
|
|||||||
QString expandScripts(QString context, QVariant &varValue, QObject* reportItem);
|
QString expandScripts(QString context, QVariant &varValue, QObject* reportItem);
|
||||||
QVariant evaluateScript(const QString &script);
|
QVariant evaluateScript(const QString &script);
|
||||||
void addTableOfContensItem(const QString& uniqKey, const QString& content, int pageNumber, int indent);
|
void addTableOfContensItem(const QString& uniqKey, const QString& content, int pageNumber, int indent);
|
||||||
void clearTableOfContens(){ m_tableOfContens->clear(); }
|
void clearTableOfContens();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateModel();
|
void updateModel();
|
||||||
@ -336,7 +351,6 @@ private:
|
|||||||
ScriptEngineContext* m_context;
|
ScriptEngineContext* m_context;
|
||||||
DataSourceManager* m_dataManager;
|
DataSourceManager* m_dataManager;
|
||||||
ScriptFunctionsManager* m_functionManager;
|
ScriptFunctionsManager* m_functionManager;
|
||||||
TableOfContens* m_tableOfContens;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScriptExtractor
|
class ScriptExtractor
|
||||||
|
Loading…
Reference in New Issue
Block a user