Tag: cws_src680_rpt23fix01
User: oj      
Date: 2007-07-12 12:59:59+0000
Modified:
   dba/reportdesign/source/core/api/Function.cxx
   dba/reportdesign/source/core/resource/strings.src
   dba/reportdesign/source/filter/xml/xmlExport.cxx
   dba/reportdesign/source/filter/xml/xmlExport.hxx
   dba/reportdesign/source/filter/xml/xmlFunction.cxx
   dba/reportdesign/source/filter/xml/xmlFunction.hxx
   dba/reportdesign/source/filter/xml/xmlGroup.cxx
   dba/reportdesign/source/filter/xml/xmlReport.cxx
   dba/reportdesign/source/filter/xml/xmlReport.hxx
   dba/reportdesign/source/filter/xml/xmlfilter.cxx
   dba/reportdesign/source/filter/xml/xmlfilter.hxx

Log:
 #i77832# #i77146# impl group on and interval

File Changes:

Directory: /dba/reportdesign/source/core/api/
=============================================

File [changed]: Function.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/core/api/Function.cxx?r1=1.2&r2=1.2.2.1
Delta lines:  +3 -3
-------------------
--- Function.cxx        2007-07-09 11:56:14+0000        1.2
+++ Function.cxx        2007-07-12 12:59:56+0000        1.2.2.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: Function.cxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.2.2.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/09 11:56:14 $
+ *  last change: $Author: oj $ $Date: 2007/07/12 12:59:56 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -181,7 +181,7 @@
 
 void SAL_CALL OFunction::setDeepTraversing(::sal_Bool the_value) throw 
(uno::RuntimeException)
 {
-    set(PROPERTY_DEEPTRAVERSING,the_value,m_bPreEvaluated);
+    set(PROPERTY_DEEPTRAVERSING,the_value,m_bDeepTraversing);
 }
 // 
-----------------------------------------------------------------------------
 

Directory: /dba/reportdesign/source/core/resource/
==================================================

File [changed]: strings.src
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/core/resource/strings.src?r1=1.2&r2=1.2.2.1
Delta lines:  +6 -13
--------------------
--- strings.src 2007-07-09 11:56:16+0000        1.2
+++ strings.src 2007-07-12 12:59:56+0000        1.2.2.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: strings.src,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.2.2.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/09 11:56:16 $
+ *  last change: $Author: oj $ $Date: 2007/07/12 12:59:56 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -84,36 +84,29 @@
 };
 String RID_STR_ARGUMENT_IS_NULL
 {
-       Text [ de ] = "Das Element ist ungültig.";
        Text [ en-US ] = "The element is invalid.";
 };
 String RID_STR_FIXEDTEXT
 {
-       Text [ de ] = "LabelField";
-       Text [ en-US ] = "LabelField";
+       Text [ en-US ] = "Label field" ;
 };
 String RID_STR_FORMATTEDFIELD
 {
-       Text [ de ] = "FormattedField";
-       Text [ en-US ] = "FormattedField";
+       Text [ en-US ] = "Formatted field";
 };
 String RID_STR_IMAGECONTROL
 {
-       Text [ de ] = "ImageControl";
-       Text [ en-US ] = "ImageControl";
+       Text [ en-US ] = "Image control" ;
 };
 String RID_STR_REPORT
 {
-       Text [ de ] = "Report";
        Text [ en-US ] = "Report";
 };
 String RID_STR_SHAPE
 {
-       Text [ de ] = "Shape";
        Text [ en-US ] = "Shape";
 };
 String RID_STR_FIXEDLINE
 {
-       Text [ de ] = "FixedLine";
-       Text [ en-US ] = "FixedLine";
+       Text [ en-US ] = "Fixed line";
 };

Directory: /dba/reportdesign/source/filter/xml/
===============================================

