// Support both file:///... and system file path notations.
OUString aPath = OUString::createFromAscii(pPath);
INetURLObject aURL;
aURL.SetSmartURL(aPath);
aPath = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
if (eRC == osl::FileBase::E_EXIST)
{
eRC = mpLogFile->open(osl_File_OpenFlag_Write);
if (eRC != osl::FileBase::E_None)
{ // Failed to open an existing log file.
mpLogFile.reset(); return;
}
if (mpLogFile->setPos(osl_Pos_End, 0) != osl::FileBase::E_None)
{ // Failed to set the position to the end of the file.
mpLogFile.reset(); return;
}
} elseif (eRC != osl::FileBase::E_None)
{ // Failed to create a new file.
mpLogFile.reset(); return;
}
void FormulaLogger::writeAscii( constchar* s, size_t n )
{ if (!mpLogFile) return;
sal_uInt64 nBytes;
mpLogFile->write(s, n, nBytes);
}
void FormulaLogger::write( std::u16string_view ou )
{
OString s = OUStringToOString(ou, RTL_TEXTENCODING_UTF8);
writeAscii(s.getStr(), s.getLength());
}
void FormulaLogger::write( sal_Int32 n )
{
OString s = OString::number(n);
writeAscii(s.getStr(), s.getLength());
}
void FormulaLogger::sync()
{ if (!mpLogFile) return;
mpLogFile->sync();
}
void FormulaLogger::writeNestLevel()
{ // Write the nest level, but keep it only 1-character length to avoid // messing up the spacing. if (mnNestLevel < 10)
write(mnNestLevel); else
writeAscii("!");
writeAscii(": "); for (sal_Int32 i = 1; i < mnNestLevel; ++i)
writeAscii(" ");
}
FormulaLogger::GroupScope FormulaLogger::enterGroup( const ScDocument& rDoc, const ScFormulaCell& rCell )
{ // Get the file name if available. const ScDocShell* pShell = rDoc.GetDocumentShell(); const SfxMedium* pMedium = pShell ? pShell->GetMedium() : nullptr;
OUString aName; if (pMedium)
aName = pMedium->GetURLObject().GetLastName(); if (aName.isEmpty())
aName = "-"; // unsaved document.
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.