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