Ticket #2166 (closed feature: obsolete)
copy-paste-styled-text - Copy and paste external formatted text
Reported by: | deyan | Owned by: | deni |
---|---|---|---|
Priority: | critical | Milestone: | X3 |
Component: | uncategorized | Version: | 2.0 |
Keywords: | Cc: | ||
Category: | unknown | Effort: | 2 |
Importance: | 94 | Ticket_group: | |
Estimated Number of Hours: | 0 | Add Hours to Ticket: | 0 |
Billable?: | yes | Total Hours: | 0 |
Analysis_owners: | deyan | Design_owners: | deni |
Imp._owners: | deni | Test_owners: | |
Analysis_reviewers: | deni | Changelog: | |
Design_reviewers: | pap | Imp._reviewers: | meddle, deyan, pap, dan |
Test_reviewers: | Analysis_score: | 3 | |
Design_score: | 4.5 | Imp._score: | 4.5 |
Test_score: | 0 |
Description (last modified by deyan) (diff)
when i copy an RTF file and paste into a Sophie text frame
Attachments
Change History
comment:1 Changed 15 years ago by deyan
- Owner set to deyan
- Status changed from new to s1a_analysis_started
comment:2 Changed 15 years ago by deyan
- Status changed from s1a_analysis_started to s1b_analysis_finished
comment:3 Changed 15 years ago by deyan
- Importance set to 94
- Effort set to 2
- Description modified (diff)
Batch update from file priorities.csv
comment:4 Changed 15 years ago by deyan
- Summary changed from copy-paste-styled-text to copy-paste-styled-text – Copy and paste external formatted text
Batch update from file report_1.csv
comment:6 Changed 15 years ago by deni
- Design_owners set to deni
- Owner changed from deyan to deni
- Status changed from s1c_analysis_ok to s2a_design_started
- Imp._owners set to deni
comment:7 Changed 15 years ago by deni
- Status changed from s2a_design_started to s2b_design_finished
- Change the DataFlavor of RtfData to "text/rtf"
- Currently when importing RTF data (using RtfTextImportManager two extra linefeeds are imported at the end of the text. This is very inconvenient when the user has copied some text from a text editor and wants to insert it in a text frame that already contains some text.
- The only solution I could think of was to delete them (after parsing the StyledDocument in RtfTextImportManager):
HotPos endPos = text.getEnd(); HotPos beginPos = text.advance(endPos, -2); HotInterval interval = new HotInterval(beginPos, endPos); if (text.subText(interval).toString().equals("\n\n")) { text = text.replace(interval, ImmHotText.empty()); }
- The only solution I could think of was to delete them (after parsing the StyledDocument in RtfTextImportManager):
comment:8 Changed 15 years ago by deyan
- Priority changed from major to critical
- Summary changed from copy-paste-styled-text – Copy and paste external formatted text to copy-paste-styled-text – Copy and paste external formatted text
Batch update from file 0911261.csv
comment:9 Changed 15 years ago by todor
- Summary changed from copy-paste-styled-text – Copy and paste external formatted text to copy-paste-styled-text - Copy and paste external formatted text
comment:10 Changed 15 years ago by pap
- Status changed from s2b_design_finished to s1c_analysis_ok
- Design_score changed from 0 to 1
- Design_reviewers set to pap
- I commited this in trunk in [8223] just because it is harmless to sophie.
- I don't advise you to do several tasks in the same branch unless it is really meaningful. This task could just be patch-solved.
- Now to the design.
- This just does not work correctly - tested on the dev server.
- It would be much better to make DndData have a list/array of supported DataFlavors. It seems something natural to DataFlavors as far I looked at http://java.sun.com/javase/6/docs/api/index.html?java/awt/datatransfer/DataFlavor.html and how it treats text.
- Also it doesn't seem as something so hard to implement. And I want to note that the later we make this change the more things to change there will be - my personal experience.
- I used a tool we have - DataFlavorRecognizer. It didn't show text/rtf on my machine.
- About the linefeeds - they inconvenient indeed but your solution is bad.
- First would be better of even using such removing you do it in the RTF to ImmHotText convertion process before you get the hot text. Modifying hot text is somewhat slow.
- Second when I launched this demo http://java.sun.com/docs/books/tutorialJWS/uiswing/components/ex6//TextSamplerDemo.jnlp and pasted some text from OpenOffice inside it I got no problems and I uses StyledDocument too.
- Even if we accept this dirty "solution" it is quite bad to just put it in the code without any note.
comment:12 Changed 15 years ago by deni
- Status changed from s2a_design_started to s2b_design_finished
- Make DndData keep a list of supported flavors (instead of a single one):
- Change the private final DataFlavor flavor field to private final ImmList<DataFlavor> flavors .
- Keep the constructor by DataFlavor argument for convenience, but add another one by DataFlavor[] .
- Make DndData.getDataFromAwt() iterate through all supported flavors and call Transferable.getTransferData(DataFlavor) for the first possible.
- Make DndData.getDataFromAwtUnchecked(Class<T>) call getDataFromAwt(), wrap the checked exceptions into runtime exceptions and cast the result.
- Change the return type of DndProvider.getSupportedFlavor() from DataFlavor to DataFlavor[].
- Most DndDatas have a static DataFlavor field containing the supported flavor. Make it an array of DataFlavors.
- In RTFData add to the array DataFlavors with MIME type "text/richtext", representation class InputStream and different charsets.
- Make SophieTransferable respect the above changes.
- Not exactly part of this ticket, but fix finding the first position of a styled interval in ImmHotText.getNormalizedStyleValues(). In case the start position is not in the text, replace it with the begin of the text. However, make sure to convert it to the HotPosKind of the original position.
- Keeping a position outside the current text cause the following problem when copying text. If we have the texts "aaaaaaaaaa" and "bbbbb" with all b-s bold and copy the last 3 b-s after the second a, the first 2 a-s will become bold, too.
comment:14 Changed 15 years ago by deni
- Status changed from s2c_design_ok to s3a_implementation_started
comment:15 Changed 15 years ago by deni
- Status changed from s3a_implementation_started to s3b_implementation_finished
comment:16 Changed 15 years ago by meddle
- Status changed from s3b_implementation_finished to s3c_implementation_ok
- Analysis_reviewers set to deni
- Analysis_score changed from 0 to 3
- Imp._reviewers set to meddle, deyan, pap, dan
- Design_score changed from 1 to 4.5
- Imp._score changed from 0 to 4.5
Merged to the trunk at [8525], very nice
4.5p
comment:17 Changed 13 years ago by meddle
- Status changed from s3c_implementation_ok to closed
- Resolution set to obsolete
Closing all the tickets before M Y1
Note: See
TracTickets for help on using
tickets.