Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_EDITENG_SOURCE_EDITENG_EEHTML_HXX
21 : #define INCLUDED_EDITENG_SOURCE_EDITENG_EEHTML_HXX
22 :
23 : #include <editdoc.hxx>
24 : #include <svtools/parhtml.hxx>
25 :
26 : class EditEngine;
27 :
28 0 : struct AnchorInfo
29 : {
30 : OUString aHRef;
31 : OUString aText;
32 : };
33 :
34 : class EditHTMLParser : public HTMLParser
35 : {
36 : using HTMLParser::CallParser;
37 : private:
38 : OUStringBuffer maStyleSource;
39 : EditSelection aCurSel;
40 : OUString aBaseURL;
41 : EditEngine* mpEditEngine;
42 : AnchorInfo* pCurAnchor;
43 :
44 : bool bInPara:1;
45 : bool bWasInPara:1; // Remember bInPara before HeadingStart, because afterwards it will be gone.
46 : bool bFieldsInserted:1;
47 : bool bInTitle:1;
48 :
49 : sal_uInt8 nInTable;
50 : sal_uInt8 nInCell;
51 : sal_uInt8 nDefListLevel;
52 :
53 : void StartPara( bool bReal );
54 : void EndPara( bool bReal );
55 : void AnchorStart();
56 : void AnchorEnd();
57 : void HeadingStart( int nToken );
58 : void HeadingEnd( int nToken );
59 : void SkipGroup( int nEndToken );
60 : bool ThrowAwayBlank();
61 : bool HasTextInCurrentPara();
62 :
63 : void ImpInsertParaBreak();
64 : void ImpInsertText( const OUString& rText );
65 : void ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSel = 0 );
66 : void ImpSetStyleSheet( sal_uInt16 nHeadingLevel );
67 :
68 : protected:
69 : virtual void NextToken( int nToken ) SAL_OVERRIDE;
70 :
71 : public:
72 : EditHTMLParser(SvStream& rIn, const OUString& rBaseURL, SvKeyValueIterator* pHTTPHeaderAttrs);
73 : virtual ~EditHTMLParser();
74 :
75 : SvParserState CallParser(EditEngine* pEE, const EditPaM& rPaM);
76 :
77 1 : const EditSelection& GetCurSelection() const { return aCurSel; }
78 : };
79 :
80 : typedef tools::SvRef<EditHTMLParser> EditHTMLParserRef;
81 :
82 : #endif // INCLUDED_EDITENG_SOURCE_EDITENG_EEHTML_HXX
83 :
84 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|