summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2010-08-11 13:35:12 +0200
committerKurt Zenker <kz@openoffice.org>2010-08-11 13:35:12 +0200
commitaa24f45a25b29d19d740ba1ddd2f3ca88d668f01 (patch)
tree3abdef1cb1b8e234d61a8dd3abf683d136d2867d
parentea3180add6a2e63c485f9e34bdfb1018a9359eff (diff)
parent629bf4759551e6008518a197141b561c1af2c8e8 (diff)
CWS-TOOLING: integrate CWS tl83_OOO330ooo/OOO330_m5ooo/OOO330_m4
-rwxr-xr-x[-rw-r--r--]starmath/inc/format.hxx4
-rw-r--r--starmath/inc/node.hxx23
-rw-r--r--starmath/inc/symbol.hxx12
-rw-r--r--starmath/source/cfgitem.cxx8
-rw-r--r--starmath/source/dialog.cxx6
-rw-r--r--starmath/source/document.cxx36
-rw-r--r--starmath/source/edit.cxx13
-rw-r--r--starmath/source/format.cxx7
-rw-r--r--starmath/source/makefile.mk20
-rw-r--r--starmath/source/mathmlexport.cxx1
-rw-r--r--starmath/source/mathmlimport.cxx1
-rwxr-xr-x[-rw-r--r--]starmath/source/node.cxx96
-rwxr-xr-xstarmath/source/parse.cxx4
-rw-r--r--starmath/source/symbol.cxx35
-rw-r--r--starmath/source/types.cxx2
-rwxr-xr-xstarmath/source/unomodel.cxx16
-rwxr-xr-xstarmath/source/view.cxx3
-rw-r--r--sw/source/core/edit/edlingu.cxx28
18 files changed, 234 insertions, 81 deletions
diff --git a/starmath/inc/format.hxx b/starmath/inc/format.hxx
index 7b8a09ac82..7b360f98d0 100644..100755
--- a/starmath/inc/format.hxx
+++ b/starmath/inc/format.hxx
@@ -109,6 +109,7 @@ class SmFormat : public SfxBroadcaster
USHORT vSize[SIZ_END + 1];
USHORT vDist[DIS_END + 1];
SmHorAlign eHorAlign;
+ INT16 nGreekCharStyle;
BOOL bIsTextmode,
bScaleNormalBrackets;
@@ -137,6 +138,9 @@ public:
BOOL IsTextmode() const { return bIsTextmode; }
void SetTextmode(BOOL bVal) { bIsTextmode = bVal; }
+
+ INT16 GetGreekCharStyle() const { return nGreekCharStyle; }
+ void SetGreekCharStyle(INT16 nVal) { nGreekCharStyle = nVal; }
BOOL IsScaleNormalBrackets() const { return bScaleNormalBrackets; }
void SetScaleNormalBrackets(BOOL bVal) { bScaleNormalBrackets = bVal; }
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index 66e2bafd36..156a3c1f24 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -311,19 +311,10 @@ class SmTextNode : public SmVisibleNode
USHORT nFontDesc;
protected:
- SmTextNode(SmNodeType eNodeType, const SmToken &rNodeToken, USHORT nFontDescP)
- : SmVisibleNode(eNodeType, rNodeToken)
- {
- nFontDesc = nFontDescP;
- }
+ SmTextNode(SmNodeType eNodeType, const SmToken &rNodeToken, USHORT nFontDescP );
public:
- SmTextNode(const SmToken &rNodeToken, USHORT nFontDescP)
- : SmVisibleNode(NTEXT, rNodeToken)
- {
- nFontDesc = nFontDescP;
- }
-
+ SmTextNode(const SmToken &rNodeToken, USHORT nFontDescP );
USHORT GetFontDesc() const { return nFontDesc; }
void SetText(const XubString &rText) { aText = rText; }
@@ -347,15 +338,13 @@ public:
class SmSpecialNode : public SmTextNode
{
+ bool bIsFromGreekSymbolSet;
+
protected:
- SmSpecialNode(SmNodeType eNodeType, const SmToken &rNodeToken, USHORT _nFontDesc)
- : SmTextNode(eNodeType, rNodeToken, _nFontDesc)
- {}
+ SmSpecialNode(SmNodeType eNodeType, const SmToken &rNodeToken, USHORT _nFontDesc);
public:
- SmSpecialNode(const SmToken &rNodeToken)
- : SmTextNode(NSPECIAL, rNodeToken, FNT_MATH) //! default Font nicht immer richtig
- {}
+ SmSpecialNode(const SmToken &rNodeToken);
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx
index 79b63d9a54..2cd7c545f5 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/cfgitem.cxx b/starmath/source/cfgitem.cxx
index c2f417d15e..bbc129484e 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -42,7 +42,6 @@ using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::beans;
-#define A2OU(x) rtl::OUString::createFromAscii( x )
static const char* aRootName = "Office.Math";
@@ -127,6 +126,7 @@ static const char * aMathPropNames[] =
static const char * aFormatPropNames[] =
{
"StandardFormat/Textmode",
+ "StandardFormat/GreekCharStyle",
"StandardFormat/ScaleNormalBracket",
"StandardFormat/HorizontalAlignment",
"StandardFormat/BaseSize",
@@ -994,6 +994,10 @@ void SmMathConfig::LoadFormat()
if (pVal->hasValue() && (*pVal >>= bTmp))
pFormat->SetTextmode( bTmp );
++pVal;
+ // StandardFormat/GreekCharStyle
+ if (pVal->hasValue() && (*pVal >>= nTmp16))
+ pFormat->SetGreekCharStyle( nTmp16 );
+ ++pVal;
// StandardFormat/ScaleNormalBracket
if (pVal->hasValue() && (*pVal >>= bTmp))
pFormat->SetScaleNormalBrackets( bTmp );
@@ -1069,6 +1073,8 @@ void SmMathConfig::SaveFormat()
// StandardFormat/Textmode
*pValue++ <<= (BOOL) pFormat->IsTextmode();
+ // StandardFormat/GreekCharStyle
+ *pValue++ <<= (INT16) pFormat->GetGreekCharStyle();
// StandardFormat/ScaleNormalBracket
*pValue++ <<= (BOOL) pFormat->IsScaleNormalBrackets();
// StandardFormat/HorizontalAlignment
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 7ee8f0db0f..916891c1b7 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1277,7 +1277,7 @@ SmShowSymbolSet::SmShowSymbolSet(Window *pParent, const ResId& rResId) :
void SmShowSymbolSet::SetSymbolSet(const SymbolPtrVec_t& rSymbolSet)
{
aSymbolSet = rSymbolSet;
-
+
if (static_cast< USHORT >(aSymbolSet.size()) > (nColumns * nRows))
{
aVScrollBar.SetRange(Range(0, ((aSymbolSet.size() + (nColumns - 1)) / nColumns) - nRows));
@@ -1485,6 +1485,7 @@ IMPL_LINK( SmSymbolDialog, GetClickHdl, Button *, EMPTYARG pButton )
{
XubString aText ('%');
aText += pSym->GetName();
+ aText += (sal_Unicode)' ';
rViewSh.GetViewFrame()->GetDispatcher()->Execute(
SID_INSERTTEXT, SFX_CALLMODE_STANDARD,
@@ -1600,6 +1601,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 ee2a552eef..94bd3e51e3 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -131,9 +131,9 @@ void SmDocShell::SFX_NOTIFY(SfxBroadcaster&, const TypeId&,
{
case HINT_FORMATCHANGED:
SetFormulaArranged(FALSE);
- nModifyCount++; //! merkwuerdig...
- // ohne dies wird die Grafik letztlich
- // nicht geupdatet
+
+ nModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState
+
Repaint();
break;
}
@@ -211,11 +211,19 @@ void SmDocShell::SetFormat(SmFormat& rFormat)
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::SetFormat" );
aFormat = rFormat;
- SetFormulaArranged(FALSE);
- SmViewShell *pViewSh = SmGetActiveView();
- if (pViewSh)
- pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_GAPHIC_SM);
- SetModified(TRUE);
+ SetFormulaArranged( FALSE );
+ SetModified( TRUE );
+
+ nModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState
+
+ // don't use SmGetActiveView since the view shell might not be active (0 pointer)
+ // if for example the Basic Macro dialog currently has the focus. Thus:
+ SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this );
+ while (pFrm)
+ {
+ pFrm->GetBindings().Invalidate(SID_GAPHIC_SM);
+ pFrm = SfxViewFrame::GetNext( *pFrm, this );
+ }
}
String SmDocShell::GetAccessibleText()
@@ -241,7 +249,7 @@ void SmDocShell::Parse()
delete pTree;
ReplaceBadChars();
pTree = aInterpreter.Parse(aText);
- nModifyCount++;
+ nModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState
SetFormulaArranged( FALSE );
}
@@ -1123,13 +1131,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;
@@ -1222,6 +1226,10 @@ void SmDocShell::GetState(SfxItemSet &rSet)
break;
case SID_GAPHIC_SM:
+ //! very old (pre UNO) and ugly hack to invalidate the SmGraphicWindow.
+ //! If nModifyCount gets changed then the call below will implicitly notify
+ //! SmGraphicController::StateChanged and there the window gets invalidated.
+ //! Thus all the 'nModifyCount++' before invalidating this slot.
rSet.Put(SfxInt16Item(SID_GAPHIC_SM, nModifyCount));
break;
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index f6add289ba..935c2133c1 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -252,6 +252,7 @@ IMPL_LINK( SmEditWindow, ModifyTimerHdl, Timer *, EMPTYARG /*pTimer*/ )
SmModule *pp = SM_MOD();
if (pp->GetConfig()->IsAutoRedraw())
Flush();
+ aModifyTimer.Stop();
return 0;
}
@@ -279,6 +280,7 @@ IMPL_LINK(SmEditWindow, CursorMoveTimerHdl, Timer *, EMPTYARG /*pTimer*/)
aOldSelection = aNewSelection;
}
}
+ aCursorMoveTimer.Stop();
return 0;
}
@@ -435,7 +437,7 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt)
SmViewShell *pView = GetView();
if ( pView && !pView->KeyInput(rKEvt) )
{
- /* fuert bei F1 (Hilfe) zum Zerstoeren von this! */
+ /* fuert bei F1 (Hilfe) zum Zerstoeren von this! */
Flush();
if ( aModifyTimer.IsActive() )
aModifyTimer.Stop();
@@ -734,6 +736,9 @@ void SmEditWindow::InsertCommand(USHORT nCommand)
pEditView->SetSelection(aSelection);
}
+ aModifyTimer.Start();
+ aCursorMoveTimer.Start();
+
GrabFocus();
}
}
@@ -917,7 +922,11 @@ void SmEditWindow::InsertText(const String& Text)
{
DBG_ASSERT( pEditView, "EditView missing" );
if (pEditView)
+ {
pEditView->InsertText(Text);
+ aModifyTimer.Start();
+ aCursorMoveTimer.Start();
+ }
}
void SmEditWindow::Flush()
@@ -928,9 +937,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/format.cxx b/starmath/source/format.cxx
index b59bd810cd..49d900ac1d 100644
--- a/starmath/source/format.cxx
+++ b/starmath/source/format.cxx
@@ -112,8 +112,9 @@ SmFormat::SmFormat()
{
nVersion = SM_FMT_VERSION_NOW;
- eHorAlign = AlignCenter;
- bIsTextmode = bScaleNormalBrackets = FALSE;
+ eHorAlign = AlignCenter;
+ nGreekCharStyle = 0;
+ bIsTextmode = bScaleNormalBrackets = FALSE;
vSize[SIZ_TEXT] = 100;
vSize[SIZ_INDEX] = 60;
@@ -191,6 +192,7 @@ SmFormat & SmFormat::operator = (const SmFormat &rFormat)
SetVersion (rFormat.GetVersion());
SetHorAlign(rFormat.GetHorAlign());
SetTextmode(rFormat.IsTextmode());
+ SetGreekCharStyle(rFormat.GetGreekCharStyle());
SetScaleNormalBrackets(rFormat.IsScaleNormalBrackets());
USHORT i;
@@ -212,6 +214,7 @@ BOOL SmFormat::operator == (const SmFormat &rFormat) const
{
BOOL bRes = aBaseSize == rFormat.aBaseSize &&
eHorAlign == rFormat.eHorAlign &&
+ nGreekCharStyle == rFormat.nGreekCharStyle &&
bIsTextmode == rFormat.bIsTextmode &&
bScaleNormalBrackets == rFormat.bScaleNormalBrackets;
diff --git a/starmath/source/makefile.mk b/starmath/source/makefile.mk
index 596060397e..a409e55d24 100644
--- a/starmath/source/makefile.mk
+++ b/starmath/source/makefile.mk
@@ -36,6 +36,8 @@ LIBTARGET=NO
# --- Settings -----------------------------------------------------
+ENABLE_EXCEPTIONS=TRUE
+
.INCLUDE : settings.mk
# --- Files --------------------------------------------------------
@@ -84,24 +86,6 @@ SLOFILES = \
$(SLO1FILES) \
$(SLO2FILES)
-EXCEPTIONSFILES = \
- $(SLO)$/register.obj \
- $(SLO)$/accessibility.obj \
- $(SLO)$/cfgitem.obj \
- $(SLO)$/dialog.obj \
- $(SLO)$/document.obj \
- $(SLO)$/node.obj \
- $(SLO)$/parse.obj \
- $(SLO)$/mathmlimport.obj \
- $(SLO)$/mathmlexport.obj \
- $(SLO)$/mathtype.obj \
- $(SLO)$/smdll.obj \
- $(SLO)$/view.obj \
- $(SLO)$/unomodel.obj \
- $(SLO)$/smdetect.obj \
- $(SLO)$/symbol.obj \
- $(SLO)$/unodoc.obj
-
LIB1TARGET = \
$(SLB)$/$(TARGET).lib
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 8188f6dc37..cf5c28eef8 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 4f3e9adc17..689e1e8a39 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/node.cxx b/starmath/source/node.cxx
index d0991d8153..a01cab246c 100644..100755
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -28,7 +28,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_starmath.hxx"
-#define APPEND(str,ascii) str.AppendAscii(RTL_CONSTASCII_STRINGPARAM(ascii))
+#include "node.hxx"
+#include "rect.hxx"
+#include "symbol.hxx"
+#include "smmod.hxx"
+#include "document.hxx"
+#include "view.hxx"
+#include "mathtype.hxx"
+
#include <tools/gen.hxx>
#include <tools/fract.hxx>
#include <rtl/math.hxx>
@@ -38,23 +45,14 @@
#include <vcl/outdev.hxx>
#include <sfx2/module.hxx>
-
-#include "node.hxx"
-#include <rect.hxx>
-#include "symbol.hxx"
-#include "smmod.hxx"
-#include <document.hxx>
-#include <view.hxx>
-#ifndef _MATHTYPE_HXX
-#include "mathtype.hxx"
-#endif
-
#include <math.h>
#include <float.h>
// define this to draw rectangles for debugging
//#define SM_RECT_DEBUG
+#define APPEND(str,ascii) str.AppendAscii(RTL_CONSTASCII_STRINGPARAM(ascii))
+
////////////////////////////////////////
// SmTmpDevice
// Allows for font and color changes. The original settings will be restored
@@ -2355,6 +2353,20 @@ void SmRectangleNode::Draw(OutputDevice &rDev, const Point &rPosition) const
/**************************************************************************/
+SmTextNode::SmTextNode( SmNodeType eNodeType, const SmToken &rNodeToken, USHORT nFontDescP ) :
+ SmVisibleNode(eNodeType, rNodeToken)
+{
+ nFontDesc = nFontDescP;
+}
+
+
+SmTextNode::SmTextNode( const SmToken &rNodeToken, USHORT nFontDescP ) :
+ SmVisibleNode(NTEXT, rNodeToken)
+{
+ nFontDesc = nFontDescP;
+}
+
+
void SmTextNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
{
SmNode::Prepare(rFormat, rDocShell);
@@ -2798,6 +2810,36 @@ void SmAttributNode::CreateTextFromNode(String &rText)
/**************************************************************************/
+bool lcl_IsFromGreekSymbolSet( const String &rTokenText )
+{
+ bool bRes = false;
+
+ // valid symbol name needs to have a '%' at pos 0 and at least an additonal char
+ if (rTokenText.Len() > 2 && rTokenText.GetBuffer()[0] == (sal_Unicode)'%')
+ {
+ String aName( rTokenText.Copy(1) );
+ SmSym *pSymbol = SM_MOD()->GetSymbolManager().GetSymbolByName( aName );
+ if (pSymbol && GetExportSymbolSetName( pSymbol->GetSymbolSetName() ).EqualsAscii( "Greek" ) )
+ bRes = true;
+ }
+
+ return bRes;
+}
+
+
+SmSpecialNode::SmSpecialNode(SmNodeType eNodeType, const SmToken &rNodeToken, USHORT _nFontDesc) :
+ SmTextNode(eNodeType, rNodeToken, _nFontDesc)
+{
+ bIsFromGreekSymbolSet = lcl_IsFromGreekSymbolSet( rNodeToken.aText );
+}
+
+
+SmSpecialNode::SmSpecialNode(const SmToken &rNodeToken) :
+ SmTextNode(NSPECIAL, rNodeToken, FNT_MATH) //! default Font nicht immer richtig
+{
+ bIsFromGreekSymbolSet = lcl_IsFromGreekSymbolSet( rNodeToken.aText );
+}
+
void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
{
@@ -2806,7 +2848,8 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell
const SmSym *pSym;
SmModule *pp = SM_MOD();
- if (NULL != (pSym = pp->GetSymbolManager().GetSymbolByName(GetToken().aText)))
+ String aName( GetToken().aText.Copy(1) );
+ if (NULL != (pSym = pp->GetSymbolManager().GetSymbolByName( aName )))
{
SetText( pSym->GetCharacter() );
GetFont() = pSym->GetFace();
@@ -2832,6 +2875,33 @@ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell
SetAttribut(ATTR_BOLD);
Flags() |= FLG_FONT;
+
+ if (bIsFromGreekSymbolSet)
+ {
+ DBG_ASSERT( GetText().Len() == 1, "a symbol should only consist of 1 char!" );
+ bool bItalic = false;
+ INT16 nStyle = rFormat.GetGreekCharStyle();
+ DBG_ASSERT( nStyle >= 0 && nStyle <= 2, "unexpected value for GreekCharStyle" );
+ if (nStyle == 1)
+ bItalic = true;
+ else if (nStyle == 2)
+ {
+ String aTmp( GetText() );
+ if (aTmp.Len() > 0)
+ {
+ const sal_Unicode cUppercaseAlpha = 0x0391;
+ const sal_Unicode cUppercaseOmega = 0x03A9;
+ sal_Unicode cChar = aTmp.GetBuffer()[0];
+ // uppercase letters should be straight and lowercase letters italic
+ bItalic = !(cUppercaseAlpha <= cChar && cChar <= cUppercaseOmega);
+ }
+ }
+
+ if (bItalic)
+ Attributes() |= ATTR_ITALIC;
+ else
+ Attributes() &= ~ATTR_ITALIC;;
+ }
};
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 7a78ee5579..af5c02c827 100755
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -741,14 +741,14 @@ void SmParser::NextToken()
CurToken.nLevel = 5;
CurToken.aText = String();
CurToken.nRow = sal::static_int_cast< xub_StrLen >(Row);
- CurToken.nCol = nTmpStart - ColOff + 1;
+ CurToken.nCol = nTmpStart - ColOff;
if (aTmpRes.TokenType & KParseType::IDENTNAME)
{
xub_StrLen n = sal::static_int_cast< xub_StrLen >(aTmpRes.EndPos - nTmpStart);
CurToken.eType = TSPECIAL;
- CurToken.aText = BufferString.Copy( sal::static_int_cast< xub_StrLen >(nTmpStart), n );
+ CurToken.aText = BufferString.Copy( sal::static_int_cast< xub_StrLen >(nTmpStart-1), n+1 );
DBG_ASSERT( aTmpRes.EndPos > rnEndPos,
"empty identifier" );
diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx
index d40bd4f557..6c23a079db 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 e190edb79e..61f014fd96 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/unomodel.cxx b/starmath/source/unomodel.cxx
index 7d73b0c737..a3139d0de8 100755
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -203,6 +203,7 @@ enum SmModelPropertyHandles
HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS,
HANDLE_RELATIVE_FONT_HEIGHT_LIMITS,
HANDLE_IS_TEXT_MODE,
+ HANDLE_GREEK_CHAR_STYLE,
HANDLE_ALIGNMENT,
HANDLE_RELATIVE_SPACING,
HANDLE_RELATIVE_LINE_SPACING,
@@ -273,6 +274,7 @@ PropertySetInfo * lcl_createModelPropertyInfo ()
{ RTL_CONSTASCII_STRINGPARAM( "Formula" ), HANDLE_FORMULA , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM( "IsScaleAllBrackets" ), HANDLE_IS_SCALE_ALL_BRACKETS , &::getBooleanCppuType(), PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM( "IsTextMode" ), HANDLE_IS_TEXT_MODE , &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM( "GreekCharStyle" ), HANDLE_GREEK_CHAR_STYLE, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
{ RTL_CONSTASCII_STRINGPARAM( "LeftMargin" ), HANDLE_LEFT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_LEFTSPACE },
{ RTL_CONSTASCII_STRINGPARAM( "PrinterName" ), HANDLE_PRINTER_NAME , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0 },
{ RTL_CONSTASCII_STRINGPARAM( "PrinterSetup" ), HANDLE_PRINTER_SETUP , &::getCppuType((const Sequence < sal_Int8 >*)0), PROPERTY_NONE, 0 },
@@ -593,6 +595,16 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
}
break;
+ case HANDLE_GREEK_CHAR_STYLE :
+ {
+ sal_Int16 nVal = 0;
+ *pValues >>= nVal;
+ if (nVal < 0 || nVal > 2)
+ throw IllegalArgumentException();
+ aFormat.SetGreekCharStyle( nVal );
+ }
+ break;
+
case HANDLE_ALIGNMENT :
{
// SmHorAlign uses the same values as HorizontalAlignment
@@ -824,6 +836,10 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
}
break;
+ case HANDLE_GREEK_CHAR_STYLE :
+ *pValue <<= (sal_Int16)aFormat.GetGreekCharStyle();
+ break;
+
case HANDLE_ALIGNMENT :
// SmHorAlign uses the same values as HorizontalAlignment
*pValue <<= (sal_Int16)aFormat.GetHorAlign();
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 4698d7d71a..0d9ea5812c 100755
--- 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;
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index d136102a2f..536a6a0b8c 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1318,8 +1318,12 @@ void SwEditShell::MoveContinuationPosToEndOfCheckedSentence()
void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, bool bRecheck)
{
+ // Note: rNewPortions.size() == 0 is valid and happens when the whole
+ // sentence got removed in the dialog
+
ASSERT( pSpellIter, "SpellIter missing" );
- if(pSpellIter)
+ if(pSpellIter &&
+ pSpellIter->GetLastPortions().size() > 0) // no portions -> no text to be changed
{
const SpellPortions& rLastPortions = pSpellIter->GetLastPortions();
const SpellContentPositions rLastPositions = pSpellIter->GetLastPositions();
@@ -1330,9 +1334,6 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
// iterate over the new portions, beginning at the end to take advantage of the previously
// saved content positions
- if(!rLastPortions.size())
- return;
-
pDoc->StartUndo( UNDO_OVERWRITE, NULL );
StartAction();
@@ -1344,6 +1345,10 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
sal_uInt32 nRedlinePortions = lcl_CountRedlines(rLastPortions);
if((rLastPortions.size() - nRedlinePortions) == rNewPortions.size())
{
+ DBG_ASSERT( rNewPortions.size() > 0, "rNewPortions should not be empty here" );
+ DBG_ASSERT( rLastPortions.size() > 0, "rLastPortions should not be empty here" );
+ DBG_ASSERT( rLastPositions.size() > 0, "rLastPositions should not be empty here" );
+
//the simple case: the same number of elements on both sides
//each changed element has to be applied to the corresponding source element
svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.end();
@@ -1357,8 +1362,17 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
//jump over redline portions
while(aCurrentOldPortion->bIsHidden)
{
- --aCurrentOldPortion;
- --aCurrentOldPosition;
+ if (aCurrentOldPortion != rLastPortions.begin() &&
+ aCurrentOldPosition != rLastPositions.begin())
+ {
+ --aCurrentOldPortion;
+ --aCurrentOldPosition;
+ }
+ else
+ {
+ DBG_ASSERT( 0, "ApplyChangedSentence: iterator positions broken" );
+ break;
+ }
}
if ( !pCrsr->HasMark() )
pCrsr->SetMark();
@@ -1398,6 +1412,8 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
}
else
{
+ DBG_ASSERT( rLastPositions.size() > 0, "rLastPositions should not be empty here" );
+
//select the complete sentence
SpellContentPositions::const_iterator aCurrentEndPosition = rLastPositions.end();
--aCurrentEndPosition;