You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2014/03/19 11:15:07 UTC

svn commit: r1579184 [26/33] - in /openoffice/branches/alg_writerframes: ./ ext_sources/ extras/l10n/source/de/ extras/l10n/source/es/ extras/l10n/source/eu/ extras/l10n/source/hi/ extras/l10n/source/kk/ extras/l10n/source/lt/ extras/l10n/source/nb/ ex...

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/doc/docbm.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/doc/docbm.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/doc/docbm.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/doc/docbm.cxx Wed Mar 19 10:14:42 2014
@@ -60,19 +60,25 @@
 #include <stdio.h>
 
 
-using namespace ::std;
 using namespace ::sw::mark;
 
 namespace
 {
     static bool lcl_GreaterThan( const SwPosition& rPos, const SwNodeIndex& rNdIdx, const SwIndex* pIdx )
     {
-        return pIdx ? ( rPos.nNode > rNdIdx || ( rPos.nNode == rNdIdx && rPos.nContent >= pIdx->GetIndex() )) : rPos.nNode >= rNdIdx;
+        return pIdx != NULL
+               ? ( rPos.nNode > rNdIdx
+                   || ( rPos.nNode == rNdIdx
+                        && rPos.nContent >= pIdx->GetIndex() ) )
+               : rPos.nNode >= rNdIdx;
     }
 
     static bool lcl_Lower( const SwPosition& rPos, const SwNodeIndex& rNdIdx, const SwIndex* pIdx )
     {
-        return rPos.nNode < rNdIdx || ( pIdx && rPos.nNode == rNdIdx && rPos.nContent < pIdx->GetIndex() );
+        return rPos.nNode < rNdIdx
+               || ( pIdx != NULL
+                    && rPos.nNode == rNdIdx
+                    && rPos.nContent < pIdx->GetIndex() );
     }
 
     static bool lcl_MarkOrderingByStart(const IDocumentMarkAccess::pMark_t& rpFirst,
@@ -99,9 +105,11 @@ namespace
             pMark);
     }
 
-    static inline auto_ptr<SwPosition> lcl_PositionFromCntntNode(SwCntntNode * const pCntntNode, const bool bAtEnd=false)
+    static inline ::std::auto_ptr<SwPosition> lcl_PositionFromCntntNode(
+        SwCntntNode * const pCntntNode,
+        const bool bAtEnd=false)
     {
-        auto_ptr<SwPosition> pResult(new SwPosition(*pCntntNode));
+        ::std::auto_ptr<SwPosition> pResult(new SwPosition(*pCntntNode));
         pResult->nContent.Assign(pCntntNode, bAtEnd ? pCntntNode->Len() : 0);
         return pResult;
     }
@@ -110,21 +118,31 @@ namespace
     // else set it to the begin of the Node after rEnd, if there is one
     // else set it to the end of the node before rStt
     // else set it to the CntntNode of the Pos outside the Range
-    static inline auto_ptr<SwPosition> lcl_FindExpelPosition(const SwNodeIndex& rStt,
+    static inline ::std::auto_ptr<SwPosition> lcl_FindExpelPosition(
+        const SwNodeIndex& rStt,
         const SwNodeIndex& rEnd,
         const SwPosition& rOtherPosition)
     {
         SwCntntNode * pNode = rEnd.GetNode().GetCntntNode();
-        SwNodeIndex aStt = SwNodeIndex(rStt);
-        SwNodeIndex aEnd = SwNodeIndex(rEnd);
-        bool bAtEnd = false;
-        if(!pNode)
-            pNode = rEnd.GetNodes().GoNext(&aEnd), bAtEnd = false;
-        if(!pNode)
-            pNode = rStt.GetNodes().GoPrevious(&aStt), bAtEnd = true;
-        if(pNode)
-            return lcl_PositionFromCntntNode(pNode, bAtEnd);
-        return auto_ptr<SwPosition>(new SwPosition(rOtherPosition));
+        bool bPosAtEndOfNode = false;
+        if ( pNode == NULL)
+        {
+            SwNodeIndex aEnd = SwNodeIndex(rEnd);
+            pNode = rEnd.GetNodes().GoNext( &aEnd );
+            bPosAtEndOfNode = false;
+        }
+        if ( pNode == NULL )
+        {
+            SwNodeIndex aStt = SwNodeIndex(rStt);
+            pNode = rStt.GetNodes().GoPrevious(&aStt);
+            bPosAtEndOfNode = true;
+        }
+        if ( pNode != NULL )
+        {
+            return lcl_PositionFromCntntNode( pNode, bPosAtEndOfNode );
+        }
+
+        return ::std::auto_ptr<SwPosition>(new SwPosition(rOtherPosition));
     };
 
     static IMark* lcl_getMarkAfter(const IDocumentMarkAccess::container_t& rMarks, const SwPosition& rPos)
@@ -154,25 +172,41 @@ namespace
             rMarks.begin(),
             pCandidatesEnd,
             back_inserter(vCandidates),
-            bind(logical_not<bool>(), bind(&IMark::EndsBefore, _1, rPos)));
+            boost::bind( ::std::logical_not<bool>(), bind( &IMark::EndsBefore, _1, rPos ) ) );
         // no candidate left => we are in front of the first mark or there are none
         if(!vCandidates.size()) return NULL;
         // return the highest (last) candidate using mark end ordering
         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 )
