Kaydet (Commit) 3a5ae29f authored tarafından Ivan Timofeev's avatar Ivan Timofeev

String -> OUString

Change-Id: I5b577a8e0675d7849ca22e24bb99ee2d8602ae6a
üst f0cd6fe9
...@@ -126,12 +126,12 @@ static OUString HelpLocaleString() ...@@ -126,12 +126,12 @@ static OUString HelpLocaleString()
if (!osl::DirectoryItem::get(sHelpPath, aDirItem) == osl::FileBase::E_None) if (!osl::DirectoryItem::get(sHelpPath, aDirItem) == osl::FileBase::E_None)
{ {
bOk = false; bOk = false;
String sLang(aLocaleStr); OUString sLang(aLocaleStr);
xub_StrLen nSepPos = sLang.Search( '-' ); sal_Int32 nSepPos = sLang.indexOf( '-' );
if (nSepPos != STRING_NOTFOUND) if (nSepPos != -1)
{ {
bOk = true; bOk = true;
sLang = sLang.Copy( 0, nSepPos ); sLang = sLang.copy( 0, nSepPos );
sHelpPath = aBaseInstallPath + sHelpPath = aBaseInstallPath +
OUString::createFromAscii(szHelpPath) + sLang; OUString::createFromAscii(szHelpPath) + sLang;
if (!osl::DirectoryItem::get(sHelpPath, aDirItem) == osl::FileBase::E_None) if (!osl::DirectoryItem::get(sHelpPath, aDirItem) == osl::FileBase::E_None)
...@@ -185,7 +185,7 @@ sal_Bool GetHelpAnchor_Impl( const OUString& _rURL, OUString& _rAnchor ) ...@@ -185,7 +185,7 @@ sal_Bool GetHelpAnchor_Impl( const OUString& _rURL, OUString& _rAnchor )
if ( !sAnchor.isEmpty() ) if ( !sAnchor.isEmpty() )
{ {
_rAnchor = String( sAnchor ); _rAnchor = sAnchor;
bRet = sal_True; bRet = sal_True;
} }
} }
...@@ -307,7 +307,7 @@ public: ...@@ -307,7 +307,7 @@ public:
~SfxHelp_Impl(); ~SfxHelp_Impl();
SfxHelpOptions_Impl* GetOptions(); SfxHelpOptions_Impl* GetOptions();
static String GetHelpText( const OUString& aCommandURL, const String& rModule ); static OUString GetHelpText( const OUString& aCommandURL, const OUString& rModule );
}; };
SfxHelp_Impl::SfxHelp_Impl() : SfxHelp_Impl::SfxHelp_Impl() :
...@@ -322,14 +322,17 @@ SfxHelp_Impl::~SfxHelp_Impl() ...@@ -322,14 +322,17 @@ SfxHelp_Impl::~SfxHelp_Impl()
delete m_pOpt; delete m_pOpt;
} }
String SfxHelp_Impl::GetHelpText( const OUString& aCommandURL, const String& rModule ) OUString SfxHelp_Impl::GetHelpText( const OUString& aCommandURL, const OUString& rModule )
{ {
// create help url // create help url
String aHelpURL = SfxHelp::CreateHelpURL( aCommandURL, rModule ); OUStringBuffer aHelpURL( SfxHelp::CreateHelpURL( aCommandURL, rModule ) );
// added 'active' parameter // added 'active' parameter
aHelpURL.Insert( String( "&Active=true" ), aHelpURL.SearchBackward( '#' ) ); sal_Int32 nIndex = aHelpURL.lastIndexOf( '#' );
if ( nIndex < 0 )
nIndex = aHelpURL.getLength();
aHelpURL.insert( nIndex, "&Active=true" );
// load help string // load help string
return SfxContentHelper::GetActiveHelpString( aHelpURL ); return SfxContentHelper::GetActiveHelpString( aHelpURL.makeStringAndClear() );
} }
SfxHelpOptions_Impl* SfxHelp_Impl::GetOptions() SfxHelpOptions_Impl* SfxHelp_Impl::GetOptions()
...@@ -619,13 +622,13 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const Window* pWindo ...@@ -619,13 +622,13 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const Window* pWindo
if ( bIsDebug ) if ( bIsDebug )
{ {
sHelpText += "\n-------------\n"; sHelpText += "\n-------------\n";
sHelpText += String( sModuleName ); sHelpText += sModuleName;
sHelpText += ": "; sHelpText += ": ";
sHelpText += aCommandURL; sHelpText += aCommandURL;
if ( !aNewHelpId.isEmpty() ) if ( !aNewHelpId.isEmpty() )
{ {
sHelpText += " - "; sHelpText += " - ";
sHelpText += String(OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8)); sHelpText += OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8);
} }
} }
...@@ -644,7 +647,7 @@ static bool impl_hasHelpInstalled( const OUString &rLang = OUString() ) ...@@ -644,7 +647,7 @@ static bool impl_hasHelpInstalled( const OUString &rLang = OUString() )
sal_Bool SfxHelp::SearchKeyword( const OUString& rKeyword ) sal_Bool SfxHelp::SearchKeyword( const OUString& rKeyword )
{ {
return Start_Impl( String(), NULL, rKeyword ); return Start_Impl( OUString(), NULL, rKeyword );
} }
sal_Bool SfxHelp::Start( const OUString& rURL, const Window* pWindow ) sal_Bool SfxHelp::Start( const OUString& rURL, const Window* pWindow )
...@@ -653,14 +656,14 @@ sal_Bool SfxHelp::Start( const OUString& rURL, const Window* pWindow ) ...@@ -653,14 +656,14 @@ sal_Bool SfxHelp::Start( const OUString& rURL, const Window* pWindow )
} }
/// Redirect the vnd.sun.star.help:// urls to http://help.libreoffice.org /// Redirect the vnd.sun.star.help:// urls to http://help.libreoffice.org
static bool impl_showOnlineHelp( const String& rURL ) static bool impl_showOnlineHelp( const OUString& rURL )
{ {
String aInternal( "vnd.sun.star.help://" ); OUString aInternal( "vnd.sun.star.help://" );
if ( rURL.Len() <= aInternal.Len() || rURL.Copy( 0, aInternal.Len() ) != aInternal ) if ( rURL.getLength() <= aInternal.getLength() || !rURL.startsWith(aInternal) )
return false; return false;
OUString aHelpLink( "http://help.libreoffice.org/" ); OUString aHelpLink( "http://help.libreoffice.org/" );
aHelpLink += rURL.Copy( aInternal.Len() ); aHelpLink += rURL.copy( aInternal.getLength() );
try try
{ {
Reference< XSystemShellExecute > xSystemShell( Reference< XSystemShellExecute > xSystemShell(
...@@ -692,10 +695,10 @@ sal_Bool SfxHelp::Start_Impl(const OUString& rURL, const Window* pWindow, const ...@@ -692,10 +695,10 @@ sal_Bool SfxHelp::Start_Impl(const OUString& rURL, const Window* pWindow, const
Help keyword search now is implemented as own method; in former versions it Help keyword search now is implemented as own method; in former versions it
was done via Help::Start, but this implementation conflicted with the upward search. was done via Help::Start, but this implementation conflicted with the upward search.
*/ */
String aHelpURL; OUString aHelpURL;
INetURLObject aParser( rURL ); INetURLObject aParser( rURL );
INetProtocol nProtocol = aParser.GetProtocol(); INetProtocol nProtocol = aParser.GetProtocol();
String aHelpModuleName( GetHelpModuleName_Impl() ); OUString aHelpModuleName( GetHelpModuleName_Impl() );
switch ( nProtocol ) switch ( nProtocol )
{ {
...@@ -727,7 +730,7 @@ sal_Bool SfxHelp::Start_Impl(const OUString& rURL, const Window* pWindow, const ...@@ -727,7 +730,7 @@ sal_Bool SfxHelp::Start_Impl(const OUString& rURL, const Window* pWindow, const
if (!pParent) if (!pParent)
{ {
// create help url of start page ( helpid == 0 -> start page) // create help url of start page ( helpid == 0 -> start page)
aHelpURL = CreateHelpURL( String(), aHelpModuleName ); aHelpURL = CreateHelpURL( OUString(), aHelpModuleName );
} }
else if (pParent->IsDialog() && !bTriedTabPage) else if (pParent->IsDialog() && !bTriedTabPage)
{ {
......
...@@ -248,9 +248,9 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin ...@@ -248,9 +248,9 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
String SfxContentHelper::GetActiveHelpString( const String& rURL ) OUString SfxContentHelper::GetActiveHelpString( const OUString& rURL )
{ {
String aRet; OUStringBuffer aRet;
try try
{ {
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
...@@ -268,7 +268,7 @@ String SfxContentHelper::GetActiveHelpString( const String& rURL ) ...@@ -268,7 +268,7 @@ String SfxContentHelper::GetActiveHelpString( const String& rURL )
for( sal_Int32 i = 0; i < nRead; ++i ) for( sal_Int32 i = 0; i < nRead; ++i )
sBuffer.append( (sal_Char)lData[i] ); sBuffer.append( (sal_Char)lData[i] );
OUString sString = OStringToOUString( sBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); OUString sString = OStringToOUString( sBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
aRet += String( sString ); aRet.append( sString );
nRead = xStream->readBytes( lData, 1024 ); nRead = xStream->readBytes( lData, 1024 );
} }
...@@ -277,12 +277,12 @@ String SfxContentHelper::GetActiveHelpString( const String& rURL ) ...@@ -277,12 +277,12 @@ String SfxContentHelper::GetActiveHelpString( const String& rURL )
{ {
} }
return aRet; return aRet.makeStringAndClear();
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
sal_Bool SfxContentHelper::IsHelpErrorDocument( const String& rURL ) sal_Bool SfxContentHelper::IsHelpErrorDocument( const OUString& rURL )
{ {
sal_Bool bRet = sal_False; sal_Bool bRet = sal_False;
try try
......
...@@ -34,8 +34,8 @@ public: ...@@ -34,8 +34,8 @@ public:
GetResultSet( const String& rURL ); GetResultSet( const String& rURL );
static ::com::sun::star::uno::Sequence< ::rtl::OUString > static ::com::sun::star::uno::Sequence< ::rtl::OUString >
GetHelpTreeViewContents( const String& rURL ); GetHelpTreeViewContents( const String& rURL );
static String GetActiveHelpString( const String& rURL ); static OUString GetActiveHelpString( const OUString& rURL );
static sal_Bool IsHelpErrorDocument( const String& rURL ); static sal_Bool IsHelpErrorDocument( const OUString& rURL );
static sal_uIntPtr GetSize( const String& rContent ); static sal_uIntPtr GetSize( const String& rContent );
}; };
......
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