[Libreoffice-commits] .: 4 commits - connectivity/source svl/Module_svl.mk sw/source xmloff/source

Michael Stahl mst at kemper.freedesktop.org
Fri Jan 20 06:19:46 PST 2012


 connectivity/source/drivers/file/FResultSet.cxx |   50 +++++++++---------------
 svl/Module_svl.mk                               |    1 
 sw/source/ui/config/optpage.cxx                 |    4 +
 xmloff/source/text/txtparae.cxx                 |   32 ++++++++++-----
 4 files changed, 44 insertions(+), 43 deletions(-)

New commits:
commit c82ed24c4e51492105b5d94e164ece3cf86d6d86
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jan 20 13:45:54 2012 +0100

    rhbz#746174: also export list restart for non root list

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 6db50ff..3761121 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -906,8 +906,8 @@ void XMLTextParagraphExport::exportListChange(
             // Thus, for other document types <sListId> is empty.
             const ::rtl::OUString sListId( rNextInfo.GetListId() );
             bool bExportListStyle( true );
-            bool bRestartNumberingAtContinuedRootList( false );
-            sal_Int16 nRestartValueForContinuedRootList( -1 );
+            bool bRestartNumberingAtContinuedList( false );
+            sal_Int32 nRestartValueForContinuedList( -1 );
             bool bContinueingPreviousSubList = !bRootListToBeStarted &&
                                                rNextInfo.IsContinueingPreviousSubTree();
             do {
@@ -980,9 +980,9 @@ void XMLTextParagraphExport::exportListChange(
                                  ( nListLevelsToBeOpened != 1 ||
                                    !rNextInfo.HasStartValue() ) )
                             {
-                                bRestartNumberingAtContinuedRootList = true;
-                                nRestartValueForContinuedRootList =
-                                                rNextInfo.GetListLevelStartValue();
+                                bRestartNumberingAtContinuedList = true;
+                                nRestartValueForContinuedList =
+                                            rNextInfo.GetListLevelStartValue();
                             }
                         }
 
@@ -1003,6 +1003,18 @@ void XMLTextParagraphExport::exportListChange(
                     GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
                             GetExport().EncodeStyleName( sListStyleName ) );
                     bExportListStyle = false;
+
+
+                }
+                else
+                {
+                    // rhbz#746174: also export list restart for non root list
+                    if (rNextInfo.IsRestart() && !rNextInfo.HasStartValue())
+                    {
+                        bRestartNumberingAtContinuedList = true;
+                        nRestartValueForContinuedList =
+                                        rNextInfo.GetListLevelStartValue();
+                    }
                 }
 
                 if ( bContinueingPreviousSubList )
@@ -1030,9 +1042,7 @@ void XMLTextParagraphExport::exportListChange(
                 // <text:list-header> or <text:list-item>
                 GetExport().CheckAttrList();
 
-                /* Export start value in case of <bRestartNumberingAtContinuedRootList>
-                   at correct list item (#i97309#)
-                */
+                /* Export start value at correct list item (#i97309#) */
                 if ( nListLevelsToBeOpened == 1 )
                 {
                     if ( rNextInfo.HasStartValue() )
@@ -1042,14 +1052,14 @@ void XMLTextParagraphExport::exportListChange(
                         GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
                                       aBuffer.makeStringAndClear() );
                     }
-                    else if ( bRestartNumberingAtContinuedRootList )
+                    else if (bRestartNumberingAtContinuedList)
                     {
                         OUStringBuffer aBuffer;
-                        aBuffer.append( (sal_Int32)nRestartValueForContinuedRootList );
+                        aBuffer.append( nRestartValueForContinuedList );
                         GetExport().AddAttribute( XML_NAMESPACE_TEXT,
                                                   XML_START_VALUE,
                                                   aBuffer.makeStringAndClear() );
-                        bRestartNumberingAtContinuedRootList = false;
+                        bRestartNumberingAtContinuedList = false;
                     }
                 }
 
commit 35e8190b0317972abb376dd2ed55567c43bc8b4d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jan 19 15:25:07 2012 +0100

    connectivity: fdo#43479: fix crash on DISTINCT:
    
    Since commit f89f2b8bf506de0cc547ad596c75cbe1a0cf1ef1,
    OResultSet::sortRows() works on the rows after SELECT, not on full rows.
    So OResultSet::OpenImpl() has to be adapted to not use the mapping from
    selected columns to entries rows in m_aColMapping any more; instead,
    use the given ORDER BY clause for sorting.
    But first extend the sort order to cover all columns, so it is no longer
    necessary to call sortRows twice (this should be legal, because SQL says
    the order of rows that are equal in ORDER BY columns is unspecified).

diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index 43b7827..c47e92f 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -1438,26 +1438,31 @@ sal_Bool OResultSet::OpenImpl()
             else
             {
                 sal_Bool bDistinct = sal_False;
-                sal_Bool bWasSorted = sal_False;
                 OSQLParseNode *pDistinct = m_pParseTree->getChild(1);
-                ::std::vector<sal_Int32>                aOrderbyColumnNumberSave;
-                ::std::vector<TAscendingOrder>          aOrderbyAscendingSave;
 
+                assert(m_aOrderbyColumnNumber.size() ==
+                       m_aOrderbyAscending.size());
                 if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT )
                 {
-                    // Sort on all columns, saving original order for later
-                    if(IsSorted())
+                    // To eliminate duplicates we need to sort on all columns.
+                    // This is not a problem because the SQL spec says that the
+                    // order of columns that are not specified in ORDER BY
+                    // clause is undefined, so it doesn't hurt to sort on
+                    // these; pad the vectors to include them.
+                    for (sal_Int32 i = 1;
+                         static_cast<size_t>(i) < m_aColMapping.size(); ++i)
                     {
-                        aOrderbyColumnNumberSave = m_aOrderbyColumnNumber;
-                        m_aOrderbyColumnNumber.clear();
-                        aOrderbyAscendingSave.assign(m_aOrderbyAscending.begin(), m_aOrderbyAscending.end());
-                        bWasSorted = sal_True;
+                        if (::std::find(m_aOrderbyColumnNumber.begin(),
+                                        m_aOrderbyColumnNumber.end(), i)
+                                == m_aOrderbyColumnNumber.end())
+                        {
+                            m_aOrderbyColumnNumber.push_back(i);
+                            m_aOrderbyAscending.push_back(
+                                    (m_aOrderbyAscending.empty())
+                                        ? SQL_ASC // default for no ORDER BY
+                                        : m_aOrderbyAscending.back());
+                        }
                     }
-
-                    // the first column is the bookmark column
-                    ::std::vector<sal_Int32>::iterator aColStart = (m_aColMapping.begin()+1);
-                    ::std::copy(aColStart, m_aColMapping.end(),::std::back_inserter(m_aOrderbyColumnNumber));
-                    m_aOrderbyAscending.assign(m_aColMapping.size()-1, SQL_ASC);
                     bDistinct = sal_True;
                 }
 
@@ -1539,23 +1544,6 @@ sal_Bool OResultSet::OpenImpl()
                         m_pFileSet->get().erase(::std::remove_if(m_pFileSet->get().begin(),m_pFileSet->get().end(),
                                                             ::std::bind2nd(::std::equal_to<sal_Int32>(),0))
                                           ,m_pFileSet->get().end());
-
-                        if (bWasSorted)
-                        {
-                            // Re-sort on original requested order
-                            m_aOrderbyColumnNumber = aOrderbyColumnNumberSave;
-                            m_aOrderbyAscending.assign(aOrderbyAscendingSave.begin(), aOrderbyAscendingSave.end());
-
-                            TIntVector aEvaluationKeySet(m_pFileSet->get());
-                            m_pEvaluationKeySet = &aEvaluationKeySet;
-                            sortRows();
-                        }
-                        else
-                        {
-                            m_aOrderbyColumnNumber.clear();
-                            m_aOrderbyAscending.clear();
-                            ::std::sort(m_pFileSet->get().begin(),m_pFileSet->get().end());
-                        }
                     }
                 }
             }
commit ca7aa534777db183cabcc01978840a4581f01829
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jan 19 12:09:14 2012 +0100

    svl: add new test to subsequenttests

diff --git a/svl/Module_svl.mk b/svl/Module_svl.mk
index 801aa5a..2639cdf 100644
--- a/svl/Module_svl.mk
+++ b/svl/Module_svl.mk
@@ -43,6 +43,7 @@ $(eval $(call gb_Module_add_check_targets,svl,\
 # in tail build
 
 $(eval $(call gb_Module_add_subsequentcheck_targets,svl,\
+	CppunitTest_svl_urihelper \
     JunitTest_svl_complex \
 ))
 
commit 57444c86d274e5602218d1163810fe586aec02c0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jan 18 13:54:24 2012 +0100

    sw: SwAddPrinterTabPage::SetFax: fix STL conversion
    
    regression from 166053646aff23f93ad3704cde05b9bda20e171c

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 3952f40..f08b487 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -508,7 +508,9 @@ void  SwAddPrinterTabPage::SetFax( const std::vector<String>& rFaxLst )
 {
     aFaxLB.InsertEntry(sNone);
     for(size_t i = 0; i < rFaxLst.size(); ++i)
-        aFaxLB.InsertEntry(rFaxLst[0]);
+    {
+        aFaxLB.InsertEntry(rFaxLst[i]);
+    }
     aFaxLB.SelectEntryPos(0);
 }
 


More information about the Libreoffice-commits mailing list