+        {
+            // 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());
+            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;
@@ -623,8 +657,11 @@ namespace sw { namespace mark
             const SwIndex* pSttIdx,
             const SwIndex* pEndIdx )
     {
-        vector<const_iterator_t> vMarksToDelete;
-        bool isSortingNeeded = false;
+        ::std::vector<const_iterator_t> vMarksToDelete;
+        bool bIsSortingNeeded = false;
+
+        // boolean indicating, if at least one mark has been moved while colleting marks for deletion
+        bool bMarksMoved = false;
 
         // copy all bookmarks in the move area to a vector storing all position data as offset
         // reassignment is performed after the move
@@ -639,94 +676,134 @@ namespace sw { namespace mark
 
             ::sw::mark::MarkBase* pMark = dynamic_cast< ::sw::mark::MarkBase* >(ppMark->get());
             // on position ??
-            bool isPosInRange = (lcl_GreaterThan(pMark->GetMarkPos(), rStt, pSttIdx) &&
-                lcl_Lower(pMark->GetMarkPos(), rEnd, pEndIdx));
-            bool isOtherPosInRange = (pMark->IsExpanded() &&
-                lcl_GreaterThan(pMark->GetOtherMarkPos(), rStt, pSttIdx) &&
-                lcl_Lower(pMark->GetOtherMarkPos(), rEnd, pEndIdx));
+            bool bIsPosInRange = lcl_GreaterThan(pMark->GetMarkPos(), rStt, pSttIdx)
+                                 && lcl_Lower(pMark->GetMarkPos(), rEnd, pEndIdx);
+            bool bIsOtherPosInRange = pMark->IsExpanded()
+                                      && 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
+                 && ( ( bIsOtherPosInRange
+                        && pMark->GetMarkPos().nNode == rEnd
+                        && pMark->GetMarkPos().nContent == *pEndIdx )
+                      || ( bIsPosInRange
+                           && pMark->IsExpanded()
+                           && pMark->GetOtherMarkPos().nNode == rEnd
+                           && pMark->GetOtherMarkPos().nContent == *pEndIdx ) ) )
             {
-                isPosInRange = true, isOtherPosInRange = true;
+                bIsPosInRange = true, bIsOtherPosInRange = true;
             }
 
-            if ( isPosInRange
-                 && ( isOtherPosInRange
+            if ( bIsPosInRange
+                 && ( bIsOtherPosInRange
                       || !pMark->IsExpanded() ) )
             {
                 // completely in range
 
-                bool bKeepCrossRefBkmk( false );
+                bool bDeleteMark = true;
                 {
-                    if ( rStt == rEnd
-                         && ( IDocumentMarkAccess::GetType(*pMark) == IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK
-                              || IDocumentMarkAccess::GetType(*pMark) == IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK ) )
+                    switch ( IDocumentMarkAccess::GetType( *pMark ) )
                     {
-                        bKeepCrossRefBkmk = true;
+                    case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK:
+                    case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK:
+                        // no delete of cross-reference bookmarks, if range is inside one paragraph
+                        bDeleteMark = rStt != rEnd;
+                        break;
+                    case IDocumentMarkAccess::UNO_BOOKMARK:
+                        // no delete of UNO mark, if it is not expanded and only touches the start of the range
+                        bDeleteMark = bIsOtherPosInRange
+                                      || pMark->IsExpanded()
+                                      || pSttIdx == NULL
+                                      || !( pMark->GetMarkPos().nNode == rStt
+                                            && pMark->GetMarkPos().nContent == *pSttIdx );
+                        break;
+                    default:
+                        bDeleteMark = true;
+                        break;
                     }
                 }
-                if ( !bKeepCrossRefBkmk )
+
+                if ( bDeleteMark )
                 {
-                    if(pSaveBkmk)
-                        pSaveBkmk->push_back(SaveBookmark(true, true, *pMark, rStt, pSttIdx));
+                    if ( pSaveBkmk )
+                    {
+                        pSaveBkmk->push_back( SaveBookmark( true, true, *pMark, rStt, pSttIdx ) );
+                    }
                     vMarksToDelete.push_back(ppMark);
                 }
             }
-            else if(isPosInRange ^ isOtherPosInRange)
+            else if ( bIsPosInRange ^ bIsOtherPosInRange )
             {
                 // 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 )
+
+                ::std::auto_ptr< SwPosition > pNewPos;
+                {
+                    if ( pEndIdx != NULL )
+                    {
+                        pNewPos = ::std::auto_ptr< SwPosition >( new SwPosition( rEnd, *pEndIdx ) );
+                    }
+                    else
+                    {
+                        pNewPos =
+                            lcl_FindExpelPosition( rStt, rEnd, bIsPosInRange ? 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 ( bIsPosInRange )
                         pMark->SetMarkPos(*pNewPos);
                     else
                         pMark->SetOtherMarkPos(*pNewPos);
+                    bMarksMoved = true;
 
                     // illegal selection? collapse the mark and restore sorting later
-                    isSortingNeeded |= lcl_FixCorrectedMark(isPosInRange, isOtherPosInRange, pMark);
+                    bIsSortingNeeded |= lcl_FixCorrectedMark( bIsPosInRange, bIsOtherPosInRange, pMark );
                 }
-                // <--
             }
         }
 
+        // If needed, sort mark containers containing subsets of the marks in order to assure sorting.
+        // The sorting is critical for the deletion of a mark as it is searched in these container for deletion.
+        if ( vMarksToDelete.size() > 0 && bMarksMoved )
+        {
+            sortSubsetMarks();
+        }
         // we just remembered the iterators to delete, so we do not need to search
         // for the shared_ptr<> (the entry in m_vAllMarks) again
         // reverse iteration, since erasing an entry invalidates iterators
         // behind it (the iterators in vMarksToDelete are sorted)
-        for(vector<const_iterator_t>::reverse_iterator pppMark = vMarksToDelete.rbegin();
-            pppMark != vMarksToDelete.rend();
-            pppMark++)
+        for ( ::std::vector< const_iterator_t >::reverse_iterator pppMark = vMarksToDelete.rbegin();
+              pppMark != vMarksToDelete.rend();
+              ++pppMark )
         {
             deleteMark(*pppMark);
         }
-        if(isSortingNeeded)
+
+        if ( bIsSortingNeeded )
+        {
             sortMarks();
+        }
+
 #if 0
         OSL_TRACE("deleteMarks");
         lcl_DebugMarks(m_vAllMarks);
@@ -743,28 +820,41 @@ namespace sw { namespace mark
             case IDocumentMarkAccess::BOOKMARK:
             case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK:
             case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK:
-                // if(dynamic_cast<IBookmark*>)
                 {
                     IDocumentMarkAccess::iterator_t ppBookmark = lcl_FindMark(m_vBookmarks, *ppMark);
-                    OSL_ENSURE(ppBookmark != m_vBookmarks.end(),
-                        "<MarkManager::deleteMark(..)>"
-                        " - Bookmark not found.");
-                    m_vBookmarks.erase(ppBookmark);
+                    if ( ppBookmark != m_vBookmarks.end() )
+                    {
+                        m_vBookmarks.erase(ppBookmark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Bookmark not found in Bookmark container.");
+                    }
 
                     ppBookmark = lcl_FindMark(m_vCommonMarks, *ppMark);
-                    m_vCommonMarks.erase(ppBookmark);
+                    if ( ppBookmark != m_vCommonMarks.end() )
+                    {
+                        m_vCommonMarks.erase(ppBookmark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Bookmark not found in common mark container.");
+                    }
                 }
                 break;
 
             case IDocumentMarkAccess::TEXT_FIELDMARK:
             case IDocumentMarkAccess::CHECKBOX_FIELDMARK:
-                // if(dynamic_cast<IFieldmark*>
                 {
                     IDocumentMarkAccess::iterator_t ppFieldmark = lcl_FindMark(m_vFieldmarks, *ppMark);
-                    OSL_ENSURE(ppFieldmark != m_vFieldmarks.end(),
-                        "<MarkManager::deleteMark(..)>"
-                        " - Bookmark not found.");
-                    m_vFieldmarks.erase(ppFieldmark);
+                    if ( ppFieldmark != m_vFieldmarks.end() )
+                    {
+                        m_vFieldmarks.erase(ppFieldmark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Fieldmark not found in Fieldmark container.");
+                    }
 
                     sw::mark::TextFieldmark* pTextFieldmark = dynamic_cast<sw::mark::TextFieldmark*>(ppMark->get());
                     if ( pTextFieldmark )
@@ -773,15 +863,28 @@ namespace sw { namespace mark
                     }
 
                     ppFieldmark = lcl_FindMark(m_vCommonMarks, *ppMark);
-                    m_vCommonMarks.erase(ppFieldmark);
+                    if ( ppFieldmark != m_vCommonMarks.end() )
+                    {
+                        m_vCommonMarks.erase(ppFieldmark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Fieldmark not found in common mark container.");
+                    }
                 }
                 break;
 
             case IDocumentMarkAccess::ANNOTATIONMARK:
                 {
                     IDocumentMarkAccess::iterator_t ppAnnotationMark = lcl_FindMark(m_vAnnotationMarks, *ppMark);
-                    OSL_ENSURE( ppAnnotationMark != m_vAnnotationMarks.end(), "<MarkManager::deleteMark(..)> - Annotation Mark not found." );
-                    m_vAnnotationMarks.erase(ppAnnotationMark);
+                    if ( ppAnnotationMark != m_vAnnotationMarks.end() )
+                    {
+                        m_vAnnotationMarks.erase(ppAnnotationMark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Annotation Mark not found in Annotation Mark container.");
+                    }
                 }
                 break;
 
@@ -790,7 +893,14 @@ namespace sw { namespace mark
             case IDocumentMarkAccess::UNO_BOOKMARK:
                 {
                     IDocumentMarkAccess::iterator_t ppOtherMark = lcl_FindMark(m_vCommonMarks, *ppMark);
-                    m_vCommonMarks.erase(ppOtherMark);
+                    if ( ppOtherMark != m_vCommonMarks.end() )
+                    {
+                        m_vCommonMarks.erase(ppOtherMark);
+                    }
+                    else
+                    {
+                        OSL_ENSURE( false, "<MarkManager::deleteMark(..)> - Navigator Reminder, DDE Mark or Uno Makr not found in common mark container.");
+                    }
                 }
                 break;
         }
@@ -827,7 +937,7 @@ namespace sw { namespace mark
             find_if(
                 pMarkLow,
                 pMarkHigh,
-                bind(equal_to<const IMark*>(), bind(&boost::shared_ptr<IMark>::get, _1), pMark) );
+                boost::bind( ::std::equal_to<const IMark*>(), bind(&boost::shared_ptr<IMark>::get, _1), pMark ) );
         if(pMarkFound != pMarkHigh)
             deleteMark(pMarkFound);
     }
@@ -955,15 +1065,25 @@ namespace sw { namespace mark
         return sTmp;
     }
 
-    void MarkManager::sortMarks()
+    void MarkManager::assureSortedMarkContainers() const
+    {
+        const_cast< MarkManager* >(this)->sortMarks();
+    }
+
+    void MarkManager::sortSubsetMarks()
     {
-        sort(m_vAllMarks.begin(), m_vAllMarks.end(), &lcl_MarkOrderingByStart);
         sort(m_vCommonMarks.begin(), m_vCommonMarks.end(), &lcl_MarkOrderingByStart);
         sort(m_vBookmarks.begin(), m_vBookmarks.end(), &lcl_MarkOrderingByStart);
         sort(m_vFieldmarks.begin(), m_vFieldmarks.end(), &lcl_MarkOrderingByStart);
         sort(m_vAnnotationMarks.begin(), m_vAnnotationMarks.end(), &lcl_MarkOrderingByStart);
     }
 
+    void MarkManager::sortMarks()
+    {
+        sort(m_vAllMarks.begin(), m_vAllMarks.end(), &lcl_MarkOrderingByStart);
+        sortSubsetMarks();
+    }
+
 #if OSL_DEBUG_LEVEL > 1
     void MarkManager::dumpFieldmarks( ) const
     {
@@ -1264,6 +1384,7 @@ void SaveBookmark::SetInDoc(
     }
 }
 
+
 // _DelBookmarks, _{Save,Restore}CntntIdx
 
 void _DelBookmarks(

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/doc/doccorr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/doc/doccorr.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/doc/doccorr.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/doc/doccorr.cxx Wed Mar 19 10:14:42 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/branches/alg_writerframes/main/sw/source/core/doc/docdesc.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/doc/docdesc.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/doc/docdesc.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/doc/docdesc.cxx Wed Mar 19 10:14:42 2014
@@ -646,7 +646,7 @@ void SwDoc::PrtDataChanged()
             pSh->GetViewOptions()->IsPrtFormat() )
 		{
 			if ( GetDocShell() )
-				pWait = new SwWait( *GetDocShell(), sal_True );
+				pWait = new SwWait( *GetDocShell(), true );
 
 			pTmpRoot->StartAllAction();
 			bEndAction = sal_True;

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/doc/docedt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/doc/docedt.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/doc/docedt.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/doc/docedt.cxx Wed Mar 19 10:14:42 2014
@@ -1559,52 +1559,50 @@ bool SwDoc::DeleteAndJoinWithRedlineImpl
     ASSERT( IsRedlineOn(), "DeleteAndJoinWithRedline: redline off" );
 
     {
-		SwUndoRedlineDelete* pUndo = 0;
-		RedlineMode_t eOld = GetRedlineMode();
-		checkRedlining(eOld);
+        SwUndoRedlineDelete* pUndo = 0;
+        RedlineMode_t eOld = GetRedlineMode();
+        checkRedlining( eOld );
         if (GetIDocumentUndoRedo().DoesUndo())
         {
 
-    //JP 06.01.98: MUSS noch optimiert werden!!!
-    SetRedlineMode(
-		   (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ));
+            //JP 06.01.98: MUSS noch optimiert werden!!!
+            SetRedlineMode(
+                (RedlineMode_t) ( nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ) );
 
-            GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+            GetIDocumentUndoRedo().StartUndo( UNDO_DELETE, NULL );
             pUndo = new SwUndoRedlineDelete( rPam, UNDO_DELETE );
-            GetIDocumentUndoRedo().AppendUndo(pUndo);
+            GetIDocumentUndoRedo().AppendUndo( pUndo );
         }
-        if( *rPam.GetPoint() != *rPam.GetMark() )
-            AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, rPam ), true);
+
+        if ( *rPam.GetPoint() != *rPam.GetMark() )
+            AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, rPam ), true );
         SetModified();
 
-		if( pUndo )
-		{
-            GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+        if ( pUndo )
+        {
+            GetIDocumentUndoRedo().EndUndo( UNDO_EMPTY, NULL );
             // ??? why the hell is the AppendUndo not below the
             // CanGrouping, so this hideous cleanup wouldn't be necessary?
             // bah, this is redlining, probably changing this would break it...
-            if (GetIDocumentUndoRedo().DoesGroupUndo())
+            if ( GetIDocumentUndoRedo().DoesGroupUndo() )
             {
-                SwUndo *const pLastUndo( GetUndoManager().GetLastUndo() );
-                SwUndoRedlineDelete *const pUndoRedlineDel(
-                        dynamic_cast<SwUndoRedlineDelete*>(pLastUndo) );
-                if (pUndoRedlineDel)
+                SwUndo * const pLastUndo( GetUndoManager().GetLastUndo() );
+                SwUndoRedlineDelete * const pUndoRedlineDel( dynamic_cast< SwUndoRedlineDelete* >( pLastUndo ) );
+                if ( pUndoRedlineDel )
                 {
-                    bool const bMerged = pUndoRedlineDel->CanGrouping(*pUndo);
-                    if (bMerged)
+                    bool const bMerged = pUndoRedlineDel->CanGrouping( *pUndo );
+                    if ( bMerged )
                     {
-                        ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
-                        SwUndo const*const pDeleted =
-                            GetUndoManager().RemoveLastUndo();
-                        OSL_ENSURE(pDeleted == pUndo,
-                            "DeleteAndJoinWithRedlineImpl: "
-                            "undo removed is not undo inserted?");
+                        ::sw::UndoGuard const undoGuard( GetIDocumentUndoRedo() );
+                        SwUndo const* const pDeleted = GetUndoManager().RemoveLastUndo();
+                        OSL_ENSURE( pDeleted == pUndo, "DeleteAndJoinWithRedlineImpl: "
+                            "undo removed is not undo inserted?" );
                         delete pDeleted;
                     }
                 }
             }
-//JP 06.01.98: MUSS noch optimiert werden!!!
-SetRedlineMode( eOld );
+            //JP 06.01.98: MUSS noch optimiert werden!!!
+            SetRedlineMode( eOld );
         }
         return true;
     }

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/doc/doclay.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/doc/doclay.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/doc/doclay.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/doc/doclay.cxx Wed Mar 19 10:14:42 2014
@@ -923,97 +923,100 @@ if( GetIDocumentUndoRedo().DoesUndo() )
 }
 
 
-	//Einfuegen eines DrawObjectes. Das Object muss bereits im DrawModel
-	// angemeldet sein.
-SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg,
-							 SdrObject& rDrawObj,
-							 const SfxItemSet* pFlyAttrSet,
-							 SwFrmFmt* pDefFmt )
-{
-	SwDrawFrmFmt *pFmt = MakeDrawFrmFmt( aEmptyStr,
-										pDefFmt ? pDefFmt : GetDfltFrmFmt() );
-
-	const SwFmtAnchor* pAnchor = 0;
-	if( pFlyAttrSet )
-	{
-		pFlyAttrSet->GetItemState( RES_ANCHOR, sal_False,
-									(const SfxPoolItem**)&pAnchor );
-        pFmt->SetFmtAttr( *pFlyAttrSet );
-	}
+// Insert drawing object, which has to be already inserted in the DrawModel
+SwDrawFrmFmt* SwDoc::InsertDrawObj(
+    const SwPaM &rRg,
+    SdrObject& rDrawObj,
+    const SfxItemSet& rFlyAttrSet )
+{
+    SwDrawFrmFmt* pFmt = MakeDrawFrmFmt( aEmptyStr, GetDfltFrmFmt() );
+
+    const SwFmtAnchor* pAnchor = 0;
+    rFlyAttrSet.GetItemState( RES_ANCHOR, sal_False, (const SfxPoolItem**) &pAnchor );
+    pFmt->SetFmtAttr( rFlyAttrSet );
 
-	RndStdIds eAnchorId = pAnchor ? pAnchor->GetAnchorId()
-								  : pFmt->GetAnchor().GetAnchorId();
-
-	// Anker noch nicht gesetzt ?
-	// DrawObjecte duerfen niemals in Kopf-/Fusszeilen landen.
+    RndStdIds eAnchorId = pAnchor != NULL ? pAnchor->GetAnchorId() : pFmt->GetAnchor().GetAnchorId();
     const bool bIsAtCntnt = (FLY_AT_PAGE != eAnchorId);
 
-	const SwNodeIndex* pChkIdx = 0;
-	if( !pAnchor )
+    const SwNodeIndex* pChkIdx = 0;
+    if ( pAnchor == NULL )
     {
-		pChkIdx = &rRg.GetPoint()->nNode;
+        pChkIdx = &rRg.GetPoint()->nNode;
     }
-	else if( bIsAtCntnt )
+    else if ( bIsAtCntnt )
     {
-		pChkIdx = pAnchor->GetCntntAnchor()
-					? &pAnchor->GetCntntAnchor()->nNode
-					: &rRg.GetPoint()->nNode;
+        pChkIdx =
+            pAnchor->GetCntntAnchor() ? &pAnchor->GetCntntAnchor()->nNode : &rRg.GetPoint()->nNode;
     }
 
-    // OD 24.06.2003 #108784# - allow drawing objects in header/footer, but
-    // control objects aren't allowed in header/footer.
-    if( pChkIdx &&
-        ::CheckControlLayer( &rDrawObj ) &&
-        IsInHeaderFooter( *pChkIdx ) )
+    // allow drawing objects in header/footer, but control objects aren't allowed in header/footer.
+    if( pChkIdx != NULL
+        && ::CheckControlLayer( &rDrawObj )
+        && IsInHeaderFooter( *pChkIdx ) )
     {
-       pFmt->SetFmtAttr( SwFmtAnchor( eAnchorId = FLY_AT_PAGE ) );
+        // apply at-page anchor format
+        eAnchorId = FLY_AT_PAGE;
+        pFmt->SetFmtAttr( SwFmtAnchor( eAnchorId ) );
     }
-    else if( !pAnchor || (bIsAtCntnt && !pAnchor->GetCntntAnchor() ))
-	{
-		// dann setze ihn, wird im Undo gebraucht
-		SwFmtAnchor aAnch( pAnchor ? *pAnchor : pFmt->GetAnchor() );
-		eAnchorId = aAnch.GetAnchorId();
-		if( FLY_AT_FLY == eAnchorId )
-		{
-			SwPosition aPos( *rRg.GetNode()->FindFlyStartNode() );
-			aAnch.SetAnchor( &aPos );
-		}
-		else
-		{
-			aAnch.SetAnchor( rRg.GetPoint() );
-            if ( FLY_AT_PAGE == eAnchorId )
-			{
-				eAnchorId = rDrawObj.ISA( SdrUnoObj )
-                                    ? FLY_AS_CHAR : FLY_AT_PARA;
-				aAnch.SetType( eAnchorId );
-			}
-		}
+    else if( pAnchor == NULL
+             || ( bIsAtCntnt
+                  && pAnchor->GetCntntAnchor() == NULL ) )
+    {
+        // apply anchor format
+        SwFmtAnchor aAnch( pAnchor != NULL ? *pAnchor : pFmt->GetAnchor() );
+        eAnchorId = aAnch.GetAnchorId();
+        if ( eAnchorId == FLY_AT_FLY )
+        {
+            SwPosition aPos( *rRg.GetNode()->FindFlyStartNode() );
+            aAnch.SetAnchor( &aPos );
+        }
+        else
+        {
+            aAnch.SetAnchor( rRg.GetPoint() );
+            if ( eAnchorId == FLY_AT_PAGE )
+            {
+                eAnchorId = rDrawObj.ISA( SdrUnoObj ) ? FLY_AS_CHAR : FLY_AT_PARA;
+                aAnch.SetType( eAnchorId );
+            }
+        }
         pFmt->SetFmtAttr( aAnch );
-	}
+    }
 
-	// bei als Zeichen gebundenen Draws das Attribut im Absatz setzen
-    if ( FLY_AS_CHAR == eAnchorId )
+    // insert text attribute for as-character anchored drawing object
+    if ( eAnchorId == FLY_AS_CHAR )
     {
-		xub_StrLen nStt = rRg.GetPoint()->nContent.GetIndex();
-        SwFmtFlyCnt aFmt( pFmt );
-        rRg.GetPoint()->nNode.GetNode().GetTxtNode()->InsertItem(
-                aFmt, nStt, nStt );
+        bool bAnchorAtPageAsFallback = true;
+        const SwFmtAnchor& rDrawObjAnchorFmt = pFmt->GetAnchor();
+        if ( rDrawObjAnchorFmt.GetCntntAnchor() != NULL )
+        {
+            SwTxtNode* pAnchorTxtNode =
+                    rDrawObjAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetTxtNode();
+            if ( pAnchorTxtNode != NULL )
+            {
+                const xub_StrLen nStt = rDrawObjAnchorFmt.GetCntntAnchor()->nContent.GetIndex();
+                SwFmtFlyCnt aFmt( pFmt );
+                pAnchorTxtNode->InsertItem( aFmt, nStt, nStt );
+                bAnchorAtPageAsFallback = false;
+            }
+        }
+
+        if ( bAnchorAtPageAsFallback )
+        {
+            ASSERT( false, "SwDoc::InsertDrawObj(..) - missing content anchor for as-character anchored drawing object --> anchor at-page" );
+            pFmt->SetFmtAttr( SwFmtAnchor( FLY_AT_PAGE ) );
+        }
     }
 
     SwDrawContact* pContact = new SwDrawContact( pFmt, &rDrawObj );
 
-	// ggfs. Frames anlegen
-	if( GetCurrentViewShell() )
+    if ( GetCurrentViewShell() )
     {
-		pFmt->MakeFrms();
-        // --> OD 2005-02-09 #i42319# - follow-up of #i35635#
-        // move object to visible layer
-        // --> OD 2007-07-10 #i79391#
+        // create layout representation
+        pFmt->MakeFrms();
         if ( pContact->GetAnchorFrm() )
         {
             pContact->MoveObjToVisibleLayer( &rDrawObj );
         }
-        // <--
     }
 
     if (GetIDocumentUndoRedo().DoesUndo())
@@ -1021,8 +1024,8 @@ SwDrawFrmFmt* SwDoc::Insert( const SwPaM
         GetIDocumentUndoRedo().AppendUndo( new SwUndoInsLayFmt(pFmt, 0, 0) );
     }
 
-	SetModified();
-	return pFmt;
+    SetModified();
+    return pFmt;
 }
 
 /*************************************************************************
@@ -1422,7 +1425,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtCo
                 pNewSet->Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ) );
 
 				aFrmSize = pOldFmt->GetFrmSize();
-				aFrmSize.SetWidthPercent( 100 );
+				aFrmSize.SetWidthPercent( 0 );
 				aFrmSize.SetHeightPercent( 255 );
 				pNewSet->Put( aFrmSize );
 

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/doc/docnew.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/doc/docnew.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/doc/docnew.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/doc/docnew.cxx Wed Mar 19 10:14:42 2014
@@ -1202,7 +1202,25 @@ SfxObjectShell* SwDoc::CreateCopy(bool b
     pRet->Paste( *this );
 
     // remove the temporary shell if it is there as it was done before
-    pRet->SetTmpDocShell( (SfxObjectShell*)NULL );
+    if(pRet->GetTmpDocShell())
+    {
+        // #123914# If we get here, SwOLENode::MakeCopy had to create a temporary
+        // SwDocShell to have a SvPersist as a target for the OLE data to be copied.
+        // It is reset by a call to SetTmpDocShell(NULL), but in this case here
+        // there is no other ref holder to the just cloned SwDoc. Thus - to prevent
+        // it's immediate deletion - it is required to hold a fercunt to it during
+        // the SetTmpDocShell call. This can be done with an instance of a class
+        // holding a SwDoc, but most simple using acquire/release on the SwDoc
+        // (as long as these are public, I was surprised. Also probably not
+        // guaranteed for the future is that the release call does not delete the
+        // SwDoc it gets called at, but currently works like this).
+        pRet->acquire();
+        pRet->SetTmpDocShell((SfxObjectShell*)NULL);
+        pRet->release();
+    }
+
+    // remove the temporary shell if it is there as it was done before
+    // pRet->SetTmpDocShell( (SfxObjectShell*)NULL );
 
     return pRetShell;
 }

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/doc/docnum.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/doc/docnum.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/doc/docnum.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/doc/docnum.cxx Wed Mar 19 10:14:42 2014
@@ -868,67 +868,44 @@ sal_Bool SwDoc::GotoOutline( SwPosition&
 // <--
 
 
-void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule )
+void lcl_ChgNumRule(
+    SwDoc& rDoc,
+    const SwNumRule& rRule )
 {
-	SwNumRule* pOld = rDoc.FindNumRulePtr( rRule.GetName() );
-	ASSERT( pOld, "ohne die alte NumRule geht gar nichts" );
+    SwNumRule* pOld = rDoc.FindNumRulePtr( rRule.GetName() );
+    ASSERT( pOld, "ohne die alte NumRule geht gar nichts" );
 
-    sal_uInt16 nChgFmtLevel = 0, nMask = 1;
-	sal_uInt8 n;
+    sal_uInt16 nChgFmtLevel = 0;
+    sal_uInt16 nMask = 1;
 
-	for( n = 0; n < MAXLEVEL; ++n, nMask <<= 1 )
-	{
-		const SwNumFmt& rOldFmt = pOld->Get( n ),
-					  & rNewFmt = rRule.Get( n );
+    for ( sal_uInt8 n = 0; n < MAXLEVEL; ++n, nMask <<= 1 )
+    {
+        const SwNumFmt& rOldFmt = pOld->Get( n ), &rNewFmt = rRule.Get( n );
 
-		if( rOldFmt != rNewFmt )
-		{
-			nChgFmtLevel |= nMask;
-		}
-		else if( SVX_NUM_NUMBER_NONE > rNewFmt.GetNumberingType() && 1 < rNewFmt.GetIncludeUpperLevels() &&
-				0 != (nChgFmtLevel & GetUpperLvlChg( n, rNewFmt.GetIncludeUpperLevels(),nMask )) )
-			nChgFmtLevel |= nMask;
-	}
+        if ( rOldFmt != rNewFmt )
+        {
+            nChgFmtLevel |= nMask;
+        }
+        else if ( SVX_NUM_NUMBER_NONE > rNewFmt.GetNumberingType()
+                  && 1 < rNewFmt.GetIncludeUpperLevels()
+                  && 0 != ( nChgFmtLevel & GetUpperLvlChg( n, rNewFmt.GetIncludeUpperLevels(), nMask ) ) )
+        {
+            nChgFmtLevel |= nMask;
+        }
+    }
 
     if( !nChgFmtLevel )         // es wurde nichts veraendert?
     {
-        // --> OD 2006-04-27 #i64311#
         const bool bInvalidateNumRule( pOld->IsContinusNum() != rRule.IsContinusNum() );
-        // <--
         pOld->CheckCharFmts( &rDoc );
         pOld->SetContinusNum( rRule.IsContinusNum() );
-        // --> OD 2008-06-17 #i87166#
-        // Do NOT change list style type
-//        pOld->SetRuleType( rRule.GetRuleType() );
-        // <--
-        // --> OD 2006-04-27 #i64311#
         if ( bInvalidateNumRule )
         {
             pOld->SetInvalidRule(sal_True);
         }
-        // <--
         return ;
 	}
 
-    // --> OD 2008-02-19 #refactorlists#
-//    SwNumRuleInfo* pUpd = new SwNumRuleInfo( rRule.GetName() );
-//    pUpd->MakeList( rDoc );
-
-//    sal_uInt8 nLvl;
-//    for( sal_uLong nFirst = 0, nLast = pUpd->GetList().Count();
-//        nFirst < nLast; ++nFirst )
-//    {
-//        SwTxtNode* pTxtNd = pUpd->GetList().GetObject( nFirst );
-//        nLvl = static_cast<sal_uInt8>(pTxtNd->GetLevel());
-
-//        if( nLvl < MAXLEVEL )
-//        {
-//            if( nChgFmtLevel & ( 1 << nLvl ))
-//            {
-//                pTxtNd->NumRuleChgd();
-//            }
-//        }
-//    }
     SwNumRule::tTxtNodeList aTxtNodeList;
     pOld->GetTxtNodeList( aTxtNodeList );
     sal_uInt8 nLvl( 0 );
@@ -946,34 +923,24 @@ void lcl_ChgNumRule( SwDoc& rDoc, const 
             }
         }
     }
-    // <--
 
-	for( n = 0; n < MAXLEVEL; ++n )
-		if( nChgFmtLevel & ( 1 << n ))
-			pOld->Set( n, rRule.GetNumFmt( n ));
-
-	pOld->CheckCharFmts( &rDoc );
-	pOld->SetInvalidRule(sal_True);
-	pOld->SetContinusNum( rRule.IsContinusNum() );
-    // --> OD 2008-06-17 #i87166#
-    // Do NOT change list style type
-//    pOld->SetRuleType( rRule.GetRuleType() );
-    // <--
-
-    // --> OD 2008-02-19 #refactorlists#
-//    delete pUpd;
-    // <--
+    for ( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
+        if ( nChgFmtLevel & ( 1 << n ) )
+            pOld->Set( n, rRule.GetNumFmt( n ) );
+
+    pOld->CheckCharFmts( &rDoc );
+    pOld->SetInvalidRule( sal_True );
+    pOld->SetContinusNum( rRule.IsContinusNum() );
 
     rDoc.UpdateNumRule();
 }
 
-// OD 2008-02-08 #newlistlevelattrs# - add handling of parameter <bResetIndentAttrs>
-// --> OD 2008-03-17 #refactorlists#
+
 void SwDoc::SetNumRule( const SwPaM& rPam,
                         const SwNumRule& rRule,
                         const bool bCreateNewList,
                         const String sContinuedListId,
-                        sal_Bool bSetItem,
+                        bool bSetItem,
                         const bool bResetIndentAttrs )
 {
     SwUndoInsNum * pUndo = NULL;
@@ -985,70 +952,69 @@ void SwDoc::SetNumRule( const SwPaM& rPa
         GetIDocumentUndoRedo().AppendUndo(pUndo);
     }
 
-	SwNumRule * pNew = FindNumRulePtr( rRule.GetName() );
-    bool bUpdateRule = false;
-
-	if( !pNew )
+    SwNumRule* pNewOrChangedNumRule = FindNumRulePtr( rRule.GetName() );
+    bool bNewNumRuleCreated = false;
+    if ( pNewOrChangedNumRule == NULL )
     {
-		pNew = (*pNumRuleTbl)[ MakeNumRule( rRule.GetName(), &rRule ) ];
+        // create new numbering rule based on given one
+        pNewOrChangedNumRule = ( *pNumRuleTbl )[MakeNumRule( rRule.GetName(), &rRule )];
+        bNewNumRuleCreated = true;
     }
-    else if (rRule != *pNew)
+    else if ( rRule != *pNewOrChangedNumRule )
     {
-        bUpdateRule = true;
-    }
-
-    if (bUpdateRule)
-    {
-        if( pUndo )
+        // change existing numbering rule
+        if( pUndo != NULL )
         {
-        	pUndo->SaveOldNumRule( *pNew );
-			::lcl_ChgNumRule( *this, rRule );
-			pUndo->SetLRSpaceEndPos();
+            pUndo->SaveOldNumRule( *pNewOrChangedNumRule );
         }
-        else
+        ::lcl_ChgNumRule( *this, rRule );
+        if( pUndo != NULL )
         {
-			::lcl_ChgNumRule( *this, rRule );
+            pUndo->SetLRSpaceEndPos();
         }
     }
 
     if ( bSetItem )
     {
+        String sListId;
         if ( bCreateNewList )
         {
-            String sListId;
-            if ( !bUpdateRule )
+            if ( bNewNumRuleCreated )
             {
                 // apply list id of list, which has been created for the new list style
-                sListId = pNew->GetDefaultListId();
+                sListId = pNewOrChangedNumRule->GetDefaultListId();
             }
             else
             {
                 // create new list and apply its list id
-                SwList* pNewList = createList( String(), pNew->GetName() );
+                const SwList* pNewList = createList( String(), pNewOrChangedNumRule->GetName() );
                 ASSERT( pNewList,
                         "<SwDoc::SetNumRule(..)> - could not create new list. Serious defect -> please inform OD." );
                 sListId = pNewList->GetListId();
             }
-            InsertPoolItem( rPam, SfxStringItem( RES_PARATR_LIST_ID, sListId ), 0 );
         }
         else if ( sContinuedListId.Len() > 0 )
         {
             // apply given list id
-            InsertPoolItem( rPam, SfxStringItem( RES_PARATR_LIST_ID, sContinuedListId ), 0 );
+            sListId = sContinuedListId;
+        }
+        if ( sListId.Len() > 0 )
+        {
+            InsertPoolItem( rPam, SfxStringItem( RES_PARATR_LIST_ID, sListId ), 0 );
         }
     }
 
-    if ( ! rPam.HasMark())
+    if ( !rPam.HasMark() )
     {
         SwTxtNode * pTxtNd = rPam.GetPoint()->nNode.GetNode().GetTxtNode();
-        // consider case that the PaM doesn't denote a text node - e.g. it denotes a graphic node
-        if ( pTxtNd )
+        // robust code: consider case that the PaM doesn't denote a text node - e.g. it denotes a graphic node
+        if ( pTxtNd != NULL )
         {
             SwNumRule * pRule = pTxtNd->GetNumRule();
 
-            if (pRule && pRule->GetName() == pNew->GetName())
+            if (pRule && pRule->GetName() == pNewOrChangedNumRule->GetName())
             {
-                bSetItem = sal_False;
+                bSetItem = false;
                 if ( !pTxtNd->IsInList() )
                 {
                     pTxtNd->AddToList();
@@ -1062,10 +1028,10 @@ void SwDoc::SetNumRule( const SwPaM& rPa
                 if ( pColl )
                 {
                     SwNumRule* pCollRule = FindNumRulePtr(pColl->GetNumRule().GetValue());
-                    if ( pCollRule && pCollRule->GetName() == pNew->GetName() )
+                    if ( pCollRule && pCollRule->GetName() == pNewOrChangedNumRule->GetName() )
                     {
                         pTxtNd->ResetAttr( RES_PARATR_NUMRULE );
-                        bSetItem = sal_False;
+                        bSetItem = false;
                     }
                 }
             }
@@ -1074,11 +1040,11 @@ void SwDoc::SetNumRule( const SwPaM& rPa
 
     if ( bSetItem )
     {
-        InsertPoolItem( rPam, SwNumRuleItem( pNew->GetName() ), 0 );
+        InsertPoolItem( rPam, SwNumRuleItem( pNewOrChangedNumRule->GetName() ), 0 );
     }
 
-    if ( bResetIndentAttrs &&
-         pNew && pNew->Get( 0 ).GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+    if ( bResetIndentAttrs
+         && pNewOrChangedNumRule->Get( 0 ).GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
     {
         SvUShortsSort aResetAttrsArray;
         aResetAttrsArray.Insert( RES_LR_SPACE );
@@ -1107,6 +1073,7 @@ void SwDoc::SetNumRule( const SwPaM& rPa
     SetModified();
 }
 
+
 void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted)
 {
     if ( bCounted )
@@ -1347,15 +1314,18 @@ void SwDoc::StopNumRuleAnimations( Outpu
 	}
 }
 
-sal_Bool SwDoc::ReplaceNumRule( const SwPosition& rPos,
-							const String& rOldRule, const String& rNewRule )
+sal_Bool SwDoc::ReplaceNumRule(
+    const SwPosition& rPos,
+    const String& rOldRule,
+    const String& rNewRule )
 {
-	sal_Bool bRet = sal_False;
-	SwNumRule *pOldRule = FindNumRulePtr( rOldRule ),
-			  *pNewRule = FindNumRulePtr( rNewRule );
-	if( pOldRule && pNewRule && pOldRule != pNewRule )
-	{
-        // --> OD 2008-02-19 #refactorlists#
+    sal_Bool bRet = sal_False;
+    SwNumRule* pOldRule = FindNumRulePtr( rOldRule );
+    SwNumRule* pNewRule = FindNumRulePtr( rNewRule );
+    if ( pOldRule != NULL
+         && pNewRule != NULL
+         && pOldRule != pNewRule )
+    {
         SwUndoInsNum* pUndo = 0;
         if (GetIDocumentUndoRedo().DoesUndo())
         {
@@ -1365,49 +1335,10 @@ sal_Bool SwDoc::ReplaceNumRule( const Sw
             GetIDocumentUndoRedo().AppendUndo(pUndo);
         }
 
-        // --> OD 2008-02-19 #refactorlists#
-        // apply new list style <pNewRule> to all text nodes, which have the
-        // old list style <pOldNRule> applied and belong to the same list as
-        // the text node of the given <SwPosition>.
-//        SwNumRuleInfo aUpd( rOldRule );
-//        aUpd.MakeList( *this );
-
-//        if (aUpd.GetList().Count() > 0)    // #106897#
         SwNumRule::tTxtNodeList aTxtNodeList;
         pOldRule->GetTxtNodeList( aTxtNodeList );
         if ( aTxtNodeList.size() > 0 )
         {
-//            // Position suchen und bestimme ob ein Node davor oder dahinter
-//            // einen Start erzwingt
-//            SwTxtNode* pTxtNd;
-//            sal_uLong nFndPos, nFirst, nLast;
-
-//            if( TABLE_ENTRY_NOTFOUND != aUpd.GetList().SearchKey(
-//                                                                 rPos.nNode.GetIndex(), &nFndPos ))
-//                ++nFndPos;
-
-//            for( nLast = nFndPos; nLast < aUpd.GetList().Count(); ++nLast )
-//            {
-//                pTxtNd = aUpd.GetList().GetObject( nLast );
-//                if(pTxtNd->IsRestart())
-//                    break;
-//            }
-//            for( nFirst = nFndPos; nFirst; )
-//            {
-//                pTxtNd = aUpd.GetList().GetObject( --nFirst );
-//                if( pTxtNd->IsRestart() )
-//                    break;
-//            }
-//            // dann neue Numerierung ueber diesen Bereich
-//            // definieren und den Start am Anfang/Ende zurueck setzen
-//            pTxtNd = aUpd.GetList().GetObject( nFirst );
-//            if( pTxtNd->IsRestart() )
-//            {
-//                pTxtNd->SetRestart(false);
-//                if( pUndo )
-//                    pUndo->SetSttNum( pTxtNd->GetIndex() );
-//            }
-
             SwRegHistory aRegH( pUndo ? pUndo->GetHistory() : 0 );
             sal_uInt16 nChgFmtLevel = 0;
             for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
@@ -1422,15 +1353,6 @@ sal_Bool SwDoc::ReplaceNumRule( const Sw
 
             const SwTxtNode* pGivenTxtNode = rPos.nNode.GetNode().GetTxtNode();
             SwNumRuleItem aRule( rNewRule );
-//            for( ; nFirst < nLast; ++nFirst )
-//            {
-//                pTxtNd = aUpd.GetList().GetObject( nFirst );
-
-//                aRegH.RegisterInModify( pTxtNd, *pTxtNd );
-
-//                pTxtNd->SwCntntNode::SetAttr( aRule );
-//                pTxtNd->NumRuleChgd();
-//            }
             for ( SwNumRule::tTxtNodeList::iterator aIter = aTxtNodeList.begin();
                   aIter != aTxtNodeList.end(); ++aIter )
             {
@@ -1455,7 +1377,7 @@ sal_Bool SwDoc::ReplaceNumRule( const Sw
 	return bRet;
 }
 
-// --> OD 2008-03-18 #refactorlists#
+
 namespace
 {
     struct ListStyleData
@@ -1471,22 +1393,17 @@ namespace
         {}
     };
 }
-// <--
 
 void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM)
 {
     ASSERT( rPaM.GetDoc() == this, "need same doc" );
 
-    // --> OD 2008-03-18 #refactorlists#
-//    map<SwNumRule *, SwNumRule *> aMyNumRuleMap;
     ::std::map<SwNumRule *, ListStyleData> aMyNumRuleMap;
-    // <--
-
- 	sal_uLong nStt = rPaM.Start()->nNode.GetIndex();
-	sal_uLong nEnd = rPaM.End()->nNode.GetIndex();
 
     bool bFirst = true;
 
+    const sal_uLong nStt = rPaM.Start()->nNode.GetIndex();
+    const sal_uLong nEnd = rPaM.End()->nNode.GetIndex();
     for (sal_uLong n = nStt; n <= nEnd; n++)
     {
         SwTxtNode * pCNd = GetNodes()[n]->GetTxtNode();
@@ -1497,11 +1414,8 @@ void SwDoc::MakeUniqueNumRules(const SwP
 
             if (pRule && pRule->IsAutoRule() && ! pRule->IsOutlineRule())
             {
-                // --> OD 2008-03-18 #refactorlists#
-//                SwNumRule * pReplaceNumRule = aMyNumRuleMap[pRule];
                 ListStyleData aListStyleData = aMyNumRuleMap[pRule];
 
-//                if (! pReplaceNumRule)
                 if ( aListStyleData.pReplaceNumRule == 0 )
                 {
                     if (bFirst)
@@ -1514,26 +1428,20 @@ void SwDoc::MakeUniqueNumRules(const SwP
                                             aListStyleData.sListId, true ));
                     }
 
-//                    if (! pReplaceNumRule)
                     if ( aListStyleData.pReplaceNumRule == 0 )
                     {
-//                        pReplaceNumRule = new SwNumRule(*pRule);
-//                        pReplaceNumRule->SetName(GetUniqueNumRuleName());
                         aListStyleData.pReplaceNumRule = new SwNumRule(*pRule);
-                        // --> OD 2008-07-08 #i91400#
-                        aListStyleData.pReplaceNumRule->SetName(
-                                                GetUniqueNumRuleName(), *this );
-                        // <--
+                        aListStyleData.pReplaceNumRule->SetName( GetUniqueNumRuleName(), *this );
                         aListStyleData.bCreateNewList = true;
                     }
 
-//                    aMyNumRuleMap[pRule] = pReplaceNumRule;
                     aMyNumRuleMap[pRule] = aListStyleData;
                 }
 
                 SwPaM aPam(*pCNd);
 
-                SetNumRule( aPam, *aListStyleData.pReplaceNumRule,
+                SetNumRule( aPam,
+                            *aListStyleData.pReplaceNumRule,
                             aListStyleData.bCreateNewList,
                             aListStyleData.sListId );
                 if ( aListStyleData.bCreateNewList )
@@ -2401,20 +2309,17 @@ sal_Bool SwDoc::NumOrNoNum( const SwNode
     return bResult;
 }
 
-SwNumRule* SwDoc::GetCurrNumRule( const SwPosition& rPos ) const
+SwNumRule* SwDoc::GetNumRuleAtPos( const SwPosition& rPos ) const
 {
-	SwNumRule* pRet = 0;
-	SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
+    SwNumRule* pRet = NULL;
+    SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
 
-	if( pTNd )
+    if ( pTNd != NULL )
     {
-        // --> OD 2008-02-20 #refactorlists#
-//        pTNd->SyncNumberAndNumRule();
-        // <--
-		pRet = pTNd->GetNumRule();
+        pRet = pTNd->GetNumRule();
     }
 
-	return pRet;
+    return pRet;
 }
 
 sal_uInt16 SwDoc::FindNumRule( const String& rName ) const
@@ -2602,7 +2507,7 @@ void SwDoc::UpdateNumRule()
 			rNmTbl[ n ]->Validate();
 }
 
-// --> OD 2008-04-02 #refactorlists#
+
 void SwDoc::MarkListLevel( const String& sListId,
                            const int nListLevel,
                            const sal_Bool bValue )
@@ -2622,27 +2527,22 @@ void SwDoc::MarkListLevel( SwList& rList
     // Set new marked list level and notify all affected nodes of the changed mark.
     rList.MarkListLevel( nListLevel, bValue );
 }
-// <- #i27615#
-// <--
 
-// #i23726#
-sal_Bool SwDoc::IsFirstOfNumRule(SwPosition & rPos)
+
+bool SwDoc::IsFirstOfNumRuleAtPos( const SwPosition & rPos )
 {
-    sal_Bool bResult = sal_False;
-    SwTxtNode * pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+    bool bResult = false;
 
-    if (pTxtNode)
+    const SwTxtNode* pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+    if ( pTxtNode != NULL )
     {
-        SwNumRule * pNumRule = pTxtNode->GetNumRule();
-
-        if (pNumRule)
-            bResult = pTxtNode->IsFirstOfNumRule();
+        bResult = pTxtNode->IsFirstOfNumRule();
     }
 
     return bResult;
 }
 
-// --> OD 2007-10-26 #i83479#
+
 // implementation for interface <IDocumentListItems>
 bool SwDoc::lessThanNodeNum::operator()( const SwNodeNum* pNodeNumOne,
                                          const SwNodeNum* pNodeNumTwo ) const
@@ -2722,9 +2622,8 @@ void SwDoc::getNumItems( tSortedNodeNumL
         }
     }
 }
-// <--
 
-// --> OD 2007-11-15 #i83479#
+
 // implementation for interface <IDocumentOutlineNodes>
 sal_Int32 SwDoc::getOutlineNodesCount() const
 {

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/doc/docredln.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/doc/docredln.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/doc/docredln.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/doc/docredln.cxx Wed Mar 19 10:14:42 2014
@@ -3013,12 +3013,16 @@ SwRedlineData::SwRedlineData( RedlineTyp
 	aStamp.Set100Sec( 0 );
 }
 
-SwRedlineData::SwRedlineData( const SwRedlineData& rCpy, sal_Bool bCpyNext )
-	:
-	pNext( (bCpyNext && rCpy.pNext) ? new SwRedlineData( *rCpy.pNext ) : 0 ),
-	pExtraData( rCpy.pExtraData ? rCpy.pExtraData->CreateNew() : 0 ),
-	sComment( rCpy.sComment ), aStamp( rCpy.aStamp ), eType( rCpy.eType ),
-	nAuthor( rCpy.nAuthor ), nSeqNo( rCpy.nSeqNo )
+SwRedlineData::SwRedlineData(
+    const SwRedlineData& rCpy,
+    sal_Bool bCpyNext )
+    : pNext( ( bCpyNext && rCpy.pNext ) ? new SwRedlineData( *rCpy.pNext ) : 0 )
+    , pExtraData( rCpy.pExtraData ? rCpy.pExtraData->CreateNew() : 0 )
+    , sComment( rCpy.sComment )
+    , aStamp( rCpy.aStamp )
+    , eType( rCpy.eType )
+    , nAuthor( rCpy.nAuthor )
+    , nSeqNo( rCpy.nSeqNo )
 {
 }
 

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/doc/doctxm.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/doc/doctxm.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/doc/doctxm.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/doc/doctxm.cxx Wed Mar 19 10:14:42 2014
@@ -1877,20 +1877,12 @@ void SwTOXBaseSection::GenerateText( sal
 					}
                     LinkStruct* pNewLink = new LinkStruct(sURL, nLinkStartPosition,
                                                     nEnd);
-                    pNewLink->aINetFmt.SetVisitedFmt(sLinkCharacterStyle);
-                    pNewLink->aINetFmt.SetINetFmt(sLinkCharacterStyle);
-                    if(sLinkCharacterStyle.Len())
-                    {
-                        sal_uInt16 nPoolId =
-                            SwStyleNameMapper::GetPoolIdFromUIName( sLinkCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
-                        pNewLink->aINetFmt.SetVisitedFmtId(nPoolId);
-                        pNewLink->aINetFmt.SetINetFmtId(nPoolId);
-                    }
-                    else
-                    {
-                        pNewLink->aINetFmt.SetVisitedFmtId(USHRT_MAX);
-                        pNewLink->aINetFmt.SetINetFmtId(USHRT_MAX);
-                    }
+                    const sal_uInt16 nPoolId =
+                            sLinkCharacterStyle.Len() == 0
+                            ? USHRT_MAX
+                            : SwStyleNameMapper::GetPoolIdFromUIName( sLinkCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+                    pNewLink->aINetFmt.SetVisitedFmtAndId( sLinkCharacterStyle, nPoolId );
+                    pNewLink->aINetFmt.SetINetFmtAndId( sLinkCharacterStyle, nPoolId );
                     aLinkArr.Insert( pNewLink, aLinkArr.Count() );
 					nLinkStartPosition = STRING_NOTFOUND;
                     sLinkCharacterStyle.Erase();

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/docnode/ndcopy.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/docnode/ndcopy.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/docnode/ndcopy.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/docnode/ndcopy.cxx Wed Mar 19 10:14:42 2014
@@ -1306,13 +1306,16 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPos
 		*pCpyRange->GetMark() = *aCpyPam.GetMark();
 	}
 
-    if ( pNumRuleToPropagate )
+    if ( pNumRuleToPropagate != NULL )
     {
-        // --> OD 2009-08-25 #i86492#
-        // use <SwDoc::SetNumRule(..)>, because it also handles the <ListId>
-//        pDoc->ReplaceNumRule(aCpyPam, *pNumRuleToPropagate);
-        pDoc->SetNumRule( aCpyPam, *pNumRuleToPropagate, false,
-                          aListIdToPropagate, sal_True, true );
+        // replace list
+        pDoc->SetNumRule(
+            aCpyPam,
+            *pNumRuleToPropagate,
+            false,
+            aListIdToPropagate,
+            true,
+            true );
     }
 
 	pDoc->SetRedlineMode_intern( eOld );

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/edit/autofmt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/edit/autofmt.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/edit/autofmt.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/edit/autofmt.cxx Wed Mar 19 10:14:42 2014
@@ -1663,75 +1663,76 @@ void SwAutoFormat::BuildEnum( sal_uInt16
 			bChgEnum = sal_False;
 	}
 
-	if( bChgEnum || bChgBullet )
-	{
-		aDelPam.DeleteMark();
-		aDelPam.GetPoint()->nNode = aNdIdx;
+    if ( bChgEnum || bChgBullet )
+    {
+        aDelPam.DeleteMark();
+        aDelPam.GetPoint()->nNode = aNdIdx;
 
-		if( aFlags.bSetNumRule )
-		{
-			if( aFlags.bAFmtByInput )
-			{
-				aDelPam.SetMark();
-				aDelPam.GetMark()->nNode++;
-                aDelPam.GetNode(sal_False)->GetTxtNode()->SetAttrListLevel( nLvl );
-			}
+        if ( aFlags.bSetNumRule )
+        {
+            if ( aFlags.bAFmtByInput )
+            {
+                aDelPam.SetMark();
+                aDelPam.GetMark()->nNode++;
+                aDelPam.GetNode( sal_False )->GetTxtNode()->SetAttrListLevel( nLvl );
+            }
 
-            pAktTxtNd->SetAttrListLevel(nLvl);
-			pAktTxtNd->SetNumLSpace( sal_True );
+            pAktTxtNd->SetAttrListLevel( nLvl );
+            pAktTxtNd->SetNumLSpace( sal_True );
 
-            // --> OD 2008-03-17 #refactorlists#
             // start new list
             pDoc->SetNumRule( aDelPam, aRule, true );
             // <--
-			aDelPam.DeleteMark();
+            aDelPam.DeleteMark();
 
-			aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 );
-		}
-		else
-			aDelPam.GetPoint()->nContent.Assign( pAktTxtNd,
-						bChgEnum ? (nTxtStt - nOrigTxtStt) : 0 );
-		aDelPam.SetMark();
+            aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, 0 );
+        }
+        else
+        {
+            aDelPam.GetPoint()->nContent.Assign( pAktTxtNd, bChgEnum ? ( nTxtStt - nOrigTxtStt ) : 0 );
+        }
+        aDelPam.SetMark();
 
-		if( bChgBullet )
-			nTxtStt += 2;
+        if ( bChgBullet )
+            nTxtStt += 2;
 
-		while( nTxtStt < rStr.Len() && IsSpace( rStr.GetChar( nTxtStt ) ))
-			nTxtStt++;
+        while (nTxtStt < rStr.Len() && IsSpace( rStr.GetChar( nTxtStt ) ))
+            nTxtStt++;
 
-		aDelPam.GetPoint()->nContent = nTxtStt - nOrigTxtStt;
-		DeleteSel( aDelPam );
+        aDelPam.GetPoint()->nContent = nTxtStt - nOrigTxtStt;
+        DeleteSel( aDelPam );
 
-		if( !aFlags.bSetNumRule )
-		{
-			String sChgStr( '\t' );
-			if( bChgBullet )
-				sChgStr.Insert( aFlags.cBullet, 0 );
+        if ( !aFlags.bSetNumRule )
+        {
+            String sChgStr( '\t' );
+            if ( bChgBullet )
+                sChgStr.Insert( aFlags.cBullet, 0 );
             pDoc->InsertString( aDelPam, sChgStr );
 
-			SfxItemSet aSet( pDoc->GetAttrPool(), aTxtNodeSetRange );
-			if( bChgBullet )
-			{
-				aDelPam.GetPoint()->nContent = 0;
-				aDelPam.SetMark();
-				aDelPam.GetMark()->nContent = 1;
-				SetAllScriptItem( aSet,
-					 SvxFontItem( aFlags.aBulletFont.GetFamily(),
-								  aFlags.aBulletFont.GetName(),
-								  aFlags.aBulletFont.GetStyleName(),
-								  aFlags.aBulletFont.GetPitch(),
-                                  aFlags.aBulletFont.GetCharSet(),
-                                  RES_CHRATR_FONT ) );
-				pDoc->SetFmtItemByAutoFmt( aDelPam, aSet );
-				aDelPam.DeleteMark();
-				nAutoCorrPos = 2;
-				aSet.ClearItem();
-			}
-            SvxTabStopItem aTStops( RES_PARATR_TABSTOP );    aTStops.Insert( SvxTabStop( 0 ));
-			aSet.Put( aTStops );
-			pDoc->SetFmtItemByAutoFmt( aDelPam, aSet );
-		}
-	}
+            SfxItemSet aSet( pDoc->GetAttrPool(), aTxtNodeSetRange );
+            if ( bChgBullet )
+            {
+                aDelPam.GetPoint()->nContent = 0;
+                aDelPam.SetMark();
+                aDelPam.GetMark()->nContent = 1;
+                SetAllScriptItem( aSet,
+                                  SvxFontItem( aFlags.aBulletFont.GetFamily(),
+                                               aFlags.aBulletFont.GetName(),
+                                               aFlags.aBulletFont.GetStyleName(),
+                                               aFlags.aBulletFont.GetPitch(),
+                                               aFlags.aBulletFont.GetCharSet(),
+                                               RES_CHRATR_FONT ) );
+                pDoc->SetFmtItemByAutoFmt( aDelPam, aSet );
+                aDelPam.DeleteMark();
+                nAutoCorrPos = 2;
+                aSet.ClearItem();
+            }
+            SvxTabStopItem aTStops( RES_PARATR_TABSTOP );
+            aTStops.Insert( SvxTabStop( 0 ) );
+            aSet.Put( aTStops );
+            pDoc->SetFmtItemByAutoFmt( aDelPam, aSet );
+        }
+    }
 
 	if( bBreak )
 	{
@@ -2683,7 +2684,7 @@ void SwEditShell::AutoFormat( const SvxS
 	{
 		aAFFlags = *pAFlags;
 		if( !aAFFlags.bAFmtByInput )
-			pWait = new SwWait( *GetDoc()->GetDocShell(), sal_True );
+			pWait = new SwWait( *GetDoc()->GetDocShell(), true );
 	}
 
 	SwPaM* pCrsr = GetCrsr();

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/edit/eddel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/edit/eddel.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/edit/eddel.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/edit/eddel.cxx Wed Mar 19 10:14:42 2014
@@ -118,7 +118,7 @@ long SwEditShell::Delete()
 {
 	SET_CURR_SHELL( this );
 	long nRet = 0;
-	if( !HasReadonlySel() )
+	if ( !HasReadonlySel() || CrsrInsideInputFld() )
 	{
 		StartAllAction();
 

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/edit/edfcol.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/edit/edfcol.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/edit/edfcol.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/edit/edfcol.cxx Wed Mar 19 10:14:42 2014
@@ -77,11 +77,10 @@ void SwEditShell::SetTxtFmtColl( SwTxtFm
     GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_SETFMTCOLL, &aRewriter);
 	FOREACHPAM_START(this)
 
-        if( !PCURCRSR->HasReadonlySel(
-                    // --> FME 2004-06-29 #114856# Formular view
-                    GetViewOptions()->IsFormView() ) )
-                    // <--
+        if ( !PCURCRSR->HasReadonlySel( GetViewOptions()->IsFormView() ) )
+        {
             GetDoc()->SetTxtFmtColl( *PCURCRSR, pLocal, true, bResetListAttrs );
+        }
 
 	FOREACHPAM_END()
     GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, &aRewriter);

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/edit/ednumber.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/edit/ednumber.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/edit/ednumber.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/edit/ednumber.cxx Wed Mar 19 10:14:42 2014
@@ -352,101 +352,63 @@ sal_Bool SwEditShell::NumUpDown( sal_Boo
 	EndAllAction();
 	return bRet;
 }
-// -> #i23726#
-sal_Bool SwEditShell::IsFirstOfNumRule() const
-{
-    sal_Bool bResult = sal_False;
 
-    SwPaM * pCrsr = GetCrsr();
-    if (pCrsr->GetNext() == pCrsr)
-    {
-        bResult = IsFirstOfNumRule(*pCrsr);
-    }
 
-    return bResult;
-}
-
-sal_Bool SwEditShell::IsFirstOfNumRule(const SwPaM & rPaM) const
+bool SwEditShell::IsFirstOfNumRuleAtCrsrPos() const
 {
-    sal_Bool bResult = sal_False;
-
-    SwPosition aPos(*rPaM.GetPoint());
-    bResult = GetDoc()->IsFirstOfNumRule(aPos);
-
-    return bResult;
+    return GetDoc()->IsFirstOfNumRuleAtPos( *GetCrsr()->GetPoint() );
 }
-// <- #i23726#
 
-// -> #i23725#
-// --> OD 2008-06-09 #i90078#
-// Remove unused default parameter <nLevel> and <bRelative>.
-// Adjust method name and parameter name
-void SwEditShell::ChangeIndentOfAllListLevels( short nDiff )
+
+void SwEditShell::ChangeIndentOfAllListLevels( const short nDiff )
 {
     StartAllAction();
 
-    const SwNumRule *pCurNumRule = GetCurNumRule();
-    //#120911# check if numbering rule really exists
-    if (pCurNumRule)
+    const SwNumRule *pCurNumRule = GetNumRuleAtCurrCrsrPos();
+    if ( pCurNumRule != NULL )
     {
         SwNumRule aRule(*pCurNumRule);
-        // --> OD 2008-06-09 #i90078#
         aRule.ChangeIndent( nDiff );
-        // <--
 
-        // --> OD 2008-03-17 #refactorlists#
-        // no start of new list
         SetCurNumRule( aRule, false );
-        // <--
     }
 
     EndAllAction();
 }
 
-// --> OD 2008-06-09 #i90078#
-// Adjust method name
-void SwEditShell::SetIndent(short nIndent, const SwPosition & rPos)
-// <--
+
+void SwEditShell::SetIndent(
+    short nIndent,
+    const SwPosition & rPos )
 {
     StartAllAction();
 
-    SwNumRule *pCurNumRule = GetDoc()->GetCurrNumRule(rPos);
+    SwNumRule *pCurNumRule = GetDoc()->GetNumRuleAtPos(rPos);
 
     if (pCurNumRule)
     {
-        SwPaM aPaM(rPos);
-        SwTxtNode * pTxtNode = aPaM.GetNode()->GetTxtNode();
-
-        // --> OD 2008-06-09 #i90078#
-//        int nLevel = -1;
-//        int nReferenceLevel = pTxtNode->GetActualListLevel();
-//        if (! IsFirstOfNumRule(aPaM))
-//            nLevel = nReferenceLevel;
-
         SwNumRule aRule(*pCurNumRule);
-//        aRule.ChangeIndent(nIndent, nLevel, nReferenceLevel, sal_False);
-        if ( IsFirstOfNumRule() )
+        if ( !IsMultiSelection() && IsFirstOfNumRuleAtCrsrPos() )
         {
             aRule.SetIndentOfFirstListLevelAndChangeOthers( nIndent );
         }
-        else if ( pTxtNode->GetActualListLevel() >= 0  )
+        else
         {
-            aRule.SetIndent( nIndent,
-                             static_cast<sal_uInt16>(pTxtNode->GetActualListLevel()) );
+            const SwTxtNode* pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+            if ( pTxtNode != NULL
+                 && pTxtNode->GetActualListLevel() >= 0 )
+            {
+                aRule.SetIndent( nIndent, static_cast< sal_uInt16 >( pTxtNode->GetActualListLevel() ) );
+            }
         }
-        // <--
 
-        // --> OD 2005-02-18 #i42921# - 3rd parameter = false in order to
-        // suppress setting of num rule at <aPaM>.
-        // --> OD 2008-03-17 #refactorlists#
-        // do not apply any list
-        GetDoc()->SetNumRule( aPaM, aRule, false, String(), sal_False );
-        // <--
+        // change numbering rule - changed numbering rule is not applied at <aPaM>
+        SwPaM aPaM(rPos);
+        GetDoc()->SetNumRule( aPaM, aRule, false, String(), false );
     }
 
     EndAllAction();
 }
-// <- #i23725#
 
 sal_Bool SwEditShell::MoveParagraph( long nOffset )
 {
@@ -696,35 +658,36 @@ sal_Bool SwEditShell::IsOutlineCopyable(
 }
 
 
-sal_Bool SwEditShell::NumOrNoNum( sal_Bool bNumOn, sal_Bool bChkStart ) // #115901#
+sal_Bool SwEditShell::NumOrNoNum(
+    sal_Bool bNumOn,
+    sal_Bool bChkStart )
 {
-	sal_Bool bRet = sal_False;
-	SwPaM* pCrsr = GetCrsr();
-	if( pCrsr->GetNext() == pCrsr && !pCrsr->HasMark() &&
-		( !bChkStart || !pCrsr->GetPoint()->nContent.GetIndex()) )
-	{
-		StartAllAction();		// Klammern fuers Updaten !!
-        // #115901#
-		bRet = GetDoc()->NumOrNoNum( pCrsr->GetPoint()->nNode, !bNumOn ); // #i29560#
-		EndAllAction();
-	}
-	return bRet;
+    sal_Bool bRet = sal_False;
+
+    if ( !IsMultiSelection()
+         && !HasSelection()
+         && ( !bChkStart || IsSttPara() ) )
+    {
+        StartAllAction();
+        bRet = GetDoc()->NumOrNoNum( GetCrsr()->GetPoint()->nNode, !bNumOn );
+        EndAllAction();
+    }
+    return bRet;
 }
 
+
 sal_Bool SwEditShell::IsNoNum( sal_Bool bChkStart ) const
 {
-	// ein Backspace im Absatz ohne Nummer wird zum Delete
     sal_Bool bResult = sal_False;
-	SwPaM* pCrsr = GetCrsr();
 
-    if (pCrsr->GetNext() == pCrsr && !pCrsr->HasMark() &&
-		(!bChkStart || !pCrsr->GetPoint()->nContent.GetIndex()))
+    if ( !IsMultiSelection()
+         && !HasSelection()
+         && ( !bChkStart || IsSttPara() ) )
     {
-        const SwTxtNode* pTxtNd = pCrsr->GetNode()->GetTxtNode();
-
-        if (pTxtNd)
+        const SwTxtNode* pTxtNd = GetCrsr()->GetNode()->GetTxtNode();
+        if ( pTxtNd != NULL )
         {
-            bResult =  ! pTxtNd->IsCountedInList();
+            bResult =  !pTxtNd->IsCountedInList();
         }
     }
 
@@ -740,12 +703,12 @@ sal_uInt8 SwEditShell::GetNumLevel() con
     SwPaM* pCrsr = GetCrsr();
     const SwTxtNode* pTxtNd = pCrsr->GetNode()->GetTxtNode();
 
-    ASSERT( pTxtNd, "GetNumLevel() without text node" )
-    if ( !pTxtNd )
+    ASSERT( pTxtNd != NULL, "GetNumLevel() without text node" )
+    if ( pTxtNd == NULL )
         return nLevel;
 
     const SwNumRule* pRule = pTxtNd->GetNumRule();
-    if(pRule)
+    if ( pRule != NULL )
     {
         const int nListLevelOfTxtNode( pTxtNd->GetActualListLevel() );
         if ( nListLevelOfTxtNode >= 0 )
@@ -757,13 +720,51 @@ sal_uInt8 SwEditShell::GetNumLevel() con
     return nLevel;
 }
 
-const SwNumRule* SwEditShell::GetCurNumRule() const
+const SwNumRule* SwEditShell::GetNumRuleAtCurrCrsrPos() const
 {
-	return GetDoc()->GetCurrNumRule( *GetCrsr()->GetPoint() );
+	return GetDoc()->GetNumRuleAtPos( *GetCrsr()->GetPoint() );
 }
 
-// OD 2008-02-08 #newlistlevelattrs# - add handling of parameter <bResetIndentAttrs>
-// --> OD 2008-03-17 #refactorlists#
+const SwNumRule* SwEditShell::GetNumRuleAtCurrentSelection() const
+{
+    const SwNumRule* pNumRuleAtCurrentSelection = NULL;
+
+    const SwPaM* pCurrentCrsr = GetCrsr();
+    bool bDifferentNumRuleFound = false;
+    const SwPaM* pCrsr = pCurrentCrsr;
+    do
+    {
+        const SwNodeIndex aEndNode = pCrsr->End()->nNode;
+
+        for ( SwNodeIndex aNode = pCrsr->Start()->nNode; aNode <= aEndNode; aNode++ )
+        {
+            const SwNumRule* pNumRule = GetDoc()->GetNumRuleAtPos( SwPosition( aNode ) );
+            if ( pNumRule == NULL )
+            {
+                continue;
+            }
+            else if ( pNumRule != pNumRuleAtCurrentSelection )
+            {
+                if ( pNumRuleAtCurrentSelection == NULL )
+                {
+                    pNumRuleAtCurrentSelection = pNumRule;
+                }
+                else
+                {
+                    pNumRuleAtCurrentSelection = NULL;
+                    bDifferentNumRuleFound = true;
+                    break;
+                }
+            }
+        }
+
+        pCrsr = static_cast< const SwPaM* >(pCrsr->GetNext());
+    } while ( !bDifferentNumRuleFound && pCrsr != pCurrentCrsr );
+
+    return pNumRuleAtCurrentSelection;
+}
+
+
 void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
                                  const bool bCreateNewList,
                                  const String sContinuedListId,
@@ -774,7 +775,7 @@ void SwEditShell::SetCurNumRule( const S
     GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
 
     SwPaM* pCrsr = GetCrsr();
-    if( pCrsr->GetNext() != pCrsr )			// Mehrfachselektion ?
+    if( IsMultiSelection() )
     {
         SwPamRanges aRangeArr( *pCrsr );
         SwPaM aPam( *pCrsr->GetPoint() );
@@ -783,7 +784,7 @@ void SwEditShell::SetCurNumRule( const S
             aRangeArr.SetPam( n, aPam );
             GetDoc()->SetNumRule( aPam, rRule,
                                   bCreateNewList, sContinuedListId,
-                                  sal_True, bResetIndentAttrs );
+                                  true, bResetIndentAttrs );
             GetDoc()->SetCounted( aPam, true );
         }
     }
@@ -791,7 +792,7 @@ void SwEditShell::SetCurNumRule( const S
     {
         GetDoc()->SetNumRule( *pCrsr, rRule,
                               bCreateNewList, sContinuedListId,
-                              sal_True, bResetIndentAttrs );
+                              true, bResetIndentAttrs );
         GetDoc()->SetCounted( *pCrsr, true );
     }
     GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
@@ -799,6 +800,7 @@ void SwEditShell::SetCurNumRule( const S
     EndAllAction();
 }
 
+
 String SwEditShell::GetUniqueNumRuleName( const String* pChkStr, sal_Bool bAutoNum ) const
 {
 	return GetDoc()->GetUniqueNumRuleName( pChkStr, bAutoNum );

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/edit/edtab.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/edit/edtab.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/edit/edtab.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/edit/edtab.cxx Wed Mar 19 10:14:42 2014
@@ -131,7 +131,7 @@ sal_Bool SwEditShell::TextToTable( const
                                sal_Int16 eAdj,
                                const SwTableAutoFmt* pTAFmt )
 {
-	SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
+	SwWait aWait( *GetDoc()->GetDocShell(), true );
 	sal_Bool bRet = sal_False;
 	StartAllAction();
 	FOREACHPAM_START(this)
@@ -145,7 +145,7 @@ sal_Bool SwEditShell::TextToTable( const
 
 sal_Bool SwEditShell::TableToText( sal_Unicode cCh )
 {
-	SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
+	SwWait aWait( *GetDoc()->GetDocShell(), true );
 	sal_Bool bRet = sal_False;
 	SwPaM* pCrsr = GetCrsr();
 	const SwTableNode* pTblNd =

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/edit/edundo.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/edit/edundo.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/edit/edundo.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/edit/edundo.cxx Wed Mar 19 10:14:42 2014
@@ -125,7 +125,7 @@ bool SwEditShell::Undo(sal_uInt16 const 
         //			Erkennung darf nur noch fuer die neue "Box" erfolgen!
         ClearTblBoxCntnt();
 
-        RedlineMode_t eOld = GetDoc()->GetRedlineMode();
+        const RedlineMode_t eOld = GetDoc()->GetRedlineMode();
 
         try {
             for (sal_uInt16 i = 0; i < nCount; ++i)

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/fields/expfld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/fields/expfld.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/fields/expfld.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/fields/expfld.cxx Wed Mar 19 10:14:42 2014
@@ -1181,6 +1181,32 @@ const String& SwInputField::getContent()
     return aContent;
 }
 
+
+void SwInputField::LockNotifyContentChange()
+{
+    if ( GetFmtFld() != NULL )
+    {
+        SwTxtInputFld* pTxtInputFld = dynamic_cast< SwTxtInputFld* >(GetFmtFld()->GetTxtFld());
+        if ( pTxtInputFld != NULL )
+        {
+            pTxtInputFld->LockNotifyContentChange();
+        }
+    }
+}
+
+
+void SwInputField::UnlockNotifyContentChange()
+{
+    if ( GetFmtFld() != NULL )
+    {
+        SwTxtInputFld* pTxtInputFld = dynamic_cast< SwTxtInputFld* >(GetFmtFld()->GetTxtFld());
+        if ( pTxtInputFld != NULL )
+        {
+            pTxtInputFld->UnlockNotifyContentChange();
+        }
+    }
+}
+
 void SwInputField::applyFieldContent( const String& rNewFieldContent )
 {
     if ( (nSubType & 0x00ff) == INP_TXT )
@@ -1194,6 +1220,13 @@ void SwInputField::applyFieldContent( co
         if( pUserTyp )
         {
             pUserTyp->SetContent( rNewFieldContent );
+
+            // trigger update of the corresponding User Fields and other related Input Fields
+            {
+                LockNotifyContentChange();
+                pUserTyp->UpdateFlds();
+                UnlockNotifyContentChange();
+            }
         }
     }
 }

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/fields/usrfld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/fields/usrfld.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/fields/usrfld.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/fields/usrfld.cxx Wed Mar 19 10:14:42 2014
@@ -230,12 +230,18 @@ const String& SwUserFieldType::GetName()
 
 void SwUserFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
 {
-	if( !pOld && !pNew )
-		ChgValid( sal_False );
+    if( !pOld && !pNew )
+        ChgValid( sal_False );
 
-	NotifyClients( pOld, pNew );
-	// und ggfs. am UserFeld haengende InputFelder updaten!
-	GetDoc()->GetSysFldType( RES_INPUTFLD )->UpdateFlds();
+    NotifyClients( pOld, pNew );
+
+    // update Input Fields as there might be Input Fields depending on this User Field
+    if ( !IsModifyLocked() )
+    {
+        LockModify();
+        GetDoc()->GetSysFldType( RES_INPUTFLD )->UpdateFlds();
+        UnlockModify();
+    }
 }
 
 double SwUserFieldType::GetValue( SwCalc& rCalc )

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/frmedt/fecopy.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/frmedt/fecopy.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/frmedt/fecopy.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/frmedt/fecopy.cxx Wed Mar 19 10:14:42 2014
@@ -83,7 +83,7 @@
 #include <pagedesc.hxx>
 #include <mvsave.hxx>
 #include <vcl/virdev.hxx>
-
+#include <svx/svdundo.hxx>
 
 using namespace ::com::sun::star;
 
@@ -211,7 +211,7 @@ sal_Bool SwFEShell::Copy( SwDoc* pClpDoc
                     pClpDoc->CloneSdrObj( *pObj, sal_False, sal_True );
 
                 SwPaM aTemp(aPos);
-                pClpDoc->Insert(aTemp, *pNew, &aSet, NULL);
+                pClpDoc->InsertDrawObj(aTemp, *pNew, aSet );
 			}
 			else
 			{
@@ -396,8 +396,7 @@ sal_Bool SwFEShell::CopyDrawSel( SwFEShe
 					aSet.Put( aAnchor );
 					SdrObject* pNew = pDestDoc->CloneSdrObj( *pObj, bIsMove &&
 												GetDoc() == pDestDoc, sal_True );
-					pFmt = pDestDoc->Insert( *pDestShell->GetCrsr(),
-											*pNew, &aSet, NULL );
+					pFmt = pDestDoc->InsertDrawObj( *pDestShell->GetCrsr(), *pNew, aSet );
 				}
 				else
                     pFmt = pDestDoc->CopyLayoutFmt( *pFmt, aAnchor, true, true );
@@ -1299,7 +1298,7 @@ sal_Bool SwFEShell::GetDrawObjGraphic( s
 		}
 		else if( SOT_FORMAT_GDIMETAFILE == nFmt )
 			rGrf = Imp()->GetDrawView()->GetMarkedObjMetaFile();
-		else if( SOT_FORMAT_BITMAP == nFmt )
+		else if( SOT_FORMAT_BITMAP == nFmt || SOT_FORMATSTR_ID_PNG == nFmt )
 			rGrf = Imp()->GetDrawView()->GetMarkedObjBitmapEx();
 	}
 	return bConvert;
@@ -1456,10 +1455,15 @@ void SwFEShell::Paste( SvStream& rStrm, 
 
 					DelSelectedObj();
 
-					pFmt = GetDoc()->Insert( *GetCrsr(), *pNewObj, &aFrmSet, NULL );
+					pFmt = GetDoc()->InsertDrawObj( *GetCrsr(), *pNewObj, aFrmSet );
 				}
 				else
-					pView->ReplaceObjectAtView( pOldObj, *Imp()->GetPageView(), pNewObj, sal_True );
+                {
+                    // #123922#  for handling MasterObject and virtual ones correctly, SW
+                    // wants us to call ReplaceObject at the page, but that also
+                    // triggers the same assertion (I tried it), so stay at the view method
+                    pView->ReplaceObjectAtView(pOldObj, *Imp()->GetPageView(), pNewObj);
+                }
 			}
 			break;
 
@@ -1564,23 +1568,52 @@ void SwFEShell::Paste( SvStream& rStrm, 
 	delete pModel;
 }
 
-sal_Bool SwFEShell::Paste( const Graphic &rGrf )
+bool SwFEShell::Paste( const Graphic &rGrf, const String& rURL )
 {
-	SET_CURR_SHELL( this );
-	SdrObject* pObj;
-	SdrView *pView = Imp()->GetDrawView();
+    SET_CURR_SHELL( this );
+    SdrObject* pObj = 0;
+    SdrView *pView = Imp()->GetDrawView();
 
-	sal_Bool bRet = 1 == pView->GetMarkedObjectList().GetMarkCount() &&
-		(pObj = pView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj())->IsClosedObj() &&
-		!pObj->ISA( SdrOle2Obj );
+    sal_Bool bRet = 1 == pView->GetMarkedObjectList().GetMarkCount() &&
+        (pObj = pView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj())->IsClosedObj() &&
+        !pObj->ISA( SdrOle2Obj );
 
-	if( bRet )
-	{
-		SfxItemSet aSet(GetAttrPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
+    if( bRet && pObj )
+    {
+        // #123922# added code to handle the two cases of SdrGrafObj and a fillable, non-
+        // OLE object in focus
+        SdrObject* pResult = pObj;
 
-        aSet.Put(XFillStyleItem(XFILL_BITMAP));
-		aSet.Put(XFillBitmapItem(aEmptyStr, rGrf));
-		pView->SetAttributes(aSet, false);
-	}
-	return bRet;
+        if(dynamic_cast< SdrGrafObj* >(pObj))
+        {
+            SdrGrafObj* pNewGrafObj = (SdrGrafObj*)pObj->Clone();
+
+            pNewGrafObj->SetGraphic(rGrf);
+
+            // #123922#  for handling MasterObject and virtual ones correctly, SW
+            // wants us to call ReplaceObject at the page, but that also
+            // triggers the same assertion (I tried it), so stay at the view method
+            pView->ReplaceObjectAtView(pObj, *pView->GetSdrPageView(), pNewGrafObj);
+
+            // set in all cases - the Clone() will have copied an existing link (!)
+            pNewGrafObj->SetGraphicLink(rURL, String());
+
+            pResult = pNewGrafObj;
+        }
+        else
+        {
+            pView->AddUndo(new SdrUndoAttrObj(*pObj));
+
+            SfxItemSet aSet(pView->GetModel()->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
+
+            aSet.Put(XFillStyleItem(XFILL_BITMAP));
+            aSet.Put(XFillBitmapItem(String(), rGrf));
+            pObj->SetMergedItemSetAndBroadcast(aSet);
+        }
+
+        // we are done; mark the modified/new object
+        pView->MarkObj(pResult, pView->GetSdrPageView());
+    }
+
+    return bRet;
 }

Modified: openoffice/branches/alg_writerframes/main/sw/source/core/frmedt/fefly1.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/frmedt/fefly1.cxx?rev=1579184&r1=1579183&r2=1579184&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/frmedt/fefly1.cxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/frmedt/fefly1.cxx Wed Mar 19 10:14:42 2014
@@ -965,7 +965,7 @@ void SwFEShell::InsertDrawObj( SdrObject
         ::lcl_FindAnchorPos( *this, *GetDoc(), rInsertPosition, *pFrm, rFlyAttrSet );
     }
     // insert drawing object into the document creating a new <SwDrawFrmFmt> instance
-    SwDrawFrmFmt* pFmt = GetDoc()->Insert( aPam, rDrawObj, &rFlyAttrSet, 0 );
+    SwDrawFrmFmt* pFmt = GetDoc()->InsertDrawObj( aPam, rDrawObj, rFlyAttrSet );
 
     // move object to visible layer
     SwContact* pContact = static_cast<SwContact*>(rDrawObj.GetUserCall());