File [changed]: xmlExport.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlExport.cxx?r1=1.2.2.2&r2=1.2.2.3
Delta lines:  +108 -16
----------------------
--- xmlExport.cxx       2007-07-11 10:31:00+0000        1.2.2.2
+++ xmlExport.cxx       2007-07-12 12:59:56+0000        1.2.2.3
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: xmlExport.cxx,v $
  *
- *  $Revision: 1.2.2.2 $
+ *  $Revision: 1.2.2.3 $
  *
- *  last change: $Author: oj $ $Date: 2007/07/11 10:31:00 $
+ *  last change: $Author: oj $ $Date: 2007/07/12 12:59:56 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -90,6 +90,7 @@
 #include <com/sun/star/util/NumberFormat.hpp>
 #include <com/sun/star/style/ParagraphAdjust.hpp>
 #include <com/sun/star/awt/TextAlign.hpp>
+#include <com/sun/star/report/GroupOn.hpp>
 #ifndef _COM_SUN_STAR_REPORT_XFIXEDTEXT_HPP_
 #include <com/sun/star/report/XFixedText.hpp>
 #endif
@@ -420,19 +421,23 @@
     {
         uno::Reference< report::XFunction> 
xFunction(_xFunctions->getByIndex(i),uno::UNO_QUERY_THROW);
         OSL_ENSURE(xFunction.is(),"Function object is NULL!");
-
-        exportFormula(XML_FORMULA,xFunction->getFormula());
-        beans::Optional< ::rtl::OUString> aInitial = 
xFunction->getInitialFormula();
-        if ( aInitial.IsPresent )
+        exportFunction(xFunction);
+    }
+}
+// 
-----------------------------------------------------------------------------
+void ORptExport::exportFunction(const uno::Reference< XFunction>& _xFunction)
+{
+    exportFormula(XML_FORMULA,_xFunction->getFormula());
+    beans::Optional< ::rtl::OUString> aInitial = 
_xFunction->getInitialFormula();
+    if ( aInitial.IsPresent && aInitial.Value.getLength() )
             exportFormula(XML_INITIAL_FORMULA ,aInitial.Value );
-        AddAttribute( XML_NAMESPACE_REPORT, XML_NAME , xFunction->getName() );
-        if ( xFunction->getPreEvaluated() )
+    AddAttribute( XML_NAMESPACE_REPORT, XML_NAME , _xFunction->getName() );
+    if ( _xFunction->getPreEvaluated() )
             AddAttribute( XML_NAMESPACE_REPORT, XML_PRE_EVALUATED , XML_TRUE );
-        if ( xFunction->getDeepTraversing() )
+    if ( _xFunction->getDeepTraversing() )
             AddAttribute( XML_NAMESPACE_REPORT, XML_DEEP_TRAVERSING , XML_TRUE 
);
 
         SvXMLElementExport aFunction(*this,XML_NAMESPACE_REPORT, XML_FUNCTION, 
sal_True, sal_True);
-    }
 }
 // 
-----------------------------------------------------------------------------
 void ORptExport::exportMasterDetailFields(const Reference<XReportDefinition>& 
_xReportDefinition)
@@ -463,6 +468,7 @@
        if ( _xReportDefinition.is() )
        {
         exportFunctions(_xReportDefinition->getFunctions().get());
+        exportGroupsExpressionAsFunction(_xReportDefinition->getGroups());
                
                if ( _xReportDefinition->getReportHeaderOn() )
                {
@@ -1233,9 +1239,13 @@
                     ::rtl::OUString sExpression = xGroup->getExpression();
                     if ( sExpression.getLength() )
                     {
-                        ::rtl::OUString 
sFormula(RTL_CONSTASCII_USTRINGPARAM("rpt:HASCHANGED("));
+                        ::rtl::OUString 
sFormula(RTL_CONSTASCII_USTRINGPARAM("rpt:HASCHANGED(\""));
+
+                        TGroupFunctionMap::iterator aGroupFind = 
m_aGroupFunctionMap.find(xGroup);
+                        if ( aGroupFind != m_aGroupFunctionMap.end() )
+                            sExpression = aGroupFind->second->getName();
                         sFormula += sExpression;
-                        sFormula += 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
+                        sFormula += 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\")"));
                         sExpression = sFormula;
                     }
                                        AddAttribute(XML_NAMESPACE_REPORT, 
XML_GROUP_EXPRESSION,sExpression);
@@ -1668,6 +1678,88 @@
         }
     }
 }
