[Libreoffice-commits] core.git: 2 commits - chart2/source

Kohei Yoshida kohei.yoshida at collabora.com
Mon Mar 24 19:26:26 PDT 2014


 chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx |   16 +++++-----
 chart2/source/controller/dialogs/res_ErrorBar.cxx                 |    6 +--
 chart2/source/controller/dialogs/tp_ChartType.cxx                 |    8 ++---
 chart2/source/controller/inc/res_ErrorBar.hxx                     |    2 -
 chart2/source/controller/main/ControllerCommandDispatch.cxx       |    2 -
 chart2/source/model/template/ChartTypeTemplate.cxx                |    9 +++++
 6 files changed, 25 insertions(+), 18 deletions(-)

New commits:
commit 325ecb1d0511c6c02d863eb760c2d0521f0b6c19
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Mar 21 10:27:46 2014 -0400

    Let's be more defensive here by checking for null return objects.
    
    Change-Id: I5164e7d82f882ea9fe296a5a2df616d396d6726f

diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index 83e747e..748d40d 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -337,7 +337,11 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate(
         if( bResult )
         {
             Sequence< Reference< XChartType > > aFormerlyUsedChartTypes;
-            const OUString aChartTypeToMatch( getChartTypeForNewSeries(aFormerlyUsedChartTypes)->getChartType());
+            Reference<XChartType> xOldCT = getChartTypeForNewSeries(aFormerlyUsedChartTypes);
+            if (!xOldCT.is())
+                return false;
+
+            const OUString aChartTypeToMatch = xOldCT->getChartType();
             const sal_Int32 nDimensionToMatch = getDimension();
             for( sal_Int32 nCooSysIdx=0; bResult && (nCooSysIdx < aCooSysSeq.getLength()); ++nCooSysIdx )
             {
@@ -348,6 +352,9 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate(
                 Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
                 for( sal_Int32 nCTIdx=0; bResult && (nCTIdx < aChartTypeSeq.getLength()); ++nCTIdx )
                 {
+                    if (!aChartTypeSeq[nCTIdx].is())
+                        return false;
+
                     // match chart type
                     bResult = bResult && aChartTypeSeq[nCTIdx]->getChartType().equals( aChartTypeToMatch );
                     bool bFound=false;
commit 6292dbc3ef4067280290f2c7f95292e2791a15db
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Mar 20 17:41:16 2014 -0400

    Better to associate true for "enable" and false for "disable".
    
    The code reads better this way, and certainly is easier on human brain
    to process their logic.
    
    Change-Id: I3150fca3385931b9fe01ad13cb11fab410331349

diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index b6242a4..dea17aa 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -149,8 +149,8 @@ enum
     PROP_DOCUMENT_ADDITIONAL_SHAPES,
     PROP_DOCUMENT_UPDATE_ADDIN,
     PROP_DOCUMENT_NULL_DATE,
-    PROP_DOCUMENT_DISABLE_COMPLEX_CHARTTYPES,
-    PROP_DOCUMENT_DISABLE_DATATABLE_DIALOG
+    PROP_DOCUMENT_ENABLE_COMPLEX_CHARTTYPES,
+    PROP_DOCUMENT_ENABLE_DATATABLE_DIALOG
 };
 
 void lcl_AddPropertiesToVector(
@@ -224,14 +224,14 @@ void lcl_AddPropertiesToVector(
                   beans::PropertyAttribute::MAYBEVOID ));
 
     rOutProperties.push_back(
-        Property( "DisableComplexChartTypes",
-                  PROP_DOCUMENT_DISABLE_COMPLEX_CHARTTYPES,
+        Property( "EnableComplexChartTypes",
+                  PROP_DOCUMENT_ENABLE_COMPLEX_CHARTTYPES,
                   ::getBooleanCppuType(),
                   //#i112666# no PropertyChangeEvent is fired on change so far
                   beans::PropertyAttribute::MAYBEDEFAULT ) );
     rOutProperties.push_back(
-        Property( "DisableDataTableDialog",
-                  PROP_DOCUMENT_DISABLE_DATATABLE_DIALOG,
+        Property( "EnableDataTableDialog",
+                  PROP_DOCUMENT_ENABLE_DATATABLE_DIALOG,
                   ::getBooleanCppuType(),
                   //#i112666# no PropertyChangeEvent is fired on change so far
                   beans::PropertyAttribute::MAYBEDEFAULT ) );
@@ -1531,8 +1531,8 @@ const std::vector< WrappedProperty* > ChartDocumentWrapper::createWrappedPropert
     aWrappedProperties.push_back( new WrappedAdditionalShapesProperty( *this ) );
     aWrappedProperties.push_back( new WrappedRefreshAddInAllowedProperty( *this ) );
     aWrappedProperties.push_back( new WrappedIgnoreProperty("NullDate",Any() ) ); // i99104
-    aWrappedProperties.push_back( new WrappedIgnoreProperty("DisableComplexChartTypes", uno::makeAny( sal_False ) ) );
-    aWrappedProperties.push_back( new WrappedIgnoreProperty("DisableDataTableDialog", uno::makeAny( sal_False ) ) );
+    aWrappedProperties.push_back( new WrappedIgnoreProperty("EnableComplexChartTypes", uno::makeAny(sal_True) ) );
+    aWrappedProperties.push_back( new WrappedIgnoreProperty("EnableDataTableDialog", uno::makeAny(sal_True) ) );
 
     return aWrappedProperties;
 }
diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx
index 7c25681..2803f37 100644
--- a/chart2/source/controller/dialogs/res_ErrorBar.cxx
+++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx
@@ -97,7 +97,7 @@ ErrorBarResources::ErrorBarResources( VclBuilderContainer* pParent, Dialog * pPa
         m_pParentDialog( pParentDialog ),
         m_pCurrentRangeChoosingField( 0 ),
         m_bHasInternalDataProvider( true ),
-        m_bDisableDataTableDialog( false )
+        m_bEnableDataTableDialog( true )
 {
         pParent->get(m_pRbNone,"RB_NONE");
         pParent->get(m_pRbConst, "RB_CONST");
@@ -181,7 +181,7 @@ void ErrorBarResources::SetChartDocumentForRangeChoosing(
         {
             try
             {
-                xProps->getPropertyValue( "DisableDataTableDialog" ) >>= m_bDisableDataTableDialog;
+                xProps->getPropertyValue("EnableDataTableDialog") >>= m_bEnableDataTableDialog;
             }
             catch( const uno::Exception& e )
             {
@@ -231,7 +231,7 @@ void ErrorBarResources::UpdateControlStates()
     m_pLbFunction->Enable( bIsFunction );
 
     // range buttons
-    m_pRbRange->Enable( !m_bHasInternalDataProvider || !m_bDisableDataTableDialog );
+    m_pRbRange->Enable( !m_bHasInternalDataProvider || m_bEnableDataTableDialog );
     bool bShowRange = ( m_pRbRange->IsChecked());
     bool bCanChooseRange =
         ( bShowRange &&
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 63df637..0c78e59 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -696,13 +696,13 @@ ChartTypeTabPage::ChartTypeTabPage(Window* pParent
     m_pSubTypeList->SetColCount(4);
     m_pSubTypeList->SetLineCount(1);
 
-    bool bDisableComplexChartTypes = false;
+    bool bEnableComplexChartTypes = true;
     uno::Reference< beans::XPropertySet > xProps( m_xChartModel, uno::UNO_QUERY );
     if ( xProps.is() )
     {
         try
         {
-            xProps->getPropertyValue( "DisableComplexChartTypes" ) >>= bDisableComplexChartTypes;
+            xProps->getPropertyValue("EnableComplexChartTypes") >>= bEnableComplexChartTypes;
         }
         catch( const uno::Exception& e )
         {
@@ -715,13 +715,13 @@ ChartTypeTabPage::ChartTypeTabPage(Window* pParent
     m_aChartTypeDialogControllerList.push_back(new PieChartDialogController() );
     m_aChartTypeDialogControllerList.push_back(new AreaChartDialogController() );
     m_aChartTypeDialogControllerList.push_back(new LineChartDialogController() );
-    if ( !bDisableComplexChartTypes )
+    if (bEnableComplexChartTypes)
     {
         m_aChartTypeDialogControllerList.push_back(new XYChartDialogController() );
         m_aChartTypeDialogControllerList.push_back(new BubbleChartDialogController() );
     }
     m_aChartTypeDialogControllerList.push_back(new NetChartDialogController() );
-    if ( !bDisableComplexChartTypes )
+    if (bEnableComplexChartTypes)
     {
         m_aChartTypeDialogControllerList.push_back(new StockChartDialogController() );
     }
diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx
index 83cc4d1..de97253 100644
--- a/chart2/source/controller/inc/res_ErrorBar.hxx
+++ b/chart2/source/controller/inc/res_ErrorBar.hxx
@@ -119,7 +119,7 @@ private:
     boost::scoped_ptr< RangeSelectionHelper >  m_apRangeSelectionHelper;
     Edit *               m_pCurrentRangeChoosingField;
     bool                 m_bHasInternalDataProvider;
-    bool                 m_bDisableDataTableDialog;
+    bool                 m_bEnableDataTableDialog;
 
     DECL_LINK( CategoryChosen, void * );
     DECL_LINK( SynchronizePosAndNeg, void * );
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx
index 07fdf49..f7e6e5e 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.cxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx
@@ -538,7 +538,7 @@ void ControllerCommandDispatch::updateCommandAvailability()
         {
             try
             {
-                xProps->getPropertyValue(  "DisableDataTableDialog" ) >>= bDisableDataTableDialog;
+                xProps->getPropertyValue(  "EnableDataTableDialog" ) >>= bDisableDataTableDialog;
             }
             catch( const uno::Exception& e )
             {


More information about the Libreoffice-commits mailing list