Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / writerfilter / inc / dmapper / DomainMapper.hxx
blob26654d728c0f619a4eebed30b2a58960ae16bbf8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_DOMAINMAPPER_HXX
20 #define INCLUDED_DOMAINMAPPER_HXX
22 #include <WriterFilterDllApi.hxx>
23 #include <resourcemodel/LoggedResources.hxx>
24 #include <com/sun/star/lang/XComponent.hpp>
25 #include <com/sun/star/text/FontEmphasis.hpp>
26 #include <com/sun/star/style/TabAlign.hpp>
28 #include <map>
29 #include <vector>
30 #include <boost/scoped_ptr.hpp>
32 namespace com{ namespace sun {namespace star{
33 namespace beans{
34 struct PropertyValue;
36 namespace io{
37 class XInputStream;
39 namespace uno{
40 class XComponentContext;
42 namespace lang{
43 class XMultiServiceFactory;
45 namespace text{
46 class XTextRange;
48 }}}
50 typedef std::vector< com::sun::star::beans::PropertyValue > PropertyValueVector_t;
52 namespace writerfilter {
53 namespace dmapper
56 class PropertyMap;
57 class DomainMapper_Impl;
58 class ListsManager;
59 class StyleSheetTable;
60 class GraphicZOrderHelper;
62 // different context types require different sprm handling (e.g. names)
63 enum SprmType
65 SPRM_DEFAULT,
66 SPRM_LIST
68 enum SourceDocumentType
70 DOCUMENT_DOC,
71 DOCUMENT_OOXML,
72 DOCUMENT_RTF
74 class WRITERFILTER_OOXML_DLLPUBLIC DomainMapper : public LoggedProperties, public LoggedTable,
75 public BinaryObj, public LoggedStream
77 DomainMapper_Impl *m_pImpl;
79 public:
80 DomainMapper(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
81 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
82 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModel,
83 bool bRepairStorage,
84 SourceDocumentType eDocumentType,
85 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xInsertTextRange,
86 bool bIsNewDoc = true);
87 virtual ~DomainMapper();
89 // Stream
90 virtual void markLastParagraphInSection();
92 // BinaryObj
93 virtual void data(const sal_uInt8* buf, size_t len,
94 writerfilter::Reference<Properties>::Pointer_t ref);
96 void sprmWithProps( Sprm& sprm, ::boost::shared_ptr<PropertyMap> pContext, SprmType = SPRM_DEFAULT );
98 void PushStyleSheetProperties( ::boost::shared_ptr<PropertyMap> pStyleProperties, bool bAffectTableMngr = false );
99 void PopStyleSheetProperties( bool bAffectTableMngr = false );
101 void PushListProperties( ::boost::shared_ptr<PropertyMap> pListProperties );
102 void PopListProperties();
104 bool IsOOXMLImport() const;
105 bool IsRTFImport() const;
106 ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > GetTextFactory() const;
107 void AddListIDToLFOTable( sal_Int32 nAbstractNumId );
108 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetCurrentTextRange();
110 OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties );
111 boost::shared_ptr< StyleSheetTable > GetStyleSheetTable( );
112 GraphicZOrderHelper* graphicZOrderHelper();
114 bool IsInHeaderFooter() const;
116 @see DomainMapper_Impl::processDeferredCharacterProperties()
118 void processDeferredCharacterProperties(
119 const std::map< sal_Int32, com::sun::star::uno::Any >& deferredCharacterProperties );
121 private:
122 // Stream
123 virtual void lcl_startSectionGroup();
124 virtual void lcl_endSectionGroup();
125 virtual void lcl_startParagraphGroup();
126 virtual void lcl_endParagraphGroup();
127 virtual void lcl_startCharacterGroup();
128 virtual void lcl_endCharacterGroup();
129 virtual void lcl_startShape( ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
130 virtual void lcl_endShape( );
132 virtual void lcl_text(const sal_uInt8 * data, size_t len);
133 virtual void lcl_utext(const sal_uInt8 * data, size_t len);
134 virtual void lcl_props(writerfilter::Reference<Properties>::Pointer_t ref);
135 virtual void lcl_table(Id name,
136 writerfilter::Reference<Table>::Pointer_t ref);
137 virtual void lcl_substream(Id name,
138 ::writerfilter::Reference<Stream>::Pointer_t ref);
139 virtual void lcl_info(const string & info);
141 // Properties
142 virtual void lcl_attribute(Id Name, Value & val);
143 virtual void lcl_sprm(Sprm & sprm);
145 // Table
146 virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
148 void handleUnderlineType(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext);
149 void handleParaJustification(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext, const bool bExchangeLeftRight);
150 bool getColorFromIndex(const sal_Int32 nIndex, sal_Int32 &nColor);
151 sal_Int16 getEmphasisValue(const sal_Int32 nIntValue);
152 OUString getBracketStringFromEnum(const sal_Int32 nIntValue, const bool bIsPrefix = true);
153 com::sun::star::style::TabAlign getTabAlignFromValue(const sal_Int32 nIntValue);
154 sal_Unicode getFillCharFromValue(const sal_Int32 nIntValue);
155 sal_Int32 mnBackgroundColor;
156 bool mbIsHighlightSet;
157 boost::scoped_ptr< GraphicZOrderHelper > zOrderHelper;
160 } // namespace dmapper
161 } // namespace writerfilter
162 #endif //
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */