[Libreoffice-commits] .: 2 commits - basctl/source

Takeshi Abe tabe at kemper.freedesktop.org
Tue Apr 17 08:25:05 PDT 2012


 basctl/source/basicide/basobj2.cxx  |    9 +++++----
 basctl/source/basicide/bastype2.cxx |   14 +++++++-------
 basctl/source/basicide/bastype3.cxx |   10 ++++------
 3 files changed, 16 insertions(+), 17 deletions(-)

New commits:
commit b1bee56af9a4cbbaabfe43290d28f53efdebc14d
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Wed Apr 18 00:23:42 2012 +0900

    calling GetChar() only once suffices

diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index ddbc3a4..cd9986c 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -108,10 +108,11 @@ sal_Bool IsValidSbxName( const String& rName )
 {
     for ( sal_uInt16 nChar = 0; nChar < rName.Len(); nChar++ )
     {
-        sal_Bool bValid = ( ( rName.GetChar(nChar) >= 'A' && rName.GetChar(nChar) <= 'Z' ) ||
-                        ( rName.GetChar(nChar) >= 'a' && rName.GetChar(nChar) <= 'z' ) ||
-                        ( rName.GetChar(nChar) >= '0' && rName.GetChar(nChar) <= '9' && nChar ) ||
-                        ( rName.GetChar(nChar) == '_' ) );
+        sal_Unicode c = rName.GetChar(nChar);
+        sal_Bool bValid = ( ( c >= 'A' && c <= 'Z' ) ||
+                            ( c >= 'a' && c <= 'z' ) ||
+                            ( c >= '0' && c <= '9' && nChar ) ||
+                            ( c == '_' ) );
         if ( !bValid )
             return sal_False;
     }
commit f00d60997edc56bf0f4653b1bd78c5379cedda6a
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Wed Apr 18 00:22:17 2012 +0900

    replaced String by rtl::OUString

diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 986efa3..34a1aaf 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -332,7 +332,7 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
 
                     for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
                     {
-                        String aModName = pModNames[ i ];
+                        ::rtl::OUString aModName = pModNames[ i ];
                         SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
                         if ( !pModuleEntry )
                             pModuleEntry = AddEntry(
@@ -408,10 +408,10 @@ void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEnt
 {
 
     ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > > aEntries;
-    aEntries.push_back( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) );
-    aEntries.push_back( ::std::make_pair( OBJ_TYPE_USERFORMS,  String( IDEResId( RID_STR_USERFORMS ) ) ) );
-    aEntries.push_back( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, String( IDEResId( RID_STR_NORMAL_MODULES ) ) ) );
-    aEntries.push_back( ::std::make_pair( OBJ_TYPE_CLASS_MODULES,  String( IDEResId( RID_STR_CLASS_MODULES ) ) ) );
+    aEntries.push_back( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, ResId::toString( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) );
+    aEntries.push_back( ::std::make_pair( OBJ_TYPE_USERFORMS, ResId::toString( IDEResId( RID_STR_USERFORMS ) ) ) );
+    aEntries.push_back( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, ResId::toString( IDEResId( RID_STR_NORMAL_MODULES ) ) ) );
+    aEntries.push_back( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, ResId::toString( IDEResId( RID_STR_CLASS_MODULES ) ) ) );
 
     ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > >::iterator iter;
     for( iter = aEntries.begin(); iter != aEntries.end(); ++iter )
@@ -798,8 +798,8 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc )
     {
         aDesc = BasicEntryDescriptor(
             ScriptDocument::getApplicationScriptDocument(),
-            LIBRARY_LOCATION_USER, String::CreateFromAscii( "Standard" ),
-            String(), String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN );
+            LIBRARY_LOCATION_USER, "Standard",
+            ::rtl::OUString(), ".", OBJ_TYPE_UNKNOWN );
     }
     ScriptDocument aDocument( aDesc.GetDocument() );
     OSL_ENSURE( aDocument.isValid(), "BasicTreeListBox::SetCurrentEntry: invalid document!" );
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index 4128474..d906471 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -67,8 +67,7 @@ void BasicTreeListBox::RequestingChildren( SvLBoxEntry* pEntry )
     }
     else if ( eType == OBJ_TYPE_LIBRARY )
     {
-        String aLibName( aDesc.GetLibName() );
-        ::rtl::OUString aOULibName( aLibName );
+        ::rtl::OUString aOULibName( aDesc.GetLibName() );
 
         // check password
         sal_Bool bOK = sal_True;
@@ -79,7 +78,7 @@ void BasicTreeListBox::RequestingChildren( SvLBoxEntry* pEntry )
             if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
             {
                 ::rtl::OUString aPassword;
-                bOK = QueryPassword( xModLibContainer, aLibName, aPassword );
+                bOK = QueryPassword( xModLibContainer, aOULibName, aPassword );
             }
         }
 
@@ -115,7 +114,7 @@ void BasicTreeListBox::RequestingChildren( SvLBoxEntry* pEntry )
             if ( bModLibLoaded || bDlgLibLoaded )
             {
                 // create the sub entries
-                ImpCreateLibSubEntries( pEntry, aDocument, aLibName );
+                ImpCreateLibSubEntries( pEntry, aDocument, aOULibName );
 
                 // exchange image
                 bool bDlgMode = ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES );
@@ -133,7 +132,7 @@ void BasicTreeListBox::RequestingChildren( SvLBoxEntry* pEntry )
             || eType == OBJ_TYPE_NORMAL_MODULES
             || eType == OBJ_TYPE_CLASS_MODULES )
     {
-        String aLibName( aDesc.GetLibName() );
+        ::rtl::OUString aLibName( aDesc.GetLibName() );
         ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName );
     }
     else {
@@ -178,7 +177,6 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
     if ( !pEntry )
         return 0;
 
-    String aLib, aModOrObj, aSubOrPropOrSObj, aPropOrSubInSObj;
     ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
     EntryArray aEntries;
 


More information about the Libreoffice-commits mailing list