[Libreoffice-commits] .: 4 commits - solenv/gdb sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 24 16:19:39 PDT 2012


 solenv/gdb/libreoffice/sw.py       |    6 ++++
 sw/source/core/txtnode/ndhints.cxx |   38 +++++++++++++++++-------------
 sw/source/ui/uiview/viewsrch.cxx   |   46 ++++++++++++++++++-------------------
 3 files changed, 51 insertions(+), 39 deletions(-)

New commits:
commit aad3cc3db08c40e62ce2d7f1105455fec9fab4a2
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Aug 25 01:16:08 2012 +0200

    gdb: SwPaMPrinter: print rings as well
    
    Change-Id: I31b7b6b0cd4ac67c059729e68b50c92b865930b0

diff --git a/solenv/gdb/libreoffice/sw.py b/solenv/gdb/libreoffice/sw.py
index 941f56d..a9d2e8c 100644
--- a/solenv/gdb/libreoffice/sw.py
+++ b/solenv/gdb/libreoffice/sw.py
@@ -72,9 +72,15 @@ class SwPaMPrinter(object):
         return "%s" % (self.typename)
 
     def children(self):
+        next_ = self.value['pNext']
+        prev  = self.value['pPrev']
         point = self.value['m_pPoint'].dereference()
         mark = self.value['m_pMark'].dereference()
         children = [ ( 'point', point), ( 'mark', mark ) ]
+        if next_ != self.value.address:
+            children.append(("next", next_))
+        if prev != self.value.address:
+            children.append(("prev", prev))
         return children.__iter__()
 
 class SwRectPrinter(object):
