Commit 428d2412 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Remove the need for the hash so we can map back from words to characters

This is needed because sometimes the hash had collissions and make it impossible to know which character we had to put back
Now we just keep the word and the characters together in the same class and it is much easier to correlate them
Also the code gets much more simplified and less new/delete are needed

This fixes the crash in 287138

I am still concerted that we use the page width and height in TextPagePrivate::correctTextOrder, but that should not cause crashes, at most some misplacements of very small text
parent 972b514c
This diff is collapsed.
......@@ -56,56 +56,12 @@ class TextPagePrivate
*/
void setWordList(const TextList &list);
/**
* Copy m_words to a new TextList, it is the caller responsability to free the pointers
*/
TextList duplicateWordList() const;
/**
* Make necessary modifications in the TextList to make the text order correct, so
* that textselection works fine
*/
void correctTextOrder();
/**
* Remove odd spaces which are much bigger than normal spaces from m_words
*/
void removeSpace();
/**
* Create words from characters
*/
QHash<QRect, RegionText> makeWordFromCharacters();
/**
* Create lines from TextList and sort them according to their position
*/
QList< QPair<TextList, QRect> > makeAndSortLines(const TextList &words) const;
/**
* Caluclate statistical info like, word spacing, column spacing, line spacing from the Lines
* we made
*/
void calculateStatisticalInformation(const TextList &words, int *word_spacing,
int *line_spacing, int *column_spacing) const;
/**
* Functions necessary for document file segmentation into text regions for document layout
* analysis.
*/
RegionTextList XYCutForBoundingBoxes();
/**
* Add additional spaces between words, if necessary, which can make the words valuable
* while copying after selection
*/
void addNecessarySpace(RegionTextList tree);
/**
* Break the words into characters, so the text selection wors fine
*/
void breakWordIntoCharacters(const QHash<QRect, RegionText> &words_char_map);
// variables those can be accessed directly from TextPage
TextList m_words;
QMap< int, SearchPoint* > m_searchPoints;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment