chart2/source/controller/chartapiwrapper/AxisWrapper.cxx                 |    
5 
 chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx      |    
5 
 chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx |   
67 +---------
 chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx |    
9 -
 chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx            |    
7 -
 chart2/source/model/main/Axis.cxx                                        |   
15 +-
 chart2/source/model/main/DataPointProperties.cxx                         |   
11 +
 chart2/source/model/main/DataPointProperties.hxx                         |    
1 
 8 files changed, 43 insertions(+), 77 deletions(-)

New commits:
commit 7ce7dcf04156cf1990530dc0d83a3fd090d25a30
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Tue Jun 17 16:54:18 2014 -0400

    Make the "link to source" property a real property of Axis and DataPoint.
    
    It was previously just an alias for the NumberFormat property not being
    set i.e. the single internal property "NumberFormat" representing 2
    external properties.
    
    Change-Id: Id17dd5bd1ce4d9296917620229498b2128bab378

diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx 
b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
index 2c10c61..4643d6c 100644
--- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
@@ -656,9 +656,8 @@ const std::vector< WrappedProperty* > 
AxisWrapper::createWrappedProperties()
     aWrappedProperties.push_back( new WrappedProperty("Visible","Show") );
     aWrappedProperties.push_back( new 
WrappedDirectStateProperty("DisplayLabels","DisplayLabels") );
     aWrappedProperties.push_back( new 
WrappedDirectStateProperty("TextBreak","TextBreak") );
-    WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new 
WrappedNumberFormatProperty( m_spChart2ModelContact );
-    aWrappedProperties.push_back( pWrappedNumberFormatProperty );
-    aWrappedProperties.push_back( new 
WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
+    aWrappedProperties.push_back( new 
WrappedNumberFormatProperty(m_spChart2ModelContact) );
+    aWrappedProperties.push_back( new 
WrappedLinkNumberFormatProperty(m_spChart2ModelContact) );
     aWrappedProperties.push_back( new 
WrappedProperty("StackedText","StackCharacters") );
     aWrappedProperties.push_back( new 
WrappedDirectStateProperty("CrossoverPosition","CrossoverPosition") );
     {
diff --git 
a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx 
b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index b2429b6..f3c150e 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -701,9 +701,8 @@ const std::vector< WrappedProperty* > 
DataSeriesPointWrapper::createWrappedPrope
         WrappedStatisticProperties::addWrappedPropertiesForSeries( 
aWrappedProperties, m_spChart2ModelContact );
         aWrappedProperties.push_back( new WrappedAttachedAxisProperty( 
m_spChart2ModelContact ) );
 
-        WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new 
WrappedNumberFormatProperty( m_spChart2ModelContact );
-        aWrappedProperties.push_back( pWrappedNumberFormatProperty );
-        aWrappedProperties.push_back( new 
WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
+        aWrappedProperties.push_back( new 
WrappedNumberFormatProperty(m_spChart2ModelContact) );
+        aWrappedProperties.push_back( new 
WrappedLinkNumberFormatProperty(m_spChart2ModelContact) );
     }
 
     WrappedSymbolProperties::addWrappedPropertiesForSeries( 
aWrappedProperties, m_spChart2ModelContact );
diff --git 
a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx 
b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
index 198dc0c..85d8e7e 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
@@ -33,18 +33,11 @@ namespace wrapper
 WrappedNumberFormatProperty::WrappedNumberFormatProperty( ::boost::shared_ptr< 
Chart2ModelContact > spChart2ModelContact )
         : WrappedDirectStateProperty( CHART_UNONAME_NUMFMT, 
CHART_UNONAME_NUMFMT )
         , m_spChart2ModelContact(spChart2ModelContact)
-        , m_pWrappedLinkNumberFormatProperty(NULL)
 {
-    m_aOuterValue = getPropertyDefault( 0 );
 }
 
 WrappedNumberFormatProperty::~WrappedNumberFormatProperty()
 {
-    if( m_pWrappedLinkNumberFormatProperty )
-    {
-        if( m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty 
== this )
-            m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty 
= 0;
-    }
 }
 
 void WrappedNumberFormatProperty::setPropertyValue( const Any& rOuterValue, 
const Reference< beans::XPropertySet >& xInnerPropertySet ) const
@@ -54,19 +47,8 @@ void WrappedNumberFormatProperty::setPropertyValue( const 
Any& rOuterValue, cons
     if( ! (rOuterValue >>= nFormat) )
         throw lang::IllegalArgumentException( "Property 'NumberFormat' 
requires value of type sal_Int32", 0, 0 );
 
-    m_aOuterValue = rOuterValue;
     if(xInnerPropertySet.is())
-    {
-        bool bUseSourceFormat = 
!xInnerPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue();
-        if( bUseSourceFormat )
-        {
-            uno::Reference< chart2::XChartDocument > xChartDoc( 
m_spChart2ModelContact->getChart2Document() );
-            if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() )
-                bUseSourceFormat = false;
-        }
-        if( !bUseSourceFormat )
-            xInnerPropertySet->setPropertyValue( m_aInnerName, 
this->convertOuterToInnerValue( rOuterValue ) );
-    }
+        xInnerPropertySet->setPropertyValue(getInnerName(), 
this->convertOuterToInnerValue(rOuterValue));
 }
 
 Any WrappedNumberFormatProperty::getPropertyValue( const Reference< 
beans::XPropertySet >& xInnerPropertySet ) const
@@ -77,7 +59,7 @@ Any WrappedNumberFormatProperty::getPropertyValue( const 
Reference< beans::XProp
         OSL_FAIL("missing xInnerPropertySet in 
WrappedNumberFormatProperty::getPropertyValue");
         return Any();
     }
-    Any aRet( xInnerPropertySet->getPropertyValue( m_aInnerName ));
+    Any aRet( xInnerPropertySet->getPropertyValue(getInnerName()));
     if( !aRet.hasValue() )
     {
         sal_Int32 nKey = 0;
@@ -100,23 +82,14 @@ Any WrappedNumberFormatProperty::getPropertyDefault( const 
Reference< beans::XPr
     return uno::makeAny( sal_Int32( 0 ) );
 }
 
-WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( 
WrappedNumberFormatProperty* pWrappedNumberFormatProperty ) :
-    WrappedProperty( CHART_UNONAME_LINK_TO_SRC_NUMFMT, OUString() ),
-    m_pWrappedNumberFormatProperty( pWrappedNumberFormatProperty )
+WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( const 
boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact ) :
+    WrappedDirectStateProperty(CHART_UNONAME_LINK_TO_SRC_NUMFMT, 
CHART_UNONAME_LINK_TO_SRC_NUMFMT),
+    m_pChart2ModelContact(pChart2ModelContact)
 {
-    if( m_pWrappedNumberFormatProperty )
-    {
-        m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty = 
this;
-    }
 }
 
 WrappedLinkNumberFormatProperty::~WrappedLinkNumberFormatProperty()
 {
-    if( m_pWrappedNumberFormatProperty )
-    {
-        if( m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty 
== this )
-            m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty 
= 0;
-    }
 }
 
 void WrappedLinkNumberFormatProperty::setPropertyValue( const Any& 
rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
@@ -128,31 +101,7 @@ void WrappedLinkNumberFormatProperty::setPropertyValue( 
const Any& rOuterValue,
         return;
     }
 
-    bool bLinkFormat = false;
-    if( rOuterValue >>= bLinkFormat )
-    {
-        Any aValue;
-        if( bLinkFormat )
-        {
-            if( m_pWrappedNumberFormatProperty )
-            {
-                uno::Reference< chart2::XChartDocument > xChartDoc( 
m_pWrappedNumberFormatProperty->m_spChart2ModelContact->getChart2Document() );
-                if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() )
-                    return;
-            }
-        }
-        else
-        {
-            if( m_pWrappedNumberFormatProperty )
-            {
-                aValue = m_pWrappedNumberFormatProperty->getPropertyValue( 
xInnerPropertySet );
-            }
-            else
-                aValue <<= sal_Int32( 0 );
-        }
-
-        xInnerPropertySet->setPropertyValue(CHART_UNONAME_NUMFMT, aValue);
-    }
+    xInnerPropertySet->setPropertyValue(getInnerName(), rOuterValue);
 }
 
 Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< 
beans::XPropertySet >& xInnerPropertySet ) const
@@ -163,8 +112,8 @@ Any WrappedLinkNumberFormatProperty::getPropertyValue( 
const Reference< beans::X
         OSL_FAIL("missing xInnerPropertySet in 
WrappedNumberFormatProperty::getPropertyValue");
         return getPropertyDefault(0);
     }
-    bool bLink = ! 
xInnerPropertySet->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue();
-    return uno::makeAny( bLink );
+
+    return xInnerPropertySet->getPropertyValue(getInnerName());
 }
 
 Any WrappedLinkNumberFormatProperty::getPropertyDefault( const Reference< 
beans::XPropertyState >& /*xInnerPropertyState*/ ) const
diff --git 
a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx 
b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
index 618fc07..d721e6b 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
@@ -49,14 +49,12 @@ public:
     friend class WrappedLinkNumberFormatProperty;
 private:
     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
-    mutable ::com::sun::star::uno::Any m_aOuterValue;
-    WrappedLinkNumberFormatProperty* m_pWrappedLinkNumberFormatProperty;
 };
 
-class WrappedLinkNumberFormatProperty : public WrappedProperty
+class WrappedLinkNumberFormatProperty : public WrappedDirectStateProperty
 {
 public:
-    WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* 
pWrappedNumberFormatProperty );
+    WrappedLinkNumberFormatProperty( const 
boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact );
     virtual ~WrappedLinkNumberFormatProperty();
 
     virtual void setPropertyValue( const ::com::sun::star::uno::Any& 
rOuterValue, const ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
@@ -68,9 +66,8 @@ public:
     virtual ::com::sun::star::uno::Any getPropertyDefault( const 
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& 
xInnerPropertyState ) const
                         throw 
(::com::sun::star::beans::UnknownPropertyException, 
::com::sun::star::lang::WrappedTargetException, 
::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
 
-    friend class WrappedNumberFormatProperty;
 private:
-    WrappedNumberFormatProperty* m_pWrappedNumberFormatProperty;
+    boost::shared_ptr<Chart2ModelContact> m_pChart2ModelContact;
 };
 
 } //namespace wrapper
diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx 
b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
index fe8eeb5..e3b7175 100644
--- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
@@ -423,8 +423,9 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 
nWhichId, SfxItemSet & rOutI
 
         case SID_ATTR_NUMBERFORMAT_SOURCE:
         {
-            bool bNumberFormatIsSet = ( 
GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue());
-            rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
+            bool bLinkToSource = true;
+            
GetPropertySet()->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= 
bLinkToSource;
+            rOutItemSet.Put(SfxBoolItem(nWhichId, bLinkToSource));
         }
         break;
 
@@ -930,6 +931,8 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 
nWhichId, const SfxItemSet
             bool bUseSourceFormat =
                 (static_cast< const SfxBoolItem & >(
                     rItemSet.Get( nWhichId )).GetValue() );
+            
GetPropertySet()->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, 
uno::makeAny(bUseSourceFormat));
+
             bool bNumberFormatIsSet = 
