Re: changes made to find and replace win32

From: Dom Lachowicz (domlachowicz@yahoo.com)
Date: Thu May 22 2003 - 09:40:33 EDT

  • Next message: Alan Horkan: "Re: changes made to find and replace win32"

    Hi DeJe,

    On the whole, this looks really good. I do have a few
    comments and requests, though.

    1) FV_View::GetDocPosition - the naming convention in
    use would be 'getDocPosition', but that's not quite
    what this method does. It seems to map FV_DocPos to
    PT_DocPosition. I might rename it to
    mapDocPos(FV_DocPos dp) or something similar.

    2) FV_View::_m_sFind - the naming convention is
    m_sFind. I see that you removed code that was in
    violation of that convention. It was in error.

    3) Is there any utility in returning the previous
    value in findSetWholeWord() and friends? I doubt we
    care what the previous value is/was.

    4) I don't like the scriptingFind methods as
    implemented. Using the x&y slots for anything other
    than x&y values should be considered a hack. I also
    don't like the multiplicity of them. I've thought
    about something I might prefer, such as a CSS-like
    mechanism for setting additional attributes
    ("forward:true;match-case:false;...") but I can see
    too many ways this can break down. Seeing as how
    no-one uses our PERL bindings in a serious fashion
    right now, and how to do what you're suggesting and
    the fact that I'd rather rework the EV_EditMethod
    design than hack around it, I'd prefer that these
    methods be removed.

    On the whole, teriffic job. Please send a new patch
    addressing those above issues or comment on them in a
    follow-up email. And thanks for adding yourself to the
    CREDITS. Everyone forgets to do that :-)

    Thanks,
    Dom

    --- "D. Elbers" <deje_auto@hotmail.com> wrote:
    > Hello all,
    >
    > Hereby I send the diff files for changes I made to
    > the find and replace
    > dialog, and related functions.
    > I added 'reverse find' and 'match whole word'.
    > Also added EditMethods to access these functions
    > from Scripting.
    >
    > <see the attachments> including two screenshots....
    > :-)
    >
    > Could someone please COMMIT these changes ?
    >
    > greetz,
    > DeJe
    >
    >
    _________________________________________________________________
    > Add photos to your e-mail with MSN 8. Get 2 months
    > FREE*.
    > http://join.msn.com/?page=features/featuredemail
    > > --=[]=--
    >
    > Changes by DeJe for
    > reverse find,
    > match whole word and
    > editmethods for scripting.
    >
    > --=[]=--
    >
    > Since multiple variables were passed from the find
    > dialog to the search and
    > replace functions in the view, I decided to move
    > those variables from the
    > dialog to the View.
    > Therefore I added multiple functions to set and
    > retreive these variables.
    > Also by moving these variables function calls have
    > been changed because
    > these
    > variables don't need to be passed anymore.
    >
    >
    -------------------------------------------------------------------------------
    > fv_View.h ...\abi\src\text\fmt\xp\
    >
    -------------------------------------------------------------------------------
    > Added funtions:
    > UT_UCSChar * findGetFindString (void);
    > UT_UCSChar * findGetReplaceString (void);
    > bool findGetReverseFind ();
    > bool findGetMatchCase ();
    > bool findGetWholeWord ();
    > bool findSetFindString (const UT_UCSChar* string);
    > bool findSetReplaceString (const UT_UCSChar*
    > string);
    > bool findSetReverseFind (bool newValue);
    > bool findSetMatchCase (bool newValue);
    > bool findSetWholeWord (bool newValue);
    > bool findReplaceReverse (bool&
    > bDoneEntireDocument);
    > bool _findReplaceReverse (UT_uint32* pPrefix, bool
    > & bDoneEntireDocument);
    >
    > Changed functions:
    > //old: UT_uint32* _computeFindPrefix (const
    > UT_UCSChar* pFind, bool
    > bMatchCase);
    > UT_uint32* _computeFindPrefix (const UT_UCSChar*
    > pFind);
    >
    > //old: bool findNext (const UT_UCSChar* pFind,
    > bool bMatchCase, bool&
    > bDoneEntireDocument);
    > bool findNext (bool& bDoneEntireDocument);
    > bool findNext (const UT_UCSChar* pFind, bool&
    > bDoneEntireDocument);
    >
    > //old: bool _findNext(const UT_UCSChar* pFind,
    > UT_uint32* pPrefix, bool
    > bMatchCase, bool& bDoneEntireDocument);
    > bool _findNext (UT_uint32* pPrefix, bool &
    > bDoneEntireDocument);
    >
    > //old: bool findPrev(const UT_UCSChar* pFind,
    > bool bMatchCase, bool&
    > bDoneEntireDocument);
    > bool findPrev (bool& bDoneEntireDocument);
    > bool findPrev (const UT_UCSChar* pFind, bool&
    > bDoneEntireDocument);
    >
    > //old: bool _findPrev(const UT_UCSChar* pFind,
    > UT_uint32* pPrefix, bool
    > bMatchCase, bool& bDoneEntireDocument);
    > bool _findPrev (UT_uint32* pPrefix, bool&
    > bDoneEntireDocument);
    >
    > //old: bool _findReplace(const UT_UCSChar* pFind,
    > const UT_UCSChar*
    > pReplace, UT_uint32* pPrefix, bool bMatchCase, bool&
    > bDoneEntireDocument);
    > bool _findReplace (UT_uint32* pPrefix, bool &
    > bDoneEntireDocument);
    >
    > //old: bool findReplace(const UT_UCSChar* pFind,
    > const UT_UCSChar*
    > pReplace, bool bMatchCase, bool &
    > bDoneEntireDocument);
    > bool findReplace (bool& bDoneEntireDocument);
    >
    > //old: UT_uint32 findReplaceAll(const UT_UCSChar*
    > pFind, const
    > UT_UCSChar* pReplace, bool bMatchCase);
    > UT_uint32 findReplaceAll();
    >
    > Added and changed variables:
    > bool _m_bReverseFind;
    > bool _m_bWholeWord;
    > bool _m_bMatchCase;
    > //removed: UT_UCSChar * _m_findNextString;
    > UT_UCSChar * _m_sFind;
    > UT_UCSChar * _m_sReplace;
    >
    >
    -------------------------------------------------------------------------------
    > fv_View.cpp ...\abi\src\text\fmt\xp\
    >
    -------------------------------------------------------------------------------
    > Constructor:
    > //removed: _m_matchCase(false),
    > _m_bReverseFind(false),
    > _m_bWholeWord(false),
    > //removed: _m_findNextString(0),
    > _m_sFind(0),
    >
    > Destructor:
    > //removed: FREEP(_m_findNextString);
    > FREEP(_m_sFind);
    > FREEP(_m_sReplace);
    >
    >
    -------------------------------------------------------------------------------
    > fv_View_protected.cpp ...\abi\src\text\fmt\xp\
    >
    -------------------------------------------------------------------------------
    > Changed functions: (see comments on fv_View.h)
    > UT_uint32* _computeFindPrefix (const UT_UCSChar*
    > pFind)
    > bool _findNext (UT_uint32* pPrefix, bool&
    > bDoneEntireDocument)
    > bool _findPrev (UT_uint32* pPrefix, bool&
    > bDoneEntireDocument)
    > UT_UCSChar* _findGetPrevBlockBuffer
    > (fl_BlockLayout** pBlock,
    > PT_DocPosition* pOffset)
    > applied same changes as to
    > _findGetNextBlockBuffer()
    > bool _findReplaceReverse (UT_uint32* pPrefix,
    > bool& bDoneEntireDocument)
    > bool _findReplace (UT_uint32* pPrefix, bool&
    > bDoneEntireDocument)
    >
    >
    -------------------------------------------------------------------------------
    > fl_DocLayout.h
    >
    -------------------------------------------------------------------------------
    > Added function:
    > fl_BlockLayout*
    > findBlockAtPositionReverse(PT_DocPosition pos);
    >
    >
    -------------------------------------------------------------------------------
    > fl_DocLayout.cpp
    >
    -------------------------------------------------------------------------------
    > see comments on fl_DocLayout.h.
    >
    >
    -------------------------------------------------------------------------------
    > ap_Dialog_Replace.h ...\abi\src\wp\ap\xp\
    >
    -------------------------------------------------------------------------------
    > Added functions:
    > bool setReverseFind (bool newValue);
    > bool getReverseFind (void);
    > bool setWholeWord (bool newValue);
    > bool getWholeWord (void);
    > bool findPrev (void);
    > bool findReplaceReverse (void);
    >
    > Changed functions:
    > bool findNext (void);
    >
    > Added and changed variables:
    > bool persist_reverseFind;
    > bool persist_wholeWord;
    >
    >
    -------------------------------------------------------------------------------
    > ap_Dialog_Replace.cpp ...\abi\src\wp\ap\xp\
    >
    -------------------------------------------------------------------------------
    > see comments on ap_Dialog_Replace.h.
    >
    >
    -------------------------------------------------------------------------------
    > ap_Win32Dialog_Replace.cpp
    >
    -------------------------------------------------------------------------------
    > in _onCommand: added handling of clicking the
    > checkboxes for
    > match whole word
    > reverse find
    >
    >
    -------------------------------------------------------------------------------
    > ap_Win32Resources_DialogReplace.rc2
    > ...\abi\src\wp\ap\win\
    >
    -------------------------------------------------------------------------------
    > added two checkboxes:
    > match whole word
    > reverse find
    >
    > --=[]=--
    >
    >
    -------------------------------------------------------------------------------
    > ap_EditMethods.cpp ...\abi\src\wp\ap\xp\
    >
    -------------------------------------------------------------------------------
    > Added Editmethods:
    > scriptingFind
    > scriptingFindReverse
    > scriptingReplace
    > scriptingReplaceAll
    >
    > These Editmethods use their CallData as follows:
    > m_pData = (char) string to find
    > m_xPos = match case (0=false, 1=true)
    > m_yPos = whole word (0=false, 1=true)
    >
    === message truncated ===

    > ATTACHMENT part 3 image/x-png name=find.png

    > ATTACHMENT part 4 image/x-png name=replace.png
    > Index: abi/src/text/fmt/xp/fv_View.h
    >
    ===================================================================
    > RCS file: /cvsroot/abi/src/text/fmt/xp/fv_View.h,v
    > retrieving revision 1.278
    > diff -u -r1.278 fv_View.h
    > --- abi/src/text/fmt/xp/fv_View.h 23 Apr 2003
    > 14:36:35 -0000 1.278
    > +++ abi/src/text/fmt/xp/fv_View.h 22 May 2003
    > 09:46:02 -0000
    > @@ -226,7 +226,7 @@
    > virtual bool isSelectionEmpty(void) const;
    > virtual void cmdUnselectSelection(void);
    > void
    > getDocumentRangeOfCurrentSelection(PD_DocumentRange
    > * pdr);
    > -
    > + PT_DocPosition GetDocPosition ( FV_DocPos
    > dp );
    > PT_DocPosition saveSelectedImage (const char *
    > toFile );
    > PT_DocPosition saveSelectedImage (const UT_ByteBuf
    > ** outByteBuf);
    >
    > @@ -401,33 +401,31 @@
    >
    > // find and replace
    >
    > - bool findSetNextString(UT_UCSChar* string, bool
    > bMatchCase);
    > + bool findSetFindString (const UT_UCSChar*
    > string);
    > + bool findSetReplaceString(const UT_UCSChar*
    > string);
    > + bool findSetReverseFind (bool newValue);
    > + bool findSetMatchCase (bool newValue);
    > + bool findSetWholeWord (bool newValue);
    > + UT_UCSChar * findGetFindString (void);
    > + UT_UCSChar * findGetReplaceString(void);
    > + bool findGetReverseFind ();
    > + bool findGetMatchCase ();
    > + bool findGetWholeWord ();
    > bool findAgain(void);
    > -
    > void findSetStartAtInsPoint(void);
    > -
    > - bool findNext(const UT_UCSChar* pFind, bool
    > bMatchCase,
    > - bool& bDoneEntireDocument);
    > - UT_uint32* _computeFindPrefix(const UT_UCSChar*
    > pFind,
    > - bool bMatchCase);
    > - bool _findNext(const UT_UCSChar* pFind,
    > - UT_uint32* pPrefix,
    > - bool bMatchCase,
    > - bool& bDoneEntireDocument);
    > -
    > - bool _findReplace(const UT_UCSChar* pFind,
    > - const UT_UCSChar* pReplace,
    > - UT_uint32* pPrefix,
    > - bool bMatchCase,
    > - bool& bDoneEntireDocument);
    > - bool findReplace(const UT_UCSChar* pFind,
    > - const UT_UCSChar* pReplace,
    > - bool bMatchCase,
    > - bool& bDoneEntireDocument);
    > -
    > - UT_uint32 findReplaceAll(const UT_UCSChar* pFind,
    > - const UT_UCSChar* pReplace,
    > - bool bMatchCase);
    > + bool findNext(bool& bDoneEntireDocument);
    > + bool findNext(const UT_UCSChar* pFind, bool&
    > bDoneEntireDocument);
    > + bool findPrev(bool& bDoneEntireDocument);
    > + bool findPrev(const UT_UCSChar* pFind, bool&
    > bDoneEntireDocument);
    > + bool findReplaceReverse(bool&
    > bDoneEntireDocument);
    > + bool findReplace(bool& bDoneEntireDocument);
    > + UT_uint32 findReplaceAll();
    > +
    > + UT_uint32* _computeFindPrefix(const UT_UCSChar*
    > pFind);
    > + bool _findNext(UT_uint32* pPrefix, bool&
    > bDoneEntireDocument);
    > + bool _findPrev(UT_uint32* pPrefix, bool&
    > bDoneEntireDocument);
    > + bool _findReplaceReverse(UT_uint32* pPrefix,
    > bool& bDoneEntireDocument);
    > + bool _findReplace(UT_uint32* pPrefix, bool&
    > bDoneEntireDocument);
    >
    > // ----------------------
    >
    > @@ -707,9 +705,13 @@
    > fl_BlockLayout * _findGetCurrentBlock(void);
    > PT_DocPosition _findGetCurrentOffset(void);
    > UT_UCSChar *
    > _findGetNextBlockBuffer(fl_BlockLayout ** block,
    > PT_DocPosition *offset);
    > + UT_UCSChar *
    > _findGetPrevBlockBuffer(fl_BlockLayout ** block,
    > PT_DocPosition *offset);
    >
    > - bool _m_matchCase;
    > - UT_UCSChar * _m_findNextString;
    > + bool _m_bReverseFind;
    > + bool _m_bWholeWord;
    > + bool _m_bMatchCase;
    > + UT_UCSChar * _m_sFind;
    > + UT_UCSChar * _m_sReplace;
    >
    > UT_sint32 _findBlockSearchRegexp(const UT_UCSChar
    > * haystack, const
    > UT_UCSChar * needle);
    >
    >
    > > Index: abi/src/text/fmt/xp/fv_View.cpp
    >
    ===================================================================
    > RCS file: /cvsroot/abi/src/text/fmt/xp/fv_View.cpp,v
    > retrieving revision 1.796
    > diff -u -r1.796 fv_View.cpp
    > --- abi/src/text/fmt/xp/fv_View.cpp 17 May 2003
    > 20:15:15 -0000 1.796
    > +++ abi/src/text/fmt/xp/fv_View.cpp 22 May 2003
    > 09:46:08 -0000
    > @@ -159,8 +159,11 @@
    > m_pEditShadow(NULL),
    > m_iSavedPosition(0),
    > m_bNeedSavedPosition(false),
    > - _m_matchCase(false),
    > - _m_findNextString(0),
    > + _m_bMatchCase(false),
    > + _m_bReverseFind(false),
    > + _m_bWholeWord(false),
    > + _m_sFind(0),
    > + _m_sReplace(0),
    > m_bShowPara(false),
    > m_viewMode(VIEW_PRINT),
    > m_previewMode(PREVIEW_NONE),
    > @@ -421,8 +424,8 @@
    > {
    > DELETEP(m_caretListener);
    > }
    > -
    > - FREEP(_m_findNextString);
    > + FREEP(_m_sFind);
    > + FREEP(_m_sReplace);
    >
    > FREEP(m_chg.propsChar);
    > FREEP(m_chg.propsBlock);
    > @@ -927,26 +930,26 @@
    > switch(focus)
    > {
    > case AV_FOCUS_HERE:
    > - if (isSelectionEmpty() && (getPoint() > 0))
    > + if (isSelectionEmpty() && (getPoint() > 0) &&
    > m_pG->getCaret())
    > {
    > m_pG->getCaret()->setBlink(m_bCursorBlink);
    > }
    > m_pApp->rememberFocussedFrame(m_pParentData);
    > break;
    > case AV_FOCUS_NEARBY:
    > - if (isSelectionEmpty() && (getPoint() > 0))
    > + if (isSelectionEmpty() && (getPoint() > 0) &&
    > m_pG->getCaret())
    > {
    > m_pG->getCaret()->setBlink(false);
    > }
    > break;
    > case AV_FOCUS_MODELESS:
    > - if (isSelectionEmpty() && (getPoint() > 0))
    > + if (isSelectionEmpty() && (getPoint() > 0) &&
    > m_pG->getCaret())
    > {
    > m_pG->getCaret()->setBlink(false);
    > }
    > break;
    > case AV_FOCUS_NONE:
    > - if (isSelectionEmpty() && (getPoint() > 0))
    > + if (isSelectionEmpty() && (getPoint() > 0) &&
    > m_pG->getCaret())
    > {
    > m_pG->getCaret()->setBlink(false);
    > }
    > @@ -1280,6 +1283,10 @@
    > return dPos ;
    > }
    >
    > +PT_DocPosition FV_View::GetDocPosition( FV_DocPos
    > dp ) {
    > + return ( _getDocPos( dp ));
    > + }
    > +
    > PT_DocPosition FV_View::saveSelectedImage (const
    > UT_ByteBuf ** pBytes)
    > {
    > const char * dataId = NULL;
    > @@ -4710,16 +4717,28 @@
    > \return True if string was found, false otherwise
    > */
    > bool
    > -FV_View::findNext(const UT_UCSChar* pFind, bool
    > bMatchCase,
    > - bool& bDoneEntireDocument)
    > +FV_View::findNext(const UT_UCSChar* pFind, bool&
    > bDoneEntireDocument)
    > +
    > +{
    > + findSetFindString(pFind);
    > + return findNext(bDoneEntireDocument);
    > +}
    > +
    > +bool
    > +FV_View::findNext(bool& bDoneEntireDocument)
    > {
    > + if ((m_startPosition >=0) && (m_startPosition <2))
    > {
    > + m_startPosition = 2;
    > + setPoint(m_startPosition);
    > + }
    > +
    > if (!isSelectionEmpty())
    > {
    > _clearSelection();
    > }
    >
    > - UT_uint32* pPrefix = _computeFindPrefix(pFind,
    > bMatchCase);
    > - bool bRes = _findNext(pFind, pPrefix, bMatchCase,
    > bDoneEntireDocument);
    > + UT_uint32* pPrefix = _computeFindPrefix(_m_sFind);
    > + bool bRes = _findNext(pPrefix,
    > bDoneEntireDocument);
    > FREEP(pPrefix);
    >
    > if (isSelectionEmpty())
    > @@ -4737,6 +4756,38 @@
    > return bRes;
    > }
    >
    > +bool
    > +FV_View::findPrev(const UT_UCSChar* pFind, bool&
    > bDoneEntireDocument)
    > +{
    > + findSetFindString(pFind);
    > + return findPrev(bDoneEntireDocument);
    > +}
    > +
    > +bool
    > +FV_View::findPrev(bool& bDoneEntireDocument)
    > +{
    > + if (!isSelectionEmpty())
    > + {
    > + _clearSelection();
    > + }
    > +
    > + UT_uint32* pPrefix = _computeFindPrefix(_m_sFind);
    > + bool bRes = _findPrev(pPrefix,
    > bDoneEntireDocument);
    > + FREEP(pPrefix);
    > +
    > + if (isSelectionEmpty())
    > + {
    > + _updateInsertionPoint();
    > + }
    > + else
    > + {
    > + _ensureInsertionPointOnScreen();
    > + _drawSelection();
    > + }
    > +
    > + notifyListeners(AV_CHG_MOTION);
    > + return bRes;
    > +}
    >
    > /*!
    > Find operation reset
    > @@ -4752,25 +4803,96 @@
    > m_doneFind = false;
    > }
    >
    > +bool
    > +FV_View::findSetFindString(const UT_UCSChar* pFind)
    > +{
    > + FREEP(_m_sFind);
    > + return UT_UCS4_cloneString(&_m_sFind, pFind);
    > +}
    > +
    > +UT_UCSChar *
    > +FV_View::findGetFindString(void)
    > +{
    > + UT_UCSChar * string = NULL;
    > + if (_m_sFind)
    > + {
    > + if (UT_UCS4_cloneString(&string, _m_sFind))
    > + return string;
    > + }
    > + else
    > + {
    > + if (UT_UCS4_cloneString_char(&string, ""))
    > + return string;
    > + }
    > +
    > + return NULL;
    > +}
    > +
    > +bool
    > +FV_View::findSetReplaceString(const UT_UCSChar*
    > pReplace)
    > +{
    > + FREEP(_m_sReplace);
    > + return UT_UCS4_cloneString(&_m_sReplace,
    > pReplace);
    > +}
    > +
    > +UT_UCSChar *
    >
    === message truncated ===> Index:
    abi/src/text/fmt/xp/fv_View_protected.cpp
    >
    ===================================================================
    > RCS file:
    > /cvsroot/abi/src/text/fmt/xp/fv_View_protected.cpp,v
    > retrieving revision 1.91
    > diff -u -r1.91 fv_View_protected.cpp
    > --- abi/src/text/fmt/xp/fv_View_protected.cpp 21 May
    > 2003 07:53:10
    > -0000 1.91
    > +++ abi/src/text/fmt/xp/fv_View_protected.cpp 22 May
    > 2003 09:46:14 -0000
    > @@ -31,7 +31,7 @@
    > #include "ut_string.h"
    > #include "ut_bytebuf.h"
    > #include "ut_timer.h"
    > -
    > +#include "ut_types.h"
    > #include "xav_View.h"
    > #include "fv_View.h"
    > #include "fl_DocLayout.h"
    > @@ -2010,19 +2010,19 @@
    > /*!
    > Compute prefix function for search
    > \param pFind String to find
    > - \param bMatchCase True to match case, false to
    > ignore case
    > */
    > +
    > UT_uint32*
    > -FV_View::_computeFindPrefix(const UT_UCSChar*
    > pFind, bool bMatchCase)
    > +FV_View::_computeFindPrefix(const UT_UCSChar*
    > pFind)
    > {
    > UT_uint32 m = UT_UCS4_strlen(pFind);
    > UT_uint32 k = 0, q = 1;
    > - UT_uint32 *pPrefix =
    > static_cast<UT_uint32*>(UT_calloc(m,
    > sizeof(UT_uint32)));
    > + UT_uint32 *pPrefix = (UT_uint32*) UT_calloc(m,
    > sizeof(UT_uint32));
    > UT_ASSERT(pPrefix);
    >
    > pPrefix[0] = 0; // Must be this regardless of the
    > string
    >
    > - if (bMatchCase)
    > + if (_m_bMatchCase)
    > {
    > for (q = 1; q < m; q++)
    > {
    > @@ -2061,32 +2061,32 @@
    > function - it is presently done lot's of places in
    > the code.
    > */
    > bool
    > -FV_View::_findNext(const UT_UCSChar* pFind,
    > UT_uint32* pPrefix,
    > - bool bMatchCase, bool& bDoneEntireDocument)
    > +FV_View::_findNext(UT_uint32* pPrefix,
    > + bool& bDoneEntireDocument)
    > {
    > - UT_ASSERT(pFind);
    > + UT_ASSERT(_m_sFind);
    >
    > fl_BlockLayout* block = _findGetCurrentBlock();
    > PT_DocPosition offset = _findGetCurrentOffset();
    > UT_UCSChar* buffer = NULL;
    > - UT_uint32 m = UT_UCS4_strlen(pFind);
    > + UT_uint32 m = UT_UCS4_strlen(_m_sFind);
    >
    > // Clone the search string, converting it to
    > lowercase is search
    > // should ignore case.
    > - UT_UCSChar* pFindStr =
    > static_cast<UT_UCSChar*>(UT_calloc(m,
    > sizeof(UT_UCSChar)));
    > + UT_UCSChar* pFindStr = (UT_UCSChar*) UT_calloc(m,
    > sizeof(UT_UCSChar));
    > UT_ASSERT(pFindStr);
    > if (!pFindStr)
    > return false;
    > UT_uint32 j;
    > - if (bMatchCase)
    > + if (_m_bMatchCase)
    > {
    > for (j = 0; j < m; j++)
    > - pFindStr[j] = pFind[j];
    > + pFindStr[j] = _m_sFind[j];
    > }
    > else
    > {
    > for (j = 0; j < m; j++)
    > - pFindStr[j] = UT_UCS4_tolower(pFind[j]);
    > + pFindStr[j] = UT_UCS4_tolower(_m_sFind[j]);
    > }
    >
    > // Now we use the prefix function (stored as an
    > array) to search
    > @@ -2096,7 +2096,7 @@
    > UT_sint32 foundAt = -1;
    > UT_uint32 i = 0, t = 0;
    >
    > - if (bMatchCase)
    > + if (_m_bMatchCase)
    > {
    > UT_UCSChar currentChar;
    >
    > @@ -2113,8 +2113,18 @@
    > i++;
    > if (t == m)
    > {
    > - foundAt = i - m;
    > - break;
    > + if (_m_bWholeWord) {
    > + bool start =
    > UT_isWordDelimiter(buffer[i-m-1], UCS_UNKPUNK,
    > UCS_UNKPUNK);
    > + bool end = UT_isWordDelimiter(buffer[i],
    > UCS_UNKPUNK, UCS_UNKPUNK);
    > + if (start && end) {
    > + foundAt = i - m;
    > + break;
    > + }
    > + }
    > + else {
    > + foundAt = i - m;
    > + break;
    > + }
    > }
    > }
    > }
    > @@ -2132,13 +2142,27 @@
    >
    > while (t > 0 && pFindStr[t] != currentChar)
    > t = pPrefix[t-1];
    > +
    > if (pFindStr[t] == currentChar)
    > t++;
    > i++;
    > if (t == m)
    > {
    > - foundAt = i - m;
    > - break;
    > + if (_m_bWholeWord)
    > + {
    > + bool start =
    > UT_isWordDelimiter(buffer[i-m-1], UCS_UNKPUNK,
    > UCS_UNKPUNK);
    > + bool end = UT_isWordDelimiter(buffer[i],
    > UCS_UNKPUNK, UCS_UNKPUNK);
    > + if (start && end)
    > + {
    > + foundAt = i - m;
    > + break;
    > + }
    > + }
    > + else
    > + {
    > + foundAt = i - m;
    > + break;
    > + }
    > }
    > }
    > }
    > @@ -2176,6 +2200,170 @@
    > return false;
    > }
    >
    > +bool
    > +FV_View::_findPrev(UT_uint32* pPrefix,
    > + bool& bDoneEntireDocument)
    > +{
    > + UT_ASSERT(_m_sFind);
    > +
    > + fl_BlockLayout* block = _findGetCurrentBlock();
    > + PT_DocPosition offset = _findGetCurrentOffset();
    > + UT_UCSChar* buffer = NULL;
    > + UT_uint32 m = UT_UCS4_strlen(_m_sFind);
    > +
    > + // Clone the search string, converting it to
    > lowercase is search
    > + // should ignore case.
    > + UT_UCSChar* pFindStr = (UT_UCSChar*) UT_calloc(m,
    > sizeof(UT_UCSChar));
    > + UT_ASSERT(pFindStr);
    > + if (!pFindStr)
    > + return false;
    > + UT_uint32 j;
    > + if (_m_bMatchCase)
    > + {
    > + for (j = 0; j < m; j++)
    > + pFindStr[j] = _m_sFind[j];
    > + }
    > + else
    > + {
    > + for (j = 0; j < m; j++)
    > + pFindStr[j] = UT_UCS4_tolower(_m_sFind[j]);
    > + }
    > +
    > + // Now we use the prefix function (stored as an
    > array)
    === message truncated ===> Index:
    abi/src/text/fmt/xp/fl_DocLayout.h
    >
    ===================================================================
    > RCS file:
    > /cvsroot/abi/src/text/fmt/xp/fl_DocLayout.h,v
    > retrieving revision 1.95
    > diff -u -r1.95 fl_DocLayout.h
    > --- abi/src/text/fmt/xp/fl_DocLayout.h 3 May 2003
    > 12:20:22 -0000 1.95
    > +++ abi/src/text/fmt/xp/fl_DocLayout.h 22 May 2003
    > 09:46:44 -0000
    > @@ -133,6 +133,7 @@
    > void setLayoutIsFilling(bool bisFill) {
    > m_bisLayoutFilling =
    > bisFill;}
    > bool isLayoutFilling(void) const { return
    > m_bisLayoutFilling;}
    > fl_BlockLayout* findBlockAtPosition(PT_DocPosition
    > pos) const;
    > + fl_BlockLayout*
    > findBlockAtPositionReverse(PT_DocPosition pos);
    > void deletePage(fp_Page* pPage, bool bDontNotify);
    >
    > void formatAll();
    >
    > > Index: abi/src/text/fmt/xp/fl_DocLayout.cpp
    >
    ===================================================================
    > RCS file:
    > /cvsroot/abi/src/text/fmt/xp/fl_DocLayout.cpp,v
    > retrieving revision 1.217
    > diff -u -r1.217 fl_DocLayout.cpp
    > --- abi/src/text/fmt/xp/fl_DocLayout.cpp 3 May 2003
    > 12:20:22 -0000 1.217
    > +++ abi/src/text/fmt/xp/fl_DocLayout.cpp 22 May 2003
    > 09:46:48 -0000
    > @@ -1354,6 +1354,114 @@
    > return pBL;
    > }
    >
    > +fl_BlockLayout*
    >
    FL_DocLayout::findBlockAtPositionReverse(PT_DocPosition
    >
    > pos)
    > +{
    > + fl_BlockLayout* pBL = NULL;
    > + PL_StruxFmtHandle sfh = 0;
    > +
    > + PT_DocPosition posBOD;
    > + bool bRes;
    > +
    > + bRes = m_pDoc->getBounds(false, posBOD);
    > + UT_ASSERT(bRes);
    > + if(m_pDoc->isEndFootnoteAtPos(pos))
    > + {
    > + xxx_UT_DEBUGMSG(("End footnote found at %d
    > \n",pos));
    > + pos--;
    > + }
    > + if(m_pDoc->isFootnoteAtPos(pos))
    > + {
    > + xxx_UT_DEBUGMSG(("Start footnote found at %d
    > \n",pos));
    > + pos+=2;
    > + }
    > + bRes = m_pDoc->getStruxOfTypeFromPosition(m_lid,
    > pos, PTX_Block, &sfh);
    > + // If block wasn't found at position, try finding
    > it to the right,
    > + // limited only by the EOD.
    > + while(!bRes && (pos > posBOD))
    > + {
    > + pos--;
    > + bRes = m_pDoc->getStruxOfTypeFromPosition(m_lid,
    > pos, PTX_Block, &sfh);
    > + }
    > +
    > + if (bRes)
    > + {
    > + fl_Layout * pL = (fl_Layout *)sfh;
    > + if(!pL)
    > + return NULL;
    > +
    > + switch (pL->getType())
    > + {
    > + case PTX_Block:
    > + pBL = static_cast<fl_BlockLayout *>(pL);
    > + break;
    > +
    > + case PTX_Section:
    > + default:
    > + UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
    > + // We asked for a block, and we got a section.
    > Bad
    > + return NULL;
    > + }
    > + }
    > + else
    > + {
    > + UT_ASSERT(0);
    > + return NULL;
    > + }
    > +
    > + if(pBL->getSectionLayout()->getType() ==
    > FL_SECTION_HDRFTR)
    > + {
    > + fl_HdrFtrShadow * pShadow = NULL;
    > + FV_View * pView = getView();
    > + if(pView && pView->isHdrFtrEdit())
    > + {
    > + pShadow = pView->getEditShadow();
    > +//
    > +// We might actually be in the other HdrFtr is the
    > point got here from an
    > undo!
    > +// Check for this.
    > +//
    > +
    >
    if(!pShadow->getHdrFtrSectionLayout()->isPointInHere(pos))
    > + {
    > + fl_HdrFtrSectionLayout * pHF =
    > (fl_HdrFtrSectionLayout *)
    > pBL->getSectionLayout();
    > + if(pHF->isPointInHere(pos))
    > + {
    > + pShadow = pHF->getFirstShadow();
    > + pView->clearHdrFtrEdit();
    > + pView->setHdrFtrEdit(pShadow);
    > + pBL = (fl_BlockLayout *)
    > pShadow->findBlockAtPosition(pos);
    > + return pBL;
    > + }
    > + // Ok, we're really confused now, point is
    > nowhere to be found.
    > + // It might be OK if pos-1 is in here,
    > though...
    > + if
    >
    (!pShadow->getHdrFtrSectionLayout()->isPointInHere(pos-1))
    > + {
    > + UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
    > + }
    > + }
    > +
    > + }
    > + else
    > + {
    > + pShadow = ((fl_HdrFtrSectionLayout *)
    > pBL->getSectionLayout())->getFirstShadow();
    > + }
    > + fl_BlockLayout * ppBL = NULL;
    > + if(pShadow != NULL)
    > + ppBL = (fl_BlockLayout *)
    > pShadow->findMatchingContainer(pBL);
    > + else
    > + {
    > + if(!isLayoutFilling())
    > + {
    > + UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
    > + }
    > + }
    > +
    > + if(ppBL) {
    > + pBL = ppBL;
    > + }
    > + }
    > + UT_ASSERT(pBL);
    > + return pBL;
    > +}
    > +
    > void FL_DocLayout::deleteEmptyColumnsAndPages(void)
    > {
    > fl_DocSectionLayout* pSL = m_pFirstSection;
    >
    > > Index: abi/src/wp/ap/xp/ap_Dialog_Replace.h
    >
    ===================================================================
    > RCS file:
    > /cvsroot/abi/src/wp/ap/xp/ap_Dialog_Replace.h,v
    > retrieving revision 1.17
    > diff -u -r1.17 ap_Dialog_Replace.h
    > --- abi/src/wp/ap/xp/ap_Dialog_Replace.h 6 May 2003
    > 22:57:48 -0000 1.17
    > +++ abi/src/wp/ap/xp/ap_Dialog_Replace.h 22 May 2003
    > 09:46:21 -0000
    > @@ -39,8 +39,8 @@
    > virtual void useEnd(void);
    > virtual void runModal(XAP_Frame * pFrame) = 0;
    > virtual void runModeless(XAP_Frame * pFrame) = 0;
    > - virtual void destroy(void)=0;
    > - virtual void activate(void)=0;
    > + virtual void destroy(void)=0;
    > + virtual void activate(void)=0;
    > void setActiveFrame(XAP_Frame *pFrame);
    > virtual void notifyActiveFrame(XAP_Frame *pFrame)
    > = 0;
    >
    > @@ -66,9 +66,16 @@
    > bool setMatchCase(bool match);
    > bool getMatchCase(void);
    >
    > + bool setReverseFind( bool newValue);
    > + bool getReverseFind(void);
    > + bool setWholeWord( bool newValue);
    > + bool getWholeWord(void);
    > +
    > // Action functions... set data using the accessors
    > // above and call one of these.
    > bool findNext(void);
    > + bool findPrev(void);
    > + bool findReplaceReverse(void);
    > bool findReplace(void);
    > bool findReplaceAll(void);
    >
    > @@ -77,20 +84,21 @@
    > // These are the persistent dialog data items,
    > // which are carefully read and set by useStart()
    > // and useEnd(), and not by the accessors.
    > - UT_UCSChar * persist_findString;
    > - UT_UCSChar * persist_replaceString;
    > - bool persist_matchCase;
    > -
    > + UT_UCSChar * persist_findString;
    > + UT_UCSChar * persist_replaceString;
    > + bool persist_matchCase;
    > + bool persist_reverseFind;
    > + bool persist_wholeWord;
    > +
    > // These are the "current use" dialog data items,
    > // which are liberally read and set by the
    > // accessor methods above. Note that the buffers
    > // these may point to are destroyed when useEnd()
    > // is done storing them away
    > - FV_View * m_pView;
    > - UT_UCSChar * m_findString;
    > - UT_UCSChar * m_replaceString;
    > - bool m_matchCase;
    > -
    > + FV_View * m_pView;
    > + UT_UCSChar * m_findString;
    > + UT_UCSChar * m_replaceString;
    > +
    > // These are also "current use" dialog data item,
    > // but they're not user-settable; they are set
    > // on conditions that action functions or other
    >
    > > Index: abi/src/wp/ap/xp/ap_Dialog_Replace.cpp
    >
    ===================================================================
    > RCS file:
    > /cvsroot/abi/src/wp/ap/xp/ap_Dialog_Replace.cpp,v
    > retrieving revision 1.42
    > diff -u -r1.42 ap_Dialog_Replace.cpp
    > --- abi/src/wp/ap/xp/ap_Dialog_Replace.cpp 6 May
    > 2003 22:57:48 -0000 1.42
    > +++ abi/src/wp/ap/xp/ap_Dialog_Replace.cpp 22 May
    > 2003 09:46:24 -0000
    > @@ -47,10 +47,10 @@
    > m_pView = NULL;
    > m_pFrame = NULL;
    >
    > - m_findString = NULL;
    > - m_replaceString = NULL;
    > - m_matchCase = false;
    > +
    > UT_DEBUGMSG(("AP_dlg_replace::AP_dlg_replace()\n"));
    >
    > + persist_reverseFind = false;
    > + persist_wholeWord = false;
    > m_didSomething = false;
    >
    > // is this used?
    > @@ -63,8 +63,7 @@
    > {
    > // UT_ASSERT(!m_bInUse);
    >
    > - FREEP(m_findString);
    > - FREEP(m_replaceString);
    > +
    >
    UT_DEBUGMSG(("AP_dlg_replace::~AP_dlg_Replace()\n"));
    >
    > FREEP(persist_findString);
    > FREEP(persist_replaceString);
    > @@ -89,14 +88,6 @@
    > {
    > UT_DEBUGMSG(("AP_Dialog_Replace::useStart(void)
    > I've been called\n"));
    >
    > - // restore from persistent storage
    > - if (persist_findString)
    > - UT_UCS4_cloneString(&m_findString,
    > persist_findString);
    > - if (persist_replaceString)
    > - UT_UCS4_cloneString(&m_replaceString,
    > persist_replaceString);
    > -
    > - m_matchCase = persist_matchCase;
    > -
    > }
    >
    > void AP_Dialog_Replace::useEnd(void)
    > @@ -108,14 +99,13 @@
    > if (m_didSomething)
    > {
    > FREEP(persist_findString);
    > - if (m_findString)
    > - UT_UCS4_cloneString(&persist_findString,
    > m_findString);
    > -
    > + UT_UCS4_cloneString(&persist_findString,
    > getFindString());
    > FREEP(persist_replaceString);
    > - if (m_replaceString)
    > - UT_UCS4_cloneString(&persist_replaceString,
    > m_replaceString);
    > + UT_UCS4_cloneString(&persist_replaceString,
    > getReplaceString());
    >
    > - persist_matchCase = m_matchCase;
    > + persist_matchCase = getMatchCase();
    > + persist_reverseFind = getReverseFind();
    > + persist_wholeWord = getWholeWord();
    > }
    > }
    >
    > @@ -183,23 +173,28 @@
    >
    > bool AP_Dialog_Replace::setFindString(const
    > UT_UCSChar * string)
    > {
    > - if (string && m_findString &&
    > UT_UCS4_strcmp(string, m_findString) != 0)
    > +
    > UT_DEBUGMSG(("AP_dlg_replace::setFindString()\n"));
    > +
    > + if (string && getFvView()->findGetFindString() &&
    > UT_UCS4_strcmp(string,
    > getFvView()->findGetFindString()) != 0)
    > {
    > // When search parameters change, clear any
    > existing selection to
    > // avoid replacement of the previous search
    > string.
    > getFvView()->cmdUnselectSelection();
    > }
    >
    > - FREEP(m_findString);
    > - return UT_UCS4_cloneString(&m_findString, string);
    > +
    > + return getFvView()->findSetFindString(string);
    > }
    >
    > UT_UCSChar * AP_Dialog_Replace::getFindString(void)
    > +
    > {
    > +
    > UT_DEBUGMSG(("AP_dlg_replace::getFindString()\n"));
    > +
    > UT_UCSChar * string = NULL;
    > - if (m_findString)
    > + if (getFvView()->findGetFindString())
    > {
    > - if (UT_UCS4_cloneString(&string, m_findString))
    > + if (UT_UCS4_cloneString(&string,
    > getFvView()->findGetFindString()))
    > return string;
    > }
    > else
    > @@ -212,16 +207,20 @@
    >
    > bool AP_Dialog_Replace::setReplaceString(const
    > UT_UCSChar * string)
    > {
    > - FREEP(m_replaceString);
    > - return UT_UCS4_cloneString(&m_replaceString,
    > string);
    > +
    >
    UT_DEBUGMSG(("AP_dlg_replace::setReplaceString()\n"));
    > +
    > + return getFvView()->findSetReplaceString(string);
    > }
    >
    > UT_UCSChar *
    > AP_Dialog_Replace::getReplaceString(void)
    > {
    > +
    >
    UT_DEBUGMSG(("AP_dlg_replace::getReplaceString()\n"));
    > +
    > UT_UCSChar * string = NULL;
    > - if (m_replaceString)
    > +
    > + if (getFvView()->findGetReplaceString())
    > {
    > - if (UT_UCS4_cloneString(&string,
    > m_replaceString))
    > + if (UT_UCS4_cloneString(&string,
    > getFvView()->findGetReplaceString()))
    > return string;
    > }
    > else
    > @@ -235,7 +234,9 @@
    >
    > bool AP_Dialog_Replace::setMatchCase(bool match)
    > {
    > - if (match != m_matchCase)
    > + UT_DEBUGMSG(("AP_dlg_replace::setMatchCase()\n"));
    > +
    > + if (match != getFvView()->findGetMatchCase())
    > {
    > // When search parameters change, clear any
    > existing selection to
    > // avoid replacement of the previous search
    > string.
    > @@ -243,24 +244,67 @@
    > getFvView()->cmdUnselectSelection();
    > }
    >
    > - m_matchCase = match;
    > - return true;
    > + return getFvView()->findSetMatchCase(match);
    > }
    >
    > bool AP_Dialog_Replace::getMatchCase(void)
    > {
    > - return m_matchCase;
    > + UT_DEBUGMSG(("AP_dlg_replace::getMatchCase()\n"));
    > + return getFvView()->findGetMatchCase();
    > +}
    > +
    > +bool AP_Dialog_Replace::setReverseFind(bool
    > newValue)
    > +{
    > +
    > UT_DEBUGMSG(("AP_dlg_replace::setReverseFind()\n"));
    > +
    > + return getFvView()->findSetReverseFind(newValue);
    > +}
    > +
    > +bool AP_Dialog_Replace::getReverseFind(void)
    > +{
    > +
    > UT_DEBUGMSG(("AP_dlg_replace::getReverseFind()\n"));
    > +
    > + return getFvView()->findGetReverseFind();
    > +}
    > +
    > +bool AP_Dialog_Replace::setWholeWord(bool newValue)
    > +{
    >
    === message truncated ===> Index:
    abi/src/wp/ap/win/ap_Win32Dialog_Replace.cpp
    >
    ===================================================================
    > RCS file:
    >
    /cvsroot/abi/src/wp/ap/win/ap_Win32Dialog_Replace.cpp,v
    > retrieving revision 1.23
    > diff -u -r1.23 ap_Win32Dialog_Replace.cpp
    > --- abi/src/wp/ap/win/ap_Win32Dialog_Replace.cpp 7
    > May 2003 07:13:07
    > -0000 1.23
    > +++ abi/src/wp/ap/win/ap_Win32Dialog_Replace.cpp 22
    > May 2003 09:46:28 -0000
    > @@ -49,9 +49,6 @@
    > XAP_Dialog_Id id)
    > : AP_Dialog_Replace(pDlgFactory,id)
    > {
    > - m_findString = NULL;
    > - m_replaceString = NULL;
    > - m_matchCase = true;
    > m_hWnd = 0;
    > }
    >
    > @@ -287,6 +284,14 @@
    >
    >
    setMatchCase((IsDlgButtonChecked(hWnd,AP_RID_DIALOG_REPLACE_CHECK_MATCHCASE)==BST_CHECKED));
    > return 1;
    >
    > + case AP_RID_DIALOG_REPLACE_CHECK_WHOLEWORD:
    > +
    >
    setWholeWord((IsDlgButtonChecked(hWnd,AP_RID_DIALOG_REPLACE_CHECK_WHOLEWORD)==BST_CHECKED));
    > + return 1;
    > +
    > + case AP_RID_DIALOG_REPLACE_CHECK_REVERSEFIND:
    > +
    >
    setReverseFind((IsDlgButtonChecked(hWnd,AP_RID_DIALOG_REPLACE_CHECK_REVERSEFIND)==BST_CHECKED));
    > + return 1;
    > +
    > case AP_RID_DIALOG_REPLACE_BTN_FINDNEXT:
    > return _onBtn_FindNext(hWnd);
    >
    > @@ -328,7 +333,12 @@
    > goto FreeMemory;
    >
    > setFindString(pUCSFind);
    > - findNext();
    > + if (!getReverseFind()) {
    > + findNext();
    > + }
    > + else {
    > + findPrev();
    > + }
    >
    > FreeMemory:
    > DELETEP(pBufFromDialogFind);
    > @@ -378,7 +388,12 @@
    >
    > setFindString(pUCSFind);
    > setReplaceString(pUCSReplace);
    > - findReplace();
    > + if (!getReverseFind()) {
    > + findReplace();
    > + }
    > + else {
    > + findReplaceReverse();
    > + }
    >
    > FreeMemory:
    > DELETEP(pBufFromDialogFind);
    >
    > > Index:
    >
    abi/src/wp/ap/win/ap_Win32Resources_DialogReplace.rc2
    >
    ===================================================================
    > RCS file:
    >
    /cvsroot/abi/src/wp/ap/win/ap_Win32Resources_DialogReplace.rc2,v
    > retrieving revision 1.7
    > diff -u -r1.7 ap_Win32Resources_DialogReplace.rc2
    > ---
    >
    abi/src/wp/ap/win/ap_Win32Resources_DialogReplace.rc2
    > 15 Apr 2002
    > 17:40:56 -0000 1.7
    > +++
    >
    abi/src/wp/ap/win/ap_Win32Resources_DialogReplace.rc2
    > 22 May 2003
    > 09:46:31 -0000
    > @@ -37,38 +37,48 @@
    > #define AP_RID_DIALOG_REPLACE_CHECK_MATCHCASE 1006
    > #define AP_RID_DIALOG_REPLACE_TEXT_FIND 1007
    > #define AP_RID_DIALOG_REPLACE_TEXT_REPLACE 1008
    > +#define AP_RID_DIALOG_REPLACE_CHECK_WHOLEWORD
    > 1009
    > +#define AP_RID_DIALOG_REPLACE_CHECK_REVERSEFIND
    > 1010
    >
    > #ifdef RC_INVOKED
    > // NOTE -- these placeholder strings get overridden
    > at runtime
    > // NOTE -- they're just here to make sizing easier
    >
    > -AP_RID_DIALOG_REPLACE DIALOG DISCARDABLE 0, 0,
    > 254, 82
    > +AP_RID_DIALOG_REPLACE DIALOG DISCARDABLE 0, 0,
    > 254, 92
    > STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION |
    > WS_SYSMENU
    > CAPTION "Replace"
    > FONT 8, "MS Sans Serif"
    > BEGIN
    > - LTEXT
    > "&Find:", AP_RID_DIALOG_REPLACE_TEXT_FIND,
    > 7,7,46,14,SS_CENTERIMAGE
    > + LTEXT
    > "F&ind:", AP_RID_DIALOG_REPLACE_TEXT_FIND,
    > 7,7,46,14,SS_CENTERIMAGE
    >
    > EDITTEXT AP_RID_DIALOG_REPLACE_EDIT_FIND,
    > 55,7,129,14,ES_AUTOHSCROLL
    > LTEXT
    > "&Replace:", AP_RID_DIALOG_REPLACE_TEXT_REPLACE,
    > 7,25,46,14,SS_CENTERIMAGE
    >
    > EDITTEXT AP_RID_DIALOG_REPLACE_EDIT_REPLACE,
    > 55,25,129,14,ES_AUTOHSCROLL
    > CONTROL "&Match Case",
    > AP_RID_DIALOG_REPLACE_CHECK_MATCHCASE,
    > - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,
    > 7,52,150,10
    > - DEFPUSHBUTTON "Find
    > &Next", AP_RID_DIALOG_REPLACE_BTN_FINDNEXT,
    > 195,7,55,14
    > + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,
    > 7,43,150,10
    > + CONTROL "&Whole word",
    > AP_RID_DIALOG_REPLACE_CHECK_WHOLEWORD,
    > + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,
    > 7,55,150,10
    > + CONTROL "R&everse
    > find", AP_RID_DIALOG_REPLACE_CHECK_REVERSEFIND,
    > + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,
    > 7,67,150,10
    > + DEFPUSHBUTTON "&Find",
    > AP_RID_DIALOG_REPLACE_BTN_FINDNEXT, 195,7,55,14
    >
    > PUSHBUTTON "Re&place",
    > AP_RID_DIALOG_REPLACE_BTN_REPLACE, 195,25,55,14
    > PUSHBUTTON "Replace
    > &All", AP_RID_DIALOG_REPLACE_BTN_REPLACEALL,
    > 195,43,55,14
    > PUSHBUTTON
    > "&Close", AP_RID_DIALOG_REPLACE_BTN_CLOSE,
    > 195,61,55,14
    > END
    >
    > -AP_RID_DIALOG_FIND DIALOG DISCARDABLE 0, 0, 254,
    > 49
    > +AP_RID_DIALOG_FIND DIALOG DISCARDABLE 0, 0, 254,
    > 70
    > STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION |
    > WS_SYSMENU
    > CAPTION "Find"
    > FONT 8, "MS Sans Serif"
    > BEGIN
    > - LTEXT
    > "&Find:", AP_RID_DIALOG_REPLACE_TEXT_FIND,
    > 7,7,46,14,SS_CENTERIMAGE
    > + LTEXT
    > "F&ind:", AP_RID_DIALOG_REPLACE_TEXT_FIND,
    > 7,7,46,14,SS_CENTERIMAGE
    >
    > EDITTEXT AP_RID_DIALOG_REPLACE_EDIT_FIND,
    > 55,7,129,14,ES_AUTOHSCROLL
    > CONTROL "&Match Case",
    > AP_RID_DIALOG_REPLACE_CHECK_MATCHCASE,
    > "Button",BS_AUTOCHECKBOX | WS_TABSTOP,
    > 7,31,150,10
    > - DEFPUSHBUTTON "Find
    > &Next", AP_RID_DIALOG_REPLACE_BTN_FINDNEXT,
    > 195,7,55,14
    > + DEFPUSHBUTTON "&Find",
    > AP_RID_DIALOG_REPLACE_BTN_FINDNEXT, 195,7,55,14
    > + CONTROL "&Whole word",
    > AP_RID_DIALOG_REPLACE_CHECK_WHOLEWORD,
    > + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,
    > 7,43,150,10
    > + CONTROL "R&everse
    > find", AP_RID_DIALOG_REPLACE_CHECK_REVERSEFIND,
    > + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,
    > 7,55,150,10
    > PUSHBUTTON
    > "&Close", AP_RID_DIALOG_REPLACE_BTN_CLOSE,
    > 195,25,55,14
    > END
    > #endif /* RC_INVOKED */
    >
    > > Index: abi/src/wp/ap/xp/ap_EditMethods.cpp
    >
    ===================================================================
    > RCS file:
    > /cvsroot/abi/src/wp/ap/xp/ap_EditMethods.cpp,v
    > retrieving revision 1.603
    > diff -u -r1.603 ap_EditMethods.cpp
    > --- abi/src/wp/ap/xp/ap_EditMethods.cpp 16 May 2003
    > 07:16:31 -0000 1.603
    > +++ abi/src/wp/ap/xp/ap_EditMethods.cpp 22 May 2003
    > 09:46:40 -0000
    > @@ -352,6 +352,11 @@
    > static EV_EditMethod_Fn removeHeader;
    > static EV_EditMethod_Fn removeFooter;
    >
    > + static EV_EditMethod_Fn scriptingFind;
    > + static EV_EditMethod_Fn scriptingFindReverse;
    > + static EV_EditMethod_Fn scriptingReplace;
    > + static EV_EditMethod_Fn scriptingReplaceAll;
    > +
    > static EV_EditMethod_Fn viewStd;
    > static EV_EditMethod_Fn viewFormat;
    > static EV_EditMethod_Fn viewExtra;
    > @@ -949,6 +954,12 @@
    >
    > // s
    > EV_EditMethod(NF(scriptPlay), 0, ""),
    > +
    > + EV_EditMethod(NF(scriptingFind), 0, ""),
    > + EV_EditMethod(NF(scriptingFindReverse), 0, ""),
    > + EV_EditMethod(NF(scriptingReplace), 0, ""),
    > + EV_EditMethod(NF(scriptingReplaceAll), 0, ""),
    > +
    > EV_EditMethod(NF(scrollLineDown), 0, ""),
    > EV_EditMethod(NF(scrollLineLeft), 0, ""),
    > EV_EditMethod(NF(scrollLineRight), 0, ""),
    > @@ -11310,3 +11321,193 @@
    >
    > return true;
    > }
    > +
    > +Defun(scriptingFind)
    > +{
    > + CHECK_FRAME;
    > + ABIWORD_VIEW;
    > +
    > + bool bTmp = false;
    > + bool bMatch = false;
    > + bool bWhole = false;
    > +
    > + UT_UCSChar * pUCSFind = NULL;
    > +
    >
    UT_UCS4_cloneString_char(&pUCSFind,(char*)pCallData->m_pData);
    > + UT_UCS4Char * mbuf;
    > + UT_UCS4_cloneString(&mbuf, pUCSFind);
    > +
    > + if (pCallData->m_xPos != 0)
    > + {
    > + bMatch = true;
    > + }
    > +
    > + if (pCallData->m_yPos != 0)
    > + {
    > + bWhole = true;
    > + }
    > +
    > + pView->findSetFindString(mbuf);
    > + pView->findSetMatchCase(bMatch);
    > + pView->findSetWholeWord(bWhole);
    > +
    > + bool bRes = pView->findNext(bTmp);
    > +
    > + if (bRes)
    > + {
    > + strcpy((char *)pCallData->m_pData, "true");
    > + pCallData->m_dataLength = strlen((char
    > *)pCallData->m_pData);
    > + }
    > + else
    > + {
    > + strcpy((char *)pCallData->m_pData, "false");
    > + pCallData->m_dataLength = strlen((char
    > *)pCallData->m_pData);
    > + }
    > + return true;
    > +}
    > +
    > +Defun(scriptingFindReverse)
    > +{
    > + CHECK_FRAME;
    > + ABIWORD_VIEW;
    > +
    > + bool bTmp=false;
    > + bool bMatch = false;
    > + bool bWhole = false;
    > +
    > + UT_UCSChar * pUCSFind = NULL;
    > +
    >
    UT_UCS4_cloneString_char(&pUCSFind,(char*)pCallData->m_pData);
    > + UT_UCS4Char * mFind;
    > + UT_UCS4_cloneString(&mFind, pUCSFind);
    > +
    > + if (pCallData->m_xPos != 0)
    > + {
    > + bMatch = true;
    > + }
    > +
    > + if (pCallData->m_yPos != 0)
    > + {
    > + bWhole = true;
    > + }
    > +
    > + pView->findSetFindString(mFind);
    > + pView->findSetMatchCase(bMatch);
    > + pView->findSetWholeWord(bWhole);
    > +
    > + bool bRes = pView->findPrev(bTmp);
    > +
    > + if (bRes)
    > + {
    > + strcpy((char *)pCallData->m_pData, "true");
    > + pCallData->m_dataLength = strlen((char
    > *)pCallData->m_pData);
    > + }
    > + else
    > + {
    > + strcpy((char *)pCallData->m_pData, "false");
    > + pCallData->m_dataLength = strlen((char
    > *)pCallData->m_pData);
    > + }
    > + return true;
    > +}
    > +
    > +Defun(scriptingReplace)
    > +{
    > + CHECK_FRAME;
    > + ABIWORD_VIEW;
    > +
    > + bool bTmp=false;
    > + bool bMatch = false;
    > + bool bWhole = false;
    > +
    > + UT_UCSChar * pUCSFind = NULL;
    > +
    >
    UT_UCS4_cloneString_char(&pUCSFind,(char*)pCallData->m_pData);
    > + UT_UCS4Char * mFind = NULL;
    > + UT_UCS4_cloneString(&mFind, pUCSFind);
    > +
    > + UT_UCS4Char * mReplace = NULL;
    > +
    > + UT_UCS4_cloneString_char(&mReplace,
    > pCallData->getScriptName().c_str());
    > +
    > + if (pCallData->m_xPos!=0)
    > + {
    > + bMatch = true;
    > + }
    > +
    > + if (pCallData->m_yPos!=0)
    > + {
    > + bWhole = true;
    > + }
    > +
    > + pView->findSetFindString(mFind);
    > + pView->findSetReplaceString(mReplace);
    > + pView->findSetMatchCase(bMatch);
    > + pView->findSetWholeWord(bWhole);
    > +
    > + bool bRes = pView->findNext(bTmp);
    > +
    > + if (bRes)
    > + {
    > + bRes = pView->findReplace(bTmp);
    > + }
    > +
    > + if (bRes)
    > + {
    > + strcpy((char *)pCallData->m_pData, "true");
    > + pCallData->m_dataLength = strlen((char
    > *)pCallData->m_pData);
    > + }
    > + else
    > + {
    > + strcpy((char *)pCallData->m_pData, "false");
    > + pCallData->m_dataLength = strlen((char
    > *)pCallData->m_pData);
    > + }
    > +
    > + return true;
    > +}
    > +
    > +Defun(scriptingReplaceAll)
    > +{
    > + CHECK_FRAME;
    > + ABIWORD_VIEW;
    > +
    > + UT_uint32 bRes = 0;
    > + bool bMatch = false;
    > + bool bWhole = false;
    > +
    > + UT_UCSChar * pUCSFind = NULL;
    > +
    >
    UT_UCS4_cloneString_char(&pUCSFind,(char*)pCallData->m_pData);
    >
    === message truncated ===> Index:
    abi/src/./../CREDITS.TXT
    >
    ===================================================================
    > RCS file: /cvsroot/abi/CREDITS.TXT,v
    > retrieving revision 1.215
    > diff -u -r1.215 CREDITS.TXT
    > --- abi/src/./../CREDITS.TXT 5 May 2003 22:43:45
    > -0000 1.215
    > +++ abi/src/./../CREDITS.TXT 22 May 2003 09:46:51
    > -0000
    > @@ -71,6 +71,7 @@
    > encoding stuff
    > Ryan Dooley <ryan@coe.missouri.edu> started IRIX
    > port
    > Paul Egli <pegli@sourcegear.com>
    > +Dennis Elbers <deje_auto@hotmail.com> Win32
    > Find/Replace dialog additions
    > Uri Elias <elias@techunix.technion.ac.il> testing
    > of bidi
    > Mike Fabian <mfabian@suse.de> XIM fix for Gnome.
    > Danny Faught <faught@rstcorp.com>
    >
    >

    __________________________________
    Do you Yahoo!?
    The New Yahoo! Search - Faster. Easier. Bingo.
    http://search.yahoo.com



    This archive was generated by hypermail 2.1.4 : Thu May 22 2003 - 09:54:42 EDT