Word Processing - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Word Processing

Description:

Text is still text. Basic styling of ... xmlns='http://www.w3.org/TR/REC-html40' head meta http-equiv=Content-Type content='text/html; charset=windows-1252' ... – PowerPoint PPT presentation

Number of Views:90
Avg rating:3.0/5.0
Slides: 32
Provided by: danrol
Category:

less

Transcript and Presenter's Notes

Title: Word Processing


1
Word Processing
2
Word Processing and the WWW
  • Similarities
  • Text is still text
  • Basic styling of headers, bold, italic, tables
  • These are inherent in how people communicate with
    text
  • Similar underlying algorithms and structures

3
Word Processing and the WWW
  • Differences
  • WWW is dynamic
  • Variable window size
  • Possibly non-graphical devices
  • Leave decisions to the browser
  • Simple implementation when building many browsers
  • Word processing is static
  • Fixed page size
  • Exact layout
  • Target is always paper

4
Microsoft Word
5
Microsoft Word
Virtually every word processor has these same
features
6
Word and HTML
7
Word and HTML
8
Word and HTML
lthtml xmlnso"urnschemas-microsoft-comofficeof
fice" xmlnsw"urnschemas-microsoft-comofficewo
rd" xmlns"http//www.w3.org/TR/REC-html40"gt lthead
gt ltmeta http-equivContent-Type
content"text/html charsetwindows-1252"gt ltmeta
nameOriginator content"Microsoft Word
9"gt lttitlegtThis is some new textlt/titlegt lt!--if
gte mso 9gtltxmlgt ltoDocumentPropertiesgt
ltoAuthorgtDan R. Olsen Jr.lt/oAuthorgt lt/oDocument
Propertiesgt lt/xmlgtlt/headgt ltbody langEN-US
style'tab-interval.5in'gt ltdiv
classSection1gt ltp classMsoNormalgtThis is
ltbgtsomelt/bgt new textlt/pgt lt/divgt lt/bodygt lt/htmlgt
9
HTML in Word
  • Word doesnt like JavaScript very much

10
Encodings
  • HTML
  • This ltbgtislt/bgt text
  • Word
  • Use special characters beyond 128 instead of tags

11
Translating Encodings
  • Word encodes many more kinds of style information
    than HTML
  • Paragraph indentation
  • Superscript and subscript
  • Embedded EXCEL tables
  • Saving as HTML
  • Re code similar features (bold, underline)
  • Simulate the Word feature using HTML features
  • Throw away the Word feature

12
Translating Encodings
  • What if we take a Word document and
  • Convert MS Word to WordPerfect
  • then, convert WordPerfect to HTML
  • then, convert HTML back to MS Word.
  • Each step may modify or discard some features.
  • The end result will rarely be the same as the
    original document!!!

13
Algorithms for Word Processing
  • Insert a character
  • Delete a character
  • Select some characters
  • Bold some characters
  • Cut / Copy / Paste

14
Cursor Position
15
Insert a Character
Key p
16
Insert a Character
4
Cursor 3 Key 'p' Text.length 7
8
function insertChar(text, cursor, key) For
(itext.length-1 igtcursor ii-1)
texti1 texti textcursor
key cursor cursor 1 text.length
text.length 1
Move a character up one space
Insert character
Increment cursor
Increment length
17
Algorithms for Word Processing
  • Insert a character
  • Delete a character
  • Select some characters
  • Bold some characters
  • Cut / Copy / Paste

18
Delete a Character
3
Cursor 4 Key ltbkspgt Text.length 8
7
function deleteChar(text, cursor) For
(icursor Ilttext.length ii1)
texti-1texti cursor cursor -
1 text.length text.length - 1
Move a character back one space
Decrement cursor
Decrement length
19
(No Transcript)
20
function moveChars(text, start, end,
destination) for (i0 iltend-start ii1)
textidestinationtextistart return
moveChars
function moveChars(text, start, end,
destination) if (destinationltstart) for
(i0 iltend-start ii1) textidestinationte
xtistart else for (iend-start igt0
ii-1) textidestinationtextistart
return
21
A Helpful Function
  • function moveChars(text, start, end, destination)
  • if (destination lt start)
  • for (istart iltend ii1)
  • textdestinationi-start texti
  • else
  • for (iend-1 igtstart ii-1)
  • textdestinationi-start texti
  • return

22
Insert a Character
function insertChar(text, cursor, key) For
(itext.length-1 igtcursor ii-1)
texti1texti textCursor
key cursor cursor 1 text.length
text.length 1
Changed to
function insertChar(text, cursor,
key) moveChars(text, cursor, text.length,
cursor1) textcursor key cursor cursor
1 text.length text.length 1
23
Delete a Character
function deleteChar(text, cursor) For
(icursor Ilttext.length ii1) texti-1
texti cursor cursor - 1 text.length
text.length - 1
Changed to
function deleteChar(text, cursor) moveChars(text
, cursor, text.length, cursor-1) cursor
cursor - 1 text.length text.length - 1
24
Algorithms for Word Processing
  • Insert a character
  • Delete a character
  • Select some characters
  • Bold some characters
  • Cut / Copy / Paste

25
Selecting Characters
start 2 end 7
26
Algorithms for Word Processing
  • Insert a character
  • Delete a character
  • Select some characters
  • Bold some characters
  • Cut / Copy / Paste

27
Bolding Characters
start 2 end 7
boldChars(text, 2, 7)
function boldChars(text, start,
end) moveChars(text, start, text.length,
start1) textstart ltcode for start
boldgt moveChars(text, end1, text.length1,
end2) textend1 ltcode for end boldgt end
end 2 text.length text.length 2
28
Algorithms for Word Processing
  • Insert a character
  • Delete a character
  • Select some characters
  • Bold some characters
  • Cut / Copy / Paste

29
Cut
start 2 end 7
ClipBoard
function cutChars(text, start, end,
clipBoard) for (istart iltend ii1)
clipBoardi texti clipBoard.length
(end - start) moveChars(text, end,
text.length-1, start) text.length text.length
- clipBoard.length end start
30
Paste
Start 2
ClipBoard strin
function pasteChars(text, start,
clipBoard) moveChars(text, start, text.length,
startclipBoard.length) for (i0
iltclipBoard.length ii1) textstarti
clipBoardi text.length text.length
clipBoard.length
31
Review
  • Other encodings besides ltbgtlt/bgt
  • Translating between encodings can modify or lose
    information
  • Text is just an array
  • Insert a character - move characters right
  • Deleting a character - move characters left
  • Selecting - Start and End are array indices
  • Cut - copy to clip board and move characters left
  • Copy - copy to clip board
  • Paste - move characters right and copy from clip
    board
Write a Comment
User Comments (0)
About PowerShow.com