Commit graph

42 commits

Author SHA1 Message Date
Alexander Lohnau
2f193a63de Convert license headers to SPDX 2021-06-10 08:11:56 +00:00
Albert Astals Cid
19d98d6a74 Run clang-format
find . \( -name "*.cpp" -or -name "*.h"  -or -name "*.c"  -or -name "*.cc" \) -exec clang-format -i {} \;

If you reached this file doing a git blame, please see README.clang-format (added 2 commits in the future of this one)
2020-07-11 09:17:33 +02:00
David Hurka
c61a9587ec Improve documentation of TextEntity stuff
Summary:
This adds some important documentation on TextEntity and other classes, and improves some of the existing documentation.

This includes changing parameter names from ‘rect’ to ‘area’, because I found ‘rect’ misleading.

Test Plan: Run doxygen

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: aacid, yurchor, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21271
2019-07-21 10:49:51 +02:00
Yuri Chornoivan
c04ca1fa96 Fix minor EBN issues 2018-08-31 12:23:45 +03:00
Albert Astals Cid
4e6c9f8f7a Fix crash when accessing text page after save
text page was storing a pointer to a PagePrivate pointer but those die
after saving so we need to store a Page pointer since those are stable.

BUGS: 387247
2017-12-05 23:07:10 +01:00
Jaan Vajakas
dff8bf1b36 Improve searching code
Also simplified code a bit by removing unnecessary calls to toLower in TextPagePrivate::findTextInternalForward and TextPagePrivate::findTextInternalBackward I also fixed a small bug: the letter capital I with dot above (U+0130) did not match itself in case-insensitive mode on Qt 4.8.4 (U+0130 still does not match lowercase i (U+0069), which can be considered another bug, that I didn't fix (although this behavior conforms to the Unicode case folding rules)).

(I did not implement the Knuth-Morris-Pratt algorithm that I promised in a comment of Bug 323263 because on second thought I find that the win, if any, would probably be negligible except for some very special documents and special query strings.)

BUGS: 323262
BUGS: 323263
REVIEW: 112135
2013-10-18 16:30:07 +02:00
Jan Binder
aa6ed8afc0 Replace deprecated QMatrix by QTransform
REVIEW: 105737
2012-09-08 17:06:02 +02:00
Albert Astals Cid
428d2412bd 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
2011-12-03 13:50:37 +01:00
Albert Astals Cid
972b514c21 Rework makeAndSortLines to return a list of qpairs instead of two lists 2011-12-01 00:09:00 +00:00
Albert Astals Cid
2776b11276 Move the invocation of makeAndSortLines inside calculateStatisticalInformation 2011-12-01 00:09:00 +00:00
Albert Astals Cid
b055d659b0 Simplify the code
TextPagePrivate::correctTextOrder was running makeAndSortLines + calculateStatisticalInformation to calculate the tcx, tcy
to pass it to XYCutForBoundingBoxes and then in XYCutForBoundingBoxes we were doing the same but just for when countLoop was not 0, thus
if we remove the first code and remove the check for countLoop being not 0 we end up with the same behaviour
2011-12-01 00:09:00 +00:00
Albert Astals Cid
d704dd1ecd const + spacing fixes 2011-12-01 00:09:00 +00:00
Albert Astals Cid
8d7c2b2ce1 Make the function const to signal it does not change anything in the object 2011-12-01 00:09:00 +00:00
Albert Astals Cid
99b3906560 Move the calculation of the key to a single place
Removes the problem of changing it in one placea and not in the other
2011-11-03 19:11:23 +01:00
Albert Astals Cid
d41f230123 Move correctTextOrder to TextPagePrivate 2011-10-17 19:09:26 +02:00
Albert Astals Cid
dec4733603 Rework the internals a bit
* Remove m_word_chars_map, m_XY_cut_tree, m_lines and m_line_rects: They are not really member
variables and where used only to pass info from one method to another, we use variables and parameters
for that now
 * Make output parameters be * instead of & following Qt guidelines
 * Fix all memory leaks, valgrind is happy now :-)
