1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
35 class SFX2_DLLPUBLIC SfxHTMLParser
: public HTMLParser
40 SfxMedium
*pDLMedium
; // Medium for Download Files
42 ScriptType eScriptType
;
44 SAL_DLLPRIVATE
void GetScriptType_Impl( SvKeyValueIterator
* );
48 SfxHTMLParser( SvStream
& rStream
, sal_Bool bNewDoc
=sal_True
, SfxMedium
*pMedium
=0 );
50 virtual ~SfxHTMLParser();
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 Region more
56 static bool ParseMapOptions(ImageMap
* pImageMap
, const HTMLOptions
& rOptions
);
57 bool ParseMapOptions(ImageMap
* pImageMap
)
58 { return ParseMapOptions(pImageMap
, GetOptions()); }
59 static bool ParseAreaOptions(ImageMap
* pImageMap
, const String
& rBaseURL
,
60 const HTMLOptions
& rOptions
,
61 sal_uInt16 nEventMouseOver
= 0,
62 sal_uInt16 nEventMouseOut
= 0 );
63 inline sal_Bool
ParseAreaOptions(ImageMap
* pImageMap
, const String
& rBaseURL
,
64 sal_uInt16 nEventMouseOver
= 0,
65 sal_uInt16 nEventMouseOut
= 0);
67 // <TD SDVAL="..." SDNUM="...">
68 static double GetTableDataOptionsValNum( sal_uInt32
& nNumForm
,
69 LanguageType
& eNumLang
, const String
& aValStr
,
70 const String
& aNumStr
, SvNumberFormatter
& rFormatter
);
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
);
85 // End of an asynchronous file download. Returns TRUE if the download
86 // was successful. The read file is then passed into String.
87 sal_Bool
FinishFileDownload( String
& rStr
);
89 // Returns TRUE if a file was downloaded and if FileDownloadFinished
90 // has not yet been called
91 sal_Bool
ShouldFinishFileDownload() const { return pDLMedium
!= 0; }
93 SfxMedium
*GetMedium() { return pMedium
; }
94 const SfxMedium
*GetMedium() const { return pMedium
; }
96 // Default (without iterator) is JavaScript
97 ScriptType
GetScriptType( SvKeyValueIterator
* ) const;
98 const String
& GetScriptTypeString( SvKeyValueIterator
* ) const;
101 inline sal_Bool
SfxHTMLParser::ParseAreaOptions(ImageMap
* pImageMap
, const String
& rBaseURL
,
102 sal_uInt16 nEventMouseOver
,
103 sal_uInt16 nEventMouseOut
)
105 return ParseAreaOptions( pImageMap
, rBaseURL
, GetOptions(),
106 nEventMouseOver
, nEventMouseOut
);
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */