[Libreoffice-commits] core.git: editeng/source

Noel Grandin noel at peralex.com
Sun Jan 11 22:16:25 PST 2015


 editeng/source/editeng/editdoc.hxx  |   10 +++++-----
 editeng/source/editeng/editundo.cxx |    2 +-
 editeng/source/editeng/impedit2.cxx |    8 ++++----
 editeng/source/editeng/impedit3.cxx |    2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit a4d1e3d22b7f73ba7740dfe5f1d3586a49164947
Author: Noel Grandin <noel at peralex.com>
Date:   Sun Jan 11 16:40:21 2015 +0200

    no need for DeletedNodeInfo class to be type unsafe
    
    Change-Id: Idab8eacf8fa06d902c9186995b249e871bc54067
    Reviewed-on: https://gerrit.libreoffice.org/13860
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 5e4559c..9127ca7 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -725,18 +725,18 @@ public:
 class DeletedNodeInfo
 {
 private:
-    sal_uIntPtr     nInvalidAdressPtr;
+    ContentNode*    mpInvalidNode;
     sal_Int32       nInvalidParagraph;
 
 public:
-            DeletedNodeInfo( sal_uIntPtr nInvAdr, sal_Int32 nPos )
-            : nInvalidAdressPtr(nInvAdr)
+            DeletedNodeInfo( ContentNode* pNode, sal_Int32 nPos )
+            : mpInvalidNode(pNode)
             , nInvalidParagraph(nPos)
             {
             }
 
-    sal_uIntPtr GetInvalidAdress() const { return nInvalidAdressPtr; }
-    sal_Int32   GetPosition() const { return nInvalidParagraph; }
+    ContentNode* GetNode() const { return mpInvalidNode; }
+    sal_Int32    GetPosition() const { return nInvalidParagraph; }
 };
 
 
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 674fc96..dc6309c 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -187,7 +187,7 @@ void EditUndoDelContent::Redo()
     if (pEE->IsCallParaInsertedOrDeleted())
         pEE->ParagraphDeleted( nNode );
 
-    DeletedNodeInfo* pInf = new DeletedNodeInfo( reinterpret_cast<sal_uLong>(pContentNode), nNode );
+    DeletedNodeInfo* pInf = new DeletedNodeInfo( pContentNode, nNode );
     pEE->AppendDeletedNodeInfo(pInf);
     pEE->UpdateSelections();
 
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 1b8993f..da28934 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2200,7 +2200,7 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR
     }
 
     sal_Int32 nParagraphTobeDeleted = aEditDoc.GetPos( pRight );
-    DeletedNodeInfo* pInf = new DeletedNodeInfo( reinterpret_cast<sal_uIntPtr>(pRight), nParagraphTobeDeleted );
+    DeletedNodeInfo* pInf = new DeletedNodeInfo( pRight, nParagraphTobeDeleted );
     aDeletedNodes.push_back(pInf);
 
     GetEditEnginePtr()->ParagraphConnected( aEditDoc.GetPos( pLeft ), aEditDoc.GetPos( pRight ) );
@@ -2440,7 +2440,7 @@ void ImpEditEngine::ImpRemoveParagraph( sal_Int32 nPara )
 
     OSL_ENSURE( pNode, "Blind Node in ImpRemoveParagraph" );
 
-    DeletedNodeInfo* pInf = new DeletedNodeInfo( reinterpret_cast<sal_uIntPtr>(pNode), nPara );
+    DeletedNodeInfo* pInf = new DeletedNodeInfo( pNode, nPara );
     aDeletedNodes.push_back(pInf);
 
     // The node is managed by the undo and possibly destroyed!
@@ -3299,8 +3299,8 @@ void ImpEditEngine::UpdateSelections()
         for (size_t i = 0, n = aDeletedNodes.size(); i < n; ++i)
         {
             const DeletedNodeInfo& rInf = aDeletedNodes[i];
-            if ( ( reinterpret_cast<sal_uLong>(aCurSel.Min().GetNode()) == rInf.GetInvalidAdress() ) ||
-                 ( reinterpret_cast<sal_uLong>(aCurSel.Max().GetNode()) == rInf.GetInvalidAdress() ) )
+            if ( ( aCurSel.Min().GetNode() == rInf.GetNode() ) ||
+                 ( aCurSel.Max().GetNode() == rInf.GetNode() ) )
             {
                 // Use ParaPortions, as now also hidden paragraphs have to be
                 // taken into account!
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index b777fc3..494aafc 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3924,7 +3924,7 @@ void ImpEditEngine::ShowParagraph( sal_Int32 nParagraph, bool bShow )
         {
             // Mark as deleted, so that no selection will end or begin at
             // this paragraph...
-            DeletedNodeInfo* pDelInfo = new DeletedNodeInfo( reinterpret_cast<sal_uIntPtr>(pPPortion->GetNode()), nParagraph );
+            DeletedNodeInfo* pDelInfo = new DeletedNodeInfo( pPPortion->GetNode(), nParagraph );
             aDeletedNodes.push_back(pDelInfo);
             UpdateSelections();
             // The region below will not be invalidated if UpdateMode = sal_False!


More information about the Libreoffice-commits mailing list