Branch data Line data Source code
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 : : #ifndef INCLUDED_DMAPPER_DOMAINMAPPER_IMPL_HXX
20 : : #define INCLUDED_DMAPPER_DOMAINMAPPER_IMPL_HXX
21 : :
22 : : #include <com/sun/star/text/XTextDocument.hpp>
23 : : #include <com/sun/star/text/XTextCursor.hpp>
24 : : #include <com/sun/star/text/XTextAppend.hpp>
25 : : #include <com/sun/star/text/XTextAppendAndConvert.hpp>
26 : : #include <com/sun/star/text/XTextFrame.hpp>
27 : : #include <com/sun/star/style/TabStop.hpp>
28 : : #include <com/sun/star/container/XNameContainer.hpp>
29 : : #include <vector>
30 : : #include <stack>
31 : :
32 : : #ifndef INCLUDED_RESOURCESIDS
33 : : #include <doctok/resourceids.hxx>
34 : : #include <ooxml/resourceids.hxx>
35 : : #endif
36 : : #include <dmapper/DomainMapper.hxx>
37 : : #include <DomainMapperTableManager.hxx>
38 : : #include <PropertyMap.hxx>
39 : : #include <FontTable.hxx>
40 : : #include <NumberingManager.hxx>
41 : : #include <StyleSheetTable.hxx>
42 : : #include <SettingsTable.hxx>
43 : : #include <ThemeTable.hxx>
44 : : #include <GraphicImport.hxx>
45 : : #include <OLEHandler.hxx>
46 : : #include <FFDataHandler.hxx>
47 : : #include <FormControlHelper.hxx>
48 : : #include <map>
49 : :
50 : : #include <string.h>
51 : :
52 : : namespace com{ namespace sun{ namespace star{
53 : : namespace awt{
54 : : struct Size;
55 : : }
56 : : namespace lang{
57 : : class XMultiServiceFactory;
58 : : struct Locale;
59 : : }
60 : : namespace text
61 : : {
62 : : class XTextField;
63 : : class XFormField;
64 : : }
65 : : namespace beans{ class XPropertySet;}
66 : : }}}
67 : :
68 : : namespace writerfilter {
69 : : namespace dmapper {
70 : :
71 : : using namespace com::sun::star;
72 : :
73 : : struct _PageMar
74 : : {
75 : : sal_Int32 top;
76 : : sal_Int32 right;
77 : : sal_Int32 bottom;
78 : : sal_Int32 left;
79 : : sal_Int32 header;
80 : : sal_Int32 footer;
81 : : sal_Int32 gutter;
82 : : public:
83 : : _PageMar();
84 : : };
85 : : enum PageMarElement
86 : : {
87 : : PAGE_MAR_TOP,
88 : : PAGE_MAR_RIGHT,
89 : : PAGE_MAR_BOTTOM,
90 : : PAGE_MAR_LEFT,
91 : : PAGE_MAR_HEADER,
92 : : PAGE_MAR_FOOTER,
93 : : PAGE_MAR_GUTTER
94 : : };
95 : :
96 : : /*-------------------------------------------------------------------------
97 : : property stack element
98 : : -----------------------------------------------------------------------*/
99 : : enum ContextType
100 : : {
101 : : CONTEXT_SECTION,
102 : : CONTEXT_PARAGRAPH,
103 : : CONTEXT_CHARACTER,
104 : : CONTEXT_STYLESHEET,
105 : : CONTEXT_LIST,
106 : : NUMBER_OF_CONTEXTS
107 : : };
108 : :
109 : : enum BreakType
110 : : {
111 : : PAGE_BREAK,
112 : : COLUMN_BREAK
113 : : };
114 : : /*--------------------------------------------------
115 : : field stack element
116 : : * --------------------------------------------------*/
117 : : class FieldContext
118 : : {
119 : : bool m_bFieldCommandCompleted;
120 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xStartRange;
121 : :
122 : : OUString m_sCommand;
123 : :
124 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > m_xTextField;
125 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField > m_xFormField;
126 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xTOC;//TOX
127 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xTC;//TOX entry
128 : : OUString m_sHyperlinkURL;
129 : : FFDataHandler::Pointer_t m_pFFDataHandler;
130 : : FormControlHelper::Pointer_t m_pFormControlHelper;
131 : :
132 : : public:
133 : : FieldContext(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xStart);
134 : : ~FieldContext();
135 : :
136 : 39 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetStartRange() const { return m_xStartRange; }
137 : :
138 : : void AppendCommand(const OUString& rPart);
139 : 78 : const OUString& GetCommand() const {return m_sCommand; }
140 : :
141 : 39 : void SetCommandCompleted() { m_bFieldCommandCompleted = true; }
142 : 144 : bool IsCommandCompleted() const { return m_bFieldCommandCompleted; }
143 : :
144 : 66 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > GetTextField() const { return m_xTextField;}
145 : 39 : void SetTextField(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > xTextField) { m_xTextField = xTextField;}
146 : 3 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField > GetFormField() const { return m_xFormField;}
147 : 3 : void SetFormField(::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField > xFormField) { m_xFormField = xFormField;}
148 : :
149 : 0 : void SetTOC( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xTOC ) { m_xTOC = xTOC; }
150 : 39 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetTOC() { return m_xTOC; }
151 : :
152 : 0 : void SetTC( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xTC ) { m_xTC = xTC; }
153 : 39 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetTC( ) { return m_xTC; }
154 : :
155 : 3 : void SetHyperlinkURL( const OUString& rURL ) { m_sHyperlinkURL = rURL; }
156 : 18 : const OUString& GetHyperlinkURL() { return m_sHyperlinkURL; }
157 : :
158 : 21 : void setFFDataHandler(FFDataHandler::Pointer_t pFFDataHandler) { m_pFFDataHandler = pFFDataHandler; }
159 : 3 : FFDataHandler::Pointer_t getFFDataHandler() const { return m_pFFDataHandler; }
160 : :
161 : 3 : void setFormControlHelper(FormControlHelper::Pointer_t pFormControlHelper) { m_pFormControlHelper = pFormControlHelper; }
162 : 18 : FormControlHelper::Pointer_t getFormControlHelper() const { return m_pFormControlHelper; }
163 : :
164 : : ::std::vector<OUString> GetCommandParts() const;
165 : : };
166 : :
167 [ + - ][ + - ]: 1896 : struct TextAppendContext
168 : : {
169 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend > xTextAppend;
170 : : ParagraphPropertiesPtr pLastParagraphProperties;
171 : :
172 : 632 : TextAppendContext( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend >& xAppend ) :
173 [ + - ]: 632 : xTextAppend( xAppend ){}
174 : : };
175 : :
176 : 207 : struct AnchoredContext
177 : : {
178 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xTextContent;
179 : : bool bToRemove;
180 : :
181 : 69 : AnchoredContext( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent ) :
182 : 69 : xTextContent( xContent ), bToRemove( false ) {}
183 : : };
184 : :
185 : : typedef boost::shared_ptr<FieldContext> FieldContextPtr;
186 : :
187 : : typedef std::stack<ContextType> ContextStack;
188 : : typedef std::stack<PropertyMapPtr> PropertyStack;
189 : : typedef std::stack< TextAppendContext > TextAppendStack;
190 : : typedef std::stack<FieldContextPtr> FieldStack;
191 : : typedef std::stack< AnchoredContext > TextContentStack;
192 : :
193 : :
194 : :
195 : : class FIB
196 : : {
197 : : sal_Int32 aFIBData[ NS_rtf::LN_LCBSTTBFUSSR - NS_rtf::LN_WIDENT + 1];
198 : : sal_Int32 nLNCHS;
199 : : public:
200 : 506 : FIB() :
201 : 506 : nLNCHS( 0 )
202 : : {
203 : 506 : memset(&aFIBData, 0x00, sizeof(aFIBData));
204 : 506 : }
205 : :
206 : : sal_Int32 GetLNCHS() const {return nLNCHS;}
207 : 0 : void SetLNCHS(sal_Int32 nValue) {nLNCHS = nValue;}
208 : : void SetData( Id nName, sal_Int32 nValue );
209 : : };
210 : :
211 : : /*-------------------------------------------------------------------------
212 : : extended tab stop struct
213 : : -----------------------------------------------------------------------*/
214 : : struct DeletableTabStop : public ::com::sun::star::style::TabStop
215 : : {
216 : : bool bDeleted;
217 : 887 : DeletableTabStop() :
218 : 887 : bDeleted( false ){}
219 : 0 : DeletableTabStop( const ::com::sun::star::style::TabStop& rTabStop ) :
220 : : TabStop( rTabStop ),
221 : 0 : bDeleted( false ){}
222 : : };
223 : : /*-------------------------------------------------------------------------
224 : : /// helper to remember bookmark start position
225 : : -----------------------------------------------------------------------*/
226 : 105 : struct BookmarkInsertPosition
227 : : {
228 : : bool m_bIsStartOfText;
229 : : OUString m_sBookmarkName;
230 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xTextRange;
231 : 21 : BookmarkInsertPosition(bool bIsStartOfText, const OUString& rName, ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xTextRange):
232 : : m_bIsStartOfText( bIsStartOfText ),
233 : : m_sBookmarkName( rName ),
234 : 21 : m_xTextRange( xTextRange )
235 : 21 : {}
236 : : };
237 : :
238 : : /// Stores the start/end positions of an annotation before its insertion.
239 : 1012 : struct AnnotationPosition
240 : : {
241 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xStart;
242 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xEnd;
243 : : };
244 : :
245 : 0 : struct RedlineParams
246 : : {
247 : : OUString m_sAuthor;
248 : : OUString m_sDate;
249 : : sal_Int32 m_nId;
250 : : sal_Int32 m_nToken;
251 : : };
252 : : typedef boost::shared_ptr< RedlineParams > RedlineParamsPtr;
253 : :
254 : :
255 : :
256 : : struct LineNumberSettings
257 : : {
258 : : bool bIsOn;
259 : : sal_Int32 nDistance;
260 : : sal_Int32 nInterval;
261 : : sal_Int32 bRestartAtEachPage;
262 : : sal_Int32 nStartValue;
263 : 506 : LineNumberSettings() :
264 : : bIsOn(false)
265 : : ,nDistance(0)
266 : : ,nInterval(0)
267 : : ,bRestartAtEachPage(true)
268 : 506 : ,nStartValue(1)
269 : 506 : {}
270 : :
271 : : };
272 : :
273 : :
274 : : class DomainMapper;
275 : : class WRITERFILTER_DLLPRIVATE DomainMapper_Impl
276 : : {
277 : : public:
278 : : typedef TableManager< ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >, PropertyMapPtr > TableManager_t;
279 : : typedef TableDataHandler< ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >, TablePropertyMapPtr > TableDataHandler_t;
280 : : typedef std::map < OUString, BookmarkInsertPosition > BookmarkMap_t;
281 : :
282 : : private:
283 : : SourceDocumentType m_eDocumentType;
284 : : DomainMapper& m_rDMapper;
285 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > m_xTextDocument;
286 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDocumentSettings;
287 : : ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > m_xTextFactory;
288 : : ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xComponentContext;
289 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xPageStyles;
290 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > m_xBodyText;
291 : :
292 : : TextAppendStack m_aTextAppendStack;
293 : :
294 : : TextContentStack m_aAnchoredStack;
295 : :
296 : : FieldStack m_aFieldStack;
297 : : bool m_bFieldMode;
298 : : bool m_bSetUserFieldContent;
299 : : bool m_bIsFirstSection;
300 : : bool m_bIsColumnBreakDeferred;
301 : : bool m_bIsPageBreakDeferred;
302 : :
303 : : LineNumberSettings m_aLineNumberSettings;
304 : :
305 : : BookmarkMap_t m_aBookmarkMap;
306 : :
307 : : _PageMar m_aPageMargins;
308 : :
309 : :
310 : : // TableManagers are stacked: one for each stream to avoid any confusion
311 : : std::stack< boost::shared_ptr< DomainMapperTableManager > > m_aTableManagers;
312 : : TableDataHandler_t::Pointer_t m_pTableHandler;
313 : :
314 : : //each context needs a stack of currently used attributes
315 : : FIB m_aFIB;
316 : : PropertyStack m_aPropertyStacks[NUMBER_OF_CONTEXTS];
317 : : ContextStack m_aContextStack;
318 : : FontTablePtr m_pFontTable;
319 : : ListsManager::Pointer m_pListTable;
320 : : StyleSheetTablePtr m_pStyleSheetTable;
321 : : ThemeTablePtr m_pThemeTable;
322 : : SettingsTablePtr m_pSettingsTable;
323 : : GraphicImportPtr m_pGraphicImport;
324 : :
325 : :
326 : : PropertyMapPtr m_pTopContext;
327 : : PropertyMapPtr m_pLastSectionContext;
328 : : PropertyMapPtr m_pLastCharacterContext;
329 : :
330 : : ::std::vector<DeletableTabStop> m_aCurrentTabStops;
331 : : sal_uInt32 m_nCurrentTabStopIndex;
332 : : OUString m_sCurrentParaStyleId;
333 : : bool m_bInStyleSheetImport; //in import of fonts, styles, lists or lfos
334 : : bool m_bInAnyTableImport; //in import of fonts, styles, lists or lfos
335 : : bool m_bInHeaderFooterImport;
336 : :
337 : : bool m_bLineNumberingSet;
338 : : bool m_bIsInFootnoteProperties;
339 : : bool m_bIsCustomFtnMark;
340 : :
341 : : //registered frame properties
342 : : ::com::sun::star::uno::Sequence< beans::PropertyValue > m_aFrameProperties;
343 : : ::com::sun::star::uno::Reference< text::XTextRange > m_xFrameStartRange;
344 : : ::com::sun::star::uno::Reference< text::XTextRange > m_xFrameEndRange;
345 : :
346 : : // Redline stack
347 : : std::vector< RedlineParamsPtr > m_aRedlines;
348 : : RedlineParamsPtr m_pParaRedline;
349 : : bool m_bIsParaChange;
350 : :
351 : : /// If the current paragraph has any runs.
352 : : bool m_bParaChanged;
353 : : bool m_bIsFirstParaInSection;
354 : : bool m_bIsLastParaInSection;
355 : : /// If the current paragraph contains section property definitions.
356 : : bool m_bParaSectpr;
357 : : bool m_bUsingEnhancedFields;
358 : :
359 : : //annotation import
360 : : uno::Reference< beans::XPropertySet > m_xAnnotationField;
361 : : AnnotationPosition m_aAnnotationPosition;
362 : :
363 : : void GetCurrentLocale(::com::sun::star::lang::Locale& rLocale);
364 : : void SetNumberFormat( const OUString& rCommand,
365 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xPropertySet );
366 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
367 : : FindOrCreateFieldMaster( const sal_Char* pFieldMasterService,
368 : : const OUString& rFieldMasterName )
369 : : throw(::com::sun::star::uno::Exception);
370 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetDocumentSettings();
371 : :
372 : : std::map< sal_Int32, com::sun::star::uno::Any > deferredCharacterProperties;
373 : :
374 : : public:
375 : : DomainMapper_Impl(
376 : : DomainMapper& rDMapper,
377 : : uno::Reference < uno::XComponentContext > xContext,
378 : : uno::Reference< lang::XComponent > xModel,
379 : : SourceDocumentType eDocumentType );
380 : : DomainMapper_Impl();
381 : : virtual ~DomainMapper_Impl();
382 : :
383 : 536 : SectionPropertyMap* GetLastSectionContext( )
384 : : {
385 [ + + ]: 536 : return dynamic_cast< SectionPropertyMap* >( m_pLastSectionContext.get( ) );
386 : : }
387 : :
388 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetPageStyles();
389 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > GetBodyText();
390 : 1230 : ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > GetTextFactory() const
391 : : {
392 : 1230 : return m_xTextFactory;
393 : : }
394 : : ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > GetComponentContext() const
395 : : {
396 : : return m_xComponentContext;
397 : : }
398 : 2940 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > GetTextDocument() const
399 : : {
400 : 2940 : return m_xTextDocument;
401 : : }
402 : : void SetDocumentSettingsProperty( const OUString& rPropName, const uno::Any& rValue );
403 : :
404 : : void CreateRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange, RedlineParamsPtr& pRedline );
405 : :
406 : : void CheckParaRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange );
407 : :
408 : : void CheckRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange );
409 : :
410 : : void StartParaChange( );
411 : : void EndParaChange( );
412 : :
413 : : void RemoveLastParagraph( );
414 : : void SetIsLastParagraphInSection( bool bIsLast );
415 : : bool GetIsLastParagraphInSection();
416 : : void SetIsFirstParagraphInSection( bool bIsFirst );
417 : : bool GetIsFirstParagraphInSection();
418 : : void SetParaSectpr(bool bParaSectpr);
419 : : bool GetParaSectpr();
420 : : bool GetParaChanged();
421 : :
422 : : void deferBreak( BreakType deferredBreakType );
423 : : bool isBreakDeferred( BreakType deferredBreakType );
424 : : void clearDeferredBreaks();
425 : : void finishParagraph( PropertyMapPtr pPropertyMap );
426 : : void appendTextPortion( const OUString& rString, PropertyMapPtr pPropertyMap );
427 : : void appendTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >,
428 : : const uno::Sequence< beans::PropertyValue > );
429 : : void appendOLE( const OUString& rStreamName, OLEHandlerPtr pOleHandler );
430 : : void appendStarMath( const Value& v );
431 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > appendTextSectionAfter(
432 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xBefore );
433 : :
434 : 0 : FIB& GetFIB() {return m_aFIB;}
435 : : // push the new properties onto the stack and make it the 'current' property map
436 : : void PushProperties(ContextType eId);
437 : : void PushStyleProperties(PropertyMapPtr pStyleProperties);
438 : : void PushListProperties(PropertyMapPtr pListProperties);
439 : : void PopProperties(ContextType eId);
440 : :
441 : 12978 : ContextType GetTopContextType() const { return m_aContextStack.top(); }
442 : 99285 : PropertyMapPtr GetTopContext()
443 : : {
444 : 99285 : return m_pTopContext;
445 : : }
446 : : PropertyMapPtr GetTopContextOfType(ContextType eId);
447 : :
448 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend > GetTopTextAppend();
449 : :
450 : 14959 : FontTablePtr GetFontTable()
451 : : {
452 [ + + ]: 14959 : if(!m_pFontTable)
453 [ + - ]: 368 : m_pFontTable.reset(new FontTable());
454 : 14959 : return m_pFontTable;
455 : : }
456 : 2696 : StyleSheetTablePtr GetStyleSheetTable()
457 : : {
458 [ + + ]: 2696 : if(!m_pStyleSheetTable)
459 [ + - ][ + - ]: 497 : m_pStyleSheetTable.reset(new StyleSheetTable( m_rDMapper, m_xTextDocument ));
[ + - ]
460 : 2696 : return m_pStyleSheetTable;
461 : : }
462 : : ListsManager::Pointer GetListTable();
463 : 449 : ThemeTablePtr GetThemeTable()
464 : : {
465 [ + + ]: 449 : if(!m_pThemeTable)
466 [ + - ]: 83 : m_pThemeTable.reset( new ThemeTable );
467 : 449 : return m_pThemeTable;
468 : : }
469 : :
470 : 985 : SettingsTablePtr GetSettingsTable()
471 : : {
472 [ + + ]: 985 : if( !m_pSettingsTable )
473 [ + - ][ + - ]: 506 : m_pSettingsTable.reset( new SettingsTable( m_rDMapper, m_xTextFactory ) );
[ + - ]
474 : 985 : return m_pSettingsTable;
475 : : }
476 : :
477 : : GraphicImportPtr GetGraphicImport( GraphicImportType eGraphicImportType );
478 : : void ResetGraphicImport();
479 : : // this method deletes the current m_pGraphicImport after import
480 : : void ImportGraphic(writerfilter::Reference< Properties>::Pointer_t, GraphicImportType eGraphicImportType );
481 : :
482 : : void InitTabStopFromStyle( const ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop >& rInitTabStops );
483 : : void ModifyCurrentTabStop( Id nId, sal_Int32 nValue);
484 : : void IncorporateTabStop( const DeletableTabStop &aTabStop );
485 : : ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > GetCurrentTabStopAndClear();
486 : 0 : void NextTabStop() {++m_nCurrentTabStopIndex;}
487 : :
488 : 3002 : void SetCurrentParaStyleId(OUString sStringValue) {m_sCurrentParaStyleId = sStringValue;}
489 : 13601 : OUString GetCurrentParaStyleId() const {return m_sCurrentParaStyleId;}
490 : :
491 : : ::com::sun::star::uno::Any GetPropertyFromStyleSheet(PropertyIds eId);
492 : 610 : void SetStyleSheetImport( bool bSet ) { m_bInStyleSheetImport = bSet;}
493 : 582 : bool IsStyleSheetImport()const { return m_bInStyleSheetImport;}
494 : 2500 : void SetAnyTableImport( bool bSet ) { m_bInAnyTableImport = bSet;}
495 : 73015 : bool IsAnyTableImport()const { return m_bInAnyTableImport;}
496 : 2591 : bool IsInShape()const { return m_aAnchoredStack.size() > 0;}
497 : :
498 : : void PushShapeContext( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
499 : : void PopShapeContext();
500 : :
501 : : void PushPageHeader(SectionPropertyMap::PageType eType);
502 : : void PushPageFooter(SectionPropertyMap::PageType eType);
503 : :
504 : : void PopPageHeaderFooter();
505 : 15 : bool IsInHeaderFooter() const { return m_bInHeaderFooterImport; }
506 : :
507 : : void PushFootOrEndnote( bool bIsFootnote );
508 : : void PopFootOrEndnote();
509 : :
510 : : void PushAnnotation();
511 : : void PopAnnotation();
512 : :
513 : : //field context starts with a 0x13
514 : : void PushFieldContext();
515 : : //the current field context waits for the completion of the command
516 : : bool IsOpenFieldCommand() const;
517 : : bool IsOpenField() const;
518 : : //collect the pieces of the command
519 : : void AppendFieldCommand(OUString& rPartOfCommand);
520 : : void handleFieldAsk
521 : : (FieldContextPtr pContext,
522 : : PropertyNameSupplier& rPropNameSupplier,
523 : : uno::Reference< uno::XInterface > & xFieldInterface,
524 : : uno::Reference< beans::XPropertySet > xFieldProperties);
525 : : void handleAutoNum
526 : : (FieldContextPtr pContext,
527 : : PropertyNameSupplier& rPropNameSupplier,
528 : : uno::Reference< uno::XInterface > & xFieldInterface,
529 : : uno::Reference< beans::XPropertySet > xFieldProperties);
530 : : void handleAuthor
531 : : (FieldContextPtr pContext,
532 : : PropertyNameSupplier& rPropNameSupplier,
533 : : uno::Reference< uno::XInterface > & xFieldInterface,
534 : : uno::Reference< beans::XPropertySet > xFieldProperties,
535 : : FieldId eFieldId);
536 : : void handleDocProperty
537 : : (FieldContextPtr pContext,
538 : : PropertyNameSupplier& rPropNameSupplier,
539 : : uno::Reference< uno::XInterface > & xFieldInterface,
540 : : uno::Reference< beans::XPropertySet > xFieldProperties);
541 : : void handleToc
542 : : (FieldContextPtr pContext,
543 : : PropertyNameSupplier& rPropNameSupplier,
544 : : uno::Reference< uno::XInterface > & xFieldInterface,
545 : : uno::Reference< beans::XPropertySet > xFieldProperties,
546 : : const OUString & sTOCServiceName);
547 : : //the field command has to be closed (0x14 appeared)
548 : : void CloseFieldCommand();
549 : : //the _current_ fields require a string type result while TOCs accept richt results
550 : : bool IsFieldResultAsString();
551 : : //apply the result text to the related field
552 : : void SetFieldResult( OUString& rResult );
553 : : // set FFData of top field context
554 : : void SetFieldFFData( FFDataHandler::Pointer_t pFFDataHandler );
555 : : //the end of field is reached (0x15 appeared) - the command might still be open
556 : : void PopFieldContext();
557 : :
558 : : void AddBookmark( const OUString& rBookmarkName, const OUString& rId );
559 : :
560 : : void AddAnnotationPosition(const bool bStart);
561 : :
562 : 100268 : DomainMapperTableManager& getTableManager()
563 : : {
564 [ + - ][ + - ]: 100268 : boost::shared_ptr< DomainMapperTableManager > pMngr = m_aTableManagers.top();
565 [ + - ]: 100268 : return *pMngr.get( );
566 : : }
567 : :
568 : 632 : void appendTableManager( )
569 : : {
570 : : boost::shared_ptr< DomainMapperTableManager > pMngr(
571 [ + - ][ + + ]: 632 : new DomainMapperTableManager( m_eDocumentType == DOCUMENT_OOXML || m_eDocumentType == DOCUMENT_RTF, m_eDocumentType == DOCUMENT_RTF ) );
[ + - ][ + - ]
[ + - ]
572 [ + - ][ + - ]: 632 : m_aTableManagers.push( pMngr );
573 : 632 : }
574 : :
575 : 57 : void appendTableHandler( )
576 : : {
577 [ + - ]: 57 : if (m_pTableHandler.get())
578 [ + - ][ + - ]: 57 : m_aTableManagers.top()->setHandler(m_pTableHandler);
579 : 57 : }
580 : :
581 : 632 : void popTableManager( )
582 : : {
583 [ + - ]: 632 : if ( m_aTableManagers.size( ) > 0 )
584 : 632 : m_aTableManagers.pop( );
585 : 632 : }
586 : :
587 : : void SetLineNumbering( sal_Int32 nLnnMod, sal_Int32 nLnc, sal_Int32 ndxaLnn );
588 : 0 : bool IsLineNumberingSet() const {return m_bLineNumberingSet;}
589 : :
590 : : DeletableTabStop m_aCurrentTabStop;
591 : :
592 : 2450 : bool IsOOXMLImport() const { return m_eDocumentType == DOCUMENT_OOXML; }
593 : :
594 : 842 : bool IsRTFImport() const { return m_eDocumentType == DOCUMENT_RTF; }
595 : :
596 : 332 : void InitPageMargins() { m_aPageMargins = _PageMar(); }
597 : : void SetPageMarginTwip( PageMarElement eElement, sal_Int32 nValue );
598 : 332 : const _PageMar& GetPageMargins() const {return m_aPageMargins;}
599 : :
600 : 0 : const LineNumberSettings& GetLineNumberSettings() const { return m_aLineNumberSettings;}
601 : 0 : void SetLineNumberSettings(const LineNumberSettings& rSet) { m_aLineNumberSettings = rSet;}
602 : :
603 : 564 : void SetInFootnoteProperties(bool bSet) { m_bIsInFootnoteProperties = bSet;}
604 : 1410 : bool IsInFootnoteProperties() const { return m_bIsInFootnoteProperties;}
605 : :
606 : 0 : void SetCustomFtnMark(bool bSet) { m_bIsCustomFtnMark = bSet; }
607 : 0 : bool IsCustomFtnMark() const { return m_bIsCustomFtnMark; }
608 : :
609 : : void CheckUnregisteredFrameConversion( );
610 : : void RegisterFrameConversion(
611 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xFrameStartRange,
612 : : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xFrameEndRange,
613 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aFrameProperties
614 : : );
615 : : bool ExecuteFrameConversion();
616 : :
617 : : void AddNewRedline( );
618 : :
619 : : RedlineParamsPtr GetTopRedline( );
620 : :
621 : : sal_Int32 GetCurrentRedlineToken( );
622 : : void SetCurrentRedlineAuthor( OUString sAuthor );
623 : : void SetCurrentRedlineDate( OUString sDate );
624 : : void SetCurrentRedlineId( sal_Int32 nId );
625 : : void SetCurrentRedlineToken( sal_Int32 nToken );
626 : : void RemoveCurrentRedline( );
627 : : void ResetParaRedline( );
628 : : void SetCurrentRedlineInitials( OUString sInitials );
629 : :
630 : : void ApplySettingsTable();
631 : : SectionPropertyMap * GetSectionContext();
632 : : /// If the current paragraph has a numbering style associated, this method returns its character style
633 : : com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> GetCurrentNumberingCharStyle();
634 : :
635 : : /**
636 : : Used for attributes/sprms which cannot be evaluated immediatelly (e.g. they depend
637 : : on another one that comes in the same CONTEXT_CHARACTER). The property will be processed
638 : : again in DomainMapper::processDeferredCharacterProperties().
639 : : */
640 : : void deferCharacterProperty( sal_Int32 id, com::sun::star::uno::Any value );
641 : : /**
642 : : Processes properties deferred using deferCharacterProperty(). To be called whenever the top
643 : : CONTEXT_CHARACTER is going to be used (e.g. by appendText()).
644 : : */
645 : : void processDeferredCharacterProperties();
646 : :
647 : : /// Get a property of the current numbering style's current level.
648 : : sal_Int32 getCurrentNumberingProperty(OUString aProp);
649 : : };
650 : : } //namespace dmapper
651 : : } //namespace writerfilter
652 : : #endif
653 : :
654 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|