diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-05-07 09:35:48 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-05-07 09:35:48 +0200 |
commit | 0f05fe5096be6019d8fa89af94e67032ac4c2b89 (patch) | |
tree | 9253cabceee7e54caaf3f566e890b35fa805d491 | |
parent | dbb0cfc25df81ef3b7aa5fa6731e73e31d43fc4f (diff) |
cws tl74: #158766# problem with test tool fixed
-rw-r--r-- | starmath/source/dialog.cxx | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 95b0035acd..1f7fad48ef 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -1893,10 +1893,17 @@ IMPL_LINK( SmSymDefineDialog, AddClickHdl, Button *, EMPTYARG pButton ) // add symbol // TO_DO_UCS4 (#i74049): get rid of cast without loosing UCS4 functionality - const SmSym aSymbol( aSymbols.GetText(), aCharsetDisplay.GetFont(), + const SmSym aNewSymbol( aSymbols.GetText(), aCharsetDisplay.GetFont(), sal::static_int_cast< sal_Unicode >( aCharsetDisplay.GetSelectCharacter() ), aSymbolSets.GetText() ); - aSymbolMgrCopy.AddOrReplaceSymbol( aSymbol ); + DBG_ASSERT( aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL, "symbol already exists" ); + aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol ); + + // update display of new symbol + aSymbolDisplay.SetChar( aNewSymbol.GetCharacter() ); + aSymbolDisplay.SetFont( aNewSymbol.GetFace() ); + aSymbolName.SetText( aNewSymbol.GetName() ); + aSymbolSetName.SetText( aNewSymbol.GetSymbolSetName() ); // update list box entries FillSymbolSets(aOldSymbolSets, FALSE); @@ -1922,17 +1929,26 @@ IMPL_LINK( SmSymDefineDialog, ChangeClickHdl, Button *, EMPTYARG pButton ) //! get font from symbol-disp lay since charset-display does not keep //! the bold attribut. // TO_DO_UCS4 (#i74049): get rid of cast without loosing UCS4 functionality - const SmSym aNewSymbol( aSymbols.GetText(), aSymbolDisplay.GetFont(), + const SmSym aNewSymbol( aSymbols.GetText(), aCharsetDisplay.GetFont(), sal::static_int_cast< sal_Unicode >( aCharsetDisplay.GetSelectCharacter() ), aSymbolSets.GetText() ); // remove old symbol if the name was changed then add new one - if (aOldSymbols.GetText() != aSymbols.GetText()) + const bool bSetNameChanged = aOldSymbolSets.GetText() != aSymbolSets.GetText(); + const bool bNameChanged = aOldSymbols.GetText() != aSymbols.GetText(); + if (bNameChanged) aSymbolMgrCopy.RemoveSymbol( aOldSymbols.GetText() ); aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol, true ); - // clear display for original symbol - SetOrigSymbol(NULL, XubString()); + // clear display for original symbol if necessary + if (bNameChanged) + SetOrigSymbol(NULL, XubString()); + + // update display of new symbol + aSymbolDisplay.SetChar( aNewSymbol.GetCharacter() ); + aSymbolDisplay.SetFont( aNewSymbol.GetFace() ); + aSymbolName.SetText( aNewSymbol.GetName() ); + aSymbolSetName.SetText( aNewSymbol.GetSymbolSetName() ); // update list box entries FillSymbolSets(aOldSymbolSets, FALSE); @@ -2005,9 +2021,12 @@ void SmSymDefineDialog::UpdateButtons() // aendern wenn bei gleichem Namen mindestens eine Einstellung anders ist // oder wenn es noch kein Symbol des neuen Namens gibt (wuerde implizites // loeschen des bereits vorhandenen Symbols erfordern) - BOOL bEqualName = pOrigSymbol && aTmpSymbolName == pOrigSymbol->GetName(); - bChange = pOrigSymbol && ( (bEqualName && !bEqual) || (!bEqualName && bAdd) ); - } +// BOOL bEqualName = pOrigSymbol && aTmpSymbolName == pOrigSymbol->GetName(); +// bChange = pOrigSymbol && ( (bEqualName && !bEqual) || (!bEqualName && bAdd) ); + + // aendern nur falls altes Symbol vorhanden und am neuen etwas anders ist + bChange = pOrigSymbol && !bEqual; +} aAddBtn .Enable(bAdd); aChangeBtn.Enable(bChange); |