basctl/source/basicide/baside2b.cxx        |   57 +++++++++++++++--------------
 basic/source/classes/codecompletecache.cxx |   13 ++++--
 include/basic/codecompletecache.hxx        |    2 -
 3 files changed, 41 insertions(+), 31 deletions(-)

New commits:
commit bd5ac5bce9492991c7ff26d5149f0d8679a2a050
Author: Gergo Mocsi <gmocs...@gmail.com>
Date:   Mon Jul 29 16:08:13 2013 +0200

    GSOC work, nested reflection fix - again
    
    Fixed the issue when an invalid method was typed, listbox showed tha 
methods of the base variable.
    
    Change-Id: I88576645b373e76112103055d547f713af1fc153

diff --git a/basctl/source/basicide/baside2b.cxx 
b/basctl/source/basicide/baside2b.cxx
index 5ff3e3d..a3a8f10 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -592,6 +592,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
                 {
                     unsigned int j = 1;
                     OUString sMethName;
+                    bool bReflect = true;
                     while( j != aVect.size() )
                     {
                         sMethName = aVect[j];
@@ -604,43 +605,47 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
                         }
                         else
                         {
+                            bReflect = false;
                             break;
                         }
                         j++;
                     }
-                    Sequence< Reference< reflection::XIdlMethod > > aMethods = 
xClass->getMethods();
-                    Sequence< Reference< reflection::XIdlField > > aFields = 
xClass->getFields();
-                    std::vector< OUString > aEntryVect;
-
-                    if( aMethods.getLength() != 0 )
+                    if( bReflect )
                     {
-                        for(sal_Int32 l = 0; l < aMethods.getLength(); ++l)
+                        Sequence< Reference< reflection::XIdlMethod > > 
aMethods = xClass->getMethods();
+                        Sequence< Reference< reflection::XIdlField > > aFields 
= xClass->getFields();
+                        std::vector< OUString > aEntryVect;
+
+                        if( aMethods.getLength() != 0 )
                         {
-                            
aEntryVect.push_back(OUString(aMethods[l]->getName()));
+                            for(sal_Int32 l = 0; l < aMethods.getLength(); ++l)
+                            {
+                                
aEntryVect.push_back(OUString(aMethods[l]->getName()));
+                            }
                         }
-                    }
-                    if( aFields.getLength() != 0 )
-                    {
-                        for(sal_Int32 l = 0; l < aFields.getLength(); ++l)
+                        if( aFields.getLength() != 0 )
                         {
-                            
aEntryVect.push_back(OUString(aFields[l]->getName()));
+                            for(sal_Int32 l = 0; l < aFields.getLength(); ++l)
+                            {
+                                
aEntryVect.push_back(OUString(aFields[l]->getName()));
+                            }
                         }
-                    }
-                    if( aEntryVect.size() > 0 )
-                    {
-                        Rectangle aRect = ( (TextEngine*) GetEditEngine() 
)->PaMtoEditCursor( aSel.GetEnd() , false );
-                        aSel.GetStart().GetIndex() += 1;
-                        aSel.GetEnd().GetIndex() += 1;
-                        pCodeCompleteWnd->ClearListBox();
-                        pCodeCompleteWnd->SetTextSelection(aSel);
-                        for(unsigned int l = 0; l < aEntryVect.size(); ++l)
+                        if( aEntryVect.size() > 0 )
                         {
-                            pCodeCompleteWnd->InsertEntry( aEntryVect[l] );
+                            Rectangle aRect = ( (TextEngine*) GetEditEngine() 
)->PaMtoEditCursor( aSel.GetEnd() , false );
+                            aSel.GetStart().GetIndex() += 1;
+                            aSel.GetEnd().GetIndex() += 1;
+                            pCodeCompleteWnd->ClearListBox();
+                            pCodeCompleteWnd->SetTextSelection(aSel);
+                            for(unsigned int l = 0; l < aEntryVect.size(); ++l)
+                            {
+                                pCodeCompleteWnd->InsertEntry( aEntryVect[l] );
+                            }
+                            pCodeCompleteWnd->SetPosPixel( aRect.BottomRight() 
);
+                            pCodeCompleteWnd->Show();
+                            pCodeCompleteWnd->ResizeListBox();
+                            pCodeCompleteWnd->SelectFirstEntry();
                         }
-                        pCodeCompleteWnd->SetPosPixel( aRect.BottomRight() );
-                        pCodeCompleteWnd->Show();
-                        pCodeCompleteWnd->ResizeListBox();
-                        pCodeCompleteWnd->SelectFirstEntry();
                     }
                 }
             }
diff --git a/basic/source/classes/codecompletecache.cxx 
b/basic/source/classes/codecompletecache.cxx
index 728dcb4..b174d1e 100644
--- a/basic/source/classes/codecompletecache.cxx
+++ b/basic/source/classes/codecompletecache.cxx
@@ -142,18 +142,23 @@ void CodeCompleteDataCache::InsertLocalVar( const 
OUString& sProcName, const OUS
     }
 }
 
-OUString CodeCompleteDataCache::GetVarType( const OUString& sVarName )
+OUString CodeCompleteDataCache::GetVarType( const OUString& sVarName ) const
 {
     for( CodeCompleteVarScopes::const_iterator aIt = aVarScopes.begin(); aIt 
!= aVarScopes.end(); ++aIt )
     {
         CodeCompleteVarTypes aTypes = aIt->second;
-        if( aTypes[sVarName] != OUString("") )
-            return aTypes[sVarName];
+        for( CodeCompleteVarTypes::const_iterator aOtherIt = aTypes.begin(); 
aOtherIt != aTypes.end(); ++aOtherIt )
+        {
+            if( aOtherIt->first.equalsIgnoreAsciiCase( sVarName ) )
+            {
+                return aOtherIt->second;
+            }
+        }
     }
     //not a local, search global scope
     for( CodeCompleteVarTypes::const_iterator aIt = aGlobalVars.begin(); aIt 
!= aGlobalVars.end(); ++aIt )
     {
-        if( aIt->first == sVarName )
+        if( aIt->first.equalsIgnoreAsciiCase( sVarName ) )
             return aIt->second;
     }
     return OUString(""); //not found
diff --git a/include/basic/codecompletecache.hxx 
b/include/basic/codecompletecache.hxx
index 5206299..c12139b 100644
--- a/include/basic/codecompletecache.hxx
+++ b/include/basic/codecompletecache.hxx
@@ -99,7 +99,7 @@ public:
 
     void InsertGlobalVar( const OUString& sVarName, const OUString& sVarType );
     void InsertLocalVar( const OUString& sProcName, const OUString& sVarName, 
const OUString& sVarType );
-    OUString GetVarType( const OUString& sVarName );
+    OUString GetVarType( const OUString& sVarName ) const;
     void print() const; // wrapper for operator<<, prints to std::cerr
     void Clear();
 };
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to