commit b3233579ccb2528912835deedde37c1d48417d6c
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Aug 25 00:39:21 2012 +0200

    fdo#49901: SwView::ExecSearch: fix Replace All cursor:
    
    Because the "fix" for i#8288 only set the point of the cursor and not
    the mark, it can happen that after a Replace All weird things are
    selected; fix that (and i#8288 properly) by using the SwCrsrShell stack,
    and don't do it when searching in the selection.
    This cannot be done in SwCrsrShell itself because ExecSearch sets the
    cursor to the beginning/end of the document already.
    (regression from cda75d6f358d438f7ed36ed7fa296ac23e3c4a04)
    
    Change-Id: Ie9f8d7da2fa26000a0237c24f8742e47ffa29213

diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index bb8d438..3dfbd45 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -282,36 +282,36 @@ void SwView::ExecSearch(SfxRequest& rReq, sal_Bool bNoMessage)
             case SVX_SEARCHCMD_REPLACE_ALL:
                 {
                     SwSearchOptions aOpts( pWrtShell, pSrchItem->GetBackward() );
-
-                    // Fix for i#8288: "Replace all" should leave the cursor at the place it was
-                    // before executing the command, rather than at the site of the final replacement.
-                    // To do this take note of the current cursor position before replace all begins:
-                    // note: must be stored so that it is corrected by PamCorr*
-                    ::boost::scoped_ptr<SwUnoCrsr> const pTmpCursor(
-                            pWrtShell->GetDoc()->CreateUnoCrsr(
-                                *pWrtShell->GetSwCrsr()->GetPoint()));
-
-                    if( !pSrchItem->GetSelection() )
-                    {
-                        // bestehende Selektionen aufheben,
-                        // wenn nicht in selektierten Bereichen gesucht werden soll
-                        pWrtShell->KillSelection(0, false);
-                        if( DOCPOS_START == aOpts.eEnd )
-                            pWrtShell->EndDoc();
-                        else
-                            pWrtShell->SttDoc();
-                    }
-
                     bExtra = sal_False;
                     sal_uLong nFound;
 
                     {   //Scope for SwWait-Object
                         SwWait aWait( *GetDocShell(), sal_True );
                         pWrtShell->StartAllAction();
+                        if (!pSrchItem->GetSelection())
+                        {
+                            // if we don't want to search in the selection...
+                            pWrtShell->KillSelection(0, false);
+                            // i#8288 "replace all" should not change cursor
+                            // position, so save current cursor
+                            pWrtShell->Push();
+                            if (DOCPOS_START == aOpts.eEnd)
+                            {
+                                pWrtShell->EndDoc();
+                            }
+                            else
+                            {
+                                pWrtShell->SttDoc();
+                            }
+                        }
                         nFound = FUNC_Search( aOpts );
-                        // #i8288# Now that everything has been replaced, restore the original cursor position.
-                        *(pWrtShell->GetSwCrsr()->GetPoint()) =
-                            *pTmpCursor->GetPoint();
+                        if (!pSrchItem->GetSelection())
+                        {
+                            // create it just to overwrite it with stack cursor
+                            pWrtShell->CreateCrsr();
+                            // i#8288 restore the original cursor position
+                            pWrtShell->Pop(false);
+                        }
                         pWrtShell->EndAllAction();
                     }
 
commit d52a1320dbe142d2fc184e031bf79994f5ef1144
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Aug 24 17:27:15 2012 +0200

    SwpHintsArray::Check(): reindent that
    
    Change-Id: I9fede393b5a0fb6bd2fe0425f6a4b60b754aeb0b

diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx
index e13bc4f..4ff0e21 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -174,7 +174,7 @@ sal_uInt16 SwpHintsArray::GetPos( const SwTxtAttr *pHt ) const
 #define CHECK_ERR(cond, text) \
         if(!(cond)) \
         { \
-            OSL_ENSURE(!this, text); \
+            SAL_WARN("sw.core", text); \
             DumpHints(m_HintStarts, m_HintEnds); \
             return !(const_cast<SwpHintsArray*>(this))->Resort(); \
         }
@@ -254,25 +254,27 @@ bool SwpHintsArray::Check() const
         // 8) style portion check
         const SwTxtAttr* pHtThis = m_HintStarts[i];
         const SwTxtAttr* pHtLast = i > 0 ? m_HintStarts[i-1] : 0;
-        CHECK_ERR( 0 == i ||
-                    ( RES_TXTATR_CHARFMT != pHtLast->Which() && RES_TXTATR_AUTOFMT != pHtLast->Which() ) ||
-                    ( RES_TXTATR_CHARFMT != pHtThis->Which() && RES_TXTATR_AUTOFMT != pHtThis->Which() ) ||
-                    ( *pHtThis->GetStart() >= *pHtLast->GetEnd() ) ||
-                    (   (   (*pHtThis->GetStart() == *pHtLast->GetStart())
-                        &&  (*pHtThis->GetEnd()   == *pHtLast->GetEnd())
-                        ) // same range
-                    &&  (   (pHtThis->Which() != RES_TXTATR_AUTOFMT)
-                        ||  (pHtLast->Which() != RES_TXTATR_AUTOFMT)
-                        ) // never two AUTOFMT on same range
-                    &&  (   (pHtThis->Which() != RES_TXTATR_CHARFMT)
-                        ||  (pHtLast->Which() != RES_TXTATR_CHARFMT)
-                        ||  (static_cast<const SwTxtCharFmt *>(pHtThis)
+        CHECK_ERR( (0 == i)
+            ||  (   (RES_TXTATR_CHARFMT != pHtLast->Which())
+                &&  (RES_TXTATR_AUTOFMT != pHtLast->Which()))
+            ||  (   (RES_TXTATR_CHARFMT != pHtThis->Which())
+                &&  (RES_TXTATR_AUTOFMT != pHtThis->Which()))
+            ||  (*pHtThis->GetStart() >= *pHtLast->GetEnd()) // no overlap
+            ||  (   (   (*pHtThis->GetStart() == *pHtLast->GetStart())
+                    &&  (*pHtThis->GetEnd()   == *pHtLast->GetEnd())
+                    ) // same range
+                &&  (   (pHtThis->Which() != RES_TXTATR_AUTOFMT)
+                    ||  (pHtLast->Which() != RES_TXTATR_AUTOFMT)
+                    ) // never two AUTOFMT on same range
+                &&  (   (pHtThis->Which() != RES_TXTATR_CHARFMT)
+                    ||  (pHtLast->Which() != RES_TXTATR_CHARFMT)
+                    ||  (static_cast<const SwTxtCharFmt *>(pHtThis)
                                 ->GetSortNumber() !=
-                             static_cast<const SwTxtCharFmt *>(pHtLast)
+                         static_cast<const SwTxtCharFmt *>(pHtLast)
                                 ->GetSortNumber())
-                        ) // multiple CHARFMT on same range need distinct sortnr
-                    )
-                ||  (*pHtThis->GetStart() == *pHtThis->GetEnd()),
+                    ) // multiple CHARFMT on same range need distinct sortnr
+                )
+            ||  (*pHtThis->GetStart() == *pHtThis->GetEnd()), // this empty
                    "HintsCheck: Portion inconsistency. "
                    "This can be temporarily ok during undo operations" );
 
commit 411ef872a0903c4dd15d96c2f893309f6440eeca
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Aug 24 17:03:30 2012 +0200

    SwpHintsArray: refactor assertions:
    
    Since 4623c603bde7678004fe6019f9d9e4b816a3d6c6 the assertions in
    lcl_IsLessStart/lcl_IsLessEnd trigger spuriously, because the comparison
    is invoked always now even on identical pointers, while the SvArray only
    invoked it if the 2 hints didn't have the same address; move the
    assertion to SwpHintsArray::Check().
    
    Change-Id: Ida6c8e268452343ed3e90410636703c6baffbabd

diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx
index af2a032..e13bc4f 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -61,7 +61,6 @@ static sal_Bool lcl_IsLessStart( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
                 {
                     const sal_uInt16 nS1 = static_cast<const SwTxtCharFmt&>(rHt1).GetSortNumber();
                     const sal_uInt16 nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber();
-                    OSL_ENSURE( nS1 != nS2, "AUTOSTYLES: lcl_IsLessStart trouble" );
                     if ( nS1 != nS2 ) // robust
                         return nS1 < nS2;
                 }
@@ -97,7 +96,6 @@ static sal_Bool lcl_IsLessEnd( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
                 {
                     const sal_uInt16 nS1 = static_cast<const SwTxtCharFmt&>(rHt1).GetSortNumber();
                     const sal_uInt16 nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber();
-                    OSL_ENSURE( nS1 != nS2, "AUTOSTYLES: lcl_IsLessEnd trouble" );
                     if ( nS1 != nS2 ) // robust
                         return nS1 > nS2;
                 }
@@ -260,15 +258,21 @@ bool SwpHintsArray::Check() const
                     ( RES_TXTATR_CHARFMT != pHtLast->Which() && RES_TXTATR_AUTOFMT != pHtLast->Which() ) ||
                     ( RES_TXTATR_CHARFMT != pHtThis->Which() && RES_TXTATR_AUTOFMT != pHtThis->Which() ) ||
                     ( *pHtThis->GetStart() >= *pHtLast->GetEnd() ) ||
-                    (   (   (   (*pHtThis->GetStart() == *pHtLast->GetStart())
-                            &&  (*pHtThis->GetEnd()   == *pHtLast->GetEnd())
-                            ) // same range
-                        ||  (*pHtThis->GetStart() == *pHtThis->GetEnd())
-                        )
+                    (   (   (*pHtThis->GetStart() == *pHtLast->GetStart())
+                        &&  (*pHtThis->GetEnd()   == *pHtLast->GetEnd())
+                        ) // same range
                     &&  (   (pHtThis->Which() != RES_TXTATR_AUTOFMT)
                         ||  (pHtLast->Which() != RES_TXTATR_AUTOFMT)
                         ) // never two AUTOFMT on same range
-                    ),
+                    &&  (   (pHtThis->Which() != RES_TXTATR_CHARFMT)
+                        ||  (pHtLast->Which() != RES_TXTATR_CHARFMT)
+                        ||  (static_cast<const SwTxtCharFmt *>(pHtThis)
+                                ->GetSortNumber() !=
+                             static_cast<const SwTxtCharFmt *>(pHtLast)
+                                ->GetSortNumber())
+                        ) // multiple CHARFMT on same range need distinct sortnr
+                    )
+                ||  (*pHtThis->GetStart() == *pHtThis->GetEnd()),
                    "HintsCheck: Portion inconsistency. "
                    "This can be temporarily ok during undo operations" );
 


More information about the Libreoffice-commits mailing list