+// 
-----------------------------------------------------------------------------
+void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& 
_xGroups)
+{
+    if ( _xGroups.is() )
+       {
+        uno::Reference< XFunctions> xFunctions = 
_xGroups->getReportDefinition()->getFunctions();
+               const sal_Int32 nCount = _xGroups->getCount();
+        for (sal_Int32 i = 0; i < nCount; ++i)
+        {
+            uno::Reference< XGroup> 
xGroup(_xGroups->getByIndex(i),uno::UNO_QUERY_THROW);
+            const ::sal_Int16 nGroupOn = xGroup->getGroupOn();
+            if ( nGroupOn != report::GroupOn::DEFAULT )
+            {
+                uno::Reference< XFunction> xFunction = 
xFunctions->createFunction();
+                ::rtl::OUString sFunction,sPrefix,sPostfix;
+                ::rtl::OUString sExpression = xGroup->getExpression();
+                switch(nGroupOn)
+                   {
+                           case report::GroupOn::PREFIX_CHARACTERS:
+                                   sFunction = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LEFT"));
+                        sPrefix = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";")) + 
::rtl::OUString::valueOf(xGroup->getGroupInterval());
+                                   break;
+                           case report::GroupOn::YEAR:
+                        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"));
+                                   break;
+                           case report::GroupOn::MONTH:
+                                   sFunction = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MONTH"));
+                                   break;
+                           case report::GroupOn::WEEK:
+                                   sFunction = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WEEK"));
+                                   break;
+                           case report::GroupOn::DAY:
+                                   sFunction = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DAY"));
+                                   break;
+                           case report::GroupOn::HOUR:
+                                   sFunction = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HOUR"));
+                                   break;
+                           case report::GroupOn::MINUTE:
+                                   sFunction = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MINUTE"));
+                                   break;
+                           case report::GroupOn::INTERVAL:
+                        {
+                            sFunction = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INT"));
+                            uno::Reference< XFunction> xCountFunction = 
xFunctions->createFunction();
+                            xCountFunction->setInitialFormula(beans::Optional< 
::rtl::OUString>(sal_True,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:1"))));
+                            ::rtl::OUString sCountName = sFunction + 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_count_")) + sExpression;
+                            xCountFunction->setName(sCountName);
+                            
xCountFunction->setFormula(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:["))
 + sCountName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("] + 1")));
+                            exportFunction(xCountFunction);
+                            sExpression = sCountName;
+                            sPrefix = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" / ")) + 
::rtl::OUString::valueOf(xGroup->getGroupInterval());
+                        }
+                                   break;
+                           default:
+                        ;
+                   }
+                if ( sFunction.getLength() )
+                {
+                    
+                    xFunction->setName(sFunction + 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_")) + sExpression);
+                    sFunction = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:")) + sFunction;
+                    sFunction += 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("(["));
+                    sFunction += sExpression;
+                    sFunction += 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("]"));
+    
+                    if ( sPrefix.getLength() )
+                        sFunction += sPrefix;
+                    sFunction += 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
+                    if ( sPostfix.getLength() )
+                        sFunction += sPostfix;
+                    xFunction->setFormula(sFunction);
+                    exportFunction(xFunction);
+                    
m_aGroupFunctionMap.insert(TGroupFunctionMap::value_type(xGroup,xFunction));
+                }
+            }
+        }
+    }
+}
 
 // 
-----------------------------------------------------------------------------
 }// rptxml

File [changed]: xmlExport.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlExport.hxx?r1=1.2&r2=1.2.2.1
Delta lines:  +7 -3
-------------------
--- xmlExport.hxx       2007-07-09 11:56:17+0000        1.2
+++ xmlExport.hxx       2007-07-12 12:59:57+0000        1.2.2.1
@@ -6,9 +6,9 @@
  *
  *  $RCSfile: xmlExport.hxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.2.2.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/09 11:56:17 $
+ *  last change: $Author: oj $ $Date: 2007/07/12 12:59:57 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -174,6 +174,7 @@
     typedef ::std::vector< TCell >                                  TRow;
     typedef ::std::vector< ::std::pair< sal_Bool, TRow > >          TGrid;
     typedef ::std::map< Reference<XPropertySet> ,TGrid >            
TSectionsGrid;
+    typedef ::std::map< Reference<XGroup> ,Reference<XFunction> >   
TGroupFunctionMap;
 private:
        ::std::auto_ptr< TStringPair >                                  
m_aAutoIncrement;
        ::std::auto_ptr< TDelimiter >                                   
m_aDelimiter;
@@ -183,6 +184,7 @@
        TPropertyStyleMap                                                       
        m_aAutoStyleNames;
     TGridStyleMap                                   m_aColumnStyleNames;
     TGridStyleMap                                   m_aRowStyleNames;
+    TGroupFunctionMap                               m_aGroupFunctionMap;    
     
        ::rtl::OUString                                                         
        m_sCharSet;
     ::rtl::OUString                                 m_sTableStyle;
@@ -206,6 +208,7 @@
 
        void                                    exportReport(const 
Reference<XReportDefinition>& _xReportDefinition); /// <element 
name="office:report">
     void                                       exportFunctions(const 
Reference<XIndexAccess>& _xFunctions); /// <ref name="rpt-function"/>
+    void                    exportFunction(const Reference< XFunction>& 
_xFunction);
     void                                       exportMasterDetailFields(const 
Reference<XReportDefinition>& _xReportDefinition);
        void                                    exportComponent(const 
Reference<XReportComponent>& _xReportComponent);
        void                                    exportImagePosition(sal_Int16 
_nImagePosition);
@@ -225,6 +228,7 @@
     void                    collectStyleNames(sal_Int32 _nFamily,const 
::std::vector< sal_Int32>& _aSize, ORptExport::TStringVec& _rStyleNames);
     void                    exportParagraph(const Reference< 
XReportControlModel >& _xReportElement);
     bool                   exportFormula(enum ::xmloff::token::XMLTokenEnum 
eName,const ::rtl::OUString& _sFormula);
+    void                    exportGroupsExpressionAsFunction(const Reference< 
XGroups>& _xGroups);
     ::rtl::OUString         convertFormula(const ::rtl::OUString& _sFormula);
 
        ::rtl::OUString                 implConvertAny(const Any& _rValue);

File [changed]: xmlFunction.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlFunction.cxx?r1=1.2&r2=1.2.2.1
Delta lines:  +21 -10
---------------------
--- xmlFunction.cxx     2007-07-09 11:56:17+0000        1.2
+++ xmlFunction.cxx     2007-07-12 12:59:57+0000        1.2.2.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: xmlFunction.cxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.2.2.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/09 11:56:17 $
+ *  last change: $Author: oj $ $Date: 2007/07/12 12:59:57 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -75,9 +75,11 @@
                                ,const OUString& _sLocalName
                                ,const Reference< XAttributeList > & _xAttrList 
                 ,const Reference< XFunctionsSupplier >&        _xFunctions
+                ,bool _bAddToReport
                                ) :
        SvXMLImportContext( _rImport, nPrfx, _sLocalName )
     ,m_xFunctions(_xFunctions->getFunctions())
