LibreOffice Module sdext (master)  1
writertreevisiting.hxx
Go to the documentation of this file.
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 #include <pdfihelper.hxx>
26 
27 namespace pdfi
28 {
29  struct DrawElement;
30 
32  {
33  private:
35  void optimizeTextElements(Element& rParent);
36  void checkHeaderAndFooter( PageElement& rElem );
37 
38  public:
39  explicit WriterXmlOptimizer(PDFIProcessor& rProcessor) :
40  m_rProcessor(rProcessor)
41  {}
42 
43  virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
44  virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
45  virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
46  virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
47  virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
48  virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
49  virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
50  virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
51  };
52 
54  {
55  private:
58 
59  static void setFirstOnPage( ParagraphElement& rElem,
60  StyleContainer& rStyles,
61  const OUString& rMasterPageName );
62 
63  public:
64  explicit WriterXmlFinalizer(StyleContainer& rStyleContainer,
65  PDFIProcessor& rProcessor) :
66  m_rStyleContainer(rStyleContainer),
67  m_rProcessor(rProcessor)
68  {}
69 
70  virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
71  virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
72  virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
73  virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
74  virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
75  virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
76  virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
77  virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
78  };
79 
81  {
82  private:
84  static void fillFrameProps( DrawElement& rElem,
85  PropertyMap& rProps,
86  const EmitContext& rEmitContext );
87 
88  public:
89  explicit WriterXmlEmitter(EmitContext& rEmitContext) :
90  m_rEmitContext(rEmitContext)
91  {}
92 
93  virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
94  virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
95  virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
96  virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
97  virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
98  virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
99  virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
100  virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
101  };
102 }
103 
104 #endif
105 
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unordered_map< OUString, OUString > PropertyMap
Definition: pdfihelper.hxx:44
StyleContainer & m_rStyleContainer
static void fillFrameProps(DrawElement &rElem, PropertyMap &rProps, const EmitContext &rEmitContext)
virtual void visit(HyperlinkElement &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
virtual void visit(HyperlinkElement &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
Main entry from the parser.
WriterXmlFinalizer(StyleContainer &rStyleContainer, PDFIProcessor &rProcessor)
void optimizeTextElements(Element &rParent)
To be visited by all tree element types.
virtual void visit(HyperlinkElement &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
static void setFirstOnPage(ParagraphElement &rElem, StyleContainer &rStyles, const OUString &rMasterPageName)
WriterXmlOptimizer(PDFIProcessor &rProcessor)
void checkHeaderAndFooter(PageElement &rElem)
WriterXmlEmitter(EmitContext &rEmitContext)