Kaydet (Commit) 4c8d9dbc authored tarafından Thomas Lange [tl]'s avatar Thomas Lange [tl]

cws tl83: #i113276# changes to Greek symbol set because of new OpenSymbol font

üst 1acb3fa5
......@@ -38,7 +38,10 @@
#include <map>
#include <vector>
#include <set>
#include <functional>
#include <algorithm>
#include "unomodel.hxx"
#include "utility.hxx"
#include "smmod.hxx"
......@@ -133,6 +136,15 @@ typedef std::map< String, SmSym, lt_String > SymbolMap_t;
// vector of pointers to the actual symbols in the above container
typedef std::vector< const SmSym * > SymbolPtrVec_t;
struct lt_SmSymPtr : public std::binary_function< const SmSym *, const SmSym *, bool >
{
bool operator() ( const SmSym *pSym1, const SmSym *pSym2 )
{
return pSym1->GetCharacter() < pSym2->GetCharacter();
}
};
class SmSymbolManager : public SfxListener
{
SymbolMap_t m_aSymbols;
......
......@@ -1600,6 +1600,9 @@ BOOL SmSymbolDialog::SelectSymbolSet(const XubString &rSymbolSetName)
aSymbolSetName = rSymbolSetName;
aSymbolSet = rSymbolMgr.GetSymbolSet( aSymbolSetName );
// sort symbols by Unicode position (useful for displaying Greek characters alphabetically)
std::sort( aSymbolSet.begin(), aSymbolSet.end(), lt_SmSymPtr() );
aSymbolSetDisplay.SetSymbolSet( aSymbolSet );
if (aSymbolSet.size() > 0)
SelectSymbol(0);
......
......@@ -1123,13 +1123,9 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_TEXT:
{
const SfxStringItem& rItem =
(const SfxStringItem&)rReq.GetArgs()->Get(SID_TEXT);
const SfxStringItem& rItem = (const SfxStringItem&)rReq.GetArgs()->Get(SID_TEXT);
if (GetText() != rItem.GetValue())
{
SetText(rItem.GetValue());
}
}
break;
......
......@@ -251,7 +251,10 @@ IMPL_LINK( SmEditWindow, ModifyTimerHdl, Timer *, EMPTYARG /*pTimer*/ )
{
SmModule *pp = SM_MOD();
if (pp->GetConfig()->IsAutoRedraw())
{
Flush();
aModifyTimer.Stop();
}
return 0;
}
......@@ -917,7 +920,10 @@ void SmEditWindow::InsertText(const String& Text)
{
DBG_ASSERT( pEditView, "EditView missing" );
if (pEditView)
{
pEditView->InsertText(Text);
aModifyTimer.Start();
}
}
void SmEditWindow::Flush()
......@@ -928,9 +934,11 @@ void SmEditWindow::Flush()
pEditEngine->ClearModifyFlag();
SmViewShell *pViewSh = rCmdBox.GetView();
if (pViewSh)
{
pViewSh->GetViewFrame()->GetDispatcher()->Execute(
SID_TEXT, SFX_CALLMODE_STANDARD,
new SfxStringItem(SID_TEXT, GetText()), 0L);
}
}
if (aCursorMoveTimer.IsActive())
......
......@@ -75,7 +75,6 @@
#include <memory>
#include "mathmlexport.hxx"
#include "mathtype.hxx"
#include <starmath.hrc>
#include <unomodel.hxx>
#include <document.hxx>
......
......@@ -71,7 +71,6 @@ one go*/
#include <memory>
#include "mathmlimport.hxx"
#include "mathtype.hxx"
#include <starmath.hrc>
#include <unomodel.hxx>
#include <document.hxx>
......
......@@ -290,6 +290,28 @@ void SmSymbolManager::Load()
DBG_ERROR( "no symbol set found" );
m_bModified = false;
}
// now add a %i... symbol to the 'iGreek' set for every symbol found in the 'Greek' set.
SmLocalizedSymbolData aLocalizedData;
const String aGreekSymbolSetName( aLocalizedData.GetUiSymbolSetName( A2OU("Greek") ) );
const SymbolPtrVec_t aGreekSymbols( GetSymbolSet( aGreekSymbolSetName ) );
String aSymbolSetName( (sal_Unicode) 'i' );
aSymbolSetName += 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];
Font aFont( rSym.GetFace() );
DBG_ASSERT( aFont.GetItalic() == ITALIC_NONE, "expected Font with ITALIC_NONE, failed." );
aFont.SetItalic( ITALIC_NORMAL );
String aSymbolName( (sal_Unicode)'i' );
aSymbolName += rSym.GetName();
SmSym aSymbol( aSymbolName, aFont, rSym.GetCharacter(),
aSymbolSetName, TRUE /*bIsPredefined*/ );
AddOrReplaceSymbol( aSymbol );
}
}
void SmSymbolManager::Save()
......@@ -314,10 +336,21 @@ void SmSymbolManager::Save()
}
DBG_ASSERT(pSym - pSymbols == nSaveSymbolCnt, "wrong number of symbols" );
#endif
// prepare to skip symbols from iGreek on saving
SmLocalizedSymbolData aLocalizedData;
String aSymbolSetName( (sal_Unicode) 'i' );
aSymbolSetName += aLocalizedData.GetUiSymbolSetName( A2OU("Greek") );
SymbolPtrVec_t aTmp( GetSymbols() );
std::vector< SmSym > aSymbols;
for (size_t i = 0; i < aTmp.size(); ++i)
aSymbols.push_back( *aTmp[i] );
{
// skip symbols from iGreek set since those symbols always get added
// by computational means in SmSymbolManager::Load
if (aTmp[i]->GetSymbolSetName() != aSymbolSetName)
aSymbols.push_back( *aTmp[i] );
}
rCfg.SetSymbols( aSymbols );
#if 0
delete [] pSymbols;
......
......@@ -38,7 +38,7 @@ sal_Unicode ConvertMathPrivateUseAreaToUnicode( sal_Unicode cChar )
if (IsInPrivateUseArea( cChar ))
{
DBG_ASSERT( 0, "Error: private use area characters should no longer be in use!" );
cRes = (sal_Unicode) '&'; // just some character that should easily be notice as odd in the context
cRes = (sal_Unicode) '@'; // just some character that should easily be notice as odd in the context
}
return cRes;
}
......
......@@ -1545,8 +1545,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
case SID_INSERTTEXT:
{
const SfxStringItem& rItem =
(const SfxStringItem&)rReq.GetArgs()->Get(SID_INSERTTEXT);
(const SfxStringItem&)rReq.GetArgs()->Get(SID_INSERTTEXT);
if (pWin)
pWin->InsertText(rItem.GetValue());
break;
......
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