loplugin:useuniqueptr in sdext
Change-Id: I0870d4b1e85465b07e3d9cdb05520fcb37dfc267 Reviewed-on: https://gerrit.libreoffice.org/50659 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -77,7 +77,7 @@ namespace pdfi
|
|||||||
: x( 0 ), y( 0 ), w( 0 ), h( 0 ), StyleId( -1 ), Parent( pParent )
|
: x( 0 ), y( 0 ), w( 0 ), h( 0 ), StyleId( -1 ), Parent( pParent )
|
||||||
{
|
{
|
||||||
if( pParent )
|
if( pParent )
|
||||||
pParent->Children.push_back( this );
|
pParent->Children.emplace_back( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -87,7 +87,7 @@ namespace pdfi
|
|||||||
To be implemented by every tree node that needs to be
|
To be implemented by every tree node that needs to be
|
||||||
visitable.
|
visitable.
|
||||||
*/
|
*/
|
||||||
virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& rParentIt ) = 0;
|
virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt ) = 0;
|
||||||
/// Apply visitor to all children
|
/// Apply visitor to all children
|
||||||
void applyToChildren( ElementTreeVisitor& );
|
void applyToChildren( ElementTreeVisitor& );
|
||||||
/// Union element geometry with given element
|
/// Union element geometry with given element
|
||||||
@@ -100,18 +100,18 @@ namespace pdfi
|
|||||||
/** el must be a valid dereferenceable iterator of el->Parent->Children
|
/** el must be a valid dereferenceable iterator of el->Parent->Children
|
||||||
pNewParent must not be NULL
|
pNewParent must not be NULL
|
||||||
*/
|
*/
|
||||||
static void setParent( std::list<Element*>::iterator const & el, Element* pNewParent );
|
static void setParent( std::list<std::unique_ptr<Element>>::iterator const & el, Element* pNewParent );
|
||||||
|
|
||||||
double x, y, w, h;
|
double x, y, w, h;
|
||||||
sal_Int32 StyleId;
|
sal_Int32 StyleId;
|
||||||
Element* Parent;
|
Element* Parent;
|
||||||
std::list<Element*> Children;
|
std::list<std::unique_ptr<Element>> Children;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ListElement : public Element
|
struct ListElement : public Element
|
||||||
{
|
{
|
||||||
ListElement() : Element( nullptr ) {}
|
ListElement() : Element( nullptr ) {}
|
||||||
virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HyperlinkElement : public Element
|
struct HyperlinkElement : public Element
|
||||||
@@ -121,7 +121,7 @@ namespace pdfi
|
|||||||
HyperlinkElement( Element* pParent, const OUString& rURI )
|
HyperlinkElement( Element* pParent, const OUString& rURI )
|
||||||
: Element( pParent ), URI( rURI ) {}
|
: Element( pParent ), URI( rURI ) {}
|
||||||
public:
|
public:
|
||||||
virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
|
|
||||||
OUString URI;
|
OUString URI;
|
||||||
};
|
};
|
||||||
@@ -166,7 +166,7 @@ namespace pdfi
|
|||||||
: DrawElement( pParent, nGCId ) {}
|
: DrawElement( pParent, nGCId ) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TextElement : public GraphicalElement
|
struct TextElement : public GraphicalElement
|
||||||
@@ -177,7 +177,7 @@ namespace pdfi
|
|||||||
: GraphicalElement( pParent, nGCId ), FontId( nFontId ) {}
|
: GraphicalElement( pParent, nGCId ), FontId( nFontId ) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
|
|
||||||
OUStringBuffer Text;
|
OUStringBuffer Text;
|
||||||
sal_Int32 FontId;
|
sal_Int32 FontId;
|
||||||
@@ -190,7 +190,7 @@ namespace pdfi
|
|||||||
explicit ParagraphElement( Element* pParent ) : Element( pParent ), Type( Normal ), bRtl( false ) {}
|
explicit ParagraphElement( Element* pParent ) : Element( pParent ), Type( Normal ), bRtl( false ) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& rParentIt ) override;
|
virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt ) override;
|
||||||
|
|
||||||
// returns true only if only a single line is contained
|
// returns true only if only a single line is contained
|
||||||
bool isSingleLined( PDFIProcessor const & rProc ) const;
|
bool isSingleLined( PDFIProcessor const & rProc ) const;
|
||||||
@@ -213,7 +213,7 @@ namespace pdfi
|
|||||||
const basegfx::B2DPolyPolygon& rPolyPoly,
|
const basegfx::B2DPolyPolygon& rPolyPoly,
|
||||||
sal_Int8 nAction );
|
sal_Int8 nAction );
|
||||||
public:
|
public:
|
||||||
virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& rParentIt ) override;
|
virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt ) override;
|
||||||
|
|
||||||
void updateGeometry();
|
void updateGeometry();
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ namespace pdfi
|
|||||||
: DrawElement( pParent, nGCId ), Image( nImage ) {}
|
: DrawElement( pParent, nGCId ), Image( nImage ) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
|
|
||||||
ImageId Image;
|
ImageId Image;
|
||||||
};
|
};
|
||||||
@@ -249,11 +249,11 @@ namespace pdfi
|
|||||||
{}
|
{}
|
||||||
private:
|
private:
|
||||||
// helper method for resolveHyperlinks
|
// helper method for resolveHyperlinks
|
||||||
bool resolveHyperlink( const std::list<Element*>::iterator& link_it, std::list<Element*>& rElements );
|
bool resolveHyperlink( const std::list<std::unique_ptr<Element>>::iterator& link_it, std::list<std::unique_ptr<Element>>& rElements );
|
||||||
public:
|
public:
|
||||||
virtual ~PageElement() override;
|
virtual ~PageElement() override;
|
||||||
|
|
||||||
virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& rParentIt ) override;
|
virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt ) override;
|
||||||
|
|
||||||
static void updateParagraphGeometry( Element* pEle );
|
static void updateParagraphGeometry( Element* pEle );
|
||||||
void resolveHyperlinks();
|
void resolveHyperlinks();
|
||||||
@@ -266,8 +266,8 @@ namespace pdfi
|
|||||||
double BottomMargin;
|
double BottomMargin;
|
||||||
double LeftMargin;
|
double LeftMargin;
|
||||||
double RightMargin;
|
double RightMargin;
|
||||||
Element* HeaderElement;
|
std::unique_ptr<Element> HeaderElement;
|
||||||
Element* FooterElement;
|
std::unique_ptr<Element> FooterElement;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DocumentElement : public Element
|
struct DocumentElement : public Element
|
||||||
@@ -278,7 +278,7 @@ namespace pdfi
|
|||||||
public:
|
public:
|
||||||
virtual ~DocumentElement() override;
|
virtual ~DocumentElement() override;
|
||||||
|
|
||||||
virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// this class is the differentiator of document types: it will create
|
// this class is the differentiator of document types: it will create
|
||||||
|
@@ -43,14 +43,14 @@ namespace pdfi
|
|||||||
*/
|
*/
|
||||||
struct ElementTreeVisitor
|
struct ElementTreeVisitor
|
||||||
{
|
{
|
||||||
virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) = 0;
|
virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) = 0;
|
||||||
virtual void visit( TextElement&, const std::list< Element* >::const_iterator& ) = 0;
|
virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) = 0;
|
||||||
virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& ) = 0;
|
virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) = 0;
|
||||||
virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& ) = 0;
|
virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) = 0;
|
||||||
virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& ) = 0;
|
virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) = 0;
|
||||||
virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& ) = 0;
|
virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) = 0;
|
||||||
virtual void visit( PageElement&, const std::list< Element* >::const_iterator& ) = 0;
|
virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) = 0;
|
||||||
virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& ) = 0;
|
virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) = 0;
|
||||||
virtual ~ElementTreeVisitor() {}
|
virtual ~ElementTreeVisitor() {}
|
||||||
};
|
};
|
||||||
typedef std::shared_ptr<ElementTreeVisitor> ElementTreeVisitorSharedPtr;
|
typedef std::shared_ptr<ElementTreeVisitor> ElementTreeVisitorSharedPtr;
|
||||||
|
@@ -67,12 +67,12 @@ const Reference< XCharacterClassification >& DrawXmlEmitter::GetCharacterClassif
|
|||||||
return mxCharClass;
|
return mxCharClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlEmitter::visit( HyperlinkElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlEmitter::visit( HyperlinkElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
if( elem.Children.empty() )
|
if( elem.Children.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const char* pType = dynamic_cast<DrawElement*>(elem.Children.front()) ? "draw:a" : "text:a";
|
const char* pType = dynamic_cast<DrawElement*>(elem.Children.front().get()) ? "draw:a" : "text:a";
|
||||||
|
|
||||||
PropertyMap aProps;
|
PropertyMap aProps;
|
||||||
aProps[ "xlink:type" ] = "simple";
|
aProps[ "xlink:type" ] = "simple";
|
||||||
@@ -81,8 +81,8 @@ void DrawXmlEmitter::visit( HyperlinkElement& elem, const std::list< Element* >:
|
|||||||
aProps[ "xlink:show" ] = "new";
|
aProps[ "xlink:show" ] = "new";
|
||||||
|
|
||||||
m_rEmitContext.rEmitter.beginTag( pType, aProps );
|
m_rEmitContext.rEmitter.beginTag( pType, aProps );
|
||||||
std::list< Element* >::iterator this_it = elem.Children.begin();
|
auto this_it = elem.Children.begin();
|
||||||
while( this_it !=elem.Children.end() && *this_it != &elem )
|
while( this_it != elem.Children.end() && this_it->get() != &elem )
|
||||||
{
|
{
|
||||||
(*this_it)->visitedBy( *this, this_it );
|
(*this_it)->visitedBy( *this, this_it );
|
||||||
++this_it;
|
++this_it;
|
||||||
@@ -90,7 +90,7 @@ void DrawXmlEmitter::visit( HyperlinkElement& elem, const std::list< Element* >:
|
|||||||
m_rEmitContext.rEmitter.endTag( pType );
|
m_rEmitContext.rEmitter.endTag( pType );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlEmitter::visit( TextElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlEmitter::visit( TextElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
if( elem.Text.isEmpty() )
|
if( elem.Text.isEmpty() )
|
||||||
return;
|
return;
|
||||||
@@ -152,8 +152,8 @@ void DrawXmlEmitter::visit( TextElement& elem, const std::list< Element* >::cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list< Element* >::iterator this_it = elem.Children.begin();
|
auto this_it = elem.Children.begin();
|
||||||
while( this_it !=elem.Children.end() && *this_it != &elem )
|
while( this_it != elem.Children.end() && this_it->get() != &elem )
|
||||||
{
|
{
|
||||||
(*this_it)->visitedBy( *this, this_it );
|
(*this_it)->visitedBy( *this, this_it );
|
||||||
++this_it;
|
++this_it;
|
||||||
@@ -162,7 +162,7 @@ void DrawXmlEmitter::visit( TextElement& elem, const std::list< Element* >::cons
|
|||||||
m_rEmitContext.rEmitter.endTag( "text:span" );
|
m_rEmitContext.rEmitter.endTag( "text:span" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlEmitter::visit( ParagraphElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlEmitter::visit( ParagraphElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
PropertyMap aProps;
|
PropertyMap aProps;
|
||||||
if( elem.StyleId != -1 )
|
if( elem.StyleId != -1 )
|
||||||
@@ -174,8 +174,8 @@ void DrawXmlEmitter::visit( ParagraphElement& elem, const std::list< Element* >:
|
|||||||
pTagType = "text:h";
|
pTagType = "text:h";
|
||||||
m_rEmitContext.rEmitter.beginTag( pTagType, aProps );
|
m_rEmitContext.rEmitter.beginTag( pTagType, aProps );
|
||||||
|
|
||||||
std::list< Element* >::iterator this_it = elem.Children.begin();
|
auto this_it = elem.Children.begin();
|
||||||
while( this_it !=elem.Children.end() && *this_it != &elem )
|
while( this_it != elem.Children.end() && this_it->get() != &elem )
|
||||||
{
|
{
|
||||||
(*this_it)->visitedBy( *this, this_it );
|
(*this_it)->visitedBy( *this, this_it );
|
||||||
++this_it;
|
++this_it;
|
||||||
@@ -242,20 +242,20 @@ void DrawXmlEmitter::fillFrameProps( DrawElement& rElem,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlEmitter::visit( FrameElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlEmitter::visit( FrameElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
if( elem.Children.empty() )
|
if( elem.Children.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool bTextBox = (dynamic_cast<ParagraphElement*>(elem.Children.front()) != nullptr);
|
bool bTextBox = (dynamic_cast<ParagraphElement*>(elem.Children.front().get()) != nullptr);
|
||||||
PropertyMap aFrameProps;
|
PropertyMap aFrameProps;
|
||||||
fillFrameProps( elem, aFrameProps, m_rEmitContext, false );
|
fillFrameProps( elem, aFrameProps, m_rEmitContext, false );
|
||||||
m_rEmitContext.rEmitter.beginTag( "draw:frame", aFrameProps );
|
m_rEmitContext.rEmitter.beginTag( "draw:frame", aFrameProps );
|
||||||
if( bTextBox )
|
if( bTextBox )
|
||||||
m_rEmitContext.rEmitter.beginTag( "draw:text-box", PropertyMap() );
|
m_rEmitContext.rEmitter.beginTag( "draw:text-box", PropertyMap() );
|
||||||
|
|
||||||
std::list< Element* >::iterator this_it = elem.Children.begin();
|
auto this_it = elem.Children.begin();
|
||||||
while( this_it !=elem.Children.end() && *this_it != &elem )
|
while( this_it != elem.Children.end() && this_it->get() != &elem )
|
||||||
{
|
{
|
||||||
(*this_it)->visitedBy( *this, this_it );
|
(*this_it)->visitedBy( *this, this_it );
|
||||||
++this_it;
|
++this_it;
|
||||||
@@ -266,7 +266,7 @@ void DrawXmlEmitter::visit( FrameElement& elem, const std::list< Element* >::con
|
|||||||
m_rEmitContext.rEmitter.endTag( "draw:frame" );
|
m_rEmitContext.rEmitter.endTag( "draw:frame" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlEmitter::visit( PolyPolyElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlEmitter::visit( PolyPolyElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
elem.updateGeometry();
|
elem.updateGeometry();
|
||||||
/* note:
|
/* note:
|
||||||
@@ -335,7 +335,7 @@ void DrawXmlEmitter::visit( PolyPolyElement& elem, const std::list< Element* >::
|
|||||||
m_rEmitContext.rEmitter.endTag( "draw:path" );
|
m_rEmitContext.rEmitter.endTag( "draw:path" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlEmitter::visit( ImageElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlEmitter::visit( ImageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
PropertyMap aImageProps;
|
PropertyMap aImageProps;
|
||||||
m_rEmitContext.rEmitter.beginTag( "draw:image", aImageProps );
|
m_rEmitContext.rEmitter.beginTag( "draw:image", aImageProps );
|
||||||
@@ -345,7 +345,7 @@ void DrawXmlEmitter::visit( ImageElement& elem, const std::list< Element* >::con
|
|||||||
m_rEmitContext.rEmitter.endTag( "draw:image" );
|
m_rEmitContext.rEmitter.endTag( "draw:image" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlEmitter::visit( PageElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlEmitter::visit( PageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
PropertyMap aPageProps;
|
PropertyMap aPageProps;
|
||||||
aPageProps[ "draw:master-page-name" ] = m_rEmitContext.rStyles.getStyleName( elem.StyleId );
|
aPageProps[ "draw:master-page-name" ] = m_rEmitContext.rStyles.getStyleName( elem.StyleId );
|
||||||
@@ -355,8 +355,8 @@ void DrawXmlEmitter::visit( PageElement& elem, const std::list< Element* >::cons
|
|||||||
if( m_rEmitContext.xStatusIndicator.is() )
|
if( m_rEmitContext.xStatusIndicator.is() )
|
||||||
m_rEmitContext.xStatusIndicator->setValue( elem.PageNumber );
|
m_rEmitContext.xStatusIndicator->setValue( elem.PageNumber );
|
||||||
|
|
||||||
std::list< Element* >::iterator this_it = elem.Children.begin();
|
auto this_it = elem.Children.begin();
|
||||||
while( this_it != elem.Children.end() && *this_it != &elem )
|
while( this_it != elem.Children.end() && this_it->get() != &elem )
|
||||||
{
|
{
|
||||||
(*this_it)->visitedBy( *this, this_it );
|
(*this_it)->visitedBy( *this, this_it );
|
||||||
++this_it;
|
++this_it;
|
||||||
@@ -365,14 +365,14 @@ void DrawXmlEmitter::visit( PageElement& elem, const std::list< Element* >::cons
|
|||||||
m_rEmitContext.rEmitter.endTag("draw:page");
|
m_rEmitContext.rEmitter.endTag("draw:page");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlEmitter::visit( DocumentElement& elem, const std::list< Element* >::const_iterator&)
|
void DrawXmlEmitter::visit( DocumentElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator&)
|
||||||
{
|
{
|
||||||
m_rEmitContext.rEmitter.beginTag( "office:body", PropertyMap() );
|
m_rEmitContext.rEmitter.beginTag( "office:body", PropertyMap() );
|
||||||
m_rEmitContext.rEmitter.beginTag( m_bWriteDrawDocument ? "office:drawing" : "office:presentation",
|
m_rEmitContext.rEmitter.beginTag( m_bWriteDrawDocument ? "office:drawing" : "office:presentation",
|
||||||
PropertyMap() );
|
PropertyMap() );
|
||||||
|
|
||||||
std::list< Element* >::iterator this_it = elem.Children.begin();
|
auto this_it = elem.Children.begin();
|
||||||
while( this_it != elem.Children.end() && *this_it != &elem )
|
while( this_it != elem.Children.end() && this_it->get() != &elem )
|
||||||
{
|
{
|
||||||
(*this_it)->visitedBy( *this, this_it );
|
(*this_it)->visitedBy( *this, this_it );
|
||||||
++this_it;
|
++this_it;
|
||||||
@@ -383,24 +383,24 @@ void DrawXmlEmitter::visit( DocumentElement& elem, const std::list< Element* >::
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DrawXmlOptimizer::visit( HyperlinkElement&, const std::list< Element* >::const_iterator& )
|
void DrawXmlOptimizer::visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlOptimizer::visit( TextElement&, const std::list< Element* >::const_iterator&)
|
void DrawXmlOptimizer::visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlOptimizer::visit( FrameElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlOptimizer::visit( FrameElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlOptimizer::visit( ImageElement&, const std::list< Element* >::const_iterator& )
|
void DrawXmlOptimizer::visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element* >::const_iterator& elemIt )
|
void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& elemIt )
|
||||||
{
|
{
|
||||||
/* note: optimize two consecutive PolyPolyElements that
|
/* note: optimize two consecutive PolyPolyElements that
|
||||||
* have the same path but one of which is a stroke while
|
* have the same path but one of which is a stroke while
|
||||||
@@ -412,12 +412,12 @@ void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element* >
|
|||||||
// find following PolyPolyElement in parent's children list
|
// find following PolyPolyElement in parent's children list
|
||||||
if( elemIt == elem.Parent->Children.end() )
|
if( elemIt == elem.Parent->Children.end() )
|
||||||
return;
|
return;
|
||||||
std::list< Element* >::const_iterator next_it = elemIt;
|
auto next_it = elemIt;
|
||||||
++next_it;
|
++next_it;
|
||||||
if( next_it == elem.Parent->Children.end() )
|
if( next_it == elem.Parent->Children.end() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PolyPolyElement* pNext = dynamic_cast<PolyPolyElement*>(*next_it);
|
PolyPolyElement* pNext = dynamic_cast<PolyPolyElement*>(next_it->get());
|
||||||
// TODO(F2): this comparison fails for OOo-generated polygons with beziers.
|
// TODO(F2): this comparison fails for OOo-generated polygons with beziers.
|
||||||
if( !pNext || pNext->PolyPoly != elem.PolyPoly )
|
if( !pNext || pNext->PolyPoly != elem.PolyPoly )
|
||||||
return;
|
return;
|
||||||
@@ -452,7 +452,7 @@ void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element* >
|
|||||||
elem.Children.splice( elem.Children.end(), pNext->Children );
|
elem.Children.splice( elem.Children.end(), pNext->Children );
|
||||||
// workaround older compilers that do not have std::list::erase(const_iterator)
|
// workaround older compilers that do not have std::list::erase(const_iterator)
|
||||||
#if HAVE_BROKEN_CONST_ITERATORS
|
#if HAVE_BROKEN_CONST_ITERATORS
|
||||||
std::list< Element* >::iterator tmpIt = elem.Parent->Children.begin();
|
auto tmpIt = elem.Parent->Children.begin();
|
||||||
std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
|
std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
|
||||||
elem.Parent->Children.erase(tmpIt);
|
elem.Parent->Children.erase(tmpIt);
|
||||||
#else
|
#else
|
||||||
@@ -462,14 +462,14 @@ void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element* >
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlOptimizer::visit( ParagraphElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlOptimizer::visit( ParagraphElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
optimizeTextElements( elem );
|
optimizeTextElements( elem );
|
||||||
|
|
||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlOptimizer::visit( PageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
if( m_rProcessor.getStatusIndicator().is() )
|
if( m_rProcessor.getStatusIndicator().is() )
|
||||||
m_rProcessor.getStatusIndicator()->setValue( elem.PageNumber );
|
m_rProcessor.getStatusIndicator()->setValue( elem.PageNumber );
|
||||||
@@ -485,7 +485,7 @@ void DrawXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::co
|
|||||||
|
|
||||||
// find paragraphs in text
|
// find paragraphs in text
|
||||||
ParagraphElement* pCurPara = nullptr;
|
ParagraphElement* pCurPara = nullptr;
|
||||||
std::list< Element* >::iterator page_element, next_page_element;
|
std::list< std::unique_ptr<Element> >::iterator page_element, next_page_element;
|
||||||
next_page_element = elem.Children.begin();
|
next_page_element = elem.Children.begin();
|
||||||
double fCurLineHeight = 0.0; // average height of text items in current para
|
double fCurLineHeight = 0.0; // average height of text items in current para
|
||||||
int nCurLineElements = 0; // number of line contributing elements in current para
|
int nCurLineElements = 0; // number of line contributing elements in current para
|
||||||
@@ -495,17 +495,17 @@ void DrawXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::co
|
|||||||
while( next_page_element != elem.Children.end() )
|
while( next_page_element != elem.Children.end() )
|
||||||
{
|
{
|
||||||
page_element = next_page_element++;
|
page_element = next_page_element++;
|
||||||
ParagraphElement* pPagePara = dynamic_cast<ParagraphElement*>(*page_element);
|
ParagraphElement* pPagePara = dynamic_cast<ParagraphElement*>(page_element->get());
|
||||||
if( pPagePara )
|
if( pPagePara )
|
||||||
{
|
{
|
||||||
pCurPara = pPagePara;
|
pCurPara = pPagePara;
|
||||||
// adjust line height and text items
|
// adjust line height and text items
|
||||||
fCurLineHeight = 0.0;
|
fCurLineHeight = 0.0;
|
||||||
nCurLineElements = 0;
|
nCurLineElements = 0;
|
||||||
for( std::list< Element* >::iterator it = pCurPara->Children.begin();
|
for( auto it = pCurPara->Children.begin();
|
||||||
it != pCurPara->Children.end(); ++it )
|
it != pCurPara->Children.end(); ++it )
|
||||||
{
|
{
|
||||||
TextElement* pTestText = dynamic_cast<TextElement*>(*it);
|
TextElement* pTestText = dynamic_cast<TextElement*>(it->get());
|
||||||
if( pTestText )
|
if( pTestText )
|
||||||
{
|
{
|
||||||
fCurLineHeight = (fCurLineHeight*double(nCurLineElements) + pTestText->h)/double(nCurLineElements+1);
|
fCurLineHeight = (fCurLineHeight*double(nCurLineElements) + pTestText->h)/double(nCurLineElements+1);
|
||||||
@@ -515,10 +515,10 @@ void DrawXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::co
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
HyperlinkElement* pLink = dynamic_cast<HyperlinkElement*>(*page_element);
|
HyperlinkElement* pLink = dynamic_cast<HyperlinkElement*>(page_element->get());
|
||||||
DrawElement* pDraw = dynamic_cast<DrawElement*>(*page_element);
|
DrawElement* pDraw = dynamic_cast<DrawElement*>(page_element->get());
|
||||||
if( ! pDraw && pLink && ! pLink->Children.empty() )
|
if( ! pDraw && pLink && ! pLink->Children.empty() )
|
||||||
pDraw = dynamic_cast<DrawElement*>(pLink->Children.front() );
|
pDraw = dynamic_cast<DrawElement*>(pLink->Children.front().get() );
|
||||||
if( pDraw )
|
if( pDraw )
|
||||||
{
|
{
|
||||||
// insert small drawing objects as character, else leave them page bound
|
// insert small drawing objects as character, else leave them page bound
|
||||||
@@ -539,12 +539,12 @@ void DrawXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::co
|
|||||||
// or perhaps the draw element begins a new paragraph
|
// or perhaps the draw element begins a new paragraph
|
||||||
else if( next_page_element != elem.Children.end() )
|
else if( next_page_element != elem.Children.end() )
|
||||||
{
|
{
|
||||||
TextElement* pText = dynamic_cast<TextElement*>(*next_page_element);
|
TextElement* pText = dynamic_cast<TextElement*>(next_page_element->get());
|
||||||
if( ! pText )
|
if( ! pText )
|
||||||
{
|
{
|
||||||
ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(*next_page_element);
|
ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(next_page_element->get());
|
||||||
if( pPara && ! pPara->Children.empty() )
|
if( pPara && ! pPara->Children.empty() )
|
||||||
pText = dynamic_cast<TextElement*>(pPara->Children.front());
|
pText = dynamic_cast<TextElement*>(pPara->Children.front().get());
|
||||||
}
|
}
|
||||||
if( pText && // check there is a text
|
if( pText && // check there is a text
|
||||||
pDraw->h < pText->h*1.5 && // and it is approx the same height
|
pDraw->h < pText->h*1.5 && // and it is approx the same height
|
||||||
@@ -573,9 +573,9 @@ void DrawXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextElement* pText = dynamic_cast<TextElement*>(*page_element);
|
TextElement* pText = dynamic_cast<TextElement*>(page_element->get());
|
||||||
if( ! pText && pLink && ! pLink->Children.empty() )
|
if( ! pText && pLink && ! pLink->Children.empty() )
|
||||||
pText = dynamic_cast<TextElement*>(pLink->Children.front());
|
pText = dynamic_cast<TextElement*>(pLink->Children.front().get());
|
||||||
if( pText )
|
if( pText )
|
||||||
{
|
{
|
||||||
Element* pGeo = pLink ? static_cast<Element*>(pLink) :
|
Element* pGeo = pLink ? static_cast<Element*>(pLink) :
|
||||||
@@ -632,14 +632,14 @@ void DrawXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::co
|
|||||||
// set parent
|
// set parent
|
||||||
pCurPara->Parent = &elem;
|
pCurPara->Parent = &elem;
|
||||||
//insert new paragraph before current element
|
//insert new paragraph before current element
|
||||||
page_element = elem.Children.insert( page_element, pCurPara );
|
page_element = elem.Children.insert( page_element, std::unique_ptr<Element>(pCurPara) );
|
||||||
// forward iterator to current element again
|
// forward iterator to current element again
|
||||||
++ page_element;
|
++ page_element;
|
||||||
// update next_element which is now invalid
|
// update next_element which is now invalid
|
||||||
next_page_element = page_element;
|
next_page_element = page_element;
|
||||||
++ next_page_element;
|
++ next_page_element;
|
||||||
}
|
}
|
||||||
Element* pCurEle = *page_element;
|
Element* pCurEle = page_element->get();
|
||||||
Element::setParent( page_element, pCurPara );
|
Element::setParent( page_element, pCurPara );
|
||||||
OSL_ENSURE( !pText || pCurEle == pText || pCurEle == pLink, "paragraph child list in disorder" );
|
OSL_ENSURE( !pText || pCurEle == pText || pCurEle == pLink, "paragraph child list in disorder" );
|
||||||
if( pText || pDraw )
|
if( pText || pDraw )
|
||||||
@@ -678,17 +678,17 @@ void DrawXmlOptimizer::optimizeTextElements(Element& rParent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// concatenate child elements with same font id
|
// concatenate child elements with same font id
|
||||||
std::list< Element* >::iterator next = rParent.Children.begin();
|
auto next = rParent.Children.begin();
|
||||||
std::list< Element* >::iterator it = next++;
|
auto it = next++;
|
||||||
|
|
||||||
while( next != rParent.Children.end() )
|
while( next != rParent.Children.end() )
|
||||||
{
|
{
|
||||||
bool bConcat = false;
|
bool bConcat = false;
|
||||||
TextElement* pCur = dynamic_cast<TextElement*>(*it);
|
TextElement* pCur = dynamic_cast<TextElement*>(it->get());
|
||||||
|
|
||||||
if( pCur )
|
if( pCur )
|
||||||
{
|
{
|
||||||
TextElement* pNext = dynamic_cast<TextElement*>(*next);
|
TextElement* pNext = dynamic_cast<TextElement*>(next->get());
|
||||||
bool isComplex = false;
|
bool isComplex = false;
|
||||||
OUString str(pCur->Text.getStr());
|
OUString str(pCur->Text.getStr());
|
||||||
for(int i=0; i< str.getLength(); i++)
|
for(int i=0; i< str.getLength(); i++)
|
||||||
@@ -742,7 +742,7 @@ void DrawXmlOptimizer::optimizeTextElements(Element& rParent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( dynamic_cast<HyperlinkElement*>(*it) )
|
else if( dynamic_cast<HyperlinkElement*>(it->get()) )
|
||||||
optimizeTextElements( **it );
|
optimizeTextElements( **it );
|
||||||
if ( bConcat )
|
if ( bConcat )
|
||||||
next = it;
|
next = it;
|
||||||
@@ -752,13 +752,13 @@ void DrawXmlOptimizer::optimizeTextElements(Element& rParent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlOptimizer::visit( DocumentElement& elem, const std::list< Element* >::const_iterator&)
|
void DrawXmlOptimizer::visit( DocumentElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator&)
|
||||||
{
|
{
|
||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
// xxx TODO copied from DrawElement
|
// xxx TODO copied from DrawElement
|
||||||
const GraphicsContext& rGC = m_rProcessor.getGraphicsContext(elem.GCId );
|
const GraphicsContext& rGC = m_rProcessor.getGraphicsContext(elem.GCId );
|
||||||
@@ -821,7 +821,7 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< Element* >
|
|||||||
elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
|
elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlFinalizer::visit( HyperlinkElement&, const std::list< Element* >::const_iterator& )
|
void DrawXmlFinalizer::visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -836,7 +836,7 @@ void SetFontsizeProperties(PropertyMap& props, double fontSize)
|
|||||||
props["style:font-size-complex"] = aFSize;
|
props["style:font-size-complex"] = aFSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlFinalizer::visit( TextElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
const FontAttributes& rFont = m_rProcessor.getFont( elem.FontId );
|
const FontAttributes& rFont = m_rProcessor.getFont( elem.FontId );
|
||||||
PropertyMap aProps;
|
PropertyMap aProps;
|
||||||
@@ -899,7 +899,7 @@ void DrawXmlFinalizer::visit( TextElement& elem, const std::list< Element* >::co
|
|||||||
elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
|
elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlFinalizer::visit( ParagraphElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
|
|
||||||
PropertyMap aProps;
|
PropertyMap aProps;
|
||||||
@@ -924,7 +924,7 @@ void DrawXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element*
|
|||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlFinalizer::visit( FrameElement& elem, const std::list< Element* >::const_iterator&)
|
void DrawXmlFinalizer::visit( FrameElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator&)
|
||||||
{
|
{
|
||||||
PropertyMap props1;
|
PropertyMap props1;
|
||||||
props1[ "style:family" ] = "graphic";
|
props1[ "style:family" ] = "graphic";
|
||||||
@@ -970,11 +970,11 @@ void DrawXmlFinalizer::visit( FrameElement& elem, const std::list< Element* >::c
|
|||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlFinalizer::visit( ImageElement&, const std::list< Element* >::const_iterator& )
|
void DrawXmlFinalizer::visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlFinalizer::visit( PageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
if( m_rProcessor.getStatusIndicator().is() )
|
if( m_rProcessor.getStatusIndicator().is() )
|
||||||
m_rProcessor.getStatusIndicator()->setValue( elem.PageNumber );
|
m_rProcessor.getStatusIndicator()->setValue( elem.PageNumber );
|
||||||
@@ -988,7 +988,7 @@ void DrawXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::co
|
|||||||
elem.LeftMargin = elem.w;
|
elem.LeftMargin = elem.w;
|
||||||
elem.RightMargin = 0;
|
elem.RightMargin = 0;
|
||||||
|
|
||||||
for( std::list< Element* >::const_iterator it = elem.Children.begin(); it != elem.Children.end(); ++it )
|
for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
|
||||||
{
|
{
|
||||||
if( (*it)->x < elem.LeftMargin )
|
if( (*it)->x < elem.LeftMargin )
|
||||||
elem.LeftMargin = (*it)->x;
|
elem.LeftMargin = (*it)->x;
|
||||||
@@ -1075,7 +1075,7 @@ void DrawXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::co
|
|||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawXmlFinalizer::visit( DocumentElement& elem, const std::list< Element* >::const_iterator& )
|
void DrawXmlFinalizer::visit( DocumentElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
@@ -44,14 +44,14 @@ namespace pdfi
|
|||||||
m_rProcessor(rProcessor)
|
m_rProcessor(rProcessor)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( TextElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DrawXmlFinalizer : public ElementTreeVisitor
|
class DrawXmlFinalizer : public ElementTreeVisitor
|
||||||
@@ -67,14 +67,14 @@ namespace pdfi
|
|||||||
m_rProcessor(rProcessor)
|
m_rProcessor(rProcessor)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( TextElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DrawXmlEmitter : public ElementTreeVisitor
|
class DrawXmlEmitter : public ElementTreeVisitor
|
||||||
@@ -100,14 +100,14 @@ namespace pdfi
|
|||||||
m_bWriteDrawDocument(eDocType==DRAW_DOC)
|
m_bWriteDrawDocument(eDocType==DRAW_DOC)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( TextElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,9 +34,6 @@ namespace pdfi
|
|||||||
|
|
||||||
Element::~Element()
|
Element::~Element()
|
||||||
{
|
{
|
||||||
for (auto const& child : Children)
|
|
||||||
delete child;
|
|
||||||
Children.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element::applyToChildren( ElementTreeVisitor& rVisitor )
|
void Element::applyToChildren( ElementTreeVisitor& rVisitor )
|
||||||
@@ -45,7 +42,7 @@ void Element::applyToChildren( ElementTreeVisitor& rVisitor )
|
|||||||
(*it)->visitedBy( rVisitor, it );
|
(*it)->visitedBy( rVisitor, it );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element::setParent( std::list<Element*>::iterator const & el, Element* pNewParent )
|
void Element::setParent( std::list<std::unique_ptr<Element>>::iterator const & el, Element* pNewParent )
|
||||||
{
|
{
|
||||||
if( pNewParent )
|
if( pNewParent )
|
||||||
{
|
{
|
||||||
@@ -95,32 +92,32 @@ void Element::emitStructure( int nLevel)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ListElement::visitedBy( ElementTreeVisitor& visitor, const std::list< Element* >::const_iterator& )
|
void ListElement::visitedBy( ElementTreeVisitor& visitor, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
// this is only an inner node
|
// this is only an inner node
|
||||||
applyToChildren(visitor);
|
applyToChildren(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HyperlinkElement::visitedBy( ElementTreeVisitor& rVisitor,
|
void HyperlinkElement::visitedBy( ElementTreeVisitor& rVisitor,
|
||||||
const std::list< Element* >::const_iterator& rParentIt )
|
const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
|
||||||
{
|
{
|
||||||
rVisitor.visit(*this,rParentIt);
|
rVisitor.visit(*this,rParentIt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextElement::visitedBy( ElementTreeVisitor& rVisitor,
|
void TextElement::visitedBy( ElementTreeVisitor& rVisitor,
|
||||||
const std::list< Element* >::const_iterator& rParentIt )
|
const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
|
||||||
{
|
{
|
||||||
rVisitor.visit(*this,rParentIt);
|
rVisitor.visit(*this,rParentIt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameElement::visitedBy( ElementTreeVisitor& rVisitor,
|
void FrameElement::visitedBy( ElementTreeVisitor& rVisitor,
|
||||||
const std::list< Element* >::const_iterator& rParentIt )
|
const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
|
||||||
{
|
{
|
||||||
rVisitor.visit(*this,rParentIt);
|
rVisitor.visit(*this,rParentIt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageElement::visitedBy( ElementTreeVisitor& rVisitor,
|
void ImageElement::visitedBy( ElementTreeVisitor& rVisitor,
|
||||||
const std::list< Element* >::const_iterator& rParentIt)
|
const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt)
|
||||||
{
|
{
|
||||||
rVisitor.visit( *this, rParentIt);
|
rVisitor.visit( *this, rParentIt);
|
||||||
}
|
}
|
||||||
@@ -153,7 +150,7 @@ void PolyPolyElement::updateGeometry()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PolyPolyElement::visitedBy( ElementTreeVisitor& rVisitor,
|
void PolyPolyElement::visitedBy( ElementTreeVisitor& rVisitor,
|
||||||
const std::list< Element* >::const_iterator& rParentIt)
|
const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt)
|
||||||
{
|
{
|
||||||
rVisitor.visit( *this, rParentIt);
|
rVisitor.visit( *this, rParentIt);
|
||||||
}
|
}
|
||||||
@@ -183,22 +180,22 @@ void PolyPolyElement::emitStructure( int nLevel)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ParagraphElement::visitedBy( ElementTreeVisitor& rVisitor,
|
void ParagraphElement::visitedBy( ElementTreeVisitor& rVisitor,
|
||||||
const std::list< Element* >::const_iterator& rParentIt )
|
const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
|
||||||
{
|
{
|
||||||
rVisitor.visit(*this,rParentIt);
|
rVisitor.visit(*this,rParentIt);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParagraphElement::isSingleLined( PDFIProcessor const & rProc ) const
|
bool ParagraphElement::isSingleLined( PDFIProcessor const & rProc ) const
|
||||||
{
|
{
|
||||||
std::list< Element* >::const_iterator it = Children.begin();
|
auto it = Children.begin();
|
||||||
TextElement* pText = nullptr, *pLastText = nullptr;
|
TextElement* pText = nullptr, *pLastText = nullptr;
|
||||||
while( it != Children.end() )
|
while( it != Children.end() )
|
||||||
{
|
{
|
||||||
// a paragraph containing subparagraphs cannot be single lined
|
// a paragraph containing subparagraphs cannot be single lined
|
||||||
if( dynamic_cast< ParagraphElement* >(*it) != nullptr )
|
if( dynamic_cast< ParagraphElement* >(it->get()) != nullptr )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
pText = dynamic_cast< TextElement* >(*it);
|
pText = dynamic_cast< TextElement* >(it->get());
|
||||||
if( pText )
|
if( pText )
|
||||||
{
|
{
|
||||||
const FontAttributes& rFont = rProc.getFont( pText->FontId );
|
const FontAttributes& rFont = rProc.getFont( pText->FontId );
|
||||||
@@ -223,9 +220,9 @@ bool ParagraphElement::isSingleLined( PDFIProcessor const & rProc ) const
|
|||||||
double ParagraphElement::getLineHeight( PDFIProcessor& rProc ) const
|
double ParagraphElement::getLineHeight( PDFIProcessor& rProc ) const
|
||||||
{
|
{
|
||||||
double line_h = 0;
|
double line_h = 0;
|
||||||
for( std::list< Element* >::const_iterator it = Children.begin(); it != Children.end(); ++it )
|
for( auto it = Children.begin(); it != Children.end(); ++it )
|
||||||
{
|
{
|
||||||
ParagraphElement* pPara = dynamic_cast< ParagraphElement* >(*it);
|
ParagraphElement* pPara = dynamic_cast< ParagraphElement* >(it->get());
|
||||||
TextElement* pText = nullptr;
|
TextElement* pText = nullptr;
|
||||||
if( pPara )
|
if( pPara )
|
||||||
{
|
{
|
||||||
@@ -233,7 +230,7 @@ double ParagraphElement::getLineHeight( PDFIProcessor& rProc ) const
|
|||||||
if( lh > line_h )
|
if( lh > line_h )
|
||||||
line_h = lh;
|
line_h = lh;
|
||||||
}
|
}
|
||||||
else if( (pText = dynamic_cast< TextElement* >( *it )) != nullptr )
|
else if( (pText = dynamic_cast< TextElement* >( it->get() )) != nullptr )
|
||||||
{
|
{
|
||||||
const FontAttributes& rFont = rProc.getFont( pText->FontId );
|
const FontAttributes& rFont = rProc.getFont( pText->FontId );
|
||||||
double lh = pText->h;
|
double lh = pText->h;
|
||||||
@@ -249,22 +246,20 @@ double ParagraphElement::getLineHeight( PDFIProcessor& rProc ) const
|
|||||||
TextElement* ParagraphElement::getFirstTextChild() const
|
TextElement* ParagraphElement::getFirstTextChild() const
|
||||||
{
|
{
|
||||||
TextElement* pText = nullptr;
|
TextElement* pText = nullptr;
|
||||||
for( std::list< Element* >::const_iterator it = Children.begin();
|
for( auto it = Children.begin();
|
||||||
it != Children.end() && ! pText; ++it )
|
it != Children.end() && ! pText; ++it )
|
||||||
{
|
{
|
||||||
pText = dynamic_cast<TextElement*>(*it);
|
pText = dynamic_cast<TextElement*>(it->get());
|
||||||
}
|
}
|
||||||
return pText;
|
return pText;
|
||||||
}
|
}
|
||||||
|
|
||||||
PageElement::~PageElement()
|
PageElement::~PageElement()
|
||||||
{
|
{
|
||||||
delete HeaderElement;
|
|
||||||
delete FooterElement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageElement::visitedBy( ElementTreeVisitor& rVisitor,
|
void PageElement::visitedBy( ElementTreeVisitor& rVisitor,
|
||||||
const std::list< Element* >::const_iterator& rParentIt )
|
const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
|
||||||
{
|
{
|
||||||
rVisitor.visit(*this, rParentIt);
|
rVisitor.visit(*this, rParentIt);
|
||||||
}
|
}
|
||||||
@@ -272,24 +267,24 @@ void PageElement::visitedBy( ElementTreeVisitor& rVisit
|
|||||||
void PageElement::updateParagraphGeometry( Element* pEle )
|
void PageElement::updateParagraphGeometry( Element* pEle )
|
||||||
{
|
{
|
||||||
// update geometry of children
|
// update geometry of children
|
||||||
for( std::list< Element* >::iterator it = pEle->Children.begin();
|
for( auto it = pEle->Children.begin();
|
||||||
it != pEle->Children.end(); ++it )
|
it != pEle->Children.end(); ++it )
|
||||||
{
|
{
|
||||||
updateParagraphGeometry( *it );
|
updateParagraphGeometry( it->get() );
|
||||||
}
|
}
|
||||||
// if this is a paragraph itself, then update according to children geometry
|
// if this is a paragraph itself, then update according to children geometry
|
||||||
if( dynamic_cast<ParagraphElement*>(pEle) )
|
if( dynamic_cast<ParagraphElement*>(pEle) )
|
||||||
{
|
{
|
||||||
for( std::list< Element* >::iterator it = pEle->Children.begin();
|
for( auto it = pEle->Children.begin();
|
||||||
it != pEle->Children.end(); ++it )
|
it != pEle->Children.end(); ++it )
|
||||||
{
|
{
|
||||||
Element* pChild = nullptr;
|
Element* pChild = nullptr;
|
||||||
TextElement* pText = dynamic_cast<TextElement*>(*it);
|
TextElement* pText = dynamic_cast<TextElement*>(it->get());
|
||||||
if( pText )
|
if( pText )
|
||||||
pChild = pText;
|
pChild = pText;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(*it);
|
ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(it->get());
|
||||||
if( pPara )
|
if( pPara )
|
||||||
pChild = pPara;
|
pChild = pPara;
|
||||||
}
|
}
|
||||||
@@ -299,18 +294,18 @@ void PageElement::updateParagraphGeometry( Element* pEle )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PageElement::resolveHyperlink( const std::list<Element*>::iterator& link_it, std::list<Element*>& rElements )
|
bool PageElement::resolveHyperlink( const std::list<std::unique_ptr<Element>>::iterator& link_it, std::list<std::unique_ptr<Element>>& rElements )
|
||||||
{
|
{
|
||||||
HyperlinkElement* pLink = dynamic_cast<HyperlinkElement*>(*link_it);
|
HyperlinkElement* pLink = dynamic_cast<HyperlinkElement*>(link_it->get());
|
||||||
if( ! pLink ) // sanity check
|
if( ! pLink ) // sanity check
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for( std::list<Element*>::iterator it = rElements.begin(); it != rElements.end(); ++it )
|
for( auto it = rElements.begin(); it != rElements.end(); ++it )
|
||||||
{
|
{
|
||||||
if( (*it)->x >= pLink->x && (*it)->x + (*it)->w <= pLink->x + pLink->w &&
|
if( (*it)->x >= pLink->x && (*it)->x + (*it)->w <= pLink->x + pLink->w &&
|
||||||
(*it)->y >= pLink->y && (*it)->y + (*it)->h <= pLink->y + pLink->h )
|
(*it)->y >= pLink->y && (*it)->y + (*it)->h <= pLink->y + pLink->h )
|
||||||
{
|
{
|
||||||
TextElement* pText = dynamic_cast<TextElement*>(*it);
|
TextElement* pText = dynamic_cast<TextElement*>(it->get());
|
||||||
if( pText )
|
if( pText )
|
||||||
{
|
{
|
||||||
if( pLink->Children.empty() )
|
if( pLink->Children.empty() )
|
||||||
@@ -320,7 +315,7 @@ bool PageElement::resolveHyperlink( const std::list<Element*>::iterator& link_it
|
|||||||
pLink->Parent = (*it)->Parent;
|
pLink->Parent = (*it)->Parent;
|
||||||
}
|
}
|
||||||
// move text element into hyperlink
|
// move text element into hyperlink
|
||||||
std::list<Element*>::iterator next = it;
|
auto next = it;
|
||||||
++next;
|
++next;
|
||||||
Element::setParent( it, pLink );
|
Element::setParent( it, pLink );
|
||||||
it = next;
|
it = next;
|
||||||
@@ -330,13 +325,13 @@ bool PageElement::resolveHyperlink( const std::list<Element*>::iterator& link_it
|
|||||||
// a link can contain multiple text elements or a single frame
|
// a link can contain multiple text elements or a single frame
|
||||||
if( ! pLink->Children.empty() )
|
if( ! pLink->Children.empty() )
|
||||||
continue;
|
continue;
|
||||||
if( dynamic_cast<ParagraphElement*>(*it) )
|
if( dynamic_cast<ParagraphElement*>(it->get()) )
|
||||||
{
|
{
|
||||||
if( resolveHyperlink( link_it, (*it)->Children ) )
|
if( resolveHyperlink( link_it, (*it)->Children ) )
|
||||||
break;
|
break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
FrameElement* pFrame = dynamic_cast<FrameElement*>(*it);
|
FrameElement* pFrame = dynamic_cast<FrameElement*>(it->get());
|
||||||
if( pFrame )
|
if( pFrame )
|
||||||
{
|
{
|
||||||
// insert the hyperlink before the frame
|
// insert the hyperlink before the frame
|
||||||
@@ -357,7 +352,6 @@ void PageElement::resolveHyperlinks()
|
|||||||
{
|
{
|
||||||
if( ! resolveHyperlink( Hyperlinks.Children.begin(), Children ) )
|
if( ! resolveHyperlink( Hyperlinks.Children.begin(), Children ) )
|
||||||
{
|
{
|
||||||
delete Hyperlinks.Children.front();
|
|
||||||
Hyperlinks.Children.pop_front();
|
Hyperlinks.Children.pop_front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -373,10 +367,10 @@ void PageElement::resolveUnderlines( PDFIProcessor const & rProc )
|
|||||||
// FIXME: currently the algorithm used is quadratic
|
// FIXME: currently the algorithm used is quadratic
|
||||||
// this could be solved by some sorting beforehand
|
// this could be solved by some sorting beforehand
|
||||||
|
|
||||||
std::list< Element* >::iterator poly_it = Children.begin();
|
auto poly_it = Children.begin();
|
||||||
while( poly_it != Children.end() )
|
while( poly_it != Children.end() )
|
||||||
{
|
{
|
||||||
PolyPolyElement* pPoly = dynamic_cast< PolyPolyElement* >(*poly_it);
|
PolyPolyElement* pPoly = dynamic_cast< PolyPolyElement* >(poly_it->get());
|
||||||
if( ! pPoly || ! pPoly->Children.empty() )
|
if( ! pPoly || ! pPoly->Children.empty() )
|
||||||
{
|
{
|
||||||
++poly_it;
|
++poly_it;
|
||||||
@@ -413,10 +407,10 @@ void PageElement::resolveUnderlines( PDFIProcessor const & rProc )
|
|||||||
u_y = r_x; r_x = l_x; l_x = u_y;
|
u_y = r_x; r_x = l_x; l_x = u_y;
|
||||||
}
|
}
|
||||||
u_y = aPoly.getB2DPoint(0).getY();
|
u_y = aPoly.getB2DPoint(0).getY();
|
||||||
for( std::list< Element*>::iterator it = Children.begin();
|
for( auto it = Children.begin();
|
||||||
it != Children.end(); ++it )
|
it != Children.end(); ++it )
|
||||||
{
|
{
|
||||||
Element* pEle = *it;
|
Element* pEle = it->get();
|
||||||
if( pEle->y <= u_y && pEle->y + pEle->h*1.1 >= u_y )
|
if( pEle->y <= u_y && pEle->y + pEle->h*1.1 >= u_y )
|
||||||
{
|
{
|
||||||
// first: is the element underlined completely ?
|
// first: is the element underlined completely ?
|
||||||
@@ -450,7 +444,7 @@ void PageElement::resolveUnderlines( PDFIProcessor const & rProc )
|
|||||||
}
|
}
|
||||||
if( bRemovePoly )
|
if( bRemovePoly )
|
||||||
{
|
{
|
||||||
std::list< Element* >::iterator next_it = poly_it;
|
auto next_it = poly_it;
|
||||||
++next_it;
|
++next_it;
|
||||||
Children.erase( poly_it );
|
Children.erase( poly_it );
|
||||||
delete pPoly;
|
delete pPoly;
|
||||||
@@ -466,7 +460,7 @@ DocumentElement::~DocumentElement()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DocumentElement::visitedBy( ElementTreeVisitor& rVisitor,
|
void DocumentElement::visitedBy( ElementTreeVisitor& rVisitor,
|
||||||
const std::list< Element* >::const_iterator& rParentIt)
|
const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt)
|
||||||
{
|
{
|
||||||
rVisitor.visit(*this, rParentIt);
|
rVisitor.visit(*this, rParentIt);
|
||||||
}
|
}
|
||||||
|
@@ -543,7 +543,7 @@ void PDFIProcessor::emit( XmlEmitter& rEmitter,
|
|||||||
rVisitorFactory.createOptimizingVisitor(*this));
|
rVisitorFactory.createOptimizingVisitor(*this));
|
||||||
// FIXME: localization
|
// FIXME: localization
|
||||||
startIndicator( " " );
|
startIndicator( " " );
|
||||||
m_pDocument->visitedBy( *optimizingVisitor, std::list<Element*>::const_iterator());
|
m_pDocument->visitedBy( *optimizingVisitor, std::list<std::unique_ptr<Element>>::const_iterator());
|
||||||
|
|
||||||
#if OSL_DEBUG_LEVEL > 0
|
#if OSL_DEBUG_LEVEL > 0
|
||||||
m_pDocument->emitStructure( 0 );
|
m_pDocument->emitStructure( 0 );
|
||||||
@@ -555,7 +555,7 @@ void PDFIProcessor::emit( XmlEmitter& rEmitter,
|
|||||||
rVisitorFactory.createStyleCollectingVisitor(aStyles,*this));
|
rVisitorFactory.createStyleCollectingVisitor(aStyles,*this));
|
||||||
// FIXME: localization
|
// FIXME: localization
|
||||||
|
|
||||||
m_pDocument->visitedBy( *finalizingVisitor, std::list<Element*>::const_iterator() );
|
m_pDocument->visitedBy( *finalizingVisitor, std::list<std::unique_ptr<Element>>::const_iterator() );
|
||||||
|
|
||||||
EmitContext aContext( rEmitter, aStyles, m_aImages, *this, m_xStatusIndicator, m_xContext );
|
EmitContext aContext( rEmitter, aStyles, m_aImages, *this, m_xStatusIndicator, m_xContext );
|
||||||
ElementTreeVisitorSharedPtr aEmittingVisitor(
|
ElementTreeVisitorSharedPtr aEmittingVisitor(
|
||||||
@@ -589,7 +589,7 @@ void PDFIProcessor::emit( XmlEmitter& rEmitter,
|
|||||||
// emit style list
|
// emit style list
|
||||||
aStyles.emit( aContext, *aEmittingVisitor );
|
aStyles.emit( aContext, *aEmittingVisitor );
|
||||||
|
|
||||||
m_pDocument->visitedBy( *aEmittingVisitor, std::list<Element*>::const_iterator() );
|
m_pDocument->visitedBy( *aEmittingVisitor, std::list<std::unique_ptr<Element>>::const_iterator() );
|
||||||
aContext.rEmitter.endTag( "office:document" );
|
aContext.rEmitter.endTag( "office:document" );
|
||||||
endIndicator();
|
endIndicator();
|
||||||
}
|
}
|
||||||
@@ -625,7 +625,7 @@ void PDFIProcessor::endIndicator()
|
|||||||
m_xStatusIndicator->end();
|
m_xStatusIndicator->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool lr_tb_sort( Element* pLeft, Element* pRight )
|
static bool lr_tb_sort( std::unique_ptr<Element> const & pLeft, std::unique_ptr<Element> const & pRight )
|
||||||
{
|
{
|
||||||
// Ensure irreflexivity (which could be compromised if h or w is negative):
|
// Ensure irreflexivity (which could be compromised if h or w is negative):
|
||||||
if (pLeft == pRight)
|
if (pLeft == pRight)
|
||||||
@@ -637,9 +637,9 @@ static bool lr_tb_sort( Element* pLeft, Element* pRight )
|
|||||||
// of the same order as font height whereas the real paint area
|
// of the same order as font height whereas the real paint area
|
||||||
// of text is usually smaller
|
// of text is usually smaller
|
||||||
double fudge_factor_left = 0.0, fudge_factor_right = 0.0;
|
double fudge_factor_left = 0.0, fudge_factor_right = 0.0;
|
||||||
if( dynamic_cast< TextElement* >(pLeft) )
|
if( dynamic_cast< TextElement* >(pLeft.get()) )
|
||||||
fudge_factor_left = 0.1;
|
fudge_factor_left = 0.1;
|
||||||
if (dynamic_cast< TextElement* >(pRight))
|
if (dynamic_cast< TextElement* >(pRight.get()))
|
||||||
fudge_factor_right = 0.1;
|
fudge_factor_right = 0.1;
|
||||||
|
|
||||||
// Allow negative height
|
// Allow negative height
|
||||||
|
@@ -201,7 +201,7 @@ void StyleContainer::impl_emitStyle( sal_Int32 nStyleId,
|
|||||||
rContext.rEmitter.write( rStyle.Contents );
|
rContext.rEmitter.write( rStyle.Contents );
|
||||||
if( rStyle.ContainedElement )
|
if( rStyle.ContainedElement )
|
||||||
rStyle.ContainedElement->visitedBy( rContainedElemVisitor,
|
rStyle.ContainedElement->visitedBy( rContainedElemVisitor,
|
||||||
std::list<Element*>::iterator() );
|
std::list<std::unique_ptr<Element>>::iterator() );
|
||||||
rContext.rEmitter.endTag( rStyle.Name.getStr() );
|
rContext.rEmitter.endTag( rStyle.Name.getStr() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,12 +36,12 @@ using namespace ::com::sun::star;
|
|||||||
namespace pdfi
|
namespace pdfi
|
||||||
{
|
{
|
||||||
|
|
||||||
void WriterXmlEmitter::visit( HyperlinkElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlEmitter::visit( HyperlinkElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
if( elem.Children.empty() )
|
if( elem.Children.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const char* pType = dynamic_cast<DrawElement*>(elem.Children.front()) ? "draw:a" : "text:a";
|
const char* pType = dynamic_cast<DrawElement*>(elem.Children.front().get()) ? "draw:a" : "text:a";
|
||||||
|
|
||||||
PropertyMap aProps;
|
PropertyMap aProps;
|
||||||
aProps[ "xlink:type" ] = "simple";
|
aProps[ "xlink:type" ] = "simple";
|
||||||
@@ -50,8 +50,8 @@ void WriterXmlEmitter::visit( HyperlinkElement& elem, const std::list< Element*
|
|||||||
aProps[ "xlink:show" ] = "new";
|
aProps[ "xlink:show" ] = "new";
|
||||||
|
|
||||||
m_rEmitContext.rEmitter.beginTag( pType, aProps );
|
m_rEmitContext.rEmitter.beginTag( pType, aProps );
|
||||||
std::list< Element* >::iterator this_it = elem.Children.begin();
|
auto this_it = elem.Children.begin();
|
||||||
while( this_it !=elem.Children.end() && *this_it != &elem )
|
while( this_it != elem.Children.end() && this_it->get() != &elem )
|
||||||
{
|
{
|
||||||
(*this_it)->visitedBy( *this, this_it );
|
(*this_it)->visitedBy( *this, this_it );
|
||||||
++this_it;
|
++this_it;
|
||||||
@@ -59,7 +59,7 @@ void WriterXmlEmitter::visit( HyperlinkElement& elem, const std::list< Element*
|
|||||||
m_rEmitContext.rEmitter.endTag( pType );
|
m_rEmitContext.rEmitter.endTag( pType );
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlEmitter::visit( TextElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlEmitter::visit( TextElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
if( elem.Text.isEmpty() )
|
if( elem.Text.isEmpty() )
|
||||||
return;
|
return;
|
||||||
@@ -73,8 +73,8 @@ void WriterXmlEmitter::visit( TextElement& elem, const std::list< Element* >::co
|
|||||||
|
|
||||||
m_rEmitContext.rEmitter.beginTag( "text:span", aProps );
|
m_rEmitContext.rEmitter.beginTag( "text:span", aProps );
|
||||||
m_rEmitContext.rEmitter.write( elem.Text.makeStringAndClear() );
|
m_rEmitContext.rEmitter.write( elem.Text.makeStringAndClear() );
|
||||||
std::list< Element* >::iterator this_it = elem.Children.begin();
|
auto this_it = elem.Children.begin();
|
||||||
while( this_it !=elem.Children.end() && *this_it != &elem )
|
while( this_it != elem.Children.end() && this_it->get() != &elem )
|
||||||
{
|
{
|
||||||
(*this_it)->visitedBy( *this, this_it );
|
(*this_it)->visitedBy( *this, this_it );
|
||||||
++this_it;
|
++this_it;
|
||||||
@@ -83,7 +83,7 @@ void WriterXmlEmitter::visit( TextElement& elem, const std::list< Element* >::co
|
|||||||
m_rEmitContext.rEmitter.endTag( "text:span" );
|
m_rEmitContext.rEmitter.endTag( "text:span" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlEmitter::visit( ParagraphElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlEmitter::visit( ParagraphElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
PropertyMap aProps;
|
PropertyMap aProps;
|
||||||
if( elem.StyleId != -1 )
|
if( elem.StyleId != -1 )
|
||||||
@@ -95,8 +95,8 @@ void WriterXmlEmitter::visit( ParagraphElement& elem, const std::list< Element*
|
|||||||
pTagType = "text:h";
|
pTagType = "text:h";
|
||||||
m_rEmitContext.rEmitter.beginTag( pTagType, aProps );
|
m_rEmitContext.rEmitter.beginTag( pTagType, aProps );
|
||||||
|
|
||||||
std::list< Element* >::iterator this_it = elem.Children.begin();
|
auto this_it = elem.Children.begin();
|
||||||
while( this_it !=elem.Children.end() && *this_it != &elem )
|
while( this_it != elem.Children.end() && this_it->get() != &elem )
|
||||||
{
|
{
|
||||||
(*this_it)->visitedBy( *this, this_it );
|
(*this_it)->visitedBy( *this, this_it );
|
||||||
++this_it;
|
++this_it;
|
||||||
@@ -203,20 +203,20 @@ void WriterXmlEmitter::fillFrameProps( DrawElement& rElem,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlEmitter::visit( FrameElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlEmitter::visit( FrameElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
if( elem.Children.empty() )
|
if( elem.Children.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool bTextBox = (dynamic_cast<ParagraphElement*>(elem.Children.front()) != nullptr);
|
bool bTextBox = (dynamic_cast<ParagraphElement*>(elem.Children.front().get()) != nullptr);
|
||||||
PropertyMap aFrameProps;
|
PropertyMap aFrameProps;
|
||||||
fillFrameProps( elem, aFrameProps, m_rEmitContext );
|
fillFrameProps( elem, aFrameProps, m_rEmitContext );
|
||||||
m_rEmitContext.rEmitter.beginTag( "draw:frame", aFrameProps );
|
m_rEmitContext.rEmitter.beginTag( "draw:frame", aFrameProps );
|
||||||
if( bTextBox )
|
if( bTextBox )
|
||||||
m_rEmitContext.rEmitter.beginTag( "draw:text-box", PropertyMap() );
|
m_rEmitContext.rEmitter.beginTag( "draw:text-box", PropertyMap() );
|
||||||
|
|
||||||
std::list< Element* >::iterator this_it = elem.Children.begin();
|
auto this_it = elem.Children.begin();
|
||||||
while( this_it !=elem.Children.end() && *this_it != &elem )
|
while( this_it != elem.Children.end() && this_it->get() != &elem )
|
||||||
{
|
{
|
||||||
(*this_it)->visitedBy( *this, this_it );
|
(*this_it)->visitedBy( *this, this_it );
|
||||||
++this_it;
|
++this_it;
|
||||||
@@ -227,7 +227,7 @@ void WriterXmlEmitter::visit( FrameElement& elem, const std::list< Element* >::c
|
|||||||
m_rEmitContext.rEmitter.endTag( "draw:frame" );
|
m_rEmitContext.rEmitter.endTag( "draw:frame" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlEmitter::visit( PolyPolyElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlEmitter::visit( PolyPolyElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
elem.updateGeometry();
|
elem.updateGeometry();
|
||||||
/* note:
|
/* note:
|
||||||
@@ -293,7 +293,7 @@ void WriterXmlEmitter::visit( PolyPolyElement& elem, const std::list< Element* >
|
|||||||
m_rEmitContext.rEmitter.endTag( "draw:path" );
|
m_rEmitContext.rEmitter.endTag( "draw:path" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlEmitter::visit( ImageElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlEmitter::visit( ImageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
PropertyMap aImageProps;
|
PropertyMap aImageProps;
|
||||||
m_rEmitContext.rEmitter.beginTag( "draw:image", aImageProps );
|
m_rEmitContext.rEmitter.beginTag( "draw:image", aImageProps );
|
||||||
@@ -303,34 +303,34 @@ void WriterXmlEmitter::visit( ImageElement& elem, const std::list< Element* >::c
|
|||||||
m_rEmitContext.rEmitter.endTag( "draw:image" );
|
m_rEmitContext.rEmitter.endTag( "draw:image" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlEmitter::visit( PageElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlEmitter::visit( PageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
if( m_rEmitContext.xStatusIndicator.is() )
|
if( m_rEmitContext.xStatusIndicator.is() )
|
||||||
m_rEmitContext.xStatusIndicator->setValue( elem.PageNumber );
|
m_rEmitContext.xStatusIndicator->setValue( elem.PageNumber );
|
||||||
|
|
||||||
std::list< Element* >::iterator this_it = elem.Children.begin();
|
auto this_it = elem.Children.begin();
|
||||||
while( this_it !=elem.Children.end() && *this_it != &elem )
|
while( this_it != elem.Children.end() && this_it->get() != &elem )
|
||||||
{
|
{
|
||||||
(*this_it)->visitedBy( *this, this_it );
|
(*this_it)->visitedBy( *this, this_it );
|
||||||
++this_it;
|
++this_it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlEmitter::visit( DocumentElement& elem, const std::list< Element* >::const_iterator&)
|
void WriterXmlEmitter::visit( DocumentElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator&)
|
||||||
{
|
{
|
||||||
m_rEmitContext.rEmitter.beginTag( "office:body", PropertyMap() );
|
m_rEmitContext.rEmitter.beginTag( "office:body", PropertyMap() );
|
||||||
m_rEmitContext.rEmitter.beginTag( "office:text", PropertyMap() );
|
m_rEmitContext.rEmitter.beginTag( "office:text", PropertyMap() );
|
||||||
|
|
||||||
for( std::list< Element* >::iterator it = elem.Children.begin(); it != elem.Children.end(); ++it )
|
for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
|
||||||
{
|
{
|
||||||
PageElement* pPage = dynamic_cast<PageElement*>(*it);
|
PageElement* pPage = dynamic_cast<PageElement*>(it->get());
|
||||||
if( pPage )
|
if( pPage )
|
||||||
{
|
{
|
||||||
// emit only page anchored objects
|
// emit only page anchored objects
|
||||||
// currently these are only DrawElement types
|
// currently these are only DrawElement types
|
||||||
for( std::list< Element* >::iterator child_it = pPage->Children.begin(); child_it != pPage->Children.end(); ++child_it )
|
for( auto child_it = pPage->Children.begin(); child_it != pPage->Children.end(); ++child_it )
|
||||||
{
|
{
|
||||||
if( dynamic_cast<DrawElement*>(*child_it) != nullptr )
|
if( dynamic_cast<DrawElement*>(child_it->get()) != nullptr )
|
||||||
(*child_it)->visitedBy( *this, child_it );
|
(*child_it)->visitedBy( *this, child_it );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -339,9 +339,9 @@ void WriterXmlEmitter::visit( DocumentElement& elem, const std::list< Element* >
|
|||||||
// do not emit page anchored objects, they are emitted before
|
// do not emit page anchored objects, they are emitted before
|
||||||
// (must precede all pages in writer document) currently these are
|
// (must precede all pages in writer document) currently these are
|
||||||
// only DrawElement types
|
// only DrawElement types
|
||||||
for( std::list< Element* >::iterator it = elem.Children.begin(); it != elem.Children.end(); ++it )
|
for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
|
||||||
{
|
{
|
||||||
if( dynamic_cast<DrawElement*>(*it) == nullptr )
|
if( dynamic_cast<DrawElement*>(it->get()) == nullptr )
|
||||||
(*it)->visitedBy( *this, it );
|
(*it)->visitedBy( *this, it );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,24 +350,24 @@ void WriterXmlEmitter::visit( DocumentElement& elem, const std::list< Element* >
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WriterXmlOptimizer::visit( HyperlinkElement&, const std::list< Element* >::const_iterator& )
|
void WriterXmlOptimizer::visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlOptimizer::visit( TextElement&, const std::list< Element* >::const_iterator&)
|
void WriterXmlOptimizer::visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlOptimizer::visit( FrameElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlOptimizer::visit( FrameElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlOptimizer::visit( ImageElement&, const std::list< Element* >::const_iterator& )
|
void WriterXmlOptimizer::visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element* >::const_iterator& elemIt )
|
void WriterXmlOptimizer::visit( PolyPolyElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& elemIt )
|
||||||
{
|
{
|
||||||
/* note: optimize two consecutive PolyPolyElements that
|
/* note: optimize two consecutive PolyPolyElements that
|
||||||
* have the same path but one of which is a stroke while
|
* have the same path but one of which is a stroke while
|
||||||
@@ -378,12 +378,12 @@ void WriterXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element*
|
|||||||
// find following PolyPolyElement in parent's children list
|
// find following PolyPolyElement in parent's children list
|
||||||
if( elemIt == elem.Parent->Children.end() )
|
if( elemIt == elem.Parent->Children.end() )
|
||||||
return;
|
return;
|
||||||
std::list< Element* >::const_iterator next_it = elemIt;
|
auto next_it = elemIt;
|
||||||
++next_it;
|
++next_it;
|
||||||
if( next_it == elem.Parent->Children.end() )
|
if( next_it == elem.Parent->Children.end() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PolyPolyElement* pNext = dynamic_cast<PolyPolyElement*>(*next_it);
|
PolyPolyElement* pNext = dynamic_cast<PolyPolyElement*>(next_it->get());
|
||||||
if( !pNext || pNext->PolyPoly != elem.PolyPoly )
|
if( !pNext || pNext->PolyPoly != elem.PolyPoly )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -413,7 +413,7 @@ void WriterXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element*
|
|||||||
elem.Children.splice( elem.Children.end(), pNext->Children );
|
elem.Children.splice( elem.Children.end(), pNext->Children );
|
||||||
// workaround older compilers that do not have std::list::erase(const_iterator)
|
// workaround older compilers that do not have std::list::erase(const_iterator)
|
||||||
#if HAVE_BROKEN_CONST_ITERATORS
|
#if HAVE_BROKEN_CONST_ITERATORS
|
||||||
std::list< Element* >::iterator tmpIt = elem.Parent->Children.begin();
|
auto tmpIt = elem.Parent->Children.begin();
|
||||||
std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
|
std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
|
||||||
elem.Parent->Children.erase(tmpIt);
|
elem.Parent->Children.erase(tmpIt);
|
||||||
#else
|
#else
|
||||||
@@ -423,7 +423,7 @@ void WriterXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlOptimizer::visit( ParagraphElement& elem, const std::list< Element* >::const_iterator& rParentIt)
|
void WriterXmlOptimizer::visit( ParagraphElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt)
|
||||||
{
|
{
|
||||||
optimizeTextElements( elem );
|
optimizeTextElements( elem );
|
||||||
|
|
||||||
@@ -432,12 +432,12 @@ void WriterXmlOptimizer::visit( ParagraphElement& elem, const std::list< Element
|
|||||||
if( elem.Parent && rParentIt != elem.Parent->Children.end() )
|
if( elem.Parent && rParentIt != elem.Parent->Children.end() )
|
||||||
{
|
{
|
||||||
// find if there is a previous paragraph that might be a heading for this one
|
// find if there is a previous paragraph that might be a heading for this one
|
||||||
std::list<Element*>::const_iterator prev = rParentIt;
|
auto prev = rParentIt;
|
||||||
ParagraphElement* pPrevPara = nullptr;
|
ParagraphElement* pPrevPara = nullptr;
|
||||||
while( prev != elem.Parent->Children.begin() )
|
while( prev != elem.Parent->Children.begin() )
|
||||||
{
|
{
|
||||||
--prev;
|
--prev;
|
||||||
pPrevPara = dynamic_cast< ParagraphElement* >(*prev);
|
pPrevPara = dynamic_cast< ParagraphElement* >(prev->get());
|
||||||
if( pPrevPara )
|
if( pPrevPara )
|
||||||
{
|
{
|
||||||
/* What constitutes a heading ? current hints are:
|
/* What constitutes a heading ? current hints are:
|
||||||
@@ -480,7 +480,7 @@ void WriterXmlOptimizer::visit( ParagraphElement& elem, const std::list< Element
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlOptimizer::visit( PageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
if( m_rProcessor.getStatusIndicator().is() )
|
if( m_rProcessor.getStatusIndicator().is() )
|
||||||
m_rProcessor.getStatusIndicator()->setValue( elem.PageNumber );
|
m_rProcessor.getStatusIndicator()->setValue( elem.PageNumber );
|
||||||
@@ -496,7 +496,7 @@ void WriterXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::
|
|||||||
|
|
||||||
// find paragraphs in text
|
// find paragraphs in text
|
||||||
ParagraphElement* pCurPara = nullptr;
|
ParagraphElement* pCurPara = nullptr;
|
||||||
std::list< Element* >::iterator page_element, next_page_element;
|
std::list< std::unique_ptr<Element> >::iterator page_element, next_page_element;
|
||||||
next_page_element = elem.Children.begin();
|
next_page_element = elem.Children.begin();
|
||||||
double fCurLineHeight = 0.0; // average height of text items in current para
|
double fCurLineHeight = 0.0; // average height of text items in current para
|
||||||
int nCurLineElements = 0; // number of line contributing elements in current para
|
int nCurLineElements = 0; // number of line contributing elements in current para
|
||||||
@@ -506,17 +506,17 @@ void WriterXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::
|
|||||||
while( next_page_element != elem.Children.end() )
|
while( next_page_element != elem.Children.end() )
|
||||||
{
|
{
|
||||||
page_element = next_page_element++;
|
page_element = next_page_element++;
|
||||||
ParagraphElement* pPagePara = dynamic_cast<ParagraphElement*>(*page_element);
|
ParagraphElement* pPagePara = dynamic_cast<ParagraphElement*>(page_element->get());
|
||||||
if( pPagePara )
|
if( pPagePara )
|
||||||
{
|
{
|
||||||
pCurPara = pPagePara;
|
pCurPara = pPagePara;
|
||||||
// adjust line height and text items
|
// adjust line height and text items
|
||||||
fCurLineHeight = 0.0;
|
fCurLineHeight = 0.0;
|
||||||
nCurLineElements = 0;
|
nCurLineElements = 0;
|
||||||
for( std::list< Element* >::iterator it = pCurPara->Children.begin();
|
for( auto it = pCurPara->Children.begin();
|
||||||
it != pCurPara->Children.end(); ++it )
|
it != pCurPara->Children.end(); ++it )
|
||||||
{
|
{
|
||||||
TextElement* pTestText = dynamic_cast<TextElement*>(*it);
|
TextElement* pTestText = dynamic_cast<TextElement*>(it->get());
|
||||||
if( pTestText )
|
if( pTestText )
|
||||||
{
|
{
|
||||||
fCurLineHeight = (fCurLineHeight*double(nCurLineElements) + pTestText->h)/double(nCurLineElements+1);
|
fCurLineHeight = (fCurLineHeight*double(nCurLineElements) + pTestText->h)/double(nCurLineElements+1);
|
||||||
@@ -526,10 +526,10 @@ void WriterXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
HyperlinkElement* pLink = dynamic_cast<HyperlinkElement*>(*page_element);
|
HyperlinkElement* pLink = dynamic_cast<HyperlinkElement*>(page_element->get());
|
||||||
DrawElement* pDraw = dynamic_cast<DrawElement*>(*page_element);
|
DrawElement* pDraw = dynamic_cast<DrawElement*>(page_element->get());
|
||||||
if( ! pDraw && pLink && ! pLink->Children.empty() )
|
if( ! pDraw && pLink && ! pLink->Children.empty() )
|
||||||
pDraw = dynamic_cast<DrawElement*>(pLink->Children.front() );
|
pDraw = dynamic_cast<DrawElement*>(pLink->Children.front().get() );
|
||||||
if( pDraw )
|
if( pDraw )
|
||||||
{
|
{
|
||||||
// insert small drawing objects as character, else leave them page bound
|
// insert small drawing objects as character, else leave them page bound
|
||||||
@@ -550,12 +550,12 @@ void WriterXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::
|
|||||||
// or perhaps the draw element begins a new paragraph
|
// or perhaps the draw element begins a new paragraph
|
||||||
else if( next_page_element != elem.Children.end() )
|
else if( next_page_element != elem.Children.end() )
|
||||||
{
|
{
|
||||||
TextElement* pText = dynamic_cast<TextElement*>(*next_page_element);
|
TextElement* pText = dynamic_cast<TextElement*>(next_page_element->get());
|
||||||
if( ! pText )
|
if( ! pText )
|
||||||
{
|
{
|
||||||
ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(*next_page_element);
|
ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(next_page_element->get());
|
||||||
if( pPara && ! pPara->Children.empty() )
|
if( pPara && ! pPara->Children.empty() )
|
||||||
pText = dynamic_cast<TextElement*>(pPara->Children.front());
|
pText = dynamic_cast<TextElement*>(pPara->Children.front().get());
|
||||||
}
|
}
|
||||||
if( pText && // check there is a text
|
if( pText && // check there is a text
|
||||||
pDraw->h < pText->h*1.5 && // and it is approx the same height
|
pDraw->h < pText->h*1.5 && // and it is approx the same height
|
||||||
@@ -584,9 +584,9 @@ void WriterXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextElement* pText = dynamic_cast<TextElement*>(*page_element);
|
TextElement* pText = dynamic_cast<TextElement*>(page_element->get());
|
||||||
if( ! pText && pLink && ! pLink->Children.empty() )
|
if( ! pText && pLink && ! pLink->Children.empty() )
|
||||||
pText = dynamic_cast<TextElement*>(pLink->Children.front());
|
pText = dynamic_cast<TextElement*>(pLink->Children.front().get());
|
||||||
if( pText )
|
if( pText )
|
||||||
{
|
{
|
||||||
Element* pGeo = pLink ? static_cast<Element*>(pLink) :
|
Element* pGeo = pLink ? static_cast<Element*>(pLink) :
|
||||||
@@ -638,14 +638,14 @@ void WriterXmlOptimizer::visit( PageElement& elem, const std::list< Element* >::
|
|||||||
// set parent
|
// set parent
|
||||||
pCurPara->Parent = &elem;
|
pCurPara->Parent = &elem;
|
||||||
//insert new paragraph before current element
|
//insert new paragraph before current element
|
||||||
page_element = elem.Children.insert( page_element, pCurPara );
|
page_element = elem.Children.insert( page_element, std::unique_ptr<Element>(pCurPara) );
|
||||||
// forward iterator to current element again
|
// forward iterator to current element again
|
||||||
++ page_element;
|
++ page_element;
|
||||||
// update next_element which is now invalid
|
// update next_element which is now invalid
|
||||||
next_page_element = page_element;
|
next_page_element = page_element;
|
||||||
++ next_page_element;
|
++ next_page_element;
|
||||||
}
|
}
|
||||||
Element* pCurEle = *page_element;
|
Element* pCurEle = page_element->get();
|
||||||
Element::setParent( page_element, pCurPara );
|
Element::setParent( page_element, pCurPara );
|
||||||
OSL_ENSURE( !pText || pCurEle == pText || pCurEle == pLink, "paragraph child list in disorder" );
|
OSL_ENSURE( !pText || pCurEle == pText || pCurEle == pLink, "paragraph child list in disorder" );
|
||||||
if( pText || pDraw )
|
if( pText || pDraw )
|
||||||
@@ -673,25 +673,25 @@ void WriterXmlOptimizer::checkHeaderAndFooter( PageElement& rElem )
|
|||||||
// detect header
|
// detect header
|
||||||
// Note: the following assumes that the pages' children have been
|
// Note: the following assumes that the pages' children have been
|
||||||
// sorted geometrically
|
// sorted geometrically
|
||||||
std::list< Element* >::iterator it = rElem.Children.begin();
|
auto it = rElem.Children.begin();
|
||||||
while( it != rElem.Children.end() )
|
while( it != rElem.Children.end() )
|
||||||
{
|
{
|
||||||
ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(*it);
|
ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(it->get());
|
||||||
if( pPara )
|
if( pPara )
|
||||||
{
|
{
|
||||||
if( pPara->y+pPara->h < rElem.h*0.15 && pPara->isSingleLined( m_rProcessor ) )
|
if( pPara->y+pPara->h < rElem.h*0.15 && pPara->isSingleLined( m_rProcessor ) )
|
||||||
{
|
{
|
||||||
std::list< Element* >::iterator next_it = it;
|
auto next_it = it;
|
||||||
ParagraphElement* pNextPara = nullptr;
|
ParagraphElement* pNextPara = nullptr;
|
||||||
while( ++next_it != rElem.Children.end() && pNextPara == nullptr )
|
while( ++next_it != rElem.Children.end() && pNextPara == nullptr )
|
||||||
{
|
{
|
||||||
pNextPara = dynamic_cast<ParagraphElement*>(*next_it);
|
pNextPara = dynamic_cast<ParagraphElement*>(next_it->get());
|
||||||
}
|
}
|
||||||
if( pNextPara && pNextPara->y > pPara->y+pPara->h*2 )
|
if( pNextPara && pNextPara->y > pPara->y+pPara->h*2 )
|
||||||
{
|
{
|
||||||
rElem.HeaderElement = pPara;
|
rElem.HeaderElement = std::move(*it);
|
||||||
pPara->Parent = nullptr;
|
pPara->Parent = nullptr;
|
||||||
rElem.Children.remove( pPara );
|
rElem.Children.erase( it );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -700,25 +700,25 @@ void WriterXmlOptimizer::checkHeaderAndFooter( PageElement& rElem )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// detect footer
|
// detect footer
|
||||||
std::list< Element* >::reverse_iterator rit = rElem.Children.rbegin();
|
std::list< std::unique_ptr<Element> >::reverse_iterator rit = rElem.Children.rbegin();
|
||||||
while( rit != rElem.Children.rend() )
|
while( rit != rElem.Children.rend() )
|
||||||
{
|
{
|
||||||
ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(*rit);
|
ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(rit->get());
|
||||||
if( pPara )
|
if( pPara )
|
||||||
{
|
{
|
||||||
if( pPara->y > rElem.h*0.85 && pPara->isSingleLined( m_rProcessor ) )
|
if( pPara->y > rElem.h*0.85 && pPara->isSingleLined( m_rProcessor ) )
|
||||||
{
|
{
|
||||||
std::list< Element* >::reverse_iterator next_it = rit;
|
std::list< std::unique_ptr<Element> >::reverse_iterator next_it = rit;
|
||||||
ParagraphElement* pNextPara = nullptr;
|
ParagraphElement* pNextPara = nullptr;
|
||||||
while( ++next_it != rElem.Children.rend() && pNextPara == nullptr )
|
while( ++next_it != rElem.Children.rend() && pNextPara == nullptr )
|
||||||
{
|
{
|
||||||
pNextPara = dynamic_cast<ParagraphElement*>(*next_it);
|
pNextPara = dynamic_cast<ParagraphElement*>(next_it->get());
|
||||||
}
|
}
|
||||||
if( pNextPara && pNextPara->y < pPara->y-pPara->h*2 )
|
if( pNextPara && pNextPara->y < pPara->y-pPara->h*2 )
|
||||||
{
|
{
|
||||||
rElem.FooterElement = pPara;
|
rElem.FooterElement = std::move(*rit);
|
||||||
pPara->Parent = nullptr;
|
pPara->Parent = nullptr;
|
||||||
rElem.Children.remove( pPara );
|
rElem.Children.erase( std::next(rit).base() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -736,8 +736,8 @@ void WriterXmlOptimizer::optimizeTextElements(Element& rParent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// concatenate child elements with same font id
|
// concatenate child elements with same font id
|
||||||
std::list< Element* >::iterator next = rParent.Children.begin();
|
auto next = rParent.Children.begin();
|
||||||
std::list< Element* >::iterator it = next++;
|
auto it = next++;
|
||||||
FrameElement* pFrame = dynamic_cast<FrameElement*>(rParent.Parent);
|
FrameElement* pFrame = dynamic_cast<FrameElement*>(rParent.Parent);
|
||||||
bool bRotatedFrame = false;
|
bool bRotatedFrame = false;
|
||||||
if( pFrame )
|
if( pFrame )
|
||||||
@@ -749,10 +749,10 @@ void WriterXmlOptimizer::optimizeTextElements(Element& rParent)
|
|||||||
while( next != rParent.Children.end() )
|
while( next != rParent.Children.end() )
|
||||||
{
|
{
|
||||||
bool bConcat = false;
|
bool bConcat = false;
|
||||||
TextElement* pCur = dynamic_cast<TextElement*>(*it);
|
TextElement* pCur = dynamic_cast<TextElement*>(it->get());
|
||||||
if( pCur )
|
if( pCur )
|
||||||
{
|
{
|
||||||
TextElement* pNext = dynamic_cast<TextElement*>(*next);
|
TextElement* pNext = dynamic_cast<TextElement*>(next->get());
|
||||||
if( pNext )
|
if( pNext )
|
||||||
{
|
{
|
||||||
const GraphicsContext& rCurGC = m_rProcessor.getGraphicsContext( pCur->GCId );
|
const GraphicsContext& rCurGC = m_rProcessor.getGraphicsContext( pCur->GCId );
|
||||||
@@ -824,7 +824,7 @@ void WriterXmlOptimizer::optimizeTextElements(Element& rParent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( dynamic_cast<HyperlinkElement*>(*it) )
|
else if( dynamic_cast<HyperlinkElement*>(it->get()) )
|
||||||
optimizeTextElements( **it );
|
optimizeTextElements( **it );
|
||||||
if( bConcat )
|
if( bConcat )
|
||||||
{
|
{
|
||||||
@@ -839,13 +839,13 @@ void WriterXmlOptimizer::optimizeTextElements(Element& rParent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlOptimizer::visit( DocumentElement& elem, const std::list< Element* >::const_iterator&)
|
void WriterXmlOptimizer::visit( DocumentElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator&)
|
||||||
{
|
{
|
||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WriterXmlFinalizer::visit( PolyPolyElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlFinalizer::visit( PolyPolyElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
// xxx TODO copied from DrawElement
|
// xxx TODO copied from DrawElement
|
||||||
const GraphicsContext& rGC = m_rProcessor.getGraphicsContext(elem.GCId );
|
const GraphicsContext& rGC = m_rProcessor.getGraphicsContext(elem.GCId );
|
||||||
@@ -900,11 +900,11 @@ void WriterXmlFinalizer::visit( PolyPolyElement& elem, const std::list< Element*
|
|||||||
elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
|
elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlFinalizer::visit( HyperlinkElement&, const std::list< Element* >::const_iterator& )
|
void WriterXmlFinalizer::visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlFinalizer::visit( TextElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
const FontAttributes& rFont = m_rProcessor.getFont( elem.FontId );
|
const FontAttributes& rFont = m_rProcessor.getFont( elem.FontId );
|
||||||
PropertyMap aProps;
|
PropertyMap aProps;
|
||||||
@@ -958,7 +958,7 @@ void WriterXmlFinalizer::visit( TextElement& elem, const std::list< Element* >::
|
|||||||
elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
|
elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element* >::const_iterator& rParentIt )
|
void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt )
|
||||||
{
|
{
|
||||||
PropertyMap aParaProps;
|
PropertyMap aParaProps;
|
||||||
|
|
||||||
@@ -1001,10 +1001,10 @@ void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element
|
|||||||
|
|
||||||
// check whether to leave some space to next paragraph
|
// check whether to leave some space to next paragraph
|
||||||
// find whether there is a next paragraph
|
// find whether there is a next paragraph
|
||||||
std::list< Element* >::const_iterator it = rParentIt;
|
auto it = rParentIt;
|
||||||
const ParagraphElement* pNextPara = nullptr;
|
const ParagraphElement* pNextPara = nullptr;
|
||||||
while( ++it != elem.Parent->Children.end() && ! pNextPara )
|
while( ++it != elem.Parent->Children.end() && ! pNextPara )
|
||||||
pNextPara = dynamic_cast< const ParagraphElement* >(*it);
|
pNextPara = dynamic_cast< const ParagraphElement* >(it->get());
|
||||||
if( pNextPara )
|
if( pNextPara )
|
||||||
{
|
{
|
||||||
if( pNextPara->y - (elem.y+elem.h) > convmm2Px( 10 ) )
|
if( pNextPara->y - (elem.y+elem.h) > convmm2Px( 10 ) )
|
||||||
@@ -1030,7 +1030,7 @@ void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< Element
|
|||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlFinalizer::visit( FrameElement& elem, const std::list< Element* >::const_iterator&)
|
void WriterXmlFinalizer::visit( FrameElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator&)
|
||||||
{
|
{
|
||||||
PropertyMap aProps;
|
PropertyMap aProps;
|
||||||
aProps[ "style:family" ] = "graphic";
|
aProps[ "style:family" ] = "graphic";
|
||||||
@@ -1058,7 +1058,7 @@ void WriterXmlFinalizer::visit( FrameElement& elem, const std::list< Element* >:
|
|||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlFinalizer::visit( ImageElement&, const std::list< Element* >::const_iterator& )
|
void WriterXmlFinalizer::visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1086,7 +1086,7 @@ void WriterXmlFinalizer::setFirstOnPage( ParagraphElement& rElem,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlFinalizer::visit( PageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
if( m_rProcessor.getStatusIndicator().is() )
|
if( m_rProcessor.getStatusIndicator().is() )
|
||||||
m_rProcessor.getStatusIndicator()->setValue( elem.PageNumber );
|
m_rProcessor.getStatusIndicator()->setValue( elem.PageNumber );
|
||||||
@@ -1101,9 +1101,9 @@ void WriterXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::
|
|||||||
elem.RightMargin = 0;
|
elem.RightMargin = 0;
|
||||||
// first element should be a paragraph
|
// first element should be a paragraph
|
||||||
ParagraphElement* pFirstPara = nullptr;
|
ParagraphElement* pFirstPara = nullptr;
|
||||||
for( std::list< Element* >::const_iterator it = elem.Children.begin(); it != elem.Children.end(); ++it )
|
for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
|
||||||
{
|
{
|
||||||
if( dynamic_cast<ParagraphElement*>( *it ) )
|
if( dynamic_cast<ParagraphElement*>( it->get() ) )
|
||||||
{
|
{
|
||||||
if( (*it)->x < elem.LeftMargin )
|
if( (*it)->x < elem.LeftMargin )
|
||||||
elem.LeftMargin = (*it)->x;
|
elem.LeftMargin = (*it)->x;
|
||||||
@@ -1114,7 +1114,7 @@ void WriterXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::
|
|||||||
if( (*it)->y + (*it)->h > elem.h - elem.BottomMargin )
|
if( (*it)->y + (*it)->h > elem.h - elem.BottomMargin )
|
||||||
elem.BottomMargin = elem.h - ((*it)->y + (*it)->h);
|
elem.BottomMargin = elem.h - ((*it)->y + (*it)->h);
|
||||||
if( ! pFirstPara )
|
if( ! pFirstPara )
|
||||||
pFirstPara = dynamic_cast<ParagraphElement*>( *it );
|
pFirstPara = dynamic_cast<ParagraphElement*>( it->get() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( elem.HeaderElement && elem.HeaderElement->y < elem.TopMargin )
|
if( elem.HeaderElement && elem.HeaderElement->y < elem.TopMargin )
|
||||||
@@ -1199,14 +1199,14 @@ void WriterXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::
|
|||||||
StyleContainer::Style aFooterStyle( "style:footer", PropertyMap() );
|
StyleContainer::Style aFooterStyle( "style:footer", PropertyMap() );
|
||||||
if( elem.HeaderElement )
|
if( elem.HeaderElement )
|
||||||
{
|
{
|
||||||
elem.HeaderElement->visitedBy( *this, std::list<Element*>::iterator() );
|
elem.HeaderElement->visitedBy( *this, std::list<std::unique_ptr<Element>>::iterator() );
|
||||||
aHeaderStyle.ContainedElement = elem.HeaderElement;
|
aHeaderStyle.ContainedElement = elem.HeaderElement.get();
|
||||||
aMPStyle.SubStyles.push_back( &aHeaderStyle );
|
aMPStyle.SubStyles.push_back( &aHeaderStyle );
|
||||||
}
|
}
|
||||||
if( elem.FooterElement )
|
if( elem.FooterElement )
|
||||||
{
|
{
|
||||||
elem.FooterElement->visitedBy( *this, std::list<Element*>::iterator() );
|
elem.FooterElement->visitedBy( *this, std::list<std::unique_ptr<Element>>::iterator() );
|
||||||
aFooterStyle.ContainedElement = elem.FooterElement;
|
aFooterStyle.ContainedElement = elem.FooterElement.get();
|
||||||
aMPStyle.SubStyles.push_back( &aFooterStyle );
|
aMPStyle.SubStyles.push_back( &aFooterStyle );
|
||||||
}
|
}
|
||||||
elem.StyleId = m_rStyleContainer.impl_getStyleId( aMPStyle,false );
|
elem.StyleId = m_rStyleContainer.impl_getStyleId( aMPStyle,false );
|
||||||
@@ -1222,12 +1222,12 @@ void WriterXmlFinalizer::visit( PageElement& elem, const std::list< Element* >::
|
|||||||
{
|
{
|
||||||
pFirstPara = ElementFactory::createParagraphElement( nullptr );
|
pFirstPara = ElementFactory::createParagraphElement( nullptr );
|
||||||
pFirstPara->Parent = &elem;
|
pFirstPara->Parent = &elem;
|
||||||
elem.Children.push_front( pFirstPara );
|
elem.Children.push_front( std::unique_ptr<Element>(pFirstPara) );
|
||||||
}
|
}
|
||||||
setFirstOnPage(*pFirstPara, m_rStyleContainer, aMasterPageName);
|
setFirstOnPage(*pFirstPara, m_rStyleContainer, aMasterPageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriterXmlFinalizer::visit( DocumentElement& elem, const std::list< Element* >::const_iterator& )
|
void WriterXmlFinalizer::visit( DocumentElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
|
||||||
{
|
{
|
||||||
elem.applyToChildren(*this);
|
elem.applyToChildren(*this);
|
||||||
}
|
}
|
||||||
|
@@ -38,14 +38,14 @@ namespace pdfi
|
|||||||
m_rProcessor(rProcessor)
|
m_rProcessor(rProcessor)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( TextElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WriterXmlFinalizer : public ElementTreeVisitor
|
class WriterXmlFinalizer : public ElementTreeVisitor
|
||||||
@@ -65,14 +65,14 @@ namespace pdfi
|
|||||||
m_rProcessor(rProcessor)
|
m_rProcessor(rProcessor)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( TextElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WriterXmlEmitter : public ElementTreeVisitor
|
class WriterXmlEmitter : public ElementTreeVisitor
|
||||||
@@ -88,14 +88,14 @@ namespace pdfi
|
|||||||
m_rEmitContext(rEmitContext)
|
m_rEmitContext(rEmitContext)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( TextElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( PageElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& ) override;
|
virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user