// avoid having the same symbol name twice but with different symbols in use if (!pFound || bForceChange)
{
m_aSymbols[ aSymbolName ] = rSymbol;
bAdded = true;
} elseif (bSymbolConflict)
{ // TODO: to solve this a document owned symbol manager would be required ...
SAL_WARN("starmath", "symbol conflict, different symbol with same name found!"); // symbols in all formulas. A copy of the global one would be needed here // and then the new symbol has to be forcefully applied. This would keep // the current formula intact but will leave the set of symbols in the // global symbol manager somewhat to chance.
}
OSL_ENSURE( bAdded, "failed to add symbol" ); if (bAdded)
m_bModified = true;
OSL_ENSURE( bAdded || (pFound && !bSymbolConflict), "AddOrReplaceSymbol: unresolved symbol conflict" );
}
m_aSymbols.clear(); for (size_t i = 0; i < nSymbolCount; ++i)
{ const SmSym &rSym = aSymbols[i];
OSL_ENSURE( !rSym.GetUiName().isEmpty(), "symbol without name!" ); if (!rSym.GetUiName().isEmpty())
AddOrReplaceSymbol( rSym );
}
m_bModified = true;
if (0 == nSymbolCount)
{
SAL_WARN("starmath", "no symbol set found");
m_bModified = false;
}
// now add a %i... symbol to the 'iGreek' set for every symbol found in the 'Greek' set. const OUString aGreekSymbolSetName(SmLocalizedSymbolData::GetUiSymbolSetName(u"Greek")); const SymbolPtrVec_t aGreekSymbols( GetSymbolSet( aGreekSymbolSetName ) );
OUString aSymbolSetName = "i" + aGreekSymbolSetName;
size_t nSymbols = aGreekSymbols.size(); for (size_t i = 0; i < nSymbols; ++i)
{ // make the new symbol a copy but with ITALIC_NORMAL, and add it to iGreek const SmSym &rSym = *aGreekSymbols[i];
vcl::Font aFont( rSym.GetFace() );
OSL_ENSURE( aFont.GetItalicMaybeAskConfig() == ITALIC_NONE, "expected Font with ITALIC_NONE, failed." );
aFont.SetItalic( ITALIC_NORMAL );
OUString aSymbolName = "i" + rSym.GetUiName();
SmSym aSymbol( aSymbolName, aFont, rSym.GetCharacter(),
aSymbolSetName, true/*bIsPredefined*/ );
aSymbol.SetExportName("i" + rSym.GetExportName());
AddOrReplaceSymbol( aSymbol );
}
}
void SmSymbolManager::Save()
{ if (!m_bModified) return;
// prepare to skip symbols from iGreek on saving
OUString aSymbolSetName = "i" +
SmLocalizedSymbolData::GetUiSymbolSetName(u"Greek");
SymbolPtrVec_t aTmp( GetSymbols() );
std::vector< SmSym > aSymbols; for (const SmSym* i : aTmp)
{ // skip symbols from iGreek set since those symbols always get added // by computational means in SmSymbolManager::Load if (i->GetSymbolSetName() != aSymbolSetName)
aSymbols.push_back( *i );
}
SmModule::get()->GetConfig()->SetSymbols(aSymbols);
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.