Tag: cws_src680_reportdesign01
User: oj      
Date: 2007-10-11 10:00:28+0000
Modified:
   dba/reportdesign/source/ui/inc/GeometryHandler.hxx
   dba/reportdesign/source/ui/inspection/GeometryHandler.cxx

Log:
 #i77604# handle empty scope

File Changes:

Directory: /dba/reportdesign/source/ui/inc/
===========================================

File [changed]: GeometryHandler.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/inc/GeometryHandler.hxx?r1=1.3.20.4&r2=1.3.20.5
Delta lines:  +9 -7
-------------------
--- GeometryHandler.hxx 2007-10-11 07:45:17+0000        1.3.20.4
+++ GeometryHandler.hxx 2007-10-11 10:00:25+0000        1.3.20.5
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: GeometryHandler.hxx,v $
  *
- *  $Revision: 1.3.20.4 $
+ *  $Revision: 1.3.20.5 $
  *
- *  last change: $Author: oj $ $Date: 2007/10/11 07:45:17 $
+ *  last change: $Author: oj $ $Date: 2007/10/11 10:00:25 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -86,6 +86,8 @@
         ::rtl::OUString                                     m_sFormula;
         ::sal_Bool                                          m_bPreEvaluated;
         ::sal_Bool                                          m_bDeepTraversing;
+
+        inline ::rtl::OUString getName() const { return m_sName; }
     } ;
 
     class OPropertyInfoService;
@@ -136,7 +138,7 @@
         void implCreateListLikeControl(
                 const ::com::sun::star::uno::Reference< 
::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory
                 ,::com::sun::star::inspection::LineDescriptor & out_Descriptor
-                ,const ::rtl::OUString& _sEntries
+                ,const ::std::vector< ::rtl::OUString>& _aEntries
                 ,sal_Bool _bReadOnlyControl
                 ,sal_Bool _bTrueIfListBoxFalseIfComboBox
             );
@@ -181,15 +183,15 @@
 
         /**return all formula in a semicolon seperated list
         *
-        * \return the localized function names seperated by semicolon
+        * \param _rList the localized function names
         */
-        ::rtl::OUString getFormulaList() const;
+        void impl_fillFormulaList_nothrow(::std::vector< ::rtl::OUString >& 
_out_rList) const;
 
         /**return all group names in a semicolon seperated list starting with 
the group where this control is contained in.
         *
-        * \return the localized group names seperated by semicolon and 
prefixed with "Group: %1" (localized)
+        * \param _rList fills the list with all scope names.
         */
