// 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.