summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tools/urlobj.hxx12
-rw-r--r--sot/source/sdstor/ucbstorage.cxx2
-rw-r--r--svl/source/misc/lockfilecommon.cxx2
-rw-r--r--svl/source/misc/msodocumentlockfile.cxx2
-rw-r--r--svtools/source/contnr/fileview.cxx2
-rw-r--r--svtools/source/control/inettbc.cxx4
-rw-r--r--tools/source/fsys/urlobj.cxx17
7 files changed, 16 insertions, 25 deletions
diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx
index f72f2521a2b2..a1244bd7eba6 100644
--- a/include/tools/urlobj.hxx
+++ b/include/tools/urlobj.hxx
@@ -574,12 +574,18 @@ public:
@param rTheName The new name.
+ @param eMechanism See the general discussion for get-methods.
+
+ @param eCharset See the general discussion for get-methods.
+
@return True if the name has successfully been modified (and the
resulting URI is still valid). If the path is not hierarchical, or
the specified segment does not exist, false is returned. If false is
returned, the object is not modified.
*/
- bool setName(OUString const & rTheName);
+ bool setName(OUString const& rTheName,
+ EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
/** Get the base of the name of a segment.
@@ -926,10 +932,6 @@ public:
OUString GetBase() const;
- void SetName(OUString const & rTheName,
- EncodeMechanism eMechanism = EncodeMechanism::WasEncoded,
- rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
-
void SetExtension(OUString const & rTheExtension);
OUString CutExtension();
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index b732faef2734..a4c754610229 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1050,7 +1050,7 @@ sal_Int16 UCBStorageStream_Impl::Commit()
m_aTempURL.clear();
INetURLObject aObj( m_aURL );
- aObj.SetName( m_aName );
+ aObj.setName( m_aName );
m_aURL = aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
m_bModified = false;
m_bSourceRead = true;
diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx
index 9a3cb0c7abe0..e27c1113d975 100644
--- a/svl/source/misc/lockfilecommon.cxx
+++ b/svl/source/misc/lockfilecommon.cxx
@@ -72,7 +72,7 @@ void LockFileCommon::SetURL(const OUString& aURL)
OUString LockFileCommon::GenerateOwnLockFileURL(const OUString& aOrigURL, const OUString& aPrefix)
{
INetURLObject aURL = ResolveLinks(INetURLObject(aOrigURL));
- aURL.SetName(aPrefix + aURL.GetLastName() + "%23" /*'#'*/);
+ aURL.setName(aPrefix + aURL.GetLastName() + "%23" /*'#'*/);
return aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
}
diff --git a/svl/source/misc/msodocumentlockfile.cxx b/svl/source/misc/msodocumentlockfile.cxx
index cdb4ddd2264f..9650db03999f 100644
--- a/svl/source/misc/msodocumentlockfile.cxx
+++ b/svl/source/misc/msodocumentlockfile.cxx
@@ -56,7 +56,7 @@ OUString GenerateMSOLockFileURL(const OUString& aOrigURL)
else if (nFileNameLength == 7)
sFileName = sFileName.copy(1);
}
- aURL.SetName("~$" + sFileName);
+ aURL.setName("~$" + sFileName);
return aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
}
}
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 3cf1bfab180b..9f7b6c14b6bd 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1846,7 +1846,7 @@ void SvtFileView_Impl::EntryRenamed( OUString& rURL,
(*aFoundElem)->maDisplayText = aDisplayText.replaceAt( 0, nIndex, rTitle );
INetURLObject aURLObj( rURL );
- aURLObj.SetName( rTitle, INetURLObject::EncodeMechanism::All );
+ aURLObj.setName( rTitle, INetURLObject::EncodeMechanism::All );
rURL = aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index a2ef57c6116a..eff7b67fcb47 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -1779,7 +1779,7 @@ OUString SvtURLBox::GetURL()
if( success && aTitle != "/" && aTitle != "." )
{
- aObj.SetName( aTitle );
+ aObj.setName( aTitle );
if ( bSlash )
aObj.setFinalSlash();
}
@@ -2214,7 +2214,7 @@ OUString URLBox::GetURL()
if( success && aTitle != "/" && aTitle != "." )
{
- aObj.SetName( aTitle );
+ aObj.setName( aTitle );
if ( bSlash )
aObj.setFinalSlash();
}
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 7ee92a3382b6..980619ea5d26 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -3999,7 +3999,8 @@ OUString INetURLObject::getName(sal_Int32 nIndex, bool bIgnoreFinalSlash,
return decode(pSegBegin, p, eMechanism, eCharset);
}
-bool INetURLObject::setName(OUString const & rTheName)
+bool INetURLObject::setName(OUString const& rTheName, EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
{
SubString aSegment(getSegment(LAST_SEGMENT, true));
if (!aSegment.isPresent())
@@ -4020,8 +4021,7 @@ bool INetURLObject::setName(OUString const & rTheName)
OUStringBuffer aNewPath;
aNewPath.append(pPathBegin, pSegBegin - pPathBegin);
- aNewPath.append(encodeText(rTheName, PART_PCHAR,
- EncodeMechanism::WasEncoded, RTL_TEXTENCODING_UTF8, true));
+ aNewPath.append(encodeText(rTheName, PART_PCHAR, eMechanism, eCharset, true));
aNewPath.append(p, pPathEnd - p);
return setPath(aNewPath.makeStringAndClear(), EncodeMechanism::NotCanonical,
@@ -4919,17 +4919,6 @@ OUString INetURLObject::GetBase() const
return getBase(LAST_SEGMENT, true, DecodeMechanism::WithCharset);
}
-void INetURLObject::SetName(OUString const & rTheName,
- EncodeMechanism eMechanism,
- rtl_TextEncoding eCharset)
-{
- INetURLObject aTemp(*this);
- if (aTemp.removeSegment()
- && aTemp.insertName(rTheName, false, LAST_SEGMENT, eMechanism,
- eCharset))
- *this = aTemp;
-}
-
void INetURLObject::SetExtension(OUString const & rTheExtension)
{
setExtension(rTheExtension, LAST_SEGMENT, false);