+    ,m_bAddToReport(_bAddToReport)
 {
     DBG_CTOR( rpt_OXMLFunction,NULL);
 
@@ -112,6 +114,7 @@
                                        m_xFunction->setPreEvaluated(sValue == 
s_sTRUE);
                                        break;
                 case XML_TOK_INITIAL_FORMULA:
+                    if ( sValue.getLength() )
                                        
m_xFunction->setInitialFormula(beans::Optional< 
::rtl::OUString>(sal_True,ORptFilter::convertFormula(sValue)));
                                        break;
                 case XML_TOK_DEEP_TRAVERSING:
@@ -141,6 +144,13 @@
 // 
-----------------------------------------------------------------------------
 void OXMLFunction::EndElement()
 {
+    if ( m_bAddToReport )
+    {
+        GetOwnImport().insertFunction(m_xFunction);
+        m_xFunction.clear();
+    }
+    else
+    {
        try
        {
                
m_xFunctions->insertByIndex(m_xFunctions->getCount(),uno::makeAny(m_xFunction));
@@ -149,6 +159,7 @@
        {
                OSL_ENSURE(0,"Exception catched!");
        }
+    }
 }
 // 
-----------------------------------------------------------------------------
 //----------------------------------------------------------------------------

File [changed]: xmlFunction.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlFunction.hxx?r1=1.2&r2=1.2.2.1
Delta lines:  +4 -2
-------------------
--- xmlFunction.hxx     2007-07-09 11:56:17+0000        1.2
+++ xmlFunction.hxx     2007-07-12 12:59:57+0000        1.2.2.1
@@ -6,9 +6,9 @@
  *
  *  $RCSfile: xmlFunction.hxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.2.2.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/09 11:56:17 $
+ *  last change: $Author: oj $ $Date: 2007/07/12 12:59:57 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -57,6 +57,7 @@
        protected:
                ::com::sun::star::uno::Reference< 
::com::sun::star::report::XFunctions >        m_xFunctions;
         ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunction 
>            m_xFunction;
+        bool                                                                   
     m_bAddToReport;
        
                ORptFilter& GetOwnImport();
 
@@ -69,6 +70,7 @@
                                        ,const ::rtl::OUString& rLName
                                        ,const 
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > 
& xAttrList
                     ,const ::com::sun::star::uno::Reference< 
::com::sun::star::report::XFunctionsSupplier >&   _xFunctions
+                    ,bool _bAddToReport = false
                                        );
                virtual ~OXMLFunction();
 

File [changed]: xmlGroup.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlGroup.cxx?r1=1.2&r2=1.2.2.1
Delta lines:  +59 -3
--------------------
--- xmlGroup.cxx        2007-07-09 11:56:17+0000        1.2
+++ xmlGroup.cxx        2007-07-12 12:59:57+0000        1.2.2.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: xmlGroup.cxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.2.2.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/09 11:56:17 $
+ *  last change: $Author: oj $ $Date: 2007/07/12 12:59:57 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -151,6 +151,62 @@
                                 --nLen;
                             }
                             sValue = sValue.copy(nPos,nLen-nPos-1);
