[Libreoffice-commits] .: 7 commits - basic/source editeng/source forms/source svl/inc svl/source svx/inc svx/source tools/inc tools/source unusedcode.easy vcl/source

Caolán McNamara caolan at kemper.freedesktop.org
Thu Sep 15 03:24:30 PDT 2011


 basic/source/runtime/iosys.cxx              |   17 ++-
 editeng/source/rtf/rtfgrf.cxx               |    7 -
 forms/source/component/DatabaseForm.cxx     |    2 
 svl/inc/svl/style.hxx                       |    1 
 svl/source/items/style.cxx                  |   12 --
 svx/inc/svx/svdotext.hxx                    |    3 
 svx/inc/svx/svdviter.hxx                    |   17 ---
 svx/source/svdraw/svdotext.cxx              |   12 --
 svx/source/svdraw/svdviter.cxx              |  147 ----------------------------
 tools/inc/tools/string.hxx                  |    2 
 tools/source/string/strimp.cxx              |   32 ------
 tools/source/string/tustring.cxx            |   32 ++++++
 unusedcode.easy                             |   10 -
 vcl/source/app/dbggui.cxx                   |   40 +++----
 vcl/source/control/button.cxx               |    4 
 vcl/source/control/quickselectionengine.cxx |    2 
 vcl/source/helper/strhelper.cxx             |    3 
 vcl/source/window/dialog.cxx                |   28 +++--
 vcl/source/window/window.cxx                |   18 ++-
 19 files changed, 105 insertions(+), 284 deletions(-)

New commits:
commit 2bee9847ec615258819b6cfec857c84e8f03fc6d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Sep 15 11:23:10 2011 +0100

    ditch ByteString::Fill

diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index bb674a6..9a70a66 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -177,6 +177,7 @@ private:
                                      // Append(char)
     void                operator +=(int); // not implemented; to detect misuses
                                           // of operator +=(sal_Char)
+
 public:
                         ByteString();
                         ByteString( const ByteString& rStr );
@@ -233,7 +234,6 @@ public:
     ByteString&         Erase( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN );
     ByteString          Copy( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ) const;
 
-    ByteString&         Fill( xub_StrLen nCount, sal_Char cFillChar = ' ' );
     ByteString&         Expand( xub_StrLen nCount, sal_Char cExpandChar = ' ' );
 
     ByteString&         EraseLeadingChars( sal_Char c = ' ' );
diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx
index f351aea..3d15cb2 100644
--- a/tools/source/string/strimp.cxx
+++ b/tools/source/string/strimp.cxx
@@ -769,38 +769,6 @@ STRING& STRING::Erase( xub_StrLen nIndex, xub_StrLen nCount )
 
 // -----------------------------------------------------------------------
 
-STRING& STRING::Fill( xub_StrLen nCount, STRCODE cFillChar )
-{
-    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
-    if ( !nCount )
-        return *this;
-
-    // Ist nCount groesser wie der jetzige String, dann verlaengern
-    if ( nCount > mpData->mnLen )
-    {
-        // dann neuen String mit der neuen Laenge anlegen
-        STRINGDATA* pNewData = ImplAllocData( nCount );
-        STRING_RELEASE((STRING_TYPE *)mpData);
-        mpData = pNewData;
-    }
-    else
-        ImplCopyData();
-
-    STRCODE* pStr = mpData->maStr;
-    do
-    {
-        *pStr = cFillChar;
-        ++pStr,
-        --nCount;
-    }
-    while ( nCount );
-
-    return *this;
-}
-
-// -----------------------------------------------------------------------
-
 STRING& STRING::Expand( xub_StrLen nCount, STRCODE cExpandChar )
 {
     DBG_CHKTHIS( STRING, DBGCHECKSTRING );
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index 877b6d8..720d5a2 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -442,4 +442,36 @@ StringCompare STRING::CompareIgnoreCaseToAscii( const STRING& rStr,
         return COMPARE_GREATER;
 }
 
+// -----------------------------------------------------------------------
+
+STRING& STRING::Fill( xub_StrLen nCount, STRCODE cFillChar )
+{
+    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+    if ( !nCount )
+        return *this;
+
+    // Ist nCount groesser wie der jetzige String, dann verlaengern
+    if ( nCount > mpData->mnLen )
+    {
+        // dann neuen String mit der neuen Laenge anlegen
+        STRINGDATA* pNewData = ImplAllocData( nCount );
+        STRING_RELEASE((STRING_TYPE *)mpData);
+        mpData = pNewData;
+    }
+    else
+        ImplCopyData();
+
+    STRCODE* pStr = mpData->maStr;
+    do
+    {
+        *pStr = cFillChar;
+        ++pStr,
+        --nCount;
+    }
+    while ( nCount );
+
+    return *this;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit f1d1cb2d8f0f6e3a9c6071faeda1e58f88041749
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Sep 15 09:46:53 2011 +0100

    drop some more unused code

diff --git a/svx/inc/svx/svdviter.hxx b/svx/inc/svx/svdviter.hxx
index 57b9e5a..544fac3 100644
--- a/svx/inc/svx/svdviter.hxx
+++ b/svx/inc/svx/svdviter.hxx
@@ -92,9 +92,6 @@ class SVX_DLLPUBLIC SdrViewIter
 private:
     SVX_DLLPRIVATE void          ImpInitVars();
     SVX_DLLPRIVATE SdrView*      ImpFindView();
-    SVX_DLLPRIVATE SdrPageView*  ImpFindPageView();
-    SVX_DLLPRIVATE OutputDevice* ImpFindOutDev();
-    SVX_DLLPRIVATE Window*       ImpFindWindow();
     SVX_DLLPRIVATE sal_Bool      ImpCheckPageView(SdrPageView* pPV) const;
 
 public:
diff --git a/svx/source/svdraw/svdviter.cxx b/svx/source/svdraw/svdviter.cxx
index 97d66ee..6cf4cc4 100644
--- a/svx/source/svdraw/svdviter.cxx
+++ b/svx/source/svdraw/svdviter.cxx
@@ -189,90 +189,6 @@ SdrView* SdrViewIter::ImpFindView()
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
-SdrPageView* SdrViewIter::ImpFindPageView()
-{
-    if(mpModel)
-    {
-        while(mpAktView)
-        {
-            SdrPageView* pPV = mpAktView->GetSdrPageView();
-
-            if(pPV)
-            {
-                if(mpPage)
-                {
-                    if(ImpCheckPageView(pPV))
-                    {
-                        return pPV;
-                    }
-                }
-                else
-                {
-                    return pPV;
-                }
-
-                mnPageViewNum++;
-            }
-
-            mnListenerNum++;
-            ImpFindView();
-        }
-    }
-
-    return 0L;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-OutputDevice* SdrViewIter::ImpFindOutDev()
-{
-    while(mpAktView)
-    {
-        const sal_uInt32 nOutDevAnz(mpAktView->PaintWindowCount());
-
-        if(mnOutDevNum < nOutDevAnz)
-        {
-            SdrPaintWindow* pPaintWindow = mpAktView->GetPaintWindow(mnOutDevNum);
-            return &pPaintWindow->GetOutputDevice();
-        }
-
-        mnListenerNum++;
-        ImpFindView();
-    }
-
-    return 0L;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-Window* SdrViewIter::ImpFindWindow()
-{
-    while(mpAktView)
-    {
-        const sal_uInt32 nOutDevAnz(mpAktView->PaintWindowCount());
-
-        while(mnOutDevNum < nOutDevAnz)
-        {
-            SdrPaintWindow* pPaintWindow = mpAktView->GetPaintWindow(mnOutDevNum);
-            OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
-
-            if(OUTDEV_WINDOW == rOutDev.GetOutDevType())
-            {
-                return (Window*)(&rOutDev);
-            }
-
-            mnOutDevNum++;
-        }
-
-        mnListenerNum++;
-        ImpFindView();
-    }
-
-    return 0L;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
 SdrView* SdrViewIter::FirstView()
 {
     ImpInitVars();
commit 22eb754f613fdaa0c90f9c98a4373e6f7faa0a99
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Sep 15 09:44:06 2011 +0100

    replace ByteString::Fill

diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 7f4274c..5b57527 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -45,6 +45,7 @@
 #include <ctype.h>
 #include <rtl/byteseq.hxx>
 #include <rtl/textenc.h>
+#include <rtl/strbuf.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/textenc.h>
 #include <rtl/ustrbuf.hxx>
@@ -652,11 +653,21 @@ SbError SbiStream::Read( ByteString& rBuf, sal_uInt16 n, bool bForceReadingPerBy
     }
     else
     {
-        if( !n ) n = nLen;
+        if( !n )
+            n = nLen;
         if( !n )
             return nError = SbERR_BAD_RECORD_LENGTH;
-        rBuf.Fill( n, ' ' );
-        pStrm->Read( (void*)rBuf.GetBuffer(), n );
+        rtl::OStringBuffer aBuffer(read_uInt8s_AsOString(*pStrm, n));
+        //Pad it out with ' ' to the requested length on short read
+        sal_Int32 nRead = aBuffer.getLength();
+        sal_Int32 nRequested = sal::static_int_cast<sal_Int32>(n);
+        if (nRead < nRequested)
+        {
+            aBuffer.setLength(nRequested);
+            for (sal_Int32 i = nRead; i < nRequested; ++i)
+                aBuffer.setCharAt(i, ' ');
+        }
+        rBuf = aBuffer.makeStringAndClear();
     }
     MapError();
     if( !nError && pStrm->IsEof() )
commit 565587eba10a8c4e01d4346669327bd9065c5dfa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Sep 15 08:46:28 2011 +0100

    replace ByteString::Fill

diff --git a/editeng/source/rtf/rtfgrf.cxx b/editeng/source/rtf/rtfgrf.cxx
index bb375b7..4ff9f35 100644
--- a/editeng/source/rtf/rtfgrf.cxx
+++ b/editeng/source/rtf/rtfgrf.cxx
@@ -42,6 +42,8 @@
 
 #include <editeng/svxrtf.hxx>
 
+#include <vector>
+
 using namespace ::rtl;
 
 static sal_uInt8 aPal1[ 2 * 4 ] = {
@@ -328,9 +330,8 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType )
                 rPicType.eStyle = SvxRTFPictureType::MAC_QUICKDRAW;
                 // Mac-Pict gets a empty header above
                 pTmpFile.reset(new SvCacheStream);
-                ByteString aStr;
-                aStr.Fill( 512, '\0' );
-                pTmpFile->Write( aStr.GetBuffer(), aStr.Len() );
+                std::vector<char> a512Zeros(512, '\0');
+                pTmpFile->Write( &a512Zeros[0], a512Zeros.size() );
                 pFilterNm = "PCT";
             }
             break;
commit 1c38704ff1bff7942a9d1eb8452a43c03fe41449
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 14 22:13:56 2011 +0100

    callcatcher: some unused code

diff --git a/svl/inc/svl/style.hxx b/svl/inc/svl/style.hxx
index 4f478c0..7edecd7 100644
--- a/svl/inc/svl/style.hxx
+++ b/svl/inc/svl/style.hxx
@@ -365,7 +365,6 @@ class SVL_DLLPUBLIC SfxUnoStyleSheet : public ::cppu::ImplInheritanceHelper2< Sf
 {
 public:
     SfxUnoStyleSheet( const UniString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, sal_uInt16 _nMaske );
-    SfxUnoStyleSheet( const SfxStyleSheet& _rSheet );
 
     static SfxUnoStyleSheet* getUnoStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle );
 
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 1078c7f..e09109c 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -953,12 +953,6 @@ SfxStyleSheetBase* SfxStyleSheetPool::Create( const SfxStyleSheet& r )
 {
     return new SfxStyleSheet( r );
 }
-/*
-sal_Bool SfxStyleSheetPool::CopyTo(SfxStyleSheetPool &, const String &)
-{
-    return sal_False;
-}
-*/
 
 // --------------------------------------------------------------------
 // class SfxUnoStyleSheet
@@ -970,12 +964,6 @@ SfxUnoStyleSheet::SfxUnoStyleSheet( const UniString& _rName, const SfxStyleSheet
 }
 
 // --------------------------------------------------------------------
-SfxUnoStyleSheet::SfxUnoStyleSheet( const SfxStyleSheet& _rSheet )
-: ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel >( _rSheet )
-{
-}
-
-// --------------------------------------------------------------------
 
 SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle )
 {
diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx
index 9f54b9b..c1fca7d 100644
--- a/svx/inc/svx/svdotext.hxx
+++ b/svx/inc/svx/svdotext.hxx
@@ -478,9 +478,6 @@ public:
     virtual void EndTextEdit(SdrOutliner& rOutl);
     virtual sal_uInt16 GetOutlinerViewAnchorMode() const;
 
-    void StartTextAnimation(OutputDevice* pOutDev, const Point& rOffset, long nExtraData=0L);
-    void StopTextAnimation(OutputDevice* pOutDev=NULL, long nExtraData=0L);
-
     virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
     void NbcSetOutlinerParaObjectForText( OutlinerParaObject* pTextObject, SdrText* pText );
     virtual OutlinerParaObject* GetOutlinerParaObject() const;
diff --git a/svx/inc/svx/svdviter.hxx b/svx/inc/svx/svdviter.hxx
index 7873e56..57b9e5a 100644
--- a/svx/inc/svx/svdviter.hxx
+++ b/svx/inc/svx/svdviter.hxx
@@ -44,10 +44,6 @@ Using this class, you can find out:
   - All PageViews in which a model is displayed
   - All PageViews in which a certain page is visible (also as MasterPage)
   - All PageViews in which a certain object is visible (also as MasterPage)
-- OutputDevice* First/NextOutDev()
-  - All OutputDevices in which a model is displayed
-  - All OutputDevices in which a certain page is visible (also as MasterPage)
-  - All OutputDevices in which a certain object is visible (also as MasterPage)
 - Window* First/NextWindow()
   - All Windows in which a model is displayed
   - All Windows in which a certain page is visible (also as MasterPage)
@@ -102,21 +98,11 @@ private:
     SVX_DLLPRIVATE sal_Bool      ImpCheckPageView(SdrPageView* pPV) const;
 
 public:
-    SdrViewIter(const SdrModel* pModel);
     SdrViewIter(const SdrPage* pPage, sal_Bool bNoMasterPage = sal_False);
     SdrViewIter(const SdrObject* pObject, sal_Bool bNoMasterPage = sal_False);
 
     SdrView* FirstView();
     SdrView* NextView();
-
-    SdrPageView* FirstPageView();
-    SdrPageView* NextPageView();
-
-    OutputDevice* FirstOutDev();
-    OutputDevice* NextOutDev();
-
-    Window* FirstWindow();
-    Window* NextWindow();
 };
 
 #endif //_SVDVITER_HXX
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index c7222a9..46cb749 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1023,18 +1023,6 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextS
     }
 }
 
-void SdrTextObj::StartTextAnimation(OutputDevice* /*pOutDev*/, const Point& /*rOffset*/, long /*nExtraData*/)
-{
-    // use new text animation
-    SetTextAnimationAllowed(sal_True);
-}
-
-void SdrTextObj::StopTextAnimation(OutputDevice* /*pOutDev*/, long /*nExtraData*/)
-{
-    // use new text animation
-    SetTextAnimationAllowed(sal_False);
-}
-
 void SdrTextObj::TakeObjNameSingul(XubString& rName) const
 {
     XubString aStr;
diff --git a/svx/source/svdraw/svdviter.cxx b/svx/source/svdraw/svdviter.cxx
index 5b64a82..97d66ee 100644
--- a/svx/source/svdraw/svdviter.cxx
+++ b/svx/source/svdraw/svdviter.cxx
@@ -51,16 +51,6 @@ void SdrViewIter::ImpInitVars()
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
-SdrViewIter::SdrViewIter(const SdrModel* pModel)
-{
-    mpModel = pModel;
-    mpPage = 0L;
-    mpObject = 0L;
-    ImpInitVars();
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
 SdrViewIter::SdrViewIter(const SdrPage* pPage, sal_Bool bNoMasterPage)
 {
     mpPage = pPage;
@@ -297,57 +287,4 @@ SdrView* SdrViewIter::NextView()
     return ImpFindView();
 }
 
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-SdrPageView* SdrViewIter::FirstPageView()
-{
-    ImpInitVars();
-    ImpFindView();
-    return ImpFindPageView();
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-SdrPageView* SdrViewIter::NextPageView()
-{
-    mnPageViewNum++;
-    return ImpFindPageView();
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-OutputDevice* SdrViewIter::FirstOutDev()
-{
-    ImpInitVars();
-    ImpFindView();
-    return ImpFindOutDev();
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-OutputDevice* SdrViewIter::NextOutDev()
-{
-    mnOutDevNum++;
-    return ImpFindOutDev();
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-Window* SdrViewIter::FirstWindow()
-{
-    ImpInitVars();
-    ImpFindView();
-    return ImpFindWindow();
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-Window* SdrViewIter::NextWindow()
-{
-    mnOutDevNum++;
-    return ImpFindWindow();
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unusedcode.easy b/unusedcode.easy
index d5d44bc..4d6f8b9 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -709,20 +709,11 @@ SdrTextObj::NbcSetFitToSize(SdrFitToSizeType)
 SdrTextObj::NbcSetMaxTextFrameHeight(long)
 SdrTextObj::NbcSetMaxTextFrameWidth(long)
 SdrTextObj::NbcSetTextHidden(unsigned char)
-SdrTextObj::StartTextAnimation(OutputDevice*, Point const&, long)
-SdrTextObj::StopTextAnimation(OutputDevice*, long)
 SdrUndoAttrObj::SetRepeatAttr(SfxItemSet const&)
 SdrUndoGroup::SdrUndoGroup(SdrModel&, String const&)
 SdrUndoGroup::push_front(SdrUndoAction*)
 SdrView::MarkNext(Point const&, unsigned char)
 SdrView::MarkNext(unsigned char)
-SdrViewIter::FirstOutDev()
-SdrViewIter::FirstPageView()
-SdrViewIter::FirstWindow()
-SdrViewIter::NextOutDev()
-SdrViewIter::NextPageView()
-SdrViewIter::NextWindow()
-SdrViewIter::SdrViewIter(SdrModel const*)
 SectReprArr::Insert(SectRepr* const&, unsigned short&)
 SectReprArr::Insert(SectRepr* const*, unsigned short)
 SectReprArr::Insert(SectReprArr const*, unsigned short, unsigned short)
@@ -815,7 +806,6 @@ SfxUShortRanges::Contains(unsigned short) const
 SfxUShortRanges::Intersects(SfxUShortRanges const&) const
 SfxUShortRanges::SfxUShortRanges(int, int, int, ...)
 SfxUShortRangesItem::SfxUShortRangesItem(unsigned short, unsigned short const*)
-SfxUnoStyleSheet::SfxUnoStyleSheet(SfxStyleSheet const&)
 SfxViewFactory::~SfxViewFactory()
 SfxViewFrame::Hide()
 Slider::SetRangeMax(long)
commit 1cbaa2a61090fab9e0b24ac3f18395ced92e984f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 14 21:59:35 2011 +0100

    ByteString->rtl::OString[Buffer]

diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index d32fd84..6e76706 100755
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -610,7 +610,7 @@ DbgWindow::DbgWindow() :
     SetOutputSizePixel( Size( 600, 480 ) );
     if ( pData->aDbgWinState )
     {
-        ByteString aState( pData->aDbgWinState );
+        rtl::OString aState( pData->aDbgWinState );
         SetWindowState( aState );
     }
 
@@ -624,11 +624,11 @@ DbgWindow::DbgWindow() :
 sal_Bool DbgWindow::Close()
 {
     // remember window position
-    ByteString aState( GetWindowState() );
+    rtl::OString aState( GetWindowState() );
     DbgData* pData = DbgGetData();
-    size_t nCopy = (sizeof( pData->aDbgWinState ) < size_t(aState.Len() + 1U ))
-    ? sizeof( pData->aDbgWinState ) : size_t(aState.Len() + 1U );
-    strncpy( pData->aDbgWinState, aState.GetBuffer(), nCopy );
+    size_t nCopy = (sizeof( pData->aDbgWinState ) < size_t(aState.getLength() + 1U ))
+    ? sizeof( pData->aDbgWinState ) : size_t(aState.getLength() + 1U );
+    strncpy( pData->aDbgWinState, aState.getStr(), nCopy );
     pData->aDbgWinState[ sizeof( pData->aDbgWinState ) - 1 ] = 0;
     // and save for next session
     DbgSaveData( *pData );
@@ -1194,11 +1194,11 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
         aData.nWarningOut = ImplGetChannelId( maWarningBox, 0 );
         aData.nErrorOut   = ImplGetChannelId( maErrorBox, mnErrorOff );
 
-        strncpy( aData.aDebugName, ByteString( maDebugName.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aDebugName ) );
-        strncpy( aData.aInclClassFilter, ByteString( maInclClassFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aInclClassFilter ) );
-        strncpy( aData.aExclClassFilter, ByteString( maExclClassFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aExclClassFilter ) );
-        strncpy( aData.aInclFilter, ByteString( maInclFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aInclFilter ) );
-        strncpy( aData.aExclFilter, ByteString( maExclFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aExclFilter ) );
+        strncpy( aData.aDebugName, rtl::OUStringToOString(maDebugName.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aDebugName ) );
+        strncpy( aData.aInclClassFilter, rtl::OUStringToOString(maInclClassFilter.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aInclClassFilter ) );
+        strncpy( aData.aExclClassFilter, rtl::OUStringToOString(maExclClassFilter.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aExclClassFilter ) );
+        strncpy( aData.aInclFilter, rtl::OUStringToOString(maInclFilter.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aInclFilter ) );
+        strncpy( aData.aExclFilter, rtl::OUStringToOString(maExclFilter.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aExclFilter ) );
         aData.aDebugName[sizeof( aData.aDebugName )-1] = '\0';
         aData.aInclClassFilter[sizeof( aData.aInclClassFilter )-1] = '\0';
         aData.aExclClassFilter[sizeof( aData.aExclClassFilter )-1] = '\0';
@@ -1524,7 +1524,7 @@ void DbgDialogTest( Window* pWindow )
                         DbgOutTypef( DBG_OUT_ERROR,
                                  "%s should have a mnemonic char (~): %s",
                                  pClass,
-                                 ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+                                 rtl::OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
 
                     // check text width
                     int aWidth=0;
@@ -1547,7 +1547,7 @@ void DbgDialogTest( Window* pWindow )
                         DbgOutTypef( DBG_OUT_ERROR,
                                  "%s exceeds window width: %s",
                                  pClass,
-                                 ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+                                 rtl::OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
                 }
             }
 
@@ -1556,7 +1556,7 @@ void DbgDialogTest( Window* pWindow )
                 if ( pChild->GetSizePixel().Width() < pChild->GetTextWidth( aText ) )
                     DbgOutTypef( DBG_OUT_ERROR,
                                  "FixedLine exceeds window width: %s",
-                                 ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+                                 rtl::OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
             }
 
             if ( pChild->GetType() == WINDOW_FIXEDTEXT )
@@ -1566,7 +1566,7 @@ void DbgDialogTest( Window* pWindow )
                 {
                     DbgOutTypef( DBG_OUT_ERROR,
                                  "FixedText greater than one line, but WordBreak is not set: %s",
-                                 ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+                                 rtl::OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
                 }
 
                 if ( pChild->IsVisible() )
@@ -1584,7 +1584,7 @@ void DbgDialogTest( Window* pWindow )
                         {
                             DbgOutTypef( DBG_OUT_ERROR,
                                          "FixedText exceeds window width: %s",
-                                         ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+                                         rtl::OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
                         }
                 }
 
@@ -1614,13 +1614,13 @@ void DbgDialogTest( Window* pWindow )
                         {
                             DbgOutTypef( DBG_OUT_ERROR,
                                          "Labels befor Fields (Edit,ListBox,...) should have a mnemonic char (~): %s",
-                                         ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+                                         rtl::OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
                         }
                         if ( !pTempChild->IsEnabled() && pChild->IsEnabled() )
                         {
                             DbgOutTypef( DBG_OUT_ERROR,
                                          "Labels befor Fields (Edit,ListBox,...) should be disabled, when the field is disabled: %s",
-                                         ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+                                         rtl::OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
                         }
                     }
                 }
@@ -1712,7 +1712,7 @@ void DbgDialogTest( Window* pWindow )
                 {
                     DbgOutTypef( DBG_OUT_ERROR,
                                  "No Max-Value is set: %s",
-                                 ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+                                 rtl::OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
                 }
 
                 if ( (pChild->GetType() == WINDOW_RADIOBUTTON) ||
@@ -1755,7 +1755,7 @@ void DbgDialogTest( Window* pWindow )
                         {
                             DbgOutTypef( DBG_OUT_ERROR,
                                          "Possible wrong childorder for dialogcontrol: %s",
-                                         ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+                                         rtl::OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
                         }
                         aTabPos = aNewPos;
                     }
@@ -1767,7 +1767,7 @@ void DbgDialogTest( Window* pWindow )
                         {
                             DbgOutTypef( DBG_OUT_ERROR,
                                          "Window overlaps with sibling window: %s",
-                                         ByteString( aErrorText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+                                         rtl::OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
                         }
                     }
                     pRectAry[i] = aChildRect;
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 103c9a5..52eb43e 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -164,8 +164,8 @@ XubString Button::GetStandardText( StandardButtonType eButton )
     }
     else
     {
-        ByteString aT( aResIdAry[(sal_uInt16)eButton].pDefText );
-        aText = String( aT, RTL_TEXTENCODING_ASCII_US );
+        rtl::OString aT( aResIdAry[(sal_uInt16)eButton].pDefText );
+        aText = rtl::OStringToOUString(aT, RTL_TEXTENCODING_ASCII_US);
     }
     return aText;
 }
diff --git a/vcl/source/control/quickselectionengine.cxx b/vcl/source/control/quickselectionengine.cxx
index ee479d2..aed84b3 100644
--- a/vcl/source/control/quickselectionengine.cxx
+++ b/vcl/source/control/quickselectionengine.cxx
@@ -134,7 +134,7 @@ namespace vcl
         if ( ( c >= 32 ) && ( c != 127 ) && !_keyEvent.GetKeyCode().IsMod2() )
         {
             m_pData->sCurrentSearchString += c;
-            OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: searching for %s", ByteString( m_pData->sCurrentSearchString, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+            OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: searching for %s", rtl::OUStringToOString(m_pData->sCurrentSearchString, RTL_TEXTENCODING_UTF8).getStr() );
 
             if ( m_pData->sCurrentSearchString.Len() == 1 )
             {   // first character in the search -> remmeber
diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx
index c192431..f80b08c 100644
--- a/vcl/source/helper/strhelper.cxx
+++ b/vcl/source/helper/strhelper.cxx
@@ -220,8 +220,7 @@ rtl::OString GetCommandLineToken(int nToken, const rtl::OString& rLine)
 
     *pLeap = 0;
 
-    ByteString aRet( pBuffer );
-    return aRet;
+    return rtl::OString(pBuffer);
 }
 
 int GetCommandLineTokenCount( const String& rLine )
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 6a3331d..f4e5622 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -35,6 +35,8 @@
 #include <window.h>
 #include <brdwin.hxx>
 
+#include <rtl/strbuf.hxx>
+
 #include <vcl/svapp.hxx>
 #include <vcl/event.hxx>
 #include <vcl/wrkwin.hxx>
@@ -55,19 +57,21 @@
 
 #ifdef DBG_UTIL
 
-static ByteString ImplGetDialogText( Dialog* pDialog )
+static rtl::OString ImplGetDialogText( Dialog* pDialog )
 {
-    ByteString aErrorStr( pDialog->GetText(), RTL_TEXTENCODING_UTF8 );
+    rtl::OStringBuffer aErrorStr(rtl::OUStringToOString(
+        pDialog->GetText(), RTL_TEXTENCODING_UTF8));
     if ( (pDialog->GetType() == WINDOW_MESSBOX) ||
          (pDialog->GetType() == WINDOW_INFOBOX) ||
          (pDialog->GetType() == WINDOW_WARNINGBOX) ||
          (pDialog->GetType() == WINDOW_ERRORBOX) ||
          (pDialog->GetType() == WINDOW_QUERYBOX) )
     {
-        aErrorStr += ", ";
-        aErrorStr += ByteString( ((MessBox*)pDialog)->GetMessText(), RTL_TEXTENCODING_UTF8 );
+        aErrorStr.append(", ");
+        aErrorStr.append(rtl::OUStringToOString(
+            ((MessBox*)pDialog)->GetMessText(), RTL_TEXTENCODING_UTF8));
     }
-    return aErrorStr;
+    return aErrorStr.makeStringAndClear();
 }
 
 #endif
@@ -590,9 +594,10 @@ sal_Bool Dialog::ImplStartExecuteModal()
     if ( mbInExecute )
     {
 #ifdef DBG_UTIL
-        ByteString aErrorStr( "Dialog::StartExecuteModal() is called in Dialog::StartExecuteModal(): " );
-        aErrorStr += ImplGetDialogText( this );
-        OSL_FAIL( aErrorStr.GetBuffer() );
+        rtl::OStringBuffer aErrorStr;
+        aErrorStr.append(RTL_CONSTASCII_STRINGPARAM("Dialog::StartExecuteModal() is called in Dialog::StartExecuteModal(): "));
+        aErrorStr.append(ImplGetDialogText(this));
+        OSL_FAIL(aErrorStr.getStr());
 #endif
         return sal_False;
     }
@@ -600,9 +605,10 @@ sal_Bool Dialog::ImplStartExecuteModal()
     if ( Application::IsDialogCancelEnabled() )
     {
 #ifdef DBG_UTIL
-        ByteString aErrorStr( "Dialog::StartExecuteModal() is called in a none UI application: " );
-        aErrorStr += ImplGetDialogText( this );
-        OSL_FAIL( aErrorStr.GetBuffer() );
+        rtl::OStringBuffer aErrorStr;
+        aErrorStr.append(RTL_CONSTASCII_STRINGPARAM("Dialog::StartExecuteModal() is called in a none UI application: "));
+        aErrorStr.append(ImplGetDialogText(this));
+        OSL_FAIL(aErrorStr.getStr());
 #endif
         return sal_False;
     }
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 2d99e55..d0646e0 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -97,6 +97,7 @@
 #include "com/sun/star/accessibility/AccessibleRole.hpp"
 
 #include <sal/macros.h>
+#include <rtl/strbuf.hxx>
 
 #include <set>
 #include <typeinfo>
@@ -4351,12 +4352,17 @@ Window::~Window()
         }
         if ( bError )
         {
-            ByteString aTempStr( "Window (" );
-            aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 );
-            aTempStr += ") with living SystemWindow(s) destroyed: ";
-            aTempStr += aErrorStr;
-            OSL_FAIL( aTempStr.GetBuffer() );
-            GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) );   // abort in non-pro version, this must be fixed!
+            rtl::OStringBuffer aTempStr;
+            aTempStr.append(RTL_CONSTASCII_STRINGPARAM("Window ("));
+            aTempStr.append(rtl::OUStringToOString(GetText(),
+                RTL_TEXTENCODING_UTF8));
+            aTempStr.append(RTL_CONSTASCII_STRINGPARAM(
+                ") with living SystemWindow(s) destroyed: "));
+            aTempStr.append(aErrorStr);
+            OSL_FAIL(aTempStr.getStr());
+            // abort in non-pro version, this must be fixed!
+            GetpApp()->Abort(rtl::OStringToOUString(
+                aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));
         }
 
         bError = sal_False;
commit 365a13d3c5fdc7713a37bd29046cbddc1248d5d0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 14 21:38:29 2011 +0100

    make forms ByteString free

diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index 52c85ad..ebe7361 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -1050,7 +1050,7 @@ void ODatabaseForm::InsertTextPart( INetMIMEMessage& rParent, const ::rtl::OUStr
 
     // Body
     SvMemoryStream* pStream = new SvMemoryStream;
-    pStream->WriteLine( ByteString( UniString(rData), rtl_getTextEncodingFromMimeCharset(pBestMatchingEncoding) ) );
+    pStream->WriteLine( rtl::OUStringToOString(rData, rtl_getTextEncodingFromMimeCharset(pBestMatchingEncoding)) );
     pStream->Flush();
     pStream->Seek( 0 );
     pChild->SetDocumentLB( new SvLockBytes(pStream, sal_True) );


More information about the Libreoffice-commits mailing list