Author: orw
Date: Wed Jan  8 14:20:43 2014
New Revision: 1556542

URL: http://svn.apache.org/r1556542
Log:
123792: correction for comments/annotations on table cell ranges


Modified:
    openoffice/trunk/main/sw/inc/IDocumentMarkAccess.hxx
    openoffice/trunk/main/sw/inc/doc.hxx
    openoffice/trunk/main/sw/source/core/crsr/annotationmark.cxx
    openoffice/trunk/main/sw/source/core/doc/docbm.cxx
    openoffice/trunk/main/sw/source/core/doc/doccorr.cxx
    openoffice/trunk/main/sw/source/core/undo/undobj.cxx
    openoffice/trunk/main/sw/source/core/unocore/unoobj.cxx
    openoffice/trunk/main/sw/source/ui/docvw/SidebarWin.cxx
    openoffice/trunk/main/sw/source/ui/shells/textfld.cxx
    openoffice/trunk/main/sw/source/ui/wrtsh/wrtsh2.cxx
    openoffice/trunk/main/xmloff/source/text/txtfldi.cxx

Modified: openoffice/trunk/main/sw/inc/IDocumentMarkAccess.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/IDocumentMarkAccess.hxx?rev=1556542&r1=1556541&r2=1556542&view=diff
==============================================================================
--- openoffice/trunk/main/sw/inc/IDocumentMarkAccess.hxx (original)
+++ openoffice/trunk/main/sw/inc/IDocumentMarkAccess.hxx Wed Jan  8 14:20:43 
2014
@@ -260,7 +260,7 @@ class IDocumentMarkAccess
         virtual const_iterator_t findAnnotationMark( const ::rtl::OUString& 
rName ) const = 0;
 
         // Returns the MarkType used to create the mark
-        static MarkType SAL_DLLPUBLIC_EXPORT GetType(const ::sw::mark::IMark& 
rMark);
+        static SAL_DLLPUBLIC_EXPORT MarkType GetType(const ::sw::mark::IMark& 
rMark);
 
         static SAL_DLLPUBLIC_EXPORT const ::rtl::OUString& 
GetCrossRefHeadingBookmarkNamePrefix();
         static SAL_DLLPUBLIC_EXPORT bool IsLegalPaMForCrossRefHeadingBookmark( 
const SwPaM& );

Modified: openoffice/trunk/main/sw/inc/doc.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/doc.hxx?rev=1556542&r1=1556541&r2=1556542&view=diff
==============================================================================
--- openoffice/trunk/main/sw/inc/doc.hxx (original)
+++ openoffice/trunk/main/sw/inc/doc.hxx Wed Jan  8 14:20:43 2014
@@ -1491,18 +1491,32 @@ public:
                // wie z.B. die ::com::sun::star::text::Bookmarks oder die 
Verzeichnisse.
                // JP 22.06.95: ist bMoveCrsr gesetzt, verschiebe auch die Crsr
 
