/* -*- 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/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// If we are checking the template type, and the document is not a .dot, don't // mis-detect it. if ( bIsDetected && aTypeName == "writer_MS_Word_97_Vorlage" )
{ // It is common practice to rename a .doc to .dot to make it a template. // Since we have detected a.doc-ish format, always accept .dot-named-files // as valid templates to avoid flagging this as an invalid .dot format..
INetURLObject aParser(aMediaDesc.getUnpackedValueOrDefault(
utl::MediaDescriptor::PROP_URL, OUString()));
// Super ugly hack, but we don't want to use the whole WW8Fib thing here in // the swd library, apparently. We know (do we?) that the "aBits1" byte, as // the variable is called in WW8Fib::WW8Fib(SvStream&,sal_uInt8,sal_uInt32), // is at offset 10 in the WordDocument stream. The fDot bit is bit 0x01 of // that byte. if (aParser.getExtension().toAsciiLowerCase() != "dot")
{
rtl::Reference<SotStorageStream> xWordDocument
= aStorage->OpenSotStream(u"WordDocument"_ustr, StreamMode::STD_READ);
xWordDocument->Seek(10); if (xWordDocument->Tell() == 10)
{
sal_uInt8 aBits1;
xWordDocument->ReadUChar(aBits1); // Check fDot bit
bIsDetected = ((aBits1 & 0x01) == 0x01);
}
}
}
}
}
} catch (...)
{
bIsDetected = false;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.