Kaydet (Commit) 801cb231 authored tarafından Miklos Vajna's avatar Miklos Vajna

Add rtl::OUString::fromUtf8()

Note that this should be used only at places legitimately assuming that
the OString contains valid UTF-8.

Change-Id: I9e8ecef9928975fe0737553f5b2a19ff2dd40861
üst 2bd1896e
...@@ -2074,6 +2074,26 @@ public: ...@@ -2074,6 +2074,26 @@ public:
pData, indexUtf16, incrementCodePoints); pData, indexUtf16, incrementCodePoints);
} }
/**
* Convert an OString to an OUString, assuming that the OString is
* UTF-8-encoded.
*
* @param rStr
* an OString to convert
*
* @param convertFlags
* flags which control the conversion.
*
* @see rtl::OStringToOUString for more info on convertFlags.
*
* @since LibreOffice 4.4
*/
static inline OUString fromUtf8(const OString& rStr,
sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS)
{
return OUString(rStr.getStr(), rStr.getLength(), RTL_TEXTENCODING_UTF8, convertFlags);
}
/** /**
Returns the string representation of the integer argument. Returns the string representation of the integer argument.
......
...@@ -55,7 +55,7 @@ SwFrmDlg::SwFrmDlg( SfxViewFrame* pViewFrame, ...@@ -55,7 +55,7 @@ SwFrmDlg::SwFrmDlg( SfxViewFrame* pViewFrame,
: SfxTabDialog(pViewFrame, pParent, sResType, : SfxTabDialog(pViewFrame, pParent, sResType,
OUString("modules/swriter/ui/") + OUString("modules/swriter/ui/") +
OStringToOUString(sResType.toAsciiLowerCase(), RTL_TEXTENCODING_UTF8) + OUString::fromUtf8(sResType.toAsciiLowerCase()) +
(".ui"), &rCoreSet, pStr != 0) (".ui"), &rCoreSet, pStr != 0)
, m_bFormat(bFormat) , m_bFormat(bFormat)
, m_bNew(bNewFrm) , m_bNew(bNewFrm)
......
...@@ -934,7 +934,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u ...@@ -934,7 +934,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u
OUStringBuffer sHelpURL; OUStringBuffer sHelpURL;
sHelpURL.appendAscii ( INET_HID_SCHEME ); sHelpURL.appendAscii ( INET_HID_SCHEME );
SwEditWin &rEditWin = pView->GetEditWin(); SwEditWin &rEditWin = pView->GetEditWin();
sHelpURL.append( OStringToOUString( rEditWin.GetHelpId(), RTL_TEXTENCODING_UTF8 ) ); sHelpURL.append( OUString::fromUtf8( rEditWin.GetHelpId() ) );
rValue <<= sHelpURL.makeStringAndClear(); rValue <<= sHelpURL.makeStringAndClear();
} }
else else
......
...@@ -374,7 +374,7 @@ void SwWrtShell::InsertObject( const svt::EmbeddedObjectRef& xRef, SvGlobalName ...@@ -374,7 +374,7 @@ void SwWrtShell::InsertObject( const svt::EmbeddedObjectRef& xRef, SvGlobalName
aCmd += pSlot->GetUnoName(); aCmd += pSlot->GetUnoName();
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
boost::scoped_ptr<SfxAbstractInsertObjectDialog> pDlg( boost::scoped_ptr<SfxAbstractInsertObjectDialog> pDlg(
pFact->CreateInsertObjectDialog( GetWin(), OStringToOUString( aCmd, RTL_TEXTENCODING_UTF8 ), xStor, &aServerList )); pFact->CreateInsertObjectDialog( GetWin(), OUString::fromUtf8( aCmd ), xStor, &aServerList ));
if ( pDlg ) if ( pDlg )
{ {
pDlg->Execute(); pDlg->Execute();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment