[Libreoffice-commits] .: 7 commits - configure.in desktop/source starmath/inc starmath/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 2 09:55:32 PDT 2012


 configure.in                     |    2 -
 desktop/source/splash/splash.cxx |    1 
 starmath/inc/edit.hxx            |    4 +-
 starmath/inc/utility.hxx         |   10 +-----
 starmath/source/cursor.cxx       |    2 -
 starmath/source/edit.cxx         |   64 ++++++++++++++++++---------------------
 starmath/source/mathmlexport.cxx |    2 -
 starmath/source/mathmlimport.cxx |    3 -
 starmath/source/unomodel.cxx     |   18 ++++------
 starmath/source/utility.cxx      |   29 +++++------------
 starmath/source/view.cxx         |   12 +------
 11 files changed, 58 insertions(+), 89 deletions(-)

New commits:
commit 2d25eea6949196d2275d8b2bd484e6dab0163a33
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Tue Oct 2 20:53:27 2012 +0400

    splash screen: fix RTL mode
    
    Change-Id: I6a00cba8fda11351ed5340f21678c330ce028a2d

diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index e55b5b2..95cdc67 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -155,6 +155,7 @@ SplashScreen::SplashScreen()
     , _yoffset(18)
 {
     loadConfig();
+    _vdev.EnableRTL(IsRTLEnabled());
 }
 
 SplashScreen::~SplashScreen()
commit 509d964e985b58ddc4c20ccc163809a6f3623d8a
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Tue Oct 2 20:43:41 2012 +0400

    correct help string: horizontal -> vertical
    
    Change-Id: Id67da9d90a8fa21b99733c448fc32e81c6f1ab46

diff --git a/configure.in b/configure.in
index fba3bc2..2974db0 100644
--- a/configure.in
+++ b/configure.in
@@ -1989,7 +1989,7 @@ AC_ARG_WITH(intro-progressbar-text-color,
 
 AC_ARG_WITH(intro-progressbar-text-baseline,
     AS_HELP_STRING([--with-intro-progressbar-text-baseline],
-        [Set horizontal position of progress bar text on intro screen. Value in decimal format.])
+        [Set vertical position of progress bar text on intro screen. Value in decimal format.])
     [
                           Usage: --with-intro-progressbar-text-baseline=250
 ],,)
commit 86b9e14bc8fed823ae39ebc5fee62e98c524d3fe
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Tue Oct 2 16:59:26 2012 +0400

    String -> OUString
    
    Change-Id: I88873eec738a068152e7d7be0dc4ab86fcfe345a

diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx
index 67e6574..be7b52d 100644
--- a/starmath/inc/edit.hxx
+++ b/starmath/inc/edit.hxx
@@ -113,7 +113,7 @@ public:
     void                Paste();
     void                Delete();
     void                SelectAll();
-    void                InsertText(const String &rText);
+    void                InsertText(const OUString &rText);
     void                InsertCommand(sal_uInt16 nCommand);
     void                MarkError(const Point &rPos);
     void                SelNextMark();
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index c3514ad..8ba0529 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -484,7 +484,7 @@ SmNodeList::iterator SmCursor::TakeSelectedNodesFromList(SmNodeList *pLineList,
                 }
                 //If we need to save the selected text
                 if(pSelectedNodes && len2 > 0) {
-                    String str = aText.copy(start2, len2);
+                    OUString str = aText.copy(start2, len2);
                     SmTextNode* pSeg2 = new SmTextNode(aToken, eFontDesc);
                     pSeg2->ChangeText(str);
                     pSelectedNodes->push_back(pSeg2);
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 1c0510a..b6d83e0 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -912,12 +912,12 @@ void SmEditWindow::Delete()
     }
 }
 
-void SmEditWindow::InsertText(const String& Text)
+void SmEditWindow::InsertText(const OUString& rText)
 {
     OSL_ENSURE( pEditView, "EditView missing" );
     if (pEditView)
     {
-        pEditView->InsertText(Text);
+        pEditView->InsertText(rText);
         aModifyTimer.Start();
         StartCursorMove();
     }
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 5707439..2f7e0a7 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1466,8 +1466,6 @@ bool SmViewShell::Insert( SfxMedium& rMedium )
     RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Insert" );
 
     SmDocShell *pDoc = GetDoc();
-    String aText( pDoc->GetText() );
-    String aTemp = aText;
     bool bRet = false;
 
     uno::Reference < embed::XStorage > xStorage = rMedium.GetStorage();
@@ -1485,15 +1483,13 @@ bool SmViewShell::Insert( SfxMedium& rMedium )
 
     if( bRet )
     {
-        aText = pDoc->GetText();
+        OUString aText = pDoc->GetText();
         SmEditWindow *pEditWin = GetEditWindow();
         if (pEditWin)
             pEditWin->InsertText( aText );
         else
         {
             OSL_FAIL( "EditWindow missing" );
-            aTemp += aText;
-            aText  = aTemp;
         }
 
         pDoc->Parse();
@@ -1514,8 +1510,6 @@ bool SmViewShell::InsertFrom(SfxMedium &rMedium)
     bool        bSuccess = false;
     SmDocShell *pDoc = GetDoc();
     SvStream   *pStream = rMedium.GetInStream();
-    String      aText( pDoc->GetText() );
-    String      aTemp = aText;
 
     if (pStream)
     {
@@ -1530,15 +1524,13 @@ bool SmViewShell::InsertFrom(SfxMedium &rMedium)
 
     if( bSuccess )
     {
-        aText = pDoc->GetText();
+        OUString aText = pDoc->GetText();
         SmEditWindow *pEditWin = GetEditWindow();
         if (pEditWin)
             pEditWin->InsertText( aText );
         else
         {
             OSL_FAIL( "EditWindow missing" );
-            aTemp += aText;
-            aText  = aTemp;
         }
 
         pDoc->Parse();
commit 939d6400401d01658d173b67d17b2051c3468bb6
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Mon Oct 1 22:09:35 2012 +0400

    String -> OUString
    
    Change-Id: I9921e9803e5d63fafffbfcf15e5c4fc2c9080669

diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx
index 2096b92..67e6574 100644
--- a/starmath/inc/edit.hxx
+++ b/starmath/inc/edit.hxx
@@ -118,7 +118,7 @@ public:
     void                MarkError(const Point &rPos);
     void                SelNextMark();
     void                SelPrevMark();
-    bool                HasMark(const String &rText) const;
+    bool                HasMark(const OUString &rText) const;
 
     void                Flush();
     void                DeleteEditView( SmViewShell &rView );
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 5091d40..1c0510a 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -237,7 +237,7 @@ void SmEditWindow::DataChanged( const DataChangedEvent& )
         // forces new settings to be used
         // unfortunately this resets the whole edit engine
         // thus we need to save at least the text
-        String aTxt( pEditEngine->GetText( LINEEND_LF ) );
+        OUString aTxt( pEditEngine->GetText( LINEEND_LF ) );
         pEditEngine->Clear();   //incorrect font size
         pEditEngine->SetText( aTxt );
     }
@@ -686,8 +686,8 @@ bool SmEditWindow::IsAllSelected() const
         sal_Int32 nParaCnt = pEditEngine->GetParagraphCount();
         if (!(nParaCnt - 1))
         {
-            String Text( pEditEngine->GetText( LINEEND_LF ) );
-            bRes = !eSelection.nStartPos && (eSelection.nEndPos == Text.Len () - 1);
+            sal_uInt16 nTextLen = pEditEngine->GetText( LINEEND_LF ).Len();
+            bRes = !eSelection.nStartPos && (eSelection.nEndPos == nTextLen - 1);
         }
         else
         {
@@ -719,7 +719,7 @@ void SmEditWindow::InsertCommand(sal_uInt16 nCommand)
         aSelection.nEndPara = aSelection.nStartPara;
 
         OSL_ENSURE( pEditView, "NULL pointer" );
-        String  aText = String(SmResId(nCommand));
+        OUString aText = SM_RESSTR(nCommand);
         pEditView->InsertText(aText);
 
         if (HasMark(aText))
@@ -729,7 +729,7 @@ void SmEditWindow::InsertCommand(sal_uInt16 nCommand)
         }
         else
         {   // set selection after inserted text
-            aSelection.nEndPos    = aSelection.nEndPos + sal::static_int_cast< xub_StrLen >(aText.Len());
+            aSelection.nEndPos += aText.getLength();
             aSelection.nStartPos  = aSelection.nEndPos;
             pEditView->SetSelection(aSelection);
         }
@@ -761,23 +761,21 @@ void SmEditWindow::SelNextMark()
     if (pEditEngine  &&  pEditView)
     {
         ESelection eSelection = pEditView->GetSelection();
-        sal_uInt16     Pos        = eSelection.nEndPos;
-        rtl::OUString aMark("<?>");
-        String     aText;
+        sal_Int32 nPos = eSelection.nEndPos;
         sal_uInt16     nCounts    = pEditEngine->GetParagraphCount();
 
         while (eSelection.nEndPara < nCounts)
         {
-            aText = pEditEngine->GetText( eSelection.nEndPara );
-            Pos   = aText.Search(aMark, Pos);
-
-            if (Pos != STRING_NOTFOUND)
+            OUString aText = pEditEngine->GetText(eSelection.nEndPara);
+            nPos = aText.indexOf("<?>", nPos);
+            if (nPos != -1)
             {
-                pEditView->SetSelection(ESelection (eSelection.nEndPara, Pos, eSelection.nEndPara, Pos + 3));
+                pEditView->SetSelection(ESelection(
+                    eSelection.nEndPara, nPos, eSelection.nEndPara, nPos + 3));
                 break;
             }
 
-            Pos = 0;
+            nPos = 0;
             eSelection.nEndPara++;
         }
     }
@@ -791,43 +789,43 @@ void SmEditWindow::SelPrevMark()
     if (pEditEngine  &&  pEditView)
     {
         ESelection eSelection = pEditView->GetSelection();
-        sal_uInt16     Pos        = STRING_NOTFOUND;
-        xub_StrLen Max        = eSelection.nStartPos;
-        String     Text( pEditEngine->GetText( eSelection.nStartPara ) );
-        rtl::OUString aMark("<?>");
+        sal_Int32 nPos = -1;
+        sal_Int32 nMax = eSelection.nStartPos;
+        OUString aText(pEditEngine->GetText(eSelection.nStartPara));
+        OUString aMark("<?>");
         sal_uInt16     nCounts    = pEditEngine->GetParagraphCount();
 
         do
         {
-            sal_uInt16 Fnd = Text.Search(aMark, 0);
-
-            while ((Fnd < Max) && (Fnd != STRING_NOTFOUND))
+            sal_Int32 nMarkIndex = aText.indexOf(aMark);
+            while ((nMarkIndex < nMax) && (nMarkIndex != -1))
             {
-                Pos = Fnd;
-                Fnd = Text.Search(aMark, Fnd + 1);
+                nPos = nMarkIndex;
+                nMarkIndex = aText.indexOf(aMark, nMarkIndex + 1);
             }
 
-            if (Pos == STRING_NOTFOUND)
+            if (nPos == -1)
             {
                 eSelection.nStartPara--;
-                Text = pEditEngine->GetText( eSelection.nStartPara );
-                Max = Text.Len();
+                aText = pEditEngine->GetText(eSelection.nStartPara);
+                nMax = aText.getLength();
             }
         }
         while ((eSelection.nStartPara < nCounts) &&
-            (Pos == STRING_NOTFOUND));
+            (nPos == -1));
 
-        if (Pos != STRING_NOTFOUND)
+        if (nPos != -1)
         {
-            pEditView->SetSelection(ESelection (eSelection.nStartPara, Pos, eSelection.nStartPara, Pos + 3));
+            pEditView->SetSelection(ESelection(
+                eSelection.nStartPara, nPos, eSelection.nStartPara, nPos + 3));
         }
     }
 }
 
-bool SmEditWindow::HasMark(const String& rText) const
+bool SmEditWindow::HasMark(const OUString& rText) const
     // returns true iff 'rText' contains a mark
 {
-    return rText.SearchAscii("<?>", 0) != STRING_NOTFOUND;
+    return rText.indexOf("<?>") != -1;
 }
 
 void SmEditWindow::MouseMove(const MouseEvent &rEvt)
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index ccca612..1ecaff1 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -134,7 +134,7 @@ sal_Bool SmXMLExportWrapper::Export(SfxMedium &rMedium)
         if (xStatusIndicator.is())
         {
             sal_Int32 nProgressRange = bFlat ? 1 : 3;
-            xStatusIndicator->start(String(SmResId(STR_STATSTR_WRITING)),
+            xStatusIndicator->start(SM_RESSTR(STR_STATSTR_WRITING),
                 nProgressRange);
         }
     }
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 04d26ef..a71fc36 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -171,8 +171,7 @@ sal_uLong SmXMLImportWrapper::Import(SfxMedium &rMedium)
     sal_Int32 nProgressRange(nSteps);
     if (xStatusIndicator.is())
     {
-        xStatusIndicator->start(String(SmResId(STR_STATSTR_READING)),
-            nProgressRange);
+        xStatusIndicator->start(SM_RESSTR(STR_STATSTR_READING), nProgressRange);
     }
 
     nSteps=0;
commit 3c8e3212045b66abf5af0976c6b4d09b64e051b0
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Mon Oct 1 21:39:33 2012 +0400

    String -> OUString
    
    Change-Id: I1cfd68c37629b4847bad88f54d2866496bc91283

diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx
index 52aa72e..1184c85 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -127,7 +127,7 @@ protected:
 
     virtual bool    CompareItem(const void *pFirstItem, const void *pSecondItem) const = 0;
 
-    virtual String  GetStringItem(void *pItem) = 0;
+    virtual OUString GetStringItem(void *pItem) = 0;
 
     void       *GetPtr(sal_uInt16 nPos) const { return SfxPtrArr::GetObject(nPos); }
     void      *&GetPtr(sal_uInt16 nPos) { return SfxPtrArr::GetObject(nPos); }
@@ -172,7 +172,7 @@ protected:
 
     virtual bool    CompareItem(const void *pFirstItem, const void *pSecondItem) const;
 
-    virtual String  GetStringItem(void *pItem);
+    virtual OUString GetStringItem(void *pItem);
 
 public:
     SmFontPickList()
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index 7cef6de..cde1b35 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -19,7 +19,6 @@
 
 #include <sfx2/app.hxx>
 #include <vcl/virdev.hxx>
-#include <tools/string.hxx>
 #include <tools/tenccvt.hxx>
 #include <osl/thread.h>
 
@@ -156,28 +155,23 @@ bool SmFontPickList::CompareItem(const void *pFirstItem, const void *pSecondItem
     return false;
 }
 
-String SmFontPickList::GetStringItem(void *pItem)
+OUString SmFontPickList::GetStringItem(void *pItem)
 {
-    Font   *pFont;
-    String  aString;
-    const sal_Char *pDelim = ", ";
-
-    pFont = (Font *)pItem;
-
-    aString = pFont->GetName();
+    Font *pFont = (Font *)pItem;
+    OUStringBuffer aString(pFont->GetName());
 
     if (IsItalic( *pFont ))
     {
-        aString.AppendAscii( pDelim );
-        aString += String(SmResId(RID_FONTITALIC));
+        aString.append(", ");
+        aString.append(SM_RESSTR(RID_FONTITALIC));
     }
     if (IsBold( *pFont ))
     {
-        aString.AppendAscii( pDelim );
-        aString += String(SmResId(RID_FONTBOLD));
+        aString.append(", ");
+        aString.append(SM_RESSTR(RID_FONTBOLD));
     }
 
-    return (aString);
+    return aString.makeStringAndClear();
 }
 
 void SmFontPickList::Insert(const Font &rFont)
@@ -213,7 +207,7 @@ void SmFontPickList::WriteTo(SmFontDialog& rDialog) const
 IMPL_LINK( SmFontPickListBox, SelectHdl, ListBox *, /*pListBox*/ )
 {
     sal_uInt16  nPos;
-    String  aString;
+    OUString aString;
 
     nPos = GetSelectEntryPos();
 
commit 6fa4242439466be61c159d54cd85c2c44b631c32
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Mon Oct 1 21:32:31 2012 +0400

    remove unused method
    
    Change-Id: I7acca32fdf9902ce598bdbed32cccdecf9a08907

diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx
index 9ea1281..52aa72e 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -27,10 +27,6 @@
 #include <tools/fract.hxx>
 
 
-class String;
-
-/////////////////////////////////////////////////////////////////
-
 inline long SmPtsTo100th_mm(long nNumPts)
     // returns the length (in 100th of mm) that corresponds to the length
     // 'nNumPts' (in units points).
@@ -126,7 +122,6 @@ class SmPickList : public SfxPtrArr
 protected:
     sal_uInt16  nSize;
 
-    virtual void   *CreateItem(const String& rString) = 0;
     virtual void   *CreateItem(const void *pItem) = 0;
     virtual void    DestroyItem(void *pItem) = 0;
 
@@ -172,7 +167,6 @@ class SmFontDialog;
 class SmFontPickList : public SmPickList
 {
 protected:
-    virtual void   *CreateItem(const String& rString);
     virtual void   *CreateItem(const void *pItem);
     virtual void    DestroyItem(void *pItem);
 
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index f1d6440..7cef6de 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -129,11 +129,6 @@ void SmPickList::Clear()
 
 /**************************************************************************/
 
-void * SmFontPickList::CreateItem(const String& /*rString*/)
-{
-    return new Font();
-}
-
 void * SmFontPickList::CreateItem(const void *pItem)
 {
     return new Font(*((Font *) pItem));
commit 10272d32865b2d9754f89a50efde6e685b39b036
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Mon Oct 1 21:27:28 2012 +0400

    String -> OUString
    
    Change-Id: Ibbd6305e78738403b5140a27125f452b3ec2ec8b

diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 0cba7cc..74a545d 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -58,9 +58,6 @@ using namespace ::com::sun::star::formula;
 using namespace ::com::sun::star::view;
 using namespace ::com::sun::star::script;
 
-
-using rtl::OUString;
-
 #define TWIP_TO_MM100(TWIP)     ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
 #define MM100_TO_TWIP(MM100)    ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
 
@@ -91,9 +88,9 @@ SmPrintUIOptions::SmPrintUIOptions()
 
     // create Section for formula (results in an extra tab page in dialog)
     SvtModuleOptions aOpt;
-    String aAppGroupname( aLocalizedStrings.GetString( 0 ) );
-    aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ),
-                                    aOpt.GetModuleName( SvtModuleOptions::E_SMATH ) );
+    OUString aAppGroupname(
+        aLocalizedStrings.GetString( 0 ).
+            replaceFirst( "%s", aOpt.GetModuleName( SvtModuleOptions::E_SMATH ) ) );
     m_aUIProperties[nIdx++].Value = setGroupControlOpt("tabcontrol-page2", aAppGroupname, ".HelpID:vcl:PrintDialog:TabPage:AppPage");
 
     // create subgroup for print options
@@ -473,13 +470,12 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
             case HANDLE_CUSTOM_FONT_NAME_SANS              :
             case HANDLE_CUSTOM_FONT_NAME_FIXED             :
             {
-                OUString aText;
-                *pValues >>= aText;
-                String sFontName = aText;
-                if(!sFontName.Len())
+                OUString sFontName;
+                *pValues >>= sFontName;
+                if(sFontName.isEmpty())
                     throw IllegalArgumentException();
 
-                if(aFormat.GetFont((*ppEntries)->mnMemberId).GetName() != sFontName)
+                if(OUString(aFormat.GetFont((*ppEntries)->mnMemberId).GetName()) != sFontName)
                 {
                     const SmFace rOld = aFormat.GetFont((*ppEntries)->mnMemberId);
 


More information about the Libreoffice-commits mailing list