[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.0' - 7 commits - instsetoo_native/util oox/source solenv/inc sw/inc sw/qa sw/source

Andras Timar andras.timar at collabora.com
Tue Nov 5 12:35:23 CET 2013


 instsetoo_native/util/openoffice.lst              |   24 +++++++-------
 oox/source/drawingml/chart/seriesconverter.cxx    |    3 +
 oox/source/drawingml/chart/typegroupconverter.cxx |   19 +++++++++++
 solenv/inc/minor.mk                               |    4 +-
 sw/inc/crsrsh.hxx                                 |    4 +-
 sw/qa/extras/odfimport/data/fdo69862.odt          |binary
 sw/qa/extras/odfimport/data/fdo69979.odt          |binary
 sw/qa/extras/odfimport/odfimport.cxx              |   36 ++++++++++++++++++++++
 sw/source/core/crsr/crsrsh.cxx                    |   12 +++----
 sw/source/core/edit/eddel.cxx                     |    2 -
 sw/source/core/edit/edglss.cxx                    |    2 -
 sw/source/ui/wrtsh/select.cxx                     |    8 ++++
 12 files changed, 88 insertions(+), 26 deletions(-)

New commits:
commit 5910474aa23c4e2365be167077817586db162432
Author: Andras Timar <andras.timar at collabora.com>
Date:   Mon Oct 28 06:34:44 2013 -0700

    Bump for 4.0-20
    
    Change-Id: I2ced784f302ab7011f496470cfa19e67e6f8ed3e

diff --git a/instsetoo_native/util/openoffice.lst b/instsetoo_native/util/openoffice.lst
index 59317f7..25672e0 100644
--- a/instsetoo_native/util/openoffice.lst
+++ b/instsetoo_native/util/openoffice.lst
@@ -33,7 +33,7 @@ Globals
             CREATE_MSP_INSTALLSET 0
             UPDATE_DATABASE_LISTNAME finals_instsetoo.txt
             PACKAGEMAP package_names.txt,package_names_ext.txt
-            WINDOWSPATCHLEVEL 19
+            WINDOWSPATCHLEVEL 20
             OOOVENDOR The Document Foundation
             OOODOWNLOADNAME 1
             BUILDIDCWS {buildidcws}
@@ -50,13 +50,13 @@ LibreOffice
         {
             PRODUCTNAME LibreOffice
             PRODUCTVERSION 4.0
-            PRODUCTEXTENSION -19
+            PRODUCTEXTENSION -20
             POSTVERSIONEXTENSION
             POSTVERSIONEXTENSIONUNIX
             BRANDPACKAGEVERSION 4.0
             USERDIRPRODUCTVERSION 4
             ABOUTBOXPRODUCTVERSION 4.0
-            ABOUTBOXPRODUCTVERSIONSUFFIX :build-319
+            ABOUTBOXPRODUCTVERSIONSUFFIX :build-320
             BASEPRODUCTVERSION 4.0
             PCPFILENAME libreoffice.pcp
             UPDATEURL http://update.libreoffice.org/check.php
@@ -100,14 +100,14 @@ LibreOffice_Dev
         {
             PRODUCTNAME LOdev
             PRODUCTVERSION 4.0
-            PRODUCTEXTENSION -19
+            PRODUCTEXTENSION -20
             UNIXBASISROOTNAME lodev4.0
             POSTVERSIONEXTENSION
             POSTVERSIONEXTENSIONUNIX
             BRANDPACKAGEVERSION 4.0
             USERDIRPRODUCTVERSION 4
             ABOUTBOXPRODUCTVERSION 4.0
-            ABOUTBOXPRODUCTVERSIONSUFFIX :build-319
+            ABOUTBOXPRODUCTVERSIONSUFFIX :build-320
             BASEPRODUCTVERSION 4.0
             DEVELOPMENTPRODUCT 1
             BASISPACKAGEPREFIX lodevbasis
@@ -161,7 +161,7 @@ URE
             PRODUCTVERSION 4.0
             PACKAGEVERSION 4.0
             PACKAGEREVISION 1
-            PRODUCTEXTENSION -19
+            PRODUCTEXTENSION -20
             BRANDPACKAGEVERSION 4.0
             LICENSENAME LGPL
             NOVERSIONINDIRNAME 1
@@ -192,7 +192,7 @@ LibreOffice_SDK
         {
             PRODUCTNAME LibreOffice
             PRODUCTVERSION 4.0
-            PRODUCTEXTENSION -19
+            PRODUCTEXTENSION -20
             POSTVERSIONEXTENSION SDK
             POSTVERSIONEXTENSIONUNIX sdk
             BRANDPACKAGEVERSION 4.0
@@ -231,7 +231,7 @@ LibreOffice_Dev_SDK
         {
             PRODUCTNAME LOdev
             PRODUCTVERSION 4.0
-            PRODUCTEXTENSION -19
+            PRODUCTEXTENSION -20
             UNIXBASISROOTNAME lodev4.0
             POSTVERSIONEXTENSION SDK
             POSTVERSIONEXTENSIONUNIX sdk
@@ -276,7 +276,7 @@ LibreOffice_Test
         {
             PRODUCTNAME LibreOffice
             PRODUCTVERSION 4.0
-            PRODUCTEXTENSION -19
+            PRODUCTEXTENSION -20
             POSTVERSIONEXTENSION TEST
             POSTVERSIONEXTENSIONUNIX test
             BRANDPACKAGEVERSION 4.0
@@ -315,7 +315,7 @@ LibreOffice_Dev_Test
         {
             PRODUCTNAME LOdev
             PRODUCTVERSION 4.0
-            PRODUCTEXTENSION -19
+            PRODUCTEXTENSION -20
             UNIXBASISROOTNAME lodev4.0
             POSTVERSIONEXTENSION TEST
             POSTVERSIONEXTENSIONUNIX test
@@ -359,13 +359,13 @@ OxygenOffice
         {
             PRODUCTNAME OxygenOffice
             PRODUCTVERSION 4.0
-            PRODUCTEXTENSION -19
+            PRODUCTEXTENSION -20
             POSTVERSIONEXTENSION
             POSTVERSIONEXTENSIONUNIX
             BRANDPACKAGEVERSION 4.0
             USERDIRPRODUCTVERSION 4
             ABOUTBOXPRODUCTVERSION 4.0
-            ABOUTBOXPRODUCTVERSIONSUFFIX :build-319
+            ABOUTBOXPRODUCTVERSIONSUFFIX :build-320
             BASEPRODUCTVERSION 4.0
             PCPFILENAME openoffice.pcp
             UPDATEURL http://update.libreoffice.org/check.php
diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk
index 62f7379..9073bee 100644
--- a/solenv/inc/minor.mk
+++ b/solenv/inc/minor.mk
@@ -1,6 +1,6 @@
 RSCVERSION=400
-RSCREVISION=400m1(Build:319)
-BUILD=319
+RSCREVISION=400m1(Build:320)
+BUILD=320
 LAST_MINOR=m0
 SOURCEVERSION=OOO400
 
commit 28761942f8f281bd6787e8ad9b042bbcedbcfd83
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Oct 28 11:15:43 2013 +0100

    bnc#825891 fdo#69893 fix SwWrtShell::SelAll() to work with empty table at doc start
    
    In theory, it was a problem to have the table cursor around when having
    the selection outside the table; but it didn't cause a problem so far.
    However, when the table has one or more empty cells, we really need to
    leave table mode, otherwise only the table gets selected.
    
    Change-Id: I766903ed624b9338f0612697b4c03f44de1d2e41
    (cherry picked from commit d1eb536c7e410d40fd94c76b157bbd4ed7944d4c)
    
    Conflicts:
    	sw/qa/extras/uiwriter/uiwriter.cxx

diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
index 3923fe3..feb47e3 100644
--- a/sw/source/ui/wrtsh/select.cxx
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -162,7 +162,13 @@ long SwWrtShell::SelAll()
 
         bool bStartsWithTable = StartsWithTable();
         if (bStartsWithTable)
+        {
+            // Disable table cursor to make sure getShellCrsr() returns m_pCurCrsr, not m_pTblCrsr.
+            if (IsTableMode())
+                TblCrsrToCursor();
+            // Do the extended select all on m_pCurCrsr.
             ExtendedSelectAll(/*bFootnotes =*/ false);
+        }
 
         if( pStartPos )
         {
commit 4a66e3c54194e850a97c8875e99bb571bada3d82
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Oct 2 11:19:18 2013 +0200

    bnc#825891 fdo#69979 SwCrsrShell::ExtendedSelectAll: exclude headers, too
    
    It turns out, normal Ctrl-A doesn't select headers, footers and fly
    content, either (just like not selecting footnotes). So do the same when
    in the "doc starts with table" special mode.
    
    Change-Id: Ib9bc397944a4d07ea03bc326f1536733c57f42e6
    (cherry picked from commit 232df42b8dc0b4f7a335d2931fc0f29e73b8bca0)
    
    Conflicts:
    	sw/qa/extras/odfimport/odfimport.cxx
    	sw/source/core/crsr/crsrsh.cxx

diff --git a/sw/qa/extras/odfimport/data/fdo69979.odt b/sw/qa/extras/odfimport/data/fdo69979.odt
new file mode 100644
index 0000000..8f7d77e
Binary files /dev/null and b/sw/qa/extras/odfimport/data/fdo69979.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 6a1240e..eb8a819 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -49,6 +49,7 @@ public:
     void testFdo37606();
     void testFdo37606Copy();
     void testFdo69862();
+    void testFdo69979();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -70,6 +71,7 @@ void Test::run()
         {"fdo37606.odt", &Test::testFdo37606},
         {"fdo37606.odt", &Test::testFdo37606Copy},
         {"fdo69862.odt", &Test::testFdo69862},
+        {"fdo69979.odt", &Test::testFdo69979},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -371,7 +373,22 @@ void Test::testFdo69862()
 
     SwTxtNode& rEnd = dynamic_cast<SwTxtNode&>(pShellCrsr->End()->nNode.GetNode());
     CPPUNIT_ASSERT_EQUAL(String("H" "\x01" "ello."), rEnd.GetTxt());
+}
+
+void Test::testFdo69979()
+{
+    // The test doc is special in that it starts with a table and it also has a header.
+    SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+    SwWrtShell* pWrtShell = pTxtDoc->GetDocShell()->GetWrtShell();
+    SwShellCrsr* pShellCrsr = pWrtShell->getShellCrsr(false);
 
+    pWrtShell->SelAll();
+    SwTxtNode& rStart = dynamic_cast<SwTxtNode&>(pShellCrsr->Start()->nNode.GetNode());
+    // This was "", as Ctrl-A also selected headers, but it should not.
+    CPPUNIT_ASSERT_EQUAL(String("A1"), rStart.GetTxt());
+
+    SwTxtNode& rEnd = dynamic_cast<SwTxtNode&>(pShellCrsr->End()->nNode.GetNode());
+    CPPUNIT_ASSERT_EQUAL(String("Hello."), rEnd.GetTxt());
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 731c017..9b2af3b 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -539,7 +539,7 @@ void SwCrsrShell::ExtendedSelectAll(bool bFootnotes)
 {
     SwNodes& rNodes = GetDoc()->GetNodes();
     SwPosition* pPos = pCurCrsr->GetPoint();
-    pPos->nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfInserts();
+    pPos->nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfAutotext();
     pPos->nContent.Assign( rNodes.GoNext( &pPos->nNode ), 0 );
     pPos = pCurCrsr->GetMark();
     pPos->nNode = rNodes.GetEndOfContent();
@@ -550,7 +550,7 @@ void SwCrsrShell::ExtendedSelectAll(bool bFootnotes)
 bool SwCrsrShell::ExtendedSelectedAll(bool bFootnotes)
 {
     SwNodes& rNodes = GetDoc()->GetNodes();
-    SwNodeIndex nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfInserts();
+    SwNodeIndex nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfAutotext();
     SwCntntNode* pStart = rNodes.GoNext(&nNode);
 
     nNode = rNodes.GetEndOfContent();
commit 60d595d850bed308d7f49a0da4884fd25db06cb5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Sep 30 11:45:35 2013 +0200

    bnc#825891 fdo#69862 SwCrsrShell::ExtendedSelectAll: don't always select footnotes
    
    ExtendedSelectAll() was originally invented to e.g. select the whole
    document, change the language of the selection and then inmediately
    (before the layout is updated) undo the selection.
    
    When using it for "select all and doc starts with a table" purposes,
    then footnotes shouldn't be selected, just like those are not selected
    either, when the doc starts with a normal paragraph. Their anchor is
    still selected, and that's enough to have correct delete and copy&paste.
    
    Change-Id: I4fc49db628054a4b8a46effc2d0328eaabcaa9f8
    (cherry picked from commit 959711f1276106b0aaee69ab660f1b0d3ece5bbc)
    
    Conflicts:
    	sw/source/core/crsr/crsrsh.cxx
    	sw/source/core/edit/eddel.cxx

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index f1e1411..c2f9010 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -323,9 +323,9 @@ public:
     // SelAll() selects the document body content
     // if ExtendedSelect() is called afterwards, the whole nodes array is selected
     // only for usage in special cases allowed!
-    void ExtendedSelectAll();
+    void ExtendedSelectAll(bool bFootnotes = true);
     /// If ExtendedSelectAll() was called and selection didn't change since then.
-    bool ExtendedSelectedAll();
+    bool ExtendedSelectedAll(bool bFootnotes = true);
     /// If document body starts with a table.
     bool StartsWithTable();
 
diff --git a/sw/qa/extras/odfimport/data/fdo69862.odt b/sw/qa/extras/odfimport/data/fdo69862.odt
new file mode 100644
index 0000000..aec48fd
Binary files /dev/null and b/sw/qa/extras/odfimport/data/fdo69862.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 456eb50..6a1240e 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -48,6 +48,7 @@ public:
     void testFdo56272();
     void testFdo37606();
     void testFdo37606Copy();
+    void testFdo69862();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -68,6 +69,7 @@ void Test::run()
         {"fdo56272.odt", &Test::testFdo56272},
         {"fdo37606.odt", &Test::testFdo37606},
         {"fdo37606.odt", &Test::testFdo37606Copy},
+        {"fdo69862.odt", &Test::testFdo69862},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -355,6 +357,23 @@ void Test::testFdo37606Copy()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
 }
 
+void Test::testFdo69862()
+{
+    // The test doc is special in that it starts with a table and it also has a footnote.
+    SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+    SwWrtShell* pWrtShell = pTxtDoc->GetDocShell()->GetWrtShell();
+    SwShellCrsr* pShellCrsr = pWrtShell->getShellCrsr(false);
+
+    pWrtShell->SelAll();
+    SwTxtNode& rStart = dynamic_cast<SwTxtNode&>(pShellCrsr->Start()->nNode.GetNode());
+    // This was "Footnote.", as Ctrl-A also selected footnotes, but it should not.
+    CPPUNIT_ASSERT_EQUAL(String("A1"), rStart.GetTxt());
+
+    SwTxtNode& rEnd = dynamic_cast<SwTxtNode&>(pShellCrsr->End()->nNode.GetNode());
+    CPPUNIT_ASSERT_EQUAL(String("H" "\x01" "ello."), rEnd.GetTxt());
+
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 197ac44..731c017 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -239,7 +239,7 @@ void SwCrsrShell::StartAction()
 void SwCrsrShell::EndAction( const sal_Bool bIdleEnd )
 {
     sal_Bool bVis = bSVCrsrVis;
-    comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll());
+    comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false));
 
     // Idle-formatting?
     if( bIdleEnd && Imp()->GetRegion() )
@@ -535,11 +535,11 @@ sal_Bool SwCrsrShell::SttEndDoc( sal_Bool bStt )
     return bRet;
 }
 
-void SwCrsrShell::ExtendedSelectAll()
+void SwCrsrShell::ExtendedSelectAll(bool bFootnotes)
 {
     SwNodes& rNodes = GetDoc()->GetNodes();
     SwPosition* pPos = pCurCrsr->GetPoint();
-    pPos->nNode = rNodes.GetEndOfPostIts();
+    pPos->nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfInserts();
     pPos->nContent.Assign( rNodes.GoNext( &pPos->nNode ), 0 );
     pPos = pCurCrsr->GetMark();
     pPos->nNode = rNodes.GetEndOfContent();
@@ -547,10 +547,10 @@ void SwCrsrShell::ExtendedSelectAll()
     pPos->nContent.Assign( pCNd, pCNd ? pCNd->Len() : 0 );
 }
 
-bool SwCrsrShell::ExtendedSelectedAll()
+bool SwCrsrShell::ExtendedSelectedAll(bool bFootnotes)
 {
     SwNodes& rNodes = GetDoc()->GetNodes();
-    SwNodeIndex nNode = rNodes.GetEndOfPostIts();
+    SwNodeIndex nNode = bFootnotes ? rNodes.GetEndOfPostIts() : rNodes.GetEndOfInserts();
     SwCntntNode* pStart = rNodes.GoNext(&nNode);
 
     nNode = rNodes.GetEndOfContent();
@@ -1175,7 +1175,7 @@ sal_Bool SwCrsrShell::GoPrevCrsr()
 
 void SwCrsrShell::Paint( const Rectangle &rRect)
 {
-    comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll());
+    comphelper::FlagRestorationGuard g(mbSelectAll, StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false));
     SET_CURR_SHELL( this );
 
     // always switch off all cursors when painting
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 1f98618..064fe3d 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -39,7 +39,7 @@
 
 void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo )
 {
-    bool bSelectAll = StartsWithTable() && ExtendedSelectedAll();
+    bool bSelectAll = StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false);
     // nur bei Selektion
     if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark())
         return;
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index 8828b97e..8199db4 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -226,7 +226,7 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
         bool bColSel = _GetCrsr()->IsColumnSelection();
         if( bColSel && pInsDoc->IsClipBoard() )
             pInsDoc->SetColumnSelection( true );
-        bool bSelectAll = StartsWithTable() && ExtendedSelectedAll();
+        bool bSelectAll = StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false);
         {
         FOREACHPAM_START(this)
 
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
index c57c13c..3923fe3 100644
--- a/sw/source/ui/wrtsh/select.cxx
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -162,7 +162,7 @@ long SwWrtShell::SelAll()
 
         bool bStartsWithTable = StartsWithTable();
         if (bStartsWithTable)
-            ExtendedSelectAll();
+            ExtendedSelectAll(/*bFootnotes =*/ false);
 
         if( pStartPos )
         {
commit 13f137f9a107a5a34d51cdf2ae2209ba222512e8
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Oct 28 12:29:48 2013 +0100

    oox: fix build
    
    OUString::number() -> OUString::valueOf()

diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx
index 164abb0..ab43614 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -297,7 +297,7 @@ Reference< XLabeledDataSequence > TypeGroupConverter::createCategorySequence()
         DataSourceModel &aSrc = aModel.maSources.create( SeriesModel::CATEGORIES );
         DataSequenceModel &aSeq = aSrc.mxDataSeq.create();
         for( sal_Int32 i = 0; i < nMaxValues; i++ )
-            aSeq.maData[ i ] <<= OUString::number( i + 1 );
+            aSeq.maData[ i ] <<= OUString::valueOf( i + 1 );
         SeriesConverter aSeriesConv( *this,  aModel );
         xLabeledSeq = aSeriesConv.createCategorySequence( "categories" );
     }
commit f05df6cd281a3e4530e33899dfb1fc80383386c9
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Tue Oct 22 15:13:41 2013 +0530

    n#839727: Crash fix.

diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index e2f9034..419a316 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -631,7 +631,8 @@ Reference< XDataSeries > SeriesConverter::createDataSeries( const TypeGroupConve
         {
             // Use number format code from Value series
             DataSourceModel* pValues = mrModel.maSources.get( SeriesModel::VALUES ).get();
-            xLabels->maNumberFormat.maFormatCode = pValues->mxDataSeq->maFormatCode;
+            if( pValues )
+                xLabels->maNumberFormat.maFormatCode = pValues->mxDataSeq->maFormatCode;
         }
         DataLabelsConverter aLabelsConv( *this, *xLabels );
         aLabelsConv.convertFromModel( xDataSeries, rTypeGroup );
commit 506e4cb68cc01ff9934ca02422cdb0a89f4f7eae
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Tue Oct 22 14:47:56 2013 +0530

    n#839727: Chart missing dataset.
    
    This was because there is no explicit category
    in the chart - while libreoffice expects it.

diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx
index 7b72fd4..164abb0 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -270,6 +270,7 @@ Reference< XCoordinateSystem > TypeGroupConverter::createCoordinateSystem()
 
 Reference< XLabeledDataSequence > TypeGroupConverter::createCategorySequence()
 {
+    sal_Int32 nMaxValues = 0;
     Reference< XLabeledDataSequence > xLabeledSeq;
     /*  Find first existing category sequence. The bahaviour of Excel 2007 is
         different to Excel 2003, which always used the category sequence of the
@@ -281,6 +282,24 @@ Reference< XLabeledDataSequence > TypeGroupConverter::createCategorySequence()
             SeriesConverter aSeriesConv( *this, **aIt );
             xLabeledSeq = aSeriesConv.createCategorySequence( CREATE_OUSTRING( "categories" ) );
         }
+        else if( nMaxValues <= 0 && (*aIt)->maSources.has( SeriesModel::VALUES ) )
+        {
+            DataSourceModel *pValues = (*aIt)->maSources.get( SeriesModel::VALUES ).get();
+            if( pValues->mxDataSeq.is() )
+                nMaxValues = pValues->mxDataSeq.get()->maData.size();
+        }
+    }
+    /* n#839727 Create Category Sequence when none are found */
+    if( !xLabeledSeq.is() && mrModel.maSeries.size() > 0 ) {
+        if( nMaxValues < 0 )
+            nMaxValues = 2;
+        SeriesModel &aModel = mrModel.maSeries.create();
+        DataSourceModel &aSrc = aModel.maSources.create( SeriesModel::CATEGORIES );
+        DataSequenceModel &aSeq = aSrc.mxDataSeq.create();
+        for( sal_Int32 i = 0; i < nMaxValues; i++ )
+            aSeq.maData[ i ] <<= OUString::number( i + 1 );
+        SeriesConverter aSeriesConv( *this,  aModel );
+        xLabeledSeq = aSeriesConv.createCategorySequence( "categories" );
     }
     return xLabeledSeq;
 }


More information about the Libreoffice-commits mailing list