/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
void Element::updateGeometryWith( const Element* pMergeFrom )
{ if( w == 0 && h == 0 )
{
x = pMergeFrom->x;
y = pMergeFrom->y;
w = pMergeFrom->w;
h = pMergeFrom->h;
} else
{ if( pMergeFrom->x < x )
{
w += x - pMergeFrom->x;
x = pMergeFrom->x;
} if( pMergeFrom->x+pMergeFrom->w > x+w )
w = pMergeFrom->w+pMergeFrom->x - x; if( pMergeFrom->y < y )
{
h += y - pMergeFrom->y;
y = pMergeFrom->y;
} if( pMergeFrom->y+pMergeFrom->h > y+h )
h = pMergeFrom->h+pMergeFrom->y - y;
}
}
#if OSL_DEBUG_LEVEL > 0 #include <typeinfo> void Element::emitStructure( int nLevel)
{
SAL_INFO( "sdext", std::string(nLevel, ' ') << "<" << typeid( *this ).name() << " " << this << "> ("
<< std::setprecision(1) << x << "," << y << ")+(" << w << "x" << h << ")" ); for (autoconst& child : Children)
child->emitStructure(nLevel+1);
SAL_INFO( "sdext", std::string(nLevel, ' ') << "" << typeid( *this ).name() << ">" );
} #endif
void ListElement::visitedBy( ElementTreeVisitor& visitor, const std::list< std::unique_ptr<Element> >::const_iterator& )
{ // this is only an inner node
applyToChildren(visitor);
}
void PageElement::resolveUnderlines( PDFIProcessor const & rProc )
{ // FIXME: currently the algorithm used is quadratic // this could be solved by some sorting beforehand
std::vector<Element*> textAndHypers;
textAndHypers.reserve(Children.size()); for (autoconst & p : Children)
{ if (p->dynCastAsTextElement() || dynamic_cast<HyperlinkElement*>(p.get()))
textAndHypers.push_back(p.get());
}
auto poly_it = Children.begin(); while( poly_it != Children.end() )
{
PolyPolyElement* pPoly = dynamic_cast< PolyPolyElement* >(poly_it->get()); if( ! pPoly || ! pPoly->Children.empty() )
{
++poly_it; continue;
} /* check for: no filling * only two points (FIXME: handle small rectangles, too) * y coordinates of points are equal
*/ if( pPoly->Action != PATH_STROKE )
{
++poly_it; continue;
} if( pPoly->PolyPoly.count() != 1 )
{
++poly_it; continue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.