You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2012/08/20 13:46:47 UTC

svn commit: r1374979 [27/29] - in /incubator/ooo/branches/writer001: ./ ext_libraries/apr-util/ ext_libraries/apr-util/prj/ ext_libraries/apr/ ext_libraries/coinmp/ ext_libraries/hunspell/ ext_libraries/serf/ ext_libraries/serf/prj/ ext_sources/ extras...

Modified: incubator/ooo/branches/writer001/main/svx/source/sdr/overlay/overlaytools.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/sdr/overlay/overlaytools.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/sdr/overlay/overlaytools.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/sdr/overlay/overlaytools.cxx Mon Aug 20 11:46:19 2012
@@ -236,6 +236,7 @@ namespace drawinglayer
 					getDiscreteHatchDistance() * getDiscreteUnit(),
 					getHatchRotation() - getRotation(),
 					getHatchColor(),
+                    3, // same default as VCL, a minimum of three discrete units (pixels) offset
 					false);
                 const Primitive2DReference aPrimitive(
                     new PolyPolygonHatchPrimitive2D(

Modified: incubator/ooo/branches/writer001/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx Mon Aug 20 11:46:19 2012
@@ -458,6 +458,7 @@ namespace drawinglayer
 								(double)rHatch.GetDistance(),
 								(double)rHatch.GetAngle() * F_PI1800,
 								aColorB.getBColor(),
+                                3, // same default as VCL, a minimum of three discrete units (pixels) offset
 								((const XFillBackgroundItem&)(rSet.Get(XATTR_FILLBACKGROUND))).GetValue());
 							
 							break;

Modified: incubator/ooo/branches/writer001/main/svx/source/svdraw/svddrgmt.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/svdraw/svddrgmt.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/svdraw/svddrgmt.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/svdraw/svddrgmt.cxx Mon Aug 20 11:46:19 2012
@@ -184,7 +184,7 @@ void SdrDragEntrySdrObject::prepareCurre
 	}
 }
 
-drawinglayer::primitive2d::Primitive2DSequence SdrDragEntrySdrObject::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod)
+drawinglayer::primitive2d::Primitive2DSequence SdrDragEntrySdrObject::createPrimitive2DSequenceInCurrentState(SdrDragMethod& /* rDragMethod */)
 {
 	const SdrObject* pSource = &maOriginal;
 

Modified: incubator/ooo/branches/writer001/main/svx/source/svdraw/svdedxv.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/svdraw/svdedxv.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/svdraw/svdedxv.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/svdraw/svdedxv.cxx Mon Aug 20 11:46:19 2012
@@ -73,6 +73,7 @@
 #include <svtools/colorcfg.hxx>
 #include <vcl/svapp.hxx> //add CHINA001 
 #include <svx/sdrpaintwindow.hxx>
+#include <svx/sdrundomanager.hxx>
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -97,7 +98,8 @@ void SdrObjEditView::ImpClearVars()
 }
 
 SdrObjEditView::SdrObjEditView(SdrModel* pModel1, OutputDevice* pOut):
-    SdrGlueEditView(pModel1,pOut)
+    SdrGlueEditView(pModel1,pOut),
+    mpOldTextEditUndoManager(0)
 {
     ImpClearVars();
 }
@@ -109,6 +111,11 @@ SdrObjEditView::~SdrObjEditView()
     if (pTextEditOutliner!=NULL) {
         delete pTextEditOutliner;
     }
+
+    if(mpOldTextEditUndoManager)
+    {
+        delete mpOldTextEditUndoManager;
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -537,6 +544,18 @@ IMPL_LINK(SdrObjEditView,ImpOutlinerCalc
     return 0;
 }
 
+IMPL_LINK(SdrObjEditView, EndTextEditHdl, SdrUndoManager*, /*pUndoManager*/)
+{
+    SdrEndTextEdit();
+    return 0;
+}
+
+SdrUndoManager* SdrObjEditView::getSdrUndoManagerForEnhancedTextEdit() const
+{
+    // default returns registered UndoManager
+    return GetModel() ? dynamic_cast< SdrUndoManager* >(GetModel()->GetSdrUndoManager()) : 0;
+}
+
 sal_Bool SdrObjEditView::SdrBeginTextEdit(
 	SdrObject* pObj, SdrPageView* pPV, Window* pWin, 
 	sal_Bool bIsNewObj,	SdrOutliner* pGivenOutliner, 
@@ -765,6 +784,32 @@ sal_Bool SdrObjEditView::SdrBeginTextEdi
 			if( mxSelectionController.is() )
 				mxSelectionController->onSelectionHasChanged();
 
+            if(IsUndoEnabled())
+            {
+                SdrUndoManager* pSdrUndoManager = getSdrUndoManagerForEnhancedTextEdit();
+            
+                if(pSdrUndoManager)
+                {
+                    // we have an outliner, undo manager and it's an EditUndoManager, exchange
+                    // the document undo manager and the default one from the outliner and tell 
+                    // it that text edit starts by setting a callback if it needs to end text edit mode.
+                    if(mpOldTextEditUndoManager)
+                    {
+                        // should not happen, delete it since it was probably forgotten somewhere
+                        OSL_ENSURE(false, "Deleting forgotten old TextEditUndoManager, should be checked (!)");
+                        delete mpOldTextEditUndoManager;
+                        mpOldTextEditUndoManager = 0;
+                    }
+
+                    mpOldTextEditUndoManager = pTextEditOutliner->SetUndoManager(pSdrUndoManager);
+                    pSdrUndoManager->SetEndTextEditHdl(LINK(this, SdrObjEditView, EndTextEditHdl));
+                }
+                else
+                {
+                    OSL_ENSURE(false, "The document undo manager is not derived from SdrUndoManager (!)");
+                }
+            }
+            
             return sal_True; // Gut gelaufen, TextEdit laeuft nun
         } 
 		else 
@@ -822,6 +867,51 @@ SdrEndTextEditKind SdrObjEditView::SdrEn
     SdrOutliner*  pTEOutliner    =pTextEditOutliner;
     OutlinerView* pTEOutlinerView=pTextEditOutlinerView;
     Cursor*       pTECursorMerker=pTextEditCursorMerker;
+    SdrUndoManager* pUndoEditUndoManager = 0;
+    bool bNeedToUndoSavedRedoTextEdit(false);
+
+    if(IsUndoEnabled() && GetModel() && pTEObj && pTEOutliner)
+    {
+        // change back the UndoManager to the remembered original one
+        ::svl::IUndoManager* pOriginal = pTEOutliner->SetUndoManager(mpOldTextEditUndoManager);
+        mpOldTextEditUndoManager = 0;
+
+        if(pOriginal)
+        {
+            // check if we got back our document undo manager
+            SdrUndoManager* pSdrUndoManager = getSdrUndoManagerForEnhancedTextEdit();
+
+            if(pSdrUndoManager && dynamic_cast< SdrUndoManager* >(pOriginal) == pSdrUndoManager)
+            {
+                if(pSdrUndoManager->isEndTextEditTriggeredFromUndo())
+                {
+                    // remember the UndoManager where missing Undos have to be triggered after end
+                    // text edit. When the undo had triggered the end text edit, the original action
+                    // which had to be undone originally is not yet undone.
+                    pUndoEditUndoManager = pSdrUndoManager;
+
+                    // We are ending text edit; if text edit was triggered from undo, execute all redos 
+                    // to create a complete text change undo action for the redo buffer. Also mark this 
+                    // state when at least one redo was executed; the created extra TextChange needs to 
+                    // be undone in addition to the first real undo outside the text edit changes
+                    while(pSdrUndoManager->GetRedoActionCount())
+                    {
+                        bNeedToUndoSavedRedoTextEdit = true;
+                        pSdrUndoManager->Redo();
+                    }
+                }
+
+                // reset the callback link and let the undo manager cleanup all text edit
+                // undo actions to get the stack back to the form before the text edit
+                pSdrUndoManager->SetEndTextEditHdl(Link());
+            }
+            else
+            {
+                OSL_ENSURE(false, "´Got UndoManager back in SdrEndTextEdit which is NOT the expected document UndoManager (!)");
+                delete pOriginal;
+            }
+        }
+    }
 
     // send HINT_ENDEDIT #99840#
     if( GetModel() && mxTextEditObj.is() )
@@ -1031,7 +1121,22 @@ SdrEndTextEditKind SdrObjEditView::SdrEn
 		((SfxBroadcaster*)pTEObj->GetBroadcaster())->Broadcast(aHint);
 	}
 
-	return eRet;
+    if(pUndoEditUndoManager)
+    {
+        if(bNeedToUndoSavedRedoTextEdit)
+        {
+            // undo the text edit action since it was created as part of an EndTextEdit
+            // callback from undo itself. This needs to be done after the call to
+            // FmFormView::SdrEndTextEdit since it gets created there
+            pUndoEditUndoManager->Undo();
+        }
+        
+        // trigger the Undo which was not executed, but lead to this
+        // end text edit
+        pUndoEditUndoManager->Undo();
+    }
+
+    return eRet;
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////

Modified: incubator/ooo/branches/writer001/main/svx/source/svdraw/svdmodel.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/svdraw/svdmodel.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/svdraw/svdmodel.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/svdraw/svdmodel.cxx Mon Aug 20 11:46:19 2012
@@ -1899,13 +1899,15 @@ void SdrModel::setLock( sal_Bool bLock )
 {
 	if( mbModelLocked != bLock )
 	{
-		if( sal_False == bLock )
+        // #120437# need to set first, else ImpReformatAllEdgeObjects will do nothing
+		mbModelLocked = bLock;
+
+        if( sal_False == bLock )
 		{
 			// ReformatAllTextObjects(); #103122# due to a typo in the above if, this code was never
 			//							 executed, so I remove it until we discover that we need it here
 			ImpReformatAllEdgeObjects();	// #103122#
 		}
-		mbModelLocked = bLock;
 	}
 }
 

Modified: incubator/ooo/branches/writer001/main/svx/source/svdraw/svdoedge.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/svdraw/svdoedge.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/svdraw/svdoedge.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/svdraw/svdoedge.cxx Mon Aug 20 11:46:19 2012
@@ -471,7 +471,11 @@ void SdrEdgeObj::ConnectToNode(FASTBOOL 
 	if (pObj!=NULL) {
 		pObj->AddListener(*this);
 		rCon.pObj=pObj;
-		ImpDirtyEdgeTrack();
+
+        // #120437# If connection is set, reset bEdgeTrackUserDefined
+	    bEdgeTrackUserDefined = false;
+
+        ImpDirtyEdgeTrack();
 	}
 }
 
