Update ooo320-m1
[ooovba.git] / writerfilter / inc / dmapper / DomainMapper.hxx
blobcbf314a4b949477f336711f9910f9e26c7c13dd4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DomainMapper.hxx,v $
10 * $Revision: 1.23 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef INCLUDED_DOMAINMAPPER_HXX
31 #define INCLUDED_DOMAINMAPPER_HXX
33 #include <WriterFilterDllApi.hxx>
34 #include <resourcemodel/WW8ResourceModel.hxx>
35 #include <com/sun/star/lang/XComponent.hpp>
36 #include <com/sun/star/text/FontEmphasis.hpp>
37 #include <com/sun/star/style/TabAlign.hpp>
39 #include <map>
40 #include <vector>
42 namespace com{ namespace sun {namespace star{
43 namespace beans{
44 struct PropertyValue;
46 namespace io{
47 class XInputStream;
49 namespace uno{
50 class XComponentContext;
52 namespace lang{
53 class XMultiServiceFactory;
55 namespace text{
56 class XTextRange;
58 }}}
60 typedef std::vector< com::sun::star::beans::PropertyValue > PropertyValueVector_t;
62 namespace writerfilter {
63 namespace dmapper
65 using namespace std;
67 class PropertyMap;
68 class DomainMapper_Impl;
69 class ListsManager;
70 class StyleSheetTable;
72 // different context types require different sprm handling (e.g. names)
73 enum SprmType
75 SPRM_DEFAULT,
76 SPRM_LIST
78 enum SourceDocumentType
80 DOCUMENT_DOC,
81 DOCUMENT_OOXML,
82 DOCUMENT_RTF
84 class WRITERFILTER_DLLPUBLIC DomainMapper : public Properties, public Table,
85 public BinaryObj, public Stream
87 DomainMapper_Impl *m_pImpl;
89 public:
90 DomainMapper(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
91 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
92 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModel,
93 SourceDocumentType eDocumentType );
94 virtual ~DomainMapper();
96 // Properties
97 virtual void attribute(Id Name, Value & val);
98 virtual void sprm(Sprm & sprm);
100 // Table
101 virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
103 // BinaryObj
104 virtual void data(const sal_uInt8* buf, size_t len,
105 writerfilter::Reference<Properties>::Pointer_t ref);
107 // Stream
108 virtual void startSectionGroup();
109 virtual void endSectionGroup();
110 virtual void startParagraphGroup();
111 virtual void endParagraphGroup();
112 virtual void markLastParagraphInSection();
113 virtual void startCharacterGroup();
114 virtual void endCharacterGroup();
115 virtual void startShape( ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
116 virtual void endShape( );
118 virtual void text(const sal_uInt8 * data, size_t len);
119 virtual void utext(const sal_uInt8 * data, size_t len);
120 virtual void props(writerfilter::Reference<Properties>::Pointer_t ref);
121 virtual void table(Id name,
122 writerfilter::Reference<Table>::Pointer_t ref);
123 virtual void substream(Id name,
124 ::writerfilter::Reference<Stream>::Pointer_t ref);
125 virtual void info(const string & info);
127 void sprm( Sprm& sprm, ::boost::shared_ptr<PropertyMap> pContext, SprmType = SPRM_DEFAULT );
129 void PushStyleSheetProperties( ::boost::shared_ptr<PropertyMap> pStyleProperties, bool bAffectTableMngr = false );
130 void PopStyleSheetProperties( bool bAffectTableMngr = false );
132 void PushListProperties( ::boost::shared_ptr<PropertyMap> pListProperties );
133 void PopListProperties();
135 bool IsOOXMLImport() const;
136 ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > GetTextFactory() const;
137 void AddListIDToLFOTable( sal_Int32 nAbstractNumId );
138 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetCurrentTextRange();
140 ::rtl::OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties );
141 boost::shared_ptr< ListsManager > GetListTable( );
142 boost::shared_ptr< StyleSheetTable > GetStyleSheetTable( );
144 private:
145 void handleUnderlineType(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext);
146 void handleParaJustification(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext, const bool bExchangeLeftRight);
147 bool getColorFromIndex(const sal_Int32 nIndex, sal_Int32 &nColor);
148 sal_Int16 getEmphasisValue(const sal_Int32 nIntValue);
149 rtl::OUString getBracketStringFromEnum(const sal_Int32 nIntValue, const bool bIsPrefix = true);
150 com::sun::star::style::TabAlign getTabAlignFromValue(const sal_Int32 nIntValue);
151 sal_Unicode getFillCharFromValue(const sal_Int32 nIntValue);
152 void resolveAttributeProperties(Value & val);
153 void resolveSprmProps(Sprm & sprm_);
154 sal_Int32 mnBackgroundColor;
155 bool mbIsHighlightSet;
158 } // namespace dmapper
159 } // namespace writerfilter
160 #endif //