diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-07-23 17:21:05 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-07-23 17:21:05 +0200 |
commit | 4c8d9dbc46403017cf09723d903e1b49296b9e48 (patch) | |
tree | d198bb6242316a4403e75007d7691ce6a68fd0e3 /starmath | |
parent | 1acb3fa596bac16a168b22d4070db9f6423881d8 (diff) |
cws tl83: #i113276# changes to Greek symbol set because of new OpenSymbol font
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/symbol.hxx | 12 | ||||
-rw-r--r-- | starmath/source/dialog.cxx | 3 | ||||
-rw-r--r-- | starmath/source/document.cxx | 6 | ||||
-rw-r--r-- | starmath/source/edit.cxx | 8 | ||||
-rw-r--r-- | starmath/source/mathmlexport.cxx | 1 | ||||
-rw-r--r-- | starmath/source/mathmlimport.cxx | 1 | ||||
-rw-r--r-- | starmath/source/symbol.cxx | 35 | ||||
-rw-r--r-- | starmath/source/types.cxx | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | starmath/source/view.cxx | 3 |
9 files changed, 60 insertions, 11 deletions
diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx index 503859485095..51e8ad0b8642 100644 --- a/starmath/inc/symbol.hxx +++ b/starmath/inc/symbol.hxx @@ -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; diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 037f2fc1dff8..6067daa797dc 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -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); diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 49739af72972..86d23af0161b 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -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; diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index f7093f9c3815..fe849a36e358 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -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()) diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index 36eb9d3884b5..bec69eb01b95 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -75,7 +75,6 @@ #include <memory> #include "mathmlexport.hxx" -#include "mathtype.hxx" #include <starmath.hrc> #include <unomodel.hxx> #include <document.hxx> diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index dd90caaf6d45..36c009757eac 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -71,7 +71,6 @@ one go*/ #include <memory> #include "mathmlimport.hxx" -#include "mathtype.hxx" #include <starmath.hrc> #include <unomodel.hxx> #include <document.hxx> diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx index e248f9726629..5208ce3644ce 100644 --- a/starmath/source/symbol.cxx +++ b/starmath/source/symbol.cxx @@ -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; diff --git a/starmath/source/types.cxx b/starmath/source/types.cxx index a861db5a0c79..e63d46c79e9b 100644 --- a/starmath/source/types.cxx +++ b/starmath/source/types.cxx @@ -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; } diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 886d409931b2..0087595703ca 100755..100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -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; |