Files
harbour-core/harbour/contrib/hbxbp/rtf.prg
Viktor Szakats c300ba14ee 2012-07-23 17:26 UTC+0200 Viktor Szakats (harbour syenar.net)
+ contrib/gtwvg/3state.prg
  + contrib/gtwvg/activex.prg
  + contrib/gtwvg/bitmap.prg
  + contrib/gtwvg/checkbox.prg
  + contrib/gtwvg/class.prg
  + contrib/gtwvg/combobox.prg
  + contrib/gtwvg/crt.prg
  + contrib/gtwvg/dataref.prg
  + contrib/gtwvg/dialog.prg
  + contrib/gtwvg/drawarea.prg
  + contrib/gtwvg/genrc.prg
  + contrib/gtwvg/htmlview.prg
  + contrib/gtwvg/listbox.prg
  + contrib/gtwvg/menubar.prg
  + contrib/gtwvg/mle.prg
  + contrib/gtwvg/paint.prg
  + contrib/gtwvg/parthdlr.prg
  + contrib/gtwvg/pushbut.prg
  + contrib/gtwvg/radiobut.prg
  + contrib/gtwvg/scrollbr.prg
  + contrib/gtwvg/sle.prg
  + contrib/gtwvg/statbar.prg
  + contrib/gtwvg/static.prg
  + contrib/gtwvg/syswnd.prg
  + contrib/gtwvg/tabpage.prg
  + contrib/gtwvg/toolbar.prg
  + contrib/gtwvg/treeview.prg
  + contrib/gtwvg/wnd.prg
  + contrib/hbxbp/3state.prg
  + contrib/hbxbp/appevent.prg
  + contrib/hbxbp/bitmap.prg
  + contrib/hbxbp/browse.prg
  + contrib/hbxbp/checkbox.prg
  + contrib/hbxbp/clipboard.prg
  + contrib/hbxbp/combobox.prg
  + contrib/hbxbp/crt.prg
  + contrib/hbxbp/dataref.prg
  + contrib/hbxbp/dialog.prg
  + contrib/hbxbp/filedialog.prg
  + contrib/hbxbp/fontdialog.prg
  + contrib/hbxbp/generic.prg
  + contrib/hbxbp/gra.prg
  + contrib/hbxbp/htmlviewer.prg
  + contrib/hbxbp/listbox.prg
  + contrib/hbxbp/menubar.prg
  + contrib/hbxbp/mle.prg
  + contrib/hbxbp/parthandler.prg
  + contrib/hbxbp/presspace.prg
  + contrib/hbxbp/printdialog.prg
  + contrib/hbxbp/printer.prg
  + contrib/hbxbp/pushbutton.prg
  + contrib/hbxbp/radiobutton.prg
  + contrib/hbxbp/rtf.prg
  + contrib/hbxbp/scrollbar.prg
  + contrib/hbxbp/sle.prg
  + contrib/hbxbp/spinbutton.prg
  + contrib/hbxbp/static.prg
  + contrib/hbxbp/statusbar.prg
  + contrib/hbxbp/style.prg
  + contrib/hbxbp/tabpage.prg
  + contrib/hbxbp/toolbar.prg
  + contrib/hbxbp/treeview.prg
  + contrib/hbxbp/window.prg
  - contrib/gtwvg/wvg3stat.prg
  - contrib/gtwvg/wvgax.prg
  - contrib/gtwvg/wvgbitmp.prg
  - contrib/gtwvg/wvgcheck.prg
  - contrib/gtwvg/wvgclass.prg
  - contrib/gtwvg/wvgcombo.prg
  - contrib/gtwvg/wvgcrt.prg
  - contrib/gtwvg/wvgdarea.prg
  - contrib/gtwvg/wvgdatar.prg
  - contrib/gtwvg/wvgdlg.prg
  - contrib/gtwvg/wvggenrc.prg
  - contrib/gtwvg/wvghtmlv.prg
  - contrib/gtwvg/wvglistb.prg
  - contrib/gtwvg/wvgmenub.prg
  - contrib/gtwvg/wvgmle.prg
  - contrib/gtwvg/wvgpaint.prg
  - contrib/gtwvg/wvgphdlr.prg
  - contrib/gtwvg/wvgpushb.prg
  - contrib/gtwvg/wvgradio.prg
  - contrib/gtwvg/wvgscrlb.prg
  - contrib/gtwvg/wvgsle.prg
  - contrib/gtwvg/wvgstatb.prg
  - contrib/gtwvg/wvgstatc.prg
  - contrib/gtwvg/wvgsysw.prg
  - contrib/gtwvg/wvgtabpg.prg
  - contrib/gtwvg/wvgtoolb.prg
  - contrib/gtwvg/wvgtreev.prg
  - contrib/gtwvg/wvgwnd.prg
  - contrib/hbxbp/xbp3state.prg
  - contrib/hbxbp/xbpappevent.prg
  - contrib/hbxbp/xbpbitmap.prg
  - contrib/hbxbp/xbpbrowse.prg
  - contrib/hbxbp/xbpcheckbox.prg
  - contrib/hbxbp/xbpclipboard.prg
  - contrib/hbxbp/xbpcombobox.prg
  - contrib/hbxbp/xbpcrt.prg
  - contrib/hbxbp/xbpdataref.prg
  - contrib/hbxbp/xbpdialog.prg
  - contrib/hbxbp/xbpfiledialog.prg
  - contrib/hbxbp/xbpfontdialog.prg
  - contrib/hbxbp/xbpgeneric.prg
  - contrib/hbxbp/xbpgra.prg
  - contrib/hbxbp/xbphtmlviewer.prg
  - contrib/hbxbp/xbplistbox.prg
  - contrib/hbxbp/xbpmenubar.prg
  - contrib/hbxbp/xbpmle.prg
  - contrib/hbxbp/xbpparthandler.prg
  - contrib/hbxbp/xbppresspace.prg
  - contrib/hbxbp/xbpprintdialog.prg
  - contrib/hbxbp/xbpprinter.prg
  - contrib/hbxbp/xbppushbutton.prg
  - contrib/hbxbp/xbpradiobutton.prg
  - contrib/hbxbp/xbprtf.prg
  - contrib/hbxbp/xbpscrollbar.prg
  - contrib/hbxbp/xbpsle.prg
  - contrib/hbxbp/xbpspinbutton.prg
  - contrib/hbxbp/xbpstatic.prg
  - contrib/hbxbp/xbpstatusbar.prg
  - contrib/hbxbp/xbpstyle.prg
  - contrib/hbxbp/xbptabpage.prg
  - contrib/hbxbp/xbptoolbar.prg
  - contrib/hbxbp/xbptreeview.prg
  - contrib/hbxbp/xbpwindow.prg
  * contrib/gtwvg/gtwvg.hbp
  * contrib/hbxbp/hbxbp.hbp
    % deleted unnecessary prefix from .prg filenames, 
      thus making the much more easily searchable and 
      recognizable and also allowing more room for 
      the real description with much less undecipherable 
      abbreviations.
2012-07-23 15:32:39 +00:00

746 lines
23 KiB
Plaintext

/*
* $Id$
*/
/*
* Harbour Project source code:
* Source file for the Xbp*Classes
*
* Copyright 2009-2010 Pritpal Bedi <bedipritpal@hotmail.com>
* http://harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*
* EkOnkar
* ( The LORD is ONE )
*
* Xbase++ Compatible XbpRtf Class
*
* Pritpal Bedi
* 10Jul2009
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "common.ch"
#include "xbp.ch"
#include "gra.ch"
#include "appevent.ch"
/*----------------------------------------------------------------------*/
CLASS XbpRtf INHERIT XbpWindow
METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
METHOD configure()
METHOD destroy()
METHOD connect()
METHOD disconnect()
METHOD handleEvent( nEvent, mp1, mp2 ) VIRTUAL
METHOD execSlot( cSlot, p )
METHOD setStyle() VIRTUAL
DATA appearance INIT XBP_APPEARANCE_3D
DATA bulletIndent INIT 0
DATA changed INIT .F.
DATA hideSelection INIT .T.
DATA locked INIT .F.
DATA maxLength INIT 0
DATA popupMenu INIT NIL // XbpMenu
DATA rightMargin INIT 0
DATA scrollbars INIT XBP_SCROLLBAR_HORIZ + XBP_SCROLLBAR_VERT
DATA usePopupMenu INIT .T.
METHOD text SETGET
METHOD textRTF SETGET
METHOD selAlignment SETGET // XBPRTF_ALIGN_LEFT
METHOD selBold SETGET // .F.
METHOD selBullet SETGET // .F.
METHOD selCharOffset SETGET // 0
METHOD selColor SETGET //
METHOD selFontName SETGET // ""
METHOD selFontSize SETGET // 0
METHOD selHangingIndent SETGET // 0
METHOD selIndent SETGET // 0
METHOD selItalic SETGET // .F.
METHOD selLength SETGET // 0
METHOD selRightIndent SETGET // 0
METHOD selStart SETGET // 0
METHOD selStrikeThru SETGET // .F.
METHOD selTabCount SETGET // 0
METHOD selReadOnly SETGET // .F.
METHOD selText SETGET // ""
METHOD selUnderline SETGET // .F.
METHOD loadFile( cFile )
METHOD saveFile( cFile )
METHOD clear()
METHOD copy()
METHOD cut()
METHOD find( cSearchString, nStart, nEnd, nOptions )
METHOD getLineFromChar( nChar )
METHOD getLineStart( nLine )
METHOD undo()
METHOD paste()
METHOD print( oXbpPrinter, lOnlySelection )
METHOD selTabs( nTab, nPos )
METHOD span( cCharacters, bForward, bExclude )
/*< Harbour Extensions >*/
METHOD redo()
METHOD insertText( cText )
METHOD insertImage( cImageFilename )
METHOD selFont SETGET
/*</Harbour Extensions >*/
DATA sl_xbeRTF_Change
METHOD change( ... ) SETGET
DATA sl_xbeRTF_SelChange
METHOD selChange( ... ) SETGET
PROTECTED:
DATA oTextCharFormat INIT QTextCharFormat()
DATA oTextDocument INIT QTextDocument()
DATA oTextCursor INIT QTextCursor()
DATA oCurCursor // ontained by one of :sel*
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpRtf:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oWidget := QTextEdit( ::pParent )
::connect()
::setPosAndSize()
IF ::visible
::show()
ENDIF
::oParent:AddChild( SELF )
::postCreate()
::oTextDocument := ::oWidget:document()
::oTextCursor := ::oWidget:textCursor()
::oTextCharFormat := ::oTextCursor:charFormat()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:execSlot( cSlot, p )
HB_SYMBOL_UNUSED( p )
DO CASE
CASE cSlot == "copyAvailable(bool)"
CASE cSlot == "currentCharFormatChanged(QTextCharFormat)"
CASE cSlot == "cursorPositionChanged()"
::oTextCursor := ::oWidget:textCursor()
::oCurCursor := ::oTextCursor
CASE cSlot == "redoAvailable(bool)"
CASE cSlot == "undoAvailable(bool)"
CASE cSlot == "textChanged()" /* Xbase++ Implements */
::changed := .t. /* .f. only at save */
::change()
CASE cSlot == "selectionChanged()" /* Xbase++ Implements */
::oTextCursor := ::oWidget:textCursor()
::oCurCursor := ::oTextCursor
::selChange()
ENDCASE
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:configure()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:connect()
* ::oWidget:connect( "copyAvailable(bool)" , {|p| ::execSlot( "copyAvailable(bool)" , p ) } )
::oWidget:connect( "currentCharFormatChanged(QTextCharFormat)", {|p| ::execSlot( "currentCharFormatChanged(QTextCharFormat)", p ) } )
::oWidget:connect( "cursorPositionChanged()" , {|p| ::execSlot( "cursorPositionChanged()", p ) } )
::oWidget:connect( "redoAvailable(bool)" , {|p| ::execSlot( "redoAvailable(bool)" , p ) } )
::oWidget:connect( "undoAvailable(bool)" , {|p| ::execSlot( "undoAvailable(bool)" , p ) } )
::oWidget:connect( "textChanged()" , {|p| ::execSlot( "textChanged()" , p ) } )
::oWidget:connect( "selectionChanged()" , {|p| ::execSlot( "selectionChanged()" , p ) } )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:disconnect()
IF ! empty( ::oWidget )
* ::oWidget:disconnect( "copyAvailable(bool)" )
::oWidget:disconnect( "currentCharFormatChanged(QTextCharFormat)" )
::oWidget:disconnect( "cursorPositionChanged()" )
::oWidget:disconnect( "redoAvailable(bool)" )
::oWidget:disconnect( "undoAvailable(bool)" )
::oWidget:disconnect( "textChanged()" )
::oWidget:disconnect( "selectionChanged()" )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:destroy()
::disconnect()
::xbpWindow:destroy()
::oTextDocument := NIL
::oTextCursor := NIL
::oTextCharFormat := NIL
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:loadFile( cFile )
IF file( cFile )
::oWidget:setText( memoread( cFile ) )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:saveFile( cFile )
IF ( '.txt' $ lower( cFile ) )
memowrit( cFile, ::oWidget:toPlainText() )
ELSE
memowrit( cFile, ::oWidget:toHTML() )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:clear()
::oWidget:clear()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:copy()
::oWidget:copy()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:cut()
::oWidget:cut()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:find( cSearchString, nStart, nEnd, nOptions )
LOCAL nPos := 0
HB_SYMBOL_UNUSED( nStart )
HB_SYMBOL_UNUSED( nEnd )
HB_SYMBOL_UNUSED( nOptions )
IF HB_ISSTRING( cSearchString )
::oTextDocument := ::oWidget:document()
::oTextCursor := ::oTextDocument:find( cSearchString )
::oCurCursor := ::oTextCursor
nPos := ::oTextCursor:position()
ENDIF
RETURN nPos
/*----------------------------------------------------------------------*/
METHOD XbpRtf:getLineFromChar( nChar )
LOCAL nLine := 0
HB_SYMBOL_UNUSED( nChar )
RETURN nLine
/*----------------------------------------------------------------------*/
METHOD XbpRtf:getLineStart( nLine )
LOCAL nChar := 0
HB_SYMBOL_UNUSED( nLine )
RETURN nChar
/*----------------------------------------------------------------------*/
METHOD XbpRtf:undo()
::oWidget:undo()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:paste()
::oWidget:paste()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:print( oXbpPrinter, lOnlySelection )
IF !HB_ISOBJECT( oXbpPrinter )
oXbpPrinter := XbpPrinter():new():create()
ENDIF
IF HB_ISLOGICAL( lOnlySelection ) .and. lOnlySelection
::oWidget:print( oXbpPrinter:oWidget )
ELSE
::oWidget:print( oXbpPrinter:oWidget )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:redo()
::oWidget:redo()
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selTabs( nTab, nPos )
HB_SYMBOL_UNUSED( nTab )
HB_SYMBOL_UNUSED( nPos )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:span( cCharacters, bForward, bExclude )
DEFAULT bForward TO .T.
HB_SYMBOL_UNUSED( cCharacters )
HB_SYMBOL_UNUSED( bForward )
HB_SYMBOL_UNUSED( bExclude )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:change( ... )
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .and. HB_ISBLOCK( aP[ 1 ] )
::sl_xbeRTF_Change := aP[ 1 ]
ELSEIF HB_ISBLOCK( ::sl_xbeRTF_Change )
asize( aP, 2 )
eval( ::sl_xbeRTF_Change, aP[ 1 ], aP[ 2 ], Self )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selChange( ... )
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .and. HB_ISBLOCK( aP[ 1 ] )
::sl_xbeRTF_SelChange := aP[ 1 ]
ELSEIF HB_ISBLOCK( ::sl_xbeRTF_SelChange )
asize( aP, 2 )
eval( ::sl_xbeRTF_SelChange, aP[ 1 ], aP[ 2 ], Self )
ENDIF
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selAlignment( ... ) // XBPRTF_ALIGN_LEFT
LOCAL xRet := XBPRTF_ALIGN_LEFT
LOCAL aP := hb_aParams()
LOCAL oTBFormat
IF len( aP ) >= 1 .and. HB_ISNUMERIC( aP[ 1 ] )
oTBFormat := ::oCurCursor:blockFormat()
xRet := oTBFormat:alignment()
oTBFormat:setAlignment( hbxbp_ConvertAFactFromXBP( "RTFSELALIGNMENT", aP[ 1 ] ) )
::oCurCursor:setBlockFormat( oTBFormat )
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selBold( ... ) // .F.
LOCAL xRet := .f.
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .and. HB_ISLOGICAL( aP[ 1 ] )
::oTextCharFormat := ::oCurCursor:charFormat()
IF ::oTextCharFormat:isValid()
::oTextCharFormat:setFontWeight( QFont_Bold )
::oCurCursor:setCharFormat( ::oTextCharFormat )
ENDIF
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selBullet( ... ) // .F.
LOCAL xRet := 0
LOCAL aP := hb_aParams()
// ::bulletIndent
IF len( aP ) >= 1
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selCharOffset( ... ) // 0
LOCAL xRet := 0, nAlign
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .and. HB_ISNUMERIC( aP[ 1 ] )
::oTextCharFormat := ::oCurCursor:charFormat()
IF ::oTextCharFormat:isValid()
nAlign := iif( aP[ 1 ] < 0, -1, iif( aP[ 1 ] > 0, 1, 0 ) )
xRet := ::oTextCharFormat:verticalAlignment()
::oTextCharFormat:setVerticalAlignment( hbxbp_ConvertAFactFromXBP( "RtfVerticalAlign", nAlign ) )
::oCurCursor:setCharFormat( ::oTextCharFormat )
ENDIF
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selColor( ... )
LOCAL xRet := 0
LOCAL oBrush, nColor, oColor
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .AND. HB_ISNUMERIC( aP[ 1 ] )
::oTextCharFormat := ::oCurCursor:charFormat()
IF ::oTextCharFormat:isValid()
xRet := ::oTextCharFormat:foreground()
nColor := hbxbp_ConvertAFactFromXBP( "COLOR", aP[ 1 ] )
oColor := QColor( nColor )
oBrush := QBrush( oColor )
::oTextCharFormat:setForeground( oBrush )
::oCurCursor:setCharFormat( ::oTextCharFormat )
ENDIF
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
// This is Harour Extension
//
METHOD XbpRtf:selFont( ... ) // ""
LOCAL xRet := NIL
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .and. HB_ISOBJECT( aP[ 1 ] )
::oTextCharFormat := ::oCurCursor:charFormat()
IF ::oTextCharFormat:isValid()
::oTextCharFormat:setFont( aP[ 1 ]:oWidget )
::oCurCursor:setCharFormat( ::oTextCharFormat )
ENDIF
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selFontName( ... ) // ""
LOCAL xRet := 0
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .and. HB_ISSTRING( aP[ 1 ] )
::oTextCharFormat := ::oCurCursor:charFormat()
IF ::oTextCharFormat:isValid()
xRet := ::oTextCharFormat:fontFamily()
::oTextCharFormat:setFontFamily( aP[ 1 ] )
::oCurCursor:setCharFormat( ::oTextCharFormat )
ENDIF
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selFontSize( ... ) // 0
LOCAL xRet := 0
LOCAL aP := hb_aParams()
::oTextCharFormat := ::oCurCursor:charFormat()
IF ::oTextCharFormat:isValid()
xRet := ::oTextCharFormat:fontPointSize()
IF len( aP ) >= 1 .and. HB_ISNUMERIC( aP[ 1 ] )
::oTextCharFormat:setFontPointSize( aP[ 1 ] )
::oCurCursor:setCharFormat( ::oTextCharFormat )
ENDIF
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selHangingIndent( ... ) // 0
LOCAL xRet := 0
LOCAL aP := hb_aParams()
IF len( aP ) >= 1
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selIndent( ... ) // 0
LOCAL xRet := 0
LOCAL aP := hb_aParams()
IF len( aP ) >= 1
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selItalic( ... ) // .F.
LOCAL xRet := .f.
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .and. HB_ISLOGICAL( aP[ 1 ] )
::oTextCharFormat := ::oCurCursor:charFormat()
IF ::oTextCharFormat:isValid()
::oTextCharFormat:setFontItalic( aP[ 1 ] )
::oCurCursor:setCharFormat( ::oTextCharFormat )
ENDIF
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selLength( ... ) // 0
LOCAL xRet := 0
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .and. HB_ISNUMERIC( ap[ 1 ] )
::oCurCursor:movePosition( QTextCursor_NextCharacter, QTextCursor_KeepAnchor, aP[ 1 ] )
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selRightIndent( ... ) // 0
LOCAL xRet := 0
LOCAL aP := hb_aParams()
IF len( aP ) >= 1
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selStart( ... ) // 0
LOCAL xRet := 0
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .and. HB_ISNUMERIC( aP[ 1 ] )
::oTextCursor := ::oWidget:textCursor()
::oCurCursor := ::oTextCursor
xRet := ::oCurCursor:position()
::oCurCursor:setPosition( aP[ 1 ] )
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selStrikeThru( ... ) // .F.
LOCAL xRet := .f.
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .and. HB_ISLOGICAL( aP[ 1 ] )
::oTextCharFormat := ::oCurCursor:charFormat()
IF ::oTextCharFormat:isValid()
::oTextCharFormat:setFontStrikeOut( aP[ 1 ] )
::oCurCursor:setCharFormat( ::oTextCharFormat )
ENDIF
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selTabCount( ... ) // 0
LOCAL xRet := 0
LOCAL aP := hb_aParams()
IF len( aP ) >= 1
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selReadOnly( ... ) // .F.
LOCAL xRet := .f.
LOCAL aP := hb_aParams()
IF len( aP ) >= 1
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selText( ... ) // ""
LOCAL xRet := ""
LOCAL aP := hb_aParams()
IF ::oCurCursor:hasSelection()
xRet := ::oCurCursor:selectedText()
ENDIF
IF len( aP ) >= 1 .and. HB_ISSTRING( aP[ 1 ] )
::oCurCursor:removeSelectedText()
::oCurCursor:insertText( aP[ 1 ] )
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:selUnderline( ... ) // .F.
LOCAL xRet := .f.
LOCAL aP := hb_aParams()
IF len( aP ) >= 1 .and. HB_ISLOGICAL( aP[ 1 ] )
::oTextCharFormat := ::oCurCursor:charFormat()
IF ::oTextCharFormat:isValid()
::oTextCharFormat:setFontUnderline( aP[ 1 ] )
::oCurCursor:setCharFormat( ::oTextCharFormat )
ENDIF
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:text( ... ) // ""
LOCAL xRet := ::oWidget:toPlainText()
LOCAL aP := hb_aParams()
IF len( aP ) == 1 .and. HB_ISSTRING( aP[ 1 ] )
::oWidget:setPlainText( aP[ 1 ] )
ENDIF
IF len( aP ) >= 1
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:textRTF( ... ) // ""
LOCAL xRet := ::oWidget:toHtml()
LOCAL aP := hb_aParams()
IF len( aP ) == 1 .and. HB_ISSTRING( aP[ 1 ] )
::oWidget:setHTML( aP[ 1 ] )
ENDIF
IF len( aP ) >= 1
ENDIF
RETURN xRet
/*----------------------------------------------------------------------*/
METHOD XbpRtf:insertText( cText )
::oWidget:insertPlainText( cText )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD XbpRtf:insertImage( cImageFilename )
::oCurCursor:insertImage( cImageFilename )
RETURN Self
/*----------------------------------------------------------------------*/