GetPropertySet()->getPropertyValue(CHART_UNONAME_NUMFMT).hasValue();
 
             bChangedOtherwise = (bUseSourceFormat == bNumberFormatIsSet);
diff --git a/chart2/source/model/main/Axis.cxx 
b/chart2/source/model/main/Axis.cxx
index 90e7660..a345bd9 100644
--- a/chart2/source/model/main/Axis.cxx
+++ b/chart2/source/model/main/Axis.cxx
@@ -67,7 +67,8 @@ enum
     PROP_AXIS_CROSSOVER_POSITION,
     PROP_AXIS_CROSSOVER_VALUE,
     PROP_AXIS_DISPLAY_LABELS,
-    PROP_AXIS_NUMBER_FORMAT,
+    PROP_AXIS_NUMBERFORMAT,
+    PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
     PROP_AXIS_LABEL_POSITION,
     PROP_AXIS_TEXT_ROTATION,
     PROP_AXIS_TEXT_BREAK,
@@ -115,10 +116,17 @@ void lcl_AddPropertiesToVector(
 
     rOutProperties.push_back(
         Property( CHART_UNONAME_NUMFMT,
-                  PROP_AXIS_NUMBER_FORMAT,
+                  PROP_AXIS_NUMBERFORMAT,
                   cppu::UnoType<sal_Int32>::get(),
                   beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEVOID ));
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+    rOutProperties.push_back(
+        Property( CHART_UNONAME_LINK_TO_SRC_NUMFMT,
+                  PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
+                  ::getBooleanCppuType(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
 
     rOutProperties.push_back(
         Property( "LabelPosition",
@@ -220,6 +228,7 @@ private:
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, 
PROP_AXIS_SHOW, true );
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, 
PROP_AXIS_CROSSOVER_POSITION, ::com::sun::star::chart::ChartAxisPosition_ZERO );
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, 
PROP_AXIS_DISPLAY_LABELS, true );
+        ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, 
PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE, true );
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, 
PROP_AXIS_LABEL_POSITION, 
::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
         ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, 
PROP_AXIS_TEXT_ROTATION, 0.0 );
         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, 
PROP_AXIS_TEXT_BREAK, false );
diff --git a/chart2/source/model/main/DataPointProperties.cxx 
b/chart2/source/model/main/DataPointProperties.cxx
index 2ebfa95..e145d42 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -282,7 +282,14 @@ void DataPointProperties::AddPropertiesToVector(
                   PROP_DATAPOINT_NUMBER_FORMAT,
                   cppu::UnoType<sal_Int32>::get(),
                   beans::PropertyAttribute::BOUND
-                  | beans::PropertyAttribute::MAYBEVOID ));
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+    rOutProperties.push_back(
+        Property( CHART_UNONAME_LINK_TO_SRC_NUMFMT,
+                  PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE,
+                  ::getBooleanCppuType(),
+                  beans::PropertyAttribute::BOUND
+                  | beans::PropertyAttribute::MAYBEDEFAULT ));
 
     //additional 'PercentageNumberFormat'
     rOutProperties.push_back(
@@ -410,6 +417,8 @@ void DataPointProperties::AddDefaultsToMap(
     PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, 
PROP_DATAPOINT_PERCENT_DIAGONAL, 0 );
 
     PropertyHelper::setPropertyValueDefault< double >( rOutMap, 
PROP_DATAPOINT_TEXT_ROTATION, 0.0 );
+
+    PropertyHelper::setPropertyValueDefault(rOutMap, 
PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE, true);
 }
 
 } //  namespace chart
diff --git a/chart2/source/model/main/DataPointProperties.hxx 
b/chart2/source/model/main/DataPointProperties.hxx
index 596adf8..2d7258a 100644
--- a/chart2/source/model/main/DataPointProperties.hxx
+++ b/chart2/source/model/main/DataPointProperties.hxx
@@ -62,6 +62,7 @@ public:
         PROP_DATAPOINT_LABEL,
         PROP_DATAPOINT_LABEL_SEPARATOR,
         PROP_DATAPOINT_NUMBER_FORMAT,
+        PROP_DATAPOINT_LINK_NUMBERFORMAT_TO_SOURCE,
         PROP_DATAPOINT_PERCENTAGE_NUMBER_FORMAT,
         PROP_DATAPOINT_LABEL_PLACEMENT,
         PROP_DATAPOINT_REFERENCE_DIAGRAM_SIZE,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to