[Libreoffice-commits] core.git: basctl/source cui/source include/sfx2 sc/source sd/source sfx2/source sw/source

Ivan Timofeev timofeev.i.s at gmail.com
Wed Aug 14 02:50:59 PDT 2013


 basctl/source/basicide/basides2.cxx   |    4 ++--
 basctl/source/inc/basidesh.hxx        |    2 +-
 cui/source/tabpages/autocdlg.cxx      |    4 ++--
 include/sfx2/viewsh.hxx               |    2 +-
 sc/source/ui/inc/editsh.hxx           |    2 +-
 sc/source/ui/inc/tabvwsh.hxx          |    2 +-
 sc/source/ui/view/editsh.cxx          |    4 ++--
 sc/source/ui/view/tabvwshe.cxx        |   12 ++++--------
 sd/source/ui/inc/DrawViewShell.hxx    |    2 +-
 sd/source/ui/inc/OutlineViewShell.hxx |    2 +-
 sd/source/ui/inc/ViewShellBase.hxx    |    2 +-
 sd/source/ui/view/ViewShellBase.cxx   |    2 +-
 sd/source/ui/view/drviewsf.cxx        |    2 +-
 sd/source/ui/view/outlnvsh.cxx        |    2 +-
 sfx2/source/view/viewsh.cxx           |    6 +++---
 sw/source/ui/inc/view.hxx             |    6 +++---
 sw/source/ui/index/swuiidxmrk.cxx     |    4 ++--
 sw/source/ui/uiview/view.cxx          |    7 +++----
 18 files changed, 31 insertions(+), 36 deletions(-)

New commits:
commit dcbad1b3bfe719f4eecdfafe8c78dd01f34b6605
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Tue Aug 13 23:01:07 2013 +0400

    convert GetSelectionText... methods to OUString and bool
    
    Change-Id: I77726f009338ae49877c5f58fe6c14d386089bbe

diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
index 8e1daa8..052486c 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -63,9 +63,9 @@ sal_Bool Shell::HasSelection( sal_Bool /* bText */ ) const
     return false;
 }
 
-String Shell::GetSelectionText( sal_Bool bWholeWord )
+OUString Shell::GetSelectionText( bool bWholeWord )
 {
-    String aText;
+    OUString aText;
     if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin))
     {
         if (TextView* pEditView = pMCurWin->GetEditView())
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index b16f535..1945d8a 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -179,7 +179,7 @@ public:
     // virtual sal_uInt16           Print( SfxProgress &rProgress, sal_Bool bIsAPI, PrintDialog *pPrintDialog = 0 );
     virtual SfxPrinter*     GetPrinter( sal_Bool bCreate );
     virtual sal_uInt16      SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
-    virtual String          GetSelectionText( sal_Bool bCompleteWords );
+    virtual OUString        GetSelectionText( bool bCompleteWords );
     virtual sal_Bool        HasSelection( sal_Bool bText ) const;
 
     void                GetState( SfxItemSet& );
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 2b57b6c..014b889 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -1032,10 +1032,10 @@ void OfaAutocorrReplacePage::RefillReplaceBox(sal_Bool bFromReset,
     if( pViewShell && pViewShell->HasSelection( sal_True ) )
     {
         bHasSelectionText = sal_True;
-        const String sSelection( pViewShell->GetSelectionText() );
+        const OUString sSelection( pViewShell->GetSelectionText() );
         m_pReplaceED->SetText( sSelection );
         m_pTextOnlyCB->Check( !bSWriter );
-        m_pTextOnlyCB->Enable( bSWriter && sSelection.Len() );
+        m_pTextOnlyCB->Enable( bSWriter && !sSelection.isEmpty() );
     }
     else
     {
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index ad4c64c..b09708e 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -185,7 +185,7 @@ public:
 
     // Misc
     virtual sal_uInt16              PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
-    virtual String              GetSelectionText( sal_Bool bCompleteWords = sal_False );
+    virtual OUString            GetSelectionText( bool bCompleteWords = false );
     virtual sal_Bool                HasSelection( sal_Bool bText = sal_True ) const;
     virtual SdrView*            GetDrawView() const;
 
diff --git a/sc/source/ui/inc/editsh.hxx b/sc/source/ui/inc/editsh.hxx
index f888bbc..1f84d27 100644
--- a/sc/source/ui/inc/editsh.hxx
+++ b/sc/source/ui/inc/editsh.hxx
@@ -69,7 +69,7 @@ public:
     void    ExecuteUndo(SfxRequest& rReq);
     void    GetUndoState(SfxItemSet &rSet);
 
-    String  GetSelectionText( sal_Bool bWholeWord );
+    OUString GetSelectionText( bool bWholeWord );
 };
 
 
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 06cd9c8..a5da444 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -213,7 +213,7 @@ protected:
 
     virtual void    QueryObjAreaPixel( Rectangle& rRect ) const;
 
-    virtual String  GetSelectionText( sal_Bool bWholeWord );
+    virtual OUString GetSelectionText( bool bWholeWord );
     virtual sal_Bool    HasSelection( sal_Bool bText ) const;
     virtual String  GetDescription() const;
 
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 58fc542..76a9529 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -1131,9 +1131,9 @@ void ScEditShell::GetAttrState(SfxItemSet &rSet)
     }
 }
 
