[Libreoffice-commits] core.git: basctl/source vcl/inc vcl/source

Chr. Rossmanith ChrRossmanith at gmx.de
Thu Mar 28 06:48:23 PDT 2013


 basctl/source/basicide/baside2.cxx          |    2 +-
 basctl/source/basicide/baside2b.cxx         |    2 +-
 basctl/source/basicide/linenumberwindow.cxx |    4 ++--
 vcl/inc/vcl/outdev.hxx                      |    3 +--
 vcl/source/gdi/outdev3.cxx                  |   12 ++++--------
 5 files changed, 9 insertions(+), 14 deletions(-)

New commits:
commit 91c1161dd9e1fc73c91608f1320197daadd5ea2e
Author: Chr. Rossmanith <ChrRossmanith at gmx.de>
Date:   Sun Mar 24 20:34:33 2013 +0100

    Use OUString and sal_Int32 in GetTextWidth()
    
    Change-Id: I0b3cdbe8576300d098027cc98d7dff841d148f18
    Reviewed-on: https://gerrit.libreoffice.org/3097
    Reviewed-by: Petr Mladek <pmladek at suse.cz>
    Tested-by: Petr Mladek <pmladek at suse.cz>

diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index f8962c5..f8690cc 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -888,7 +888,7 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
 
     // nLinepPage is not correct if there's a line break
     sal_uInt16 nLinespPage = (sal_uInt16) (aPaperSz.Height()/nLineHeight);
-    sal_uInt16 nCharspLine = (sal_uInt16) (aPaperSz.Width() / pPrinter->GetTextWidth( 'X' ) );
+    sal_uInt16 nCharspLine = (sal_uInt16) (aPaperSz.Width() / pPrinter->GetTextWidth( "X" ) );
     sal_uLong nParas = GetEditEngine()->GetParagraphCount();
 
     sal_uInt16 nPages = (sal_uInt16) (nParas/nLinespPage+1 );
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index bb81726..bc683f6 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -786,7 +786,7 @@ void EditorWindow::InitScrollBars()
     {
         rModulWindow.GetHScrollBar()->SetVisibleSize( aOutSz.Width() );
         rModulWindow.GetHScrollBar()->SetPageSize( aOutSz.Width() * 8 / 10 );
-        rModulWindow.GetHScrollBar()->SetLineSize( GetTextWidth( OUString('x') ) );
+        rModulWindow.GetHScrollBar()->SetLineSize( GetTextWidth( "x" ) );
         rModulWindow.GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
         rModulWindow.GetHScrollBar()->Show();
     }
diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx
index 2bd4dbe..56d01cf 100644
--- a/basctl/source/basicide/linenumberwindow.cxx
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -41,7 +41,7 @@ LineNumberWindow::LineNumberWindow (Window* pParent, ModulWindow* pModulWindow)
     m_nCurYOffset(0)
 {
     SetBackground(Wallpaper(GetSettings().GetStyleSettings().GetFieldColor()));
-    m_nBaseWidth = GetTextWidth('8');
+    m_nBaseWidth = GetTextWidth("8");
     m_nWidth = m_nBaseWidth * 3 + m_nBaseWidth / 2;
 }
 
@@ -79,7 +79,7 @@ void LineNumberWindow::Paint( const Rectangle& )
 
     // FIXME: it would be best if we could get notified of a font change
     // rather than doing that re-calculation at each Paint event
-    m_nBaseWidth = GetTextWidth(OUString('8'));
+    m_nBaseWidth = GetTextWidth("8");
 
     // reserve enough for 3 sigit minimum, with a bit to spare for confort
     m_nWidth = m_nBaseWidth * 3 + m_nBaseWidth / 2;
diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index 44a5979..3f4fdbd 100644
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -573,8 +573,7 @@ public:
     void                DrawText( const Point& rStartPt, const XubString& rStr,
                                   xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN,
                                   MetricVector* pVector = NULL, OUString* pDisplayText = NULL );
-    long                GetTextWidth( const XubString& rStr, xub_StrLen nIndex = 0,
-                                      xub_StrLen nLen = STRING_LEN ) const;
+    long                GetTextWidth( const OUString& rStr, sal_Int32 nIndex = 0, sal_Int32 nLen = -1 ) const;
     /// Height where any character of the current font fits; in logic coordinates.
     long                GetTextHeight() const;
     float               approximate_char_width() const;
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 4ce3714..b588b08 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -5470,15 +5470,11 @@ void OutputDevice::DrawText( const Point& rStartPt, const String& rStr,
         mpAlphaVDev->DrawText( rStartPt, rStr, nIndex, nLen, pVector, pDisplayText );
 }
 
-long OutputDevice::GetTextWidth( const String& rStr,
-                                 xub_StrLen nIndex, xub_StrLen nLen ) const
+long OutputDevice::GetTextWidth( const OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen ) const
 {
     DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
 
-    sal_Int32 nLen2 = (nLen == STRING_LEN) ? -1 : nLen; // only needed until nLen is sal_Int32
-    sal_Int32 nIndex2 = nIndex;                            // ditto
-    OUString aTmpStr(rStr);
-    long nWidth = GetTextArray( aTmpStr, NULL, nIndex2, nLen2 );
+    long nWidth = GetTextArray( rStr, NULL, nIndex, nLen );
 
     return nWidth;
 }
@@ -5504,7 +5500,7 @@ long OutputDevice::GetTextHeight() const
 
 float OutputDevice::approximate_char_width() const
 {
-    return GetTextWidth(rtl::OUString("aemnnxEM")) / 8.0;
+    return GetTextWidth("aemnnxEM") / 8.0;
 }
 
 void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr,
@@ -6357,7 +6353,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& r
     }
     else
     {
-        long nTextWidth = _rLayout.GetTextWidth( aStr, 0, STRING_LEN );
+        long nTextWidth = _rLayout.GetTextWidth( aStr, 0, -1 );
 
         // Evt. Text kuerzen
         if ( nTextWidth > nWidth )


More information about the Libreoffice-commits mailing list