Kaydet (Commit) af69f27e authored tarafından Miklos Vajna's avatar Miklos Vajna

sw HTML paste: add debug env var to capture outgoing content

Similar to existing SW_DEBUG_RTF_PASTE_TO.

Change-Id: I5d6fe72929ab6ddd3e6e175ed344781fc4e3cb31
Reviewed-on: https://gerrit.libreoffice.org/51961Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst f98040a2
......@@ -78,6 +78,8 @@
#include <IDocumentMarkAccess.hxx>
#include <xmloff/odffields.hxx>
#include <tools/urlobj.hxx>
#include <osl/file.hxx>
#include <comphelper/scopeguard.hxx>
#define MAX_INDENT_LEVEL 20
......@@ -208,6 +210,24 @@ void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium)
ErrCode SwHTMLWriter::WriteStream()
{
// Intercept paste output if requested.
char* pPasteEnv = getenv("SW_DEBUG_HTML_PASTE_TO");
std::unique_ptr<SvStream> pPasteStream;
SvStream* pOldPasteStream = nullptr;
if (pPasteEnv)
{
OUString aPasteStr;
if (pPasteEnv
&& osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(pPasteEnv), aPasteStr)
== osl::FileBase::E_None)
{
pPasteStream.reset(new SvFileStream(aPasteStr, StreamMode::WRITE));
pOldPasteStream = &Strm();
SetStream(pPasteStream.get());
}
}
comphelper::ScopeGuard g([this, pOldPasteStream] { this->SetStream(pOldPasteStream); });
SvxHtmlOptions& rHtmlOptions = SvxHtmlOptions::Get();
// font heights 1-7
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment