25#include <com/sun/star/i18n/BreakIterator.hpp>
26#include <com/sun/star/i18n/ScriptType.hpp>
41 (*it)->visitedBy( rVisitor, it );
48 pNewParent->
Children.splice( pNewParent->
Children.end(), (*el)->Parent->Children, el );
49 (*el)->Parent = pNewParent;
55 if(
w == 0 &&
h == 0 )
64 if( pMergeFrom->
x <
x )
66 w +=
x - pMergeFrom->
x;
69 if( pMergeFrom->
x+pMergeFrom->
w >
x+
w )
70 w = pMergeFrom->
w+pMergeFrom->
x -
x;
71 if( pMergeFrom->
y <
y )
73 h +=
y - pMergeFrom->
y;
76 if( pMergeFrom->
y+pMergeFrom->
h >
y+
h )
77 h = pMergeFrom->
h+pMergeFrom->
y -
y;
82#if OSL_DEBUG_LEVEL > 0
86 SAL_INFO(
"sdext", std::string(nLevel,
' ') <<
"<" <<
typeid( *this ).name() <<
" " <<
this <<
"> ("
87 << std::setprecision(1) <<
x <<
"," <<
y <<
")+(" <<
w <<
"x" <<
h <<
")" );
89 child->emitStructure(nLevel+1);
90 SAL_INFO(
"sdext", std::string(nLevel,
' ') <<
"</" <<
typeid( *this ).name() <<
">" );
101 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
103 rVisitor.
visit(*
this,rParentIt);
107 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
109 rVisitor.
visit(*
this,rParentIt);
113 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
115 rVisitor.
visit(*
this,rParentIt);
119 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt)
121 rVisitor.
visit( *
this, rParentIt);
129 PolyPoly( rPolyPoly ),
152 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt)
154 rVisitor.
visit( *
this, rParentIt);
157#if OSL_DEBUG_LEVEL > 0
160 SAL_INFO(
"sdext", std::string(nLevel,
' ') <<
"<" <<
typeid( *this ).name() <<
" " <<
this <<
">" );
163 for(
int i = 0;
i < nPoly;
i++ )
167 int nPoints = aPoly.
count();
168 for(
int n = 0;
n < nPoints;
n++ )
171 buff.append(
" (" + OUString::number(aPoint.
getX()) +
"," + OUString::number(aPoint.
getY()) +
")");
173 SAL_INFO(
"sdext",
" " << buff.makeStringAndClear() );
176 child->emitStructure( nLevel+1 );
177 SAL_INFO(
"sdext", std::string(nLevel,
' ') <<
"</" <<
typeid( *this ).name() <<
">");
182 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
184 rVisitor.
visit(*
this,rParentIt);
189 TextElement* pText =
nullptr, *pLastText =
nullptr;
200 if( pText->
h > rFont.
size*1.5 )
204 if( pText->
y > pLastText->y+pLastText->h ||
205 pLastText->y > pText->
y+pText->
h )
214 return pLastText !=
nullptr;
233 double lh = pText->
h;
234 if( pText->
h > rFont.
size*1.5 )
247 [](
const std::unique_ptr<Element>& rxElem) { return rxElem->dynCastAsTextElement() != nullptr; });
258 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
260 rVisitor.
visit(*
this, rParentIt);
269 for(
auto it = rElements.begin(); it != rElements.end(); ++it )
271 if( (*it)->x >=
pLink->x && (*it)->x + (*it)->w <=
pLink->x +
pLink->w &&
277 if(
pLink->Children.empty() )
281 pLink->Parent = (*it)->Parent;
292 if( !
pLink->Children.empty() )
305 pLink->Parent = (*it)->Parent;
312 return !
pLink->Children.empty();
336 std::vector<Element*> textAndHypers;
337 textAndHypers.reserve(
Children.size());
341 textAndHypers.push_back(
p.get());
348 if( ! pPoly || ! pPoly->
Children.empty() )
368 bool bRemovePoly =
false;
370 if( aPoly.
count() != 2 ||
381 u_y = r_x; r_x = l_x; l_x = u_y;
384 for(
Element* pEle : textAndHypers )
386 if( pEle->y <= u_y && pEle->y + pEle->h*1.1 >= u_y )
389 if( pEle->x + pEle->w*0.1 >= l_x &&
390 pEle->x + pEle->w*0.9 <= r_x )
410 else if( l_x >= pEle->x && r_x <= pEle->
x+pEle->w &&
418 poly_it =
Children.erase( poly_it );
429 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt)
431 rVisitor.
visit(*
this, rParentIt);
434bool isComplex(
const css::uno::Reference<css::i18n::XBreakIterator>& rBreakIterator,
TextElement*
const pTextElem) {
435 OUString str(pTextElem->
Text.toString());
436 for(
int i=0;
i< str.getLength();
i++)
438 sal_Int16
nType = rBreakIterator->getScriptType(str,
i);
439 if (
nType == css::i18n::ScriptType::COMPLEX)
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
void setClosed(bool bNew)
bool areControlPointsUsed() const
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
Main entry from the parser.
const GraphicsContext & getGraphicsContext(sal_Int32 nGCId) const
const FontAttributes & getFont(sal_Int32 nFontId) const
sal_Int32 getFontId(const FontAttributes &rAttr) const
#define SAL_INFO(area, stream)
B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon &rCandidate, double fAngleBound)
B2DRange getRange(const B2DPolygon &rCandidate)
bool isComplex(const css::uno::Reference< css::i18n::XBreakIterator > &rBreakIterator, TextElement *const pTextElem)
virtual void visitedBy(ElementTreeVisitor &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
To be implemented by every tree node that needs to be visitable.
virtual ~DocumentElement() override
To be visited by all tree element types.
virtual void visit(HyperlinkElement &, const std::list< std::unique_ptr< Element > >::const_iterator &)=0
static void setParent(std::list< std::unique_ptr< Element > >::iterator const &el, Element *pNewParent)
el must be a valid dereferenceable iterator of el->Parent->Children pNewParent must not be NULL
std::list< std::unique_ptr< Element > > Children
virtual void emitStructure(int nLevel)
void applyToChildren(ElementTreeVisitor &)
Apply visitor to all children.
void updateGeometryWith(const Element *pMergeFrom)
Union element geometry with given element.
virtual void visitedBy(ElementTreeVisitor &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
To be implemented by every tree node that needs to be visitable.
bool isRotatedOrSkewed() const
virtual void visitedBy(ElementTreeVisitor &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
To be implemented by every tree node that needs to be visitable.
virtual void visitedBy(ElementTreeVisitor &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
To be implemented by every tree node that needs to be visitable.
virtual void visitedBy(ElementTreeVisitor &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
To be implemented by every tree node that needs to be visitable.
void resolveUnderlines(PDFIProcessor const &rProc)
bool resolveHyperlink(const std::list< std::unique_ptr< Element > >::iterator &link_it, std::list< std::unique_ptr< Element > > &rElements)
virtual ~PageElement() override
virtual void visitedBy(ElementTreeVisitor &, const std::list< std::unique_ptr< Element > >::const_iterator &rParentIt) override
To be implemented by every tree node that needs to be visitable.
void resolveFontStyles(PDFIProcessor const &rProc)
TextElement * getFirstTextChild() const
double getLineHeight(PDFIProcessor &rProc) const
virtual void visitedBy(ElementTreeVisitor &, const std::list< std::unique_ptr< Element > >::const_iterator &rParentIt) override
To be implemented by every tree node that needs to be visitable.
bool isSingleLined(PDFIProcessor const &rProc) const
virtual void visitedBy(ElementTreeVisitor &, const std::list< std::unique_ptr< Element > >::const_iterator &rParentIt) override
To be implemented by every tree node that needs to be visitable.
basegfx::B2DPolyPolygon PolyPoly
PolyPolyElement(Element *pParent, sal_Int32 nGCId, const basegfx::B2DPolyPolygon &rPolyPoly, sal_Int8 nAction)
virtual void emitStructure(int nLevel) override
virtual const TextElement * dynCastAsTextElement() const override
To avoid some dynamic_cast cost.
virtual void visitedBy(ElementTreeVisitor &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
To be implemented by every tree node that needs to be visitable.