[Libreoffice-commits] core.git: include/rtl sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Nov 5 05:46:08 PST 2014
include/rtl/ustring.hxx | 20 ++++++++++++++++++++
sw/source/ui/frmdlg/frmdlg.cxx | 2 +-
sw/source/uibase/uno/unomod.cxx | 2 +-
sw/source/uibase/wrtsh/wrtsh1.cxx | 2 +-
4 files changed, 23 insertions(+), 3 deletions(-)
New commits:
commit 801cb231f2e2b43f4befd9575e23da58d764c600
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Nov 5 12:07:44 2014 +0100
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
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index f59d646..4550869 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -2075,6 +2075,26 @@ public:
}
/**
+ * 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.
This function can't be used for language specific conversion.
diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx
index cd62318..2213373d 100644
--- a/sw/source/ui/frmdlg/frmdlg.cxx
+++ b/sw/source/ui/frmdlg/frmdlg.cxx
@@ -55,7 +55,7 @@ SwFrmDlg::SwFrmDlg( SfxViewFrame* pViewFrame,
: SfxTabDialog(pViewFrame, pParent, sResType,
OUString("modules/swriter/ui/") +
- OStringToOUString(sResType.toAsciiLowerCase(), RTL_TEXTENCODING_UTF8) +
+ OUString::fromUtf8(sResType.toAsciiLowerCase()) +
(".ui"), &rCoreSet, pStr != 0)
, m_bFormat(bFormat)
, m_bNew(bNewFrm)
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index a0b27cd..2614c35 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -934,7 +934,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u
OUStringBuffer sHelpURL;
sHelpURL.appendAscii ( INET_HID_SCHEME );
SwEditWin &rEditWin = pView->GetEditWin();
- sHelpURL.append( OStringToOUString( rEditWin.GetHelpId(), RTL_TEXTENCODING_UTF8 ) );
+ sHelpURL.append( OUString::fromUtf8( rEditWin.GetHelpId() ) );
rValue <<= sHelpURL.makeStringAndClear();
}
else
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index fc31080..aa58f59 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -374,7 +374,7 @@ void SwWrtShell::InsertObject( const svt::EmbeddedObjectRef& xRef, SvGlobalName
aCmd += pSlot->GetUnoName();
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
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 )
{
pDlg->Execute();
More information about the Libreoffice-commits
mailing list