-String ScEditShell::GetSelectionText( sal_Bool bWholeWord )
+OUString ScEditShell::GetSelectionText( bool bWholeWord )
 {
-    String aStrSelection;
+    OUString aStrSelection;
 
     if ( pViewData->HasEditView( pViewData->GetActivePart() ) )    // #125326#
     {
diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx
index e64b22b..effbc7a 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -42,9 +42,9 @@
 
 //==================================================================
 
-String ScTabViewShell::GetSelectionText( sal_Bool bWholeWord )
+OUString ScTabViewShell::GetSelectionText( bool bWholeWord )
 {
-    String aStrSelection;
+    OUString aStrSelection;
 
     if ( pEditShell && pEditShell == GetMySubShell() )
     {
@@ -107,12 +107,8 @@ String ScTabViewShell::GetSelectionText( sal_Bool bWholeWord )
 
             if ( bInFormatDialog || bWholeWord || aRange.aEnd.Row() == aRange.aStart.Row() )
             {
-                xub_StrLen nAt;
-                while (  (nAt = aStrSelection.Search( CHAR_CR )) != STRING_NOTFOUND )
-                    aStrSelection.SetChar( nAt, ' ' );
-                while (  (nAt = aStrSelection.Search( '\t' )) != STRING_NOTFOUND )
-                    aStrSelection.SetChar( nAt, ' ' );
-
+                aStrSelection = aStrSelection.replaceAll(OUString(CHAR_CR), " ");
+                aStrSelection = aStrSelection.replaceAll("\t", " ");
                 aStrSelection = comphelper::string::stripEnd(aStrSelection, ' ');
             }
         }
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 61c8d1c..1565648 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -154,7 +154,7 @@ public:
     virtual void    Deactivate(sal_Bool IsMDIActivate);
     virtual void    UIActivating( SfxInPlaceClient* );
     virtual void    UIDeactivated( SfxInPlaceClient* );
-    virtual String  GetSelectionText( sal_Bool bCompleteWords = sal_False );
+    virtual OUString GetSelectionText( bool bCompleteWords = false );
     virtual sal_Bool    HasSelection( sal_Bool bText = sal_True ) const;
 
     void            ExecCtrl(SfxRequest& rReq);
diff --git a/sd/source/ui/inc/OutlineViewShell.hxx b/sd/source/ui/inc/OutlineViewShell.hxx
index f4ca53f..957b3af 100644
--- a/sd/source/ui/inc/OutlineViewShell.hxx
+++ b/sd/source/ui/inc/OutlineViewShell.hxx
@@ -102,7 +102,7 @@ public:
 
     virtual void SetZoom(long nZoom);
     virtual void SetZoomRect(const Rectangle& rZoomRect);
-    virtual String  GetSelectionText( sal_Bool bCompleteWords = sal_False );
+    virtual OUString GetSelectionText( bool bCompleteWords = false );
     virtual sal_Bool    HasSelection( sal_Bool bText = sal_True ) const;
 
     void Execute(SfxRequest& rReq);
diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx
index 0de9a17..dc1cc4e 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -115,7 +115,7 @@ public:
     virtual void GetState (SfxItemSet& rSet);
 
     /* override these from SfxViewShell */
-    virtual String GetSelectionText(sal_Bool);
+    virtual OUString GetSelectionText(bool);
     virtual sal_Bool HasSelection(sal_Bool) const;
 
     SvBorder GetBorder (bool bOuterResize);
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index a069311..4c6817f 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -459,7 +459,7 @@ void ViewShellBase::InitializeFramework (void)
 }
 
 
-String ViewShellBase::GetSelectionText(sal_Bool bCompleteWords)
+OUString ViewShellBase::GetSelectionText(bool bCompleteWords)
 {
     ::boost::shared_ptr<ViewShell> const pMainShell(GetMainViewShell());
     DrawViewShell *const pDrawViewShell(
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index f18f175..5667740 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -744,7 +744,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
 
 
 
-String DrawViewShell::GetSelectionText(sal_Bool bCompleteWords)
+OUString DrawViewShell::GetSelectionText(bool bCompleteWords)
 {
     OUString aStrSelection;
     ::Outliner* pOl = mpDrawView->GetTextEditOutliner();
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 1c5a50d..6e0cee7 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -1466,7 +1466,7 @@ sal_Bool OutlineViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin)
 /**
  * Return text of the selection
  */
-String OutlineViewShell::GetSelectionText(sal_Bool bCompleteWords)
+OUString OutlineViewShell::GetSelectionText(bool bCompleteWords)
 {
     OUString aStrSelection;
     ::Outliner* pOl = pOlView->GetOutliner();
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index fa00d8b..b4387cb 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1357,9 +1357,9 @@ SdrView* SfxViewShell::GetDrawView() const
 
 //--------------------------------------------------------------------
 
-String SfxViewShell::GetSelectionText
+OUString SfxViewShell::GetSelectionText
 (
-    sal_Bool /*bCompleteWords*/     /*  FALSE (default)
+    bool /*bCompleteWords*/ /*  FALSE (default)
                                 Only the actual selected text is returned.
 
                                 TRUE
@@ -1382,7 +1382,7 @@ String SfxViewShell::GetSelectionText
 */
 
 {
-    return String();
+    return OUString();
 }
 
 //--------------------------------------------------------------------
diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx
index 056ae0d..d7f538d 100644
--- a/sw/source/ui/inc/view.hxx
+++ b/sw/source/ui/inc/view.hxx
@@ -413,10 +413,10 @@ public:
 
     com::sun::star::view::XSelectionSupplier*       GetUNOObject();
 
-    String                  GetSelectionTextParam( sal_Bool bCompleteWords,
-                                                   sal_Bool bEraseTrail );
+    OUString                GetSelectionTextParam( bool bCompleteWords,
+                                                   bool bEraseTrail );
     virtual sal_Bool            HasSelection( sal_Bool  bText ) const;
-    virtual String          GetSelectionText( sal_Bool bCompleteWords = sal_False );
+    virtual OUString        GetSelectionText( bool bCompleteWords = false );
     virtual sal_uInt16          PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False );
     virtual void            MarginChanged();
 
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 8c89daf..1421e2f 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -269,7 +269,7 @@ void SwIndexMarkPane::InitControls()
         if (nCnt < 2)
         {
             bSelected = !pSh->HasSelection();
-            aOrgStr = pSh->GetView().GetSelectionTextParam(sal_True, sal_False);
+            aOrgStr = pSh->GetView().GetSelectionTextParam(true, false);
             m_pEntryED->SetText(aOrgStr);
 
             //to include all equal entries may only be allowed in the body and even there
@@ -361,7 +361,7 @@ void    SwIndexMarkPane::Activate()
         if (nCnt < 2)
         {
             bSelected = !pSh->HasSelection();
-            aOrgStr = pSh->GetView().GetSelectionTextParam(sal_True, sal_False);
+            aOrgStr = pSh->GetView().GetSelectionTextParam(true, false);
             m_pEntryED->SetText(aOrgStr);
 
             //to include all equal entries may only be allowed in the body and even there
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 0323f6d..94fd75e 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -1572,13 +1572,12 @@ sal_Bool SwView::HasSelection( sal_Bool  bText ) const
                  : GetWrtShell().HasSelection();
 }
 
-String SwView::GetSelectionText( sal_Bool bCompleteWrds )
+OUString SwView::GetSelectionText( bool bCompleteWrds )
 {
-    return GetSelectionTextParam( bCompleteWrds, sal_True );
+    return GetSelectionTextParam( bCompleteWrds, true );
 }
 
-String  SwView::GetSelectionTextParam( sal_Bool bCompleteWrds,
-                                       sal_Bool bEraseTrail )
+OUString SwView::GetSelectionTextParam( bool bCompleteWrds, bool bEraseTrail )
 {
     String sReturn;
     if( bCompleteWrds && !GetWrtShell().HasSelection() )


More information about the Libreoffice-commits mailing list