TOC generation has been changed

This commit is contained in:
Arin Alexander 2017-08-31 02:53:34 +03:00
parent 2c50a9a791
commit 992c53e19a
21 changed files with 515 additions and 177 deletions

View File

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF8"?>
<Report>
<object ClassName="LimeReport::ReportEnginePrivate" Type="Object">
<object Type="Object" ClassName="LimeReport::ReportEnginePrivate">
<objectName Type="QString"></objectName>
<pages Type="Collection">
<item ClassName="LimeReport::PageDesignIntf" Type="Object">
<item Type="Object" ClassName="LimeReport::PageDesignIntf">
<objectName Type="QString">page2</objectName>
<sceneRect height="3070" Type="QRect" y="-50" width="2200" x="-50"/>
<sceneRect y="-50" Type="QRect" width="2200" x="-50" height="3070"/>
<bspTreeDepth Type="int" Value="5"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Noto Sans" pointSize="9" stylename=""/>
<font pointSize="9" stylename="" Type="QFont" family="Noto Sans" italic="0" weight="50" underline="0"/>
<sortCacheEnabled Type="bool" Value="0"/>
<stickyFocus Type="bool" Value="0"/>
<minimumRenderSize Type="qreal" Value="0"/>
<pageItem ClassName="PageItem" Type="Object">
<pageItem Type="Object" ClassName="PageItem">
<objectName Type="QString">TOC</objectName>
<geometry height="2970" Type="QRect" y="0" width="2100" x="0"/>
<geometry y="0" Type="QRect" width="2100" x="0" height="2970"/>
<children Type="Collection">
<item ClassName="Data" Type="Object">
<item Type="Object" ClassName="Data">
<objectName Type="QString">DataBand1</objectName>
<geometry height="100" Type="QRect" y="50" width="2000" x="50"/>
<geometry y="50" Type="QRect" width="2000" x="50" height="94"/>
<children Type="Collection">
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem1</objectName>
<geometry height="50" Type="QRect" y="26" width="1280" x="18"/>
<geometry y="26" Type="QRect" width="1612" x="18" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -37,7 +37,7 @@
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -49,18 +49,19 @@
<trimValue Type="bool" Value="0"/>
<lineSpacing Type="int" Value="1"/>
<underlineLineSize Type="int" Value="1"/>
<allowHTML Type="bool" Value="0"/>
<allowHTMLInFields Type="bool" Value="0"/>
<allowHTML Type="bool" Value="1"/>
<allowHTMLInFields Type="bool" Value="1"/>
<format Type="QString"></format>
<valueType Type="enumAndFlags" Value="0"/>
<followTo Type="QString"></followTo>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem2</objectName>
<geometry height="50" Type="QRect" y="24" width="250" x="1310"/>
<geometry y="28" Type="QRect" width="244" x="1640" height="48"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -71,12 +72,19 @@
<itemLocation Type="enumAndFlags" Value="0"/>
<stretchToMaxHeight Type="bool" Value="0"/>
<itemAlign Type="enumAndFlags" Value="4"/>
<content Type="QString">$D{tableofcontens.Page number}</content>
<content Type="QString">$S{
getFieldByKeyField(
"tableofcontens",
"Page number",
"Content Key",
"$D{tableofcontens.Content Key}"
)
}</content>
<margin Type="int" Value="4"/>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -96,6 +104,7 @@
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="1"/>
</item>
</children>
<zOrder Type="qreal" Value="0"/>
@ -145,25 +154,25 @@
<pageIsTOC Type="bool" Value="1"/>
</pageItem>
</item>
<item ClassName="LimeReport::PageDesignIntf" Type="Object">
<item Type="Object" ClassName="LimeReport::PageDesignIntf">
<objectName Type="QString">page1</objectName>
<sceneRect height="3070" Type="QRect" y="-50" width="2200" x="-50"/>
<sceneRect y="-50" Type="QRect" width="2200" x="-50" height="3070"/>
<bspTreeDepth Type="int" Value="5"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Sans Serif" pointSize="9" stylename=""/>
<font pointSize="9" stylename="" Type="QFont" family="Sans Serif" italic="0" weight="50" underline="0"/>
<sortCacheEnabled Type="bool" Value="0"/>
<stickyFocus Type="bool" Value="0"/>
<minimumRenderSize Type="qreal" Value="0"/>
<pageItem ClassName="PageItem" Type="Object">
<pageItem Type="Object" ClassName="PageItem">
<objectName Type="QString">ReportPage1</objectName>
<geometry height="2970" Type="QRect" y="0" width="2100" x="0"/>
<geometry y="0" Type="QRect" width="2100" x="0" height="2970"/>
<children Type="Collection">
<item ClassName="ReportHeader" Type="Object">
<item Type="Object" ClassName="ReportHeader">
<objectName Type="QString">ReportHeader1</objectName>
<geometry height="164" Type="QRect" y="50" width="2000" x="50"/>
<geometry y="154" Type="QRect" width="2000" x="50" height="164"/>
<children Type="Collection">
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem1</objectName>
<geometry height="142" Type="QRect" y="22" width="1024" x="230"/>
<geometry y="22" Type="QRect" width="1024" x="230" height="142"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -180,7 +189,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="75" family="Arial" pointSize="16" stylename=""/>
<font pointSize="16" stylename="" Type="QFont" family="Arial" italic="0" weight="75" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="0"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -200,10 +209,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="ImageItem" Type="Object">
<item Type="Object" ClassName="ImageItem">
<objectName Type="QString">ImageItem1</objectName>
<geometry height="156" Type="QRect" y="6" width="158" x="68"/>
<geometry y="6" Type="QRect" width="158" x="68" height="156"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -224,9 +234,9 @@ Report</content>
<center Type="bool" Value="1"/>
<resourcePath Type="QString"></resourcePath>
</item>
<item ClassName="ShapeItem" Type="Object">
<item Type="Object" ClassName="ShapeItem">
<objectName Type="QString">ShapeItem1</objectName>
<geometry height="78" Type="QRect" y="86" width="2000" x="0"/>
<geometry y="86" Type="QRect" width="2000" x="0" height="78"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="-0.1"/>
<borders Type="enumAndFlags" Value="0"/>
@ -246,9 +256,9 @@ Report</content>
<opacity Type="int" Value="100"/>
<cornerRadius Type="int" Value="0"/>
</item>
<item ClassName="ShapeItem" Type="Object">
<item Type="Object" ClassName="ShapeItem">
<objectName Type="QString">ShapeItem2</objectName>
<geometry height="50" Type="QRect" y="60" width="2006" x="-6"/>
<geometry y="60" Type="QRect" width="2006" x="-6" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0.1"/>
<borders Type="enumAndFlags" Value="0"/>
@ -268,9 +278,9 @@ Report</content>
<opacity Type="int" Value="100"/>
<cornerRadius Type="int" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem9</objectName>
<geometry height="50" Type="QRect" y="18" width="200" x="1782"/>
<geometry y="18" Type="QRect" width="200" x="1782" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -286,7 +296,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="130"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="75" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="75" underline="0"/>
<backgroundOpacity Type="int" Value="50"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -306,10 +316,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem10</objectName>
<geometry height="50" Type="QRect" y="98" width="200" x="1782"/>
<geometry y="98" Type="QRect" width="200" x="1782" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -325,7 +336,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="130"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="75" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="75" underline="0"/>
<backgroundOpacity Type="int" Value="50"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -345,6 +356,7 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
</children>
<zOrder Type="qreal" Value="0"/>
@ -354,7 +366,7 @@ Report</content>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<autoHeight Type="bool" Value="0"/>
<bandIndex Type="int" Value="0"/>
<bandIndex Type="int" Value="1"/>
<keepBottomSpace Type="bool" Value="0"/>
<parentBand Type="QString"></parentBand>
<backgroundColor Type="QColor" Value="#87b51a"/>
@ -363,13 +375,13 @@ Report</content>
<splittable Type="bool" Value="0"/>
<printBeforePageHeader Type="bool" Value="0"/>
</item>
<item ClassName="Data" Type="Object">
<item Type="Object" ClassName="Data">
<objectName Type="QString">DataBand1</objectName>
<geometry height="64" Type="QRect" y="310" width="2000" x="50"/>
<geometry y="414" Type="QRect" width="2000" x="50" height="64"/>
<children Type="Collection">
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem3</objectName>
<geometry height="50" Type="QRect" y="6" width="250" x="648"/>
<geometry y="6" Type="QRect" width="250" x="648" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -385,7 +397,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="0"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -405,10 +417,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem4</objectName>
<geometry height="50" Type="QRect" y="6" width="250" x="178"/>
<geometry y="6" Type="QRect" width="250" x="178" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -424,7 +437,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="0"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -444,10 +457,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem12</objectName>
<geometry height="38" Type="QRect" y="12" width="340" x="1642"/>
<geometry y="12" Type="QRect" width="340" x="1642" height="38"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -463,7 +477,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="34"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="75" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="75" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -483,10 +497,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem16</objectName>
<geometry height="50" Type="QRect" y="6" width="162" x="10"/>
<geometry y="6" Type="QRect" width="162" x="10" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -502,7 +517,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="75" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="75" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="0"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -522,10 +537,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem17</objectName>
<geometry height="50" Type="QRect" y="6" width="208" x="434"/>
<geometry y="6" Type="QRect" width="208" x="434" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -541,7 +557,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="75" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="75" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="0"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -561,6 +577,7 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
</children>
<zOrder Type="qreal" Value="0"/>
@ -570,7 +587,7 @@ Report</content>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<autoHeight Type="bool" Value="1"/>
<bandIndex Type="int" Value="2"/>
<bandIndex Type="int" Value="3"/>
<keepBottomSpace Type="bool" Value="0"/>
<parentBand Type="QString"></parentBand>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -588,13 +605,13 @@ Report</content>
<alternateBackgroundColor Type="QColor" Value="#ffffff"/>
<useAlternateBackgroundColor Type="bool" Value="0"/>
</item>
<item ClassName="GroupHeader" Type="Object">
<item Type="Object" ClassName="GroupHeader">
<objectName Type="QString">GroupBandHeader1</objectName>
<geometry height="88" Type="QRect" y="218" width="2000" x="50"/>
<geometry y="322" Type="QRect" width="2000" x="50" height="88"/>
<children Type="Collection">
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem2</objectName>
<geometry height="50" Type="QRect" y="22" width="580" x="10"/>
<geometry y="22" Type="QRect" width="580" x="10" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -610,7 +627,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="0"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -630,10 +647,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="ShapeItem" Type="Object">
<item Type="Object" ClassName="ShapeItem">
<objectName Type="QString">ShapeItem3</objectName>
<geometry height="8" Type="QRect" y="2" width="2000" x="0"/>
<geometry y="2" Type="QRect" width="2000" x="0" height="8"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="-0.1"/>
<borders Type="enumAndFlags" Value="0"/>
@ -653,9 +671,9 @@ Report</content>
<opacity Type="int" Value="100"/>
<cornerRadius Type="int" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem11</objectName>
<geometry height="38" Type="QRect" y="24" width="326" x="1656"/>
<geometry y="24" Type="QRect" width="326" x="1656" height="38"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -671,7 +689,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="34"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="75" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="75" underline="0"/>
<backgroundOpacity Type="int" Value="50"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -691,6 +709,7 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
</children>
<zOrder Type="qreal" Value="0"/>
@ -700,7 +719,7 @@ Report</content>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<autoHeight Type="bool" Value="0"/>
<bandIndex Type="int" Value="1"/>
<bandIndex Type="int" Value="2"/>
<keepBottomSpace Type="bool" Value="0"/>
<parentBand Type="QString">DataBand1</parentBand>
<backgroundColor Type="QColor" Value="#595458"/>
@ -714,13 +733,13 @@ Report</content>
<reprintOnEachPage Type="bool" Value="0"/>
<condition Type="QString"></condition>
</item>
<item ClassName="SubDetail" Type="Object">
<item Type="Object" ClassName="SubDetail">
<objectName Type="QString">SubDetailBand1</objectName>
<geometry height="64" Type="QRect" y="378" width="2000" x="50"/>
<geometry y="482" Type="QRect" width="2000" x="50" height="64"/>
<children Type="Collection">
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem5</objectName>
<geometry height="50" Type="QRect" y="6" width="626" x="104"/>
<geometry y="6" Type="QRect" width="626" x="104" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -736,7 +755,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="1"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="0"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -756,10 +775,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem6</objectName>
<geometry height="50" Type="QRect" y="6" width="250" x="738"/>
<geometry y="6" Type="QRect" width="250" x="738" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -775,7 +795,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="34"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="0"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -795,10 +815,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem7</objectName>
<geometry height="50" Type="QRect" y="6" width="86" x="8"/>
<geometry y="6" Type="QRect" width="86" x="8" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -814,7 +835,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="33"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="0"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -834,10 +855,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem13</objectName>
<geometry height="42" Type="QRect" y="12" width="354" x="1628"/>
<geometry y="12" Type="QRect" width="354" x="1628" height="42"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -853,7 +875,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="34"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="75" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="75" underline="0"/>
<backgroundOpacity Type="int" Value="50"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -873,6 +895,7 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
</children>
<zOrder Type="qreal" Value="0"/>
@ -882,7 +905,7 @@ Report</content>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<autoHeight Type="bool" Value="1"/>
<bandIndex Type="int" Value="3"/>
<bandIndex Type="int" Value="4"/>
<keepBottomSpace Type="bool" Value="0"/>
<parentBand Type="QString">DataBand1</parentBand>
<backgroundColor Type="QColor" Value="#aac293"/>
@ -896,13 +919,13 @@ Report</content>
<alternateBackgroundColor Type="QColor" Value="#ffffff"/>
<useAlternateBackgroundColor Type="bool" Value="0"/>
</item>
<item ClassName="SubDetailFooter" Type="Object">
<item Type="Object" ClassName="SubDetailFooter">
<objectName Type="QString">SubDetailFooterBand1</objectName>
<geometry height="70" Type="QRect" y="446" width="2000" x="50"/>
<geometry y="550" Type="QRect" width="2000" x="50" height="70"/>
<children Type="Collection">
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem8</objectName>
<geometry height="50" Type="QRect" y="10" width="248" x="738"/>
<geometry y="10" Type="QRect" width="248" x="738" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="1"/>
@ -918,7 +941,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="130"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -938,10 +961,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem14</objectName>
<geometry height="42" Type="QRect" y="16" width="380" x="1602"/>
<geometry y="16" Type="QRect" width="380" x="1602" height="42"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -957,7 +981,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="34"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="75" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="75" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -977,10 +1001,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="TextItem" Type="Object">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem15</objectName>
<geometry height="50" Type="QRect" y="10" width="200" x="528"/>
<geometry y="10" Type="QRect" width="200" x="528" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -996,7 +1021,7 @@ Report</content>
<alignment Type="enumAndFlags" Value="130"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font italic="0" Type="QFont" underline="0" weight="50" family="Arial" pointSize="10" stylename=""/>
<font pointSize="10" stylename="" Type="QFont" family="Arial" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -1016,10 +1041,11 @@ Report</content>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
<item ClassName="ShapeItem" Type="Object">
<item Type="Object" ClassName="ShapeItem">
<objectName Type="QString">ShapeItem4</objectName>
<geometry height="50" Type="QRect" y="40" width="1994" x="6"/>
<geometry y="40" Type="QRect" width="1994" x="6" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -1047,7 +1073,7 @@ Report</content>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<autoHeight Type="bool" Value="1"/>
<bandIndex Type="int" Value="4"/>
<bandIndex Type="int" Value="5"/>
<keepBottomSpace Type="bool" Value="0"/>
<parentBand Type="QString">SubDetailBand1</parentBand>
<backgroundColor Type="QColor" Value="#ffffff"/>
@ -1057,6 +1083,128 @@ Report</content>
<columnsFillDirection Type="enumAndFlags" Value="0"/>
<printAlways Type="bool" Value="0"/>
</item>
<item Type="Object" ClassName="PageFooter">
<objectName Type="QString">PageFooter1</objectName>
<geometry y="624" Type="QRect" width="2000" x="50" height="100"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem18</objectName>
<geometry y="22" Type="QRect" width="696" x="1258" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
<parentName Type="QString">PageFooter1</parentName>
<borderLineSize Type="int" Value="1"/>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<itemLocation Type="enumAndFlags" Value="0"/>
<stretchToMaxHeight Type="bool" Value="0"/>
<itemAlign Type="enumAndFlags" Value="4"/>
<content Type="QString">Page $V{#PAGE} from $V{#PAGE_COUNT}</content>
<margin Type="int" Value="4"/>
<alignment Type="enumAndFlags" Value="34"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font pointSize="9" stylename="" Type="QFont" family="DejaVu Sans" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
<fontColor Type="QColor" Value="#000000"/>
<angle Type="enumAndFlags" Value="0"/>
<foregroundOpacity Type="int" Value="100"/>
<underlines Type="bool" Value="0"/>
<adaptFontToSize Type="bool" Value="0"/>
<trimValue Type="bool" Value="1"/>
<lineSpacing Type="int" Value="1"/>
<underlineLineSize Type="int" Value="1"/>
<allowHTML Type="bool" Value="0"/>
<allowHTMLInFields Type="bool" Value="0"/>
<format Type="QString"></format>
<valueType Type="enumAndFlags" Value="0"/>
<followTo Type="QString"></followTo>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
</children>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Type="int" Value="1"/>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<autoHeight Type="bool" Value="1"/>
<bandIndex Type="int" Value="6"/>
<keepBottomSpace Type="bool" Value="0"/>
<parentBand Type="QString"></parentBand>
<backgroundColor Type="QColor" Value="#ffffff"/>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<printIfEmpty Type="bool" Value="0"/>
<printOnFirstPage Type="bool" Value="1"/>
<printOnLastPage Type="bool" Value="1"/>
</item>
<item Type="Object" ClassName="PageHeader">
<objectName Type="QString">PageHeader18</objectName>
<geometry y="50" Type="QRect" width="2000" x="50" height="100"/>
<children Type="Collection">
<item Type="Object" ClassName="TextItem">
<objectName Type="QString">TextItem19</objectName>
<geometry y="22" Type="QRect" width="696" x="1258" height="50"/>
<children Type="Collection"/>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
<parentName Type="QString">PageHeader18</parentName>
<borderLineSize Type="int" Value="1"/>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<itemLocation Type="enumAndFlags" Value="0"/>
<stretchToMaxHeight Type="bool" Value="0"/>
<itemAlign Type="enumAndFlags" Value="4"/>
<content Type="QString">Page $V{#PAGE} from $V{#PAGE_COUNT}</content>
<margin Type="int" Value="4"/>
<alignment Type="enumAndFlags" Value="34"/>
<autoWidth Type="enumAndFlags" Value="0"/>
<autoHeight Type="bool" Value="0"/>
<font pointSize="9" stylename="" Type="QFont" family="DejaVu Sans" italic="0" weight="50" underline="0"/>
<backgroundOpacity Type="int" Value="100"/>
<backgroundMode Type="enumAndFlags" Value="1"/>
<backgroundColor Type="QColor" Value="#ffffff"/>
<fontColor Type="QColor" Value="#000000"/>
<angle Type="enumAndFlags" Value="0"/>
<foregroundOpacity Type="int" Value="100"/>
<underlines Type="bool" Value="0"/>
<adaptFontToSize Type="bool" Value="0"/>
<trimValue Type="bool" Value="1"/>
<lineSpacing Type="int" Value="1"/>
<underlineLineSize Type="int" Value="1"/>
<allowHTML Type="bool" Value="0"/>
<allowHTMLInFields Type="bool" Value="0"/>
<format Type="QString"></format>
<valueType Type="enumAndFlags" Value="0"/>
<followTo Type="QString"></followTo>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<textIndent Type="qreal" Value="0"/>
<textLayoutDirection Type="enumAndFlags" Value="2"/>
<fillInSecondPass Type="bool" Value="0"/>
</item>
</children>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
<parentName Type="QString">ReportPage1</parentName>
<borderLineSize Type="int" Value="1"/>
<isVisible Type="bool" Value="1"/>
<borderColor Type="QColor" Value="#000000"/>
<autoHeight Type="bool" Value="1"/>
<bandIndex Type="int" Value="0"/>
<keepBottomSpace Type="bool" Value="0"/>
<parentBand Type="QString"></parentBand>
<backgroundColor Type="QColor" Value="#ffffff"/>
<backgroundBrushStyle Type="enumAndFlags" Value="1"/>
<printIfEmpty Type="bool" Value="0"/>
<printOnFirstPage Type="bool" Value="1"/>
<printOnLastPage Type="bool" Value="1"/>
</item>
</children>
<zOrder Type="qreal" Value="0"/>
<borders Type="enumAndFlags" Value="0"/>
@ -1080,10 +1228,10 @@ Report</content>
</pageItem>
</item>
</pages>
<datasourcesManager ClassName="LimeReport::DataSourceManager" Type="Object">
<datasourcesManager Type="Object" ClassName="LimeReport::DataSourceManager">
<objectName Type="QString">datasources</objectName>
<connections Type="Collection">
<item ClassName="LimeReport::ConnectionDesc" Type="Object">
<item Type="Object" ClassName="LimeReport::ConnectionDesc">
<objectName Type="QString"></objectName>
<name Type="QString">northwind</name>
<driver Type="QString">QSQLITE</driver>
@ -1096,7 +1244,7 @@ Report</content>
</item>
</connections>
<queries Type="Collection">
<item ClassName="LimeReport::QueryDesc" Type="Object">
<item Type="Object" ClassName="LimeReport::QueryDesc">
<objectName Type="QString"></objectName>
<queryName Type="QString">orders</queryName>
<queryText Type="QString">Select * from orders
@ -1106,7 +1254,7 @@ limit 50</queryText>
</item>
</queries>
<subqueries Type="Collection">
<item ClassName="LimeReport::SubQueryDesc" Type="Object">
<item Type="Object" ClassName="LimeReport::SubQueryDesc">
<objectName Type="QString"></objectName>
<queryName Type="QString">orderitems</queryName>
<queryText Type="QString">Select * from orderitems
@ -1119,18 +1267,26 @@ where orderid = $D{orders.orderid}</queryText>
<subproxies Type="Collection"/>
<variables Type="Collection"/>
</datasourcesManager>
<scriptContext ClassName="LimeReport::ScriptEngineContext" Type="Object">
<scriptContext Type="Object" ClassName="LimeReport::ScriptEngineContext">
<objectName Type="QString"></objectName>
<dialogs Type="Collection"/>
<initScript Type="QString">ReportPage1_DataBand1.bandRegistred.connect(SB1AfterData);
ReportPage1_SubDetailBand1.bandRegistred.connect(SB2AfterData);
<initScript Type="QString">ReportPage1_DataBand1.afterRender.connect(SB1AfterData);
ReportPage1_SubDetailBand1.afterRender.connect(SB2AfterData);
ReportPage1_GroupBandHeader1.afterRender.connect(SB3AfterData);
var firstLevel = "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;";
var secondLevel = "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;";
function SB1AfterData(){
addTableOfContensItem(getField("orders.OrderID"),getField("orders.OrderID"), getVariable("#PAGE"));
addTableOfContensItem(getField("orders.OrderID"),firstLevel+getField("orders.OrderID"));
}
function SB2AfterData(){
addTableOfContensItem(getField("orders.OrderID")+getField("orderItems.ProductName"), getField("orderItems.ProductName"), getVariable("#PAGE"), 5);
addTableOfContensItem(getField("orders.OrderID")+getField("orderItems.ProductName"), secondLevel+"&lt;i>"+getField("orderItems.ProductName")+"&lt;/i>");
}
function SB3AfterData(){
addTableOfContensItem(getField("orders.CompanyName"), "&lt;b>"+getField("orders.CompanyName")+"&lt;/b>");
}</initScript>
</scriptContext>
<suppressFieldAndVarError Type="bool" Value="0"/>

View File

@ -56,7 +56,6 @@ public:
virtual void clearUserVariables()=0;
virtual ICallbackDatasource* createCallbackDatasource(const QString& name) = 0;
virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0;
//virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0;
};
}

