[Libreoffice-commits] .: sc/inc sc/source unotools/inc unotools/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Wed Jul 11 14:55:50 PDT 2012
sc/inc/chgviset.hxx | 15 +++++++--------
sc/source/core/tool/chgviset.cxx | 13 ++++++-------
sc/source/ui/view/viewutil.cxx | 2 +-
unotools/inc/unotools/textsearch.hxx | 3 +++
unotools/source/i18n/textsearch.cxx | 33 +++++++++++++++++++++++++++++++++
5 files changed, 50 insertions(+), 16 deletions(-)
New commits:
commit c5653e812eb9729581e24c5e7822441b00b6d059
Author: Sören Möller <soerenmoeller2001 at gmail.com>
Date: Mon Jul 9 21:48:26 2012 +0200
Replaced deprecated tools/String with OUString in sc/../chgviset
Added new TextSearch::SearchForward mirroring TextSearch::SearchFrwrd using OUString and sal_Int32 to make it possible to replace all uses of tools/String
Change-Id: I260d8d3a23d634eab37f28a5ceaf61ace5040540
diff --git a/sc/inc/chgviset.hxx b/sc/inc/chgviset.hxx
index 6d95abc..f3e1dd9 100644
--- a/sc/inc/chgviset.hxx
+++ b/sc/inc/chgviset.hxx
@@ -29,7 +29,6 @@
#define SC_CHGVISET_HXX
#include <tools/datetime.hxx>
-#include <tools/string.hxx>
#include "rangelst.hxx"
#include "scdllapi.h"
@@ -50,8 +49,8 @@ private:
utl::TextSearch* pCommentSearcher;
DateTime aFirstDateTime;
DateTime aLastDateTime;
- String aAuthorToShow;
- String aComment;
+ ::rtl::OUString aAuthorToShow;
+ ::rtl::OUString aComment;
ScRangeList aRangeList;
ScChgsDateMode eDateMode;
sal_Bool bShowIt;
@@ -108,16 +107,16 @@ public:
sal_Bool HasAuthor() const {return bIsAuthor;}
void SetHasAuthor(sal_Bool nFlag=sal_True) {bIsAuthor=nFlag;}
- String GetTheAuthorToShow()const {return aAuthorToShow;}
- void SetTheAuthorToShow(const String& aString){aAuthorToShow=aString;}
+ ::rtl::OUString GetTheAuthorToShow()const {return aAuthorToShow;}
+ void SetTheAuthorToShow(const ::rtl::OUString& aString){aAuthorToShow=aString;}
sal_Bool HasComment() const {return bIsComment;}
void SetHasComment(sal_Bool nFlag=sal_True) {bIsComment=nFlag;}
- String GetTheComment()const {return aComment;}
- void SetTheComment(const String& aString);
+ ::rtl::OUString GetTheComment()const {return aComment;}
+ void SetTheComment(const ::rtl::OUString& aString);
- sal_Bool IsValidComment(const String* pCommentStr) const;
+ sal_Bool IsValidComment(const ::rtl::OUString* pCommentStr) const;
sal_Bool IsEveryoneButMe() const {return bEveryoneButMe;}
void SetEveryoneButMe(sal_Bool nFlag=sal_True) {bEveryoneButMe=nFlag;}
diff --git a/sc/source/core/tool/chgviset.cxx b/sc/source/core/tool/chgviset.cxx
index 061f662..fdd1678 100644
--- a/sc/source/core/tool/chgviset.cxx
+++ b/sc/source/core/tool/chgviset.cxx
@@ -89,21 +89,20 @@ ScChangeViewSettings& ScChangeViewSettings::operator=( const ScChangeViewSetting
return *this;
}
-sal_Bool ScChangeViewSettings::IsValidComment(const String* pCommentStr) const
+sal_Bool ScChangeViewSettings::IsValidComment(const ::rtl::OUString* pCommentStr) const
{
sal_Bool nTheFlag=sal_True;
if(pCommentSearcher!=NULL)
{
- xub_StrLen nStartPos = 0;
- xub_StrLen nEndPos = pCommentStr->Len();
-
- nTheFlag=sal::static_int_cast<sal_Bool>(pCommentSearcher->SearchFrwrd( *pCommentStr, &nStartPos, &nEndPos));
+ sal_Int32 nStartPos = 0;
+ sal_Int32 nEndPos = pCommentStr->getLength();
+ nTheFlag=pCommentSearcher->SearchForward(*pCommentStr, &nStartPos, &nEndPos);
}
return nTheFlag;
}
-void ScChangeViewSettings::SetTheComment(const String& rString)
+void ScChangeViewSettings::SetTheComment(const ::rtl::OUString& rString)
{
aComment=rString;
if(pCommentSearcher!=NULL)
@@ -112,7 +111,7 @@ void ScChangeViewSettings::SetTheComment(const String& rString)
pCommentSearcher=NULL;
}
- if(rString.Len()>0)
+ if(!rString.isEmpty())
{
utl::SearchParam aSearchParam( rString,
utl::SearchParam::SRCH_REGEXP,false,false,false );
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index 74bcb89..574d1c6 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -179,7 +179,7 @@ sal_Bool ScViewUtil::IsActionShown( const ScChangeAction& rAction,
rAction.GetDescription(aTmp, &rDocument);
aBuf.append(aTmp);
aBuf.append(sal_Unicode(')'));
- String aComStr = aBuf.makeStringAndClear();
+ rtl::OUString aComStr = aBuf.makeStringAndClear();
if(!rSettings.IsValidComment(&aComStr))
return false;
diff --git a/unotools/inc/unotools/textsearch.hxx b/unotools/inc/unotools/textsearch.hxx
index 58e49aa..1f955bc 100644
--- a/unotools/inc/unotools/textsearch.hxx
+++ b/unotools/inc/unotools/textsearch.hxx
@@ -159,6 +159,9 @@ public:
int SearchFrwrd( const String &rStr,
xub_StrLen* pStart, xub_StrLen* pEnde,
::com::sun::star::util::SearchResult* pSrchResult = 0 );
+ sal_Bool SearchForward( const ::rtl::OUString &rStr,
+ sal_Int32* pStart, sal_Int32* pEnd,
+ ::com::sun::star::util::SearchResult* pRes = 0 );
int SearchBkwrd( const String &rStr,
xub_StrLen* pStart, xub_StrLen* pEnde,
::com::sun::star::util::SearchResult* pSrchResult = 0 );
diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx
index 70cd7ae..b78a45f 100644
--- a/unotools/source/i18n/textsearch.cxx
+++ b/unotools/source/i18n/textsearch.cxx
@@ -247,6 +247,39 @@ int TextSearch::SearchFrwrd( const String & rStr, xub_StrLen* pStart,
return nRet;
}
+sal_Bool TextSearch::SearchForward( const ::rtl::OUString &rStr,
+ sal_Int32* pStart, sal_Int32* pEnd,
+ ::com::sun::star::util::SearchResult* pRes)
+{
+ sal_Bool nRet = sal_False;
+ try
+ {
+ if( xTextSearch.is() )
+ {
+ SearchResult aRet( xTextSearch->searchForward(
+ rStr, *pStart, *pEnd ));
+ if( aRet.subRegExpressions > 0 )
+ {
+ nRet = sal_True;
+ // the XTextsearch returns in startOffset the higher position
+ // and the endposition is allways exclusive.
+ // The caller of this function will have in startPos the
+ // lower pos. and end
+ *pStart = aRet.startOffset[ 0 ];
+ *pEnd = aRet.endOffset[ 0 ];
+ if( pRes )
+ *pRes = aRet;
+ }
+ }
+ }
+ catch ( Exception& )
+ {
+ SAL_WARN( "unotools.i18n", "SearchForward: Exception caught!" );
+ }
+ return nRet;
+}
+
+
int TextSearch::SearchBkwrd( const String & rStr, xub_StrLen* pStart,
xub_StrLen* pEnde, SearchResult* pRes )
{
More information about the Libreoffice-commits
mailing list