2014-03-15 23:09:09 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-04-18 18:21:34 +02:00
|
|
|
#ifndef INCLUDED_SVTOOLS_HTMLWRITER_HXX
|
|
|
|
#define INCLUDED_SVTOOLS_HTMLWRITER_HXX
|
2014-03-15 23:09:09 +01:00
|
|
|
|
|
|
|
#include <rtl/string.hxx>
|
2014-09-20 14:50:46 +02:00
|
|
|
#include <rtl/ustring.hxx>
|
2014-03-15 23:09:09 +01:00
|
|
|
#include <tools/stream.hxx>
|
|
|
|
#include <vector>
|
|
|
|
#include <svtools/svtdllapi.h>
|
|
|
|
|
|
|
|
class SVT_DLLPUBLIC HtmlWriter
|
|
|
|
{
|
|
|
|
private:
|
2014-03-16 20:50:27 +01:00
|
|
|
std::vector<OString> maElementStack;
|
2014-03-15 23:09:09 +01:00
|
|
|
|
2014-09-20 14:50:46 +02:00
|
|
|
SvStream& mrStream;
|
|
|
|
|
|
|
|
bool mbElementOpen;
|
|
|
|
bool mbContentWritten;
|
|
|
|
bool mbPrettyPrint;
|
|
|
|
rtl_TextEncoding maEncoding;
|
2014-03-15 23:09:09 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
HtmlWriter(SvStream& rStream);
|
|
|
|
virtual ~HtmlWriter();
|
|
|
|
|
2014-03-16 20:50:27 +01:00
|
|
|
void prettyPrint(bool bChoice);
|
|
|
|
|
2014-09-20 14:50:46 +02:00
|
|
|
void start(const OString& aElement);
|
|
|
|
|
2014-03-15 23:09:09 +01:00
|
|
|
void end();
|
2014-09-20 14:50:46 +02:00
|
|
|
|
|
|
|
void flushStack();
|
|
|
|
void flushStack(const OString& aElement);
|
|
|
|
|
|
|
|
void write(const OString& aContent);
|
|
|
|
|
|
|
|
void attribute(const OString& aAttribute, const char* aValue);
|
|
|
|
void attribute(const OString& aAttribute, sal_Int32 aValue);
|
|
|
|
void attribute(const OString& aAttribute, const OString& aValue);
|
|
|
|
void attribute(const OString& aAttribute, const OUString& aValue);
|
|
|
|
// boolean attribute e.g. <img ismap>
|
|
|
|
void attribute(const OString& aAttribute);
|
|
|
|
|
|
|
|
void single(const OString& aContent);
|
2014-03-15 23:09:09 +01:00
|
|
|
void endAttribute();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|