Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef INCLUDED_PDFI_DRAWTREEVISITING_HXX
30 : : #define INCLUDED_PDFI_DRAWTREEVISITING_HXX
31 : :
32 : : #include "treevisiting.hxx"
33 : :
34 : : #include "com/sun/star/i18n/XBreakIterator.hpp"
35 : : #include "com/sun/star/i18n/XCharacterClassification.hpp"
36 : : #include "com/sun/star/lang/XMultiServiceFactory.hpp"
37 : : #include "com/sun/star/uno/XComponentContext.hpp"
38 : :
39 : : namespace pdfi
40 : : {
41 : : struct DrawElement;
42 : :
43 [ - + ]: 6 : class DrawXmlOptimizer : public ElementTreeVisitor
44 : : {
45 : : private:
46 : : PDFIProcessor& m_rProcessor;
47 : : void optimizeTextElements(Element& rParent);
48 : :
49 : : public:
50 : : ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > mxBreakIter;
51 : : const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >& GetBreakIterator();
52 : 3 : explicit DrawXmlOptimizer(PDFIProcessor& rProcessor) :
53 : 3 : m_rProcessor(rProcessor)
54 : 3 : {}
55 : :
56 : : virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& );
57 : : virtual void visit( TextElement&, const std::list< Element* >::const_iterator& );
58 : : virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& );
59 : : virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& );
60 : : virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& );
61 : : virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& );
62 : : virtual void visit( PageElement&, const std::list< Element* >::const_iterator& );
63 : : virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& );
64 : : };
65 : :
66 [ - + ]: 6 : class DrawXmlFinalizer : public ElementTreeVisitor
67 : : {
68 : : private:
69 : : StyleContainer& m_rStyleContainer;
70 : : PDFIProcessor& m_rProcessor;
71 : :
72 : : public:
73 : 3 : explicit DrawXmlFinalizer(StyleContainer& rStyleContainer,
74 : : PDFIProcessor& rProcessor) :
75 : : m_rStyleContainer(rStyleContainer),
76 : 3 : m_rProcessor(rProcessor)
77 : 3 : {}
78 : :
79 : : virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& );
80 : : virtual void visit( TextElement&, const std::list< Element* >::const_iterator& );
81 : : virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& );
82 : : virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& );
83 : : virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& );
84 : : virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& );
85 : : virtual void visit( PageElement&, const std::list< Element* >::const_iterator& );
86 : : virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& );
87 : : };
88 : :
89 [ - + ]: 6 : class DrawXmlEmitter : public ElementTreeVisitor
90 : : {
91 : : private:
92 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory;
93 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xCtx;
94 : : ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > mxBreakIter;
95 : : ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification > mxCharClass;
96 : :
97 : : PDFIProcessor& m_rProcessor;
98 : :
99 : : EmitContext& m_rEmitContext ;
100 : : /// writes Impress doc when false
101 : : const bool m_bWriteDrawDocument;
102 : :
103 : : void fillFrameProps( DrawElement& rElem,
104 : : PropertyMap& rProps,
105 : : const EmitContext& rEmitContext,
106 : : bool bWasTransformed = false
107 : : );
108 : :
109 : : public:
110 : : const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification >& GetCharacterClassification();
111 : : enum DocType{ DRAW_DOC, IMPRESS_DOC };
112 : 3 : explicit DrawXmlEmitter(EmitContext& rEmitContext, DocType eDocType, PDFIProcessor& rProc ) :
113 : : m_rProcessor( rProc ),
114 : : m_rEmitContext(rEmitContext),
115 : 3 : m_bWriteDrawDocument(eDocType==DRAW_DOC)
116 : 3 : {}
117 : :
118 : : virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& );
119 : : virtual void visit( TextElement&, const std::list< Element* >::const_iterator& );
120 : : virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& );
121 : : virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& );
122 : : virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& );
123 : : virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& );
124 : : virtual void visit( PageElement&, const std::list< Element* >::const_iterator& );
125 : : virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& );
126 : : };
127 : : }
128 : :
129 : : #endif
130 : :
131 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|