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 1 : explicit WriterXmlOptimizer(PDFIProcessor& rProcessor) :
38 1 : m_rProcessor(rProcessor)
39 1 : {}
40 2 : virtual ~WriterXmlOptimizer()
41 2 : {}
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 : static void setFirstOnPage( ParagraphElement& rElem,
60 : StyleContainer& rStyles,
61 : const OUString& rMasterPageName );
62 :
63 : public:
64 1 : explicit WriterXmlFinalizer(StyleContainer& rStyleContainer,
65 : PDFIProcessor& rProcessor) :
66 : m_rStyleContainer(rStyleContainer),
67 1 : m_rProcessor(rProcessor)
68 1 : {}
69 2 : virtual ~WriterXmlFinalizer()
70 2 : {}
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 : static void fillFrameProps( DrawElement& rElem,
87 : PropertyMap& rProps,
88 : const EmitContext& rEmitContext );
89 :
90 : public:
91 1 : explicit WriterXmlEmitter(EmitContext& rEmitContext) :
92 1 : m_rEmitContext(rEmitContext)
93 1 : {}
94 2 : virtual ~WriterXmlEmitter()
95 2 : {}
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: */
|