-               // Setzt alles in rOldNode auf rNewPos + Offset
-       void CorrAbs( const SwNodeIndex& rOldNode, const SwPosition& rNewPos,
-                                       const xub_StrLen nOffset = 0, sal_Bool 
bMoveCrsr = sal_False );
-               // Setzt alles im Bereich von [rStartNode, rEndNode] nach 
rNewPos
-       void CorrAbs( const SwNodeIndex& rStartNode, const SwNodeIndex& 
rEndNode,
-                                       const SwPosition& rNewPos, sal_Bool 
bMoveCrsr = sal_False );
-               // Setzt alles im Bereich von rRange nach rNewPos
-       void CorrAbs( const SwPaM& rRange, const SwPosition& rNewPos,
-                                       sal_Bool bMoveCrsr = sal_False );
-               // Setzt alles in rOldNode auf relative Pos
-       void CorrRel( const SwNodeIndex& rOldNode, const SwPosition& rNewPos,
-                                       const xub_StrLen nOffset = 0, sal_Bool 
bMoveCrsr = sal_False );
+    // Setzt alles in rOldNode auf rNewPos + Offset
+    void CorrAbs(
+        const SwNodeIndex& rOldNode,
+        const SwPosition& rNewPos,
+        const xub_StrLen nOffset = 0,
+        sal_Bool bMoveCrsr = sal_False );
+
+    // Setzt alles im Bereich von [rStartNode, rEndNode] nach rNewPos
+    void CorrAbs(
+        const SwNodeIndex& rStartNode,
+        const SwNodeIndex& rEndNode,
+        const SwPosition& rNewPos,
+        sal_Bool bMoveCrsr = sal_False );
+
+    // Setzt alles im Bereich von rRange nach rNewPos
+    void CorrAbs(
+        const SwPaM& rRange,
+        const SwPosition& rNewPos,
+        sal_Bool bMoveCrsr = sal_False );
+
+    // Setzt alles in rOldNode auf relative Pos
+    void CorrRel(
+        const SwNodeIndex& rOldNode,
+        const SwPosition& rNewPos,
+        const xub_StrLen nOffset = 0,
+        sal_Bool bMoveCrsr = sal_False );
 
                // GliederungsRegeln erfragen / setzen
     // --> OD 2005-11-02 #i51089 - TUNING#