View File

@ -83,6 +83,7 @@ namespace Const{
const qreal SELECTION_OPACITY = 0.3;
const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString NAMED_VARIABLE_RX = "\\$V\\s*\\{\\s*(%1)\\s*\\}";
const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}";
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
@ -108,7 +109,7 @@ namespace Const{
QVector<QString> normalizeCaptures(const QRegExp &reg);
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
enum RenderPass {FirstPass, SecondPass};
enum RenderPass {FirstPass = 1, SecondPass = 2};
enum ArrangeType {AsNeeded, Force};
enum PreviewHint{ShowAllPreviewBars = 0,
HidePreviewToolBar = 1,

View File

@ -339,7 +339,7 @@ void TextItem::updateLayout()
bool TextItem::isNeedExpandContent() const
{
QRegExp rx("$*\\{[^{]*\\}");
return content().contains(rx);
return content().contains(rx) || isContentBackedUp();
}
QString TextItem::replaceBR(QString text)
@ -733,23 +733,35 @@ void TextItem::setAlignment(Qt::Alignment value)
void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
{
QString context=content();
ExpandType expandType = (allowHTML() && !allowHTMLInFields())?ReplaceHTMLSymbols:NoEscapeSymbols;
foreach (QString variableName, dataManager->variableNamesByRenderPass(SecondPass)) {
QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName));
if (context.contains(rx) && pass == FirstPass){
backupContent();
break;
}
}
ExpandType expandType = (allowHTML() && !allowHTMLInFields()) ? ReplaceHTMLSymbols : NoEscapeSymbols;
switch(pass){
case FirstPass:
if (!fillInSecondPass()){
context=expandUserVariables(context, pass, expandType, dataManager);
context=expandScripts(context, dataManager);
context=expandDataFields(context, expandType, dataManager);
} else {
context=expandDataFields(context, expandType, dataManager);
}
break;
case SecondPass:;
case SecondPass:
if (isContentBackedUp()) {
restoreContent();
context = content();
}
context=expandUserVariables(context, pass, expandType, 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) {
setContent(formatFieldValue());
} else {
setContent(context);

View File

@ -71,6 +71,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit {
Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle)
Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent)
Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE setTextLayoutDirection)
Q_PROPERTY(bool fillInSecondPass READ fillInSecondPass WRITE setFillInSecondPass)
public:
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};

