Kaydet (Commit) c5653e81 authored tarafından Sören Möller's avatar Sören Möller Kaydeden (comit) Markus Mohrhard

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
üst efd13135
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#define SC_CHGVISET_HXX #define SC_CHGVISET_HXX
#include <tools/datetime.hxx> #include <tools/datetime.hxx>
#include <tools/string.hxx>
#include "rangelst.hxx" #include "rangelst.hxx"
#include "scdllapi.h" #include "scdllapi.h"
...@@ -50,8 +49,8 @@ private: ...@@ -50,8 +49,8 @@ private:
utl::TextSearch* pCommentSearcher; utl::TextSearch* pCommentSearcher;
DateTime aFirstDateTime; DateTime aFirstDateTime;
DateTime aLastDateTime; DateTime aLastDateTime;
String aAuthorToShow; ::rtl::OUString aAuthorToShow;
String aComment; ::rtl::OUString aComment;
ScRangeList aRangeList; ScRangeList aRangeList;
ScChgsDateMode eDateMode; ScChgsDateMode eDateMode;
sal_Bool bShowIt; sal_Bool bShowIt;
...@@ -108,16 +107,16 @@ public: ...@@ -108,16 +107,16 @@ public:
sal_Bool HasAuthor() const {return bIsAuthor;} sal_Bool HasAuthor() const {return bIsAuthor;}
void SetHasAuthor(sal_Bool nFlag=sal_True) {bIsAuthor=nFlag;} void SetHasAuthor(sal_Bool nFlag=sal_True) {bIsAuthor=nFlag;}
String GetTheAuthorToShow()const {return aAuthorToShow;} ::rtl::OUString GetTheAuthorToShow()const {return aAuthorToShow;}
void SetTheAuthorToShow(const String& aString){aAuthorToShow=aString;} void SetTheAuthorToShow(const ::rtl::OUString& aString){aAuthorToShow=aString;}
sal_Bool HasComment() const {return bIsComment;} sal_Bool HasComment() const {return bIsComment;}
void SetHasComment(sal_Bool nFlag=sal_True) {bIsComment=nFlag;} void SetHasComment(sal_Bool nFlag=sal_True) {bIsComment=nFlag;}
String GetTheComment()const {return aComment;} ::rtl::OUString GetTheComment()const {return aComment;}
void SetTheComment(const String& aString); 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;} sal_Bool IsEveryoneButMe() const {return bEveryoneButMe;}
void SetEveryoneButMe(sal_Bool nFlag=sal_True) {bEveryoneButMe=nFlag;} void SetEveryoneButMe(sal_Bool nFlag=sal_True) {bEveryoneButMe=nFlag;}
......
...@@ -89,21 +89,20 @@ ScChangeViewSettings& ScChangeViewSettings::operator=( const ScChangeViewSetting ...@@ -89,21 +89,20 @@ ScChangeViewSettings& ScChangeViewSettings::operator=( const ScChangeViewSetting
return *this; return *this;
} }
sal_Bool ScChangeViewSettings::IsValidComment(const String* pCommentStr) const sal_Bool ScChangeViewSettings::IsValidComment(const ::rtl::OUString* pCommentStr) const
{ {
sal_Bool nTheFlag=sal_True; sal_Bool nTheFlag=sal_True;
if(pCommentSearcher!=NULL) if(pCommentSearcher!=NULL)
{ {
xub_StrLen nStartPos = 0; sal_Int32 nStartPos = 0;
xub_StrLen nEndPos = pCommentStr->Len(); sal_Int32 nEndPos = pCommentStr->getLength();
nTheFlag=pCommentSearcher->SearchForward(*pCommentStr, &nStartPos, &nEndPos);
nTheFlag=sal::static_int_cast<sal_Bool>(pCommentSearcher->SearchFrwrd( *pCommentStr, &nStartPos, &nEndPos));
} }
return nTheFlag; return nTheFlag;
} }
void ScChangeViewSettings::SetTheComment(const String& rString) void ScChangeViewSettings::SetTheComment(const ::rtl::OUString& rString)
{ {
aComment=rString; aComment=rString;
if(pCommentSearcher!=NULL) if(pCommentSearcher!=NULL)
...@@ -112,7 +111,7 @@ void ScChangeViewSettings::SetTheComment(const String& rString) ...@@ -112,7 +111,7 @@ void ScChangeViewSettings::SetTheComment(const String& rString)
pCommentSearcher=NULL; pCommentSearcher=NULL;
} }
if(rString.Len()>0) if(!rString.isEmpty())
{ {
utl::SearchParam aSearchParam( rString, utl::SearchParam aSearchParam( rString,
utl::SearchParam::SRCH_REGEXP,false,false,false ); utl::SearchParam::SRCH_REGEXP,false,false,false );
......
...@@ -179,7 +179,7 @@ sal_Bool ScViewUtil::IsActionShown( const ScChangeAction& rAction, ...@@ -179,7 +179,7 @@ sal_Bool ScViewUtil::IsActionShown( const ScChangeAction& rAction,
rAction.GetDescription(aTmp, &rDocument); rAction.GetDescription(aTmp, &rDocument);
aBuf.append(aTmp); aBuf.append(aTmp);
aBuf.append(sal_Unicode(')')); aBuf.append(sal_Unicode(')'));
String aComStr = aBuf.makeStringAndClear(); rtl::OUString aComStr = aBuf.makeStringAndClear();
if(!rSettings.IsValidComment(&aComStr)) if(!rSettings.IsValidComment(&aComStr))
return false; return false;
......
...@@ -159,6 +159,9 @@ public: ...@@ -159,6 +159,9 @@ public:
int SearchFrwrd( const String &rStr, int SearchFrwrd( const String &rStr,
xub_StrLen* pStart, xub_StrLen* pEnde, xub_StrLen* pStart, xub_StrLen* pEnde,
::com::sun::star::util::SearchResult* pSrchResult = 0 ); ::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, int SearchBkwrd( const String &rStr,
xub_StrLen* pStart, xub_StrLen* pEnde, xub_StrLen* pStart, xub_StrLen* pEnde,
::com::sun::star::util::SearchResult* pSrchResult = 0 ); ::com::sun::star::util::SearchResult* pSrchResult = 0 );
......
...@@ -247,6 +247,39 @@ int TextSearch::SearchFrwrd( const String & rStr, xub_StrLen* pStart, ...@@ -247,6 +247,39 @@ int TextSearch::SearchFrwrd( const String & rStr, xub_StrLen* pStart,
return nRet; 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, int TextSearch::SearchBkwrd( const String & rStr, xub_StrLen* pStart,
xub_StrLen* pEnde, SearchResult* pRes ) xub_StrLen* pEnde, SearchResult* pRes )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment