diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-01 11:03:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-02 00:05:57 +0100 |
commit | d67dff5719b32c17f4bf02990de5d7a772db484c (patch) | |
tree | fec9e2fe2ba0a81df0ae951a6dd608b9a2572677 /vcl | |
parent | 2ffa6b313acc322a2502c6c200b39ec652699bf9 (diff) |
XubString->OUString
Change-Id: Id64cdd70c2877ff71c5bc90286fab6b3d8ab7ad4
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/helpwin.hxx | 14 | ||||
-rw-r--r-- | vcl/inc/vcl/help.hxx | 32 | ||||
-rw-r--r-- | vcl/source/app/help.cxx | 47 |
3 files changed, 48 insertions, 45 deletions
diff --git a/vcl/inc/helpwin.hxx b/vcl/inc/helpwin.hxx index 40a969f5b40c..7dd0c31ba964 100644 --- a/vcl/inc/helpwin.hxx +++ b/vcl/inc/helpwin.hxx @@ -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, diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx index 1906bcaa7e56..8753c3c8fd08 100644 --- a/vcl/inc/vcl/help.hxx +++ b/vcl/inc/vcl/help.hxx @@ -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 ); }; diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 9cb7a03a617c..18a6573e1491 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -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() ) |