summaryrefslogtreecommitdiff
path: root/reportdesign/source/filter/xml
diff options
context:
space:
mode:
Diffstat (limited to 'reportdesign/source/filter/xml')
-rw-r--r--reportdesign/source/filter/xml/xmlExport.cxx87
-rw-r--r--reportdesign/source/filter/xml/xmlExport.hxx2
-rw-r--r--reportdesign/source/filter/xml/xmlGroup.cxx10
3 files changed, 17 insertions, 82 deletions
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index b0012e731c81..aff63a9eb6f8 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -172,40 +172,6 @@ namespace rptxml
}
//---------------------------------------------------------------------
- ::rtl::OUString lcl_implGetPropertyXMLType(const Type& _rType)
- {
- // possible types we can write (either because we recognize them directly or because we convert _rValue
- // into one of these types)
- static const ::rtl::OUString s_sTypeBoolean (RTL_CONSTASCII_USTRINGPARAM("boolean"));
- static const ::rtl::OUString s_sTypeShort (RTL_CONSTASCII_USTRINGPARAM("short"));
- static const ::rtl::OUString s_sTypeInteger (RTL_CONSTASCII_USTRINGPARAM("int"));
- static const ::rtl::OUString s_sTypeLong (RTL_CONSTASCII_USTRINGPARAM("long"));
- static const ::rtl::OUString s_sTypeDouble (RTL_CONSTASCII_USTRINGPARAM("double"));
- static const ::rtl::OUString s_sTypeString (RTL_CONSTASCII_USTRINGPARAM("string"));
-
- // handle the type description
- switch (_rType.getTypeClass())
- {
- case TypeClass_STRING:
- return s_sTypeString;
- case TypeClass_DOUBLE:
- return s_sTypeDouble;
- case TypeClass_BOOLEAN:
- return s_sTypeBoolean;
- case TypeClass_BYTE:
- case TypeClass_SHORT:
- return s_sTypeShort;
- case TypeClass_LONG:
- return s_sTypeInteger;
- case TypeClass_HYPER:
- return s_sTypeLong;
- case TypeClass_ENUM:
- return s_sTypeInteger;
-
- default:
- return s_sTypeDouble;
- }
- }
class OSpecialHanldeXMLExportPropertyMapper : public SvXMLExportPropertyMapper
{
@@ -1486,45 +1452,6 @@ sal_uInt32 ORptExport::exportDoc(enum ::xmloff::token::XMLTokenEnum eClass)
return aBuffer.makeStringAndClear();
}
// -----------------------------------------------------------------------------
-::rtl::OUString ORptExport::implConvertMeasure(sal_Int32 _nValue)
-{
- ::rtl::OUStringBuffer aBuffer;
- GetMM100UnitConverter().convertMeasure(aBuffer, _nValue);
- return aBuffer.makeStringAndClear();
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString ORptExport::implConvertAny(const Any& _rValue)
-{
- ::rtl::OUStringBuffer aBuffer;
- switch (_rValue.getValueTypeClass())
- {
- case TypeClass_STRING:
- { // extract the string
- ::rtl::OUString sCurrentValue;
- _rValue >>= sCurrentValue;
- aBuffer.append(sCurrentValue);
- }
- break;
- case TypeClass_DOUBLE:
- // let the unit converter format is as string
- GetMM100UnitConverter().convertDouble(aBuffer, getDouble(_rValue));
- break;
- case TypeClass_BOOLEAN:
- aBuffer = getBOOL(_rValue) ? ::xmloff::token::GetXMLToken(XML_TRUE) : ::xmloff::token::GetXMLToken(XML_FALSE);
- break;
- case TypeClass_BYTE:
- case TypeClass_SHORT:
- case TypeClass_LONG:
- // let the unit converter format is as string
- GetMM100UnitConverter().convertNumber(aBuffer, getINT32(_rValue));
- break;
- default:
- OSL_ENSURE(0,"ORptExport::implConvertAny: Invalid type");
- }
-
- return aBuffer.makeStringAndClear();
-}
-// -----------------------------------------------------------------------------
UniReference < XMLPropertySetMapper > ORptExport::GetCellStylePropertyMapper() const
{
return m_xCellStylesPropertySetMapper;
@@ -1660,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:
@@ -1670,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"));
@@ -1699,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_uInt32 j= 0; j < sizeof(pReplaceChars)/sizeof(pReplaceChars[0]);++j)
+ sFunctionName = sFunctionName.replace(pReplaceChars[j],'_');
- 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/xmlExport.hxx b/reportdesign/source/filter/xml/xmlExport.hxx
index 3b8e621b52ae..3bd478b60ba8 100644
--- a/reportdesign/source/filter/xml/xmlExport.hxx
+++ b/reportdesign/source/filter/xml/xmlExport.hxx
@@ -177,9 +177,7 @@ private:
void exportGroupsExpressionAsFunction(const Reference< XGroups>& _xGroups);
::rtl::OUString convertFormula(const ::rtl::OUString& _sFormula);
- ::rtl::OUString implConvertAny(const Any& _rValue);
::rtl::OUString implConvertNumber(sal_Int32 _nValue);
- ::rtl::OUString implConvertMeasure(sal_Int32 _nValue);
private:
ORptExport();
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;