View File

@ -96,7 +96,7 @@ class BaseDesignIntf :
Q_PROPERTY(int borderLineSize READ borderLineSize WRITE setBorderLineSize)
Q_PROPERTY(bool isVisible READ isVisible WRITE setItemVisible DESIGNABLE false)
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
Q_PROPERTY(bool fillInSecondPass READ fillInSecondPass WRITE setFillInSecondPass)
friend class ReportRender;
public:
enum BGMode { TransparentMode, OpaqueMode};

View File

@ -291,6 +291,16 @@ QVariant ModelToDataSource::data(const QString &columnName)
return m_model->data(m_model->index(currentRow(),columnIndexByName(columnName)));
}
QVariant ModelToDataSource::dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData)
{
for( int i=0; i < m_model->rowCount(); ++i ){
if (m_model->data(m_model->index(i, columnIndexByName(keyColumnName))) == keyData){
return m_model->data(m_model->index(i, columnIndexByName(columnName)));
}
}
return QVariant();
}
int ModelToDataSource::columnCount()
{
if (isInvalid()) return 0;
@ -702,17 +712,24 @@ void CallbackDatasource::first(){
else m_eof = !result;
}
QVariant CallbackDatasource::callbackData(const QString& columnName, int row)
{
CallbackInfo info;
QVariant result;
info.dataType = CallbackInfo::ColumnData;
info.columnName = columnName;
info.index = row;
emit getCallbackData(info, result);
return result;
}
QVariant CallbackDatasource::data(const QString& columnName)
{
QVariant result;
if (!bof())
{
if (!m_getDataFromCache){
CallbackInfo info;
info.dataType = CallbackInfo::ColumnData;
info.columnName = columnName;
info.index = m_currentRow;
emit getCallbackData(info,result);
result = callbackData(columnName, m_currentRow);
} else {
result = m_valuesCache[columnName];
}
@ -720,6 +737,31 @@ QVariant CallbackDatasource::data(const QString& columnName)
return result;
}
QVariant CallbackDatasource::dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData)
{
int backupCurrentRow = m_currentRow;
int currentRow = 0;
QVariant result = QVariant();
first();
if (!checkIfEmpty()){
do {
QVariant key = callbackData(keyColumnName, currentRow);
if (key == keyData){
result = callbackData(columnName, currentRow);
break;
}
currentRow++;
} while (next());
}
first();
if (backupCurrentRow != -1){
for (int i = 0; i < backupCurrentRow; ++i)
next();
}
return result;
}
int CallbackDatasource::columnCount(){
CallbackInfo info;
if (m_columnCount == -1){
@ -781,7 +823,7 @@ int CallbackDatasource::columnIndexByName(QString name)
bool CallbackDatasource::checkNextRecord(int recordNum){
if (bof()) checkIfEmpty();
if (m_rowCount > 0) {
return (m_currentRow < (m_rowCount-1));
return (recordNum < (m_rowCount-1));
} else {
QVariant result = false;
CallbackInfo info;

View File

@ -58,6 +58,7 @@ public:
virtual bool bof() = 0;
virtual bool eof() = 0;
virtual QVariant data(const QString& columnName) = 0;
virtual QVariant dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData) = 0;
virtual int columnCount() = 0;
virtual QString columnNameByIndex(int columnIndex) = 0;
virtual int columnIndexByName(QString name) = 0;
@ -359,6 +360,7 @@ public:
bool eof();
bool bof();
QVariant data(const QString& columnName);
QVariant dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData);
int columnCount();
QString columnNameByIndex(int columnIndex);
int columnIndexByName(QString name);
@ -390,6 +392,7 @@ public:
bool bof(){return m_currentRow == -1;}
bool eof(){return m_eof;}
QVariant data(const QString &columnName);
QVariant dataByKeyField(const QString& columnName, const QString& keyColumnName, QVariant keyData);
int columnCount();
QString columnNameByIndex(int columnIndex);
int columnIndexByName(QString name);
@ -407,6 +410,7 @@ private:
int m_rowCount;
QHash<QString, QVariant> m_valuesCache;
bool m_getDataFromCache;
QVariant callbackData(const QString& columnName, int row);
};
class CallbackDatasourceHolder :public QObject, public IDataSourceHolder{

View File

@ -224,7 +224,7 @@ DataSourceManager::DataSourceManager(QObject *parent) :
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("AVG"),new ConstructorGroupFunctionCreator<AvgGroupFunction>);
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("MIN"),new ConstructorGroupFunctionCreator<MinGroupFunction>);
m_groupFunctionFactory.registerFunctionCreator(QLatin1String("MAX"),new ConstructorGroupFunctionCreator<MaxGroupFunction>);
setSystemVariable(QLatin1String("#PAGE"),1,FirstPass);
setSystemVariable(QLatin1String("#PAGE"),1,SecondPass);
setSystemVariable(QLatin1String("#PAGE_COUNT"),0,SecondPass);
setSystemVariable(QLatin1String("#IS_LAST_PAGEFOOTER"),false,FirstPass);
setSystemVariable(QLatin1String("#IS_FIRST_PAGEFOOTER"),false,FirstPass);
@ -1377,6 +1377,15 @@ QVariant DataSourceManager::fieldData(const QString &fieldName)
return QVariant();
}
QVariant DataSourceManager::fieldDataByKey(const QString& datasourceName, const QString& valueFieldName, const QString& keyFieldName, QVariant keyValue)
{
IDataSource* ds = dataSource(datasourceName);
if (ds){
return ds->dataByKeyField(valueFieldName, keyFieldName, keyValue);
}
return QVariant();
}
QVariant DataSourceManager::variable(const QString &variableName)
{
if (m_userVariables.containsVariable(variableName))
@ -1403,6 +1412,17 @@ QStringList DataSourceManager::variableNames()
return m_reportVariables.variableNames();
}
QStringList DataSourceManager::variableNamesByRenderPass(RenderPass pass)
{
QStringList result;
foreach(QString variableName, m_reportVariables.variableNames()){
if (m_reportVariables.variablePass(variableName) == pass){
result.append(variableName);
}
}
return result;
}
QStringList DataSourceManager::namesOfUserVariables(){
return m_userVariables.variableNames();
}