+                            const ORptFilter::TGroupFunctionMap& aFunctions = 
_rImport.getFunctions();
+                            ORptFilter::TGroupFunctionMap::const_iterator 
aFind = aFunctions.find(sValue);
+                            if ( aFind != aFunctions.end() )
+                            {
+                                sal_Int32 nIndex = 0;
+                                const ::rtl::OUString sCompleteFormula = 
aFind->second->getFormula();
+                                ::rtl::OUString sExpression = 
sCompleteFormula.getToken(1,'[',nIndex);
+                                nIndex = 0;
+                                sExpression = 
sExpression.getToken(0,']',nIndex);
+                                nIndex = 0;
+                                const ::rtl::OUString sFormula = 
sCompleteFormula.getToken(0,'(',nIndex);
+                                ::sal_Int16 nGroupOn = 
report::GroupOn::DEFAULT;
+
+                                if ( sFormula 
==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:LEFT")))
+                                {
+                                    nGroupOn = 
report::GroupOn::PREFIX_CHARACTERS;
+                                    ::rtl::OUString sInterval = 
sCompleteFormula.getToken(1,';',nIndex);
+                                    nIndex = 0;
+                                    sInterval = 
sInterval.getToken(0,')',nIndex);
+                                    
m_xGroup->setGroupInterval(sInterval.toInt32());
+                                }
+                                else if ( sFormula 
==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:YEAR")))
+                                    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;
+                                }
+                                   else if ( sFormula 
==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:WEEK")))
+                                       nGroupOn = report::GroupOn::WEEK;
+                                   else if ( sFormula 
==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:DAY")))
+                                       nGroupOn = report::GroupOn::DAY;
+                                   else if ( sFormula 
==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:HOUR")))
+                                       nGroupOn = report::GroupOn::HOUR;
+                                   else if ( sFormula 
==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:MINUTE")))
+                                       nGroupOn = report::GroupOn::MINUTE;
+                                else if ( sFormula 
==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:INT")))
+                                {
+                                    nGroupOn = report::GroupOn::INTERVAL;
+                                    _rImport.removeFunction(sExpression);
+                                    sExpression = 
sExpression.copy(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INT_count_")).getLength());
+                                    
+                                    nIndex = 0;
+                                    ::rtl::OUString sInterval = 
sCompleteFormula.getToken(1,'/',nIndex);
+                                    nIndex = 0;
+                                    sInterval = 
sInterval.getToken(0,')',nIndex);
+                                    
m_xGroup->setGroupInterval(sInterval.toInt32());
+                                }
+
+                                m_xGroup->setGroupOn(nGroupOn);
+       
+                                _rImport.removeFunction(sValue);
+                                sValue = sExpression;
+                            }
                                                m_xGroup->setExpression(sValue);
                         }
                     }

File [changed]: xmlReport.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlReport.cxx?r1=1.2&r2=1.2.2.1
Delta lines:  +12 -3
--------------------
--- xmlReport.cxx       2007-07-09 11:56:18+0000        1.2
+++ xmlReport.cxx       2007-07-12 12:59:57+0000        1.2.2.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: xmlReport.cxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.2.2.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/09 11:56:18 $
+ *  last change: $Author: oj $ $Date: 2007/07/12 12:59:57 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -197,7 +197,7 @@
                case XML_TOK_REPORT_FUNCTION:
                        {
                                m_rImport.GetProgressBarHelper()->Increment( 
PROGRESS_BAR_STEP );
-                               pContext = new OXMLFunction( m_rImport, 
nPrefix, rLocalName,xAttrList,m_xComponent.get());
+                               pContext = new OXMLFunction( m_rImport, 
nPrefix, rLocalName,xAttrList,m_xComponent.get(),true);
                        }
                        break;
                case XML_TOK_REPORT_HEADER:
@@ -249,6 +249,15 @@
        return pContext;
 }
 // 
-----------------------------------------------------------------------------
+void OXMLReport::EndElement()
+{
+    Reference< XFunctions > xFunctions = m_xComponent->getFunctions();
+    const ORptFilter::TGroupFunctionMap& aFunctions = m_rImport.getFunctions();
+    ORptFilter::TGroupFunctionMap::const_iterator aIter = aFunctions.begin();
+    const ORptFilter::TGroupFunctionMap::const_iterator aEnd = 
aFunctions.end();
+    for (; aIter != aEnd; ++aIter)
+        
xFunctions->insertByIndex(xFunctions->getCount(),uno::makeAny(aIter->second));
+}
 //----------------------------------------------------------------------------
 } // namespace rptxml
 // 
-----------------------------------------------------------------------------

File [changed]: xmlReport.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlReport.hxx?r1=1.2&r2=1.2.2.1
Delta lines:  +4 -2
-------------------
--- xmlReport.hxx       2007-07-09 11:56:18+0000        1.2
+++ xmlReport.hxx       2007-07-12 12:59:57+0000        1.2.2.1
@@ -6,9 +6,9 @@
  *
  *  $RCSfile: xmlReport.hxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.2.2.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/09 11:56:18 $
+ *  last change: $Author: oj $ $Date: 2007/07/12 12:59:57 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -60,6 +60,8 @@
                                        const ::rtl::OUString& rLocalName,
                                        const ::com::sun::star::uno::Reference< 
::com::sun::star::xml::sax::XAttributeList > & xAttrList );
 
+        virtual void EndElement();
+
     private:
         /** initializes our object's properties whose runtime (API) default is 
different from the file
             format default.

File [changed]: xmlfilter.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlfilter.cxx?r1=1.2.2.1&r2=1.2.2.2
Delta lines:  +12 -2
--------------------
--- xmlfilter.cxx       2007-07-11 10:31:01+0000        1.2.2.1
+++ xmlfilter.cxx       2007-07-12 12:59:57+0000        1.2.2.2
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: xmlfilter.cxx,v $
  *
- *  $Revision: 1.2.2.1 $
+ *  $Revision: 1.2.2.2 $
  *
- *  last change: $Author: oj $ $Date: 2007/07/11 10:31:01 $
+ *  last change: $Author: oj $ $Date: 2007/07/12 12:59:57 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -1065,5 +1065,15 @@
     SvXMLImport::endDocument();
 }
 // 
-----------------------------------------------------------------------------
+void ORptFilter::removeFunction(const ::rtl::OUString& _sFunctionName)
+{
+    m_aFunctions.erase(_sFunctionName);
+}
+// 
-----------------------------------------------------------------------------
+void ORptFilter::insertFunction(const ::com::sun::star::uno::Reference< 
::com::sun::star::report::XFunction > & _xFunction)
+{
+    
m_aFunctions.insert(TGroupFunctionMap::value_type(_xFunction->getName(),_xFunction));
+}
+// 
-----------------------------------------------------------------------------
 }// rptxml
 // 
-----------------------------------------------------------------------------

File [changed]: xmlfilter.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlfilter.hxx?r1=1.2&r2=1.2.2.1
Delta lines:  +12 -3
--------------------
--- xmlfilter.hxx       2007-07-09 11:56:18+0000        1.2
+++ xmlfilter.hxx       2007-07-12 12:59:57+0000        1.2.2.1
@@ -6,9 +6,9 @@
  *
  *  $RCSfile: xmlfilter.hxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.2.2.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/09 11:56:18 $
+ *  last change: $Author: oj $ $Date: 2007/07/12 12:59:57 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -132,8 +132,10 @@
 {
 public:
        DECLARE_STL_USTRINGACCESS_MAP(Sequence<PropertyValue>,TPropertyNameMap);
-
+    DECLARE_STL_USTRINGACCESS_MAP( Reference<XFunction> ,TGroupFunctionMap);
 private:
+    
+    TGroupFunctionMap                               m_aFunctions;
     com::sun::star::uno::Any                        m_aViewSettings;     
        Reference< XComponent >                                                 
m_xSrcDoc;
        mutable ::std::auto_ptr<SvXMLTokenMap>                  
m_pDocElemTokenMap;
@@ -225,6 +227,13 @@
        inline UniReference < XMLPropertySetMapper > 
GetRowStylesPropertySetMapper()       const   { return 
m_xRowStylesPropertySetMapper;     }
        inline UniReference < XMLPropertySetMapper > 
GetTableStylesPropertySetMapper()     const   { return 
m_xTableStylesPropertySetMapper;   }
     static ::rtl::OUString convertFormula(const ::rtl::OUString& _sFormula);
+    /** inserts a new function
+    *
+    * \param _xFunction 
+    */
+    void insertFunction(const ::com::sun::star::uno::Reference< 
::com::sun::star::report::XFunction > & _xFunction);
+    void removeFunction(const ::rtl::OUString& _sFunctionName);
+    inline const TGroupFunctionMap& getFunctions() const { return 
m_aFunctions; }
     
        virtual SvXMLImport&                            getGlobalContext();
 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to