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 throw(::com::sun::star::uno::Exception); 379 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetDocumentSettings(); 380 381 public: 382 DomainMapper_Impl( 383 DomainMapper& rDMapper, 384 uno::Reference < uno::XComponentContext > xContext, 385 uno::Reference< lang::XComponent > xModel, 386 SourceDocumentType eDocumentType ); 387 DomainMapper_Impl(); 388 virtual ~DomainMapper_Impl(); 389 GetLastSectionContext()390 SectionPropertyMap* GetLastSectionContext( ) 391 { 392 return dynamic_cast< SectionPropertyMap* >( m_pLastSectionContext.get( ) ); 393 } 394 395 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetPageStyles(); 396 ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > GetBodyText(); GetTextFactory() const397 ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > GetTextFactory() const 398 { 399 return m_xTextFactory; 400 } GetComponentContext() const401 ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > GetComponentContext() const 402 { 403 return m_xComponentContext; 404 } GetTextDocument() const405 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > GetTextDocument() const 406 { 407 return m_xTextDocument; 408 } 409 void SetDocumentSettingsProperty( const ::rtl::OUString& rPropName, const uno::Any& rValue ); 410 411 void CreateRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange, RedlineParamsPtr& pRedline ); 412 413 void CheckParaRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange ); 414 415 void CheckRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange ); 416 417 void StartParaChange( ); 418 void EndParaChange( ); 419 420 void RemoveLastParagraph( ); 421 void SetIsLastParagraphInSection( bool bIsLast ); 422 423 void deferBreak( BreakType deferredBreakType ); 424 bool isBreakDeferred( BreakType deferredBreakType ); 425 void clearDeferredBreaks(); 426 void finishParagraph( PropertyMapPtr pPropertyMap ); 427 void appendTextPortion( const ::rtl::OUString& rString, PropertyMapPtr pPropertyMap ); 428 void appendTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >, 429 const uno::Sequence< beans::PropertyValue > ); 430 void appendOLE( const ::rtl::OUString& rStreamName, OLEHandlerPtr pOleHandler ); 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 // void appendTextSection(); 435 GetFIB()436 FIB& GetFIB() {return m_aFIB;} 437 // push the new properties onto the stack and make it the 'current' property map 438 void PushProperties(ContextType eId); 439 void PushStyleProperties(PropertyMapPtr pStyleProperties); 440 void PushListProperties(PropertyMapPtr pListProperties); 441 void PopProperties(ContextType eId); 442 GetTopContextType() const443 ContextType GetTopContextType() const { return m_aContextStack.top(); } GetTopContext()444 PropertyMapPtr GetTopContext() 445 { 446 return m_pTopContext; 447 } 448 PropertyMapPtr GetTopContextOfType(ContextType eId); 449 450 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend > GetTopTextAppend(); 451 GetFontTable()452 FontTablePtr GetFontTable() 453 { 454 if(!m_pFontTable) 455 m_pFontTable.reset(new FontTable()); 456 return m_pFontTable; 457 } GetStyleSheetTable()458 StyleSheetTablePtr GetStyleSheetTable() 459 { 460 if(!m_pStyleSheetTable) 461 m_pStyleSheetTable.reset(new StyleSheetTable( m_rDMapper, m_xTextDocument )); 462 return m_pStyleSheetTable; 463 } 464 ListsManager::Pointer GetListTable(); GetThemeTable()465 ThemeTablePtr GetThemeTable() 466 { 467 if(!m_pThemeTable) 468 m_pThemeTable.reset( new ThemeTable ); 469 return m_pThemeTable; 470 } 471 GetSettingsTable()472 SettingsTablePtr GetSettingsTable() 473 { 474 if( !m_pSettingsTable ) 475 m_pSettingsTable.reset( new SettingsTable( m_rDMapper, m_xTextFactory ) ); 476 return m_pSettingsTable; 477 } 478 479 GraphicImportPtr GetGraphicImport( GraphicImportType eGraphicImportType ); 480 void ResetGraphicImport(); 481 // this method deletes the current m_pGraphicImport after import 482 void ImportGraphic(writerfilter::Reference< Properties>::Pointer_t, GraphicImportType eGraphicImportType ); 483 484 void InitTabStopFromStyle( const ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop >& rInitTabStops ); 485 void ModifyCurrentTabStop( Id nId, sal_Int32 nValue); 486 void IncorporateTabStop( const DeletableTabStop &aTabStop ); 487 ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > GetCurrentTabStopAndClear(); NextTabStop()488 void NextTabStop() {++m_nCurrentTabStopIndex;} 489 SetCurrentParaStyleId(::rtl::OUString sStringValue)490 void SetCurrentParaStyleId(::rtl::OUString sStringValue) {m_sCurrentParaStyleId = sStringValue;} GetCurrentParaStyleId() const491 ::rtl::OUString GetCurrentParaStyleId() const {return m_sCurrentParaStyleId;} 492 493 ::com::sun::star::uno::Any GetPropertyFromStyleSheet(PropertyIds eId); SetStyleSheetImport(bool bSet)494 void SetStyleSheetImport( bool bSet ) { m_bInStyleSheetImport = bSet;} IsStyleSheetImport() const495 bool IsStyleSheetImport()const { return m_bInStyleSheetImport;} SetAnyTableImport(bool bSet)496 void SetAnyTableImport( bool bSet ) { m_bInAnyTableImport = bSet;} IsAnyTableImport() const497 bool IsAnyTableImport()const { return m_bInAnyTableImport;} 498 499 void PushShapeContext( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); 500 void PopShapeContext(); 501 502 void PushPageHeader(SectionPropertyMap::PageType eType); 503 void PushPageFooter(SectionPropertyMap::PageType eType); 504 505 void PopPageHeaderFooter(); 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(::rtl::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 void handleDocProperty 536 (FieldContextPtr pContext, 537 PropertyNameSupplier& rPropNameSupplier, 538 uno::Reference< uno::XInterface > & xFieldInterface, 539 uno::Reference< beans::XPropertySet > xFieldProperties); 540 void handleToc 541 (FieldContextPtr pContext, 542 PropertyNameSupplier& rPropNameSupplier, 543 uno::Reference< uno::XInterface > & xFieldInterface, 544 uno::Reference< beans::XPropertySet > xFieldProperties, 545 const ::rtl::OUString & sTOCServiceName); 546 //the field command has to be closed (0x14 appeared) 547 void CloseFieldCommand(); 548 //the _current_ fields require a string type result while TOCs accept richt results 549 bool IsFieldResultAsString(); 550 //apply the result text to the related field 551 void SetFieldResult( ::rtl::OUString& rResult ); 552 // set FFData of top field context 553 void SetFieldFFData( FFDataHandler::Pointer_t pFFDataHandler ); 554 //the end of field is reached (0x15 appeared) - the command might still be open 555 void PopFieldContext(); 556 557 void AddBookmark( 558 const ::rtl::OUString& rBookmarkName, 559 const sal_Int32 nId ); 560 561 void AddAnnotationPosition( 562 const bool bStart, 563 const sal_Int32 nAnnotationId ); 564 getTableManager()565 DomainMapperTableManager& getTableManager() 566 { 567 boost::shared_ptr< DomainMapperTableManager > pMngr = m_aTableManagers.top(); 568 return *pMngr.get( ); 569 } 570 appendTableManager()571 void appendTableManager() 572 { 573 boost::shared_ptr< DomainMapperTableManager > pMngr( 574 new DomainMapperTableManager( m_eDocumentType == DOCUMENT_OOXML ) ); 575 m_aTableManagers.push( pMngr ); 576 } 577 popTableManager()578 void popTableManager( ) 579 { 580 if ( m_aTableManagers.size( ) > 0 ) 581 m_aTableManagers.pop( ); 582 } 583 584 void SetLineNumbering( sal_Int32 nLnnMod, sal_Int32 nLnc, sal_Int32 ndxaLnn ); IsLineNumberingSet() const585 bool IsLineNumberingSet() const {return m_bLineNumberingSet;} 586 587 DeletableTabStop m_aCurrentTabStop; 588 IsOOXMLImport() const589 bool IsOOXMLImport() const { return m_eDocumentType == DOCUMENT_OOXML; } 590 InitPageMargins()591 void InitPageMargins() { m_aPageMargins = _PageMar(); } 592 void SetPageMarginTwip( PageMarElement eElement, sal_Int32 nValue ); GetPageMargins() const593 const _PageMar& GetPageMargins() const {return m_aPageMargins;} 594 GetLineNumberSettings() const595 const LineNumberSettings& GetLineNumberSettings() const { return m_aLineNumberSettings;} SetLineNumberSettings(const LineNumberSettings & rSet)596 void SetLineNumberSettings(const LineNumberSettings& rSet) { m_aLineNumberSettings = rSet;} 597 SetInFootnoteProperties(bool bSet)598 void SetInFootnoteProperties(bool bSet) { m_bIsInFootnoteProperties = bSet;} IsInFootnoteProperties() const599 bool IsInFootnoteProperties() const { return m_bIsInFootnoteProperties;} 600 SetCustomFtnMark(bool bSet)601 void SetCustomFtnMark(bool bSet) { m_bIsCustomFtnMark = bSet; } IsCustomFtnMark() const602 bool IsCustomFtnMark() const { return m_bIsCustomFtnMark; } 603 IsInComments() const604 bool IsInComments() const { return m_bIsInComments; }; 605 606 void RegisterFrameConversion( 607 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xFrameStartRange, 608 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xFrameEndRange, 609 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aFrameProperties 610 ); 611 bool ExecuteFrameConversion(); 612 613 void AddNewRedline( ); 614 615 RedlineParamsPtr GetTopRedline( ); 616 617 sal_Int32 GetCurrentRedlineToken( ); 618 void SetCurrentRedlineAuthor( rtl::OUString sAuthor ); 619 void SetCurrentRedlineDate( rtl::OUString sDate ); 620 void SetCurrentRedlineId( sal_Int32 nId ); 621 void SetCurrentRedlineToken( sal_Int32 nToken ); 622 void RemoveCurrentRedline( ); 623 void ResetParaRedline( ); 624 void SetCurrentRedlineInitials( rtl::OUString sInitials ); 625 626 void ApplySettingsTable(); 627 SectionPropertyMap * GetSectionContext(); 628 }; 629 } //namespace dmapper 630 } //namespace writerfilter 631 #endif 632