Modified: openoffice/trunk/main/sw/source/core/crsr/annotationmark.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/crsr/annotationmark.cxx?rev=1556542&r1=1556541&r2=1556542&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/crsr/annotationmark.cxx (original)
+++ openoffice/trunk/main/sw/source/core/crsr/annotationmark.cxx Wed Jan  8 
14:20:43 2014
@@ -60,6 +60,7 @@ namespace sw { namespace mark
         SwTxtFld* pTxtFld =
             GetMarkEnd().nNode.GetNode().GetTxtNode()->GetFldTxtAttrAt(
             GetMarkEnd().nContent.GetIndex()-1, true );
+        ASSERT( pTxtFld != NULL, "<AnnotationMark::InitDoc(..)> - missing text 
attribute for annotation field!" );
         if ( pTxtFld != NULL )
         {
             const SwPostItField* pPostItField = dynamic_cast< const 
SwPostItField* >(pTxtFld->GetFmtFld().GetField());

Modified: openoffice/trunk/main/sw/source/core/doc/docbm.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/doc/docbm.cxx?rev=1556542&r1=1556541&r2=1556542&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/doc/docbm.cxx (original)
+++ openoffice/trunk/main/sw/source/core/doc/docbm.cxx Wed Jan  8 14:20:43 2014
@@ -161,18 +161,34 @@ namespace
         return max_element(vCandidates.begin(), vCandidates.end(), 
&lcl_MarkOrderingByEnd)->get();
     }
 
-    static bool lcl_FixCorrectedMark(bool bChangedPos, bool bChangedOPos, 
MarkBase* io_pMark)
+    static bool lcl_FixCorrectedMark(
+        const bool bChangedPos,
+        const bool bChangedOPos,
+        MarkBase* io_pMark )
     {
-        if( (bChangedPos || bChangedOPos) && io_pMark->IsExpanded() &&
-            
io_pMark->GetOtherMarkPos().nNode.GetNode().FindTableBoxStartNode() !=
-            io_pMark->GetMarkPos().nNode.GetNode().FindTableBoxStartNode() )
+        if ( IDocumentMarkAccess::GetType(*io_pMark) == 
IDocumentMarkAccess::ANNOTATIONMARK )
         {
-            if(!bChangedOPos)
-                io_pMark->SetMarkPos(io_pMark->GetOtherMarkPos());
+            // annotation marks are allowed to span a table cell range.
+            // but trigger sorting to be save
+            return true;
+        }
+
+        if ( ( bChangedPos || bChangedOPos )
+             && io_pMark->IsExpanded()
+             && 
io_pMark->GetOtherMarkPos().nNode.GetNode().FindTableBoxStartNode() !=
+                    
io_pMark->GetMarkPos().nNode.GetNode().FindTableBoxStartNode() )
+        {
+            if ( !bChangedOPos )
+            {
+                io_pMark->SetMarkPos( io_pMark->GetOtherMarkPos() );
+            }
             io_pMark->ClearOtherMarkPos();
             DdeBookmark * const pDdeBkmk = dynamic_cast< 
DdeBookmark*>(io_pMark);
-            if(pDdeBkmk && pDdeBkmk->IsServer())
+            if ( pDdeBkmk != NULL
+                 && pDdeBkmk->IsServer() )
+            {
                 pDdeBkmk->SetRefObject(NULL);
+            }
             return true;
         }
         return false;
@@ -645,14 +661,14 @@ namespace sw { namespace mark
                 lcl_GreaterThan(pMark->GetOtherMarkPos(), rStt, pSttIdx) &&
                 lcl_Lower(pMark->GetOtherMarkPos(), rEnd, pEndIdx));
             // special case: completely in range, touching the end?
-            if(pEndIdx &&
-                    ((isOtherPosInRange
-                    && pMark->GetMarkPos().nNode == rEnd
-                    && pMark->GetMarkPos().nContent == *pEndIdx)
-                || (isPosInRange
-                    && pMark->IsExpanded()
-                    && pMark->GetOtherMarkPos().nNode == rEnd
-                    && pMark->GetOtherMarkPos().nContent == *pEndIdx)))
+            if ( pEndIdx != NULL
+                 && ( ( isOtherPosInRange
+                        && pMark->GetMarkPos().nNode == rEnd
+                        && pMark->GetMarkPos().nContent == *pEndIdx )
+                      || ( isPosInRange
+                           && pMark->IsExpanded()
+                           && pMark->GetOtherMarkPos().nNode == rEnd
+                           && pMark->GetOtherMarkPos().nContent == *pEndIdx ) 
) )
             {
                 isPosInRange = true, isOtherPosInRange = true;
             }
@@ -679,39 +695,51 @@ namespace sw { namespace mark
                     vMarksToDelete.push_back(ppMark);
                 }
             }
-            else if(isPosInRange ^ isOtherPosInRange)
+            else if ( isPosInRange ^ isOtherPosInRange )
             {
                 // the bookmark is partitially in the range
                 // move position of that is in the range out of it
-                auto_ptr<SwPosition> pNewPos;
-                if(pEndIdx)
-                    pNewPos = auto_ptr<SwPosition>(new SwPosition(
-                        rEnd,
-                        *pEndIdx));
-                else
-                    pNewPos = lcl_FindExpelPosition(
-                        rStt,
-                        rEnd,
-                        isPosInRange ? pMark->GetOtherMarkPos() : 
pMark->GetMarkPos());
-
-                // --> OD 2009-08-06 #i92125#
-                // no move of position for cross-reference bookmarks,
-                // if move occurs inside a certain node
-                if ( ( IDocumentMarkAccess::GetType(*pMark) !=
-                                IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK 
&&
-                       IDocumentMarkAccess::GetType(*pMark) !=
-                                IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK 
) ||
-                     pMark->GetMarkPos().nNode != pNewPos->nNode )
+
+                auto_ptr< SwPosition > pNewPos;
+                {
+                    if ( pEndIdx != NULL )
+                    {
+                        pNewPos = auto_ptr< SwPosition >( new SwPosition( 
rEnd, *pEndIdx ) );
+                    }
+                    else
+                    {
+                        pNewPos = lcl_FindExpelPosition( rStt, rEnd, 
isPosInRange ? pMark->GetOtherMarkPos() : pMark->GetMarkPos() );
+                    }
+                }
+
+                bool bMoveMark = true;
+                {
+                    switch ( IDocumentMarkAccess::GetType( *pMark ) )
+                    {
+                    case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK:
+                    case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK:
+                        // no move of cross-reference bookmarks, if move 
occurs inside a certain node
+                        bMoveMark = pMark->GetMarkPos().nNode != 
pNewPos->nNode;
+                        break;
+                    case IDocumentMarkAccess::ANNOTATIONMARK:
+                        // no move of annotation marks, if method is called to 
collect deleted marks
+                        bMoveMark = pSaveBkmk == NULL;
+                        break;
+                    default:
+                        bMoveMark = true;
+                        break;
+                    }
+                }
+                if ( bMoveMark )
                 {
-                    if(isPosInRange)
+                    if ( isPosInRange )
                         pMark->SetMarkPos(*pNewPos);
                     else
                         pMark->SetOtherMarkPos(*pNewPos);
 
                     // illegal selection? collapse the mark and restore 
sorting later
-                    isSortingNeeded |= lcl_FixCorrectedMark(isPosInRange, 
isOtherPosInRange, pMark);
+                    isSortingNeeded |= lcl_FixCorrectedMark( isPosInRange, 
isOtherPosInRange, pMark );
                 }
-                // <--
             }
         }
 
@@ -827,7 +855,7 @@ namespace sw { namespace mark
             find_if(
                 pMarkLow,
                 pMarkHigh,
-                bind(equal_to<const IMark*>(), 
bind(&boost::shared_ptr<IMark>::get, _1), pMark) );
+                bind( equal_to<const IMark*>(), 
bind(&boost::shared_ptr<IMark>::get, _1), pMark) );
         if(pMarkFound != pMarkHigh)
             deleteMark(pMarkFound);
     }

Modified: openoffice/trunk/main/sw/source/core/doc/doccorr.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/doc/doccorr.cxx?rev=1556542&r1=1556541&r2=1556542&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/doc/doccorr.cxx (original)
+++ openoffice/trunk/main/sw/source/core/doc/doccorr.cxx Wed Jan  8 14:20:43 
2014
@@ -233,26 +233,28 @@ void SwDoc::CorrAbs(const SwNodeIndex& r
     }
 }
 
-void SwDoc::CorrAbs(const SwPaM& rRange,
+void SwDoc::CorrAbs(
+    const SwPaM& rRange,
     const SwPosition& rNewPos,
-    sal_Bool bMoveCrsr)
+    sal_Bool bMoveCrsr )
 {
     SwPosition aStart(*rRange.Start());
     SwPosition aEnd(*rRange.End());
     SwPosition aNewPos(rNewPos);
 
-    _DelBookmarks(aStart.nNode, aEnd.nNode, NULL,
-        &aStart.nContent, &aEnd.nContent);
+    _DelBookmarks( aStart.nNode, aEnd.nNode, NULL, &aStart.nContent, 
&aEnd.nContent );
+
     if(bMoveCrsr)
         ::PaMCorrAbs(rRange, rNewPos);
 }
 
-void SwDoc::CorrAbs(const SwNodeIndex& rStartNode,
-     const SwNodeIndex& rEndNode,
-     const SwPosition& rNewPos,
-     sal_Bool bMoveCrsr)
+void SwDoc::CorrAbs(
+    const SwNodeIndex& rStartNode,
+    const SwNodeIndex& rEndNode,
+    const SwPosition& rNewPos,
+    sal_Bool bMoveCrsr )
 {
-    _DelBookmarks(rStartNode, rEndNode);
+    _DelBookmarks( rStartNode, rEndNode );
 
     if(bMoveCrsr)
     {

Modified: openoffice/trunk/main/sw/source/core/undo/undobj.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/undo/undobj.cxx?rev=1556542&r1=1556541&r2=1556542&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/undo/undobj.cxx (original)
+++ openoffice/trunk/main/sw/source/core/undo/undobj.cxx Wed Jan  8 14:20:43 
2014
@@ -907,12 +907,21 @@ void SwUndoSaveSection::SaveSection( SwD
 }
 
 
-void SwUndoSaveSection::SaveSection( SwDoc* , const SwNodeRange& rRange )
+void SwUndoSaveSection::SaveSection(
+    SwDoc* pDoc,
+    const SwNodeRange& rRange )
 {
-       SwPaM aPam( rRange.aStart, rRange.aEnd );
+    SwPaM aPam( rRange.aStart, rRange.aEnd );
 
-       // loesche alle Fussnoten / FlyFrames / Bookmarks / Verzeichnisse
-       DelCntntIndex( *aPam.GetMark(), *aPam.GetPoint() );
+    // delete all footnotes, fly frames, bookmarks and indexes
+    DelCntntIndex( *aPam.GetMark(), *aPam.GetPoint() );
+    {
+        // move certain indexes out of deleted range
+        SwNodeIndex aSttIdx( aPam.Start()->nNode.GetNode() );
+        SwNodeIndex aEndIdx( aPam.End()->nNode.GetNode() );
+        SwNodeIndex aMvStt( aEndIdx, 1 );
+        pDoc->CorrAbs( aSttIdx, aEndIdx, SwPosition( aMvStt ), sal_True );
+    }
 
        pRedlSaveData = new SwRedlineSaveDatas;
        if( !SwUndo::FillSaveData( aPam, *pRedlSaveData, sal_True, sal_True ))

Modified: openoffice/trunk/main/sw/source/core/unocore/unoobj.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/unocore/unoobj.cxx?rev=1556542&r1=1556541&r2=1556542&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/unocore/unoobj.cxx (original)
+++ openoffice/trunk/main/sw/source/core/unocore/unoobj.cxx Wed Jan  8 14:20:43 
2014
@@ -1300,22 +1300,6 @@ throw (uno::RuntimeException)
         throw uno::RuntimeException();
     }
 
-    SwStartNodeType eSearchNodeType = SwNormalStartNode;
-    switch (m_pImpl->m_eType)
-    {
-        case CURSOR_FRAME:      eSearchNodeType = SwFlyStartNode;       break;
-        case CURSOR_TBLTEXT:    eSearchNodeType = SwTableBoxStartNode;  break;
-        case CURSOR_FOOTNOTE:   eSearchNodeType = SwFootnoteStartNode;  break;
-        case CURSOR_HEADER:     eSearchNodeType = SwHeaderStartNode;    break;
-        case CURSOR_FOOTER:     eSearchNodeType = SwFooterStartNode;    break;
-        //case CURSOR_INVALID:
-        //case CURSOR_BODY:
-        default:
-            ;
-    }
-    const SwStartNode* pOwnStartNode =
-        rOwnCursor.GetNode()->FindSttNodeByType(eSearchNodeType);
-
     SwPaM aPam(GetDoc()->GetNodes());
     const SwPaM * pPam(0);
     if (pCursor)
@@ -1334,21 +1318,51 @@ throw (uno::RuntimeException)
     {
         throw uno::RuntimeException();
     }
-    const SwStartNode* pTmp =
-        pPam->GetNode()->FindSttNodeByType(eSearchNodeType);
 
-    //SectionNodes ueberspringen
-    while(pTmp && pTmp->IsSectionNode())
     {
-        pTmp = pTmp->StartOfSectionNode();
-    }
-    while(pOwnStartNode && pOwnStartNode->IsSectionNode())
-    {
-        pOwnStartNode = pOwnStartNode->StartOfSectionNode();
-    }
-    if(pOwnStartNode != pTmp)
-    {
-        throw uno::RuntimeException();
+        SwStartNodeType eSearchNodeType = SwNormalStartNode;
+        switch (m_pImpl->m_eType)
+        {
+        case CURSOR_FRAME:      eSearchNodeType = SwFlyStartNode;       break;
+        case CURSOR_TBLTEXT:    eSearchNodeType = SwTableBoxStartNode;  break;
+        case CURSOR_FOOTNOTE:   eSearchNodeType = SwFootnoteStartNode;  break;
+        case CURSOR_HEADER:     eSearchNodeType = SwHeaderStartNode;    break;
+        case CURSOR_FOOTER:     eSearchNodeType = SwFooterStartNode;    break;
+            //case CURSOR_INVALID:
+            //case CURSOR_BODY:
+        default:
+            ;
+        }
+
+        const SwStartNode* pOwnStartNode = 
rOwnCursor.GetNode()->FindSttNodeByType(eSearchNodeType);
+        while ( pOwnStartNode != NULL
+                && pOwnStartNode->IsSectionNode())
+        {
+            pOwnStartNode = pOwnStartNode->StartOfSectionNode();
+        }
+
+        const SwStartNode* pTmp =
+            pPam->GetNode()->FindSttNodeByType(eSearchNodeType);
+        while ( pTmp != NULL
+                && pTmp->IsSectionNode() )
+        {
+            pTmp = pTmp->StartOfSectionNode();
+        }
+
+        if ( eSearchNodeType == SwTableBoxStartNode )
+        {
+            if ( pOwnStartNode->FindTableNode() != pTmp->FindTableNode() )
+            {
+                throw uno::RuntimeException();
+            }
+        }
+        else
+        {
+            if ( pOwnStartNode != pTmp )
+            {
+                throw uno::RuntimeException();
+            }
+        }
     }
 
     if (CURSOR_META == m_pImpl->m_eType)
@@ -2684,7 +2698,7 @@ throw (beans::UnknownPropertyException, 
        return aRet;
 }
 
-void SAL_CALL SwXTextCursor::invalidateMarkings(::sal_Int32 nType) 
+void SAL_CALL SwXTextCursor::invalidateMarkings(::sal_Int32 nType)
 throw (uno::RuntimeException)
 {
     vos::OGuard aGuard(Application::GetSolarMutex());

Modified: openoffice/trunk/main/sw/source/ui/docvw/SidebarWin.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/docvw/SidebarWin.cxx?rev=1556542&r1=1556541&r2=1556542&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/docvw/SidebarWin.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/docvw/SidebarWin.cxx Wed Jan  8 14:20:43 
2014
@@ -593,11 +593,26 @@ void SwSidebarWin::SetPosAndSize()
                 SwNodes& rNds = pTxtNode->GetDoc()->GetNodes();
                 SwCntntNode* const pCntntNd = 
rNds[mrSidebarItem.maLayoutInfo.mnStartNodeIdx]->GetCntntNode();
                 SwPosition aStartPos( *pCntntNd, 
mrSidebarItem.maLayoutInfo.mnStartContent );
-                ::boost::scoped_ptr<SwShellCrsr> 
pTmpCrsrForAnnotationTextRange(
-                    new SwShellCrsr( DocView().GetWrtShell(), aStartPos ) );
-                pTmpCrsrForAnnotationTextRange->SetMark();
-                pTmpCrsrForAnnotationTextRange->GetMark()->nNode = *pTxtNode;
-                pTmpCrsrForAnnotationTextRange->GetMark()->nContent.Assign( 
pTxtNode, *(pTxtAnnotationFld->GetStart())+1 );
+                SwShellCrsr* pTmpCrsr = NULL;
+                const bool bTableCrsrNeeded = 
pTxtNode->FindTableBoxStartNode() != pCntntNd->FindTableBoxStartNode();
+                if ( bTableCrsrNeeded )
+                {
+                    SwShellTableCrsr* pTableCrsr = new SwShellTableCrsr( 
DocView().GetWrtShell(), aStartPos );
+                    pTableCrsr->SetMark();
+                    pTableCrsr->GetMark()->nNode = *pTxtNode;
+                    pTableCrsr->GetMark()->nContent.Assign( pTxtNode, 
*(pTxtAnnotationFld->GetStart())+1 );
+                    pTableCrsr->NewTableSelection();
+                    pTmpCrsr = pTableCrsr;
+                }
+                else
+                {
+                    SwShellCrsr* pCrsr = new SwShellCrsr( 
DocView().GetWrtShell(), aStartPos );
+                    pCrsr->SetMark();
+                    pCrsr->GetMark()->nNode = *pTxtNode;
+                    pCrsr->GetMark()->nContent.Assign( pTxtNode, 
*(pTxtAnnotationFld->GetStart())+1 );
+                    pTmpCrsr = pCrsr;
+                }
+                ::boost::scoped_ptr<SwShellCrsr> 
pTmpCrsrForAnnotationTextRange( pTmpCrsr );
 
                 pTmpCrsrForAnnotationTextRange->FillRects();
 

Modified: openoffice/trunk/main/sw/source/ui/shells/textfld.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/shells/textfld.cxx?rev=1556542&r1=1556541&r2=1556542&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/shells/textfld.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/shells/textfld.cxx Wed Jan  8 14:20:43 
2014
@@ -367,9 +367,8 @@ void SwTextShell::ExecField(SfxRequest &
                             if( !(sAuthor = aUserOpt.GetID()).Len() )
                                 sAuthor = String( SW_RES( 
STR_REDLINE_UNKNOWN_AUTHOR ));
 
-                        if( rSh.HasSelection() )
+                        if ( rSh.HasSelection() && !rSh.IsTableMode() )
                         {
-                            rSh.NormalizePam( sal_False );
                             rSh.KillPams();
                         }
 

Modified: openoffice/trunk/main/sw/source/ui/wrtsh/wrtsh2.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/wrtsh/wrtsh2.cxx?rev=1556542&r1=1556541&r2=1556542&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/wrtsh/wrtsh2.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/wrtsh/wrtsh2.cxx Wed Jan  8 14:20:43 2014
@@ -94,10 +94,23 @@ void SwWrtShell::Insert( SwField& rFld )
         {
             // for annotation fields:
             // - keep the current selection in order to create a corresponding 
annotation mark
-            // - collapse cursur to its point
-            const SwPaM& rCurrPaM = GetCurrentShellCursor();
-            pAnnotationTextRange = new SwPaM( *rCurrPaM.GetPoint(), 
*rCurrPaM.GetMark() );
-            ClearMark();
+            // - collapse cursor to its end
+            if ( IsTableMode() )
+            {
+                GetTblCrs()->Normalize( sal_False );
+                const SwPosition rStartPos( 
*(GetTblCrs()->GetMark()->nNode.GetNode().GetCntntNode()), 0 );
+                KillPams();
+                EndPara();
+                const SwPosition rEndPos( *GetCurrentShellCursor().GetPoint() 
);
+                pAnnotationTextRange = new SwPaM( rStartPos, rEndPos );
+            }
+            else
+            {
+                NormalizePam( sal_False );
+                const SwPaM& rCurrPaM = GetCurrentShellCursor();
+                pAnnotationTextRange = new SwPaM( *rCurrPaM.GetPoint(), 
*rCurrPaM.GetMark() );
+                ClearMark();
+            }
         }
         else
         {

Modified: openoffice/trunk/main/xmloff/source/text/txtfldi.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/text/txtfldi.cxx?rev=1556542&r1=1556541&r2=1556542&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/text/txtfldi.cxx (original)
+++ openoffice/trunk/main/xmloff/source/text/txtfldi.cxx Wed Jan  8 14:20:43 
2014
@@ -3776,8 +3776,8 @@ void XMLAnnotationImportContext::EndElem
                 // let's create a text range covering the start and the 
current position.
                 uno::Reference< text::XText > xText = 
GetImportHelper().GetText();
                 uno::Reference< text::XTextCursor > xCursor =
-                    xText->createTextCursorByRange( xPrevField->getAnchor() );
-                xCursor->gotoRange( GetImportHelper().GetCursorAsRange(), true 
);
+                    xText->createTextCursorByRange( 
GetImportHelper().GetCursorAsRange() );
+                xCursor->gotoRange( xPrevField->getAnchor(), true );
                 uno::Reference< text::XTextRange > xTextRange( xCursor, 
uno::UNO_QUERY );
 
                 xText->insertTextContent( xTextRange, xPrevField, 
!xCursor->isCollapsed() );


Reply via email to