basctl/source/basicide/baside2.cxx  |    4 ++--
 basctl/source/basicide/basobj2.cxx  |    8 ++++----
 basctl/source/basicide/basobj3.cxx  |    2 +-
 basctl/source/basicide/macrodlg.cxx |    4 ++--
 basic/source/basmgr/basmgr.cxx      |    6 +++---
 basic/source/classes/sb.cxx         |    2 +-
 basic/source/classes/sbxmod.cxx     |   15 ++++++---------
 basic/source/comp/parser.cxx        |    2 +-
 include/basic/sbmod.hxx             |    4 ++--
 sfx2/source/view/viewfrm.cxx        |    2 +-
 sw/source/filter/html/htmlbas.cxx   |    2 +-
 11 files changed, 24 insertions(+), 27 deletions(-)

New commits:
commit af599940e38a5f2d79e3de8899cd030fd63568e4
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Oct 9 12:33:08 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Thu Oct 9 22:06:39 2025 +0200

    Get rid of some unneeded intermediate variables.
    
    The "is p equal to pDeletedBasic" check doesn't need a dynamic cast
    to StarBASIC*.
    
    Change-Id: I13bee0791d95f045beacad11b0d97e6fd616d636
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192112
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 2978d961a0fd..722b9210db29 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1327,20 +1327,17 @@ void 
SbModule::implClearIfVarDependsOnDeletedBasic(SbxVariable& rVar, StarBASIC*
     if (rVar.SbxValue::GetType() != SbxOBJECT || dynamic_cast<const 
SbProcedureProperty*>(&rVar) != nullptr)
         return;
 
-    SbxObject* pObj = dynamic_cast<SbxObject*>(rVar.GetObject());
-    if( pObj == nullptr )
+    SbxObject* p = dynamic_cast<SbxObject*>(rVar.GetObject());
+    if (p == nullptr)
         return;
 
-    SbxObject* p = pObj;
-
     SbModule* pMod = dynamic_cast<SbModule*>( p  );
     if( pMod != nullptr )
         pMod->ClearVarsDependingOnDeletedBasic( pDeletedBasic );
 
     while( (p = p->GetParent()) != nullptr )
     {
-        StarBASIC* pBasic = dynamic_cast<StarBASIC*>( p  );
-        if( pBasic != nullptr && pBasic == pDeletedBasic )
+        if (p == pDeletedBasic)
         {
             rVar.SbxValue::Clear();
             break;
commit e16910adada716cf8137c1de5faa1b18dc320366
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Oct 9 10:03:47 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Thu Oct 9 22:06:25 2025 +0200

    SbModule: [GS]etSource32 -> [GS]etSource
    
    The *32 methods were initially introduced in a series of "Basic Modules > 
64K"
    commits (2003), in addition to the pre-existing [GS]etSource methods. Then, 
in
    commits d41b8ac9e53d3cbe05bed171f27c76cc01ea742f (callcatcher: shave off a 
few
    more, 2015-02-02) and 919375354c769ac9cc6a49ebfbfb84aa0f15df39 (GetSource32
    and GetSource are identical, 2019-12-09), the original methods were dropped.
    Now the '32' suffix to the methods makes no sense.
    
    Change-Id: I9dc172ce973b1b49511518f184d174ea68227cdf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192086
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/basctl/source/basicide/baside2.cxx 
b/basctl/source/basicide/baside2.cxx
index 3bf17508e46a..8c5915cb969b 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -783,12 +783,12 @@ void ModulWindow::UpdateData()
     if ( !XModule().is() )
         return;
 
-    SetModule( m_xModule->GetSource32() );
+    SetModule( m_xModule->GetSource() );
 
     if ( GetEditView() )
     {
         TextSelection aSel = GetEditView()->GetSelection();
-        setTextEngineText(*GetEditEngine(), m_xModule->GetSource32());
+        setTextEngineText(*GetEditEngine(), m_xModule->GetSource());
         GetEditView()->SetSelection( aSel );
         GetEditEngine()->SetModified( false );
         MarkDocumentModified( GetDocument() );
diff --git a/basctl/source/basicide/basobj2.cxx 
b/basctl/source/basicide/basobj2.cxx
index c0b54a51885e..2775d55401ad 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -368,10 +368,10 @@ Sequence< OUString > GetMethodNames( const 
ScriptDocument& rDocument, const OUSt
         SbModuleRef xModule;
         // Only reparse modules if ScriptDocument source is out of sync
         // with basic's Module
-        if ( !pMod || pMod->GetSource32() != aOUSource )
+        if ( !pMod || pMod->GetSource() != aOUSource )
         {
             xModule = new SbModule( rModName );
-            xModule->SetSource32( aOUSource );
+            xModule->SetSource( aOUSource );
             pMod = xModule.get();
         }
 
@@ -418,10 +418,10 @@ bool HasMethod (
         SbModuleRef xModule;
         // Only reparse modules if ScriptDocument source is out of sync
         // with basic's Module
-        if ( !pMod || pMod->GetSource32() != aOUSource )
+        if ( !pMod || pMod->GetSource() != aOUSource )
         {
             xModule = new SbModule( rModName );
-            xModule->SetSource32( aOUSource );
+            xModule->SetSource( aOUSource );
             pMod = xModule.get();
         }
         SbxArray* pMethods = pMod->GetMethods().get();
diff --git a/basctl/source/basicide/basobj3.cxx 
b/basctl/source/basicide/basobj3.cxx
index 6b0d241e7e45..f4e60eabc308 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -90,7 +90,7 @@ SbMethod* CreateMacro( SbModule* pModule, const OUString& 
rMacroName )
         }
     }
 
-    OUString aOUSource( pModule->GetSource32() );
+    OUString aOUSource( pModule->GetSource() );
 
     // don't produce too many empty lines...
     sal_Int32 nSourceLen = aOUSource.getLength();
diff --git a/basctl/source/basicide/macrodlg.cxx 
b/basctl/source/basicide/macrodlg.cxx
index f8ba42ce4626..4eed5a62f107 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -274,12 +274,12 @@ void MacroChooser::DeleteMacro()
 
     SbModule* pModule = pMethod->GetModule();
     assert(pModule && "DeleteMacro: No Module?!");
-    OUString aSource( pModule->GetSource32() );
+    OUString aSource( pModule->GetSource() );
     sal_uInt16 nStart, nEnd;
     pMethod->GetLineRange( nStart, nEnd );
     pModule->GetMethods()->Remove( pMethod );
     CutLines( aSource, nStart-1, nEnd-nStart+1 );
-    pModule->SetSource32( aSource );
+    pModule->SetSource( aSource );
 
     // update module in library
     OUString aLibName = pBasic->GetName();
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 264c8e70ef4e..aa73c94a286f 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -264,7 +264,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( 
const container::Con
     Event.Element >>= aMod;
 
     if( pMod )
-            pMod->SetSource32( aMod );
+            pMod->SetSource( aMod );
     else
             pLib->MakeModule( aName, aMod );
 
@@ -501,7 +501,7 @@ static void copyToLibraryContainer( StarBASIC* pBasic, 
const LibraryContainerInf
         OUString aModName = pModule->GetName();
         if( !xLib->hasByName( aModName ) )
         {
-            OUString aSource = pModule->GetSource32();
+            OUString aSource = pModule->GetSource();
             uno::Any aSourceAny;
             aSourceAny <<= aSource;
             xLib->insertByName( aModName, aSourceAny );
@@ -1687,7 +1687,7 @@ uno::Any ModuleContainer_Impl::getByName( const OUString& 
aName )
     SbModule* pMod = mpLib ? mpLib->FindModule( aName ) : nullptr;
     if( !pMod )
         throw container::NoSuchElementException();
-    uno::Reference< script::XStarBasicModuleInfo > xMod = new ModuleInfo_Impl( 
aName, u"StarBasic"_ustr, pMod->GetSource32() );
+    uno::Reference< script::XStarBasicModuleInfo > xMod = new ModuleInfo_Impl( 
aName, u"StarBasic"_ustr, pMod->GetSource() );
     uno::Any aRetAny;
     aRetAny <<= xMod;
     return aRetAny;
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 301cd724ed2f..93b4d56ca793 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1034,7 +1034,7 @@ SbModule* StarBASIC::MakeModule( const OUString& rName, 
const ModuleInfo& mInfo,
         p = new SbModule( rName, isVBAEnabled() );
         break;
     }
-    p->SetSource32( rSrc );
+    p->SetSource( rSrc );
     p->SetParent( this );
     pModules.emplace_back(p);
     SetModified( true );
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 0d3338f88252..2978d961a0fd 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -800,7 +800,7 @@ void SbModule::Notify( SfxBroadcaster& rBC, const SfxHint& 
rHint )
 // The setting of the source makes the image invalid
 // and scans the method definitions newly in
 
-void SbModule::SetSource32( const OUString& r )
+void SbModule::SetSource( const OUString& r )
 {
     // Default basic mode to library container mode, but... allow Option 
VBASupport 0/1 override
     SetVBASupport( getDefaultVBAMode( static_cast< StarBASIC*>( GetParent() ) 
) );
@@ -1618,14 +1618,14 @@ bool SbModule::LoadData( SvStream& rStrm, sal_uInt16 
nVer )
         // Old version: image away
         if( nVer == 1 )
         {
-            SetSource32( p->aOUSource );
+            SetSource( p->aOUSource );
         }
         else
             pImage = std::move(p);
     }
     else
     {
-        SetSource32( p->aOUSource );
+        SetSource( p->aOUSource );
     }
     return true;
 }
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index 485a3f1cf4fd..abd4c13ce04c 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -110,7 +110,7 @@ const SbiStatement StmntTable [] = {
 };
 
 SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
-        : SbiTokenizer( pm->GetSource32(), pb ),
+        : SbiTokenizer( pm->GetSource(), pb ),
           pStack(nullptr),
           pProc(nullptr),
           pWithVar(nullptr),
diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx
index e6a47632d022..e9f7a1fc15fc 100644
--- a/include/basic/sbmod.hxx
+++ b/include/basic/sbmod.hxx
@@ -104,8 +104,8 @@ public:
 
     SAL_DLLPRIVATE virtual SbxVariable* Find( const OUString&, SbxClassType ) 
override;
 
-    const OUString&  GetSource32() const { return aOUSource;}
-    void             SetSource32( const OUString& r );
+    const OUString&  GetSource() const { return aOUSource;}
+    void             SetSource( const OUString& r );
 
     bool Compile();
     bool IsCompiled() const;
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 831e5eb59ff7..b8c7841cc1b8 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -3147,7 +3147,7 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const 
OUString& sMacro )
                 SbMethod* pMethod = pModule ? pModule->FindMethod(aMacroName, 
SbxClassType::Method) : nullptr;
                 if (pMethod)
                 {
-                    aOUSource = pModule->GetSource32();
+                    aOUSource = pModule->GetSource();
                     sal_uInt16 nStart, nEnd;
                     pMethod->GetLineRange( nStart, nEnd );
                     sal_uInt16 nlStart = nStart;
diff --git a/sw/source/filter/html/htmlbas.cxx 
b/sw/source/filter/html/htmlbas.cxx
index 0dd129f831c2..e37909aa87b9 100644
--- a/sw/source/filter/html/htmlbas.cxx
+++ b/sw/source/filter/html/htmlbas.cxx
@@ -294,7 +294,7 @@ void SwHTMLWriter::OutBasic(const SwHTMLWriter & rHTMLWrt)
 
             const OUString& rModName = pModule->GetName();
             Strm().WriteOString( SAL_NEWLINE_STRING );   // don't indent!
-            HTMLOutFuncs::OutScript( Strm(), GetBaseURL(), 
pModule->GetSource32(),
+            HTMLOutFuncs::OutScript( Strm(), GetBaseURL(), 
pModule->GetSource(),
                                      sLang, STARBASIC, OUString(),
                                      &rLibName, &rModName );
         }

Reply via email to