Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SDEXT_SOURCE_PDFIMPORT_TREE_WRITERTREEVISITING_HXX
21 : #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_TREE_WRITERTREEVISITING_HXX
22 :
23 : #include "treevisiting.hxx"
24 :
25 : namespace pdfi
26 : {
27 : struct DrawElement;
28 :
29 : class WriterXmlOptimizer : public ElementTreeVisitor
30 : {
31 : private:
32 : PDFIProcessor& m_rProcessor;
33 : void optimizeTextElements(Element& rParent);
34 : void checkHeaderAndFooter( PageElement& rElem );
35 :
36 : public:
37 2 : explicit WriterXmlOptimizer(PDFIProcessor& rProcessor) :
38 2 : m_rProcessor(rProcessor)
39 2 : {}
40 4 : virtual ~WriterXmlOptimizer()
41 4 : {}
42 :
43 : virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
44 : virtual void visit( TextElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
45 : virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
46 : virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
47 : virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
48 : virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
49 : virtual void visit( PageElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
50 : virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
51 : };
52 :
53 : class WriterXmlFinalizer : public ElementTreeVisitor
54 : {
55 : private:
56 : StyleContainer& m_rStyleContainer;
57 : PDFIProcessor& m_rProcessor;
58 :
59 : void setFirstOnPage( ParagraphElement& rElem,
60 : StyleContainer& rStyles,
61 : const OUString& rMasterPageName );
62 :
63 : public:
64 2 : explicit WriterXmlFinalizer(StyleContainer& rStyleContainer,
65 : PDFIProcessor& rProcessor) :
66 : m_rStyleContainer(rStyleContainer),
67 2 : m_rProcessor(rProcessor)
68 2 : {}
69 4 : virtual ~WriterXmlFinalizer()
70 4 : {}
71 :
72 : virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
73 : virtual void visit( TextElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
74 : virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
75 : virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
76 : virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
77 : virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
78 : virtual void visit( PageElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
79 : virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
80 : };
81 :
82 : class WriterXmlEmitter : public ElementTreeVisitor
83 : {
84 : private:
85 : EmitContext& m_rEmitContext ;
86 : void fillFrameProps( DrawElement& rElem,
87 : PropertyMap& rProps,
88 : const EmitContext& rEmitContext );
89 :
90 : public:
91 2 : explicit WriterXmlEmitter(EmitContext& rEmitContext) :
92 2 : m_rEmitContext(rEmitContext)
93 2 : {}
94 4 : virtual ~WriterXmlEmitter()
95 4 : {}
96 :
97 : virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
98 : virtual void visit( TextElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
99 : virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
100 : virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
101 : virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
102 : virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
103 : virtual void visit( PageElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
104 : virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& ) SAL_OVERRIDE;
105 : };
106 : }
107 :
108 : #endif
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|