@@ -548,8 +552,11 @@ void SdrEdgeObj::ImpUndirtyEdgeTrack()
 
 void SdrEdgeObj::ImpRecalcEdgeTrack()
 {
-	if ( bEdgeTrackUserDefined && (GetModel() && GetModel()->isLocked()) )
+    // #120437# if bEdgeTrackUserDefined, do not recalculate. Also not when model locked
+	if(bEdgeTrackUserDefined || !GetModel() || GetModel()->isLocked())
+    {
 		return;
+    }
 
 	// #110649#
 	if(IsBoundRectCalculationRunning())
@@ -564,17 +571,17 @@ void SdrEdgeObj::ImpRecalcEdgeTrack()
 	{
 		// avoid re-layout during imports/API call sequences
 		// #i45294# but calc EdgeTrack and secure properties there
-		((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_True;
+		mbBoundRectCalculationRunning = sal_True;
 		*pEdgeTrack=ImpCalcEdgeTrack(*pEdgeTrack,aCon1,aCon2,&aEdgeInfo);
 		ImpSetAttrToEdgeInfo();
 		bEdgeTrackDirty=sal_False;
-		((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_False;
+		mbBoundRectCalculationRunning = sal_False;
 	}
 	else
 	{
 		// To not run in a depth loop, use a coloring algorythm on
 		// SdrEdgeObj BoundRect calculations
-		((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_True;
+		mbBoundRectCalculationRunning = sal_True;
 
 		Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetCurrentBoundRect();
 		SetRectsDirty();
@@ -590,7 +597,7 @@ void SdrEdgeObj::ImpRecalcEdgeTrack()
 		SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
 
 		// #110649#
-		((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_False;
+		mbBoundRectCalculationRunning = sal_False;
 	}
 }
 
@@ -2263,63 +2270,93 @@ void SdrEdgeObj::NbcResize(const Point& 
 // #54102# added rotation support
 void SdrEdgeObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
 {
-    // handle start and end point if not connected
-	FASTBOOL bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage;
-	FASTBOOL bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage;
-
-    if(!bCon1 && pEdgeTrack)
+    if(bEdgeTrackUserDefined)
     {
-        RotatePoint((*pEdgeTrack)[0],rRef,sn,cs);
-        ImpDirtyEdgeTrack();
+        // #120437# special handling when track is imported, apply
+        // transformation directly to imported track.
+        SdrTextObj::NbcRotate(rRef, nWink, sn, cs);
+        RotateXPoly(*pEdgeTrack, rRef, sn, cs);
     }
-
-    if(!bCon2 && pEdgeTrack)
+    else
     {
-    	sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount();
-        RotatePoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef,sn,cs);
-        ImpDirtyEdgeTrack();
+        // handle start and end point if not connected
+	    FASTBOOL bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage;
+	    FASTBOOL bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage;
+
+        if(!bCon1 && pEdgeTrack)
+        {
+            RotatePoint((*pEdgeTrack)[0],rRef,sn,cs);
+            ImpDirtyEdgeTrack();
+        }
+
+        if(!bCon2 && pEdgeTrack)
+        {
+    	    sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount();
+            RotatePoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef,sn,cs);
+            ImpDirtyEdgeTrack();
+        }
     }
 }
 
 // #54102# added mirror support
 void SdrEdgeObj::NbcMirror(const Point& rRef1, const Point& rRef2)
 {
-    // handle start and end point if not connected
-	FASTBOOL bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage;
-	FASTBOOL bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage;
-
-    if(!bCon1 && pEdgeTrack)
+    if(bEdgeTrackUserDefined)
     {
-    	MirrorPoint((*pEdgeTrack)[0],rRef1,rRef2);
-        ImpDirtyEdgeTrack();
+        // #120437# special handling when track is imported, apply
+        // transformation directly to imported track.
+        SdrTextObj::NbcMirror(rRef1, rRef2);
+        MirrorXPoly(*pEdgeTrack, rRef1, rRef2);
     }
-
-    if(!bCon2 && pEdgeTrack)
+    else
     {
-    	sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount();
-    	MirrorPoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef1,rRef2);
-        ImpDirtyEdgeTrack();
+        // handle start and end point if not connected
+	    FASTBOOL bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage;
+	    FASTBOOL bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage;
+
+        if(!bCon1 && pEdgeTrack)
+        {
+    	    MirrorPoint((*pEdgeTrack)[0],rRef1,rRef2);
+            ImpDirtyEdgeTrack();
+        }
+
+        if(!bCon2 && pEdgeTrack)
+        {
+    	    sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount();
+    	    MirrorPoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef1,rRef2);
+            ImpDirtyEdgeTrack();
+        }
     }
 }
 
 // #54102# added shear support
 void SdrEdgeObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
 {
-    // handle start and end point if not connected
-	FASTBOOL bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage;
-	FASTBOOL bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage;
-
-    if(!bCon1 && pEdgeTrack)
+    if(bEdgeTrackUserDefined)
     {
-    	ShearPoint((*pEdgeTrack)[0],rRef,tn,bVShear);
-        ImpDirtyEdgeTrack();
+        // #120437# special handling when track is imported, apply
+        // transformation directly to imported track.
+        SdrTextObj::NbcShear(rRef, nWink, tn, bVShear);
+        ShearXPoly(*pEdgeTrack, rRef, tn, bVShear);
     }
-
-    if(!bCon2 && pEdgeTrack)
+    else
     {
-    	sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount();
-    	ShearPoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef,tn,bVShear);
-        ImpDirtyEdgeTrack();
+        // handle start and end point if not connected
+	    FASTBOOL bCon1=aCon1.pObj!=NULL && aCon1.pObj->GetPage()==pPage;
+	    FASTBOOL bCon2=aCon2.pObj!=NULL && aCon2.pObj->GetPage()==pPage;
+
+        if(!bCon1 && pEdgeTrack)
+        {
+    	    ShearPoint((*pEdgeTrack)[0],rRef,tn,bVShear);
+            ImpDirtyEdgeTrack();
+        }
+
+        if(!bCon2 && pEdgeTrack)
+        {
+    	    sal_uInt16 nPntAnz = pEdgeTrack->GetPointCount();
+    	    ShearPoint((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],rRef,tn,bVShear);
+            ImpDirtyEdgeTrack();
+        }
     }
 }
 

Modified: incubator/ooo/branches/writer001/main/svx/source/svdraw/svdopath.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/svdraw/svdopath.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/svdraw/svdopath.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/svdraw/svdopath.cxx Mon Aug 20 11:46:19 2012
@@ -1799,6 +1799,10 @@ void SdrPathObj::ImpForceKind()
 		{
 			aRect = ImpGetBoundRect(GetPathPoly());
 		}
+
+        // #116244# reset rotation
+		aGeo.nDrehWink = aGeo.nShearWink = 0;
+		aGeo.RecalcSinCos(); aGeo.RecalcTan();
 	}
 
 	// #i75974# adapt polygon state to object type. This may include a reinterpretation

Modified: incubator/ooo/branches/writer001/main/svx/source/svdraw/svdpage.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/svdraw/svdpage.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/svdraw/svdpage.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/svdraw/svdpage.cxx Mon Aug 20 11:46:19 2012
@@ -727,14 +727,17 @@ void SdrObjList::ReformatAllTextObjects(
 */
 void SdrObjList::ReformatAllEdgeObjects()
 {
-	const sal_uInt32 nCount=GetObjCount();
-	sal_uInt32 nObj;
+    // #120437# go over whole hierarchy, not only over object level null (seen from grouping)
+	SdrObjListIter aIter(*this, IM_DEEPNOGROUPS);
 
-	for( nObj = 0; nObj < nCount; nObj++ )
+    while(aIter.IsMore())
 	{
-		SdrObject* pObj = GetObj(nObj);
-		if( pObj->ISA(SdrEdgeObj) )
-			static_cast<SdrEdgeObj*>(pObj)->Reformat();
+		SdrEdgeObj* pSdrEdgeObj = dynamic_cast< SdrEdgeObj* >(aIter.Next());
+		
+        if(pSdrEdgeObj)
+        {
+			pSdrEdgeObj->Reformat();
+        }
 	}
 }
 
@@ -1815,7 +1818,9 @@ void SdrPage::SetInserted( bool bIns )
 	{
 		mbInserted = bIns;
 
-		SdrObjListIter aIter( *this, IM_FLAT );
+        // #120437# go over whole hierarchy, not only over object level null (seen from grouping)
+		SdrObjListIter aIter(*this, IM_DEEPNOGROUPS);
+
  		while ( aIter.IsMore() )
 		{
 			SdrObject* pObj = aIter.Next();

Modified: incubator/ooo/branches/writer001/main/sw/inc/doc.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/inc/doc.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/inc/doc.hxx (original)
+++ incubator/ooo/branches/writer001/main/sw/inc/doc.hxx Mon Aug 20 11:46:19 2012
@@ -89,6 +89,7 @@ class SwList;
 
 #include <boost/scoped_ptr.hpp>
 #include <boost/shared_ptr.hpp>
+#include <flypos.hxx>
 
 class SvxForbiddenCharactersTable;
 class SwExtTextInput;
@@ -153,7 +154,6 @@ class SwNodes;
 class SwNumRule;
 class SwNumRuleTbl;
 class SwPageDesc;
-class SwPosFlyFrms;
 class SwPagePreViewPrtData;
 class SwRedline;
 class SwRedlineTbl;
@@ -1056,8 +1056,7 @@ public:
 	// FlyFrames von der ::com::sun::star::awt::Selection vollstaendig umschlossen sein
 	// ( Start < Pos < End ) !!!
 	// (wird fuer die Writer benoetigt)
-	void GetAllFlyFmts( SwPosFlyFrms& rPosFlyFmts, const SwPaM* = 0,
-						sal_Bool bDrawAlso = sal_False ) const;
+	SwPosFlyFrms GetAllFlyFmts( const SwPaM* = 0, sal_Bool bDrawAlso = sal_False ) const;
 
     // wegen swrtf.cxx und define private public, jetzt hier
 	SwFlyFrmFmt  *MakeFlyFrmFmt (const String &rFmtName, SwFrmFmt *pDerivedFrom);

Modified: incubator/ooo/branches/writer001/main/sw/inc/docstyle.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/inc/docstyle.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/inc/docstyle.hxx (original)
+++ incubator/ooo/branches/writer001/main/sw/inc/docstyle.hxx Mon Aug 20 11:46:19 2012
@@ -219,8 +219,7 @@ public:
 	void	SetOrganizerMode( sal_Bool bMode )	{ bOrganizer = bMode; }
 	sal_Bool 	IsOrganizerMode() const 		{ return bOrganizer; }
 
-	virtual SfxStyleSheetIterator* CreateIterator( SfxStyleFamily,
-													sal_uInt16 nMask );
+	virtual SfxStyleSheetIteratorPtr CreateIterator( SfxStyleFamily, sal_uInt16 nMask );
 
 	SwDoc& GetDoc() const { return rDoc; }
 

Modified: incubator/ooo/branches/writer001/main/sw/inc/flypos.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/inc/flypos.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/inc/flypos.hxx (original)
+++ incubator/ooo/branches/writer001/main/sw/inc/flypos.hxx Mon Aug 20 11:46:19 2012
@@ -23,9 +23,9 @@
 #ifndef _FLYPOS_HXX
 #define _FLYPOS_HXX
 
-
-#include <svl/svarray.hxx>
 #include <swdllapi.h>
+#include <boost/shared_ptr.hpp>
+#include <set>
 
 class SwFrmFmt;
 class SwNodeIndex;
@@ -34,23 +34,24 @@ class SwNodeIndex;
 class SW_DLLPUBLIC SwPosFlyFrm
 {
 	const SwFrmFmt* pFrmFmt;	// das FlyFrmFmt
-//	SwPosition* pPos;			// Position in den ContentNode
 	SwNodeIndex* pNdIdx;		// es reicht ein Index auf den Node
 	sal_uInt32 nOrdNum;
 public:
 	SwPosFlyFrm( const SwNodeIndex& , const SwFrmFmt*, sal_uInt16 nArrPos );
 	virtual ~SwPosFlyFrm(); // virtual fuer die Writer (DLL !!)
 
-	// operatoren fuer das Sort-Array
-	sal_Bool operator==( const SwPosFlyFrm& );
-	sal_Bool operator<( const SwPosFlyFrm& );
-
 	const SwFrmFmt& GetFmt() const { return *pFrmFmt; }
 	const SwNodeIndex& GetNdIndex() const { return *pNdIdx; }
 	sal_uInt32 GetOrdNum() const { return nOrdNum; }
 };
 
-typedef SwPosFlyFrm* SwPosFlyFrmPtr;
-SV_DECL_PTRARR_SORT_VISIBILITY( SwPosFlyFrms, SwPosFlyFrmPtr, 0, 40, SW_DLLPUBLIC )
+// define needed classes to safely handle an array of allocated SwPosFlyFrm(s).
+// SwPosFlyFrms can be handled by value (as return value), only refcounts to
+// contained SwPosFlyFrm* will be copied. When releasing the last SwPosFlyFrmPtr
+// instance the allocated instance will be freed. The array is sorted by
+// GetNdIndex by using a ::std::set container.
+typedef ::boost::shared_ptr< SwPosFlyFrm > SwPosFlyFrmPtr;
+struct SwPosFlyFrmCmp { bool operator()(const SwPosFlyFrmPtr& rA, const SwPosFlyFrmPtr& rB) const; };
+typedef ::std::set< SwPosFlyFrmPtr, SwPosFlyFrmCmp > SwPosFlyFrms;
 
 #endif // _FLYPOS_HXX

Modified: incubator/ooo/branches/writer001/main/sw/inc/viewopt.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/inc/viewopt.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/inc/viewopt.hxx (original)
+++ incubator/ooo/branches/writer001/main/sw/inc/viewopt.hxx Mon Aug 20 11:46:19 2012
@@ -89,7 +89,7 @@ namespace svtools{ class ColorConfig;}
 #define VIEWOPT_2_MODIFIED		    0x00010000L
 #define VIEWOPT_2_KEEPASPECTRATIO   0x00020000L
 #define VIEWOPT_2_GRFKEEPZOOM	    0x00040000L
-#define VIEWOPT_2_PREVENT_TIPS      0x00100000L
+#define VIEWOPT_2_CONTENT_TIPS      0x00100000L
 #define VIEWOPT_2_RESERVED3         0x00200000L
 #define VIEWOPT_2_RESERVED4         0x00400000L
 #define VIEWOPT_2_PRTFORMAT         0x00800000L
@@ -470,8 +470,8 @@ public:
 		{ return nUIOptions & VIEWOPT_2_KEEPASPECTRATIO ? sal_True : sal_False;	  }
 	sal_Bool 	IsGrfKeepZoom()	   const
 		{ return nUIOptions & VIEWOPT_2_GRFKEEPZOOM ? sal_True : sal_False;	  }
-    sal_Bool    IsPreventTips() const
-        { return nUIOptions & VIEWOPT_2_PREVENT_TIPS ? sal_True : sal_False; }
+    sal_Bool    IsShowContentTips() const
+        { return nUIOptions & VIEWOPT_2_CONTENT_TIPS ? sal_True : sal_False; }
 	sal_Bool 	IsPrtFormat() const
 		{ return nUIOptions & VIEWOPT_2_PRTFORMAT ? sal_True : sal_False; }
 
@@ -487,8 +487,8 @@ public:
 		{ b ? (nUIOptions |= VIEWOPT_2_KEEPASPECTRATIO ) : ( nUIOptions &= ~VIEWOPT_2_KEEPASPECTRATIO); }
 	void   SetGrfKeepZoom	(sal_Bool b)
 		{ b ? (nUIOptions |= VIEWOPT_2_GRFKEEPZOOM ) : ( nUIOptions &= ~VIEWOPT_2_GRFKEEPZOOM); }
-    void SetPreventTips( sal_Bool b)
-        { b ? (nUIOptions |= VIEWOPT_2_PREVENT_TIPS) : (nUIOptions &= ~VIEWOPT_2_PREVENT_TIPS); }
+    void SetShowContentTips( sal_Bool b)
+        { b ? (nUIOptions |= VIEWOPT_2_CONTENT_TIPS) : (nUIOptions &= ~VIEWOPT_2_CONTENT_TIPS); }
     void SetPrtFormat( sal_Bool b)
         { b ? (nUIOptions |= VIEWOPT_2_PRTFORMAT) : (nUIOptions &= ~VIEWOPT_2_PRTFORMAT); }
 

Modified: incubator/ooo/branches/writer001/main/sw/source/core/doc/doclay.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/doc/doclay.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/doc/doclay.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/doc/doclay.cxx Mon Aug 20 11:46:19 2012
@@ -1084,10 +1084,9 @@ sal_Bool TstFlyRange( const SwPaM* pPam,
 }
 
 
-void SwDoc::GetAllFlyFmts( SwPosFlyFrms& rPosFlyFmts,
-						   const SwPaM* pCmpRange, sal_Bool bDrawAlso ) const
+SwPosFlyFrms SwDoc::GetAllFlyFmts( const SwPaM* pCmpRange, sal_Bool bDrawAlso ) const
 {
-	SwPosFlyFrm *pFPos = 0;
+    SwPosFlyFrms aRetval;
 	SwFrmFmt *pFly;
 
 	// erstmal alle Absatzgebundenen einsammeln
@@ -1108,8 +1107,7 @@ void SwDoc::GetAllFlyFmts( SwPosFlyFrms&
 				if( pCmpRange &&
 					!TstFlyRange( pCmpRange, pAPos, rAnchor.GetAnchorId() ))
 						continue;		// kein gueltiger FlyFrame
-				pFPos = new SwPosFlyFrm( pAPos->nNode, pFly, rPosFlyFmts.Count() );
-				rPosFlyFmts.Insert( pFPos );
+                aRetval.insert(SwPosFlyFrmPtr(new SwPosFlyFrm(pAPos->nNode, pFly, aRetval.size())));
 			}
 		}
 	}
@@ -1117,9 +1115,10 @@ void SwDoc::GetAllFlyFmts( SwPosFlyFrms&
 	// kein Layout oder nur ein Teil, dann wars das
 	// Seitenbezogen Flys nur, wenn vollstaendig "gewuenscht" wird !
 	if( !GetCurrentViewShell() || pCmpRange )	//swmod 071108//swmod 071225
-		return;
+    {
+		return aRetval;
+    }
 
-	pFPos = 0;
 	SwPageFrm *pPage = (SwPageFrm*)GetCurrentLayout()->GetLower();	//swmod 080218
 	while( pPage )
 	{
@@ -1157,18 +1156,15 @@ void SwDoc::GetAllFlyFmts( SwPosFlyFrms&
 					if ( pCntntFrm )
 					{
 						SwNodeIndex aIdx( *pCntntFrm->GetNode() );
-						pFPos = new SwPosFlyFrm( aIdx, pFly, rPosFlyFmts.Count() );
+                        aRetval.insert(SwPosFlyFrmPtr(new SwPosFlyFrm(aIdx, pFly, aRetval.size())));
 					}
 				}
-				if ( pFPos )
-				{
-					rPosFlyFmts.Insert( pFPos );
-					pFPos = 0;
-				}
 			}
 		}
 		pPage = (SwPageFrm*)pPage->GetNext();
 	}
+
+    return aRetval;
 }
 
 /*************************************************************************

Modified: incubator/ooo/branches/writer001/main/sw/source/core/doc/docnum.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/doc/docnum.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/doc/docnum.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/doc/docnum.cxx Mon Aug 20 11:46:19 2012
@@ -60,6 +60,9 @@
 
 #include <map>
 
+#include <stdlib.h>
+
+
 inline sal_uInt8 GetUpperLvlChg( sal_uInt8 nCurLvl, sal_uInt8 nLevel, sal_uInt16 nMask )
 {
 	if( 1 < nLevel )
@@ -2466,6 +2469,11 @@ SwNumRule* SwDoc::FindNumRulePtr( const 
 // #i36749#
 void SwDoc::AddNumRule(SwNumRule * pRule)
 {
+    if ((SAL_MAX_UINT16 - 1) <= pNumRuleTbl->Count())
+    {
+        OSL_ENSURE(false, "SwDoc::AddNumRule: table full.");
+        abort(); // this should never happen on real documents
+    }
     pNumRuleTbl->Insert(pRule, pNumRuleTbl->Count());
     maNumRuleMap[pRule->GetName()] = pRule;
     pRule->SetNumRuleMap(&maNumRuleMap);

Modified: incubator/ooo/branches/writer001/main/sw/source/core/doc/number.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/doc/number.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/doc/number.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/doc/number.cxx Mon Aug 20 11:46:19 2012
@@ -1292,9 +1292,9 @@ namespace numfunc
             }
             inline sal_Unicode GetChar( sal_uInt8 p_nListLevel ) const
             {
-                if ( p_nListLevel > MAXLEVEL )
+                if (p_nListLevel >= MAXLEVEL)
                 {
-                    p_nListLevel = MAXLEVEL;
+                    p_nListLevel = MAXLEVEL - 1;
                 }
 
                 return mnLevelChars[p_nListLevel];

Modified: incubator/ooo/branches/writer001/main/sw/source/core/draw/dview.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/draw/dview.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/draw/dview.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/draw/dview.cxx Mon Aug 20 11:46:19 2012
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
@@ -29,6 +27,9 @@
 #include <svx/svdpagv.hxx>
 #include <svx/fmmodel.hxx>
 #include <sot/exchange.hxx>
+#include <svx/sdrundomanager.hxx>
+#include <editeng/outliner.hxx>
+#include <com/sun/star/embed/EmbedMisc.hpp>
 
 #include "swtypes.hxx"
 #include "pagefrm.hxx"
@@ -49,26 +50,13 @@
 #include <fmtanchr.hxx>
 #include "shellres.hxx"
 #include <IDocumentUndoRedo.hxx>
-
-// #i7672#
-#include <editeng/outliner.hxx>
-
-#include <com/sun/star/embed/EmbedMisc.hpp>
-
-// OD 18.06.2003 #108784#
-//#ifndef _SVDVMARK_HXX //autogen
-//#include <svx/svdvmark.hxx>
-//#endif
 #include <vector>
-// --> OD 2004-06-24 #i28701#
 #include <sortedobjs.hxx>
 #include <flyfrms.hxx>
-// <--
-
+#include <UndoManager.hxx>
 
 using namespace com::sun::star;
 
-
 class SwSdrHdl : public SdrHdl
 {
 public:
@@ -1109,3 +1097,12 @@ void SwDrawView::DeleteMarked()
 		pTmpRoot->EndAllAction();	//swmod 080218
 }
 
+// support enhanced text edit for draw objects
+SdrUndoManager* SwDrawView::getSdrUndoManagerForEnhancedTextEdit() const
+{
+	SwDoc* pDoc = Imp().GetShell()->GetDoc();
+
+    return pDoc ? dynamic_cast< SdrUndoManager* >(&(pDoc->GetUndoManager())) : 0;
+}
+
+// eof

Modified: incubator/ooo/branches/writer001/main/sw/source/core/inc/UndoManager.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/inc/UndoManager.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/inc/UndoManager.hxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/inc/UndoManager.hxx Mon Aug 20 11:46:19 2012
@@ -25,22 +25,18 @@
 #define SW_UNDO_MANAGER_HXX
 
 #include <IDocumentUndoRedo.hxx>
-
 #include <memory>
-
-#include <svl/undo.hxx>
-
+#include <svx/sdrundomanager.hxx>
 
 class IDocumentDrawModelAccess;
 class IDocumentRedlineAccess;
 class IDocumentState;
 
-
 namespace sw {
 
 class UndoManager
     : public IDocumentUndoRedo
-    , public SfxUndoManager
+    , public SdrUndoManager
 {
 public:
 
@@ -111,7 +107,7 @@ private:
     bool impl_DoUndoRedo(UndoOrRedo_t const undoOrRedo);
 
     // UGLY: should not be called
-    using SfxUndoManager::Repeat;
+    using SdrUndoManager::Repeat;
 };
 
 } // namespace sw

Modified: incubator/ooo/branches/writer001/main/sw/source/core/inc/dview.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/inc/dview.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/inc/dview.hxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/inc/dview.hxx Mon Aug 20 11:46:19 2012
@@ -31,6 +31,7 @@ class SwViewImp;
 class SwFrm;
 class SwFlyFrm;
 class SwAnchoredObject;
+class SdrUndoManager;
 
 class SwDrawView : public FmFormView
 {
@@ -87,6 +88,9 @@ protected:
     using FmFormView::CheckSingleSdrObjectHit;
     virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_uLong nOptions, const SetOfByte* pMVisLay) const;
 
+    // support enhanced text edit for draw objects
+    virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const;
+
 public:
 	SwDrawView( SwViewImp &rI, SdrModel *pMd, OutputDevice* pOutDev=NULL );
 

Modified: incubator/ooo/branches/writer001/main/sw/source/core/layout/fly.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/layout/fly.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/layout/fly.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/layout/fly.cxx Mon Aug 20 11:46:19 2012
@@ -2691,7 +2691,8 @@ SwTwips lcl_CalcAutoWidth( const SwLayou
             nMin = ((SwTxtFrm*)pFrm)->CalcFitToContent();
             const SvxLRSpaceItem &rSpace =
                 ((SwTxtFrm*)pFrm)->GetTxtNode()->GetSwAttrSet().GetLRSpace();
-            nMin += rSpace.GetRight() + rSpace.GetTxtLeft() + rSpace.GetTxtFirstLineOfst();
+            if (!((SwTxtFrm*)pFrm)->IsLocked())
+                nMin += rSpace.GetRight() + rSpace.GetTxtLeft() + rSpace.GetTxtFirstLineOfst();
         }
         else if ( pFrm->IsTabFrm() )
         {

Modified: incubator/ooo/branches/writer001/main/sw/source/core/layout/flypos.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/layout/flypos.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/layout/flypos.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/layout/flypos.cxx Mon Aug 20 11:46:19 2012
@@ -37,7 +37,15 @@
 #include "ndindex.hxx"
 #include "switerator.hxx"
 
-SV_IMPL_OP_PTRARR_SORT( SwPosFlyFrms, SwPosFlyFrmPtr )
+bool SwPosFlyFrmCmp::operator()(const SwPosFlyFrmPtr& rA, const SwPosFlyFrmPtr& rB) const 
+{ 
+    if(rA->GetNdIndex() == rB->GetNdIndex())
+    {
+        return rA->GetOrdNum() < rB->GetOrdNum();
+    }
+
+    return rA->GetNdIndex() < rB->GetNdIndex(); 
+}
 
 SwPosFlyFrm::SwPosFlyFrm( const SwNodeIndex& rIdx, const SwFrmFmt* pFmt,
 							sal_uInt16 nArrPos )
@@ -89,20 +97,4 @@ SwPosFlyFrm::~SwPosFlyFrm()
     }
 }
 
-sal_Bool SwPosFlyFrm::operator==( const SwPosFlyFrm& )
-{
-	return sal_False;	// FlyFrames koennen auf der gleichen Position stehen
-}
-
-sal_Bool SwPosFlyFrm::operator<( const SwPosFlyFrm& rPosFly )
-{
-	if( pNdIdx->GetIndex() == rPosFly.pNdIdx->GetIndex() )
-	{
-		// dann entscheidet die Ordnungsnummer!
-		return nOrdNum < rPosFly.nOrdNum;
-	}
-	return pNdIdx->GetIndex() < rPosFly.pNdIdx->GetIndex();
-}
-
-
-
+// eof

Modified: incubator/ooo/branches/writer001/main/sw/source/core/layout/pagechg.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/layout/pagechg.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/layout/pagechg.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/layout/pagechg.cxx Mon Aug 20 11:46:19 2012
@@ -36,6 +36,7 @@
 #include <fmtfordr.hxx>
 #include <fmtfld.hxx>
 #include <fmtornt.hxx>
+#include <fmtsrnd.hxx>
 #include <ftninfo.hxx>
 #include <tgrditem.hxx>
 #include <viewopt.hxx>
@@ -2079,6 +2080,10 @@ void lcl_MoveAllLowerObjs( SwFrm* pFrm, 
             const Point aNewAnchorPos( ( aCurrAnchorPos + rOffset ) );
             pAnchoredDrawObj->DrawObj()->SetAnchorPos( aNewAnchorPos );
             pAnchoredDrawObj->SetLastObjRect( pAnchoredDrawObj->GetObjRect().SVRect() );
+
+            // clear contour cache if contour wrapping is enabled #i100684#
+            if ( pAnchoredDrawObj->GetFrmFmt().GetSurround().IsContour() )
+                ClrContourCache( pAnchoredDrawObj->GetDrawObj() );
         }
         // --> OD 2009-08-20 #i92511#
         // cache for object rectangle inclusive spaces has to be invalidated.

Modified: incubator/ooo/branches/writer001/main/sw/source/core/layout/tabfrm.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/layout/tabfrm.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/layout/tabfrm.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/layout/tabfrm.cxx Mon Aug 20 11:46:19 2012
@@ -1875,6 +1875,22 @@ SwFrm* lcl_FormatNextCntntForKeep( SwTab
     return pNxt;
 }
 
+namespace {
+    bool AreAllRowsKeepWithNext( const SwRowFrm* pFirstRowFrm )
+    {
+        bool bRet = pFirstRowFrm != 0 &&
+                    pFirstRowFrm->ShouldRowKeepWithNext();
+
+        while ( bRet && pFirstRowFrm->GetNext() != 0 )
+        {
+            pFirstRowFrm = dynamic_cast<const SwRowFrm*>(pFirstRowFrm->GetNext());
+            bRet = pFirstRowFrm != 0 &&
+                   pFirstRowFrm->ShouldRowKeepWithNext();
+        }
+
+        return bRet;
+    }
+}
 void SwTabFrm::MakeAll()
 {
 	if ( IsJoinLocked() || StackHack::IsLocked() || StackHack::Count() > 50 )
@@ -2419,11 +2435,17 @@ void SwTabFrm::MakeAll()
         // 2. If this row wants to keep, we need an additional row
         // 3. The table is allowed to split or we do not have an pIndPrev:
         //
-		SwFrm* pIndPrev = GetIndPrev();
+        SwFrm* pIndPrev = GetIndPrev();
         const SwRowFrm* pFirstNonHeadlineRow = GetFirstNonHeadlineRow();
+        // #120016# if this row wants to keep, allow split in case that all rows want to keep with next, 
+        // the table can not move forward as it is the first one and a split is in general allowed.
+        const bool bAllowSplitOfRow = ( bTableRowKeep && 
+                                        AreAllRowsKeepWithNext( pFirstNonHeadlineRow ) ) &&
+                                      !pIndPrev && 
+                                      !bDontSplit;
 
         if ( pFirstNonHeadlineRow && nUnSplitted > 0 &&
-             ( !bTableRowKeep || pFirstNonHeadlineRow->GetNext() || !pFirstNonHeadlineRow->ShouldRowKeepWithNext() ) &&
+             ( !bTableRowKeep || pFirstNonHeadlineRow->GetNext() || !pFirstNonHeadlineRow->ShouldRowKeepWithNext() || bAllowSplitOfRow ) &&
              ( !bDontSplit || !pIndPrev ) )
         {
             // --> FME 2004-06-03 #i29438#
@@ -2442,7 +2464,7 @@ void SwTabFrm::MakeAll()
 
             // 1. Try: bTryToSplit = true  => Try to split the row.
             // 2. Try: bTryToSplit = false => Split the table between the rows.
-			if ( pFirstNonHeadlineRow->GetNext() || bTryToSplit )
+            if ( pFirstNonHeadlineRow->GetNext() || bTryToSplit )
             {
                 SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
                 if( IsInSct() || GetUpper()->IsInTab() ) // TABLE IN TABLE)
@@ -2515,11 +2537,15 @@ void SwTabFrm::MakeAll()
                     // An existing follow flow line has to be removed.
                     //
                     if ( HasFollowFlowLine() )
-						RemoveFollowFlowLine();
+                    {
+                        RemoveFollowFlowLine();
+                    }
 
-                    const bool bSplitError = !Split( nDeadLine, bTryToSplit, bTableRowKeep );
-					if( !bTryToSplit && !bSplitError && nUnSplitted > 0 )
-						--nUnSplitted;
+                    const bool bSplitError = !Split( nDeadLine, bTryToSplit, ( bTableRowKeep && !bAllowSplitOfRow ) );
+                    if( !bTryToSplit && !bSplitError && nUnSplitted > 0 )
+                    {
+                        --nUnSplitted;
+                    }
 
                     // --> FME 2004-06-09 #i29771# Two tries to split the table:
                     // If an error occured during splitting. We start a second
@@ -2546,12 +2572,12 @@ void SwTabFrm::MakeAll()
                     {
                         lcl_RecalcRow( static_cast<SwRowFrm&>(*Lower()), LONG_MAX );
                         bValidPos = sal_False;
-    					bTryToSplit = false;
+                        bTryToSplit = false;
                         continue;
                     }
                     // <--
 
-  					bTryToSplit = !bSplitError;
+                    bTryToSplit = !bSplitError;
 
                     //Damit es nicht zu Oszillationen kommt, muss der
                     //Follow gleich gueltig gemacht werden.
@@ -2636,11 +2662,13 @@ void SwTabFrm::MakeAll()
         // Set to false again as early as possible.
         bLastRowHasToMoveToFollow = false;
 
-		if( IsInSct() && bMovedFwd && bMakePage && GetUpper()->IsColBodyFrm() &&
-			GetUpper()->GetUpper()->GetUpper()->IsSctFrm() &&
-			( GetUpper()->GetUpper()->GetPrev() || GetIndPrev() ) &&
-			((SwSectionFrm*)GetUpper()->GetUpper()->GetUpper())->MoveAllowed(this) )
-			bMovedFwd = sal_False;
+        if( IsInSct() && bMovedFwd && bMakePage && GetUpper()->IsColBodyFrm() &&
+            GetUpper()->GetUpper()->GetUpper()->IsSctFrm() &&
+            ( GetUpper()->GetUpper()->GetPrev() || GetIndPrev() ) &&
+            ((SwSectionFrm*)GetUpper()->GetUpper()->GetUpper())->MoveAllowed(this) )
+        {
+            bMovedFwd = sal_False;
+        }
 
         // --> FME 2004-06-09 #i29771# Reset bTryToSplit flag on change of upper
         const SwFrm* pOldUpper = GetUpper();

Modified: incubator/ooo/branches/writer001/main/sw/source/core/text/txttab.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/text/txttab.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/text/txttab.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/text/txttab.cxx Mon Aug 20 11:46:19 2012
@@ -82,18 +82,19 @@ sal_uInt16 SwLineInfo::NumberOfTabStops(
  *************************************************************************/
 SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto ) const
 {
-	SwTabPortion *pTabPor = 0;
-	SwTabPortion  *pLastTab = rInf.GetLastTab();
-    if( pLastTab && ( pLastTab->IsTabCntPortion() || pLastTab->IsTabDecimalPortion() ) )
-		if( pLastTab->PostFormat( rInf ) )
-			return 0;
+    {
+        SwTabPortion  *pLastTab = rInf.GetLastTab();
+        if( pLastTab && ( pLastTab->IsTabCntPortion() || pLastTab->IsTabDecimalPortion() ) )
+            if( pLastTab->PostFormat( rInf ) )
+                return 0;
+    }
 
     xub_Unicode cFill = 0;
     xub_Unicode cDec = 0;
-	SvxTabAdjust eAdj;
+    SvxTabAdjust eAdj;
 
-	KSHORT nNewTabPos;
-	{
+    KSHORT nNewTabPos;
+    {
         const bool bRTL = pFrm->IsRightToLeft();
         // #i24363# tab stops relative to indent
         // nTabLeft: The absolute value, the tab stops are relative to: Tabs origin.
@@ -149,7 +150,7 @@ SwTabPortion *SwTxtFormatter::NewTabPort
             nMyRight = aRightTop.Y();
         }
 
-		SwTwips nNextPos;
+        SwTwips nNextPos = 0;
 
         // #i24363# tab stops relative to indent
         // nSearchPos: The current position relative to the tabs origin.
@@ -164,53 +165,54 @@ SwTabPortion *SwTxtFormatter::NewTabPort
         // Note: If there are no user defined tab stops, there is always a
         // default tab stop.
         //
-		const SvxTabStop* pTabStop =
-            aLineInf.GetTabStop( nSearchPos, nMyRight );
-		if( pTabStop )
-		{
-			cFill = ' ' != pTabStop->GetFill() ? pTabStop->GetFill() : 0;
-			cDec = pTabStop->GetDecimal();
-			eAdj = pTabStop->GetAdjustment();
+        const SvxTabStop* pTabStop = aLineInf.GetTabStop( nSearchPos, nMyRight );
+        if ( pTabStop )
+        {
+            cFill = ' ' != pTabStop->GetFill() ? pTabStop->GetFill() : 0;
+            cDec = pTabStop->GetDecimal();
+            eAdj = pTabStop->GetAdjustment();
             nNextPos = pTabStop->GetTabPos();
             if(!bTabsRelativeToIndent && eAdj == SVX_TAB_ADJUST_DEFAULT && nSearchPos < 0)
             {
                 //calculate default tab position of default tabs in negative indent
                 nNextPos = ( nSearchPos / nNextPos ) * nNextPos;
             }
-		}
-		else
-		{
-			KSHORT nDefTabDist = aLineInf.GetDefTabStop();
-			if( KSHRT_MAX == nDefTabDist )
-			{
-				const SvxTabStopItem& rTab =
-					(const SvxTabStopItem &)pFrm->GetAttrSet()->
-					GetPool()->GetDefaultItem( RES_PARATR_TABSTOP );
-				if( rTab.Count() )
-					nDefTabDist = (KSHORT)rTab.GetStart()->GetTabPos();
-				else
-					nDefTabDist = SVX_TAB_DEFDIST;
-				aLineInf.SetDefTabStop( nDefTabDist );
-			}
+        }
+        else
+        {
+            KSHORT nDefTabDist = aLineInf.GetDefTabStop();
+            if( KSHRT_MAX == nDefTabDist )
+            {
+                const SvxTabStopItem& rTab =
+                    (const SvxTabStopItem &)pFrm->GetAttrSet()->
+                    GetPool()->GetDefaultItem( RES_PARATR_TABSTOP );
+                if( rTab.Count() )
+                    nDefTabDist = (KSHORT)rTab.GetStart()->GetTabPos();
+                else
+                    nDefTabDist = SVX_TAB_DEFDIST;
+                aLineInf.SetDefTabStop( nDefTabDist );
+            }
             SwTwips nCount = nSearchPos;
 
-			//Minimum tab stop width is 1
-			if (nDefTabDist <= 0)
-			    nDefTabDist = 1;
-
-			nCount /= nDefTabDist;
-            nNextPos = nCount < 0 || (!nCount && nSearchPos <= 0)? nCount * nDefTabDist :( nCount + 1 ) * nDefTabDist ;
+            // Minimum tab stop width is 1
+            if (nDefTabDist <= 0)
+                nDefTabDist = 1;
+
+            nCount /= nDefTabDist;
+            nNextPos = ( nCount < 0 || ( !nCount && nSearchPos <= 0 ) )
+                       ? ( nCount * nDefTabDist )
+                       : ( ( nCount + 1 ) * nDefTabDist );
             // --> FME 2004-09-21 #117919 Minimum tab stop width is 1 or 51 twips:
             const SwTwips nMinimumTabWidth = pFrm->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT) ? 0 : 50;
             // <--
-            if( (  bRTL && nTabLeft - nNextPos >= nCurrentAbsPos - nMinimumTabWidth ) ||
+            if ( (  bRTL && nTabLeft - nNextPos >= nCurrentAbsPos - nMinimumTabWidth ) ||
                  ( !bRTL && nNextPos + nTabLeft <= nCurrentAbsPos + nMinimumTabWidth  ) )
             {
                 nNextPos += nDefTabDist;
             }
-			cFill = 0;
-			eAdj = SVX_TAB_ADJUST_LEFT;
-		}
+            cFill = 0;
+            eAdj = SVX_TAB_ADJUST_LEFT;
+        }
         
         // --> OD #i115705# - correction and refactoring:
         // overrule determined next tab stop position in order to apply 
@@ -280,10 +282,11 @@ SwTabPortion *SwTxtFormatter::NewTabPort
         // <--        
         
         nNextPos += bRTL ? nLinePos - nTabLeft : nTabLeft - nLinePos;
-		ASSERT( nNextPos >= 0, "GetTabStop: Don't go back!" );
-		nNewTabPos = KSHORT(nNextPos);
-	}
+        ASSERT( nNextPos >= 0, "GetTabStop: Don't go back!" );
+        nNewTabPos = KSHORT(nNextPos);
+    }
 
+    SwTabPortion *pTabPor = 0;
     if ( bAuto )
     {
         if ( SVX_TAB_ADJUST_DECIMAL == eAdj &&
@@ -296,37 +299,32 @@ SwTabPortion *SwTxtFormatter::NewTabPort
     {
         switch( eAdj )
         {
-	        case SVX_TAB_ADJUST_RIGHT :
-   		    {
-    		    pTabPor = new SwTabRightPortion( nNewTabPos, cFill );
-		        break;
-	        }
-	        case SVX_TAB_ADJUST_CENTER :
-	        {
-       			pTabPor = new SwTabCenterPortion( nNewTabPos, cFill );
-		        break;
-	        }
-	        case SVX_TAB_ADJUST_DECIMAL :
-	        {
-       			pTabPor = new SwTabDecimalPortion( nNewTabPos, cDec, cFill );
-		        break;
-	        }
-	        default:
-	        {
-       			ASSERT( SVX_TAB_ADJUST_LEFT == eAdj || SVX_TAB_ADJUST_DEFAULT == eAdj,
-				        "+SwTxtFormatter::NewTabPortion: unknown adjustment" );
-		        pTabPor = new SwTabLeftPortion( nNewTabPos, cFill );
-		        break;
-	        }
+        case SVX_TAB_ADJUST_RIGHT :
+            {
+                pTabPor = new SwTabRightPortion( nNewTabPos, cFill );
+                break;
+            }
+        case SVX_TAB_ADJUST_CENTER :
+            {
+                pTabPor = new SwTabCenterPortion( nNewTabPos, cFill );
+                break;
+            }
+        case SVX_TAB_ADJUST_DECIMAL :
+            {
+                pTabPor = new SwTabDecimalPortion( nNewTabPos, cDec, cFill );
+                break;
+            }
+        default:
+            {
+                ASSERT( SVX_TAB_ADJUST_LEFT == eAdj || SVX_TAB_ADJUST_DEFAULT == eAdj,
+                    "+SwTxtFormatter::NewTabPortion: unknown adjustment" );
+                pTabPor = new SwTabLeftPortion( nNewTabPos, cFill );
+                break;
+            }
         }
     }
 
-	// Vorhandensein von Tabulatoren anzeigen ... ist nicht mehr noetig
-	// pCurr->SetTabulation();
-	// Aus Sicherheitsgruenden lassen wir uns die Daten errechnen
-	// pTabPor->Height( pLast->Height() );
-	// pTabPor->SetAscent( pLast->GetAscent() );
-	return pTabPor;
+    return pTabPor;
 }
 
 /*************************************************************************

Modified: incubator/ooo/branches/writer001/main/sw/source/core/txtnode/txtedt.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/txtnode/txtedt.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/txtnode/txtedt.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/txtnode/txtedt.cxx Mon Aug 20 11:46:19 2012
@@ -1590,7 +1590,8 @@ void SwLinguStatistik::Flush()
 
 #endif
 
-
+namespace sw // #i120045# namespace to avoid XCode template-misoptimization
+{
 struct TransliterationChgData
 {
     xub_StrLen              nStart;
@@ -1598,6 +1599,8 @@ struct TransliterationChgData
     String                  sChanged;
     Sequence< sal_Int32 >   aOffsets;
 };
+}
+using sw::TransliterationChgData;
 
 // change text to Upper/Lower/Hiragana/Katagana/...
 void SwTxtNode::TransliterateText( 

Modified: incubator/ooo/branches/writer001/main/sw/source/core/undo/docundo.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/undo/docundo.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/undo/docundo.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/undo/docundo.cxx Mon Aug 20 11:46:19 2012
@@ -74,7 +74,7 @@ UndoManager::UndoManager(::std::auto_ptr
     OSL_ASSERT(m_pUndoNodes.get());
     // writer expects it to be disabled initially
     // Undo is enabled by SwEditShell constructor
-    SfxUndoManager::EnableUndo(false);
+    SdrUndoManager::EnableUndo(false);
 }
 
 SwNodes const& UndoManager::GetUndoNodes() const
@@ -94,18 +94,28 @@ bool UndoManager::IsUndoNodes(SwNodes co
 
 void UndoManager::DoUndo(bool const bDoUndo)
 {
-    EnableUndo(bDoUndo);
-
-    SdrModel *const pSdrModel = m_rDrawModelAccess.GetDrawModel();
-	if( pSdrModel )
+    if(!isTextEditActive())
     {
-        pSdrModel->EnableUndo(bDoUndo);
+        EnableUndo(bDoUndo);
+
+        SdrModel *const pSdrModel = m_rDrawModelAccess.GetDrawModel();
+	    if( pSdrModel )
+        {
+            pSdrModel->EnableUndo(bDoUndo);
+        }
     }
 }
 
 bool UndoManager::DoesUndo() const
 {
-    return IsUndoEnabled();
+    if(isTextEditActive())
+    {
+        return false;
+    }
+    else
+    {
+        return IsUndoEnabled();
+    }
 }
 
 void UndoManager::DoGroupUndo(bool const bDoUndo)
@@ -164,11 +174,11 @@ void UndoManager::UnLockUndoNoModifiedPo
 
 SwUndo* UndoManager::GetLastUndo()
 {
-    if (!SfxUndoManager::GetUndoActionCount(CurrentLevel))
+    if (!SdrUndoManager::GetUndoActionCount(CurrentLevel))
     {
         return 0;
     }
-    SfxUndoAction *const pAction( SfxUndoManager::GetUndoAction(0) );
+    SfxUndoAction *const pAction( SdrUndoManager::GetUndoAction(0) );
     return dynamic_cast<SwUndo*>(pAction);
 }
 
@@ -179,14 +189,14 @@ void UndoManager::AppendUndo(SwUndo *con
 
 void UndoManager::ClearRedo()
 {
-    return SfxUndoManager::ImplClearRedo_NoLock(TopLevel);
+    return SdrUndoManager::ImplClearRedo_NoLock(TopLevel);
 }
 
 void UndoManager::DelAllUndoObj()
 {
     ::sw::UndoGuard const undoGuard(*this);
 
-    SfxUndoManager::ClearAllLevels();
+    SdrUndoManager::ClearAllLevels();
 
     m_UndoSaveMark = MARK_INVALID;
 }
@@ -215,7 +225,7 @@ UndoManager::StartUndo(SwUndoId const i_
         comment = pRewriter->Apply(comment);
     }
 
-    SfxUndoManager::EnterListAction(comment, comment, eUndoId);
+    SdrUndoManager::EnterListAction(comment, comment, eUndoId);
 
     return eUndoId;
 }
@@ -235,8 +245,8 @@ UndoManager::EndUndo(SwUndoId const i_eU
                 "EndUndo(): no Undo ID, but rewriter given?");
 
     SfxUndoAction *const pLastUndo(
-        (0 == SfxUndoManager::GetUndoActionCount(CurrentLevel))
-            ? 0 : SfxUndoManager::GetUndoAction(0) );
+        (0 == SdrUndoManager::GetUndoActionCount(CurrentLevel))
+            ? 0 : SdrUndoManager::GetUndoAction(0) );
 
     int const nCount = LeaveListAction();
 
@@ -244,7 +254,7 @@ UndoManager::EndUndo(SwUndoId const i_eU
     {
         OSL_ASSERT(pLastUndo);
         OSL_ASSERT(UNDO_START != eUndoId);
-        SfxUndoAction *const pUndoAction(SfxUndoManager::GetUndoAction(0));
+        SfxUndoAction *const pUndoAction(SdrUndoManager::GetUndoAction(0));
         SfxListUndoAction *const pListAction(
             dynamic_cast<SfxListUndoAction*>(pUndoAction));
         OSL_ASSERT(pListAction);
@@ -291,12 +301,12 @@ UndoManager::GetLastUndoInfo(
 {
     // this is actually expected to work on the current level,
     // but that was really not obvious from the previous implementation...
-    if (!SfxUndoManager::GetUndoActionCount(CurrentLevel))
+    if (!SdrUndoManager::GetUndoActionCount(CurrentLevel))
     {
         return false;
     }
 
-    SfxUndoAction *const pAction( SfxUndoManager::GetUndoAction(0) );
+    SfxUndoAction *const pAction( SdrUndoManager::GetUndoAction(0) );
 
     if (o_pStr)
     {
@@ -313,15 +323,15 @@ UndoManager::GetLastUndoInfo(
 
 SwUndoComments_t UndoManager::GetUndoComments() const
 {
-    OSL_ENSURE(!SfxUndoManager::IsInListAction(),
+    OSL_ENSURE(!SdrUndoManager::IsInListAction(),
             "GetUndoComments() called while in list action?");
 
     SwUndoComments_t ret;
-    sal_uInt16 const nUndoCount(SfxUndoManager::GetUndoActionCount(TopLevel));
+    sal_uInt16 const nUndoCount(SdrUndoManager::GetUndoActionCount(TopLevel));
     for (sal_uInt16 n = 0; n < nUndoCount; ++n)
     {
         ::rtl::OUString const comment(
-                SfxUndoManager::GetUndoActionComment(n, TopLevel));
+                SdrUndoManager::GetUndoActionComment(n, TopLevel));
         ret.push_back(comment);
     }
 
@@ -333,14 +343,14 @@ SwUndoComments_t UndoManager::GetUndoCom
 
 bool UndoManager::GetFirstRedoInfo(::rtl::OUString *const o_pStr) const
 {
-    if (!SfxUndoManager::GetRedoActionCount(CurrentLevel))
+    if (!SdrUndoManager::GetRedoActionCount(CurrentLevel))
     {
         return false;
     }
 
     if (o_pStr)
     {
-        *o_pStr = SfxUndoManager::GetRedoActionComment(0, CurrentLevel);
+        *o_pStr = SdrUndoManager::GetRedoActionComment(0, CurrentLevel);
     }
 
     return true;
@@ -349,15 +359,15 @@ bool UndoManager::GetFirstRedoInfo(::rtl
 
 SwUndoComments_t UndoManager::GetRedoComments() const
 {
-    OSL_ENSURE(!SfxUndoManager::IsInListAction(),
+    OSL_ENSURE(!SdrUndoManager::IsInListAction(),
             "GetRedoComments() called while in list action?");
 
     SwUndoComments_t ret;
-    sal_uInt16 const nRedoCount(SfxUndoManager::GetRedoActionCount(TopLevel));
+    sal_uInt16 const nRedoCount(SdrUndoManager::GetRedoActionCount(TopLevel));
     for (sal_uInt16 n = 0; n < nRedoCount; ++n)
     {
         ::rtl::OUString const comment(
-                SfxUndoManager::GetRedoActionComment(n, TopLevel));
+                SdrUndoManager::GetRedoActionComment(n, TopLevel));
         ret.push_back(comment);
     }
 
@@ -383,19 +393,19 @@ SwUndoId UndoManager::GetRepeatInfo(::rt
 
 SwUndo * UndoManager::RemoveLastUndo()
 {
-    if (SfxUndoManager::GetRedoActionCount(CurrentLevel) ||
-        SfxUndoManager::GetRedoActionCount(TopLevel))
+    if (SdrUndoManager::GetRedoActionCount(CurrentLevel) ||
+        SdrUndoManager::GetRedoActionCount(TopLevel))
     {
         OSL_ENSURE(false, "RemoveLastUndoAction(): there are Redo actions?");
         return 0;
     }
-    if (!SfxUndoManager::GetUndoActionCount(CurrentLevel))
+    if (!SdrUndoManager::GetUndoActionCount(CurrentLevel))
     {
         OSL_ENSURE(false, "RemoveLastUndoAction(): no Undo actions");
         return 0;
     }
     SfxUndoAction *const pLastUndo(GetUndoAction(0));
-    SfxUndoManager::RemoveLastUndoAction();
+    SdrUndoManager::RemoveLastUndoAction();
     return dynamic_cast<SwUndo *>(pLastUndo);
 }
 
@@ -403,9 +413,9 @@ SwUndo * UndoManager::RemoveLastUndo()
 
 void UndoManager::EnableUndo(bool bEnable)
 {
-    // SfxUndoManager does not have a counter anymore, but reverted to the old behavior of
+    // SdrUndoManager does not have a counter anymore, but reverted to the old behavior of
     // having a simple boolean flag for locking. So, simply forward.
-    SfxUndoManager::EnableUndo(bEnable);
+    SdrUndoManager::EnableUndo(bEnable);
 }
 
 void UndoManager::AddUndoAction(SfxUndoAction *pAction, sal_Bool bTryMerge)
@@ -418,7 +428,7 @@ void UndoManager::AddUndoAction(SfxUndoA
             pUndo->SetRedlineMode( m_rRedlineAccess.GetRedlineMode() );
         }
     }
-    SfxUndoManager::AddUndoAction(pAction, bTryMerge);
+    SdrUndoManager::AddUndoAction(pAction, bTryMerge);
     // if the undo nodes array is too large, delete some actions
     while (UNDO_ACTION_LIMIT < GetUndoNodes().Count())
     {
@@ -483,17 +493,17 @@ bool UndoManager::impl_DoUndoRedo(UndoOr
     // N.B. these may throw!
     if (UNDO == undoOrRedo)
     {
-        bRet = SfxUndoManager::UndoWithContext(context);
+        bRet = SdrUndoManager::UndoWithContext(context);
     }
     else
     {
-        bRet = SfxUndoManager::RedoWithContext(context);
+        bRet = SdrUndoManager::RedoWithContext(context);
     }
 
     if (bRet)
     {
         // if we are at the "last save" position, the document is not modified
-        if (SfxUndoManager::HasTopUndoActionMark(m_UndoSaveMark))
+        if (SdrUndoManager::HasTopUndoActionMark(m_UndoSaveMark))
         {
             m_rState.ResetModified();
         }
@@ -510,31 +520,43 @@ bool UndoManager::impl_DoUndoRedo(UndoOr
 
 sal_Bool UndoManager::Undo()
 {
-    bool const bRet = impl_DoUndoRedo(UNDO);
-    return bRet;
+    if(isTextEditActive())
+    {
+        return SdrUndoManager::Undo();
+    }
+    else
+    {
+        return impl_DoUndoRedo(UNDO);
+    }
 }
 
 sal_Bool UndoManager::Redo()
 {
-    bool const bRet = impl_DoUndoRedo(REDO);
-    return bRet;
+    if(isTextEditActive())
+    {
+        return SdrUndoManager::Redo();
+    }
+    else
+    {
+        return impl_DoUndoRedo(REDO);
+    }
 }
 
-/** N.B.: this does _not_ call SfxUndoManager::Repeat because it is not
+/** N.B.: this does _not_ call SdrUndoManager::Repeat because it is not
           possible to wrap a list action around it:
-          calling EnterListAction here will cause SfxUndoManager::Repeat
+          calling EnterListAction here will cause SdrUndoManager::Repeat
           to repeat the list action!
  */
 bool
 UndoManager::Repeat(::sw::RepeatContext & rContext,
         sal_uInt16 const nRepeatCount)
 {
-    if (SfxUndoManager::IsInListAction())
+    if (SdrUndoManager::IsInListAction())
     {
         OSL_ENSURE(false, "repeat in open list action???");
         return false;
     }
-    if (!SfxUndoManager::GetUndoActionCount(TopLevel))
+    if (!SdrUndoManager::GetUndoActionCount(TopLevel))
     {
         return false;
     }

Modified: incubator/ooo/branches/writer001/main/sw/source/core/unocore/unoframe.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/unocore/unoframe.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/unocore/unoframe.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/unocore/unoframe.cxx Mon Aug 20 11:46:19 2012
@@ -174,7 +174,7 @@ sal_Bool BaseFrameProperties_Impl::GetPr
 }
 
 //Begin Bug 119922:Graphic in header and footer can not be displayed correctly.
-//Set default value for "Follow text flow" to false if a previous version didn't support "Follow text flow".
+//Set default value for "Follow text flow" to false if a previous version didn't support "Follow text flow".
 sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet,
 													  const SfxItemSet& rFromSet, 
 													  sal_Bool& rSizeFound,

Modified: incubator/ooo/branches/writer001/main/sw/source/core/unocore/unoobj2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/unocore/unoobj2.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/unocore/unoobj2.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/unocore/unoobj2.cxx Mon Aug 20 11:46:19 2012
@@ -1885,20 +1885,18 @@ SwXParaFrameEnumeration::SwXParaFrameEnu
     {
         if (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode)
         {
-            SwPosFlyFrms aFlyFrms;
             //get all frames that are bound at paragraph or at character
-            rPaM.GetDoc()->GetAllFlyFmts(aFlyFrms, m_pImpl->GetCursor());
-            for(sal_uInt16 i = 0; i < aFlyFrms.Count(); i++)
+            SwPosFlyFrms aFlyFrms(rPaM.GetDoc()->GetAllFlyFmts(m_pImpl->GetCursor()));
+
+            for(SwPosFlyFrms::const_iterator aIter(aFlyFrms.begin()); aIter != aFlyFrms.end(); aIter++)
             {
-                SwPosFlyFrm* pPosFly = aFlyFrms[i];
-                SwFrmFmt *const pFrmFmt =
-                    const_cast<SwFrmFmt*>(&pPosFly->GetFmt());
+                SwFrmFmt *const pFrmFmt = const_cast<SwFrmFmt*>(&((*aIter)->GetFmt()));
+
                 // create SwDepend for frame and insert into array
-                SwDepend *const pNewDepend =
-                    new SwDepend(m_pImpl.get(), pFrmFmt);
-                m_pImpl->m_Frames.push_back(
-                        ::boost::shared_ptr<SwDepend>(pNewDepend) );
+                SwDepend *const pNewDepend = new SwDepend(m_pImpl.get(), pFrmFmt);
+                m_pImpl->m_Frames.push_back(::boost::shared_ptr<SwDepend>(pNewDepend));
             }
+            
             //created from any text range
             if (m_pImpl->GetCursor()->HasMark())
             {
@@ -1914,6 +1912,7 @@ SwXParaFrameEnumeration::SwXParaFrameEnu
                         *m_pImpl->GetCursor()->GetMark());
             }
         }
+
         lcl_FillFrame(*m_pImpl.get(), *m_pImpl->GetCursor(), m_pImpl->m_Frames);
     }
 }

Modified: incubator/ooo/branches/writer001/main/sw/source/core/unocore/unostyle.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/unocore/unostyle.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/unocore/unostyle.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/unocore/unostyle.cxx Mon Aug 20 11:46:19 2012
@@ -860,7 +860,7 @@ uno::Sequence< OUString > SwXStyleFamily
     uno::Sequence< OUString > aRet;
     if(pBasePool)
     {
-        SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, 0xffff);
+        SfxStyleSheetIteratorPtr pIterator = pBasePool->CreateIterator(eFamily, 0xffff);
         sal_uInt16 nCount = pIterator->Count();
         aRet.realloc(nCount);
         OUString* pArray = aRet.getArray();
@@ -870,7 +870,6 @@ uno::Sequence< OUString > SwXStyleFamily
 			SwStyleNameMapper::FillProgName((*pIterator)[i]->GetName(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
             pArray[i] = OUString ( aString );
 		}
-        delete pIterator;
     }
     else
         throw uno::RuntimeException();

Modified: incubator/ooo/branches/writer001/main/sw/source/core/view/printdata.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/core/view/printdata.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/core/view/printdata.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/core/view/printdata.cxx Mon Aug 20 11:46:19 2012
@@ -78,6 +78,7 @@ void SwRenderData::CreatePostItData( SwD
     m_pPostItFields = new _SetGetExpFlds;
     lcl_GetPostIts( pDoc, m_pPostItFields );
     m_pPostItDoc    = new SwDoc;
+    m_pPostItDoc->acquire();
 
     //!! Disable spell and grammar checking in the temporary document.
     //!! Otherwise the grammar checker might process it and crash if we later on
@@ -94,11 +95,15 @@ void SwRenderData::DeletePostItData()
     if (HasPostItData())
     {
         m_pPostItDoc->setPrinter( 0, false, false );  //damit am echten DOC der Drucker bleibt
-        delete m_pPostItShell;        //Nimmt das PostItDoc mit ins Grab.
-        delete m_pPostItFields;
-        m_pPostItDoc    = 0;
+        delete m_pPostItShell;
         m_pPostItShell  = 0;
+        delete m_pPostItFields;
         m_pPostItFields = 0;
+        if ( !m_pPostItDoc->release() )
+        {
+            delete m_pPostItDoc;
+        }
+        m_pPostItDoc    = 0;
     }
 }    
 

Modified: incubator/ooo/branches/writer001/main/sw/source/filter/html/htmlatr.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/filter/html/htmlatr.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/filter/html/htmlatr.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/filter/html/htmlatr.cxx Mon Aug 20 11:46:19 2012
@@ -2628,9 +2628,22 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt,
 
 			if( bOutChar )
 			{
-				sal_Unicode c = rStr.GetChar( nStrPos );
-				// versuche nach ungefaehr 255 Zeichen eine neue Zeile zu
-				// beginnen, aber nicht in PRE und nur bei Spaces
+				// #i120442#: get the UTF-32 codepoint by converting an eventual UTF-16 unicode surrogate pair
+				sal_uInt64 c = rStr.GetChar( nStrPos );
+				if( nStrPos < nEnde - 1 )
+				{
+					const sal_Unicode d = rStr.GetChar( nStrPos + 1 );
+					if( (c >= 0xd800 && c <= 0xdbff) && (d >= 0xdc00 && d <= 0xdfff) )
+					{
+						sal_uInt64 templow = d&0x03ff;
+						sal_uInt64 temphi = ((c&0x03ff) + 0x0040)<<10;
+						c = temphi|templow;
+						nStrPos++;
+					}
+				}
+				
+				// try to split a line after about 255 characters
+				// at a space character unless in a PRE-context
 				if( ' '==c && !rHTMLWrt.nLastParaToken  )
 				{
 					xub_StrLen nLineLen;
@@ -2642,7 +2655,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt,
 					xub_StrLen nWordLen = rStr.Search( ' ', nStrPos+1 );
 					if( nWordLen == STRING_NOTFOUND )
 						nWordLen = nEnde;
-                    nWordLen = nWordLen - nStrPos;
+					nWordLen -= nStrPos;
 
 					if( nLineLen >= rHTMLWrt.nWhishLineLen ||
 						(nLineLen+nWordLen) >= rHTMLWrt.nWhishLineLen )
@@ -2662,13 +2675,20 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt,
 						HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext );
 						HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_linebreak );
 					}
+					// #i120442#: if c is outside the unicode base plane output it as "&#******;"
+					else if( c > 0xffff)
+					{
+						ByteString sOut("&#");
+						sOut += ByteString::CreateFromInt64( (sal_uInt64)c );
+						sOut += ';';
+						rWrt.Strm() << sOut.GetBuffer();
+					}
 					else
-						HTMLOutFuncs::Out_Char( rWrt.Strm(), c, aContext, &rHTMLWrt.aNonConvertableCharacters );
+						HTMLOutFuncs::Out_Char( rWrt.Strm(), (sal_Unicode)c, aContext, &rHTMLWrt.aNonConvertableCharacters );
 
-					// Wenn das letzte Zeichen eines Absatzed ein harter
-					// Zeilen-Umbruch ist brauchen wir noch ein <BR> mehr, weil
-					// Netscape & Co in diesem Fall fuer den naechsten Absatz
-					// nicht in die naechste Zeile gehen.
+					// if a paragraph's last character is a hard line break
+					// then we need to add an extra <br>
+					// because browsers like Mozilla wouldn't add a line for the next paragraph
 					bWriteBreak = (0x0a == c) &&
 								  (HTML_PREFORMTXT_ON != rHTMLWrt.nLastParaToken);
 				}

Modified: incubator/ooo/branches/writer001/main/sw/source/filter/html/htmlfly.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/filter/html/htmlfly.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/filter/html/htmlfly.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/filter/html/htmlfly.cxx Mon Aug 20 11:46:19 2012
@@ -309,13 +309,12 @@ void SwHTMLWriter::CollectFlyFrms()
 	ASSERT( HTML_CFG_MAX+1 == MAX_BROWSERS,
 			"number of browser configurations has changed" );
 
-	sal_uInt8 nSz = (sal_uInt8)Min( pDoc->GetSpzFrmFmts()->Count(), sal_uInt16(255) );
-	SwPosFlyFrms aFlyPos( nSz, nSz );
-	pDoc->GetAllFlyFmts( aFlyPos, bWriteAll ? 0 : pCurPam, sal_True );
+	// sal_uInt8 nSz = (sal_uInt8)Min( pDoc->GetSpzFrmFmts()->Count(), sal_uInt16(255) );
+	SwPosFlyFrms aFlyPos(pDoc->GetAllFlyFmts(bWriteAll ? 0 : pCurPam, sal_True));
 
-	for( sal_uInt16 i=0; i< aFlyPos.Count(); i++ )
+    for(SwPosFlyFrms::const_iterator aIter(aFlyPos.begin()); aIter != aFlyPos.end(); aIter++)
 	{
-		const SwFrmFmt& rFrmFmt = aFlyPos[i]->GetFmt();
+		const SwFrmFmt& rFrmFmt = (*aIter)->GetFmt();
 		const SdrObject *pSdrObj = 0;
 		const SwPosition *pAPos;
 		const SwCntntNode *pACNd;
@@ -365,8 +364,7 @@ void SwHTMLWriter::CollectFlyFrms()
 		if( !pHTMLPosFlyFrms )
 			pHTMLPosFlyFrms = new SwHTMLPosFlyFrms;
 
-		SwHTMLPosFlyFrm *pNew =
-			new SwHTMLPosFlyFrm( *aFlyPos[i], pSdrObj, nMode );
+		SwHTMLPosFlyFrm *pNew = new SwHTMLPosFlyFrm(**aIter, pSdrObj, nMode);
 		pHTMLPosFlyFrms->Insert( pNew );
 	}
 }

Modified: incubator/ooo/branches/writer001/main/sw/source/filter/inc/fltshell.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/filter/inc/fltshell.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/filter/inc/fltshell.hxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/filter/inc/fltshell.hxx Mon Aug 20 11:46:19 2012
@@ -126,6 +126,7 @@ public:
 	void MarkAllAttrsOld();
 	void KillUnlockedAttrs(const SwPosition& pPos);
 	SfxPoolItem* GetFmtStackAttr(sal_uInt16 nWhich, sal_uInt16 * pPos = 0);
+	const SfxPoolItem* GetOpenStackAttr(const SwPosition& rPos, sal_uInt16 nWhich);
 	const SfxPoolItem* GetFmtAttr(const SwPosition& rPos, sal_uInt16 nWhich);
 	void Delete(const SwPaM &rPam);
 

Modified: incubator/ooo/branches/writer001/main/sw/source/filter/inc/msfilter.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/filter/inc/msfilter.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/filter/inc/msfilter.hxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/filter/inc/msfilter.hxx Mon Aug 20 11:46:19 2012
@@ -117,6 +117,11 @@ namespace sw
                 <a href="mailto:mmaher@openoffice.org">Martin Maher</a
         */
         sal_uLong MSDateTimeFormatToSwFormat(String& rParams, SvNumberFormatter *pFormatter, sal_uInt16 &rLang, bool bHijri);
+		/*Used to identify if the previous is AM time field*/
+		sal_Bool IsPreviousAM(String& rParams, xub_StrLen nPos);
+
+		/*Used to identify if the next is PM time field*/
+		sal_Bool IsNextPM(String& rParams, xub_StrLen nPos);
 
         /** Used by MSDateTimeFormatToSwFormat to identify AM time fields
 

Modified: incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtffld.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtffld.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtffld.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtffld.cxx Mon Aug 20 11:46:19 2012
@@ -159,7 +159,10 @@ static RTF_FLD_TYPES _WhichFld( String& 
 //			rName = sNm.Copy( nFndPos, nLen );
             rName = rName.Copy( nFndPos, static_cast< xub_StrLen >(nLen) );
             nFndPos += nTokenStt + static_cast< xub_StrLen >(nLen);
-			while( rNext.GetChar( nFndPos ) == ' ' )    ++nFndPos;
+            while ((nFndPos < rNext.Len()) && (rNext.GetChar(nFndPos) == ' '))
+            {
+                ++nFndPos;
+            }
 			rNext.Erase( 0, nFndPos );
 			rNext.EraseTrailingChars();
 			return aFldNmArr[n].eFldType;
@@ -391,8 +394,10 @@ int SwRTFParser::MakeFieldInst( String& 
 	{
         xub_StrLen nStartDel = nPos;
 		nPos += 2;
-		while (aSaveStr.GetChar(nPos) == ' ')
+        while ((nPos < aSaveStr.Len()) && (aSaveStr.GetChar(nPos) == ' '))
+        {
             ++nPos;
+        }
         if (aSaveStr.EqualsIgnoreCaseAscii("MERGEFORMAT", nPos, 11))
         {
             xub_StrLen nNoDel = (nPos + 11 ) - nStartDel;
@@ -437,7 +442,9 @@ int SwRTFParser::MakeFieldInst( String& 
 			if( STRING_NOTFOUND != ( nPos = aSaveStr.SearchAscii( "\\*" )) )
 			{
 				nPos += 2;
-				while( aSaveStr.GetChar(nPos) == ' ' ) nPos++;
+                while ((nPos < aSaveStr.Len()) &&
+                       (aSaveStr.GetChar(nPos) == ' '))
+                { nPos++; }
 				aSaveStr.Erase( 0, nPos );
 
 				// steht jetzt geanu auf dem Format-Namen
@@ -456,7 +463,9 @@ int SwRTFParser::MakeFieldInst( String& 
 			if( STRING_NOTFOUND != ( nPos = aSaveStr.SearchAscii( "\\*" )) )
 			{
 				nPos += 2;
-				while( aSaveStr.GetChar(nPos) == ' ' ) nPos++;
+                while ((nPos < aSaveStr.Len()) &&
+                       (aSaveStr.GetChar(nPos) == ' '))
+                { nPos++; }
 				aSaveStr.Erase( 0, nPos );
 
 				// steht jetzt geanu auf dem Format-Namen
@@ -536,7 +545,7 @@ int SwRTFParser::MakeFieldInst( String& 
 			// werden:
 			//	\\data -> Datenbank-Name als Field
 			//	DATA -> Datenbank-Info
-			sal_Bool bField = rFieldStr.GetChar( 0 ) != 'D';
+            bool const bField = rFieldStr.Len() && rFieldStr.GetChar(0) != 'D';
 
 			// nur der Name interressiert
 			if( STRING_NOTFOUND != (nPos = aSaveStr.Search( '.' )) )

Modified: incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtffly.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtffly.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtffly.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtffly.cxx Mon Aug 20 11:46:19 2012
@@ -280,7 +280,8 @@ void SwRTFParser::SetFlysInDoc()
 
 		// liegt Ende und Start vom Naechsten im gleichen Node, dann muss
 		// gesplittet werden
-		if( n + 1 < aFlyArr.Count() && pFlySave->nEndCnt &&
+        if (((static_cast<size_t>(n) + 1) < aFlyArr.Count()) &&
+            pFlySave->nEndCnt &&
 			pFlySave->nEndNd == aFlyArr[ n + 1 ]->nSttNd )
 		{
             SwCntntNode *const pCNd = pFlySave->nEndNd.GetNode().GetCntntNode();
@@ -1249,28 +1250,33 @@ void SwRTFParser::InsPicture( const Stri
     if ( bReadSwFly && !mbReadCellWhileReadSwFly )
     // <--
 	{
-		// erzeuge nur einen normalen GrafikNode und ersetze diesen gegen
-		// den vorhandenen Textnode
-		SwNodeIndex& rIdx = pPam->GetPoint()->nNode;
-		pGrfNd = pDoc->GetNodes().MakeGrfNode( rIdx,
-					rGrfNm, aEmptyStr,    // Name der Graphic !!
-					pGrf,
-					(SwGrfFmtColl*)pDoc->GetDfltGrfFmtColl() );
-
-		if( pGrfAttrSet )
-			pGrfNd->SetAttr( *pGrfAttrSet );
-
-		SwFlySave* pFlySave = aFlyArr[ aFlyArr.Count()-1 ];
-		pFlySave->nSttNd = rIdx.GetIndex() - 1;
-
-		if( 1 < aFlyArr.Count() )
-		{
-			pFlySave = aFlyArr[ aFlyArr.Count() - 2 ];
-			if( pFlySave->nEndNd == rIdx )
-				pFlySave->nEndNd = rIdx.GetIndex() - 1;
-		}
+        OSL_ENSURE(aFlyArr.Count(),
+            "SwRTFParser::InsPicture: fly array empty.");
+        if (aFlyArr.Count())
+        {
+		    // erzeuge nur einen normalen GrafikNode und ersetze diesen gegen
+		    // den vorhandenen Textnode
+		    SwNodeIndex& rIdx = pPam->GetPoint()->nNode;
+		    pGrfNd = pDoc->GetNodes().MakeGrfNode( rIdx,
+					    rGrfNm, aEmptyStr,    // Name der Graphic !!
+					    pGrf,
+					    (SwGrfFmtColl*)pDoc->GetDfltGrfFmtColl() );
+
+		    if( pGrfAttrSet )
+			    pGrfNd->SetAttr( *pGrfAttrSet );
+
+		    SwFlySave* pFlySave = aFlyArr[ aFlyArr.Count()-1 ];
+		    pFlySave->nSttNd = rIdx.GetIndex() - 1;
+
+		    if( 1 < aFlyArr.Count() )
+		    {
+			    pFlySave = aFlyArr[ aFlyArr.Count() - 2 ];
+			    if( pFlySave->nEndNd == rIdx )
+				    pFlySave->nEndNd = rIdx.GetIndex() - 1;
+		    }
 
-        pGrfNd->onGraphicChanged();
+            pGrfNd->onGraphicChanged();
+        }
 	}
 	else
 	{

Modified: incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtftbl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtftbl.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtftbl.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/filter/rtf/rtftbl.cxx Mon Aug 20 11:46:19 2012
@@ -216,6 +216,11 @@ void SwRTFParser::ReadTable( int nToken 
 
     sal_Int16 eVerOrient = text::VertOrientation::NONE;
 	long nLineHeight = 0;
+    if (aMergeBoxes.empty()) // can this actually happen?
+    {
+        OSL_ASSERT(false);
+        aMergeBoxes.push_back(sal_False);
+    }
 	size_t nBoxCnt = aMergeBoxes.size()-1;
 	SwBoxFrmFmts aBoxFmts;
 	SwTableBoxFmt* pBoxFmt = pDoc->MakeTableBoxFmt();
@@ -306,8 +311,11 @@ void SwRTFParser::ReadTable( int nToken 
                         {
                             --m_nCurrentBox;
                         }
-                        pFmt = static_cast<SwTableBoxFmt*>(
-                            pLine->GetTabBoxes()[ m_nCurrentBox ]->GetFrmFmt());
+                        if (m_nCurrentBox < pLine->GetTabBoxes().Count())
+                        {
+                            pFmt = static_cast<SwTableBoxFmt*>(
+                              pLine->GetTabBoxes()[m_nCurrentBox]->GetFrmFmt());
+                        }
 					}
 					else
                         pFmt = aBoxFmts[ aBoxFmts.Count()-1 ];
@@ -646,12 +654,6 @@ void SwRTFParser::ReadTable( int nToken 
 
 		pOldTblNd = pTableNode;
 		bNewTbl = sal_False;
-
-		{
-			// JP 13.08.98: TabellenUmrandungen optimieren - Bug 53525
-			void* p = pFmt;
-			aTblFmts.Insert( p, aTblFmts.Count() );
-		}
 	}
 	else
 	{
@@ -746,12 +748,6 @@ void SwRTFParser::ReadTable( int nToken 
 
             m_nCurrentBox = 0;
 			pOldTblNd = pTableNode;
-
-			{
-				// JP 13.08.98: TabellenUmrandungen optimieren - Bug 53525
-				void* p = pFmt;
-				aTblFmts.Insert( p, aTblFmts.Count() );
-			}
 		}
 	}
 
@@ -911,7 +907,7 @@ void SwRTFParser::GotoNextBox()
 		}
 
         if (bMove &&
-                (static_cast<size_t>(m_nCurrentBox + 1) == aMergeBoxes.size()))
+               ((static_cast<size_t>(m_nCurrentBox) + 1) == aMergeBoxes.size()))
 			// dann hinter die Tabelle
 			pPam->Move( fnMoveForward, fnGoNode );
 	}

Modified: incubator/ooo/branches/writer001/main/sw/source/filter/rtf/swparrtf.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/filter/rtf/swparrtf.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/filter/rtf/swparrtf.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/filter/rtf/swparrtf.cxx Mon Aug 20 11:46:19 2012
@@ -190,7 +190,6 @@ SwRTFParser::SwRTFParser(SwDoc* pD,
     maCharStyleMapper(*pD),
     maSegments(*this),
     maInsertedTables(*pD),
-    aTblFmts(0, 10),
     mpBookmarkStart(0),
     mpRedlineStack(0),
     pAuthorInfos(0),
@@ -562,7 +561,9 @@ bool rtfSections::SetCols(SwFrmFmt &rFmt
     {
         aCol._SetOrtho(false);
         sal_uInt16 nWishWidth = 0, nHalfPrev = 0;
-        for(sal_uInt16 n=0, i=0; n < rSection.maPageInfo.maColumns.size() && i < nCols; n += 2, ++i )
+        for (sal_uInt16 n=0, i=0;
+             (static_cast<size_t>(n)+1) < rSection.maPageInfo.maColumns.size() && i < nCols;
+             n += 2, ++i)
         {
             SwColumn* pCol = aCol.GetColumns()[ i ];
             pCol->SetLeft( nHalfPrev );
@@ -2782,7 +2783,7 @@ sal_Bool lcl_SetFmtCol( SwFmt& rFmt, sal
         {
             aCol._SetOrtho( sal_False );
             sal_uInt16 nWishWidth = 0, nHalfPrev = 0;
-            for( sal_uInt16 n = 0, i = 0; n < rColumns.Count(); n += 2, ++i )
+            for (sal_uInt16 n = 0, i = 0; (n+1) < rColumns.Count(); n += 2, ++i)
             {
                 SwColumn* pCol = aCol.GetColumns()[ i ];
                 pCol->SetLeft( nHalfPrev );
@@ -3249,6 +3250,7 @@ void SwRTFParser::ReadPageDescTbl()
 
     sal_uInt16 nCols = USHRT_MAX, nColSpace = USHRT_MAX, nAktCol = 0;
     SvUShorts aColumns;
+    ::std::map< const SwPageDesc*, sal_uInt16 > aFollowMap; //store index of following page descriptors
 
     while( nNumOpenBrakets && IsParserWorking() )
     {
@@ -3322,10 +3324,9 @@ void SwRTFParser::ReadPageDescTbl()
             break;
 
         case RTF_PGDSCNXT:
-            // setze erstmal nur die Nummer als Follow. Am Ende der
-            // Tabelle wird diese entsprechend korrigiert !!
+            // store index of follow in map; will be fixed up later
             if( nTokenValue )
-                pPg->SetFollow( (const SwPageDesc*)nTokenValue );
+                aFollowMap.insert( ::std::pair<const SwPageDesc*, sal_uInt16>( pPg, nTokenValue ));
             else
                 pPg->SetFollow( & const_cast<const SwDoc *>(pDoc)
                                 ->GetPageDesc( 0 ) );
@@ -3506,10 +3507,13 @@ void SwRTFParser::ReadPageDescTbl()
     for( nPos = 0; nPos < pDoc->GetPageDescCnt(); ++nPos )
     {
         SwPageDesc* pPgDsc = &pDoc->_GetPageDesc( nPos );
-        if( (sal_uInt16)(long)pPgDsc->GetFollow() < pDoc->GetPageDescCnt() )
-            pPgDsc->SetFollow(& const_cast<const SwDoc *>(pDoc)
-                              ->GetPageDesc((sal_uInt16)(long)
-                                            pPgDsc->GetFollow()));
+        std::map< const SwPageDesc*, sal_uInt16 >::const_iterator aIter =
+            aFollowMap.find( pPgDsc );
+        if (aIter != aFollowMap.end())
+        {
+            if ((*aIter).second < pDoc->GetPageDescCnt())
+                pPgDsc->SetFollow(& const_cast<const SwDoc *>(pDoc)->GetPageDesc((*aIter).second));
+        }
     }
 
     SetChkStyleAttr( bSaveChkStyleAttr );

Modified: incubator/ooo/branches/writer001/main/sw/source/filter/rtf/swparrtf.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/filter/rtf/swparrtf.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/filter/rtf/swparrtf.hxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/filter/rtf/swparrtf.hxx Mon Aug 20 11:46:19 2012
@@ -295,7 +295,6 @@ class SwRTFParser : public SvxRTFParser
 	SwFlySaveArr aFlyArr;				// Flys als Letzes im Doc setzen
 	SvBools aMergeBoxes;				// Flags fuer gemergte Zellen
 	SwListArr aListArr;
-	SvPtrarr aTblFmts;
 	SvPtrarr aRubyCharFmts;
 	BookmarkPosition* mpBookmarkStart;
     sw::util::RedlineStack *mpRedlineStack;

Modified: incubator/ooo/branches/writer001/main/sw/source/filter/ww1/fltshell.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/filter/ww1/fltshell.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/filter/ww1/fltshell.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/filter/ww1/fltshell.cxx Mon Aug 20 11:46:19 2012
@@ -621,6 +621,27 @@ SfxPoolItem* SwFltControlStack::GetFmtSt
 	return 0;
 }
 
+const SfxPoolItem* SwFltControlStack::GetOpenStackAttr(const SwPosition& rPos, sal_uInt16 nWhich)
+{
+	SwFltStackEntry* pEntry;
+	sal_uInt16 nSize = static_cast< sal_uInt16 >(Count());
+	SwNodeIndex aAktNode( rPos.nNode, -1 );
+	sal_uInt16 nAktIdx = rPos.nContent.GetIndex();
+
+	while (nSize)
+	{
+		pEntry = (*this)[ --nSize ];
+		if(    pEntry->bLocked
+			&& (pEntry->pAttr->Which() == nWhich)
+			&& (pEntry->nMkNode  == aAktNode)
+			&& (pEntry->nMkCntnt == nAktIdx ))
+		{
+			return (SfxPoolItem*)pEntry->pAttr;
+		}
+	}
+	return 0;
+}
+
 const SfxPoolItem* SwFltControlStack::GetFmtAttr(const SwPosition& rPos, sal_uInt16 nWhich)
 {
 	SfxPoolItem* pHt = GetFmtStackAttr(nWhich);

Modified: incubator/ooo/branches/writer001/main/sw/source/filter/ww1/w1filter.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/sw/source/filter/ww1/w1filter.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/sw/source/filter/ww1/w1filter.cxx (original)
+++ incubator/ooo/branches/writer001/main/sw/source/filter/ww1/w1filter.cxx Mon Aug 20 11:46:19 2012
@@ -1401,7 +1401,7 @@ SvxFontItem Ww1Fonts::GetFont(sal_uInt16
 				FAMILY_DONTKNOW, FAMILY_ROMAN, FAMILY_SWISS, FAMILY_MODERN,
 				FAMILY_SCRIPT, FAMILY_DECORATIVE
 			};
-			if (b < sizeof(eFamilyA))
+            if (b < (sizeof(eFamilyA)/sizeof(eFamilyA[0])))
 				eFamily = eFamilyA[b];
 		}
 		else