From fc0d57b7aff84f4bdca0a1f201527c265d5f0cf5 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 6 Nov 2014 17:24:13 +0100 Subject: Revert "use the new OUString::fromUtf8 method" This reverts commit 05050cdb23de586870bf479a9df5ced06828d498, not all places that use e.g. OStringToOUString to convert potential UTF-8 are guaranteed to fulfil the prerequisites necessary to use fromUtf8 (and some places like e.g. in codemaker are happy with the best-effort effect of OStringToOUString's OSTRING_TO_OUSTRING_CVTFLAGS). --- sfx2/source/appl/childwin.cxx | 2 +- sfx2/source/appl/sfxhelp.cxx | 6 +++--- sfx2/source/appl/shutdownicon.cxx | 3 ++- sfx2/source/appl/shutdowniconunx.cxx | 3 ++- sfx2/source/bastyp/helper.cxx | 2 +- sfx2/source/bastyp/mieclip.cxx | 2 +- sfx2/source/bastyp/sfxhtml.cxx | 2 +- sfx2/source/control/msg.cxx | 2 +- sfx2/source/dialog/basedlgs.cxx | 10 ++++++---- sfx2/source/dialog/filedlghelper.cxx | 4 ++-- sfx2/source/dialog/tabdlg.cxx | 12 +++++++----- 11 files changed, 27 insertions(+), 21 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index ba98e80d29a5..e2cb96804f0d 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -292,7 +292,7 @@ void SfxChildWindow::SaveStatus(const SfxChildWinInfo& rInfo) if (!rInfo.aModule.isEmpty()) sName = rInfo.aModule + "/" + sName; SvtViewOptions aWinOpt(E_WINDOW, sName); - aWinOpt.SetWindowState(OUString::fromUtf8(rInfo.aWinState)); + aWinOpt.SetWindowState(OStringToOUString(rInfo.aWinState, RTL_TEXTENCODING_UTF8)); ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); aSeq[0].Name = "Data"; diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 612f98531782..e9cab42faad7 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -455,7 +455,7 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* p while ( pParent ) { aNewHelpId = pParent->GetHelpId(); - sHelpText = SfxHelp_Impl::GetHelpText( OUString::fromUtf8(aNewHelpId), sModuleName ); + sHelpText = SfxHelp_Impl::GetHelpText( OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8), sModuleName ); if (!sHelpText.isEmpty()) pParent = NULL; else @@ -476,7 +476,7 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* p if ( !aNewHelpId.isEmpty() ) { sHelpText += " - "; - sHelpText += OUString::fromUtf8(aNewHelpId); + sHelpText += OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8); } } @@ -568,7 +568,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const while ( pParent ) { OString aHelpId = pParent->GetHelpId(); - aHelpURL = CreateHelpURL( OUString::fromUtf8(aHelpId), aHelpModuleName ); + aHelpURL = CreateHelpURL( OStringToOUString(aHelpId, RTL_TEXTENCODING_UTF8), aHelpModuleName ); if ( !SfxContentHelper::IsHelpErrorDocument( aHelpURL ) ) { break; diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index ab4736b8ef45..f8f0e2a42ab1 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -730,7 +730,8 @@ static OUString getAutostartDir( bool bCreate = false ) OUString aShortcut; const char *pConfigHome; if( (pConfigHome = getenv("XDG_CONFIG_HOME") ) ) - aShortcut = OUString::fromUtf8( OString( pConfigHome ) ); + aShortcut = OStringToOUString( OString( pConfigHome ), + RTL_TEXTENCODING_UTF8 ); else { OUString aHomeURL; diff --git a/sfx2/source/appl/shutdowniconunx.cxx b/sfx2/source/appl/shutdowniconunx.cxx index a5da0de290a1..b716f56d8724 100644 --- a/sfx2/source/appl/shutdowniconunx.cxx +++ b/sfx2/source/appl/shutdowniconunx.cxx @@ -164,7 +164,8 @@ static void add_item( GtkMenuShell *pMenuShell, const char *pAsciiURL, OUString *pOverrideLabel, sal_uInt16 nResId, GCallback pFnCallback ) { - OUString *pURL = new OUString (OUString::fromUtf8( pAsciiURL )); + OUString *pURL = new OUString (OStringToOUString( pAsciiURL, + RTL_TEXTENCODING_UTF8 )); OString aLabel; if (pOverrideLabel) aLabel = OUStringToOString (*pOverrideLabel, RTL_TEXTENCODING_UTF8); diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index de879ad93d73..e00e6cb266d5 100644 --- a/sfx2/source/bastyp/helper.cxx +++ b/sfx2/source/bastyp/helper.cxx @@ -207,7 +207,7 @@ OUString SfxContentHelper::GetActiveHelpString( const OUString& rURL ) while ( nRead > 0 ) { OString sOldString( (sal_Char*)lData.getConstArray(), nRead ); - OUString sString = OUString::fromUtf8( sOldString ); + OUString sString = OStringToOUString( sOldString, RTL_TEXTENCODING_UTF8 ); aRet.append( sString ); nRead = xStream->readBytes( lData, 1024 ); diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx index 18b94389a9fb..8fcc660e7618 100644 --- a/sfx2/source/bastyp/mieclip.cxx +++ b/sfx2/source/bastyp/mieclip.cxx @@ -60,7 +60,7 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream ) else if (sTmp == "EndFragment") nFragEnd = sLine.copy(nIndex).toInt32(); else if (sTmp == "SourceURL") - sBaseURL = OUString::fromUtf8( sLine.copy(nIndex) ); + sBaseURL = OStringToOUString( sLine.copy(nIndex), RTL_TEXTENCODING_UTF8 ); if (nEnd >= 0 && nStt >= 0 && (!sBaseURL.isEmpty() || rStream.Tell() >= static_cast(nStt))) diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index 1503ed1c3f32..8549e9b7c64a 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -254,7 +254,7 @@ bool SfxHTMLParser::FinishFileDownload( OUString& rStr ) sal_Size nLen = aStream.Tell(); aStream.Seek( 0 ); OString sBuffer = read_uInt8s_ToOString(aStream, nLen); - rStr = OUString::fromUtf8( sBuffer ); + rStr = OStringToOUString( sBuffer, RTL_TEXTENCODING_UTF8 ); } delete pDLMedium; diff --git a/sfx2/source/control/msg.cxx b/sfx2/source/control/msg.cxx index de7c107160f5..4fc4cbf18e93 100644 --- a/sfx2/source/control/msg.cxx +++ b/sfx2/source/control/msg.cxx @@ -59,7 +59,7 @@ OString SfxSlot::GetCommand() const OUString SfxSlot::GetCommandString() const { - return OUString::fromUtf8(GetCommand()); + return OStringToOUString(GetCommand(), RTL_TEXTENCODING_UTF8); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 75845925c128..b8a3a7419596 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -101,7 +101,7 @@ void SfxModalDialog::SetDialogData_Impl() // save settings (position and user data) OUString sConfigId; if (isLayoutEnabled()) - sConfigId = OUString::fromUtf8(GetHelpId()); + sConfigId = OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8); else { SAL_WARN("sfx.config", "Dialog needs to be converted to .ui format"); @@ -128,7 +128,7 @@ void SfxModalDialog::GetDialogData_Impl() { OUString sConfigId; if (isLayoutEnabled()) - sConfigId = OUString::fromUtf8(GetHelpId()); + sConfigId = OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8); else { SAL_WARN("sfx.config", "Dialog needs to be converted to .ui format"); @@ -654,7 +654,8 @@ IMPL_LINK_NOARG(SfxSingleTabDialog, OKHdl_Impl) pImpl->m_pSfxPage->FillUserData(); OUString sData( pImpl->m_pSfxPage->GetUserData() ); - OUString sConfigId = OUString::fromUtf8(pImpl->m_pSfxPage->GetConfigId()); + OUString sConfigId = OStringToOUString(pImpl->m_pSfxPage->GetConfigId(), + RTL_TEXTENCODING_UTF8); if (sConfigId.isEmpty()) { SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format"); @@ -723,7 +724,8 @@ void SfxSingleTabDialog::SetTabPage(SfxTabPage* pTabPage, if ( pImpl->m_pSfxPage ) { // First obtain the user data, only then Reset() - OUString sConfigId = OUString::fromUtf8(pImpl->m_pSfxPage->GetConfigId()); + OUString sConfigId = OStringToOUString(pImpl->m_pSfxPage->GetConfigId(), + RTL_TEXTENCODING_UTF8); if (sConfigId.isEmpty()) { SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format"); diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 25d91ae3d4b1..18da893e5823 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -271,7 +271,7 @@ OUString FileDialogHelper_Impl::handleHelpRequested( const FilePickerEvent& aEve OUString aHelpText; Help* pHelp = Application::GetHelp(); if ( pHelp ) - aHelpText = pHelp->GetHelpText( OUString::fromUtf8(sHelpId), NULL ); + aHelpText = pHelp->GetHelpText( OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), NULL ); return aHelpText; } @@ -1143,7 +1143,7 @@ void FileDialogHelper_Impl::setControlHelpIds( const sal_Int16* _pControlId, con { while ( *_pControlId ) { - DBG_ASSERT( INetURLObject( OUString::fromUtf8( *_pHelpId ) ).GetProtocol() == INET_PROT_NOT_VALID, "Wrong HelpId!" ); + DBG_ASSERT( INetURLObject( OStringToOUString( *_pHelpId, RTL_TEXTENCODING_UTF8 ) ).GetProtocol() == INET_PROT_NOT_VALID, "Wrong HelpId!" ); OUString sId( sHelpIdPrefix ); sId += OUString( *_pHelpId, strlen( *_pHelpId ), RTL_TEXTENCODING_UTF8 ); xControlAccess->setValue( *_pControlId, ControlActions::SET_HELP_URL, makeAny( sId ) ); diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index d71f62d466ba..34338673e9ba 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -377,7 +377,8 @@ SfxTabDialog::~SfxTabDialog() if ( !aPageData.isEmpty() ) { // save settings of all pages (user data) - OUString sConfigId = OUString::fromUtf8(pDataObject->pTabPage->GetConfigId()); + OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(), + RTL_TEXTENCODING_UTF8); if (sConfigId.isEmpty()) { SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format"); @@ -554,7 +555,7 @@ void SfxTabDialog::Start_Impl() sal_uInt16 nActPage = m_pTabCtrl->GetPageId( 0 ); // load old settings, when exists - SvtViewOptions aDlgOpt(E_TABDIALOG, OUString::fromUtf8(GetHelpId())); + SvtViewOptions aDlgOpt(E_TABDIALOG, OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8)); if ( aDlgOpt.Exists() ) { SetWindowState(OUStringToOString(aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US)); @@ -673,7 +674,8 @@ void SfxTabDialog::RemoveTabPage( sal_uInt16 nId ) if ( !aPageData.isEmpty() ) { // save settings of this page (user data) - OUString sConfigId = OUString::fromUtf8(pDataObject->pTabPage->GetConfigId()); + OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(), + RTL_TEXTENCODING_UTF8); if (sConfigId.isEmpty()) { SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format"); @@ -756,7 +758,7 @@ SfxTabPage* SfxTabDialog::GetTabPage( sal_uInt16 nPageId ) const void SfxTabDialog::SavePosAndId() { // save settings (screen position and current page) - SvtViewOptions aDlgOpt(E_TABDIALOG, OUString::fromUtf8(GetHelpId())); + SvtViewOptions aDlgOpt(E_TABDIALOG, OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8)); aDlgOpt.SetWindowState(OStringToOUString(GetWindowState(WINDOWSTATE_MASK_POS),RTL_TEXTENCODING_ASCII_US)); // to-do replace with name of page when all pages are converted to .ui aDlgOpt.SetPageID( m_pTabCtrl->GetCurPageId() ); @@ -1125,7 +1127,7 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl ) DBG_ASSERT( NULL == pDataObject->pTabPage, "create TabPage more than once" ); pDataObject->pTabPage = pTabPage; - OUString sConfigId = OUString::fromUtf8(pTabPage->GetConfigId()); + OUString sConfigId = OStringToOUString(pTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8); if (sConfigId.isEmpty()) { SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format"); -- cgit v1.2.3