mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-25 04:54:40 +03:00
TOC Refactored
This commit is contained in:
parent
9be042819b
commit
3aee2b62d7
@ -184,13 +184,6 @@ QString BandDesignIntf::translateBandName(const BaseDesignIntf* item) const{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BandDesignIntf::copyBookmarks(BandDesignIntf* sourceBand)
|
|
||||||
{
|
|
||||||
foreach(QString key, sourceBand->bookmarks()){
|
|
||||||
addBookmark(key,sourceBand->getBookMark(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BandDesignIntf::setBackgroundModeProperty(BaseDesignIntf::BGMode value)
|
void BandDesignIntf::setBackgroundModeProperty(BaseDesignIntf::BGMode value)
|
||||||
{
|
{
|
||||||
if (value!=backgroundMode()){
|
if (value!=backgroundMode()){
|
||||||
@ -843,12 +836,6 @@ qreal BandDesignIntf::bottomSpace() const
|
|||||||
return height()-findMaxBottom();
|
return 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();
|
||||||
|
@ -248,12 +248,6 @@ public:
|
|||||||
qreal bottomSpace() const;
|
qreal bottomSpace() const;
|
||||||
void setBackgroundModeProperty(BGMode value);
|
void setBackgroundModeProperty(BGMode value);
|
||||||
void setBackgroundOpacity(int value);
|
void setBackgroundOpacity(int value);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
int bootomSpace() const;
|
int bootomSpace() const;
|
||||||
void setBootomSpace(int bootomSpace);
|
void setBootomSpace(int bootomSpace);
|
||||||
signals:
|
signals:
|
||||||
|
@ -1639,4 +1639,18 @@ QMap<QString, QString> BaseDesignIntf::getStringForTranslation(){
|
|||||||
return QMap<QString,QString>();
|
return QMap<QString,QString>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariant BookmarkContainerDesignIntf::getBookMark(const QString& key)
|
||||||
|
{
|
||||||
|
if (m_bookmarks.contains(key))
|
||||||
|
return m_bookmarks.value(key);
|
||||||
|
else return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BookmarkContainerDesignIntf::copyBookmarks(BookmarkContainerDesignIntf* source)
|
||||||
|
{
|
||||||
|
foreach(QString key, source->bookmarks()){
|
||||||
|
addBookmark(key,source->getBookMark(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace LimeReport
|
} //namespace LimeReport
|
||||||
|
@ -356,6 +356,7 @@ protected:
|
|||||||
void addChildItems(QList<BaseDesignIntf*>* list);
|
void addChildItems(QList<BaseDesignIntf*>* list);
|
||||||
qreal calcAbsolutePosY(qreal currentOffset, BaseDesignIntf* item);
|
qreal calcAbsolutePosY(qreal currentOffset, BaseDesignIntf* item);
|
||||||
qreal calcAbsolutePosX(qreal currentOffset, BaseDesignIntf* item);
|
qreal calcAbsolutePosX(qreal currentOffset, BaseDesignIntf* item);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateSelectionMarker();
|
void updateSelectionMarker();
|
||||||
int resizeDirectionFlags(QPointF position);
|
int resizeDirectionFlags(QPointF position);
|
||||||
@ -434,6 +435,19 @@ signals:
|
|||||||
void afterRender();
|
void afterRender();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BookmarkContainerDesignIntf: public BaseDesignIntf{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
BookmarkContainerDesignIntf(const QString& storageTypeName, QObject* owner = 0, QGraphicsItem* parent = 0)
|
||||||
|
:BaseDesignIntf(storageTypeName, owner, parent){}
|
||||||
|
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(BookmarkContainerDesignIntf* source);
|
||||||
|
private:
|
||||||
|
QMap<QString,QVariant> m_bookmarks;
|
||||||
|
};
|
||||||
|
|
||||||
} //namespace LimeReport
|
} //namespace LimeReport
|
||||||
|
|
||||||
#endif // LRBASEDESIGNINTF_H
|
#endif // LRBASEDESIGNINTF_H
|
||||||
|
@ -37,10 +37,11 @@ struct ItemSortContainer {
|
|||||||
typedef QSharedPointer< ItemSortContainer > PItemSortContainer;
|
typedef QSharedPointer< ItemSortContainer > PItemSortContainer;
|
||||||
bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortContainer c2);
|
bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortContainer c2);
|
||||||
|
|
||||||
class ItemsContainerDesignInft : public BaseDesignIntf{
|
class ItemsContainerDesignInft : public BookmarkContainerDesignIntf{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ItemsContainerDesignInft(const QString& xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0):
|
ItemsContainerDesignInft(const QString& xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0):
|
||||||
BaseDesignIntf(xmlTypeName, owner, parent){}
|
BookmarkContainerDesignIntf(xmlTypeName, owner, parent){}
|
||||||
protected:
|
protected:
|
||||||
void snapshotItemsLayout();
|
void snapshotItemsLayout();
|
||||||
void arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type = AsNeeded);
|
void arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type = AsNeeded);
|
||||||
|
@ -1112,21 +1112,21 @@ BandDesignIntf* ReportRender::sliceBand(BandDesignIntf *band, BandDesignIntf* pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ReportRender::updateTOC(BaseDesignIntf* item, int pageNumber){
|
void ReportRender::updateTOC(BaseDesignIntf* item, int pageNumber){
|
||||||
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(item);
|
BookmarkContainerDesignIntf* bookmarkContainer = dynamic_cast<BookmarkContainerDesignIntf*>(item);
|
||||||
if (band){
|
if (bookmarkContainer){
|
||||||
TableOfContents* toc = m_scriptEngineContext->tableOfContents();
|
TableOfContents* toc = m_scriptEngineContext->tableOfContents();
|
||||||
foreach (QString key, band->bookmarks()){
|
foreach (QString key, bookmarkContainer->bookmarks()){
|
||||||
toc->setItem(key, band->getBookMark(key).toString(), pageNumber);
|
toc->setItem(key, bookmarkContainer->getBookMark(key).toString(), pageNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportRender::secondRenderPass(ReportPages renderedPages)
|
void ReportRender::secondRenderPass(ReportPages renderedPages)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!m_scriptEngineContext->tableOfContents()->isEmpty()){
|
if (!m_scriptEngineContext->tableOfContents()->isEmpty()){
|
||||||
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);
|
||||||
|
updateTOC(page.data(), m_pagesRanges.findPageNumber(i));
|
||||||
foreach(BaseDesignIntf* item, page->childBaseItems()){
|
foreach(BaseDesignIntf* item, page->childBaseItems()){
|
||||||
updateTOC(item, m_pagesRanges.findPageNumber(i));
|
updateTOC(item, m_pagesRanges.findPageNumber(i));
|
||||||
}
|
}
|
||||||
|
@ -553,6 +553,9 @@ void ScriptEngineManager::addTableOfContentsItem(const QString& uniqKey, const Q
|
|||||||
m_context->tableOfContents()->setItem(uniqKey, content, 0, indent);
|
m_context->tableOfContents()->setItem(uniqKey, content, 0, indent);
|
||||||
if (currentBand)
|
if (currentBand)
|
||||||
currentBand->addBookmark(uniqKey, content);
|
currentBand->addBookmark(uniqKey, content);
|
||||||
|
else if (m_context->getCurrentPage()) {
|
||||||
|
m_context->getCurrentPage()->addBookmark(uniqKey, content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1236,6 +1239,7 @@ PageItemDesignIntf* ScriptEngineContext::getCurrentPage() const
|
|||||||
void ScriptEngineContext::setCurrentPage(PageItemDesignIntf* currentPage)
|
void ScriptEngineContext::setCurrentPage(PageItemDesignIntf* currentPage)
|
||||||
{
|
{
|
||||||
m_currentPage = currentPage;
|
m_currentPage = currentPage;
|
||||||
|
m_currentBand = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BandDesignIntf* ScriptEngineContext::getCurrentBand() const
|
BandDesignIntf* ScriptEngineContext::getCurrentBand() const
|
||||||
|
@ -175,7 +175,7 @@ public:
|
|||||||
typedef QSharedPointer<QDialog> DialogPtr;
|
typedef QSharedPointer<QDialog> DialogPtr;
|
||||||
#endif
|
#endif
|
||||||
explicit ScriptEngineContext(QObject* parent=0):
|
explicit ScriptEngineContext(QObject* parent=0):
|
||||||
QObject(parent),
|
QObject(parent), m_currentBand(0), m_currentPage(0),
|
||||||
m_tableOfContents(new TableOfContents(this)), m_hasChanges(false) {}
|
m_tableOfContents(new TableOfContents(this)), m_hasChanges(false) {}
|
||||||
#ifdef HAVE_UI_LOADER
|
#ifdef HAVE_UI_LOADER
|
||||||
void addDialog(const QString& name, const QByteArray& description);
|
void addDialog(const QString& name, const QByteArray& description);
|
||||||
|
Loading…
Reference in New Issue
Block a user