GPU-Calc: remove Alloc_Host_Ptr for clmem of NAN vector
[LibreOffice.git] / writerfilter / inc / dmapper / DomainMapper.hxx
blobd6b5d379517ac0f497adfbb1f2d0dd054af183d6
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 /// Return the first from the pending (not inserted to the document) shapes, if there are any.
115 com::sun::star::uno::Reference<com::sun::star::drawing::XShape> PopPendingShape();
117 bool IsInHeaderFooter() const;
119 @see DomainMapper_Impl::processDeferredCharacterProperties()
121 void processDeferredCharacterProperties(
122 const std::map< sal_Int32, com::sun::star::uno::Any >& deferredCharacterProperties );
123 void setInTableStyleRunProps(bool bInTableStyleRunProps);
125 /// Enable storing of seen tokens in a named grab bag.
126 void enableInteropGrabBag(OUString aName);
127 /// Get the stored tokens and clear the internal storage.
128 beans::PropertyValue getInteropGrabBag();
130 private:
131 // Stream
132 virtual void lcl_startSectionGroup();
133 virtual void lcl_endSectionGroup();
134 virtual void lcl_startParagraphGroup();
135 virtual void lcl_endParagraphGroup();
136 virtual void lcl_startCharacterGroup();
137 virtual void lcl_endCharacterGroup();
138 virtual void lcl_startShape( ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
139 virtual void lcl_endShape( );
141 virtual void lcl_text(const sal_uInt8 * data, size_t len);
142 virtual void lcl_utext(const sal_uInt8 * data, size_t len);
143 virtual void lcl_props(writerfilter::Reference<Properties>::Pointer_t ref);
144 virtual void lcl_table(Id name,
145 writerfilter::Reference<Table>::Pointer_t ref);
146 virtual void lcl_substream(Id name,
147 ::writerfilter::Reference<Stream>::Pointer_t ref);
148 virtual void lcl_info(const string & info);
150 // Properties
151 virtual void lcl_attribute(Id Name, Value & val);
152 virtual void lcl_sprm(Sprm & sprm);
154 // Table
155 virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
157 void handleUnderlineType(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext);
158 void handleParaJustification(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext, const bool bExchangeLeftRight);
159 bool getColorFromIndex(const sal_Int32 nIndex, sal_Int32 &nColor);
160 sal_Int16 getEmphasisValue(const sal_Int32 nIntValue);
161 OUString getBracketStringFromEnum(const sal_Int32 nIntValue, const bool bIsPrefix = true);
162 com::sun::star::style::TabAlign getTabAlignFromValue(const sal_Int32 nIntValue);
163 sal_Unicode getFillCharFromValue(const sal_Int32 nIntValue);
164 sal_Int32 mnBackgroundColor;
165 bool mbIsHighlightSet;
166 bool mbIsBIDI;
167 boost::scoped_ptr< GraphicZOrderHelper > zOrderHelper;
170 } // namespace dmapper
171 } // namespace writerfilter
172 #endif //
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */