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 _EEHTML_HXX 25 #define _EEHTML_HXX 26 27 #include <svl/svarray.hxx> 28 29 #include <editdoc.hxx> 30 #include <svtools/parhtml.hxx> 31 32 class ImpEditEngine; 33 34 #define MAX_NUMBERLEVEL 10 35 36 struct AnchorInfo 37 { 38 String aHRef; 39 String aText; 40 }; 41 42 class EditHTMLParser : public HTMLParser 43 { 44 using HTMLParser::CallParser; 45 private: 46 EditSelection aCurSel; 47 String aBaseURL; 48 ImpEditEngine* pImpEditEngine; 49 AnchorInfo* pCurAnchor; 50 51 sal_Bool bInPara; 52 sal_Bool bWasInPara; // bInPara vor HeadingStart merken, weil sonst hinterher weg 53 sal_Bool bFieldsInserted; 54 sal_uInt8 nInTable; 55 sal_uInt8 nInCell; 56 sal_Bool bInTitle; 57 58 sal_uInt8 nDefListLevel; 59 sal_uInt8 nBulletLevel; 60 sal_uInt8 nNumberingLevel; 61 62 sal_uInt8 nLastAction; 63 64 void StartPara( sal_Bool bReal ); 65 void EndPara( sal_Bool bReal ); 66 void AnchorStart(); 67 void AnchorEnd(); 68 void HeadingStart( int nToken ); 69 void HeadingEnd( int nToken ); 70 void SkipGroup( int nEndToken ); 71 sal_Bool ThrowAwayBlank(); 72 sal_Bool HasTextInCurrentPara(); 73 void ProcessUnknownControl( sal_Bool bOn ); 74 75 void ImpInsertParaBreak(); 76 void ImpInsertText( const String& rText ); 77 void ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSel = 0 ); 78 void ImpSetStyleSheet( sal_uInt16 nHeadingLevel ); 79 80 protected: 81 virtual void NextToken( int nToken ); 82 83 public: 84 EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValueIterator* pHTTPHeaderAttrs ); 85 ~EditHTMLParser(); 86 87 virtual SvParserState CallParser( ImpEditEngine* pImpEE, const EditPaM& rPaM ); 88 GetCurSelection() const89 const EditSelection& GetCurSelection() const { return aCurSel; } 90 }; 91 92 SV_DECL_REF( EditHTMLParser ) 93 SV_IMPL_REF( EditHTMLParser ); 94 95 #endif // _EEHTML_HXX 96