summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/crsrsh.hxx17
-rw-r--r--sw/inc/pam.hxx12
-rw-r--r--sw/inc/swcrsr.hxx13
-rw-r--r--sw/inc/swtypes.hxx14
-rw-r--r--sw/source/core/bastyp/swtypes.cxx40
-rw-r--r--sw/source/core/crsr/crsrsh.cxx19
-rw-r--r--sw/source/core/crsr/findattr.cxx61
-rw-r--r--sw/source/core/crsr/findtxt.cxx43
-rw-r--r--sw/source/core/edit/edtox.cxx59
-rw-r--r--sw/source/ui/inc/wrtsh.hxx12
-rw-r--r--sw/source/ui/index/idxmrk.cxx66
-rw-r--r--sw/source/ui/uiview/srcview.cxx64
-rw-r--r--sw/source/ui/uiview/view2.cxx55
-rw-r--r--sw/source/ui/uiview/viewsrch.cxx72
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx137
-rw-r--r--sw/source/ui/wrtsh/select.cxx24
16 files changed, 576 insertions, 132 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 34c981b596..bdbaed2777 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: crsrsh.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jp $ $Date: 2000-11-26 17:03:22 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:13:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -138,12 +138,12 @@ class SwTxtAttr;
class SwTableBox;
class SwCellFrms;
class SwTOXMark;
+class SwRedline;
struct SwPosition;
-namespace utl {
- class SearchParam;
-};
-class SwRedline;
+namespace com { namespace sun { namespace star { namespace util {
+ struct SearchOptions;
+} } } }
// enum und struktur, um ueber die Doc-Position Informationen zu erfragen
@@ -399,7 +399,7 @@ public:
FASTBOOL MoveRegion( SwWhichRegion, SwPosRegion );
// die Suchfunktionen
- ULONG Find( const utl::SearchParam& rParam,
+ ULONG Find( const com::sun::star::util::SearchOptions& rSearchOpt,
SwDocPositions eStart, SwDocPositions eEnde,
FindRanges eRng, int bReplace = FALSE );
@@ -409,7 +409,8 @@ public:
ULONG Find( const SfxItemSet& rSet, FASTBOOL bNoCollections,
SwDocPositions eStart, SwDocPositions eEnde,
- FindRanges eRng, const utl::SearchParam* pTextPara = 0,
+ FindRanges eRng,
+ const com::sun::star::util::SearchOptions* pSearchOpt = 0,
const SfxItemSet* rReplSet = 0 );
// Positionieren des Cursors
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 6ca4f98a5b..1f5ff49f2c 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pam.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jp $ $Date: 2001-01-26 18:07:34 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:13:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -92,8 +92,11 @@ class SwCntntNode;
class SwNodes;
class SwPaM;
+namespace com { namespace sun { namespace star { namespace util {
+ struct SearchOptions;
+} } } }
+
namespace utl {
- class SearchParam;
class TextSearch;
};
@@ -190,7 +193,8 @@ public:
SwGoInDoc fnGo = fnGoCntnt );
// Suchen
- BYTE Find( const utl::SearchParam& rParam, utl::TextSearch& rSTxt,
+ BYTE Find( const com::sun::star::util::SearchOptions& rSearchOpt,
+ utl::TextSearch& rSTxt,
SwMoveFn fnMove = fnMoveForward,
const SwPaM *pPam =0, FASTBOOL bInReadOnly = FALSE);
FASTBOOL Find( const SwFmt& rFmt,
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx
index db16d3b95f..7cdba9f55b 100644
--- a/sw/inc/swcrsr.hxx
+++ b/sw/inc/swcrsr.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: swcrsr.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jp $ $Date: 2000-11-20 09:20:40 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:13:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,6 +79,11 @@ class SwUnoCrsr;
class SwUnoTableCrsr;
struct _SwCursor_SavePos;
+namespace com { namespace sun { namespace star { namespace util {
+ struct SearchOptions;
+} } } }
+
+
// ein Basis-Struktur fuer die Parameter der Find-Methoden
// return - Werte vom Found-Aufruf.
const int FIND_NOT_FOUND = 0;
@@ -141,7 +146,7 @@ public:
SwMoveFnCollection* MakeFindRange( SwDocPositions, SwDocPositions,
SwPaM* ) const;
- ULONG Find( const utl::SearchParam& rParam,
+ ULONG Find( const com::sun::star::util::SearchOptions& rSearchOpt,
SwDocPositions nStart, SwDocPositions nEnde,
FindRanges = FND_IN_BODY,
int bReplace = FALSE );
@@ -154,7 +159,7 @@ public:
ULONG Find( const SfxItemSet& rSet, FASTBOOL bNoCollections,
SwDocPositions nStart, SwDocPositions nEnde,
FindRanges = FND_IN_BODY,
- const utl::SearchParam* pTextPara = 0,
+ const com::sun::star::util::SearchOptions* pSearchOpt = 0,
const SfxItemSet* rReplSet = 0 );
FASTBOOL IsStartWord()const;
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 799e4928d3..9a9c1f34dc 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: swtypes.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jp $ $Date: 2001-01-18 14:05:09 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:14:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,6 +64,10 @@
#ifndef _SOLAR_H
#include <tools/solar.h>
#endif
+#ifndef _LANG_HXX
+#include <tools/lang.hxx>
+#endif
+
#include <limits.h> //fuer LONG_MAX
#ifdef PM20
@@ -72,6 +76,9 @@
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h>
#endif
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
#ifndef _HORIORNT_HXX
#include <horiornt.hxx>
#endif
@@ -228,6 +235,9 @@ extern ResMgr* pSwResMgr; // steht in swapp0.cxx
#define DDE_AVAILABLE
#endif
+
+com::sun::star::lang::Locale CreateLocale( LanguageType eLanguage );
+
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XSpellChecker1 > GetSpellChecker();
::com::sun::star::uno::Reference<
diff --git a/sw/source/core/bastyp/swtypes.cxx b/sw/source/core/bastyp/swtypes.cxx
index 1c7e6e5129..252ea24502 100644
--- a/sw/source/core/bastyp/swtypes.cxx
+++ b/sw/source/core/bastyp/swtypes.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: swtypes.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jp $ $Date: 2000-11-13 10:47:52 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:14:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,10 +77,19 @@
#ifndef _OFA_OSPLCFG_HXX //autogen
#include <offmgr/osplcfg.hxx>
#endif
+#ifndef _LANG_HXX
+#include <tools/lang.hxx>
+#endif
+#ifndef _ISOLANG_HXX
+#include <tools/isolang.hxx>
+#endif
#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
#include <comphelper/processfactory.hxx>
#endif
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
#ifndef _COM_SUN_STAR_LINGUISTIC2_XSPELLCHECKER1_HPP_
#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
#endif
@@ -159,6 +168,9 @@
#endif
using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::linguistic2;
using namespace ::comphelper;
@@ -224,27 +236,41 @@ Size GetGraphicSizeTwip( const Graphic& rGraphic, OutputDevice* pOutDev )
}
-uno::Reference< XSpellChecker1 > GetSpellChecker()
+Locale CreateLocale( LanguageType eLanguage )
+{
+ String aLangStr, aCtryStr;
+ if (LANGUAGE_NONE != eLanguage)
+ ConvertLanguageToIsoNames( eLanguage, aLangStr, aCtryStr );
+
+ return Locale( aLangStr, aCtryStr, rtl::OUString() );
+}
+
+
+Reference< XSpellChecker1 > GetSpellChecker()
{
return LinguMgr::GetSpellChecker();
}
-uno::Reference< XHyphenator > GetHyphenator()
+
+Reference< XHyphenator > GetHyphenator()
{
return LinguMgr::GetHyphenator();
}
-uno::Reference< XThesaurus > GetThesaurus()
+
+Reference< XThesaurus > GetThesaurus()
{
return LinguMgr::GetThesaurus();
}
-uno::Reference< XDictionaryList > GetDictionaryList()
+
+Reference< XDictionaryList > GetDictionaryList()
{
return LinguMgr::GetDictionaryList();
}
-uno::Reference< beans::XPropertySet > GetLinguPropertySet()
+
+Reference< beans::XPropertySet > GetLinguPropertySet()
{
return LinguMgr::GetLinguPropertySet();
}
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 112eb7b62f..c7d2990fb8 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: crsrsh.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: jp $ $Date: 2001-02-26 15:34:38 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:15:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,10 @@
*
************************************************************************/
+#ifndef _COM_SUN_STAR_UTIL_SEARCHOPTIONS_HPP_
+#include <com/sun/star/util/SearchOptions.hpp>
+#endif
+
#ifdef PRECOMPILED
#include "core_pch.hxx"
#endif
@@ -147,6 +151,9 @@
#endif
+using namespace com::sun::star;
+using namespace com::sun::star::util;
+
TYPEINIT2(SwCrsrShell,ViewShell,SwModify);
@@ -2678,7 +2685,7 @@ FASTBOOL SwCrsrShell::IsSelFullPara() const
/* */
// die Suchfunktionen
-ULONG SwCrsrShell::Find( const utl::SearchParam& rParam,
+ULONG SwCrsrShell::Find( const SearchOptions& rSearchOpt,
SwDocPositions eStart, SwDocPositions eEnde,
FindRanges eRng, int bReplace )
{
@@ -2686,7 +2693,7 @@ ULONG SwCrsrShell::Find( const utl::SearchParam& rParam,
GetCrsr();
delete pTblCrsr, pTblCrsr = 0;
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
- ULONG nRet = pCurCrsr->Find( rParam, eStart, eEnde, eRng, bReplace );
+ ULONG nRet = pCurCrsr->Find( rSearchOpt, eStart, eEnde, eRng, bReplace );
if( nRet )
UpdateCrsr();
return nRet;
@@ -2708,7 +2715,7 @@ ULONG SwCrsrShell::Find( const SwTxtFmtColl& rFmtColl,
ULONG SwCrsrShell::Find( const SfxItemSet& rSet, FASTBOOL bNoCollections,
SwDocPositions eStart, SwDocPositions eEnde,
- FindRanges eRng, const utl::SearchParam* pTextPara,
+ FindRanges eRng, const SearchOptions* pSearchOpt,
const SfxItemSet* rReplSet )
{
if( pTblCrsr )
@@ -2716,7 +2723,7 @@ ULONG SwCrsrShell::Find( const SfxItemSet& rSet, FASTBOOL bNoCollections,
delete pTblCrsr, pTblCrsr = 0;
SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
ULONG nRet = pCurCrsr->Find( rSet, bNoCollections, eStart, eEnde,
- eRng, pTextPara, rReplSet );
+ eRng, pSearchOpt, rReplSet );
if( nRet )
UpdateCrsr();
return nRet;
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index 2580fc4b53..676340ae84 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: findattr.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jp $ $Date: 2000-11-20 09:22:18 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:15:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,20 @@
*
************************************************************************/
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_SEARCHOPTIONS_HPP_
+#include <com/sun/star/util/SearchOptions.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_SEARCHFLAGS_HPP_
+#include <com/sun/star/util/SearchFlags.hpp>
+#endif
+
+#ifndef _ISOLANG_HXX
+#include <tools/isolang.hxx>
+#endif
+
#ifdef PRECOMPILED
#include "core_pch.hxx"
#endif
@@ -119,6 +133,9 @@
#include <swundo.hxx>
#endif
+using namespace com::sun::star;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::util;
SV_DECL_PTRARR_SORT( SwpFmts, SwFmt*, 0, 4 )
SV_IMPL_PTRARR_SORT( SwpFmts, SwFmt* )
@@ -1251,15 +1268,15 @@ struct SwFindParaAttr : public SwFindParas
{
BOOL bValue;
const SfxItemSet *pSet, *pReplSet;
- const utl::SearchParam *pTxtPara;
+ const SearchOptions *pSearchOpt;
SwCursor& rCursor;
utl::TextSearch* pSTxt;
SwFindParaAttr( const SfxItemSet& rSet, BOOL bNoCollection,
- const utl::SearchParam* pTextParam, const SfxItemSet* pRSet,
+ const SearchOptions* pOpt, const SfxItemSet* pRSet,
SwCursor& rCrsr )
: pSet( &rSet ), pReplSet( pRSet ), rCursor( rCrsr ),
- bValue( bNoCollection ), pTxtPara( pTextParam ), pSTxt( 0 )
+ bValue( bNoCollection ), pSearchOpt( pOpt ), pSTxt( 0 )
{}
~SwFindParaAttr() { delete pSTxt; }
@@ -1273,7 +1290,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
{
// String ersetzen ?? (nur wenn Text angegeben oder nicht attributiert
// gesucht wird)
- BOOL bReplaceTxt = pTxtPara && ( pTxtPara->GetReplaceStr().Len() ||
+ BOOL bReplaceTxt = pSearchOpt && ( pSearchOpt->replaceString.getLength() ||
!pSet->Count() );
BOOL bReplaceAttr = pReplSet && pReplSet->Count();
if( bInReadOnly && (bReplaceAttr || bReplaceTxt ))
@@ -1294,23 +1311,31 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
// || *pCrsr->GetMark() == *pCrsr->GetPoint() ) // kein Bereich ??
return FIND_NOT_FOUND;
- if( !pTxtPara )
+ if( !pSearchOpt )
break; // ok, nur Attribute, also gefunden
pTextRegion = pCrsr;
}
- else if( !pTxtPara )
+ else if( !pSearchOpt )
return FIND_NOT_FOUND;
// dann darin den Text
if( !pSTxt )
{
- utl::SearchParam aTmp( *pTxtPara );
- aTmp.SetSrchInSelection( TRUE );
- pSTxt = new utl::TextSearch( aTmp, LANGUAGE_SYSTEM );
+ SearchOptions aTmp( *pSearchOpt );
+
+ // search in selection
+ aTmp.searchFlag |= (SearchFlags::REG_NOT_BEGINOFLINE |
+ SearchFlags::REG_NOT_ENDOFLINE);
+
+ String aLang, aCntry;
+ ConvertLanguageToIsoNames( LANGUAGE_SYSTEM, aLang, aCntry );
+ aTmp.Locale = Locale( aLang, aCntry, rtl::OUString() );
+
+ pSTxt = new utl::TextSearch( aTmp );
}
// Bug 24665: suche im richtigen Bereich weiter (pTextRegion!)
- if( pCrsr->Find( *pTxtPara, *pSTxt, fnMove, pTextRegion, bInReadOnly ) &&
+ if( pCrsr->Find( *pSearchOpt, *pSTxt, fnMove, pTextRegion, bInReadOnly ) &&
*pCrsr->GetMark() != *pCrsr->GetPoint() ) // gefunden ?
break; // also raus
else if( !pSet->Count() )
@@ -1346,7 +1371,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
if( bReplaceTxt )
{
- int bRegExp = utl::SearchParam::SRCH_REGEXP == pTxtPara->GetSrchType();
+ int bRegExp = SearchAlgorithms_REGEXP == pSearchOpt->algorithmType;
SwIndex& rSttCntIdx = pCrsr->Start()->nContent;
xub_StrLen nSttCnt = rSttCntIdx.GetIndex();
@@ -1359,7 +1384,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
((Ring*)pRegion)->MoveRingTo( &rCursor );
}
- rCursor.GetDoc()->Replace( *pCrsr, pTxtPara->GetReplaceStr(), bRegExp );
+ rCursor.GetDoc()->Replace( *pCrsr, pSearchOpt->replaceString, bRegExp );
rCursor.SaveTblBoxCntnt( pCrsr->GetPoint() );
if( bRegExp )
@@ -1420,7 +1445,7 @@ int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
int SwFindParaAttr::IsReplaceMode() const
{
- return ( pTxtPara && pTxtPara->GetReplaceStr().Len() ) ||
+ return ( pSearchOpt && pSearchOpt->replaceString.getLength() ) ||
( pReplSet && pReplSet->Count() );
}
@@ -1430,21 +1455,21 @@ int SwFindParaAttr::IsReplaceMode() const
ULONG SwCursor::Find( const SfxItemSet& rSet, FASTBOOL bNoCollections,
SwDocPositions nStart, SwDocPositions nEnde,
FindRanges eFndRngs,
- const utl::SearchParam* pTextPara, const SfxItemSet* pReplSet )
+ const SearchOptions* pSearchOpt, const SfxItemSet* pReplSet )
{
// OLE-Benachrichtigung abschalten !!
SwDoc* pDoc = GetDoc();
Link aLnk( pDoc->GetOle2Link() );
pDoc->SetOle2Link( Link() );
- BOOL bReplace = ( pTextPara && ( pTextPara->GetReplaceStr().Len() ||
+ BOOL bReplace = ( pSearchOpt && ( pSearchOpt->replaceString.getLength() ||
!rSet.Count() ) ) ||
(pReplSet && pReplSet->Count());
BOOL bSttUndo = pDoc->DoesUndo() && bReplace;
if( bSttUndo )
pDoc->StartUndo( UNDO_REPLACE );
- SwFindParaAttr aSwFindParaAttr( rSet, bNoCollections, pTextPara,
+ SwFindParaAttr aSwFindParaAttr( rSet, bNoCollections, pSearchOpt,
pReplSet, *this );
ULONG nRet = FindAll(aSwFindParaAttr, nStart, nEnde, eFndRngs );
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index fdb3a33971..63ae49fe34 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: findtxt.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jp $ $Date: 2000-12-09 14:59:31 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:15:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,13 @@
*
************************************************************************/
+#ifndef _COM_SUN_STAR_UTIL_SEARCHOPTIONS_HPP_
+#include <com/sun/star/util/SearchOptions.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_SEARCHFLAGS_HPP_
+#include <com/sun/star/util/SearchFlags.hpp>
+#endif
+
#ifdef PRECOMPILED
#include "core_pch.hxx"
#endif
@@ -100,6 +107,10 @@
#include <swundo.hxx>
#endif
+using namespace com::sun::star;
+using namespace com::sun::star::util;
+
+
String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
xub_StrLen& rEnde, SvULongs& rArr, String& rRet )
{
@@ -191,11 +202,11 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
-BYTE SwPaM::Find( const utl::SearchParam& rParam, utl::TextSearch& rSTxt,
+BYTE SwPaM::Find( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
SwMoveFn fnMove, const SwPaM * pRegion,
FASTBOOL bInReadOnly )
{
- if( !rParam.GetSrchStr().Len() )
+ if( !rSearchOpt.searchString.getLength() )
return FALSE;
SwPaM* pPam = MakeRegion( fnMove, pRegion );
@@ -302,7 +313,8 @@ BYTE SwPaM::Find( const utl::SearchParam& rParam, utl::TextSearch& rSTxt,
else
*/ GetPoint()->nContent = nEnde;
- if( utl::SearchParam::SRCH_REGEXP == rParam.GetSrchType() &&
+ BOOL bRegSearch = SearchAlgorithms_REGEXP == rSearchOpt.algorithmType;
+ if( bRegSearch &&
1 < Abs( (int)(GetPoint()->nNode.GetIndex() - GetMark()->nNode.GetIndex())))
// Fehler: es koennen maximal 2 Nodes selektiert werden !!
continue;
@@ -322,14 +334,14 @@ BYTE SwPaM::Find( const utl::SearchParam& rParam, utl::TextSearch& rSTxt,
// Parameter fuers Suchen und Ersetzen von Text
struct SwFindParaText : public SwFindParas
{
- const utl::SearchParam& rParam;
+ const SearchOptions& rSearchOpt;
SwCursor& rCursor;
utl::TextSearch aSTxt;
BOOL bReplace;
- SwFindParaText( const utl::SearchParam& rPara, int bRepl, SwCursor& rCrsr )
- : rCursor( rCrsr ), bReplace( bRepl ), rParam( rPara ),
- aSTxt( rPara, LANGUAGE_SYSTEM )
+ SwFindParaText( const SearchOptions& rOpt, int bRepl, SwCursor& rCrsr )
+ : rCursor( rCrsr ), bReplace( bRepl ),
+ rSearchOpt( rOpt ), aSTxt( rOpt )
{}
virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, FASTBOOL bInReadOnly );
virtual int IsReplaceMode() const;
@@ -342,7 +354,7 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove,
if( bInReadOnly && bReplace )
bInReadOnly = FALSE;
- BOOL bFnd = (BOOL)pCrsr->Find( rParam, aSTxt, fnMove, pRegion, bInReadOnly );
+ BOOL bFnd = (BOOL)pCrsr->Find( rSearchOpt, aSTxt, fnMove, pRegion, bInReadOnly );
// kein Bereich ??
if( bFnd && *pCrsr->GetMark() == *pCrsr->GetPoint() )
return FIND_NOT_FOUND;
@@ -350,7 +362,7 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove,
if( bFnd && bReplace ) // String ersetzen ??
{
// Replace-Methode vom SwDoc benutzen
- int bRegExp = utl::SearchParam::SRCH_REGEXP == rParam.GetSrchType();
+ int bRegExp = SearchAlgorithms_REGEXP == rSearchOpt.algorithmType;
SwIndex& rSttCntIdx = pCrsr->Start()->nContent;
xub_StrLen nSttCnt = rSttCntIdx.GetIndex();
// damit die Region auch verschoben wird, in den Shell-Cursr-Ring
@@ -362,7 +374,7 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove,
((Ring*)pRegion)->MoveRingTo( &rCursor );
}
- rCursor.GetDoc()->Replace( *pCrsr, rParam.GetReplaceStr(), bRegExp );
+ rCursor.GetDoc()->Replace( *pCrsr, rSearchOpt.replaceString, bRegExp );
rCursor.SaveTblBoxCntnt( pCrsr->GetPoint() );
if( bRegExp )
@@ -388,7 +400,7 @@ int SwFindParaText::IsReplaceMode() const
}
-ULONG SwCursor::Find( const utl::SearchParam& rParam,
+ULONG SwCursor::Find( const SearchOptions& rSearchOpt,
SwDocPositions nStart, SwDocPositions nEnde,
FindRanges eFndRngs, int bReplace )
{
@@ -401,9 +413,10 @@ ULONG SwCursor::Find( const utl::SearchParam& rParam,
if( bSttUndo )
pDoc->StartUndo( UNDO_REPLACE );
- if( rParam.IsSrchInSelection() )
+ BOOL bSearchSel = 0 != (rSearchOpt.searchFlag & SearchFlags::REG_NOT_BEGINOFLINE);
+ if( bSearchSel )
eFndRngs = (FindRanges)(eFndRngs | FND_IN_SEL);
- SwFindParaText aSwFindParaText( rParam, bReplace, *this );
+ SwFindParaText aSwFindParaText( rSearchOpt, bReplace, *this );
ULONG nRet = FindAll( aSwFindParaText, nStart, nEnde, eFndRngs );
pDoc->SetOle2Link( aLnk );
if( nRet && bReplace )
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 2267367975..558691811e 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: edtox.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jp $ $Date: 2000-11-20 09:24:41 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:16:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,16 @@
*
************************************************************************/
+#ifndef _COM_SUN_STAR_UTIL_SEARCHOPTIONS_HPP_
+#include <com/sun/star/util/SearchOptions.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_SEARCHFLAGS_HPP_
+#include <com/sun/star/util/SearchFlags.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
+
#ifdef PRECOMPILED
#include "core_pch.hxx"
#endif
@@ -68,7 +78,7 @@
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif
-#ifndef _TXTCMP_HXX //autogen wg. SearchParam
+#ifndef _TXTCMP_HXX
#include <svtools/txtcmp.hxx>
#endif
#ifndef _UCBHELPER_CONTENT_HXX
@@ -78,6 +88,9 @@
#include <sfx2/docfile.hxx>
#endif
+#ifndef _SWTYPES_HXX
+#include <swtypes.hxx>
+#endif
#ifndef _EDITSH_HXX
#include <editsh.hxx>
#endif
@@ -121,7 +134,9 @@
#include <statstr.hrc>
#endif
-using namespace ::com::sun::star;
+using namespace com::sun::star;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::util;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::uno;
using namespace ::rtl;
@@ -498,15 +513,37 @@ void SwEditShell::ApplyAutoMark()
String sWordOnly = sLine.GetToken(0, ';', nTokenPos);
//3.
- utl::SearchParam aParam( sToSelect, utl::SearchParam::SRCH_NORMAL,
- TRUE, FALSE, FALSE );
- BOOL bCaseSensitive = sCase.Len() && sCase != sZero;
- BOOL bWordOnly = sWordOnly.Len() && sWordOnly != sZero;
- aParam.SetCaseSensitive( bCaseSensitive );
- aParam.SetSrchWordOnly( bWordOnly );
+ //SearchAlgorithms eSrchType = SearchAlgorithms_ABSOLUTE;
+ //OUString aSrchStr = rText;
+ BOOL bCaseSensitive = sCase.Len() && sCase != sZero;
+ BOOL bWordOnly = sWordOnly.Len() && sWordOnly != sZero;
+ BOOL bSrchInSel = FALSE;
+ BOOL bLEV_Relaxed = TRUE;
+ INT32 nLEV_Other = 2; // -> changedChars;
+ INT32 nLEV_Longer = 3; //! -> deletedChars;
+ INT32 nLEV_Shorter = 1; //! -> insertedChars;
+ INT32 nTransliterationFlags = 0;
+ //
+ INT32 nSrchFlags = 0;
+ if (!bCaseSensitive)
+ nSrchFlags |= SearchFlags::ALL_IGNORE_CASE;
+ if ( bWordOnly)
+ nSrchFlags |= SearchFlags::NORM_WORD_ONLY;
+ if ( bLEV_Relaxed)
+ nSrchFlags |= SearchFlags::LEV_RELAXED;
+ if ( bSrchInSel)
+ nSrchFlags |= (SearchFlags::REG_NOT_BEGINOFLINE |
+ SearchFlags::REG_NOT_ENDOFLINE );
+ //
+ SearchOptions aSearchOpt(
+ SearchAlgorithms_ABSOLUTE, nSrchFlags,
+ sToSelect, OUString(),
+ CreateLocale( LANGUAGE_SYSTEM ),
+ nLEV_Other, nLEV_Longer, nLEV_Shorter,
+ nTransliterationFlags );
KillPams();
- ULONG nRet = Find( aParam, DOCPOS_START, DOCPOS_END,
+ ULONG nRet = Find( aSearchOpt, DOCPOS_START, DOCPOS_END,
(FindRanges)(FND_IN_SELALL|FND_IN_BODYONLY),
FALSE );
diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
index 99f0614554..4fd99b3c49 100644
--- a/sw/source/ui/inc/wrtsh.hxx
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: wrtsh.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jp $ $Date: 2000-11-20 09:21:32 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:16:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -96,6 +96,10 @@ struct SwCallMouseEvent;
class DropEvent;
struct ChartSelectionInfo;
+namespace com { namespace sun { namespace star { namespace util {
+ struct SearchOptions;
+} } } }
+
class SwWrtShell: public SwFEShell
{
@@ -351,7 +355,7 @@ typedef FASTBOOL (SwWrtShell:: *FNSimpleMove)();
String GetRepeatString() const;
//Suchen oder Ersetzen
- ULONG SearchPattern(const utl::SearchParam& rParam,
+ ULONG SearchPattern(const com::sun::star::util::SearchOptions& rSearchOpt,
SwDocPositions eStart, SwDocPositions eEnde,
FindRanges eFlags = FND_IN_BODY,
int bReplace = FALSE );
@@ -365,7 +369,7 @@ typedef FASTBOOL (SwWrtShell:: *FNSimpleMove)();
BOOL bNoColls,
SwDocPositions eStart,SwDocPositions eEnde,
FindRanges eFlags = FND_IN_BODY,
- const utl::SearchParam* pParam = 0,
+ const com::sun::star::util::SearchOptions* pSearchOpt = 0,
const SfxItemSet* pReplaceSet = 0);
void AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar = ' ' );
diff --git a/sw/source/ui/index/idxmrk.cxx b/sw/source/ui/index/idxmrk.cxx
index fbb6604ee2..e4d9b33022 100644
--- a/sw/source/ui/index/idxmrk.cxx
+++ b/sw/source/ui/index/idxmrk.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: idxmrk.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: os $ $Date: 2001-02-13 10:14:44 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:17:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,15 @@
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
+#ifndef _COM_SUN_STAR_UTIL_SEARCHOPTIONS_HPP_
+#include <com/sun/star/util/SearchOptions.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_SEARCHFLAGS_HPP_
+#include <com/sun/star/util/SearchFlags.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
#include "helpid.h"
#define _SVSTDARR_STRINGSSORT
@@ -104,6 +113,11 @@
#ifndef _SFXVIEWFRM_HXX
#include <sfx2/viewfrm.hxx>
#endif
+
+
+#ifndef _SWTYPES_HXX
+#include <swtypes.hxx>
+#endif
#ifndef _IDXMRK_HXX
#include <idxmrk.hxx>
#endif
@@ -161,10 +175,15 @@ static sal_uInt16 nKey1Pos = USHRT_MAX;
static sal_uInt16 nKey2Pos = USHRT_MAX;
+using namespace com::sun::star;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::util;
using namespace ::rtl;
using namespace ::comphelper;
using namespace ::com::sun::star;
+
#define C2U(cChar) OUString::createFromAscii(cChar)
+
/*--------------------------------------------------------------------
Beschreibung: Dialog zum Einfuegen einer Verzeichnismarkierung
--------------------------------------------------------------------*/
@@ -447,14 +466,44 @@ void SwIndexMarkDlg::InsertUpdate()
void lcl_SelectSameStrings(SwWrtShell& rSh, BOOL bWordOnly, BOOL bCaseSensitive)
{
rSh.Push();
- utl::SearchParam aParam( rSh.GetSelTxt(), utl::SearchParam::SRCH_NORMAL,
- TRUE, FALSE, FALSE );
+
+// utl::SearchParam aParam( rSh.GetSelTxt(), utl::SearchParam::SRCH_NORMAL,
+// TRUE, FALSE, FALSE );
- aParam.SetCaseSensitive( bCaseSensitive );
- aParam.SetSrchWordOnly( bWordOnly );
+// aParam.SetCaseSensitive( bCaseSensitive );
+// aParam.SetSrchWordOnly( bWordOnly );
+
+ //SearchAlgorithms eSrchType = SearchAlgorithms_ABSOLUTE;
+ //OUString aSrchStr = rText;
+ //BOOL bCaseSensitive = TRUE;
+ //BOOL bWordOnly = FALSE;
+ BOOL bSrchInSel = FALSE;
+ BOOL bLEV_Relaxed = TRUE;
+ INT32 nLEV_Other = 2; // -> changedChars;
+ INT32 nLEV_Longer = 3; //! -> deletedChars;
+ INT32 nLEV_Shorter = 1; //! -> insertedChars;
+ INT32 nTransliterationFlags = 0;
+ //
+ INT32 nSrchFlags = 0;
+ if (!bCaseSensitive)
+ nSrchFlags |= SearchFlags::ALL_IGNORE_CASE;
+ if ( bWordOnly)
+ nSrchFlags |= SearchFlags::NORM_WORD_ONLY;
+ if ( bLEV_Relaxed)
+ nSrchFlags |= SearchFlags::LEV_RELAXED;
+ if ( bSrchInSel)
+ nSrchFlags |= (SearchFlags::REG_NOT_BEGINOFLINE |
+ SearchFlags::REG_NOT_ENDOFLINE );
+ //
+ SearchOptions aSearchOpt(
+ SearchAlgorithms_ABSOLUTE, nSrchFlags,
+ rSh.GetSelTxt(), OUString(),
+ CreateLocale( LANGUAGE_SYSTEM ),
+ nLEV_Other, nLEV_Longer, nLEV_Shorter,
+ nTransliterationFlags );
rSh.ClearMark();
- ULONG nRet = rSh.Find( aParam, DOCPOS_START, DOCPOS_END,
+ ULONG nRet = rSh.Find( aSearchOpt, DOCPOS_START, DOCPOS_END,
(FindRanges)(FND_IN_SELALL|FND_IN_BODYONLY), FALSE );
}
@@ -1754,6 +1803,9 @@ void SwAuthMarkModalDlg::Apply()
/*------------------------------------------------------------------------
$Log: not supported by cvs2svn $
+ Revision 1.5 2001/02/13 10:14:44 os
+ #83826# String::CreateFromAscii added
+
Revision 1.4 2000/11/20 09:18:54 jp
must change: processfactory moved
diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx
index e0c30b89b8..f8652cdb0f 100644
--- a/sw/source/ui/uiview/srcview.cxx
+++ b/sw/source/ui/uiview/srcview.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: srcview.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: jp $ $Date: 2001-01-15 18:46:53 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:12:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,6 +72,15 @@
#include <uiparam.hxx>
#endif
+#ifndef _COM_SUN_STAR_UTIL_SEARCHOPTIONS_HPP_
+#include <com/sun/star/util/SearchOptions.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_SEARCHFLAGS_HPP_
+#include <com/sun/star/util/SearchFlags.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
#ifndef _UNOTOOLS_TEMPFILE_HXX
#include <unotools/tempfile.hxx>
@@ -232,6 +241,8 @@
#include "swslots.hxx"
using namespace com::sun::star;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::util;
using namespace com::sun::star::uno;
#define C2S(cChar) UniString::CreateFromAscii(cChar)
@@ -827,6 +838,7 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
pTextView->SetSelection( TextSelection( TextPaM( 0xFFFFFFFF, 0xFFFF ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
}
+#ifdef NEVER
utl::SearchParam aSearchParam( rSearchItem.GetSearchString(),
utl::SearchParam::SRCH_NORMAL, rSearchItem.GetExact(),
rSearchItem.GetWordOnly(), rSearchItem.GetSelection() );
@@ -840,18 +852,60 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
aSearchParam.SetLEVShorter( rSearchItem.GetLEVShorter() );
aSearchParam.SetLEVLonger( rSearchItem.GetLEVLonger() );
}
+#endif
+
+ SearchAlgorithms eSrchType = SearchAlgorithms_ABSOLUTE;
+ //OUString aSrchStr = rText;
+ BOOL bCaseSensitive = rSearchItem.GetExact();
+ BOOL bWordOnly = rSearchItem.GetWordOnly();
+ BOOL bSrchInSel = rSearchItem.GetSelection();
+ BOOL bLEV_Relaxed = TRUE;
+ INT32 nLEV_Other = 2; // -> changedChars;
+ INT32 nLEV_Longer = 3; //! -> deletedChars;
+ INT32 nLEV_Shorter = 1; //! -> insertedChars;
+ INT32 nTransliterationFlags = 0;
+ //
+ if ( rSearchItem.GetRegExp() )
+ eSrchType = SearchAlgorithms_REGEXP;
+ else if ( rSearchItem.IsLevenshtein() )
+ {
+ eSrchType = SearchAlgorithms_APPROXIMATE;
+ bLEV_Relaxed = rSearchItem.IsLEVRelaxed();
+ nLEV_Other = rSearchItem.GetLEVOther();
+ nLEV_Longer = rSearchItem.GetLEVLonger();
+ nLEV_Shorter = rSearchItem.GetLEVShorter();
+ }
+ //
+ INT32 nSrchFlags = 0;
+ if (!bCaseSensitive)
+ nSrchFlags |= SearchFlags::ALL_IGNORE_CASE;
+ if ( bWordOnly)
+ nSrchFlags |= SearchFlags::NORM_WORD_ONLY;
+ if ( bLEV_Relaxed)
+ nSrchFlags |= SearchFlags::LEV_RELAXED;
+ if ( bSrchInSel)
+ nSrchFlags |= (SearchFlags::REG_NOT_BEGINOFLINE |
+ SearchFlags::REG_NOT_ENDOFLINE );
+ //
+ SearchOptions aSearchOpt(
+ eSrchType, nSrchFlags,
+ rSearchItem.GetSearchString(), rtl::OUString(),
+ CreateLocale( LANGUAGE_SYSTEM ),
+ nLEV_Other, nLEV_Longer, nLEV_Shorter,
+ nTransliterationFlags );
+
USHORT nFound = 0;
if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND ) ||
( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL ) )
{
- nFound = pTextView->Search( aSearchParam, bForward );
+ nFound = pTextView->Search( aSearchOpt, bForward );
}
else if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE ) ||
( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL ) )
{
- aSearchParam.SetReplaceStr( rSearchItem.GetReplaceString() );
+ aSearchOpt.replaceString = rSearchItem.GetReplaceString();
BOOL bAll = rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL;
- nFound = pTextView->Replace( aSearchParam, bAll, bForward );
+ nFound = pTextView->Replace( aSearchOpt, bAll, bForward );
}
if(!nFound)
{
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index af6cb9adbc..5a4625fcf7 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: view2.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: jp $ $Date: 2001-03-08 21:22:49 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:11:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,6 +65,16 @@
#pragma hdrstop
+#ifndef _COM_SUN_STAR_UTIL_SEARCHOPTIONS_HPP_
+#include <com/sun/star/util/SearchOptions.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_SEARCHFLAGS_HPP_
+#include <com/sun/star/util/SearchFlags.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
+
#ifndef _HINTIDS_HXX
#include <hintids.hxx>
#endif
@@ -151,6 +161,9 @@
#include <unotools/testsearch.hxx>
#endif
+#ifndef _SWTYPES_HXX
+#include <swtypes.hxx>
+#endif
#ifndef _SWWAIT_HXX
#include <swwait.hxx>
#endif
@@ -272,6 +285,8 @@ static String sLstPg;
static USHORT nPageCnt = 0;
const char __FAR_DATA sStatusDelim[] = " : ";
+using namespace com::sun::star;
+using namespace com::sun::star::util;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::scanner;
@@ -1167,10 +1182,40 @@ BOOL SwView::JumpToSwMark( const String& rMark )
{
// Normale Textsuche
pWrtShell->EnterStdMode();
- utl::SearchParam aParam( sName, utl::SearchParam::SRCH_NORMAL,
- TRUE, FALSE, FALSE );
- if( pWrtShell->SearchPattern( aParam, DOCPOS_START, DOCPOS_END ))
+// utl::SearchParam aParam( sName, utl::SearchParam::SRCH_NORMAL,
+// TRUE, FALSE, FALSE );
+
+ //SearchAlgorithms eSrchType = SearchAlgorithms_ABSOLUTE;
+ //OUString aSrchStr = rText;
+ BOOL bCaseSensitive = TRUE;
+ BOOL bWordOnly = FALSE;
+ BOOL bSrchInSel = FALSE;
+ BOOL bLEV_Relaxed = TRUE;
+ INT32 nLEV_Other = 2; // -> changedChars;
+ INT32 nLEV_Longer = 3; //! -> deletedChars;
+ INT32 nLEV_Shorter = 1; //! -> insertedChars;
+ INT32 nTransliterationFlags = 0;
+ //
+ INT32 nSrchFlags = 0;
+ if (!bCaseSensitive)
+ nSrchFlags |= SearchFlags::ALL_IGNORE_CASE;
+ if ( bWordOnly)
+ nSrchFlags |= SearchFlags::NORM_WORD_ONLY;
+ if ( bLEV_Relaxed)
+ nSrchFlags |= SearchFlags::LEV_RELAXED;
+ if ( bSrchInSel)
+ nSrchFlags |= (SearchFlags::REG_NOT_BEGINOFLINE |
+ SearchFlags::REG_NOT_ENDOFLINE );
+ //
+ SearchOptions aSearchOpt(
+ SearchAlgorithms_ABSOLUTE, nSrchFlags,
+ sName, rtl::OUString(),
+ CreateLocale( LANGUAGE_SYSTEM ),
+ nLEV_Other, nLEV_Longer, nLEV_Shorter,
+ nTransliterationFlags );
+
+ if( pWrtShell->SearchPattern( aSearchOpt, DOCPOS_START, DOCPOS_END ))
{
pWrtShell->EnterStdMode(); // Selektion wieder aufheben
bRet = TRUE;
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
index e21de6b2fb..d51ea33363 100644
--- a/sw/source/ui/uiview/viewsrch.cxx
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewsrch.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jp $ $Date: 2000-11-20 09:26:31 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:12:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,6 +70,15 @@
#include "hintids.hxx"
#include "uiparam.hxx"
+#ifndef _COM_SUN_STAR_UTIL_SEARCHOPTIONS_HPP_
+#include <com/sun/star/util/SearchOptions.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_SEARCHFLAGS_HPP_
+#include <com/sun/star/util/SearchFlags.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
#ifndef _SVX_PAGEITEM_HXX //autogen
#include <svx/pageitem.hxx>
@@ -127,6 +136,10 @@
#include "view.hrc"
+using namespace com::sun::star;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::util;
+
#define SRCH_ATTR_OFF 0
#define SRCH_ATTR_ON 1
#define SRCH_ATTR_SET 2
@@ -663,9 +676,50 @@ ULONG SwView::FUNC_Search( const SwSearchOptions& rOptions )
DELETEZ( pReplSet ); // kennen wir nicht
}
+ //
+ // build SearchOptions to be used
+ //
+ SearchAlgorithms eSrchType = SearchAlgorithms_ABSOLUTE;
+ rtl::OUString aSrchStr = pSrchItem->GetSearchString();
+ rtl::OUString aRplcStr;
+ BOOL bCaseSensitive = pSrchItem->GetExact();
+ BOOL bWordOnly = pSrchItem->GetWordOnly();
+ BOOL bSrchInSel = pSrchItem->GetSelection();
+ BOOL bLEV_Relaxed = pSrchItem->IsLEVRelaxed();
+ INT32 nLEV_Other = pSrchItem->GetLEVOther(); // -> changedChars;
+ INT32 nLEV_Longer = pSrchItem->GetLEVLonger(); //! -> deletedChars;
+ INT32 nLEV_Shorter = pSrchItem->GetLEVShorter(); //! -> insertedChars;
+ INT32 nTransliterationFlags = 0;
+ //
+ if (bDoReplace)
+ aRplcStr = pSrchItem->GetReplaceString();
+ if (pSrchItem->IsLevenshtein())
+ eSrchType = SearchAlgorithms_APPROXIMATE;
+ if (pSrchItem->GetRegExp())
+ eSrchType = SearchAlgorithms_REGEXP;
+ //
+ INT32 nSrchFlags = 0;
+ if (!bCaseSensitive)
+ nSrchFlags |= SearchFlags::ALL_IGNORE_CASE;
+ if ( bWordOnly)
+ nSrchFlags |= SearchFlags::NORM_WORD_ONLY;
+ if ( bLEV_Relaxed)
+ nSrchFlags |= SearchFlags::LEV_RELAXED;
+ if ( bSrchInSel)
+ nSrchFlags |= (SearchFlags::REG_NOT_BEGINOFLINE |
+ SearchFlags::REG_NOT_ENDOFLINE );
+ //
+ SearchOptions aSearchOpt(
+ eSrchType, nSrchFlags,
+ aSrchStr, aRplcStr,
+ CreateLocale( LANGUAGE_SYSTEM ),
+ nLEV_Other, nLEV_Longer, nLEV_Shorter,
+ nTransliterationFlags );
+
ULONG nFound;
if( aSrchSet.Count() || ( pReplSet && pReplSet->Count() ))
{
+#ifdef NEVER
// Suche nach Attributen
utl::SearchParam aPar( pSrchItem->GetSearchString() );
if( aPar.GetSrchStr().Len() )
@@ -686,14 +740,15 @@ ULONG SwView::FUNC_Search( const SwSearchOptions& rOptions )
aPar.SetLEVShorter( pSrchItem->GetLEVShorter());
aPar.SetLEVLonger( pSrchItem->GetLEVLonger());
}
-
+#endif
+
nFound = pWrtShell->SearchAttr(
aSrchSet,
!pSrchItem->GetPattern(),
rOptions.eStart,
rOptions.eEnd,
FindRanges(eRanges),
- pSrchItem->GetSearchString().Len() ? &aPar : 0,
+ pSrchItem->GetSearchString().Len() ? &aSearchOpt : 0,
pReplSet );
}
else if( pSrchItem->GetPattern() )
@@ -709,6 +764,7 @@ ULONG SwView::FUNC_Search( const SwSearchOptions& rOptions )
{
// Normale Suche
+#ifdef NEVER
utl::SearchParam aParam( pSrchItem->GetSearchString(),
pSrchItem->GetRegExp()
? utl::SearchParam::SRCH_REGEXP :
@@ -725,8 +781,9 @@ ULONG SwView::FUNC_Search( const SwSearchOptions& rOptions )
if (bDoReplace)
aParam.SetReplaceStr(pSrchItem->GetReplaceString());
-
- nFound = pWrtShell->SearchPattern(aParam,
+#endif
+
+ nFound = pWrtShell->SearchPattern(aSearchOpt,
rOptions.eStart,
rOptions.eEnd,
FindRanges(eRanges),
@@ -834,6 +891,9 @@ void SwView::StateSearch(SfxItemSet &rSet)
/*------------------------------------------------------------------------
$Log: not supported by cvs2svn $
+ Revision 1.3 2000/11/20 09:26:31 jp
+ must change: SearchText->TextSearch and use namespace
+
Revision 1.2 2000/10/20 14:52:05 jp
Bug #79645#: ExecSearch - RepeatSearch without SearchItem must create it's own item
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index dc1a41cf2e..1b3f489911 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unotxdoc.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: os $ $Date: 2001-02-26 12:08:18 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:18:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -161,6 +161,16 @@
#ifndef _POOLFMT_HXX
#include <poolfmt.hxx>
#endif
+
+#ifndef _COM_SUN_STAR_UTIL_SEARCHOPTIONS_HPP_
+#include <com/sun/star/util/SearchOptions.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_SEARCHFLAGS_HPP_
+#include <com/sun/star/util/SearchFlags.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
#ifndef _COM_SUN_STAR_LANG_SERVICENOTREGISTEREDEXCEPTION_HPP_
#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
#endif
@@ -201,6 +211,10 @@
#ifndef _VOS_MUTEX_HXX_ //autogen
#include <vos/mutex.hxx>
#endif
+
+#ifndef _SWTYPES_HXX
+#include <swtypes.hxx>
+#endif
#ifndef _SWMODULE_HXX
#include <swmodule.hxx>
#endif
@@ -217,6 +231,7 @@
#include "swcont.hxx"
using namespace ::com::sun::star;
+using namespace ::com::sun::star::util;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
@@ -763,10 +778,12 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor >
const SwXTextSearch* pSearch = (const SwXTextSearch*)
xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId());
- utl::SearchParam aSrchParam(pSearch->sSearchText);
- aSrchParam.SetReplaceStr(pSearch->sReplaceText);
sal_Bool bBackward = sal_False;
int eRanges(FND_IN_BODY|FND_IN_SELALL);
+
+#ifdef NEVER
+ utl::SearchParam aSrchParam(pSearch->sSearchText);
+ aSrchParam.SetReplaceStr(pSearch->sReplaceText);
//bInSel: 1; // wie geht das?
//TODO: pSearch->bStyles!
aSrchParam.SetCaseSensitive(pSearch->bCase);
@@ -783,6 +800,42 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor >
// similarity setzt sich gegen RegExp durch!
if(pSearch->bSimilarity)
aSrchParam.SetSrchType(utl::SearchParam::SRCH_LEVDIST);
+#endif
+ SearchAlgorithms eSrchType = SearchAlgorithms_ABSOLUTE;
+ //OUString aSrchStr = rText;
+ BOOL bCaseSensitive = pSearch->bCase;
+ BOOL bWordOnly = pSearch->bWord;
+ BOOL bSrchInSel = FALSE;
+ BOOL bLEV_Relaxed = pSearch->bLevRelax;
+ INT32 nLEV_Other = pSearch->nLevExchange; // -> changedChars;
+ INT32 nLEV_Longer = pSearch->nLevAdd; //! -> deletedChars;
+ INT32 nLEV_Shorter = pSearch->nLevRemove; //! -> insertedChars;
+ INT32 nTransliterationFlags = 0;
+ //
+ INT32 nSrchFlags = 0;
+ if (!bCaseSensitive)
+ nSrchFlags |= SearchFlags::ALL_IGNORE_CASE;
+ if ( bWordOnly)
+ nSrchFlags |= SearchFlags::NORM_WORD_ONLY;
+ if ( bLEV_Relaxed)
+ nSrchFlags |= SearchFlags::LEV_RELAXED;
+ if ( bSrchInSel)
+ nSrchFlags |= (SearchFlags::REG_NOT_BEGINOFLINE |
+ SearchFlags::REG_NOT_ENDOFLINE );
+ //
+ if(pSearch->bExpr)
+ eSrchType = SearchAlgorithms_REGEXP;
+ //! similarity overrules RegExp !
+ if(pSearch->bSimilarity)
+ eSrchType = SearchAlgorithms_APPROXIMATE;
+ //
+ SearchOptions aSearchOpt(
+ eSrchType, nSrchFlags,
+ pSearch->sSearchText, pSearch->sReplaceText,
+ CreateLocale( LANGUAGE_SYSTEM ),
+ nLEV_Other, nLEV_Longer, nLEV_Shorter,
+ nTransliterationFlags );
+
SwDocPositions eStart = pSearch->bBack ? DOCPOS_END : DOCPOS_START;
SwDocPositions eEnd = pSearch->bBack ? DOCPOS_START : DOCPOS_END;
@@ -808,7 +861,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor >
nResult = (sal_Int32)pUnoCrsr->Find( aSearch, !pSearch->bStyles,
eStart, eEnd,
(FindRanges)eRanges,
- pSearch->sSearchText.Len() ? &aSrchParam : 0,
+ pSearch->sSearchText.Len() ? &aSearchOpt : 0,
&aReplace );
}
else if(pSearch->bStyles)
@@ -823,7 +876,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor >
}
else
{
- nResult = pUnoCrsr->Find( aSrchParam,
+ nResult = pUnoCrsr->Find( aSearchOpt,
eStart, eEnd,
(FindRanges)eRanges,
sal_True );
@@ -902,24 +955,12 @@ SwUnoCrsr* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
bParentInExtra = SwNormalStartNode != pTmp->GetStartNodeType();
}
- utl::SearchParam aSrchParam(pSearch->sSearchText);
sal_Bool bBackward = sal_False;
-/*
- * folgende Kombinationen sind erlaubt:
- * - suche einen im Body: -> FND_IN_BODY
- * - suche alle im Body: -> FND_IN_BODYONLY | FND_IN_SELALL
- * - suche in Selectionen: einen / alle -> FND_IN_SEL [ | FND_IN_SELALL ]
- * - suche im nicht Body: einen / alle -> FND_IN_OTHER [ | FND_IN_SELALL ]
- * - suche ueberall alle: -> FND_IN_SELALL
- */
- int eRanges(FND_IN_BODY);
- if(bParentInExtra)
- eRanges = FND_IN_OTHER;
+
+#ifdef NEVER
+ utl::SearchParam aSrchParam(pSearch->sSearchText);
//bInSel: 1; // wie geht das?
aSrchParam.SetCaseSensitive(pSearch->bCase);
-
- if(bAll) //immer - ueberall?
- eRanges = FND_IN_SELALL;
// inSelection??
// aSrchParam.SetSrchInSelection(TypeConversion::toBOOL(aVal));
aSrchParam.SetSrchWordOnly(pSearch->bWord);
@@ -932,6 +973,56 @@ SwUnoCrsr* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
// similarity setzt sich gegen RegExp durch!
if(pSearch->bSimilarity)
aSrchParam.SetSrchType(utl::SearchParam::SRCH_LEVDIST);
+#endif
+ SearchAlgorithms eSrchType = SearchAlgorithms_ABSOLUTE;
+ //OUString aSrchStr = rText;
+ BOOL bCaseSensitive = pSearch->bCase;
+ BOOL bWordOnly = pSearch->bWord;
+ BOOL bSrchInSel = FALSE;
+ BOOL bLEV_Relaxed = pSearch->bLevRelax;
+ INT32 nLEV_Other = pSearch->nLevExchange; // -> changedChars;
+ INT32 nLEV_Longer = pSearch->nLevAdd; //! -> deletedChars;
+ INT32 nLEV_Shorter = pSearch->nLevRemove; //! -> insertedChars;
+ INT32 nTransliterationFlags = 0;
+ //
+ INT32 nSrchFlags = 0;
+ if (!bCaseSensitive)
+ nSrchFlags |= SearchFlags::ALL_IGNORE_CASE;
+ if ( bWordOnly)
+ nSrchFlags |= SearchFlags::NORM_WORD_ONLY;
+ if ( bLEV_Relaxed)
+ nSrchFlags |= SearchFlags::LEV_RELAXED;
+ if ( bSrchInSel)
+ nSrchFlags |= (SearchFlags::REG_NOT_BEGINOFLINE |
+ SearchFlags::REG_NOT_ENDOFLINE );
+ //
+ if(pSearch->bExpr)
+ eSrchType = SearchAlgorithms_REGEXP;
+ //! similarity overrules RegExp !
+ if(pSearch->bSimilarity)
+ eSrchType = SearchAlgorithms_APPROXIMATE;
+ //
+ SearchOptions aSearchOpt(
+ eSrchType, nSrchFlags,
+ pSearch->sSearchText, OUString(),
+ CreateLocale( LANGUAGE_SYSTEM ),
+ nLEV_Other, nLEV_Longer, nLEV_Shorter,
+ nTransliterationFlags );
+
+
+/*
+ * folgende Kombinationen sind erlaubt:
+ * - suche einen im Body: -> FND_IN_BODY
+ * - suche alle im Body: -> FND_IN_BODYONLY | FND_IN_SELALL
+ * - suche in Selectionen: einen / alle -> FND_IN_SEL [ | FND_IN_SELALL ]
+ * - suche im nicht Body: einen / alle -> FND_IN_OTHER [ | FND_IN_SELALL ]
+ * - suche ueberall alle: -> FND_IN_SELALL
+ */
+ int eRanges(FND_IN_BODY);
+ if(bParentInExtra)
+ eRanges = FND_IN_OTHER;
+ if(bAll) //immer - ueberall?
+ eRanges = FND_IN_SELALL;
SwDocPositions eStart = !bAll ? DOCPOS_CURR : pSearch->bBack ? DOCPOS_END : DOCPOS_START;
SwDocPositions eEnd = pSearch->bBack ? DOCPOS_START : DOCPOS_END;
@@ -952,7 +1043,7 @@ SwUnoCrsr* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
nResult = (sal_Int32)pUnoCrsr->Find( aSearch, !pSearch->bStyles,
eStart, eEnd,
(FindRanges)eRanges,
- pSearch->sSearchText.Len() ? &aSrchParam : 0,
+ pSearch->sSearchText.Len() ? &aSearchOpt : 0,
0 );
}
else if(pSearch->bStyles)
@@ -967,7 +1058,7 @@ SwUnoCrsr* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
}
else
{
- nResult = (sal_Int32)pUnoCrsr->Find( aSrchParam,
+ nResult = (sal_Int32)pUnoCrsr->Find( aSearchOpt,
eStart, eEnd,
(FindRanges)eRanges,
/*int bReplace =*/sal_False );
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
index 259ed49a8c..79cc03de59 100644
--- a/sw/source/ui/wrtsh/select.cxx
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: select.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jp $ $Date: 2000-11-28 18:46:55 $
+ * last change: $Author: tl $ $Date: 2001-03-12 08:18:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -128,6 +128,13 @@
#endif
#endif
+namespace com { namespace sun { namespace star { namespace util {
+ struct SearchOptions;
+} } } }
+
+using namespace com::sun::star::util;
+
+
static long nStartDragX = 0, nStartDragY = 0;
static BOOL bStartDrag = FALSE;
@@ -235,14 +242,14 @@ long SwWrtShell::SelAll()
------------------------------------------------------------------------*/
-ULONG SwWrtShell::SearchPattern( const utl::SearchParam& rParam,
+ULONG SwWrtShell::SearchPattern( const SearchOptions& rSearchOpt,
SwDocPositions eStt, SwDocPositions eEnd,
FindRanges eFlags, int bReplace )
{
// keine Erweiterung bestehender Selektionen
if(!(eFlags & FND_IN_SEL))
ClearMark();
- return Find( rParam, eStt, eEnd, eFlags, bReplace );
+ return Find( rSearchOpt, eStt, eEnd, eFlags, bReplace );
}
/*------------------------------------------------------------------------
Beschreibung: Suche nach Vorlagen
@@ -272,7 +279,7 @@ ULONG SwWrtShell::SearchTempl( const String &rTempl,
ULONG SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, BOOL bNoColls,
SwDocPositions eStart, SwDocPositions eEnde,
- FindRanges eFlags, const utl::SearchParam* pParam,
+ FindRanges eFlags, const SearchOptions* pSearchOpt,
const SfxItemSet* pReplaceSet )
{
// Keine Erweiterung bestehender Selektionen
@@ -280,7 +287,7 @@ ULONG SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, BOOL bNoColls,
ClearMark();
// Suchen
- return Find( rFindSet, bNoColls, eStart, eEnde, eFlags, pParam, pReplaceSet);
+ return Find( rFindSet, bNoColls, eStart, eEnde, eFlags, pSearchOpt, pReplaceSet);
}
// ---------- Selektionsmodi ----------
@@ -966,11 +973,14 @@ long SwWrtShell::MoveText(const Point *pPt,BOOL)
Source Code Control System - Header
- $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/ui/wrtsh/select.cxx,v 1.5 2000-11-28 18:46:55 jp Exp $
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/ui/wrtsh/select.cxx,v 1.6 2001-03-12 08:18:49 tl Exp $
Source Code Control System - Update
$Log: not supported by cvs2svn $
+ Revision 1.5 2000/11/28 18:46:55 jp
+ Bug #80312#: OverwriteCursor for CJK
+
Revision 1.4 2000/11/21 08:49:57 os
#80521# prevent creation of illegal strings