2011-08-23 17:15:12 +02:00
Albert Astals Cid
2ff2cd9434 Rename copyFromList to setWordList
Also change the behaviour in that it adopts the pointers, saves a few news and deletes
2011-08-23 16:10:43 +02:00
Albert Astals Cid
8286aac4db We never use m_spaces, so kill it 2011-08-23 15:39:06 +02:00
Albert Astals Cid
0e1efa6516 rework the API a bit so we can assign it to const variables 2011-08-22 20:36:49 +02:00
Albert Astals Cid
be8f9bd9cb Rename copy* functions to something I like more 2011-08-22 19:12:21 +02:00
Albert Astals Cid
a9fd44009e Add some const & 2011-08-22 19:06:29 +02:00
Mohammad Mahfuzur Rahman Mamun
dca4ee559c Another Code Refactoring done 2011-08-21 10:44:42 +06:00
Mohammad Mahfuzur Rahman Mamun
5a8b984f14 debugging and printing removed from textpage.cpp ... need code recomment now 2011-08-17 15:32:40 +06:00
Mohammad Mahfuzur Rahman Mamun
3214307ed9 unnecessary changes removed from area.h and cpp textpage.h textpage_p.h 2011-08-17 10:45:46 +06:00
Mohammad Mahfuzur Rahman Mamun
929e4b6a0e Removed some double selection Problem 2011-08-12 08:25:21 +06:00
Mohammad Mahfuzur Rahman Mamun
c598b7749d removal of some crashes 2011-07-20 13:04:59 +06:00
Mohammad Mahfuzur Rahman Mamun
b69d9e0262 implementation of parameter tuning of XYcut using local information 2011-07-15 17:29:59 +06:00
Mohammad Mahfuzur Rahman Mamun
2809c3c747 makeAndSortLines changed to remove some similar code redundancy 2011-07-14 19:23:39 +06:00
Mohammad Mahfuzur Rahman Mamun
9343babe43 some issues regarding selection (TextPage::textArea) solved 2011-07-14 17:35:02 +06:00
Mohammad Mahfuzur Rahman Mamun
8a3d4b2db5 some rearrangement and redesign of the code 2011-07-13 19:27:04 +06:00
Mohammad Mahfuzur Rahman Mamun
33d0facf4e selection of text by character done ... need some testing and debug 2011-07-13 17:16:03 +06:00
Mohammad Mahfuzur Rahman Mamun
1bbb192fce added spaces between words ... looking very bad though ... will be solved later 2011-07-12 20:24:17 +06:00
Mohammad Mahfuzur Rahman Mamun
8eda44b435 crash in makeword removed 2011-07-10 20:54:38 +06:00
Mohammad Mahfuzur Rahman Mamun
e2b0e0816c calculation of horizontal and vertical projection profile done 2011-07-09 00:12:39 +06:00
Mohammad Mahfuzur Rahman Mamun
bbd28aa8bf calculation of column space rectangle and a try to separate columns from a two column document on that basis 2011-07-01 16:41:55 +06:00
Mohammad Mahfuzur Rahman Mamun
27d0f2f8c6 create and sort lines by y overlap first and then according to x ordering 2011-06-29 18:17:15 +06:00
Pino Toscano
192c0a0880 refactor a bit the string matching in text search, using a intermediate comparer function
this way, we can choose the comparing strategy before starting the search
also, make the comparer function use stringref, so we avoid copying data from the original strings (meaning less memory used, and slightly faster)
provide two comparing strategies, case sensitive and case insensitive, to continue doing the same job done so far

svn path=/trunk/KDE/kdegraphics/okular/; revision=1066591
2009-12-27 14:22:13 +00:00
Pino Toscano
e8e93ee179 Internally replace a TextEntity with a "lighter version", that stores the raw UTF-16 data of the text.
This way, we can save about 4 int's for each text entity; this is not much for small documents,
but with big documents with lots of text (eg, the PDF specs) we can save a lot (more than 50MB!).

CCBUG: 161213

svn path=/trunk/KDE/kdegraphics/okular/; revision=803048
2008-05-01 19:03:02 +00:00
Pino Toscano
93c57bac43 add a simpler ctor for the private class of textpage
svn path=/trunk/KDE/kdegraphics/okular/; revision=798434
2008-04-18 09:57:55 +00:00
Pino Toscano
8a858a9449 Core implementation of the backward text search, to be used now in the search bar.
Works pretty well -- the only problem left is that when changing the search direction, the first match is the current match.

svn path=/trunk/KDE/kdegraphics/okular/; revision=785629
2008-03-14 14:14:06 +00:00
Pino Toscano
99a99a1590 instead of just keeping the transformation matrix, add the pointer to the owning page in a text page, so a text page can know more information, and with no need to manually be updated by the page
svn path=/trunk/KDE/kdegraphics/okular/; revision=708443
2007-09-04 22:37:39 +00:00
Pino Toscano
1bd879c240 extract the definition of the private class of TextPage to an own file, and rename it to TextPagePrivate
svn path=/trunk/KDE/kdegraphics/okular/; revision=708084
2007-09-03 19:52:46 +00:00