openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1498841 - in /openoffice/trunk/main/dbaccess/source/ui: inc/QueryTableView.hxx querydesign/QueryTableView.cxx
Date Tue, 02 Jul 2013 08:50:18 GMT
Author: alg
Date: Tue Jul  2 08:50:18 2013
New Revision: 1498841

URL: http://svn.apache.org/r1498841
Log:
i122589 check if element is added before removing and deleting it (well, put it in undo)

Modified:
    openoffice/trunk/main/dbaccess/source/ui/inc/QueryTableView.hxx
    openoffice/trunk/main/dbaccess/source/ui/querydesign/QueryTableView.cxx

Modified: openoffice/trunk/main/dbaccess/source/ui/inc/QueryTableView.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/dbaccess/source/ui/inc/QueryTableView.hxx?rev=1498841&r1=1498840&r2=1498841&view=diff
==============================================================================
--- openoffice/trunk/main/dbaccess/source/ui/inc/QueryTableView.hxx (original)
+++ openoffice/trunk/main/dbaccess/source/ui/inc/QueryTableView.hxx Tue Jul  2 08:50:18 2013
@@ -73,6 +73,7 @@ namespace dbaui
 
 		// Basisklasse ueberschrieben : Fenster kreieren und loeschen
 		// (eigentlich nicht wirklich LOESCHEN, es geht in die Verantwortung einer UNDO-Action
ueber)
+        bool ContainsTabWin(const OTableWindow& rTabWin); // #122589# Allow to check
if OTableWindow is registered
 		virtual void AddTabWin( const ::rtl::OUString& _rTableName, const ::rtl::OUString&
_rAliasName, sal_Bool bNewTable = sal_False );
 		virtual void RemoveTabWin(OTableWindow* pTabWin);
 

Modified: openoffice/trunk/main/dbaccess/source/ui/querydesign/QueryTableView.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/dbaccess/source/ui/querydesign/QueryTableView.cxx?rev=1498841&r1=1498840&r2=1498841&view=diff
==============================================================================
--- openoffice/trunk/main/dbaccess/source/ui/querydesign/QueryTableView.cxx (original)
+++ openoffice/trunk/main/dbaccess/source/ui/querydesign/QueryTableView.cxx Tue Jul  2 08:50:18
2013
@@ -835,42 +835,65 @@ sal_Bool OQueryTableView::FindTableFromF
 }
 
 //------------------------------------------------------------------------------
-void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin)
+bool OQueryTableView::ContainsTabWin(const OTableWindow& rTabWin)
 {
-	DBG_CHKTHIS(OQueryTableView,NULL);
-	DBG_ASSERT(pTabWin != NULL, "OQueryTableView::RemoveTabWin : Fenster sollte ungleich NULL
sein !");
-
-	// mein Parent brauche ich, da es vom Loeschen erfahren soll
-	OQueryDesignView* pParent = static_cast<OQueryDesignView*>(getDesignView());
+    OTableWindowMap* pTabWins = GetTabWinMap();
+    DBG_ASSERT(pTabWins != NULL, "OQueryTableView::HideTabWin : habe keine TabWins !");
 
-	SfxUndoManager& rUndoMgr = m_pView->getController().GetUndoManager();
-	rUndoMgr.EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String() );
+    OTableWindowMap::iterator aIter = pTabWins->begin();
+    OTableWindowMap::iterator aEnd  = pTabWins->end();
 
-	// Undo-Action anlegen
-	OQueryTabWinDelUndoAct* pUndoAction = new OQueryTabWinDelUndoAct(this);
-	pUndoAction->SetTabWin(static_cast< OQueryTableWindow*>(pTabWin));
+    for ( ;aIter != aEnd ; ++aIter )
+    {
+        if ( aIter->second == &rTabWin )
+        {
+            return true;
+        }
+    }
 
-	// und Fenster verstecken
-	HideTabWin(static_cast< OQueryTableWindow*>(pTabWin), pUndoAction);
-
-	// Undo Actions und Loeschen der Felder in SelectionBrowseBox
-	pParent->TableDeleted( static_cast< OQueryTableWindowData*>(pTabWin->GetData().get())->GetAliasName()
);
-
-	m_pView->getController().addUndoActionAndInvalidate( pUndoAction );
-	rUndoMgr.LeaveListAction();
+    return false;
+}
 
-	if (m_lnkTabWinsChangeHandler.IsSet())
-	{
-		TabWinsChangeNotification aHint(TabWinsChangeNotification::AT_REMOVED_WIN, static_cast<
OQueryTableWindow*>(pTabWin)->GetAliasName());
-		m_lnkTabWinsChangeHandler.Call(&aHint);
-	}
+//------------------------------------------------------------------------------
+void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin)
+{
+	DBG_CHKTHIS(OQueryTableView,NULL);
+	DBG_ASSERT(pTabWin != NULL, "OQueryTableView::RemoveTabWin : Fenster sollte ungleich NULL
sein !");
 
-	modified();
-	if ( m_pAccessible )
-		m_pAccessible->notifyAccessibleEvent(	AccessibleEventId::CHILD,
-												makeAny(pTabWin->GetAccessible()),
-												Any()												
-												);
+    if(pTabWin && ContainsTabWin(*pTabWin)) // #122589# check if registered before
deleting
+    {
+	    // mein Parent brauche ich, da es vom Loeschen erfahren soll
+	    OQueryDesignView* pParent = static_cast<OQueryDesignView*>(getDesignView());
+
+	    SfxUndoManager& rUndoMgr = m_pView->getController().GetUndoManager();
+	    rUndoMgr.EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String()
);
+
+	    // Undo-Action anlegen
+	    OQueryTabWinDelUndoAct* pUndoAction = new OQueryTabWinDelUndoAct(this);
+	    pUndoAction->SetTabWin(static_cast< OQueryTableWindow*>(pTabWin));
+
+	    // und Fenster verstecken
+	    HideTabWin(static_cast< OQueryTableWindow*>(pTabWin), pUndoAction);
+
+	    // Undo Actions und Loeschen der Felder in SelectionBrowseBox
+	    pParent->TableDeleted( static_cast< OQueryTableWindowData*>(pTabWin->GetData().get())->GetAliasName()
);
+
+	    m_pView->getController().addUndoActionAndInvalidate( pUndoAction );
+	    rUndoMgr.LeaveListAction();
+
+	    if (m_lnkTabWinsChangeHandler.IsSet())
+	    {
+		    TabWinsChangeNotification aHint(TabWinsChangeNotification::AT_REMOVED_WIN, static_cast<
OQueryTableWindow*>(pTabWin)->GetAliasName());
+		    m_lnkTabWinsChangeHandler.Call(&aHint);
+	    }
+
+	    modified();
+	    if ( m_pAccessible )
+		    m_pAccessible->notifyAccessibleEvent(	AccessibleEventId::CHILD,
+												    makeAny(pTabWin->GetAccessible()),
+												    Any()												
+												    );
+    }
 }
 
 //------------------------------------------------------------------------



Mime
View raw message