[ooo-build-commit] Branch 'ooo-build-3-1-1' - patches/dev300

René Engelhard rene at kemper.freedesktop.org
Thu Aug 6 23:39:51 PDT 2009


 patches/dev300/apply                              |    4 
 patches/dev300/chart-formula-syntax-m17.diff      |  186 ++++++++++++++++++++++
 patches/dev300/chart-formula-syntax.diff          |   23 +-
 patches/dev300/chart-subtitle-xls-export-m17.diff |  122 ++++++++++++++
 patches/dev300/chart-subtitle-xls-export.diff     |    6 
 5 files changed, 326 insertions(+), 15 deletions(-)

New commits:
commit b56ef1f48a31a665e2ceb55a861a1e567b5c7b31
Author: Rene Engelhard <rene at debian.org>
Date:   Fri Aug 7 08:37:49 2009 +0200

    ooo310-m18 update
    
    * patches/dev300/chart-formula-syntax-m17.diff: rotate
    * patches/dev300/chart-formula-syntax.diff:  update for m18
    * patches/dev300/chart-subtitle-xls-export-m17.diff: rotate
    * patches/dev300/chart-subtitle-xls-export.diff: update for m18
    * patches/dev300/apply: adapt

diff --git a/patches/dev300/apply b/patches/dev300/apply
index ecfda6f..6724662 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -2021,6 +2021,10 @@ calc-formula-variable-separators-officecfg.diff, n#447164, i#92056, kohei
 # Display references when entering input mode, even when the separators are not ';'.
 calc-formula-variable-separators-ref-display.diff, n#469395, i#101090, kohei
 
+[ CalcFixes < ooo310-m18 ]
+# Fix chart breakage for non-default formula syntax (Excel A1 and R1C1).
+chart-formula-syntax-m17.diff, n#487350, i#101091, kohei
+[ CalcFixes >= ooo310-m18 ]
 # Fix chart breakage for non-default formula syntax (Excel A1 and R1C1).
 chart-formula-syntax.diff, n#487350, i#101091, kohei
 
diff --git a/patches/dev300/chart-formula-syntax-m17.diff b/patches/dev300/chart-formula-syntax-m17.diff
new file mode 100644
index 0000000..3ea27fc
--- /dev/null
+++ b/patches/dev300/chart-formula-syntax-m17.diff
@@ -0,0 +1,186 @@
+diff --git sc/inc/reftokenhelper.hxx sc/inc/reftokenhelper.hxx
+index b1159cc..d7b335f 100644
+--- sc/inc/reftokenhelper.hxx
++++ sc/inc/reftokenhelper.hxx
+@@ -56,7 +56,8 @@ public:
+      * The source range may consist of multiple ranges separated by ';'s. 
+      */
+     static void compileRangeRepresentation(
+-        ::std::vector<ScSharedTokenRef>& rRefTokens, const ::rtl::OUString& rRangeStr, ScDocument* pDoc);
++        ::std::vector<ScSharedTokenRef>& rRefTokens, const ::rtl::OUString& rRangeStr, ScDocument* pDoc,
++        ::formula::FormulaGrammar::Grammar eGrammar = ::formula::FormulaGrammar::GRAM_ENGLISH);
+ 
+     static bool getRangeFromToken(ScRange& rRange, const ScSharedTokenRef& pToken, bool bExternal = false);
+ 
+diff --git sc/source/core/data/documen5.cxx sc/source/core/data/documen5.cxx
+index 19f6b09..a921945 100644
+--- sc/source/core/data/documen5.cxx
++++ sc/source/core/data/documen5.cxx
+@@ -130,6 +130,7 @@ void lcl_SetChartRanges( const uno::Reference< chart2::XChartDocument >& xChartD
+ 
+             if( xLabel.is())
+             {
++                // the range string must be in Calc A1 format.
+                 uno::Reference< chart2::data::XDataSequence > xNewSeq(
+                     xDataProvider->createDataSequenceByRangeRepresentation( rRanges[nRange++] ));
+                 
+@@ -145,6 +146,7 @@ void lcl_SetChartRanges( const uno::Reference< chart2::XChartDocument >& xChartD
+ 
+             if( xValues.is())
+             {
++                // the range string must be in Calc A1 format.
+                 uno::Reference< chart2::data::XDataSequence > xNewSeq(
+                     xDataProvider->createDataSequenceByRangeRepresentation( rRanges[nRange++] ));
+                 
+@@ -391,7 +393,7 @@ void ScDocument::GetChartRanges( const String& rChartName, ::std::vector< ScRang
+         for( sal_Int32 nN=0; nN<aRangeStrings.getLength(); nN++ )
+         {
+             ScRangeList aRanges;
+-            aRanges.Parse( aRangeStrings[nN], pSheetNameDoc );
++            aRanges.Parse( aRangeStrings[nN], pSheetNameDoc, SCA_VALID, pSheetNameDoc->GetAddressConvention() );
+             rRangesVector.push_back(aRanges);
+         }
+     }
+@@ -407,8 +409,8 @@ void ScDocument::SetChartRanges( const String& rChartName, const ::std::vector<
+         for( sal_Int32 nN=0; nN<nCount; nN++ )
+         {
+             ScRangeList aScRangeList( rRangesVector[nN] );
+-            String sRangeStr;
+-            aScRangeList.Format( sRangeStr, SCR_ABS_3D, this, GetAddressConvention() );
++            String sRangeStr; // This range must be in Calc A1 format.
++            aScRangeList.Format( sRangeStr, SCR_ABS_3D, this );
+             aRangeStrings[nN]=sRangeStr;
+         }
+         lcl_SetChartRanges( xChartDoc, aRangeStrings );
+diff --git sc/source/core/tool/reftokenhelper.cxx sc/source/core/tool/reftokenhelper.cxx
+index 8ecb44a..0e07819 100644
+--- sc/source/core/tool/reftokenhelper.cxx
++++ sc/source/core/tool/reftokenhelper.cxx
+@@ -49,7 +49,7 @@ using ::std::auto_ptr;
+ using ::rtl::OUString;
+ 
+ void ScRefTokenHelper::compileRangeRepresentation(
+-    vector<ScSharedTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc)
++    vector<ScSharedTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc, FormulaGrammar::Grammar eGrammar)
+ {
+     const sal_Unicode cSep = ';';
+     const sal_Unicode cQuote = '\'';
+@@ -63,7 +63,7 @@ void ScRefTokenHelper::compileRangeRepresentation(
+             break;
+         
+         ScCompiler aCompiler(pDoc, ScAddress(0,0,0));
+-        aCompiler.SetGrammar(FormulaGrammar::GRAM_ENGLISH);
++        aCompiler.SetGrammar(eGrammar);
+         auto_ptr<ScTokenArray> pArray(aCompiler.CompileString(aToken));
+ 
+         // There should only be one reference per range token.
+diff --git sc/source/ui/drawfunc/fuins2.cxx sc/source/ui/drawfunc/fuins2.cxx
+index f2562a3..22b46b9 100644
+--- sc/source/ui/drawfunc/fuins2.cxx
++++ sc/source/ui/drawfunc/fuins2.cxx
+@@ -167,8 +167,10 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
+             if ( aRangeListRef->Count() )
+             {
+                 pScDoc->LimitChartIfAll( aRangeListRef );               // limit whole columns/rows to used area
++
++                // update string from modified ranges.  The ranges must be in the current formula syntax.
+                 String aTmpStr;                            
+-                aRangeListRef->Format( aTmpStr, SCR_ABS_3D, pScDoc, pScDoc->GetAddressConvention() );   // update string from changed ranges
++                aRangeListRef->Format( aTmpStr, SCR_ABS_3D, pScDoc, pScDoc->GetAddressConvention() );
+                 aRangeString = aTmpStr;
+ 
+                 ScChartPositioner aChartPositioner( pScDoc, aRangeListRef );
+diff --git sc/source/ui/unoobj/chart2uno.cxx sc/source/ui/unoobj/chart2uno.cxx
+index 8bbd382..d9c2698 100644
+--- sc/source/ui/unoobj/chart2uno.cxx
++++ sc/source/ui/unoobj/chart2uno.cxx
+@@ -1057,7 +1057,7 @@ void lcl_SeperateOneRowRange(ScRange aR, const ScAddress& rPos, ScRangeListRef&
+     }
+ 
+     vector<ScSharedTokenRef> aTokens;
+-    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument);
++    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
+     return !aTokens.empty();
+ }
+ 
+@@ -1451,7 +1451,7 @@ ScChart2DataProvider::createDataSource(
+     }
+ 
+     vector<ScSharedTokenRef> aRefTokens;
+-    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
++    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
+     if (aRefTokens.empty())
+         // Invalid range representation.  Bail out.
+         throw lang::IllegalArgumentException();
+@@ -2184,7 +2184,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum
+         return false;
+ 
+     vector<ScSharedTokenRef> aTokens;
+-    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument);
++    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
+     return !aTokens.empty();
+ }
+ 
+@@ -2201,6 +2201,12 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL
+     if(!m_pDocument || (aRangeRepresentation.getLength() == 0))
+         return xResult;
+ 
++    // Note: the range representation must be in Calc A1 format.  The import 
++    // filters use this method to pass data ranges, and they have no idea what
++    // the current formula syntax is.  In the future we should add another
++    // method to allow the client code to directly pass tokens representing
++    // ranges.
++
+     vector<ScSharedTokenRef> aRefTokens;
+     ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
+     if (aRefTokens.empty())
+@@ -2246,7 +2252,7 @@ rtl::OUString SAL_CALL ScChart2DataProvider::convertRangeToXML( const rtl::OUStr
+         return aRet;
+ 
+     vector<ScSharedTokenRef> aRefTokens;
+-    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, sRangeRepresentation, m_pDocument);
++    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, sRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
+     if (aRefTokens.empty())
+         throw lang::IllegalArgumentException();
+ 
+@@ -2405,7 +2411,7 @@ void ScChart2DataProvider::detectRangesFromDataSource(vector<ScSharedTokenRef>&
+     {
+         const OUString& rRangeRep = *itr;
+         vector<ScSharedTokenRef> aTokens;
+-        ScRefTokenHelper::compileRangeRepresentation(aTokens, rRangeRep, m_pDocument);
++        ScRefTokenHelper::compileRangeRepresentation(aTokens, rRangeRep, m_pDocument, m_pDocument->GetGrammar());
+ 
+         CollectRefTokens func;
+         func = for_each(aTokens.begin(), aTokens.end(), func);
+diff --git sc/inc/document.hxx sc/inc/document.hxx
+index 810f215..1be2397 100644
+--- sc/inc/document.hxx
++++ sc/inc/document.hxx
+@@ -607,7 +607,7 @@ public:
+ 	SC_DLLPUBLIC BOOL			IsActiveScenario( SCTAB nTab ) const;
+ 	SC_DLLPUBLIC void			SetActiveScenario( SCTAB nTab, BOOL bActive );		// nur fuer Undo etc.
+ 	SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const;
+-    formula::FormulaGrammar::Grammar GetGrammar() const;
++    SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const;
+     void            SetGrammar( formula::FormulaGrammar::Grammar eGram );
+ 	SC_DLLPUBLIC BYTE			GetLinkMode( SCTAB nTab ) const;
+ 	BOOL			IsLinked( SCTAB nTab ) const;
+diff --git sc/source/filter/excel/xechart.cxx sc/source/filter/excel/xechart.cxx
+index b01bdc6..cf3f218 100644
+--- sc/source/filter/excel/xechart.cxx
++++ sc/source/filter/excel/xechart.cxx
+@@ -717,11 +717,12 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > x
+     if (!xDataSeq.is())
+         return nValueCount;
+ 
+-    // Compile the range representation string into token array.
++    // Compile the range representation string into token array.  Note that the 
++    // source range text depends on the current grammar.
+     OUString aRangeRepr = xDataSeq->getSourceRangeRepresentation();
+     ScRangeList aScRanges;
+     ScCompiler aComp(GetDocPtr(), ScAddress());
+-    aComp.SetGrammar(FormulaGrammar::GRAM_ENGLISH);
++    aComp.SetGrammar(GetDocPtr()->GetGrammar());
+     ScTokenArray* pArray = aComp.CompileString(aRangeRepr);
+     if (!pArray)
+         return nValueCount;
diff --git a/patches/dev300/chart-formula-syntax.diff b/patches/dev300/chart-formula-syntax.diff
index 3ea27fc..b24e614 100644
--- a/patches/dev300/chart-formula-syntax.diff
+++ b/patches/dev300/chart-formula-syntax.diff
@@ -169,18 +169,17 @@ diff --git sc/source/filter/excel/xechart.cxx sc/source/filter/excel/xechart.cxx
 index b01bdc6..cf3f218 100644
 --- sc/source/filter/excel/xechart.cxx
 +++ sc/source/filter/excel/xechart.cxx
-@@ -717,11 +717,12 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > x
-     if (!xDataSeq.is())
-         return nValueCount;
+@@ -714,10 +714,11 @@
+     if( !xDataSeq.is() )
+         return nDefCount;
  
--    // Compile the range representation string into token array.
-+    // Compile the range representation string into token array.  Note that the 
+-    // compile the range representation string into token array
++    // compile the range representation string into token array. Note that the
 +    // source range text depends on the current grammar.
      OUString aRangeRepr = xDataSeq->getSourceRangeRepresentation();
-     ScRangeList aScRanges;
-     ScCompiler aComp(GetDocPtr(), ScAddress());
--    aComp.SetGrammar(FormulaGrammar::GRAM_ENGLISH);
-+    aComp.SetGrammar(GetDocPtr()->GetGrammar());
-     ScTokenArray* pArray = aComp.CompileString(aRangeRepr);
-     if (!pArray)
-         return nValueCount;
+     ScCompiler aComp( GetDocPtr(), ScAddress() );
+-    aComp.SetGrammar( FormulaGrammar::GRAM_ENGLISH );
++    aComp.SetGrammar( GetDocPtr()->GetGrammar() );
+     ScTokenArray* pArray = aComp.CompileString( aRangeRepr );
+     if( !pArray )
+         return nDefCount;
diff --git a/patches/dev300/chart-subtitle-xls-export-m17.diff b/patches/dev300/chart-subtitle-xls-export-m17.diff
new file mode 100644
index 0000000..a765715
--- /dev/null
+++ b/patches/dev300/chart-subtitle-xls-export-m17.diff
@@ -0,0 +1,122 @@
+--- sc/source/filter/excel/xechart.cxx.old	2009-04-06 16:42:05.000000000 +0000
++++ sc/source/filter/excel/xechart.cxx	2009-04-06 16:42:05.000000000 +0000
+@@ -36,6 +36,7 @@
+ #include <com/sun/star/i18n/XBreakIterator.hpp>
+ #include <com/sun/star/i18n/ScriptType.hpp>
+ #include <com/sun/star/drawing/FillStyle.hpp>
++#include <com/sun/star/chart/XChartDocument.hpp>
+ #include <com/sun/star/chart2/XChartDocument.hpp>
+ #include <com/sun/star/chart2/XDiagram.hpp>
+ #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+@@ -876,6 +877,13 @@ void XclExpChSourceLink::ConvertNumFmt(
+     }
+ }
+ 
++void XclExpChSourceLink::AppendString( const String& rStr )
++{
++    if (!mxString.is())
++        return;
++    XclExpStringHelper::AppendString( *mxString, GetRoot(), rStr );
++}
++
+ void XclExpChSourceLink::Save( XclExpStream& rStrm )
+ {
+     // CHFORMATRUNS record
+@@ -977,7 +985,7 @@ void XclExpChText::SetRotation( sal_uInt
+     ::insert_value( maData.mnFlags, XclTools::GetXclOrientFromRot( nRotation ), 8, 3 );
+ }
+ 
+-void XclExpChText::ConvertTitle( Reference< XTitle > xTitle, sal_uInt16 nTarget )
++void XclExpChText::ConvertTitle( Reference< XTitle > xTitle, sal_uInt16 nTarget, const String* pSubTitle )
+ {
+     mxSrcLink.reset();
+     mxObjLink.reset( new XclExpChObjectLink( nTarget, XclChDataPointPos( 0, 0 ) ) );
+@@ -991,6 +999,14 @@ void XclExpChText::ConvertTitle( Referen
+         // string sequence
+         mxSrcLink.reset( new XclExpChSourceLink( GetChRoot(), EXC_CHSRCLINK_TITLE ) );
+         sal_uInt16 nFontIdx = mxSrcLink->ConvertStringSequence( xTitle->getText() );
++        if (pSubTitle)
++        {
++            // append subtitle as the 2nd line of the title.
++            String aSubTitle = String::CreateFromAscii("\n");
++            aSubTitle.Append(*pSubTitle);
++            mxSrcLink->AppendString(aSubTitle);
++        }
++
+         ConvertFontBase( GetChRoot(), nFontIdx );
+ 
+         // rotation
+@@ -1140,14 +1156,15 @@ void XclExpChText::WriteBody( XclExpStre
+ namespace {
+ 
+ /** Creates and returns an Excel text object from the passed title. */
+-XclExpChTextRef lclCreateTitle( const XclExpChRoot& rRoot, Reference< XTitled > xTitled, sal_uInt16 nTarget )
++XclExpChTextRef lclCreateTitle( const XclExpChRoot& rRoot, Reference< XTitled > xTitled, sal_uInt16 nTarget,
++                                const String* pSubTitle = NULL )
+ {
+     Reference< XTitle > xTitle;
+     if( xTitled.is() )
+         xTitle = xTitled->getTitleObject();
+ 
+     XclExpChTextRef xText( new XclExpChText( rRoot ) );
+-    xText->ConvertTitle( xTitle, nTarget );
++    xText->ConvertTitle( xTitle, nTarget, pSubTitle );
+     /*  Do not delete the CHTEXT group for the main title. A missing CHTEXT
+         will be interpreted as auto-generated title showing the series title in
+         charts that contain exactly one data series. */
+@@ -2742,6 +2759,23 @@ void XclExpChAxesSet::WriteBody( XclExpS
+ 
+ // The chart object ===========================================================
+ 
++static void lcl_getChartSubTitle(const Reference<XChartDocument>& xChartDoc, 
++                                 String& rSubTitle)
++{
++    Reference< ::com::sun::star::chart::XChartDocument > xChartDoc1(xChartDoc, UNO_QUERY);
++    if (!xChartDoc1.is())
++        return;
++
++    Reference< XPropertySet > xProp(xChartDoc1->getSubTitle(), UNO_QUERY);
++    if (!xProp.is())
++        return;
++
++    OUString aTitle;
++    Any any = xProp->getPropertyValue( OUString::createFromAscii("String") );
++    if (any >>= aTitle)
++        rSubTitle = aTitle;
++}
++
+ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
+         Reference< XChartDocument > xChartDoc, const Size& rSize ) :
+     XclExpChGroupBase( EXC_ID_CHCHART, 16 ),
+@@ -2780,7 +2814,10 @@ XclExpChChart::XclExpChChart( const XclE
+ 
+         // chart title
+         Reference< XTitled > xTitled( xChartDoc, UNO_QUERY );
+-        mxTitle = lclCreateTitle( GetChRoot(), xTitled, EXC_CHOBJLINK_TITLE );
++        String aSubTitle;
++        lcl_getChartSubTitle(xChartDoc, aSubTitle);
++        mxTitle = lclCreateTitle( GetChRoot(), xTitled, EXC_CHOBJLINK_TITLE, 
++                                  aSubTitle.Len() ? &aSubTitle : NULL );
+ 
+         // diagrams (axes sets)
+         sal_uInt16 nFreeGroupIdx = mxPrimAxesSet->Convert( xDiagram, 0 );
+--- sc/source/filter/inc/xechart.hxx.old	2009-04-06 16:41:51.000000000 +0000
++++ sc/source/filter/inc/xechart.hxx	2009-04-06 16:42:05.000000000 +0000
+@@ -348,6 +348,8 @@ public:
+     /** Converts the number format from the passed property set. */
+     void                ConvertNumFmt( const ScfPropertySet& rPropSet, bool bPercent );
+ 
++    void                AppendString( const String& rStr );
++
+     /** Returns true, if this source link contains explicit string data. */
+     inline bool         HasString() const { return mxString.is() && !mxString->IsEmpty(); }
+ 
+@@ -436,7 +438,7 @@ public:
+     virtual void        SetRotation( sal_uInt16 nRotation );
+ 
+     /** Converts all text settings of the passed title text object. */
+-    void                ConvertTitle( XTitleRef xTitle, sal_uInt16 nTarget );
++    void                ConvertTitle( XTitleRef xTitle, sal_uInt16 nTarget, const String* pSubTitle = NULL );
+     /** Converts all text settings of the passed legend. */
+     void                ConvertLegend( const ScfPropertySet& rPropSet );
+     /** Converts all settings of the passed data point caption text object. */
diff --git a/patches/dev300/chart-subtitle-xls-export.diff b/patches/dev300/chart-subtitle-xls-export.diff
index a765715..5adae73 100644
--- a/patches/dev300/chart-subtitle-xls-export.diff
+++ b/patches/dev300/chart-subtitle-xls-export.diff
@@ -1,9 +1,9 @@
 --- sc/source/filter/excel/xechart.cxx.old	2009-04-06 16:42:05.000000000 +0000
 +++ sc/source/filter/excel/xechart.cxx	2009-04-06 16:42:05.000000000 +0000
-@@ -36,6 +36,7 @@
- #include <com/sun/star/i18n/XBreakIterator.hpp>
- #include <com/sun/star/i18n/ScriptType.hpp>
+@@ -38,6 +38,7 @@
  #include <com/sun/star/drawing/FillStyle.hpp>
+ #include <com/sun/star/chart/DataLabelPlacement.hpp>
+ #include <com/sun/star/chart/ErrorBarStyle.hpp>
 +#include <com/sun/star/chart/XChartDocument.hpp>
  #include <com/sun/star/chart2/XChartDocument.hpp>
  #include <com/sun/star/chart2/XDiagram.hpp>


More information about the ooo-build-commit mailing list