1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef INCLUDED_DMAPPER_DOMAINMAPPER_IMPL_HXX 24 #define INCLUDED_DMAPPER_DOMAINMAPPER_IMPL_HXX 25 26 #include <com/sun/star/text/XTextDocument.hpp> 27 #include <com/sun/star/text/XTextCursor.hpp> 28 #include <com/sun/star/text/XTextAppend.hpp> 29 #include <com/sun/star/text/XTextAppendAndConvert.hpp> 30 #include <com/sun/star/text/XTextFrame.hpp> 31 #include <com/sun/star/style/TabStop.hpp> 32 #include <com/sun/star/container/XNameContainer.hpp> 33 #include <vector> 34 #include <stack> 35 36 #ifndef INCLUDED_RESOURCESIDS 37 #include <doctok/resourceids.hxx> 38 #include <ooxml/resourceids.hxx> 39 #endif 40 #include <dmapper/DomainMapper.hxx> 41 #include <DomainMapperTableManager.hxx> 42 #include <PropertyMap.hxx> 43 #include <FontTable.hxx> 44 #include <NumberingManager.hxx> 45 #include <StyleSheetTable.hxx> 46 #include <SettingsTable.hxx> 47 #include <ThemeTable.hxx> 48 #include <SettingsTable.hxx> 49 #include <GraphicImport.hxx> 50 #include <OLEHandler.hxx> 51 #include <FFDataHandler.hxx> 52 #include <FormControlHelper.hxx> 53 #include <map> 54 #include <hash_map> 55 56 #include <string.h> 57 58 namespace com{ namespace sun{ namespace star{ 59 namespace awt{ 60 struct Size; 61 } 62 namespace lang{ 63 class XMultiServiceFactory; 64 struct Locale; 65 } 66 namespace text 67 { 68 class XTextField; 69 } 70 namespace beans{ class XPropertySet;} 71 }}} 72 73 namespace writerfilter { 74 namespace dmapper { 75 76 using namespace com::sun::star; 77 78 //#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) 79 //sal_Int32 lcl_convertToMM100(sal_Int32 _t); 80 81 struct _PageMar 82 { 83 sal_Int32 top; 84 sal_Int32 right; 85 sal_Int32 bottom; 86 sal_Int32 left; 87 sal_Int32 header; 88 sal_Int32 footer; 89 sal_Int32 gutter; 90 public: 91 _PageMar(); 92 }; 93 enum PageMarElement 94 { 95 PAGE_MAR_TOP, 96 PAGE_MAR_RIGHT, 97 PAGE_MAR_BOTTOM, 98 PAGE_MAR_LEFT, 99 PAGE_MAR_HEADER, 100 PAGE_MAR_FOOTER, 101 PAGE_MAR_GUTTER 102 }; 103 104 /*-- 14.06.2006 07:42:52--------------------------------------------------- 105 property stack element 106 -----------------------------------------------------------------------*/ 107 enum ContextType 108 { 109 CONTEXT_SECTION, 110 CONTEXT_PARAGRAPH, 111 CONTEXT_CHARACTER, 112 CONTEXT_STYLESHEET, 113 CONTEXT_LIST, 114 NUMBER_OF_CONTEXTS 115 }; 116 117 enum BreakType 118 { 119 PAGE_BREAK, 120 COLUMN_BREAK 121 }; 122 /*-----------------29.01.2007 11:47----------------- 123 field stack element 124 * --------------------------------------------------*/ 125 class FieldContext 126 { 127 bool m_bFieldCommandCompleted; 128 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xStartRange; 129 130 ::rtl::OUString m_sCommand; 131 132 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > m_xTextField; 133 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xTOC;//TOX 134 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xTC;//TOX entry 135 ::rtl::OUString m_sHyperlinkURL; 136 FFDataHandler::Pointer_t m_pFFDataHandler; 137 FormControlHelper::Pointer_t m_pFormControlHelper; 138 139 public: 140 FieldContext(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xStart); 141 ~FieldContext(); 142 GetStartRange() const143 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetStartRange() const { return m_xStartRange; } 144 145 void AppendCommand(const ::rtl::OUString& rPart); GetCommand() const146 const ::rtl::OUString& GetCommand() const {return m_sCommand; } 147 SetCommandCompleted()148 void SetCommandCompleted() { m_bFieldCommandCompleted = true; } IsCommandCompleted() const149 bool IsCommandCompleted() const { return m_bFieldCommandCompleted; } 150 GetTextField() const151 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > GetTextField() const { return m_xTextField;} SetTextField(::com::sun::star::uno::Reference<::com::sun::star::text::XTextField> xTextField)152 void SetTextField(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > xTextField) { m_xTextField = xTextField;} 153 SetTOC(::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertySet> xTOC)154 void SetTOC( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xTOC ) { m_xTOC = xTOC; } GetTOC()155 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetTOC() { return m_xTOC; } 156 SetTC(::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertySet> xTC)157 void SetTC( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xTC ) { m_xTC = xTC; } GetTC()158 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetTC( ) { return m_xTC; } 159 SetHyperlinkURL(const::rtl::OUString & rURL)160 void SetHyperlinkURL( const ::rtl::OUString& rURL ) { m_sHyperlinkURL = rURL; } GetHyperlinkURL()161 const ::rtl::OUString& GetHyperlinkURL() { return m_sHyperlinkURL; } 162 setFFDataHandler(FFDataHandler::Pointer_t pFFDataHandler)163 void setFFDataHandler(FFDataHandler::Pointer_t pFFDataHandler) { m_pFFDataHandler = pFFDataHandler; } getFFDataHandler() const164 FFDataHandler::Pointer_t getFFDataHandler() const { return m_pFFDataHandler; } 165 setFormControlHelper(FormControlHelper::Pointer_t pFormControlHelper)166 void setFormControlHelper(FormControlHelper::Pointer_t pFormControlHelper) { m_pFormControlHelper = pFormControlHelper; } getFormControlHelper() const167 FormControlHelper::Pointer_t getFormControlHelper() const { return m_pFormControlHelper; } 168 169 ::std::vector<rtl::OUString> GetCommandParts() const; 170 }; 171 172 struct TextAppendContext 173 { 174 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend > xTextAppend; 175 ParagraphPropertiesPtr pLastParagraphProperties; 176 TextAppendContextwriterfilter::dmapper::TextAppendContext177 TextAppendContext( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend >& xAppend ) 178 : xTextAppend( xAppend ) 179 { 180 } 181 }; 182 183 typedef boost::shared_ptr<FieldContext> FieldContextPtr; 184 185 typedef std::stack<ContextType> ContextStack; 186 typedef std::stack<PropertyMapPtr> PropertyStack; 187 typedef std::stack< TextAppendContext > TextAppendStack; 188 typedef std::stack<FieldContextPtr> FieldStack; 189 typedef std::stack< com::sun::star::uno::Reference< com::sun::star::text::XTextContent > > TextContentStack; 190 191 /*-- 18.07.2006 08:49:08--------------------------------------------------- 192 193 -----------------------------------------------------------------------*/ 194 class FIB 195 { 196 sal_Int32 aFIBData[ NS_rtf::LN_LCBSTTBFUSSR - NS_rtf::LN_WIDENT + 1]; 197 sal_Int32 nLNCHS; 198 public: FIB()199 FIB() : 200 nLNCHS( 0 ) 201 { 202 memset(&aFIBData, 0x00, sizeof(aFIBData)); 203 } 204 GetLNCHS() const205 sal_Int32 GetLNCHS() const {return nLNCHS;} SetLNCHS(sal_Int32 nValue)206 void SetLNCHS(sal_Int32 nValue) {nLNCHS = nValue;} 207 sal_Int32 GetData( Id nName ); 208 void SetData( Id nName, sal_Int32 nValue ); 209 }; 210 211 /*-- 17.07.2006 09:14:13--------------------------------------------------- 212 extended tab stop struct 213 -----------------------------------------------------------------------*/ 214 struct DeletableTabStop : public ::com::sun::star::style::TabStop 215 { 216 bool bDeleted; 217 DeletableTabStopwriterfilter::dmapper::DeletableTabStop218 DeletableTabStop() 219 : TabStop() 220 , bDeleted( false ) 221 {} 222 DeletableTabStopwriterfilter::dmapper::DeletableTabStop223 DeletableTabStop( const ::com::sun::star::style::TabStop& rTabStop ) 224 : TabStop( rTabStop ) 225 , bDeleted( false ) 226 {} 227 }; 228 /*-- 12.06.2007 07:15:31--------------------------------------------------- 229 /// helper to remember bookmark start position 230 -----------------------------------------------------------------------*/ 231 struct BookmarkInsertPosition 232 { 233 bool m_bIsStartOfText; 234 ::rtl::OUString m_sBookmarkName; 235 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xTextRange; 236 BookmarkInsertPositionwriterfilter::dmapper::BookmarkInsertPosition237 BookmarkInsertPosition( 238 bool bIsStartOfText, 239 const ::rtl::OUString& rName, 240 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xTextRange ) 241 : m_bIsStartOfText( bIsStartOfText ) 242 , m_sBookmarkName( rName ) 243 , m_xTextRange( xTextRange ) 244 {} 245 }; 246 247 /// Stores the start/end positions of an annotation before its insertion. 248 struct AnnotationPosition 249 { 250 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xStart; 251 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xEnd; 252 }; 253 typedef std::unordered_map< sal_Int32, AnnotationPosition > AnnotationPositions_t; 254 255 struct RedlineParams 256 { 257 ::rtl::OUString m_sAuthor; 258 ::rtl::OUString m_sDate; 259 sal_Int32 m_nId; 260 sal_Int32 m_nToken; 261 }; 262 typedef boost::shared_ptr< RedlineParams > RedlineParamsPtr; 263 264 /*-- 03.03.2008 11:01:38--------------------------------------------------- 265 266 -----------------------------------------------------------------------*/ 267 struct LineNumberSettings 268 { 269 bool bIsOn; 270 sal_Int32 nDistance; 271 sal_Int32 nInterval; 272 sal_Int32 bRestartAtEachPage; 273 sal_Int32 nStartValue; LineNumberSettingswriterfilter::dmapper::LineNumberSettings274 LineNumberSettings() : 275 bIsOn(false) 276 ,nDistance(0) 277 ,nInterval(0) 278 ,bRestartAtEachPage(true) 279 ,nStartValue(1) 280 {} 281 282 }; 283 /*-- 09.06.2006 10:15:20--------------------------------------------------- 284 285 -----------------------------------------------------------------------*/ 286 class DomainMapper; 287 class DomainMapper_Impl 288 { 289 public: 290 typedef TableManager< ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >, PropertyMapPtr > TableManager_t; 291 typedef TableDataHandler< ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >, TablePropertyMapPtr > TableDataHandler_t; 292 typedef std::map < sal_Int32, BookmarkInsertPosition > BookmarkMap_t; 293 294 private: 295 SourceDocumentType m_eDocumentType; 296 DomainMapper& m_rDMapper; 297 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > m_xTextDocument; 298 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDocumentSettings; 299 ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > m_xTextFactory; 300 ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xComponentContext; 301 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xPageStyles; 302 ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > m_xBodyText; 303 304 TextAppendStack m_aTextAppendStack; 305 306 TextContentStack 307 m_aAnchoredStack; 308 309 FieldStack m_aFieldStack; 310 bool m_bFieldMode; 311 bool m_bSetUserFieldContent; 312 bool m_bIsFirstSection; 313 bool m_bIsColumnBreakDeferred; 314 bool m_bIsPageBreakDeferred; 315 bool m_bIsInShape; 316 bool m_bShapeContextAdded; 317 318 LineNumberSettings m_aLineNumberSettings; 319 320 BookmarkMap_t m_aBookmarkMap; 321 322 _PageMar m_aPageMargins; 323 324 325 // TableManagers are stacked: one for each stream to avoid any confusion 326 std::stack< boost::shared_ptr< DomainMapperTableManager > > m_aTableManagers; 327 328 //each context needs a stack of currently used attributes 329 FIB m_aFIB; 330 PropertyStack m_aPropertyStacks[NUMBER_OF_CONTEXTS]; 331 ContextStack m_aContextStack; 332 FontTablePtr m_pFontTable; 333 ListsManager::Pointer m_pListTable; 334 StyleSheetTablePtr m_pStyleSheetTable; 335 ThemeTablePtr m_pThemeTable; 336 SettingsTablePtr m_pSettingsTable; 337 GraphicImportPtr m_pGraphicImport; 338 339 340 PropertyMapPtr m_pTopContext; 341 PropertyMapPtr m_pLastSectionContext; 342 343 ::std::vector<DeletableTabStop> m_aCurrentTabStops; 344 sal_uInt32 m_nCurrentTabStopIndex; 345 ::rtl::OUString m_sCurrentParaStyleId; 346 bool m_bInStyleSheetImport; //in import of fonts, styles, lists or lfos 347 bool m_bInAnyTableImport; //in import of fonts, styles, lists or lfos 348 349 bool m_bLineNumberingSet; 350 bool m_bIsInFootnoteProperties; 351 bool m_bIsCustomFtnMark; 352 353 //registered frame properties 354 ::com::sun::star::uno::Sequence< beans::PropertyValue > m_aFrameProperties; 355 ::com::sun::star::uno::Reference< text::XTextRange > m_xFrameStartRange; 356 ::com::sun::star::uno::Reference< text::XTextRange > m_xFrameEndRange; 357 358 // Redline stack 359 std::vector< RedlineParamsPtr > m_aRedlines; 360 RedlineParamsPtr m_pParaRedline; 361 bool m_bIsParaChange; 362 363 bool m_bParaChanged; 364 bool m_bIsLastParaInSection; 365 bool m_bIsInComments; 366 367 //annotation import 368 uno::Reference< beans::XPropertySet > m_xAnnotationField; 369 sal_Int32 m_nAnnotationId; 370 AnnotationPositions_t m_aAnnotationPositions; 371 372 void GetCurrentLocale(::com::sun::star::lang::Locale& rLocale); 373 void SetNumberFormat( const ::rtl::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 ::rtl::OUString& rFieldMasterName ); 378 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetDocumentSettings(); 379 380 public: 381 DomainMapper_Impl( 382 DomainMapper& rDMapper, 383 uno::Reference < uno::XComponentContext > xContext, 384 uno::Reference< lang::XComponent > xModel, 385 SourceDocumentType eDocumentType ); 386 DomainMapper_Impl(); 387 virtual ~DomainMapper_Impl(); 388 GetLastSectionContext()389 SectionPropertyMap* GetLastSectionContext( ) 390 { 391 return dynamic_cast< SectionPropertyMap* >( m_pLastSectionContext.get( ) ); 392 } 393 394 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetPageStyles(); 395 ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > GetBodyText(); GetTextFactory() const396 ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > GetTextFactory() const 397 { 398 return m_xTextFactory; 399 } GetComponentContext() const400 ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > GetComponentContext() const 401 { 402 return m_xComponentContext; 403 } GetTextDocument() const404 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > GetTextDocument() const 405 { 406 return m_xTextDocument; 407 } 408 void SetDocumentSettingsProperty( const ::rtl::OUString& rPropName, const uno::Any& rValue ); 409 410 void CreateRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange, RedlineParamsPtr& pRedline ); 411 412 void CheckParaRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange ); 413 414 void CheckRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange ); 415 416 void StartParaChange( ); 417 void EndParaChange( ); 418 419 void RemoveLastParagraph( ); 420 void SetIsLastParagraphInSection( bool bIsLast ); 421 422 void deferBreak( BreakType deferredBreakType ); 423 bool isBreakDeferred( BreakType deferredBreakType ); 424 void clearDeferredBreaks(); 425 void finishParagraph( PropertyMapPtr pPropertyMap ); 426 void appendTextPortion( const ::rtl::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 ::rtl::OUString& rStreamName, OLEHandlerPtr pOleHandler ); 430 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > appendTextSectionAfter( 431 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xBefore ); 432 433 // void appendTextSection(); 434 GetFIB()435 FIB& GetFIB() {return m_aFIB;} 436 // push the new properties onto the stack and make it the 'current' property map 437 void PushProperties(ContextType eId); 438 void PushStyleProperties(PropertyMapPtr pStyleProperties); 439 void PushListProperties(PropertyMapPtr pListProperties); 440 void PopProperties(ContextType eId); 441 GetTopContextType() const442 ContextType GetTopContextType() const { return m_aContextStack.top(); } GetTopContext()443 PropertyMapPtr GetTopContext() 444 { 445 return m_pTopContext; 446 } 447 PropertyMapPtr GetTopContextOfType(ContextType eId); 448 449 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend > GetTopTextAppend(); 450 GetFontTable()451 FontTablePtr GetFontTable() 452 { 453 if(!m_pFontTable) 454 m_pFontTable.reset(new FontTable()); 455 return m_pFontTable; 456 } GetStyleSheetTable()457 StyleSheetTablePtr GetStyleSheetTable() 458 { 459 if(!m_pStyleSheetTable) 460 m_pStyleSheetTable.reset(new StyleSheetTable( m_rDMapper, m_xTextDocument )); 461 return m_pStyleSheetTable; 462 } 463 ListsManager::Pointer GetListTable(); GetThemeTable()464 ThemeTablePtr GetThemeTable() 465 { 466 if(!m_pThemeTable) 467 m_pThemeTable.reset( new ThemeTable ); 468 return m_pThemeTable; 469 } 470 GetSettingsTable()471 SettingsTablePtr GetSettingsTable() 472 { 473 if( !m_pSettingsTable ) 474 m_pSettingsTable.reset( new SettingsTable( m_rDMapper, m_xTextFactory ) ); 475 return m_pSettingsTable; 476 } 477 478 GraphicImportPtr GetGraphicImport( GraphicImportType eGraphicImportType ); 479 void ResetGraphicImport(); 480 // this method deletes the current m_pGraphicImport after import 481 void ImportGraphic(writerfilter::Reference< Properties>::Pointer_t, GraphicImportType eGraphicImportType ); 482 483 void InitTabStopFromStyle( const ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop >& rInitTabStops ); 484 void ModifyCurrentTabStop( Id nId, sal_Int32 nValue); 485 void IncorporateTabStop( const DeletableTabStop &aTabStop ); 486 ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > GetCurrentTabStopAndClear(); NextTabStop()487 void NextTabStop() {++m_nCurrentTabStopIndex;} 488 SetCurrentParaStyleId(::rtl::OUString sStringValue)489 void SetCurrentParaStyleId(::rtl::OUString sStringValue) {m_sCurrentParaStyleId = sStringValue;} GetCurrentParaStyleId() const490 ::rtl::OUString GetCurrentParaStyleId() const {return m_sCurrentParaStyleId;} 491 492 ::com::sun::star::uno::Any GetPropertyFromStyleSheet(PropertyIds eId); SetStyleSheetImport(bool bSet)493 void SetStyleSheetImport( bool bSet ) { m_bInStyleSheetImport = bSet;} IsStyleSheetImport() const494 bool IsStyleSheetImport()const { return m_bInStyleSheetImport;} SetAnyTableImport(bool bSet)495 void SetAnyTableImport( bool bSet ) { m_bInAnyTableImport = bSet;} IsAnyTableImport() const496 bool IsAnyTableImport()const { return m_bInAnyTableImport;} 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 506 void PushFootOrEndnote( bool bIsFootnote ); 507 void PopFootOrEndnote(); 508 509 void PushAnnotation(); 510 void PopAnnotation(); 511 512 //field context starts with a 0x13 513 void PushFieldContext(); 514 //the current field context waits for the completion of the command 515 bool IsOpenFieldCommand() const; 516 bool IsOpenField() const; 517 //collect the pieces of the command 518 void AppendFieldCommand(::rtl::OUString& rPartOfCommand); 519 void handleFieldAsk 520 (FieldContextPtr pContext, 521 PropertyNameSupplier& rPropNameSupplier, 522 uno::Reference< uno::XInterface > & xFieldInterface, 523 uno::Reference< beans::XPropertySet > xFieldProperties); 524 void handleAutoNum 525 (FieldContextPtr pContext, 526 PropertyNameSupplier& rPropNameSupplier, 527 uno::Reference< uno::XInterface > & xFieldInterface, 528 uno::Reference< beans::XPropertySet > xFieldProperties); 529 void handleAuthor 530 (FieldContextPtr pContext, 531 PropertyNameSupplier& rPropNameSupplier, 532 uno::Reference< uno::XInterface > & xFieldInterface, 533 uno::Reference< beans::XPropertySet > xFieldProperties); 534 void handleDocProperty 535 (FieldContextPtr pContext, 536 PropertyNameSupplier& rPropNameSupplier, 537 uno::Reference< uno::XInterface > & xFieldInterface, 538 uno::Reference< beans::XPropertySet > xFieldProperties); 539 void handleToc 540 (FieldContextPtr pContext, 541 PropertyNameSupplier& rPropNameSupplier, 542 uno::Reference< uno::XInterface > & xFieldInterface, 543 uno::Reference< beans::XPropertySet > xFieldProperties, 544 const ::rtl::OUString & sTOCServiceName); 545 //the field command has to be closed (0x14 appeared) 546 void CloseFieldCommand(); 547 //the _current_ fields require a string type result while TOCs accept richt results 548 bool IsFieldResultAsString(); 549 //apply the result text to the related field 550 void SetFieldResult( ::rtl::OUString& rResult ); 551 // set FFData of top field context 552 void SetFieldFFData( FFDataHandler::Pointer_t pFFDataHandler ); 553 //the end of field is reached (0x15 appeared) - the command might still be open 554 void PopFieldContext(); 555 556 void AddBookmark( 557 const ::rtl::OUString& rBookmarkName, 558 const sal_Int32 nId ); 559 560 void AddAnnotationPosition( 561 const bool bStart, 562 const sal_Int32 nAnnotationId ); 563 getTableManager()564 DomainMapperTableManager& getTableManager() 565 { 566 boost::shared_ptr< DomainMapperTableManager > pMngr = m_aTableManagers.top(); 567 return *pMngr.get( ); 568 } 569 appendTableManager()570 void appendTableManager() 571 { 572 boost::shared_ptr< DomainMapperTableManager > pMngr( 573 new DomainMapperTableManager( m_eDocumentType == DOCUMENT_OOXML ) ); 574 m_aTableManagers.push( pMngr ); 575 } 576 popTableManager()577 void popTableManager( ) 578 { 579 if ( m_aTableManagers.size( ) > 0 ) 580 m_aTableManagers.pop( ); 581 } 582 583 void SetLineNumbering( sal_Int32 nLnnMod, sal_Int32 nLnc, sal_Int32 ndxaLnn ); IsLineNumberingSet() const584 bool IsLineNumberingSet() const {return m_bLineNumberingSet;} 585 586 DeletableTabStop m_aCurrentTabStop; 587 IsOOXMLImport() const588 bool IsOOXMLImport() const { return m_eDocumentType == DOCUMENT_OOXML; } 589 InitPageMargins()590 void InitPageMargins() { m_aPageMargins = _PageMar(); } 591 void SetPageMarginTwip( PageMarElement eElement, sal_Int32 nValue ); GetPageMargins() const592 const _PageMar& GetPageMargins() const {return m_aPageMargins;} 593 GetLineNumberSettings() const594 const LineNumberSettings& GetLineNumberSettings() const { return m_aLineNumberSettings;} SetLineNumberSettings(const LineNumberSettings & rSet)595 void SetLineNumberSettings(const LineNumberSettings& rSet) { m_aLineNumberSettings = rSet;} 596 SetInFootnoteProperties(bool bSet)597 void SetInFootnoteProperties(bool bSet) { m_bIsInFootnoteProperties = bSet;} IsInFootnoteProperties() const598 bool IsInFootnoteProperties() const { return m_bIsInFootnoteProperties;} 599 SetCustomFtnMark(bool bSet)600 void SetCustomFtnMark(bool bSet) { m_bIsCustomFtnMark = bSet; } IsCustomFtnMark() const601 bool IsCustomFtnMark() const { return m_bIsCustomFtnMark; } 602 IsInComments() const603 bool IsInComments() const { return m_bIsInComments; }; 604 605 void RegisterFrameConversion( 606 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xFrameStartRange, 607 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xFrameEndRange, 608 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aFrameProperties 609 ); 610 bool ExecuteFrameConversion(); 611 612 void AddNewRedline( ); 613 614 RedlineParamsPtr GetTopRedline( ); 615 616 sal_Int32 GetCurrentRedlineToken( ); 617 void SetCurrentRedlineAuthor( rtl::OUString sAuthor ); 618 void SetCurrentRedlineDate( rtl::OUString sDate ); 619 void SetCurrentRedlineId( sal_Int32 nId ); 620 void SetCurrentRedlineToken( sal_Int32 nToken ); 621 void RemoveCurrentRedline( ); 622 void ResetParaRedline( ); 623 void SetCurrentRedlineInitials( rtl::OUString sInitials ); 624 625 void ApplySettingsTable(); 626 SectionPropertyMap * GetSectionContext(); 627 }; 628 } //namespace dmapper 629 } //namespace writerfilter 630 #endif 631