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 2014/07/15 14:15:38 UTC

svn commit: r1610671 - in /openoffice/trunk/main/sw/source: core/frmedt/feshview.cxx core/layout/fly.cxx ui/shells/textsh.cxx

Author: orw
Date: Tue Jul 15 12:15:37 2014
New Revision: 1610671

URL: http://svn.apache.org/r1610671
Log:
121443: - register text frames and graphics on the correct page frame
        - trigger formatting of selected object when moving view to the selected object or when graphical horizontal line has been inserted.


Modified:
    openoffice/trunk/main/sw/source/core/frmedt/feshview.cxx
    openoffice/trunk/main/sw/source/core/layout/fly.cxx
    openoffice/trunk/main/sw/source/ui/shells/textsh.cxx

Modified: openoffice/trunk/main/sw/source/core/frmedt/feshview.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/frmedt/feshview.cxx?rev=1610671&r1=1610670&r2=1610671&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/frmedt/feshview.cxx (original)
+++ openoffice/trunk/main/sw/source/core/frmedt/feshview.cxx Tue Jul 15 12:15:37 2014
@@ -2459,16 +2459,18 @@ const SwFrmFmt*  SwFEShell::GetFlyNum(sa
 	return GetDoc()->GetFlyNum(nIdx, eType );
 }
 
+
 // zeige das akt. selektierte "Object" an
 void SwFEShell::MakeSelVisible()
 {
-	if( Imp()->HasDrawView() &&
-		Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() )
-	{
-		MakeVisible( Imp()->GetDrawView()->GetAllMarkedRect() );
-	}
-	else
-		SwCrsrShell::MakeSelVisible();
+    if ( Imp()->HasDrawView() &&
+         Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() )
+    {
+        GetCurrFrm(); // just to trigger formatting in case the selected object is not formatted.
+        MakeVisible( Imp()->GetDrawView()->GetAllMarkedRect() );
+    }
+    else
+        SwCrsrShell::MakeSelVisible();
 }
 
 

Modified: openoffice/trunk/main/sw/source/core/layout/fly.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/layout/fly.cxx?rev=1610671&r1=1610670&r2=1610671&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/layout/fly.cxx (original)
+++ openoffice/trunk/main/sw/source/core/layout/fly.cxx Tue Jul 15 12:15:37 2014
@@ -2223,40 +2223,10 @@ void SwFrm::AppendFly( SwFlyFrm *pNew )
     pDrawObjs->Insert( *pNew );
     pNew->ChgAnchorFrm( this );
 
-	//Bei der Seite anmelden; kann sein, dass noch keine da ist - die
-	//Anmeldung wird dann in SwPageFrm::PreparePage durch gefuehrt.
-	SwPageFrm *pPage = FindPageFrm();
-	if ( pPage )
-	{
-		if ( pNew->IsFlyAtCntFrm() && pNew->Frm().Top() == WEIT_WECH )
-		{
-			//Versuch die Seitenformatierung von neuen Dokumenten etwas
-			//guenstiger zu gestalten.
-			//Wir haengen die Flys erstenmal nach hinten damit sie bei heftigem
-			//Fluss der Anker nicht unoetig oft formatiert werden.
-			//Damit man noch brauchbar an das Ende des Dokumentes springen
-			//kann werden die Flys nicht ganz an das Ende gehaengt.
-			SwRootFrm *pRoot = (SwRootFrm*)pPage->GetUpper();
-            if( !SwLayHelper::CheckPageFlyCache( pPage, pNew ) )
-            {
-                SwPageFrm *pTmp = pRoot->GetLastPage();
-                if ( pTmp->GetPhyPageNum() > 30 )
-                {
-                    for ( sal_uInt16 i = 0; i < 10; ++i )
-                    {
-                        pTmp = (SwPageFrm*)pTmp->GetPrev();
-                        if( pTmp->GetPhyPageNum() <= pPage->GetPhyPageNum() )
-                            break; // damit wir nicht vor unserem Anker landen
-                    }
-                    if ( pTmp->IsEmptyPage() )
-                        pTmp = (SwPageFrm*)pTmp->GetPrev();
-                    pPage = pTmp;
-                }
-			}
-            pPage->AppendFlyToPage( pNew );
-		}
-		else
-            pPage->AppendFlyToPage( pNew );
+    SwPageFrm* pPage = FindPageFrm();
+    if ( pPage != NULL )
+    {
+        pPage->AppendFlyToPage( pNew );
     }
 }
 

Modified: openoffice/trunk/main/sw/source/ui/shells/textsh.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/shells/textsh.cxx?rev=1610671&r1=1610670&r2=1610671&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/ui/shells/textsh.cxx (original)
+++ openoffice/trunk/main/sw/source/ui/shells/textsh.cxx Tue Jul 15 12:15:37 2014
@@ -680,30 +680,31 @@ void SwTextShell::ExecInsert(SfxRequest 
         }
 		break;
 	}
-	case FN_INSERT_HRULER:
-	{
-		String sPath;
-		sal_Bool bSimpleLine = sal_False;
-		sal_Bool bRet = sal_False;
-		Window* pParent = GetView().GetWindow();
+
+    case FN_INSERT_HRULER:
+    {
+        String sPath;
+        sal_Bool bSimpleLine = sal_False;
+        sal_Bool bRet = sal_False;
+        Window* pParent = GetView().GetWindow();
         if ( pItem )
         {
-            sPath = ((SfxStringItem*)pItem)->GetValue();
-            SFX_REQUEST_ARG( rReq, pSimple, SfxBoolItem, FN_PARAM_1 , sal_False );
+            sPath = ( (SfxStringItem*) pItem )->GetValue();
+            SFX_REQUEST_ARG( rReq, pSimple, SfxBoolItem, FN_PARAM_1, sal_False );
             if ( pSimple )
                 bSimpleLine = pSimple->GetValue();
         }
         else
         {
             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-            DBG_ASSERT(pFact, "Dialogdiet fail!");
+            DBG_ASSERT( pFact, "Dialogdiet fail!" );
             AbstractInsertGrfRulerDlg* pDlg = pFact->CreateInsertGrfRulerDlg( DLG_INSERT_RULER,
-														pParent );
-            DBG_ASSERT(pDlg, "Dialogdiet fail!");
-			// MessageBox fuer fehlende Grafiken
-            if(!pDlg->HasImages())
-                InfoBox( pParent, SW_RES(MSG_NO_RULER)).Execute();
-            if(RET_OK == pDlg->Execute())
+                pParent );
+            DBG_ASSERT( pDlg, "Dialogdiet fail!" );
+            // MessageBox fuer fehlende Grafiken
+            if ( !pDlg->HasImages() )
+                InfoBox( pParent, SW_RES( MSG_NO_RULER ) ).Execute();
+            if ( RET_OK == pDlg->Execute() )
             {
                 sPath = pDlg->GetGraphicName();
                 bSimpleLine = pDlg->IsSimpleLine();
@@ -714,41 +715,45 @@ void SwTextShell::ExecInsert(SfxRequest 
             rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bSimpleLine ) );
         }
 
-		rSh.StartAllAction();
-        rSh.StartUndo(UNDO_UI_INSERT_RULER);
-		if(bSimpleLine)
-		{
-			if(!(rSh.IsSttOfPara() && rSh.IsEndOfPara())) // kein leerer Absatz?
-				rSh.SplitNode( sal_False, sal_False ); // dann Platz schaffen
-			rSh.SplitNode( sal_False, sal_False );
-			rSh.Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
-			rSh.SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_HTML_HR ));
-			rSh.Right(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
-			bRet = sal_True;
-		}
-		else if(sPath.Len())
-		{
+        rSh.StartAllAction();
+        rSh.StartUndo( UNDO_UI_INSERT_RULER );
+        if ( bSimpleLine )
+        {
+            if ( !( rSh.IsSttOfPara() && rSh.IsEndOfPara() ) ) // kein leerer Absatz?
+                rSh.SplitNode( sal_False, sal_False ); // dann Platz schaffen
+            rSh.SplitNode( sal_False, sal_False );
+            rSh.Left( CRSR_SKIP_CHARS, sal_False, 1, sal_False );
+            rSh.SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_HTML_HR ) );
+            rSh.Right( CRSR_SKIP_CHARS, sal_False, 1, sal_False );
+            bRet = sal_True;
+        }
+        else if ( sPath.Len() )
+        {
             SwFlyFrmAttrMgr aFrmMgr( sal_True, &rSh, FRMMGR_TYPE_GRF );
-			// am FrmMgr muessen die richtigen Parameter eingestellt werden
+            // am FrmMgr muessen die richtigen Parameter eingestellt werden
 
-            aFrmMgr.SetAnchor(FLY_AS_CHAR);
+            aFrmMgr.SetAnchor( FLY_AS_CHAR );
 
-			rSh.SplitNode( sal_False, sal_False );
-			rSh.SplitNode( sal_False, sal_False );
-			rSh.Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
-			rSh.SetAttrItem(SvxAdjustItem(SVX_ADJUST_CENTER,RES_PARATR_ADJUST ));
-            if(GRFILTER_OK == GetView().InsertGraphic(sPath, aEmptyStr, sal_True, 0, 0 ))
-				bRet = sal_True;
-			rSh.EnterStdMode();
-			rSh.Right(CRSR_SKIP_CHARS, sal_False, 1, sal_False );
-		}
-		rSh.EndAllAction();
-        rSh.EndUndo(UNDO_UI_INSERT_RULER);
-		rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
+            rSh.SplitNode( sal_False, sal_False );
+            rSh.SplitNode( sal_False, sal_False );
+            rSh.Left( CRSR_SKIP_CHARS, sal_False, 1, sal_False );
+            rSh.SetAttrItem( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) );
+            if ( GRFILTER_OK == GetView().InsertGraphic( sPath, aEmptyStr, sal_True, 0, 0 ) )
+            {
+                rSh.GetCurrFrm(); // just to trigger formatting in case the inserted graphic is not formatted.
+                bRet = sal_True;
+            }
+            rSh.EnterStdMode();
+            rSh.Right( CRSR_SKIP_CHARS, sal_False, 1, sal_False );
+        }
+        rSh.EndAllAction();
+        rSh.EndUndo( UNDO_UI_INSERT_RULER );
+        rReq.SetReturnValue( SfxBoolItem( nSlot, bRet ) );
         rReq.Done();
-	}
-	break;
-	case FN_FORMAT_COLUMN :
+    }
+    break;
+
+    case FN_FORMAT_COLUMN :
 	{
 		SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
         DBG_ASSERT(pFact, "Dialogdiet fail!");