-        ::rtl::OUString getScopeList() const;
+        void impl_fillScopeList_nothrow(::std::vector< ::rtl::OUString >& 
_out_rList) const;
 
         /** get the functions supplier for the set scope, default is the 
surrounding group.
         *

Directory: /dba/reportdesign/source/ui/inspection/
==================================================

File [changed]: GeometryHandler.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/inspection/GeometryHandler.cxx?r1=1.4.20.8&r2=1.4.20.9
Delta lines:  +30 -44
---------------------
--- GeometryHandler.cxx 2007-10-11 09:05:52+0000        1.4.20.8
+++ GeometryHandler.cxx 2007-10-11 10:00:26+0000        1.4.20.9
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: GeometryHandler.cxx,v $
  *
- *  $Revision: 1.4.20.8 $
+ *  $Revision: 1.4.20.9 $
  *
- *  last change: $Author: lla $ $Date: 2007/10/11 09:05:52 $
+ *  last change: $Author: oj $ $Date: 2007/10/11 10:00:26 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -487,6 +487,8 @@
                     case FUNCTION:
                         if ( isDefaultFunction(sDataField,sDataField) )
                             aPropertyValue <<= sDataField;
+                        else if ( !sDataField.getLength() )
+                            aPropertyValue = uno::Any();
                         break;
                     case COUNTER:
                     case USER_DEF_FUNCTION:
@@ -523,7 +525,7 @@
                         }
                         break;
                     case USER_DEF_FUNCTION:
-                        aPropertyValue = (PROPERTY_ID_FORMULALIST == nId ? 
aDataField : uno::makeAny(::rtl::OUString()));
+                        aPropertyValue = (PROPERTY_ID_FORMULALIST == nId ? 
aDataField : uno::Any());
                         break;
                     case COUNTER:
                         if ( PROPERTY_ID_SCOPE == nId && 
impl_isCounterFunction_throw(sDataField,m_sScope) )
@@ -771,14 +773,19 @@
         ,sal_Bool _bTrueIfListBoxFalseIfComboBox
     )
 {
-    const String aEntries = String( ModuleRes( _nResId ) );
-    
implCreateListLikeControl(_rxControlFactory,out_Descriptor,aEntries,_bReadOnlyControl,_bTrueIfListBoxFalseIfComboBox);
+    const String sEntries = String( ModuleRes( _nResId ) );
+    const xub_StrLen nCount = sEntries.GetTokenCount();
+    ::std::vector< ::rtl::OUString > aList;
+    for ( xub_StrLen i=0; i < nCount; ++i )
+        aList.push_back(sEntries.GetToken(i));
+
+    
implCreateListLikeControl(_rxControlFactory,out_Descriptor,aList,_bReadOnlyControl,_bTrueIfListBoxFalseIfComboBox);
 }
 // 
-----------------------------------------------------------------------------
 void GeometryHandler::implCreateListLikeControl(
         const uno::Reference< inspection::XPropertyControlFactory >& 
_rxControlFactory
         ,inspection::LineDescriptor & out_Descriptor
-        ,const ::rtl::OUString& _sEntries
+        ,const ::std::vector< ::rtl::OUString>& _aEntries
         ,sal_Bool _bReadOnlyControl
         ,sal_Bool _bTrueIfListBoxFalseIfComboBox
     )
@@ -791,10 +798,7 @@
     );
 
     out_Descriptor.Control = xListControl.get();
-    const String sEntries(_sEntries);
-    const xub_StrLen nCount = sEntries.GetTokenCount();
-    for ( xub_StrLen i=0; i < nCount; ++i )
-        xListControl->appendListEntry( sEntries.GetToken(i) );
+    ::std::for_each( _aEntries.begin(), _aEntries.end(),::boost::bind( 
&inspection::XStringListControl::appendListEntry, xListControl,_1 ));
 }
 // 
-----------------------------------------------------------------------------
 void lcl_collectParamNames_nothrow( const uno::Reference< 
container::XIndexAccess >& _rxParams, ::std::vector< ::rtl::OUString >& 
_out_rParamNames )
@@ -843,10 +847,18 @@
             
implCreateListLikeControl(_xControlFactory,aOut,RID_STR_REPORTPRINTOPTION_CONST,sal_False,sal_True);
             break;
         case PROPERTY_ID_FORMULALIST:
-            
implCreateListLikeControl(_xControlFactory,aOut,getFormulaList(),sal_False,sal_True);
+            {
+                ::std::vector< ::rtl::OUString > aList;
+                impl_fillFormulaList_nothrow(aList);
+                
implCreateListLikeControl(_xControlFactory,aOut,aList,sal_False,sal_True);
+            }
             break;
         case PROPERTY_ID_SCOPE:
-            
implCreateListLikeControl(_xControlFactory,aOut,getScopeList(),sal_False,sal_True);
+            {
+                ::std::vector< ::rtl::OUString > aList;
+                impl_fillScopeList_nothrow(aList);
+                
implCreateListLikeControl(_xControlFactory,aOut,aList,sal_False,sal_True);
+            }
             break;
         case PROPERTY_ID_TYPE:
             
implCreateListLikeControl(_xControlFactory,aOut,RID_STR_TYPE_CONST,sal_False,sal_True);
@@ -1620,39 +1632,16 @@
     }
 }
 // 
-----------------------------------------------------------------------------
-::rtl::OUString GeometryHandler::getFormulaList() const
+void GeometryHandler::impl_fillFormulaList_nothrow(::std::vector< 
::rtl::OUString >& _out_rList) const
 {
-    ::rtl::OUString sReturn;
-    const static ::rtl::OUString 
s_sSemiColon(RTL_CONSTASCII_USTRINGPARAM(";"));
     if ( m_nDataFieldType == FUNCTION )
-    {
-        ::std::vector< DefaultFunction >::const_iterator aIter = 
m_aDefaultFunctions.begin();
-        ::std::vector< DefaultFunction >::const_iterator aDeEnd = 
m_aDefaultFunctions.end();
-        for (; aIter != aDeEnd; ++aIter)
-        {
-            if ( sReturn.getLength() )
-                sReturn += s_sSemiColon;
-            sReturn += aIter->m_sName;
-        }
-    }
+        
::std::transform(m_aDefaultFunctions.begin(),m_aDefaultFunctions.end(),::std::back_inserter(_out_rList),::boost::bind(
 &DefaultFunction::getName, _1 ));
     else if ( m_nDataFieldType == USER_DEF_FUNCTION )
-    {
-        TFunctions::const_iterator aIter  = m_aFunctionNames.begin();
-        TFunctions::const_iterator aDeEnd = m_aFunctionNames.end();
-        for (; aIter != aDeEnd; ++aIter)
-        {
-            if ( sReturn.getLength() )
-                sReturn += s_sSemiColon;
-            sReturn += aIter->first;
-        }
-    }
-    
-    return sReturn;
+        
::std::transform(m_aFunctionNames.begin(),m_aFunctionNames.end(),::std::back_inserter(_out_rList),::std::select1st<TFunctions::value_type>());
 }
 // 
-----------------------------------------------------------------------------
-::rtl::OUString GeometryHandler::getScopeList() const
+void GeometryHandler::impl_fillScopeList_nothrow(::std::vector< 
::rtl::OUString >& _out_rList) const
 {
-    ::rtl::OUStringBuffer sReturn;
     try
     {
         const uno::Reference< report::XReportComponent> 
xSourceReportComponent(m_xReportComponent,uno::UNO_QUERY_THROW);
@@ -1673,17 +1662,14 @@
             xGroup.set(xGroups->getByIndex(i),uno::UNO_QUERY_THROW);
             String sGroupName = sGroup;
             sGroupName.SearchAndReplaceAscii("%1",xGroup->getExpression());
-            sReturn.append(sGroupName);
-            if ( i <= nPos )
-                sReturn.appendAscii(";");
+            _out_rList.push_back(sGroupName);
         }
-        sReturn.append(xReportDefinition->getName());
+        _out_rList.push_back(xReportDefinition->getName());
     }
     catch(uno::Exception&)
     {
         OSL_ENSURE(0,"Exception caught!");
     }
-    return sReturn.makeStringAndClear();
 }
 // 
-----------------------------------------------------------------------------
 uno::Reference< report::XFunctionsSupplier> 
GeometryHandler::fillScope_throw(::rtl::OUString& _rsNamePostFix)




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

Reply via email to