Kaydet (Commit) d67dff57 authored tarafından Caolán McNamara's avatar Caolán McNamara

XubString->OUString

Change-Id: Id64cdd70c2877ff71c5bc90286fab6b3d8ab7ad4
üst 2ffa6b31
......@@ -19,45 +19,45 @@
#ifndef _SFX_HELP_HXX
#define _SFX_HELP_HXX
#include <rtl/ustring.hxx>
#include "sal/config.h"
#include "sfx2/dllapi.h"
#include "sal/types.h"
#include <vcl/help.hxx>
#include <tools/string.hxx>
class SfxHelp_Impl;
class SfxFrame;
class SFX2_DLLPUBLIC SfxHelp : public Help
{
String aTicket; // for Plugins
String aUser;
String aLanguageStr;
String aCountryStr;
OUString aTicket; // for Plugins
OUString aUser;
OUString aLanguageStr;
OUString aCountryStr;
sal_Bool bIsDebug;
SfxHelp_Impl* pImp;
private:
SAL_DLLPRIVATE sal_Bool Start_Impl( const String& rURL, const Window* pWindow, const String& rKeyword );
SAL_DLLPRIVATE virtual sal_Bool SearchKeyword( const XubString& rKeyWord );
SAL_DLLPRIVATE virtual sal_Bool Start( const String& rURL, const Window* pWindow );
SAL_DLLPRIVATE virtual void OpenHelpAgent( const rtl::OString& sHelpId );
SAL_DLLPRIVATE String GetHelpModuleName_Impl();
SAL_DLLPRIVATE String CreateHelpURL_Impl( const String& aCommandURL, const String& rModuleName );
SAL_DLLPRIVATE sal_Bool Start_Impl( const OUString& rURL, const Window* pWindow, const OUString& rKeyword );
SAL_DLLPRIVATE virtual sal_Bool SearchKeyword( const OUString& rKeyWord );
SAL_DLLPRIVATE virtual sal_Bool Start( const OUString& rURL, const Window* pWindow );
SAL_DLLPRIVATE virtual void OpenHelpAgent( const OString& sHelpId );
SAL_DLLPRIVATE OUString GetHelpModuleName_Impl();
SAL_DLLPRIVATE OUString CreateHelpURL_Impl( const OUString& aCommandURL, const OUString& rModuleName );
public:
SfxHelp();
~SfxHelp();
inline void SetTicket( const String& rTicket ) { aTicket = rTicket; }
inline void SetUser( const String& rUser ) { aUser = rUser; }
inline void SetTicket( const OUString& rTicket ) { aTicket = rTicket; }
inline void SetUser( const OUString& rUser ) { aUser = rUser; }
virtual XubString GetHelpText( const String&, const Window* pWindow );
virtual OUString GetHelpText( const OUString&, const Window* pWindow );
static String CreateHelpURL( const String& aCommandURL, const String& rModuleName );
static OUString CreateHelpURL( const OUString& aCommandURL, const OUString& rModuleName );
using Help::OpenHelpAgent;
static void OpenHelpAgent( SfxFrame* pFrame, const rtl::OString& sHelpId );
static String GetDefaultHelpModule();
static ::rtl::OUString GetCurrentModuleIdentifier();
static void OpenHelpAgent( SfxFrame* pFrame, const OString& sHelpId );
static OUString GetDefaultHelpModule();
static OUString GetCurrentModuleIdentifier();
};
#endif // #ifndef _SFX_HELP_HXX
......
......@@ -627,14 +627,11 @@ void IndexTabPage_Impl::InitializeIndex()
try
{
::rtl::OUString aURL = HELP_URL;
aURL += ::rtl::OUString( sFactory );
OUStringBuffer aURL = HELP_URL;
aURL.append(sFactory);
AppendConfigToken(aURL, sal_True);
String aTemp = aURL;
AppendConfigToken( aTemp, sal_True );
aURL = aTemp;
Content aCnt( aURL, Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
Content aCnt( aURL.makeStringAndClear(), Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = aCnt.getProperties();
if ( xInfo->hasPropertyByName( PROPERTY_ANCHORREF ) )
{
......@@ -1070,17 +1067,17 @@ IMPL_LINK_NOARG(SearchTabPage_Impl, SearchHdl)
EnterWait();
ClearSearchResults();
RememberSearchText( aSearchText );
String aSearchURL = HELP_URL;
aSearchURL += aFactory;
aSearchURL += String( HELP_SEARCH_TAG );
OUStringBuffer aSearchURL(HELP_URL);
aSearchURL.append(aFactory);
aSearchURL.append(HELP_SEARCH_TAG);
if ( !aFullWordsCB.IsChecked() )
aSearchText = sfx2::PrepareSearchString( aSearchText, xBreakIterator, true );
aSearchURL += aSearchText;
AppendConfigToken( aSearchURL, sal_False );
aSearchURL.append(aSearchText);
AppendConfigToken(aSearchURL, sal_False);
if ( aScopeCB.IsChecked() )
aSearchURL += DEFINE_CONST_UNICODE("&Scope=Heading");
Sequence< ::rtl::OUString > aFactories = SfxContentHelper::GetResultSet( aSearchURL );
const ::rtl::OUString* pFacs = aFactories.getConstArray();
aSearchURL.append("&Scope=Heading");
Sequence< OUString > aFactories = SfxContentHelper::GetResultSet(aSearchURL.makeStringAndClear());
const OUString* pFacs = aFactories.getConstArray();
sal_uInt32 i, nCount = aFactories.getLength();
for ( i = 0; i < nCount; ++i )
{
......@@ -1479,11 +1476,10 @@ void BookmarksTabPage_Impl::AddBookmarks( const String& rTitle, const String& rU
sHelpURL.append(HELP_URL);
sHelpURL.append(sFactory);
sHelpURL.append(sContent);
String sURL = String(sHelpURL.makeStringAndClear());
AppendConfigToken(sURL, bUseQuestionMark);
AppendConfigToken(sHelpURL, bUseQuestionMark);
if (!sAnchor.isEmpty())
sURL += String(sAnchor);
return ::rtl::OUString(sURL);
sHelpURL.append(sAnchor);
return sHelpURL.makeStringAndClear();
}
void SfxHelpWindow_Impl::loadHelpContent(const ::rtl::OUString& sHelpURL, sal_Bool bAddToHistory)
......@@ -1597,9 +1593,9 @@ SfxHelpIndexWindow_Impl::~SfxHelpIndexWindow_Impl()
void SfxHelpIndexWindow_Impl::Initialize()
{
String aHelpURL = HELP_URL;
AppendConfigToken( aHelpURL, sal_True );
Sequence< ::rtl::OUString > aFactories = SfxContentHelper::GetResultSet( aHelpURL );
OUStringBuffer aHelpURL(HELP_URL);
AppendConfigToken(aHelpURL, sal_True);
Sequence< ::rtl::OUString > aFactories = SfxContentHelper::GetResultSet(aHelpURL.makeStringAndClear());
const ::rtl::OUString* pFacs = aFactories.getConstArray();
sal_uInt32 i, nCount = aFactories.getLength();
for ( i = 0; i < nCount; ++i )
......
......@@ -598,7 +598,7 @@ public:
};
/// Appends ?Language=xy&System=abc to the help URL in rURL
void AppendConfigToken( String& rURL, sal_Bool bQuestionMark, const rtl::OUString &rLang = rtl::OUString() );
void AppendConfigToken(OUStringBuffer& rURL, sal_Bool bQuestionMark, const OUString &rLang = rtl::OUString());
#endif // #ifndef INCLUDED_SFX_NEWHELP_HXX
......
This diff is collapsed.
......@@ -44,8 +44,8 @@ private:
Rectangle maTextRect; // For wrapped text in QuickHelp
String maHelpText;
String maStatusText;
OUString maHelpText;
OUString maStatusText;
Timer maShowTimer;
Timer maHideTimer;
......@@ -61,16 +61,16 @@ protected:
void ImplShow();
public:
HelpTextWindow( Window* pParent, const String& rText, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle );
HelpTextWindow( Window* pParent, const OUString& rText, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle );
~HelpTextWindow();
const String& GetHelpText() const { return maHelpText; }
void SetHelpText( const String& rHelpText );
const OUString& GetHelpText() const { return maHelpText; }
void SetHelpText( const OUString& rHelpText );
sal_uInt16 GetWinStyle() const { return mnHelpWinStyle; }
sal_uInt16 GetStyle() const { return mnStyle; }
// Nur merken:
void SetStatusText( const String& rStatusText ) { maStatusText = rStatusText; }
void SetStatusText( const OUString& rStatusText ) { maStatusText = rStatusText; }
void SetHelpArea( const Rectangle& rRect ) { maHelpArea = rRect; }
void ShowHelp( sal_uInt16 nDelayMode );
......@@ -82,7 +82,7 @@ public:
};
void ImplShowHelpWindow( Window* pParent, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle,
const String& rHelpText, const String& rStatusText,
const OUString& rHelpText, const OUString& rStatusText,
const Point& rScreenPos, const Rectangle* pHelpArea = NULL );
void ImplDestroyHelpWindow( bool bUpdateHideTime );
void ImplSetHelpWindowPos( Window* pHelpWindow, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle,
......
......@@ -29,7 +29,7 @@
#ifndef _SV_HELP_HXX
#define _SV_HELP_HXX
#include <tools/string.hxx>
#include <rtl/ustring.hxx>
#include <tools/solar.h>
#include <vcl/dllapi.h>
......@@ -69,19 +69,19 @@ class Window;
class VCL_DLLPUBLIC Help
{
private:
String maHelpFile;
OUString maHelpFile;
public:
Help();
virtual ~Help();
void SetHelpFile( const String& rFileName ) { maHelpFile = rFileName; }
const String& GetHelpFile() const { return maHelpFile; }
void SetHelpFile( const OUString& rFileName ) { maHelpFile = rFileName; }
const OUString& GetHelpFile() const { return maHelpFile; }
virtual sal_Bool Start( const XubString& rHelpId, const Window* pWindow );
virtual sal_Bool SearchKeyword( const XubString& rKeyWord );
virtual void OpenHelpAgent( const rtl::OString& rHelpId );
virtual XubString GetHelpText( const String& aHelpURL, const Window* pWindow );
virtual sal_Bool Start( const OUString& rHelpId, const Window* pWindow );
virtual sal_Bool SearchKeyword( const OUString& rKeyWord );
virtual void OpenHelpAgent( const OString& rHelpId );
virtual OUString GetHelpText( const OUString& aHelpURL, const Window* pWindow );
static void EnableContextHelp();
static void DisableContextHelp();
......@@ -98,35 +98,35 @@ public:
static sal_Bool IsBalloonHelpEnabled();
static sal_Bool ShowBalloon( Window* pParent,
const Point& rScreenPos,
const XubString& rHelpText );
const OUString& rHelpText );
static sal_Bool ShowBalloon( Window* pParent,
const Point& rScreenPos,
const Rectangle&,
const XubString& rHelpText );
const OUString& rHelpText );
static void EnableQuickHelp();
static void DisableQuickHelp();
static sal_Bool IsQuickHelpEnabled();
static sal_Bool ShowQuickHelp( Window* pParent,
const Rectangle& rScreenRect,
const XubString& rHelpText,
const XubString& rLongHelpText,
const OUString& rHelpText,
const OUString& rLongHelpText,
sal_uInt16 nStyle = 0 );
static sal_Bool ShowQuickHelp( Window* pParent,
const Rectangle& rScreenRect,
const XubString& rHelpText,
const OUString& rHelpText,
sal_uInt16 nStyle = 0 )
{ return Help::ShowQuickHelp( pParent, rScreenRect, rHelpText, XubString(), nStyle ); }
{ return Help::ShowQuickHelp( pParent, rScreenRect, rHelpText, OUString(), nStyle ); }
static void HideBalloonAndQuickHelp();
static sal_uLong ShowTip( Window* pParent,
const Rectangle& rScreenRect,
const XubString& rText, sal_uInt16 nStyle = 0 );
const OUString& rText, sal_uInt16 nStyle = 0 );
static void UpdateTip( sal_uLong nId,
Window* pParent,
const Rectangle& rScreenRect,
const XubString& rText );
const OUString& rText );
static void HideTip( sal_uLong nId );
};
......
......@@ -26,6 +26,7 @@
*
************************************************************************/
#include <comphelper/string.hxx>
#include "tools/debug.hxx"
#include "tools/diagnose_ex.h"
......@@ -66,25 +67,25 @@ Help::~Help()
// -----------------------------------------------------------------------
void Help::OpenHelpAgent( const rtl::OString& )
void Help::OpenHelpAgent( const OString& )
{
}
// -----------------------------------------------------------------------
sal_Bool Help::Start( const XubString&, const Window* )
sal_Bool Help::Start( const OUString&, const Window* )
{
return sal_False;
}
sal_Bool Help::SearchKeyword( const XubString& )
sal_Bool Help::SearchKeyword( const OUString& )
{
return sal_False;
}
// -----------------------------------------------------------------------
XubString Help::GetHelpText( const String&, const Window* )
OUString Help::GetHelpText( const OUString&, const Window* )
{
return ImplGetSVEmptyStr();
}
......@@ -193,7 +194,7 @@ sal_Bool Help::IsBalloonHelpEnabled()
sal_Bool Help::ShowBalloon( Window* pParent,
const Point& rScreenPos,
const XubString& rHelpText )
const OUString& rHelpText )
{
ImplShowHelpWindow( pParent, HELPWINSTYLE_BALLOON, 0,
rHelpText, ImplGetSVEmptyStr(), rScreenPos );
......@@ -205,7 +206,7 @@ sal_Bool Help::ShowBalloon( Window* pParent,
sal_Bool Help::ShowBalloon( Window* pParent,
const Point& rScreenPos, const Rectangle& rRect,
const XubString& rHelpText )
const OUString& rHelpText )
{
ImplShowHelpWindow( pParent, HELPWINSTYLE_BALLOON, 0,
rHelpText, ImplGetSVEmptyStr(), rScreenPos, &rRect );
......@@ -238,8 +239,8 @@ sal_Bool Help::IsQuickHelpEnabled()
sal_Bool Help::ShowQuickHelp( Window* pParent,
const Rectangle& rScreenRect,
const XubString& rHelpText,
const XubString& rLongHelpText,
const OUString& rHelpText,
const OUString& rLongHelpText,
sal_uInt16 nStyle )
{
ImplShowHelpWindow( pParent, HELPWINSTYLE_QUICK, nStyle,
......@@ -260,7 +261,7 @@ void Help::HideBalloonAndQuickHelp()
// -----------------------------------------------------------------------
sal_uIntPtr Help::ShowTip( Window* pParent, const Rectangle& rScreenRect,
const XubString& rText, sal_uInt16 nStyle )
const OUString& rText, sal_uInt16 nStyle )
{
sal_uInt16 nHelpWinStyle = ( ( nStyle & QUICKHELP_TIP_STYLE_BALLOON ) != 0 ) ? HELPWINSTYLE_BALLOON : HELPWINSTYLE_QUICK;
HelpTextWindow* pHelpWin = new HelpTextWindow( pParent, rText, nHelpWinStyle, nStyle );
......@@ -274,7 +275,7 @@ sal_uIntPtr Help::ShowTip( Window* pParent, const Rectangle& rScreenRect,
// -----------------------------------------------------------------------
void Help::UpdateTip( sal_uIntPtr nId, Window* pParent, const Rectangle& rScreenRect, const XubString& rText )
void Help::UpdateTip( sal_uIntPtr nId, Window* pParent, const Rectangle& rScreenRect, const OUString& rText )
{
HelpTextWindow* pHelpWin = reinterpret_cast< HelpTextWindow* >( nId );
ENSURE_OR_RETURN_VOID( pHelpWin != NULL, "Help::UpdateTip: invalid ID!" );
......@@ -303,7 +304,7 @@ void Help::HideTip( sal_uLong nId )
// =======================================================================
HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle ) :
HelpTextWindow::HelpTextWindow( Window* pParent, const OUString& rText, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle ) :
//FloatingWindow( pParent->ImplGetFrameWindow(), WB_SYSTEMWINDOW ),
FloatingWindow( pParent, WB_SYSTEMWINDOW|WB_TOOLTIPWIN ), // #105827# if we change the parent, mirroring will not work correctly when positioning this window
maHelpText( rText )
......@@ -367,10 +368,10 @@ HelpTextWindow::~HelpTextWindow()
// -----------------------------------------------------------------------
void HelpTextWindow::SetHelpText( const String& rHelpText )
void HelpTextWindow::SetHelpText( const OUString& rHelpText )
{
maHelpText = rHelpText;
if ( mnHelpWinStyle == HELPWINSTYLE_QUICK && maHelpText.Len() < HELPTEXTMAXLEN)
if ( mnHelpWinStyle == HELPWINSTYLE_QUICK && maHelpText.getLength() < HELPTEXTMAXLEN)
{
Size aSize;
aSize.Height() = GetTextHeight();
......@@ -383,9 +384,11 @@ void HelpTextWindow::SetHelpText( const String& rHelpText )
else // HELPWINSTYLE_BALLOON
{
Point aTmpPoint;
sal_uInt16 nCharsInLine = 35 + ((maHelpText.Len()/100)*5);
XubString aXXX;
aXXX.Fill( nCharsInLine, 'x' ); // average width to have all windows consistent
sal_Int32 nCharsInLine = 35 + ((maHelpText.getLength()/100)*5);
// average width to have all windows consistent
OUStringBuffer aBuf;
comphelper::string::padToLength(aBuf, nCharsInLine, 'x');
OUString aXXX = aBuf.makeStringAndClear();
long nWidth = GetTextWidth( aXXX );
Size aTmpSize( nWidth, 0x7FFFFFFF );
Rectangle aTry1( aTmpPoint, aTmpSize );
......@@ -428,11 +431,11 @@ void HelpTextWindow::Paint( const Rectangle& )
Rectangle aCtrlRegion( Point( 0, 0 ), GetOutputSizePixel() );
ImplControlValue aControlValue;
bNativeOK = DrawNativeControl( CTRL_TOOLTIP, PART_ENTIRE_CONTROL, aCtrlRegion,
0, aControlValue, rtl::OUString() );
0, aControlValue, OUString() );
}
// paint text
if ( mnHelpWinStyle == HELPWINSTYLE_QUICK && maHelpText.Len() < HELPTEXTMAXLEN)
if ( mnHelpWinStyle == HELPWINSTYLE_QUICK && maHelpText.getLength() < HELPTEXTMAXLEN)
{
if ( mnStyle & QUICKHELP_CTRLTEXT )
DrawCtrlText( maTextRect.TopLeft(), maHelpText );
......@@ -536,7 +539,7 @@ void HelpTextWindow::RequestHelp( const HelpEvent& /*rHEvt*/ )
// -----------------------------------------------------------------------
String HelpTextWindow::GetText() const
XubString HelpTextWindow::GetText() const
{
return maHelpText;
}
......@@ -552,12 +555,12 @@ String HelpTextWindow::GetText() const
// =======================================================================
void ImplShowHelpWindow( Window* pParent, sal_uInt16 nHelpWinStyle, sal_uInt16 nStyle,
const XubString& rHelpText, const XubString& rStatusText,
const OUString& rHelpText, const OUString& rStatusText,
const Point& rScreenPos, const Rectangle* pHelpArea )
{
ImplSVData* pSVData = ImplGetSVData();
if( !rHelpText.Len() && !pSVData->maHelpData.mbRequestingHelp )
if (rHelpText.isEmpty() && !pSVData->maHelpData.mbRequestingHelp)
return;
HelpTextWindow* pHelpWin = pSVData->maHelpData.mpHelpWin;
......@@ -602,7 +605,7 @@ void ImplShowHelpWindow( Window* pParent, sal_uInt16 nHelpWinStyle, sal_uInt16 n
}
}
if ( !pHelpWin && rHelpText.Len() )
if (!pHelpWin && !rHelpText.isEmpty())
{
sal_uLong nCurTime = Time::GetSystemTicks();
if ( ( ( nCurTime - pSVData->maHelpData.mnLastHelpHideTime ) < pParent->GetSettings().GetHelpSettings().GetTipDelay() )
......
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