2005-07-15 18:20:57 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2005 by Piotr Szymanski <niedakh@gmail.com> *
|
|
|
|
* *
|
|
|
|
* 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 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
2006-09-21 08:45:36 +00:00
|
|
|
|
2007-04-19 18:30:20 +00:00
|
|
|
#include "textpage.h"
|
2007-09-03 19:52:46 +00:00
|
|
|
#include "textpage_p.h"
|
2006-11-27 18:31:20 +00:00
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
#include <kdebug.h>
|
|
|
|
|
2005-07-15 18:20:57 +00:00
|
|
|
#include "area.h"
|
2007-07-31 10:19:48 +00:00
|
|
|
#include "debug_p.h"
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
#include "misc.h"
|
2007-09-05 14:57:15 +00:00
|
|
|
#include "page.h"
|
2007-09-04 22:37:39 +00:00
|
|
|
#include "page_p.h"
|
2006-09-21 08:45:36 +00:00
|
|
|
|
|
|
|
using namespace Okular;
|
2005-07-15 18:20:57 +00:00
|
|
|
|
2006-11-23 17:56:03 +00:00
|
|
|
class SearchPoint
|
2006-05-27 10:06:31 +00:00
|
|
|
{
|
2006-11-23 17:56:03 +00:00
|
|
|
public:
|
|
|
|
SearchPoint()
|
|
|
|
: theIt( 0 ), offset_begin( -1 ), offset_end( -1 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
TextEntity::List::ConstIterator theIt;
|
|
|
|
int offset_begin;
|
|
|
|
int offset_end;
|
|
|
|
};
|
|
|
|
|
|
|
|
TextEntity::TextEntity( const QString &text, NormalizedRect *area )
|
2007-08-13 22:25:27 +00:00
|
|
|
: m_text( text ), m_area( area ), d( 0 )
|
2006-11-23 17:56:03 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
TextEntity::~TextEntity()
|
|
|
|
{
|
|
|
|
delete m_area;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString TextEntity::text() const
|
|
|
|
{
|
|
|
|
return m_text;
|
|
|
|
}
|
|
|
|
|
|
|
|
NormalizedRect* TextEntity::area() const
|
|
|
|
{
|
|
|
|
return m_area;
|
|
|
|
}
|
|
|
|
|
2007-08-13 22:25:27 +00:00
|
|
|
NormalizedRect TextEntity::transformedArea(const QMatrix &matrix) const
|
2006-11-23 22:14:04 +00:00
|
|
|
{
|
2007-08-13 22:25:27 +00:00
|
|
|
NormalizedRect transformed_area = *m_area;
|
|
|
|
transformed_area.transform( matrix );
|
|
|
|
return transformed_area;
|
2006-11-23 22:14:04 +00:00
|
|
|
}
|
|
|
|
|
2006-11-23 17:56:03 +00:00
|
|
|
|
2007-09-03 19:52:46 +00:00
|
|
|
TextPagePrivate::TextPagePrivate( const TextEntity::List &words )
|
2007-09-04 22:37:39 +00:00
|
|
|
: m_words( words ), m_page( 0 )
|
2007-09-03 19:52:46 +00:00
|
|
|
{
|
|
|
|
}
|
2006-11-23 17:56:03 +00:00
|
|
|
|
2007-09-03 19:52:46 +00:00
|
|
|
TextPagePrivate::~TextPagePrivate()
|
|
|
|
{
|
|
|
|
qDeleteAll( m_searchPoints );
|
|
|
|
qDeleteAll( m_words );
|
|
|
|
}
|
2006-05-27 10:06:31 +00:00
|
|
|
|
|
|
|
|
2006-11-23 17:56:03 +00:00
|
|
|
TextPage::TextPage()
|
2007-09-03 19:52:46 +00:00
|
|
|
: d( new TextPagePrivate( TextEntity::List() ) )
|
2006-11-23 17:56:03 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
TextPage::TextPage( const TextEntity::List &words )
|
2007-09-03 19:52:46 +00:00
|
|
|
: d( new TextPagePrivate( words ) )
|
2006-11-23 17:56:03 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
TextPage::~TextPage()
|
2005-07-15 18:20:57 +00:00
|
|
|
{
|
2006-11-23 17:56:03 +00:00
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TextPage::append( const QString &text, NormalizedRect *area )
|
|
|
|
{
|
|
|
|
d->m_words.append( new TextEntity( text, area ) );
|
2005-07-15 18:20:57 +00:00
|
|
|
}
|
|
|
|
|
2006-11-23 17:11:04 +00:00
|
|
|
RegularAreaRect * TextPage::textArea ( TextSelection * sel) const
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
{
|
2006-11-25 21:39:52 +00:00
|
|
|
if ( d->m_words.isEmpty() )
|
|
|
|
return new RegularAreaRect();
|
|
|
|
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
/**
|
2007-01-05 14:40:38 +00:00
|
|
|
It works like this:
|
|
|
|
There are two cursors, we need to select all the text between them. The coordinates are normalised, leftTop is (0,0)
|
|
|
|
rightBottom is (1,1), so for cursors start (sx,sy) and end (ex,ey) we start with finding text rectangles under those
|
|
|
|
points, if not we search for the first that is to the right to it in the same baseline, if none found, then we search
|
|
|
|
for the first rectangle with a baseline under the cursor, having two points that are the best rectangles to both
|
|
|
|
of the cursors: (rx,ry)x(tx,ty) for start and (ux,uy)x(vx,vy) for end, we do a
|
|
|
|
1. (rx,ry)x(1,ty)
|
|
|
|
2. (0,ty)x(1,uy)
|
|
|
|
3. (0,uy)x(vx,vy)
|
|
|
|
|
|
|
|
To find the closest rectangle to cursor (cx,cy) we search for a rectangle that either contains the cursor
|
|
|
|
or that has a left border >= cx and bottom border >= cy.
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
*/
|
2007-01-05 14:40:38 +00:00
|
|
|
RegularAreaRect * ret= new RegularAreaRect;
|
2007-09-04 22:37:39 +00:00
|
|
|
|
|
|
|
QMatrix matrix = d->m_page ? d->m_page->rotationMatrix() : QMatrix();
|
2007-09-03 19:35:55 +00:00
|
|
|
#if 0
|
2007-01-05 14:40:38 +00:00
|
|
|
int it = -1;
|
|
|
|
int itB = -1;
|
|
|
|
int itE = -1;
|
|
|
|
|
|
|
|
// ending cursor is higher then start cursor, we need to find positions in reverse
|
2007-08-13 22:25:27 +00:00
|
|
|
NormalizedRect tmp;
|
|
|
|
NormalizedRect start;
|
|
|
|
NormalizedRect end;
|
2007-01-05 14:40:38 +00:00
|
|
|
|
|
|
|
NormalizedPoint startC = sel->start();
|
|
|
|
double startCx = startC.x;
|
|
|
|
double startCy = startC.y;
|
|
|
|
|
|
|
|
NormalizedPoint endC = sel->end();
|
|
|
|
double endCx = endC.x;
|
|
|
|
double endCy = endC.y;
|
|
|
|
|
|
|
|
if ( sel->direction() == 1 || ( sel->itB() == -1 && sel->direction() == 0 ) )
|
|
|
|
{
|
2006-09-26 22:22:01 +00:00
|
|
|
#ifdef DEBUG_TEXTPAGE
|
2007-07-31 10:19:48 +00:00
|
|
|
kWarning() << "running first loop";
|
2006-09-26 22:22:01 +00:00
|
|
|
#endif
|
2007-01-05 14:40:38 +00:00
|
|
|
const int count = d->m_words.count();
|
|
|
|
for ( it = 0; it < count; it++ )
|
|
|
|
{
|
2007-09-03 19:35:55 +00:00
|
|
|
tmp = *d->m_words[ it ]->area();
|
2007-08-13 22:25:27 +00:00
|
|
|
if ( tmp.contains( startCx, startCy )
|
|
|
|
|| ( tmp.top <= startCy && tmp.bottom >= startCy && tmp.left >= startCx )
|
|
|
|
|| ( tmp.top >= startCy))
|
2007-01-05 14:40:38 +00:00
|
|
|
{
|
|
|
|
/// we have found the (rx,ry)x(tx,ty)
|
|
|
|
itB = it;
|
2006-09-26 22:22:01 +00:00
|
|
|
#ifdef DEBUG_TEXTPAGE
|
2007-07-31 10:19:48 +00:00
|
|
|
kWarning() << "start is" << itB << "count is" << d->m_words.count();
|
2006-09-26 22:22:01 +00:00
|
|
|
#endif
|
2007-01-05 14:40:38 +00:00
|
|
|
break;
|
|
|
|
}
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
}
|
2007-01-05 14:40:38 +00:00
|
|
|
sel->itB( itB );
|
|
|
|
}
|
|
|
|
itB = sel->itB();
|
2006-09-26 22:22:01 +00:00
|
|
|
#ifdef DEBUG_TEXTPAGE
|
2007-07-31 10:19:48 +00:00
|
|
|
kWarning() << "direction is" << sel->direction();
|
|
|
|
kWarning() << "reloaded start is" << itB << "against" << sel->itB();
|
2006-09-26 22:22:01 +00:00
|
|
|
#endif
|
2007-01-05 14:40:38 +00:00
|
|
|
if ( sel->direction() == 0 || ( sel->itE() == -1 && sel->direction() == 1 ) )
|
|
|
|
{
|
2006-09-26 22:22:01 +00:00
|
|
|
#ifdef DEBUG_TEXTPAGE
|
2007-07-31 10:19:48 +00:00
|
|
|
kWarning() << "running second loop";
|
2006-09-26 22:22:01 +00:00
|
|
|
#endif
|
2007-01-05 14:40:38 +00:00
|
|
|
for ( it = d->m_words.count() - 1; it >= itB; it-- )
|
|
|
|
{
|
2007-09-03 19:35:55 +00:00
|
|
|
tmp = *d->m_words[ it ]->area();
|
2007-08-13 22:25:27 +00:00
|
|
|
if ( tmp.contains( endCx, endCy )
|
|
|
|
|| ( tmp.top <= endCy && tmp.bottom >= endCy && tmp.right <= endCx )
|
|
|
|
|| ( tmp.bottom <= endCy ) )
|
2007-01-05 14:40:38 +00:00
|
|
|
{
|
|
|
|
/// we have found the (ux,uy)x(vx,vy)
|
|
|
|
itE = it;
|
2006-09-26 22:22:01 +00:00
|
|
|
#ifdef DEBUG_TEXTPAGE
|
2007-07-31 10:19:48 +00:00
|
|
|
kWarning() << "ending is" << itE << "count is" << d->m_words.count();
|
2007-08-13 22:25:27 +00:00
|
|
|
kWarning() << "conditions" << tmp.contains( endCx, endCy ) << " "
|
|
|
|
<< ( tmp.top <= endCy && tmp.bottom >= endCy && tmp.right <= endCx ) << " " <<
|
|
|
|
( tmp.top >= endCy);
|
2006-09-26 22:22:01 +00:00
|
|
|
#endif
|
2007-01-05 14:40:38 +00:00
|
|
|
break;
|
|
|
|
}
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
}
|
2007-01-05 14:40:38 +00:00
|
|
|
sel->itE( itE );
|
|
|
|
}
|
2006-09-26 22:22:01 +00:00
|
|
|
#ifdef DEBUG_TEXTPAGE
|
2007-07-31 10:19:48 +00:00
|
|
|
kWarning() << "reloaded ending is" << itE << "against" << sel->itE();
|
2006-09-26 22:22:01 +00:00
|
|
|
#endif
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
|
2007-01-05 14:40:38 +00:00
|
|
|
if ( sel->itB() != -1 && sel->itE() != -1 )
|
|
|
|
{
|
2007-09-03 19:35:55 +00:00
|
|
|
start = *d->m_words[ sel->itB() ]->area();
|
|
|
|
end = *d->m_words[ sel->itE() ]->area();
|
2007-01-05 14:40:38 +00:00
|
|
|
|
|
|
|
NormalizedRect first, second, third;
|
|
|
|
/// finding out if there are more then one baseline between them is a hard and discussable task
|
|
|
|
/// we will create a rectangle (rx,0)x(tx,1) and will check how many times does it intersect the
|
|
|
|
/// areas, if more than one -> we have a three or over line selection
|
2007-08-13 22:25:27 +00:00
|
|
|
first = start;
|
|
|
|
second.top = start.bottom;
|
2007-01-05 14:40:38 +00:00
|
|
|
first.right = second.right = 1;
|
2007-08-13 22:25:27 +00:00
|
|
|
third = end;
|
2007-01-05 14:40:38 +00:00
|
|
|
third.left = second.left = 0;
|
2007-08-13 22:25:27 +00:00
|
|
|
second.bottom = end.top;
|
2007-01-05 14:40:38 +00:00
|
|
|
int selMax = qMax( sel->itB(), sel->itE() );
|
|
|
|
for ( it = qMin( sel->itB(), sel->itE() ); it <= selMax; ++it )
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
{
|
2007-09-03 19:35:55 +00:00
|
|
|
tmp = *d->m_words[ it ]->area();
|
2007-08-13 22:25:27 +00:00
|
|
|
if ( tmp.intersects( &first ) || tmp.intersects( &second ) || tmp.intersects( &third ) )
|
2007-09-04 22:37:39 +00:00
|
|
|
ret->appendShape( d->m_words.at( it )->transformedArea( matrix ) );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
}
|
2007-01-05 14:40:38 +00:00
|
|
|
}
|
2007-09-03 19:35:55 +00:00
|
|
|
#else
|
|
|
|
NormalizedRect tmp;
|
|
|
|
|
|
|
|
NormalizedPoint startC = sel->start();
|
|
|
|
double startCx = startC.x;
|
|
|
|
double startCy = startC.y;
|
|
|
|
|
|
|
|
NormalizedPoint endC = sel->end();
|
|
|
|
double endCx = endC.x;
|
|
|
|
double endCy = endC.y;
|
|
|
|
|
|
|
|
TextEntity::List::ConstIterator it = d->m_words.begin(), itEnd = d->m_words.end();
|
2007-09-05 14:57:15 +00:00
|
|
|
MergeSide side = d->m_page ? (MergeSide)d->m_page->m_page->totalOrientation() : MergeRight;
|
2007-09-03 19:35:55 +00:00
|
|
|
for ( ; it != itEnd; ++it )
|
|
|
|
{
|
|
|
|
tmp = *(*it)->area();
|
|
|
|
if ( ( tmp.top > startCy || ( tmp.bottom > startCy && tmp.right > startCx ) )
|
|
|
|
&& ( tmp.bottom < endCy || ( tmp.top < endCy && tmp.left < endCx ) ) )
|
|
|
|
{
|
2007-09-05 14:57:15 +00:00
|
|
|
ret->appendShape( (*it)->transformedArea( matrix ), side );
|
2007-09-03 19:35:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
|
2007-01-05 14:40:38 +00:00
|
|
|
return ret;
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
}
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
|
|
|
|
|
2007-01-05 15:00:12 +00:00
|
|
|
RegularAreaRect* TextPage::findText( int searchID, const QString &query, SearchDirection direct,
|
2006-11-23 16:54:28 +00:00
|
|
|
Qt::CaseSensitivity caseSensitivity, const RegularAreaRect *area )
|
2005-07-15 18:20:57 +00:00
|
|
|
{
|
2006-11-23 16:54:28 +00:00
|
|
|
SearchDirection dir=direct;
|
2005-07-15 18:20:57 +00:00
|
|
|
// invalid search request
|
2006-05-27 10:06:31 +00:00
|
|
|
if ( query.isEmpty() || area->isNull() )
|
2005-07-15 18:20:57 +00:00
|
|
|
return 0;
|
2006-11-23 17:56:03 +00:00
|
|
|
TextEntity::List::ConstIterator start;
|
|
|
|
TextEntity::List::ConstIterator end;
|
|
|
|
if ( !d->m_searchPoints.contains( searchID ) )
|
2005-07-15 18:20:57 +00:00
|
|
|
{
|
2006-05-27 10:06:31 +00:00
|
|
|
// if no previous run of this search is found, then set it to start
|
|
|
|
// from the beginning (respecting the search direction)
|
2006-11-23 16:54:28 +00:00
|
|
|
if ( dir == NextResult )
|
2006-05-27 10:06:31 +00:00
|
|
|
dir = FromTop;
|
2006-11-23 16:54:28 +00:00
|
|
|
else if ( dir == PreviousResult )
|
2006-05-27 10:06:31 +00:00
|
|
|
dir = FromBottom;
|
2005-07-15 18:20:57 +00:00
|
|
|
}
|
2006-05-27 10:06:31 +00:00
|
|
|
bool forward = true;
|
|
|
|
switch ( dir )
|
2005-07-15 18:20:57 +00:00
|
|
|
{
|
2006-05-27 10:06:31 +00:00
|
|
|
case FromTop:
|
2006-11-23 17:56:03 +00:00
|
|
|
start = d->m_words.begin();
|
|
|
|
end = d->m_words.end();
|
2006-05-27 10:06:31 +00:00
|
|
|
break;
|
|
|
|
case FromBottom:
|
2006-11-23 17:56:03 +00:00
|
|
|
start = d->m_words.end();
|
|
|
|
end = d->m_words.begin();
|
|
|
|
if ( !d->m_words.isEmpty() )
|
2005-07-15 18:20:57 +00:00
|
|
|
{
|
2006-05-27 10:06:31 +00:00
|
|
|
--start;
|
2005-07-15 18:20:57 +00:00
|
|
|
}
|
2006-05-27 10:06:31 +00:00
|
|
|
forward = false;
|
2005-07-15 18:20:57 +00:00
|
|
|
break;
|
2006-11-23 16:54:28 +00:00
|
|
|
case NextResult:
|
2006-11-23 17:56:03 +00:00
|
|
|
start = d->m_searchPoints[ searchID ]->theIt;
|
|
|
|
end = d->m_words.end();
|
2006-05-27 10:06:31 +00:00
|
|
|
break;
|
2006-11-23 16:54:28 +00:00
|
|
|
case PreviousResult:
|
2006-11-23 17:56:03 +00:00
|
|
|
start = d->m_searchPoints[ searchID ]->theIt;
|
|
|
|
end = d->m_words.begin();
|
2006-05-27 10:06:31 +00:00
|
|
|
forward = false;
|
2005-07-15 18:20:57 +00:00
|
|
|
break;
|
2006-05-27 10:06:31 +00:00
|
|
|
};
|
|
|
|
RegularAreaRect* ret = 0;
|
|
|
|
if ( forward )
|
|
|
|
{
|
2006-11-23 17:56:03 +00:00
|
|
|
ret = d->findTextInternalForward( searchID, query, caseSensitivity, start, end );
|
2005-07-15 18:20:57 +00:00
|
|
|
}
|
2006-05-27 10:06:31 +00:00
|
|
|
// TODO implement backward search
|
|
|
|
#if 0
|
|
|
|
else
|
|
|
|
{
|
2006-11-23 16:54:28 +00:00
|
|
|
ret = findTextInternalBackward( searchID, query, caseSensitivity, start, end );
|
2006-05-27 10:06:31 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return ret;
|
2005-07-15 18:20:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-03 19:52:46 +00:00
|
|
|
RegularAreaRect* TextPagePrivate::findTextInternalForward( int searchID, const QString &_query,
|
2006-11-23 17:56:03 +00:00
|
|
|
Qt::CaseSensitivity caseSensitivity,
|
|
|
|
const TextEntity::List::ConstIterator &start,
|
|
|
|
const TextEntity::List::ConstIterator &end )
|
2005-07-15 18:20:57 +00:00
|
|
|
{
|
2007-09-04 22:37:39 +00:00
|
|
|
QMatrix matrix = m_page ? m_page->rotationMatrix() : QMatrix();
|
2005-07-15 18:20:57 +00:00
|
|
|
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
RegularAreaRect* ret=new RegularAreaRect;
|
2006-11-23 16:54:28 +00:00
|
|
|
QString query = (caseSensitivity == Qt::CaseSensitive) ? _query : _query.toLower();
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
|
2005-07-15 18:20:57 +00:00
|
|
|
// j is the current position in our query
|
2006-09-21 08:45:36 +00:00
|
|
|
// len is the length of the string in TextEntity
|
2005-07-15 18:20:57 +00:00
|
|
|
// queryLeft is the length of the query we have left
|
2007-08-13 22:25:27 +00:00
|
|
|
const TextEntity* curEntity = 0;
|
2005-07-15 18:20:57 +00:00
|
|
|
int j=0, len=0, queryLeft=query.length();
|
2006-05-27 10:06:31 +00:00
|
|
|
int offset = 0;
|
2005-11-18 20:48:01 +00:00
|
|
|
bool haveMatch=false;
|
2005-07-15 18:20:57 +00:00
|
|
|
bool dontIncrement=false;
|
2006-05-27 10:06:31 +00:00
|
|
|
bool offsetMoved = false;
|
2006-11-23 17:56:03 +00:00
|
|
|
TextEntity::List::ConstIterator it = start;
|
2006-05-27 10:06:31 +00:00
|
|
|
for ( ; it != end; ++it )
|
2006-05-13 15:04:22 +00:00
|
|
|
{
|
2006-05-27 10:06:31 +00:00
|
|
|
curEntity = *it;
|
2007-08-13 22:25:27 +00:00
|
|
|
const QString &str = curEntity->text();
|
2006-05-27 10:06:31 +00:00
|
|
|
if ( !offsetMoved && ( it == start ) )
|
|
|
|
{
|
|
|
|
if ( m_searchPoints.contains( searchID ) )
|
|
|
|
{
|
|
|
|
offset = qMax( m_searchPoints[ searchID ]->offset_end, 0 );
|
|
|
|
}
|
|
|
|
offsetMoved = true;
|
|
|
|
}
|
|
|
|
if ( query.at(j).isSpace() )
|
2005-07-15 18:20:57 +00:00
|
|
|
{
|
|
|
|
// lets match newline as a space
|
2005-11-18 20:48:01 +00:00
|
|
|
#ifdef DEBUG_TEXTPAGE
|
2007-07-31 10:19:48 +00:00
|
|
|
kDebug(OkularDebug) << "newline or space";
|
2005-11-18 20:48:01 +00:00
|
|
|
#endif
|
2005-07-15 18:20:57 +00:00
|
|
|
j++;
|
|
|
|
queryLeft--;
|
2006-07-18 19:06:01 +00:00
|
|
|
// since we do not really need to increment this after this
|
2005-07-15 18:20:57 +00:00
|
|
|
// run of the loop finishes because we are not comparing it
|
|
|
|
// to any entity, rather we are deducing a situation in a document
|
|
|
|
dontIncrement=true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dontIncrement=false;
|
|
|
|
len=str.length();
|
2006-05-13 15:04:22 +00:00
|
|
|
int min=qMin(queryLeft,len);
|
2006-05-27 22:13:27 +00:00
|
|
|
#ifdef DEBUG_TEXTPAGE
|
2007-07-31 10:19:48 +00:00
|
|
|
kDebug(OkularDebug) << str.mid(offset,min) << ":" << _query.mid(j,min);
|
2006-05-27 22:13:27 +00:00
|
|
|
#endif
|
2005-07-15 18:20:57 +00:00
|
|
|
// we have equal (or less then) area of the query left as the lengt of the current
|
|
|
|
// entity
|
- Page/Link: tooltips for links backported
- Page: rotation does not switch height and width
- Document/Part/Generator:
1. Add API for attaching stuff to the interface: ActionCollection and the Navigation Panel
also add possibility to merge an XML .rc file with menu layout. Relevant functions are:
QString Generator::getXMLFile(), returns a QString with your .rc file name.
void Generator::setupGUI (KActionCollection* , QToolbox* ), add your components to the user interface
2. Supporting backend settings:
If during startup, backends which provide a configuration ([X-KDE-oKularHasInternalSettings]
set to true) are found, a menu item: configure backends is created, clicking on it results in
loading all the generators that have settings, but not those that dont. the Generator::addPages(KConfigDialog *dlg)
function should be overloaded by a generator and dlg->addPage should be used to add pages.
If a user opens a file that needs an already loaded generator, the already loaded one is used instead of loading another.
3. Error/Warning/Notice sending support, to send a notice/error/warning, add a relevant notice/error/warning(QString& txt ,int duration)
to the generator class, and sending a message to the user is as simple as emitting a signal!
4. Intercepting of events generated by the PageView is done by Generator::handleEvent(QEvent*), subclass it, do a switch on QEvent::type(), handle your
event and return true if pageview is to proceed with its handling or false if not.
5. Support configuring the KPrinter on the generator side, use Generator::canConfigurePrinter(), return true there, and you get a nonconfigured KPrinter in your
Generator::print()
6. PixmapRequest handling update:
a.) Generator::canGeneratePixmap is now Generator::canGeneratePixmap(bool async)
b.) Document::sendGeneratorRequests is a slot now
c.) Old way of sending pixmaps (Document::requestPixmaps(QValueList<PixmapRequest*> checking if we can generate pixmap if not, waiting for receiving)
is replaced with: requestPixmaps only queues the pixmap all checking if w can generate is done in sendGeneratorReqest, the sendGeneratorRequest is
run in three places:
1. in requestPixmaps when we receive a request
2. in requestDone if pixmapStack is not empty
3. sendGeneratorRequest, apart from removing invalid requests, takes the current request and if generator canGeratePixmap(request->async)
it removes the pixmap from stack and sends to generator if not, QTimer::singleshots to itself after 20ms, it ends when stack has no valid pixmap request
7. Added a commented out zoom field to PixmapGenerator, mightcome in handy sometime
- TextPage: add instructions that handle simplyfing the RegularAreaRect, no more double painted borders in selection rectangles, this rocks.
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=445196
2005-08-10 16:14:39 +00:00
|
|
|
|
2006-11-23 16:54:28 +00:00
|
|
|
if ((caseSensitivity == Qt::CaseSensitive)
|
2006-05-27 10:06:31 +00:00
|
|
|
? (str.mid(offset,min) != query.mid(j,min))
|
2006-10-11 22:15:58 +00:00
|
|
|
: (str.mid(offset,min).toLower() != query.mid(j,min))
|
2005-07-15 18:20:57 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
// we not have matched
|
2006-07-18 19:06:01 +00:00
|
|
|
// this means we do not have a complete match
|
2005-07-15 18:20:57 +00:00
|
|
|
// we need to get back to query start
|
|
|
|
// and continue the search from this place
|
|
|
|
haveMatch=false;
|
2006-05-13 15:04:22 +00:00
|
|
|
ret->clear();
|
2005-11-18 20:48:01 +00:00
|
|
|
#ifdef DEBUG_TEXTPAGE
|
2007-07-31 10:19:48 +00:00
|
|
|
kDebug(OkularDebug) << "\tnot matched";
|
2005-11-18 20:48:01 +00:00
|
|
|
#endif
|
2005-07-15 18:20:57 +00:00
|
|
|
j=0;
|
2006-05-27 10:06:31 +00:00
|
|
|
offset = 0;
|
2005-07-15 18:20:57 +00:00
|
|
|
queryLeft=query.length();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// we have a match
|
|
|
|
// move the current position in the query
|
|
|
|
// to the position after the length of this string
|
|
|
|
// we matched
|
|
|
|
// substract the length of the current entity from
|
|
|
|
// the left length of the query
|
2005-11-18 20:48:01 +00:00
|
|
|
#ifdef DEBUG_TEXTPAGE
|
2007-07-31 10:19:48 +00:00
|
|
|
kDebug(OkularDebug) << "\tmatched";
|
2005-11-18 20:48:01 +00:00
|
|
|
#endif
|
2005-07-15 18:20:57 +00:00
|
|
|
haveMatch=true;
|
2007-09-04 22:37:39 +00:00
|
|
|
ret->append( curEntity->transformedArea( matrix ) );
|
2005-07-15 18:20:57 +00:00
|
|
|
j+=min;
|
|
|
|
queryLeft-=min;
|
|
|
|
}
|
|
|
|
}
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
|
2006-05-13 15:04:22 +00:00
|
|
|
if (haveMatch && queryLeft==0 && j==query.length())
|
2005-07-15 18:20:57 +00:00
|
|
|
{
|
2006-05-27 10:06:31 +00:00
|
|
|
// save or update the search point for the current searchID
|
|
|
|
if ( !m_searchPoints.contains( searchID ) )
|
|
|
|
{
|
|
|
|
SearchPoint* newsp = new SearchPoint;
|
|
|
|
m_searchPoints.insert( searchID, newsp );
|
|
|
|
}
|
|
|
|
SearchPoint* sp = m_searchPoints[ searchID ];
|
|
|
|
sp->theIt = it;
|
|
|
|
sp->offset_begin = j;
|
|
|
|
sp->offset_end = j + qMin( queryLeft, len );
|
- GIGANTIC 2700 line diff with LOTS OF FEATURES!
- 1. editor-like text selection, and I do mean it, its not pseudo-editor
(like the ones acroread and kviewshell have) it doesnt intersect the
selection area with words under it, no, it does a lot more, including
work on cursors and searching for the text area closest to the given
cursor
- 2. rotation support, change the orientation of the documents if
you need too :)
- 3. the kfaxview backend works beautifully, porting kviewshell backends
is damn easy ! djvu and dvi will be next!
- 4. Hardware Blending of selection rectangles! We now use XRender
instead of KImageEffect, makes a damn faster blend!
- 5. Overview mode - as seen in Kviewshell, but quite a bit extended,
the kviewshell is only one state, while we support it in both
continous and non-continous form
- BTW. I coded all those features myself, (apart from kfaxview backend library)
it is an impressive bit right? but oKular cant be run by only one person,
join in on the fun! i can introduce you into the code just mail niedakh@gmail.com
svn path=/trunk/playground/graphics/oKular/kpdf/; revision=509871
2006-02-15 18:54:49 +00:00
|
|
|
ret->simplify();
|
2005-07-15 18:20:57 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2006-05-13 15:04:22 +00:00
|
|
|
}
|
2006-05-27 10:06:31 +00:00
|
|
|
// end of loop - it means that we've ended the textentities
|
|
|
|
if ( m_searchPoints.contains( searchID ) )
|
|
|
|
{
|
|
|
|
SearchPoint* sp = m_searchPoints[ searchID ];
|
|
|
|
m_searchPoints.remove( searchID );
|
|
|
|
delete sp;
|
|
|
|
}
|
|
|
|
delete ret;
|
2005-07-15 18:20:57 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-11-23 17:11:04 +00:00
|
|
|
QString TextPage::text(const RegularAreaRect *area) const
|
2005-07-15 18:20:57 +00:00
|
|
|
{
|
2006-11-24 21:02:38 +00:00
|
|
|
if ( area && area->isNull() )
|
2006-05-26 14:32:35 +00:00
|
|
|
return QString();
|
2005-07-15 18:20:57 +00:00
|
|
|
|
2006-11-24 21:02:38 +00:00
|
|
|
TextEntity::List::ConstIterator it = d->m_words.begin(), itEnd = d->m_words.end();
|
|
|
|
QString ret;
|
|
|
|
if ( area )
|
2006-10-08 15:57:11 +00:00
|
|
|
{
|
2006-11-24 21:02:38 +00:00
|
|
|
for ( ; it != itEnd; ++it )
|
2005-07-15 18:20:57 +00:00
|
|
|
{
|
2007-09-03 19:35:55 +00:00
|
|
|
if ( area->intersects( *(*it)->area() ) )
|
2006-11-24 21:02:38 +00:00
|
|
|
{
|
|
|
|
ret += (*it)->text();
|
|
|
|
}
|
2005-07-15 18:20:57 +00:00
|
|
|
}
|
2006-10-08 15:57:11 +00:00
|
|
|
}
|
2006-11-24 21:02:38 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
for ( ; it != itEnd; ++it )
|
|
|
|
ret += (*it)->text();
|
|
|
|
}
|
2005-07-15 18:20:57 +00:00
|
|
|
return ret;
|
|
|
|
}
|