summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/filter/xml/xmlExport.cxx14
-rw-r--r--reportdesign/source/filter/xml/xmlGroup.cxx10
2 files changed, 17 insertions, 7 deletions
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index 588b8c4a0e61..a4032b35f073 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -1587,6 +1587,7 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG
uno::Reference< XFunction> xFunction = xFunctions->createFunction();
::rtl::OUString sFunction,sPrefix,sPostfix;
::rtl::OUString sExpression = xGroup->getExpression();
+ ::rtl::OUString sFunctionName;
switch(nGroupOn)
{
case report::GroupOn::PREFIX_CHARACTERS:
@@ -1597,8 +1598,9 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG
sFunction = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YEAR"));
break;
case report::GroupOn::QUARTAL:
- sFunction = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MONTH"));
- sPostfix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/4"));
+ sFunction = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INT((MONTH"));
+ sPostfix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-1)/3)+1"));
+ sFunctionName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("QUARTAL_")) + sExpression;
break;
case report::GroupOn::MONTH:
sFunction = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MONTH"));
@@ -1626,15 +1628,21 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG
exportFunction(xCountFunction);
sExpression = sCountName;
sPrefix = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" / ")) + ::rtl::OUString::valueOf(xGroup->getGroupInterval());
+ sFunctionName = sFunction + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_")) + sExpression;
}
break;
default:
;
}
+ if ( !sFunctionName.getLength() )
+ sFunctionName = sFunction + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_")) + sExpression;
if ( sFunction.getLength() )
{
+ sal_Unicode pReplaceChars[] = { '(',')',';',',','+','-','[',']','/','*'};
+ for(sal_Int32 i= 0; i < sizeof(pReplaceChars)/sizeof(pReplaceChars[0]);++i)
+ sFunctionName = sFunctionName.replace(pReplaceChars[i],'_');
- xFunction->setName(sFunction + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_")) + sExpression);
+ xFunction->setName(sFunctionName);
sFunction = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:")) + sFunction;
sFunction += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("(["));
sFunction += sExpression;
diff --git a/reportdesign/source/filter/xml/xmlGroup.cxx b/reportdesign/source/filter/xml/xmlGroup.cxx
index 383cc88336ca..195b41aaa3c0 100644
--- a/reportdesign/source/filter/xml/xmlGroup.cxx
+++ b/reportdesign/source/filter/xml/xmlGroup.cxx
@@ -140,10 +140,12 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport
nGroupOn = report::GroupOn::YEAR;
else if ( sFormula ==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:MONTH")))
{
- if ( sCompleteFormula.endsWithIgnoreAsciiCaseAsciiL("\4",2) )
- nGroupOn = report::GroupOn::QUARTAL;
- else
- nGroupOn = report::GroupOn::MONTH;
+ nGroupOn = report::GroupOn::MONTH;
+ }
+ else if ( sCompleteFormula.matchAsciiL("rpt:INT((MONTH",sizeof("rpt:INT((MONTH"),0)
+ && sCompleteFormula.endsWithIgnoreAsciiCaseAsciiL("-1)/3)+1",sizeof("-1)/3)+1")) )
+ {
+ nGroupOn = report::GroupOn::QUARTAL;
}
else if ( sFormula ==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:WEEK")))
nGroupOn = report::GroupOn::WEEK;