sw/inc/section.hxx                 |    2 --
 sw/source/core/docnode/section.cxx |   19 +------------------
 sw/source/ui/dialog/uiregionsw.cxx |   21 +++++++++++++++++++--
 3 files changed, 20 insertions(+), 22 deletions(-)

New commits:
commit d7fbea57ef945c1444185581787d17a93dda8cd9
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed May 4 19:53:21 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu May 5 08:28:43 2022 +0200

    tdf#148299 Don't unmotivatedly mess with spaces in file names
    
    This conversion of double to single spaces had been done ever since
    84a3db80b4fd66c6854b3135b5f69b61fd828e62 "initial import", but it is 
unclear to
    me why.
    
    The same conversion functionality is also used at two places in
    sw/source/ui/dialog/uiregionsw.cxx.  Not sure if it has any motivation 
there, so
    lets keep that intact for now.
    
    Change-Id: I0558f015c53f69a9a405891b9dad21a98de3533c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133841
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx
index 2ead8c7c6e7d..67609057b13c 100644
--- a/sw/inc/section.hxx
+++ b/sw/inc/section.hxx
@@ -130,8 +130,6 @@ public:
 
     bool IsConnectFlag() const                  { return m_bConnectFlag; }
     void SetConnectFlag(bool const bFlag){ m_bConnectFlag = bFlag; }
-
-    static OUString CollapseWhiteSpaces(const OUString& sName);
 };
 
 class SW_DLLPUBLIC SwSection
diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index 2e33038596cd..b76b3ddeac3d 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -176,23 +176,6 @@ bool SwSectionData::operator==(SwSectionData const& 
rOther) const
     // FIXME: old code ignored m_bCondHiddenFlag m_bHiddenFlag m_bConnectFlag
 }
 
-OUString SwSectionData::CollapseWhiteSpaces(const OUString& sName)
-{
-    const sal_Int32 nLen = sName.getLength();
-    const sal_Unicode cRef = ' ';
-    OUStringBuffer aBuf(nLen+1);
-    for (sal_Int32 i = 0; i<nLen; )
-    {
-        const sal_Unicode cCur = sName[i++];
-        aBuf.append(cCur);
-        if (cCur!=cRef)
-            continue;
-        while (i<nLen && sName[i]==cRef)
-            ++i;
-    }
-    return aBuf.makeStringAndClear();
-}
-
 SwSection::SwSection(
         SectionType const eType, OUString const& rName, SwSectionFormat & 
rFormat)
     : SwClient(& rFormat)
@@ -1438,7 +1421,7 @@ void SwSection::CreateLink( LinkCreateType eCreateType )
     SwIntrnlSectRefLink *const pLnk =
         static_cast<SwIntrnlSectRefLink*>( m_RefLink.get() );
 
-    const OUString 
sCmd(SwSectionData::CollapseWhiteSpaces(m_Data.GetLinkFileName()));
+    const OUString sCmd(m_Data.GetLinkFileName());
     pLnk->SetUpdateMode( nUpdateType );
     pLnk->SetVisible( 
pFormat->GetDoc()->getIDocumentLinksAdministration().IsVisibleLinks() );
 
diff --git a/sw/source/ui/dialog/uiregionsw.cxx 
b/sw/source/ui/dialog/uiregionsw.cxx
index a06a060f2edc..f87bd7513136 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -73,6 +73,23 @@ OUString BuildBitmap(bool bProtect, bool bHidden)
     return bHidden ? OUString(RID_BMP_HIDE) : OUString(RID_BMP_NO_HIDE);
 }
 
+OUString CollapseWhiteSpaces(const OUString& sName)
+{
+    const sal_Int32 nLen = sName.getLength();
+    const sal_Unicode cRef = ' ';
+    OUStringBuffer aBuf(nLen+1);
+    for (sal_Int32 i = 0; i<nLen; )
+    {
+        const sal_Unicode cCur = sName[i++];
+        aBuf.append(cCur);
+        if (cCur!=cRef)
+            continue;
+        while (i<nLen && sName[i]==cRef)
+            ++i;
+    }
+    return aBuf.makeStringAndClear();
+}
+
 }
 
 static void   lcl_ReadSections( SfxMedium& rMedium, weld::ComboBox& rBox );
@@ -1099,7 +1116,7 @@ IMPL_LINK(SwEditRegionDlg, FileNameEntryHdl, 
weld::Entry&, rEdit, void)
     m_bSubRegionsFilled = false;
     if (m_xDDECB->get_active())
     {
-        OUString sLink( SwSectionData::CollapseWhiteSpaces(rEdit.get_text()) );
+        OUString sLink( CollapseWhiteSpaces(rEdit.get_text()) );
         sal_Int32 nPos = 0;
         sLink = sLink.replaceFirst( " ", OUStringChar(sfx2::cTokenSeparator), 
&nPos );
         if (nPos>=0)
@@ -1539,7 +1556,7 @@ bool SwInsertSectionTabPage::FillItemSet( SfxItemSet* )
         OUString aLinkFile;
         if( bDDe )
         {
-            aLinkFile = SwSectionData::CollapseWhiteSpaces(sFileName);
+            aLinkFile = CollapseWhiteSpaces(sFileName);
             sal_Int32 nPos = 0;
             aLinkFile = aLinkFile.replaceFirst( " ", 
OUStringChar(sfx2::cTokenSeparator), &nPos );
             if (nPos>=0)

Reply via email to