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_SFX2_SFXHTML_HXX
21 : #define INCLUDED_SFX2_SFXHTML_HXX
22 :
23 : #include <sal/config.h>
24 : #include <sfx2/dllapi.h>
25 : #include <sal/types.h>
26 : #include <i18nlangtag/lang.h>
27 : #include <svtools/parhtml.hxx>
28 : #include <svl/macitem.hxx>
29 :
30 :
31 : class ImageMap;
32 : class SfxMedium;
33 : class SfxObjectShell;
34 :
35 : class SFX2_DLLPUBLIC SfxHTMLParser : public HTMLParser
36 : {
37 : OUString aScriptType;
38 :
39 : SfxMedium* pMedium;
40 : SfxMedium *pDLMedium; // Medium for Download Files
41 :
42 : ScriptType eScriptType;
43 :
44 : SAL_DLLPRIVATE void GetScriptType_Impl( SvKeyValueIterator* );
45 :
46 : protected:
47 :
48 : SfxHTMLParser( SvStream& rStream, bool bNewDoc=true, SfxMedium *pMedium=0 );
49 :
50 : virtual ~SfxHTMLParser();
51 :
52 : public:
53 : // Read the options of an image map
54 : // <MAP>: sal_True = Image-Map has a name
55 : // <AREA>: sal_True = Image-Map has now one vcl::Region more
56 : static bool ParseMapOptions(ImageMap* pImageMap, const HTMLOptions& rOptions);
57 0 : bool ParseMapOptions(ImageMap * pImageMap)
58 0 : { return ParseMapOptions(pImageMap, GetOptions()); }
59 : static bool ParseAreaOptions(ImageMap * pImageMap, const OUString& rBaseURL,
60 : const HTMLOptions& rOptions,
61 : sal_uInt16 nEventMouseOver = 0,
62 : sal_uInt16 nEventMouseOut = 0 );
63 : inline bool ParseAreaOptions(ImageMap * pImageMap, const OUString& rBaseURL,
64 : sal_uInt16 nEventMouseOver = 0,
65 : sal_uInt16 nEventMouseOut = 0);
66 :
67 : // <TD SDVAL="..." SDNUM="...">
68 : static double GetTableDataOptionsValNum( sal_uInt32& nNumForm,
69 : LanguageType& eNumLang, const OUString& aValStr,
70 : const OUString& aNumStr, SvNumberFormatter& rFormatter );
71 :
72 : protected:
73 : // Start a file download. This is done asynchronously or synchronously.
74 : // In the synchronous case, the parser is in the working state after
75 : // it has been called. The read file can then be picked up directly with
76 : // FinishFileDownload. In the asynchronous case, the parser is in the
77 : // pending state after it hs been called. The parser then has to leave
78 : // over the Continue (without Reschedule!). If the file is loaded,
79 : // a Continue is called with passed on token. The file can then be picked
80 : // up by FinishFileDownload. To cancel the download should a shell be
81 : // left. It can only exist a single download at the same time, For every
82 : // started download FinshFileDownload must be called.
83 : void StartFileDownload(const OUString& rURL);
84 :
85 : // End of an asynchronous file download. Returns TRUE if the download
86 : // was successful. The read file is then passed into String.
87 : bool FinishFileDownload( OUString& rStr );
88 :
89 : // Returns TRUE if a file was downloaded and if FileDownloadFinished
90 : // has not yet been called
91 : bool ShouldFinishFileDownload() const { return pDLMedium != 0; }
92 :
93 1136 : SfxMedium *GetMedium() { return pMedium; }
94 : const SfxMedium *GetMedium() const { return pMedium; }
95 :
96 : // Default (without iterator) is JavaScript
97 : ScriptType GetScriptType( SvKeyValueIterator* ) const;
98 : const OUString& GetScriptTypeString( SvKeyValueIterator* ) const;
99 : };
100 :
101 0 : inline bool SfxHTMLParser::ParseAreaOptions(ImageMap * pImageMap, const OUString& rBaseURL,
102 : sal_uInt16 nEventMouseOver,
103 : sal_uInt16 nEventMouseOut)
104 : {
105 0 : return ParseAreaOptions( pImageMap, rBaseURL, GetOptions(),
106 0 : nEventMouseOver, nEventMouseOut );
107 : }
108 :
109 :
110 : #endif
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|