View File

@ -126,6 +126,7 @@ public:
QVariant variable(const QString& variableName);
RenderPass variablePass(const QString& name);
QStringList variableNames();
QStringList variableNamesByRenderPass(RenderPass pass);
QStringList namesOfUserVariables();
VarDesc::VarType variableType(const QString& name);
bool variableIsSystem(const QString& name);
@ -161,6 +162,12 @@ public:
QStringList fieldNames(const QString& datasourceName);
bool containsField(const QString& fieldName);
QVariant fieldData(const QString& fieldName);
QVariant fieldDataByKey(
const QString& datasourceName,
const QString& valueFieldName,
const QString& keyFieldName,
QVariant keyValue
);
QString extractDataSource(const QString& fieldName);
QString extractFieldName(const QString& fieldName);

View File

@ -56,7 +56,6 @@ public:
virtual void clearUserVariables()=0;
virtual ICallbackDatasource* createCallbackDatasource(const QString& name) = 0;
virtual void registerDbCredentialsProvider(IDbCredentialsProvider* provider) = 0;
//virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0;
};
}

View File

@ -83,6 +83,7 @@ namespace Const{
const qreal SELECTION_OPACITY = 0.3;
const QString FIELD_RX = "\\$D\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^{}]*)\\s*\\}";
const QString NAMED_VARIABLE_RX = "\\$V\\s*\\{\\s*(%1)\\s*\\}";
const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}";
//const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
@ -108,7 +109,7 @@ namespace Const{
QVector<QString> normalizeCaptures(const QRegExp &reg);
enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
enum RenderPass {FirstPass, SecondPass};
enum RenderPass {FirstPass = 1, SecondPass = 2};
enum ArrangeType {AsNeeded, Force};
enum PreviewHint{ShowAllPreviewBars = 0,
HidePreviewToolBar = 1,

View File

@ -122,4 +122,14 @@ QMap<QString, QString> ContentItemDesignIntf::getStringForTranslation(){
return map;
}
bool ContentItemDesignIntf::isContentBackedUp() const
{
return m_contentBackedUp;
}
void ContentItemDesignIntf::setContentBackedUp(bool contentBackedUp)
{
m_contentBackedUp = contentBackedUp;
}
}// namespace LimeReport

View File

@ -61,6 +61,7 @@ private:
class Spacer :public ItemDesignIntf{
public:
Spacer(QObject* owner,QGraphicsItem* parent);
bool isEmpty() const {return true;}
protected:
BaseDesignIntf* createSameTypeItem(QObject *owner, QGraphicsItem *parent){
return new Spacer(owner, parent);
@ -72,10 +73,17 @@ class ContentItemDesignIntf : public ItemDesignIntf
Q_OBJECT
public:
ContentItemDesignIntf(const QString& xmlTypeName, QObject* owner = 0,QGraphicsItem* parent = 0)
:ItemDesignIntf(xmlTypeName,owner,parent){}
:ItemDesignIntf(xmlTypeName,owner,parent), m_contentBackedUp(false){}
virtual QString content() const = 0;
virtual void setContent(const QString& value) = 0;
QMap<QString, QString> getStringForTranslation();
void backupContent(){ m_contentBackUp = content(); m_contentBackedUp = true;}
void restoreContent() {setContent(m_contentBackUp);}
bool isContentBackedUp() const;
void setContentBackedUp(bool contentBackedUp);
private:
QString m_contentBackUp;
bool m_contentBackedUp;
};
class LayoutDesignIntf : public ItemDesignIntf{

View File

@ -331,7 +331,7 @@ void PageItemDesignIntf::initColumnsPos(QVector<qreal> &posByColumns, qreal pos,
}
}
bool PageItemDesignIntf::getIsTOC() const
bool PageItemDesignIntf::isTOC() const
{
return m_isTOC;
}

View File

@ -55,7 +55,7 @@ class PageItemDesignIntf : public LimeReport::ItemsContainerDesignInft
Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber)
Q_PROPERTY(bool isExtendedInDesignMode READ isExtendedInDesignMode WRITE setExtendedInDesignMode)
Q_PROPERTY(int extendedHeight READ extendedHeight WRITE setExtendedHeight)
Q_PROPERTY(bool pageIsTOC READ getIsTOC WRITE setIsTOC)
Q_PROPERTY(bool pageIsTOC READ isTOC WRITE setIsTOC)
friend class ReportRender;
public:
enum Orientation { Portrait, Landscape };
@ -127,7 +127,7 @@ public:
int extendedHeight() const;
void setExtendedHeight(int extendedHeight);
bool getIsTOC() const;
bool isTOC() const;
void setIsTOC(bool isTOC);
signals:
void beforeFirstPageRendered();

View File

@ -914,29 +914,35 @@ ReportPages ReportEnginePrivate::renderToPages()
emit renderStarted();
foreach(PageDesignIntf* page , m_pages){
if (!page->pageItem()->getIsTOC()){
if (!page->pageItem()->isTOC()){
page->setReportSettings(&m_reportSettings);
result.append(m_reportRender->renderPageToPages(page));
}
}
bool isFirst = true;
// m_reportRender->secondRenderPass(result);
foreach(PageDesignIntf* page , m_pages){
if (page->pageItem()->getIsTOC()){
for (int i=0; i<m_pages.count(); ++i){
PageDesignIntf* page = m_pages.at(i);
if (page->pageItem()->isTOC()){
page->setReportSettings(&m_reportSettings);
if (isFirst){
ReportPages pages = m_reportRender->renderPageToPages(page);
for (int i=0; i<pages.count(); ++i){
result.insert(i,pages.at(i));
if (i==0){
PageDesignIntf* secondPage = 0;
if (m_pages.count()>1) secondPage = m_pages.at(1);
ReportPages pages = m_reportRender->renderTOC(
page,
true,
secondPage && secondPage->pageItem()->resetPageNumber()
);
for (int j=0; j<pages.count(); ++j){
result.insert(j,pages.at(j));
}
}
else
} else {
result.append(m_reportRender->renderPageToPages(page));
}
}
isFirst = false;
}
m_reportRender->secondRenderPass(result);

View File

@ -148,7 +148,7 @@ void ReportRender::renameChildItems(BaseDesignIntf *item){
ReportRender::ReportRender(QObject *parent)
:QObject(parent), m_renderPageItem(0), m_pageCount(0),
m_lastDataBand(0), m_lastRenderedFooter(0), m_currentColumn(0)
m_lastDataBand(0), m_lastRenderedFooter(0), m_currentColumn(0), m_renderingFirstTOC(false)
{
initColumns();
}
@ -188,15 +188,24 @@ void ReportRender::initDatasource(const QString& name){
}
}
void ReportRender::renderPage(PageDesignIntf* patternPage)
void ReportRender::renderPage(PageDesignIntf* patternPage, bool isTOC, bool isFirst, bool resetPageNumbers)
{
m_curentNameIndex = 0;
m_patternPageItem = patternPage->pageItem();
m_renderingFirstTOC = isTOC && isFirst;
if (m_patternPageItem->resetPageNumber() && m_pageCount>0) {
if (m_patternPageItem->resetPageNumber() && m_pageCount>0 && !isTOC) {
resetPageNumber(PageReset);
}
if (m_renderingFirstTOC && resetPageNumbers){
PagesRange range;
range.firstPage = 0;
range.lastPage = 0;
m_ranges.insert(0,range);
m_pageCount = 0;
}
m_renderCanceled = false;
BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter);
m_reportFooterHeight = 0;
@ -238,6 +247,12 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
renderBand(tearOffBand, 0, StartNewPageAsNeeded);
savePage(true);
if (m_renderingFirstTOC && resetPageNumbers && m_ranges.count()>1){
m_ranges[1].firstPage = m_ranges.at(0).lastPage+1;
m_ranges[1].lastPage += m_ranges.at(0).lastPage+1;
}
#ifndef USE_QJSENGINE
ScriptEngineManager::instance().scriptEngine()->popContext();
#endif
@ -267,6 +282,11 @@ ReportPages ReportRender::renderPageToPages(PageDesignIntf *patternPage)
return m_renderedPages;
}
ReportPages ReportRender::renderTOC(PageDesignIntf* patternPage, bool first, bool resetPages){
renderPage(patternPage, true, first, resetPages);
return m_renderedPages;
}
void ReportRender::initRenderPage()
{
if (!m_renderPageItem) {
@ -1038,11 +1058,21 @@ void ReportRender::updateTOC(BaseDesignIntf* item, int pageNumber){
void ReportRender::secondRenderPass(ReportPages renderedPages)
{
if (!m_scriptEngineContext->tableOfContens()->isEmpty()){
for(int i=0; i<renderedPages.count(); ++i){
PageItemDesignIntf::Ptr page = renderedPages.at(i);
foreach(BaseDesignIntf* item, page->childBaseItems()){
updateTOC(item, findPageNumber(i));
}
}
}
for(int i=0; i<renderedPages.count(); ++i){
PageItemDesignIntf::Ptr page = renderedPages.at(i);
m_datasources->setReportVariable("#PAGE",findPageNumber(i));
m_datasources->setReportVariable("#PAGE_COUNT",findLastPageNumber(i));
foreach(BaseDesignIntf* item, page->childBaseItems()){
if (!m_scriptEngineContext->tableOfContens()->isEmpty()) updateTOC(item, i+1);
item->updateItemSize(m_datasources, SecondPass);
}
}
@ -1155,7 +1185,7 @@ void ReportRender::resetPageNumber(ResetPageNuberType resetType)
{
PagesRange range;
if (!m_ranges.isEmpty()){
m_ranges.last().lastPage = (resetType == BandReset)? m_pageCount : m_pageCount-1;
currentRange().lastPage = (resetType == BandReset)? m_pageCount : m_pageCount-1;
range.firstPage = m_pageCount+((resetType == BandReset)? 1 : 0);
} else {
range.firstPage = m_pageCount;
@ -1175,6 +1205,15 @@ int ReportRender::findLastPageNumber(int currentPage)
return 0;
}
int ReportRender::findPageNumber(int currentPage)
{
foreach (PagesRange range, m_ranges) {
if ( range.firstPage<= (currentPage) && range.lastPage>= (currentPage) )
return (currentPage - range.firstPage)+1;
}
return 0;
}
void ReportRender::cutGroups()
{
m_popupedExpression.clear();
@ -1302,13 +1341,13 @@ void ReportRender::savePage(bool isLast)
}
}
if (m_ranges.last().lastPage==0 && m_ranges.count()>1) {
if (currentRange(m_renderingFirstTOC).lastPage==0 && m_ranges.count()>1) {
m_datasources->setReportVariable("#PAGE",1);
} else {
m_datasources->setReportVariable("#PAGE",m_datasources->variable("#PAGE").toInt()+1);
}
m_ranges.last().lastPage = m_pageCount;
currentRange(m_renderingFirstTOC).lastPage = m_pageCount;
BandDesignIntf* pageFooter = m_renderPageItem->bandByType(BandDesignIntf::PageFooter);
if (pageFooter) pageFooter->setBandIndex(++m_currentIndex);

View File

@ -82,6 +82,7 @@ public:
PageItemDesignIntf::Ptr pageAt(int index);
QString renderPageToString(PageDesignIntf *patternPage);
ReportPages renderPageToPages(PageDesignIntf *patternPage);
ReportPages renderTOC(PageDesignIntf* patternPage, bool first, bool resetPages);
void secondRenderPass(ReportPages renderedPages);
signals:
void pageRendered(int renderedPageCount);
@ -95,7 +96,7 @@ private:
void initGroups();
void clearPageMap();
void renderPage(PageDesignIntf *patternPage);
void renderPage(PageDesignIntf *patternPage, bool isTOC = false, bool isFirst = false, bool resetPageNumbers = false);
BandDesignIntf* renderBand(BandDesignIntf *patternBand, BandDesignIntf *bandData, DataRenderMode mode = NotStartNewPage, bool isLast = false);
void renderDataBand(BandDesignIntf* dataBand);
void renderPageHeader(PageItemDesignIntf* patternPage);
@ -147,6 +148,7 @@ private:
void startNewPage(bool isFirst = false);
void resetPageNumber(ResetPageNuberType resetType);
int findLastPageNumber(int currentPage);
int findPageNumber(int currentPage);
void savePage(bool isLast = false);
QString toString();
void initColumns();
@ -159,6 +161,7 @@ private:
void renameChildItems(BaseDesignIntf *item);
void renderGroupFooterByHeader(BandDesignIntf *groupHeader);
void updateTOC(BaseDesignIntf* item, int pageNumber);
PagesRange& currentRange(bool isTOC = false){ return (isTOC) ? m_ranges.first(): m_ranges.last();}
private:
DataSourceManager* m_datasources;
ScriptEngineContext* m_scriptEngineContext;
@ -188,9 +191,7 @@ private:
QList<PagesRange> m_ranges;
QVector<BandDesignIntf*> m_columnedBandItems;
unsigned long long m_curentNameIndex;
bool m_renderingFirstTOC;
};
} // namespace LimeReport
#endif // LRREPORTRENDER_H

View File

@ -364,21 +364,21 @@ QString ScriptEngineManager::expandUserVariables(QString context, RenderPass pas
pos += rx.matchedLength();
if (dataManager()->containsVariable(variable) ){
try {
if (pass==dataManager()->variablePass(variable)){
varValue = dataManager()->variable(variable);
switch (expandType){
case EscapeSymbols:
context.replace(rx.cap(0),escapeSimbols(varValue.toString()));
break;
case NoEscapeSymbols:
context.replace(rx.cap(0),varValue.toString());
break;
case ReplaceHTMLSymbols:
context.replace(rx.cap(0),replaceHTMLSymbols(varValue.toString()));
break;
}
pos=0;
varValue = dataManager()->variable(variable);
switch (expandType){
case EscapeSymbols:
context.replace(rx.cap(0),escapeSimbols(varValue.toString()));
break;
case NoEscapeSymbols:
context.replace(rx.cap(0),varValue.toString());
break;
case ReplaceHTMLSymbols:
context.replace(rx.cap(0),replaceHTMLSymbols(varValue.toString()));
break;
}
pos=0;
} catch (ReportError e){
dataManager()->putError(e.what());
if (!dataManager()->reportSettings() || dataManager()->reportSettings()->suppressAbsentFieldsAndVarsWarnings())
@ -540,12 +540,12 @@ QVariant ScriptEngineManager::evaluateScript(const QString& script){
return QVariant();
}
void ScriptEngineManager::addTableOfContensItem(const QString& uniqKey, const QString& content, int pageNumber, int indent)
void ScriptEngineManager::addTableOfContensItem(const QString& uniqKey, const QString& content, int indent)
{
Q_ASSERT(m_context != 0);
if (m_context){
BandDesignIntf* currentBand = m_context->getCurrentBand();
m_context->tableOfContens()->setItem(uniqKey, content, pageNumber, indent);
m_context->tableOfContens()->setItem(uniqKey, content, 0, indent);
if (currentBand)
currentBand->addBookmark(uniqKey, content);
}
@ -764,6 +764,25 @@ bool ScriptEngineManager::createGetFieldFunction()
return addFunction(fd);
}
bool ScriptEngineManager::createGetFieldByKeyFunction()
{
JSFunctionDesc fd;
fd.setManager(m_functionManager);
fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME);
fd.setCategory(tr("GENERAL"));
fd.setName("getFieldByKeyField");
fd.setDescription("getFieldByKeyField(\""+tr("Datasource")+"\", \""+
tr("ValueField")+"\",\""+
tr("KeyField")+"\", \""+
tr("KeyFieldValue")+"\")"
);
fd.setScriptWrapper(QString("function getFieldByKeyField(datasource, valueFieldName, keyFieldName, keyValue){"
"return %1.getFieldByKeyField(datasource, valueFieldName, keyFieldName, keyValue);}"
).arg(LimeReport::Const::FUNCTION_MANAGER_NAME)
);
return addFunction(fd);
}
bool ScriptEngineManager::createAddTableOfContensItemFunction()
{
JSFunctionDesc fd;
@ -771,9 +790,9 @@ bool ScriptEngineManager::createAddTableOfContensItemFunction()
fd.setManagerName(LimeReport::Const::FUNCTION_MANAGER_NAME);
fd.setCategory(tr("GENERAL"));
fd.setName("addTableOfContensItem");
fd.setDescription("addTableOfContensItem(\""+tr("Unique identifier")+" \""+tr("Content")+"\", \""+tr("Page Number")+", \""+tr("Indent")+"\")");
fd.setScriptWrapper(QString("function addTableOfContensItem(uniqKey, content, pageNumber, indent){"
"return %1.addTableOfContensItem(uniqKey, content, pageNumber, indent);}"
fd.setDescription("addTableOfContensItem(\""+tr("Unique identifier")+" \""+tr("Content")+"\", \""+tr("Indent")+"\")");
fd.setScriptWrapper(QString("function addTableOfContensItem(uniqKey, content, indent){"
"return %1.addTableOfContensItem(uniqKey, content, indent);}"
).arg(LimeReport::Const::FUNCTION_MANAGER_NAME)
);
return addFunction(fd);
@ -814,6 +833,7 @@ ScriptEngineManager::ScriptEngineManager()
#endif
createSetVariableFunction();
createGetFieldFunction();
createGetFieldByKeyFunction();
createGetVariableFunction();
#ifndef USE_QJSENGINE
QScriptValue colorCtor = m_scriptEngine->newFunction(constructColor);
@ -1466,9 +1486,15 @@ QVariant ScriptFunctionsManager::getField(const QString &field)
return dm->fieldData(field);
}
void ScriptFunctionsManager::addTableOfContensItem(const QString& uniqKey, const QString& content, int pageNumber, int indent)
QVariant ScriptFunctionsManager::getFieldByKeyField(const QString& datasourceName, const QString& valueFieldName, const QString& keyFieldName, QVariant keyValue)
{
scriptEngineManager()->addTableOfContensItem(uniqKey, content, pageNumber, indent);
DataSourceManager* dm = scriptEngineManager()->dataManager();
return dm->fieldDataByKey(datasourceName, valueFieldName, keyFieldName, keyValue);
}
void ScriptFunctionsManager::addTableOfContensItem(const QString& uniqKey, const QString& content, int indent)
{
scriptEngineManager()->addTableOfContensItem(uniqKey, content, indent);
}
void ScriptFunctionsManager::clearTableOfContens()
@ -1532,6 +1558,7 @@ void TableOfContens::setItem(const QString& uniqKey, const QString& content, int
item->content = content;
item->pageNumber = pageNumber;
item->indent = indent;
item->uniqKey = uniqKey;
m_tableOfContens.append(item);
m_hash.insert(uniqKey, item);
}
@ -1541,7 +1568,7 @@ void TableOfContens::setItem(const QString& uniqKey, const QString& content, int
void TableOfContens::slotOneSlotDS(CallbackInfo info, QVariant& data)
{
QStringList columns;
columns << "Content" << "Page number";
columns << "Content" << "Page number" << "Content Key";
switch (info.dataType) {
case LimeReport::CallbackInfo::RowCount:
@ -1557,9 +1584,11 @@ void TableOfContens::slotOneSlotDS(CallbackInfo info, QVariant& data)
case LimeReport::CallbackInfo::ColumnData:
if (info.index < m_tableOfContens.count()){
ContentItem* item = m_tableOfContens.at(info.index);
if (info.columnName == "Content")
if (info.columnName.compare("Content",Qt::CaseInsensitive) == 0)
data = item->content.rightJustified(item->indent+item->content.size());
else
if (info.columnName.compare("Content Key",Qt::CaseInsensitive) == 0)
data = item->uniqKey;
if (info.columnName.compare("Page number",Qt::CaseInsensitive) == 0)
data = QString::number(item->pageNumber);
}
break;

View File

@ -63,6 +63,7 @@ struct ContentItem {
QString content;
int indent;
int pageNumber;
QString uniqKey;
};
class TableOfContens : public QObject{
@ -278,8 +279,9 @@ public:
Q_INVOKABLE void setVariable(const QString& name, QVariant value);
Q_INVOKABLE QVariant getVariable(const QString& name);
Q_INVOKABLE QVariant getField(const QString& field);
Q_INVOKABLE QVariant getFieldByKeyField(const QString& datasourceName, const QString& valueFieldName, const QString& keyFieldName, QVariant keyValue);
Q_INVOKABLE QVariant color(const QString& color){ return QColor(color);}
Q_INVOKABLE void addTableOfContensItem(const QString& uniqKey, const QString& content, int pageNumber, int indent = 0);
Q_INVOKABLE void addTableOfContensItem(const QString& uniqKey, const QString& content, int indent = 0);
Q_INVOKABLE void clearTableOfContens();
#ifdef USE_QJSENGINE
Q_INVOKABLE QFont font(const QString& family, int pointSize = -1, bool bold = false, bool italic = false, bool underLine = false);
@ -320,7 +322,7 @@ public:
QString expandDataFields(QString context, ExpandType expandType, QVariant &varValue, QObject* reportItem);
QString expandScripts(QString context, QVariant &varValue, QObject* reportItem);
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 indent);
void clearTableOfContens();
protected:
@ -340,6 +342,7 @@ private:
bool createSetVariableFunction();
bool createGetVariableFunction();
bool createGetFieldFunction();
bool createGetFieldByKeyFunction();
bool createAddTableOfContensItemFunction();
bool createClearTableOfContensFunction();
private: