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

Andreas Heinisch (via logerrit) logerrit at kemper.freedesktop.org
Tue May 25 10:56:00 UTC 2021


 sc/source/ui/vba/vbawindow.cxx |   34 ++--------------------------------
 1 file changed, 2 insertions(+), 32 deletions(-)

New commits:
commit b2f7187e04a6b6c6183b42230a0119569f069dcf
Author:     Andreas Heinisch <andreas.heinisch at yahoo.de>
AuthorDate: Thu Jan 7 22:51:54 2021 +0100
Commit:     Andreas Heinisch <andreas.heinisch at yahoo.de>
CommitDate: Tue May 25 12:55:22 2021 +0200

    tdf#118129 - return only the caption property of the frame
    
    Change-Id: I3dc875d54c49f233e2784dcd778c2b6fc42e59cd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108958
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heinisch at yahoo.de>

diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx
index ec76e2aca68b..1691fbbc3bf3 100644
--- a/sc/source/ui/vba/vbawindow.cxx
+++ b/sc/source/ui/vba/vbawindow.cxx
@@ -301,39 +301,9 @@ ScVbaWindow::ScrollWorkbookTabs( const uno::Any& /*Sheets*/, const uno::Any& /*P
 uno::Any SAL_CALL
 ScVbaWindow::getCaption()
 {
-    static const char sCrud[] = " - OpenOffice.org Calc";
-    static const sal_Int32 nCrudLen = strlen(sCrud);
-
+    // tdf#118129 - return only the caption property of the frame
     OUString sTitle;
-    getFrameProps()->getPropertyValue( SC_UNONAME_TITLE ) >>= sTitle;
-    sal_Int32 nCrudIndex = sTitle.indexOf( sCrud );
-    // adjust title ( by removing crud )
-    // sCrud string present
-    if ( nCrudIndex != -1 )
-    {
-        // and ends with sCrud
-        if ( ( nCrudLen + nCrudIndex ) == sTitle.getLength() )
-        {
-            sTitle = sTitle.copy( 0, nCrudIndex );
-            rtl::Reference< ScVbaWorkbook > workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) );
-            OUString sName = workbook->getName();
-            // rather bizarre hack to make sure the name behavior
-            // is like XL
-            // if the adjusted title == workbook name, use name
-            // if the adjusted title != workbook name but ...
-            //  name == title + extension ( .csv, ,odt, .xls )
-            //  etc. then also use the name
-
-            if ( sTitle != sName )
-            {
-                // starts with title
-                if ( sName.startsWith( sTitle ) )
-                    // extension starts immediately after
-                    if ( sName.match( ".", sTitle.getLength() ) )
-                        sTitle = sName;
-            }
-        }
-    }
+    getFrameProps()->getPropertyValue(SC_UNONAME_TITLE) >>= sTitle;
     return uno::makeAny( sTitle );
 }
 


More information about the Libreoffice-commits mailing list