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 24 #ifndef _WW8ATTRIBUTEOUTPUT_HXX_ 25 #define _WW8ATTRIBUTEOUTPUT_HXX_ 26 27 #include "attributeoutputbase.hxx" 28 #include "wrtww8.hxx" 29 30 class WW8AttributeOutput : public AttributeOutputBase 31 { 32 public: 33 /// Export the state of RTL/CJK. 34 virtual void RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript ); 35 36 /// Start of the paragraph. 37 virtual void StartParagraph( ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/ ) {} 38 39 /// End of the paragraph. 40 virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner ); 41 42 /// Called before we start outputting the attributes. 43 virtual void StartParagraphProperties( const SwTxtNode& /*rNode*/ ) {} 44 45 /// Called after we end outputting the attributes. 46 virtual void EndParagraphProperties() {} 47 48 /// Empty paragraph. 49 virtual void EmptyParagraph(); 50 51 /// Start of the text run. 52 /// 53 virtual void StartRun( const SwRedlineData* pRedlineData ); 54 55 virtual void OnTOXEnding(); 56 57 /// End of the text run. 58 /// 59 /// No-op for binary filters. 60 virtual void EndRun() {} 61 62 /// Before we start outputting the attributes. 63 virtual void StartRunProperties(); 64 65 /// After we end outputting the attributes. 66 virtual void EndRunProperties( const SwRedlineData* pRedlineData ); 67 68 /// Output text. 69 virtual void RunText( const String& rText, rtl_TextEncoding eCharSet ); 70 71 /// Output text (without markup). 72 virtual void RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet ); 73 74 /// Output ruby start. 75 virtual void StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby ); 76 77 /// Output ruby end. 78 virtual void EndRuby(); 79 80 /// Output URL start. 81 virtual bool StartURL( const String &rUrl, const String &rTarget ); 82 83 /// Output URL end. 84 virtual bool EndURL(); 85 86 virtual void FieldVanish( const String& rTxt, ww::eField eType ); 87 88 /// Output redlining. 89 virtual void Redline( const SwRedlineData* pRedline ); 90 91 virtual void FormatDrop( const SwTxtNode& rNode, const SwFmtDrop &rSwFmtDrop, sal_uInt16 nStyle, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner ); 92 93 /// Output FKP (Formatted disK Page) - necessary for binary formats only. 94 /// FIXME having it in AttributeOutputBase is probably a hack, it 95 /// should be in WW8AttributeOutput only... 96 virtual void OutputFKP(); 97 98 /// Output style. 99 virtual void ParagraphStyle( sal_uInt16 nStyle ); 100 101 virtual void TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ); 102 103 virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ); 104 105 virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ); 106 107 virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ); 108 109 virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ); 110 111 virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ); 112 113 virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ); 114 115 virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ); 116 117 virtual void TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ); 118 119 virtual void TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo ); 120 121 virtual void TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner ); 122 123 virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); 124 125 virtual void TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); 126 127 virtual void TableRowEnd( sal_uInt32 nDepth = 1 ); 128 129 /// Start of the styles table. 130 virtual void StartStyles(); 131 132 /// End of the styles table. 133 virtual void EndStyles( sal_uInt16 nNumberOfStyles ); 134 135 /// Write default style. 136 virtual void DefaultStyle( sal_uInt16 nStyle ); 137 138 /// Start of a style in the styles table. 139 virtual void StartStyle( const String& rName, bool bPapFmt, 140 sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwIdi, sal_uInt16 nId ); 141 142 /// End of a style in the styles table. 143 virtual void EndStyle(); 144 145 /// Start of (paragraph or run) properties of a style. 146 virtual void StartStyleProperties( bool bParProp, sal_uInt16 nStyle ); 147 148 /// End of (paragraph or run) properties of a style. 149 virtual void EndStyleProperties( bool bParProp ); 150 151 /// Numbering rule and Id. 152 virtual void OutlineNumbering( sal_uInt8 nLvl, const SwNumFmt &rNFmt, const SwFmt &rFmt ); 153 154 /// Page break 155 /// As a paragraph property - the paragraph should be on the next page. 156 virtual void PageBreakBefore( bool bBreak ); 157 158 /// Write a section break 159 /// msword::ColumnBreak or msword::PageBreak 160 virtual void SectionBreak( sal_uInt8 nC, const WW8_SepInfo* pSectionInfo = NULL ); 161 162 /// Start of the section properties. 163 virtual void StartSection(); 164 165 /// End of the section properties. 166 /// 167 /// No-op for binary filters. 168 virtual void EndSection() {} 169 170 /// Protection of forms. 171 virtual void SectionFormProtection( bool bProtected ); 172 173 /// Numbering of the lines in the document. 174 virtual void SectionLineNumbering( sal_uLong nRestartNo, const SwLineNumberInfo& rLnNumInfo ); 175 176 /// Has different headers/footers for the title page. 177 virtual void SectionTitlePage(); 178 179 /// Description of the page borders. 180 virtual void SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmFmt* pFirstPageFmt ); 181 182 /// Columns populated from right/numbers on the right side? 183 virtual void SectionBiDi( bool bBiDi ); 184 185 /// The style of the page numbers. 186 /// 187 /// nPageRestartNumberr being 0 means no restart. 188 virtual void SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 nPageRestartNumber ); 189 190 /// The type of breaking. 191 virtual void SectionType( sal_uInt8 nBreakCode ); 192 193 /// Special header/footer flags, needed for old versions only. 194 virtual void SectionWW6HeaderFooterFlags( sal_uInt8 nHeadFootFlags ); 195 196 /// Definition of a numbering instance. 197 virtual void NumberingDefinition( sal_uInt16 nId, const SwNumRule &rRule ); 198 199 /// All the numbering level information. 200 virtual void NumberingLevel( sal_uInt8 nLevel, 201 sal_uInt16 nStart, 202 sal_uInt16 nNumberingType, 203 SvxAdjust eAdjust, 204 const sal_uInt8 *pNumLvlPos, 205 sal_uInt8 nFollow, 206 const wwFont *pFont, 207 const SfxItemSet *pOutSet, 208 sal_Int16 nIndentAt, 209 sal_Int16 nFirstLineIndex, 210 sal_Int16 nListTabPos, 211 const String &rNumberingString ); 212 213 protected: 214 /// Output frames - the implementation. 215 void OutputFlyFrame_Impl( const sw::Frame& rFmt, const Point& rNdTopLeft ); 216 217 /// Sfx item Sfx item RES_CHRATR_CASEMAP 218 virtual void CharCaseMap( const SvxCaseMapItem& ); 219 220 /// Sfx item Sfx item RES_CHRATR_COLOR 221 virtual void CharColor( const SvxColorItem& ); 222 223 /// Sfx item Sfx item RES_CHRATR_CONTOUR 224 virtual void CharContour( const SvxContourItem& ); 225 226 /// Sfx item RES_CHRATR_CROSSEDOUT 227 virtual void CharCrossedOut( const SvxCrossedOutItem& rHt ); 228 229 /// Sfx item RES_CHRATR_ESCAPEMENT 230 virtual void CharEscapement( const SvxEscapementItem& ); 231 232 /// Sfx item RES_CHRATR_FONT 233 virtual void CharFont( const SvxFontItem& ); 234 235 /// Sfx item RES_CHRATR_FONTSIZE 236 virtual void CharFontSize( const SvxFontHeightItem& ); 237 238 /// Sfx item RES_CHRATR_KERNING 239 virtual void CharKerning( const SvxKerningItem& ); 240 241 /// Sfx item RES_CHRATR_LANGUAGE 242 virtual void CharLanguage( const SvxLanguageItem& ); 243 244 /// Sfx item RES_CHRATR_POSTURE 245 virtual void CharPosture( const SvxPostureItem& ); 246 247 /// Sfx item RES_CHRATR_SHADOWED 248 virtual void CharShadow( const SvxShadowedItem& ); 249 250 /// Sfx item RES_CHRATR_UNDERLINE 251 virtual void CharUnderline( const SvxUnderlineItem& ); 252 253 /// Sfx item RES_CHRATR_WEIGHT 254 virtual void CharWeight( const SvxWeightItem& ); 255 256 /// Sfx item RES_CHRATR_AUTOKERN 257 virtual void CharAutoKern( const SvxAutoKernItem& ); 258 259 /// Sfx item RES_CHRATR_BLINK 260 virtual void CharAnimatedText( const SvxBlinkItem& ); 261 262 /// Sfx item RES_CHRATR_BACKGROUND 263 virtual void CharBackground( const SvxBrushItem& ); 264 265 /// Sfx item RES_CHRATR_CJK_FONT 266 virtual void CharFontCJK( const SvxFontItem& ); 267 268 /// Sfx item RES_CHRATR_CJK_FONTSIZE 269 virtual void CharFontSizeCJK( const SvxFontHeightItem& rHt ) { CharFontSize( rHt ); } 270 271 /// Sfx item RES_CHRATR_CJK_LANGUAGE 272 virtual void CharLanguageCJK( const SvxLanguageItem& rHt ) { CharLanguage( rHt ); } 273 274 /// Sfx item RES_CHRATR_CJK_POSTURE 275 virtual void CharPostureCJK( const SvxPostureItem& rHt ) { CharPosture( rHt ); } 276 277 /// Sfx item RES_CHRATR_CJK_WEIGHT 278 virtual void CharWeightCJK( const SvxWeightItem& rHt ) { CharWeight( rHt ); } 279 280 /// Sfx item RES_CHRATR_CTL_FONT 281 virtual void CharFontCTL( const SvxFontItem& ); 282 283 /// Sfx item RES_CHRATR_CTL_FONTSIZE 284 virtual void CharFontSizeCTL( const SvxFontHeightItem& rHt ) { CharFontSize( rHt ); } 285 286 /// Sfx item RES_CHRATR_CTL_LANGUAGE 287 virtual void CharLanguageCTL( const SvxLanguageItem& rHt ) { CharLanguage( rHt ); } 288 289 /// Sfx item RES_CHRATR_CTL_POSTURE 290 virtual void CharPostureCTL( const SvxPostureItem& ); 291 292 /// Sfx item RES_CHRATR_CTL_WEIGHT 293 virtual void CharWeightCTL( const SvxWeightItem& ); 294 295 /// Sfx item RES_CHRATR_BidiRTL 296 virtual void CharBidiRTL( const SfxPoolItem& rHt ); 297 298 /// Sfx item RES_CHRATR_IdctHint 299 virtual void CharIdctHint( const SfxPoolItem& rHt ); 300 301 /// Sfx item RES_CHRATR_ROTATE 302 virtual void CharRotate( const SvxCharRotateItem& ); 303 304 /// Sfx item RES_CHRATR_EMPHASIS_MARK 305 virtual void CharEmphasisMark( const SvxEmphasisMarkItem& rHt ); 306 307 /// Sfx item RES_CHRATR_TWO_LINES 308 virtual void CharTwoLines( const SvxTwoLinesItem& ); 309 310 /// Sfx item RES_CHRATR_SCALEW 311 virtual void CharScaleWidth( const SvxCharScaleWidthItem& ); 312 313 /// Sfx item RES_CHRATR_RELIEF 314 virtual void CharRelief( const SvxCharReliefItem& ); 315 316 /// Sfx item RES_CHRATR_HIDDEN 317 virtual void CharHidden( const SvxCharHiddenItem& ); 318 319 /// Sfx item RES_TXTATR_INETFMT 320 virtual void TextINetFormat( const SwFmtINetFmt& ); 321 322 /// Sfx item RES_TXTATR_CHARFMT 323 virtual void TextCharFormat( const SwFmtCharFmt& ); 324 325 /// Sfx item RES_TXTATR_FTN 326 virtual void TextFootnote_Impl( const SwFmtFtn& ); 327 328 /// Sfx item RES_PARATR_LINESPACING 329 virtual void ParaLineSpacing_Impl( short nSpace, short nMulti ); 330 331 /// Sfx item RES_PARATR_ADJUST 332 virtual void ParaAdjust( const SvxAdjustItem& rHt ); 333 334 /// Sfx item RES_PARATR_SPLIT 335 virtual void ParaSplit( const SvxFmtSplitItem& ); 336 337 /// Sfx item RES_PARATR_WIDOWS 338 virtual void ParaWidows( const SvxWidowsItem& rHt ); 339 340 /// Sfx item RES_PARATR_TABSTOP 341 virtual void ParaTabStop( const SvxTabStopItem& rHt ); 342 343 /// Sfx item RES_PARATR_HYPHENZONE 344 virtual void ParaHyphenZone( const SvxHyphenZoneItem& ); 345 346 /// Sfx item RES_PARATR_NUMRULE 347 virtual void ParaNumRule_Impl( const SwTxtNode *pTxtNd, sal_Int32 nLvl, sal_Int32 nNumId ); 348 349 /// Sfx item RES_PARATR_SCRIPTSPACE 350 virtual void ParaScriptSpace( const SfxBoolItem& ); 351 352 /// Sfx item RES_PARATR_VERTALIGN 353 virtual void ParaVerticalAlign( const SvxParaVertAlignItem& ); 354 355 /// Sfx item RES_PARATR_SNAPTOGRID 356 virtual void ParaSnapToGrid( const SvxParaGridItem& ); 357 358 /// Sfx item RES_FRM_SIZE 359 virtual void FormatFrameSize( const SwFmtFrmSize& ); 360 361 /// Sfx item RES_PAPER_BIN 362 virtual void FormatPaperBin( const SvxPaperBinItem& ); 363 364 /// Sfx item RES_LR_SPACE 365 virtual void FormatLRSpace( const SvxLRSpaceItem& ); 366 367 /// Sfx item RES_UL_SPACE 368 virtual void FormatULSpace( const SvxULSpaceItem& rHt ); 369 370 /// Sfx item RES_SURROUND 371 virtual void FormatSurround( const SwFmtSurround& ); 372 373 /// Sfx item RES_VERT_ORIENT 374 virtual void FormatVertOrientation( const SwFmtVertOrient& ); 375 376 /// Sfx item RES_HORI_ORIENT 377 virtual void FormatHorizOrientation( const SwFmtHoriOrient& ); 378 379 /// Sfx item RES_ANCHOR 380 virtual void FormatAnchor( const SwFmtAnchor& ); 381 382 /// Sfx item RES_BACKGROUND 383 virtual void FormatBackground( const SvxBrushItem& ); 384 385 /// Sfx item RES_BOX 386 virtual void FormatBox( const SvxBoxItem& ); 387 388 /// Sfx item RES_COL 389 virtual void FormatColumns_Impl( sal_uInt16 nCols, const SwFmtCol & rCol, bool bEven, SwTwips nPageSize ); 390 391 /// Sfx item RES_KEEP 392 virtual void FormatKeep( const SvxFmtKeepItem& ); 393 394 /// Sfx item RES_TEXTGRID 395 virtual void FormatTextGrid( const SwTextGridItem& ); 396 397 /// Sfx item RES_LINENUMBER 398 virtual void FormatLineNumbering( const SwFmtLineNumber& ); 399 400 /// Sfx item RES_FRAMEDIR 401 virtual void FormatFrameDirection( const SvxFrameDirectionItem& ); 402 403 /// Write the expanded field 404 virtual void WriteExpand( const SwField* pFld ); 405 406 virtual void RefField ( const SwField& rFld, const String& rRef ); 407 virtual void HiddenField( const SwField& rFld ); 408 virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd ); 409 virtual void PostitField( const SwField* pFld ); 410 virtual bool DropdownField( const SwField* pFld ); 411 412 virtual bool AnalyzeURL( const String& rURL, const String& rTarget, String* pLinkURL, String* pMark ); 413 414 /// Reference to the export, where to get the data from 415 WW8Export &m_rWW8Export; 416 417 /// For output of styles. 418 /// 419 /// We have to remember these positions between the StartStyle() and 420 /// EndStyle(). 421 sal_uInt16 nPOPosStdLen1, nPOPosStdLen2; 422 423 /// For output of styles. 424 /// 425 /// We have to remember this position between StartStyleProperties() and 426 /// EndStyleProperties(). 427 sal_uInt16 m_nStyleStartSize, m_nStyleLenPos; 428 429 /// For output of styles. 430 /// 431 /// Used between StartStyles() and EndStyles(). 432 sal_uLong m_nStyAnzPos; 433 434 /// For output of run properties. 435 /// 436 /// We have to remember the number of field results, and do not export end 437 /// of the field results if we were forced to split text. 438 sal_uInt16 m_nFieldResults; 439 440 bool mbOnTOXEnding; 441 442 public: 443 WW8AttributeOutput( WW8Export &rWW8Export ) : AttributeOutputBase(), m_rWW8Export( rWW8Export ),mbOnTOXEnding(false) {} 444 virtual ~WW8AttributeOutput() {} 445 446 /// Return the right export class. 447 virtual MSWordExportBase& GetExport() { return m_rWW8Export; } 448 449 protected: 450 /// Output the bold etc. attributes 451 void OutputWW8Attribute( sal_uInt8 nId, bool bVal ); 452 453 /// Output the bold etc. attributes, the Complex Text Layout version 454 void OutputWW8AttributeCTL( sal_uInt8 nId, bool bVal ); 455 456 }; 457 458 #endif // _WW8ATTRIBUTEOUTPUT_HXX_ 459 460 /* vi:set tabstop=4 shiftwidth=4 expandtab: */ 461