ooo-build r13549 - in branches/ooo-build-2-4-1: . patches/src680



Author: pmladek
Date: Wed Aug 13 19:31:54 2008
New Revision: 13549
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13549&view=rev

Log:
2008-08-13  Kohei Yoshida  <kyoshida novell com>

	* patches/src680/chart-subtitle-xls-export.diff: preserve the subtitle
	of a chart when exporting to an xls file (n#411855, i#92357).

	* patches/src680/apply: apply the new file



Added:
   branches/ooo-build-2-4-1/patches/src680/chart-subtitle-xls-export.diff
Modified:
   branches/ooo-build-2-4-1/ChangeLog
   branches/ooo-build-2-4-1/patches/src680/apply

Modified: branches/ooo-build-2-4-1/patches/src680/apply
==============================================================================
--- branches/ooo-build-2-4-1/patches/src680/apply	(original)
+++ branches/ooo-build-2-4-1/patches/src680/apply	Wed Aug 13 19:31:54 2008
@@ -1798,6 +1798,9 @@
 # sheets can be distinguished.
 svtools-adjust-sheet-tabcolor.diff, n#386029, kohei
 
+# Squeeze chart's subtitle into the 2nd line of the main title when exporting
+# to xls.
+chart-subtitle-xls-export.diff, i#92357, n#411855, kohei
 
 [ ImpressFixes ]
 

Added: branches/ooo-build-2-4-1/patches/src680/chart-subtitle-xls-export.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-2-4-1/patches/src680/chart-subtitle-xls-export.diff	Wed Aug 13 19:31:54 2008
@@ -0,0 +1,126 @@
+diff --git sc/source/filter/excel/xechart.cxx sc/source/filter/excel/xechart.cxx
+index 7cf370e..d5763da 100644
+--- sc/source/filter/excel/xechart.cxx
++++ sc/source/filter/excel/xechart.cxx
+@@ -40,6 +40,7 @@
+ 
+ #include <com/sun/star/i18n/XBreakIterator.hpp>
+ #include <com/sun/star/i18n/ScriptType.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>
+@@ -781,6 +782,13 @@ void XclExpChSourceLink::ConvertNumFmt( const ScfPropertySet& rPropSet, bool bPe
+     }
+ }
+ 
++void XclExpChSourceLink::AppendString( const String& rStr )
++{
++    if (!mxString.is())
++        return;
++    XclExpStringHelper::AppendString( *mxString, GetRoot(), rStr );
++}
++
+ void XclExpChSourceLink::Save( XclExpStream& rStrm )
+ {
+     // CHFORMATRUNS record
+@@ -882,7 +890,7 @@ void XclExpChText::SetRotation( sal_uInt16 nRotation )
+     ::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 ) ) );
+@@ -896,6 +904,14 @@ void XclExpChText::ConvertTitle( Reference< XTitle > xTitle, sal_uInt16 nTarget
+         // 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
+@@ -1045,14 +1061,15 @@ void XclExpChText::WriteBody( XclExpStream& rStrm )
+ 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. */
+@@ -2568,6 +2585,23 @@ void XclExpChAxesSet::WriteBody( XclExpStream& rStrm )
+ 
+ // 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 ),
+@@ -2599,7 +2633,10 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
+ 
+         // 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)
+         Reference< XDiagram > xDiagram = xChartDoc->getFirstDiagram();
+diff --git sc/source/filter/inc/xechart.hxx sc/source/filter/inc/xechart.hxx
+index 7a3b761..a17adb6 100644
+--- sc/source/filter/inc/xechart.hxx
++++ sc/source/filter/inc/xechart.hxx
+@@ -350,6 +350,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(); }
+ 
+@@ -438,7 +440,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. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]