LibreOffice Module sdext (master)  1
drawtreevisiting.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_DRAWTREEVISITING_HXX
21 #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_TREE_DRAWTREEVISITING_HXX
22 
23 #include <treevisiting.hxx>
24 
25 #include <com/sun/star/i18n/XBreakIterator.hpp>
26 #include <com/sun/star/i18n/XCharacterClassification.hpp>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
29 
30 namespace pdfi
31 {
32  struct DrawElement;
33 
35  {
36  private:
38  css::uno::Reference< css::i18n::XBreakIterator > mxBreakIter;
39 
40  void optimizeTextElements(Element& rParent);
41 
42  public:
43  const css::uno::Reference< css::i18n::XBreakIterator >& GetBreakIterator();
44  explicit DrawXmlOptimizer(PDFIProcessor& rProcessor) :
45  m_rProcessor(rProcessor)
46  {}
47 
48  virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
49  virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
50  virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
51  virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
52  virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
53  virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
54  virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
55  virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
56  };
57 
59  {
60  private:
63 
64  public:
65  explicit DrawXmlFinalizer(StyleContainer& rStyleContainer,
66  PDFIProcessor& rProcessor) :
67  m_rStyleContainer(rStyleContainer),
68  m_rProcessor(rProcessor)
69  {}
70 
71  virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
72  virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
73  virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
74  virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
75  virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
76  virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
77  virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
78  virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
79  };
80 
82  {
83  private:
84  css::uno::Reference< css::i18n::XCharacterClassification > mxCharClass;
85 
89 
90  static void fillFrameProps( DrawElement& rElem,
91  PropertyMap& rProps,
92  const EmitContext& rEmitContext,
93  bool bWasTransformed
94  );
95 
96  public:
97  const css::uno::Reference< css::i18n::XCharacterClassification >& GetCharacterClassification();
99  explicit DrawXmlEmitter(EmitContext& rEmitContext, DocType eDocType) :
100  m_rEmitContext(rEmitContext),
101  m_bWriteDrawDocument(eDocType==DRAW_DOC)
102  {}
103 
104  virtual void visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
105  virtual void visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
106  virtual void visit( ParagraphElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
107  virtual void visit( FrameElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
108  virtual void visit( PolyPolyElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
109  virtual void visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
110  virtual void visit( PageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
111  virtual void visit( DocumentElement&, const std::list< std::unique_ptr<Element> >::const_iterator& ) override;
112  };
113 }
114 
115 #endif
116 
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unordered_map< OUString, OUString > PropertyMap
Definition: pdfihelper.hxx:45
PDFIProcessor & m_rProcessor
EmitContext & m_rEmitContext
DrawXmlEmitter(EmitContext &rEmitContext, DocType eDocType)
static void fillFrameProps(DrawElement &rElem, PropertyMap &rProps, const EmitContext &rEmitContext, bool bWasTransformed)
Main entry from the parser.
PDFIProcessor & m_rProcessor
StyleContainer & m_rStyleContainer
virtual void visit(HyperlinkElement &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
const css::uno::Reference< css::i18n::XBreakIterator > & GetBreakIterator()
DrawXmlOptimizer(PDFIProcessor &rProcessor)
DrawXmlFinalizer(StyleContainer &rStyleContainer, PDFIProcessor &rProcessor)
css::uno::Reference< css::i18n::XCharacterClassification > mxCharClass
To be visited by all tree element types.
virtual void visit(HyperlinkElement &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
const css::uno::Reference< css::i18n::XCharacterClassification > & GetCharacterClassification()
css::uno::Reference< css::i18n::XBreakIterator > mxBreakIter
void optimizeTextElements(Element &rParent)
virtual void visit(HyperlinkElement &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
const bool m_bWriteDrawDocument
writes Impress doc when false