LCOV - code coverage report
Current view: top level - writerfilter/source/rtftok - rtfdocumentimpl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2012-08-25 Functions: 9 9 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 23 46 50.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       3                 :            :  *
       4                 :            :  * The contents of this file are subject to the Mozilla Public License Version
       5                 :            :  * 1.1 (the "License"); you may not use this file except in compliance with
       6                 :            :  * the License. You may obtain a copy of the License at
       7                 :            :  * http://www.mozilla.org/MPL/
       8                 :            :  *
       9                 :            :  * Software distributed under the License is distributed on an "AS IS" basis,
      10                 :            :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      11                 :            :  * for the specific language governing rights and limitations under the
      12                 :            :  * License.
      13                 :            :  *
      14                 :            :  * The Initial Developer of the Original Code is
      15                 :            :  *       Miklos Vajna <vmiklos@frugalware.org>
      16                 :            :  * Portions created by the Initial Developer are Copyright (C) 2011 the
      17                 :            :  * Initial Developer. All Rights Reserved.
      18                 :            :  *
      19                 :            :  * Contributor(s):
      20                 :            :  *
      21                 :            :  * Alternatively, the contents of this file may be used under the terms of
      22                 :            :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      23                 :            :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      24                 :            :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      25                 :            :  * instead of those above.
      26                 :            :  */
      27                 :            : 
      28                 :            : #ifndef _RTFDOCUMENTIMPL_HXX_
      29                 :            : #define _RTFDOCUMENTIMPL_HXX_
      30                 :            : 
      31                 :            : #include <stack>
      32                 :            : #include <queue>
      33                 :            : 
      34                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      35                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      36                 :            : #include <com/sun/star/document/XDocumentProperties.hpp>
      37                 :            : #include <oox/helper/graphichelper.hxx>
      38                 :            : #include <oox/mathml/importutils.hxx>
      39                 :            : #include <rtl/strbuf.hxx>
      40                 :            : 
      41                 :            : #include <rtftok/RTFDocument.hxx>
      42                 :            : #include <rtfreferencetable.hxx>
      43                 :            : #include <rtfsprm.hxx>
      44                 :            : 
      45                 :            : class SvStream;
      46                 :            : 
      47                 :            : namespace writerfilter {
      48                 :            :     namespace rtftok {
      49                 :            :         enum RTFInternalState
      50                 :            :         {
      51                 :            :             INTERNAL_NORMAL,
      52                 :            :             INTERNAL_BIN,
      53                 :            :             INTERNAL_HEX
      54                 :            :         };
      55                 :            : 
      56                 :            :         // Note that this is not a 1:1 mapping between destination control
      57                 :            :         // words, e.g. RTF_PICT gets mapped to DESTINATION_PICT or
      58                 :            :         // DESTINATION_SHAPEPROPERTYVALUEPICT, etc.
      59                 :            :         enum RTFDesitnationState
      60                 :            :         {
      61                 :            :             DESTINATION_NORMAL,
      62                 :            :             DESTINATION_SKIP,
      63                 :            :             DESTINATION_FONTTABLE,
      64                 :            :             DESTINATION_FONTENTRY,
      65                 :            :             DESTINATION_COLORTABLE,
      66                 :            :             DESTINATION_STYLESHEET,
      67                 :            :             DESTINATION_STYLEENTRY,
      68                 :            :             DESTINATION_FIELD,
      69                 :            :             DESTINATION_FIELDINSTRUCTION,
      70                 :            :             DESTINATION_FIELDRESULT,
      71                 :            :             DESTINATION_LISTTABLE,
      72                 :            :             DESTINATION_LISTENTRY,
      73                 :            :             DESTINATION_LISTOVERRIDETABLE,
      74                 :            :             DESTINATION_LISTOVERRIDEENTRY,
      75                 :            :             DESTINATION_LISTLEVEL,
      76                 :            :             DESTINATION_LEVELTEXT,
      77                 :            :             DESTINATION_LEVELNUMBERS,
      78                 :            :             DESTINATION_SHPPICT,
      79                 :            :             DESTINATION_PICT,
      80                 :            :             DESTINATION_PICPROP,
      81                 :            :             DESTINATION_SHAPEPROPERTY,
      82                 :            :             DESTINATION_SHAPEPROPERTYNAME,
      83                 :            :             DESTINATION_SHAPEPROPERTYVALUE,
      84                 :            :             DESTINATION_SHAPE,
      85                 :            :             DESTINATION_SHAPEINSTRUCTION,
      86                 :            :             DESTINATION_SHAPEPROPERTYVALUEPICT,
      87                 :            :             DESTINATION_NESTEDTABLEPROPERTIES,
      88                 :            :             DESTINATION_FOOTNOTE,
      89                 :            :             DESTINATION_BOOKMARKSTART,
      90                 :            :             DESTINATION_BOOKMARKEND,
      91                 :            :             DESTINATION_REVISIONTABLE,
      92                 :            :             DESTINATION_REVISIONENTRY,
      93                 :            :             DESTINATION_SHAPETEXT,
      94                 :            :             DESTINATION_FORMFIELD,
      95                 :            :             DESTINATION_FORMFIELDNAME,
      96                 :            :             DESTINATION_FORMFIELDLIST,
      97                 :            :             DESTINATION_DATAFIELD,
      98                 :            :             DESTINATION_INFO,
      99                 :            :             DESTINATION_CREATIONTIME,
     100                 :            :             DESTINATION_REVISIONTIME,
     101                 :            :             DESTINATION_PRINTTIME,
     102                 :            :             DESTINATION_AUTHOR,
     103                 :            :             DESTINATION_KEYWORDS,
     104                 :            :             DESTINATION_OPERATOR,
     105                 :            :             DESTINATION_COMPANY,
     106                 :            :             DESTINATION_COMMENT,
     107                 :            :             DESTINATION_OBJECT,
     108                 :            :             DESTINATION_OBJDATA,
     109                 :            :             DESTINATION_RESULT,
     110                 :            :             DESTINATION_ANNOTATIONDATE,
     111                 :            :             DESTINATION_ANNOTATIONAUTHOR,
     112                 :            :             DESTINATION_FALT,
     113                 :            :             DESTINATION_FLYMAINCONTENT,
     114                 :            :             DESTINATION_DRAWINGOBJECT,
     115                 :            :             DESTINATION_PARAGRAPHNUMBERING,
     116                 :            :             DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE,
     117                 :            :             DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER,
     118                 :            :             DESTINATION_TITLE,
     119                 :            :             DESTINATION_SUBJECT,
     120                 :            :             DESTINATION_DOCCOMM,
     121                 :            :             DESTINATION_ATNID,
     122                 :            :             DESTINATION_MOMATH,
     123                 :            :             DESTINATION_MR,
     124                 :            :             DESTINATION_MF,
     125                 :            :             DESTINATION_MFPR,
     126                 :            :             DESTINATION_MCTRLPR,
     127                 :            :             DESTINATION_MNUM,
     128                 :            :             DESTINATION_MDEN,
     129                 :            :             DESTINATION_MACC,
     130                 :            :             DESTINATION_MACCPR,
     131                 :            :             DESTINATION_MCHR,
     132                 :            :             DESTINATION_MPOS,
     133                 :            :             DESTINATION_MVERTJC,
     134                 :            :             DESTINATION_MSTRIKEH,
     135                 :            :             DESTINATION_MDEGHIDE,
     136                 :            :             DESTINATION_ME,
     137                 :            :             DESTINATION_MBAR,
     138                 :            :             DESTINATION_MBARPR,
     139                 :            :             DESTINATION_MD,
     140                 :            :             DESTINATION_MDPR,
     141                 :            :             DESTINATION_MBEGCHR,
     142                 :            :             DESTINATION_MSEPCHR,
     143                 :            :             DESTINATION_MENDCHR,
     144                 :            :             DESTINATION_MFUNC,
     145                 :            :             DESTINATION_MFUNCPR,
     146                 :            :             DESTINATION_MFNAME,
     147                 :            :             DESTINATION_MLIMLOW,
     148                 :            :             DESTINATION_MLIMLOWPR,
     149                 :            :             DESTINATION_MLIM,
     150                 :            :             DESTINATION_MM,
     151                 :            :             DESTINATION_MMPR,
     152                 :            :             DESTINATION_MMR,
     153                 :            :             DESTINATION_MNARY,
     154                 :            :             DESTINATION_MNARYPR,
     155                 :            :             DESTINATION_MSUB,
     156                 :            :             DESTINATION_MSUP,
     157                 :            :             DESTINATION_MSUBHIDE,
     158                 :            :             DESTINATION_MSUPHIDE,
     159                 :            :             DESTINATION_MLIMUPP,
     160                 :            :             DESTINATION_MLIMUPPPR,
     161                 :            :             DESTINATION_MGROUPCHR,
     162                 :            :             DESTINATION_MGROUPCHRPR,
     163                 :            :             DESTINATION_MBORDERBOX,
     164                 :            :             DESTINATION_MBORDERBOXPR,
     165                 :            :             DESTINATION_MRAD,
     166                 :            :             DESTINATION_MRADPR,
     167                 :            :             DESTINATION_MDEG,
     168                 :            :             DESTINATION_MSSUB,
     169                 :            :             DESTINATION_MSSUBPR,
     170                 :            :             DESTINATION_MSSUP,
     171                 :            :             DESTINATION_MSSUPPR,
     172                 :            :             DESTINATION_MSSUBSUP,
     173                 :            :             DESTINATION_MSSUBSUPPR,
     174                 :            :             DESTINATION_MSPRE,
     175                 :            :             DESTINATION_MSPREPR,
     176                 :            :             DESTINATION_MTYPE,
     177                 :            :             DESTINATION_MGROW,
     178                 :            :             DESTINATION_MBOX,
     179                 :            :             DESTINATION_MEQARR,
     180                 :            :         };
     181                 :            : 
     182                 :            :         enum RTFBorderState
     183                 :            :         {
     184                 :            :             BORDER_NONE,
     185                 :            :             BORDER_PARAGRAPH,
     186                 :            :             BORDER_PARAGRAPH_BOX,
     187                 :            :             BORDER_CELL,
     188                 :            :             BORDER_PAGE
     189                 :            :         };
     190                 :            : 
     191                 :            :         enum RTFErrors
     192                 :            :         {
     193                 :            :             ERROR_OK,
     194                 :            :             ERROR_GROUP_UNDER,
     195                 :            :             ERROR_GROUP_OVER,
     196                 :            :             ERROR_EOF,
     197                 :            :             ERROR_HEX_INVALID,
     198                 :            :             ERROR_CHAR_OVER
     199                 :            :         };
     200                 :            : 
     201                 :            :         /// Minimalistic buffer of elements for nested cells.
     202                 :            :         enum RTFBufferTypes
     203                 :            :         {
     204                 :            :             BUFFER_PROPS,
     205                 :            :             BUFFER_CELLEND,
     206                 :            :             BUFFER_STARTRUN,
     207                 :            :             BUFFER_TEXT,
     208                 :            :             BUFFER_UTEXT,
     209                 :            :             BUFFER_ENDRUN,
     210                 :            :             BUFFER_PAR
     211                 :            :         };
     212                 :            : 
     213                 :            :         /// Form field types
     214                 :            :         enum RTFFormFieldTypes
     215                 :            :         {
     216                 :            :             FORMFIELD_NONE,
     217                 :            :             FORMFIELD_TEXT,
     218                 :            :             FORMFIELD_CHECKBOX,
     219                 :            :             FORMFIELD_LIST
     220                 :            :         };
     221                 :            : 
     222                 :            :         enum RTFBmpStyles
     223                 :            :         {
     224                 :            :             BMPSTYLE_NONE,
     225                 :            :             BMPSTYLE_PNG
     226                 :            :         };
     227                 :            : 
     228                 :            :         enum RTFFieldStatus
     229                 :            :         {
     230                 :            :             FIELD_NONE,
     231                 :            :             FIELD_INSTRUCTION,
     232                 :            :             FIELD_RESULT
     233                 :            :         };
     234                 :            : 
     235                 :            :         /// A buffer storing dmapper calls.
     236                 :            :         typedef std::deque< std::pair<RTFBufferTypes, RTFValue::Pointer_t> > RTFBuffer_t;
     237                 :            : 
     238                 :            :         /// An entry in the color table.
     239                 :            :         class RTFColorTableEntry
     240                 :            :         {
     241                 :            :             public:
     242                 :            :                 RTFColorTableEntry();
     243                 :            :                 sal_uInt8 nRed;
     244                 :            :                 sal_uInt8 nGreen;
     245                 :            :                 sal_uInt8 nBlue;
     246                 :            :         };
     247                 :            : 
     248                 :            :         /// Stores the properties of a shape.
     249                 :     182718 :         class RTFShape
     250                 :            :         {
     251                 :            :             public:
     252                 :            :                 RTFShape();
     253                 :            :                 std::vector< std::pair<rtl::OUString, rtl::OUString> > aProperties;
     254                 :            :                 int nLeft;
     255                 :            :                 int nTop;
     256                 :            :                 int nRight;
     257                 :            :                 int nBottom;
     258                 :            :                 sal_Int16 nHoriOrientRelation;
     259                 :            :                 sal_Int16 nVertOrientRelation;
     260                 :            :         };
     261                 :            : 
     262                 :            :         /// Stores the properties of a drawing object.
     263         [ +  - ]:      90810 :         class RTFDrawingObject : public RTFShape
     264                 :            :         {
     265                 :            :             public:
     266                 :            :                 RTFDrawingObject();
     267                 :            :                 uno::Reference<drawing::XShape> xShape;
     268                 :            :                 uno::Reference<beans::XPropertySet> xPropertySet;
     269                 :            :                 std::vector<beans::PropertyValue> aPendingProperties;
     270                 :            :                 sal_uInt8 nLineColorR, nLineColorG, nLineColorB;
     271                 :            :                 bool bHasLineColor;
     272                 :            :                 sal_uInt8 nFillColorR, nFillColorG, nFillColorB;
     273                 :            :                 bool bHasFillColor;
     274                 :            :         };
     275                 :            : 
     276                 :            :         /// Stores the properties of a picture.
     277                 :            :         class RTFPicture
     278                 :            :         {
     279                 :            :             public:
     280                 :            :                 RTFPicture();
     281                 :            :                 sal_uInt16 nWidth, nHeight;
     282                 :            :                 sal_uInt16 nGoalWidth, nGoalHeight;
     283                 :            :                 sal_uInt16 nScaleX, nScaleY;
     284                 :            :                 short nCropT, nCropB, nCropL, nCropR;
     285                 :            :                 sal_uInt16 eWMetafile;
     286                 :            :                 RTFBmpStyles nStyle;
     287                 :            :         };
     288                 :            : 
     289                 :            :         class RTFParserState;
     290                 :            : 
     291                 :            :         /// Stores the properties of a frame
     292                 :            :         class RTFFrame
     293                 :            :         {
     294                 :            :             private:
     295                 :            :                 RTFParserState* m_pParserState;
     296                 :            :                 sal_Int32 nX, nY, nW, nH;
     297                 :            :                 sal_Int32 nHoriPadding, nVertPadding;
     298                 :            :                 sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor;
     299                 :            :                 Id nHRule;
     300                 :            :             public:
     301                 :            :                 RTFFrame(RTFParserState* pParserState);
     302                 :            :                 sal_Int16 nAnchorType;
     303                 :            : 
     304                 :            :                 /// Convert the stored properties to Sprms
     305                 :            :                 RTFSprms getSprms();
     306                 :            :                 /// Store a property
     307                 :            :                 void setSprm(Id nId, Id nValue);
     308                 :            :                 bool hasProperties();
     309                 :            :                 /// If we got tokens indicating we're in a frame.
     310                 :            :                 bool inFrame();
     311                 :            :         };
     312                 :            : 
     313                 :            :         class RTFDocumentImpl;
     314                 :            : 
     315                 :            :         /// State of the parser, which gets saved / restored when changing groups.
     316 [ +  - ][ +  - ]:      90810 :         class RTFParserState
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     317                 :            :         {
     318                 :            :             public:
     319                 :            :                 RTFParserState(RTFDocumentImpl* pDocumentImpl);
     320                 :            :                 /// Resets aFrame.
     321                 :            :                 void resetFrame();
     322                 :            : 
     323                 :            :                 RTFDocumentImpl* m_pDocumentImpl;
     324                 :            :                 RTFInternalState nInternalState;
     325                 :            :                 RTFDesitnationState nDestinationState;
     326                 :            :                 RTFFieldStatus nFieldStatus;
     327                 :            :                 RTFBorderState nBorderState;
     328                 :            :                 // font table, stylesheet table
     329                 :            :                 RTFSprms aTableSprms;
     330                 :            :                 RTFSprms aTableAttributes;
     331                 :            :                 // reset by plain
     332                 :            :                 RTFSprms aCharacterSprms;
     333                 :            :                 RTFSprms aCharacterAttributes;
     334                 :            :                 // reset by pard
     335                 :            :                 RTFSprms aParagraphSprms;
     336                 :            :                 RTFSprms aParagraphAttributes;
     337                 :            :                 // reset by sectd
     338                 :            :                 RTFSprms aSectionSprms;
     339                 :            :                 RTFSprms aSectionAttributes;
     340                 :            :                 // reset by trowd
     341                 :            :                 RTFSprms aTableRowSprms;
     342                 :            :                 RTFSprms aTableRowAttributes;
     343                 :            :                 // reset by cellx
     344                 :            :                 RTFSprms aTableCellSprms;
     345                 :            :                 RTFSprms aTableCellAttributes;
     346                 :            :                 // reset by row/nestrow
     347                 :            :                 std::deque<RTFSprms> aTableCellsSprms;
     348                 :            :                 std::deque<RTFSprms> aTableCellsAttributes;
     349                 :            :                 // backup of the above two, to support inheriting cell props
     350                 :            :                 std::deque<RTFSprms> aTableInheritingCellsSprms;
     351                 :            :                 std::deque<RTFSprms> aTableInheritingCellsAttributes;
     352                 :            :                 // reset by tx
     353                 :            :                 RTFSprms aTabAttributes;
     354                 :            : 
     355                 :            :                 RTFColorTableEntry aCurrentColor;
     356                 :            : 
     357                 :            :                 rtl_TextEncoding nCurrentEncoding;
     358                 :            : 
     359                 :            :                 /// Current \uc value.
     360                 :            :                 int nUc;
     361                 :            :                 /// Characters to skip, set to nUc by \u.
     362                 :            :                 int nCharsToSkip;
     363                 :            :                 /// Characters to read, once in binary mode.
     364                 :            :                 int nBinaryToRead;
     365                 :            : 
     366                 :            :                 /// Next list level index to use when parsing list table.
     367                 :            :                 int nListLevelNum;
     368                 :            :                 /// List level entries, which will form a list entry later.
     369                 :            :                 RTFSprms aListLevelEntries;
     370                 :            : 
     371                 :            :                 /// List of character positions in leveltext to replace.
     372                 :            :                 std::vector<sal_Int32> aLevelNumbers;
     373                 :            : 
     374                 :            :                 RTFPicture aPicture;
     375                 :            :                 RTFShape aShape;
     376                 :            :                 RTFDrawingObject aDrawingObject;
     377                 :            :                 RTFFrame aFrame;
     378                 :            : 
     379                 :            :                 /// Current cellx value.
     380                 :            :                 int nCellX;
     381                 :            :                 int nCells;
     382                 :            :                 int nInheritingCells;
     383                 :            : 
     384                 :            :                 /// CJK or CTL?
     385                 :            :                 bool bIsCjk;
     386                 :            : 
     387                 :            :                 // Info group.
     388                 :            :                 int nYear;
     389                 :            :                 int nMonth;
     390                 :            :                 int nDay;
     391                 :            :                 int nHour;
     392                 :            :                 int nMinute;
     393                 :            : 
     394                 :            :                 /// Text from special destinations.
     395                 :            :                 rtl::OUStringBuffer aDestinationText;
     396                 :            :         };
     397                 :            : 
     398                 :            :         class RTFTokenizer;
     399                 :            :         class RTFSdrImport;
     400                 :            : 
     401                 :            :         /// Implementation of the RTFDocument interface.
     402                 :            :         class RTFDocumentImpl
     403                 :            :             : public RTFDocument
     404                 :            :         {
     405                 :            :             public:
     406                 :            :                 typedef ::boost::shared_ptr<RTFDocumentImpl> Pointer_t;
     407                 :            :                 RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& xContext,
     408                 :            :                                 uno::Reference<io::XInputStream> const& xInputStream,
     409                 :            :                                 uno::Reference<lang::XComponent> const& xDstDoc,
     410                 :            :                                 uno::Reference<frame::XFrame> const& xFrame,
     411                 :            :                                 uno::Reference<task::XStatusIndicator> const& xStatusIndicator);
     412                 :            :                 virtual ~RTFDocumentImpl();
     413                 :            :                 virtual void resolve(Stream & rHandler);
     414                 :            :                 virtual std::string getType() const;
     415                 :            : 
     416                 :            :                 Stream& Mapper();
     417                 :            :                 void setSubstream(bool bIsSubtream);
     418                 :            :                 void setSuperstream(RTFDocumentImpl *pSuperstream);
     419                 :            :                 void setAuthor(rtl::OUString& rAuthor);
     420                 :            :                 void setAuthorInitials(rtl::OUString& rAuthorInitials);
     421                 :            :                 bool isSubstream() const;
     422                 :            :                 void finishSubstream();
     423                 :            :                 void setIgnoreFirst(rtl::OUString& rIgnoreFirst);
     424                 :            :                 void seek(sal_uInt32 nPos);
     425                 :            :                 uno::Reference<lang::XMultiServiceFactory> getModelFactory();
     426                 :            :                 RTFParserState& getState();
     427                 :            :                 /// Number of states on the stack.
     428                 :            :                 int getGroup() const;
     429                 :            :                 void setDestinationText(rtl::OUString& rString);
     430                 :            :                 /// Resolve a picture: If not inline, then anchored.
     431                 :            :                 int resolvePict(bool bInline);
     432                 :            :                 void runBreak();
     433                 :            :                 bool replayShapetext();
     434                 :            :                 bool getSkipUnknown();
     435                 :            :                 void setSkipUnknown(bool bSkipUnknown);
     436                 :            : 
     437                 :            :                 // These callbacks are invoked by the tokenizer.
     438                 :            :                 int resolveChars(char ch);
     439                 :            :                 int pushState();
     440                 :            :                 int popState();
     441                 :            :                 int dispatchFlag(RTFKeyword nKeyword);
     442                 :            :                 int dispatchDestination(RTFKeyword nKeyword);
     443                 :            :                 int dispatchSymbol(RTFKeyword nKeyword);
     444                 :            :                 int dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam);
     445                 :            :                 int dispatchValue(RTFKeyword nKeyword, int nParam);
     446                 :            : 
     447                 :            :                 /// If this is the first run of the document, starts the initial paragraph.
     448                 :            :                 void checkFirstRun();
     449                 :            :                 /// If the initial paragraph is started.
     450                 :            :                 bool getFirstRun();
     451                 :            :                 /// If we need to add a dummy paragraph before a section break.
     452                 :            :                 void setNeedPar(bool bNeedPar);
     453                 :            :                 /// Return the dmapper index of an RTF index for fonts.
     454                 :            :                 int getFontIndex(int nIndex);
     455                 :            :                 /// Return the encoding associated with a dmapper font index.
     456                 :            :                 rtl_TextEncoding getEncoding(sal_uInt32 nFontIndex);
     457                 :            :                 /// Get the default parser state.
     458                 :            :                 RTFParserState& getDefaultState();
     459                 :            : 
     460                 :            :             private:
     461                 :            :                 SvStream& Strm();
     462                 :            :                 sal_uInt32 getColorTable(sal_uInt32 nIndex);
     463                 :            :                 RTFSprms mergeSprms();
     464                 :            :                 RTFSprms mergeAttributes();
     465                 :            :                 void resetSprms();
     466                 :            :                 void resetAttributes();
     467                 :            :                 void resolveSubstream(sal_uInt32 nPos, Id nId);
     468                 :            :                 void resolveSubstream(sal_uInt32 nPos, Id nId, rtl::OUString& rIgnoreFirst);
     469                 :            : 
     470                 :            :                 void text(rtl::OUString& rString);
     471                 :            :                 // Sends a single character to dmapper, taking care of buffering.
     472                 :            :                 void singleChar(sal_uInt8 nValue, bool bRunProps = false);
     473                 :            :                 // Sends run properties to dmapper, taking care of buffering.
     474                 :            :                 void runProps();
     475                 :            :                 void parBreak();
     476                 :            :                 void tableBreak();
     477                 :            :                 void checkNeedPap();
     478                 :            :                 void sectBreak(bool bFinal);
     479                 :            :                 void replayBuffer(RTFBuffer_t& rBuffer);
     480                 :            :                 /// If we have some unicode or hex characters to send.
     481                 :            :                 void checkUnicode(bool bUnicode = true, bool bHex = true);
     482                 :            : 
     483                 :            :                 uno::Reference<uno::XComponentContext> const& m_xContext;
     484                 :            :                 uno::Reference<io::XInputStream> const& m_xInputStream;
     485                 :            :                 uno::Reference<lang::XComponent> const& m_xDstDoc;
     486                 :            :                 uno::Reference<frame::XFrame> const& m_xFrame;
     487                 :            :                 uno::Reference<task::XStatusIndicator> const& m_xStatusIndicator;
     488                 :            :                 uno::Reference<lang::XMultiServiceFactory> m_xModelFactory;
     489                 :            :                 uno::Reference<document::XDocumentProperties> m_xDocumentProperties;
     490                 :            :                 boost::shared_ptr<SvStream> m_pInStream;
     491                 :            :                 Stream* m_pMapperStream;
     492                 :            :                 boost::shared_ptr<RTFSdrImport> m_pSdrImport;
     493                 :            :                 boost::shared_ptr<RTFTokenizer> m_pTokenizer;
     494                 :            :                 /// Same as m_aStates.size(), except that this can be negative for invalid input.
     495                 :            :                 int m_nGroup;
     496                 :            :                 std::stack<RTFParserState> m_aStates;
     497                 :            :                 /// Read by RTF_PARD.
     498                 :            :                 RTFParserState m_aDefaultState;
     499                 :            :                 bool m_bSkipUnknown;
     500                 :            :                 /// Font index <-> encoding map, *not* part of the parser state
     501                 :            :                 std::map<int, rtl_TextEncoding> m_aFontEncodings;
     502                 :            :                 /// Maps the non-continious font indexes to the continous dmapper indexes.
     503                 :            :                 std::vector<int> m_aFontIndexes;
     504                 :            :                 /// Color index <-> RGB color value map
     505                 :            :                 std::vector<sal_uInt32> m_aColorTable;
     506                 :            :                 bool m_bFirstRun;
     507                 :            :                 /// If paragraph properties should be emitted on next run.
     508                 :            :                 bool m_bNeedPap;
     509                 :            :                 /// If we need to emit a CR at the end of substream.
     510                 :            :                 bool m_bNeedCr;
     511                 :            :                 bool m_bNeedPar;
     512                 :            :                 /// If set, an empty paragraph will be added at the end of the document.
     513                 :            :                 bool m_bNeedFinalPar;
     514                 :            :                 /// The list table and list override table combined.
     515                 :            :                 RTFSprms m_aListTableSprms;
     516                 :            :                 /// The settings table attributes.
     517                 :            :                 RTFSprms m_aSettingsTableAttributes;
     518                 :            :                 /// The settings table sprms.
     519                 :            :                 RTFSprms m_aSettingsTableSprms;
     520                 :            : 
     521                 :            :                 oox::StorageRef m_xStorage;
     522                 :            :                 boost::shared_ptr<oox::GraphicHelper> m_pGraphicHelper;
     523                 :            : 
     524                 :            :                 /// Buffered table cells, till cell definitions are not reached.
     525                 :            :                 RTFBuffer_t m_aTableBuffer;
     526                 :            :                 /// Buffered superscript, till footnote is reached (or not).
     527                 :            :                 RTFBuffer_t m_aSuperBuffer;
     528                 :            :                 /// Buffered shape text.
     529                 :            :                 RTFBuffer_t m_aShapetextBuffer;
     530                 :            :                 /// Points to the active buffer, if there is one.
     531                 :            :                 RTFBuffer_t* m_pCurrentBuffer;
     532                 :            : 
     533                 :            :                 bool m_bHasFootnote;
     534                 :            :                 /// Superstream of this substream.
     535                 :            :                 RTFDocumentImpl *m_pSuperstream;
     536                 :            :                 std::queue< std::pair<Id, sal_uInt32> > m_nHeaderFooterPositions;
     537                 :            :                 sal_uInt32 m_nGroupStartPos;
     538                 :            :                 /// Ignore the first occurrence of this text.
     539                 :            :                 rtl::OUString m_aIgnoreFirst;
     540                 :            :                 /// Bookmark name <-> index map.
     541                 :            :                 std::map<rtl::OUString, int> m_aBookmarks;
     542                 :            :                 /// Revision index <-> author map.
     543                 :            :                 std::map<int, rtl::OUString> m_aAuthors;
     544                 :            :                 /// Annotation author of the next annotation.
     545                 :            :                 rtl::OUString m_aAuthor;
     546                 :            :                 /// Initials of author of the next annotation.
     547                 :            :                 rtl::OUString m_aAuthorInitials;
     548                 :            : 
     549                 :            :                 RTFSprms m_aFormfieldSprms;
     550                 :            :                 RTFSprms m_aFormfieldAttributes;
     551                 :            :                 RTFFormFieldTypes m_nFormFieldType;
     552                 :            : 
     553                 :            :                 RTFSprms m_aObjectSprms;
     554                 :            :                 RTFSprms m_aObjectAttributes;
     555                 :            :                 /// If we are in an object group.
     556                 :            :                 bool m_bObject;
     557                 :            :                 /// Contents of the objdata group.
     558                 :            :                 boost::shared_ptr<SvStream> m_pObjectData;
     559                 :            :                 /// If the data for a picture is a binary one, it's stored here.
     560                 :            :                 boost::shared_ptr<SvStream> m_pBinaryData;
     561                 :            : 
     562                 :            :                 RTFReferenceTable::Entries_t m_aFontTableEntries;
     563                 :            :                 int m_nCurrentFontIndex;
     564                 :            : 
     565                 :            :                 RTFReferenceTable::Entries_t m_aStyleTableEntries;
     566                 :            :                 int m_nCurrentStyleIndex;
     567                 :            :                 bool m_bFormField;
     568                 :            :                 /// If a frame start token is already sent to dmapper (nesting them is not OK).
     569                 :            :                 bool m_bIsInFrame;
     570                 :            :                 // Unicode characters are collected here so we don't have to send them one by one.
     571                 :            :                 rtl::OUStringBuffer m_aUnicodeBuffer;
     572                 :            :                 /// Same for hex characters.
     573                 :            :                 rtl::OStringBuffer m_aHexBuffer;
     574                 :            :                 /// Formula import.
     575                 :            :                 oox::formulaimport::XmlStreamBuilder m_aMathBuffer;
     576                 :            :         };
     577                 :            :     } // namespace rtftok
     578                 :            : } // namespace writerfilter
     579                 :            : 
     580                 :            : #endif // _RTFDOCUMENTIMPL_HXX_
     581                 :            : 
     582                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10