40 (*it)->visitedBy( rVisitor, it );
47 pNewParent->
Children.splice( pNewParent->
Children.end(), (*el)->Parent->Children, el );
48 (*el)->Parent = pNewParent;
54 if(
w == 0 &&
h == 0 )
63 if( pMergeFrom->
x <
x )
65 w +=
x - pMergeFrom->
x;
68 if( pMergeFrom->
x+pMergeFrom->
w >
x+
w )
69 w = pMergeFrom->
w+pMergeFrom->
x -
x;
70 if( pMergeFrom->
y <
y )
72 h +=
y - pMergeFrom->
y;
75 if( pMergeFrom->
y+pMergeFrom->
h >
y+
h )
76 h = pMergeFrom->
h+pMergeFrom->
y -
y;
81 #if OSL_DEBUG_LEVEL > 0
85 SAL_INFO(
"sdext", std::string(nLevel,
' ') <<
"<" <<
typeid( *this ).name() <<
" " <<
this <<
"> ("
86 << std::setprecision(1) <<
x <<
"," <<
y <<
")+(" <<
w <<
"x" <<
h <<
")" );
88 child->emitStructure(nLevel+1);
89 SAL_INFO(
"sdext", std::string(nLevel,
' ') <<
"</" <<
typeid( *this ).name() <<
">" );
100 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
102 rVisitor.
visit(*
this,rParentIt);
106 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
108 rVisitor.
visit(*
this,rParentIt);
112 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
114 rVisitor.
visit(*
this,rParentIt);
118 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt)
120 rVisitor.
visit( *
this, rParentIt);
128 PolyPoly( rPolyPoly ),
151 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt)
153 rVisitor.
visit( *
this, rParentIt);
156 #if OSL_DEBUG_LEVEL > 0
159 SAL_INFO(
"sdext", std::string(nLevel,
' ') <<
"<" <<
typeid( *this ).name() <<
" " <<
this <<
">" );
162 for(
int i = 0;
i < nPoly;
i++ )
166 int nPoints = aPoly.
count();
167 for(
int n = 0;
n < nPoints;
n++ )
170 buff.append(
" (" + OUString::number(aPoint.
getX()) +
"," + OUString::number(aPoint.
getY()) +
")");
172 SAL_INFO(
"sdext",
" " << buff.makeStringAndClear() );
175 child->emitStructure( nLevel+1 );
176 SAL_INFO(
"sdext", std::string(nLevel,
' ') <<
"</" <<
typeid( *this ).name() <<
">");
181 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
183 rVisitor.
visit(*
this,rParentIt);
188 TextElement* pText =
nullptr, *pLastText =
nullptr;
192 if( dynamic_cast< ParagraphElement* >(rxChild.get()) !=
nullptr )
195 pText =
dynamic_cast< TextElement*
>(rxChild.get());
199 if( pText->
h > rFont.
size*1.5 )
203 if( pText->
y > pLastText->y+pLastText->h ||
204 pLastText->y > pText->
y+pText->
h )
213 return pLastText !=
nullptr;
229 else if( (pText = dynamic_cast< TextElement* >( rxChild.get() )) != nullptr )
232 double lh = pText->
h;
233 if( pText->
h > rFont.
size*1.5 )
246 [](
const std::unique_ptr<Element>& rxElem) {
return dynamic_cast<TextElement*
>(rxElem.get()) !=
nullptr; });
248 pText = dynamic_cast<TextElement*>(it->get());
257 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
259 rVisitor.
visit(*
this, rParentIt);
268 for(
auto it = rElements.begin(); it != rElements.end(); ++it )
270 if( (*it)->x >= pLink->
x && (*it)->x + (*it)->w <= pLink->
x + pLink->
w &&
271 (*it)->y >= pLink->
y && (*it)->y + (*it)->h <= pLink->
y + pLink->
h )
293 if( dynamic_cast<ParagraphElement*>(it->get()) )
339 if( ! pPoly || ! pPoly->
Children.empty() )
359 bool bRemovePoly =
false;
361 if( aPoly.
count() != 2 ||
372 u_y = r_x; r_x = l_x; l_x = u_y;
375 for(
const auto& rxChild :
Children )
378 if( pEle->
y <= u_y && pEle->
y + pEle->
h*1.1 >= u_y )
381 if( pEle->
x + pEle->
w*0.1 >= l_x &&
382 pEle->
x + pEle->
w*0.9 <= r_x )
397 else if( dynamic_cast< HyperlinkElement* >(pEle) )
402 else if( dynamic_cast< HyperlinkElement* >(pEle) !=
nullptr &&
403 l_x >= pEle->
x && r_x <= pEle->
x+pEle->
w )
411 auto next_it = poly_it;
413 Children.erase( poly_it );
426 const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt)
428 rVisitor.
visit(*
this, rParentIt);
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.
basegfx::B2DPolyPolygon PolyPoly
virtual void emitStructure(int nLevel)
bool isRotatedOrSkewed() const
void setClosed(bool bNew)
bool isSingleLined(PDFIProcessor const &rProc) const
void applyToChildren(ElementTreeVisitor &)
Apply visitor to all children.
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.
Main entry from the parser.
const FontAttributes & getFont(sal_Int32 nFontId) const
PolyPolyElement(Element *pParent, sal_Int32 nGCId, const basegfx::B2DPolyPolygon &rPolyPoly, sal_Int8 nAction)
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.
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
virtual void emitStructure(int nLevel) override
TextElement * getFirstTextChild() const
const GraphicsContext & getGraphicsContext(sal_Int32 nGCId) const
virtual ~DocumentElement() override
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.
To be visited by all tree element types.
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.
std::list< std::unique_ptr< Element > > Children
virtual void visit(HyperlinkElement &, const std::list< std::unique_ptr< Element > >::const_iterator &)=0
virtual ~PageElement() override
void resolveFontStyles(PDFIProcessor const &rProc)
bool resolveHyperlink(const std::list< std::unique_ptr< Element >>::iterator &link_it, std::list< std::unique_ptr< Element >> &rElements)
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.
B2DRange getRange(const B2DPolygon &rCandidate)
void updateGeometryWith(const Element *pMergeFrom)
Union element geometry with given element.
B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon &rCandidate, double fAngleBound)
void resolveUnderlines(PDFIProcessor const &rProc)
#define SAL_INFO(area, stream)
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 ...
sal_Int32 getFontId(const FontAttributes &rAttr) 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.
double getLineHeight(PDFIProcessor &rProc) 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.
bool areControlPointsUsed() const
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const