summaryrefslogtreecommitdiff
path: root/starmath/source
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
commitd791366863cf9659a01b171ce0e727bfe2f28cdf (patch)
treec44591abc4bf9e7207814d6d9a7756c37657249a /starmath/source
initial import
Diffstat (limited to 'starmath/source')
-rw-r--r--starmath/source/action.cxx128
-rw-r--r--starmath/source/commands.src2714
-rw-r--r--starmath/source/config.cxx381
-rw-r--r--starmath/source/dialog.cxx2405
-rw-r--r--starmath/source/document.cxx1641
-rw-r--r--starmath/source/edit.cxx783
-rw-r--r--starmath/source/format.cxx311
-rw-r--r--starmath/source/makefile.mk163
-rw-r--r--starmath/source/math_pch.cxx893
-rw-r--r--starmath/source/mathtype.cxx3081
-rw-r--r--starmath/source/mathtype.hxx203
-rw-r--r--starmath/source/node.cxx2490
-rw-r--r--starmath/source/parse.cxx2087
-rw-r--r--starmath/source/rect.cxx908
-rw-r--r--starmath/source/smdll.cxx166
-rw-r--r--starmath/source/smmod.cxx231
-rw-r--r--starmath/source/smres.src10674
-rw-r--r--starmath/source/symbol.cxx657
-rw-r--r--starmath/source/toolbox.cxx274
-rw-r--r--starmath/source/typemap.cxx190
-rw-r--r--starmath/source/unomodel.cxx782
-rw-r--r--starmath/source/utility.cxx651
-rw-r--r--starmath/source/view.cxx1559
23 files changed, 33372 insertions, 0 deletions
diff --git a/starmath/source/action.cxx b/starmath/source/action.cxx
new file mode 100644
index 000000000000..15b052264e66
--- /dev/null
+++ b/starmath/source/action.cxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * $RCSfile: action.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include "action.hxx"
+#include "smdll.hxx"
+#include "document.hxx"
+#include "starmath.hrc"
+
+SmEditAction::SmEditAction(SmDocShell *pDocSh,
+ const String& rOldText,
+ const String& rNewText) :
+ pDoc( pDocSh ),
+ aOldText( rOldText ),
+ aNewText( rNewText )
+{
+}
+
+void SmEditAction::Undo()
+{
+ pDoc->SetText(aOldText);
+}
+
+void SmEditAction::Redo()
+{
+ pDoc->SetText(aNewText);
+}
+
+void SmEditAction::Repeat(SmDocShell *pDocSh)
+{
+ pDocSh->SetText(aNewText);
+}
+
+String SmEditAction::GetComment() const
+{
+ return (SmResId(RID_UNDOEDITNAME));
+}
+
+
+SmFormatAction::SmFormatAction(SmDocShell *pDocSh,
+ const SmFormat& rOldFormat,
+ const SmFormat& rNewFormat) :
+ pDoc( pDocSh ),
+ aOldFormat( rOldFormat ),
+ aNewFormat( rNewFormat )
+{
+}
+
+void SmFormatAction::Undo()
+{
+ pDoc->SetFormat(aOldFormat);
+}
+
+void SmFormatAction::Redo()
+{
+ pDoc->SetFormat(aNewFormat);
+}
+
+void SmFormatAction::Repeat(SmDocShell *pDocSh)
+{
+ pDocSh->SetFormat(aNewFormat);
+}
+
+String SmFormatAction::GetComment() const
+{
+ return (SmResId(RID_UNDOFORMATNAME));
+}
+
+
diff --git a/starmath/source/commands.src b/starmath/source/commands.src
new file mode 100644
index 000000000000..5482aef9e103
--- /dev/null
+++ b/starmath/source/commands.src
@@ -0,0 +1,2714 @@
+/*************************************************************************
+ *
+ * $RCSfile: commands.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <sfx2/sfx.hrc>
+#include "starmath.hrc"
+
+
+////////////////////////////////////////////////////////////
+//
+// XPolyPolygon data for some characters from StarMath font
+//
+
+Resource RID_XPP_LINE
+{
+ ExtraData =
+ {
+// Zeichen: 0x73 Font: StarMath
+ 29457; 512; 76; 768; 146; 0; 59; 0;
+ 44; 0; 83; 768; 1; 5; 146; 0;
+ 141; 768; 146; 0; 59; 0; 189; 0;
+ 59; 0; 189; 0; 141; 768; 146; 0;
+ 141; 768; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0x73 Font: StarMath
+ "\x73\x11\x02\x00\x00\x4C\x03\x00\x00\x92\x00\x00\x00\x3B\x00\x00"
+ "\x00\x2C\x00\x00\x00\x53\x03\x00\x00\x01\x00\x05\x00\x92\x00\x00"
+ "\x00\x8D\x03\x00\x00\x92\x00\x00\x00\x3B\x00\x00\x00\xBD\x00\x00"
+ "\x00\x3B\x00\x00\x00\xBD\x00\x00\x00\x8D\x03\x00\x00\x92\x00\x00"
+ "\x00\x8D\x03\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_DLINE
+{
+ ExtraData =
+ {
+// Zeichen: 0x74 Font: StarMath
+ 29713; 512; 76; 768; 136; 0; 59; 0;
+ 214; 0; 78; 768; 2; 5; 51; 256;
+ 136; 768; 51; 256; 59; 0; 93; 256;
+ 59; 0; 93; 256; 136; 768; 51; 256;
+ 136; 768; 0; 0; 0; 1280; -30720; 0;
+-30717; 0; -30720; 0; 15104; 0; -19968; 0;
+ 15104; 0; -19968; 0; -30717; 0; -30720; 0;
+-30717; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0x74 Font: StarMath
+ "\x74\x11\x02\x00\x00\x4C\x03\x00\x00\x88\x00\x00\x00\x3B\x00\x00"
+ "\x00\xD6\x00\x00\x00\x4E\x03\x00\x00\x02\x00\x05\x00\x33\x01\x00"
+ "\x00\x88\x03\x00\x00\x33\x01\x00\x00\x3B\x00\x00\x00\x5D\x01\x00"
+ "\x00\x3B\x00\x00\x00\x5D\x01\x00\x00\x88\x03\x00\x00\x33\x01\x00"
+ "\x00\x88\x03\x00\x00\x00\x00\x00\x00\x00\x05\x00\x88\x00\x00\x00"
+ "\x88\x03\x00\x00\x88\x00\x00\x00\x3B\x00\x00\x00\xB2\x00\x00\x00"
+ "\x3B\x00\x00\x00\xB2\x00\x00\x00\x88\x03\x00\x00\x88\x00\x00\x00"
+ "\x88\x03\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_SQRT
+{
+ ExtraData =
+ {
+// Zeichen: 0x87 Font: StarMath
+-30959; 512; 76; 768; 26; 0; 48; 0;
+ 184; 256; 170; 512; 1; 10; 2; 256;
+ 217; 512; 97; 0; 184; 256; 37; 0;
+ 208; 256; 26; 0; 196; 256; 131; 0;
+ 155; 256; 15; 256; 153; 512; 189; 256;
+ 48; 0; 209; 256; 48; 0; 22; 256;
+ 217; 512; 2; 256; 217; 512; 0; 0;
+ 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0x87 Font: StarMath
+ "\x87\x11\x02\x00\x00\x4C\x03\x00\x00\x1A\x00\x00\x00\x30\x00\x00"
+ "\x00\xB8\x01\x00\x00\xAA\x02\x00\x00\x01\x00\x0A\x00\x02\x01\x00"
+ "\x00\xD9\x02\x00\x00\x61\x00\x00\x00\xB8\x01\x00\x00\x25\x00\x00"
+ "\x00\xD0\x01\x00\x00\x1A\x00\x00\x00\xC4\x01\x00\x00\x83\x00\x00"
+ "\x00\x9B\x01\x00\x00\x0F\x01\x00\x00\x99\x02\x00\x00\xBD\x01\x00"
+ "\x00\x30\x00\x00\x00\xD1\x01\x00\x00\x30\x00\x00\x00\x16\x01\x00"
+ "\x00\xD9\x02\x00\x00\x02\x01\x00\x00\xD9\x02\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_SQRT2
+{
+ ExtraData =
+ {
+// Zeichen: 0x89 Font: StarMath
+-30447; 512; 76; 768; 26; 0; 48; 0;
+ 218; 0; 170; 512; 1; 10; 227; 0;
+ 217; 512; 74; 0; 203; 256; 35; 0;
+ 225; 256; 26; 0; 213; 256; 91; 0;
+ 176; 256; 229; 0; 156; 512; 227; 0;
+ 48; 0; 243; 0; 48; 0; 243; 0;
+ 217; 512; 227; 0; 217; 512; 0; 0;
+ 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0x89 Font: StarMath
+ "\x89\x11\x02\x00\x00\x4C\x03\x00\x00\x1A\x00\x00\x00\x30\x00\x00"
+ "\x00\xDA\x00\x00\x00\xAA\x02\x00\x00\x01\x00\x0A\x00\xE3\x00\x00"
+ "\x00\xD9\x02\x00\x00\x4A\x00\x00\x00\xCB\x01\x00\x00\x23\x00\x00"
+ "\x00\xE1\x01\x00\x00\x1A\x00\x00\x00\xD5\x01\x00\x00\x5B\x00\x00"
+ "\x00\xB0\x01\x00\x00\xE5\x00\x00\x00\x9C\x02\x00\x00\xE3\x00\x00"
+ "\x00\x30\x00\x00\x00\xF3\x00\x00\x00\x30\x00\x00\x00\xF3\x00\x00"
+ "\x00\xD9\x02\x00\x00\xE3\x00\x00\x00\xD9\x02\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_HAT
+{
+ ExtraData =
+ {
+// Zeichen: 0x90 Font: StarMath
+-28655; 512; 76; 768; 13; 0; 113; 0;
+ 7; 256; 161; 0; 1; 7; 19; 256;
+ 12; 256; 3; 256; 14; 256; 148; 0;
+ 182; 0; 32; 0; 17; 256; 13; 0;
+ 12; 256; 150; 0; 113; 0; 19; 256;
+ 12; 256; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0x90 Font: StarMath
+ "\x90\x11\x02\x00\x00\x4C\x03\x00\x00\x0D\x00\x00\x00\x71\x00\x00"
+ "\x00\x07\x01\x00\x00\xA1\x00\x00\x00\x01\x00\x07\x00\x13\x01\x00"
+ "\x00\x0C\x01\x00\x00\x03\x01\x00\x00\x0E\x01\x00\x00\x94\x00\x00"
+ "\x00\xB6\x00\x00\x00\x20\x00\x00\x00\x11\x01\x00\x00\x0D\x00\x00"
+ "\x00\x0C\x01\x00\x00\x96\x00\x00\x00\x71\x00\x00\x00\x13\x01\x00"
+ "\x00\x0C\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_TILDE
+{
+ ExtraData =
+ {
+// Zeichen: 0x95 Font: StarMath
+-27375; 512; 76; 768; 8; 0; 119; 0;
+ 8; 256; 109; 0; 1; 26; 21; 0;
+ 227; 0; 8; 0; 227; 0; 11; 0;
+ 157; 0; 37; 0; 119; 0; 86; 0;
+ 119; 0; 97; 0; 119; 0; 141; 0;
+ 140; 0; 219; 0; 177; 0; 238; 0;
+ 177; 0; 251; 0; 158; 0; 3; 256;
+ 119; 0; 15; 256; 119; 0; 15; 256;
+ 124; 0; 15; 256; 151; 0; 9; 256;
+ 175; 0; 253; 0; 194; 0; 238; 0;
+ 217; 0; 217; 0; 227; 0; 194; 0;
+ 227; 0; 177; 0; 227; 0; 131; 0;
+ 209; 0; 60; 0; 168; 0; 42; 0;
+ 168; 0; 28; 0; 189; 0; 21; 0;
+ 227; 0; 21; 0; 227; 0; 0; 2;
+ 512; 514; 2; 512; 0; 514; 2; 512;
+ 514; 2; 512; 0;
+#ifdef NO_MORE
+ // Zeichen: 0x95 Font: StarMath
+ "\x95\x11\x02\x00\x00\x4C\x03\x00\x00\x08\x00\x00\x00\x77\x00\x00"
+ "\x00\x08\x01\x00\x00\x6D\x00\x00\x00\x01\x00\x1A\x00\x15\x00\x00"
+ "\x00\xE3\x00\x00\x00\x08\x00\x00\x00\xE3\x00\x00\x00\x0B\x00\x00"
+ "\x00\x9D\x00\x00\x00\x25\x00\x00\x00\x77\x00\x00\x00\x56\x00\x00"
+ "\x00\x77\x00\x00\x00\x61\x00\x00\x00\x77\x00\x00\x00\x8D\x00\x00"
+ "\x00\x8C\x00\x00\x00\xDB\x00\x00\x00\xB1\x00\x00\x00\xEE\x00\x00"
+ "\x00\xB1\x00\x00\x00\xFB\x00\x00\x00\x9E\x00\x00\x00\x03\x01\x00"
+ "\x00\x77\x00\x00\x00\x0F\x01\x00\x00\x77\x00\x00\x00\x0F\x01\x00"
+ "\x00\x7C\x00\x00\x00\x0F\x01\x00\x00\x97\x00\x00\x00\x09\x01\x00"
+ "\x00\xAF\x00\x00\x00\xFD\x00\x00\x00\xC2\x00\x00\x00\xEE\x00\x00"
+ "\x00\xD9\x00\x00\x00\xD9\x00\x00\x00\xE3\x00\x00\x00\xC2\x00\x00"
+ "\x00\xE3\x00\x00\x00\xB1\x00\x00\x00\xE3\x00\x00\x00\x83\x00\x00"
+ "\x00\xD1\x00\x00\x00\x3C\x00\x00\x00\xA8\x00\x00\x00\x2A\x00\x00"
+ "\x00\xA8\x00\x00\x00\x1C\x00\x00\x00\xBD\x00\x00\x00\x15\x00\x00"
+ "\x00\xE3\x00\x00\x00\x15\x00\x00\x00\xE3\x00\x00\x00\x00\x00\x02"
+ "\x02\x00\x02\x02\x00\x02\x02\x00\x00\x00\x02\x02\x00\x02\x02\x00"
+ "\x02\x02\x00\x02\x02\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_BAR
+{
+ ExtraData =
+ {
+// Zeichen: 0x96 Font: StarMath
+-27119; 512; 76; 768; 42; 0; 146; 0;
+ 87; 256; 33; 0; 1; 5; 42; 0;
+ 146; 0; 128; 256; 146; 0; 128; 256;
+ 178; 0; 42; 0; 178; 0; 42; 0;
+ 146; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0x96 Font: StarMath
+ "\x96\x11\x02\x00\x00\x4C\x03\x00\x00\x2A\x00\x00\x00\x92\x00\x00"
+ "\x00\x57\x01\x00\x00\x21\x00\x00\x00\x01\x00\x05\x00\x2A\x00\x00"
+ "\x00\x92\x00\x00\x00\x80\x01\x00\x00\x92\x00\x00\x00\x80\x01\x00"
+ "\x00\xB2\x00\x00\x00\x2A\x00\x00\x00\xB2\x00\x00\x00\x2A\x00\x00"
+ "\x00\x92\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_VEC
+{
+ ExtraData =
+ {
+// Zeichen: 0x97 Font: StarMath
+-26863; 512; 76; 768; 40; 0; 77; 0;
+ 128; 256; 172; 0; 1; 8; 40; 0;
+ 185; 0; 40; 0; 138; 0; 27; 256;
+ 138; 0; 10; 256; 77; 0; 167; 256;
+ 163; 0; 10; 256; 248; 0; 27; 256;
+ 185; 0; 40; 0; 185; 0; 0; 0;
+ 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0x97 Font: StarMath
+ "\x97\x11\x02\x00\x00\x4C\x03\x00\x00\x28\x00\x00\x00\x4D\x00\x00"
+ "\x00\x80\x01\x00\x00\xAC\x00\x00\x00\x01\x00\x08\x00\x28\x00\x00"
+ "\x00\xB9\x00\x00\x00\x28\x00\x00\x00\x8A\x00\x00\x00\x1B\x01\x00"
+ "\x00\x8A\x00\x00\x00\x0A\x01\x00\x00\x4D\x00\x00\x00\xA7\x01\x00"
+ "\x00\xA3\x00\x00\x00\x0A\x01\x00\x00\xF8\x00\x00\x00\x1B\x01\x00"
+ "\x00\xB9\x00\x00\x00\x28\x00\x00\x00\xB9\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_LBRACE
+{
+ ExtraData =
+ {
+// Zeichen: 0xA0 Font: StarMath
+-24559; 512; 76; 768; 38; 0; 43; 0;
+ 168; 0; 104; 768; 1; 42; 205; 0;
+ 146; 768; 200; 0; 146; 768; 163; 0;
+ 146; 768; 136; 0; 133; 768; 116; 0;
+ 109; 768; 97; 0; 86; 768; 89; 0;
+ 57; 768; 89; 0; 20; 768; 89; 0;
+ 26; 512; 89; 0; 247; 256; 72; 0;
+ 228; 256; 38; 0; 228; 256; 38; 0;
+ 214; 256; 57; 0; 214; 256; 70; 0;
+ 211; 256; 79; 0; 203; 256; 86; 0;
+ 196; 256; 89; 0; 181; 256; 89; 0;
+ 160; 256; 89; 0; 168; 0; 89; 0;
+ 131; 0; 99; 0; 101; 0; 119; 0;
+ 77; 0; 138; 0; 55; 0; 167; 0;
+ 43; 0; 205; 0; 43; 0; 205; 0;
+ 57; 0; 151; 0; 57; 0; 123; 0;
+ 91; 0; 123; 0; 157; 0; 119; 0;
+ 138; 256; 119; 0; 177; 256; 101; 0;
+ 206; 256; 65; 0; 223; 256; 101; 0;
+ 240; 256; 119; 0; 13; 512; 119; 0;
+ 51; 512; 123; 0; 32; 768; 123; 0;
+ 99; 768; 151; 0; 133; 768; 205; 0;
+ 133; 768; 205; 0; 146; 768; 0; 2;
+ 512; 514; 0; 514; 0; 514; 2; 512;
+ 2; 512; 514; 0; 514; 0; 514; 2;
+ 512; 2; 512; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xA0 Font: StarMath
+ "\xA0\x11\x02\x00\x00\x4C\x03\x00\x00\x26\x00\x00\x00\x2B\x00\x00"
+ "\x00\xA8\x00\x00\x00\x68\x03\x00\x00\x01\x00\x2D\x00\xCD\x00\x00"
+ "\x00\x92\x03\x00\x00\xC8\x00\x00\x00\x92\x03\x00\x00\xA3\x00\x00"
+ "\x00\x92\x03\x00\x00\x88\x00\x00\x00\x85\x03\x00\x00\x74\x00\x00"
+ "\x00\x6D\x03\x00\x00\x61\x00\x00\x00\x56\x03\x00\x00\x59\x00\x00"
+ "\x00\x39\x03\x00\x00\x59\x00\x00\x00\x14\x03\x00\x00\x59\x00\x00"
+ "\x00\x1A\x02\x00\x00\x59\x00\x00\x00\x06\x02\x00\x00\x54\x00\x00"
+ "\x00\xF8\x01\x00\x00\x4D\x00\x00\x00\xF0\x01\x00\x00\x46\x00\x00"
+ "\x00\xE9\x01\x00\x00\x39\x00\x00\x00\xE4\x01\x00\x00\x26\x00\x00"
+ "\x00\xE4\x01\x00\x00\x26\x00\x00\x00\xD6\x01\x00\x00\x3B\x00\x00"
+ "\x00\xD6\x01\x00\x00\x48\x00\x00\x00\xD3\x01\x00\x00\x4F\x00\x00"
+ "\x00\xCB\x01\x00\x00\x56\x00\x00\x00\xC4\x01\x00\x00\x59\x00\x00"
+ "\x00\xB5\x01\x00\x00\x59\x00\x00\x00\xA0\x01\x00\x00\x59\x00\x00"
+ "\x00\xA8\x00\x00\x00\x59\x00\x00\x00\x83\x00\x00\x00\x63\x00\x00"
+ "\x00\x65\x00\x00\x00\x77\x00\x00\x00\x4D\x00\x00\x00\x8A\x00\x00"
+ "\x00\x37\x00\x00\x00\xA7\x00\x00\x00\x2B\x00\x00\x00\xCD\x00\x00"
+ "\x00\x2B\x00\x00\x00\xCD\x00\x00\x00\x39\x00\x00\x00\x97\x00\x00"
+ "\x00\x39\x00\x00\x00\x7B\x00\x00\x00\x5B\x00\x00\x00\x7B\x00\x00"
+ "\x00\x9D\x00\x00\x00\x77\x00\x00\x00\x8A\x01\x00\x00\x77\x00\x00"
+ "\x00\xB1\x01\x00\x00\x65\x00\x00\x00\xCE\x01\x00\x00\x41\x00\x00"
+ "\x00\xDF\x01\x00\x00\x65\x00\x00\x00\xF0\x01\x00\x00\x77\x00\x00"
+ "\x00\x0D\x02\x00\x00\x77\x00\x00\x00\x33\x02\x00\x00\x7B\x00\x00"
+ "\x00\x20\x03\x00\x00\x7B\x00\x00\x00\x63\x03\x00\x00\x97\x00\x00"
+ "\x00\x85\x03\x00\x00\xCD\x00\x00\x00\x85\x03\x00\x00\xCD\x00\x00"
+ "\x00\x92\x03\x00\x00\x00\x00\x02\x02\x00\x02\x02\x00\x00\x02\x02"
+ "\x00\x02\x02\x00\x00\x02\x02\x00\x02\x02\x00\x00\x02\x02\x00\x02"
+ "\x02\x00\x00\x02\x02\x00\x00\x02\x02\x00\x02\x02\x00\x00\x02\x02"
+ "\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_RBRACE
+{
+ ExtraData =
+ {
+// Zeichen: 0xA1 Font: StarMath
+-24303; 512; 76; 768; 38; 0; 43; 0;
+ 168; 0; 104; 768; 1; 63; 38; 0;
+ 146; 768; 38; 0; 133; 768; 92; 0;
+ 133; 768; 121; 0; 99; 768; 121; 0;
+ 32; 768; 121; 0; 5; 768; 119; 0;
+ 222; 512; 119; 0; 169; 512; 116; 0;
+ 117; 512; 116; 0; 78; 512; 116; 0;
+ 51; 512; 116; 0; 14; 512; 135; 0;
+ 243; 256; 172; 0; 223; 256; 135; 0;
+ 206; 256; 116; 0; 177; 256; 116; 0;
+ 138; 256; 116; 0; 111; 256; 116; 0;
+ 73; 256; 119; 0; 19; 256; 119; 0;
+ 222; 0; 121; 0; 183; 0; 121; 0;
+ 157; 0; 121; 0; 91; 0; 92; 0;
+ 57; 0; 38; 0; 57; 0; 38; 0;
+ 43; 0; 43; 0; 43; 0; 79; 0;
+ 43; 0; 108; 0; 57; 0; 128; 0;
+ 81; 0; 145; 0; 102; 0; 155; 0;
+ 133; 0; 155; 0; 170; 0; 155; 0;
+ 197; 0; 153; 0; 239; 0; 150; 0;
+ 37; 256; 146; 0; 93; 256; 145; 0;
+ 135; 256; 145; 0; 162; 256; 145; 0;
+ 184; 256; 148; 0; 198; 256; 158; 0;
+ 204; 256; 167; 0; 213; 256; 182; 0;
+ 216; 256; 205; 0; 216; 256; 205; 0;
+ 230; 256; 182; 0; 230; 256; 167; 0;
+ 233; 256; 158; 0; 240; 256; 148; 0;
+ 247; 256; 145; 0; 6; 512; 145; 0;
+ 28; 512; 145; 0; 55; 512; 146; 0;
+ 97; 512; 150; 0; 151; 512; 153; 0;
+ 207; 512; 155; 0; 247; 512; 155; 0;
+ 20; 768; 155; 0; 104; 768; 116; 0;
+ 146; 768; 38; 0; 146; 768; 38; 0;
+ 146; 768; 0; 2; 512; 514; 2; 512;
+ 514; 2; 512; 514; 2; 512; 514; 0;
+ 2; 512; 514; 2; 512; 514; 2; 512;
+ 514; 0; 514; 2; 512; 514; 2; 512;
+ 514; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xA1 Font: StarMath
+ "\xA1\x11\x02\x00\x00\x4C\x03\x00\x00\x26\x00\x00\x00\x2B\x00\x00"
+ "\x00\xA8\x00\x00\x00\x68\x03\x00\x00\x01\x00\x3F\x00\x26\x00\x00"
+ "\x00\x92\x03\x00\x00\x26\x00\x00\x00\x85\x03\x00\x00\x5C\x00\x00"
+ "\x00\x85\x03\x00\x00\x79\x00\x00\x00\x63\x03\x00\x00\x79\x00\x00"
+ "\x00\x20\x03\x00\x00\x79\x00\x00\x00\x05\x03\x00\x00\x77\x00\x00"
+ "\x00\xDE\x02\x00\x00\x77\x00\x00\x00\xA9\x02\x00\x00\x74\x00\x00"
+ "\x00\x75\x02\x00\x00\x74\x00\x00\x00\x4E\x02\x00\x00\x74\x00\x00"
+ "\x00\x33\x02\x00\x00\x74\x00\x00\x00\x0E\x02\x00\x00\x87\x00\x00"
+ "\x00\xF3\x01\x00\x00\xAC\x00\x00\x00\xDF\x01\x00\x00\x87\x00\x00"
+ "\x00\xCE\x01\x00\x00\x74\x00\x00\x00\xB1\x01\x00\x00\x74\x00\x00"
+ "\x00\x8A\x01\x00\x00\x74\x00\x00\x00\x6F\x01\x00\x00\x74\x00\x00"
+ "\x00\x49\x01\x00\x00\x77\x00\x00\x00\x13\x01\x00\x00\x77\x00\x00"
+ "\x00\xDE\x00\x00\x00\x79\x00\x00\x00\xB7\x00\x00\x00\x79\x00\x00"
+ "\x00\x9D\x00\x00\x00\x79\x00\x00\x00\x5B\x00\x00\x00\x5C\x00\x00"
+ "\x00\x39\x00\x00\x00\x26\x00\x00\x00\x39\x00\x00\x00\x26\x00\x00"
+ "\x00\x2B\x00\x00\x00\x2B\x00\x00\x00\x2B\x00\x00\x00\x4F\x00\x00"
+ "\x00\x2B\x00\x00\x00\x6C\x00\x00\x00\x39\x00\x00\x00\x80\x00\x00"
+ "\x00\x51\x00\x00\x00\x91\x00\x00\x00\x66\x00\x00\x00\x9B\x00\x00"
+ "\x00\x85\x00\x00\x00\x9B\x00\x00\x00\xAA\x00\x00\x00\x9B\x00\x00"
+ "\x00\xC5\x00\x00\x00\x99\x00\x00\x00\xEF\x00\x00\x00\x96\x00\x00"
+ "\x00\x25\x01\x00\x00\x92\x00\x00\x00\x5D\x01\x00\x00\x91\x00\x00"
+ "\x00\x87\x01\x00\x00\x91\x00\x00\x00\xA2\x01\x00\x00\x91\x00\x00"
+ "\x00\xB8\x01\x00\x00\x94\x00\x00\x00\xC6\x01\x00\x00\x9E\x00\x00"
+ "\x00\xCC\x01\x00\x00\xA7\x00\x00\x00\xD5\x01\x00\x00\xB6\x00\x00"
+ "\x00\xD8\x01\x00\x00\xCD\x00\x00\x00\xD8\x01\x00\x00\xCD\x00\x00"
+ "\x00\xE6\x01\x00\x00\xB6\x00\x00\x00\xE6\x01\x00\x00\xA7\x00\x00"
+ "\x00\xE9\x01\x00\x00\x9E\x00\x00\x00\xF0\x01\x00\x00\x94\x00\x00"
+ "\x00\xF7\x01\x00\x00\x91\x00\x00\x00\x06\x02\x00\x00\x91\x00\x00"
+ "\x00\x1C\x02\x00\x00\x91\x00\x00\x00\x37\x02\x00\x00\x92\x00\x00"
+ "\x00\x61\x02\x00\x00\x96\x00\x00\x00\x97\x02\x00\x00\x99\x00\x00"
+ "\x00\xCF\x02\x00\x00\x9B\x00\x00\x00\xF7\x02\x00\x00\x9B\x00\x00"
+ "\x00\x14\x03\x00\x00\x9B\x00\x00\x00\x68\x03\x00\x00\x74\x00\x00"
+ "\x00\x92\x03\x00\x00\x26\x00\x00\x00\x92\x03\x00\x00\x26\x00\x00"
+ "\x00\x92\x03\x00\x00\x00\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00"
+ "\x02\x02\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00\x00"
+ "\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00"
+ "\x02\x02\x00\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00"
+ "\x02\x02\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_LPARENT
+{
+ ExtraData =
+ {
+// Zeichen: 0xA2 Font: StarMath
+-24047; 512; 76; 768; 60; 0; 67; 0;
+ 162; 0; 69; 768; 1; 27; 221; 0;
+ 135; 768; 167; 0; 89; 768; 126; 0;
+ 25; 768; 99; 0; 200; 512; 72; 0;
+ 127; 512; 60; 0; 51; 512; 60; 0;
+ 228; 256; 60; 0; 152; 256; 72; 0;
+ 76; 256; 99; 0; 2; 256; 128; 0;
+ 172; 0; 168; 0; 108; 0; 221; 0;
+ 67; 0; 221; 0; 87; 0; 182; 0;
+ 124; 0; 153; 0; 185; 0; 133; 0;
+ 17; 256; 116; 0; 88; 256; 109; 0;
+ 157; 256; 109; 0; 228; 256; 109; 0;
+ 43; 512; 116; 0; 114; 512; 133; 0;
+ 183; 512; 153; 0; 16; 768; 182; 0;
+ 79; 768; 221; 0; 113; 768; 221; 0;
+ 135; 768; 0; 514; 2; 512; 514; 2;
+ 512; 2; 512; 514; 2; 512; 514; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xA2 Font: StarMath
+ "\xA2\x11\x02\x00\x00\x4C\x03\x00\x00\x3C\x00\x00\x00\x43\x00\x00"
+ "\x00\xA2\x00\x00\x00\x45\x03\x00\x00\x01\x00\x1B\x00\xDD\x00\x00"
+ "\x00\x87\x03\x00\x00\xA7\x00\x00\x00\x59\x03\x00\x00\x7E\x00\x00"
+ "\x00\x19\x03\x00\x00\x63\x00\x00\x00\xC8\x02\x00\x00\x48\x00\x00"
+ "\x00\x7F\x02\x00\x00\x3C\x00\x00\x00\x33\x02\x00\x00\x3C\x00\x00"
+ "\x00\xE4\x01\x00\x00\x3C\x00\x00\x00\x98\x01\x00\x00\x48\x00\x00"
+ "\x00\x4C\x01\x00\x00\x63\x00\x00\x00\x02\x01\x00\x00\x80\x00\x00"
+ "\x00\xAC\x00\x00\x00\xA8\x00\x00\x00\x6C\x00\x00\x00\xDD\x00\x00"
+ "\x00\x43\x00\x00\x00\xDD\x00\x00\x00\x57\x00\x00\x00\xB6\x00\x00"
+ "\x00\x7C\x00\x00\x00\x99\x00\x00\x00\xB9\x00\x00\x00\x85\x00\x00"
+ "\x00\x11\x01\x00\x00\x74\x00\x00\x00\x58\x01\x00\x00\x6D\x00\x00"
+ "\x00\x9D\x01\x00\x00\x6D\x00\x00\x00\xE4\x01\x00\x00\x6D\x00\x00"
+ "\x00\x2B\x02\x00\x00\x74\x00\x00\x00\x72\x02\x00\x00\x85\x00\x00"
+ "\x00\xB7\x02\x00\x00\x99\x00\x00\x00\x10\x03\x00\x00\xB6\x00\x00"
+ "\x00\x4F\x03\x00\x00\xDD\x00\x00\x00\x71\x03\x00\x00\xDD\x00\x00"
+ "\x00\x87\x03\x00\x00\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00\x02"
+ "\x02\x00\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_RPARENT
+{
+ ExtraData =
+ {
+// Zeichen: 0xA3 Font: StarMath
+-23791; 512; 76; 768; 43; 0; 67; 0;
+ 162; 0; 69; 768; 1; 27; 43; 0;
+ 113; 768; 81; 0; 79; 768; 109; 0;
+ 20; 768; 129; 0; 191; 512; 146; 0;
+ 124; 512; 155; 0; 58; 512; 155; 0;
+ 247; 256; 155; 0; 169; 256; 146; 0;
+ 95; 256; 133; 0; 25; 256; 113; 0;
+ 190; 0; 84; 0; 126; 0; 43; 0;
+ 87; 0; 43; 0; 67; 0; 96; 0;
+ 104; 0; 136; 0; 168; 0; 167; 0;
+ 0; 256; 190; 0; 74; 256; 204; 0;
+ 150; 256; 204; 0; 228; 256; 204; 0;
+ 51; 512; 190; 0; 127; 512; 167; 0;
+ 200; 512; 136; 0; 30; 768; 96; 0;
+ 94; 768; 43; 0; 135; 768; 43; 0;
+ 113; 768; 0; 514; 2; 512; 514; 2;
+ 512; 2; 512; 514; 2; 512; 514; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xA3 Font: StarMath
+ "\xA3\x11\x02\x00\x00\x4C\x03\x00\x00\x2B\x00\x00\x00\x43\x00\x00"
+ "\x00\xA2\x00\x00\x00\x45\x03\x00\x00\x01\x00\x1B\x00\x2B\x00\x00"
+ "\x00\x71\x03\x00\x00\x51\x00\x00\x00\x4F\x03\x00\x00\x6D\x00\x00"
+ "\x00\x14\x03\x00\x00\x81\x00\x00\x00\xBF\x02\x00\x00\x92\x00\x00"
+ "\x00\x7C\x02\x00\x00\x9B\x00\x00\x00\x38\x02\x00\x00\x9B\x00\x00"
+ "\x00\xF7\x01\x00\x00\x9B\x00\x00\x00\xA9\x01\x00\x00\x92\x00\x00"
+ "\x00\x5F\x01\x00\x00\x85\x00\x00\x00\x19\x01\x00\x00\x71\x00\x00"
+ "\x00\xBE\x00\x00\x00\x54\x00\x00\x00\x7C\x00\x00\x00\x2B\x00\x00"
+ "\x00\x57\x00\x00\x00\x2B\x00\x00\x00\x43\x00\x00\x00\x60\x00\x00"
+ "\x00\x68\x00\x00\x00\x88\x00\x00\x00\xA8\x00\x00\x00\xA7\x00\x00"
+ "\x00\x00\x01\x00\x00\xBE\x00\x00\x00\x4C\x01\x00\x00\xCC\x00\x00"
+ "\x00\x98\x01\x00\x00\xCC\x00\x00\x00\xE4\x01\x00\x00\xCC\x00\x00"
+ "\x00\x32\x02\x00\x00\xBE\x00\x00\x00\x7E\x02\x00\x00\xA7\x00\x00"
+ "\x00\xC8\x02\x00\x00\x88\x00\x00\x00\x20\x03\x00\x00\x60\x00\x00"
+ "\x00\x5E\x03\x00\x00\x2B\x00\x00\x00\x87\x03\x00\x00\x2B\x00\x00"
+ "\x00\x71\x03\x00\x00\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00\x02"
+ "\x02\x00\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00\x02\x02\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_LANGLE
+{
+ ExtraData =
+ {
+// Zeichen: 0xA4 Font: StarMath
+-23535; 512; 76; 768; 35; 0; 65; 0;
+ 222; 0; 69; 768; 1; 7; 35; 0;
+ 226; 256; 238; 0; 65; 0; 0; 256;
+ 75; 0; 57; 0; 226; 256; 0; 256;
+ 123; 768; 238; 0; 133; 768; 35; 0;
+ 226; 256; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xA4 Font: StarMath
+ "\xA4\x11\x02\x00\x00\x4C\x03\x00\x00\x23\x00\x00\x00\x41\x00\x00"
+ "\x00\xDE\x00\x00\x00\x45\x03\x00\x00\x01\x00\x07\x00\x23\x00\x00"
+ "\x00\xE2\x01\x00\x00\xEE\x00\x00\x00\x41\x00\x00\x00\x00\x01\x00"
+ "\x00\x4B\x00\x00\x00\x39\x00\x00\x00\xE2\x01\x00\x00\x00\x01\x00"
+ "\x00\x7B\x03\x00\x00\xEE\x00\x00\x00\x85\x03\x00\x00\x23\x00\x00"
+ "\x00\xE2\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_RANGLE
+{
+ ExtraData =
+ {
+// Zeichen: 0xA5 Font: StarMath
+-23279; 512; 76; 768; 23; 0; 65; 0;
+ 226; 0; 69; 768; 1; 7; 248; 0;
+ 226; 256; 45; 0; 133; 768; 23; 0;
+ 123; 768; 222; 0; 225; 256; 25; 0;
+ 75; 0; 45; 0; 65; 0; 248; 0;
+ 226; 256; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xA5 Font: StarMath
+ "\xA5\x11\x02\x00\x00\x4C\x03\x00\x00\x17\x00\x00\x00\x41\x00\x00"
+ "\x00\xE2\x00\x00\x00\x45\x03\x00\x00\x01\x00\x07\x00\xF8\x00\x00"
+ "\x00\xE2\x01\x00\x00\x2D\x00\x00\x00\x85\x03\x00\x00\x17\x00\x00"
+ "\x00\x7B\x03\x00\x00\xDE\x00\x00\x00\xE1\x01\x00\x00\x19\x00\x00"
+ "\x00\x4B\x00\x00\x00\x2D\x00\x00\x00\x41\x00\x00\x00\xF8\x00\x00"
+ "\x00\xE2\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_LBRACKET
+{
+ ExtraData =
+ {
+// Zeichen: 0xA6 Font: StarMath
+-23023; 512; 76; 768; 60; 0; 59; 0;
+ 148; 0; 68; 768; 1; 9; 60; 0;
+ 126; 768; 60; 0; 59; 0; 207; 0;
+ 59; 0; 207; 0; 75; 0; 102; 0;
+ 75; 0; 102; 0; 108; 768; 207; 0;
+ 108; 768; 207; 0; 126; 768; 60; 0;
+ 126; 768; 0; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xA6 Font: StarMath
+ "\xA6\x11\x02\x00\x00\x4C\x03\x00\x00\x3C\x00\x00\x00\x3B\x00\x00"
+ "\x00\x94\x00\x00\x00\x44\x03\x00\x00\x01\x00\x09\x00\x3C\x00\x00"
+ "\x00\x7E\x03\x00\x00\x3C\x00\x00\x00\x3B\x00\x00\x00\xCF\x00\x00"
+ "\x00\x3B\x00\x00\x00\xCF\x00\x00\x00\x4B\x00\x00\x00\x66\x00\x00"
+ "\x00\x4B\x00\x00\x00\x66\x00\x00\x00\x6C\x03\x00\x00\xCF\x00\x00"
+ "\x00\x6C\x03\x00\x00\xCF\x00\x00\x00\x7E\x03\x00\x00\x3C\x00\x00"
+ "\x00\x7E\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_RBRACKET
+{
+ ExtraData =
+ {
+// Zeichen: 0xA7 Font: StarMath
+-22767; 512; 76; 768; 32; 0; 59; 0;
+ 147; 0; 68; 768; 1; 9; 178; 0;
+ 126; 768; 32; 0; 126; 768; 32; 0;
+ 108; 768; 136; 0; 108; 768; 136; 0;
+ 75; 0; 32; 0; 75; 0; 32; 0;
+ 59; 0; 178; 0; 59; 0; 178; 0;
+ 126; 768; 0; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xA7 Font: StarMath
+ "\xA7\x11\x02\x00\x00\x4C\x03\x00\x00\x20\x00\x00\x00\x3B\x00\x00"
+ "\x00\x93\x00\x00\x00\x44\x03\x00\x00\x01\x00\x09\x00\xB2\x00\x00"
+ "\x00\x7E\x03\x00\x00\x20\x00\x00\x00\x7E\x03\x00\x00\x20\x00\x00"
+ "\x00\x6C\x03\x00\x00\x88\x00\x00\x00\x6C\x03\x00\x00\x88\x00\x00"
+ "\x00\x4B\x00\x00\x00\x20\x00\x00\x00\x4B\x00\x00\x00\x20\x00\x00"
+ "\x00\x3B\x00\x00\x00\xB2\x00\x00\x00\x3B\x00\x00\x00\xB2\x00\x00"
+ "\x00\x7E\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_LDBRACKET
+{
+ ExtraData =
+ {
+// Zeichen: 0xB2 Font: StarMath
+-19951; 512; 76; 768; 60; 0; 59; 0;
+ 207; 0; 68; 768; 2; 9; 60; 0;
+ 126; 768; 60; 0; 59; 0; 10; 256;
+ 59; 0; 10; 256; 75; 0; 180; 0;
+ 75; 0; 180; 0; 108; 768; 10; 256;
+ 108; 768; 10; 256; 126; 768; 60; 0;
+ 126; 768; 0; 0; 0; 0; 0; 1280;
+-27136; 0; 19200; 0; 26112; 0; 19200; 0;
+ 26112; 0; 27651; 0; -27136; 0; 27651; 0;
+-27136; 0; 19200; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xB2 Font: StarMath
+ "\xB2\x11\x02\x00\x00\x4C\x03\x00\x00\x3C\x00\x00\x00\x3B\x00\x00"
+ "\x00\xCF\x00\x00\x00\x44\x03\x00\x00\x02\x00\x09\x00\x3C\x00\x00"
+ "\x00\x7E\x03\x00\x00\x3C\x00\x00\x00\x3B\x00\x00\x00\x0A\x01\x00"
+ "\x00\x3B\x00\x00\x00\x0A\x01\x00\x00\x4B\x00\x00\x00\xB4\x00\x00"
+ "\x00\x4B\x00\x00\x00\xB4\x00\x00\x00\x6C\x03\x00\x00\x0A\x01\x00"
+ "\x00\x6C\x03\x00\x00\x0A\x01\x00\x00\x7E\x03\x00\x00\x3C\x00\x00"
+ "\x00\x7E\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00"
+ "\x96\x00\x00\x00\x4B\x00\x00\x00\x66\x00\x00\x00\x4B\x00\x00\x00"
+ "\x66\x00\x00\x00\x6C\x03\x00\x00\x96\x00\x00\x00\x6C\x03\x00\x00"
+ "\x96\x00\x00\x00\x4B\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_RDBRACKET
+{
+ ExtraData =
+ {
+// Zeichen: 0xB3 Font: StarMath
+-19695; 512; 76; 768; 60; 0; 59; 0;
+ 207; 0; 68; 768; 2; 9; 10; 256;
+ 126; 768; 60; 0; 126; 768; 60; 0;
+ 108; 768; 138; 0; 108; 768; 138; 0;
+ 75; 0; 60; 0; 75; 0; 60; 0;
+ 59; 0; 10; 256; 59; 0; 10; 256;
+ 126; 768; 0; 0; 0; 0; 0; 1280;
+-22528; 0; 19200; 0; -22528; 0; 27651; 0;
+ -8192; 0; 27651; 0; -8192; 0; 19200; 0;
+-22528; 0; 19200; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xB3 Font: StarMath
+ "\xB3\x11\x02\x00\x00\x4C\x03\x00\x00\x3C\x00\x00\x00\x3B\x00\x00"
+ "\x00\xCF\x00\x00\x00\x44\x03\x00\x00\x02\x00\x09\x00\x0A\x01\x00"
+ "\x00\x7E\x03\x00\x00\x3C\x00\x00\x00\x7E\x03\x00\x00\x3C\x00\x00"
+ "\x00\x6C\x03\x00\x00\x8A\x00\x00\x00\x6C\x03\x00\x00\x8A\x00\x00"
+ "\x00\x4B\x00\x00\x00\x3C\x00\x00\x00\x4B\x00\x00\x00\x3C\x00\x00"
+ "\x00\x3B\x00\x00\x00\x0A\x01\x00\x00\x3B\x00\x00\x00\x0A\x01\x00"
+ "\x00\x7E\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00"
+ "\xA8\x00\x00\x00\x4B\x00\x00\x00\xA8\x00\x00\x00\x6C\x03\x00\x00"
+ "\xE0\x00\x00\x00\x6C\x03\x00\x00\xE0\x00\x00\x00\x4B\x00\x00\x00"
+ "\xA8\x00\x00\x00\x4B\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_LCEIL
+{
+ ExtraData =
+ {
+// Zeichen: 0xC0 Font: StarMath
+-16367; 512; 76; 768; 60; 0; 59; 0;
+ 148; 0; 68; 768; 1; 7; 60; 0;
+ 126; 768; 60; 0; 59; 0; 207; 0;
+ 59; 0; 207; 0; 75; 0; 102; 0;
+ 75; 0; 102; 0; 126; 768; 60; 0;
+ 126; 768; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xC0 Font: StarMath
+ "\xC0\x11\x02\x00\x00\x4C\x03\x00\x00\x3C\x00\x00\x00\x3B\x00\x00"
+ "\x00\x94\x00\x00\x00\x44\x03\x00\x00\x01\x00\x07\x00\x3C\x00\x00"
+ "\x00\x7E\x03\x00\x00\x3C\x00\x00\x00\x3B\x00\x00\x00\xCF\x00\x00"
+ "\x00\x3B\x00\x00\x00\xCF\x00\x00\x00\x4B\x00\x00\x00\x66\x00\x00"
+ "\x00\x4B\x00\x00\x00\x66\x00\x00\x00\x7E\x03\x00\x00\x3C\x00\x00"
+ "\x00\x7E\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_RCEIL
+{
+ ExtraData =
+ {
+// Zeichen: 0xC2 Font: StarMath
+-15855; 512; 76; 768; 32; 0; 59; 0;
+ 147; 0; 68; 768; 1; 7; 178; 0;
+ 126; 768; 136; 0; 126; 768; 136; 0;
+ 75; 0; 32; 0; 75; 0; 32; 0;
+ 59; 0; 178; 0; 59; 0; 178; 0;
+ 126; 768; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xC2 Font: StarMath
+ "\xC2\x11\x02\x00\x00\x4C\x03\x00\x00\x20\x00\x00\x00\x3B\x00\x00"
+ "\x00\x93\x00\x00\x00\x44\x03\x00\x00\x01\x00\x07\x00\xB2\x00\x00"
+ "\x00\x7E\x03\x00\x00\x88\x00\x00\x00\x7E\x03\x00\x00\x88\x00\x00"
+ "\x00\x4B\x00\x00\x00\x20\x00\x00\x00\x4B\x00\x00\x00\x20\x00\x00"
+ "\x00\x3B\x00\x00\x00\xB2\x00\x00\x00\x3B\x00\x00\x00\xB2\x00\x00"
+ "\x00\x7E\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_LFLOOR
+{
+ ExtraData =
+ {
+// Zeichen: 0xC1 Font: StarMath
+-16111; 512; 76; 768; 60; 0; 59; 0;
+ 148; 0; 68; 768; 1; 7; 60; 0;
+ 126; 768; 60; 0; 59; 0; 102; 0;
+ 59; 0; 102; 0; 108; 768; 207; 0;
+ 108; 768; 207; 0; 126; 768; 60; 0;
+ 126; 768; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xC1 Font: StarMath
+ "\xC1\x11\x02\x00\x00\x4C\x03\x00\x00\x3C\x00\x00\x00\x3B\x00\x00"
+ "\x00\x94\x00\x00\x00\x44\x03\x00\x00\x01\x00\x07\x00\x3C\x00\x00"
+ "\x00\x7E\x03\x00\x00\x3C\x00\x00\x00\x3B\x00\x00\x00\x66\x00\x00"
+ "\x00\x3B\x00\x00\x00\x66\x00\x00\x00\x6C\x03\x00\x00\xCF\x00\x00"
+ "\x00\x6C\x03\x00\x00\xCF\x00\x00\x00\x7E\x03\x00\x00\x3C\x00\x00"
+ "\x00\x7E\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_RFLOOR
+{
+ ExtraData =
+ {
+// Zeichen: 0xC3 Font: StarMath
+-15599; 512; 76; 768; 32; 0; 59; 0;
+ 147; 0; 68; 768; 1; 7; 178; 0;
+ 126; 768; 32; 0; 126; 768; 32; 0;
+ 108; 768; 136; 0; 108; 768; 136; 0;
+ 59; 0; 178; 0; 59; 0; 178; 0;
+ 126; 768; 0; 0; 0; 0;
+#ifdef NO_MORE
+ // Zeichen: 0xC3 Font: StarMath
+ "\xC3\x11\x02\x00\x00\x4C\x03\x00\x00\x20\x00\x00\x00\x3B\x00\x00"
+ "\x00\x93\x00\x00\x00\x44\x03\x00\x00\x01\x00\x07\x00\xB2\x00\x00"
+ "\x00\x7E\x03\x00\x00\x20\x00\x00\x00\x7E\x03\x00\x00\x20\x00\x00"
+ "\x00\x6C\x03\x00\x00\x88\x00\x00\x00\x6C\x03\x00\x00\x88\x00\x00"
+ "\x00\x3B\x00\x00\x00\xB2\x00\x00\x00\x3B\x00\x00\x00\xB2\x00\x00"
+ "\x00\x7E\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_OVERBRACE
+{
+ ExtraData =
+ {
+// Zeichen: 0x35 Font: StarMath
+ 13585; 512; 76; 768; 20; 0; 8; 0;
+ 104; 768; 168; 0; 1; 45; 20; 0;
+ 175; 0; 20; 0; 172; 0; 20; 0;
+ 135; 0; 32; 0; 108; 0; 57; 0;
+ 87; 0; 79; 0; 70; 0; 109; 0;
+ 60; 0; 146; 0; 60; 0; 140; 256;
+ 60; 0; 159; 256; 60; 0; 172; 256;
+ 57; 0; 181; 256; 48; 0; 187; 256;
+ 42; 0; 193; 256; 28; 0; 193; 256;
+ 8; 0; 206; 256; 8; 0; 206; 256;
+ 28; 0; 209; 256; 42; 0; 218; 256;
+ 48; 0; 225; 256; 57; 0; 240; 256;
+ 60; 0; 4; 512; 60; 0; 254; 512;
+ 60; 0; 35; 768; 60; 0; 65; 768;
+ 70; 0; 89; 768; 89; 0; 111; 768;
+ 109; 0; 123; 768; 138; 0; 123; 768;
+ 175; 0; 109; 768; 175; 0; 109; 768;
+ 123; 0; 76; 768; 96; 0; 10; 768;
+ 94; 0; 28; 512; 89; 0; 245; 256;
+ 89; 0; 216; 256; 70; 0; 199; 256;
+ 35; 0; 182; 256; 70; 0; 154; 256;
+ 89; 0; 115; 256; 89; 0; 135; 0;
+ 94; 0; 67; 0; 96; 0; 33; 0;
+ 123; 0; 33; 0; 175; 0; 20; 0;
+ 175; 0; 0; 2; 512; 514; 0; 514;
+ 2; 512; 2; 512; 514; 0; 514; 2;
+ 512; 2; 512; 2; 512; 514; 0; 514;
+ 0;
+#ifdef NO_MORE
+ // Zeichen: 0x35 Font: StarMath
+ "\x35\x11\x02\x00\x00\x4C\x03\x00\x00\x14\x00\x00\x00\x08\x00\x00"
+ "\x00\x68\x03\x00\x00\xA8\x00\x00\x00\x01\x00\x2D\x00\x14\x00\x00"
+ "\x00\xAF\x00\x00\x00\x14\x00\x00\x00\xAA\x00\x00\x00\x14\x00\x00"
+ "\x00\x85\x00\x00\x00\x20\x00\x00\x00\x6A\x00\x00\x00\x39\x00\x00"
+ "\x00\x56\x00\x00\x00\x4F\x00\x00\x00\x45\x00\x00\x00\x6D\x00\x00"
+ "\x00\x3B\x00\x00\x00\x92\x00\x00\x00\x3B\x00\x00\x00\x8C\x01\x00"
+ "\x00\x3B\x00\x00\x00\x9F\x01\x00\x00\x3B\x00\x00\x00\xAC\x01\x00"
+ "\x00\x37\x00\x00\x00\xB5\x01\x00\x00\x30\x00\x00\x00\xBB\x01\x00"
+ "\x00\x2A\x00\x00\x00\xC1\x01\x00\x00\x1C\x00\x00\x00\xC1\x01\x00"
+ "\x00\x08\x00\x00\x00\xCE\x01\x00\x00\x08\x00\x00\x00\xCE\x01\x00"
+ "\x00\x1C\x00\x00\x00\xD1\x01\x00\x00\x2A\x00\x00\x00\xDA\x01\x00"
+ "\x00\x30\x00\x00\x00\xE1\x01\x00\x00\x37\x00\x00\x00\xF0\x01\x00"
+ "\x00\x3B\x00\x00\x00\x04\x02\x00\x00\x3B\x00\x00\x00\xFE\x02\x00"
+ "\x00\x3B\x00\x00\x00\x23\x03\x00\x00\x3B\x00\x00\x00\x41\x03\x00"
+ "\x00\x45\x00\x00\x00\x59\x03\x00\x00\x59\x00\x00\x00\x6F\x03\x00"
+ "\x00\x6D\x00\x00\x00\x7B\x03\x00\x00\x8A\x00\x00\x00\x7B\x03\x00"
+ "\x00\xAF\x00\x00\x00\x6D\x03\x00\x00\xAF\x00\x00\x00\x6D\x03\x00"
+ "\x00\x79\x00\x00\x00\x4C\x03\x00\x00\x5E\x00\x00\x00\x0A\x03\x00"
+ "\x00\x5C\x00\x00\x00\x1C\x02\x00\x00\x57\x00\x00\x00\xF5\x01\x00"
+ "\x00\x57\x00\x00\x00\xD8\x01\x00\x00\x46\x00\x00\x00\xC7\x01\x00"
+ "\x00\x23\x00\x00\x00\xB6\x01\x00\x00\x46\x00\x00\x00\x9A\x01\x00"
+ "\x00\x57\x00\x00\x00\x73\x01\x00\x00\x57\x00\x00\x00\x87\x00\x00"
+ "\x00\x5C\x00\x00\x00\x43\x00\x00\x00\x5E\x00\x00\x00\x21\x00\x00"
+ "\x00\x79\x00\x00\x00\x21\x00\x00\x00\xAF\x00\x00\x00\x14\x00\x00"
+ "\x00\xAF\x00\x00\x00\x00\x00\x02\x02\x00\x02\x02\x00\x00\x02\x02"
+ "\x00\x02\x02\x00\x00\x02\x02\x00\x02\x02\x00\x00\x02\x02\x00\x02"
+ "\x02\x00\x00\x02\x02\x00\x00\x02\x02\x00\x02\x02\x00\x00\x02\x02"
+ "\x00\x00";
+#endif
+ };
+};
+
+
+Resource RID_XPP_UNDERBRACE
+{
+ ExtraData =
+ {
+// Zeichen: 0x34 Font: StarMath
+ 13329; 512; 76; 768; 11; 0; 244; 512;
+ 104; 768; 166; 0; 1; 45; 114; 768;
+ 244; 512; 114; 768; 247; 512; 114; 768;
+ 28; 768; 103; 768; 55; 768; 79; 768;
+ 74; 768; 55; 768; 92; 768; 25; 768;
+ 103; 768; 244; 512; 103; 768; 252; 256;
+ 103; 768; 231; 256; 103; 768; 218; 256;
+ 106; 768; 209; 256; 114; 768; 201; 256;
+ 121; 768; 198; 256; 133; 768; 198; 256;
+ 153; 768; 184; 256; 153; 768; 184; 256;
+ 133; 768; 179; 256; 119; 768; 172; 256;
+ 113; 768; 164; 256; 106; 768; 150; 256;
+ 103; 768; 130; 256; 103; 768; 136; 0;
+ 103; 768; 97; 0; 103; 768; 67; 0;
+ 92; 768; 45; 0; 74; 768; 21; 0;
+ 54; 768; 11; 0; 25; 768; 11; 0;
+ 244; 512; 25; 0; 244; 512; 25; 0;
+ 40; 768; 57; 0; 67; 768; 124; 0;
+ 69; 768; 106; 256; 74; 768; 144; 256;
+ 74; 768; 172; 256; 91; 768; 191; 256;
+ 126; 768; 208; 256; 91; 768; 235; 256;
+ 74; 768; 19; 512; 74; 768; 0; 768;
+ 69; 768; 67; 768; 67; 768; 101; 768;
+ 40; 768; 101; 768; 244; 512; 114; 768;
+ 244; 512; 0; 2; 512; 514; 0; 514;
+ 2; 512; 2; 512; 514; 0; 514; 2;
+ 512; 2; 512; 2; 512; 514; 0; 514;
+ 0;
+#ifdef NO_MORE
+ // Zeichen: 0x34 Font: StarMath
+ "\x34\x11\x02\x00\x00\x4C\x03\x00\x00\x0B\x00\x00\x00\xF4\x02\x00"
+ "\x00\x68\x03\x00\x00\xA6\x00\x00\x00\x01\x00\x2D\x00\x72\x03\x00"
+ "\x00\xF4\x02\x00\x00\x72\x03\x00\x00\xF7\x02\x00\x00\x72\x03\x00"
+ "\x00\x1C\x03\x00\x00\x67\x03\x00\x00\x37\x03\x00\x00\x4F\x03\x00"
+ "\x00\x4A\x03\x00\x00\x37\x03\x00\x00\x5C\x03\x00\x00\x19\x03\x00"
+ "\x00\x67\x03\x00\x00\xF4\x02\x00\x00\x67\x03\x00\x00\xFA\x01\x00"
+ "\x00\x67\x03\x00\x00\xE6\x01\x00\x00\x67\x03\x00\x00\xD8\x01\x00"
+ "\x00\x6A\x03\x00\x00\xD1\x01\x00\x00\x71\x03\x00\x00\xC9\x01\x00"
+ "\x00\x77\x03\x00\x00\xC6\x01\x00\x00\x85\x03\x00\x00\xC6\x01\x00"
+ "\x00\x99\x03\x00\x00\xB8\x01\x00\x00\x99\x03\x00\x00\xB8\x01\x00"
+ "\x00\x85\x03\x00\x00\xB3\x01\x00\x00\x77\x03\x00\x00\xAC\x01\x00"
+ "\x00\x71\x03\x00\x00\xA4\x01\x00\x00\x6A\x03\x00\x00\x96\x01\x00"
+ "\x00\x67\x03\x00\x00\x82\x01\x00\x00\x67\x03\x00\x00\x88\x00\x00"
+ "\x00\x67\x03\x00\x00\x61\x00\x00\x00\x67\x03\x00\x00\x43\x00\x00"
+ "\x00\x5C\x03\x00\x00\x2D\x00\x00\x00\x4A\x03\x00\x00\x15\x00\x00"
+ "\x00\x36\x03\x00\x00\x0B\x00\x00\x00\x19\x03\x00\x00\x0B\x00\x00"
+ "\x00\xF4\x02\x00\x00\x19\x00\x00\x00\xF4\x02\x00\x00\x19\x00\x00"
+ "\x00\x28\x03\x00\x00\x39\x00\x00\x00\x43\x03\x00\x00\x7C\x00\x00"
+ "\x00\x45\x03\x00\x00\x6A\x01\x00\x00\x4A\x03\x00\x00\x90\x01\x00"
+ "\x00\x4A\x03\x00\x00\xAC\x01\x00\x00\x5B\x03\x00\x00\xBF\x01\x00"
+ "\x00\x7E\x03\x00\x00\xD0\x01\x00\x00\x5B\x03\x00\x00\xEB\x01\x00"
+ "\x00\x4A\x03\x00\x00\x13\x02\x00\x00\x4A\x03\x00\x00\x00\x03\x00"
+ "\x00\x45\x03\x00\x00\x43\x03\x00\x00\x43\x03\x00\x00\x65\x03\x00"
+ "\x00\x28\x03\x00\x00\x65\x03\x00\x00\xF4\x02\x00\x00\x72\x03\x00"
+ "\x00\xF4\x02\x00\x00\x00\x00\x02\x02\x00\x02\x02\x00\x00\x02\x02"
+ "\x00\x02\x02\x00\x00\x02\x02\x00\x02\x02\x00\x00\x02\x02\x00\x02"
+ "\x02\x00\x00\x02\x02\x00\x00\x02\x02\x00\x02\x02\x00\x00\x02\x02"
+ "\x00\x00";
+#endif
+ };
+};
+
+
+////////////////////////////////////////////////////////////
+
+
+String RID_PLUSX { Text = "+<?> " ; };
+String RID_MINUSX { Text = "-<?> " ; };
+String RID_PLUSMINUSX { Text = "+-<?> " ; };
+String RID_MINUSPLUSX { Text = "-+<?> " ; };
+String RID_NEGX { Text = "neg <?> " ; };
+String RID_XPLUSY { Text = "<?> + <?> " ; };
+String RID_XMINUSY { Text = "<?> - <?> " ; };
+String RID_XCDOTY { Text = "<?> cdot <?> " ; };
+String RID_XTIMESY { Text = "<?> times <?> " ; };
+String RID_XSYMTIMESY { Text = "<?> * <?> " ; };
+String RID_XSYMDIVIDEY { Text = "<?> / <?> " ; };
+String RID_XDIVY { Text = "<?> div <?> " ; };
+String RID_XOVERY { Text = "<?> over <?> " ; };
+String RID_XODIVIDEY { Text = "<?> odivide <?> " ; };
+String RID_XODOTY { Text = "<?> odot <?> " ; };
+String RID_XOMINUSY { Text = "<?> ominus <?> " ; };
+String RID_XOPLUSY { Text = "<?> oplus <?> " ; };
+String RID_XOTIMESY { Text = "<?> otimes <?> " ; };
+String RID_XANDY { Text = "<?> and <?> " ; };
+String RID_XORY { Text = "<?> or <?> " ; };
+String RID_XEQY { Text = "<?> = <?> " ; };
+String RID_XNEQY { Text = "<?> <> <?> " ; };
+String RID_XLTY { Text = "<?> < <?> " ; };
+String RID_XGTY { Text = "<?> > <?> " ; };
+String RID_XLEY { Text = "<?> <= <?> " ; };
+String RID_XGEY { Text = "<?> >= <?> " ; };
+String RID_XLESLANTY { Text = "<?> leslant <?> " ; };
+String RID_XGESLANTY { Text = "<?> geslant <?> " ; };
+String RID_XLLY { Text = "<?> << <?> " ; };
+String RID_XGGY { Text = "<?> >> <?> " ; };
+String RID_XDEFY { Text = "<?> def <?> " ; };
+String RID_XEQUIVY { Text = "<?> equiv <?> " ; };
+String RID_XAPPROXY { Text = "<?> approx <?> " ; };
+String RID_XSIMY { Text = "<?> sim <?> " ; };
+String RID_XSIMEQY { Text = "<?> simeq <?> " ; };
+String RID_XPROPY { Text = "<?> prop <?> " ; };
+String RID_XORTHOY { Text = "<?> ortho <?> " ; };
+String RID_XPARALLELY { Text = "<?> parallel <?> " ; };
+String RID_XTOWARDY { Text = "<?> toward <?> " ; };
+String RID_XTRANSLY { Text = "<?> transl <?> " ; };
+String RID_XTRANSRY { Text = "<?> transr <?> " ; };
+String RID_XINY { Text = "<?> in <?> " ; };
+String RID_XNOTINY { Text = "<?> notin <?> " ; };
+String RID_XOWNSY { Text = "<?> owns <?> " ; };
+String RID_XUNIONY { Text = "<?> union <?> " ; };
+String RID_XINTERSECTIONY { Text = "<?> intersection <?> " ; };
+String RID_XSETMINUSY { Text = "<?> setminus <?> " ; };
+String RID_XSLASHY { Text = "<?> slash <?> " ; };
+String RID_XSUBSETY { Text = "<?> subset <?> " ; };
+String RID_XSUBSETEQY { Text = "<?> subseteq <?> " ; };
+String RID_XSUPSETY { Text = "<?> supset <?> " ; };
+String RID_XSUPSETEQY { Text = "<?> supseteq <?> " ; };
+String RID_XNSUBSETY { Text = "<?> nsubset <?> " ; };
+String RID_XNSUBSETEQY { Text = "<?> nsubseteq <?> " ; };
+String RID_XNSUPSETY { Text = "<?> nsupset <?> " ; };
+String RID_XNSUPSETEQY { Text = "<?> nsupseteq <?> " ; };
+String RID_ABSX { Text = "abs{<?>} " ; };
+String RID_FACTX { Text = "fact <?> " ; };
+String RID_SQRTX { Text = "sqrt{<?>} " ; };
+String RID_NROOTXY { Text = "nroot{<?>}{<?>} " ; };
+String RID_EX { Text = "func e^{<?>} " ; };
+String RID_EXPX { Text = "exp(<?>) " ; };
+String RID_LNX { Text = "ln(<?>) " ; };
+String RID_LOGX { Text = "log(<?>) " ; };
+String RID_SINX { Text = "sin(<?>) " ; };
+String RID_COSX { Text = "cos(<?>) " ; };
+String RID_TANX { Text = "tan(<?>) " ; };
+String RID_COTX { Text = "cot(<?>) " ; };
+String RID_ARCSINX { Text = "arcsin(<?>) " ; };
+String RID_ARCCOSX { Text = "arccos(<?>) " ; };
+String RID_ARCTANX { Text = "arctan(<?>) " ; };
+String RID_ARCCOTX { Text = "arccot(<?>) " ; };
+String RID_SINHX { Text = "sinh(<?>) " ; };
+String RID_COSHX { Text = "cosh(<?>) " ; };
+String RID_TANHX { Text = "tanh(<?>) " ; };
+String RID_COTHX { Text = "coth(<?>) " ; };
+String RID_ARSINHX { Text = "arsinh(<?>) " ; };
+String RID_ARCOSHX { Text = "arcosh(<?>) " ; };
+String RID_ARTANHX { Text = "artanh(<?>) " ; };
+String RID_ARCOTHX { Text = "arcoth(<?>) " ; };
+String RID_SUMX { Text = "sum <?> " ; };
+String RID_PRODX { Text = "prod <?> " ; };
+String RID_COPRODX { Text = "coprod <?> " ; };
+String RID_LIMX { Text = "lim <?> " ; };
+String RID_LIMINFX { Text = "liminf <?> " ; };
+String RID_LIMSUPX { Text = "limsup <?> " ; };
+String RID_EXISTS { Text = "exists " ; };
+String RID_FORALL { Text = "forall " ; };
+String RID_INTX { Text = "int <?> " ; };
+String RID_IINTX { Text = "iint <?> " ; };
+String RID_IIINTX { Text = "iiint <?> " ; };
+String RID_LINTX { Text = "lint <?> " ; };
+String RID_LLINTX { Text = "llint <?> " ; };
+String RID_LLLINTX { Text = "lllint <?> " ; };
+String RID_FROMX { Text = "from{<?>} <?> " ; };
+String RID_TOX { Text = "to{<?>} <?> " ; };
+String RID_FROMXTOY { Text = "from{<?>} to{<?>} <?> " ; };
+String RID_ACUTEX { Text = "acute <?> " ; };
+String RID_BARX { Text = "bar <?> " ; };
+String RID_BREVEX { Text = "breve <?> " ; };
+String RID_CHECKX { Text = "check <?> " ; };
+String RID_CIRCLEX { Text = "circle <?> " ; };
+String RID_DOTX { Text = "dot <?> " ; };
+String RID_DDOTX { Text = "ddot <?> " ; };
+String RID_DDDOTX { Text = "dddot <?> " ; };
+String RID_GRAVEX { Text = "grave <?> " ; };
+String RID_HATX { Text = "hat <?> " ; };
+String RID_TILDEX { Text = "tilde <?> " ; };
+String RID_VECX { Text = "vec <?> " ; };
+String RID_UNDERLINEX { Text = "underline <?> " ; };
+String RID_OVERLINEX { Text = "overline <?> " ; };
+String RID_OVERSTRIKEX { Text = "overstrike <?> " ; };
+String RID_PHANTOMX { Text = "phantom <?> " ; };
+String RID_BOLDX { Text = "bold <?> " ; };
+String RID_ITALX { Text = "ital <?> " ; };
+String RID_SIZEXY { Text = "size <?> <?> " ; };
+String RID_FONTXY { Text = "font <?> <?> " ; };
+String RID_COLORX { Text = "color <?> <?> " ; };
+String RID_LRGROUPX { Text = "{<?>} " ; };
+String RID_LRPARENTX { Text = "(<?>) " ; };
+String RID_LRBRACKETX { Text = "[<?>] " ; };
+String RID_LRDBRACKETX { Text = "ldbracket <?> rdbracket " ; };
+String RID_LRBRACEX { Text = "lbrace <?> rbrace " ; };
+String RID_LRANGLEX { Text = "langle <?> rangle " ; };
+String RID_LRCEILX { Text = "lceil <?> rceil " ; };
+String RID_LRFLOORX { Text = "lfloor <?> rfloor " ; };
+String RID_LRLINEX { Text = "lline <?> rline " ; };
+String RID_LRDLINEX { Text = "ldline <?> rdline " ; };
+String RID_LMRANGLEXY { Text = "langle <?> mline <?> rangle " ; };
+String RID_SLRPARENTX { Text = "left ( <?> right ) " ; };
+String RID_SLRBRACKETX { Text = "left [ <?> right ] " ; };
+String RID_SLRDBRACKETX { Text = "left ldbracket <?> right rdbracket " ; };
+String RID_SLRBRACEX { Text = "left lbrace <?> right rbrace " ; };
+String RID_SLRANGLEX { Text = "left langle <?> right rangle " ; };
+String RID_SLRCEILX { Text = "left lceil <?> right rceil " ; };
+String RID_SLRFLOORX { Text = "left lfloor <?> right rfloor " ; };
+String RID_SLRLINEX { Text = "left lline <?> right rline " ; };
+String RID_SLRDLINEX { Text = "left ldline <?> right rdline " ; };
+String RID_SLMRANGLEXY { Text = "left langle <?> mline <?> right rangle " ; };
+String RID_XOVERBRACEY { Text = "<?> overbrace <?> " ; };
+String RID_XUNDERBRACEY { Text = "<?> underbrace <?> " ; };
+String RID_RSUBX { Text = "<?>_{<?>}" ; };
+String RID_RSUPX { Text = "<?>^{<?>}" ; };
+String RID_LSUBX { Text = "<?> lsub{<?>} " ; };
+String RID_LSUPX { Text = "<?> lsup{<?>} " ; };
+String RID_CSUBX { Text = "<?> csub{<?>} " ; };
+String RID_CSUPX { Text = "<?> csup{<?>} " ; };
+String RID_SBLANK { Text = "`" ; };
+String RID_BLANK { Text = "~" ; };
+String RID_NEWLINE { Text = "newline " ; };
+String RID_BINOMXY { Text = "binom{<?>}{<?>} " ; };
+String RID_STACK { Text = "stack{<?> # <?> # <?>} " ; };
+String RID_MATRIX { Text = "matrix{<?> # <?> ## <?> # <?>} " ; };
+String RID_ALIGNLX { Text = "alignl <?> " ; };
+String RID_ALIGNCX { Text = "alignc <?> " ; };
+String RID_ALIGNRX { Text = "alignr <?> " ; };
+String RID_ALEPH { Text = "aleph " ; };
+String RID_EMPTYSET { Text = "emptyset " ; };
+String RID_RE { Text = "Re " ; };
+String RID_IM { Text = "Im " ; };
+String RID_INFINITY { Text = "infinity " ; };
+String RID_PARTIAL { Text = "partial " ; };
+String RID_NABLA { Text = "nabla " ; };
+String RID_WP { Text = "wp " ; };
+String RID_DOTSAXIS { Text = "dotsaxis " ; };
+String RID_DOTSUP { Text = "dotsup " ; };
+String RID_DOTSDOWN { Text = "dotsdown " ; };
+String RID_DOTSLOW { Text = "dotslow " ; };
+String RID_DOTSVERT { Text = "dotsvert " ; };
+String RID_XCIRCY { Text = "<?> circ <?> " ; };
+String RID_XWIDESLASHY { Text = "<?> wideslash <?> " ; };
+String RID_XWIDEBSLASHY { Text = "<?> widebslash <?> " ; };
+String RID_XDIVIDESY { Text = "<?> divides <?> " ; };
+String RID_XNDIVIDESY { Text = "<?> ndivides <?> " ; };
+String RID_DLARROW { Text = "<?> dlarrow <?> " ; };
+String RID_DLRARROW { Text = "<?> dlrarrow <?> " ; };
+String RID_DRARROW { Text = "<?> drarrow <?> " ; };
+String RID_SETN { Text = "setN " ; };
+String RID_SETZ { Text = "setZ " ; };
+String RID_SETQ { Text = "setQ " ; };
+String RID_SETR { Text = "setR " ; };
+String RID_SETC { Text = "setC " ; };
+String RID_WIDEHATX { Text = "widehat <?> " ; };
+String RID_WIDETILDEX { Text = "widetilde <?> " ; };
+String RID_WIDEVECX { Text = "widevec <?> " ; };
+String RID_HBAR { Text = "hbar " ; };
+String RID_LAMBDABAR { Text = "lambdabar " ; };
+String RID_LEFTARROW { Text = "leftarrow " ; };
+String RID_RIGHTARROW { Text = "rightarrow " ; };
+String RID_UPARROW { Text = "uparrow " ; };
+String RID_DOWNARROW { Text = "downarrow " ; };
+
+
+//////////////////////////////////////////
+
+
+Menu RID_COMMANDMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_UNBINOPS_MENU ;
+ HelpId = HID_SMA_UNBINOPS_TBX ;
+ Text = "~Un鋜e/Bin鋜e Operatoren" ;
+ Text [ ENGLISH ] = "Unary/binary operators" ;
+ Text [ english_us ] = "Unary/Binary Operators" ;
+ Text [ portuguese_brazilian ] = "Un鋜e/Bin鋜e Operatoren" ;
+ Text [ swedish ] = "~Mon鋜a/Bin鋜a operatorer" ;
+ Text [ danish ] = "Monadiske/bin鎟e operatorer" ;
+ Text [ italian ] = "Operatori unari/binari" ;
+ Text [ spanish ] = "Operadores ~unarios/binarios" ;
+ Text [ french ] = "Op閞ateurs u~naires/binaires" ;
+ Text [ dutch ] = "~Unaire/binaire operatoren" ;
+ Text [ portuguese ] = "Operadores ~un醨ios/bin醨ios" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_PLUSX;
+ HelpId = HID_SMA_PLUSX;
+ Text = "+a";
+ };
+ MenuItem
+ {
+ Identifier = RID_MINUSX;
+ HelpId = HID_SMA_MINUSX;
+ Text = "-a";
+ };
+ MenuItem
+ {
+ Identifier = RID_PLUSMINUSX;
+ HelpId = HID_SMA_PLUSMINUSX;
+ Text = "+-a";
+ };
+ MenuItem
+ {
+ Identifier = RID_MINUSPLUSX;
+ HelpId = HID_SMA_MINUSPLUSX;
+ Text = "-+a";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_XPLUSY;
+ HelpId = HID_SMA_XPLUSY;
+ Text = "a + b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XMINUSY;
+ HelpId = HID_SMA_XMINUSY;
+ Text = "a - b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XCDOTY;
+ HelpId = HID_SMA_XCDOTY;
+ Text = "a cdot b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XTIMESY;
+ HelpId = HID_SMA_XTIMESY;
+ Text = "a times b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XSYMTIMESY;
+ HelpId = HID_SMA_XSYMTIMESY;
+ Text = "a * b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XOVERY;
+ HelpId = HID_SMA_XOVERY;
+ Text = "a over b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XDIVY;
+ HelpId = HID_SMA_XDIVY;
+ Text = "a div b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XSYMDIVIDEY;
+ HelpId = HID_SMA_XSYMDIVIDEY;
+ Text = "a / b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XCIRCY;
+ HelpId = HID_SMA_XCIRCY;
+ Text = "a circ b";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_XWIDESLASHY;
+ HelpId = HID_SMA_XWIDESLASHY;
+ Text = "a wideslash b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XWIDEBSLASHY;
+ HelpId = HID_SMA_XWIDEBSLASHY;
+ Text = "a widebslash b";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_NEGX;
+ HelpId = HID_SMA_NEGX;
+ Text = "neg a";
+ };
+ MenuItem
+ {
+ Identifier = RID_XANDY;
+ HelpId = HID_SMA_XANDY;
+ Text = "a and b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XORY;
+ HelpId = HID_SMA_XORY;
+ Text = "a or b";
+ };
+ };
+ };
+ Text[ chinese_simplified ] = "一元/二元运算符";
+ Text[ russian ] = "禹囵睇/凌磬痦 铒屦囹铕";
+ Text[ polish ] = "Unarne/binarne operatory";
+ Text[ japanese ] = "嫁咆/兽才 低呲袄";
+ Text[ chinese_traditional ] = "じ/じ笲衡才";
+ Text[ dutch ] = "~Unaire/binaire operatoren";
+ Text[ chinese_simplified ] = "一元/二元运算符";
+ Text[ greek ] = "彭醻溟觑/孽徜殛镞 翦脲篝蒡";
+ Text[ korean ] = "老柳/捞柳 楷魂磊";
+ Text[ arabic ] = "阪倾 试垌 猛窍砩/虽瞧砩";
+ Text[ turkish ] = "Birli/ikili ie鏻er";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_RELATIONS_MENU ;
+ HelpId = HID_SMA_RELATIONS_TBX ;
+ Text = "~Relationen" ;
+ Text [ ENGLISH ] = "Relations" ;
+ Text [ english_us ] = "Relations" ;
+ Text [ portuguese_brazilian ] = "Relationen" ;
+ Text [ swedish ] = "~Relationer" ;
+ Text [ danish ] = "Relationer" ;
+ Text [ italian ] = "Relazioni" ;
+ Text [ spanish ] = "~Relaciones" ;
+ Text [ french ] = "~Relations" ;
+ Text [ dutch ] = "~Relaties" ;
+ Text [ portuguese ] = "~Rela珲es" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_XEQY;
+ HelpId = HID_SMA_XEQY;
+ Text = "a = b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XNEQY;
+ HelpId = HID_SMA_XNEQY;
+ Text = "a <> b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XLTY;
+ HelpId = HID_SMA_XLTY;
+ Text = "a < b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XLEY;
+ HelpId = HID_SMA_XLEY;
+ Text = "a <= b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XLESLANTY;
+ HelpId = HID_SMA_XLESLANTY;
+ Text = "a leslant b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XGTY;
+ HelpId = HID_SMA_XGTY;
+ Text = "a > b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XGEY;
+ HelpId = HID_SMA_XGEY;
+ Text = "a >= b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XGESLANTY;
+ HelpId = HID_SMA_XGESLANTY;
+ Text = "a geslant b";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_XAPPROXY;
+ HelpId = HID_SMA_XAPPROXY;
+ Text = "a approx b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XSIMY;
+ HelpId = HID_SMA_XSIMY;
+ Text = "a sim b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XSIMEQY;
+ HelpId = HID_SMA_XSIMEQY;
+ Text = "a simeq b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XEQUIVY;
+ HelpId = HID_SMA_XEQUIVY;
+ Text = "a equiv b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XPROPY;
+ HelpId = HID_SMA_XPROPY;
+ Text = "a prop b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XPARALLELY;
+ HelpId = HID_SMA_XPARALLELY;
+ Text = "a parallel b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XORTHOY;
+ HelpId = HID_SMA_XORTHOY;
+ Text = "a ortho b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XDIVIDESY;
+ HelpId = HID_SMA_XDIVIDESY;
+ Text = "a divides b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XNDIVIDESY;
+ HelpId = HID_SMA_XNDIVIDESY;
+ Text = "a ndivides b";
+ };
+ MenuItem
+ {
+ Identifier = RID_XTOWARDY;
+ HelpId = HID_SMA_XTOWARDY;
+ Text = "a toward b";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_DLARROW;
+ HelpId = HID_SMA_DLARROW;
+ Text = "a dlarrow b";
+ };
+ MenuItem
+ {
+ Identifier = RID_DLRARROW;
+ HelpId = HID_SMA_DLRARROW;
+ Text = "a dlrarrow b";
+ };
+ MenuItem
+ {
+ Identifier = RID_DRARROW;
+ HelpId = HID_SMA_DRARROW;
+ Text = "a drarrow b";
+ };
+ };
+ };
+ Text[ chinese_simplified ] = "关系";
+ Text[ russian ] = "砚玷";
+ Text[ polish ] = "Relacje";
+ Text[ japanese ] = "刳凹";
+ Text[ chinese_traditional ] = "闽玒";
+ Text[ dutch ] = "~Relaties";
+ Text[ chinese_simplified ] = "关系";
+ Text[ greek ] = "~喻蒹彘";
+ Text[ korean ] = "包拌";
+ Text[ arabic ] = "卺寝鞘";
+ Text[ turkish ] = "輑i⺧iler";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_SETOPERATIONS_MENU ;
+ HelpId = HID_SMA_SETOPERATIONS_TBX ;
+ Text = "~Mengenoperationen" ;
+ Text [ ENGLISH ] = "Set operations" ;
+ Text [ english_us ] = "Set Operations" ;
+ Text [ portuguese_brazilian ] = "Mengenoperationen" ;
+ Text [ swedish ] = "~M鋘gdoperationer" ;
+ Text [ danish ] = "M鎛gdeoperationer" ;
+ Text [ italian ] = "Operazioni degli insiemi" ;
+ Text [ spanish ] = "~Operaciones de conjuntos" ;
+ Text [ french ] = "O~p閞ations quantitatives" ;
+ Text [ dutch ] = "~Definities" ;
+ Text [ portuguese ] = "~Opera珲es de conjuntos" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_XINY;
+ HelpId = HID_SMA_XINY;
+ Text = "a in A";
+ };
+ MenuItem
+ {
+ Identifier = RID_XNOTINY;
+ HelpId = HID_SMA_XNOTINY;
+ Text = "a notin A";
+ };
+ MenuItem
+ {
+ Identifier = RID_XOWNSY;
+ HelpId = HID_SMA_XOWNSY;
+ Text = "A owns a";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_XINTERSECTIONY;
+ HelpId = HID_SMA_XINTERSECTIONY;
+ Text = "A intersection B";
+ };
+ MenuItem
+ {
+ Identifier = RID_XUNIONY;
+ HelpId = HID_SMA_XUNIONY;
+ Text = "A union B";
+ };
+ MenuItem
+ {
+ Identifier = RID_XSETMINUSY;
+ HelpId = HID_SMA_XSETMINUSY;
+ Text = "A \\ B";
+ };
+ MenuItem
+ {
+ Identifier = RID_XSLASHY;
+ HelpId = HID_SMA_XSLASHY;
+ Text = "A / B";
+ };
+ MenuItem
+ {
+ Identifier = RID_XSUBSETY;
+ HelpId = HID_SMA_XSUBSETY;
+ Text = "A subset B";
+ };
+ MenuItem
+ {
+ Identifier = RID_XSUBSETEQY;
+ HelpId = HID_SMA_XSUBSETEQY;
+ Text = "A subseteq B";
+ };
+ MenuItem
+ {
+ Identifier = RID_XSUPSETY;
+ HelpId = HID_SMA_XSUPSETY;
+ Text = "A supset B";
+ };
+ MenuItem
+ {
+ Identifier = RID_XSUPSETEQY;
+ HelpId = HID_SMA_XSUPSETEQY;
+ Text = "A supseteq B";
+ };
+ MenuItem
+ {
+ Identifier = RID_XNSUBSETY;
+ HelpId = HID_SMA_XNSUBSETY;
+ Text = "A nsubset B";
+ };
+ MenuItem
+ {
+ Identifier = RID_XNSUBSETEQY;
+ HelpId = HID_SMA_XNSUBSETEQY;
+ Text = "A nsubseteq B";
+ };
+ MenuItem
+ {
+ Identifier = RID_XNSUPSETY;
+ HelpId = HID_SMA_XNSUPSETY;
+ Text = "A nsupset B";
+ };
+ MenuItem
+ {
+ Identifier = RID_XNSUPSETEQY;
+ HelpId = HID_SMA_XNSUPSETEQY;
+ Text = "A nsupseteq B";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_EMPTYSET;
+ HelpId = HID_SMA_EMPTYSET;
+ Text = "emptyset";
+ };
+ MenuItem
+ {
+ Identifier = RID_ALEPH;
+ HelpId = HID_SMA_ALEPH;
+ Text = "aleph";
+ };
+ MenuItem
+ {
+ Identifier = RID_SETN;
+ HelpId = HID_SMA_SETN;
+ Text = "setN";
+ };
+ MenuItem
+ {
+ Identifier = RID_SETZ;
+ HelpId = HID_SMA_SETZ;
+ Text = "setZ";
+ };
+ MenuItem
+ {
+ Identifier = RID_SETQ;
+ HelpId = HID_SMA_SETQ;
+ Text = "setQ";
+ };
+ MenuItem
+ {
+ Identifier = RID_SETR;
+ HelpId = HID_SMA_SETR;
+ Text = "setR";
+ };
+ MenuItem
+ {
+ Identifier = RID_SETC;
+ HelpId = HID_SMA_SETC;
+ Text = "setC";
+ };
+ };
+ };
+ Text[ chinese_simplified ] = "数量计算";
+ Text[ russian ] = "物屦圉梃 祉铈羼蜮";
+ Text[ polish ] = "Operacje na zbiorach";
+ Text[ japanese ] = "廤崌墘嶼";
+ Text[ chinese_traditional ] = "计秖璸衡";
+ Text[ dutch ] = "~Definities";
+ Text[ chinese_simplified ] = "数量计算";
+ Text[ greek ] = "~旭茴彘 篚睃膣";
+ Text[ korean ] = "楷魂磊 汲沥";
+ Text[ arabic ] = "闾沔谏 阢犴鞘";
+ Text[ turkish ] = "K黰e iemleri";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_FUNCTIONS_MENU ;
+ HelpId = HID_SMA_FUNCTIONS_TBX ;
+ Text = "~Funktionen" ;
+ Text [ ENGLISH ] = "Functions" ;
+ Text [ english_us ] = "Functions" ;
+ Text [ portuguese_brazilian ] = "Funktionen" ;
+ Text [ swedish ] = "~Funktioner" ;
+ Text [ danish ] = "Funktioner" ;
+ Text [ italian ] = "Funzioni" ;
+ Text [ spanish ] = "~Funciones" ;
+ Text [ french ] = "~Fonctions" ;
+ Text [ dutch ] = "~Functies" ;
+ Text [ portuguese ] = "~Fun珲es" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_ABSX;
+ HelpId = HID_SMA_ABSX;
+ Text = "|x|";
+ };
+ MenuItem
+ {
+ Identifier = RID_FACTX;
+ HelpId = HID_SMA_FACTX;
+ Text = "x!";
+ };
+ MenuItem
+ {
+ Identifier = RID_SQRTX;
+ HelpId = HID_SMA_SQRTX;
+ Text = "sqrt x";
+ };
+ MenuItem
+ {
+ Identifier = RID_NROOTXY;
+ HelpId = HID_SMA_NROOTXY;
+ Text = "nroot x y";
+ };
+ MenuItem
+ {
+ Identifier = RID_RSUPX;
+ HelpId = HID_SMA_RSUPX;
+ Text = "x^y";
+ };
+ MenuItem
+ {
+ Identifier = RID_EX;
+ HelpId = HID_SMA_EX;
+ Text = "e^x";
+ };
+ MenuItem
+ {
+ Identifier = RID_LNX;
+ HelpId = HID_SMA_LNX;
+ Text = "ln(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_EXPX;
+ HelpId = HID_SMA_EXPX;
+ Text = "exp(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_LOGX;
+ HelpId = HID_SMA_LOGX;
+ Text = "log(x)";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_SINX;
+ HelpId = HID_SMA_SINX;
+ Text = "sin(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_COSX;
+ HelpId = HID_SMA_COSX;
+ Text = "cos(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_TANX;
+ HelpId = HID_SMA_TANX;
+ Text = "tan(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_COTX;
+ HelpId = HID_SMA_COTX;
+ Text = "cot(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_SINHX;
+ HelpId = HID_SMA_SINHX;
+ Text = "sinh(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_COSHX;
+ HelpId = HID_SMA_COSHX;
+ Text = "cosh(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_TANHX;
+ HelpId = HID_SMA_TANHX;
+ Text = "tanh(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_COTHX;
+ HelpId = HID_SMA_COTHX;
+ Text = "coth(x)";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_FUNCTIONSOTHER1_MENU;
+ HelpId = HID_SMA_FUNCTIONSOTHER1_MENU;
+ Text = "andere";
+ Text [ ENGLISH ] = "other";
+ TEXT[ italian ] = "altri";
+ TEXT[ portuguese_brazilian ] = "andere";
+ TEXT[ portuguese ] = "Outros";
+ TEXT[ danish ] = "andre";
+ TEXT[ french ] = "Autres";
+ TEXT[ swedish ] = "andra";
+ TEXT[ dutch ] = "andere";
+ TEXT[ spanish ] = "otros";
+ TEXT[ english_us ] = "Other";
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_ARCSINX;
+ HelpId = HID_SMA_ARCSINX;
+ Text = "arcsin(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_ARCCOSX;
+ HelpId = HID_SMA_ARCCOSX;
+ Text = "arccos(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_ARCTANX;
+ HelpId = HID_SMA_ARCTANX;
+ Text = "arctan(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_ARCCOTX;
+ HelpId = HID_SMA_ARCCOTX;
+ Text = "arcot(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_ARSINHX;
+ HelpId = HID_SMA_ARSINHX;
+ Text = "arsinh(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_ARCOSHX;
+ HelpId = HID_SMA_ARCOSHX;
+ Text = "arcosh(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_ARTANHX;
+ HelpId = HID_SMA_ARTANHX;
+ Text = "artanh(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_ARCOTHX;
+ HelpId = HID_SMA_ARCOTHX;
+ Text = "arcoth(x)";
+ };
+ };
+ };
+ TEXT[ chinese_simplified ] = "其他";
+ TEXT[ russian ] = "漯筱桢";
+ TEXT[ polish ] = "inne";
+ TEXT[ japanese ] = "偦偺懠";
+ TEXT[ chinese_traditional ] = "ㄤ";
+ TEXT[ language_user1 ] = " ";
+ TEXT[ dutch ] = "andere";
+ TEXT[ chinese_simplified ] = "其他";
+ TEXT[ greek ] = "茈脶";
+ TEXT[ korean ] = "扁鸥";
+ TEXT[ arabic ] = "垌 嗅";
+ TEXT[ turkish ] = "Di餰r";
+ };
+ };
+ };
+ Text[ chinese_simplified ] = "函数";
+ Text[ russian ] = "泽黻鲨";
+ Text[ polish ] = "Funkcje";
+ Text[ japanese ] = "娭悢";
+ Text[ chinese_traditional ] = "ㄧ计";
+ Text[ dutch ] = "~Functies";
+ Text[ chinese_simplified ] = "函数";
+ Text[ greek ] = "~吁磲耵摅彘";
+ Text[ korean ] = "窃荐";
+ Text[ arabic ] = "锨崆";
+ Text[ turkish ] = "Fonksiyon";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_OPERATORS_MENU ;
+ HelpId = HID_SMA_OPERATORS_TBX ;
+ Text = "~Operatoren" ;
+ Text [ ENGLISH ] = "Operators" ;
+ Text [ english_us ] = "Operators" ;
+ Text [ portuguese_brazilian ] = "Operatoren" ;
+ Text [ swedish ] = "~Operatorer" ;
+ Text [ danish ] = "Operatorer" ;
+ Text [ italian ] = "Operatori" ;
+ Text [ spanish ] = "~Operadores" ;
+ Text [ french ] = "~Op閞ateurs" ;
+ Text [ dutch ] = "O~peratoren" ;
+ Text [ portuguese ] = "~Operadores" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_LIMX;
+ HelpId = HID_SMA_LIMX;
+ Text = "lim x";
+ };
+ MenuItem
+ {
+ Identifier = RID_SUMX;
+ HelpId = HID_SMA_SUMX;
+ Text = "sum x";
+ };
+ MenuItem
+ {
+ Identifier = RID_PRODX;
+ HelpId = HID_SMA_PRODX;
+ Text = "prod x";
+ };
+ MenuItem
+ {
+ Identifier = RID_COPRODX;
+ HelpId = HID_SMA_COPRODX;
+ Text = "coprod x";
+ };
+ MenuItem
+ {
+ Identifier = RID_INTX;
+ HelpId = HID_SMA_INTX;
+ Text = "int x";
+ };
+ MenuItem
+ {
+ Identifier = RID_IINTX;
+ HelpId = HID_SMA_IINTX;
+ Text = "iint x";
+ };
+ MenuItem
+ {
+ Identifier = RID_IIINTX;
+ HelpId = HID_SMA_IIINTX;
+ Text = "iiint x";
+ };
+ MenuItem
+ {
+ Identifier = RID_LINTX;
+ HelpId = HID_SMA_LINTX;
+ Text = "lint x";
+ };
+ MenuItem
+ {
+ Identifier = RID_LLINTX;
+ HelpId = HID_SMA_LLINTX;
+ Text = "llint x";
+ };
+ MenuItem
+ {
+ Identifier = RID_LLLINTX;
+ HelpId = HID_SMA_LLLINTX;
+ Text = "lllint x";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_FROMXTOY;
+ HelpId = HID_SMA_FROMXTOY;
+ Text = "... from a to b";
+ };
+ MenuItem
+ {
+ Identifier = RID_FROMX;
+ HelpId = HID_SMA_FROMX;
+ Text = "... from a";
+ };
+ MenuItem
+ {
+ Identifier = RID_TOX;
+ HelpId = HID_SMA_TOX;
+ Text = "... to b";
+ };
+ };
+ };
+ Text[ chinese_simplified ] = "运算符";
+ Text[ russian ] = "物屦囹铕";
+ Text[ polish ] = "Operatory";
+ Text[ japanese ] = "墘嶼巕";
+ Text[ chinese_traditional ] = "笲衡才";
+ Text[ dutch ] = "O~peratoren";
+ Text[ chinese_simplified ] = "运算符";
+ Text[ greek ] = "~藻脲篝蒡";
+ Text[ korean ] = "楷魂磊";
+ Text[ arabic ] = "阪倾 轻试垌";
+ Text[ turkish ] = "蔺le鏻er";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_ATTRIBUTES_MENU ;
+ HelpId = HID_SMA_ATTRIBUTES_TBX ;
+ Text = "~Attribute" ;
+ Text [ ENGLISH ] = "Attributes" ;
+ Text [ portuguese ] = "~Atributos" ;
+ Text [ english_us ] = "Attributes" ;
+ Text [ portuguese_brazilian ] = "Attribute" ;
+ Text [ swedish ] = "~Attribut" ;
+ Text [ danish ] = "Attributter" ;
+ Text [ italian ] = "Attributi" ;
+ Text [ spanish ] = "~Atributos" ;
+ Text [ french ] = "~Attributs" ;
+ Text [ dutch ] = "~Attributen" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_ACUTEX;
+ HelpId = HID_SMA_ACUTEX;
+ Text = "acute a";
+ };
+ MenuItem
+ {
+ Identifier = RID_GRAVEX;
+ HelpId = HID_SMA_GRAVEX;
+ Text = "grave a";
+ };
+ MenuItem
+ {
+ Identifier = RID_CHECKX;
+ HelpId = HID_SMA_CHECKX;
+ Text = "check a";
+ };
+ MenuItem
+ {
+ Identifier = RID_BREVEX;
+ HelpId = HID_SMA_BREVEX;
+ Text = "breve a";
+ };
+ MenuItem
+ {
+ Identifier = RID_CIRCLEX;
+ HelpId = HID_SMA_CIRCLEX;
+ Text = "circle a";
+ };
+ MenuItem
+ {
+ Identifier = RID_DOTX;
+ HelpId = HID_SMA_DOTX;
+ Text = "dot a";
+ };
+ MenuItem
+ {
+ Identifier = RID_DDOTX;
+ HelpId = HID_SMA_DDOTX;
+ Text = "ddot a";
+ };
+ MenuItem
+ {
+ Identifier = RID_DDDOTX;
+ HelpId = HID_SMA_DDDOTX;
+ Text = "dddot a";
+ };
+ MenuItem
+ {
+ Identifier = RID_BARX;
+ HelpId = HID_SMA_BARX;
+ Text = "bar a";
+ };
+ MenuItem
+ {
+ Identifier = RID_VECX;
+ HelpId = HID_SMA_VECX;
+ Text = "vec a";
+ };
+ MenuItem
+ {
+ Identifier = RID_TILDEX;
+ HelpId = HID_SMA_TILDEX;
+ Text = "tilde a";
+ };
+ MenuItem
+ {
+ Identifier = RID_HATX;
+ HelpId = HID_SMA_HATX;
+ Text = "hat a";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_WIDEVECX;
+ HelpId = HID_SMA_WIDEVECX;
+ Text = "widevec abc";
+ };
+ MenuItem
+ {
+ Identifier = RID_WIDETILDEX;
+ HelpId = HID_SMA_WIDETILDEX;
+ Text = "widetilde abc";
+ };
+ MenuItem
+ {
+ Identifier = RID_WIDEHATX;
+ HelpId = HID_SMA_WIDEHATX;
+ Text = "widehat abc";
+ };
+ MenuItem
+ {
+ Identifier = RID_OVERLINEX;
+ HelpId = HID_SMA_OVERLINEX;
+ Text = "overline abc";
+ };
+ MenuItem
+ {
+ Identifier = RID_UNDERLINEX;
+ HelpId = HID_SMA_UNDERLINEX;
+ Text = "underline abc";
+ };
+ MenuItem
+ {
+ Identifier = RID_OVERSTRIKEX;
+ HelpId = HID_SMA_OVERSTRIKEX;
+ Text = "overstrike abc";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_PHANTOMX;
+ HelpId = HID_SMA_PHANTOMX;
+ Text = "phantom b";
+ };
+ MenuItem
+ {
+ Identifier = RID_BOLDX;
+ HelpId = HID_SMA_BOLDX;
+ Text = "bold b";
+ };
+ MenuItem
+ {
+ Identifier = RID_ITALX;
+ HelpId = HID_SMA_ITALX;
+ Text = "ital b";
+ };
+ MenuItem
+ {
+ Identifier = RID_SIZEXY;
+ HelpId = HID_SMA_SIZEXY;
+ Text = "size s b";
+ };
+ MenuItem
+ {
+ Identifier = RID_FONTXY;
+ HelpId = HID_SMA_FONTXY;
+ Text = "font f b";
+ };
+ };
+ };
+ Text[ chinese_simplified ] = "属性";
+ Text[ russian ] = "莉痂狍螓";
+ Text[ polish ] = "Atrybuty";
+ Text[ japanese ] = "懏惈";
+ Text[ chinese_traditional ] = "妮┦";
+ Text[ dutch ] = "~Attributen";
+ Text[ chinese_simplified ] = "属性";
+ Text[ greek ] = "~射辄翮翦";
+ Text[ korean ] = "加己";
+ Text[ arabic ] = "鱼鞘";
+ Text[ turkish ] = "謟nitelikler";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_BRACKETS_MENU ;
+ HelpId = HID_SMA_BRACKETS_TBX ;
+ Text = "~Klammern" ;
+ Text [ ENGLISH ] = "Parentheses" ;
+ Text [ english_us ] = "Brackets" ;
+ Text [ portuguese_brazilian ] = "Klammern" ;
+ Text [ swedish ] = "~Parenteser" ;
+ Text [ danish ] = "Parenteser" ;
+ Text [ italian ] = "Parentesi" ;
+ Text [ spanish ] = "~Par閚tesis" ;
+ Text [ french ] = "~Parenth鑣es" ;
+ Text [ dutch ] = "~Haakjes" ;
+ Text [ portuguese ] = "~Par阯teses" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_LRGROUPX;
+ HelpId = HID_SMA_LRGROUPX;
+ Text = "{...}";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_LRPARENTX;
+ HelpId = HID_SMA_LRPARENTX;
+ Text = "(x)";
+ };
+ MenuItem
+ {
+ Identifier = RID_LRBRACKETX;
+ HelpId = HID_SMA_LRBRACKETX;
+ Text = "[x]";
+ };
+ MenuItem
+ {
+ Identifier = RID_LRDBRACKETX;
+ HelpId = HID_SMA_LRDBRACKETX;
+ Text = "ldbracket x rdbracket ";
+ };
+ MenuItem
+ {
+ Identifier = RID_LRBRACEX;
+ HelpId = HID_SMA_LRBRACEX;
+ Text = "{x}";
+ };
+ MenuItem
+ {
+ Identifier = RID_LRANGLEX;
+ HelpId = HID_SMA_LRANGLEX;
+ Text = "langle x rangle";
+ };
+ MenuItem
+ {
+ Identifier = RID_LMRANGLEXY;
+ HelpId = HID_SMA_LMRANGLEXY;
+ Text = "langle x mline y rangle";
+ };
+ MenuItem
+ {
+ Identifier = RID_LRCEILX;
+ HelpId = HID_SMA_LRCEILX;
+ Text = "lceil x rceil";
+ };
+ MenuItem
+ {
+ Identifier = RID_LRFLOORX;
+ HelpId = HID_SMA_LRFLOORX;
+ Text = "lfloor x rfloor";
+ };
+ MenuItem
+ {
+ Identifier = RID_LRLINEX;
+ HelpId = HID_SMA_LRLINEX;
+ Text = "lline x rline";
+ };
+ MenuItem
+ {
+ Identifier = RID_LRDLINEX;
+ HelpId = HID_SMA_LRDLINEX;
+ Text = "ldline x rdline";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_SLRPARENTX;
+ HelpId = HID_SMA_SLRPARENTX;
+ Text = "left ( x rigth )";
+ };
+ MenuItem
+ {
+ Identifier = RID_SLRBRACKETX;
+ HelpId = HID_SMA_SLRBRACKETX;
+ Text = "left [ x right ]";
+ };
+ MenuItem
+ {
+ Identifier = RID_SLRDBRACKETX;
+ HelpId = HID_SMA_SLRDBRACKETX;
+ Text = "left ldbracket x right rdbracket ";
+ };
+ MenuItem
+ {
+ Identifier = RID_SLRBRACEX;
+ HelpId = HID_SMA_SLRBRACEX;
+ Text = "left { x right }";
+ };
+ MenuItem
+ {
+ Identifier = RID_SLRANGLEX;
+ HelpId = HID_SMA_SLRANGLEX;
+ Text = "left langle x right rangle";
+ };
+ MenuItem
+ {
+ Identifier = RID_SLMRANGLEXY;
+ HelpId = HID_SMA_SLMRANGLEXY;
+ Text = "left langle x mline y right rangle";
+ };
+ MenuItem
+ {
+ Identifier = RID_SLRCEILX;
+ HelpId = HID_SMA_SLRCEILX;
+ Text = "left lceil x right rceil";
+ };
+ MenuItem
+ {
+ Identifier = RID_SLRFLOORX;
+ HelpId = HID_SMA_SLRFLOORX;
+ Text = "left lfloor x right rfloor";
+ };
+ MenuItem
+ {
+ Identifier = RID_SLRLINEX;
+ HelpId = HID_SMA_SLRLINEX;
+ Text = "left lline x right rline";
+ };
+ MenuItem
+ {
+ Identifier = RID_SLRDLINEX;
+ HelpId = HID_SMA_SLRDLINEX;
+ Text = "left ldline x right rdline";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_XOVERBRACEY;
+ HelpId = HID_SMA_XOVERBRACEY;
+ Text = "x overbrace y";
+ };
+ MenuItem
+ {
+ Identifier = RID_XUNDERBRACEY;
+ HelpId = HID_SMA_XUNDERBRACEY;
+ Text = "x underbrace y";
+ };
+ };
+ };
+ Text[ chinese_simplified ] = "括号";
+ Text[ russian ] = "殃钺觇";
+ Text[ polish ] = "Nawiasy";
+ Text[ japanese ] = "妵屖";
+ Text[ chinese_traditional ] = "珹腹";
+ Text[ dutch ] = "~Haakjes";
+ Text[ chinese_simplified ] = "括号";
+ Text[ greek ] = "~嗅皴龛蒹彘";
+ Text[ korean ] = "褒龋";
+ Text[ arabic ] = "棉媲";
+ Text[ turkish ] = "Ayra鏻ar";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_FORMAT_MENU ;
+ HelpId = HID_SMA_FORMAT_TBX ;
+ Text = "Formatieru~ngen" ;
+ Text [ ENGLISH ] = "Format" ;
+ Text [ english_us ] = "F~ormat" ;
+ Text [ portuguese_brazilian ] = "Formatierungen" ;
+ Text [ swedish ] = "~Formateringar" ;
+ Text [ danish ] = "Formateringer" ;
+ Text [ italian ] = "Formattazioni" ;
+ Text [ spanish ] = "~Formatos" ;
+ Text [ french ] = "Format~age" ;
+ Text [ dutch ] = "~Opmaak" ;
+ Text [ portuguese ] = "~Formatos" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_RSUPX;
+ HelpId = HID_SMA_RSUPX;
+ Text = "^x";
+ };
+ MenuItem
+ {
+ Identifier = RID_RSUBX;
+ HelpId = HID_SMA_RSUBX;
+ Text = "_x";
+ };
+ MenuItem
+ {
+ Identifier = RID_LSUPX;
+ HelpId = HID_SMA_LSUPX;
+ Text = "lsup x";
+ };
+ MenuItem
+ {
+ Identifier = RID_LSUBX;
+ HelpId = HID_SMA_LSUBX;
+ Text = "lsub x";
+ };
+ MenuItem
+ {
+ Identifier = RID_CSUPX;
+ HelpId = HID_SMA_CSUPX;
+ Text = "csup x";
+ };
+ MenuItem
+ {
+ Identifier = RID_CSUBX;
+ HelpId = HID_SMA_CSUBX;
+ Text = "csub x";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_NEWLINE;
+ HelpId = HID_SMA_NEWLINE;
+ Text = "neue Zeile";
+ Text [ ENGLISH ] = "new line" ;
+ Text[ italian ] = "Nuova riga";
+ Text[ portuguese_brazilian ] = "new line";
+ Text[ portuguese ] = "nova linha";
+ Text[ danish ] = "ny linje";
+ Text[ french ] = "nouvelle ligne";
+ Text[ swedish ] = "ny rad";
+ Text[ dutch ] = "nieuwe regel";
+ Text[ spanish ] = "nueva l韓ea";
+ Text[ english_us ] = "New Line";
+ Text[ chinese_simplified ] = "换行";
+ Text[ russian ] = "眍忄 耱痤赅";
+ Text[ polish ] = "nowy wiersz";
+ Text[ japanese ] = "怴偟偄峴";
+ Text[ chinese_traditional ] = "传︽";
+ Text[ dutch ] = "nieuwe regel";
+ Text[ chinese_simplified ] = "换行";
+ Text[ greek ] = "洼 泷犰燹";
+ Text[ korean ] = "货 临";
+ Text[ arabic ] = "呜 滔硐";
+ Text[ turkish ] = "Yeni sat齬";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_SBLANK;
+ HelpId = HID_SMA_SBLANK;
+ Text = "kleiner Zwischenraum";
+ Text [ ENGLISH ] = "small space" ;
+ Text[ italian ] = "Spazio intemedio piccolo";
+ Text[ portuguese_brazilian ] = "small space";
+ Text[ portuguese ] = "espa鏰mento pequeno";
+ Text[ danish ] = "lille mellemrum";
+ Text[ french ] = "Petit espace";
+ Text[ swedish ] = "litet mellanrum";
+ Text[ dutch ] = "kleine spatie";
+ Text[ spanish ] = "espacio peque駉";
+ Text[ english_us ] = "Small Gap";
+ Text[ chinese_simplified ] = "小间隔";
+ Text[ russian ] = "觐痤蜿栝 镳钺咫";
+ Text[ polish ] = "Ma硑 odst阷 mi阣zy ramkami";
+ Text[ japanese ] = "彫酵甙";
+ Text[ chinese_traditional ] = "丁筳";
+ Text[ dutch ] = "kleine spatie";
+ Text[ chinese_simplified ] = "小间隔";
+ Text[ greek ] = "扉犟 溟荜屙";
+ Text[ korean ] = "累篮 埃拜";
+ Text[ arabic ] = "嗜勤 折硌";
+ Text[ turkish ] = "K黭 aral齥";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_BLANK;
+ HelpId = HID_SMA_BLANK;
+ Text = "Zwischenraum";
+ Text [ ENGLISH ] = "space" ;
+ Text[ italian ] = "Spazio intermedio";
+ Text[ portuguese_brazilian ] = "space";
+ Text[ portuguese ] = "espa鏰mento";
+ Text[ danish ] = "mellemrum";
+ Text[ french ] = "Espace";
+ Text[ swedish ] = "mellanrum";
+ Text[ dutch ] = "spatie";
+ Text[ spanish ] = "espacio";
+ Text[ english_us ] = "Gap";
+ Text[ chinese_simplified ] = "间隔";
+ Text[ russian ] = "橡钺咫";
+ Text[ polish ] = "Odst阷 ramek";
+ Text[ japanese ] = "酵甙";
+ Text[ chinese_traditional ] = "丁筳";
+ Text[ dutch ] = "spatie";
+ Text[ chinese_simplified ] = "间隔";
+ Text[ greek ] = "拈荜屙";
+ Text[ korean ] = "埃拜";
+ Text[ arabic ] = "嗜勤";
+ Text[ turkish ] = "Aral齥";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_BINOMXY;
+ HelpId = HID_SMA_BINOMXY;
+ Text = "binom x y";
+ };
+ MenuItem
+ {
+ Identifier = RID_STACK;
+ HelpId = HID_SMA_STACK;
+ Text = "stack {...}";
+ };
+ MenuItem
+ {
+ Identifier = RID_MATRIX;
+ HelpId = HID_SMA_MATRIX;
+ Text = "matrix {...}";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_ALIGNLX;
+ HelpId = HID_SMA_ALIGNLX;
+ Text = "alignl x";
+ };
+ MenuItem
+ {
+ Identifier = RID_ALIGNCX;
+ HelpId = HID_SMA_ALIGNCX;
+ Text = "alignc x";
+ };
+ MenuItem
+ {
+ Identifier = RID_ALIGNRX;
+ HelpId = HID_SMA_ALIGNRX;
+ Text = "alignr x";
+ };
+ };
+ };
+ Text[ chinese_simplified ] = "格式(~O)";
+ Text[ russian ] = "灶痨囹";
+ Text[ polish ] = "Formatowania";
+ Text[ japanese ] = "彂幃愝掕(~O)";
+ Text[ chinese_traditional ] = "Α(~O)";
+ Text[ dutch ] = "~Opmaak";
+ Text[ chinese_simplified ] = "格式(~O)";
+ Text[ greek ] = "田駘鲲痫檗箦轵";
+ Text[ korean ] = "辑侥(~O)";
+ Text[ arabic ] = "输禹";
+ Text[ turkish ] = "Format";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_MISC_MENU ;
+ HelpId = HID_SMA_MISC_MENU ;
+ Text = "~Sonstiges" ;
+ Text [ ENGLISH ] = "Misc" ;
+ Text [ english_us ] = "~Others" ;
+ Text [ portuguese_brazilian ] = "Sonstiges" ;
+ Text [ swedish ] = "謣vrigt" ;
+ Text [ danish ] = "Andet" ;
+ Text [ italian ] = "Altro" ;
+ Text [ spanish ] = "~Otros" ;
+ Text [ french ] = "~Autres" ;
+ Text [ dutch ] = "D~iversen" ;
+ Text [ portuguese ] = "~Outros" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_INFINITY;
+ HelpId = HID_SMA_INFINITY;
+ Text = "infinity";
+ };
+ MenuItem
+ {
+ Identifier = RID_PARTIAL;
+ HelpId = HID_SMA_PARTIAL;
+ Text = "partial";
+ };
+ MenuItem
+ {
+ Identifier = RID_NABLA;
+ HelpId = HID_SMA_NABLA;
+ Text = "nabla";
+ };
+ MenuItem
+ {
+ Identifier = RID_EXISTS;
+ HelpId = HID_SMA_EXISTS;
+ Text = "exists";
+ };
+ MenuItem
+ {
+ Identifier = RID_FORALL;
+ HelpId = HID_SMA_FORALL;
+ Text = "forall";
+ };
+ MenuItem
+ {
+ Identifier = RID_HBAR;
+ HelpId = HID_SMA_HBAR;
+ Text = "hbar";
+ };
+ MenuItem
+ {
+ Identifier = RID_LAMBDABAR;
+ HelpId = HID_SMA_LAMBDABAR;
+ Text = "lambdabar";
+ };
+ MenuItem
+ {
+ Identifier = RID_RE;
+ HelpId = HID_SMA_RE;
+ Text = "Re";
+ };
+ MenuItem
+ {
+ Identifier = RID_IM;
+ HelpId = HID_SMA_IM;
+ Text = "Im";
+ };
+ MenuItem
+ {
+ Identifier = RID_WP;
+ HelpId = HID_SMA_WP;
+ Text = "wp";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_LEFTARROW;
+ HelpId = HID_SMA_LEFTARROW;
+ Text = "leftarrow";
+ };
+ MenuItem
+ {
+ Identifier = RID_RIGHTARROW;
+ HelpId = HID_SMA_RIGHTARROW;
+ Text = "rightarrow";
+ };
+ MenuItem
+ {
+ Identifier = RID_UPARROW;
+ HelpId = HID_SMA_UPARROW;
+ Text = "uparrow";
+ };
+ MenuItem
+ {
+ Identifier = RID_DOWNARROW;
+ HelpId = HID_SMA_DOWNARROW;
+ Text = "downarrow";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_DOTSLOW;
+ HelpId = HID_SMA_DOTSLOW;
+ Text = "dotslow";
+ };
+ MenuItem
+ {
+ Identifier = RID_DOTSAXIS;
+ HelpId = HID_SMA_DOTSAXIS;
+ Text = "dotsaxis";
+ };
+ MenuItem
+ {
+ Identifier = RID_DOTSVERT;
+ HelpId = HID_SMA_DOTSVERT;
+ Text = "dotsvert";
+ };
+ MenuItem
+ {
+ Identifier = RID_DOTSUP;
+ HelpId = HID_SMA_DOTSUP;
+ Text = "dotsup";
+ };
+ MenuItem
+ {
+ Identifier = RID_DOTSDOWN;
+ HelpId = HID_SMA_DOTSDOWN;
+ Text = "dotsdown";
+ };
+ };
+ };
+ Text[ chinese_simplified ] = "其他";
+ Text[ russian ] = "橡铟邋";
+ Text[ polish ] = "R罂ne";
+ Text[ japanese ] = "偦偺懠";
+ Text[ chinese_traditional ] = "ㄤ";
+ Text[ dutch ] = "D~iversen";
+ Text[ chinese_simplified ] = "其他";
+ Text[ greek ] = "~拈荟锺";
+ Text[ korean ] = "扁鸥(~O)";
+ Text[ arabic ] = "闱 谙 嗅";
+ Text[ turkish ] = "Di餰r";
+ Text[ language_user1 ] = " ";
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/starmath/source/config.cxx b/starmath/source/config.cxx
new file mode 100644
index 000000000000..2a26b23275c3
--- /dev/null
+++ b/starmath/source/config.cxx
@@ -0,0 +1,381 @@
+/*************************************************************************
+ *
+ * $RCSfile: config.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifndef _SFXITEMSET_HXX //autogen
+#include <svtools/itemset.hxx>
+#endif
+#ifndef _SFXHINT_HXX //autogen
+#include <svtools/hint.hxx>
+#endif
+#ifndef _SFXSMPLHINT_HXX //autogen
+#include <svtools/smplhint.hxx>
+#endif
+#ifndef _SFX_INIMGR_HXX //autogen
+#include <sfx2/inimgr.hxx>
+#endif
+#ifndef _SFXSIDS_HRC //autogen
+#include <sfx2/sfxsids.hrc>
+#endif
+#ifndef _SFXENUMITEM_HXX //autogen
+#include <svtools/eitem.hxx>
+#endif
+#ifndef _SFXITEMPOOL_HXX //autogen
+#include <svtools/itempool.hxx>
+#endif
+#ifndef _SFXSTRITEM_HXX //autogen
+#include <svtools/stritem.hxx>
+#endif
+#ifndef _SFXINTITEM_HXX //autogen
+#include <svtools/intitem.hxx>
+#endif
+
+
+#ifndef CONFIG_HXX
+#include "config.hxx"
+#endif
+#ifndef FORMAT_HXX
+#include "format.hxx"
+#endif
+#ifndef _SMMOD_HXX
+#include "smmod.hxx"
+#endif
+#ifndef _STARMATH_HRC
+#include "starmath.hrc"
+#endif
+
+#define DEFSYMFILE "starmath$(lang).sms"
+#define CONFIGVERSION (INT16)0x0001;
+
+
+SmConfig::SmConfig() :
+ SfxConfigItem(SMCONFIGITEM)
+{
+ UseDefault();
+ StartListening(aStandardFormat);
+}
+
+
+SmConfig::~SmConfig()
+{
+ EndListening(aStandardFormat);
+}
+
+
+void SmConfig::SFX_NOTIFY(SfxBroadcaster &, const TypeId &,
+ const SfxHint &rHint, const TypeId &)
+{
+ switch (((SfxSimpleHint &) rHint).GetId())
+ {
+ case HINT_FORMATCHANGED:
+ SetModified(TRUE);
+ SetDefault (FALSE);
+ break;
+ }
+}
+
+
+void SmConfig::ConfigChangedAction()
+{
+ SetModified(TRUE);
+ SetDefault(FALSE);
+ //Broadcast(SfxSimpleHint(HINT_CONFIGCHANGED));
+}
+
+
+void SmConfig::SetValueIfNE(BOOL &rItem, const BOOL bVal)
+ // "Set 'Modified' and 'Value' if not equal"
+{
+ if (rItem != bVal)
+ { rItem = bVal;
+ ConfigChangedAction();
+ }
+}
+
+
+void SmConfig::SetSymbolFile(const String &rText)
+{
+ if (aSymbolFile != rText)
+ {
+ aSymbolFile = rText;
+ ConfigChangedAction();
+ }
+}
+
+
+int SmConfig::Load(SvStream &rStream)
+{
+ // Da die Fileformat Version in ConfigItems nur einen Defaultwert hat setzen
+ // wir diesen hier auf die aktuelle Version, damit beim folgenden (impliziten)
+ // einlesen des 'SmFormat' Objekts aus dem Stream dieses entsprechend
+ // reagieren kann.
+ rStream.SetVersion(SOFFICE_FILEFORMAT_NOW);
+
+ rStream >> *this;
+ SetDefault(FALSE);
+ return SfxConfigItem::ERR_OK;
+}
+
+
+BOOL SmConfig::Store(SvStream &rStream)
+{
+ rStream << *this;
+ return TRUE;
+}
+
+/**************************************************************************/
+
+void SmConfig::UseDefault()
+{
+ SfxConfigItem::UseDefault(); // this implicitly calls 'SetDefault(TRUE)'
+
+ bToolBoxVisible = bCmdBoxWindow = bAutoRedraw = bFormulaCursor =
+ bPrintTitle = bPrintText = bPrintFrame = bWarnNoSymbols =
+ bNoRightSpaces = TRUE;
+
+ aSymbolFile = C2S(DEFSYMFILE);
+ SfxIniManager* pIniMgr = SFX_INIMANAGER();
+ pIniMgr->SearchFile( aSymbolFile, SFX_KEY_USERCONFIG_PATH );
+
+ ePrintSize = PRINT_SIZE_NORMAL;
+ nPrintZoom = 100;
+}
+
+/**************************************************************************/
+
+String SmConfig::GetName() const
+{
+ return C2S("StarMath");
+}
+
+/**************************************************************************/
+
+void SmConfig::ItemSetToConfig(const SfxItemSet &rSet)
+{
+ const SfxPoolItem *pItem = NULL;
+ BOOL bModified = FALSE;
+ String aSymbolFile;
+
+ if (rSet.GetItemState(SID_SYMBOLFILE, TRUE, &pItem) == SFX_ITEM_SET)
+ { aSymbolFile = ((const SfxStringItem *) pItem)->GetValue();
+ DBG_ASSERT(aSymbolFile.Len() > 0, "Symboldatei nicht angegeben !");
+
+ if (aSymbolFile != aSymbolFile)
+ {
+ SfxModule *p = SM_MOD1();
+ SmModule *pp = (SmModule *) p;
+
+ pp->GetConfig()->SetWarnNoSymbols(TRUE);
+ aSymbolFile = aSymbolFile;
+
+ bModified = TRUE;
+ }
+ }
+
+ UINT16 nU16;
+ if (rSet.GetItemState(SID_PRINTSIZE, TRUE, &pItem) == SFX_ITEM_SET)
+ { nU16 = ((const SfxUInt16Item *) pItem)->GetValue();
+ if (ePrintSize != nU16)
+ { ePrintSize = (SmPrintSize) nU16;
+ bModified = TRUE;
+ }
+ }
+ if (rSet.GetItemState(SID_PRINTZOOM, TRUE, &pItem) == SFX_ITEM_SET)
+ { nU16 = ((const SfxUInt16Item *) pItem)->GetValue();
+ if (nPrintZoom != nU16)
+ { nPrintZoom = (USHORT) nU16;
+ bModified = TRUE;
+ }
+ }
+
+ BOOL bVal;
+ if (rSet.GetItemState(SID_PRINTTITLE, TRUE, &pItem) == SFX_ITEM_SET)
+ { bVal = ((const SfxBoolItem *) pItem)->GetValue();
+ if (bPrintTitle != bVal)
+ { bPrintTitle = bVal;
+ bModified = TRUE;
+ }
+ }
+ if (rSet.GetItemState(SID_PRINTTEXT, TRUE, &pItem) == SFX_ITEM_SET)
+ { bVal = ((const SfxBoolItem *) pItem)->GetValue();
+ if (bPrintText != bVal)
+ { bPrintText = bVal;
+ bModified = TRUE;
+ }
+ }
+ if (rSet.GetItemState(SID_PRINTFRAME, TRUE, &pItem) == SFX_ITEM_SET)
+ { bVal = ((const SfxBoolItem *) pItem)->GetValue();
+ if (bPrintFrame != bVal)
+ { bPrintFrame = bVal;
+ bModified = TRUE;
+ }
+ }
+ if (rSet.GetItemState(SID_AUTOREDRAW, TRUE, &pItem) == SFX_ITEM_SET)
+ { bVal = ((const SfxBoolItem *) pItem)->GetValue();
+ if (bAutoRedraw != bVal)
+ { bAutoRedraw = bVal;
+ bModified = TRUE;
+ }
+ }
+ if (rSet.GetItemState(SID_NO_RIGHT_SPACES, TRUE, &pItem) == SFX_ITEM_SET)
+ { bVal = ((const SfxBoolItem *) pItem)->GetValue();
+ if (bNoRightSpaces != bVal)
+ { bNoRightSpaces = bVal;
+ bModified = TRUE;
+
+ // (angezeigte) Formeln m黶sen entsprechen neu formatiert werden.
+ // Das erreichen wir mit:
+ Broadcast(SfxSimpleHint(HINT_FORMATCHANGED));
+ }
+ }
+
+ if (bModified)
+ ConfigChangedAction();
+}
+
+
+void SmConfig::ConfigToItemSet(SfxItemSet &rSet) const
+{
+ const SfxItemPool *pPool = rSet.GetPool();
+
+ rSet.Put(SfxStringItem(pPool->GetWhich(SID_SYMBOLFILE),
+ aSymbolFile));
+
+ rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTSIZE),
+ (UINT16) ePrintSize));
+ rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTZOOM),
+ (UINT16) nPrintZoom));
+
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTITLE), bPrintTitle));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTEXT), bPrintText));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTFRAME), bPrintFrame));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_AUTOREDRAW), bAutoRedraw));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_NO_RIGHT_SPACES), bNoRightSpaces));
+}
+
+
+/**************************************************************************/
+
+
+SvStream & operator << (SvStream &rStream, const SmConfig &rConfig)
+{
+ rStream << CONFIGVERSION;
+
+ UINT16 nFlags = rConfig.bPrintTitle
+ | (rConfig.bPrintText << 1)
+ | (rConfig.bPrintFrame << 2)
+ | (rConfig.bWarnNoSymbols << 3)
+ | (rConfig.bToolBoxVisible << 4)
+ | (rConfig.bCmdBoxWindow << 5)
+ | (rConfig.bAutoRedraw << 6)
+ | (rConfig.bFormulaCursor << 7)
+ | (rConfig.bNoRightSpaces << 8);
+
+ rStream << nFlags;
+
+ rStream << (INT16) rConfig.ePrintSize;
+ rStream << (INT16) rConfig.nPrintZoom;
+
+ rStream.WriteByteString(rConfig.aSymbolFile, gsl_getSystemTextEncoding());
+ rStream << rConfig.aStandardFormat;
+
+ for (int i = 0; i < 7; i++)
+ rStream << rConfig.vFontPickList[i];
+
+ return rStream;
+}
+
+
+SvStream & operator >> (SvStream &rStream, SmConfig &rConfig)
+{
+ INT16 nVer;
+ rStream >> nVer;
+
+ UINT16 nFlags;
+ rStream >> nFlags;
+
+ rConfig.bPrintTitle = nFlags & 0x01;
+ rConfig.bPrintText = (nFlags >> 1) & 0x01;
+ rConfig.bPrintFrame = (nFlags >> 2) & 0x01;
+ rConfig.bWarnNoSymbols = (nFlags >> 3) & 0x01;
+ rConfig.bToolBoxVisible = (nFlags >> 4) & 0x01;
+ rConfig.bCmdBoxWindow = (nFlags >> 5) & 0x01;
+ rConfig.bAutoRedraw = (nFlags >> 6) & 0x01;
+ rConfig.bFormulaCursor = (nFlags >> 7) & 0x01;
+ rConfig.bNoRightSpaces = (nFlags >> 8) & 0x01;
+
+ INT16 nI16;
+ rStream >> nI16;
+ rConfig.ePrintSize = (SmPrintSize) nI16;
+ rStream >> nI16;
+ rConfig.nPrintZoom = (USHORT) nI16;
+
+ rStream.ReadByteString(rConfig.aSymbolFile, gsl_getSystemTextEncoding());
+ rStream >> rConfig.aStandardFormat;
+
+ for (int i = 0; i < 7; i++)
+ rStream >> rConfig.vFontPickList[i];
+
+ return rStream;
+}
+
+
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
new file mode 100644
index 000000000000..056103b3c61b
--- /dev/null
+++ b/starmath/source/dialog.cxx
@@ -0,0 +1,2405 @@
+/*************************************************************************
+ *
+ * $RCSfile: dialog.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#define SMDLL 1
+
+#ifndef _TOOLS_RCID_H
+#include "tools/rcid.h"
+#endif
+
+#ifndef _SFXENUMITEM_HXX //autogen
+#include <svtools/eitem.hxx>
+#endif
+#ifndef _SFXINTITEM_HXX //autogen
+#include <svtools/intitem.hxx>
+#endif
+#ifndef _IODLG_HXX
+#include <sfx2/iodlg.hxx>
+#endif
+#ifndef _SFXSTRITEM_HXX //autogen
+#include <svtools/stritem.hxx>
+#endif
+#ifndef _SFXAPP_HXX //autogen
+#include <sfx2/app.hxx>
+#endif
+#ifndef _SV_MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#ifndef _CTRLTOOL_HXX //autogen
+#include <svtools/ctrltool.hxx>
+#endif
+#ifndef _SFX_PRINTER_HXX
+#include <sfx2/printer.hxx>
+#endif
+#ifndef _SV_SOUND_HXX //autogen
+#include <vcl/sound.hxx>
+#endif
+#ifndef _SV_SNDSTYLE_HXX //autogen
+#include <vcl/sndstyle.hxx>
+#endif
+#ifndef _SV_WAITOBJ_HXX
+#include <vcl/waitobj.hxx>
+#endif
+#ifndef _SFXDISPATCH_HXX //autogen
+#include <sfx2/dispatch.hxx>
+#endif
+#ifndef _SFX_HRC //autogen
+#include <sfx2/sfx.hrc>
+#endif
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+
+
+#ifndef CONFIG_HXX
+#include "config.hxx"
+#endif
+#ifndef DIALOG_HXX
+#include "dialog.hxx"
+#endif
+#ifndef _STARMATH_HRC
+#include "starmath.hrc"
+#endif
+#ifndef _SMMOD_HXX
+#include "smmod.hxx"
+#endif
+#ifndef SYMBOL_HXX
+#include "symbol.hxx"
+#endif
+#ifndef VIEW_HXX
+#include "view.hxx"
+#endif
+#ifndef DOCUMENT_HXX
+#include "document.hxx"
+#endif
+
+////////////////////////////////////////
+//
+// Da der FontStyle besser 黚er die Attribute gesetzt/abgefragt wird als 黚er
+// den StyleName bauen wir uns hier unsere eigene 躡ersetzung
+// Attribute <-> StyleName
+// Die Bits des Index stellen die Attribute dar:
+// Bit 0 : italic
+// Bit 1 : bold
+//
+
+static XubString __READONLY_DATA aStyleName[4] =
+{
+ C2S("normal"), C2S("italic"),
+ C2S("bold"), C2S("bold italic")
+};
+
+USHORT aStyleNameCount = sizeof(aStyleName) / sizeof(aStyleName[0]);
+
+
+const XubString GetFontStyleName(const Font &rFont)
+{
+ USHORT nIndex = 2 * (rFont.GetWeight() == WEIGHT_BOLD)
+ + 1 * (rFont.GetItalic() == ITALIC_NORMAL);
+ return aStyleName[nIndex];
+}
+
+
+void SetFontStyle(const XubString &rStyleName, Font &rFont)
+{
+ // finden des Index passend zum StyleName fuer den leeren StyleName wird
+ // 0 (nicht bold nicht italic) angenommen.
+ USHORT nIndex = 0;
+ if (rStyleName.Len())
+ {
+ USHORT i;
+ for (i = 0; i < aStyleNameCount; i++)
+ if (rStyleName.CompareTo(aStyleName[i]) == COMPARE_EQUAL)
+ break;
+ DBG_ASSERT(i < aStyleNameCount, "Sm : StyleName unbekannt");
+ nIndex = i;
+ }
+
+ rFont.SetItalic((nIndex & 0x1) ? ITALIC_NORMAL : ITALIC_NONE);
+ rFont.SetWeight((nIndex & 0x2) ? WEIGHT_BOLD : WEIGHT_NORMAL);
+}
+
+
+/**************************************************************************/
+
+SmAboutDialog::SmAboutDialog(Window *pParent, BOOL bFreeRes) :
+ ModalDialog (pParent, SmResId(RID_DEFAULTABOUT)),
+ aFixedText1 (this, ResId(1)),
+ aFixedText2 (this, ResId(2)),
+ aFixedText3 (this, ResId(3)),
+ aFixedText4 (this, ResId(4)),
+ aFixedText5 (this, ResId(5)),
+ aFixedText6 (this, ResId(6)),
+ aReleaseText (this, ResId(7)),
+ aFixedBitmap1(this, ResId(1)),
+ aOKButton1 (this, ResId(1))
+{
+ if (bFreeRes)
+ FreeResource();
+
+#ifndef PRODUCT
+ aReleaseText.Show();
+#else
+ aReleaseText.Hide();
+#endif
+
+}
+
+/**************************************************************************/
+
+
+IMPL_LINK_INLINE_START( SmPrintOptionsTabPage, SizeButtonClickHdl, Button *, pButton )
+{
+ aZoom.Enable(aSizeZoomed.IsChecked());
+ return 0;
+}
+IMPL_LINK_INLINE_END( SmPrintOptionsTabPage, SizeButtonClickHdl, Button *, pButton )
+
+
+SmPrintOptionsTabPage::SmPrintOptionsTabPage(Window *pParent, const SfxItemSet &rOptions)
+ : SfxTabPage(pParent, SmResId(RID_PRINTOPTIONPAGE), rOptions),
+ aGroupBox1 (this, ResId(1)),
+ aTitle (this, ResId(1)),
+ aText (this, ResId(2)),
+ aFrame (this, ResId(3)),
+ aGroupBox3 (this, ResId(3)),
+ aNoRightSpaces (this, ResId(4)),
+ aGroupBox2 (this, ResId(2)),
+ aSizeNormal (this, ResId(1)),
+ aSizeScaled (this, ResId(2)),
+ aSizeZoomed (this, ResId(3)),
+ aZoom (this, ResId(1))
+{
+ FreeResource();
+
+ aSizeNormal.SetClickHdl(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl));
+ aSizeScaled.SetClickHdl(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl));
+ aSizeZoomed.SetClickHdl(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl));
+
+ Reset(rOptions);
+}
+
+
+BOOL SmPrintOptionsTabPage::FillItemSet(SfxItemSet& rSet)
+{
+ UINT16 nPrintSize;
+ if (aSizeNormal.IsChecked())
+ nPrintSize = PRINT_SIZE_NORMAL;
+ else if (aSizeScaled.IsChecked())
+ nPrintSize = PRINT_SIZE_SCALED;
+ else
+ nPrintSize = PRINT_SIZE_ZOOMED;
+
+ rSet.Put(SfxUInt16Item(GetWhich(SID_PRINTSIZE), (UINT16) nPrintSize));
+ rSet.Put(SfxUInt16Item(GetWhich(SID_PRINTZOOM), (UINT16) aZoom.GetValue()));
+ rSet.Put(SfxBoolItem(GetWhich(SID_PRINTTITLE), aTitle.IsChecked()));
+ rSet.Put(SfxBoolItem(GetWhich(SID_PRINTTEXT), aText.IsChecked()));
+ rSet.Put(SfxBoolItem(GetWhich(SID_PRINTFRAME), aFrame.IsChecked()));
+ rSet.Put(SfxBoolItem(GetWhich(SID_NO_RIGHT_SPACES), aNoRightSpaces.IsChecked()));
+
+ return TRUE;
+}
+
+
+void SmPrintOptionsTabPage::Reset(const SfxItemSet& rSet)
+{
+ SmPrintSize ePrintSize = (SmPrintSize)((const SfxUInt16Item &)rSet.Get(GetWhich(SID_PRINTSIZE))).GetValue();
+
+ aSizeNormal.Check(ePrintSize == PRINT_SIZE_NORMAL);
+ aSizeScaled.Check(ePrintSize == PRINT_SIZE_SCALED);
+ aSizeZoomed.Check(ePrintSize == PRINT_SIZE_ZOOMED);
+
+ aZoom.Enable(aSizeZoomed.IsChecked());
+
+ aZoom.SetValue(((const SfxUInt16Item &)rSet.Get(GetWhich(SID_PRINTZOOM))).GetValue());
+
+ aTitle.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_PRINTTITLE))).GetValue());
+ aText.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_PRINTTEXT))).GetValue());
+ aFrame.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_PRINTFRAME))).GetValue());
+ aNoRightSpaces.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_NO_RIGHT_SPACES))).GetValue());
+}
+
+
+SfxTabPage* SmPrintOptionsTabPage::Create(Window* pWindow, const SfxItemSet& rSet)
+{
+ return (new SmPrintOptionsTabPage(pWindow, rSet));
+}
+
+/**************************************************************************/
+
+
+#ifdef NEVER
+SmExtraOptionsTabPage::SmExtraOptionsTabPage(const SfxItemSet& rInSet, Window * pParent, BOOL bFreeRes)
+ : SfxTabPage(pParent, SmResId(RID_EXTRAOPTIONPAGE), rInSet),
+ aAutoRedraw (this, ResId(1)),
+ aFixedText1 (this, ResId(1)),
+ aSymbolFile (this, ResId(2), 32),
+ aBrowseButton (this, ResId(1))
+{
+ if (bFreeRes)
+ FreeResource();
+
+ aBrowseButton.SetClickHdl(LINK(this, SmExtraOptionsTabPage, SymClickHdl));
+}
+
+
+IMPL_LINK( SmExtraOptionsTabPage, SymClickHdl, PushButton *, pPushButton )
+{
+ SfxSimpleFileDialog *pFileDialog =
+ new SfxSimpleFileDialog(this, WinBits(WB_OPEN | WB_3DLOOK));
+
+#ifdef MAC
+ pFileDialog->AddFilter(SmResId(RID_SYMBOLFILESSTR), SmResId(RID_FILESYMTYP));
+ pFileDialog->AddFilter(SmResId(RID_ALLFILESSTR), "****");
+
+ pFileDialog->SetCurFilter(SmResId(RID_SYMBOLFILESSTR));
+#else
+ pFileDialog->AddFilter(SmResId(RID_SYMBOLFILESSTR), C2S("*.sms"));
+ pFileDialog->AddFilter(SmResId(RID_ALLFILESSTR), C2S("*.*"));
+
+ pFileDialog->SetCurFilter(SmResId(RID_SYMBOLFILESSTR));
+
+ pFileDialog->SetDefaultExt(C2S("*.sms"));
+#endif
+
+ pFileDialog->SetPath(aSymbolFile.GetText());
+
+ if (pFileDialog->Execute() == RET_OK)
+ aSymbolFile.SetText(pFileDialog->GetPath());
+
+ delete pFileDialog;
+ return 0;
+}
+
+
+BOOL SmExtraOptionsTabPage::FillItemSet(SfxItemSet& rOutSet)
+{
+ rOutSet.Put(SfxBoolItem(GetWhich(SID_AUTOREDRAW), aAutoRedraw.IsChecked()));
+ rOutSet.Put(SfxStringItem(GetWhich(SID_SYMBOLFILE), aSymbolFile.GetText()));
+
+ return (TRUE);
+}
+
+
+void SmExtraOptionsTabPage::Reset(const SfxItemSet& rOutSet)
+{
+ aAutoRedraw.Check(((const SfxBoolItem&)rOutSet.Get(GetWhich(SID_AUTOREDRAW))).GetValue());
+ aSymbolFile.SetText(((const SfxStringItem&)rOutSet.Get(GetWhich(SID_SYMBOLFILE))).GetValue());
+}
+
+
+SfxTabPage* SmExtraOptionsTabPage::Create(Window* pWindow, const SfxItemSet& rSet)
+{
+ return (new SmExtraOptionsTabPage(rSet, pWindow));
+}
+#endif //NEVER
+
+/**************************************************************************/
+
+
+void SmShowFont::Paint(const Rectangle&)
+{
+ XubString Text (GetFont().GetName());
+ Size TextSize(GetTextWidth(Text), GetTextHeight());
+
+ DrawText(Point((GetOutputSize().Width() - TextSize.Width()) / 2,
+ (GetOutputSize().Height() - TextSize.Height()) / 2), Text);
+}
+
+
+void SmShowFont::SetFont(const Font& rFont)
+{
+ Font aFont (rFont);
+
+ Invalidate();
+ aFont.SetSize(Size(0, 24));
+ aFont.SetAlign(ALIGN_TOP);
+ Control::SetFont(aFont);
+}
+
+
+IMPL_LINK_INLINE_START( SmFontDialog, FontChangeHdl, ComboBox *, pComboBox )
+{
+ Face.SetName(pComboBox->GetText());
+ aShowFont.SetFont(Face);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SmFontDialog, FontChangeHdl, ComboBox *, pComboBox )
+
+
+IMPL_LINK( SmFontDialog, AttrChangeHdl, CheckBox *, pCheckBox )
+{
+ if (aBoldCheckBox.IsChecked())
+ Face.SetWeight(FontWeight(WEIGHT_BOLD));
+ else
+ Face.SetWeight(FontWeight(WEIGHT_NORMAL));
+
+ if (aItalicCheckBox.IsChecked())
+ Face.SetItalic(ITALIC_NORMAL);
+ else
+ Face.SetItalic(ITALIC_NONE);
+
+ aShowFont.SetFont(Face);
+ return 0;
+}
+
+
+void SmFontDialog::SetFont(const Font &rFont)
+{
+ Face = rFont;
+
+ aFontBox.SetText(Face.GetName());
+ aBoldCheckBox.Check(Face.GetWeight() == WEIGHT_BOLD);
+ aItalicCheckBox.Check(Face.GetItalic() != ITALIC_NONE);
+
+ aShowFont.SetFont(Face);
+}
+
+
+SmFontDialog::SmFontDialog(Window * pParent, BOOL bFreeRes)
+ : ModalDialog(pParent,SmResId(RID_FONTDIALOG)),
+ aFixedText1 (this, ResId(1)),
+ aFontBox (this, ResId(1)),
+ aBoldCheckBox (this, ResId(1)),
+ aItalicCheckBox (this, ResId(2)),
+ aOKButton1 (this, ResId(1)),
+ aCancelButton1 (this, ResId(1)),
+ aShowFont (this, ResId(1)),
+ aGroupBox1 (this, ResId(1)),
+ aGroupBox2 (this, ResId(2))
+{
+ if (bFreeRes)
+ FreeResource();
+
+ {
+ WaitObject( this );
+ //Application::EnterWait();
+
+ // get FontList from printer (if possible), otherwise from application window
+ SmViewShell *pView = SmGetActiveView();
+ DBG_ASSERT(pView, "Sm : NULL pointer");
+ OutputDevice *pDev = pView->GetDoc()->GetPrinter();
+ if (!pDev || pDev->GetDevFontCount() == 0)
+ pDev = &pView->GetGraphicWindow();
+ FontList aFontList(pDev);
+
+ USHORT nCount = aFontList.GetFontNameCount();
+ for (USHORT i = 0; i < nCount; i++)
+ aFontBox.InsertEntry( aFontList.GetFontName(i).GetName() );
+
+ Face.SetSize(Size(0, 24));
+ Face.SetWeight(WEIGHT_NORMAL);
+ Face.SetItalic(ITALIC_NONE);
+ Face.SetFamily(FAMILY_DONTKNOW);
+ Face.SetPitch(PITCH_DONTKNOW);
+ Face.SetCharSet(RTL_TEXTENCODING_DONTKNOW);
+ Face.SetTransparent(TRUE);
+
+ aShowFont.SetFillColor( Color(COL_LIGHTGRAY) );
+
+ //Application::LeaveWait();
+ }
+
+ aFontBox.SetSelectHdl(LINK(this, SmFontDialog, FontChangeHdl));
+ aBoldCheckBox.SetClickHdl(LINK(this, SmFontDialog, AttrChangeHdl));
+ aItalicCheckBox.SetClickHdl(LINK(this, SmFontDialog, AttrChangeHdl));
+}
+
+/**************************************************************************/
+
+
+IMPL_LINK( SmFontSizeDialog, DefaultButtonClickHdl, Button *, pButton )
+{
+ QueryBox *pQueryBox = new QueryBox(this, SmResId(RID_DEFAULTSAVEQUERY));
+
+ if (pQueryBox->Execute() == RET_YES)
+ {
+ SmModule *pp = SM_MOD1();
+ WriteTo(pp->GetConfig()->GetFormat());
+ }
+
+ delete pQueryBox;
+ return 0;
+}
+
+
+SmFontSizeDialog::SmFontSizeDialog(Window * pParent, BOOL bFreeRes)
+ : ModalDialog(pParent, SmResId(RID_FONTSIZEDIALOG)),
+ aFixedText1(this, ResId(1)),
+ aBaseSize(this, ResId(1)),
+ aFixedText4(this, ResId(4)),
+ aTextSize(this, ResId(4)),
+ aFixedText5(this, ResId(5)),
+ aIndexSize(this, ResId(5)),
+ aFixedText6(this, ResId(6)),
+ aFunctionSize(this, ResId(6)),
+ aFixedText7(this, ResId(7)),
+ aOperatorSize(this, ResId(7)),
+ aFixedText8(this, ResId(8)),
+ aBorderSize(this, ResId(8)),
+ aGroupBox1(this, ResId(1)),
+ aOKButton1(this, ResId(1)),
+ aCancelButton1(this, ResId(1)),
+ aDefaultButton(this, ResId(1))
+{
+ if (bFreeRes)
+ FreeResource();
+
+ aDefaultButton.SetClickHdl(LINK(this, SmFontSizeDialog, DefaultButtonClickHdl));
+}
+
+
+void SmFontSizeDialog::ReadFrom(const SmFormat &rFormat)
+{
+ //! aufpassen: richtig runden!
+ aBaseSize.SetValue( SmRoundFraction(
+ Sm100th_mmToPts( rFormat.GetBaseSize().Height() ) ) );
+
+ aTextSize .SetValue( rFormat.GetRelSize(SIZ_TEXT) );
+ aIndexSize .SetValue( rFormat.GetRelSize(SIZ_INDEX) );
+ aFunctionSize.SetValue( rFormat.GetRelSize(SIZ_FUNCTION) );
+ aOperatorSize.SetValue( rFormat.GetRelSize(SIZ_OPERATOR) );
+ aBorderSize .SetValue( rFormat.GetRelSize(SIZ_LIMITS) );
+}
+
+
+void SmFontSizeDialog::WriteTo(SmFormat &rFormat) const
+{
+ rFormat.SetBaseSize( Size(0, SmPtsTo100th_mm(aBaseSize.GetValue())) );
+
+ rFormat.SetRelSize(SIZ_TEXT, (USHORT) aTextSize .GetValue());
+ rFormat.SetRelSize(SIZ_INDEX, (USHORT) aIndexSize .GetValue());
+ rFormat.SetRelSize(SIZ_FUNCTION, (USHORT) aFunctionSize.GetValue());
+ rFormat.SetRelSize(SIZ_OPERATOR, (USHORT) aOperatorSize.GetValue());
+ rFormat.SetRelSize(SIZ_LIMITS, (USHORT) aBorderSize .GetValue());
+
+ const Size aTmp (rFormat.GetBaseSize());
+ for (USHORT i = FNT_BEGIN; i <= FNT_END; i++)
+ rFormat.Font(i).SetSize(aTmp);
+
+ rFormat.RequestApplyChanges();
+}
+
+
+/**************************************************************************/
+
+
+IMPL_LINK( SmFontTypeDialog, MenuSelectHdl, Menu *, pMenu )
+{
+ SmFontPickListBox *pActiveListBox;
+
+ switch (pMenu->GetCurItemId())
+ {
+ case 1: pActiveListBox = &aVariableFont; break;
+ case 2: pActiveListBox = &aFunctionFont; break;
+ case 3: pActiveListBox = &aNumberFont; break;
+ case 4: pActiveListBox = &aTextFont; break;
+ case 5: pActiveListBox = &aSerifFont; break;
+ case 6: pActiveListBox = &aSansFont; break;
+ case 7: pActiveListBox = &aFixedFont; break;
+ default:pActiveListBox = NULL;
+ }
+
+ if (pActiveListBox)
+ {
+ SmFontDialog *pFontDialog = new SmFontDialog(this);
+
+ pActiveListBox->WriteTo(*pFontDialog);
+ if (pFontDialog->Execute() == RET_OK)
+ pActiveListBox->ReadFrom(*pFontDialog);
+ delete pFontDialog;
+ }
+ return 0;
+}
+
+
+IMPL_LINK_INLINE_START( SmFontTypeDialog, DefaultButtonClickHdl, Button *, pButton )
+{
+ QueryBox *pQueryBox = new QueryBox(this, SmResId(RID_DEFAULTSAVEQUERY));
+ if (pQueryBox->Execute() == RET_YES)
+ {
+ SmModule *pp = SM_MOD1();
+ WriteTo(pp->GetConfig()->GetFormat());
+ }
+
+ delete pQueryBox;
+ return 0;
+}
+IMPL_LINK_INLINE_END( SmFontTypeDialog, DefaultButtonClickHdl, Button *, pButton )
+
+
+SmFontTypeDialog::SmFontTypeDialog(Window * pParent, BOOL bFreeRes)
+ : ModalDialog(pParent, SmResId(RID_FONTTYPEDIALOG)),
+ aFixedText1 (this, ResId(1)),
+ aVariableFont (this, ResId(1)),
+ aFixedText2 (this, ResId(2)),
+ aFunctionFont (this, ResId(2)),
+ aFixedText3 (this, ResId(3)),
+ aNumberFont (this, ResId(3)),
+ aFixedText4 (this, ResId(4)),
+ aTextFont (this, ResId(4)),
+ aFixedText5 (this, ResId(5)),
+ aSerifFont (this, ResId(5)),
+ aFixedText6 (this, ResId(6)),
+ aSansFont (this, ResId(6)),
+ aFixedText7 (this, ResId(7)),
+ aFixedFont (this, ResId(7)),
+ aGroupBox1 (this, ResId(1)),
+ aGroupBox2 (this, ResId(2)),
+ aOKButton1 (this, ResId(1)),
+ aCancelButton1 (this, ResId(1)),
+ aMenuButton (this, ResId(1)),
+ aDefaultButton (this, ResId(2))
+{
+ if (bFreeRes)
+ FreeResource();
+
+ aDefaultButton.SetClickHdl(LINK(this, SmFontTypeDialog, DefaultButtonClickHdl));
+
+ aMenuButton.GetPopupMenu()->SetSelectHdl(LINK(this, SmFontTypeDialog, MenuSelectHdl));
+}
+
+void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat)
+{
+ SmModule *pp = SM_MOD1();
+
+ aVariableFont = pp->GetConfig()->GetFontPickList(FNT_VARIABLE);
+ aFunctionFont = pp->GetConfig()->GetFontPickList(FNT_FUNCTION);
+ aNumberFont = pp->GetConfig()->GetFontPickList(FNT_NUMBER);
+ aTextFont = pp->GetConfig()->GetFontPickList(FNT_TEXT);
+ aSerifFont = pp->GetConfig()->GetFontPickList(FNT_SERIF);
+ aSansFont = pp->GetConfig()->GetFontPickList(FNT_SANS);
+ aFixedFont = pp->GetConfig()->GetFontPickList(FNT_FIXED);
+
+ aVariableFont.Insert( rFormat.GetFont(FNT_VARIABLE) );
+ aFunctionFont.Insert( rFormat.GetFont(FNT_FUNCTION) );
+ aNumberFont .Insert( rFormat.GetFont(FNT_NUMBER) );
+ aTextFont .Insert( rFormat.GetFont(FNT_TEXT) );
+ aSerifFont .Insert( rFormat.GetFont(FNT_SERIF) );
+ aSansFont .Insert( rFormat.GetFont(FNT_SANS) );
+ aFixedFont .Insert( rFormat.GetFont(FNT_FIXED) );
+}
+
+
+void SmFontTypeDialog::WriteTo(SmFormat &rFormat) const
+{
+ SmModule *pp = SM_MOD1();
+
+ pp->GetConfig()->GetFontPickList(FNT_VARIABLE) = aVariableFont;
+ pp->GetConfig()->GetFontPickList(FNT_FUNCTION) = aFunctionFont;
+ pp->GetConfig()->GetFontPickList(FNT_NUMBER) = aNumberFont;
+ pp->GetConfig()->GetFontPickList(FNT_TEXT) = aTextFont;
+ pp->GetConfig()->GetFontPickList(FNT_SERIF) = aSerifFont;
+ pp->GetConfig()->GetFontPickList(FNT_SANS) = aSansFont;
+ pp->GetConfig()->GetFontPickList(FNT_FIXED) = aFixedFont;
+
+ rFormat.SetFont( FNT_VARIABLE, aVariableFont.Get(0) );
+ rFormat.SetFont( FNT_FUNCTION, aFunctionFont.Get(0) );
+ rFormat.SetFont( FNT_NUMBER, aNumberFont .Get(0) );
+ rFormat.SetFont( FNT_TEXT, aTextFont .Get(0) );
+ rFormat.SetFont( FNT_SERIF, aSerifFont .Get(0) );
+ rFormat.SetFont( FNT_SANS, aSansFont .Get(0) );
+ rFormat.SetFont( FNT_FIXED, aFixedFont .Get(0) );
+
+ for (USHORT i = FNT_BEGIN; i <= FNT_FIXED; i++)
+ rFormat.Font(i).SetTransparent(TRUE);
+
+ rFormat.RequestApplyChanges();
+}
+
+/**************************************************************************/
+
+struct FieldMinMax
+{
+ USHORT nMin, nMax;
+};
+
+// Data for min and max values of the 4 metric fields
+// for each of the 10 categories
+static const FieldMinMax pMinMaxData[10][4] =
+{
+ // 0
+ {{ 0, 200 }, { 0, 200 }, { 0, 100 }, { 0, 0 }},
+ // 1
+ {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
+ // 2
+ {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
+ // 3
+ {{ 0, 100 }, { 1, 100 }, { 0, 0 }, { 0, 0 }},
+ // 4
+ {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
+ // 5
+ {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 100 }},
+ // 6
+ {{ 0, 300 }, { 0, 300 }, { 0, 0 }, { 0, 0 }},
+ // 7
+ {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
+ // 8
+ {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
+ // 9
+ {{ 0, 10000 }, { 0, 10000 }, { 0, 10000 }, { 0, 10000 }}
+};
+
+SmCategoryDesc::SmCategoryDesc(const ResId& rResId, USHORT nCategoryIdx) :
+ Resource(rResId)
+{
+ if (IsAvailableRes(ResId(1).SetRT(RSC_STRING)))
+ {
+ Name = XubString(ResId(1));
+
+ int i;
+ for (i = 0; i < 4; i++)
+ {
+ int nI2 = i + 2;
+
+ if (IsAvailableRes(ResId(nI2).SetRT(RSC_STRING)))
+ {
+ Strings[i] = new XubString(ResId(nI2));
+ Graphics[i] = new Bitmap(ResId(nI2));
+ }
+ else
+ {
+ Strings[i] = 0;
+ Graphics[i] = 0;
+ }
+ }
+
+ for (i = 0; i < 4; i++)
+ {
+ const FieldMinMax &rMinMax = pMinMaxData[ nCategoryIdx ][i];
+ Value[i] = Minimum[i] = rMinMax.nMin;
+ Maximum[i] = rMinMax.nMax;
+ }
+ }
+
+ FreeResource();
+}
+
+
+SmCategoryDesc::~SmCategoryDesc()
+{
+ for (int i = 0; i < 4; i++)
+ {
+ delete Strings[i];
+ delete Graphics[i];
+ }
+}
+
+/**************************************************************************/
+
+IMPL_LINK( SmDistanceDialog, GetFocusHdl, Control *, pControl )
+{
+ if (Categories[nActiveCategory])
+ {
+ USHORT i;
+
+ if (pControl == &aMetricField1)
+ i = 0;
+ else if (pControl == &aMetricField2)
+ i = 1;
+ else if (pControl == &aMetricField3)
+ i = 2;
+ else if (pControl == &aMetricField4)
+ i = 3;
+ else
+ return 0;
+ aBitmap.SetBitmap(*(Categories[nActiveCategory]->GetGraphic(i)));
+ }
+ return 0;
+}
+
+IMPL_LINK( SmDistanceDialog, MenuSelectHdl, Menu *, pMenu )
+{
+ SetCategory(pMenu->GetCurItemId() - 1);
+ return 0;
+}
+
+
+IMPL_LINK( SmDistanceDialog, DefaultButtonClickHdl, Button *, pButton )
+{
+ QueryBox *pQueryBox = new QueryBox(this, SmResId(RID_DEFAULTSAVEQUERY));
+
+ if (pQueryBox->Execute() == RET_YES)
+ {
+ SmModule *pp = SM_MOD1();
+ WriteTo(pp->GetConfig()->GetFormat());
+ }
+ delete pQueryBox;
+ return 0;
+}
+
+
+IMPL_LINK( SmDistanceDialog, CheckBoxClickHdl, CheckBox *, pCheckBox )
+{
+ if (pCheckBox == &aCheckBox1)
+ {
+ aCheckBox1.Toggle();
+
+ BOOL bChecked = aCheckBox1.IsChecked();
+ aFixedText4 .Enable( bChecked );
+ aMetricField4.Enable( bChecked );
+ }
+ return 0;
+}
+
+
+void SmDistanceDialog::SetHelpId(MetricField &rField, ULONG nHelpId)
+{
+ //! HelpID's die auf diese Weise explizit gesetzt werden, m黶sen im
+ //! util Verzeichnis im File "hidother.src" mit Hilfe von "hidspecial"
+ //! definiert werden!
+
+ const XubString aEmptyText;
+ DBG_ASSERT(aEmptyText.Len() == 0, "Sm: Ooops...");
+
+ rField.SetHelpId(nHelpId);
+ rField.SetHelpText(aEmptyText);
+
+ // since MetricField inherits from SpinField which has a sub Edit field
+ // (which is actually the one we modify) we have to set the help-id
+ // for it too.
+ Edit *pSubEdit = rField.GetSubEdit();
+ if (pSubEdit)
+ { pSubEdit->SetHelpId(nHelpId);
+ pSubEdit->SetHelpText(aEmptyText);
+ }
+}
+
+
+void SmDistanceDialog::SetCategory(USHORT nCategory)
+{
+ DBG_ASSERT(0 <= nCategory && nCategory < NOCATEGORIES,
+ "Sm: falsche Kategorienummer in SmDistanceDialog");
+
+ // array to convert category- and metricfield-number in help ids.
+ // 0 is used in case of unused combinations.
+ DBG_ASSERT(NOCATEGORIES == 10, "Sm : Array pa遲 nicht zu Anzahl der Kategorien");
+ ULONG __READONLY_DATA aCatMf2Hid[10][4] =
+ {
+ HID_SMA_DEFAULT_DIST, HID_SMA_LINE_DIST, HID_SMA_ROOT_DIST, 0,
+ HID_SMA_SUP_DIST, HID_SMA_SUB_DIST , 0, 0,
+ HID_SMA_NUMERATOR_DIST, HID_SMA_DENOMINATOR_DIST, 0, 0,
+ HID_SMA_FRACLINE_EXCWIDTH, HID_SMA_FRACLINE_LINEWIDTH, 0, 0,
+ HID_SMA_UPPERLIMIT_DIST, HID_SMA_LOWERLIMIT_DIST, 0, 0,
+ HID_SMA_BRACKET_EXCHEIGHT, HID_SMA_BRACKET_DIST, 0, HID_SMA_BRACKET_EXCHEIGHT2,
+ HID_SMA_MATRIXROW_DIST, HID_SMA_MATRIXCOL_DIST, 0, 0,
+ HID_SMA_ATTRIBUT_DIST, HID_SMA_INTERATTRIBUT_DIST, 0, 0,
+ HID_SMA_OPERATOR_EXCHEIGHT, HID_SMA_OPERATOR_DIST, 0, 0,
+ HID_SMA_LEFTBORDER_DIST, HID_SMA_RIGHTBORDER_DIST, HID_SMA_UPPERBORDER_DIST, HID_SMA_LOWERBORDER_DIST
+ };
+
+ // array to help iterate over the controls
+ Window * __READONLY_DATA aWin[4][2] =
+ {
+ &aFixedText1, &aMetricField1,
+ &aFixedText2, &aMetricField2,
+ &aFixedText3, &aMetricField3,
+ &aFixedText4, &aMetricField4
+ };
+
+ SmCategoryDesc *pCat;
+
+ // merken der (evtl neuen) Einstellungen der aktiven SmCategoryDesc
+ // bevor zu der neuen gewechselt wird.
+ if (nActiveCategory != CATEGORY_NONE)
+ {
+ pCat = Categories[nActiveCategory];
+ pCat->SetValue(0, (USHORT) aMetricField1.GetValue());
+ pCat->SetValue(1, (USHORT) aMetricField2.GetValue());
+ pCat->SetValue(2, (USHORT) aMetricField3.GetValue());
+ pCat->SetValue(3, (USHORT) aMetricField4.GetValue());
+
+ if (nActiveCategory == 5)
+ bScaleAllBrackets = aCheckBox1.IsChecked();
+
+ aMenuButton.GetPopupMenu()->CheckItem(nActiveCategory + 1, FALSE);
+ }
+
+ // aktivieren/deaktivieren der zugeh鰎igen Controls in Abh鋘gigkeit von der
+ // gew鋒lten Kategorie.
+ BOOL bActive;
+ for (int i = 0; i < 4; i++)
+ {
+ FixedText *pFT = (FixedText * const) aWin[i][0];
+ MetricField *pMF = (MetricField * const) aWin[i][1];
+
+ // Um feststellen welche Controls aktiv sein sollen wird das
+ // vorhandensein einer zugeh鰎igen HelpID 黚erpr黤t.
+ bActive = aCatMf2Hid[nCategory][i] != 0;
+
+ pFT->Show(bActive);
+ pFT->Enable(bActive);
+ pMF->Show(bActive);
+ pMF->Enable(bActive);
+
+ // setzen von Ma遝inheit und Anzahl der Nachkommastellen
+ FieldUnit eUnit;
+ USHORT nDigits;
+ if (nCategory < 9)
+ {
+ eUnit = FUNIT_CUSTOM;
+ nDigits = 0;
+ pMF->SetCustomUnitText( '%' );
+ }
+ else
+ {
+ eUnit = FUNIT_100TH_MM;
+ nDigits = 2;
+ }
+ pMF->SetUnit(eUnit); //! ver鋘dert den Wert
+ pMF->SetDecimalDigits(nDigits);
+
+ if (bActive)
+ {
+ pCat = Categories[nCategory];
+ pFT->SetText(*pCat->GetString(i));
+
+ pMF->SetMin(pCat->GetMinimum(i));
+ pMF->SetMax(pCat->GetMaximum(i));
+ pMF->SetValue(pCat->GetValue(i));
+
+ SetHelpId(*pMF, aCatMf2Hid[nCategory][i]);
+ }
+ }
+ // nun noch die CheckBox und das zugeh鰎ige MetricField genau dann aktivieren,
+ // falls es sich um das Klammer Menu handelt.
+ bActive = nCategory == 5;
+ aCheckBox1.Show(bActive);
+ aCheckBox1.Enable(bActive);
+ if (bActive)
+ {
+ aCheckBox1.Check( bScaleAllBrackets );
+
+ BOOL bChecked = aCheckBox1.IsChecked();
+ aFixedText4 .Enable( bChecked );
+ aMetricField4.Enable( bChecked );
+ }
+
+ aMenuButton.GetPopupMenu()->CheckItem(nCategory + 1, TRUE);
+ aGroupBox.SetText(Categories[nCategory]->GetName());
+
+ nActiveCategory = nCategory;
+
+ aMetricField1.GrabFocus();
+ Invalidate();
+ Update();
+}
+
+
+SmDistanceDialog::SmDistanceDialog(Window *pParent, BOOL bFreeRes)
+ : ModalDialog(pParent, SmResId(RID_DISTANCEDIALOG)),
+ aFixedText1 (this, ResId(1)),
+ aFixedText2 (this, ResId(2)),
+ aFixedText3 (this, ResId(3)),
+ aFixedText4 (this, ResId(4)),
+ aMetricField1 (this, ResId(1)),
+ aMetricField2 (this, ResId(2)),
+ aMetricField3 (this, ResId(3)),
+ aMetricField4 (this, ResId(4)),
+ aOKButton1 (this, ResId(1)),
+ aCancelButton1 (this, ResId(1)),
+ aMenuButton (this, ResId(1)),
+ aDefaultButton (this, ResId(1)),
+ aCheckBox1 (this, ResId(1)),
+ aBitmap (this, ResId(1)),
+ aGroupBox (this, ResId(1))
+{
+ for (int i = 0; i < NOCATEGORIES; i++)
+ Categories[i] = new SmCategoryDesc(SmResId(i + 1), i);
+ nActiveCategory = CATEGORY_NONE;
+ bScaleAllBrackets = FALSE;
+
+ if (bFreeRes)
+ FreeResource();
+
+ aMetricField1.SetGetFocusHdl(LINK(this, SmDistanceDialog, GetFocusHdl));
+ aMetricField2.SetGetFocusHdl(LINK(this, SmDistanceDialog, GetFocusHdl));
+ aMetricField3.SetGetFocusHdl(LINK(this, SmDistanceDialog, GetFocusHdl));
+ aMetricField4.SetGetFocusHdl(LINK(this, SmDistanceDialog, GetFocusHdl));
+ aCheckBox1.SetClickHdl(LINK(this, SmDistanceDialog, CheckBoxClickHdl));
+
+ aMenuButton.GetPopupMenu()->SetSelectHdl(LINK(this, SmDistanceDialog, MenuSelectHdl));
+
+ aDefaultButton.SetClickHdl(LINK(this, SmDistanceDialog, DefaultButtonClickHdl));
+ }
+
+
+SmDistanceDialog::~SmDistanceDialog()
+{
+ for (int i = 0; i < NOCATEGORIES; i++)
+ DELETEZ(Categories[i]);
+}
+
+
+void SmDistanceDialog::ReadFrom(const SmFormat &rFormat)
+{
+ Categories[0]->SetValue(0, rFormat.GetDistance(DIS_HORIZONTAL));
+ Categories[0]->SetValue(1, rFormat.GetDistance(DIS_VERTICAL));
+ Categories[0]->SetValue(2, rFormat.GetDistance(DIS_ROOT));
+ Categories[1]->SetValue(0, rFormat.GetDistance(DIS_SUPERSCRIPT));
+ Categories[1]->SetValue(1, rFormat.GetDistance(DIS_SUBSCRIPT));
+ Categories[2]->SetValue(0, rFormat.GetDistance(DIS_NUMERATOR));
+ Categories[2]->SetValue(1, rFormat.GetDistance(DIS_DENOMINATOR));
+ Categories[3]->SetValue(0, rFormat.GetDistance(DIS_FRACTION));
+ Categories[3]->SetValue(1, rFormat.GetDistance(DIS_STROKEWIDTH));
+ Categories[4]->SetValue(0, rFormat.GetDistance(DIS_UPPERLIMIT));
+ Categories[4]->SetValue(1, rFormat.GetDistance(DIS_LOWERLIMIT));
+ Categories[5]->SetValue(0, rFormat.GetDistance(DIS_BRACKETSIZE));
+ Categories[5]->SetValue(1, rFormat.GetDistance(DIS_BRACKETSPACE));
+ Categories[5]->SetValue(3, rFormat.GetDistance(DIS_NORMALBRACKETSIZE));
+ Categories[6]->SetValue(0, rFormat.GetDistance(DIS_MATRIXROW));
+ Categories[6]->SetValue(1, rFormat.GetDistance(DIS_MATRIXCOL));
+ Categories[7]->SetValue(0, rFormat.GetDistance(DIS_ORNAMENTSIZE));
+ Categories[7]->SetValue(1, rFormat.GetDistance(DIS_ORNAMENTSPACE));
+ Categories[8]->SetValue(0, rFormat.GetDistance(DIS_OPERATORSIZE));
+ Categories[8]->SetValue(1, rFormat.GetDistance(DIS_OPERATORSPACE));
+ Categories[9]->SetValue(0, rFormat.GetDistance(DIS_LEFTSPACE));
+ Categories[9]->SetValue(1, rFormat.GetDistance(DIS_RIGHTSPACE));
+ Categories[9]->SetValue(2, rFormat.GetDistance(DIS_TOPSPACE));
+ Categories[9]->SetValue(3, rFormat.GetDistance(DIS_BOTTOMSPACE));
+
+ bScaleAllBrackets = rFormat.IsScaleNormalBrackets();
+
+ // force update (even of category 0) by setting nActiveCategory to a
+ // non-existent category number
+ nActiveCategory = CATEGORY_NONE;
+ SetCategory(0);
+}
+
+
+void SmDistanceDialog::WriteTo(SmFormat &rFormat) /*const*/
+{
+ // hmm... k攏nen die tats刢hlich unterschiedlich sein?
+ // wenn nicht kann oben n刴lich das const stehen!
+ SetCategory(nActiveCategory);
+
+ rFormat.SetDistance( DIS_HORIZONTAL, Categories[0]->GetValue(0) );
+ rFormat.SetDistance( DIS_VERTICAL, Categories[0]->GetValue(1) );
+ rFormat.SetDistance( DIS_ROOT, Categories[0]->GetValue(2) );
+ rFormat.SetDistance( DIS_SUPERSCRIPT, Categories[1]->GetValue(0) );
+ rFormat.SetDistance( DIS_SUBSCRIPT, Categories[1]->GetValue(1) );
+ rFormat.SetDistance( DIS_NUMERATOR, Categories[2]->GetValue(0) );
+ rFormat.SetDistance( DIS_DENOMINATOR, Categories[2]->GetValue(1) );
+ rFormat.SetDistance( DIS_FRACTION, Categories[3]->GetValue(0) );
+ rFormat.SetDistance( DIS_STROKEWIDTH, Categories[3]->GetValue(1) );
+ rFormat.SetDistance( DIS_UPPERLIMIT, Categories[4]->GetValue(0) );
+ rFormat.SetDistance( DIS_LOWERLIMIT, Categories[4]->GetValue(1) );
+ rFormat.SetDistance( DIS_BRACKETSIZE, Categories[5]->GetValue(0) );
+ rFormat.SetDistance( DIS_BRACKETSPACE, Categories[5]->GetValue(1) );
+ rFormat.SetDistance( DIS_MATRIXROW, Categories[6]->GetValue(0) );
+ rFormat.SetDistance( DIS_MATRIXCOL, Categories[6]->GetValue(1) );
+ rFormat.SetDistance( DIS_ORNAMENTSIZE, Categories[7]->GetValue(0) );
+ rFormat.SetDistance( DIS_ORNAMENTSPACE, Categories[7]->GetValue(1) );
+ rFormat.SetDistance( DIS_OPERATORSIZE, Categories[8]->GetValue(0) );
+ rFormat.SetDistance( DIS_OPERATORSPACE, Categories[8]->GetValue(1) );
+ rFormat.SetDistance( DIS_LEFTSPACE, Categories[9]->GetValue(0) );
+ rFormat.SetDistance( DIS_RIGHTSPACE, Categories[9]->GetValue(1) );
+ rFormat.SetDistance( DIS_TOPSPACE, Categories[9]->GetValue(2) );
+ rFormat.SetDistance( DIS_BOTTOMSPACE, Categories[9]->GetValue(3) );
+ rFormat.SetDistance( DIS_NORMALBRACKETSIZE, Categories[5]->GetValue(3) );
+
+ rFormat.SetScaleNormalBrackets( bScaleAllBrackets );
+
+ rFormat.RequestApplyChanges();
+}
+
+
+/**************************************************************************/
+
+
+IMPL_LINK( SmAlignDialog, DefaultButtonClickHdl, Button *, pButton )
+{
+ QueryBox *pQueryBox = new QueryBox(this, SmResId(RID_DEFAULTSAVEQUERY));
+
+ if (pQueryBox->Execute() == RET_YES)
+ {
+ SmModule *pp = SM_MOD1();
+ WriteTo(pp->GetConfig()->GetFormat());
+ }
+
+ delete pQueryBox;
+ return 0;
+}
+
+
+SmAlignDialog::SmAlignDialog(Window * pParent, BOOL bFreeRes)
+ : ModalDialog(pParent, SmResId(RID_ALIGNDIALOG)),
+ aLeft (this, ResId(1)),
+ aCenter (this, ResId(2)),
+ aRight (this, ResId(3)),
+ aGroupBox1 (this, ResId(1)),
+ aOKButton1 (this, ResId(1)),
+ aCancelButton1 (this, ResId(1)),
+ aDefaultButton (this, ResId(1))
+{
+ if (bFreeRes)
+ FreeResource();
+
+ aDefaultButton.SetClickHdl(LINK(this, SmAlignDialog, DefaultButtonClickHdl));
+}
+
+
+void SmAlignDialog::ReadFrom(const SmFormat &rFormat)
+{
+ switch (rFormat.GetHorAlign())
+ {
+ case AlignLeft:
+ aLeft .Check(TRUE);
+ aCenter.Check(FALSE);
+ aRight .Check(FALSE);
+ break;
+
+ case AlignCenter:
+ aLeft .Check(FALSE);
+ aCenter.Check(TRUE);
+ aRight .Check(FALSE);
+ break;
+
+ case AlignRight:
+ aLeft .Check(FALSE);
+ aCenter.Check(FALSE);
+ aRight .Check(TRUE);
+ break;
+ }
+}
+
+
+void SmAlignDialog::WriteTo(SmFormat &rFormat) const
+{
+ if (aLeft.IsChecked())
+ rFormat.SetHorAlign(AlignLeft);
+ else if (aRight.IsChecked())
+ rFormat.SetHorAlign(AlignRight);
+ else
+ rFormat.SetHorAlign(AlignCenter);
+
+ rFormat.RequestApplyChanges();
+}
+
+
+/**************************************************************************/
+
+
+void SmShowSymbolSet::Paint(const Rectangle&)
+{
+ Push(PUSH_MAPMODE);
+
+ // MapUnit einstellen f黵 die 'nLen' berechnet wurde
+ SetMapMode(MapMode(MAP_PIXEL));
+
+ int v = (int) (aVScrollBar.GetThumbPos() * nColumns);
+ int nSymbols = (int) aSymbolSet.GetCount();
+
+ for (int i = v; i < nSymbols ; i++)
+ {
+ SmSym aSymbol (aSymbolSet.GetSymbol(i));
+ Font aFont (aSymbol.GetFace());
+
+ // etwas kleinere FontSize nehmen (als nLen) um etwas Luft zu haben
+ // (hoffentlich auch genug f黵 links und rechts!)
+ aFont.SetSize(Size(0, nLen - (nLen / 3)));
+ SetFont(aFont);
+
+ int nIV = i - v;
+ Size aSize(GetTextWidth(aSymbol.GetCharacter()), GetTextHeight());
+
+ DrawText(Point((nIV % nColumns) * nLen + (nLen - aSize.Width()) / 2,
+ (nIV / nColumns) * nLen + (nLen - aSize.Height()) / 2),
+ aSymbol.GetCharacter());
+ }
+
+ if (nSelectSymbol != SYMBOL_NONE)
+ {
+ Invert(Rectangle(Point(((nSelectSymbol - v) % nColumns) * nLen,
+ ((nSelectSymbol - v) / nColumns) * nLen),
+ Size(nLen, nLen)));
+ }
+
+ Pop();
+}
+
+
+void SmShowSymbolSet::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ GrabFocus();
+
+ if (rMEvt.IsLeft() && Rectangle(Point(0, 0), aOutputSize).IsInside(rMEvt.GetPosPixel()))
+ {
+ SelectSymbol ((rMEvt.GetPosPixel().Y() / nLen) * nColumns + (rMEvt.GetPosPixel().X() / nLen) +
+ aVScrollBar.GetThumbPos() * nColumns);
+
+ aSelectHdlLink.Call(this);
+
+ if (rMEvt.GetClicks() > 1) aDblClickHdlLink.Call(this);
+ }
+ else Control::MouseButtonDown (rMEvt);
+}
+
+
+void SmShowSymbolSet::KeyInput(const KeyEvent& rKEvt)
+{
+ USHORT n = nSelectSymbol;
+
+ if (n != SYMBOL_NONE)
+ {
+ switch (rKEvt.GetKeyCode().GetCode())
+ {
+ case KEY_DOWN: n += nColumns; break;
+ case KEY_UP: n -= nColumns; break;
+ case KEY_LEFT: n -= 1; break;
+ case KEY_RIGHT: n += 1; break;
+ case KEY_HOME: n = 0; break;
+ case KEY_END: n = aSymbolSet.GetCount() - 1; break;
+ case KEY_PAGEUP: n -= nColumns * nRows; break;
+ case KEY_PAGEDOWN: n += nColumns * nRows; break;
+
+ default:
+ Control::KeyInput(rKEvt);
+ return;
+ }
+ }
+ else
+ n = 0;
+
+ if (n >= aSymbolSet.GetCount())
+ n = nSelectSymbol;
+
+ // adjust scrollbar
+ if ((n < (USHORT) (aVScrollBar.GetThumbPos() * nColumns)) ||
+ (n >= (USHORT) ((aVScrollBar.GetThumbPos() + nRows) * nColumns)))
+ {
+ aVScrollBar.SetThumbPos(n / nColumns);
+ Invalidate();
+ Update();
+ }
+
+ SelectSymbol(n);
+ aSelectHdlLink.Call(this);
+}
+
+
+SmShowSymbolSet::SmShowSymbolSet(Window *pParent, const ResId& rResId) :
+ Control(pParent, rResId),
+ aVScrollBar(this, WinBits(WB_VSCROLL))
+{
+ nSelectSymbol = SYMBOL_NONE;
+
+ aOutputSize = GetOutputSizePixel();
+ long nScrollBarWidth = aVScrollBar.GetSizePixel().Width(),
+ nUseableWidth = aOutputSize.Width() - nScrollBarWidth;
+
+ // H鰄e von 16pt in Pixeln (passend zu 'aOutputSize')
+ nLen = (USHORT) LogicToPixel(Size(0, 16), MapMode(MAP_POINT)).Height();
+
+ nColumns = nUseableWidth / nLen;
+ if (nColumns > 2 && nColumns % 2 != 0)
+ nColumns--;
+ nRows = aOutputSize.Height() / nLen;
+ DBG_ASSERT(nColumns > 0, "Sm : keine Spalten");
+ DBG_ASSERT(nRows > 0, "Sm : keine Zeilen");
+
+ // genau passend machen
+ aOutputSize.Width() = nColumns * nLen;
+ aOutputSize.Height() = nRows * nLen;
+
+ aVScrollBar.SetPosSizePixel(Point(aOutputSize.Width() + 1, -1),
+ Size(nScrollBarWidth, aOutputSize.Height() + 2));
+ aVScrollBar.Enable(FALSE);
+ aVScrollBar.Show();
+ aVScrollBar.SetScrollHdl(LINK(this, SmShowSymbolSet, ScrollHdl));
+
+ Size WindowSize (aOutputSize);
+ WindowSize.Width() += nScrollBarWidth;
+ SetOutputSizePixel(WindowSize);
+
+}
+
+
+void SmShowSymbolSet::SetSymbolSet(const SmSymSet& rSymbolSet)
+{
+ aSymbolSet = rSymbolSet;
+
+ if (aSymbolSet.GetCount() > (nColumns * nRows))
+ {
+ aVScrollBar.SetRange(Range(0, ((aSymbolSet.GetCount() + (nColumns - 1)) / nColumns) - nRows));
+ aVScrollBar.Enable(TRUE);
+ }
+ else
+ {
+ aVScrollBar.SetRange(Range(0,0));
+ aVScrollBar.Enable (FALSE);
+ }
+
+ Invalidate();
+}
+
+
+void SmShowSymbolSet::SelectSymbol(USHORT nSymbol)
+{
+ int v = (int) (aVScrollBar.GetThumbPos() * nColumns);
+
+ if (nSelectSymbol != SYMBOL_NONE)
+ Invalidate(Rectangle(Point(((nSelectSymbol - v) % nColumns) * nLen,
+ ((nSelectSymbol - v) / nColumns) * nLen),
+ Size(nLen, nLen)));
+
+ if (nSymbol < aSymbolSet.GetCount())
+ nSelectSymbol = nSymbol;
+
+ if (aSymbolSet.GetCount() == 0)
+ nSelectSymbol = SYMBOL_NONE;
+
+ if (nSelectSymbol != SYMBOL_NONE)
+ Invalidate(Rectangle(Point(((nSelectSymbol - v) % nColumns) * nLen,
+ ((nSelectSymbol - v) / nColumns) * nLen),
+ Size(nLen, nLen)));
+
+ Update();
+}
+
+IMPL_LINK( SmShowSymbolSet, ScrollHdl, ScrollBar*, pScrollBar)
+{
+ Invalidate();
+ return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+void SmShowSymbol::Paint(const Rectangle&)
+{
+ const XubString &rText = GetText();
+ Size aTextSize(GetTextWidth(rText), GetTextHeight());
+
+ DrawText(Point((GetOutputSize().Width() - aTextSize.Width()) / 2,
+ (GetOutputSize().Height() - aTextSize.Height()) / 2), rText);
+}
+
+
+void SmShowSymbol::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ if (rMEvt.GetClicks() > 1)
+ aDblClickHdlLink.Call(this);
+ else
+ Control::MouseButtonDown (rMEvt);
+}
+
+
+void SmShowSymbol::SetSymbol(const SmSym *pSymbol)
+{
+ if (pSymbol)
+ {
+ Font aFont (pSymbol->GetFace());
+ aFont.SetSize(Size(0, GetOutputSize().Height() - GetOutputSize().Height() / 3));
+ SetFont(aFont);
+
+ SetText(XubString(pSymbol->GetCharacter()));
+ }
+
+ // 'Invalidate' f黮lt den background mit der background-Farbe.
+ // Falls der NULL pointer 黚ergeben wurde reicht dies also zum l鰏chen
+ // der Anzeige
+ Invalidate();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+void SmSymbolDialog::FillSymbolSets(BOOL bDeleteText)
+ // f黮lt die Eintr鋑e der m鰃lichen 'SymbolsSet's im Dialog mit den
+ // aktuellen Werten des SymbolSet Managers, selektiert aber keinen.
+{
+ aSymbolSets.Clear();
+ if (bDeleteText)
+ aSymbolSets.SetNoSelection();
+
+ USHORT nNumSymSets = rSymSetMgr.GetCount();
+ for (USHORT i = 0; i < nNumSymSets; i++)
+ aSymbolSets.InsertEntry(rSymSetMgr.GetSymbolSet(i)->GetName());
+}
+
+
+IMPL_LINK( SmSymbolDialog, SymbolSetChangeHdl, ListBox *, pListBox )
+{
+ DBG_ASSERT(pListBox == &aSymbolSets, "Sm : falsches Argument");
+
+ SelectSymbolSet(aSymbolSets.GetSelectEntry());
+ return 0;
+}
+
+
+IMPL_LINK( SmSymbolDialog, SymbolChangeHdl, SmShowSymbolSet *, pShowSymbolSet )
+{
+ DBG_ASSERT(pShowSymbolSet == &aSymbolSetDisplay, "Sm : falsches Argument");
+
+ SelectSymbol(aSymbolSetDisplay.GetSelectSymbol());
+ return 0;
+}
+
+IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, pButton )
+{
+ DBG_ASSERT(pButton == &aEditBtn, "Sm : falsches Argument");
+
+ SmSymDefineDialog *pDialog = new SmSymDefineDialog(this, rSymSetMgr);
+
+ // aktuelles Symbol und SymbolSet am neuen Dialog setzen
+ const XubString aSymSetName (aSymbolSets.GetSelectEntry()),
+ aSymName (aSymbolName.GetText());
+ pDialog->SelectOldSymbolSet(aSymSetName);
+ pDialog->SelectOldSymbol(aSymName);
+ pDialog->SelectSymbolSet(aSymSetName);
+ pDialog->SelectSymbol(aSymName);
+
+ // altes SymbolSet merken
+ XubString aOldSymbolSet (aSymbolSets.GetSelectEntry());
+
+ // Dialog an evtl ge鋘derte Daten des SymbolSet Manager anpassen
+ if (pDialog->Execute() == RET_OK && rSymSetMgr.IsModified())
+ FillSymbolSets();
+
+ // wenn das alte SymbolSet nicht mehr existiert zum ersten gehen
+ // (soweit eines vorhanden ist)
+ if (!SelectSymbolSet(aOldSymbolSet) && aSymbolSets.GetEntryCount() > 0)
+ SelectSymbolSet(aSymbolSets.GetEntry(0));
+
+ delete pDialog;
+ return 0;
+}
+
+
+IMPL_LINK( SmSymbolDialog, SymbolDblClickHdl, SmShowSymbolSet *, pShowSymbolSet )
+{
+ DBG_ASSERT(pShowSymbolSet == &aSymbolSetDisplay, "Sm : falsches Argument");
+
+ GetClickHdl(&aGetBtn);
+ EndDialog(RET_OK);
+ return 0;
+}
+
+
+IMPL_LINK( SmSymbolDialog, GetClickHdl, Button *, pButton )
+{
+ DBG_ASSERT(pButton == &aGetBtn, "Sm : falscher Button");
+
+ const SmSym *pSym = GetSymbol();
+ if (pSym)
+ {
+ XubString aText ('%');
+ aText += pSym->GetName();
+
+ SmViewShell *pViewSh = SmGetActiveView();
+ if (pViewSh)
+ pViewSh->GetViewFrame()->GetDispatcher()->Execute(
+ SID_INSERTTEXT, SFX_CALLMODE_STANDARD,
+ new SfxStringItem(SID_INSERTTEXT, aText), 0L);
+ }
+
+ return 0;
+}
+
+
+IMPL_LINK_INLINE_START( SmSymbolDialog, CloseClickHdl, Button *, pButton )
+{
+ DBG_ASSERT(pButton == &aCloseBtn, "Sm : falscher Button");
+
+ EndDialog(TRUE);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SmSymbolDialog, CloseClickHdl, Button *, pButton )
+
+
+SmSymbolDialog::SmSymbolDialog(Window *pParent, SmSymSetManager &rMgr, BOOL bFreeRes) :
+ ModalDialog (pParent, SmResId(RID_SYMBOLDIALOG)),
+ aSymbolSetText (this, ResId(1)),
+ aSymbolSets (this, ResId(1)),
+ aSymbolSetDisplay (this, ResId(1)),
+ aGrpBox (this, ResId(1)),
+ aSymbolName (this, ResId(2)),
+ aSymbolDisplay (this, ResId(2)),
+ aCloseBtn (this, ResId(3)),
+ aEditBtn (this, ResId(1)),
+ aGetBtn (this, ResId(2)),
+ rSymSetMgr (rMgr)
+{
+ if (bFreeRes)
+ FreeResource();
+
+ pSymSet = NULL;
+ FillSymbolSets();
+ if (aSymbolSets.GetEntryCount() > 0)
+ SelectSymbolSet(aSymbolSets.GetEntry(0));
+
+ // set background color to white
+ Wallpaper aWhiteWall( (Color) Color(COL_WHITE) );
+ aSymbolDisplay .SetBackground( aWhiteWall );
+ aSymbolSetDisplay.SetBackground( aWhiteWall );
+
+ aSymbolSets .SetSelectHdl (LINK(this, SmSymbolDialog, SymbolSetChangeHdl));
+ aSymbolSetDisplay.SetSelectHdl (LINK(this, SmSymbolDialog, SymbolChangeHdl));
+ aSymbolSetDisplay.SetDblClickHdl(LINK(this, SmSymbolDialog, SymbolDblClickHdl));
+ aSymbolDisplay .SetDblClickHdl(LINK(this, SmSymbolDialog, SymbolDblClickHdl));
+ aCloseBtn .SetClickHdl (LINK(this, SmSymbolDialog, CloseClickHdl));
+ aEditBtn .SetClickHdl (LINK(this, SmSymbolDialog, EditClickHdl));
+ aGetBtn .SetClickHdl (LINK(this, SmSymbolDialog, GetClickHdl));
+}
+
+
+BOOL SmSymbolDialog::SelectSymbolSet(const XubString &rSymbolSetName)
+{
+ BOOL bRet = FALSE;
+ USHORT nPos = aSymbolSets.GetEntryPos(rSymbolSetName);
+
+ pSymSet = NULL;
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ aSymbolSets.SelectEntryPos(nPos);
+ USHORT nSymbolSetNo = rSymSetMgr.GetSymbolSetPos(aSymbolSets.GetSelectEntry());
+ pSymSet = rSymSetMgr.GetSymbolSet(nSymbolSetNo);
+ DBG_ASSERT(pSymSet, "Sm : NULL pointer");
+
+ aSymbolSetDisplay.SetSymbolSet(*pSymSet);
+ if (pSymSet->GetCount() > 0)
+ SelectSymbol(0);
+
+ bRet = TRUE;
+ }
+ else
+ aSymbolSets.SetNoSelection();
+
+ return bRet;
+}
+
+
+void SmSymbolDialog::SelectSymbol(USHORT nSymbolNo)
+{
+ const SmSym *pSym = NULL;
+ if (pSymSet && nSymbolNo < pSymSet->GetCount())
+ pSym = &pSymSet->GetSymbol(nSymbolNo);
+
+ aSymbolSetDisplay.SelectSymbol(nSymbolNo);
+ aSymbolDisplay.SetSymbol(pSym);
+ aSymbolName.SetText(pSym ? pSym->GetName() : XubString());
+}
+
+
+const SmSym * SmSymbolDialog::GetSymbol() const
+{
+ USHORT nSymbolNo = aSymbolSetDisplay.GetSelectSymbol();
+ return pSymSet == NULL ? NULL : &pSymSet->GetSymbol(nSymbolNo);
+}
+
+
+/**************************************************************************/
+
+
+void SmShowCharset::Paint(const Rectangle&)
+{
+ Size OutputSize = GetOutputSizePixel();
+
+ int i;
+ for (i = 1; i < (int) nColumns; i++)
+ {
+ int nLenI = nLen * i;
+
+ DrawLine(Point(nLenI, 0), Point(nLenI, OutputSize.Height()));
+ }
+
+ for (i = 1; i < (int) nRows; i++)
+ {
+ int nLenI = nLen * i;
+
+ DrawLine(Point(0, nLenI), Point(OutputSize.Width(), nLenI));
+ }
+
+ for (i = 1; i < 256; i++)
+ {
+ int x = (i % nColumns) * nLen;
+ int y = (i / nColumns) * nLen;
+
+ Size aTextSize(GetTextWidth(aChar), GetTextHeight());
+
+ XubString aChar((xub_Unicode) i);
+ DrawText(Point(x + (nLen - aTextSize.Width()) / 2,
+ y + (nLen - aTextSize.Height()) / 2), aChar);
+ }
+}
+
+
+void SmShowCharset::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ if (rMEvt.IsLeft())
+ {
+ GrabFocus();
+
+ USHORT n = (USHORT) ((rMEvt.GetPosPixel().Y() / nLen) * nColumns +
+ (rMEvt.GetPosPixel().X() / nLen));
+ SelectChar((xub_Unicode)Min((USHORT) n, (USHORT) 255));
+
+ aSelectHdlLink.Call(this);
+
+ if (rMEvt.GetClicks() > 1)
+ aDblClickHdlLink.Call(this);
+ }
+ else Control::MouseButtonDown (rMEvt);
+}
+
+
+void SmShowCharset::KeyInput(const KeyEvent& rKEvt)
+{
+ xub_Unicode n = aChar;
+
+ switch (rKEvt.GetKeyCode().GetCode())
+ {
+ case KEY_DOWN: n += (xub_Unicode) nColumns; break;
+ case KEY_UP: n -= (xub_Unicode) nColumns; break;
+ case KEY_LEFT: n -= 1; break;
+ case KEY_RIGHT: n += 1; break;
+ case KEY_HOME: n = 0; break;
+ case KEY_END: n = (xub_Unicode) 255; break;
+ case KEY_PAGEUP: n -= (xub_Unicode) nColumns; break;
+ case KEY_PAGEDOWN: n += (xub_Unicode) nColumns; break;
+
+ default:
+ Control::KeyInput(rKEvt);
+ return;
+ }
+
+ SelectChar(n);
+ aSelectHdlLink.Call(this);
+}
+
+
+SmShowCharset::SmShowCharset(Window *pParent, const ResId& rResId) :
+ Control(pParent, rResId)
+{
+ aChar = xub_Unicode('\0');
+
+ Size aOutputSize (GetOutputSizePixel());
+
+ nColumns = 32;
+ nRows = 8;
+
+ // FontSize passend w鋒len
+ nLen = Min(aOutputSize.Width() / nColumns, aOutputSize.Height() / nRows);
+
+ // Fenster genau passend machen (wird h鯿hstens kleiner!)
+ aOutputSize.Width() = nColumns * nLen;
+ aOutputSize.Height() = nRows * nLen;
+
+ SetOutputSizePixel(aOutputSize);
+}
+
+
+void SmShowCharset::SetFont(const Font &rFont)
+{
+ Font aFont (rFont);
+
+ // etwas kleinere FontSize nehmen (als nLen) um etwas Luft zu haben
+ // (hofentlich auch genug f黵 links und rechts)
+ aFont.SetSize(Size(0, nLen - (nLen / 3)));
+ aFont.SetTransparent(TRUE);
+ Control::SetFont(aFont);
+
+ Invalidate();
+}
+
+
+void SmShowCharset::SelectChar(xub_Unicode aCharP)
+{
+ int c = aChar & 0xFF;
+ Size aNSize (nLen, nLen);
+
+ Invalidate(Rectangle(Point((c % nColumns) * nLen, (c / nColumns) * nLen), aNSize));
+
+ aChar = aCharP;
+ c = aChar & 0xFF;
+ Invalidate(Rectangle(Point((c % nColumns) * nLen, (c / nColumns) * nLen), aNSize));
+
+ Update();
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+
+void SmShowChar::Paint(const Rectangle&)
+{
+ XubString Text (GetText ());
+
+ if (Text.Len() > 0)
+ {
+ Size aTextSize(GetTextWidth(Text), GetTextHeight());
+
+ DrawText(Point((GetOutputSize().Width() - aTextSize.Width()) / 2,
+ (GetOutputSize().Height() - aTextSize.Height()) / 2), Text);
+ }
+}
+
+
+void SmShowChar::SetChar(xub_Unicode aChar)
+{
+ SetText(XubString(aChar));
+ Invalidate();
+}
+
+
+void SmShowChar::SetFont(const Font &rFont)
+{
+ Font aFont (rFont);
+ Size aSize (Size(0, GetOutputSize().Height() - GetOutputSize().Height() / 3));
+
+ aFont.SetSize(aSize);
+ aFont.SetTransparent(TRUE);
+ Control::SetFont(aFont);
+
+ Invalidate();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+void SmSymDefineDialog::FillSymbols(ComboBox &rComboBox, BOOL bDeleteText)
+{
+ DBG_ASSERT(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols,
+ "Sm : falsche ComboBox");
+
+ rComboBox.Clear();
+ if (bDeleteText)
+ rComboBox.SetText(XubString());
+
+ ComboBox &rSymbolSets = &rComboBox == &aOldSymbols ?
+ aOldSymbolSets : aSymbolSets;
+ const SmSymSet *pSymSet = GetSymbolSet(rSymbolSets);
+ if (pSymSet)
+ { USHORT nNumSymbols = pSymSet->GetCount();
+ for (USHORT i = 0; i < nNumSymbols; i++)
+ rComboBox.InsertEntry(pSymSet->GetSymbol(i).GetName());
+ }
+
+}
+
+
+void SmSymDefineDialog::FillSymbolSets(ComboBox &rComboBox, BOOL bDeleteText)
+{
+ DBG_ASSERT(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets,
+ "Sm : falsche ComboBox");
+
+ rComboBox.Clear();
+ if (bDeleteText)
+ rComboBox.SetText(XubString());
+
+ USHORT nNumSymSets = aSymSetMgrCopy.GetCount();
+ for (USHORT i = 0; i < nNumSymSets; i++)
+ rComboBox.InsertEntry(aSymSetMgrCopy.GetSymbolSet(i)->GetName());
+}
+
+
+void SmSymDefineDialog::FillFonts(BOOL bDelete)
+{
+ aFonts.Clear();
+ if (bDelete)
+ aFonts.SetNoSelection();
+
+ // alle Fonts der 'FontList' in die Fontliste aufnehmen
+ // von denen mit gleichen Namen jedoch nur einen (denn der Style wird
+ // 黚er die 'FontStyleBox' gew鋒lt und nicht auch noch hier)
+ DBG_ASSERT(pFontList, "Sm : NULL pointer");
+ USHORT nCount = pFontList->GetFontNameCount();
+ for (USHORT i = 0; i < nCount; i++)
+ aFonts.InsertEntry( pFontList->GetFontName(i).GetName() );
+}
+
+
+void SmSymDefineDialog::FillStyles(BOOL bDeleteText)
+{
+ aStyles.Clear();
+ if (bDeleteText)
+ aStyles.SetText(XubString());
+
+ XubString aText (aFonts.GetSelectEntry());
+ if (aText.Len() != 0)
+ {
+ //aStyles.Fill(aText, &aFontList);
+ // eigene StyleName's verwenden
+ for (USHORT i = 0; i < aStyleNameCount; i++)
+ aStyles.InsertEntry( aStyleName[i] );
+
+ DBG_ASSERT(aStyles.GetEntryCount() > 0, "Sm : keine Styles vorhanden");
+ aStyles.SetText( aStyles.GetEntry(0) );
+ }
+}
+
+
+SmSymSet * SmSymDefineDialog::GetSymbolSet(const ComboBox &rComboBox)
+{
+ DBG_ASSERT(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets,
+ "Sm : falsche ComboBox");
+
+ USHORT nSymbolSetNo = aSymSetMgrCopy.GetSymbolSetPos(rComboBox.GetText());
+
+ return nSymbolSetNo == SYMBOLSET_NONE ?
+ NULL : aSymSetMgrCopy.GetSymbolSet(nSymbolSetNo);
+}
+
+
+SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox)
+{
+ DBG_ASSERT(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols,
+ "Sm : falsche ComboBox");
+
+ return aSymSetMgrCopy.GetSymbol(rComboBox.GetText());
+}
+
+
+IMPL_LINK( SmSymDefineDialog, OldSymbolChangeHdl, ComboBox *, pComboBox )
+{
+ DBG_ASSERT(pComboBox == &aOldSymbols, "Sm : falsches Argument");
+ SelectSymbol(aOldSymbols, aOldSymbols.GetText(), FALSE);
+ return 0;
+}
+
+
+IMPL_LINK( SmSymDefineDialog, OldSymbolSetChangeHdl, ComboBox *, pComboBox )
+{
+ DBG_ASSERT(pComboBox == &aOldSymbolSets, "Sm : falsches Argument");
+ SelectSymbolSet(aOldSymbolSets, aOldSymbolSets.GetText(), FALSE);
+ return 0;
+}
+
+
+IMPL_LINK( SmSymDefineDialog, ModifyHdl, ComboBox *, pComboBox )
+{
+ // merken der Cursorposition zum wiederherstellen derselben
+ Selection aSelection (pComboBox->GetSelection());
+
+ if (pComboBox == &aSymbols)
+ SelectSymbol(aSymbols, aSymbols.GetText(), FALSE);
+ else if (pComboBox == &aSymbolSets)
+ SelectSymbolSet(aSymbolSets, aSymbolSets.GetText(), FALSE);
+ else if (pComboBox == &aOldSymbols)
+ // nur Namen aus der Liste erlauben
+ SelectSymbol(aOldSymbols, aOldSymbols.GetText(), TRUE);
+ else if (pComboBox == &aOldSymbolSets)
+ // nur Namen aus der Liste erlauben
+ SelectSymbolSet(aOldSymbolSets, aOldSymbolSets.GetText(), TRUE);
+ else if (pComboBox == &aStyles)
+ // nur Namen aus der Liste erlauben (ist hier eh immer der Fall)
+ SelectStyle(aStyles.GetText(), TRUE);
+ else
+ DBG_ASSERT(0, "Sm : falsche ComboBox Argument");
+
+ pComboBox->SetSelection(aSelection);
+
+ UpdateButtons();
+
+ return 0;
+}
+
+
+IMPL_LINK( SmSymDefineDialog, FontChangeHdl, ListBox *, pListBox )
+{
+ DBG_ASSERT(pListBox == &aFonts, "Sm : falsches Argument");
+
+ SelectFont(aFonts.GetSelectEntry());
+ return 0;
+}
+
+
+IMPL_LINK( SmSymDefineDialog, StyleChangeHdl, ComboBox *, pComboBox )
+{
+ DBG_ASSERT(pComboBox == &aStyles, "Sm : falsches Argument");
+
+ SelectStyle(aStyles.GetText());
+ return 0;
+}
+
+
+IMPL_LINK_INLINE_START( SmSymDefineDialog, CharSelectHdl, SmShowCharset *, pShowCharset )
+{
+ DBG_ASSERT(pShowCharset == &aCharsetDisplay, "Sm : falsches Argument");
+
+ SelectChar(aCharsetDisplay.GetSelectChar());
+ return 0;
+}
+IMPL_LINK_INLINE_END( SmSymDefineDialog, CharSelectHdl, SmShowCharset *, pShowCharset )
+
+
+IMPL_LINK( SmSymDefineDialog, AddClickHdl, Button *, pButton )
+{
+ DBG_ASSERT(pButton == &aAddBtn, "Sm : falsches Argument");
+ DBG_ASSERT(aAddBtn.IsEnabled(), "Sm : Voraussetzungen erf黮lt ??");
+
+ SmSymSet *pSymSet = GetSymbolSet(aSymbolSets);
+
+ // SymbolSet einf黦en falls es noch nicht existiert
+ if (!pSymSet)
+ {
+ pSymSet = new SmSymSet(aSymbolSets.GetText());
+ aSymSetMgrCopy.AddSymbolSet(pSymSet);
+ FillSymbolSets(aOldSymbolSets, FALSE);
+ FillSymbolSets(aSymbolSets, FALSE);
+ }
+ DBG_ASSERT(pSymSet, "Sm : NULL pointer");
+
+ // Symbol ins SymbolSet einf黦en
+ SmSym *pSym = new SmSym(aSymbols.GetText(), aCharsetDisplay.GetFont(),
+ aCharsetDisplay.GetSelectChar());
+ pSymSet->AddSymbol(pSym);
+
+ // update der Hash Tabelle erzwingen (damit aAddBtn disabled wird).
+ // (wird sp鋞er nach 躡erarbeitung von symbol.cxx 黚erfl黶sig werden).
+ aSymSetMgrCopy.ChangeSymbolSet((SmSymSet *)1);
+
+ // Symbolliste aktualiseren
+ FillSymbols(aOldSymbols ,FALSE);
+ FillSymbols(aSymbols ,FALSE);
+
+ UpdateButtons();
+
+ return 0;
+}
+
+
+IMPL_LINK( SmSymDefineDialog, ChangeClickHdl, Button *, pButton )
+{
+ DBG_ASSERT(pButton == &aChangeBtn, "Sm : falsches Argument");
+ DBG_ASSERT(aChangeBtn.IsEnabled(), "Sm : Voraussetzungen erf黮lt ??");
+
+ // finden des SymbolSets zum alten Symbol
+ SmSymSet *pOldSymSet = GetSymbolSet(aOldSymbolSets);
+ DBG_ASSERT(pOldSymSet, "Sm : NULL pointer");
+
+ // suchen des neuen SymbolSets
+ SmSymSet *pNewSymSet = GetSymbolSet(aSymbolSets);
+ // SymbolSet einf黦en falls es noch nicht existiert
+ if (!pNewSymSet)
+ {
+ pNewSymSet = new SmSymSet(aSymbolSets.GetText());
+ aSymSetMgrCopy.AddSymbolSet(pNewSymSet);
+ FillSymbolSets(aOldSymbolSets, FALSE);
+ FillSymbolSets(aSymbolSets, FALSE);
+ }
+
+ // das (alte) Symbol besorgen
+ USHORT nSymbol = pOldSymSet->GetSymbolPos(aOldSymbols.GetText());
+ SmSym *pSym = (SmSym *) &pOldSymSet->GetSymbol(nSymbol);
+ DBG_ASSERT(pSym, "Sm : NULL pointer");
+
+ // 膎derungen durchf黨ren;
+ pSym->GetName() = aSymbols.GetText();
+ pSym->GetFace() = aCharsetDisplay.GetFont();
+ pSym->GetCharacter() = aCharsetDisplay.GetSelectChar();
+
+ // das SymbolSet wechseln wenn n鰐ig
+ if (pOldSymSet != pNewSymSet)
+ {
+ pOldSymSet->RemoveSymbol(nSymbol);
+ pNewSymSet->AddSymbol(pSym);
+ }
+
+ //!! den SymbolSet Manger dazu zwingen seinen HashTable zu aktualisieren,
+ //!! um mit m鰃lich neuen bzw fehlenden alten Symbol Namen konform zu sein.
+ aSymSetMgrCopy.ChangeSymbolSet((SmSymSet *)1);
+
+ UpdateButtons();
+
+ return 0;
+}
+
+
+IMPL_LINK( SmSymDefineDialog, DeleteClickHdl, Button *, pButton )
+{
+ DBG_ASSERT(pButton == &aDeleteBtn, "Sm : falsches Argument");
+ DBG_ASSERT(aDeleteBtn.IsEnabled(), "Sm : Voraussetzungen erf黮lt ??");
+
+ if (pOrigSymbol)
+ {
+ // l鰏chen des Symbols:
+ //
+ // zugeh鰎iges SymbolSet finden
+ SmSymSet *pSymSet = GetSymbolSet(aOldSymbolSets);
+ DBG_ASSERT(pSymSet, "Sm : NULL pointer");
+ // finden des Index
+ XubString aOldSymbolName (pOrigSymbol->GetName());
+ USHORT nSymbolNo = pSymSet->GetSymbolPos(aOldSymbolName);
+ DBG_ASSERT(nSymbolNo != SYMBOL_NONE, "Sm : kein Symbol");
+ // Bez黦e auf das Symbols l鰏chen
+ DBG_ASSERT(pOrigSymbol == &pSymSet->GetSymbol(nSymbolNo),
+ "Sm : Fehler beim l鰏chen des Symbols");
+ SetOrigSymbol(NULL, XubString());
+ // und weg mit dem Symbol
+ pSymSet->DeleteSymbol(nSymbolNo);
+
+ //!! den SymbolSet Manger dazu zwingen seinen HashTable zu aktualisieren,
+ //!! was er n鋗lich nicht tut, wenn in einem seiner SymbolSets ge鋘dert/
+ //!! gel鰏cht wird, was wiederum zu einem Absturz f黨ren kann (wenn er
+ //!! 黚er ein nicht mehr existentes aber nicht entferntes Symbol iteriert).
+ aSymSetMgrCopy.ChangeSymbolSet((SmSymSet *)1);
+
+ // aktualisieren der Symboleintr鋑e des Dialogs
+ aOldSymbols.SetText(XubString());
+ aOldSymbols.RemoveEntry(aOldSymbolName);
+ if (aSymbolSets.GetText() == aOldSymbolSets.GetText())
+ aSymbols.RemoveEntry(aOldSymbolName);
+ }
+
+ UpdateButtons();
+
+ return 0;
+}
+
+
+void SmSymDefineDialog::UpdateButtons()
+{
+ BOOL bAdd = FALSE,
+ bChange = FALSE,
+ bDelete = FALSE,
+ bEqual;
+ XubString aSymbolName (aSymbols.GetText()),
+ aSymbolSetName (aSymbolSets.GetText());
+
+ if (aSymbolName.Len() > 0 && aSymbolSetName.Len() > 0)
+ {
+ // alle Einstellungen gleich?
+ //! (Font-, Style- und SymbolSet Name werden nicht case sensitiv verglichen)
+ bEqual = pOrigSymbol
+ && aSymbolSetName.EqualsIgnoreCaseAscii(aOldSymbolSetName.GetText())
+ && aSymbolName.Equals(pOrigSymbol->GetName())
+ && aFonts.GetSelectEntry().EqualsIgnoreCaseAscii(pOrigSymbol->GetFace().GetName())
+ && aStyles.GetText().EqualsIgnoreCaseAscii(GetFontStyleName(pOrigSymbol->GetFace()))
+ && aCharsetDisplay.GetSelectChar() == pOrigSymbol->GetCharacter();
+
+ // hinzuf黦en nur wenn es noch kein Symbol desgleichen Namens gibt
+ bAdd = aSymSetMgrCopy.GetSymbol(aSymbolName) == NULL;
+
+ // l鰏chen nur wenn alle Einstellungen gleich sind
+ bDelete = pOrigSymbol != NULL;
+
+ // 鋘dern wenn bei gleichem Namen mindestens eine Einstellung anders ist
+ // oder wenn es noch kein Symbol des neuen Namens gibt (w黵de implizites
+ // l鰏chen des bereits vorhandenen Symbols erfordern)
+ BOOL bEqualName = pOrigSymbol && aSymbolName == pOrigSymbol->GetName();
+ bChange = pOrigSymbol && (bEqualName && !bEqual || !bEqualName && bAdd);
+ }
+
+ aAddBtn .Enable(bAdd);
+ aChangeBtn.Enable(bChange);
+ aDeleteBtn.Enable(bDelete);
+}
+
+
+SmSymDefineDialog::SmSymDefineDialog(Window * pParent, SmSymSetManager &rMgr, BOOL bFreeRes) :
+ ModalDialog (pParent, SmResId(RID_SYMDEFINEDIALOG)),
+ aOldSymbolText (this, ResId(1)),
+ aOldSymbols (this, ResId(1)),
+ aOldSymbolSetText (this, ResId(2)),
+ aOldSymbolSets (this, ResId(2)),
+ aCharsetDisplay (this, ResId(1)),
+ aSymbolText (this, ResId(9)),
+ aSymbols (this, ResId(4)),
+ aSymbolSetText (this, ResId(10)),
+ aSymbolSets (this, ResId(5)),
+ aFontText (this, ResId(3)),
+ aFonts (this, ResId(1)),
+ aStyleText (this, ResId(4)),
+ aStyles (this, ResId(3)),
+ aOldSymbolName (this, ResId(7)),
+ aOldSymbolDisplay (this, ResId(3)),
+ aOldSymbolSetName (this, ResId(8)),
+ aSymbolName (this, ResId(5)),
+ aSymbolDisplay (this, ResId(2)),
+ aSymbolSetName (this, ResId(6)),
+ aAddBtn (this, ResId(1)),
+ aChangeBtn (this, ResId(2)),
+ aDeleteBtn (this, ResId(3)),
+ aOkBtn (this, ResId(1)),
+ aCancelBtn (this, ResId(1)),
+ aRightArrow (this, ResId(1)),
+ pFontList (NULL),
+ rSymSetMgr (rMgr)
+{
+ if (bFreeRes)
+ FreeResource();
+
+ // get FontList from printer (if possible), otherwise from application window
+ SmViewShell *pView = SmGetActiveView();
+ DBG_ASSERT(pView, "Sm : NULL pointer");
+ OutputDevice *pDev = pView->GetDoc()->GetPrinter();
+ if (!pDev || pDev->GetDevFontCount() == 0)
+ pDev = &pView->GetGraphicWindow();
+ pFontList = new FontList(pDev);
+
+
+ pOrigSymbol = 0;
+
+ // make autocompletion for symbols case-sensitive
+ aOldSymbols.EnableAutocomplete(TRUE, TRUE);
+ aSymbols .EnableAutocomplete(TRUE, TRUE);
+
+ FillFonts();
+ if (aFonts.GetEntryCount() > 0)
+ SelectFont(aFonts.GetEntry(0));
+
+ // set background color to white
+ Wallpaper aWhiteWall( (Color) Color(COL_WHITE) );
+ aCharsetDisplay .SetBackground( aWhiteWall );
+ aOldSymbolDisplay.SetBackground( aWhiteWall );
+ aOldSymbolDisplay.SetBackground( aWhiteWall );
+
+ SetSymbolSetManager(rSymSetMgr);
+
+ aOldSymbols .SetSelectHdl(LINK(this, SmSymDefineDialog, OldSymbolChangeHdl));
+ aOldSymbolSets .SetSelectHdl(LINK(this, SmSymDefineDialog, OldSymbolSetChangeHdl));
+ aSymbolSets .SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
+ aOldSymbolSets .SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
+ aSymbols .SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
+ aOldSymbols .SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
+ aStyles .SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
+ aFonts .SetSelectHdl(LINK(this, SmSymDefineDialog, FontChangeHdl));
+ aStyles .SetSelectHdl(LINK(this, SmSymDefineDialog, StyleChangeHdl));
+ aAddBtn .SetClickHdl (LINK(this, SmSymDefineDialog, AddClickHdl));
+ aChangeBtn .SetClickHdl (LINK(this, SmSymDefineDialog, ChangeClickHdl));
+ aDeleteBtn .SetClickHdl (LINK(this, SmSymDefineDialog, DeleteClickHdl));
+ aCharsetDisplay.SetSelectHdl(LINK(this, SmSymDefineDialog, CharSelectHdl));
+}
+
+
+SmSymDefineDialog::~SmSymDefineDialog()
+{
+ delete pFontList;
+}
+
+
+short SmSymDefineDialog::Execute()
+{
+ short nResult = ModalDialog::Execute();
+
+ // 膎derungen 黚ernehmen falls Dialog mit OK beendet wurde
+ if (aSymSetMgrCopy.IsModified() && nResult == RET_OK)
+ {
+ // leere SymbolSets aus dem Ergebnis entfernen.
+ // Dabei von hinten durch das array iterieren, da beim l鰏chen die
+ // Elemente aufr點ken.
+ USHORT nSymbolSets = aSymSetMgrCopy.GetCount();
+ for (int i = nSymbolSets - 1; i >= 0; i--)
+ if (aSymSetMgrCopy.GetSymbolSet(i)->GetCount() == 0)
+ aSymSetMgrCopy.DeleteSymbolSet(i);
+
+ rSymSetMgr = aSymSetMgrCopy;
+ }
+
+ return nResult;
+}
+
+
+void SmSymDefineDialog::SetSymbolSetManager(const SmSymSetManager &rMgr)
+{
+ aSymSetMgrCopy = rMgr;
+
+ // Das modified Flag der Kopie auf FALSE setzen, damit man sp鋞er damit
+ // testen kann ob sich was ge鋘dert hat.
+ aSymSetMgrCopy.SetModified(FALSE);
+
+ FillSymbolSets(aOldSymbolSets);
+ if (aOldSymbolSets.GetEntryCount() > 0)
+ SelectSymbolSet(aOldSymbolSets.GetEntry(0));
+ FillSymbolSets(aSymbolSets);
+ if (aSymbolSets.GetEntryCount() > 0)
+ SelectSymbolSet(aSymbolSets.GetEntry(0));
+ FillSymbols(aOldSymbols);
+ if (aOldSymbols.GetEntryCount() > 0)
+ SelectSymbol(aOldSymbols.GetEntry(0));
+ FillSymbols(aSymbols);
+ if (aSymbols.GetEntryCount() > 0)
+ SelectSymbol(aSymbols.GetEntry(0));
+
+ UpdateButtons();
+}
+
+
+BOOL SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
+ const XubString &rSymbolSetName, BOOL bDeleteText)
+{
+ DBG_ASSERT(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets,
+ "Sm : falsche ComboBox");
+
+ // 'Normalisieren' des SymbolNamens (ohne leading und trailing Leerzeichen)
+ XubString aNormName (rSymbolSetName);
+ aNormName.EraseLeadingChars(' ');
+ aNormName.EraseTrailingChars(' ');
+ // und evtl Abweichungen in der Eingabe beseitigen
+ rComboBox.SetText(aNormName);
+
+ BOOL bRet = FALSE;
+ USHORT nPos = rComboBox.GetEntryPos(aNormName);
+
+ if (nPos != COMBOBOX_ENTRY_NOTFOUND)
+ {
+ rComboBox.SetText(rComboBox.GetEntry(nPos));
+ bRet = TRUE;
+ }
+ else if (bDeleteText)
+ rComboBox.SetText(XubString());
+
+ BOOL bIsOld = &rComboBox == &aOldSymbolSets;
+
+ // setzen des SymbolSet Namens an der zugeh鰎igen Darstellung
+ FixedText &rFT = bIsOld ? aOldSymbolSetName : aSymbolSetName;
+ rFT.SetText(rComboBox.GetText());
+
+ // setzen der zum SymbolSet geh鰎enden Symbol Namen an der zugeh鰎igen
+ // Auswahbox
+ ComboBox &rCB = bIsOld ? aOldSymbols : aSymbols;
+ FillSymbols(rCB, FALSE);
+
+ // bei Wechsel des SymbolSets f黵 das alte Zeichen ein g黮tiges
+ // Symbol bzw keins zur Anzeige bringen
+ if (bIsOld)
+ {
+ XubString aOldSymbolName;
+ if (aOldSymbols.GetEntryCount() > 0)
+ aOldSymbolName = aOldSymbols.GetEntry(0);
+ SelectSymbol(aOldSymbols, aOldSymbolName, TRUE);
+ }
+
+ UpdateButtons();
+
+ return bRet;
+}
+
+
+void SmSymDefineDialog::SetOrigSymbol(const SmSym *pSymbol,
+ const XubString &rSymbolSetName)
+{
+ pOrigSymbol = pSymbol;
+
+ XubString aSymName,
+ aSymSetName;
+ if (pSymbol)
+ {
+ aSymName = pSymbol->GetName();
+ aSymSetName = rSymbolSetName;
+ aOldSymbolDisplay.SetFont(pSymbol->GetFace());
+ aOldSymbolDisplay.SetChar(pSymbol->GetCharacter());
+ }
+ else
+ { // l鰏chen des angezeigten Symbols
+ aOldSymbolDisplay.SetText(XubString());
+ aOldSymbolDisplay.Invalidate();
+ }
+ aOldSymbolName .SetText(aSymName);
+ aOldSymbolSetName.SetText(aSymSetName);
+}
+
+
+BOOL SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
+ const XubString &rSymbolName, BOOL bDeleteText)
+{
+ DBG_ASSERT(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols,
+ "Sm : falsche ComboBox");
+
+ // 'Normalisieren' des SymbolNamens (ohne Leerzeichen)
+ XubString aNormName (rSymbolName);
+ aNormName.EraseAllChars(' ');
+ // und evtl Abweichungen in der Eingabe beseitigen
+ rComboBox.SetText(aNormName);
+
+ BOOL bRet = FALSE;
+ USHORT nPos = rComboBox.GetEntryPos(aNormName);
+
+ BOOL bIsOld = &rComboBox == &aOldSymbols;
+
+ if (nPos != COMBOBOX_ENTRY_NOTFOUND)
+ {
+ rComboBox.SetText(rComboBox.GetEntry(nPos));
+
+ if (!bIsOld)
+ {
+ const SmSym *pSymbol = GetSymbol(aSymbols);
+ if (pSymbol)
+ {
+ // Font und Style entsprechend w鋒len
+ const Font &rFont = pSymbol->GetFace();
+ SelectFont(rFont.GetName(), FALSE);
+ SelectStyle(GetFontStyleName(rFont), FALSE);
+
+ // da das setzen des Fonts 黚er den Style Namen des SymbolsFonts nicht
+ // so gut klappt (er kann zB leer sein obwohl der Font selbst 'bold' und
+ // 'italic' ist!). Setzen wir hier den Font wie er zum Symbol geh鰎t
+ // zu Fu.
+ aCharsetDisplay.SetFont(rFont);
+ aSymbolDisplay.SetFont(rFont);
+
+ // das zugeh鰎ige Zeichen ausw鋒len
+ SelectChar(pSymbol->GetCharacter());
+ }
+ }
+
+ bRet = TRUE;
+ }
+ else if (bDeleteText)
+ rComboBox.SetText(XubString());
+
+ if (bIsOld)
+ {
+ // bei Wechsel des alten Symbols nur vorhandene anzeigen sonst keins
+ const SmSym *pOldSymbol = NULL;
+ XubString aOldSymbolSetName;
+ if (nPos != COMBOBOX_ENTRY_NOTFOUND)
+ {
+ pOldSymbol = aSymSetMgrCopy.GetSymbol(aNormName);
+ aOldSymbolSetName = aOldSymbolSets.GetText();
+ }
+ SetOrigSymbol(pOldSymbol, aOldSymbolSetName);
+ }
+ else
+ aSymbolName.SetText(rComboBox.GetText());
+
+ UpdateButtons();
+
+ return bRet;
+}
+
+
+void SmSymDefineDialog::SetFont(const XubString &rFontName, const XubString &rStyleName)
+{
+ // Font (FontInfo) passend zu Namen und Style holen
+ DBG_ASSERT(pFontList, "Sm : NULL pointer");
+ FontInfo aFI( pFontList->Get(rFontName, WEIGHT_NORMAL, ITALIC_NONE) );
+ SetFontStyle(rStyleName, aFI);
+
+ aCharsetDisplay.SetFont(aFI);
+ aSymbolDisplay.SetFont(aFI);
+}
+
+
+BOOL SmSymDefineDialog::SelectFont(const XubString &rFontName, BOOL bApplyFont)
+{
+ BOOL bRet = FALSE;
+ USHORT nPos = aFonts.GetEntryPos(rFontName);
+
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ aFonts.SelectEntryPos(nPos);
+ if (aStyles.GetEntryCount() > 0)
+ SelectStyle(aStyles.GetEntry(0));
+ if (bApplyFont)
+ SetFont(aFonts.GetSelectEntry(), aStyles.GetText());
+ bRet = TRUE;
+ }
+ else
+ aFonts.SetNoSelection();
+ FillStyles();
+
+ UpdateButtons();
+
+ return bRet;
+}
+
+
+BOOL SmSymDefineDialog::SelectStyle(const XubString &rStyleName, BOOL bApplyFont)
+{
+ BOOL bRet = FALSE;
+ USHORT nPos = aStyles.GetEntryPos(rStyleName);
+
+ // falls der Style nicht zur Auswahl steht nehmen wir den erst m鰃lichen
+ // (sofern vorhanden)
+ if (nPos == COMBOBOX_ENTRY_NOTFOUND && aStyles.GetEntryCount() > 0)
+ nPos = 0;
+
+ if (nPos != COMBOBOX_ENTRY_NOTFOUND)
+ {
+ aStyles.SetText(aStyles.GetEntry(nPos));
+ if (bApplyFont)
+ SetFont(aFonts.GetSelectEntry(), aStyles.GetText());
+ bRet = TRUE;
+ }
+ else
+ aStyles.SetText(XubString());
+
+ UpdateButtons();
+
+ return bRet;
+}
+
+
+void SmSymDefineDialog::SelectChar(xub_Unicode cChar)
+{
+ aCharsetDisplay.SelectChar(cChar);
+ aSymbolDisplay.SetChar(cChar);
+
+ UpdateButtons();
+}
+
+
+/**************************************************************************/
+
+#ifdef NEVER
+SfxTabPage* SmGeneralTabPage::Create(Window* pWindow, const SfxItemSet& rSet)
+{
+ return new SmGeneralTabPage(pWindow, rSet);
+}
+#endif NEVER
+
+
+
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
new file mode 100644
index 000000000000..130f00126f47
--- /dev/null
+++ b/starmath/source/document.cxx
@@ -0,0 +1,1641 @@
+/*************************************************************************
+ *
+ * $RCSfile: document.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifndef _UCBHELPER_CONTENT_HXX
+#include <ucbhelper/content.hxx>
+#endif
+#include <sot/formats.hxx>
+#ifndef _SVSTOR_HXX //autogen
+#include <so3/svstor.hxx>
+#endif
+#ifndef _SFXSMPLHINT_HXX //autogen
+#include <svtools/smplhint.hxx>
+#endif
+#ifndef _SO_CLSIDS_HXX //autogen
+#include <so3/clsids.hxx>
+#endif
+#ifndef _SOT_EXCHANGE_HXX //autogen
+#include <sot/exchange.hxx>
+#endif
+#ifndef _SV_MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#ifndef _SFXENUMITEM_HXX //autogen
+#include <svtools/eitem.hxx>
+#endif
+#ifndef _SFX_WHITER_HXX //autogen
+#include <svtools/whiter.hxx>
+#endif
+#ifndef _SFXINTITEM_HXX //autogen
+#include <svtools/intitem.hxx>
+#endif
+#ifndef _SFXSTRITEM_HXX //autogen
+#include <svtools/stritem.hxx>
+#endif
+#ifndef _SFXPTITEM_HXX //autogen
+#include <svtools/ptitem.hxx>
+#endif
+#ifndef _UNDO_HXX //autogen
+#include <svtools/undo.hxx>
+#endif
+#ifndef _SFXITEMPOOL_HXX //autogen
+#include <svtools/itempool.hxx>
+#endif
+#ifndef SVTOOLS_URIHELPER_HXX
+#include <svtools/urihelper.hxx>
+#endif
+#ifndef _SFXDISPATCH_HXX //autogen
+#include <sfx2/dispatch.hxx>
+#endif
+#ifndef _SFXDOCINF_HXX //autogen
+#include <sfx2/docinf.hxx>
+#endif
+#ifndef _SFXDOCFILE_HXX //autogen
+#include <sfx2/docfile.hxx>
+#endif
+#ifndef _SFXAPP_HXX //autogen
+#include <sfx2/app.hxx>
+#endif
+#ifndef _SFXREQUEST_HXX //autogen
+#include <sfx2/request.hxx>
+#endif
+#ifndef _IODLG_HXX
+#include <sfx2/iodlg.hxx>
+#endif
+#ifndef _SFXECODE_HXX //autogen
+#include <svtools/sfxecode.hxx>
+#endif
+#ifndef _SV_EXCHANGE_HXX //autogen
+#include <vcl/exchange.hxx>
+#endif
+#ifndef _SFX_PRINTER_HXX //autogen
+#include <sfx2/printer.hxx>
+#endif
+#ifndef _SFX_DOCFILT_HACK_HXX
+#include <sfx2/docfilt.hxx>
+#endif
+
+#ifndef STARMATH_HRC
+#include <starmath.hrc>
+#endif
+#ifndef DOCUMENT_HXX
+#include <document.hxx>
+#endif
+#ifndef UNOMODEL_HXX
+#include <unomodel.hxx>
+#endif
+#ifndef CONFIG_HXX
+#include <config.hxx>
+#endif
+#ifndef SYMBOL_HXX
+#include <symbol.hxx>
+#endif
+#ifndef TOOLBOX_HXX
+#include <toolbox.hxx>
+#endif
+#ifndef DIALOG_HXX
+#include <dialog.hxx>
+#endif
+#ifndef ACTION_HXX
+#include <action.hxx>
+#endif
+#ifndef VIEW_HXX
+#include <view.hxx>
+#endif
+#ifndef FORMAT_HXX
+#include <format.hxx>
+#endif
+#ifndef MATHTYPE_HXX
+#include <mathtype.hxx>
+#endif
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::uno;
+using namespace ::rtl;
+
+#ifndef SO2_DECL_SVSTORAGESTREAM_DEFINED
+#define SO2_DECL_SVSTORAGESTREAM_DEFINED
+SO2_DECL_REF(SvStorageStream)
+#endif
+#ifndef SO2_DECL_SVSTORAGE_DEFINED
+#define SO2_DECL_SVSTORAGE_DEFINED
+SO2_DECL_REF(SvStorage)
+#endif
+
+#define DOCUMENT_BUFFER_SIZE (USHORT)32768
+
+static const char __FAR_DATA pStarMathDoc[] = "StarMathDocument";
+
+
+/**************************************************************************/
+/*
+**
+** CLASS IMPLEMENTATION
+**
+**/
+
+#define SmDocShell
+#include "smslots.hxx"
+
+TYPEINIT1( SmDocShell, SfxObjectShell );
+
+SFX_IMPL_INTERFACE(SmDocShell, SfxObjectShell, SmResId(0))
+{
+ SFX_POPUPMENU_REGISTRATION(SmResId(RID_VIEWMENU));
+ SFX_POPUPMENU_REGISTRATION(SmResId(RID_COMMANDMENU));
+// SFX_OBJECTBAR_REGISTRATION(
+// SFX_OBJECTBAR_OBJECT|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_SERVER,
+// SmResId(RID_DEFAULTTOOLBOX));
+}
+
+#if 0
+SFX_IMPL_OBJECTFACTORY(SmDocShell, SFXOBJECTSHELL_STD_NORMAL, smath, SvGlobalName(SO3_SM_CLASSID_50) )
+{
+ SFX_SIMPLE_FILTER_REGISTRATION( C2S("StarMath 5.0"), C2S("*.smf"),
+ SFX_FILTER_OWN | SFX_FILTER_IMPORT | SFX_FILTER_EXPORT,
+ SOT_FORMATSTR_ID_STARMATH_50,
+ C2S("SVsm0.smf"), C2S("OS2"), 0, C2S("0"), String());
+
+//JP 13.06.00: das fehlt vwohl noch, oder??
+// SfxObjectFactory& rFactory = (SfxObjectFactory&)Factory();
+// SfxFactoryFilterContainer *pFltContainer = rFactory.GetFilterContainer( FALSE );
+// rFactory.GetFilterContainer()->SetDetectFilter( &SmDLL::DetectFilter );
+
+ // FG: Sonst gibts keine Hilfe im Math #38447#
+ Factory().RegisterHelpFile (C2S("smath.svh"));
+}
+#else
+SFX_IMPL_OBJECTFACTORY_DLL(SmDocShell, smath, SvGlobalName(SO3_SM_CLASSID_50), Sm);
+#endif
+
+void SmDocShell::SFX_NOTIFY(SfxBroadcaster&, const TypeId&,
+ const SfxHint& rHint, const TypeId&)
+{
+ switch (((SfxSimpleHint&)rHint).GetId())
+ {
+ case HINT_CONFIGCHANGED:
+ {
+ SmModule *pp = SM_MOD1();
+
+ if (pp->GetConfig()->IsAutoRedraw())
+ { nModifyCount++; //! merkw乺dig...
+ // ohne dies wird die Grafik letztlich
+ // nicht geupdatet
+ Resize();
+ }
+ break;
+ }
+
+ case HINT_FORMATCHANGED:
+ SetFormulaArranged(FALSE);
+ nModifyCount++; //! merkw乺dig...
+ // ohne dies wird die Grafik letztlich
+ // nicht geupdatet
+ Resize();
+ break;
+ }
+}
+
+void SmDocShell::LoadSymbols()
+{
+ SmModule *pp = SM_MOD1();
+ String sURL(pp->GetConfig()->GetSymbolFile());
+ SfxIniManager* pIniMgr = SFX_INIMANAGER();
+ sURL = pIniMgr->SubstPathVars( sURL );
+ BOOL bExist = FALSE;
+ INetURLObject aURLObj;
+ aURLObj.SetSmartProtocol( INET_PROT_FILE );
+ aURLObj.SetSmartURL(sURL);
+ try
+ {
+ if(aURLObj.GetProtocol() == INET_PROT_FILE)
+ bExist = ::ucb::Content( aURLObj.GetMainURL(),
+ uno::Reference< XCommandEnvironment >()).isDocument();
+ }
+ catch(...){}
+ if(!bExist)
+ pIniMgr->SearchFile( sURL, SFX_KEY_USERCONFIG_PATH );
+
+ sURL = URIHelper::SmartRelToAbs(sURL);
+ pp->GetSymSetManager()->Load(sURL);
+}
+
+const String &SmDocShell::GetTitle() const
+{
+ return ((SmDocShell *) this)->GetDocInfo().GetTitle();
+}
+
+
+
+const String &SmDocShell::GetComment() const
+{
+ return ((SmDocShell *) this)->GetDocInfo().GetComment();
+}
+
+
+
+void SmDocShell::SetText(const String& rBuffer)
+{
+ if (rBuffer != aText)
+ {
+ aText = rBuffer;
+ Parse();
+ SetFormulaArranged(FALSE);
+ Resize();
+ SmViewShell *pViewSh = SmGetActiveView();
+ if (pViewSh)
+ pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_TEXT);
+ SetModified(TRUE);
+ }
+}
+
+void SmDocShell::SetFormat(SmFormat& rFormat)
+{
+ aFormat = rFormat;
+ SetFormulaArranged(FALSE);
+ SmViewShell *pViewSh = SmGetActiveView();
+ if (pViewSh)
+ pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_GRAPHIC);
+ SetModified(TRUE);
+}
+
+
+void SmDocShell::Parse()
+{
+ if (pTree)
+ delete pTree;
+ pTree = aInterpreter.Parse(aText);
+ nModifyCount++;
+}
+
+
+void SmDocShell::ArrangeFormula()
+{
+ //! Nur f黵 die Dauer der Existenz dieses Objekts sind am Drucker die
+ //! richtigen Einstellungen garantiert.
+ SmPrinterAccess aPrtAcc(*this);
+
+ OutputDevice *pOutDev = aPrtAcc.GetPrinter();
+
+#ifndef PRODUCT
+ if (!pOutDev)
+ DBG_WARNING("Sm : kein Drucker vorhanden");
+#endif
+
+ // falls n鰐ig ein anderes OutputDevice holen f黵 das formatiert wird
+ if (!pOutDev)
+ {
+ SmViewShell *pView = SmGetActiveView();
+ if (pView)
+ pOutDev = &pView->GetGraphicWindow();
+ else
+ { pOutDev = new VirtualDevice;
+ pOutDev->SetMapMode( MapMode(MAP_100TH_MM) );
+ }
+ }
+ DBG_ASSERT(pOutDev->GetMapMode().GetMapUnit() == MAP_100TH_MM,
+ "Sm : falscher MapMode");
+
+ const SmFormat &rFormat = GetFormat();
+ pTree->Prepare(rFormat);
+ pTree->Arrange(*pOutDev, rFormat);
+
+ SetFormulaArranged(TRUE);
+}
+
+
+void SmDocShell::Draw(OutputDevice &rDev, Point &rPosition)
+{
+ if (!pTree)
+ Parse();
+ DBG_ASSERT(pTree, "Sm : NULL pointer");
+
+ if (!IsFormulaArranged())
+ ArrangeFormula();
+
+ //Problem: Was passiert mit dem WYSIWYG? Wir haben waehrend wir inplace aktiv
+ //sind kein Referenzdevice und sind auch nicht darauf ausgerichtet. Es kann
+ //also jetzt eine Differenz zwischen der VisArea (spricht die Groesse im Client)
+ //und der jetzt vorliegenden Groese geben.
+ //Idee: Die Differenz koennte, zumindest behelfsmaessig, mit SmNod::SetSize
+ //angepasst werden.
+
+ rPosition.X() += aFormat.GetDistance( DIS_LEFTSPACE );
+ rPosition.Y() += aFormat.GetDistance( DIS_TOPSPACE );
+ pTree->Draw(rDev, rPosition);
+}
+
+
+
+Size SmDocShell::GetSize()
+{
+ Size aRet;
+
+ if (!pTree)
+ Parse();
+
+ if (pTree)
+ {
+ if (!IsFormulaArranged())
+ ArrangeFormula();
+ aRet = pTree->GetSize();
+
+ if ( !aRet.Width() )
+ aRet.Width() = 2000;
+ else
+ aRet.Width() += aFormat.GetDistance( DIS_LEFTSPACE ) +
+ aFormat.GetDistance( DIS_RIGHTSPACE );
+ if ( !aRet.Height() )
+ aRet.Height() = 1000;
+ else
+ aRet.Height() += aFormat.GetDistance( DIS_TOPSPACE ) +
+ aFormat.GetDistance( DIS_BOTTOMSPACE );
+ }
+
+ return aRet;
+}
+
+////////////////////////////////////////
+
+SmPrinterAccess::SmPrinterAccess( SmDocShell &rDocShell )
+{
+ if ( 0 != (pPrinter = rDocShell.GetPrt()) )
+ {
+ pPrinter->Push( PUSH_MAPMODE );
+ if ( rDocShell.GetProtocol().IsInPlaceActive() ||
+ SFX_CREATE_MODE_EMBEDDED == rDocShell.GetCreateMode() )
+ {
+ // if it is an embedded object (without it's own printer)
+ // we change the MapMode temporarily.
+ //!If it is a document with it's own printer the MapMode should
+ //!be set correct (once) elsewhere(!), in order to avoid numerous
+ //!superfluous pushing and poping of the MapMode when using
+ //!this class.
+
+ const MapUnit eOld = pPrinter->GetMapMode().GetMapUnit();
+ if ( MAP_100TH_MM != eOld )
+ {
+ MapMode aMap( pPrinter->GetMapMode() );
+ aMap.SetMapUnit( MAP_100TH_MM );
+ Point aTmp( aMap.GetOrigin() );
+ aTmp.X() = OutputDevice::LogicToLogic( aTmp.X(), eOld, MAP_100TH_MM );
+ aTmp.Y() = OutputDevice::LogicToLogic( aTmp.Y(), eOld, MAP_100TH_MM );
+ aMap.SetOrigin( aTmp );
+ pPrinter->SetMapMode( aMap );
+ }
+ }
+ }
+}
+
+SmPrinterAccess::~SmPrinterAccess()
+{
+ if ( pPrinter )
+ pPrinter->Pop();
+}
+
+////////////////////////////////////////
+
+Printer *SmDocShell::GetPrt()
+{
+ if ( GetProtocol().IsInPlaceActive() ||
+ SFX_CREATE_MODE_EMBEDDED == GetCreateMode() )
+ {
+ //Normalerweise wird der Printer vom Server besorgt. Wenn dieser aber
+ //keinen liefert (weil etwa noch keine connection da ist), kann es
+ //dennoch sein, dass wir den Printer kennen, denn dieser wird in
+ //OnDocumentPrinterChanged vom Server durchgereicht und dann temporaer
+ //festgehalten.
+ Printer *pPrt = GetDocumentPrinter();
+ if ( !pPrt )
+ pPrt = pTmpPrinter;
+ return pPrt;
+ }
+ else if ( !pPrinter )
+ {
+ SfxItemSet *pOptions =
+ new SfxItemSet(GetPool(),
+ SID_PRINTSIZE, SID_PRINTSIZE,
+ SID_PRINTZOOM, SID_PRINTZOOM,
+ SID_PRINTTITLE, SID_PRINTTITLE,
+ SID_PRINTTEXT, SID_PRINTTEXT,
+ SID_PRINTFRAME, SID_PRINTFRAME,
+ SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES,
+ 0);
+
+ SmModule *pp = SM_MOD1();
+ pp->GetConfig()->ConfigToItemSet(*pOptions);
+ pPrinter = new SfxPrinter(pOptions);
+ pPrinter->SetMapMode( MapMode(MAP_100TH_MM) );
+ }
+ return pPrinter;
+}
+
+
+void SmDocShell::SetPrinter( SfxPrinter *pNew )
+{
+ delete pPrinter;
+ pPrinter = pNew; //Eigentumsuebergang!
+ pPrinter->SetMapMode( MapMode(MAP_100TH_MM) );
+ SetFormulaArranged(FALSE);
+ SM_MOD1()->GetRectCache()->Reset();
+ Resize();
+}
+
+void SmDocShell::OnDocumentPrinterChanged( Printer *pPrt )
+{
+ pTmpPrinter = pPrt;
+ SetFormulaArranged(FALSE);
+ SM_MOD1()->GetRectCache()->Reset();
+ Size aOldSize = GetVisArea().GetSize();
+ Resize();
+ if ( aOldSize != GetVisArea().GetSize() )
+ SetModified( TRUE );
+ pTmpPrinter = 0;
+}
+
+void SmDocShell::Resize()
+{
+ Size aVisSize = GetSize();
+
+ BOOL bIsEnabled = IsEnableSetModified();
+ if ( bIsEnabled )
+ EnableSetModified( FALSE );
+
+ SetUpdateTimeout( 0L );
+ SetVisAreaSize( aVisSize );
+ SmViewShell *pViewSh = SmGetActiveView();
+ if (pViewSh)
+ pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_GRAPHIC);
+
+ if ( bIsEnabled )
+ EnableSetModified( bIsEnabled );
+}
+
+
+SmDocShell::SmDocShell(SfxObjectCreateMode eMode) :
+ SfxObjectShell(eMode),
+ aDataTypeList(SvEmbeddedObject::GetStdFormatList()),
+ pTree( 0 ),
+ pPrinter( 0 ),
+ pTmpPrinter( 0 ),
+ nModifyCount( 0 ),
+ bIsFormulaArranged( FALSE )
+{
+ SetPool(&SFX_APP()->GetPool());
+
+ SmModule *pp = SM_MOD1();
+ aFormat = pp->GetConfig()->GetFormat();
+
+ StartListening(aFormat);
+ StartListening(*pp->GetConfig());
+ LoadSymbols();
+
+ SetShell(this);
+ SetModel( new SmModel(this) ); //! das hier mit new erzeugte Model brauch
+ //! im Destruktor nicht explizit gel鰏cht werden.
+ //! Dies erledigt das Sfx.
+ pUndoMgr = new SfxUndoManager;
+ aDataTypeList.Append(SvDataType(FORMAT_STRING, MEDIUM_MEMORY));
+}
+
+
+
+SmDocShell::~SmDocShell()
+{
+ SmModule *pp = SM_MOD1();
+
+ EndListening(aFormat);
+ EndListening(*pp->GetConfig());
+
+ SaveSymbols();
+
+ delete pUndoMgr;
+ delete pTree;
+ delete pPrinter;
+}
+
+
+
+BOOL SmDocShell::GetData(SvData *pData)
+{
+ if ( FORMAT_STRING == pData->GetFormat() )
+ {
+ pData->SetData(GetText());
+ return TRUE;
+ }
+
+ return SfxInPlaceObject::GetData(pData);
+}
+
+BOOL SmDocShell::SetData( SvData *pData )
+{
+ if ( FORMAT_STRING == pData->GetFormat() )
+ {
+ String aData;
+ if ( pData->GetData( aData ) )
+ {
+ SetText( aData );
+ return TRUE;
+ }
+ }
+ return SfxInPlaceObject::SetData( pData );
+}
+
+void SmDocShell::Convert40To50Txt()
+ // adapts the text 'aText' to be parsed from 4.0 version, to changes made
+ // in 5.0 version. (Namely that functions do not need arguments any more)
+ // Example: "2 over sin x" acts very different in 4.0 and 5.0
+{
+ if (pTree)
+ delete pTree;
+
+ // parse in old 4.0 style and make changes for 5.0 style
+ BOOL bVal = aInterpreter.IsConvert40To50();
+ aInterpreter.SetConvert40To50(TRUE);
+ pTree = aInterpreter.Parse(aText);
+ aInterpreter.SetConvert40To50(bVal);
+
+ // get new to 5.0 version converted text
+ aText = aInterpreter.GetText();
+
+ // clean up tree parsed in old style
+ if (pTree)
+ { delete pTree;
+ pTree = NULL;
+ }
+}
+
+
+BOOL SmDocShell::ConvertFrom(SfxMedium &rMedium)
+{
+ BOOL bSuccess = FALSE;
+ String aTmpStr( C2S( "Equation Native" ));
+ if( rMedium.IsStorage() && rMedium.GetStorage()->IsStream( aTmpStr ))
+ {
+ // is this a MathType Storage?
+ MathType aEquation( aText );
+ bSuccess = aEquation.Parse( rMedium.GetStorage() );
+ }
+ else
+ {
+ SvStream *pStream = rMedium.GetInStream();
+ if (pStream)
+ {
+ bSuccess = ImportSM20File( pStream );
+ rMedium.CloseInStream();
+ }
+ }
+ FinishedLoading( SFX_LOADED_ALL );
+ return bSuccess;
+}
+
+
+
+BOOL SmDocShell::InsertFrom(SfxMedium &rMedium)
+{
+ BOOL bSuccess = FALSE;
+ SvStream *pStream = rMedium.GetInStream();
+
+ if (pStream)
+ {
+ bSuccess = ImportSM20File( pStream, TRUE );
+ rMedium.CloseInStream();
+ }
+ return bSuccess;
+}
+
+
+
+BOOL SmDocShell::InitNew(SvStorage * pStor)
+{
+ BOOL bRet = FALSE;
+ if (SfxInPlaceObject::InitNew(pStor))
+ {
+ bRet = TRUE;
+ SetVisArea(Rectangle(Point(0, 0), Size(2000, 1000)));
+ if (pStor)
+ {
+ aDocStream = pStor->OpenStream(String::CreateFromAscii(pStarMathDoc));
+ aDocStream->SetVersion (pStor->GetVersion ());
+ GetPool().SetFileFormatVersion(USHORT(pStor->GetVersion()));
+
+ if (! aDocStream )
+ bRet = FALSE;
+ }
+ }
+ return bRet;
+}
+
+
+BOOL SmDocShell::Load(SvStorage *pStor)
+{
+ BOOL bRet = FALSE;
+ if( SfxInPlaceObject::Load( pStor ))
+ {
+ String aTmpStr( C2S( "Equation Native" ));
+ if( pStor->IsStream( aTmpStr ))
+ {
+ // is this a MathType Storage?
+ MathType aEquation(aText);
+ bRet = (1 == aEquation.Parse(pStor));
+ }
+ else
+ {
+ bRet = 0 != Try3x (pStor, STREAM_READWRITE);
+
+ if( !bRet )
+ {
+ pStor->Remove(String::CreateFromAscii(pStarMathDoc));
+ bRet = 0 != Try2x (pStor, STREAM_READWRITE);
+ pStor->Remove(C2S("\1Ole10Native"));
+ }
+ else
+ {
+ if ( pStor->GetVersion() <= SOFFICE_FILEFORMAT_40 )
+ Convert40To50Txt();
+ }
+ }
+ }
+ FinishedLoading( SFX_LOADED_ALL );
+ return bRet;
+}
+
+
+
+BOOL SmDocShell::Insert(SvStorage *pStor)
+{
+ String aTemp = aText;
+ BOOL bRet = TRUE;
+
+ if (!Try3x (pStor, STREAM_STD_READ))
+ {
+ pStor->Remove (String::CreateFromAscii(pStarMathDoc));
+ bRet = !Try2x (pStor, STREAM_STD_READ);
+ pStor->Remove(C2S("\1Ole10Native"));
+ }
+
+ if ( bRet )
+ {
+ aTemp += aText;
+ aText = aTemp;
+
+ if ( pStor->GetVersion() <= SOFFICE_FILEFORMAT_40 )
+ Convert40To50Txt();
+
+ Parse();
+ SetModified(TRUE);
+ SmViewShell *pViewSh = SmGetActiveView();
+ if (pViewSh)
+ {
+ SfxBindings &rBnd = pViewSh->GetViewFrame()->GetBindings();
+ rBnd.Invalidate(SID_GRAPHIC);
+ rBnd.Invalidate(SID_TEXT);
+ }
+ }
+ return bRet;
+}
+
+//------------------------------------------------------------------
+
+void SmDocShell::ImplSave( SvStorageStreamRef xStrm )
+{
+ ByteString exString (ExportString(aText));
+ SmModule *pp = SM_MOD1();
+
+ *xStrm << SM304AIDENT << SM50VERSION
+ << 'T';
+ xStrm->WriteByteString(exString);
+ *xStrm << 'F' << aFormat
+ << 'S' << pp->GetSymSetManager()->GetAccessedSymbols()
+ << '\0';
+}
+
+BOOL SmDocShell::Save()
+{
+ if ( SfxInPlaceObject::Save() && aDocStream.Is() )
+ {
+ aDocStream->Seek(0);
+ ImplSave( aDocStream );
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+BOOL SmDocShell::SaveAs(SvStorage * pNewStor)
+{
+ BOOL bRet = FALSE;
+ if ( SfxInPlaceObject::SaveAs( pNewStor ) )
+ {
+ SvStorageStreamRef aStm = pNewStor->OpenStream(
+ String::CreateFromAscii(pStarMathDoc));
+ aStm->SetVersion( pNewStor->GetVersion() );
+ GetPool().SetFileFormatVersion( USHORT( pNewStor->GetVersion() ));
+ aStm->SetBufferSize(DOCUMENT_BUFFER_SIZE);
+ aStm->SetKey( pNewStor->GetKey() ); // Passwort setzen
+
+ if ( aStm.Is() )
+ {
+ ImplSave( aStm );
+ bRet = TRUE;
+ }
+ }
+ return bRet;
+}
+
+BOOL SmDocShell::ConvertTo( SfxMedium &rMedium )
+{
+ BOOL bRet = FALSE;
+ const SfxFilter* pFlt = rMedium.GetFilter();
+ if( pFlt && pFlt->GetFilterName().EqualsAscii( "MathType 3.x" ))
+ bRet = WriteAsMathType3( rMedium );
+ return bRet;
+}
+
+BOOL SmDocShell::SaveCompleted(SvStorage * pStor)
+{
+ if( SfxInPlaceObject::SaveCompleted( pStor ))
+ {
+ if (! pStor)
+ return TRUE;
+
+ aDocStream = pStor->OpenStream(String::CreateFromAscii(pStarMathDoc));
+ aDocStream->SetVersion (pStor->GetVersion ());
+ GetPool().SetFileFormatVersion(USHORT(pStor->GetVersion()));
+ aDocStream->SetBufferSize(DOCUMENT_BUFFER_SIZE);
+ aDocStream->SetKey( pStor->GetKey() ); // Passwort setzen
+ return aDocStream.Is();
+ }
+ return FALSE;
+}
+
+
+
+BOOL SmDocShell::ImportSM20File(SvStream *pStream, BOOL bInsert)
+{
+ void ReadSM20SymSet(SvStream*, SmSymSet*);
+
+ char cTag;
+ ULONG lIdent, lVersion;
+ long lTime;
+ ULONG lDate;
+ String aBuffer;
+ SmSymSet *pSymbolSet;
+ ULONG FilePos = pStream->Tell();
+
+ *pStream >> lIdent >> lVersion;
+
+ if (lIdent == FRMIDENT)
+ {
+ DBG_ASSERT((lVersion == FRMVERSION), "Illegal file version");
+
+ *pStream >> cTag;
+ rtl_TextEncoding eEnc = gsl_getSystemTextEncoding();
+ while (cTag && !pStream->IsEof())
+ {
+ switch (cTag)
+ {
+ case 'T':
+ pStream->ReadByteString(aBuffer, eEnc);
+ if (! bInsert)
+ {
+ aText = aBuffer;
+ Parse();
+ }
+ else
+ {
+ SmViewShell *pViewSh = SmGetActiveView();
+ if (pViewSh)
+ pViewSh->GetViewFrame()->GetDispatcher()->Execute(
+ SID_INSERTTEXT, SFX_CALLMODE_STANDARD,
+ new SfxStringItem(SID_INSERTTEXT, aBuffer), 0L);
+ }
+ break;
+
+ case 'D':
+ {
+ pStream->ReadByteString(aBuffer, eEnc);
+ pStream->ReadByteString(aBuffer, eEnc);
+ *pStream >> lDate >> lTime;
+ pStream->ReadByteString(aBuffer, eEnc);
+ *pStream >> lDate >> lTime;
+ pStream->ReadByteString(aBuffer, eEnc);
+ }
+ break;
+
+ case 'F':
+ aFormat.ReadSM20Format(*pStream);
+ aFormat.From300To304a ();
+ break;
+
+ case 'S':
+ pSymbolSet = new SmSymSet();
+ ReadSM20SymSet(pStream, pSymbolSet);
+ if (! bInsert)
+ {
+ SmModule *pp = SM_MOD1();
+ pp->GetSymSetManager()->AppendExtraSymbolSet(pSymbolSet);
+ }
+ else
+ delete pSymbolSet;
+ break;
+
+ default:
+ DBG_ASSERT((cTag != 0), "Illegal data tag");
+ }
+ *pStream >> cTag;
+ }
+
+ return TRUE;
+ }
+
+ pStream->Seek(FilePos);
+
+ return FALSE;
+}
+
+
+void SmDocShell::Execute(SfxRequest& rReq)
+{
+ SfxBindings *pBindings = NULL;
+ SmViewShell *pViewSh = SmGetActiveView();
+ if (pViewSh)
+ pBindings = &pViewSh->GetViewFrame()->GetBindings();
+ switch (rReq.GetSlot())
+ {
+ case SID_TEXTMODE:
+ {
+ SmFormat &rFormat = GetFormat();
+ rFormat.SetTextmode(!rFormat.IsTextmode());
+ rFormat.RequestApplyChanges();
+ break;
+ }
+
+ case SID_SYMBOLS_LOAD:
+ {
+ SmModule *pp = SM_MOD1();
+
+ SfxSimpleFileDialog *pFileDialog =
+ new SfxSimpleFileDialog(0, WinBits(WB_OPEN | WB_3DLOOK));
+
+#ifdef MAC
+ pFileDialog->AddFilter(SmResId(RID_SYMBOLFILESSTR), SmResId(RID_FILESYMTYP));
+ pFileDialog->AddFilter(SmResId(RID_ALLFILESSTR), C2S("****"));
+
+ pFileDialog->SetCurFilter(SmResId(RID_SYMBOLFILESSTR));
+#else
+ String aExt( C2S("*.sms" ));
+ pFileDialog->AddFilter(SmResId(RID_SYMBOLFILESSTR), aExt);
+ pFileDialog->AddFilter(SmResId(RID_ALLFILESSTR), C2S("*.*"));
+ pFileDialog->SetCurFilter(SmResId(RID_SYMBOLFILESSTR));
+ pFileDialog->SetDefaultExt(aExt);
+#endif
+
+ pFileDialog->SetPath(pp->GetConfig()->GetSymbolFile());
+
+ if ( RET_OK == pFileDialog->Execute() )
+ {
+ // save old symbols and sets if necessary
+ if (pp->GetSymSetManager()->IsModified())
+ pp->GetSymSetManager()->Save();
+ // load new symbols and sets from file
+ INetURLObject aURLObj;
+ aURLObj.SetSmartProtocol( INET_PROT_FILE );
+ aURLObj.SetSmartURL( pFileDialog->GetPath() );
+ pp->GetSymSetManager()->Load( aURLObj.GetMainURL() );
+ // make that file the new default symbolfile
+ pp->GetConfig()->SetSymbolFile( pFileDialog->GetPath() );
+ }
+
+ delete pFileDialog;
+ }
+ break;
+
+ case SID_AUTO_REDRAW :
+ {
+ SmModule *pp = SM_MOD1();
+ BOOL bRedraw = pp->GetConfig()->IsAutoRedraw();
+ pp->GetConfig()->SetAutoRedraw(!bRedraw);
+ break;
+ }
+
+ case SID_SYMBOLS_CATALOGUE:
+ {
+ SmSymSetManager *pSymSetMgr = SM_MOD1()->GetSymSetManager();
+ SmSymbolDialog(NULL, *pSymSetMgr).Execute();
+ RestartFocusTimer();
+ break;
+ }
+
+ case SID_TOOLBOX:
+ {
+ SmViewShell *pView = SmGetActiveView();
+ pView->GetViewFrame()->ToggleChildWindow(
+ SmToolBoxWrapper::GetChildWindowId() );
+ break;
+ }
+
+ case SID_INSERT_FORMULA:
+ {
+ SfxMedium *pMedium = SFX_APP()->
+ InsertDocumentDialog(SFXWB_INSERT | WB_OPEN | WB_3DLOOK,
+ SmDocShell::Factory());
+
+ if (pMedium != NULL)
+ {
+ if (pMedium->IsStorage())
+ Insert(pMedium->GetStorage());
+ else
+ InsertFrom(*pMedium);
+ delete pMedium;
+
+ SetFormulaArranged(FALSE);
+ // Fenster anpassen, neuzeichnen, ModifyCount erh鰄en,...
+ if (pBindings)
+ pBindings->Invalidate(SID_GRAPHIC);
+ }
+ RestartFocusTimer();
+ rReq.SetReturnValue (SfxBoolItem (rReq.GetSlot(), TRUE));
+ break;
+ }
+
+ case SID_LOADSYMBOLS:
+ LoadSymbols();
+ break;
+
+ case SID_SAVESYMBOLS:
+ SaveSymbols();
+ break;
+
+ case SID_FONT:
+ {
+ SmFontTypeDialog *pFontTypeDialog = new SmFontTypeDialog(NULL);
+
+ pFontTypeDialog->ReadFrom(GetFormat());
+ if (pFontTypeDialog->Execute() == RET_OK)
+ {
+ SmFormat& rOldFormat = GetFormat();
+
+ pFontTypeDialog->WriteTo(GetFormat());
+ GetUndoManager()->AddUndoAction(
+ new SmFormatAction(this, rOldFormat, GetFormat()));
+
+ if (aText.Len ())
+ {
+ SetModified(TRUE);
+ if (pBindings)
+ pBindings->Invalidate(SID_GRAPHIC);
+ }
+ else SetModified (FALSE);
+ }
+ delete pFontTypeDialog;
+ RestartFocusTimer ();
+ break;
+ }
+
+ case SID_FONTSIZE:
+ {
+ SmFontSizeDialog *pFontSizeDialog = new SmFontSizeDialog(NULL);
+
+ pFontSizeDialog->ReadFrom(GetFormat());
+ if (pFontSizeDialog->Execute() == RET_OK)
+ {
+ SmFormat& rOldFormat = GetFormat();
+
+ pFontSizeDialog->WriteTo(GetFormat());
+
+ GetUndoManager()->AddUndoAction(
+ new SmFormatAction(this, rOldFormat, GetFormat()));
+
+ if (aText.Len ())
+ {
+ SetModified(TRUE);
+ if (pBindings)
+ pBindings->Invalidate(SID_GRAPHIC);
+ }
+ else SetModified (FALSE);
+ }
+ delete pFontSizeDialog;
+ RestartFocusTimer ();
+ break;
+ }
+
+ case SID_DISTANCE:
+ {
+ SmDistanceDialog *pDistanceDialog = new SmDistanceDialog(NULL);
+
+ pDistanceDialog->ReadFrom(GetFormat());
+ if (pDistanceDialog->Execute() == RET_OK)
+ {
+ SmFormat& rOldFormat = GetFormat();
+
+ pDistanceDialog->WriteTo(GetFormat());
+
+ GetUndoManager()->AddUndoAction(
+ new SmFormatAction(this, rOldFormat, GetFormat()));
+
+ if (aText.Len ())
+ {
+ SetModified(TRUE);
+ if (pBindings)
+ pBindings->Invalidate(SID_GRAPHIC);
+ }
+ else
+ SetModified (FALSE);
+ }
+ delete pDistanceDialog;
+ RestartFocusTimer ();
+ break;
+ }
+
+ case SID_ALIGN:
+ {
+ SmAlignDialog *pAlignDialog = new SmAlignDialog(NULL);
+
+ pAlignDialog->ReadFrom(GetFormat());
+ if (pAlignDialog->Execute() == RET_OK)
+ {
+ SmFormat& rOldFormat = GetFormat();
+
+ pAlignDialog->WriteTo(GetFormat());
+ SmModule *pp = SM_MOD1();
+ pAlignDialog->WriteTo(pp->GetConfig()->GetFormat());
+
+ GetUndoManager()->AddUndoAction(
+ new SmFormatAction(this, rOldFormat, GetFormat()));
+
+ if (aText.Len ())
+ {
+ SetModified(TRUE);
+ if (pBindings)
+ pBindings->Invalidate(SID_GRAPHIC);
+ }
+ else
+ SetModified (FALSE);
+ }
+ delete pAlignDialog;
+ RestartFocusTimer ();
+ break;
+ }
+
+ case SID_TEXT:
+ {
+ const SfxStringItem& rItem =
+ (const SfxStringItem&)rReq.GetArgs()->Get(SID_TEXT);
+
+ if (GetText() != rItem.GetValue())
+ {
+ GetUndoManager()->AddUndoAction(
+ new SmEditAction(this, GetText(), rItem.GetValue()));
+
+ SetText(rItem.GetValue());
+ }
+ break;
+ }
+
+ case SID_COPYOBJECT:
+ {
+ SvDataMemberObjectRef ObjRef = CreateSnapshot();
+ ObjRef->CopyClipboard();
+ break;
+ }
+
+ case SID_PASTEOBJECT:
+ {
+ SvDataObjectRef ObjRef = SvDataObject::PasteClipboard();
+
+ if (ObjRef.Is())
+ {
+ SvObjectDescriptor ObjDesc(ObjRef);
+
+ if (ObjDesc.GetClassName() == *GetSvFactory())
+ {
+ SvStorageRef StorageRef(new SvStorage(String()));
+ SvData ObjData(SOT_FORMATSTR_ID_EMBED_SOURCE);
+
+ ObjData.SetData(StorageRef, TRANSFER_REFERENCE);
+
+ if (ObjRef->GetDataHere(&ObjData))
+ Insert(StorageRef);
+ }
+ }
+
+ break;
+ }
+ }
+}
+
+
+void SmDocShell::GetState(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter(rSet);
+
+ for (USHORT nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich())
+ {
+ switch (nWh)
+ {
+ case SID_TEXTMODE:
+ {
+ rSet.Put(SfxBoolItem(SID_TEXTMODE, GetFormat().IsTextmode()));
+ break;
+ }
+
+ case SID_DOCTEMPLATE :
+ rSet.DisableItem (SID_DOCTEMPLATE);
+ break;
+
+ case SID_AUTO_REDRAW :
+ {
+ SmModule *pp = SM_MOD1();
+ BOOL bRedraw = pp->GetConfig()->IsAutoRedraw();
+
+ rSet.Put (SfxBoolItem(SID_AUTO_REDRAW, bRedraw));
+ break;
+ }
+
+ case SID_TOOLBOX:
+ {
+ BOOL bState = FALSE;
+ SmViewShell *pView = SmGetActiveView();
+ SfxChildWindow *pChildWnd = pView->GetViewFrame()->
+ GetChildWindow( SmToolBoxWrapper::GetChildWindowId() );
+
+ if (pChildWnd && pChildWnd->GetWindow()->IsVisible())
+ bState = TRUE;
+ rSet.Put(SfxBoolItem(SID_TOOLBOX, bState));
+ break;
+ }
+
+ case SID_MODIFYSTATUS:
+ {
+ char cMod = ' ';
+ if (IsModified())
+ cMod = '*';
+ rSet.Put(SfxStringItem(SID_MODIFYSTATUS, String(cMod)));
+ break;
+ }
+
+ case SID_TEXT:
+ rSet.Put(SfxStringItem(SID_TEXT, GetText()));
+ break;
+
+ case SID_GRAPHIC:
+ rSet.Put(SfxInt16Item(SID_GRAPHIC, nModifyCount));
+ break;
+ }
+ }
+}
+
+
+
+void SmDocShell::FillRegInfo(SvEmbeddedRegistryInfo * pInfo)
+{
+ SfxInPlaceObject::FillRegInfo(pInfo);
+ pInfo->aObjName.AssignAscii( RTL_CONSTASCII_STRINGPARAM(pStarMathDoc));
+ pInfo->nMajorVers = 5;
+ pInfo->nMinorVers = 0;
+ pInfo->aHumanShortTypeName = String(SmResId(RID_DOCUMENTSTR));
+ pInfo->nShell = REG_SHELL_OPEN | REG_SHELL_PRINT | REG_SHELL_PRINTTO;
+ pInfo->aExt.AssignAscii( RTL_CONSTASCII_STRINGPARAM(".SMF"));
+ pInfo->nIconResId = REG_ICON_RESID_MATH;
+}
+
+
+
+SfxUndoManager *SmDocShell::GetUndoManager ()
+{
+ if (! pUndoMgr)
+ {
+ pUndoMgr = new SfxUndoManager;
+ SetUndoManager(pUndoMgr);
+ }
+ return pUndoMgr;
+}
+
+
+
+void SmDocShell::SaveSymbols()
+{
+ SmModule *pp = SM_MOD1();
+ pp->GetSymSetManager()->Save();
+}
+
+
+
+void SmDocShell::RestartFocusTimer ()
+{
+ SmCmdBoxWrapper *pWrapper = NULL;
+ SmViewShell *pView = SmGetActiveView();
+ if (pView)
+ pWrapper = (SmCmdBoxWrapper *) pView->GetViewFrame()->
+ GetChildWindow( SmCmdBoxWrapper::GetChildWindowId() );
+
+ if (pWrapper)
+ pWrapper->RestartFocusTimer ();
+}
+
+
+
+void SmDocShell::Draw(OutputDevice *pDevice,
+ const JobSetup &,
+ USHORT nAspect)
+{
+ pDevice->IntersectClipRegion(GetVisArea());
+ Point atmppoint;
+ Draw(*pDevice, atmppoint);
+}
+
+
+
+void SmDocShell::HandsOff()
+{
+ SfxInPlaceObject::HandsOff();
+ aDocStream.Clear();
+}
+
+
+
+SvDataMemberObjectRef SmDocShell::CreateSnapshot ()
+{
+ return SfxInPlaceObject::CreateSnapshot ();
+}
+
+
+
+SfxItemPool& SmDocShell::GetPool()
+{
+ return SFX_APP()->GetPool();
+}
+
+const SvDataTypeList& SmDocShell::GetTypeList() const
+{
+ return aDataTypeList;
+}
+
+void SmDocShell::SetVisArea (const Rectangle & rVisArea)
+{
+ Rectangle aNewRect (rVisArea);
+
+ aNewRect.SetPos(Point ());
+
+ if (! aNewRect.Right ()) aNewRect.Right () = 2000;
+ if (! aNewRect.Bottom ()) aNewRect.Bottom () = 1000;
+
+ BOOL bIsEnabled = IsEnableSetModified();
+ if ( bIsEnabled )
+ EnableSetModified( FALSE );
+
+ // If outplace editing, then dont resize the OutplaceWindow. But the
+ // ObjectShell has to resize. Bug 56470
+ BOOL bUnLockFrame;
+ if( GetProtocol().IsEmbed() && !GetProtocol().IsInPlaceActive() &&
+ GetFrame() )
+ {
+ GetFrame()->LockAdjustPosSizePixel();
+ bUnLockFrame = TRUE;
+ }
+ else
+ bUnLockFrame = FALSE;
+
+ SfxInPlaceObject::SetVisArea( aNewRect );
+
+ if( bUnLockFrame )
+ GetFrame()->UnlockAdjustPosSizePixel();
+
+ if ( bIsEnabled )
+ EnableSetModified( bIsEnabled );
+}
+
+
+BOOL SmDocShell::Try3x (SvStorage *pStor,
+ StreamMode eMode)
+
+{
+ BOOL bRet = FALSE;
+
+ SvStorageStreamRef aTempStream = pStor->OpenStream(
+ String::CreateFromAscii(pStarMathDoc), eMode);
+ aTempStream->SetVersion (pStor->GetVersion ());
+ GetPool().SetFileFormatVersion (USHORT(pStor->GetVersion()));
+ aTempStream->SetBufferSize(DOCUMENT_BUFFER_SIZE);
+ aTempStream->SetKey( pStor->GetKey() ); // Passwort setzen
+
+ if (aTempStream->GetError() == 0)
+ {
+ SvStream* pSvStream = aTempStream;
+ char cTag;
+ ULONG lIdent, lVersion;
+ long lTime;
+ ULONG lDate;
+ String aBuffer;
+ SmSymSet *pSymbolSet;
+
+ *pSvStream >> lIdent >> lVersion;
+
+ if ((lIdent == SM30IDENT) || (lIdent == SM30BIDENT) || (lIdent == SM304AIDENT))
+ {
+ DBG_ASSERT((lVersion == SM30VERSION) ||
+ (lVersion == SM50VERSION), "Illegal file version");
+
+ *pSvStream >> cTag;
+ rtl_TextEncoding eEnc = gsl_getSystemTextEncoding();
+ while (cTag && !pSvStream->IsEof())
+ {
+ switch (cTag)
+ {
+ case 'T':
+ pSvStream->ReadByteString(aText, eEnc);
+ Parse();
+ break;
+
+ case 'D':
+ pSvStream->ReadByteString(aBuffer, eEnc);
+ pSvStream->ReadByteString(aBuffer, eEnc);
+ *pSvStream >> lDate >> lTime;
+ pSvStream->ReadByteString(aBuffer, eEnc);
+ *pSvStream >> lDate >> lTime;
+ pSvStream->ReadByteString(aBuffer, eEnc);
+ break;
+
+ case 'F':
+ *pSvStream >> aFormat;
+ if (lIdent != SM304AIDENT)
+ aFormat.From300To304a ();
+ else if ( lVersion == SM30VERSION )
+ {
+ aFormat.SetDistance(DIS_LEFTSPACE, 100);
+ aFormat.SetDistance(DIS_RIGHTSPACE, 100);
+ aFormat.SetDistance(DIS_TOPSPACE, 100);
+ aFormat.SetDistance(DIS_BOTTOMSPACE, 100);
+ }
+ break;
+
+ case 'S':
+ {
+ pSymbolSet = new SmSymSet();
+ *pSvStream >> *pSymbolSet;
+
+ SmModule *pp = SM_MOD1();
+
+ pp->GetSymSetManager()->AppendExtraSymbolSet(pSymbolSet);
+ break;
+ }
+
+ default:
+ DBG_ASSERT((cTag != 0), "Illegal data tag");
+ }
+ *pSvStream >> cTag;
+ }
+
+ bRet = TRUE;
+ aDocStream = aTempStream;
+ }
+ }
+
+ if (!bRet)
+ {
+ // kein Passwort gesetzt --> Datei marode
+ if (pStor->GetKey().Len() == 0)
+ {
+ SetError(ERRCODE_SFX_DOLOADFAILED);
+ }
+ // Passwort gesetzt --> war wohl falsch
+ else
+ {
+ SetError(ERRCODE_SFX_WRONGPASSWORD);
+ }
+ }
+
+ return bRet;
+}
+
+
+
+BOOL SmDocShell::Try2x (SvStorage *pStor,
+ StreamMode eMode)
+{
+ SvStorageStreamRef aTempStream = pStor->OpenStream(C2S("\1Ole10Native"), eMode);
+ aTempStream->SetVersion (pStor->GetVersion ());
+ GetPool().SetFileFormatVersion(USHORT(pStor->GetVersion ()));
+
+ if (aTempStream->GetError() == SVSTREAM_OK)
+ {
+ void ReadSM20SymSet(SvStream*, SmSymSet*);
+
+ SvStream* pSvStream = aTempStream;
+ char cTag;
+ ULONG lIdent, lVersion;
+ long lTime;
+ ULONG lDate;
+ UINT32 lDataSize;
+ String aBuffer;
+ SmSymSet *pSymbolSet;
+
+ *pSvStream >> lDataSize >> lIdent >> lVersion;
+
+ if (lIdent == FRMIDENT)
+ {
+ DBG_ASSERT((lVersion == FRMVERSION), "Illegal file version");
+
+ *pSvStream >> cTag;
+ rtl_TextEncoding eEnc = gsl_getSystemTextEncoding();
+ while (cTag && !pSvStream->IsEof())
+ {
+ switch (cTag)
+ {
+ case 'T':
+ pSvStream->ReadByteString(aBuffer, eEnc);
+ aText = aBuffer;
+ Parse();
+ break;
+
+ case 'D':
+ {
+ pSvStream->ReadByteString(aBuffer, eEnc);
+ pSvStream->ReadByteString(aBuffer, eEnc);
+ *pSvStream >> lDate >> lTime;
+ pSvStream->ReadByteString(aBuffer, eEnc);
+ *pSvStream >> lDate >> lTime;
+ pSvStream->ReadByteString(aBuffer, eEnc);
+ }
+ break;
+
+ case 'F':
+ {
+ //SmFormat aFormat;
+ aFormat.ReadSM20Format(*pSvStream);
+ aFormat.From300To304a ();
+ }
+ break;
+
+ case 'S':
+ {
+ pSymbolSet = new SmSymSet();
+ ReadSM20SymSet(pSvStream, pSymbolSet);
+
+ SmModule *pp = SM_MOD1();
+
+ pp->GetSymSetManager()->AppendExtraSymbolSet(pSymbolSet);
+ break;
+ }
+
+ default:
+ DBG_ASSERT((cTag != 0), "Illegal data tag");
+ }
+ *pSvStream >> cTag;
+ }
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+
+
+void SmDocShell::UIActivate (BOOL bActivate)
+{
+ if (bActivate)
+ {
+ SfxInPlaceObject::UIActivate (bActivate);
+ SmCmdBoxWrapper *pWrapper = NULL;
+ SmViewShell *pView = SmGetActiveView();
+ if (pView)
+ pWrapper = (SmCmdBoxWrapper *)pView->GetViewFrame()->
+ GetChildWindow( SmCmdBoxWrapper::GetChildWindowId() );
+
+ if (pWrapper)
+ pWrapper->Grab ();
+ }
+ else
+ {
+ SmViewShell *pViewSh = SmGetActiveView();
+ if (pViewSh)
+ {
+ pViewSh->GetViewFrame()->GetDispatcher()->Execute(
+ SID_GETEDITTEXT, SFX_CALLMODE_STANDARD,
+ new SfxVoidItem (SID_GETEDITTEXT), 0L);
+ SfxInPlaceObject::UIActivate (bActivate);
+ Resize();
+ }
+ }
+}
+
+
+
+void SmDocShell::FillClass(SvGlobalName* pClassName,
+ ULONG* pFormat,
+ String* pAppName,
+ String* pFullTypeName,
+ String* pShortTypeName,
+ long nFileFormat) const
+{
+ SfxInPlaceObject::FillClass(pClassName, pFormat, pAppName, pFullTypeName,
+ pShortTypeName, nFileFormat);
+
+ if (nFileFormat == SOFFICE_FILEFORMAT_31)
+ {
+ *pClassName = SvGlobalName(SO3_SM_CLASSID_30);
+ *pFormat = SOT_FORMATSTR_ID_STARMATH;
+ pAppName->AssignAscii( RTL_CONSTASCII_STRINGPARAM("Smath 3.1"));
+ *pFullTypeName = String(SmResId(STR_MATH_DOCUMENT_FULLTYPE_31));
+ *pShortTypeName = String(SmResId(RID_DOCUMENTSTR));
+ }
+ else if (nFileFormat == SOFFICE_FILEFORMAT_40)
+ {
+ *pClassName = SvGlobalName(SO3_SM_CLASSID_40);
+ *pFormat = SOT_FORMATSTR_ID_STARMATH_40;
+ *pFullTypeName = String(SmResId(STR_MATH_DOCUMENT_FULLTYPE_40));
+ *pShortTypeName = String(SmResId(RID_DOCUMENTSTR));
+ }
+ else if (nFileFormat == SOFFICE_FILEFORMAT_NOW)
+ {
+ *pFullTypeName = String(SmResId(STR_MATH_DOCUMENT_FULLTYPE_50));
+ *pShortTypeName = String(SmResId(RID_DOCUMENTSTR));
+ }
+}
+
+ULONG SmDocShell::GetMiscStatus() const
+{
+ return SfxInPlaceObject::GetMiscStatus() | SVOBJ_MISCSTATUS_NOTRESIZEABLE
+ | SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE;
+}
+
+void SmDocShell::SetModified(BOOL bModified)
+{
+ SfxObjectShell::SetModified(bModified);
+ Broadcast(SfxSimpleHint(SFX_HINT_DOCCHANGED));
+}
+
+BOOL SmDocShell::WriteAsMathType3( SfxMedium& rMedium )
+{
+ MathType aEquation( aText, pTree );
+ BOOL bRet = 0 != aEquation.ConvertFromStarMath( rMedium.GetStorage() );
+ return bRet;
+}
+
+
+
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
new file mode 100644
index 000000000000..6b1bcc163791
--- /dev/null
+++ b/starmath/source/edit.cxx
@@ -0,0 +1,783 @@
+/*************************************************************************
+ *
+ * $RCSfile: edit.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include "starmath.hrc"
+#define ITEMID_FONT 1
+#define ITEMID_FONTHEIGHT 2
+#define ITEMID_LRSPACE 3
+#define ITEMID_WEIGHT 4
+
+
+#ifndef _SV_MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+#ifndef _MyEDITVIEW_HXX //autogen
+#include <svx/editview.hxx>
+#endif
+#ifndef _MyEDITENG_HXX //autogen
+#include <svx/editeng.hxx>
+#endif
+#ifndef _EDITSTAT_HXX //autogen
+#include <svx/editstat.hxx>
+#endif
+#ifndef _EEITEM_HXX //autogen
+#include <svx/eeitem.hxx>
+#endif
+#ifndef _SFXDISPATCH_HXX //autogen
+#include <sfx2/dispatch.hxx>
+#endif
+#ifndef _SFXINTITEM_HXX //autogen
+#include <svtools/intitem.hxx>
+#endif
+#ifndef _SFXITEMPOOL_HXX //autogen
+#include <svtools/itempool.hxx>
+#endif
+#ifndef _SFXSTRITEM_HXX //autogen
+#include <svtools/stritem.hxx>
+#endif
+#ifndef _SVX_FHGTITEM_HXX //autogen
+#include <svx/fhgtitem.hxx>
+#endif
+#ifndef _SVX_WGHTITEM_HXX //autogen
+#include <svx/wghtitem.hxx>
+#endif
+#ifndef _SVX_LRSPITEM_HXX //autogen
+#include <svx/lrspitem.hxx>
+#endif
+#ifndef _SFXITEMSET_HXX //autogen
+#include <svtools/itemset.hxx>
+#endif
+#ifndef _SVX_FONTITEM_HXX //autogen
+#include <svx/fontitem.hxx>
+#endif
+
+
+#include "edit.hxx"
+#include "view.hxx"
+#include "document.hxx"
+#include "config.hxx"
+
+#define SCROLL_LINE 24
+
+#define MINWIDTH 200
+#define MINHEIGHT 200
+#define MINSPLIT 40
+#define SPLITTERWIDTH 2
+
+
+////////////////////////////////////////
+
+
+void SmGetLeftSelectionPart(const ESelection aSel,
+ USHORT &nPara, USHORT &nPos)
+ // returns paragraph number and position of the selections left part
+{
+ // compare start and end of selection and use the one that comes first
+ if ( aSel.nStartPara < aSel.nEndPara
+ || aSel.nStartPara == aSel.nEndPara && aSel.nStartPos < aSel.nEndPos)
+ { nPara = aSel.nStartPara;
+ nPos = aSel.nStartPos;
+ }
+ else
+ { nPara = aSel.nEndPara;
+ nPos = aSel.nEndPos;
+ }
+}
+
+////////////////////////////////////////
+
+SmEditWindow::SmEditWindow(Window* pParent) :
+ Window(pParent),
+ pEditView( 0 ),
+#if SUPD >= 602
+ pEditEngineItemPool( 0 ),
+#endif
+ pEditEngine( 0 ),
+ pHScrollBar( 0 ),
+ pVScrollBar( 0 ),
+ pScrollBox( 0 )
+{
+ SetHelpId(HID_SMA_COMMAND_WIN_EDIT);
+ EnableDrop();
+ SetMapMode(MAP_PIXEL);
+
+ SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
+
+ aModifyTimer.SetTimeoutHdl(LINK(this, SmEditWindow, ModifyTimerHdl));
+ aModifyTimer.SetTimeout(2000);
+ aModifyTimer.Start();
+
+ aCursorMoveTimer.SetTimeoutHdl(LINK(this, SmEditWindow, CursorMoveTimerHdl));
+ aCursorMoveTimer.SetTimeout(500);
+}
+
+SmEditWindow::~SmEditWindow()
+{
+ aCursorMoveTimer.Stop();
+ aModifyTimer.Stop();
+ if ( pEditEngine )
+ {
+ pEditEngine->RemoveView(pEditView);
+ delete pEditView;
+ delete pEditEngine;
+#if SUPD >= 602
+ delete pEditEngineItemPool;
+#endif
+ delete pHScrollBar;
+ delete pVScrollBar;
+ delete pScrollBox;
+ }
+}
+
+
+void SmEditWindow::ImplSetFont()
+{
+ SetPointFont( GetSettings().GetStyleSettings().GetAppFont() );
+ if ( pEditEngine )
+ {
+ Font aFont = GetFont();
+ pEditEngine->SetDefTab( USHORT( GetTextWidth( C2S("XXXX") ) ) );
+
+#if SUPD >= 602
+ DBG_ASSERT( pEditEngineItemPool, "NULL pointer");
+ pEditEngineItemPool->SetPoolDefaultItem(
+ SvxFontItem( aFont.GetFamily(), aFont.GetName(),
+ aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(),
+ EE_CHAR_FONTINFO ) );
+ pEditEngineItemPool->SetPoolDefaultItem(
+ SvxFontHeightItem( aFont.GetSize().Height(), 100,
+ EE_CHAR_FONTHEIGHT ) );
+// pEditEngineItemPool->SetPoolDefaultItem(
+// SvxWeightItem( WEIGHT_BOLD, EE_CHAR_WEIGHT ) );
+#else
+ SfxItemSet aSet( pEditEngine->GetEmptyItemSet() );
+ aSet.Put( SvxFontItem( aFont.GetFamily(), aFont.GetName(),
+ aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(),
+ EE_CHAR_FONTINFO ) );
+ aSet.Put( SvxFontHeightItem( aFont.GetSize().Height(), 100, EE_CHAR_FONTHEIGHT ) );
+// aSet.Put( SvxWeightItem(WEIGHT_BOLD, EE_CHAR_WEIGHT ) );
+
+ pEditEngine->SetDefaults(aSet);
+#endif
+ }
+}
+
+void SmEditWindow::DataChanged( const DataChangedEvent& )
+{
+ SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
+ ImplSetFont();
+ AdjustScrollBars();
+ Resize();
+}
+
+IMPL_LINK( SmEditWindow, ModifyTimerHdl, Timer *, pTimer )
+{
+ SmModule *pp = SM_MOD1();
+ if (pp->GetConfig()->IsAutoRedraw())
+ Flush();
+ aModifyTimer.Start();
+ return 0;
+}
+
+
+IMPL_LINK(SmEditWindow, CursorMoveTimerHdl, Timer *, pTimer)
+ // every once in a while check cursor position (selection) of edit
+ // window and if it has changed (try to) set the formula-cursor
+ // according to that.
+{
+ ESelection aNewSelection (GetSelection());
+
+ if (!aNewSelection.IsEqual(aOldSelection))
+ { SmViewShell *pView = SmGetActiveView();
+ //! woher wei man, dass die Shell die wir hier kriegen die ist, die
+ //! zu dem SmEditWindow gehoert fuer das er gestartet wurde?
+ //! (Eine ViewShell vom Math ist es immer)
+ //! Siehe auch Kommentar zu:
+ //! SmEditWindow::SetText und SmViewShell::Activate
+
+ if (pView)
+ {
+ // get row and column to look for
+ USHORT nRow, nCol;
+ SmGetLeftSelectionPart(aNewSelection, nRow, nCol);
+ nRow++;
+ nCol++;
+
+ pView->GetGraphicWindow().SetCursorPos(nRow, nCol);
+
+ aOldSelection = aNewSelection;
+ }
+ }
+
+ return 0;
+}
+
+
+void SmEditWindow::Resize()
+{
+ if (!pEditEngine)
+ CreateEditEngine();
+
+ if (pEditView)
+ {
+ pEditView->SetOutputArea(AdjustScrollBars());
+ pEditView->ShowCursor();
+
+ const long nMaxVisAreaStart = pEditView->GetEditEngine()->GetTextHeight() -
+ pEditView->GetOutputArea().GetHeight();
+ if (pEditView->GetVisArea().Top() > nMaxVisAreaStart)
+ {
+ Rectangle aVisArea(pEditView->GetVisArea() );
+ aVisArea.Top() = (nMaxVisAreaStart > 0 ) ? nMaxVisAreaStart : 0;
+ aVisArea.SetSize(pEditView->GetOutputArea().GetSize());
+ pEditView->SetVisArea(aVisArea);
+ pEditView->ShowCursor();
+ }
+ InitScrollBars();
+ }
+ Invalidate();
+}
+
+void SmEditWindow::MouseButtonUp(const MouseEvent &rEvt)
+{
+ if (pEditView)
+ pEditView->MouseButtonUp(rEvt);
+ else
+ Window::MouseButtonUp (rEvt);
+
+ // ggf FormulaCursor neu positionieren
+ CursorMoveTimerHdl(&aCursorMoveTimer);
+}
+
+void SmEditWindow::MouseButtonDown(const MouseEvent &rEvt)
+{
+ if (pEditView)
+ pEditView->MouseButtonDown(rEvt);
+ else
+ Window::MouseButtonDown (rEvt);
+
+ GrabFocus();
+}
+
+void SmEditWindow::Command(const CommandEvent& rCEvt)
+{
+ if (rCEvt.GetCommand() == COMMAND_CONTEXTMENU)
+ {
+ GetParent()->ToTop();
+
+ PopupMenu* pPopupMenu = new PopupMenu(SmResId(RID_COMMANDMENU));
+ pPopupMenu->SetSelectHdl(LINK(this, SmEditWindow, MenuSelectHdl));
+
+ pPopupMenu->Execute( this, OutputToScreenPixel(
+ rCEvt.GetMousePosPixel() ) );
+ delete pPopupMenu;
+ }
+ else if (pEditView)
+ pEditView->Command( rCEvt );
+ else
+ Window::Command (rCEvt);
+}
+
+IMPL_LINK_INLINE_START( SmEditWindow, MenuSelectHdl, Menu *, pMenu )
+{
+ SmViewShell *pViewSh = SmGetActiveView();
+ if (pViewSh)
+ pViewSh->GetViewFrame()->GetDispatcher()->Execute(
+ SID_INSERTCOMMAND, SFX_CALLMODE_STANDARD,
+ new SfxInt16Item(SID_INSERTCOMMAND, pMenu->GetCurItemId()), 0L);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SmEditWindow, MenuSelectHdl, Menu *, pMenu )
+
+void SmEditWindow::KeyInput(const KeyEvent& rKEvt)
+{
+ if (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE)
+ {
+ BOOL bCallBase = TRUE;
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ if ( pViewShell && pViewShell->ISA(SmViewShell) )
+ {
+ SmDocShell* pDocSh = (SmDocShell*) pViewShell->GetViewFrame()->GetObjectShell();
+ if (pDocSh)
+ {
+ /* fuert zum (sofortigen) Zerstoeren von this! */
+ pDocSh->DoInPlaceActivate( FALSE );
+ bCallBase = FALSE;
+ }
+ }
+ if ( bCallBase )
+ Window::KeyInput( rKEvt );
+ }
+ else
+ {
+ // Timer neu starten, um den Handler (auch bei l鋘geren Eingaben)
+ // m鰃lichst nur einmal am Ende aufzurufen.
+ aCursorMoveTimer.Start();
+
+ if ( !pEditView->PostKeyEvent(rKEvt) )
+ {
+ if ( !SfxViewShell::Current()->KeyInput(rKEvt) )
+ {
+ /* fuert bei F1 (Hilfe) zum Zerstoeren von this! */
+ Flush();
+ if ( aModifyTimer.IsActive() )
+ aModifyTimer.Stop();
+ Window::KeyInput(rKEvt);
+ }
+ else
+ {
+ //SFX hat evtl. Slot an der View gecallt und dabei (wg. Hack
+ //im SFX) den Focus auf die View gesetzt
+ SfxViewShell* pVShell = SfxViewShell::Current();
+ if ( pVShell && pVShell->ISA(SmViewShell) &&
+ ((SmViewShell*)pVShell)->GetGraphicWindow().HasFocus() )
+ {
+ GrabFocus();
+ }
+ }
+ }
+ else
+ aModifyTimer.Start();
+ }
+}
+
+void SmEditWindow::Paint(const Rectangle& rRect)
+{
+ if (!pEditEngine)
+ CreateEditEngine();
+
+ pEditView->Paint(rRect);
+}
+
+void SmEditWindow::CreateEditEngine()
+{
+ if (! pEditEngine)
+ {
+#if SUPD >= 602
+ pEditEngineItemPool = EditEngine::CreatePool();
+ pEditEngine = new EditEngine( pEditEngineItemPool );
+#else
+ pEditEngine = new EditEngine;
+#endif
+ pEditView = new EditView(pEditEngine, this);
+ pEditEngine->SetUpdateMode(FALSE);
+ pEditEngine->InsertView(pEditView);
+
+ pEditEngine->SetControlWord((pEditEngine->GetControlWord() | EE_CNTRL_AUTOINDENTING) &
+ (~EE_CNTRL_UNDOATTRIBS) & (~EE_CNTRL_PASTESPECIAL));
+
+ pEditEngine->SetWordDelimiters( C2S(" .=+-*/(){}[];\"" ));
+ pEditEngine->SetRefMapMode(MAP_PIXEL);
+
+ ImplSetFont();
+ pEditEngine->Clear(); //#77957 incorrect font size
+
+ pEditEngine->SetPaperSize( Size( 800, 0 ) );
+
+ pVScrollBar = new ScrollBar(this, WinBits(WB_VSCROLL));
+ pHScrollBar = new ScrollBar(this, WinBits(WB_HSCROLL));
+ pVScrollBar->SetScrollHdl(LINK(this, SmEditWindow, ScrollHdl));
+ pHScrollBar->SetScrollHdl(LINK(this, SmEditWindow, ScrollHdl));
+ pScrollBox = new ScrollBarBox(this);
+
+ pEditView->SetOutputArea(AdjustScrollBars());
+
+ ESelection eSelection;
+
+ pEditView->SetSelection(eSelection);
+ pEditEngine->SetUpdateMode(TRUE);
+ Update();
+ pEditView->ShowCursor(TRUE, TRUE);
+
+ pEditEngine->SetStatusEventHdl(LINK(this, SmEditWindow, EditStatusHdl));
+ SetPointer(pEditView->GetPointer());
+
+ pEditEngine->EraseVirtualDevice();
+ pEditEngine->ClearModifyFlag();
+
+ SetScrollBarRanges();
+ }
+}
+
+IMPL_LINK( SmEditWindow, EditStatusHdl, EditStatus *, pStat )
+{
+ if (! pEditView)
+ return 1;
+ else
+ {
+ SetScrollBarRanges();
+ return 0;
+ }
+}
+
+IMPL_LINK_INLINE_START( SmEditWindow, ScrollHdl, ScrollBar *, pScrollBar )
+{
+ pEditView->SetVisArea(Rectangle(Point(pHScrollBar->GetThumbPos(),
+ pVScrollBar->GetThumbPos()),
+ pEditView->GetVisArea().GetSize()));
+ pEditView->Invalidate();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SmEditWindow, ScrollHdl, ScrollBar *, pScrollBar )
+
+Rectangle SmEditWindow::AdjustScrollBars()
+{
+ const Size aOut( GetOutputSizePixel() );
+ Point aPoint;
+ Rectangle aRect( aPoint, aOut );
+
+ if ( pEditEngine )
+ {
+ const long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize();
+ Point aPt( aRect.TopRight() ); aPt.X() -= nTmp -1L;
+ pVScrollBar->SetPosSizePixel( aPt, Size(nTmp, aOut.Height() - nTmp));
+
+ aPt = aRect.BottomLeft(); aPt.Y() -= nTmp - 1L;
+ pHScrollBar->SetPosSizePixel( aPt, Size(aOut.Width() - nTmp, nTmp));
+
+ aPt.X() = pHScrollBar->GetSizePixel().Width();
+ aPt.Y() = pVScrollBar->GetSizePixel().Height();
+ pScrollBox->SetPosSizePixel(aPt, Size(nTmp, nTmp ));
+
+ aRect.Right() = aPt.X() - 2;
+ aRect.Bottom() = aPt.Y() - 2;
+ }
+ return aRect;
+}
+
+void SmEditWindow::SetScrollBarRanges()
+{
+ // Extra-Methode, nicht InitScrollBars, da auch fuer EditEngine-Events.
+ if (pEditEngine )
+ {
+ long nTmp = pEditEngine->GetTextHeight();
+ pVScrollBar->SetRange(Range(0, nTmp));
+ pVScrollBar->SetThumbPos(pEditView->GetVisArea().Top());
+
+ nTmp = pEditEngine->GetPaperSize().Width();
+ pHScrollBar->SetRange(Range(0,nTmp));
+ pHScrollBar->SetThumbPos(pEditView->GetVisArea().Left());
+ }
+}
+
+void SmEditWindow::InitScrollBars()
+{
+ if (pEditEngine )
+ {
+ const Size aOut( pEditView->GetOutputArea().GetSize() );
+ pVScrollBar->SetVisibleSize(aOut.Height());
+ pVScrollBar->SetPageSize(aOut.Height() * 8 / 10);
+ pVScrollBar->SetLineSize(aOut.Height() * 2 / 10);
+
+ pHScrollBar->SetVisibleSize(aOut.Width());
+ pHScrollBar->SetPageSize(aOut.Width() * 8 / 10);
+ pHScrollBar->SetLineSize(SCROLL_LINE );
+
+ SetScrollBarRanges();
+
+ pVScrollBar->Show();
+ pHScrollBar->Show();
+ pScrollBox->Show();
+ }
+}
+
+XubString SmEditWindow::GetText()
+{
+ if (!pEditEngine)
+ CreateEditEngine();
+
+ String aText (pEditEngine->GetText( LINEEND_LF ));
+ return aText;
+}
+
+void SmEditWindow::SetText(const XubString& rText)
+{
+ if (!pEditEngine)
+ CreateEditEngine();
+
+ if (!pEditEngine->IsModified())
+ {
+ ESelection eSelection = pEditView->GetSelection();
+
+ pEditEngine->SetText(rText);
+ pEditEngine->ClearModifyFlag();
+
+ //! Hier die Timer neu zu starten verhindert, dass die Handler f黵 andere
+ //! (im Augenblick nicht mehr aktive) Math Tasks aufgerufen werden.
+ aModifyTimer.Start();
+ aCursorMoveTimer.Start();
+
+ pEditView->SetSelection(eSelection);
+ }
+}
+
+BOOL SmEditWindow::IsAllSelected() const
+{
+ ESelection eSelection = pEditView->GetSelection();
+
+ if (!(pEditEngine->GetParagraphCount() - 1))
+ {
+ String Text (pEditEngine->GetText( LINEEND_LF ));
+ return !eSelection.nStartPos && (eSelection.nEndPos == Text.Len () - 1);
+ }
+ else
+ return !eSelection.nStartPara && (eSelection.nEndPara == (pEditEngine->GetParagraphCount() - 1));
+}
+
+void SmEditWindow::SelectAll()
+{
+ // set selection from first paragraph, first char to
+ // last paragraph, last char
+ ULONG nParaCnt = pEditEngine->GetParagraphCount(); //! always >= 1
+ DBG_ASSERT( nParaCnt >= 1, "Sm : paragraph count is 0!" );
+ ULONG nParaLen = pEditEngine->GetTextLen( nParaCnt - 1 );
+ pEditView->SetSelection( ESelection( 0, 0, nParaCnt - 1, nParaLen - 1 ) );
+}
+
+void SmEditWindow::InsertCommand(USHORT Command)
+{
+ //Anfang der Selektion merken und hinterher den Cursor daraufsetzen. Nur so
+ //macht das SelNextMark() Sinn.
+ ESelection aSelection = pEditView->GetSelection();
+ aSelection.nEndPos = aSelection.nStartPos;
+ aSelection.nEndPara = aSelection.nStartPara;
+
+ String aText = String(SmResId(Command));
+ pEditView->InsertText(aText);
+
+ if (HasMark(aText))
+ { // set selection to next mark
+ pEditView->SetSelection(aSelection);
+ SelNextMark();
+ }
+ else
+ { // set selection after inserted text
+ aSelection.nStartPos =
+ aSelection.nEndPos += aText.Len();
+ pEditView->SetSelection(aSelection);
+ }
+
+ GrabFocus();
+}
+
+void SmEditWindow::MarkError(const Point &rPos)
+{
+ const int Col = rPos.X();
+ const int Row = rPos.Y() - 1;
+
+ pEditView->SetSelection(ESelection (Row, Col - 1, Row, Col));
+ GrabFocus();
+}
+
+void SmEditWindow::SelNextMark()
+{
+ ESelection eSelection = pEditView->GetSelection();
+ USHORT Pos = eSelection.nEndPos;
+ String aMark (C2S("<?>"));
+ String aText;
+ USHORT nCounts = pEditEngine->GetParagraphCount();
+
+ while (eSelection.nEndPara < nCounts)
+ {
+ aText = pEditEngine->GetText(eSelection.nEndPara);
+ Pos = aText.Search(aMark, Pos);
+
+ if (Pos != STRING_NOTFOUND)
+ {
+ pEditView->SetSelection(ESelection (eSelection.nEndPara, Pos, eSelection.nEndPara, Pos + 3));
+ break;
+ }
+
+ Pos = 0;
+ eSelection.nEndPara++;
+ }
+}
+
+void SmEditWindow::SelPrevMark()
+{
+ ESelection eSelection = pEditView->GetSelection();
+ USHORT Pos = STRING_NOTFOUND;
+ xub_StrLen Max = eSelection.nStartPos;
+ String Text (pEditEngine->GetText(eSelection.nStartPara));
+ String aMark (C2S("<?>"));
+ USHORT nCounts = pEditEngine->GetParagraphCount();
+
+ do
+ {
+ USHORT Fnd = Text.Search(aMark, 0);
+
+ while ((Fnd < Max) && (Fnd != STRING_NOTFOUND))
+ {
+ Pos = Fnd;
+ Fnd = Text.Search(aMark, Fnd + 1);
+ }
+
+ if (Pos == STRING_NOTFOUND)
+ {
+ eSelection.nStartPara--;
+ Text = pEditEngine->GetText(eSelection.nStartPara);
+ Max = Text.Len();
+ }
+ }
+ while ((eSelection.nStartPara < nCounts) &&
+ (Pos == STRING_NOTFOUND));
+
+ if (Pos != STRING_NOTFOUND)
+ {
+ pEditView->SetSelection(ESelection (eSelection.nStartPara, Pos, eSelection.nStartPara, Pos + 3));
+ }
+}
+
+BOOL SmEditWindow::HasMark(const String& rText) const
+ // returns true iff 'rText' contains a mark
+{
+ return rText.SearchAscii("<?>", 0) != STRING_NOTFOUND;
+}
+
+void SmEditWindow::MouseMove(const MouseEvent &rEvt)
+{
+ if (pEditView) pEditView->MouseMove(rEvt);
+}
+
+BOOL SmEditWindow::Drop(const DropEvent& rEvt)
+{
+ return pEditView
+ ? (pEditView->Drop(rEvt))
+ : FALSE;
+}
+
+BOOL SmEditWindow::QueryDrop(DropEvent& rEvt)
+{
+ return pEditView
+ ? pEditView->QueryDrop(rEvt)
+ : FALSE;
+}
+
+ESelection SmEditWindow::GetSelection() const
+{
+ DBG_ASSERT(pEditView, "Sm : NULL pointer");
+ return pEditView->GetSelection();
+}
+
+void SmEditWindow::SetSelection(const ESelection &rSel)
+{
+ DBG_ASSERT(pEditView, "Sm : NULL pointer");
+ pEditView->SetSelection(rSel);
+}
+
+BOOL SmEditWindow::IsEmpty() const
+{
+ return pEditEngine->GetTextLen() == 0;
+}
+
+BOOL SmEditWindow::IsSelected() const
+{
+ return pEditView->HasSelection();
+}
+
+void SmEditWindow::Cut()
+{
+ pEditView->Cut();
+}
+
+void SmEditWindow::Copy()
+{
+ pEditView->Copy();
+}
+
+void SmEditWindow::Paste()
+{
+ pEditView->Paste();
+}
+
+void SmEditWindow::Delete()
+{
+ pEditView->DeleteSelected();
+}
+
+void SmEditWindow::InsertText(const String& Text)
+{
+ pEditView->InsertText(Text);
+}
+
+void SmEditWindow::Flush()
+{
+ if ( pEditEngine && pEditEngine->IsModified() )
+ {
+ pEditEngine->ClearModifyFlag();
+ SmViewShell *pViewSh = SmGetActiveView();
+ if (pViewSh)
+ pViewSh->GetViewFrame()->GetDispatcher()->Execute(
+ SID_TEXT, SFX_CALLMODE_STANDARD,
+ new SfxStringItem(SID_TEXT, GetText()), 0L);
+ }
+
+ if (aCursorMoveTimer.IsActive())
+ {
+ aCursorMoveTimer.Stop();
+ // ggf noch die (neue) FormulaCursor Position setzen
+ CursorMoveTimerHdl(&aCursorMoveTimer);
+ }
+}
+
+
diff --git a/starmath/source/format.cxx b/starmath/source/format.cxx
new file mode 100644
index 000000000000..b5ed6622f2ff
--- /dev/null
+++ b/starmath/source/format.cxx
@@ -0,0 +1,311 @@
+/*************************************************************************
+ *
+ * $RCSfile: format.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+
+#ifndef FORMAT_HXX
+#include "format.hxx"
+#endif
+
+SmFormat::SmFormat()
+: aBaseSize(0, SmPtsTo100th_mm(12))
+{
+ nVersion = SM_FMT_VERSION_NOW;
+
+ eHorAlign = AlignCenter;
+ bIsTextmode = bScaleNormalBrackets = FALSE;
+
+ vSize[SIZ_TEXT] = 100;
+ vSize[SIZ_INDEX] = 60;
+ vSize[SIZ_FUNCTION] =
+ vSize[SIZ_OPERATOR] = 100;
+ vSize[SIZ_LIMITS] = 60;
+
+ vDist[DIS_HORIZONTAL] = 10;
+ vDist[DIS_VERTICAL] = 5;
+ vDist[DIS_ROOT] = 0;
+ vDist[DIS_SUPERSCRIPT] =
+ vDist[DIS_SUBSCRIPT] = 20;
+ vDist[DIS_NUMERATOR] =
+ vDist[DIS_DENOMINATOR] = 0;
+ vDist[DIS_FRACTION] = 10;
+ vDist[DIS_STROKEWIDTH] = 5;
+ vDist[DIS_UPPERLIMIT] =
+ vDist[DIS_LOWERLIMIT] = 0;
+ vDist[DIS_BRACKETSIZE] =
+ vDist[DIS_BRACKETSPACE] = 5;
+ vDist[DIS_MATRIXROW] = 3;
+ vDist[DIS_MATRIXCOL] = 30;
+ vDist[DIS_ORNAMENTSIZE] =
+ vDist[DIS_ORNAMENTSPACE] = 0;
+ vDist[DIS_OPERATORSIZE] = 50;
+ vDist[DIS_OPERATORSPACE] = 20;
+ vDist[DIS_LEFTSPACE] =
+ vDist[DIS_RIGHTSPACE] = 100;
+ vDist[DIS_TOPSPACE] =
+ vDist[DIS_BOTTOMSPACE] =
+ vDist[DIS_NORMALBRACKETSIZE] = 0;
+
+ vFont[FNT_VARIABLE] =
+ vFont[FNT_FUNCTION] =
+ vFont[FNT_NUMBER] =
+ vFont[FNT_TEXT] =
+ vFont[FNT_SERIF] = SmFace(C2S(FNTNAME_TIMES), aBaseSize);
+ vFont[FNT_SANS] = SmFace(C2S(FNTNAME_HELV), aBaseSize);
+ vFont[FNT_FIXED] = SmFace(C2S(FNTNAME_COUR), aBaseSize);
+ vFont[FNT_MATH] = SmFace(C2S(FNTNAME_MATH), aBaseSize);
+
+ vFont[FNT_VARIABLE].SetItalic(ITALIC_NORMAL);
+ vFont[FNT_FUNCTION].SetItalic(ITALIC_NONE);
+ vFont[FNT_TEXT].SetItalic(ITALIC_NONE);
+
+ for ( USHORT i = FNT_BEGIN; i <= FNT_END; i++ )
+ {
+ vFont[i].SetTransparent(TRUE);
+ vFont[i].SetAlign(ALIGN_BASELINE);
+ }
+}
+
+
+SmFormat & SmFormat::operator = (const SmFormat &rFormat)
+{
+ SetBaseSize(rFormat.GetBaseSize());
+ SetVersion (rFormat.GetVersion());
+ SetHorAlign(rFormat.GetHorAlign());
+ SetTextmode(rFormat.IsTextmode());
+ SetScaleNormalBrackets(rFormat.IsScaleNormalBrackets());
+
+ USHORT i;
+ for (i = FNT_BEGIN; i <= FNT_END; i++)
+ SetFont(i, rFormat.GetFont(i));
+ for (i = SIZ_BEGIN; i <= SIZ_END; i++)
+ SetRelSize(i, rFormat.GetRelSize(i));
+ for (i = DIS_BEGIN; i <= DIS_END; i++)
+ SetDistance(i, rFormat.GetDistance(i));
+
+ return *this;
+}
+
+
+SvStream & operator << (SvStream &rStream, const SmFormat &rFormat)
+{
+ //Da hier keinerlei Kompatibilit則 vorgesehen ist muessen wir leider
+ //heftig tricksen. Gluecklicherweise sind offenbar einige Informationen
+ //ueberfluessig geworden. In diese quetschen wir jetzt vier neue
+ //Einstellungen fuer die Rander.
+ //Bei Gelegenheit wird hier ein Im- Und Export gebraucht. Dann muessen
+ //die Stream-Operatoren dieser Klassen dringend mit Versionsverwaltung
+ //versehen werden!
+
+ UINT16 n;
+
+ // convert the heigth (in 100th of mm) to Pt and round the result to the
+ // nearest integer
+ n = (UINT16) SmRoundFraction(Sm100th_mmToPts(rFormat.aBaseSize.Height()));
+ DBG_ASSERT((n & 0xFF00) == 0, "Sm : higher Byte nicht leer");
+
+ // to be compatible with the old format (size and order) we put the info
+ // about textmode in the higher byte (height is already restricted to a
+ // maximum of 127!)
+ n |= (rFormat.bIsTextmode != 0) << 8
+ | (rFormat.bScaleNormalBrackets != 0) << 9;
+ rStream << n;
+
+ rStream << rFormat.vDist[DIS_LEFTSPACE]; //Wir nutzen den Platz
+ rStream << rFormat.vDist[DIS_RIGHTSPACE]; //Wir nutzen den Platz
+
+ for ( n = SIZ_BEGIN; n <= SIZ_END; ++n )
+ rStream << rFormat.vSize[n];
+
+ rStream << rFormat.vDist[DIS_TOPSPACE]; //Wir nutzen den Platz
+
+ for ( n = 0; n <= FNT_FIXED; ++n )
+ rStream << rFormat.vFont[n];
+
+ // Den zweiten Wert noch im HigherByte unterbringen
+ USHORT uTmp = rFormat.vDist[DIS_BRACKETSIZE]
+ | rFormat.vDist[DIS_NORMALBRACKETSIZE] << 8;
+ // und dann dieses rausstreamen
+ for ( n = 0; n <= DIS_OPERATORSPACE; ++n )
+ rStream << (USHORT)(n != DIS_BRACKETSIZE ? rFormat.vDist[(USHORT) n] : uTmp);
+
+ // higher byte is version number, lower byte is horizontal alignment
+ n = rFormat.eHorAlign | SM_FMT_VERSION_NOW << 8;
+ rStream << n;
+
+ rStream << rFormat.vDist[DIS_BOTTOMSPACE]; //Wir nutzen den Platz
+
+ return rStream;
+}
+
+
+SvStream & operator >> (SvStream &rStream, SmFormat &rFormat)
+{
+ UINT16 n;
+
+ rStream >> n;
+ long nBaseHeight = n & 0x00FF;
+ rFormat.bIsTextmode = ((n >> 8) & 0x01) != 0;
+ rFormat.bScaleNormalBrackets = ((n >> 9) & 0x01) != 0;
+ rFormat.aBaseSize = Size(0, SmPtsTo100th_mm(nBaseHeight));
+
+ rStream >> rFormat.vDist[DIS_LEFTSPACE]; //Wir nutzen den Platz
+ rStream >> rFormat.vDist[DIS_RIGHTSPACE]; //Wir nutzen den Platz
+
+ for ( n = SIZ_BEGIN; n <= SIZ_END; ++n )
+ rStream >> rFormat.vSize[n];
+
+ rStream >> rFormat.vDist[DIS_TOPSPACE]; //Wir nutzen den Platz
+
+ for ( n = 0; n <= FNT_FIXED; ++n )
+ rStream >> rFormat.vFont[n];
+
+ for ( n = 0; n <= DIS_OPERATORSPACE; ++n )
+ rStream >> rFormat.vDist[n];
+ // den zweiten Wert aus dem HigherByte holen
+ rFormat.vDist[DIS_NORMALBRACKETSIZE] = rFormat.vDist[DIS_BRACKETSIZE] >> 8;
+ // und dieses dann ausblenden
+ rFormat.vDist[DIS_BRACKETSIZE] &= 0x00FF;
+
+ // higher byte is version number, lower byte is horizontal alignment
+ rStream >> n;
+ rFormat.nVersion = n >> 8;
+ rFormat.eHorAlign = (SmHorAlign) (n & 0x00FF);
+
+ rStream >> rFormat.vDist[DIS_BOTTOMSPACE]; //Wir nutzen den Platz
+
+ const Size aTmp( rFormat.GetBaseSize() );
+ for ( USHORT i = 0; i <= FNT_FIXED; ++i )
+ {
+ rFormat.vFont[i].SetSize(aTmp);
+ rFormat.vFont[i].SetTransparent(TRUE);
+ rFormat.vFont[i].SetAlign(ALIGN_BASELINE);
+ }
+ rFormat.vFont[FNT_MATH].SetSize(aTmp);
+
+ // F黵 Version 4.0 (und 鋖ter) sollen auch die normalen Klammern skalierbar
+ // sein und wachsen (so wie es der Fall war), in der 5.0 Version jedoch nicht.
+ // In sp鋞eren Versionen (>= 5.1) ist das Verhalten nun durch den Anwender
+ // festzulegen (bleibt also wie aus dem Stream gelesen).
+ if (rFormat.nVersion < SM_FMT_VERSION_51)
+ {
+ BOOL bIs50Stream = rStream.GetVersion() == SOFFICE_FILEFORMAT_50;
+ BOOL bVal = bIs50Stream ? FALSE : TRUE;
+ USHORT nExcHeight = bIs50Stream ? 0 : rFormat.vDist[DIS_BRACKETSIZE];
+
+ rFormat.SetScaleNormalBrackets(bVal);
+ rFormat.SetDistance(DIS_NORMALBRACKETSIZE, nExcHeight);
+ }
+
+ return rStream;
+}
+
+void SmFormat::ReadSM20Format(SvStream &rStream)
+{
+ UINT16 n;
+ USHORT i;
+
+ rStream >> n;
+ SetBaseSize( Size(0, SmPtsTo100th_mm(n)) );
+
+ rStream >> n >> n;
+
+ for (i = SIZ_BEGIN; i <= SIZ_LIMITS; i++)
+ { rStream >> n;
+ SetRelSize(i, n);
+ }
+
+ rStream >> n;
+
+ for (i = FNT_BEGIN; i <= FNT_FIXED; i++)
+ ReadSM20Font(rStream, Font(i));
+
+ for (i = DIS_BEGIN; i <= DIS_OPERATORSPACE; i++)
+ { rStream >> n;
+ SetDistance(i, n);
+ }
+
+ rStream >> n;
+ SetHorAlign((SmHorAlign) n);
+ rStream >> n;
+
+ const Size aTmp (GetBaseSize());
+ for (i = FNT_BEGIN; i <= FNT_FIXED; i++)
+ {
+ Font(i).SetSize(aTmp);
+ Font(i).SetTransparent(TRUE);
+ Font(i).SetAlign(ALIGN_BASELINE);
+ }
+ Font(FNT_MATH).SetSize(aTmp);
+}
+
+
+void SmFormat::From300To304a()
+{
+ long nBaseSize = SmRoundFraction(Sm100th_mmToPts(aBaseSize.Height()))
+ * 2540l / 72l;
+ for (USHORT i = DIS_BEGIN; i < DIS_OPERATORSPACE; i++)
+ SetDistance(i, USHORT(GetDistance(i) * 254000L / 72L / nBaseSize));
+}
+
+
+
diff --git a/starmath/source/makefile.mk b/starmath/source/makefile.mk
new file mode 100644
index 000000000000..fed1043b88d0
--- /dev/null
+++ b/starmath/source/makefile.mk
@@ -0,0 +1,163 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+#MKDEPENDSOLVER=YES
+PROJECTPCH4DLL=TRUE
+
+PRJ=..
+
+PRJNAME=starmath
+TARGET=starmath
+
+PROJECTPCH=math_pch
+PDBTARGET=math_pch
+PROJECTPCHSOURCE=math_pch
+
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.INCLUDE : $(UPD)minor.mk
+RSCUPDVER=$(RSCREVISION)(SV$(UPD)$(UPDMINOR))
+
+IMGLST_SRS=$(SRS)$/smres.srs
+
+# --- Files --------------------------------------------------------
+
+SMDLL=TRUE
+
+SRS2NAME =smres
+SRC2FILES = smres.src \
+ commands.src
+
+SLOFILES = \
+ $(SLO)$/frmload.obj \
+ $(SLO)$/typemap.obj \
+ $(SLO)$/symbol.obj \
+ $(SLO)$/toolbox.obj \
+ $(SLO)$/action.obj \
+ $(SLO)$/config.obj \
+ $(SLO)$/dialog.obj \
+ $(SLO)$/document.obj \
+ $(SLO)$/mathtype.obj \
+ $(SLO)$/format.obj \
+ $(SLO)$/node.obj \
+ $(SLO)$/parse.obj \
+ $(SLO)$/utility.obj \
+ $(SLO)$/smdll.obj \
+ $(SLO)$/smmod.obj \
+ $(SLO)$/view.obj \
+ $(SLO)$/edit.obj \
+ $(SLO)$/rect.obj \
+ $(SLO)$/unomodel.obj \
+ $(SLO)$/xchar.obj
+
+EXCEPTIONSFILES = \
+ $(SLO)$/document.obj \
+ $(SLO)$/frmload.obj \
+ $(SLO)$/symbol.obj \
+ $(SLO)$/unomodel.obj
+
+
+LIB2TARGET = $(SLB)$/ysm.lib
+LIB2ARCHIV = $(LB)$/libysm.a
+LIB2OBJFILES = $(SLO)$/smlib.obj
+
+DEPOBJFILES = $(SLO)$/smlib.obj
+# --- Targets -------------------------------------------------------
+
+.IF "$(depend)" == ""
+
+ALL: \
+ $(INCCOM)$/dllname.hxx \
+ ALLTAR
+
+.IF "$(GUI)"=="UNX" || "$(GUI)"=="MAC"
+CDEFS+=-DUSE_POLYGON
+.ENDIF
+
+$(INCCOM)$/dllname.hxx: makefile.mk
+.IF "$(GUI)"=="OS2"
+ echo #define DLL_NAME "sm$(UPD)$(DLLPOSTFIX)" >$@
+.ELSE
+.IF "$(GUI)"=="MAC"
+ echo "$(HASHMARK)define DLL_NAME "sm$(UPD)$(DLLPOSTFIX).dll"" > $@
+.ELSE
+.IF "$(GUI)"=="UNX"
+ $(RM) $@
+ echo #define DLL_NAME \"libsm$(UPD)$(DLLPOSTFIX)$(DLLPOST)\" >$@
+.ELSE
+ echo #define DLL_NAME "sm$(UPD)$(DLLPOSTFIX)$(DLLPOST)" >$@
+.ENDIF
+.ENDIF
+.ENDIF
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+$(SRS)$/smres.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
+
diff --git a/starmath/source/math_pch.cxx b/starmath/source/math_pch.cxx
new file mode 100644
index 000000000000..8570ebc4d579
--- /dev/null
+++ b/starmath/source/math_pch.cxx
@@ -0,0 +1,893 @@
+/*************************************************************************
+ *
+ * $RCSfile: math_pch.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define SMDLL 1
+
+#include "starmath.hrc"
+
+#define ITEMID_FONT 1
+#define ITEMID_FONTHEIGHT 2
+#define ITEMID_LRSPACE 3
+#define ITEMID_WEIGHT 4
+
+//--------- ab hier die "generierten"
+#include <tools/string.hxx>
+#include <tools/solar.h>
+#include <tools/list.hxx>
+#include <tools/contnr.hxx>
+#include <tools/rtti.hxx>
+#include <tools/ref.hxx>
+#include <tools/link.hxx>
+#include <svtools/brdcst.hxx>
+#include <svtools/svarray.hxx>
+#include <tools/debug.hxx>
+#include <svtools/hint.hxx>
+#include <svtools/smplhint.hxx>
+#include <sot/sotref.hxx>
+#include <tools/globname.hxx>
+#include <sot/factory.hxx>
+#include <vcl/sv.h>
+#include <svtools/sbxdef.hxx>
+#include <tools/time.hxx>
+#include <tools/gen.hxx>
+#include <tools/stream.hxx>
+#include <tools/errinf.hxx>
+#include <tools/errcode.hxx>
+#include <sot/object.hxx>
+#include <sot/sotdata.hxx>
+#include <sfx2/shell.hxx>
+#include <sal/types.h>
+#include <sal/config.h>
+#include <tools/date.hxx>
+#include <sot/dtrans.hxx>
+#include <tools/ownlist.hxx>
+#include <vcl/accel.hxx>
+#include <vcl/resid.hxx>
+#include <tools/resid.hxx>
+#include <vcl/rc.hxx>
+#include <tools/rc.hxx>
+#include <tools/lang.hxx>
+#include <tools/resmgr.hxx>
+#include <vcl/keycod.hxx>
+#include <vcl/keycodes.hxx>
+#include <vcl/vclenum.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/cmdevt.hxx>
+#include <vcl/font.hxx>
+#include <vcl/color.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/region.hxx>
+#include <vcl/mapmod.hxx>
+#include <tools/fract.hxx>
+#include <vcl/wall.hxx>
+#include <vcl/settings.hxx>
+#include <tools/intn.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/pointr.hxx>
+#include <vcl/ptrstyle.hxx>
+#include <vcl/wintypes.hxx>
+#include <vcl/inputctx.hxx>
+#include <vcl/event.hxx>
+#include <format.hxx>
+#include <utility.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/image.hxx>
+#include <vcl/ctrl.hxx>
+#include <vcl/window.hxx>
+#include <vcl/icon.hxx>
+#include <sfx2/minarray.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/combobox.h>
+#include <vcl/edit.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/lstbox.h>
+#include <usr/guid.hxx>
+#include <usr/sequ.hxx>
+#include <uno/types.h>
+#include <uno/macros.h>
+#include <vos/xception.hxx>
+#include <osl/mutex.h>
+#include <tools/shl.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/imgdef.hxx>
+#include <usr/uno.hxx>
+#include <usr/xiface.hxx>
+#include <usr/ustring.hxx>
+#include <vos/refernce.hxx>
+#include <vos/types.hxx>
+#include <osl/types.h>
+#include <osl/interlck.h>
+#include <vos/object.hxx>
+#include <vos/macros.hxx>
+#include <smdll.hxx>
+#include <smdll0.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <chaos/cntids.hrc>
+#include <svtools/cntwids.hrc>
+#include <svtools/solar.hrc>
+#include <svtools/lstner.hxx>
+#include <starmath.hrc>
+#include <svtools/sbx.hxx>
+#include <svtools/sbxform.hxx>
+#include <svtools/sbxobj.hxx>
+#include <svtools/sbxvar.hxx>
+#include <svtools/sbxcore.hxx>
+#include <svtools/sbxprop.hxx>
+#include <svtools/sbxmeth.hxx>
+#include <tools/unqid.hxx>
+#include <tools/unqidx.hxx>
+#include <svtools/poolitem.hxx>
+#include <svtools/args.hxx>
+#include <smmod.hxx>
+#include <vos/thread.hxx>
+#include <osl/thread.h>
+#include <vos/runnable.hxx>
+#include <vcl/apptypes.hxx>
+#include <tools/dynary.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/svapp.hxx>
+#include <svtools/iniman.hxx>
+#include <vcl/timer.hxx>
+#include <sfx2/app.hxx>
+#include <svtools/plugapp.hxx>
+#include <sfx2/sfx.hrc>
+#include <svtools/memberid.hrc>
+#include <vcl/syswin.hxx>
+#include <vcl/virdev.hxx>
+#include <tools/datetime.hxx>
+#include <tools/wldcrd.hxx>
+#include <parse.hxx>
+#include <tools/stack.hxx>
+#include <types.hxx>
+#include <config.hxx>
+#include <sfx2/cfgitem.hxx>
+#include <svtools/confitem.hxx>
+#include <xchar.hxx>
+#include <vcl/poly.hxx>
+#include <svx/xpoly.hxx>
+#include <rect.hxx>
+#include <vcl/outdev.hxx>
+#include <so3/so2ref.hxx>
+#ifndef _SMART_COM_SUN_STAR_FRAME_XDISPATCHPROVIDERINTERCEPTOR_HXX_
+#include <smart/com/sun/star/frame/XDispatchProviderInterceptor.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_XDISPATCH_HXX_
+#include <smart/com/sun/star/frame/XDispatch.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HXX_
+#include <smart/com/sun/star/frame/XDispatchProvider.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_XSTATUSLISTENER_HXX_
+#include <smart/com/sun/star/frame/XStatusListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HXX_
+#include <smart/com/sun/star/frame/FrameSearchFlag.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_XDISPATCHPROVIDERINTERCEPTION_HXX_
+#include <smart/com/sun/star/frame/XDispatchProviderInterception.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_FEATURESTATEEVENT_HXX_
+#include <smart/com/sun/star/frame/FeatureStateEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_DISPATCHDESCRIPTOR_HXX_
+#include <smart/com/sun/star/frame/DispatchDescriptor.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_XFRAMEACTIONLISTENER_HXX_
+#include <smart/com/sun/star/frame/XFrameActionListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HXX_
+#include <smart/com/sun/star/frame/XComponentLoader.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_XFRAME_HXX_
+#include <smart/com/sun/star/frame/XFrame.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_FRAMEACTIONEVENT_HXX_
+#include <smart/com/sun/star/frame/FrameActionEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_FRAMEACTION_HXX_
+#include <smart/com/sun/star/frame/FrameAction.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_UTIL_XURLTRANSFORMER_HXX_
+#include <smart/com/sun/star/util/XURLTransformer.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_TASK_XSTATUSINDICATORFACTORY_HXX_
+#include <smart/com/sun/star/task/XStatusIndicatorFactory.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_TASK_XSTATUSINDICATORSUPPLIER_HXX_
+#include <smart/com/sun/star/task/XStatusIndicatorSupplier.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_TASK_XSTATUSINDICATOR_HXX_
+#include <smart/com/sun/star/task/XStatusIndicator.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_FRAME_XBROWSEHISTORYREGISTRY_HXX_
+#include <smart/com/sun/star/frame/XBrowseHistoryRegistry.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_IO_BUFFERSIZEEXCEEDEDEXCEPTION_HXX_
+#include <smart/com/sun/star/io/BufferSizeExceededException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_IO_NOTCONNECTEDEXCEPTION_HXX_
+#include <smart/com/sun/star/io/NotConnectedException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_IO_IOEXCEPTION_HXX_
+#include <smart/com/sun/star/io/IOException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_IO_UNEXPECTEDEOFEXCEPTION_HXX_
+#include <smart/com/sun/star/io/UnexpectedEOFException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_IO_WRONGFORMATEXCEPTION_HXX_
+#include <smart/com/sun/star/io/WrongFormatException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_SERVICENOTREGISTEREDEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/ServiceNotRegisteredException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_NULLPOINTEREXCEPTION_HXX_
+#include <smart/com/sun/star/lang/NullPointerException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_CLASSNOTFOUNDEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/ClassNotFoundException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_NOSUCHMETHODEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/NoSuchMethodException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_SECURITYEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/SecurityException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_NOSUCHFIELDEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/NoSuchFieldException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/DisposedException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_ARRAYINDEXOUTOFBOUNDSEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/ArrayIndexOutOfBoundsException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_ILLEGALACCESSEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/IllegalAccessException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_INDEXOUTOFBOUNDSEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/IndexOutOfBoundsException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/IllegalArgumentException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_NOSUPPORTEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/NoSupportException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_WRAPPEDTARGETEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/WrappedTargetException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_PARAMINFO_HXX_
+#include <smart/com/sun/star/reflection/ParamInfo.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_XIDLARRAY_HXX_
+#include <smart/com/sun/star/reflection/XIdlArray.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_XIDLCLASSPROVIDER_HXX_
+#include <smart/com/sun/star/reflection/XIdlClassProvider.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_FIELDACCESSMODE_HXX_
+#include <smart/com/sun/star/reflection/FieldAccessMode.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_XIDLCLASS_HXX_
+#include <smart/com/sun/star/reflection/XIdlClass.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_XIDLFIELD_HXX_
+#include <smart/com/sun/star/reflection/XIdlField.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_PARAMMODE_HXX_
+#include <smart/com/sun/star/reflection/ParamMode.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_METHODMODE_HXX_
+#include <smart/com/sun/star/reflection/MethodMode.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_XIDLMEMBER_HXX_
+#include <smart/com/sun/star/reflection/XIdlMember.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_XIDLREFLECTION_HXX_
+#include <smart/com/sun/star/reflection/XIdlReflection.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_XIDLMETHOD_HXX_
+#include <smart/com/sun/star/reflection/XIdlMethod.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_REFLECTION_INVOCATIONTARGETEXCEPTION_HXX_
+#include <smart/com/sun/star/reflection/InvocationTargetException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_PROPERTYVALUES_HXX_
+#include <smart/com/sun/star/beans/PropertyValues.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_XPROPERTYSET_HXX_
+#include <smart/com/sun/star/beans/XPropertySet.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_
+#include <smart/com/sun/star/beans/PropertyValue.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_PROPERTYSTATE_HXX_
+#include <smart/com/sun/star/beans/PropertyState.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HXX_
+#include <smart/com/sun/star/beans/XPropertySetInfo.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HXX_
+#include <smart/com/sun/star/beans/XMultiPropertySet.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_XFASTPROPERTYSET_HXX_
+#include <smart/com/sun/star/beans/XFastPropertySet.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_XVETOABLECHANGELISTENER_HXX_
+#include <smart/com/sun/star/beans/XVetoableChangeListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_XPROPERTYSTATE_HXX_
+#include <smart/com/sun/star/beans/XPropertyState.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_XPROPERTYSTATECHANGELISTENER_HXX_
+#include <smart/com/sun/star/beans/XPropertyStateChangeListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HXX_
+#include <smart/com/sun/star/beans/PropertyAttribute.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_XPROPERTIESCHANGELISTENER_HXX_
+#include <smart/com/sun/star/beans/XPropertiesChangeListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HXX_
+#include <smart/com/sun/star/beans/XPropertyChangeListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_XPROPERTYACCESS_HXX_
+#include <smart/com/sun/star/beans/XPropertyAccess.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HXX_
+#include <smart/com/sun/star/beans/XPropertyContainer.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_PROPERTYSTATECHANGEEVENT_HXX_
+#include <smart/com/sun/star/beans/PropertyStateChangeEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HXX_
+#include <smart/com/sun/star/beans/PropertyChangeEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_UNKNOWNPROPERTYEXCEPTION_HXX_
+#include <smart/com/sun/star/beans/UnknownPropertyException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_INTROSPECTIONEXCEPTION_HXX_
+#include <smart/com/sun/star/beans/IntrospectionException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_PROPERTYEXISTEXCEPTION_HXX_
+#include <smart/com/sun/star/beans/PropertyExistException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_ILLEGALTYPEEXCEPTION_HXX_
+#include <smart/com/sun/star/beans/IllegalTypeException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_BEANS_PROPERTYVETOEXCEPTION_HXX_
+#include <smart/com/sun/star/beans/PropertyVetoException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HXX_
+#include <smart/com/sun/star/container/XEnumerationAccess.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HXX_
+#include <smart/com/sun/star/container/XHierarchicalNameAccess.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_CONTAINER_XNAMEACCESS_HXX_
+#include <smart/com/sun/star/container/XNameAccess.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_CONTAINER_XCONTENTENUMERATIONACCESS_HXX_
+#include <smart/com/sun/star/container/XContentEnumerationAccess.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_CONTAINER_XENUMERATION_HXX_
+#include <smart/com/sun/star/container/XEnumeration.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_CONTAINER_XELEMENTACCESS_HXX_
+#include <smart/com/sun/star/container/XElementAccess.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_CONTAINER_XINDEXACCESS_HXX_
+#include <smart/com/sun/star/container/XIndexAccess.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_XEVENTLISTENER_HXX_
+#include <smart/com/sun/star/lang/XEventListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_EVENTOBJECT_HXX_
+#include <smart/com/sun/star/lang/EventObject.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_SCRIPT_XALLLISTENERADAPTERSERVICE_HXX_
+#include <smart/com/sun/star/script/XAllListenerAdapterService.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_SCRIPT_XALLLISTENER_HXX_
+#include <smart/com/sun/star/script/XAllListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_SCRIPT_ALLEVENTOBJECT_HXX_
+#include <smart/com/sun/star/script/AllEventObject.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_CONTAINER_XCOMPONENTENUMERATION_HXX_
+#include <smart/com/sun/star/container/XComponentEnumeration.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_XCOMPONENT_HXX_
+#include <smart/com/sun/star/lang/XComponent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_CONTAINER_XCOMPONENTENUMERATIONACCESS_HXX_
+#include <smart/com/sun/star/container/XComponentEnumerationAccess.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_LISTENEREXISTEXCEPTION_HXX_
+#include <smart/com/sun/star/lang/ListenerExistException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_CONTAINER_ELEMENTEXISTEXCEPTION_HXX_
+#include <smart/com/sun/star/container/ElementExistException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_LANG_INVALIDLISTENEREXCEPTION_HXX_
+#include <smart/com/sun/star/lang/InvalidListenerException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_CONTAINER_NOSUCHELEMENTEXCEPTION_HXX_
+#include <smart/com/sun/star/container/NoSuchElementException.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XKEYLISTENER_HXX_
+#include <smart/com/sun/star/awt/XKeyListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XPAINTLISTENER_HXX_
+#include <smart/com/sun/star/awt/XPaintListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_KEYEVENT_HXX_
+#include <smart/com/sun/star/awt/KeyEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_KEYMODIFIER_HXX_
+#include <smart/com/sun/star/awt/KeyModifier.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XMOUSEMOTIONLISTENER_HXX_
+#include <smart/com/sun/star/awt/XMouseMotionListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_FOCUSEVENT_HXX_
+#include <smart/com/sun/star/awt/FocusEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XWINDOWLISTENER_HXX_
+#include <smart/com/sun/star/awt/XWindowListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XACTIVATELISTENER_HXX_
+#include <smart/com/sun/star/awt/XActivateListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_MOUSEEVENT_HXX_
+#include <smart/com/sun/star/awt/MouseEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XTOPWINDOWLISTENER_HXX_
+#include <smart/com/sun/star/awt/XTopWindowListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_PAINTEVENT_HXX_
+#include <smart/com/sun/star/awt/PaintEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_INPUTEVENT_HXX_
+#include <smart/com/sun/star/awt/InputEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_KEYGROUP_HXX_
+#include <smart/com/sun/star/awt/KeyGroup.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_KEY_HXX_
+#include <smart/com/sun/star/awt/Key.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_WINDOWEVENT_HXX_
+#include <smart/com/sun/star/awt/WindowEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XMOUSELISTENER_HXX_
+#include <smart/com/sun/star/awt/XMouseListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_KEYFUNCTION_HXX_
+#include <smart/com/sun/star/awt/KeyFunction.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_FOCUSCHANGEREASON_HXX_
+#include <smart/com/sun/star/awt/FocusChangeReason.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_MOUSEBUTTON_HXX_
+#include <smart/com/sun/star/awt/MouseButton.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XFOCUSLISTENER_HXX_
+#include <smart/com/sun/star/awt/XFocusListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XADJUSTMENTLISTENER_HXX_
+#include <smart/com/sun/star/awt/XAdjustmentListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XACTIONLISTENER_HXX_
+#include <smart/com/sun/star/awt/XActionListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XTEXTLISTENER_HXX_
+#include <smart/com/sun/star/awt/XTextListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XSPINLISTENER_HXX_
+#include <smart/com/sun/star/awt/XSpinListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XITEMLISTENER_HXX_
+#include <smart/com/sun/star/awt/XItemListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XVCLCONTAINERLISTENER_HXX_
+#include <smart/com/sun/star/awt/XVclContainerListener.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XFILEDIALOG_HXX_
+#include <smart/com/sun/star/awt/XFileDialog.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XTEXTCOMPONENT_HXX_
+#include <smart/com/sun/star/awt/XTextComponent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XLISTBOX_HXX_
+#include <smart/com/sun/star/awt/XListBox.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XPROGRESSMONITOR_HXX_
+#include <smart/com/sun/star/awt/XProgressMonitor.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_TEXTALIGN_HXX_
+#include <smart/com/sun/star/awt/TextAlign.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XSCROLLBAR_HXX_
+#include <smart/com/sun/star/awt/XScrollBar.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HXX_
+#include <smart/com/sun/star/awt/XVclContainerPeer.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XTABCONTROLLERMODEL_HXX_
+#include <smart/com/sun/star/awt/XTabControllerModel.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XMESSAGEBOX_HXX_
+#include <smart/com/sun/star/awt/XMessageBox.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XTEXTEDITFIELD_HXX_
+#include <smart/com/sun/star/awt/XTextEditField.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_STYLE_HXX_
+#include <smart/com/sun/star/awt/Style.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XTIMEFIELD_HXX_
+#include <smart/com/sun/star/awt/XTimeField.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XVCLWINDOWPEER_HXX_
+#include <smart/com/sun/star/awt/XVclWindowPeer.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XCONTROLMODEL_HXX_
+#include <smart/com/sun/star/awt/XControlModel.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XSPINFIELD_HXX_
+#include <smart/com/sun/star/awt/XSpinField.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HXX_
+#include <smart/com/sun/star/awt/XUnoControlContainer.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XTEXTLAYOUTCONSTRAINS_HXX_
+#include <smart/com/sun/star/awt/XTextLayoutConstrains.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XNUMERICFIELD_HXX_
+#include <smart/com/sun/star/awt/XNumericField.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XBUTTON_HXX_
+#include <smart/com/sun/star/awt/XButton.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XTEXTAREA_HXX_
+#include <smart/com/sun/star/awt/XTextArea.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XIMAGEBUTTON_HXX_
+#include <smart/com/sun/star/awt/XImageButton.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XFIXEDTEXT_HXX_
+#include <smart/com/sun/star/awt/XFixedText.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XCONTROLCONTAINER_HXX_
+#include <smart/com/sun/star/awt/XControlContainer.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XDIALOG_HXX_
+#include <smart/com/sun/star/awt/XDialog.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_SCROLLBARORIENTATION_HXX_
+#include <smart/com/sun/star/awt/ScrollBarOrientation.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XRADIOBUTTON_HXX_
+#include <smart/com/sun/star/awt/XRadioButton.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XCURRENCYFIELD_HXX_
+#include <smart/com/sun/star/awt/XCurrencyField.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XPATTERNFIELD_HXX_
+#include <smart/com/sun/star/awt/XPatternField.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HXX_
+#include <smart/com/sun/star/awt/VclWindowPeerAttribute.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XTABCONTROLLER_HXX_
+#include <smart/com/sun/star/awt/XTabController.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XVCLCONTAINER_HXX_
+#include <smart/com/sun/star/awt/XVclContainer.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XDATEFIELD_HXX_
+#include <smart/com/sun/star/awt/XDateField.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XCOMBOBOX_HXX_
+#include <smart/com/sun/star/awt/XComboBox.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XCONTROL_HXX_
+#include <smart/com/sun/star/awt/XControl.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XCHECKBOX_HXX_
+#include <smart/com/sun/star/awt/XCheckBox.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_MESSAGEBOXCOMMAND_HXX_
+#include <smart/com/sun/star/awt/MessageBoxCommand.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HXX_
+#include <smart/com/sun/star/awt/XLayoutConstrains.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XPROGRESSBAR_HXX_
+#include <smart/com/sun/star/awt/XProgressBar.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_SIMPLEFONTMETRIC_HXX_
+#include <smart/com/sun/star/awt/SimpleFontMetric.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_FONTWEIGHT_HXX_
+#include <smart/com/sun/star/awt/FontWeight.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_FONTSLANT_HXX_
+#include <smart/com/sun/star/awt/FontSlant.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_CHARSET_HXX_
+#include <smart/com/sun/star/awt/CharSet.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_FONTDESCRIPTOR_HXX_
+#include <smart/com/sun/star/awt/FontDescriptor.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_FONTWIDTH_HXX_
+#include <smart/com/sun/star/awt/FontWidth.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XFONT_HXX_
+#include <smart/com/sun/star/awt/XFont.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_FONTTYPE_HXX_
+#include <smart/com/sun/star/awt/FontType.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_FONTUNDERLINE_HXX_
+#include <smart/com/sun/star/awt/FontUnderline.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_FONTSTRIKEOUT_HXX_
+#include <smart/com/sun/star/awt/FontStrikeout.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_FONTFAMILY_HXX_
+#include <smart/com/sun/star/awt/FontFamily.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_FONTPITCH_HXX_
+#include <smart/com/sun/star/awt/FontPitch.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XTOPWINDOW_HXX_
+#include <smart/com/sun/star/awt/XTopWindow.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XWINDOW_HXX_
+#include <smart/com/sun/star/awt/XWindow.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_POSSIZE_HXX_
+#include <smart/com/sun/star/awt/PosSize.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_VCLCONTAINEREVENT_HXX_
+#include <smart/com/sun/star/awt/VclContainerEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_ITEMEVENT_HXX_
+#include <smart/com/sun/star/awt/ItemEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_SPINEVENT_HXX_
+#include <smart/com/sun/star/awt/SpinEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_TEXTEVENT_HXX_
+#include <smart/com/sun/star/awt/TextEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_ADJUSTMENTTYPE_HXX_
+#include <smart/com/sun/star/awt/AdjustmentType.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_ACTIONEVENT_HXX_
+#include <smart/com/sun/star/awt/ActionEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_ADJUSTMENTEVENT_HXX_
+#include <smart/com/sun/star/awt/AdjustmentEvent.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_RECTANGLE_HXX_
+#include <smart/com/sun/star/awt/Rectangle.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_SELECTION_HXX_
+#include <smart/com/sun/star/awt/Selection.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_SIZE_HXX_
+#include <smart/com/sun/star/awt/Size.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_WINDOWDESCRIPTOR_HXX_
+#include <smart/com/sun/star/awt/WindowDescriptor.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_INVALIDATESTYLE_HXX_
+#include <smart/com/sun/star/awt/InvalidateStyle.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XTOOLKIT_HXX_
+#include <smart/com/sun/star/awt/XToolkit.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XWINDOWPEER_HXX_
+#include <smart/com/sun/star/awt/XWindowPeer.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_WINDOWCLASS_HXX_
+#include <smart/com/sun/star/awt/WindowClass.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XSYSTEMDEPENDENTWINDOWPEER_HXX_
+#include <smart/com/sun/star/awt/XSystemDependentWindowPeer.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_WINDOWATTRIBUTE_HXX_
+#include <smart/com/sun/star/awt/WindowAttribute.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XPOINTER_HXX_
+#include <smart/com/sun/star/awt/XPointer.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_SYSTEMPOINTER_HXX_
+#include <smart/com/sun/star/awt/SystemPointer.hxx>
+#endif
+#ifndef _SMART_COM_SUN_STAR_AWT_XVIEW_HXX_
+#include <smart/com/sun/star/awt/XView.hxx>
+#endif
+#include <usr/refl.hxx>
+#include <vcl/resid.hxx>
+#include <sfx2/msg.hxx>
+#include <svtools/itemset.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <vcl/floatwin.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/window.hxx>
+#include <so3/protocol.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <so3/factory.hxx>
+#include <sfx2/frame.hxx>
+#include <sfx2/objface.hxx>
+#include <so3/advise.hxx>
+#include <so3/dtrans.hxx>
+#include <vcl/event.hxx>
+#include <svtools/eitem.hxx>
+#include <svtools/intitem.hxx>
+#include <symbol.hxx>
+#include <svtools/itempool.hxx>
+#include <vcl/image.hxx>
+#include <vcl/metric.hxx>
+#include <so3/iface.hxx>
+#include <sfx2/inimgr.hxx>
+#include <node.hxx>
+#include <so3/so2dll.hxx>
+#include <tools/pstm.hxx>
+#include <tools/table.hxx>
+#include <so3/ipobj.hxx>
+#include <so3/embobj.hxx>
+#include <sfx2/docfac.hxx>
+#include <so3/pseudo.hxx>
+#include <svtools/ownlist.hxx>
+#include <sfx2/objsh.hxx>
+#include <svtools/stritem.hxx>
+#include <vcl/mapmod.hxx>
+#include <sfx2/ipfrm.hxx>
+#include <vcl/dialog.hxx>
+#include <so3/svstor.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svtools/svstdarr.hxx>
+#include <sfx2/bindings.hxx>
+#include <so3/persist.hxx>
+#include <dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/symbol.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <vcl/button.hxx>
+#include <so3/so2defs.hxx>
+#include <vcl/tabdlg.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/group.hxx>
+#include <svx/optgenrl.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/group.hxx>
+#include <document.hxx>
+#include <so3/binding.hxx>
+#include <vcl/field.hxx>
+#include <vcl/spinfld.hxx>
+#include <vcl/menubtn.hxx>
+#include <vcl/scrbar.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/field.hxx>
+#include <svtools/ctrltool.hxx>
+#include <sfx2/interno.hxx>
+#include <sfx2/sfxdefs.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/chalign.hxx>
+#include <vcl/floatwin.hxx>
+#include <sot/storage.hxx>
+#include <rsc/rscsfx.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/btndlg.hxx>
+#include <uno/uno.h>
+#include <uno/string.h>
+#include <uno/sequence.h>
+#include <uno/any.h>
+#include <uno/exceptn.h>
+#include <uno/intrface.h>
+#include <uno/factory.h>
+#include <uno/api.h>
+#include <svx/svxids.hrc>
+#include <view.hxx>
+#include <sfx2/dockwin.hxx>
+#include <vcl/dockwin.hxx>
+#include <sfx2/viewsh.hxx>
+#include <vcl/icon.hxx>
+#include <sfx2/clientsh.hxx>
+#include <so3/ipclient.hxx>
+#include <so3/client.hxx>
+#include <svtools/scrwin.hxx>
+#include <vcl/scrbar.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/viewfac.hxx>
+#include <edit.hxx>
+#include <svx/editdata.hxx>
+#include <toolbox.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/dockwin.hxx>
+#include <smslots.hxx>
+#include <svtools/undo.hxx>
+#include <sfx2/request.hxx>
+#include <svtools/whiter.hxx>
+#include <vcl/prntypes.hxx>
+#include <vcl/jobset.hxx>
+#include <vcl/gdimtf.hxx>
+#include <sot/exchange.hxx>
+#include <vcl/exchange.hxx>
+#include <vcl/wrkwin.hxx>
+#include <tools/sstring.hxx>
+#include <action.hxx>
+#include <sfx2/docinf.hxx>
+#include <sfx2/filedlg.hxx>
+#include <sfx2/iodlg.hxx>
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
new file mode 100644
index 000000000000..181794883639
--- /dev/null
+++ b/starmath/source/mathtype.cxx
@@ -0,0 +1,3081 @@
+/*************************************************************************
+ *
+ * $RCSfile: mathtype.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef MATHTYPE_HXX
+#include <mathtype.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_H
+#include <tools/debug.hxx>
+#endif
+
+#define APPEND(str,ascii) str.AppendAscii(RTL_CONSTASCII_STRINGPARAM(ascii))
+
+#if 0
+String aEmbelList[21] =
+{
+ " ",
+ " ",
+ "single dot",
+ "double dot",
+ "triple dot",
+ "single prime",
+ "double prime",
+ "backwards prime (left of character)",
+ "tilde",
+ "hat (circumflex)",
+ "diagonal slash through character",
+ "right arrow",
+ "left arrow",
+ "double-headed arrow",
+ "right single-barbed arrow",
+ "left single-barbed arrow",
+ "mid-height horizontal bar",
+ "over-bar",
+ "triple prime",
+ "over-arc, concave downward",
+ "over-arc, concave upward"
+};
+
+String aSelectorList[49] =
+{
+ "angle brackets",
+ "parentheses",
+ "braces (curly brackets)",
+ "square brackets",
+ "vertical bars",
+ "double vertical bars",
+ "floor brackets",
+ "ceiling brackets",
+ "left brace, left brace",
+ "right brace, right brace",
+ "right brace, left brace",
+ "left brace, right parenthesis",
+ "left parenthesis, right brace",
+ "radical",
+ "fractions",
+ "subscript/superscript",
+ "underbar",
+ "overbar",
+ "left-pointing arrow",
+ "right-pointing arrow",
+ "left- and right-pointing arrow",
+ "single integral",
+ "double integral",
+ "triple integral",
+ "single summation-style integral",
+ "double summation-style integral",
+ "triple summation-style integral",
+ "upper horizontal brace",
+ "lower horizontal brace",
+ "summation",
+ "summation (integral-style limits)",
+ "product",
+ "product (integral-style limits)",
+ "coproduct",
+ "coproduct (integral-style limits)",
+ "union",
+ "union (integral-style limits)",
+ "intersection",
+ "intersection (integral-style limits)",
+ "limit",
+ "long division",
+ "slash fractions",
+ "big integral-style operators",
+ "big summation-style operators",
+ "leading sub- and superscripts",
+ "Dirac delta",
+ "under arrow",
+ "over arrow",
+ "over arc"
+};
+
+String aIntegralOpt[2] =
+{
+ "fixed-size integral",
+ "integral expands vertically to fit its contents"
+};
+
+String aFenceOpt[3] =
+{
+ "center fence on math axis",
+ "center fence on contents, place math axis of contents on math axis of containing line",
+ "center fence on contents, center contents on math axis of containing line"
+};
+
+String aTypeFaces[12] =
+{
+ "",
+ "fnTEXT",
+ "fnFUNCTION",
+ "fnVARIABLE",
+ "fnLCGREEK",
+ "fnUCGREEK",
+ "fnSYMBOL",
+ "fnVECTOR",
+ "fnNUMBER",
+ "fnUSER1",
+ "fnUSER2",
+ "fnMTEXTRA"
+};
+
+String aSizes[7] =
+{
+ "full",
+ "subscript",
+ "sub-subscript",
+ "symbol",
+ "sub-symbol",
+ "user 1",
+ "user 2"
+};
+#endif
+
+/*This table is not fully complete and is pending on what decisions are
+ *made as regards the StarMath to Unicode stuff*/
+sal_Unicode aMathTypeTable[256] =
+{
+0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009,
+0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, 0x0013,
+0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d,
+0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, 0x2031, 0x0025, 0x0026, 0x221E,
+0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x2212, 0x002E, 0x002F, 0x2224, 0x21D2,
+0x21D0, 0x21D4, 0xffff, 0xffff, 0x2218, 0xffff, 0xffff, 0xffff, 0x003A, 0x003B,
+0x003C, 0x003D, 0x003E, 0x00BF, 0x2260, 0x002B, 0x2212, 0x002A, 0x00D7, 0x22C5,
+0x00F7, 0x00B1, 0x2213, 0x2295, 0x2296, 0x2297, 0x2298, 0x2299, 0x222A, 0x2229,
+0x003C, 0x003E, 0x2264, 0x2265, 0x2264, 0x2265, 0x226A, 0x226B, 0x007E, 0x2245,
+0x2248, 0xffff, 0x2261, 0x221D, 0x2202, 0x2282, 0x2283, 0x2286, 0x2287, 0x2284,
+0x2285, 0x2288, 0x2289, 0x2208, 0x2209, 0x2208, 0x2203, 0x220B, 0x2135, 0x2111,
+0x211C, 0x2118, 0x0192, 0x2221, 0x2222, 0x007C, 0x2225, 0x22A5, 0x2026, 0x22EF,
+0x22EE, 0x22F0, 0x22F1, 0x22B6, 0x22B7, 0x2192, 0x005C, 0x00AC, 0x222B, 0x222C,
+0x222D, 0x222E, 0x222F, 0x2230, 0x221A, 0x221A, 0x221A, 0x221A, 0x2210, 0x220F,
+0x2211, 0x2207, 0x2200, 0x2225, 0x005E, 0x02C7, 0x02D8, 0x00B4, 0x0060, 0x02DC,
+0x00AF, 0x2192, 0x02D9, 0x00A8, 0xffff, 0x02DA, 0x2227, 0x2228, 0x220D, 0x2205,
+0x007B, 0x007D, 0x0028, 0x0029, 0x2329, 0x232a, 0x005B, 0x005D, 0x2220, 0x221F,
+0xffff, 0x225C, 0x2254, 0x2255, 0x21B3, 0x2197, 0x2198, 0x2245, 0x301A, 0x301B,
+0xffff, 0xffff, 0xffff, 0xffff, 0x2112, 0x2130, 0x2131, 0xffff, 0xffff, 0x002F,
+0x005C, 0x274F, 0x2308, 0x230A, 0x2309, 0x230B, 0xffff, 0xffff, 0x0393, 0x0394,
+0x0398, 0x039B, 0x039E, 0x03A0, 0x03A3, 0x03A5, 0x03A6, 0x03A8, 0x0389, 0x03B1,
+0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB,
+0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03C6,
+0x03C7, 0x03C8, 0x03C9, 0x03B5, 0x03D1, 0xffff, 0x03F1, 0x03DB, 0x2118, 0xffff,
+0x2113, 0x2129, 0x2107, 0x2127, 0x210A, 0x22A4, 0x210F, 0x019B, 0x2190, 0x2191,
+0x2193, 0x2115, 0x2124, 0x211A, 0x211D, 0x2102
+};
+
+void EQNOLEFILEHDR::Read(SvStorageStream *pS)
+{
+ *pS >> nCBHdr;
+ *pS >> nVersion;
+ *pS >> nCf;
+ *pS >> nCBObject;
+ *pS >> nReserved1;
+ *pS >> nReserved2;
+ *pS >> nReserved3;
+ *pS >> nReserved4;
+}
+
+void EQNOLEFILEHDR::Write(SvStorageStream *pS)
+{
+ *pS << nCBHdr;
+ *pS << nVersion;
+ *pS << nCf;
+ *pS << nCBObject;
+ *pS << nReserved1;
+ *pS << nReserved2;
+ *pS << nReserved3;
+ *pS << nReserved4;
+}
+
+/*ToDo replace with table rather than switch, returns
+ TRUE in the case that the char is just a char, and
+ FALSE if the character is an operator which must not be
+ placed inside the quote sequence designed to protect
+ against being parsed as a keyword
+
+ General solution required to force starmath to handle
+ unicode math chars the way it handles its own math
+ chars rathar than handle them as text as it will do
+ for the default case below, i.e. incorrect spacing
+ between math symbols and ordinary text e.g. 1=2 rather
+ than 1 = 2
+ */
+BOOL MathType::LookupChar(sal_Unicode nChar)
+{
+ BOOL bRet=FALSE;
+ const char *pC = NULL;
+ switch(nChar)
+ {
+ case 0x00ac:
+ pC = " neg ";
+ break;
+ case 0x00b1:
+ pC = " +- ";
+ break;
+ case 0x0057:
+ if ((nVersion < 3) && (nTypeFace == 0x85))
+ pC = " %OMEGA ";
+ else
+ {
+ rRet.Append(nChar);
+ bRet=TRUE;
+ }
+ break;
+ case 0x00d7:
+ if (nVersion < 3)
+ pC = " cdot ";
+ else
+ pC = " times ";
+ break;
+ case 0x00f7:
+ pC = " div ";
+ break;
+ case 0x019b:
+ pC = " lambdabar ";
+ break;
+ case 0x2026:
+ pC = " dotslow ";
+ break;
+ case 0x2022:
+ pC = " cdot ";
+ break;
+ case 0x210f:
+ pC = " hbar ";
+ break;
+ case 0x2111:
+ pC = " Im ";
+ break;
+ case 0x2118:
+ pC = " wp ";
+ break;
+ case 0x211c:
+ pC = " Re ";
+ break;
+ case 0x2135:
+ pC = " aleph ";
+ break;
+ case 0x2190:
+ pC = " leftarrow ";
+ break;
+ case 0x2191:
+ pC = " uparrow ";
+ break;
+ case 0x2192:
+ pC = " rightarrow ";
+ break;
+ case 0x2193:
+ pC = " downarrow ";
+ break;
+ case 0x21d4:
+ pC = " dlrarrow ";
+ break;
+ case 0x2200:
+ pC = " forall ";
+ break;
+ case 0x2202:
+ pC = " partial ";
+ break;
+ case 0x2203:
+ pC = " exists ";
+ break;
+ case 0x2205:
+ pC = " emptyset ";
+ break;
+ case 0x2207:
+ pC = " nabla ";
+ break;
+ case 0x2208:
+ pC = " in ";
+ break;
+ case 0x2209:
+ pC = " notin ";
+ break;
+ case 0x220d:
+ pC = " owns ";
+ break;
+ case 0x220f:
+ pC = " prod ";
+ break;
+ case 0x2210:
+ pC = " coprod ";
+ break;
+ case 0x2211:
+ pC = " sum ";
+ break;
+ case 0x2212:
+ pC = " - ";
+ break;
+ case 0x2213:
+ pC = " -+ ";
+ break;
+ case 0x2217:
+ pC = " * ";
+ break;
+ case 0x2218:
+ pC = " circ ";
+ break;
+ case 0x221d:
+ pC = " prop ";
+ break;
+ case 0x221e:
+ pC = " infinity ";
+ break;
+ case 0x2227:
+ pC = " and ";
+ break;
+ case 0x2228:
+ pC = " or ";
+ break;
+ case 0x2229:
+ pC = " intersection ";
+ break;
+ case 0x222a:
+ pC = " union ";
+ break;
+ case 0x222b:
+ pC = " int ";
+ break;
+ case 0x2245:
+ pC = " simeq ";
+ break;
+ case 0x2248:
+ pC = " approx ";
+ break;
+ case 0x2260:
+ pC = " <> ";
+ break;
+ case 0x2261:
+ pC = " equiv ";
+ break;
+ case 0x2264:
+ pC = " <= ";
+ break;
+ case 0x2265:
+ pC = " >= ";
+ break;
+ case 0x2282:
+ pC = " subset ";
+ break;
+ case 0x2283:
+ pC = " supset ";
+ break;
+ case 0x2284:
+ pC = " nsubset ";
+ break;
+ case 0x2286:
+ pC = " subseteq ";
+ break;
+ case 0x2287:
+ pC = " supseteq ";
+ break;
+ case 0x227a:
+ case 0x227b:
+ case 0x22b2:
+ case 0x22b3:
+ rRet += ' ';
+ rRet.Append(nChar);
+ rRet += ' ';
+ break;
+ case 0x22a5:
+ pC = " ortho ";
+ break;
+ case 0x22c5:
+ pC = " cdot ";
+ break;
+ case 0x22ee:
+ pC = " dotsvert ";
+ break;
+ case 0x22ef:
+ pC = " dotsaxis ";
+ break;
+ case 0x22f0:
+ pC = " dotsup ";
+ break;
+ case 0x22f1:
+ pC = " dotsdown ";
+ break;
+ case 0xeb01: //no space
+ case 0xeb08: //normal space
+ bRet=TRUE;
+ break;
+ case 0xeb02: //small space
+ case 0xeb04: //medium space
+ rRet.Append('`');
+ break;
+ case 0xeb05: //large space
+ rRet.Append('~');
+ break;
+ case 0x3a9:
+ pC = " %OMEGA ";
+ break;
+ default:
+ rRet.Append(nChar);
+ bRet=TRUE;
+ break;
+ }
+ if (pC)
+ rRet.AppendAscii(pC);
+ return bRet;
+}
+
+int MathType::Parse(SvStorage *pStor)
+{
+ SvStorageStreamRef xSrc = pStor->OpenStream(
+ String::CreateFromAscii("Equation Native"),
+ STREAM_STD_READ | STREAM_NOCREATE);
+ if ( (!xSrc.Is()) || (SVSTREAM_OK != xSrc->GetError()))
+ return NULL;
+ pS = &xSrc;
+ pS->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ EQNOLEFILEHDR aHdr;
+ aHdr.Read(pS);
+ *pS >> nVersion;
+ *pS >> nPlatform;
+ *pS >> nProduct;
+ *pS >> nProdVersion;
+ *pS >> nProdSubVersion;
+
+#ifdef STANDALONE
+ *pOut << "Format Version is " << int(nVersion) << endl;
+ *pOut << "Generating Platform is " << (nPlatform ? "Windows"
+ : "Mac") << endl;
+ *pOut << "Generating Product is " << (nPlatform ? "Equation Editor"
+ : "Equation Editor") << endl;
+ *pOut << "Prod Version is " << int(nProdVersion) << "." <<
+ int(nProdSubVersion) << endl << endl;
+#endif
+
+ int nRet = HandleRecords();
+ //little crude hack to close ocassionally open expressions
+ //a sophisticated system to determine what expressions are
+ //opened is required, but this is as much work as rewriting
+ //starmaths internals.
+ APPEND(rRet,"{}");
+
+ //sanity check
+ ULONG nEnd = pS->Tell();
+ if (nEnd != pS->Seek(STREAM_SEEK_TO_END))
+ return 0;
+ return nRet;
+}
+
+/*Fabously complicated as many tokens have to be reordered and generally
+ *moved around from mathtypes paradigm to starmaths.*/
+int MathType::HandleRecords(int nLevel,BYTE nSelector,
+ BYTE nVariation, int nMatrixRows,int nMatrixCols)
+{
+ BYTE nTag,nRecord;
+ BYTE nTabType,nTabStops;
+ BYTE nTface,nStyle;
+ UINT16 nTabOffset;
+ sal_Char nChar8;
+ String sFontName;
+ int i,nRet=1,newline=0;
+ BOOL bSilent=FALSE;
+ int nPart=0;
+ String sPush,sMainTerm;
+ int nSetSize=0,nSetAlign=0;
+ int nCurRow=0,nCurCol=0;
+ BOOL bOpenString=FALSE;
+ xub_StrLen nTextStart;
+
+ do
+ {
+ *pS >> nTag;
+ nRecord = nTag&0x0F;
+
+ /*MathType strings can of course include words which
+ *are StarMath keywords, the simplest solution is
+ to escape strings of greater than len 1 with double
+ quotes to avoid scanning the TokenTable for matches
+
+ Unfortunately it may turn out that the string gets
+ split during the handling of a character emblishment
+ so this special case must be handled in the
+ character handler case 2:
+ */
+ if ((nRecord == CHAR) && (!bSilent) && (!bOpenString))
+ {
+ bOpenString=TRUE;
+ nTextStart = rRet.Len();
+ }
+ else if ((nRecord != CHAR) && (bOpenString))
+ {
+ bOpenString=FALSE;
+ if ((rRet.Len() - nTextStart) > 1)
+ {
+ rRet.InsertAscii(" ital \"",nTextStart);
+ rRet += '\"';
+ }
+ }
+
+ switch(nRecord)
+ {
+ case LINE:
+ {
+ //if (xfLMOVE(nTag))
+ //if (xfLSPACE(nTag))
+ //if (xfRULER(nTag))
+
+ if (newline>0)
+ APPEND(rRet,"\nnewline\n");
+ if (!(xfNULL(nTag)))
+ {
+ switch (nSelector)
+ {
+ case 0x0:
+ if (nVariation==0)
+ APPEND(rRet," langle ");
+ else if (nVariation==1)
+ APPEND(rRet," \\langle ");
+ break;
+ case 0x1:
+ if (nVariation==0)
+ APPEND(rRet," left (");
+ else if (nVariation==1)
+ APPEND(rRet,"\\(");
+ break;
+ case 0x2:
+ if (nVariation==0)
+ APPEND(rRet," lbrace ");
+ else if (nVariation==1)
+ APPEND(rRet," \\lbrace ");
+ break;
+ case 0x3:
+ if (nVariation==0)
+ APPEND(rRet," left [");
+ else if (nVariation==1)
+ APPEND(rRet,"\\[");
+ break;
+ case 0x8:
+ case 0xb:
+ APPEND(rRet," \\[");
+ break;
+ case 0x4:
+ if (nVariation==0)
+ APPEND(rRet," lline ");
+ else if (nVariation==1)
+ APPEND(rRet," \\lline ");
+ break;
+ case 0x5:
+ if (nVariation==0)
+ APPEND(rRet," ldline ");
+ else if (nVariation==1)
+ APPEND(rRet," \\ldline ");
+ break;
+ case 0x6:
+ if (nVariation==0)
+ APPEND(rRet," lfloor ");
+ else if (nVariation==1)
+ APPEND(rRet," \\lfloor ");
+ break;
+ case 0x7:
+ if (nVariation==0)
+ APPEND(rRet," lceil ");
+ else if (nVariation==1)
+ APPEND(rRet," \\lceil ");
+ break;
+ case 0x9:
+ case 0xa:
+ APPEND(rRet," \\]");
+ break;
+ case 0xc:
+ APPEND(rRet," \\(");
+ break;
+ case 0xd:
+ if (nPart == 0)
+ {
+ if (nVariation == 0)
+ APPEND(rRet," sqrt");
+ else
+ {
+ APPEND(rRet," nroot");
+ sPush = rRet;
+ rRet.Erase();
+ }
+ }
+ APPEND(rRet," {");
+ break;
+ case 0xe:
+ if (nPart == 0)
+ APPEND(rRet," { ");
+
+
+ if (nPart == 1)
+ APPEND(rRet," over ");
+ APPEND(rRet," {");
+ break;
+ case 0xf:
+ if ((nVariation == 0) ||
+ ((nVariation == 2) && (nPart==1)))
+ APPEND(rRet," rSup");
+ else if ((nVariation == 1) ||
+ ((nVariation == 2) && (nPart==0)))
+ APPEND(rRet," rSub");
+ APPEND(rRet," {");
+ break;
+ case 0x10:
+ if (nVariation == 0)
+ APPEND(rRet," underline ");
+ else if (nVariation == 1)
+ APPEND(rRet," underline underline ");
+ APPEND(rRet," {");
+ break;
+ case 0x11:
+ if (nVariation == 0)
+ APPEND(rRet," overline ");
+ else if (nVariation == 1)
+ APPEND(rRet," overline overline ");
+ APPEND(rRet," {");
+ break;
+ case 0x12:
+ if (nPart == 0)
+ {
+ if (nVariation == 0)
+ APPEND(rRet," widevec ");//left arrow above
+ else if (nVariation == 1)
+ APPEND(rRet," widevec ");//left arrow below
+ APPEND(rRet," {");
+ }
+ break;
+ case 0x13:
+ if (nPart == 0)
+ {
+ if (nVariation == 0)
+ APPEND(rRet," widevec ");//right arrow above
+ else if (nVariation == 1)
+ APPEND(rRet," widevec ");//right arrow below
+ APPEND(rRet," {");
+ }
+ break;
+ case 0x14:
+ if (nPart == 0)
+ {
+ if (nVariation == 0)
+ APPEND(rRet," widevec ");//double arrow above
+ else if (nVariation == 1)
+ APPEND(rRet," widevec ");//double arrow below
+ APPEND(rRet," {");
+ }
+ break;
+ case 0x15:
+ if (nPart == 0)
+ {
+ if ((nVariation == 3) || (nVariation == 4))
+ APPEND(rRet," lInt");
+ else
+ APPEND(rRet," Int");
+ if ( (nVariation != 0) && (nVariation != 3))
+ {
+ sPush = rRet;
+ rRet.Erase();
+ }
+ }
+ if (((nVariation == 1) ||
+ (nVariation == 4)) && (nPart==1))
+ APPEND(rRet," rSub");
+ else if ((nVariation == 2) && (nPart==2))
+ APPEND(rRet," rSup");
+ else if ((nVariation == 2) && (nPart==1))
+ APPEND(rRet," rSub");
+ APPEND(rRet," {");
+ break;
+ case 0x16:
+ if (nPart == 0)
+ {
+ if ((nVariation == 2) || (nVariation == 3))
+ APPEND(rRet," llInt");
+ else
+ APPEND(rRet," iInt");
+ if ( (nVariation != 0) && (nVariation != 2))
+ {
+ sPush = rRet;
+ rRet.Erase();
+ }
+ }
+ if (((nVariation == 1) ||
+ (nVariation == 3)) && (nPart==1))
+ APPEND(rRet," rSub");
+ APPEND(rRet," {");
+ break;
+ case 0x17:
+ if (nPart == 0)
+ {
+ if ((nVariation == 2) || (nVariation == 3))
+ APPEND(rRet," lllInt");
+ else
+ APPEND(rRet," iiInt");
+ if ( (nVariation != 0) && (nVariation != 2))
+ {
+ sPush = rRet;
+ rRet.Erase();
+ }
+ }
+ if (((nVariation == 1) ||
+ (nVariation == 3)) && (nPart==1))
+ APPEND(rRet," rSub");
+ APPEND(rRet," {");
+ break;
+ case 0x18:
+ if (nPart == 0)
+ {
+ if (nVariation == 2)
+ APPEND(rRet," lInt");
+ else
+ APPEND(rRet," Int");
+ sPush = rRet;
+ rRet.Erase();
+ }
+ if (((nVariation == 1) ||
+ (nVariation == 2)) && (nPart==1))
+ APPEND(rRet," cSub");
+ else if ((nVariation == 0) && (nPart==2))
+ APPEND(rRet," cSup");
+ else if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," cSub");
+ APPEND(rRet," {");
+ break;
+ case 0x19:
+ if (nPart == 0)
+ {
+ if (nVariation == 0)
+ APPEND(rRet," llInt");
+ else
+ APPEND(rRet," iInt");
+ sPush = rRet;
+ rRet.Erase();
+ }
+ if (nPart==1)
+ APPEND(rRet," cSub");
+ APPEND(rRet," {");
+ break;
+ case 0x1a:
+ if (nPart == 0)
+ {
+ if (nVariation == 0)
+ APPEND(rRet," lllInt");
+ else
+ APPEND(rRet," iiInt");
+ sPush = rRet;
+ rRet.Erase();
+ }
+ if (nPart==1)
+ APPEND(rRet," cSub");
+ APPEND(rRet," {");
+ break;
+ case 0x1b:
+ case 0x1c:
+ APPEND(rRet," {");
+ break;
+ case 0x1d:
+ if (nPart == 0)
+ {
+ APPEND(rRet," Sum");
+ if (nVariation != 2)
+ {
+ sPush = rRet;
+ rRet.Erase();
+ }
+ }
+ if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," cSub");
+ else if ((nVariation == 1) && (nPart==2))
+ APPEND(rRet," cSup");
+ else if ((nVariation == 1) && (nPart==1))
+ APPEND(rRet," cSub");
+ APPEND(rRet," {");
+ break;
+ case 0x1e:
+ if (nPart == 0)
+ {
+ APPEND(rRet," Sum");
+ sPush = rRet;
+ rRet.Erase();
+ }
+ if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," rSub");
+ else if ((nVariation == 1) && (nPart==2))
+ APPEND(rRet," rSup");
+ else if ((nVariation == 1) && (nPart==1))
+ APPEND(rRet," rSub");
+ APPEND(rRet," {");
+ break;
+ case 0x1f:
+ if (nPart == 0)
+ {
+ APPEND(rRet," Prod");
+ if (nVariation != 2)
+ {
+ sPush = rRet;
+ rRet.Erase();
+ }
+ }
+ if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," cSub");
+ else if ((nVariation == 1) && (nPart==2))
+ APPEND(rRet," cSup");
+ else if ((nVariation == 1) && (nPart==1))
+ APPEND(rRet," cSub");
+ APPEND(rRet," {");
+ break;
+ case 0x20:
+ if (nPart == 0)
+ {
+ APPEND(rRet," Prod");
+ sPush = rRet;
+ rRet.Erase();
+ }
+ if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," rSub");
+ else if ((nVariation == 1) && (nPart==2))
+ APPEND(rRet," rSup");
+ else if ((nVariation == 1) && (nPart==1))
+ APPEND(rRet," rSub");
+ APPEND(rRet," {");
+ break;
+ case 0x21:
+ if (nPart == 0)
+ {
+ APPEND(rRet," coProd");
+ if (nVariation != 2)
+ {
+ sPush = rRet;
+ rRet.Erase();
+ }
+ }
+ if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," cSub");
+ else if ((nVariation == 1) && (nPart==2))
+ APPEND(rRet," cSup");
+ else if ((nVariation == 1) && (nPart==1))
+ APPEND(rRet," cSub");
+ APPEND(rRet," {");
+ break;
+ case 0x22:
+ if (nPart == 0)
+ {
+ APPEND(rRet," coProd");
+ sPush = rRet;
+ rRet.Erase();
+ }
+ if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," rSub");
+ else if ((nVariation == 1) && (nPart==2))
+ APPEND(rRet," rSup");
+ else if ((nVariation == 1) && (nPart==1))
+ APPEND(rRet," rSub");
+ APPEND(rRet," {");
+ break;
+ case 0x23:
+ if (nPart == 0)
+ {
+ APPEND(rRet," union"); //union
+ if (nVariation != 2)
+ {
+ sPush = rRet;
+ rRet.Erase();
+ }
+ }
+ if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," cSub");
+ else if ((nVariation == 1) && (nPart==2))
+ APPEND(rRet," cSup");
+ else if ((nVariation == 1) && (nPart==1))
+ APPEND(rRet," cSub");
+ APPEND(rRet," {");
+ break;
+ case 0x24:
+ if (nPart == 0)
+ {
+ APPEND(rRet," union"); //union
+ sPush = rRet;
+ rRet.Erase();
+ }
+ if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," rSub");
+ else if ((nVariation == 1) && (nPart==2))
+ APPEND(rRet," rSup");
+ else if ((nVariation == 1) && (nPart==1))
+ APPEND(rRet," rSub");
+ APPEND(rRet," {");
+ break;
+ case 0x25:
+ if (nPart == 0)
+ {
+ APPEND(rRet," intersect"); //intersect
+ if (nVariation != 2)
+ {
+ sPush = rRet;
+ rRet.Erase();
+ }
+ }
+ if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," cSub");
+ else if ((nVariation == 1) && (nPart==2))
+ APPEND(rRet," cSup");
+ else if ((nVariation == 1) && (nPart==1))
+ APPEND(rRet," cSub");
+ APPEND(rRet," {");
+ break;
+ case 0x26:
+ if (nPart == 0)
+ {
+ APPEND(rRet," intersect"); //intersect
+ sPush = rRet;
+ rRet.Erase();
+ }
+ if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," rSub");
+ else if ((nVariation == 1) && (nPart==2))
+ APPEND(rRet," rSup");
+ else if ((nVariation == 1) && (nPart==1))
+ APPEND(rRet," rSub");
+ APPEND(rRet," {");
+ break;
+ case 0x27:
+ if ((nVariation == 0) && (nPart==1))
+ APPEND(rRet," cSup");
+ else if ((nVariation == 1) && (nPart==1))
+ APPEND(rRet," cSub");
+ else if ((nVariation == 2) && (nPart==1))
+ APPEND(rRet," cSub");
+ else if ((nVariation == 2) && (nPart==2))
+ APPEND(rRet," cSup");
+ APPEND(rRet," {");
+ break;
+ case 0x28:
+ if (nVariation == 0)
+ {
+ if (nPart == 0)
+ {
+ sPush = rRet;
+ rRet.Erase();
+ }
+ }
+ APPEND(rRet," {");
+ if (nVariation == 0)
+ {
+ if (nPart == 1)
+ APPEND(rRet,"alignr ");
+ }
+ if (nPart == 0)
+ APPEND(rRet,"\\lline ");
+ if (nVariation == 1)
+ APPEND(rRet,"overline ");
+ break;
+ case 0x29:
+ APPEND(rRet," {");
+ break;
+ case 0x2a:
+ if (nPart == 0)
+ {
+ sPush = rRet;
+ rRet.Erase();
+ }
+ if ((nVariation == 0) && (nPart==0))
+ APPEND(rRet," rSup");
+ else if ((nVariation == 2) && (nPart==1))
+ APPEND(rRet," rSup");
+ else if ((nVariation == 1) && (nPart==0))
+ APPEND(rRet," rSub");
+ else if ((nVariation == 2) && (nPart==0))
+ APPEND(rRet," rSub");
+ APPEND(rRet," {");
+ break;
+ case 0x2b:
+ if (nPart == 0)
+ {
+ sPush = rRet;
+ rRet.Erase();
+ }
+ if ((nVariation == 0) && (nPart==0))
+ APPEND(rRet," cSup");
+ else if ((nVariation == 2) && (nPart==1))
+ APPEND(rRet," cSup");
+ else if ((nVariation == 1) && (nPart==0))
+ APPEND(rRet," cSub");
+ else if ((nVariation == 2) && (nPart==0))
+ APPEND(rRet," cSub");
+ APPEND(rRet," {");
+ break;
+ case 0x2c:
+ if (nPart == 0)
+ APPEND(rRet,"\"\"");
+ if ((nVariation == 0)
+ || ((nVariation == 2) && (nPart==1)))
+ APPEND(rRet," lSup");
+ else if ((nVariation == 1)
+ || ((nVariation == 2) && (nPart==0)))
+ APPEND(rRet," lSub");
+ APPEND(rRet," {");
+ break;
+ case 0x2d:
+ if (nVariation==0)
+ {
+ if (nPart == 0)
+ APPEND(rRet," langle ");
+ }
+ else if (nVariation==1)
+ {
+ APPEND(rRet," \\langle ");
+ newline--;
+ }
+ else if (nVariation==2)
+ {
+ APPEND(rRet," \\lline ");
+ newline--;
+ }
+ break;
+ case 0x2e:
+ if (nVariation == 0)
+ APPEND(rRet," widevec ");//left below
+ else if (nVariation == 1)
+ APPEND(rRet," widevec ");//right below
+ else if (nVariation == 2)
+ APPEND(rRet," widevec ");//double headed below
+ APPEND(rRet," {");
+ break;
+ case 0x2f:
+ if (nVariation == 0)
+ APPEND(rRet," widevec ");//left above
+ else if (nVariation == 1)
+ APPEND(rRet," widevec ");//right above
+ else if (nVariation == 2)
+ APPEND(rRet," widevec ");//double headed above
+ APPEND(rRet," {");
+ break;
+ default:
+ break;
+ }
+ int nOldCurSize=nCurSize;
+ HandleSize(nLSize,nDSize,nSetSize);
+ nRet = HandleRecords(nLevel+1,nSelector,nVariation);
+ while (nSetSize)
+ {
+ APPEND(rRet,"} ");
+ nSetSize--;
+ nCurSize=nOldCurSize;
+ }
+
+
+ HandleMatrixSeperator(nMatrixRows,nMatrixCols,
+ nCurCol,nCurRow);
+
+ switch (nSelector)
+ {
+ case 0x0:
+ if (nVariation==0)
+ APPEND(rRet," rangle ");
+ else if (nVariation==2)
+ APPEND(rRet," \\rangle ");
+ break;
+ case 0x1:
+ if (nVariation==0)
+ APPEND(rRet," right )");
+ else if (nVariation==2)
+ APPEND(rRet,"\\)");
+ break;
+ case 0x2:
+ if (nVariation==0)
+ APPEND(rRet," rbrace ");
+ else if (nVariation==2)
+ APPEND(rRet," \\rbrace ");
+ break;
+ case 0x3:
+ if (nVariation==0)
+ APPEND(rRet," right ]");
+ else if (nVariation==2)
+ APPEND(rRet,"\\]");
+ break;
+ case 0x4:
+ if (nVariation==0)
+ APPEND(rRet," rline ");
+ else if (nVariation==2)
+ APPEND(rRet," \\rline ");
+ break;
+ case 0x5:
+ if (nVariation==0)
+ APPEND(rRet," rdline ");
+ else if (nVariation==2)
+ APPEND(rRet," \\rdline ");
+ break;
+ case 0x6:
+ if (nVariation==0)
+ APPEND(rRet," rfloor ");
+ else if (nVariation==2)
+ APPEND(rRet," \\rfloor ");
+ break;
+ case 0x7:
+ if (nVariation==0)
+ APPEND(rRet," rceil ");
+ else if (nVariation==2)
+ APPEND(rRet," \\rceil ");
+ break;
+ case 0x8:
+ case 0xa:
+ APPEND(rRet,"\\[");
+ break;
+ case 0x9:
+ case 0xc:
+ APPEND(rRet,"\\]");
+ break;
+ case 0xd:
+ APPEND(rRet,"} ");
+ if (nVariation == 1)
+ {
+ if (nPart == 0)
+ {
+ newline--;
+ sMainTerm = rRet;
+ rRet.Erase();
+ }
+ else
+ {
+ sPush += rRet;
+ rRet = sPush;
+ rRet += sMainTerm;
+ }
+ }
+ else
+ {
+ if (nPart == 0)
+ newline--;
+ }
+ nPart++;
+ break;
+ case 0xb:
+ APPEND(rRet,"\\)");
+ break;
+ case 0xe:
+ APPEND(rRet,"} ");
+ if (nPart == 0)
+ newline--;
+ else
+ APPEND(rRet,"} ");
+ nPart++;
+ break;
+ case 0xf:
+ case 0x2c:
+ if ((nPart == 0) &&
+ ((nVariation == 2) || (nVariation == 1)))
+ newline--;
+ APPEND(rRet,"} ");
+ nPart++;
+ break;
+ case 0x10:
+ case 0x11:
+ case 0x2e:
+ case 0x2f:
+ APPEND(rRet,"} ");
+ break;
+ case 0x12:
+ case 0x13:
+ case 0x14:
+ if (nPart == 0)
+ {
+ newline--;
+ APPEND(rRet,"} ");
+ }
+ nPart++;
+ break;
+ case 0x1b:
+ APPEND(rRet,"} ");
+ if (nPart == 0)
+ {
+ newline--;
+ APPEND(rRet,"overbrace");
+ }
+ nPart++;
+ break;
+ case 0x1c:
+ APPEND(rRet,"} ");
+ if (nPart == 0)
+ {
+ newline--;
+ APPEND(rRet,"underbrace");
+ }
+ nPart++;
+ break;
+ case 0x27:
+ if (nPart==0)
+ newline--;
+ else if ((nPart==1) &&
+ ((nVariation == 2) || (nVariation == 1)))
+ newline--;
+ APPEND(rRet,"} ");
+ nPart++;
+ break;
+ case 0x28:
+ APPEND(rRet,"} ");
+ if (nVariation == 0)
+ {
+ if (nPart == 0)
+ {
+ sMainTerm = rRet;
+ rRet.Erase();
+ }
+ else
+ {
+ sPush += rRet;
+ rRet = sPush;
+ APPEND(rRet," over ");
+ rRet += sMainTerm;
+ }
+ }
+ if (nPart == 0)
+ newline--;
+ nPart++;
+ break;
+ case 0x29:
+ APPEND(rRet,"} ");
+ if (nPart == 0)
+ {
+ newline--;
+ switch (nVariation)
+ {
+ case 1:
+ APPEND(rRet,"slash");
+ break;
+ default:
+ APPEND(rRet,"wideslash");
+ break;
+ }
+ }
+ nPart++;
+ break;
+ case 0x1d:
+ case 0x1e:
+ case 0x1f:
+ case 0x20:
+ case 0x21:
+ case 0x22:
+ case 0x23:
+ case 0x24:
+ case 0x25:
+ case 0x26:
+ APPEND(rRet,"} ");
+ if (nPart == 0)
+ {
+ if (nVariation != 2)
+ {
+ sMainTerm = rRet;
+ rRet.Erase();
+ }
+ newline--;
+ }
+ else if ((nPart == 1) && (nVariation == 0))
+ {
+ sPush += rRet;
+ rRet = sPush;
+ rRet += sMainTerm;
+ newline--;
+ }
+ else if ((nPart == 1) && (nVariation == 1))
+ newline--;
+ else if ((nPart == 2) && (nVariation == 1))
+ {
+ sPush += rRet;
+ rRet = sPush;
+ rRet += sMainTerm;
+ newline--;
+ }
+ nPart++;
+ break;
+ case 0x15:
+ APPEND(rRet,"} ");
+ if (nPart == 0)
+ {
+ if ((nVariation != 0) && (nVariation != 3))
+ {
+ sMainTerm = rRet;
+ rRet.Erase();
+ }
+ newline--;
+ }
+ else if ((nPart == 1) &&
+ ((nVariation == 1) || (nVariation==4)))
+ {
+ sPush += rRet;
+ rRet = sPush;
+ rRet += sMainTerm;
+ newline--;
+ }
+ else if ((nPart == 1) && (nVariation == 2))
+ newline--;
+ else if ((nPart == 2) && (nVariation == 2))
+ {
+ sPush += rRet;
+ rRet = sPush;
+ rRet += sMainTerm;
+ newline--;
+ }
+ nPart++;
+ break;
+ case 0x16:
+ case 0x17:
+ APPEND(rRet,"} ");
+ if (nPart == 0)
+ {
+ if ((nVariation != 0) && (nVariation != 2))
+ {
+ sMainTerm = rRet;
+ rRet.Erase();
+ }
+ newline--;
+ }
+ else if ((nPart == 1) &&
+ ((nVariation == 1) || (nVariation==3)))
+ {
+ sPush += rRet;
+ rRet = sPush;
+ rRet += sMainTerm;
+ newline--;
+ }
+ nPart++;
+ break;
+ case 0x18:
+ APPEND(rRet,"} ");
+ if (nPart == 0)
+ {
+ sMainTerm = rRet;
+ rRet.Erase();
+ newline--;
+ }
+ else if ((nPart == 1) &&
+ ((nVariation == 1) || (nVariation==2)))
+ {
+ sPush += rRet;
+ rRet = sPush;
+ rRet += sMainTerm;
+ newline--;
+ }
+ else if ((nPart == 1) && (nVariation == 0))
+ newline--;
+ else if ((nPart == 2) && (nVariation == 0))
+ {
+ sPush += rRet;
+ rRet = sPush;
+ rRet += sMainTerm;
+ newline--;
+ }
+ nPart++;
+ break;
+ case 0x19:
+ case 0x1a:
+ APPEND(rRet,"} ");
+ if (nPart == 0)
+ {
+ sMainTerm = rRet;
+ rRet.Erase();
+ newline--;
+ }
+ else if (nPart == 1)
+ {
+ sPush += rRet;
+ rRet = sPush;
+ rRet += sMainTerm;
+ newline--;
+ }
+ nPart++;
+ break;
+ case 0x2a:
+ case 0x2b:
+ APPEND(rRet,"} ");
+
+ if ((nPart == 0) &&
+ ((nVariation == 0) || (nVariation == 1)))
+ {
+ sMainTerm = rRet;
+ rRet.Erase();
+ newline--;
+ }
+ else if ((nPart == 0) && (nVariation == 2))
+ newline--;
+ else if ((nPart == 1) && (nVariation == 2))
+ {
+ sMainTerm = rRet;
+ rRet.Erase();
+ newline--;
+ }
+ else if ((nPart == 2) || (((nPart == 1) &&
+ (nVariation == 0) || (nVariation == 1))))
+ {
+ sPush+=rRet;
+ rRet = sPush;
+ rRet += sMainTerm;
+ }
+ nPart++;
+ break;
+ case 0x2d:
+ if (nVariation==0)
+ {
+ if (nPart == 0)
+ {
+ newline--; //there is another term to arrive
+ APPEND(rRet," mline ");
+ }
+ else
+ APPEND(rRet," rangle ");
+ }
+ else if (nVariation==1)
+ APPEND(rRet," \\lline ");
+ else if (nVariation==2)
+ APPEND(rRet," \\rangle ");
+ nPart++;
+ break;
+ default:
+ break;
+ }
+ bSilent = TRUE; //Skip the optional brackets and/or
+ //symbols that follow some of these
+ //records. Foo Data.
+
+ /*In matrices and piles we cannot seperate equation
+ *lines with the newline keyword*/
+ if (nMatrixCols==0)
+ newline++;
+ }
+ }
+ break;
+ case CHAR:
+ nRet = HandleChar(nTextStart,nSetSize,nLevel,nTag,nSelector,
+ nVariation,bSilent);
+ break;
+ case TMPL:
+ nRet = HandleTemplate(nLevel,nSelector,nVariation);
+ break;
+ case PILE:
+ nRet = HandlePile(nSetAlign,nLevel,nSelector,nVariation);
+ HandleMatrixSeperator(nMatrixRows,nMatrixCols,nCurCol,nCurRow);
+ break;
+ case MATRIX:
+ nRet = HandleMatrix(nLevel,nSelector,nVariation);
+ HandleMatrixSeperator(nMatrixRows,nMatrixCols,nCurCol,nCurRow);
+ break;
+ case EMBEL:
+ HandleEmblishments();
+ break;
+ case RULER:
+ *pS >> nTabStops;
+ for (i=0;i<nTabStops;i++)
+ {
+ *pS >> nTabType;
+ *pS >> nTabOffset;
+ }
+ DBG_ASSERT(FALSE,"Not seen in the wild Equation Ruler Field")
+ break;
+ case FONT:
+ *pS >> nTface;
+ *pS >> nStyle;
+ sFontName.Erase();
+ do
+ {
+ *pS >> nChar8;
+ sFontName.Append(ByteString::ConvertToUnicode(
+ nChar8,RTL_TEXTENCODING_MS_1252));
+ }
+ while(nChar8);
+ break;
+ case SIZE:
+ HandleSetSize();
+ break;
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ nLSize=nRecord-10;
+ break;
+ case END:
+ default:
+ break;
+ }
+ }
+ while (nRecord != END);
+ while (nSetSize)
+ {
+ rRet += '}';
+ nSetSize--;
+ }
+ return nRet;
+}
+
+/*Simply determine if we are at the end of a record or the end of a line,
+ *with fiddley logic to see if we are in a matrix or a pile or neither
+
+ Note we cannot tell until after the event that this is the last entry
+ of a pile, so we must strip the last seperator of a pile after this
+ is detected in the PILE handler
+ */
+void MathType::HandleMatrixSeperator(int nMatrixRows,int nMatrixCols,
+ int &rCurCol,int &rCurRow)
+{
+ if (nMatrixRows!=0)
+ {
+ if (rCurCol == nMatrixCols-1)
+ {
+ if (rCurRow != nMatrixRows-1)
+ APPEND(rRet," {} ##\n");
+ if (nMatrixRows!=-1)
+ {
+ rCurCol=0;
+ rCurRow++;
+ }
+ }
+ else
+ {
+ APPEND(rRet," {} # ");
+ if (nMatrixRows!=-1)
+ rCurCol++;
+ else
+ rRet += '\n';
+ }
+ }
+}
+
+/* set the alignment of the following term, but starmath currently
+ * cannot handle vertical alignment */
+void MathType::HandleAlign(BYTE nHAlign,BYTE nVAlign,int &rSetAlign)
+{
+ switch(nHAlign)
+ {
+ case 1:
+ default:
+ APPEND(rRet,"alignl {");
+ break;
+ case 2:
+ APPEND(rRet,"alignc {");
+ break;
+ case 3:
+ APPEND(rRet,"alignr {");
+ break;
+ }
+#if 0
+ switch(nVAlign)
+ {
+ }
+ rSetAlign+=2;
+#endif
+ rSetAlign++;
+}
+
+/* set size of text, complexity due to overuse of signedness as a flag
+ * indicator by mathtype file format*/
+BOOL MathType::HandleSize(INT16 nLSize,INT16 nDSize, int &rSetSize)
+{
+ BOOL bRet=FALSE;
+ if (nLSize < 0)
+ {
+ if ((-nLSize/32 != nDefaultSize) && (-nLSize/32 != nCurSize))
+ {
+ if (rSetSize)
+ {
+ rSetSize--;
+ rRet += '}';
+ bRet=TRUE;
+ }
+ if (-nLSize/32 != nLastSize)
+ {
+ nLastSize = nCurSize;
+ APPEND(rRet," size ");
+ rRet += String::CreateFromInt32(-nLSize/32);
+ rRet += '{';
+ bRet=TRUE;
+ rSetSize++;
+ }
+ nCurSize = -nLSize/32;
+ }
+ }
+ else
+ {
+ /*sizetable should theoreticaly be filled with the default sizes
+ *of the various font groupings matching starmaths equivalents
+ in aTypeFaces, and a test would be done to see if the new font
+ size would be the same as what starmath would have chosen for
+ itself anyway in which case the size setting could be ignored*/
+ nLSize = aSizeTable[nLSize];
+ nLSize += nDSize;
+ //if (nLSize != nDefaultSize)
+ if (nLSize != nCurSize)
+ {
+ if (rSetSize)
+ {
+ rSetSize--;
+ rRet += '}';
+ bRet=TRUE;
+ }
+ if (nLSize != nLastSize)
+ {
+ nLastSize = nCurSize;
+ APPEND(rRet," size ");
+ rRet += String::CreateFromInt32(nLSize);
+ rRet += '{';
+ bRet=TRUE;
+ rSetSize++;
+ }
+ nCurSize = nLSize;
+ }
+ }
+ return bRet;
+}
+
+int MathType::ConvertFromStarMath(SvStorage *pStor)
+{
+ if (!pTree)
+ return 0;
+
+ SvGlobalName aGName(0x0002ce02L, 0x0000, 0x0000,0xc0,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x46 );
+ pStor->SetClass( aGName, 0, C2S("Microsoft Equation 3.0"));
+
+ static BYTE __READONLY_DATA aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x02, 0xCE, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x46, 0x17, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x45, 0x71, 0x75, 0x61, 0x74, 0x69,
+ 0x6F, 0x6E, 0x20, 0x33, 0x2E, 0x30, 0x00, 0x0C,
+ 0x00, 0x00, 0x00, 0x44, 0x53, 0x20, 0x45, 0x71,
+ 0x75, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x0B,
+ 0x00, 0x00, 0x00, 0x45, 0x71, 0x75, 0x61, 0x74,
+ 0x69, 0x6F, 0x6E, 0x2E, 0x33, 0x00, 0xF4, 0x39,
+ 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ SvStorageStreamRef xStor( pStor->OpenStream( C2S("\1CompObj")));
+ xStor->Write(aCompObj,sizeof(aCompObj));
+
+ static BYTE __READONLY_DATA aOle[] = {
+ 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+ SvStorageStreamRef xStor2( pStor->OpenStream( C2S("\1Ole")));
+ xStor2->Write(aOle,sizeof(aOle));
+ xStor.Clear();
+ xStor2.Clear();
+
+ SvStorageStreamRef xSrc = pStor->OpenStream(C2S("Equation Native"));
+ if ( (!xSrc.Is()) || (SVSTREAM_OK != xSrc->GetError()))
+ return NULL;
+
+ pS = &xSrc;
+ pS->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ pS->SeekRel(EQNOLEFILEHDR_SIZE); //Skip 28byte Header and fill it in later
+ *pS << BYTE(0x03);
+ *pS << BYTE(0x01);
+ *pS << BYTE(0x01);
+ *pS << BYTE(0x03);
+ *pS << BYTE(0x00);
+ UINT32 nSize = pS->Tell();
+ nPendingAttributes=0;
+
+ HandleNodes(pTree);
+ *pS << BYTE(END);
+
+ nSize = pS->Tell()-nSize;
+ pS->Seek(0);
+ EQNOLEFILEHDR aHdr(nSize+4+1);
+ aHdr.Write(pS);
+ return 1;
+}
+
+
+BYTE MathType::HandleNodes(SmNode *pNode,int nLevel)
+{
+ BOOL bRet=FALSE;
+ switch(pNode->GetType())
+ {
+ case NATTRIBUT:
+ HandleAttributes(pNode,nLevel);
+ break;
+ case NTEXT:
+ HandleText(pNode,nLevel);
+ break;
+ case NVERTICAL_BRACE:
+ HandleVerticalBrace(pNode,nLevel);
+ break;
+ case NBRACE:
+ HandleBrace(pNode,nLevel);
+ break;
+ case NOPER:
+ HandleOperator(pNode,nLevel);
+ break;
+ case NBINVER:
+ HandleFractions(pNode,nLevel);
+ break;
+ case NROOT:
+ HandleRoot(pNode,nLevel);
+ break;
+ case NSPECIAL:
+ {
+ SmTextNode *pText=(SmTextNode *)pNode;
+ //if the token str and the result text are the same then this
+ //is to be seen as text, else assume its a mathchar
+ if (pText->GetText() == pText->GetToken().aText)
+ HandleText(pText,nLevel);
+ else
+ HandleMath(pText,nLevel);
+ }
+ break;
+ case NMATH:
+ HandleMath(pNode,nLevel);
+ break;
+ case NSUBSUP:
+ HandleSubSupScript(pNode,nLevel);
+ break;
+ case NEXPRESSION:
+ {
+ USHORT nSize = pNode->GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (SmNode *pTemp = pNode->GetSubNode(i))
+ HandleNodes(pTemp,nLevel+1);
+ }
+ break;
+ case NTABLE:
+ //Root Node, PILE equivalent, i.e. vertical stack
+ HandleTable(pNode,nLevel);
+ break;
+ case NMATRIX:
+ HandleSmMatrix((SmMatrixNode *)pNode,nLevel);
+ break;
+ case NLINE:
+ {
+ *pS << BYTE(0x0a);
+ *pS << BYTE(LINE);
+ USHORT nSize = pNode->GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (SmNode *pTemp = pNode->GetSubNode(i))
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END);
+ }
+ break;
+ case NALIGN:
+ HandleMAlign(pNode,nLevel);
+ break;
+ case NBLANK:
+ *pS << BYTE(CHAR);
+ *pS << BYTE(0x98);
+ if (pNode->GetToken().eType == TSBLANK)
+ *pS << USHORT(0xEB04);
+ else
+ *pS << USHORT(0xEB05);
+ break;
+
+ break;
+ default:
+ {
+ USHORT nSize = pNode->GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (SmNode *pTemp = pNode->GetSubNode(i))
+ HandleNodes(pTemp,nLevel+1);
+ }
+ break;
+ }
+ return bRet;
+}
+
+
+int MathType::StartTemplate(UINT16 nSelector,UINT16 nVariation)
+{
+ int nOldPending=nPendingAttributes;
+ *pS << BYTE(TMPL); //Template
+ *pS << BYTE(nSelector); //selector
+ *pS << BYTE(nVariation); //variation
+ *pS << BYTE(0x00); //options
+ *pS << BYTE(LINE);
+ //theres just no way we can now handle any character
+ //attributes (from mathtypes perspective) centered
+ //over an expression but above template attribute
+ //such as widevec and similiar constructs
+ //we have to drop them
+ nPendingAttributes=0;
+ return nOldPending;
+}
+
+void MathType::EndTemplate(int nOldPendingAttributes)
+{
+ *pS << BYTE(END); //end line
+ *pS << BYTE(END); //end template
+ nPendingAttributes=nOldPendingAttributes;
+}
+
+
+void MathType::HandleSmMatrix(SmMatrixNode *pMatrix,int nLevel)
+{
+ *pS << BYTE(MATRIX);
+ *pS << BYTE(0x00); //vAlign ?
+ *pS << BYTE(0x00); //h_just
+ *pS << BYTE(0x00); //v_just
+ *pS << BYTE(pMatrix->GetNumRows()); //v_just
+ *pS << BYTE(pMatrix->GetNumCols()); //v_just
+ int nBytes=(pMatrix->GetNumRows()+1)*2/8;
+ if (((pMatrix->GetNumRows()+1)*2)%8)
+ nBytes++;
+ for (USHORT j = 0; j < nBytes; j++)
+ *pS << BYTE(0x00); //row_parts
+ nBytes=(pMatrix->GetNumCols()+1)*2/8;
+ if (((pMatrix->GetNumCols()+1)*2)%8)
+ nBytes++;
+ for (USHORT k = 0; k < nBytes; k++)
+ *pS << BYTE(0x00); //col_parts
+ USHORT nSize = pMatrix->GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (SmNode *pTemp = pMatrix->GetSubNode(i))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END); //end line
+ }
+ *pS << BYTE(END);
+}
+
+
+//Root Node, PILE equivalent, i.e. vertical stack
+void MathType::HandleTable(SmNode *pNode,int nLevel)
+{
+ USHORT nSize = pNode->GetNumSubNodes();
+ //The root of the starmath is a table, if
+ //we convert this them each iteration of
+ //conversion from starmath to mathtype will
+ //add an extra unnecessary level to the
+ //mathtype output stack which would grow
+ //without bound in a multi step conversion
+
+ if (nLevel == 0)
+ *pS << BYTE(0x0A); //initial size
+
+ if ( nLevel || (nSize >1))
+ {
+ *pS << BYTE(PILE);
+ *pS << BYTE(nHAlign); //vAlign ?
+ *pS << BYTE(0x01); //hAlign
+ }
+
+ for (USHORT i = 0; i < nSize; i++)
+ if (SmNode *pTemp = pNode->GetSubNode(i))
+ {
+ *pS << BYTE(LINE);
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END);
+ }
+ if (nLevel || (nSize>1))
+ *pS << BYTE(END);
+}
+
+
+void MathType::HandleRoot(SmNode *pNode,int nLevel)
+{
+ USHORT nSize = pNode->GetNumSubNodes();
+ SmNode *pTemp;
+ *pS << BYTE(TMPL); //Template
+ *pS << BYTE(0x0D); //selector
+ if (pNode->GetSubNode(0))
+ *pS << BYTE(0x01); //variation
+ else
+ *pS << BYTE(0x00); //variation
+ *pS << BYTE(0x00); //options
+
+ /*
+ if (pTemp = pNode->GetSubNode(1))
+ HandleNodes(pTemp,nLevel+1);
+ */
+ if (pTemp = pNode->GetSubNode(2))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END);
+ }
+
+ if (pTemp = pNode->GetSubNode(0))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END);
+ }
+ else
+ *pS << BYTE(LINE|0x10); //dummy line
+
+
+
+ *pS << BYTE(END);
+}
+
+BYTE MathType::HandleCScript(SmNode *pNode,SmNode *pContent,int nLevel,ULONG *pPos,BOOL bTest)
+{
+ BYTE nVariation2=0xff;
+
+ if (bTest && pNode->GetSubNode(CSUP+1))
+ {
+ nVariation2=0;
+ if (pNode->GetSubNode(CSUB+1))
+ nVariation2=2;
+ }
+ else if (pNode->GetSubNode(CSUB+1))
+ nVariation2=1;
+
+ if (nVariation2!=0xff)
+ {
+ if (pPos)
+ *pPos = pS->Tell();
+ *pS << BYTE(TMPL); //Template
+ *pS << BYTE(0x2B); //selector
+ *pS << nVariation2;
+ *pS << BYTE(0x00); //options
+
+ if (pContent)
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pContent,nLevel+1);
+ *pS << BYTE(END); //line
+ }
+ else
+ *pS << BYTE(LINE|0x10);
+
+ *pS << BYTE(0x0B);
+
+ SmNode *pTemp;
+ if (pTemp = pNode->GetSubNode(CSUB+1))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END); //line
+ }
+ else
+ *pS << BYTE(LINE|0x10);
+ if (bTest && (pTemp = pNode->GetSubNode(CSUP+1)))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END); //line
+ }
+ else
+ *pS << BYTE(LINE|0x10);
+ }
+ return nVariation2;
+}
+
+
+
+/*
+ Sub and Sup scripts and another problem area, StarMath
+ can have all possible options used at the same time, whereas
+ Mathtype cannot. The ordering of the nodes for each system
+ is quite different as well leading to some complexity
+ */
+void MathType::HandleSubSupScript(SmNode *pNode,int nLevel)
+{
+ USHORT nSize = pNode->GetNumSubNodes();
+ ULONG nRSUpos=0,nCSUpos=0;
+ SmNode *pTemp;
+
+
+ BYTE nVariation=0xff;
+ if (pNode->GetSubNode(LSUP+1))
+ {
+ nVariation=0;
+ if (pNode->GetSubNode(LSUB+1))
+ nVariation=2;
+ }
+ else if (pTemp = pNode->GetSubNode(LSUB+1))
+ nVariation=1;
+
+ if (nVariation!=0xff)
+ {
+ *pS << BYTE(TMPL); //Template
+ *pS << BYTE(0x2c); //selector
+ *pS << nVariation;
+ *pS << BYTE(0x00); //options
+ *pS << BYTE(0x0B);
+
+ if (pTemp = pNode->GetSubNode(LSUB+1))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END); //line
+ }
+ else
+ *pS << BYTE(LINE|0x10);
+ if (pTemp = pNode->GetSubNode(LSUP+1))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END); //line
+ }
+ else
+ *pS << BYTE(LINE|0x10);
+ *pS << BYTE(END);
+ nVariation=0xff;
+ }
+
+
+ BYTE nVariation2=HandleCScript(pNode,NULL,nLevel);
+
+ if (pTemp = pNode->GetSubNode(0))
+ {
+ *pS << BYTE(0x0A);
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END);
+ }
+
+ if (nVariation2 != 0xff)
+ *pS << BYTE(END);
+
+ if (pNode->GetSubNode(RSUP+1))
+ {
+ nVariation=0;
+ if (pNode->GetSubNode(RSUB+1))
+ nVariation=2;
+ }
+ else if (pTemp = pNode->GetSubNode(RSUB+1))
+ nVariation=1;
+
+ if (nVariation!=0xff)
+ {
+ *pS << BYTE(TMPL); //Template
+ *pS << BYTE(0x0F); //selector
+ *pS << nVariation;
+ *pS << BYTE(0x00); //options
+ *pS << BYTE(0x0B);
+
+ if (pTemp = pNode->GetSubNode(RSUB+1))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END); //line
+ }
+ else
+ *pS << BYTE(LINE|0x10);
+ if (pTemp = pNode->GetSubNode(RSUP+1))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END); //line
+ }
+ else
+ *pS << BYTE(LINE|0x10);
+ *pS << BYTE(END); //line
+ }
+
+ //After subscript mathtype will keep the size of
+ //normal text at the subscript size, sigh.
+ *pS << BYTE(0x0A);
+}
+
+
+void MathType::HandleFractions(SmNode *pNode,int nLevel)
+{
+ USHORT nSize = pNode->GetNumSubNodes();
+ SmNode *pTemp;
+ *pS << BYTE(TMPL); //Template
+ *pS << BYTE(0x0E); //selector
+ *pS << BYTE(0x00); //variation
+ *pS << BYTE(0x00); //options
+
+ *pS << BYTE(0x0A);
+ *pS << BYTE(LINE); //line
+ if (pTemp = pNode->GetSubNode(0))
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END);
+
+ *pS << BYTE(0x0A);
+ *pS << BYTE(LINE); //line
+ if (pTemp = pNode->GetSubNode(2))
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END);
+
+ *pS << BYTE(END);
+}
+
+
+void MathType::HandleBrace(SmNode *pNode,int nLevel)
+{
+ USHORT nSize = pNode->GetNumSubNodes();
+ SmNode *pTemp;
+ SmNode *pLeft=pNode->GetSubNode(0);
+ SmNode *pRight=pNode->GetSubNode(2);
+
+ *pS << BYTE(TMPL); //Template
+ bReInterpBrace=0;
+ BYTE nBSpec=0x10;
+ ULONG nLoc = pS->Tell();
+ if (pLeft)
+ {
+ switch (pLeft->GetToken().eType)
+ {
+ case TLANGLE:
+ *pS << BYTE(tmANGLE); //selector
+ *pS << BYTE(0x00); //variation
+ *pS << BYTE(0x00); //options
+ break;
+ case TLBRACE:
+ *pS << BYTE(tmBRACE); //selector
+ *pS << BYTE(0x00); //variation
+ *pS << BYTE(0x00); //options
+ nBSpec+=3;
+ break;
+ case TLBRACKET:
+ *pS << BYTE(tmBRACK); //selector
+ *pS << BYTE(0x00); //variation
+ *pS << BYTE(0x00); //options
+ nBSpec+=3;
+ break;
+ case TLLINE:
+ *pS << BYTE(tmBAR); //selector
+ *pS << BYTE(0x00); //variation
+ *pS << BYTE(0x00); //options
+ nBSpec+=3;
+ break;
+ case TLDLINE:
+ *pS << BYTE(tmDBAR); //selector
+ *pS << BYTE(0x00); //variation
+ *pS << BYTE(0x00); //options
+ break;
+ default:
+ *pS << BYTE(tmPAREN); //selector
+ *pS << BYTE(0x00); //variation
+ *pS << BYTE(0x00); //options
+ nBSpec+=3;
+ break;
+ }
+ }
+
+ if (pTemp = pNode->GetSubNode(1))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END); //options
+ }
+ nSpec=nBSpec;
+ if (pLeft)
+ HandleNodes(pLeft,nLevel+1);
+ if (bReInterpBrace)
+ {
+ ULONG nLoc2 = pS->Tell();
+ pS->Seek(nLoc);
+ *pS << BYTE(0x2D);
+ pS->Seek(nLoc2);
+ *pS << BYTE(CHAR);
+ *pS << BYTE(0x96);
+ *pS << USHORT(0xEC07);
+ bReInterpBrace=0;
+ }
+ if (pRight)
+ HandleNodes(pRight,nLevel+1);
+ nSpec=0x0;
+ *pS << BYTE(END);
+}
+
+
+void MathType::HandleVerticalBrace(SmNode *pNode,int nLevel)
+{
+ SmNode *pTemp;
+ *pS << BYTE(TMPL); //Template
+ if (pNode->GetToken().eType == TUNDERBRACE)
+ *pS << BYTE(tmLHBRACE); //selector
+ else
+ *pS << BYTE(tmUHBRACE); //selector
+ *pS << BYTE(0x01); //variation
+ *pS << BYTE(0x00); //options
+
+ if (pTemp = pNode->GetSubNode(0))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END); //options
+ }
+
+ if (pTemp = pNode->GetSubNode(2))
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pTemp,nLevel+1);
+ *pS << BYTE(END); //options
+ }
+ *pS << BYTE(END);
+}
+
+void MathType::HandleOperator(SmNode *pNode,int nLevel)
+{
+ USHORT nSize = pNode->GetNumSubNodes();
+
+ if (HandleLim(pNode,nLevel))
+ return;
+
+ ULONG nPos;
+ BYTE nVariation;
+
+ switch (pNode->GetToken().eType)
+ {
+ case TIINT:
+ case TIIINT:
+ case TLINT:
+ case TLLINT:
+ case TLLLINT:
+ nVariation=HandleCScript(pNode->GetSubNode(0),
+ pNode->GetSubNode(1),nLevel,&nPos,0);
+ break;
+ default:
+ nVariation=HandleCScript(pNode->GetSubNode(0),
+ pNode->GetSubNode(1),nLevel,&nPos);
+ break;
+ }
+
+ BYTE nOldVariation=nVariation;
+ BYTE nIntVariation=nVariation;
+
+ ULONG nPos2=0;
+ if (nVariation != 0xff)
+ {
+ nPos2 = pS->Tell();
+ pS->Seek(nPos);
+ if (nVariation == 2)
+ {
+ nIntVariation=0;
+ nVariation = 1;
+ }
+ else if (nVariation == 0)
+ nVariation = 1;
+ else if (nVariation == 1)
+ nVariation = 0;
+ }
+ else
+ {
+ nVariation = 2;
+ nIntVariation=0;
+ }
+ *pS << BYTE(TMPL);
+ switch(pNode->GetToken().eType)
+ {
+ case TINT:
+ if (nOldVariation != 0xff)
+ *pS << BYTE(0x18); //selector
+ else
+ *pS << BYTE(0x15); //selector
+ *pS << nIntVariation; //variation
+ break;
+ case TIINT:
+ if (nOldVariation != 0xff)
+ {
+ *pS << BYTE(0x19);
+ *pS << BYTE(0x01);
+ }
+ else
+ {
+ *pS << BYTE(0x16);
+ *pS << BYTE(0x00);
+ }
+ break;
+ case TIIINT:
+ if (nOldVariation != 0xff)
+ {
+ *pS << BYTE(0x1a);
+ *pS << BYTE(0x01);
+ }
+ else
+ {
+ *pS << BYTE(0x17);
+ *pS << BYTE(0x00);
+ }
+ break;
+ case TLINT:
+ if (nOldVariation != 0xff)
+ {
+ *pS << BYTE(0x18);
+ *pS << BYTE(0x02);
+ }
+ else
+ {
+ *pS << BYTE(0x15);
+ *pS << BYTE(0x03);
+ }
+ break;
+ case TLLINT:
+ if (nOldVariation != 0xff)
+ {
+ *pS << BYTE(0x19);
+ *pS << BYTE(0x00);
+ }
+ else
+ {
+ *pS << BYTE(0x16);
+ *pS << BYTE(0x02);
+ }
+ break;
+ case TLLLINT:
+ if (nOldVariation != 0xff)
+ {
+ *pS << BYTE(0x1a);
+ *pS << BYTE(0x00);
+ }
+ else
+ {
+ *pS << BYTE(0x17);
+ *pS << BYTE(0x02);
+ }
+ break;
+ case TSUM:
+ default:
+ *pS << BYTE(0x1d);
+ *pS << nVariation;
+ break;
+ case TPROD:
+ *pS << BYTE(0x1f);
+ *pS << nVariation;
+ break;
+ case TCOPROD:
+ *pS << BYTE(0x21);
+ *pS << nVariation;
+ break;
+ }
+ *pS << BYTE(0x00); //options
+
+ if (nPos2)
+ pS->Seek(nPos2);
+ else
+ {
+ *pS << BYTE(LINE); //line
+ HandleNodes(pNode->GetSubNode(1),nLevel+1);
+ *pS << BYTE(END); //line
+ *pS << BYTE(LINE|0x10);
+ *pS << BYTE(LINE|0x10);
+ }
+
+
+ *pS << BYTE(0x0D);
+ switch(pNode->GetToken().eType)
+ {
+ case TSUM:
+ default:
+ *pS << BYTE(CHAR);
+ *pS << BYTE(0x86);
+ *pS << USHORT(0x2211);
+ break;
+ case TPROD:
+ *pS << BYTE(CHAR);
+ *pS << BYTE(0x86);
+ *pS << USHORT(0x220F);
+ break;
+ case TCOPROD:
+ *pS << BYTE(CHAR);
+ *pS << BYTE(0x8B);
+ *pS << USHORT(0x2210);
+ break;
+ case TIIINT:
+ case TLLLINT:
+ *pS << BYTE(CHAR);
+ *pS << BYTE(0x86);
+ *pS << USHORT(0x222B);
+ case TIINT:
+ case TLLINT:
+ *pS << BYTE(CHAR);
+ *pS << BYTE(0x86);
+ *pS << USHORT(0x222B);
+ case TINT:
+ case TLINT:
+ *pS << BYTE(CHAR);
+ *pS << BYTE(0x86);
+ *pS << USHORT(0x222B);
+ break;
+ }
+ *pS << BYTE(END);
+ *pS << BYTE(0x0A);
+}
+
+
+int MathType::HandlePile(int &rSetAlign,int nLevel,BYTE nSelector,
+ BYTE nVariation)
+{
+ //if (xfLMOVE(nTag))
+ *pS >> nHAlign;
+ *pS >> nVAlign;
+
+ HandleAlign(nHAlign,nVAlign,rSetAlign);
+
+ APPEND(rRet," stack {\n");
+ int nRet = HandleRecords(nLevel+1,nSelector,nVariation,-1,-1);
+ rRet.Erase(rRet.Len()-3,2);
+ APPEND(rRet,"} ");
+
+ while (rSetAlign)
+ {
+ APPEND(rRet,"} ");
+ rSetAlign--;
+ }
+ return nRet;
+}
+
+int MathType::HandleMatrix(int nLevel,BYTE nSelector,
+ BYTE nVariation)
+{
+ BYTE nH_just,nV_just;
+ int nRows,nCols;
+ //if (xfLMOVE(nTag))
+ *pS >> nVAlign;
+ *pS >> nH_just;
+ *pS >> nV_just;
+ *pS >> nRows;
+ *pS >> nCols;
+ int nBytes = ((nRows+1)*2)/8;
+ if (((nRows+1)*2)%8)
+ nBytes++;
+ pS->SeekRel(nBytes);
+ nBytes = ((nCols+1)*2)/8;
+ if (((nCols+1)*2)%8)
+ nBytes++;
+ pS->SeekRel(nBytes);
+ APPEND(rRet," matrix {\n");
+ int nRet = HandleRecords(nLevel+1,nSelector,nVariation,nRows,nCols);
+ APPEND(rRet,"\n} ");
+ return nRet;
+}
+
+int MathType::HandleTemplate(int nLevel,BYTE &rSelector,BYTE &rVariation)
+{
+ BYTE nOption; //This appears utterly unused
+ //if (xfLMOVE(nTag))
+ *pS >> rSelector;
+ *pS >> rVariation;
+ *pS >> nOption;
+ DBG_ASSERT(rSelector < 48,"Selector out of range")
+ if ((rSelector >= 21) && (rSelector <=26))
+ {
+ DBG_ASSERT(nOption < 2,"Option out of range");
+ }
+ else if ((rSelector >= 0) && (rSelector <=12))
+ {
+ DBG_ASSERT(nOption < 3,"Option out of range");
+ }
+ //suborderlist
+ int nRet = HandleRecords(nLevel+1,rSelector,rVariation);
+ rSelector = -1;
+ return nRet;
+}
+
+void MathType::HandleEmblishments()
+{
+ BYTE nEmbel;
+ //if (xfLMOVE(nTag))
+ do
+ {
+ *pS >> nEmbel;
+ switch (nEmbel)
+ {
+ case 0x02:
+ APPEND(rRet," dot ");
+ break;
+ case 0x03:
+ APPEND(rRet," ddot ");
+ break;
+ case 0x04:
+ APPEND(rRet," dddot ");
+ break;
+ case 0x05:
+ if (nPostSup == 0)
+ {
+ APPEND(sPost," sup {}");
+ nPostSup = sPost.Len();
+ }
+ sPost.InsertAscii(" ' ",nPostSup-1);
+ nPostSup += 3;
+ break;
+ case 0x06:
+ if (nPostSup == 0)
+ {
+ APPEND(sPost," sup {}");
+ nPostSup = sPost.Len();
+ }
+ sPost.InsertAscii(" '' ",nPostSup-1);
+ nPostSup += 4;
+ break;
+ case 0x07:
+ if (nPostlSup == 0)
+ {
+ APPEND(sPost," lsup {}");
+ nPostlSup = sPost.Len();
+ }
+ sPost.InsertAscii(" ' ",nPostlSup-1);
+ nPostlSup += 3;
+ break;
+ case 0x08:
+ APPEND(rRet," tilde ");
+ break;
+ case 0x09:
+ APPEND(rRet," hat ");
+ break;
+ case 0x0b:
+ APPEND(rRet," vec ");
+ break;
+ case 0x10:
+ APPEND(rRet," overstrike ");
+ break;
+ case 0x11:
+ APPEND(rRet," bar ");
+ break;
+ case 0x12:
+ if (nPostSup == 0)
+ {
+ APPEND(sPost," sup {}");
+ nPostSup = sPost.Len();
+ }
+ sPost.InsertAscii(" ''' ",nPostSup-1);
+ nPostSup += 5;
+ break;
+ case 0x14:
+ APPEND(rRet," breve ");
+ break;
+ default:
+ DBG_ASSERT(nEmbel < 21,"Embel out of range")
+ break;
+ }
+ }while (nEmbel);
+}
+
+void MathType::HandleSetSize()
+{
+ BYTE nTemp;
+ *pS >> nTemp;
+ switch (nTemp)
+ {
+ case 101:
+ *pS >> nLSize;
+ nLSize = -nLSize;
+ break;
+ case 100:
+ *pS >> nTemp;
+ nLSize = nTemp;
+ *pS >> nDSize;
+ break;
+ default:
+ nLSize = nTemp;
+ *pS >> nTemp;
+ nDSize = nTemp-128;
+ break;
+ }
+}
+
+int MathType::HandleChar(xub_StrLen &rTextStart,int &rSetSize,int nLevel,
+ BYTE nTag,BYTE nSelector,BYTE nVariation, BOOL bSilent)
+{
+ sal_Unicode nChar;
+ int nRet=1;
+
+ if (xfAUTO(nTag))
+ {
+ //This is a candidate for function recognition, whatever
+ //that is!
+ }
+ //if (xfLMODE(nTag))
+
+ *pS >> nTypeFace;
+ if (nVersion < 3)
+ {
+ BYTE nChar8;
+ *pS >> nChar8;
+ nChar = nChar8;
+ }
+ else
+ *pS >> nChar;
+
+ if (xfEMBELL(nTag))
+ {
+ //A bit tricky, the character emblishments for
+ //mathtype can all be listed after eachother, in
+ //starmath some must go before the character and some
+ //must go after. In addition some of the emblishments
+ //may repeated and in starmath some of these groups
+ //must be gathered together. sPost is the portion that
+ //follows the char and nPostSup and nPostlSup are the
+ //indexes at which this class of emblishment is
+ //collated together
+ sPost.Erase();
+ nPostSup = nPostlSup = 0;
+ int nOriglen=rRet.Len()-rTextStart;
+ if ((!bSilent) && ((nOriglen) > 1))
+ rRet += '\"';
+ nRet = HandleRecords(nLevel+1,nSelector,nVariation);
+ if (!bSilent)
+ {
+ if (nOriglen > 1)
+ {
+ rRet.InsertAscii(" ital \"",rTextStart);
+ APPEND(rRet," ital {");
+ }
+ else
+ APPEND(rRet," {");
+ }
+ }
+
+ if (!bSilent)
+ {
+ int nOldLen = rRet.Len();
+ //nLastSize = nCurSize;
+ if (HandleSize(nLSize,nDSize,rSetSize))
+ {
+ if ((nOldLen - rTextStart) > 1)
+ {
+ rRet.InsertAscii("\"",nOldLen);
+ rRet.InsertAscii(" ital \"",rTextStart);
+ }
+ rTextStart = rRet.Len();
+ }
+ nOldLen = rRet.Len();
+ if (!LookupChar(nChar))
+ {
+ if (nOldLen - rTextStart > 1)
+ {
+ rRet.InsertAscii("\"",nOldLen);
+ rRet.InsertAscii(" ital \"",rTextStart);
+ }
+ rTextStart = rRet.Len();
+ }
+ }
+
+ if ((xfEMBELL(nTag)) && (!bSilent))
+ {
+ rRet += '}';
+ rRet += sPost;
+ rTextStart = rRet.Len();
+ }
+ return nRet;
+}
+
+BOOL MathType::HandleLim(SmNode *pNode,int nLevel)
+{
+ BOOL bRet=0;
+ //Special case for the "lim" option in StarMath
+ if ((pNode->GetToken().eType == TLIM)
+ || (pNode->GetToken().eType == TLIMSUP)
+ || (pNode->GetToken().eType == TLIMINF)
+ )
+ {
+ if (pNode->GetSubNode(1))
+ {
+ BYTE nVariation2=HandleCScript(pNode->GetSubNode(0),NULL,nLevel);
+
+ *pS << BYTE(0x0A);
+ *pS << BYTE(LINE); //line
+ *pS << BYTE(CHAR|0x10);
+ *pS << BYTE(0x82);
+ *pS << USHORT('l');
+ *pS << BYTE(CHAR|0x10);
+ *pS << BYTE(0x82);
+ *pS << USHORT('i');
+ *pS << BYTE(CHAR|0x10);
+ *pS << BYTE(0x82);
+ *pS << USHORT('m');
+
+ if (pNode->GetToken().eType == TLIMSUP)
+ {
+ *pS << BYTE(CHAR); //some space
+ *pS << BYTE(0x98);
+ *pS << USHORT(0xEB04);
+
+ *pS << BYTE(CHAR|0x10);
+ *pS << BYTE(0x82);
+ *pS << USHORT('s');
+ *pS << BYTE(CHAR|0x10);
+ *pS << BYTE(0x82);
+ *pS << USHORT('u');
+ *pS << BYTE(CHAR|0x10);
+ *pS << BYTE(0x82);
+ *pS << USHORT('p');
+ }
+ else if (pNode->GetToken().eType == TLIMINF)
+ {
+ *pS << BYTE(CHAR); //some space
+ *pS << BYTE(0x98);
+ *pS << USHORT(0xEB04);
+
+ *pS << BYTE(CHAR|0x10);
+ *pS << BYTE(0x82);
+ *pS << USHORT('i');
+ *pS << BYTE(CHAR|0x10);
+ *pS << BYTE(0x82);
+ *pS << USHORT('n');
+ *pS << BYTE(CHAR|0x10);
+ *pS << BYTE(0x82);
+ *pS << USHORT('f');
+ }
+
+
+ *pS << BYTE(CHAR); //some space
+ *pS << BYTE(0x98);
+ *pS << USHORT(0xEB04);
+
+ if (nVariation2 != 0xff)
+ {
+ *pS << BYTE(END);
+ *pS << BYTE(END);
+ }
+ HandleNodes(pNode->GetSubNode(1),nLevel+1);
+ //*pS << BYTE(END); //options
+ bRet = 1;
+ }
+ }
+ return bRet;
+}
+
+void MathType::HandleMAlign(SmNode *pNode,int nLevel)
+{
+ BYTE nPushedHAlign=nHAlign;
+ switch(pNode->GetToken().eType)
+ {
+ case TALIGNC:
+ nHAlign=2;
+ break;
+ case TALIGNR:
+ nHAlign=3;
+ break;
+ default:
+ nHAlign=1;
+ break;
+ }
+ USHORT nSize = pNode->GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (SmNode *pTemp = pNode->GetSubNode(i))
+ HandleNodes(pTemp,nLevel+1);
+ nHAlign=nPushedHAlign;
+}
+
+void MathType::HandleMath(SmNode *pNode,int nLevel)
+{
+ if (pNode->GetToken().eType == TMLINE)
+ {
+ *pS << BYTE(END);
+ *pS << BYTE(LINE);
+ bReInterpBrace=1;
+ return;
+ }
+ SmMathSymbolNode *pTemp=(SmMathSymbolNode *)pNode;
+ for(int i=0;i<pTemp->GetText().Len();i++)
+ {
+ //Convert StarMath to Unicode. Provisional Table
+ //until unicode font designers come back with
+ //something complete
+
+ USHORT nArse = aMathTypeTable[pTemp->GetText().GetChar(i)&0x00FF];
+ if ((nArse == 0x2224) || (nArse == 0x2288) || (nArse == 0x2285) || (nArse == 0x2289))
+ *pS << BYTE(CHAR|0x20);
+ else
+ *pS << BYTE(CHAR); //char without formula recognition
+ //The typeface seems to be MTEXTRA for unicode characters,
+ //though how to determine when mathtype chooses one over
+ //the other is unknown. This should do the trick
+ //nevertheless.
+ BYTE nBias;
+ if ( (nArse == 0x2213) || (nArse == 0x2218) ||
+ (nArse == 0x210F) || (
+ (nArse >= 0x22EE) && (nArse <= 0x22FF)
+ ))
+ {
+ nBias = 0xB; //typeface
+ }
+ else if ((nArse > 0x2000) || (nArse == 0x00D7))
+ nBias = 0x6; //typeface
+ else if (nArse == 0x3d1)
+ nBias = 0x4;
+ else if ((nArse > 0xFF) && ((nArse < 0x393) || (nArse > 0x3c9)))
+ nBias = 0xB; //typeface
+ else if ((nArse == 0x2F) || (nArse == 0x2225))
+ nBias = 0x2; //typeface
+ else
+ nBias = 0x3; //typeface
+
+ *pS << BYTE(nSpec+nBias+128); //typeface
+
+ if (nArse == 0x2224)
+ {
+ *pS << USHORT(0x7C);
+ *pS << BYTE(EMBEL);
+ *pS << BYTE(0x0A);
+ *pS << BYTE(END); //end embel
+ *pS << BYTE(END); //end embel
+ }
+ else if (nArse == 0x2225)
+ *pS << USHORT(0xEC09);
+ else if (nArse == 0x226A)
+ {
+ *pS << USHORT(0x3C);
+ *pS << BYTE(CHAR);
+ *pS << BYTE(0x98);
+ *pS << USHORT(0xEB01);
+ *pS << BYTE(CHAR);
+ *pS << BYTE(0x86);
+ *pS << USHORT(0x3c);
+ }
+ else if (nArse == 0x2288)
+ {
+ *pS << USHORT(0x2286);
+ *pS << BYTE(EMBEL);
+ *pS << BYTE(0x0A);
+ *pS << BYTE(END); //end embel
+ *pS << BYTE(END); //end embel
+ }
+ else if (nArse == 0x2289)
+ {
+ *pS << USHORT(0x2287);
+ *pS << BYTE(EMBEL);
+ *pS << BYTE(0x0A);
+ *pS << BYTE(END); //end embel
+ *pS << BYTE(END); //end embel
+ }
+ else if (nArse == 0x2285)
+ {
+ *pS << USHORT(0x2283);
+ *pS << BYTE(EMBEL);
+ *pS << BYTE(0x0A);
+ *pS << BYTE(END); //end embel
+ *pS << BYTE(END); //end embel
+ }
+ else
+ {
+ //Convert StarMath to Unicode. Provisional Table
+ //until unicode font designers come back with
+ //something complete
+ *pS << nArse;
+ }
+
+ }
+}
+
+void MathType::HandleAttributes(SmNode *pNode,int nLevel)
+{
+ int nOldPending;
+ USHORT nSize = pNode->GetNumSubNodes();
+ SmNode *pTemp;
+ SmTextNode *pIsText;
+
+ //SmTextNode *pTemp=(SmTextNode *)pNode;
+ //for(int i=0;i<pTemp->GetText().Len();i++)
+
+ if (pTemp = pNode->GetSubNode(0))
+ {
+ pIsText = (SmTextNode *)pNode->GetSubNode(1);
+
+ switch (pTemp->GetToken().eType)
+ {
+ case TWIDEVEC:
+ //theres just no way we can now handle any character
+ //attributes (from mathtypes perspective) centered
+ //over an expression but above template attributes
+ //such as widevec and similiar constructs
+ //we have to drop them
+ nOldPending = StartTemplate(0x2f,0x01);
+ break;
+ case TCHECK: //Not Exportable
+ case TACUTE: //Not Exportable
+ case TGRAVE: //Not Exportable
+ case TCIRCLE: //Not Exportable
+ case TWIDETILDE: //Not Exportable
+ case TWIDEHAT: //Not Exportable
+ break;
+ case TUNDERLINE:
+ nOldPending = StartTemplate(0x10);
+ break;
+ case TOVERLINE: //If the next node is not text
+ //or text with more than one char
+ if ((pIsText->GetToken().eType != NTEXT) ||
+ (pIsText->GetText().Len() > 1))
+ nOldPending = StartTemplate(0x11);
+ break;
+ default:
+ nPendingAttributes++;
+ break;
+ }
+ }
+
+ if (pIsText)
+ HandleNodes(pIsText,nLevel+1);
+
+ switch (pTemp->GetToken().eType)
+ {
+ case TWIDEVEC:
+ case TUNDERLINE:
+ EndTemplate(nOldPending);
+ break;
+ case TOVERLINE:
+ if ((pIsText->GetToken().eType != NTEXT) ||
+ (pIsText->GetText().Len() > 1))
+ EndTemplate(nOldPending);
+ break;
+ default:
+ break;
+ }
+
+ //if there was no suitable place to put the attribute,
+ //then we have to just give up on it
+ if (nPendingAttributes)
+ nPendingAttributes--;
+ else
+ {
+ if ((nInsertion != 0) && (pTemp = pNode->GetSubNode(0)))
+ {
+ ULONG nPos = pS->Tell();
+ nInsertion--;
+ pS->Seek(nInsertion);
+ switch(pTemp->GetToken().eType)
+ {
+ case TACUTE: //Not Exportable
+ case TGRAVE: //Not Exportable
+ case TCIRCLE: //Not Exportable
+ break;
+ case TCDOT:
+ *pS << BYTE(2);
+ break;
+ case TDDOT:
+ *pS << BYTE(3);
+ break;
+ case TDDDOT:
+ *pS << BYTE(4);
+ break;
+ case TTILDE:
+ *pS << BYTE(8);
+ break;
+ case THAT:
+ *pS << BYTE(9);
+ break;
+ case TVEC:
+ *pS << BYTE(11);
+ break;
+ case TOVERSTRIKE:
+ *pS << BYTE(16);
+ break;
+ case TOVERLINE:
+ if ((pIsText->GetToken().eType == NTEXT) &&
+ (pIsText->GetText().Len() == 1))
+ *pS << BYTE(17);
+ break;
+ case TBREVE:
+ *pS << BYTE(20);
+ break;
+ case TWIDEVEC:
+ case TUNDERLINE:
+ case TWIDETILDE:
+ case TWIDEHAT:
+ break;
+ case TBAR:
+ *pS << BYTE(17);
+ break;
+ default:
+ *pS << BYTE(0x2);
+ break;
+ }
+ pS->Seek(nPos);
+ }
+ }
+}
+
+void MathType::HandleText(SmNode *pNode,int nLevel)
+{
+ SmTextNode *pTemp=(SmTextNode *)pNode;
+ for(int i=0;i<pTemp->GetText().Len();i++)
+ {
+ if ((nPendingAttributes) &&
+ (i == ((pTemp->GetText().Len()+1)/2)-1))
+ {
+ *pS << BYTE(0x22); //char, with attributes right
+ //after the character
+ }
+ else
+ *pS << BYTE(CHAR);
+ //*pS << BYTE(CHAR|0x10); //char with formula recognition
+
+ if ((pTemp->GetText().GetChar(i) >= '0') &&
+ (pTemp->GetText().GetChar(i) <= '9'))
+ *pS << BYTE(0x8+128); //typeface
+ else
+ *pS << BYTE(0x3+128); //typeface
+ *pS << USHORT(pTemp->GetText().GetChar(i));
+
+ //Mathtype can only have these sort of character
+ //attributes on a single character, starmath can put them
+ //anywhere, when the entity involved is a text run this is
+ //a large effort to place the character attribute on the
+ //central mathtype character so that it does pretty much
+ //what the user probably has in mind. The attributes
+ //filled in here are dummy ones which are replaced in the
+ //ATTRIBUT handler if a suitable location for the
+ //attributes was found here. Unfortunately it is
+ //possible for starmath to place character attributes on
+ //entities which cannot occur in mathtype e.g. a Summation
+ //symbol so these attributes may be lost
+ if ((nPendingAttributes) &&
+ (i == ((pTemp->GetText().Len()+1)/2)-1))
+ {
+ *pS << BYTE(EMBEL);
+ while (nPendingAttributes)
+ {
+ *pS << BYTE(2);
+ //wedge the attributes in here and clear
+ //the pending stack
+ nPendingAttributes--;
+ }
+ nInsertion=pS->Tell();
+ *pS << BYTE(END); //end embel
+ *pS << BYTE(END); //end embel
+ }
+ }
+}
+
diff --git a/starmath/source/mathtype.hxx b/starmath/source/mathtype.hxx
new file mode 100644
index 000000000000..a7cf86b1fdb2
--- /dev/null
+++ b/starmath/source/mathtype.hxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * $RCSfile: mathtype.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef MATHTYPE_HXX
+#define MATHTYPE_HXX
+
+#ifndef NODE_HXX
+#include "node.hxx"
+#endif
+
+#ifndef _SVSTOR_HXX
+#include <so3/svstor.hxx>
+#endif
+
+#define EQNOLEFILEHDR_SIZE 28
+class EQNOLEFILEHDR
+{
+public:
+ EQNOLEFILEHDR() {}
+ EQNOLEFILEHDR(UINT32 nLenMTEF): nCBHdr(0x1c), nVersion(0x20000),
+ nCf(0xc1c6), nCBObject(nLenMTEF), nReserved1(0), nReserved2(0x0014F690),
+ nReserved3(0x0014EBB4), nReserved4(0) {}
+ UINT16 nCBHdr; // length of header, sizeof(EQNOLEFILEHDR) = 28 bytes
+ UINT32 nVersion; // hiword = 2, loword = 0
+ UINT16 nCf; // clipboard format ("MathType EF")
+ UINT32 nCBObject; // length of MTEF data following this header in bytes
+ UINT32 nReserved1; // not used
+ UINT32 nReserved2; // not used
+ UINT32 nReserved3; // not used
+ UINT32 nReserved4; // not used
+
+ void Read(SvStorageStream *pS);
+ void Write(SvStorageStream *pS);
+};
+
+class MathType
+{
+public:
+ MathType(String &rIn) : bSilent(FALSE),nDefaultSize(12),
+ nLSize(0),nDSize(0),nCurSize(0),nLastSize(0),nVAlign(0),nHAlign(0),rRet(rIn)
+ {
+ aSizeTable[0]=12;
+ aSizeTable[1]=8;
+ aSizeTable[2]=6;
+ aSizeTable[3]=24;
+ aSizeTable[4]=10;
+ aSizeTable[5]=12;
+ aSizeTable[6]=12;
+ }
+ MathType(String &rIn,SmNode *pIn) : bSilent(FALSE),nDefaultSize(12),
+ nLSize(0),nDSize(0),nCurSize(0),nLastSize(0),nVAlign(0),nHAlign(2),pTree(pIn),
+ rRet(rIn),nInsertion(0),nSpec(0)
+ {
+ aSizeTable[0]=12;
+ aSizeTable[1]=8;
+ aSizeTable[2]=6;
+ aSizeTable[3]=24;
+ aSizeTable[4]=10;
+ aSizeTable[5]=12;
+ aSizeTable[6]=12;
+ }
+ int Parse(SvStorage *pS);
+ int ConvertFromStarMath(SvStorage *pStor);
+private:
+/*Ver 2 Header*/
+ BYTE nVersion;
+ BYTE nPlatform;
+ BYTE nProduct;
+ BYTE nProdVersion;
+ BYTE nProdSubVersion;
+
+ SvStorageStream *pS;
+
+ int HandleRecords(int nLevel=0,BYTE nSelector=-1,
+ BYTE nVariation=-1,int nRows=0,int nCols=0);
+ BOOL LookupChar(sal_Unicode nChar);
+ BOOL HandleSize(INT16 nLSize,INT16 nDSize, int &rSetSize);
+ void HandleAlign(BYTE nHAlign,BYTE nVAlign, int &rSetAlign);
+ int HandlePile(int &rSetAlign,int nLevel,BYTE nSelector,BYTE nVariation);
+ int HandleMatrix(int nLevel,BYTE nSelector,BYTE nVariarion);
+ void HandleMatrixSeperator(int nMatrixRows,int nMatrixCols,
+ int &rCurCol,int &rCurRow);
+ int HandleTemplate(int nLevel,BYTE &rSelector,BYTE &rVariation);
+ void HandleEmblishments();
+ void HandleSetSize();
+ int HandleChar(xub_StrLen &rTextStart,int &rSetSize,int nLevel,BYTE nTag,
+ BYTE nSelector,BYTE nVariation,BOOL bSilent);
+ int xfLMOVE(BYTE nTest) {return nTest&0x80;}
+ int xfAUTO(BYTE nTest) {return nTest&0x10;}
+ int xfEMBELL(BYTE nTest) {return nTest&0x20;}
+ int xfNULL(BYTE nTest) {return nTest&0x10;}
+ int xfLSPACE(BYTE nTest) {return nTest&0x40;}
+ int xfRULER(BYTE nTest) {return nTest&0x20;}
+
+ BYTE HandleNodes(SmNode *pNode,int nLevel=0);
+ int StartTemplate(UINT16 nSelector,UINT16 nVariation=0);
+ void EndTemplate(int nOldPendingAttributes);
+ void HandleSmMatrix(SmMatrixNode *pMatrix,int nLevel);
+ void HandleTable(SmNode *pNode,int nLevel);
+ void HandleRoot(SmNode *pNode,int nLevel);
+ void HandleSubSupScript(SmNode *pNode,int nLevel);
+ BYTE HandleCScript(SmNode *pNode,SmNode *pContent,int nLevel,ULONG *pPos=NULL,BOOL bTest=TRUE);
+ void HandleFractions(SmNode *pNode,int nLevel);
+ void HandleBrace(SmNode *pNode,int nLevel);
+ void HandleVerticalBrace(SmNode *pNode,int nLevel);
+ void HandleOperator(SmNode *pNode,int nLevel);
+ BOOL HandleLim(SmNode *pNode,int nLevel);
+ void HandleMAlign(SmNode *pNode,int nLevel);
+ void HandleMath(SmNode *pNode,int nLevel);
+ void HandleText(SmNode *pNode,int nLevel);
+ void HandleAttributes(SmNode *pNode,int nLevel);
+
+ String &rRet;
+ SmNode *pTree;
+
+ BYTE nHAlign;
+ BYTE nVAlign;
+
+ int nPendingAttributes;
+ ULONG nInsertion;
+
+ INT16 aSizeTable[7];
+ INT16 nDefaultSize;
+ INT16 nLSize;
+ INT16 nDSize;
+ INT16 nCurSize;
+ INT16 nLastSize;
+ BYTE nSpec;
+ BOOL bSilent,bReInterpBrace;
+ String sPost;
+ xub_StrLen nPostSup;
+ xub_StrLen nPostlSup;
+ BYTE nTypeFace;
+
+ enum MTOKENS {END,LINE,CHAR,TMPL,PILE,MATRIX,EMBEL,RULER,FONT,SIZE};
+ enum MTEMPLATES
+ {
+ tmANGLE,tmPAREN,tmBRACE,tmBRACK,tmBAR,tmDBAR,tmFLOOR,tmCEILING,
+ tmLBLB,tmRBRB,tmRBLB,tmLBRP,tmLPRB,tmROOT,tmFRACT,tmSCRIPT,tmUBAR,
+ tmOBAR,tmLARROW,tmRARROW,tmBARROW,tmSINT,tmDINT,tmTINT,tmSSINT,
+ tmDSINT,tmTSINT,tmUHBRACE,tmLHBRACE,tmSUM
+ };
+};
+
+
+#endif
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
new file mode 100644
index 000000000000..3680c6883500
--- /dev/null
+++ b/starmath/source/node.cxx
@@ -0,0 +1,2490 @@
+/*************************************************************************
+ *
+ * $RCSfile: node.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifndef _SV_GEN_HXX //autogen
+#include <tools/gen.hxx>
+#endif
+#ifndef _FRACT_HXX //autogen
+#include <tools/fract.hxx>
+#endif
+#ifndef _SV_COLOR_HXX //autogen
+#include <vcl/color.hxx>
+#endif
+#ifndef _SV_METRIC_HXX //autogen
+#include <vcl/metric.hxx>
+#endif
+#ifndef _SV_LINEINFO_HXX
+#include <vcl/lineinfo.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX //autogen
+#include <vcl/outdev.hxx>
+#endif
+#ifndef _SFXMODULE_HXX //autogen
+#include <sfx2/module.hxx>
+#endif
+
+#ifdef USE_POLYGON
+
+#ifndef _SV_POLY_HXX //autogen
+#include <vcl/poly.hxx>
+#endif
+#ifndef _XPOLY_HXX //autogen
+#include <svx/xpoly.hxx>
+#endif
+#ifndef _XOUTX_HXX //autogen
+#include <svx/xoutx.hxx>
+#endif
+
+#ifndef XCHAR_HXX
+#include "xchar.hxx"
+#endif
+
+#endif //USE_POLYGON
+
+
+#ifndef NODE_HXX
+#include "node.hxx"
+#endif
+#ifndef SYMBOL_HXX
+#include "symbol.hxx"
+#endif
+#ifndef _SMMOD_HXX
+#include "smmod.hxx"
+#endif
+
+#include <math.h>
+#include <float.h>
+
+// define this to draw rectangles for debugging
+//#define SM_RECT_DEBUG
+
+////////////////////////////////////////
+// SmTmpDevice
+// A little class that behaves like a "const OutputDevice &" object but
+// allows for font changes. The original font will be restored in the
+// destructor! (Thus logically it's "const".)
+// It's main purpose is to allow for the "const" in the 'OutputDevice'
+// argument in the 'Arrange' functions.
+// In fact we need to change the font in the 'OutputDevice' to the one
+// of the node to calculate sizes (rectangles) for text.
+//
+
+class SmTmpDevice
+{
+ OutputDevice &rOutDev;
+
+ // disallow use of copy-constructor and assignment-operator
+ SmTmpDevice(const SmTmpDevice &rTmpDev);
+ SmTmpDevice & operator = (const SmTmpDevice &rTmpDev);
+
+public:
+ SmTmpDevice(OutputDevice &rTheDev);
+ ~SmTmpDevice() { rOutDev.Pop(); }
+
+ void SetFont(const Font &rNewFont) { rOutDev.SetFont(rNewFont); }
+
+ // conversion operator that allows only const member-functions from
+ // 'OutputDevice' to be called. (Thus only the font can be changed
+ // via the above 'SetFont')
+ operator const OutputDevice & () const { return rOutDev; }
+};
+
+
+SmTmpDevice::SmTmpDevice(OutputDevice &rTheDev) :
+ rOutDev(rTheDev)
+{
+ rOutDev.Push( PUSH_FONT | PUSH_MAPMODE );
+ rOutDev.SetMapMode( MAP_100TH_MM ); //Immer fuer 100% fomatieren
+}
+
+
+///////////////////////////////////////////////////////////////////////////
+
+
+SmNode::SmNode(SmNodeType eNodeType, const SmToken &rNodeToken)
+{
+ eType = eNodeType;
+ eScaleMode = SCALE_NONE;
+ aNodeToken = rNodeToken;
+}
+
+
+SmNode::~SmNode()
+{
+}
+
+
+SmNode * SmNode::GetLeftMost()
+ // returns leftmost node of current subtree.
+ //! (this assumes the one with index 0 is always the leftmost subnode
+ //! for the current node).
+{
+ SmNode *pNode = GetNumSubNodes() > 0 ?
+ GetSubNode(0) : NULL;
+
+ return pNode ? pNode->GetLeftMost() : this;
+}
+
+
+void SmNode::SetPhantom(BOOL bIsPhantomP)
+{
+ if (! (Flags() & FLG_VISIBLE))
+ bIsPhantom = bIsPhantomP;
+
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->SetPhantom(bIsPhantom);
+}
+
+
+void SmNode::SetColor(const Color& rColor)
+{
+ if (! (Flags() & FLG_COLOR))
+ GetFont().SetColor(rColor);
+
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->SetColor(rColor);
+}
+
+
+void SmNode::SetAttribut(USHORT nAttrib)
+{
+ if ( nAttrib == ATTR_BOLD && !(Flags() & FLG_BOLD)
+ || nAttrib == ATTR_ITALIC && !(Flags() & FLG_ITALIC))
+ nAttributes |= nAttrib;
+
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->SetAttribut(nAttrib);
+}
+
+
+void SmNode::ClearAttribut(USHORT nAttrib)
+{
+ if ( nAttrib == ATTR_BOLD && !(Flags() & FLG_BOLD)
+ || nAttrib == ATTR_ITALIC && !(Flags() & FLG_ITALIC))
+ nAttributes &= ~nAttrib;
+
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->ClearAttribut(nAttrib);
+}
+
+
+void SmNode::SetFont(const SmFace &rFace)
+{
+ if (!(Flags() & FLG_FONT))
+ GetFont() = rFace;
+
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->SetFont(rFace);
+}
+
+
+void SmNode::SetFontSize(const Fraction &rSize, USHORT nType)
+ //! 'rSize' is in units of pts
+{
+ Size aSize;
+
+ if (!(Flags() & FLG_SIZE))
+ {
+ Fraction aVal (SmPtsTo100th_mm(rSize.GetNumerator()),
+ rSize.GetDenominator());
+ long nHeight = (long) aVal;
+
+ aSize = GetFont().GetSize();
+ aSize.Width() = 0;
+ switch(nType)
+ {
+ case FNTSIZ_ABSOLUT:
+ aSize.Height() = nHeight;
+ break;
+
+ case FNTSIZ_PLUS:
+ aSize.Height() += nHeight;
+ break;
+
+ case FNTSIZ_MINUS:
+ aSize.Height() -= nHeight;
+ break;
+
+ case FNTSIZ_MULTIPLY:
+ aSize.Height() = (long) (Fraction(aSize.Height()) * rSize);
+ break;
+
+ case FNTSIZ_DIVIDE:
+ if (rSize != Fraction(0L))
+ aSize.Height() = (long) (Fraction(aSize.Height()) / rSize);
+ break;
+ }
+
+ // check the requested size against maximum value
+ static int __READONLY_DATA nMaxVal = SmPtsTo100th_mm(128);
+ if (aSize.Height() > nMaxVal)
+ aSize.Height() = nMaxVal;
+
+ GetFont().SetSize(aSize);
+ }
+
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->SetFontSize(rSize, nType);
+}
+
+
+void SmNode::SetSize(const Fraction &rSize)
+{
+ GetFont() *= rSize;
+
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->SetSize(rSize);
+}
+
+
+void SmNode::SetRectHorAlign(RectHorAlign eHorAlign)
+{
+ if (!(Flags() & FLG_HORALIGN))
+ eRectHorAlign = eHorAlign;
+
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->SetRectHorAlign(eHorAlign);
+}
+
+
+void SmNode::PrepareAttributes()
+{
+ GetFont().SetWeight((Attributes() & ATTR_BOLD) ? WEIGHT_BOLD : WEIGHT_NORMAL);
+ GetFont().SetItalic((Attributes() & ATTR_ITALIC) ? ITALIC_NORMAL : ITALIC_NONE);
+}
+
+
+void SmNode::Prepare(const SmFormat &rFormat)
+{
+#ifdef DEBUG
+ bIsDebug = TRUE;
+#else
+ bIsDebug = FALSE;
+#endif
+ bIsPhantom = FALSE;
+ nFlags = 0;
+ nAttributes = 0;
+
+ switch (rFormat.GetHorAlign())
+ { case AlignLeft: eRectHorAlign = RHA_LEFT; break;
+ case AlignCenter: eRectHorAlign = RHA_CENTER; break;
+ case AlignRight: eRectHorAlign = RHA_RIGHT; break;
+ }
+
+ GetFont() = rFormat.GetFont(FNT_MATH);
+ GetFont().SetCharSet(RTL_TEXTENCODING_SYMBOL);
+ GetFont().SetWeight(WEIGHT_NORMAL);
+ GetFont().SetItalic(ITALIC_NONE);
+
+ SmNode *pNode;
+ int nSize = GetNumSubNodes();
+ for (int i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->Prepare(rFormat);
+}
+
+
+void SmNode::ToggleDebug() const
+ // toggle 'bIsDebug' in current subtree
+{
+#ifdef DEBUG
+ SmNode *pThis = (SmNode *) this;
+
+ pThis->bIsDebug = bIsDebug ? FALSE : TRUE;
+
+ SmNode *pNode;
+ int nSize = GetNumSubNodes();
+ for (int i = 0; i < nSize; i++)
+ if (pNode = pThis->GetSubNode(i))
+ pNode->ToggleDebug();
+#endif
+}
+
+
+#ifdef MAC
+#pragma segment FrmNode_02
+
+#else
+
+#endif
+
+
+void SmNode::Move(const Point& rPosition)
+{
+ if (rPosition.X() == 0 && rPosition.Y() == 0)
+ return;
+
+ SmRect::Move(rPosition);
+
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->Move(rPosition);
+}
+
+
+void SmNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->Arrange(rDev, rFormat);
+}
+
+
+void SmNode::Draw(OutputDevice &rDev, const Point &rPosition) const
+{
+ if (IsPhantom())
+ return;
+
+ const SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ for (USHORT i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ { Point aOffset (pNode->GetTopLeft() - GetTopLeft());
+ pNode->Draw(rDev, rPosition + aOffset);
+ }
+
+#ifdef SM_RECT_DEBUG
+ if (!IsDebug())
+ return;
+
+ int nRFlags = SM_RECT_CORE | SM_RECT_ITALIC | SM_RECT_LINES | SM_RECT_MID;
+ SmRect::Draw(rDev, rPosition, nRFlags);
+#endif
+}
+
+const SmNode * SmNode::FindTokenAt(USHORT nRow, USHORT nCol) const
+ // returns (first) ** visible ** (sub)node with the tokens text at
+ // position 'nRow', 'nCol'.
+ //! (there should be exactly one such node if any)
+{
+ if ( IsVisible()
+ && nRow == GetToken().nRow
+ && nCol >= GetToken().nCol && nCol < GetToken().nCol + GetToken().aText.Len())
+ return this;
+ else
+ {
+ USHORT nNumSubNodes = GetNumSubNodes();
+ for (USHORT i = 0; i < nNumSubNodes; i++)
+ { const SmNode *pNode = GetSubNode(i);
+
+ if (!pNode)
+ continue;
+
+ const SmNode *pResult = pNode->FindTokenAt(nRow, nCol);
+ if (pResult)
+ return pResult;
+ }
+ }
+
+ return 0;
+}
+
+
+const SmNode * SmNode::FindRectClosestTo(const Point &rPoint) const
+{
+ long nDist = LONG_MAX;
+ const SmNode *pResult = 0;
+
+ if (IsVisible())
+ pResult = this;
+ else
+ {
+ USHORT nNumSubNodes = GetNumSubNodes();
+ for (USHORT i = 0; i < nNumSubNodes; i++)
+ { const SmNode *pNode = GetSubNode(i);
+
+ if (!pNode)
+ continue;
+
+ long nTmp;
+ const SmNode *pFound = pNode->FindRectClosestTo(rPoint);
+ if (pFound && (nTmp = pFound->OrientedDist(rPoint)) < nDist)
+ { nDist = nTmp;
+ pResult = pFound;
+
+ // quit immediately if 'rPoint' is inside the *should not
+ // overlap with other rectangles* part.
+ // This (partly) serves for getting the attributes in eg
+ // "bar overstrike a".
+ // ('nDist < 0' is used as *quick shot* to avoid evaluation of
+ // the following expression, where the result is already determined)
+ if (nDist < 0 && pFound->IsInsideRect(rPoint))
+ break;
+ }
+ }
+ }
+
+ return pResult;
+}
+
+
+/**************************************************************************/
+
+
+SmStructureNode::~SmStructureNode()
+{
+ SmNode *pNode;
+
+ for (USHORT i = 0; i < GetNumSubNodes(); i++)
+ if (pNode = GetSubNode(i))
+ delete pNode;
+}
+
+
+void SmStructureNode::SetSubNodes(SmNode *pFirst, SmNode *pSecond, SmNode *pThird)
+{
+ if (pFirst)
+ aSubNodes.Put(0, pFirst);
+ if (pSecond)
+ aSubNodes.Put(1, pSecond);
+ if (pThird)
+ aSubNodes.Put(2, pThird);
+}
+
+
+void SmStructureNode::SetSubNodes(const SmNodeArray &rNodeArray)
+{
+ aSubNodes = rNodeArray;
+}
+
+
+/**************************************************************************/
+
+
+void SmTableNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+ // arranges all subnodes in one column
+{
+ Point rPosition;
+
+ USHORT nWidth = 0;
+ USHORT nHeight = 0;
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+
+ // make distance depend on font size
+ long nDist = +(rFormat.GetDistance(DIS_VERTICAL)
+ * GetFont().GetSize().Height()) / 100L;
+
+ if (nSize < 1)
+ return;
+
+ // arrange subnodes and get maximum width of them
+ long nMaxWidth = 0,
+ nTmp;
+ USHORT i;
+ for (i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ { pNode->Arrange(rDev, rFormat);
+ if ((nTmp = pNode->GetItalicWidth()) > nMaxWidth)
+ nMaxWidth = nTmp;
+ }
+
+ Point aPos;
+ SmRect::operator = (SmRect(nMaxWidth, 0));
+ for (i = 0; i < nSize; i++)
+ { if (pNode = GetSubNode(i))
+ { const SmRect &rNodeRect = pNode->GetRect();
+ const SmNode *pCoNode = pNode->GetLeftMost();
+ SmTokenType eType = pCoNode->GetToken().eType;
+ RectHorAlign eHorAlign = eType == TTEXT ?
+ RHA_LEFT : pCoNode->GetRectHorAlign();
+
+ aPos = rNodeRect.AlignTo(*this, RP_BOTTOM,
+ eHorAlign, RVA_BASELINE);
+ if (i)
+ aPos.Y() += nDist;
+ pNode->MoveTo(aPos);
+ ExtendBy(rNodeRect, nSize > 1 ? RCP_NONE : RCP_ARG);
+ }
+ }
+}
+
+
+/**************************************************************************/
+
+
+void SmLineNode::Prepare(const SmFormat &rFormat)
+{
+ SmNode::Prepare(rFormat);
+
+ //! wir verwenden hier den 'FNT_VARIABLE' Font, da er vom Ascent und Descent
+ //! ia besser zum Rest der Formel passt als der 'FNT_MATH' Font.
+ GetFont() = rFormat.GetFont(FNT_VARIABLE);
+ Flags() |= FLG_FONT;
+}
+
+
+/**************************************************************************/
+
+
+void SmLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+ // arranges all subnodes in one row with some extra space between
+{
+ SmRect::operator = (SmRect());
+
+ SmNode *pNode;
+ USHORT nSize = GetNumSubNodes();
+ USHORT i;
+ for (i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ pNode->Arrange(rDev, rFormat);
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ // provide an empty rectangle with alignment parameters for the "current"
+ // font (in order to make "a^1 {}_2^3 a_4" work correct, that is, have the
+ // same sub-/supscript positions.)
+ //! be sure to use a character that has explicitly defined HiAttribut
+ //! line in rect.cxx such as 'a' in order to make 'vec a' look same to
+ //! 'vec {a}'.
+ SmRect::operator = (SmRect(aTmpDev, &rFormat, C2S("a"),
+ GetFont().GetBorderWidth()));
+ // make sure that the rectangle occupies (almost) no space
+ SetWidth(1);
+ SetItalicSpaces(0, 0);
+
+ if (nSize < 1)
+ return;
+
+ // make distance depend on font size
+ long nDist = +(rFormat.GetDistance(DIS_HORIZONTAL)
+ * GetFont().GetSize().Height()) / 100L;
+
+ Point aPos;
+ for (i = 0; i < nSize; i++)
+ if (pNode = GetSubNode(i))
+ {
+ aPos = pNode->AlignTo(*this, RP_RIGHT, RHA_CENTER, RVA_BASELINE);
+
+ // no horizontal space before first node
+ if (i)
+ aPos.X() += nDist;
+
+ pNode->MoveTo(aPos);
+ ExtendBy(*pNode, i ? RCP_XOR : RCP_ARG);
+ }
+}
+
+
+/**************************************************************************/
+
+
+void SmExpressionNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+ // as 'SmLineNode::Arrange' but keeps alignment of leftmost subnode
+{
+ DBG_ASSERT(GetNumSubNodes() > 0, "Sm: keine subnodes");
+
+ SmLineNode::Arrange(rDev, rFormat);
+
+ // copy alignment of leftmost subnode if any
+ //! (this assumes its the one with index 0)
+ SmNode *pNode = GetSubNode(0);
+ if (pNode)
+ SetRectHorAlign(pNode->GetRectHorAlign());
+}
+
+
+/**************************************************************************/
+
+
+void SmUnHorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ BOOL bIsPostfix = GetToken().eType == TFACT;
+
+ SmNode *pOper = GetSubNode(bIsPostfix ? 1 : 0),
+ *pBody = GetSubNode(bIsPostfix ? 0 : 1);
+ DBG_ASSERT(pOper, "Sm: NULL pointer");
+ DBG_ASSERT(pBody, "Sm: NULL pointer");
+
+ pOper->SetSize(Fraction (rFormat.GetRelSize(SIZ_OPERATOR), 100));
+ pOper->Arrange(rDev, rFormat);
+ pBody->Arrange(rDev, rFormat);
+
+ Point aPos = pOper->AlignTo(*pBody, bIsPostfix ? RP_RIGHT : RP_LEFT,
+ RHA_CENTER, RVA_BASELINE);
+ // add a bit space between operator and argument
+ // (worst case -{1 over 2} where - and over have almost no space inbetween)
+ long nDelta = pOper->GetFont().GetSize().Height() / 20;
+ if (bIsPostfix)
+ aPos.X() += nDelta;
+ else
+ aPos.X() -= nDelta;
+ pOper->MoveTo(aPos);
+
+ SmRect::operator = (*pBody);
+ long nOldBot = GetBottom();
+
+ ExtendBy(*pOper, RCP_XOR);
+
+ // workaround for Bug 50865: "a^2 a^+2" have different baselines
+ // for exponents (if size of exponent is large enough)
+ SetBottom(nOldBot);
+}
+
+
+/**************************************************************************/
+
+
+void SmRootNode::GetHeightVerOffset(const SmRect &rRect,
+ long &rHeight, long &rVerOffset) const
+ // calculate height and vertical offset of root sign suitable for 'rRect'
+{
+ rVerOffset = (rRect.GetBottom() - rRect.GetAlignB()) / 2;
+ rHeight = rRect.GetHeight() - rVerOffset;
+
+ DBG_ASSERT(rHeight >= 0, "Sm : Ooops...");
+ DBG_ASSERT(rVerOffset >= 0, "Sm : Ooops...");
+}
+
+
+Point SmRootNode::GetExtraPos(const SmRect &rRootSymbol,
+ const SmRect &rExtra) const
+{
+ const Size &rSymSize = rRootSymbol.GetSize();
+
+ Point aPos = rRootSymbol.GetTopLeft()
+ + Point((rSymSize.Width() * 70) / 100,
+ (rSymSize.Height() * 52) / 100);
+
+ // from this calculate topleft edge of 'rExtra'
+ aPos.X() -= rExtra.GetWidth() + rExtra.GetItalicRightSpace();
+ aPos.Y() -= rExtra.GetHeight();
+ // if there's enough space move a bit less to the right
+ // examples: "nroot i a", "nroot j a"
+ // (it looks better if we don't use italic-spaces here)
+ long nX = rRootSymbol.GetLeft() + (rSymSize.Width() * 30) / 100;
+ if (aPos.X() > nX)
+ aPos.X() = nX;
+
+ return aPos;
+}
+
+
+void SmRootNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ //! pExtra needs to have the smaller index than pRootSym in order to
+ //! not to get the root symbol but the pExtra when clicking on it in the
+ //! GraphicWindow. (That is because of the simplicity of the algorithm
+ //! that finds the node corresponding to a mouseclick in the window.)
+ SmNode *pExtra = GetSubNode(0),
+ *pRootSym = GetSubNode(1),
+ *pBody = GetSubNode(2);
+ DBG_ASSERT(pRootSym, "Sm: NULL pointer");
+ DBG_ASSERT(pBody, "Sm: NULL pointer");
+
+ pBody->Arrange(rDev, rFormat);
+
+ long nHeight,
+ nVerOffset;
+ GetHeightVerOffset(*pBody, nHeight, nVerOffset);
+ nHeight += rFormat.GetDistance(DIS_ROOT)
+ * GetFont().GetSize().Height() / 100L;
+
+ pRootSym->AdaptToX(rDev, pBody->GetItalicWidth());
+ pRootSym->AdaptToY(rDev, nHeight);
+
+ pRootSym->Arrange(rDev, rFormat);
+
+ Point aPos = pRootSym->AlignTo(*pBody, RP_LEFT, RHA_CENTER, RVA_BASELINE);
+ //! overrride calulated vertical position
+ aPos.Y() = pRootSym->GetTop() + pBody->GetBottom() - pRootSym->GetBottom();
+ aPos.Y() -= nVerOffset;
+ pRootSym->MoveTo(aPos);
+
+ if (pExtra)
+ { pExtra->SetSize(Fraction(rFormat.GetRelSize(SIZ_INDEX), 100));
+ pExtra->Arrange(rDev, rFormat);
+
+ aPos = GetExtraPos(*pRootSym, *pExtra);
+ pExtra->MoveTo(aPos);
+ }
+
+ SmRect::operator = (*pBody);
+ ExtendBy(*pRootSym, RCP_THIS);
+ if (pExtra)
+ ExtendBy(*pExtra, RCP_THIS, (BOOL) TRUE);
+}
+
+
+/**************************************************************************/
+
+
+void SmBinHorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ SmNode *pLeft = GetSubNode(0),
+ *pOper = GetSubNode(1),
+ *pRight = GetSubNode(2);
+ DBG_ASSERT(pLeft != NULL, "Sm: NULL pointer");
+ DBG_ASSERT(pOper != NULL, "Sm: NULL pointer");
+ DBG_ASSERT(pRight != NULL, "Sm: NULL pointer");
+
+ pOper->SetSize(Fraction (rFormat.GetRelSize(SIZ_OPERATOR), 100));
+
+ pLeft ->Arrange(rDev, rFormat);
+ pOper ->Arrange(rDev, rFormat);
+ pRight->Arrange(rDev, rFormat);
+
+ const SmRect &rOpRect = pOper->GetRect();
+
+ long nDist = (rOpRect.GetWidth() *
+ rFormat.GetDistance(DIS_HORIZONTAL)) / 100L;
+
+ SmRect::operator = (*pLeft);
+
+ Point aPos;
+ aPos = pOper->AlignTo(*this, RP_RIGHT, RHA_CENTER, RVA_BASELINE);
+ aPos.X() += nDist;
+ pOper->MoveTo(aPos);
+ ExtendBy(*pOper, RCP_XOR);
+
+ aPos = pRight->AlignTo(*this, RP_RIGHT, RHA_CENTER, RVA_BASELINE);
+ aPos.X() += nDist;
+
+ pRight->MoveTo(aPos);
+ ExtendBy(*pRight, RCP_XOR);
+}
+
+
+/**************************************************************************/
+
+
+void SmBinVerNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ SmNode *pNum = GetSubNode(0),
+ *pLine = GetSubNode(1),
+ *pDenom = GetSubNode(2);
+ DBG_ASSERT(pNum, "Sm : NULL pointer");
+ DBG_ASSERT(pLine, "Sm : NULL pointer");
+ DBG_ASSERT(pDenom, "Sm : NULL pointer");
+
+ BOOL bIsTextmode = rFormat.IsTextmode();
+ if (bIsTextmode)
+ {
+ Fraction aFraction(rFormat.GetRelSize(SIZ_INDEX), 100);
+ pNum ->SetSize(aFraction);
+ pLine ->SetSize(aFraction);
+ pDenom->SetSize(aFraction);
+ }
+
+ pNum ->Arrange(rDev, rFormat);
+ pDenom->Arrange(rDev, rFormat);
+
+ long nFontHeight = GetFont().GetSize().Height(),
+ nExtLen = nFontHeight * rFormat.GetDistance(DIS_FRACTION) / 100L,
+ nThick = nFontHeight * rFormat.GetDistance(DIS_STROKEWIDTH) / 100L,
+ nWidth = Max(pNum->GetItalicWidth(), pDenom->GetItalicWidth()),
+ nNumDist = bIsTextmode ? 0 :
+ nFontHeight * rFormat.GetDistance(DIS_NUMERATOR) / 100L,
+ nDenomDist = bIsTextmode ? 0 :
+ nFontHeight * rFormat.GetDistance(DIS_DENOMINATOR) / 100L;
+
+ pLine->AdaptToX(rDev, nWidth + 2 * nExtLen);
+ pLine->AdaptToY(rDev, nThick);
+ pLine->Arrange(rDev, rFormat);
+
+ // get horizontal alignment for numerator
+ const SmNode *pLM = pNum->GetLeftMost();
+ RectHorAlign eHorAlign = pLM->GetToken().eType == TTEXT ?
+ RHA_LEFT : pLM->GetRectHorAlign();
+
+ // move numerator to its position
+ Point aPos = pNum->AlignTo(*pLine, RP_TOP, eHorAlign, RVA_BASELINE);
+ aPos.Y() -= nNumDist;
+ pNum->MoveTo(aPos);
+
+ // get horizontal alignment for denominator
+ pLM = pDenom->GetLeftMost();
+ eHorAlign = pLM->GetToken().eType == TTEXT ?
+ RHA_LEFT : pLM->GetRectHorAlign();
+
+ // move denominator to its position
+ aPos = pDenom->AlignTo(*pLine, RP_BOTTOM, eHorAlign, RVA_BASELINE);
+ aPos.Y() += nDenomDist;
+ pDenom->MoveTo(aPos);
+
+ SmRect::operator = (*pNum);
+ ExtendBy(*pDenom, RCP_NONE).ExtendBy(*pLine, RCP_NONE, pLine->GetCenterY());
+}
+
+
+/**************************************************************************/
+
+
+double Det(const Point &rHeading1, const Point &rHeading2)
+ // gibt den Wert der durch die beiden Punkte gebildeten Determinante
+ // zur點k
+{
+ return rHeading1.X() * rHeading2.Y() - rHeading1.Y() * rHeading2.X();
+}
+
+
+BOOL IsPointInLine(const Point &rPoint1,
+ const Point &rPoint2, const Point &rHeading2)
+ // ergibt TRUE genau dann, wenn der Punkt 'rPoint1' zu der Gerade geh鰎t die
+ // durch den Punkt 'rPoint2' geht und den Richtungsvektor 'rHeading2' hat
+{
+ DBG_ASSERT(rHeading2 != Point(), "Sm : 0 vector");
+
+ BOOL bRes = FALSE;
+ const double eps = 5.0 * DBL_EPSILON;
+
+ double fLambda;
+ if (labs(rHeading2.X()) > labs(rHeading2.Y()))
+ {
+ fLambda = (rPoint1.X() - rPoint2.X()) / (double) rHeading2.X();
+ bRes = fabs(rPoint1.Y() - (rPoint2.Y() + fLambda * rHeading2.Y())) < eps;
+ }
+ else
+ {
+ fLambda = (rPoint1.Y() - rPoint2.Y()) / (double) rHeading2.Y();
+ bRes = fabs(rPoint1.X() - (rPoint2.X() + fLambda * rHeading2.X())) < eps;
+ }
+
+ return bRes;
+}
+
+
+USHORT GetLineIntersectionPoint(Point &rResult,
+ const Point& rPoint1, const Point &rHeading1,
+ const Point& rPoint2, const Point &rHeading2)
+{
+ DBG_ASSERT(rHeading1 != Point(), "Sm : 0 vector");
+ DBG_ASSERT(rHeading2 != Point(), "Sm : 0 vector");
+
+ USHORT nRes = 1;
+ const double eps = 5.0 * DBL_EPSILON;
+
+ // sind die Richtumgsvektoren linear abh鋘gig ?
+ double fDet = Det(rHeading1, rHeading2);
+ if (fabs(fDet) < eps)
+ {
+ nRes = IsPointInLine(rPoint1, rPoint2, rHeading2) ? USHRT_MAX : 0;
+ rResult = nRes ? rPoint1 : Point();
+ }
+ else
+ {
+ // hier achten wir nicht auf Rechengenauigkeit
+ // (das w黵de aufwendiger und lohnt sich hier kaum)
+ double fLambda = ( (rPoint1.Y() - rPoint2.Y()) * rHeading2.X()
+ - (rPoint1.X() - rPoint2.X()) * rHeading2.Y())
+ / fDet;
+ rResult = Point(rPoint1.X() + fLambda * rHeading1.X(),
+ rPoint1.Y() + fLambda * rHeading1.Y());
+ }
+
+ return nRes;
+}
+
+
+
+SmBinDiagonalNode::SmBinDiagonalNode(const SmToken &rNodeToken)
+: SmStructureNode(NBINDIAGONAL, rNodeToken)
+{
+ bAscending = FALSE;
+ SetNumSubNodes(3);
+}
+
+
+void SmBinDiagonalNode::GetOperPosSize(Point &rPos, Size &rSize,
+ const Point &rDiagPoint, double fAngleDeg) const
+ // gibt die Position und Gr鲞e f黵 den Diagonalstrich zur點k.
+ // Vor.: das SmRect des Nodes gibt die Begrenzung vor(!), mu also selbst
+ // bereits bekannt sein.
+
+{
+ const double fPi = 3.1415926535897932384626433;
+ double fAngleRad = fAngleDeg / 180.0 * fPi;
+ long nRectLeft = GetItalicLeft(),
+ nRectRight = GetItalicRight(),
+ nRectTop = GetTop(),
+ nRectBottom = GetBottom();
+ Point aRightHdg (100, 0),
+ aDownHdg (0, 100),
+ aDiagHdg (100.0 * cos(fAngleRad), -100.0 * sin(fAngleRad));
+
+ long nLeft, nRight, nTop, nBottom; // R鋘der des Rechtecks f黵 die
+ // Diagonale
+ Point aPoint;
+ if (IsAscending())
+ {
+ //
+ // obere rechte Ecke bestimmen
+ //
+ GetLineIntersectionPoint(aPoint,
+ Point(nRectLeft, nRectTop), aRightHdg,
+ rDiagPoint, aDiagHdg);
+ //
+ // gibt es einen Schnittpunkt mit dem oberen Rand ?
+ if (aPoint.X() <= nRectRight)
+ {
+ nRight = aPoint.X();
+ nTop = nRectTop;
+ }
+ else
+ {
+ // es mu einen Schnittpunkt mit dem rechten Rand geben!
+ GetLineIntersectionPoint(aPoint,
+ Point(nRectRight, nRectTop), aDownHdg,
+ rDiagPoint, aDiagHdg);
+
+ nRight = nRectRight;
+ nTop = aPoint.Y();
+ }
+
+ //
+ // untere linke Ecke bestimmen
+ //
+ GetLineIntersectionPoint(aPoint,
+ Point(nRectLeft, nRectBottom), aRightHdg,
+ rDiagPoint, aDiagHdg);
+ //
+ // gibt es einen Schnittpunkt mit dem unteren Rand ?
+ if (aPoint.X() >= nRectLeft)
+ {
+ nLeft = aPoint.X();
+ nBottom = nRectBottom;
+ }
+ else
+ {
+ // es mu einen Schnittpunkt mit dem linken Rand geben!
+ GetLineIntersectionPoint(aPoint,
+ Point(nRectLeft, nRectTop), aDownHdg,
+ rDiagPoint, aDiagHdg);
+
+ nLeft = nRectLeft;
+ nBottom = aPoint.Y();
+ }
+ }
+ else
+ {
+ //
+ // obere linke Ecke bestimmen
+ //
+ GetLineIntersectionPoint(aPoint,
+ Point(nRectLeft, nRectTop), aRightHdg,
+ rDiagPoint, aDiagHdg);
+ //
+ // gibt es einen Schnittpunkt mit dem oberen Rand ?
+ if (aPoint.X() >= nRectLeft)
+ {
+ nLeft = aPoint.X();
+ nTop = nRectTop;
+ }
+ else
+ {
+ // es mu einen Schnittpunkt mit dem linken Rand geben!
+ GetLineIntersectionPoint(aPoint,
+ Point(nRectLeft, nRectTop), aDownHdg,
+ rDiagPoint, aDiagHdg);
+
+ nLeft = nRectLeft;
+ nTop = aPoint.Y();
+ }
+
+ //
+ // untere rechte Ecke bestimmen
+ //
+ GetLineIntersectionPoint(aPoint,
+ Point(nRectLeft, nRectBottom), aRightHdg,
+ rDiagPoint, aDiagHdg);
+ //
+ // gibt es einen Schnittpunkt mit dem unteren Rand ?
+ if (aPoint.X() <= nRectRight)
+ {
+ nRight = aPoint.X();
+ nBottom = nRectBottom;
+ }
+ else
+ {
+ // es mu einen Schnittpunkt mit dem rechten Rand geben!
+ GetLineIntersectionPoint(aPoint,
+ Point(nRectRight, nRectTop), aDownHdg,
+ rDiagPoint, aDiagHdg);
+
+ nRight = nRectRight;
+ nBottom = aPoint.Y();
+ }
+ }
+
+ rSize = Size(nRight - nLeft + 1, nBottom - nTop + 1);
+ rPos.X() = nLeft;
+ rPos.Y() = nTop;
+}
+
+
+void SmBinDiagonalNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ //! die beiden Argumente m黶sen in den Subnodes vor dem Operator kommen,
+ //! damit das anklicken im GraphicWindow den FormulaCursor richtig setzt
+ //! (vgl SmRootNode)
+ SmNode *pLeft = GetSubNode(0),
+ *pRight = GetSubNode(1);
+ DBG_ASSERT(pLeft, "Sm : NULL pointer");
+ DBG_ASSERT(pRight, "Sm : NULL pointer");
+
+ DBG_ASSERT(GetSubNode(2)->GetType() == NPOLYLINE, "Sm : falscher Nodetyp");
+ SmPolyLineNode *pOper = (SmPolyLineNode *) GetSubNode(2);
+ DBG_ASSERT(pOper, "Sm : NULL pointer");
+
+ //! some routines being called extract some info from the OutputDevice's
+ //! font (eg the space to be used for borders OR the font name(!!)).
+ //! Thus the font should reflect the needs and has to be set!
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ pLeft->Arrange(aTmpDev, rFormat);
+ pRight->Arrange(aTmpDev, rFormat);
+
+ // implizit die Weite (incl Rand) des Diagonalstrichs ermitteln
+ pOper->Arrange(aTmpDev, rFormat);
+
+ long nDelta = pOper->GetWidth() * 8 / 10;
+
+ // TopLeft Position vom rechten Argument ermitteln
+ Point aPos;
+ aPos.X() = pLeft->GetItalicRight() + nDelta + pRight->GetItalicLeftSpace();
+ if (IsAscending())
+ aPos.Y() = pLeft->GetBottom() + nDelta;
+ else
+ aPos.Y() = pLeft->GetTop() - nDelta - pRight->GetHeight();
+
+ pRight->MoveTo(aPos);
+
+ // neue Baseline bestimmen
+ long nBaseline = IsAscending() ? (pLeft->GetBottom() + pRight->GetTop()) / 2
+ : (pLeft->GetTop() + pRight->GetBottom()) / 2;
+ Point aLogCenter ((pLeft->GetItalicRight() + pRight->GetItalicLeft()) / 2,
+ nBaseline);
+
+ SmRect::operator = (*pLeft);
+ ExtendBy(*pRight, RCP_NONE);
+
+
+ // Position und Gr鲞e des Diagonalstrich ermitteln
+ Size aSize;
+ GetOperPosSize(aPos, aSize, aLogCenter, IsAscending() ? 60.0 : -60.0);
+
+ // die Gr鲞e setzen
+ pOper->AdaptToX(rDev, aSize.Width());
+ pOper->AdaptToY(rDev, aSize.Height());
+ // und diese wirksam machen
+ pOper->Arrange(aTmpDev, rFormat);
+
+ pOper->MoveTo(aPos);
+
+ ExtendBy(*pOper, RCP_NONE, nBaseline);
+}
+
+
+/**************************************************************************/
+
+
+void SmSubSupNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ DBG_ASSERT(GetNumSubNodes() == 1 + SUBSUP_NUM_ENTRIES,
+ "Sm: falsche Anzahl von subnodes");
+
+ SmNode *pBody = GetBody();
+ DBG_ASSERT(pBody, "Sm: NULL pointer");
+
+ long nOrigHeight = pBody->GetFont().GetSize().Height();
+
+ pBody->Arrange(rDev, rFormat);
+
+ const SmRect &rBodyRect = pBody->GetRect();
+ SmRect::operator = (rBodyRect);
+
+ // line that separates sub- and supscript rectangles
+ long nDelimLine = SmFromTo(GetAlignB(), GetAlignT(), 0.4);
+
+ Point aPos;
+ long nDelta, nDist;
+
+ // iterate over all possible sub-/supscripts
+ SmRect aTmpRect (rBodyRect);
+ for (int i = 0; i < SUBSUP_NUM_ENTRIES; i++)
+ { SmSubSup eSubSup = (SmSubSup) i; // cast
+ SmNode *pSubSup = GetSubSup(eSubSup);
+
+ if (!pSubSup)
+ continue;
+
+ // switch position of limits if we are in textmode
+ if (rFormat.IsTextmode() && (GetToken().nGroup & TGLIMIT))
+ switch (eSubSup)
+ { case CSUB: eSubSup = RSUB; break;
+ case CSUP: eSubSup = RSUP; break;
+ }
+
+ // prevent sub-/supscripts from diminishing in size
+ // (as would be in "a_{1_{2_{3_4}}}")
+ if (GetFont().GetSize().Height() > rFormat.GetBaseSize().Height() / 3)
+ {
+ USHORT nIndex = (eSubSup == CSUB || eSubSup == CSUP) ?
+ SIZ_LIMITS : SIZ_INDEX;
+ Fraction aFraction ( rFormat.GetRelSize(nIndex), 100 );
+ pSubSup->SetSize(aFraction);
+ }
+
+ pSubSup->Arrange(rDev, rFormat);
+
+ BOOL bIsTextmode = rFormat.IsTextmode();
+ nDist = 0;
+
+ //! be sure that CSUB, CSUP are handled before the other cases!
+ switch (eSubSup)
+ { case RSUB :
+ case LSUB :
+ if (!bIsTextmode)
+ nDist = nOrigHeight
+ * rFormat.GetDistance(DIS_SUBSCRIPT) / 100L;
+ aPos = pSubSup->GetRect().AlignTo(aTmpRect,
+ eSubSup == LSUB ? RP_LEFT : RP_RIGHT,
+ RHA_CENTER, RVA_BOTTOM);
+ aPos.Y() += nDist;
+ nDelta = nDelimLine - aPos.Y();
+ if (nDelta > 0)
+ aPos.Y() += nDelta;
+ break;
+ case RSUP :
+ case LSUP :
+ if (!bIsTextmode)
+ nDist = nOrigHeight
+ * rFormat.GetDistance(DIS_SUPERSCRIPT) / 100L;
+ aPos = pSubSup->GetRect().AlignTo(aTmpRect,
+ eSubSup == LSUP ? RP_LEFT : RP_RIGHT,
+ RHA_CENTER, RVA_TOP);
+ aPos.Y() -= nDist;
+ nDelta = aPos.Y() + pSubSup->GetHeight() - nDelimLine;
+ if (nDelta > 0)
+ aPos.Y() -= nDelta;
+ break;
+ case CSUB :
+ if (!bIsTextmode)
+ nDist = nOrigHeight
+ * rFormat.GetDistance(DIS_LOWERLIMIT) / 100L;
+ aPos = pSubSup->GetRect().AlignTo(rBodyRect, RP_BOTTOM,
+ RHA_CENTER, RVA_BASELINE);
+ aPos.Y() += nDist;
+ break;
+ case CSUP :
+ if (!bIsTextmode)
+ nDist = nOrigHeight
+ * rFormat.GetDistance(DIS_UPPERLIMIT) / 100L;
+ aPos = pSubSup->GetRect().AlignTo(rBodyRect, RP_TOP,
+ RHA_CENTER, RVA_BASELINE);
+ aPos.Y() -= nDist;
+ break;
+ default :
+ DBG_ASSERT(FALSE, "Sm: unbekannter Fall");
+ }
+
+ pSubSup->MoveTo(aPos);
+ ExtendBy(*pSubSup, RCP_THIS, (BOOL) TRUE);
+
+ // update rectangle to which RSUB, RSUP, LSUB, LSUP
+ // will be aligned to
+ if (eSubSup == CSUB || eSubSup == CSUP)
+ aTmpRect = *this;
+ }
+}
+
+
+/**************************************************************************/
+
+
+void SmBraceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ SmNode *pLeft = GetSubNode(0),
+ *pBody = GetSubNode(1),
+ *pRight = GetSubNode(2);
+ DBG_ASSERT(pLeft, "Sm: NULL pointer");
+ DBG_ASSERT(pBody, "Sm: NULL pointer");
+ DBG_ASSERT(pRight, "Sm: NULL pointer");
+
+ pBody->Arrange(rDev, rFormat);
+
+ BOOL bIsScaleNormal = rFormat.IsScaleNormalBrackets(),
+ bScale = pBody->GetHeight() > 0 &&
+ (GetScaleMode() == SCALE_HEIGHT || bIsScaleNormal),
+ bIsABS = GetToken().eType == TABS;
+
+ long nFaceHeight = GetFont().GetSize().Height();
+
+ // 躡ergr鲞e in % ermitteln
+ USHORT nPerc = 0;
+ if (!bIsABS && bScale)
+ { // im Fall von Klammern mit 躡ergr鲞e...
+ int nIndex = GetScaleMode() == SCALE_HEIGHT ?
+ DIS_BRACKETSIZE : DIS_NORMALBRACKETSIZE;
+ nPerc = rFormat.GetDistance(nIndex);
+ }
+
+ // ermitteln der H鰄e f黵 die Klammern
+ long nBraceHeight;
+ if (bScale)
+ {
+ nBraceHeight = pBody->GetType() == NBRACEBODY ?
+ ((SmBracebodyNode *) pBody)->GetBodyHeight()
+ : pBody->GetHeight();
+ nBraceHeight += 2 * (nBraceHeight * nPerc / 100L);
+ }
+ else
+ nBraceHeight = nFaceHeight;
+
+ // Abstand zum Argument
+ nPerc = bIsABS ? 0 : rFormat.GetDistance(DIS_BRACKETSPACE);
+ long nDist = nFaceHeight * nPerc / 100L;
+
+ // sofern erw黱scht skalieren der Klammern auf die gew黱schte Gr鲞e
+ if (bScale)
+ {
+ Size aSize (pLeft->GetFont().GetSize());
+ DBG_ASSERT(pRight->GetFont().GetSize() == aSize,
+ "Sm : unterschiedliche Fontgr鲞en");
+ aSize.Width() = Min((long) nBraceHeight * 60L / 100L,
+ rFormat.GetBaseSize().Height() * 3L / 2L);
+
+ xub_Unicode cChar = pLeft->GetToken().cMathChar;
+ if (cChar != MS_LINE && cChar != MS_DLINE)
+ pLeft ->GetFont().SetSize(aSize);
+
+ cChar = pRight->GetToken().cMathChar;
+ if (cChar != MS_LINE && cChar != MS_DLINE)
+ pRight->GetFont().SetSize(aSize);
+
+ pLeft ->AdaptToY(rDev, nBraceHeight);
+ pRight->AdaptToY(rDev, nBraceHeight);
+ }
+
+ pLeft ->Arrange(rDev, rFormat);
+ pRight->Arrange(rDev, rFormat);
+
+ // damit auch "\(a\) - (a) - left ( a right )" vern黱ftig aussieht
+ RectVerAlign eVerAlign = bScale ? RVA_CENTERY : RVA_BASELINE;
+
+ Point aPos;
+ aPos = pLeft->AlignTo(*pBody, RP_LEFT, RHA_CENTER, eVerAlign);
+ aPos.X() -= nDist;
+ pLeft->MoveTo(aPos);
+
+ aPos = pRight->AlignTo(*pBody, RP_RIGHT, RHA_CENTER, eVerAlign);
+ aPos.X() += nDist;
+ pRight->MoveTo(aPos);
+
+ SmRect::operator = (*pBody);
+ ExtendBy(*pLeft, RCP_THIS).ExtendBy(*pRight, RCP_THIS);
+}
+
+
+/**************************************************************************/
+
+
+void SmBracebodyNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ USHORT nNumSubNodes = GetNumSubNodes();
+ if (nNumSubNodes == 0)
+ return;
+
+ // arrange arguments
+ USHORT i;
+ for (i = 0; i < nNumSubNodes; i += 2)
+ GetSubNode(i)->Arrange(rDev, rFormat);
+
+ // build reference rectangle with necessary info for vertical alignment
+ SmRect aRefRect (*GetSubNode(0));
+ for (i = 0; i < nNumSubNodes; i += 2)
+ {
+ SmRect aTmpRect (*GetSubNode(i));
+ Point aPos = aTmpRect.AlignTo(aRefRect, RP_RIGHT, RHA_CENTER, RVA_BASELINE);
+ aTmpRect.MoveTo(aPos);
+ aRefRect.ExtendBy(aTmpRect, RCP_XOR);
+ }
+
+ nBodyHeight = aRefRect.GetHeight();
+
+ // scale separators to required height and arrange them
+ BOOL bScale = GetScaleMode() == SCALE_HEIGHT || rFormat.IsScaleNormalBrackets();
+ long nHeight = bScale ? aRefRect.GetHeight() : GetFont().GetSize().Height();
+ int nIndex = GetScaleMode() == SCALE_HEIGHT ?
+ DIS_BRACKETSIZE : DIS_NORMALBRACKETSIZE;
+ USHORT nPerc = rFormat.GetDistance(nIndex);
+ if (bScale)
+ nHeight += 2 * (nHeight * nPerc / 100L);
+ for (i = 1; i < nNumSubNodes; i += 2)
+ {
+ SmNode *pNode = GetSubNode(i);
+ pNode->AdaptToY(rDev, nHeight);
+ pNode->Arrange(rDev, rFormat);
+ }
+
+ // horizontal distance between argument and brackets or separators
+ long nDist = GetFont().GetSize().Height()
+ * rFormat.GetDistance(DIS_BRACKETSPACE) / 100L;
+
+ SmNode *pLeft = GetSubNode(0);
+ SmRect::operator = (*pLeft);
+ for (i = 1; i < nNumSubNodes; i++)
+ {
+ BOOL bIsSeparator = i % 2 != 0;
+ RectVerAlign eVerAlign = bIsSeparator ? RVA_CENTERY : RVA_BASELINE;
+
+ SmNode *pRight = GetSubNode(i);
+ Point aPosX = pRight->AlignTo(*pLeft, RP_RIGHT, RHA_CENTER, eVerAlign),
+ aPosY = pRight->AlignTo(aRefRect, RP_RIGHT, RHA_CENTER, eVerAlign);
+ aPosX.X() += nDist;
+
+ pRight->MoveTo(Point(aPosX.X(), aPosY.Y()));
+ ExtendBy(*pRight, bIsSeparator ? RCP_THIS : RCP_XOR);
+
+ pLeft = pRight;
+ }
+}
+
+
+/**************************************************************************/
+
+
+void SmVerticalBraceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ SmNode *pBody = GetSubNode(0),
+ *pBrace = GetSubNode(1),
+ *pScript = GetSubNode(2);
+ DBG_ASSERT(pBody, "Sm: NULL pointer!");
+ DBG_ASSERT(pBrace, "Sm: NULL pointer!");
+ DBG_ASSERT(pScript, "Sm: NULL pointer!");
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ pBody->Arrange(aTmpDev, rFormat);
+
+ // Groesse wie bei Grenzen fuer diesen Teil
+ pScript->SetSize( Fraction( rFormat.GetRelSize(SIZ_LIMITS), 100 ) );
+ // etwas hoehere Klammern als normal
+ pBrace ->SetSize( Fraction(3, 2) );
+
+ long nItalicWidth = pBody->GetItalicWidth();
+ if (nItalicWidth > 0)
+ pBrace->AdaptToX(aTmpDev, nItalicWidth);
+
+ pBrace ->Arrange(aTmpDev, rFormat);
+ pScript->Arrange(aTmpDev, rFormat);
+
+ // die relativen Position und die Abstaende zueinander bestimmen
+ RectPos eRectPos;
+ long nFontHeight = pBody->GetFont().GetSize().Height();
+ long nDistBody = nFontHeight * rFormat.GetDistance(DIS_ORNAMENTSIZE),
+ nDistScript = nFontHeight;
+ if (GetToken().eType == TOVERBRACE)
+ {
+ eRectPos = RP_TOP;
+ nDistBody = - nDistBody;
+ nDistScript *= - rFormat.GetDistance(DIS_UPPERLIMIT);
+ }
+ else // TUNDERBRACE
+ {
+ eRectPos = RP_BOTTOM;
+ nDistScript *= + rFormat.GetDistance(DIS_LOWERLIMIT);
+ }
+ nDistBody /= 100L;
+ nDistScript /= 100L;
+
+ Point aPos = pBrace->AlignTo(*pBody, eRectPos, RHA_CENTER, RVA_BASELINE);
+ aPos.Y() += nDistBody;
+ pBrace->MoveTo(aPos);
+
+ aPos = pScript->AlignTo(*pBrace, eRectPos, RHA_CENTER, RVA_BASELINE);
+ aPos.Y() += nDistScript;
+ pScript->MoveTo(aPos);
+
+ SmRect::operator = (*pBody);
+ ExtendBy(*pBrace, RCP_THIS).ExtendBy(*pScript, RCP_THIS);
+}
+
+
+/**************************************************************************/
+
+#ifdef MAC
+#pragma segment FrmNode_03
+#endif
+
+
+SmNode * SmOperNode::GetSymbol()
+{
+ SmNode *pNode = GetSubNode(0);
+ DBG_ASSERT(pNode, "Sm: NULL pointer!");
+
+ if (pNode->GetType() == NSUBSUP)
+ pNode = ((SmSubSupNode *) pNode)->GetBody();
+
+ DBG_ASSERT(pNode, "Sm: NULL pointer!");
+ return pNode;
+}
+
+
+long SmOperNode::CalcSymbolHeight(const SmNode &rSymbol,
+ const SmFormat &rFormat) const
+ // returns the font height to be used for operator-symbol
+{
+ long nHeight = GetFont().GetSize().Height();
+
+ SmTokenType eType = GetToken().eType;
+ if (eType == TLIM || eType == TLIMINF || eType == TLIMSUP)
+ return nHeight;
+
+ if (!rFormat.IsTextmode())
+ {
+ // set minimum size ()
+ nHeight += (nHeight * 20L) / 100L;
+
+ nHeight += nHeight
+ * rFormat.GetDistance(DIS_OPERATORSIZE) / 100L;
+ nHeight = nHeight * 686L / 845L;
+ }
+
+ // correct user-defined symbols to match height of sum from StarMath
+ // font
+ if (rSymbol.GetToken().eType == TSPECIAL)
+ nHeight = nHeight * 845L / 686L;
+
+ return nHeight;
+}
+
+
+void SmOperNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ SmNode *pOper = GetSubNode(0);
+ SmNode *pBody = GetSubNode(1);
+
+ DBG_ASSERT(pOper, "Sm: Subnode fehlt");
+ DBG_ASSERT(pBody, "Sm: Subnode fehlt");
+
+ SmNode *pSymbol = GetSymbol();
+ pSymbol->SetSize(Fraction(CalcSymbolHeight(*pSymbol, rFormat),
+ pSymbol->GetFont().GetSize().Height()));
+
+ pBody->Arrange(rDev, rFormat);
+ pOper->Arrange(rDev, rFormat);
+
+ long nOrigHeight = GetFont().GetSize().Height(),
+ nDist = nOrigHeight
+ * rFormat.GetDistance(DIS_OPERATORSPACE) / 100L;
+
+ Point aPos = pOper->AlignTo(*pBody, RP_LEFT, RHA_CENTER, /*RVA_CENTERY*/RVA_MID);
+ aPos.X() -= nDist;
+ pOper->MoveTo(aPos);
+
+ SmRect::operator = (*pBody);
+ ExtendBy(*pOper, RCP_THIS);
+}
+
+
+/**************************************************************************/
+
+
+void SmAlignNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+ // setzt im ganzen subtree (incl aktuellem node) das alignment
+{
+ DBG_ASSERT(GetNumSubNodes() > 0, "Sm: SubNode fehlt");
+
+ SmNode *pNode = GetSubNode(0);
+
+ RectHorAlign eHorAlign;
+ switch (GetToken().eType)
+ {
+ case TALIGNL: eHorAlign = RHA_LEFT; break;
+ case TALIGNC: eHorAlign = RHA_CENTER; break;
+ case TALIGNR: eHorAlign = RHA_RIGHT; break;
+ }
+ SetRectHorAlign(eHorAlign);
+
+ pNode->Arrange(rDev, rFormat);
+
+ SmRect::operator = (pNode->GetRect());
+}
+
+
+/**************************************************************************/
+
+
+void SmAttributNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ SmNode *pAttr = GetSubNode(0),
+ *pBody = GetSubNode(1);
+ DBG_ASSERT(pBody, "Sm: Body fehlt");
+ DBG_ASSERT(pAttr, "Sm: Attribut fehlt");
+
+ pBody->Arrange(rDev, rFormat);
+
+ if (GetScaleMode() == SCALE_WIDTH)
+ pAttr->AdaptToX(rDev, pBody->GetItalicWidth());
+ pAttr->Arrange(rDev, rFormat);
+
+ // get relative position of attribut
+ RectVerAlign eVerAlign;
+ long nDist = 0;
+ switch (GetToken().eType)
+ { case TUNDERLINE :
+ eVerAlign = RVA_ATTRIBUT_LO;
+ break;
+ case TOVERSTRIKE :
+ eVerAlign = RVA_ATTRIBUT_MID;
+ break;
+ default :
+ eVerAlign = RVA_ATTRIBUT_HI;
+ if (pBody->GetType() == NATTRIBUT)
+ nDist = GetFont().GetSize().Height()
+ * rFormat.GetDistance(DIS_ORNAMENTSPACE) / 100L;
+ }
+ Point aPos = pAttr->AlignTo(*pBody, RP_ATTRIBUT, RHA_CENTER, eVerAlign);
+ aPos.Y() -= nDist;
+ pAttr->MoveTo(aPos);
+
+ SmRect::operator = (*pBody);
+ ExtendBy(*pAttr, RCP_THIS, (BOOL) TRUE);
+}
+
+
+/**************************************************************************/
+
+
+void SmFontNode::Prepare(const SmFormat &rFormat)
+{
+ //! prepare subnodes first
+ SmNode::Prepare(rFormat);
+
+ int nFnt = -1;
+ switch (GetToken().eType)
+ {
+ case TFIXED: nFnt = FNT_FIXED; break;
+ case TSANS: nFnt = FNT_SANS; break;
+ case TSERIF: nFnt = FNT_SERIF; break;
+ }
+ if (nFnt != -1)
+ { GetFont() = rFormat.GetFont(nFnt);
+ SetFont(GetFont());
+ }
+
+ //! prevent overwrites of this font by 'Arrange' or 'SetFont' calls of
+ //! other font nodes (those with lower depth in the tree)
+ Flags() |= FLG_FONT;
+}
+
+
+void SmFontNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ SmNode *pNode = GetSubNode(1);
+ DBG_ASSERT(pNode, "Sm: SubNode fehlt");
+
+ switch (GetToken().eType)
+ { case TSIZE :
+ pNode->SetFontSize(aFontSize, nSizeType);
+ break;
+ case TSANS :
+ case TSERIF :
+ case TFIXED :
+ pNode->SetFont(GetFont());
+ break;
+ case TUNKNOWN : break; // no assertion on "font <?> <?>"
+
+ case TPHANTOM : SetPhantom(TRUE); break;
+ case TBOLD : SetAttribut(ATTR_BOLD); break;
+ case TITALIC : SetAttribut(ATTR_ITALIC); break;
+ case TNBOLD : ClearAttribut(ATTR_BOLD); break;
+ case TNITALIC : ClearAttribut(ATTR_ITALIC); break;
+
+ case TBLACK : SetColor(Color(COL_BLACK)); break;
+ case TWHITE : SetColor(Color(COL_WHITE)); break;
+ case TRED : SetColor(Color(COL_RED)); break;
+ case TGREEN : SetColor(Color(COL_GREEN)); break;
+ case TBLUE : SetColor(Color(COL_BLUE)); break;
+ case TCYAN : SetColor(Color(COL_CYAN)); break;
+ case TMAGENTA : SetColor(Color(COL_MAGENTA)); break;
+ case TYELLOW : SetColor(Color(COL_YELLOW)); break;
+
+ default:
+ DBG_ASSERT(FALSE, "Sm: unbekannter Fall");
+ }
+
+ pNode->Arrange(rDev, rFormat);
+
+ SmRect::operator = (pNode->GetRect());
+}
+
+
+void SmFontNode::SetSizeParameter(const Fraction& rValue, USHORT Type)
+{
+ nSizeType = Type;
+ aFontSize = rValue;
+}
+
+
+/**************************************************************************/
+
+
+SmPolyLineNode::SmPolyLineNode(const SmToken &rNodeToken)
+: SmGraphicNode(NPOLYLINE, rNodeToken)
+{
+ aPoly.SetSize(2);
+ nWidth = 0;
+}
+
+
+void SmPolyLineNode::AdaptToX(const OutputDevice &rDev, ULONG nWidth)
+{
+ aToSize.Width() = nWidth;
+}
+
+
+void SmPolyLineNode::AdaptToY(const OutputDevice &rDev, ULONG nHeight)
+{
+ GetFont().FreezeBorderWidth();
+ aToSize.Height() = nHeight;
+}
+
+
+void SmPolyLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ //! some routines being called extract some info from the OutputDevice's
+ //! font (eg the space to be used for borders OR the font name(!!)).
+ //! Thus the font should reflect the needs and has to be set!
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ long nBorderwidth = GetFont().GetBorderWidth();
+
+ //
+ // Das Polygon mit den beiden Endpunkten bilden
+ //
+ DBG_ASSERT(aPoly.GetSize() == 2, "Sm : falsche Anzahl von Punkten");
+ Point aPointA, aPointB;
+ if (GetToken().eType == TWIDESLASH)
+ {
+ aPointA.X() = nBorderwidth;
+ aPointA.Y() = aToSize.Height() - nBorderwidth;
+ aPointB.X() = aToSize.Width() - nBorderwidth;
+ aPointB.Y() = nBorderwidth;
+ }
+ else
+ {
+ DBG_ASSERT(GetToken().eType == TWIDEBACKSLASH, "Sm : unerwartetes Token");
+ aPointA.X() =
+ aPointA.Y() = nBorderwidth;
+ aPointB.X() = aToSize.Width() - nBorderwidth;
+ aPointB.Y() = aToSize.Height() - nBorderwidth;
+ }
+ aPoly.SetPoint(aPointA, 0);
+ aPoly.SetPoint(aPointB, 1);
+
+ long nThick = GetFont().GetSize().Height()
+ * rFormat.GetDistance(DIS_STROKEWIDTH) / 100L;
+ nWidth = nThick + 2 * nBorderwidth;
+
+ SmRect::operator = (SmRect(aToSize.Width(), aToSize.Height()));
+}
+
+
+void SmPolyLineNode::Draw(OutputDevice &rDev, const Point &rPosition) const
+{
+ if (IsPhantom())
+ return;
+
+ long nBorderwidth = GetFont().GetBorderWidth();
+
+ LineInfo aInfo;
+ aInfo.SetWidth(nWidth - 2 * nBorderwidth);
+
+ Point aOffset (Point() - aPoly.GetBoundRect().TopLeft()
+ + Point(nBorderwidth, nBorderwidth)),
+ aPos (rPosition + aOffset);
+ ((Polygon &) aPoly).Move(aPos.X(), aPos.Y());
+
+ Color aOldCol (rDev.GetLineColor());
+ rDev.SetLineColor( GetFont().GetColor() );
+
+ rDev.DrawPolyLine(aPoly, aInfo);
+
+ rDev.SetLineColor( aOldCol );
+
+#ifdef SM_RECT_DEBUG
+ if (!IsDebug())
+ return;
+
+ int nRFlags = SM_RECT_CORE | SM_RECT_ITALIC | SM_RECT_LINES | SM_RECT_MID;
+ SmRect::Draw(rDev, rPosition, nRFlags);
+#endif
+}
+
+
+/**************************************************************************/
+
+
+void SmPolygonNode::AdaptToX(const OutputDevice &rDev, ULONG nWidth)
+{
+ aToSize.Width() = nWidth;
+}
+
+
+void SmPolygonNode::AdaptToY(const OutputDevice &rDev, ULONG nHeight)
+{
+ GetFont().FreezeBorderWidth();
+ aToSize.Height() = nHeight;
+}
+
+
+void SmPolygonNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ //! some routines being called extract some info from the OutputDevice's
+ //! font (eg the space to be used for borders OR the font name(!!)).
+ //! Thus the font should reflect the needs and has to be set!
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ long nBorderWidth = GetFont().GetBorderWidth();
+
+ // das Polygon der gewaehlten FontSize anpassen
+ Size aSize (rDev.GetFont().GetSize()),
+ aOrigSize (aPolygon.GetOrigFontSize());
+ double fScaleY = (double) aSize.Height() / aOrigSize.Height(),
+ fScaleX = aSize.Width() ?
+ (double) aSize.Width() / aOrigSize.Width() : fScaleY;
+ aPolygon.ScaleBy(fScaleX / aPolygon.GetScaleX(), fScaleY / aPolygon.GetScaleY());
+
+ long nTmp;
+ if ((nTmp = aToSize.Width()) > 0)
+ // Breite anpassen und dabei Platz f黵 Rand links und rechts lassen
+ // (das resultierende SmRect soll den Rand beinhalten und trotzdem
+ // nicht breiter als gew黱scht sein)
+ aPolygon.AdaptToX(aTmpDev, Max(nTmp - 2L * nBorderWidth, 10L));
+ if ((nTmp = aToSize.Height()) > 0)
+ // wie oben jedoch mit oberen und unterem Rand
+ aPolygon.AdaptToY(aTmpDev, Max(nTmp - 2L * nBorderWidth, 10L));
+
+ if (aPolygon.GetChar() == xub_Unicode('\0'))
+ SmRect::operator = (SmRect());
+ else
+ SmRect::operator = (SmRect(aTmpDev, &rFormat, aPolygon, nBorderWidth));
+}
+
+
+void SmPolygonNode::Draw(OutputDevice &rDev, const Point &rPosition) const
+{
+ if (IsPhantom())
+ return;
+
+ rDev.Push(PUSH_FILLCOLOR | PUSH_LINECOLOR);
+ rDev.SetFillColor(GetFont().GetColor());
+ rDev.SetLineColor();
+
+ // calculate offset to position the polygon centered within the
+ // surrounding rectangle of the node
+ // (the root sign will be positioned right within the rectangle in order
+ // to attach the horizontal bar easily)
+ Size aPolySize (aPolygon.GetBoundRect(rDev).GetSize()),
+ aRectSize (GetRect().GetSize());
+ Point aOffset ((aRectSize.Width() - aPolySize.Width()) /
+ (aPolygon.GetChar() == MS_SQRT ? 1 : 2),
+ (aRectSize.Height() - aPolySize.Height()) / 2);
+
+ aPolygon.Draw(rDev, rPosition + aOffset);
+
+ rDev.Pop();
+
+#ifdef SM_RECT_DEBUG
+ if (!IsDebug())
+ return;
+
+ int nRFlags = SM_RECT_CORE | SM_RECT_ITALIC | SM_RECT_LINES | SM_RECT_MID;
+ SmRect::Draw(rDev, rPosition, nRFlags);
+#endif
+}
+
+
+/**************************************************************************/
+
+
+void SmRootSymbolNode::DrawBar(OutputDevice &rDev, const Point &rPosition) const
+{
+ // get polygon and rectangle
+ SmPolygon aBarPoly = SmPolygon(MS_BAR);
+
+ // extra length to close small (wedge formed) gap between root-sign and
+ // horizontal bar
+ long nExtraLen = aBarPoly.GetBoundRect(rDev).GetSize().Height() / 2;
+
+ aBarPoly.AdaptToX((OutputDevice &) rDev, nBodyWidth + nExtraLen);
+ aBarPoly.ScaleBy( 1.0, (double) GetFont().GetSize().Height()
+ / aBarPoly.GetOrigFontSize().Height());
+
+ Point aDrawPos (rPosition);
+ aDrawPos.X() -= nExtraLen;
+ aDrawPos = rDev.PixelToLogic(rDev.LogicToPixel(aDrawPos));
+
+ rDev.Push(PUSH_FILLCOLOR | PUSH_LINECOLOR);
+ rDev.SetFillColor(GetFont().GetColor());
+ rDev.SetLineColor();
+
+ aBarPoly.Draw(rDev, aDrawPos);
+
+ rDev.Pop();
+}
+
+
+void SmRootSymbolNode::AdaptToY(const OutputDevice &rDev, ULONG nHeight)
+{
+ // etwas extra L鋘ge damit der horizontale Balken sp鋞er 黚er dem
+ // Argument positioniert ist
+ SmPolygonNode::AdaptToY(rDev, nHeight + nHeight / 10L);
+}
+
+
+void SmRootSymbolNode::Draw(OutputDevice &rDev, const Point &rPosition) const
+{
+ if (IsPhantom())
+ return;
+
+ // draw root-sign itself
+ SmPolygonNode::Draw(rDev, rPosition);
+
+ // get offset for horizontal bar
+ long nPolyHeight = GetPolygon().GetBoundRect(rDev).GetSize().Height();
+ Point aBarOffset (GetWidth(), (GetHeight() - nPolyHeight) / 2);
+
+ DrawBar(rDev, rPosition + aBarOffset);
+
+#ifdef SM_RECT_DEBUG
+ if (!IsDebug())
+ return;
+
+ int nRFlags = SM_RECT_CORE | SM_RECT_ITALIC | SM_RECT_LINES | SM_RECT_MID;
+ SmRect::Draw(rDev, rPosition, nRFlags);
+#endif
+}
+
+
+/**************************************************************************/
+
+
+void SmRectangleNode::AdaptToX(const OutputDevice &rDev, ULONG nWidth)
+{
+ aToSize.Width() = nWidth;
+}
+
+
+void SmRectangleNode::AdaptToY(const OutputDevice &rDev, ULONG nHeight)
+{
+ GetFont().FreezeBorderWidth();
+ aToSize.Height() = nHeight;
+}
+
+
+void SmRectangleNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ long nFontHeight = GetFont().GetSize().Height();
+ long nWidth = aToSize.Width(),
+ nHeight = aToSize.Height();
+ if (nHeight == 0)
+ nHeight = nFontHeight / 30;
+ if (nWidth == 0)
+ nWidth = nFontHeight / 3;
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ // add some borderspace
+ ULONG nBorderWidth = GetFont().GetBorderWidth();
+ //nWidth += nBorderWidth;
+ nHeight += 2 * nBorderWidth;
+
+ //! use this method in order to have 'SmRect::HasAlignInfo() == TRUE'
+ //! and thus having the attribut-fences updated in 'SmRect::ExtendBy'
+ SmRect::operator = (SmRect(nWidth, nHeight));
+}
+
+
+void SmRectangleNode::Draw(OutputDevice &rDev, const Point &rPosition) const
+{
+ if (IsPhantom())
+ return;
+
+ rDev.Push(PUSH_FILLCOLOR | PUSH_LINECOLOR | PUSH_FONT);
+ rDev.SetFillColor(GetFont().GetColor());
+ rDev.SetLineColor();
+
+ rDev.SetFont(GetFont());
+ ULONG nBorderWidth = GetFont().GetBorderWidth();
+
+ // get rectangle and remove borderspace
+ Rectangle aTmp (AsRectangle() + rPosition - GetTopLeft());
+ aTmp.Left() += nBorderWidth;
+ aTmp.Right() -= nBorderWidth;
+ aTmp.Top() += nBorderWidth;
+ aTmp.Bottom() -= nBorderWidth;
+
+ DBG_ASSERT(aTmp.GetHeight() > 0 && aTmp.GetWidth() > 0,
+ "Sm: leeres Rechteck");
+
+ //! avoid GROWING AND SHRINKING of drawn rectangle when constantly
+ //! increasing zoomfactor.
+ // This is done by shifting it's output-position to a point that
+ // corresponds exactly to a pixel on the output device.
+ Point aPos (rDev.PixelToLogic(rDev.LogicToPixel(aTmp.TopLeft())));
+ aTmp.SetPos(aPos);
+
+ rDev.DrawRect(aTmp);
+
+ rDev.Pop();
+
+#ifdef SM_RECT_DEBUG
+ if (!IsDebug())
+ return;
+
+ int nRFlags = SM_RECT_CORE | SM_RECT_ITALIC | SM_RECT_LINES | SM_RECT_MID;
+ SmRect::Draw(rDev, rPosition, nRFlags);
+#endif
+}
+
+
+/**************************************************************************/
+
+
+void SmTextNode::Prepare(const SmFormat &rFormat)
+{
+ SmNode::Prepare(rFormat);
+
+ aText = GetToken().aText;
+ GetFont() = rFormat.GetFont(GetFontDesc());
+
+ if (GetFont().GetItalic() == ITALIC_NORMAL)
+ Attributes() |= ATTR_ITALIC;
+ if (GetFont().GetWeight() == WEIGHT_BOLD)
+ Attributes() |= ATTR_BOLD;
+
+};
+
+
+void SmTextNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ PrepareAttributes();
+
+ USHORT nSizeDesc = GetFontDesc() == FNT_FUNCTION ?
+ SIZ_FUNCTION : SIZ_TEXT;
+ GetFont() *= Fraction (rFormat.GetRelSize(nSizeDesc), 100);
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ SmRect::operator = (SmRect(aTmpDev, &rFormat, aText, GetFont().GetBorderWidth()));
+}
+
+
+void SmTextNode::Draw(OutputDevice &rDev, const Point& rPosition) const
+{
+ if (IsPhantom() || aText.Len() == 0 || aText.GetChar(0) == xub_Unicode('\0'))
+ return;
+
+ rDev.Push(PUSH_FONT);
+ rDev.SetFont(GetFont());
+
+ Point aPos (rPosition);
+ aPos.Y() += GetBaselineOffset();
+ // auf Pixelkoordinaten runden
+ aPos = rDev.PixelToLogic( rDev.LogicToPixel(aPos) );
+
+ rDev.DrawStretchText(aPos, GetWidth(), aText);
+
+ rDev.Pop();
+
+#ifdef SM_RECT_DEBUG
+ if (!IsDebug())
+ return;
+
+ int nRFlags = SM_RECT_CORE | SM_RECT_ITALIC | SM_RECT_LINES | SM_RECT_MID;
+ SmRect::Draw(rDev, rPosition, nRFlags);
+#endif
+}
+
+
+/**************************************************************************/
+
+
+void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ Point aPosition,
+ aOffset;
+ SmNode *pNode;
+ int i, j;
+
+ // initialize array that is to hold the maximum widhts of all
+ // elements (subnodes) in that column.
+ long *pColWidth = new long[nNumCols];
+ for (j = 0; j < nNumCols; j++)
+ pColWidth[j] = 0;
+
+ // arrange subnodes and calculate the aboves arrays contents
+ for (i = GetNumSubNodes() - 1; i >= 0; i--)
+ if (pNode = GetSubNode(i))
+ { pNode->Arrange(rDev, rFormat);
+
+ int nCol = i % nNumCols;
+ pColWidth[nCol]
+ = Max(pColWidth[nCol], pNode->GetItalicWidth());
+ }
+
+ // norm distance from which the following two are calcutated
+ const int nNormDist = 3 * GetFont().GetSize().Height();
+
+ // define horizontal and vertical minimal distances that seperate
+ // the elements
+ long nHorDist = nNormDist * rFormat.GetDistance(DIS_MATRIXCOL) / 100L,
+ nVerDist = nNormDist * rFormat.GetDistance(DIS_MATRIXROW) / 100L;
+
+ // build array that holds the leftmost position for each column
+ long *pColLeft = new long[nNumCols];
+ long nX = 0;
+ for (j = 0; j < nNumCols; j++)
+ { pColLeft[j] = nX;
+ nX += pColWidth[j] + nHorDist;
+ }
+
+ Point aPos, aDelta;
+ SmRect aLineRect;
+ SmRect::operator = (SmRect());
+ for (i = 0; i < nNumRows; i++)
+ { aLineRect = SmRect();
+ for (j = 0; j < nNumCols; j++)
+ { SmNode *pNode = GetSubNode(i * nNumCols + j);
+ DBG_ASSERT(pNode, "Sm: NULL pointer");
+
+ const SmRect &rNodeRect = pNode->GetRect();
+
+ // align all baselines in that row if possible
+ aPos = rNodeRect.AlignTo(aLineRect, RP_RIGHT, RHA_CENTER, RVA_BASELINE);
+ aPos.X() += nHorDist;
+
+ // get horizontal alignment
+ const SmNode *pCoNode = pNode->GetLeftMost();
+ SmTokenType eType = pCoNode->GetToken().eType;
+ RectHorAlign eHorAlign = eType == TTEXT ?
+ RHA_LEFT : pCoNode->GetRectHorAlign();
+
+ // caculate horizontal position of element depending on column
+ // and horizontal alignment
+ switch (eHorAlign)
+ { case RHA_LEFT:
+ aPos.X() = rNodeRect.GetLeft() + pColLeft[j];
+ break;
+ case RHA_CENTER:
+ aPos.X() = rNodeRect.GetLeft() + pColLeft[j]
+ + pColWidth[j] / 2
+ - rNodeRect.GetItalicCenterX();
+ break;
+ case RHA_RIGHT:
+ aPos.X() = rNodeRect.GetLeft() + pColLeft[j]
+ + pColWidth[j] - rNodeRect.GetItalicWidth();
+ break;
+ }
+
+ pNode->MoveTo(aPos);
+ aLineRect.ExtendBy(rNodeRect, RCP_XOR);
+ }
+
+ aPos = aLineRect.AlignTo(*this, RP_BOTTOM, RHA_CENTER, RVA_BASELINE);
+ aPos.Y() += nVerDist;
+
+ // move 'aLineRect' and rectangles in that line to final position
+ aDelta.X() = 0; // since horizontal alignment is already done
+ aDelta.Y() = aPos.Y() - aLineRect.GetTop();
+ aLineRect.Move(aDelta);
+ for (j = 0; j < nNumCols; j++)
+ if (pNode = GetSubNode(i * nNumCols + j))
+ pNode->Move(aDelta);
+
+ ExtendBy(aLineRect, RCP_NONE);
+ }
+
+ delete [] pColLeft;
+ delete [] pColWidth;
+}
+
+
+void SmMatrixNode::SetRowCol(USHORT nMatrixRows, USHORT nMatrixCols)
+{
+ nNumRows = nMatrixRows;
+ nNumCols = nMatrixCols;
+}
+
+
+/**************************************************************************/
+
+
+SmMathSymbolNode::SmMathSymbolNode(const SmToken &rNodeToken)
+: SmSpecialNode(NMATH, rNodeToken, FNT_MATH)
+{
+ xub_Unicode cChar = GetToken().cMathChar;
+ if ((xub_Unicode) '\0' != cChar)
+ SetText( cChar );
+}
+
+
+void SmMathSymbolNode::AdaptToX(const OutputDevice &rDev, ULONG nWidth)
+ // Scale charwidth to mach 'nWidth' while keeping the height
+ // (that is: actually the font width will be scaled)
+{
+ // Since there is no function to do this, we try to approximate
+ // it:
+ //
+ Font &rFace = GetFont();
+ Size aFntSize (rFace.GetSize());
+
+ //! however the result is a bit better with 'nWidth' as initial
+ //! font width
+ aFntSize.Width() = nWidth;
+ rFace.SetSize(aFntSize);
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(rFace);
+
+ // get denominator of error factor for width
+ long nDenom = SmRect(aTmpDev, NULL, GetText(),
+ GetFont().GetBorderWidth()).GetItalicWidth();
+
+ // scale fontwidth with this error factor
+ aFntSize.Width() *= nWidth;
+ aFntSize.Width() /= nDenom ? nDenom : 1;
+
+ GetFont().SetSize(aFntSize);
+}
+
+
+void SmMathSymbolNode::AdaptToY(const OutputDevice &rDev, ULONG nHeight)
+{
+ GetFont().FreezeBorderWidth();
+
+ Font &rFace = GetFont();
+ Size aFntSize (rFace.GetSize());
+
+ // da wir nur die H鰄e skalieren wollen m黶en wir hier ggf die Fontweite
+ // ermitteln um diese beizubehalten.
+ if (aFntSize.Width() == 0)
+ {
+ OutputDevice &rDevNC = (OutputDevice &) rDev;
+ rDevNC.Push(PUSH_FONT);
+ rDevNC.SetFont(rFace);
+ aFntSize.Width() = rDev.GetFontMetric().GetSize().Width();
+ rDevNC.Pop();
+ }
+ DBG_ASSERT(aFntSize.Width() != 0, "Sm: ");
+
+ //! however the result is a bit better with 'nHeight' as initial
+ //! font height
+ aFntSize.Height() = nHeight;
+ rFace.SetSize(aFntSize);
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(rFace);
+
+ // get denominator of error factor for height
+ long nDenom = SmRect(aTmpDev, NULL, GetText(),
+ GetFont().GetBorderWidth()).GetHeight();
+
+ // scale fontwidth with this error factor
+ aFntSize.Height() *= nHeight;
+ aFntSize.Height() /= nDenom ? nDenom : 1;
+
+ GetFont().SetSize(aFntSize);
+}
+
+
+void SmMathSymbolNode::Prepare(const SmFormat &rFormat)
+{
+ SmNode::Prepare(rFormat);
+
+ DBG_ASSERT(GetFont().GetCharSet() == RTL_TEXTENCODING_SYMBOL,
+ "Sm : falsches CHARSET f黵 Zeichen aus dem StarMath Font");
+
+ Flags() |= FLG_FONT | FLG_ITALIC;
+};
+
+
+void SmMathSymbolNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ const XubString &rText = GetText();
+
+ if (rText.Len() == 0 || rText.GetChar(0) == xub_Unicode('\0'))
+ { SmRect::operator = (SmRect());
+ return;
+ }
+
+ PrepareAttributes();
+
+ GetFont() *= Fraction (rFormat.GetRelSize(SIZ_TEXT), 100);
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ SmRect::operator = (SmRect(aTmpDev, &rFormat, rText, GetFont().GetBorderWidth()));
+}
+
+
+/**************************************************************************/
+
+
+void SmSpecialNode::Prepare(const SmFormat &rFormat)
+{
+ SmNode::Prepare(rFormat);
+
+ SmSym *pSym;
+ SmModule *pp = SM_MOD1();
+
+ Size aOldSize = GetFont().GetSize();
+ if (pSym = pp->GetSymSetManager()->GetSymbol(GetToken().aText))
+ { SetText( pSym->GetCharacter() );
+ GetFont() = pSym->GetFace();
+
+ if (GetFont().GetName().EqualsIgnoreCaseAscii("StarMath"))
+ GetFont().SetCharSet(RTL_TEXTENCODING_SYMBOL);
+ }
+ else
+ { SetText( GetToken().aText );
+ GetFont() = rFormat.GetFont(FNT_VARIABLE);
+ }
+ GetFont().SetSize(aOldSize);
+
+ //! eigentlich sollten nur WEIGHT_NORMAL und WEIGHT_BOLD vorkommen...
+ //! In der sms-Datei gibt es jedoch zB auch 'WEIGHT_ULTRALIGHT'
+ //! daher vergleichen wir hier mit > statt mit != .
+ //! (Langfristig sollte die Notwendigkeit f黵 'PrepareAttribut', und damit
+ //! f黵 dieses hier, mal entfallen.)
+ if (GetFont().GetWeight() > WEIGHT_NORMAL)
+ SetAttribut(ATTR_BOLD);
+ if (GetFont().GetItalic() != ITALIC_NONE)
+ SetAttribut(ATTR_ITALIC);
+
+ Flags() |= FLG_FONT;
+};
+
+
+void SmSpecialNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ PrepareAttributes();
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ SmRect::operator = (SmRect(aTmpDev, &rFormat, GetText(), GetFont().GetBorderWidth()));
+}
+
+
+void SmSpecialNode::Draw(OutputDevice &rDev, const Point& rPosition) const
+{
+ //! since this chars might come from any font, that we may not have
+ //! set to ALIGN_BASELINE yet, we do it now.
+ ((SmSpecialNode *)this)->GetFont().SetAlign(ALIGN_BASELINE);
+
+ SmTextNode::Draw(rDev, rPosition);
+}
+
+
+/**************************************************************************/
+
+
+void SmGlyphSpecialNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ PrepareAttributes();
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ SmRect::operator = (SmRect(aTmpDev, &rFormat, GetText(),
+ GetFont().GetBorderWidth()).AsGlyphRect());
+}
+
+
+/**************************************************************************/
+
+
+void SmPlaceNode::Prepare(const SmFormat &rFormat)
+{
+ SmNode::Prepare(rFormat);
+
+ GetFont().SetColor(COL_GRAY);
+ Flags() |= FLG_COLOR | FLG_FONT | FLG_ITALIC;
+};
+
+
+void SmPlaceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ PrepareAttributes();
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ SmRect::operator = (SmRect(aTmpDev, &rFormat, GetText(), GetFont().GetBorderWidth()));
+}
+
+
+/**************************************************************************/
+
+
+void SmErrorNode::Prepare(const SmFormat &rFormat)
+{
+ SmNode::Prepare(rFormat);
+
+ GetFont().SetColor(COL_RED);
+ Flags() |= FLG_VISIBLE | FLG_BOLD | FLG_ITALIC
+ | FLG_COLOR | FLG_FONT | FLG_SIZE;
+}
+
+
+void SmErrorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ PrepareAttributes();
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ const XubString &rText = GetText();
+ DBG_ASSERT(rText.Len() == 1 && rText.GetChar(0) == (xub_Unicode) MS_ERROR,
+ "Sm : Text ist kein ERROR Symbol");
+ SmRect::operator = (SmRect(aTmpDev, &rFormat, rText, GetFont().GetBorderWidth()));
+}
+
+
+/**************************************************************************/
+
+
+void SmBlankNode::IncreaseBy(const SmToken &rToken)
+{
+ switch(rToken.eType)
+ {
+ case TBLANK: nNum += 4; break;
+ case TSBLANK: nNum += 1; break;
+ }
+}
+
+
+void SmBlankNode::Prepare(const SmFormat &rFormat)
+{
+ SmNode::Prepare(rFormat);
+
+ //! hier mu/sollte es lediglich nicht der StarMath Font sein,
+ //! damit f黵 das in Arrange verwendete Zeichen ein "normales"
+ //! (ungecliptes) Rechteck erzeugt wird.
+ GetFont() = rFormat.GetFont(FNT_VARIABLE);
+
+ Flags() |= FLG_FONT | FLG_BOLD | FLG_ITALIC;
+}
+
+
+void SmBlankNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev);
+ aTmpDev.SetFont(GetFont());
+
+ // Abstand von der Fonth鰄e abh鋘gig machen
+ // (damit er beim skalieren (zB size *2 {a ~ b}) mitw鋍hst)
+ long nDist = GetFont().GetSize().Height() / 10L,
+ nSpace = nNum * nDist;
+
+ // ein SmRect mit Baseline und allem drum und dran besorgen
+ SmRect::operator = (SmRect(aTmpDev, &rFormat, XubString(xub_Unicode(' ')),
+ GetFont().GetBorderWidth()));
+
+ // und dieses auf die gew黱schte Breite bringen
+ SetItalicSpaces(0, 0);
+ SetWidth(nSpace);
+}
+
+
+
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
new file mode 100644
index 000000000000..f10d685d864f
--- /dev/null
+++ b/starmath/source/parse.cxx
@@ -0,0 +1,2087 @@
+/*************************************************************************
+ *
+ * $RCSfile: parse.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include <stdio.h>
+
+#define SMDLL 1
+
+#ifndef PARSE_HXX
+#include "parse.hxx"
+#endif
+#ifndef XCHAR_HXX
+#include "xchar.hxx"
+#endif
+#ifndef _STARMATH_HRC
+#include "starmath.hrc"
+#endif
+#ifndef _SMDLL_HXX
+#include "smdll.hxx"
+#endif
+#ifndef _SMMOD_HXX
+#include "smmod.hxx"
+#endif
+#ifndef CONFIG_HXX
+#include "config.hxx"
+#endif
+
+#include "node.hxx"
+
+
+static inline BOOL strnccmp(const String &u1, xub_StrLen nIdx,
+ const sal_Char *s2, xub_StrLen nLen)
+{
+ return u1.EqualsIgnoreCaseAscii( s2, nIdx, nLen );
+}
+
+static const xub_Unicode aDelimiterTable[] =
+{
+ ' ', '\t', '\n', '\r', '+', '-', '*', '/', '=', '#',
+ '%', '\\', '"', '~', '`', '>', '<', '&', '|', '(',
+ ')', '{', '}', '[', ']', '^', '_',
+ '\0' // end of list symbol
+};
+
+
+///////////////////////////////////////////////////////////////////////////
+
+SmToken::SmToken() :
+ eType (TUNKNOWN),
+ cMathChar ('\0')
+{
+ nGroup = nLevel = nRow = nCol = 0;
+}
+
+///////////////////////////////////////////////////////////////////////////
+
+struct SmTokenTableEntry
+{
+ const sal_Char* pIdent;
+ SmTokenType eType;
+ xub_Unicode cMathChar;
+ ULONG nGroup;
+ USHORT nLevel;
+};
+
+static const SmTokenTableEntry aTokenTable[] =
+{
+ { "#", TPOUND, '\0', 0, 0 },
+ { "##", TDPOUND, '\0', 0, 0 },
+ { "&", TAND, MS_AND, TGPRODUCT, 0 },
+ { "(", TLPARENT, MS_LPARENT, TGLBRACES, 5 }, //! 5 to continue expression
+ { ")", TRPARENT, MS_RPARENT, TGRBRACES, 0 }, //! 0 to terminate expression
+ { "*", TMULTIPLY, MS_MULTIPLY, TGPRODUCT, 0 },
+ { "+", TPLUS, MS_PLUS, TGUNOPER | TGSUM, 5 },
+ { "+-", TPLUSMINUS, MS_PLUSMINUS, TGUNOPER | TGSUM, 5 },
+ { "-", TMINUS, MS_MINUS, TGUNOPER | TGSUM, 5 },
+ { "-+", TMINUSPLUS, MS_MINUSPLUS, TGUNOPER | TGSUM, 5 },
+ { ".", TPOINT, '\0', 0, 0 },
+ { "/", TDIVIDEBY, MS_SLASH, TGPRODUCT, 0 },
+ { "<", TLT, MS_LT, TGRELATION, 0 },
+ { "<<", TLL, MS_LL, TGRELATION, 0 },
+ { "<=", TLE, MS_LE, TGRELATION, 0 },
+ { "<>", TNEQ, MS_NEQ, TGRELATION, 0},
+ { "<?>", TPLACE, MS_PLACE, 0, 5 },
+ { "=", TASSIGN, MS_ASSIGN, TGRELATION, 0},
+ { ">", TGT, MS_GT, TGRELATION, 0 },
+ { ">=", TGE, MS_GE, TGRELATION, 0 },
+ { ">>", TGG, MS_GG, TGRELATION, 0 },
+ { "Im" , TIM, MS_IM, TGSTANDALONE, 5 },
+ { "MZ23", TDEBUG, '\0', TGATTRIBUT, 0 },
+ { "Re" , TRE, MS_RE, TGSTANDALONE, 5 },
+ { "abs", TABS, '\0', TGUNOPER, 13 },
+ { "arcosh", TACOSH, '\0', TGFUNCTION, 5 },
+ { "arcoth", TACOTH, '\0', TGFUNCTION, 5 },
+ { "acute", TACUTE, MS_ACUTE, TGATTRIBUT, 5 },
+ { "aleph" , TALEPH, MS_ALEPH, TGSTANDALONE, 5 },
+ { "alignb", TALIGNC, '\0', TGALIGN | TGDISCARDED, 0},
+ { "alignc", TALIGNC, '\0', TGALIGN, 0},
+ { "alignl", TALIGNL, '\0', TGALIGN, 0},
+ { "alignm", TALIGNC, '\0', TGALIGN | TGDISCARDED, 0},
+ { "alignr", TALIGNR, '\0', TGALIGN, 0},
+ { "alignt", TALIGNC, '\0', TGALIGN | TGDISCARDED, 0},
+ { "and", TAND, MS_AND, TGPRODUCT, 0},
+ { "approx", TAPPROX, MS_APPROX, TGRELATION, 0},
+ { "arccos", TACOS, '\0', TGFUNCTION, 5},
+ { "arccot", TACOT, '\0', TGFUNCTION, 5},
+ { "arcsin", TASIN, '\0', TGFUNCTION, 5},
+ { "arctan", TATAN, '\0', TGFUNCTION, 5},
+ { "arsinh", TASINH, '\0', TGFUNCTION, 5},
+ { "artanh", TATANH, '\0', TGFUNCTION, 5},
+ { "backepsilon" , TBACKEPSILON, MS_BACKEPSILON, TGSTANDALONE, 5},
+ { "bar", TBAR, MS_BAR, TGATTRIBUT, 5},
+ { "binom", TBINOM, '\0', 0, 5 },
+ { "black", TBLACK, '\0', TGCOLOR, 0},
+ { "blue", TBLUE, '\0', TGCOLOR, 0},
+ { "bold", TBOLD, '\0', TGFONTATTR, 5},
+ { "boper", TBOPER, '\0', TGPRODUCT, 0},
+ { "breve", TBREVE, MS_BREVE, TGATTRIBUT, 5},
+ { "bslash", TBACKSLASH, MS_BACKSLASH, TGPRODUCT, 0 },
+ { "cdot", TCDOT, MS_CDOT, TGPRODUCT, 0},
+ { "check", TCHECK, MS_CHECK, TGATTRIBUT, 5},
+ { "circ" , TCIRC, MS_CIRC, TGSTANDALONE, 5},
+ { "circle", TCIRCLE, MS_CIRCLE, TGATTRIBUT, 5},
+ { "color", TCOLOR, '\0', TGFONTATTR, 5},
+ { "coprod", TCOPROD, MS_COPROD, TGOPER, 5},
+ { "cos", TCOS, '\0', TGFUNCTION, 5},
+ { "cosh", TCOSH, '\0', TGFUNCTION, 5},
+ { "cot", TCOT, '\0', TGFUNCTION, 5},
+ { "coth", TCOTH, '\0', TGFUNCTION, 5},
+ { "csub", TCSUB, '\0', TGPOWER, 0},
+ { "csup", TCSUP, '\0', TGPOWER, 0},
+ { "cyan", TCYAN, '\0', TGCOLOR, 0},
+ { "dddot", TDDDOT, MS_DDDOT, TGATTRIBUT, 5},
+ { "ddot", TDDOT, MS_DDOT, TGATTRIBUT, 5},
+ { "def", TDEF, MS_DEF, TGRELATION, 0},
+ { "div", TDIV, MS_DIV, TGPRODUCT, 0},
+ { "divides", TDIVIDES, MS_LINE, TGRELATION, 0},
+ { "dlarrow" , TDLARROW, MS_DLARROW, TGSTANDALONE, 5},
+ { "dlrarrow" , TDLRARROW, MS_DLRARROW, TGSTANDALONE, 5},
+ { "dot", TDOT, MS_DOT, TGATTRIBUT, 5},
+ { "dotsaxis", TDOTSAXIS, MS_DOTSAXIS, TGSTANDALONE, 5}, // 5 to continue expression
+ { "dotsdiag", TDOTSDIAG, MS_DOTSUP, TGSTANDALONE, 5}, //
+ { "dotsdown", TDOTSDOWN, MS_DOTSDOWN, TGSTANDALONE, 5}, //
+ { "dotslow", TDOTSLOW, MS_DOTSLOW, TGSTANDALONE, 5}, //
+ { "dotsup", TDOTSUP, MS_DOTSUP, TGSTANDALONE, 5}, //
+ { "dotsvert", TDOTSVERT, MS_DOTSVERT, TGSTANDALONE, 5}, //
+ { "downarrow" , TDOWNARROW, MS_DOWNARROW, TGSTANDALONE, 5},
+ { "drarrow" , TDRARROW, MS_DRARROW, TGSTANDALONE, 5},
+ { "emptyset" , TEMPTYSET, MS_EMPTYSET, TGSTANDALONE, 5},
+ { "equiv", TEQUIV, MS_EQUIV, TGRELATION, 0},
+ { "exists", TEXISTS, MS_EXISTS, TGSTANDALONE, 5},
+ { "exp", TEXP, '\0', TGFUNCTION, 5},
+ { "fact", TFACT, MS_FACT, TGUNOPER, 5},
+ { "fixed", TFIXED, '\0', TGFONT, 0},
+ { "font", TFONT, '\0', TGFONTATTR, 5},
+ { "forall", TFORALL, MS_FORALL, TGSTANDALONE, 5},
+ { "from", TFROM, '\0', TGLIMIT, 0},
+ { "func", TFUNC, '\0', TGFUNCTION, 5},
+ { "ge", TGE, MS_GE, TGRELATION, 0},
+ { "geslant", TGESLANT, MS_GESLANT, TGRELATION, 0 },
+ { "gg", TGG, MS_GG, TGRELATION, 0},
+ { "grave", TGRAVE, MS_GRAVE, TGATTRIBUT, 5},
+ { "green", TGREEN, '\0', TGCOLOR, 0},
+ { "gt", TGT, MS_GT, TGRELATION, 0},
+ { "hat", THAT, MS_HAT, TGATTRIBUT, 5},
+ { "hbar" , THBAR, MS_HBAR, TGSTANDALONE, 5},
+ { "iiint", TIIINT, MS_IIINT, TGOPER, 5},
+ { "iint", TIINT, MS_IINT, TGOPER, 5},
+ { "in", TIN, MS_IN, TGRELATION, 0},
+ { "infinity" , TINFINITY, MS_INFINITY, TGSTANDALONE, 5},
+ { "infty" , TINFINITY, MS_INFINITY, TGSTANDALONE, 5},
+ { "int", TINT, MS_INT, TGOPER, 5},
+ { "intersection", TINTERSECT, MS_INTERSECT, TGPRODUCT, 0},
+ { "ital", TITALIC, '\0', TGFONTATTR, 5},
+ { "italic", TITALIC, '\0', TGFONTATTR, 5},
+ { "lambdabar" , TLAMBDABAR, MS_LAMBDABAR, TGSTANDALONE, 5},
+ { "langle", TLANGLE, MS_LANGLE, TGLBRACES, 5},
+ { "lbrace", TLBRACE, MS_LBRACE, TGLBRACES, 5},
+ { "lceil", TLCEIL, MS_LCEIL, TGLBRACES, 5},
+ { "ldbracket", TLDBRACKET, MS_LDBRACKET, TGLBRACES, 5},
+ { "ldline", TLDLINE, MS_DLINE, TGLBRACES, 5},
+ { "le", TLE, MS_LE, TGRELATION, 0},
+ { "left", TLEFT, '\0', 0, 5},
+ { "leftarrow" , TLEFTARROW, MS_LEFTARROW, TGSTANDALONE, 5},
+ { "leslant", TLESLANT, MS_LESLANT, TGRELATION, 0 },
+ { "lfloor", TLFLOOR, MS_LFLOOR, TGLBRACES, 5},
+ { "lim", TLIM, '\0', TGOPER, 5},
+ { "liminf", TLIMINF, '\0', TGOPER, 5},
+ { "limsup", TLIMSUP, '\0', TGOPER, 5},
+ { "lint", TLINT, MS_LINT, TGOPER, 5},
+ { "ll", TLL, MS_LL, TGRELATION, 0},
+ { "lline", TLLINE, MS_LINE, TGLBRACES, 5},
+ { "llint", TLLINT, MS_LLINT, TGOPER, 5},
+ { "lllint", TLLLINT, MS_LLLINT, TGOPER, 5},
+ { "ln", TLN, '\0', TGFUNCTION, 5},
+ { "log", TLOG, '\0', TGFUNCTION, 5},
+ { "lsub", TLSUB, '\0', TGPOWER, 0},
+ { "lsup", TLSUP, '\0', TGPOWER, 0},
+ { "lt", TLT, MS_LT, TGRELATION, 0},
+ { "magenta", TMAGENTA, '\0', TGCOLOR, 0},
+ { "matrix", TMATRIX, '\0', 0, 5},
+ { "minusplus", TMINUSPLUS, MS_MINUSPLUS, TGUNOPER | TGSUM, 5},
+ { "mline", TMLINE, MS_LINE, 0, 0}, //! nicht in TGRBRACES, Level 0
+ { "nabla", TNABLA, MS_NABLA, TGSTANDALONE, 5},
+ { "nbold", TNBOLD, '\0', TGFONTATTR, 5},
+ { "ndivides", TNDIVIDES, MS_NDIVIDES, TGRELATION, 0},
+ { "neg", TNEG, MS_NEG, TGUNOPER, 5 },
+ { "neq", TNEQ, MS_NEQ, TGRELATION, 0},
+ { "newline", TNEWLINE, '\0', 0, 0},
+ { "ni", TNI, MS_NI, TGRELATION, 0},
+ { "nitalic", TNITALIC, '\0', TGFONTATTR, 5},
+ { "none", TNONE, '\0', TGLBRACES | TGRBRACES, 0},
+ { "notin", TNOTIN, MS_NOTIN, TGRELATION, 0},
+ { "nsubset", TNSUBSET, MS_NSUBSET, TGRELATION, 0 },
+ { "nsupset", TNSUPSET, MS_NSUPSET, TGRELATION, 0 },
+ { "nsubseteq", TNSUBSETEQ, MS_NSUBSETEQ, TGRELATION, 0 },
+ { "nsupseteq", TNSUPSETEQ, MS_NSUPSETEQ, TGRELATION, 0 },
+ { "nroot", TNROOT, MS_SQRT, TGUNOPER, 5},
+ { "odivide", TODIVIDE, MS_ODIVIDE, TGPRODUCT, 0},
+ { "odot", TODOT, MS_ODOT, TGPRODUCT, 0},
+ { "ominus", TOMINUS, MS_OMINUS, TGSUM, 0},
+ { "oper", TOPER, '\0', TGOPER, 5},
+ { "oplus", TOPLUS, MS_OPLUS, TGSUM, 0},
+ { "or", TOR, MS_OR, TGSUM, 0},
+ { "ortho", TORTHO, MS_ORTHO, TGRELATION, 0},
+ { "otimes", TOTIMES, MS_OTIMES, TGPRODUCT, 0},
+ { "over", TOVER, '\0', TGPRODUCT, 0},
+ { "overbrace", TOVERBRACE, MS_OVERBRACE, TGPRODUCT, 5},
+ { "overline", TOVERLINE, '\0', TGATTRIBUT, 5},
+ { "overstrike", TOVERSTRIKE, '\0', TGATTRIBUT, 5},
+ { "owns", TNI, MS_NI, TGRELATION, 0},
+ { "parallel", TPARALLEL, MS_DLINE, TGRELATION, 0},
+ { "partial", TPARTIAL, MS_PARTIAL, TGSTANDALONE, 5 },
+ { "phantom", TPHANTOM, '\0', TGFONTATTR, 5},
+ { "plusminus", TPLUSMINUS, MS_PLUSMINUS, TGUNOPER | TGSUM, 5},
+ { "prod", TPROD, MS_PROD, TGOPER, 5},
+ { "prop", TPROP, MS_PROP, TGRELATION, 0},
+ { "rangle", TRANGLE, MS_RANGLE, TGRBRACES, 0}, //! 0 to terminate expression
+ { "rbrace", TRBRACE, MS_RBRACE, TGRBRACES, 0}, //
+ { "rceil", TRCEIL, MS_RCEIL, TGRBRACES, 0}, //
+ { "rdbracket", TRDBRACKET, MS_RDBRACKET, TGRBRACES, 0}, //
+ { "rdline", TRDLINE, MS_DLINE, TGRBRACES, 0}, //
+ { "red", TRED, '\0', TGCOLOR, 0},
+ { "rfloor", TRFLOOR, MS_RFLOOR, TGRBRACES, 0}, //! 0 to terminate expression
+ { "right", TRIGHT, '\0', 0, 0},
+ { "rightarrow" , TRIGHTARROW, MS_RIGHTARROW, TGSTANDALONE, 5},
+ { "rline", TRLINE, MS_LINE, TGRBRACES, 0}, //! 0 to terminate expression
+ { "rsub", TRSUB, '\0', TGPOWER, 0},
+ { "rsup", TRSUP, '\0', TGPOWER, 0},
+ { "sans", TSANS, '\0', TGFONT, 0},
+ { "serif", TSERIF, '\0', TGFONT, 0},
+ { "setC" , TSETC, MS_SETC, TGSTANDALONE, 5},
+ { "setN" , TSETN, MS_SETN, TGSTANDALONE, 5},
+ { "setQ" , TSETQ, MS_SETQ, TGSTANDALONE, 5},
+ { "setR" , TSETR, MS_SETR, TGSTANDALONE, 5},
+ { "setZ" , TSETZ, MS_SETZ, TGSTANDALONE, 5},
+ { "setminus", TBACKSLASH, MS_BACKSLASH, TGPRODUCT, 0 },
+ { "sim", TSIM, MS_SIM, TGRELATION, 0},
+ { "simeq", TSIMEQ, MS_SIMEQ, TGRELATION, 0},
+ { "sin", TSIN, '\0', TGFUNCTION, 5},
+ { "sinh", TSINH, '\0', TGFUNCTION, 5},
+ { "size", TSIZE, '\0', TGFONTATTR, 5},
+ { "slash", TSLASH, MS_SLASH, TGPRODUCT, 0 },
+ { "sqrt", TSQRT, MS_SQRT, TGUNOPER, 5},
+ { "stack", TSTACK, '\0', 0, 5},
+ { "sub", TRSUB, '\0', TGPOWER, 0},
+ { "subset", TSUBSET, MS_SUBSET, TGRELATION, 0},
+ { "subseteq", TSUBSETEQ, MS_SUBSETEQ, TGRELATION, 0},
+ { "sum", TSUM, MS_SUM, TGOPER, 5},
+ { "sup", TRSUP, '\0', TGPOWER, 0},
+ { "supset", TSUPSET, MS_SUPSET, TGRELATION, 0},
+ { "supseteq", TSUPSETEQ, MS_SUPSETEQ, TGRELATION, 0},
+ { "tan", TTAN, '\0', TGFUNCTION, 5},
+ { "tanh", TTANH, '\0', TGFUNCTION, 5},
+ { "tilde", TTILDE, MS_TILDE, TGATTRIBUT, 5},
+ { "times", TTIMES, MS_TIMES, TGPRODUCT, 0},
+ { "to", TTO, '\0', TGLIMIT, 0},
+ { "toward", TTOWARD, MS_RIGHTARROW, TGRELATION, 0},
+ { "transl", TTRANSL, MS_TRANSL, TGRELATION, 0},
+ { "transr", TTRANSR, MS_TRANSR, TGRELATION, 0},
+ { "underbrace", TUNDERBRACE, MS_UNDERBRACE, TGPRODUCT, 5},
+ { "underline", TUNDERLINE, '\0', TGATTRIBUT, 5},
+ { "union", TUNION, MS_UNION, TGSUM, 0},
+ { "uoper", TUOPER, '\0', TGUNOPER, 5},
+ { "uparrow" , TUPARROW, MS_UPARROW, TGSTANDALONE, 5},
+ { "vec", TVEC, MS_VEC, TGATTRIBUT, 5},
+ { "white", TWHITE, '\0', TGCOLOR, 0},
+ { "widebslash", TWIDEBACKSLASH, MS_BACKSLASH, TGPRODUCT, 0 },
+ { "widehat", TWIDEHAT, MS_HAT, TGATTRIBUT, 5},
+ { "widetilde", TWIDETILDE, MS_TILDE, TGATTRIBUT, 5},
+ { "wideslash", TWIDESLASH, MS_SLASH, TGPRODUCT, 0 },
+ { "widevec", TWIDEVEC, MS_VEC, TGATTRIBUT, 5},
+ { "wp" , TWP, MS_WP, TGSTANDALONE, 5},
+ { "yellow", TYELLOW, '\0', TGCOLOR, 0},
+ { "[", TLBRACKET, MS_LBRACKET, TGLBRACES, 5}, //! 5 to continue expression
+ { "\\", TESCAPE, '\0', 0, 5},
+ { "]", TRBRACKET, MS_RBRACKET, TGRBRACES, 0}, //! 0 to terminate expression
+ { "^", TRSUP, '\0', TGPOWER, 0},
+ { "_", TRSUB, '\0', TGPOWER, 0},
+ { "`", TSBLANK, '\0', TGBLANK, 5},
+ { "{", TLGROUP, MS_LBRACE, 0, 5}, //! 5 to continue expression
+ { "|", TOR, MS_OR, TGSUM, 0},
+ { "}", TRGROUP, MS_RBRACE, 0, 0}, //! 0 to terminate expression
+ { "~", TBLANK, '\0', TGBLANK, 5},
+ { "", TEND, '\0', 0, 0}
+};
+
+
+///////////////////////////////////////////////////////////////////////////
+
+
+BOOL SmParser::IsDelimiter(sal_Unicode cChar)
+ // returns 'TRUE' iff cChar is '\0' or a delimeter
+{
+ if(!cChar)
+ return TRUE;
+
+ // check if 'cChar' is in the delimeter table
+ const sal_Unicode *pDelim = &aDelimiterTable[0];
+ for ( ; *pDelim != 0; pDelim++)
+ if (*pDelim == cChar)
+ break;
+
+ return (*pDelim != 0);
+}
+
+
+#ifdef NOT_USED
+const xub_Unicode * SmParser::GetText(XubString &rText, const xub_Unicode *pPos)
+ // put text between current and next '"' in 'rText'. With '\' quoted
+ // chars will be inserted without '\'. Thus type '\"' to get '"' in
+ // the text and '\\' for '\'. ('pPos' has to point to start of the
+ // string (ie the opening '"' char).)
+{
+ const xub_Unicode *pEnd = (const xub_Unicode *) BufferString + BufferString.Len();
+
+ DBG_ASSERT(*pPos == '"', "Dies ist kein Text");
+
+ // get string content without quoting '\'
+ rText.Erase();
+ pPos++;
+ while (pPos < pEnd && *pPos != '"')
+ if (*pPos != '\\' || ++pPos < pEnd)
+ rText += *pPos++;
+ else
+ { Error(PE_UNEXPECTED_ENDOFINPUT);
+ return pEnd;
+ }
+
+ // check for irregular end of string
+ if (pPos == pEnd)
+ { Error(PE_UNEXPECTED_ENDOFINPUT);
+ return pEnd;
+ }
+
+ // return pointer to char after closing '"'
+ return pPos + 1;
+}
+#endif
+
+
+const xub_Unicode * SmParser::SkipWhiteSpaces(const xub_Unicode *pPos, USHORT &nRow, USHORT &nCol)
+ // skip white-spaces while keeping track of actual row and column.
+{
+ DBG_ASSERT(pPos , "NULL pointer");
+
+ while ( *pPos != '\0' && IsWhiteSpace(*pPos))
+ { if (*pPos == CharLineEnd)
+ { nRow += 1;
+ nCol = 0;
+ }
+ nCol++;
+ pPos++;
+ }
+
+ return pPos;
+}
+
+
+const xub_Unicode * SmParser::SkipComment(const xub_Unicode *pPos, USHORT &nRow, USHORT &nCol)
+ // skip rest of line if comment-start ('%%') is encountered.
+ // return pointer to char after line-end or (in case of end of buffer)
+ // return pointer to the terminating '\0' char.
+{
+ DBG_ASSERT(pPos, "NULL pointer");
+
+ if (!IsComment(pPos))
+ return pPos;
+
+ // skip rest of line
+ const xub_Unicode *pStart = pPos;
+ while (*pPos != '\0' && *pPos != CharLineEnd)
+ pPos++;
+ if (*pPos == CharLineEnd)
+ { nRow += 1;
+ nCol = 0;
+ }
+ else
+ nCol += pPos - pStart;
+
+ return *pPos == '\0' ? pPos : pPos + 1;
+}
+
+
+void SmParser::Insert(const XubString &rText, USHORT nPos)
+{
+ BufferString.Insert(rText, nPos);
+
+ xub_StrLen nLen = rText.Len();
+ BufferIndex += nLen;
+ nTokenIndex += nLen;
+}
+
+
+void SmParser::NextToken()
+{
+ //xub_Unicode *pBuffer = &BufferString[BufferIndex];
+ const sal_Unicode *pBuffer = BufferString.GetBuffer();
+ pBuffer += BufferIndex;
+
+ xub_StrLen nLen = BufferString.Len();
+
+ // skip comments and white-spaces
+ const sal_Unicode *pStart;
+ do
+ { pStart = pBuffer;
+ pBuffer = (xub_Unicode *) SkipWhiteSpaces(pStart, Row, Column);
+ pBuffer = (xub_Unicode *) SkipComment(pBuffer, Row, Column);
+ } while (pStart != pBuffer);
+ BufferIndex = pBuffer - BufferString.GetBuffer();
+
+ // set index of current token
+ nTokenIndex = BufferIndex;
+
+ // check for end of input
+ if ((BufferIndex >= nLen) || (*pBuffer == '\0'))
+ { CurToken.eType = TEND;
+ CurToken.cMathChar = '\0';
+ CurToken.nGroup = 0;
+ CurToken.nLevel = 0;
+ CurToken.aText.Erase();
+ CurToken.nRow = Row;
+ CurToken.nCol = Column;
+
+ return;
+ }
+
+ // table lookup
+ int l = 0;
+ int h = sizeof(aTokenTable) / sizeof(aTokenTable[0]);
+ while (l < h-1)
+ {
+ int i = l;
+ const sal_Char *pIdentI = aTokenTable[i].pIdent;
+ USHORT n = strlen(pIdentI);
+
+ if (n != 0 && strnccmp(BufferString, BufferIndex, pIdentI, n))
+ { int j = i;
+ DBG_ASSERT(j + 1 < h, "Sm : index out of range");
+ const sal_Char *pIdentJ = aTokenTable[j + 1].pIdent;
+ int m = strlen(pIdentJ);
+ BOOL u = strnccmp(BufferString, BufferIndex, pIdentJ, m);
+
+ BOOL bReCalcLen = FALSE;
+
+ while ( ( u || strnccmp(BufferString, BufferIndex, pIdentJ, n) )
+ && (++j < h - 1) )
+ {
+ if (u)
+ {
+ i = j;
+ bReCalcLen = TRUE;
+ }
+
+ pIdentJ = aTokenTable[j + 1].pIdent;
+ m = strlen(pIdentJ);
+ u = strnccmp(BufferString, BufferIndex, pIdentJ, m);
+ }
+
+ if (bReCalcLen)
+ n = strlen(aTokenTable[i].pIdent);
+
+ const SmTokenTableEntry &rTokenI = aTokenTable[i];
+ const sal_Unicode *pChar = BufferString.GetBuffer() + BufferIndex + n - 1;
+ if (IsDelimiter(*pChar) || IsDelimiter(*(pChar + 1)))
+ { CurToken.eType = rTokenI.eType;
+ CurToken.cMathChar = rTokenI.cMathChar;
+ CurToken.nGroup = rTokenI.nGroup;
+ CurToken.nLevel = rTokenI.nLevel;
+ CurToken.aText.AssignAscii( rTokenI.pIdent );
+ CurToken.nRow = Row;
+ CurToken.nCol = Column;
+
+ Column += n;
+ BufferIndex += n;
+
+ return;
+ }
+ }
+ l++;
+ } // end of table lookup
+
+ if (*pBuffer == '"')
+ // text token
+ { CurToken.eType = TTEXT;
+ CurToken.cMathChar = '\0';
+ CurToken.nGroup = 0;
+ CurToken.nLevel = 5;
+ CurToken.aText.Erase();
+ CurToken.nRow = Row;
+ CurToken.nCol = Column + 1;
+
+ BufferIndex++;
+ pBuffer ++;
+ Column++;
+
+ while ((*pBuffer != '"') && (*pBuffer != '\0'))
+ { if ((*pBuffer == '\n') || (*pBuffer == '\r'))
+ { if (*pBuffer == '\n')
+ { CurToken.aText += ' ';
+ Row += 1;
+ }
+ else
+ Column = 1;
+ }
+ else
+ CurToken.aText += *pBuffer;
+
+ Column++;
+ BufferIndex++;
+ pBuffer ++;
+ }
+
+ if (*pBuffer == '"')
+ { BufferIndex++;
+ pBuffer ++;
+ Column++;
+ }
+ return;
+ }
+
+ USHORT n;
+ for (n = 1; !IsDelimiter(BufferString.GetChar(BufferIndex + n)); n++)
+ ;
+
+ if (*pBuffer == '%')
+ { CurToken.eType = TSPECIAL;
+ CurToken.cMathChar = '\0';
+ CurToken.nGroup = 0;
+ CurToken.nLevel = 5;
+ CurToken.aText = XubString(BufferString, BufferIndex + 1, n - 1);
+ CurToken.nRow = Row;
+ CurToken.nCol = Column + 1;
+
+ BufferIndex += n;
+ pBuffer++;
+ Column += n;
+
+ return;
+ }
+
+ USHORT i;
+ for (i = 0; (i < n) && (isdigit(*pBuffer) ||
+ (*pBuffer == '.') ||
+ (*pBuffer == ',')); i++)
+ pBuffer ++;
+
+ CurToken.eType = (i < n) ? TIDENT : TNUMBER;
+ CurToken.cMathChar = '\0';
+ CurToken.nGroup = 0;
+ CurToken.nLevel = 5;
+ CurToken.aText = XubString(BufferString, BufferIndex, n);
+ CurToken.nRow = Row;
+ CurToken.nCol = Column;
+
+ BufferIndex += n;
+ Column += n;
+}
+
+
+////////////////////////////////////////
+// grammar
+//
+
+
+void SmParser::Table()
+{
+ SmNodeArray LineArray;
+
+ Line();
+ while (CurToken.eType == TNEWLINE)
+ {
+ NextToken();
+ Line();
+ }
+
+ if (CurToken.eType != TEND)
+ Error(PE_UNEXPECTED_CHAR);
+
+ USHORT n = NodeStack.Count();
+
+ LineArray.SetSize(n);
+
+ for (USHORT i = 0; i < n; i++)
+ LineArray.Put(n - (i + 1), NodeStack.Pop());
+
+ SmStructureNode *pSNode = new SmTableNode(CurToken);
+ pSNode->SetSubNodes(LineArray);
+ NodeStack.Push(pSNode);
+}
+
+
+void SmParser::Align()
+ // parse alignment info (if any), then go on with rest of expression
+{
+ SmStructureNode *pSNode = 0;
+ BOOL bNeedGroupClose = FALSE;
+
+ if (TokenInGroup(TGALIGN))
+ {
+ if (IsConvert40To50())
+ // encapsulate expression to be aligned in group braces
+ // (here group-open brace)
+ { Insert('{', GetTokenIndex());
+ bNeedGroupClose = TRUE;
+
+ // get first valid align statement in sequence
+ // (the dominant one in 4.0) and erase all others (especially old
+ // discarded tokens) from command string.
+ while (TokenInGroup(TGALIGN))
+ { if (TokenInGroup(TGDISCARDED) || pSNode)
+ { BufferIndex = GetTokenIndex();
+ BufferString.Erase(BufferIndex, CurToken.aText.Len());
+ }
+ else
+ pSNode = new SmAlignNode(CurToken);
+
+ NextToken();
+ }
+ }
+ else
+ {
+ pSNode = new SmAlignNode(CurToken);
+
+ NextToken();
+
+ // allow for just one align statement in 5.0
+ if (!IsConvert40To50() && TokenInGroup(TGALIGN))
+ { Error(PE_DOUBLE_ALIGN);
+ return;
+ }
+ }
+ }
+
+ Expression();
+
+ if (bNeedGroupClose)
+ Insert('}', GetTokenIndex());
+
+ if (pSNode)
+ { pSNode->SetSubNodes(NodeStack.Pop(), 0);
+ NodeStack.Push(pSNode);
+ }
+}
+
+
+void SmParser::Line()
+{
+ USHORT n = 0;
+ SmNodeArray ExpressionArray;
+
+ ExpressionArray.SetSize(n);
+
+ // start with single expression that may have an alignment statement
+ // (and go on with expressions that must not have alignment
+ // statements in 'while' loop below. See also 'Expression()'.)
+ if (CurToken.eType != TEND && CurToken.eType != TNEWLINE)
+ { Align();
+ ExpressionArray.SetSize(++n);
+ ExpressionArray.Put(n - 1, NodeStack.Pop());
+ }
+
+ while (CurToken.eType != TEND && CurToken.eType != TNEWLINE)
+ { if (!IsConvert40To50())
+ Expression();
+ else
+ Align();
+ ExpressionArray.SetSize(++n);
+ ExpressionArray.Put(n - 1, NodeStack.Pop());
+ }
+
+ SmStructureNode *pSNode = new SmLineNode(CurToken);
+ pSNode->SetSubNodes(ExpressionArray);
+ NodeStack.Push(pSNode);
+}
+
+
+void SmParser::Expression()
+{
+ USHORT n = 0;
+ SmNodeArray RelationArray;
+
+ RelationArray.SetSize(n);
+
+ Relation();
+ RelationArray.SetSize(++n);
+ RelationArray.Put(n - 1, NodeStack.Pop());
+
+ while (CurToken.nLevel >= 4)
+ { Relation();
+ RelationArray.SetSize(++n);
+ RelationArray.Put(n - 1, NodeStack.Pop());
+ }
+
+ SmStructureNode *pSNode = new SmExpressionNode(CurToken);
+ pSNode->SetSubNodes(RelationArray);
+ NodeStack.Push(pSNode);
+}
+
+
+void SmParser::Relation()
+{
+ Sum();
+ while (TokenInGroup(TGRELATION))
+ {
+ SmStructureNode *pSNode = new SmBinHorNode(CurToken);
+ SmNode *pFirst = NodeStack.Pop();
+
+ OpSubSup();
+ SmNode *pSecond = NodeStack.Pop();
+
+ Sum();
+
+ pSNode->SetSubNodes(pFirst, pSecond, NodeStack.Pop());
+ NodeStack.Push(pSNode);
+ }
+}
+
+
+void SmParser::Sum()
+{
+ Product();
+ while (TokenInGroup(TGSUM))
+ {
+ SmStructureNode *pSNode = new SmBinHorNode(CurToken);
+ SmNode *pFirst = NodeStack.Pop();
+
+ OpSubSup();
+ SmNode *pSecond = NodeStack.Pop();
+
+ Product();
+
+ pSNode->SetSubNodes(pFirst, pSecond, NodeStack.Pop());
+ NodeStack.Push(pSNode);
+ }
+}
+
+
+void SmParser::Product()
+{
+ Power();
+
+ while (TokenInGroup(TGPRODUCT))
+ { SmStructureNode *pSNode;
+ SmNode *pFirst = NodeStack.Pop(),
+ *pOper;
+ BOOL bSwitchArgs = FALSE;
+
+ SmTokenType eType = CurToken.eType;
+ switch (eType)
+ {
+ case TOVER:
+ pSNode = new SmBinVerNode(CurToken);
+ pOper = new SmRectangleNode(CurToken);
+ NextToken();
+ break;
+
+ case TBOPER:
+ pSNode = new SmBinHorNode(CurToken);
+
+ NextToken();
+
+ GlyphSpecial();
+ pOper = NodeStack.Pop();
+ break;
+
+ case TOVERBRACE :
+ case TUNDERBRACE :
+ pSNode = new SmVerticalBraceNode(CurToken);
+#ifdef USE_POLYGON
+ pOper = new SmPolygonNode(CurToken);
+#else
+ pOper = new SmMathSymbolNode(CurToken);
+#endif
+ NextToken();
+ break;
+
+ case TWIDEBACKSLASH:
+ case TWIDESLASH:
+ {
+ SmBinDiagonalNode *pSTmp = new SmBinDiagonalNode(CurToken);
+ pSTmp->SetAscending(eType == TWIDESLASH);
+ pSNode = pSTmp;
+
+ pOper = new SmPolyLineNode(CurToken);
+ NextToken();
+
+ bSwitchArgs =TRUE;
+ break;
+ }
+
+ default:
+ pSNode = new SmBinHorNode(CurToken);
+
+ OpSubSup();
+ pOper = NodeStack.Pop();
+ }
+
+ Power();
+
+ if (bSwitchArgs)
+ //! vgl siehe SmBinDiagonalNode::Arrange
+ pSNode->SetSubNodes(pFirst, NodeStack.Pop(), pOper);
+ else
+ pSNode->SetSubNodes(pFirst, pOper, NodeStack.Pop());
+ NodeStack.Push(pSNode);
+ }
+}
+
+
+void SmParser::SubSup(ULONG nActiveGroup)
+{
+ DBG_ASSERT(nActiveGroup == TGPOWER || nActiveGroup == TGLIMIT,
+ "Sm: falsche Tokengruppe");
+
+ if (!TokenInGroup(nActiveGroup))
+ // already finish
+ return;
+
+ SmSubSupNode *pNode = new SmSubSupNode(CurToken);
+ //! Of course 'CurToken' ist just the first sub-/supscript token.
+ //! It should be of no further interest. The positions of the
+ //! sub-/supscripts will be identified by the corresponding subnodes
+ //! index in the 'aSubNodes' array (enum value from 'SmSubSup').
+
+ pNode->SetUseLimits(nActiveGroup == TGLIMIT);
+
+ // initialize subnodes array
+ SmNodeArray aSubNodes;
+ aSubNodes.SetSize(1 + SUBSUP_NUM_ENTRIES);
+ aSubNodes.Put(0, NodeStack.Pop());
+ for (int i = 1; i < aSubNodes.GetSize(); i++)
+ aSubNodes.Put(i, NULL);
+
+ // process all sub-/supscripts
+ int nIndex;
+ while (TokenInGroup(nActiveGroup))
+ { SmTokenType eType (CurToken.eType);
+
+ // skip sub-/supscript token
+ NextToken();
+
+ // get sub-/supscript node on top of stack
+ if (eType == TFROM || eType == TTO)
+ {
+ // parse limits in old 4.0 and 5.0 style
+ Relation();
+ }
+ else
+ Term();
+
+ switch (eType)
+ { case TRSUB : nIndex = (int) RSUB; break;
+ case TRSUP : nIndex = (int) RSUP; break;
+ case TFROM :
+ case TCSUB : nIndex = (int) CSUB; break;
+ case TTO :
+ case TCSUP : nIndex = (int) CSUP; break;
+ case TLSUB : nIndex = (int) LSUB; break;
+ case TLSUP : nIndex = (int) LSUP; break;
+ default :
+ DBG_ASSERT(FALSE, "Sm: unbekannter Fall");
+ }
+ nIndex++;
+ DBG_ASSERT(1 <= nIndex && nIndex <= 1 + SUBSUP_NUM_ENTRIES,
+ "SmParser::Power() : sub-/supscript index falsch")
+
+ // set sub-/supscript if not already done
+ if (aSubNodes.Get(nIndex) != NULL)
+ Error(PE_DOUBLE_SUBSUPSCRIPT);
+ aSubNodes.Put(nIndex, NodeStack.Pop());
+ }
+
+ pNode->SetSubNodes(aSubNodes);
+ NodeStack.Push(pNode);
+}
+
+
+void SmParser::OpSubSup()
+{
+ // push operator symbol
+ NodeStack.Push(new SmMathSymbolNode(CurToken));
+ // skip operator token
+ NextToken();
+ // get sub- supscripts if any
+ if (TokenInGroup(TGPOWER))
+ SubSup(TGPOWER);
+}
+
+
+void SmParser::Power()
+{
+ // get body for sub- supscripts on top of stack
+ Term();
+
+ SubSup(TGPOWER);
+}
+
+
+void SmParser::Blank()
+{
+ DBG_ASSERT(TokenInGroup(TGBLANK), "Sm : falsches Token");
+ SmBlankNode *pBlankNode = new SmBlankNode(CurToken);
+
+ while (TokenInGroup(TGBLANK))
+ {
+ pBlankNode->IncreaseBy(CurToken);
+ NextToken();
+ }
+
+ // Blanks am Zeilenende ignorieren wenn die entsprechende Option gesetzt ist
+ if (CurToken.eType == TNEWLINE || CurToken.eType == TEND
+ && SM_MOD1()->GetConfig()->IsNoRightSpaces())
+ pBlankNode->Clear();
+
+ NodeStack.Push(pBlankNode);
+}
+
+
+void SmParser::Term()
+{
+ switch (CurToken.eType)
+ { case TESCAPE :
+ Escape();
+ break;
+
+ case TLGROUP :
+ NextToken();
+
+ // allow for empty group
+ if (CurToken.eType == TRGROUP)
+ { SmStructureNode *pSNode = new SmExpressionNode(CurToken);
+ pSNode->SetSubNodes(NULL, NULL);
+ NodeStack.Push(pSNode);
+
+ NextToken();
+ }
+ else // go as usual
+ { Align();
+ if (CurToken.eType != TRGROUP)
+ Error(PE_RGROUP_EXPECTED);
+ else
+ { NextToken();
+ }
+ }
+ break;
+
+ case TLEFT :
+ Brace();
+ break;
+
+ case TBLANK :
+ case TSBLANK :
+ Blank();
+ break;
+
+ case TTEXT :
+ NodeStack.Push(new SmTextNode(CurToken, FNT_TEXT));
+ NextToken();
+ break;
+ case TIDENT :
+ NodeStack.Push(new SmTextNode(CurToken, FNT_VARIABLE));
+ NextToken();
+ break;
+ case TNUMBER :
+ NodeStack.Push(new SmTextNode(CurToken, FNT_NUMBER));
+ NextToken();
+ break;
+
+ case TLEFTARROW :
+ case TRIGHTARROW :
+ case TUPARROW :
+ case TDOWNARROW :
+ case TSETN :
+ case TSETZ :
+ case TSETQ :
+ case TSETR :
+ case TSETC :
+ case THBAR :
+ case TLAMBDABAR :
+ case TCIRC :
+ case TDRARROW :
+ case TDLARROW :
+ case TDLRARROW :
+ case TBACKEPSILON :
+ case TALEPH :
+ case TIM :
+ case TRE :
+ case TWP :
+ case TEMPTYSET :
+ case TINFINITY :
+ case TEXISTS :
+ case TFORALL :
+ case TPARTIAL :
+ case TNABLA :
+ case TTOWARD :
+ case TDOTSAXIS :
+ case TDOTSDIAG :
+ case TDOTSDOWN :
+ case TDOTSLOW :
+ case TDOTSUP :
+ case TDOTSVERT :
+ NodeStack.Push(new SmMathSymbolNode(CurToken));
+ NextToken();
+ break;
+
+ case TPLACE:
+ NodeStack.Push(new SmPlaceNode(CurToken));
+ NextToken();
+ break;
+
+ case TSPECIAL:
+ Special();
+ break;
+
+ case TBINOM:
+ Binom();
+ break;
+
+ case TSTACK:
+ Stack();
+ break;
+
+ case TMATRIX:
+ Matrix();
+ break;
+
+ default:
+ if (TokenInGroup(TGLBRACES))
+ { Brace();
+ }
+ else if (TokenInGroup(TGOPER))
+ { Operator();
+ }
+ else if (TokenInGroup(TGUNOPER))
+ { UnOper();
+ }
+ else if ( TokenInGroup(TGATTRIBUT)
+ || TokenInGroup(TGFONTATTR))
+ { SmStructureNodeArray aArray;
+
+ BOOL bIsAttr;
+ USHORT n = 0;
+ while ((bIsAttr = TokenInGroup(TGATTRIBUT))
+ || TokenInGroup(TGFONTATTR))
+ { aArray.SetSize(n + 1);
+
+ if (bIsAttr)
+ Attribut();
+ else
+ FontAttribut();
+
+ // check if casting in following line is ok
+ DBG_ASSERT(!NodeStack.Top()->IsVisible(), "Sm : Ooops...");
+
+ aArray.Put(n, (SmStructureNode *) NodeStack.Pop());
+ n++;
+ }
+
+ Power();
+
+ SmNode *pFirstNode = NodeStack.Pop();
+ while (n > 0)
+ { aArray.Get(n - 1)->SetSubNodes(0, pFirstNode);
+ pFirstNode = aArray.Get(n - 1);
+ n--;
+ }
+ NodeStack.Push(pFirstNode);
+ }
+ else if (TokenInGroup(TGFUNCTION))
+ { if (!IsConvert40To50())
+ { Function();
+ }
+ else // encapsulate old 4.0 style parsing in braces
+ {
+ // insert opening brace
+ Insert('{', GetTokenIndex());
+
+ //
+ // parse in 4.0 style
+ //
+ Function();
+
+ SmNode *pFunc = NodeStack.Pop();
+
+ if (CurToken.eType == TLPARENT)
+ { Term();
+ }
+ else
+ { Align();
+ }
+
+ // insert closing brace
+ Insert('}', GetTokenIndex());
+
+ SmStructureNode *pSNode = new SmExpressionNode(pFunc->GetToken());
+ pSNode->SetSubNodes(pFunc, NodeStack.Pop());
+ NodeStack.Push(pSNode);
+ }
+ }
+ else
+ Error(PE_UNEXPECTED_CHAR);
+ }
+}
+
+
+void SmParser::Escape()
+{
+ NextToken();
+
+ xub_Unicode cChar;
+ switch (CurToken.eType)
+ { case TLPARENT : cChar = MS_LPARENT; break;
+ case TRPARENT : cChar = MS_RPARENT; break;
+ case TLBRACKET : cChar = MS_LBRACKET; break;
+ case TRBRACKET : cChar = MS_RBRACKET; break;
+ case TLBRACE :
+ case TLGROUP : cChar = MS_LBRACE; break;
+ case TRBRACE :
+ case TRGROUP : cChar = MS_RBRACE; break;
+ case TLANGLE : cChar = MS_LANGLE; break;
+ case TRANGLE : cChar = MS_RANGLE; break;
+ case TLCEIL : cChar = MS_LCEIL; break;
+ case TRCEIL : cChar = MS_RCEIL; break;
+ case TLFLOOR : cChar = MS_LFLOOR; break;
+ case TRFLOOR : cChar = MS_RFLOOR; break;
+ case TLLINE :
+ case TRLINE : cChar = MS_LINE; break;
+ case TLDLINE :
+ case TRDLINE : cChar = MS_DLINE; break;
+ default:
+ Error(PE_UNEXPECTED_TOKEN);
+ }
+
+ SmNode *pNode = new SmMathSymbolNode(CurToken);
+ NodeStack.Push(pNode);
+
+ NextToken();
+}
+
+
+void SmParser::Operator()
+{
+ if (TokenInGroup(TGOPER))
+ { SmStructureNode *pSNode = new SmOperNode(CurToken);
+
+ // put operator on top of stack
+ Oper();
+
+ if (TokenInGroup(TGLIMIT) || TokenInGroup(TGPOWER))
+ SubSup(CurToken.nGroup);
+ SmNode *pOperator = NodeStack.Pop();
+
+ // get argument
+ Power();
+
+ pSNode->SetSubNodes(pOperator, NodeStack.Pop());
+ NodeStack.Push(pSNode);
+ }
+}
+
+
+void SmParser::Oper()
+{
+ SmTokenType eType (CurToken.eType);
+ SmNode *pNode = NULL;
+
+ switch (eType)
+ {
+ case TSUM :
+ case TPROD :
+ case TCOPROD :
+ case TINT :
+ case TIINT :
+ case TIIINT :
+ case TLINT :
+ case TLLINT :
+ case TLLLINT :
+ pNode = new SmMathSymbolNode(CurToken);
+ break;
+
+ case TLIM :
+ case TLIMSUP :
+ case TLIMINF :
+ {
+ const sal_Char* pLim = 0;
+ switch (eType)
+ {
+ case TLIM : pLim = "lim"; break;
+ case TLIMSUP : pLim = "lim sup"; break;
+ case TLIMINF : pLim = "lim inf"; break;
+ }
+ if( pLim )
+ CurToken.aText.AssignAscii( pLim );
+ pNode = new SmTextNode(CurToken, FNT_TEXT);
+ }
+ break;
+
+ case TOVERBRACE :
+ case TUNDERBRACE :
+#ifdef USE_POLYGON
+ pNode = new SmPolygonNode(CurToken);
+#else
+ pNode = new SmMathSymbolNode(CurToken);
+#endif
+ break;
+
+ case TOPER :
+ NextToken();
+
+ DBG_ASSERT(CurToken.eType == TSPECIAL, "Sm: falsches Token");
+ pNode = new SmGlyphSpecialNode(CurToken);
+ break;
+
+ default :
+ DBG_ASSERT(0, "Sm: unbekannter Fall");
+ }
+ NodeStack.Push(pNode);
+
+ NextToken();
+}
+
+
+void SmParser::UnOper()
+{
+ DBG_ASSERT(TokenInGroup(TGUNOPER), "Sm: falsches Token");
+
+ SmToken aNodeToken = CurToken;
+ SmTokenType eType = CurToken.eType;
+ BOOL bIsPostfix = eType == TFACT;
+
+ SmStructureNode *pSNode;
+ SmNode *pOper,
+ *pExtra = 0,
+ *pArg;
+
+ switch (eType)
+ {
+ case TABS :
+ case TSQRT :
+ NextToken();
+ break;
+
+ case TNROOT :
+ NextToken();
+ Power();
+ pExtra = NodeStack.Pop();
+ break;
+
+ case TUOPER :
+ NextToken();
+ GlyphSpecial();
+ pOper = NodeStack.Pop();
+ break;
+
+ case TPLUS :
+ case TMINUS :
+ case TPLUSMINUS :
+ case TMINUSPLUS :
+ case TNEG :
+ case TFACT :
+ OpSubSup();
+ pOper = NodeStack.Pop();
+ break;
+
+ default :
+ Error(PE_UNOPER_EXPECTED);
+ }
+
+ // get argument
+ Power();
+ pArg = NodeStack.Pop();
+
+ if (eType == TABS)
+ { pSNode = new SmBraceNode(aNodeToken);
+ pSNode->SetScaleMode(SCALE_HEIGHT);
+
+ // build nodes for left & right lines
+ // (text, group, level of the used token are of no interrest here)
+ // we'll use row & column of the keyword for abs
+ aNodeToken.eType = TABS;
+ //
+ aNodeToken.cMathChar = MS_LINE;
+#ifdef USE_POLYGON
+ SmNode* pLeft = new SmPolygonNode(aNodeToken);
+#else
+ SmNode* pLeft = new SmMathSymbolNode(aNodeToken);
+#endif
+ //
+ aNodeToken.cMathChar = MS_LINE;
+#ifdef USE_POLYGON
+ SmNode* pRight = new SmPolygonNode(aNodeToken);
+#else
+ SmNode* pRight = new SmMathSymbolNode(aNodeToken);
+#endif
+
+ pSNode->SetSubNodes(pLeft, pArg, pRight);
+ }
+ else if (eType == TSQRT || eType == TNROOT)
+ { pSNode = new SmRootNode(aNodeToken);
+ pOper = new SmRootSymbolNode(aNodeToken);
+ pSNode->SetSubNodes(pExtra, pOper, pArg);
+ }
+ else
+ { pSNode = new SmUnHorNode(aNodeToken);
+
+ if (bIsPostfix)
+ pSNode->SetSubNodes(pArg, pOper);
+ else
+ // prefix operator
+ pSNode->SetSubNodes(pOper, pArg);
+ }
+
+ NodeStack.Push(pSNode);
+}
+
+
+void SmParser::Attribut()
+{
+ DBG_ASSERT(TokenInGroup(TGATTRIBUT), "Sm: falsche Tokengruppe");
+
+ SmStructureNode *pSNode = new SmAttributNode(CurToken);
+ SmNode *pAttr;
+ SmScaleMode eScaleMode = SCALE_NONE;
+
+ // get appropriate node for the attribut itself
+ switch (CurToken.eType)
+ { case TUNDERLINE :
+ case TOVERLINE :
+ case TOVERSTRIKE :
+ pAttr = new SmRectangleNode(CurToken);
+ eScaleMode = SCALE_WIDTH;
+ break;
+
+ case TWIDEVEC :
+ case TWIDEHAT :
+ case TWIDETILDE :
+#ifdef USE_POLYGON
+ pAttr = new SmPolygonNode(CurToken);
+#else
+ pAttr = new SmMathSymbolNode(CurToken);
+#endif
+ eScaleMode = SCALE_WIDTH;
+ break;
+
+ default :
+ pAttr = new SmMathSymbolNode(CurToken);
+ }
+
+ NextToken();
+
+ pSNode->SetSubNodes(pAttr, 0);
+ pSNode->SetScaleMode(eScaleMode);
+ NodeStack.Push(pSNode);
+}
+
+
+void SmParser::FontAttribut()
+{
+ DBG_ASSERT(TokenInGroup(TGFONTATTR), "Sm: falsche Tokengruppe");
+
+ switch (CurToken.eType)
+ {
+ case TITALIC :
+ case TNITALIC :
+ case TBOLD :
+ case TNBOLD :
+ case TPHANTOM :
+ NodeStack.Push(new SmFontNode(CurToken));
+ NextToken();
+ break;
+
+ case TSIZE :
+ FontSize();
+ break;
+
+ case TFONT :
+ Font();
+ break;
+
+ case TCOLOR :
+ Color();
+ break;
+
+ default :
+ DBG_ASSERT(0, "Sm: unbekannter Fall");
+ }
+}
+
+
+void SmParser::Color()
+{
+ DBG_ASSERT(CurToken.eType == TCOLOR, "Sm : Ooops...");
+
+ // last color rules, get that one
+ SmToken aToken;
+ do
+ { NextToken();
+
+ if (TokenInGroup(TGCOLOR))
+ { aToken = CurToken;
+ NextToken();
+ }
+ else
+ Error(PE_COLOR_EXPECTED);
+ } while (CurToken.eType == TCOLOR);
+
+ NodeStack.Push(new SmFontNode(aToken));
+}
+
+
+void SmParser::Font()
+{
+ DBG_ASSERT(CurToken.eType == TFONT, "Sm : Ooops...");
+
+ // last font rules, get that one
+ SmToken aToken;
+ do
+ { NextToken();
+
+ if (TokenInGroup(TGFONT))
+ { aToken = CurToken;
+ NextToken();
+ }
+ else
+ Error(PE_FONT_EXPECTED);
+ } while (CurToken.eType == TFONT);
+
+ NodeStack.Push(new SmFontNode(aToken));
+}
+BOOL lcl_IsNumber(const UniString& rText)
+{
+ BOOL bPoint = FALSE;
+ const sal_Unicode* pBuffer = rText.GetBuffer();
+ for(xub_StrLen nPos = 0; nPos < rText.Len(); nPos++, pBuffer++)
+ {
+ const sal_Unicode cChar = *pBuffer;
+ if(cChar == '.')
+ {
+ if(bPoint)
+ return FALSE;
+ else
+ bPoint = TRUE;
+ }
+ else if ( (cChar < 48) || (cChar > 57) )
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void SmParser::FontSize()
+{
+ DBG_ASSERT(CurToken.eType == TSIZE, "Sm : Ooops...");
+
+ USHORT Type;
+ SmFontNode *pFontNode = new SmFontNode(CurToken);
+
+ NextToken();
+
+ switch (CurToken.eType)
+ {
+ case TNUMBER: Type = FNTSIZ_ABSOLUT; break;
+ case TPLUS: Type = FNTSIZ_PLUS; break;
+ case TMINUS: Type = FNTSIZ_MINUS; break;
+ case TMULTIPLY: Type = FNTSIZ_MULTIPLY; break;
+ case TDIVIDEBY: Type = FNTSIZ_DIVIDE; break;
+
+ default:
+ delete pFontNode;
+ Error(PE_SIZE_EXPECTED);
+ return;
+ }
+
+ if (Type != FNTSIZ_ABSOLUT)
+ {
+ NextToken();
+ if (CurToken.eType != TNUMBER)
+ {
+ delete pFontNode;
+ Error(PE_SIZE_EXPECTED);
+ return;
+ }
+ }
+
+ // get number argument
+ double fTmp;
+ Fraction aValue;
+ if(lcl_IsNumber(CurToken.aText) &&
+ sscanf(ByteString(CurToken.aText, RTL_TEXTENCODING_ASCII_US).GetBuffer(), "%lf", &fTmp) == 1)
+ aValue = fTmp;
+
+ NextToken();
+
+ pFontNode->SetSizeParameter(aValue, Type);
+ NodeStack.Push(pFontNode);
+}
+
+
+void SmParser::Brace()
+{
+ DBG_ASSERT(CurToken.eType == TLEFT || TokenInGroup(TGLBRACES),
+ "Sm: kein Klammer Ausdruck");
+
+ SmStructureNode *pSNode = new SmBraceNode(CurToken);
+ SmNode *pBody = 0,
+ *pLeft = 0,
+ *pRight = 0;
+ SmScaleMode eScaleMode = SCALE_NONE;
+ SmParseError eError = PE_NONE;
+
+ if (CurToken.eType == TLEFT)
+ { NextToken();
+
+ eScaleMode = SCALE_HEIGHT;
+
+ // check for left bracket
+ if (TokenInGroup(TGLBRACES) || TokenInGroup(TGRBRACES))
+ {
+#ifdef USE_POLYGON
+ pLeft = new SmPolygonNode(CurToken);
+#else
+ pLeft = new SmMathSymbolNode(CurToken);
+#endif
+ NextToken();
+ Bracebody(TRUE);
+ pBody = NodeStack.Pop();
+
+ if (CurToken.eType == TRIGHT)
+ { NextToken();
+
+ // check for right bracket
+ if (TokenInGroup(TGLBRACES) || TokenInGroup(TGRBRACES))
+ {
+#ifdef USE_POLYGON
+ pRight = new SmPolygonNode(CurToken);
+#else
+ pRight = new SmMathSymbolNode(CurToken);
+#endif
+ NextToken();
+ }
+ else
+ eError = PE_RBRACE_EXPECTED;
+ }
+ else
+ eError = PE_RIGHT_EXPECTED;
+ }
+ else
+ eError = PE_LBRACE_EXPECTED;
+ }
+ else
+ {
+ if (TokenInGroup(TGLBRACES))
+ {
+#ifdef USE_POLYGON
+ pLeft = new SmPolygonNode(CurToken);
+#else
+ pLeft = new SmMathSymbolNode(CurToken);
+#endif
+ NextToken();
+ Bracebody(FALSE);
+ pBody = NodeStack.Pop();
+
+ SmTokenType eExpectedType;
+ switch (pLeft->GetToken().eType)
+ { case TLPARENT : eExpectedType = TRPARENT; break;
+ case TLBRACKET : eExpectedType = TRBRACKET; break;
+ case TLBRACE : eExpectedType = TRBRACE; break;
+ case TLDBRACKET : eExpectedType = TRDBRACKET; break;
+ case TLLINE : eExpectedType = TRLINE; break;
+ case TLDLINE : eExpectedType = TRDLINE; break;
+ case TLANGLE : eExpectedType = TRANGLE; break;
+ case TLFLOOR : eExpectedType = TRFLOOR; break;
+ case TLCEIL : eExpectedType = TRCEIL; break;
+ default :
+ DBG_ASSERT(0, "Sm: unbekannter Fall");
+ }
+
+ if (CurToken.eType == eExpectedType)
+ {
+#ifdef USE_POLYGON
+ pRight = new SmPolygonNode(CurToken);
+#else
+ pRight = new SmMathSymbolNode(CurToken);
+#endif
+ NextToken();
+ }
+ else
+ eError = PE_PARENT_MISMATCH;
+ }
+ else
+ eError = PE_LBRACE_EXPECTED;
+ }
+
+ if (eError == PE_NONE)
+ { DBG_ASSERT(pLeft, "Sm: NULL pointer");
+ DBG_ASSERT(pRight, "Sm: NULL pointer");
+ pSNode->SetSubNodes(pLeft, pBody, pRight);
+ pSNode->SetScaleMode(eScaleMode);
+ NodeStack.Push(pSNode);
+ }
+ else
+ { delete pSNode;
+ delete pBody;
+ delete pLeft;
+ delete pRight;
+
+ Error(eError);
+ }
+}
+
+
+void SmParser::Bracebody(BOOL bIsLeftRight)
+{
+ SmStructureNode *pBody = new SmBracebodyNode(CurToken);
+ SmNodeArray aNodes;
+ USHORT nNum = 0;
+
+ // get body if any
+ if (bIsLeftRight)
+ {
+ do
+ {
+ if (CurToken.eType == TMLINE)
+ {
+#ifdef USE_POLYGON
+ NodeStack.Push(new SmPolygonNode(CurToken));
+#else
+ NodeStack.Push(new SmMathSymbolNode(CurToken));
+#endif
+ NextToken();
+ nNum++;
+ }
+ else if (CurToken.eType != TRIGHT)
+ { Align();
+ nNum++;
+
+ if (CurToken.eType != TMLINE && CurToken.eType != TRIGHT)
+ Error(PE_RIGHT_EXPECTED);
+ }
+ } while (CurToken.eType != TEND && CurToken.eType != TRIGHT);
+ }
+ else
+ {
+ do
+ {
+ if (CurToken.eType == TMLINE)
+ {
+#ifdef USE_POLYGON
+ NodeStack.Push(new SmPolygonNode(CurToken));
+#else
+ NodeStack.Push(new SmMathSymbolNode(CurToken));
+#endif
+ NextToken();
+ nNum++;
+ }
+ else if (!TokenInGroup(TGRBRACES))
+ { Align();
+ nNum++;
+
+ if (CurToken.eType != TMLINE && !TokenInGroup(TGRBRACES))
+ Error(PE_RBRACE_EXPECTED);
+ }
+ } while (CurToken.eType != TEND && !TokenInGroup(TGRBRACES));
+ }
+
+ // build argument vector in parsing order
+ aNodes.SetSize(nNum);
+ for (USHORT i = 0; i < nNum; i++)
+ aNodes.Put(nNum - 1 - i, NodeStack.Pop());
+
+ pBody->SetSubNodes(aNodes);
+ pBody->SetScaleMode(bIsLeftRight ? SCALE_HEIGHT : SCALE_NONE);
+ NodeStack.Push(pBody);
+}
+
+
+void SmParser::Function()
+{
+ switch (CurToken.eType)
+ {
+ case TFUNC:
+ NextToken(); // skip "FUNC"-statement
+ // fall through
+
+ case TSIN :
+ case TCOS :
+ case TTAN :
+ case TCOT :
+ case TASIN :
+ case TACOS :
+ case TATAN :
+ case TACOT :
+ case TSINH :
+ case TCOSH :
+ case TTANH :
+ case TCOTH :
+ case TASINH :
+ case TACOSH :
+ case TATANH :
+ case TACOTH :
+ case TLN :
+ case TLOG :
+ case TEXP :
+ NodeStack.Push(new SmTextNode(CurToken, FNT_FUNCTION));
+ NextToken();
+ break;
+
+ default:
+ Error(PE_FUNC_EXPECTED);
+ }
+}
+
+
+void SmParser::Binom()
+{
+ SmNodeArray ExpressionArray;
+ SmStructureNode *pSNode = new SmTableNode(CurToken);
+
+ NextToken();
+
+ Sum();
+ Sum();
+
+ ExpressionArray.SetSize(2);
+
+ for (int i = 0; i < 2; i++)
+ ExpressionArray.Put(2 - (i + 1), NodeStack.Pop());
+
+ pSNode->SetSubNodes(ExpressionArray);
+ NodeStack.Push(pSNode);
+}
+
+
+void SmParser::Stack()
+{
+ SmNodeArray ExpressionArray;
+ NextToken();
+ if (CurToken.eType == TLGROUP)
+ {
+ USHORT n = 0;
+
+ do
+ {
+ NextToken();
+ Align();
+ n++;
+ }
+ while (CurToken.eType == TPOUND);
+
+ ExpressionArray.SetSize(n);
+
+ for (USHORT i = 0; i < n; i++)
+ ExpressionArray.Put(n - (i + 1), NodeStack.Pop());
+
+ if (CurToken.eType != TRGROUP)
+ Error(PE_RGROUP_EXPECTED);
+
+ NextToken();
+
+ SmStructureNode *pSNode = new SmTableNode(CurToken);
+ pSNode->SetSubNodes(ExpressionArray);
+ NodeStack.Push(pSNode);
+ }
+ else
+ Error(PE_LGROUP_EXPECTED);
+}
+
+
+void SmParser::Matrix()
+{
+ SmNodeArray ExpressionArray;
+
+ NextToken();
+ if (CurToken.eType == TLGROUP)
+ {
+ USHORT c = 0;
+
+ do
+ {
+ NextToken();
+ Align();
+ c++;
+ }
+ while (CurToken.eType == TPOUND);
+
+ USHORT r = 1;
+
+ while (CurToken.eType == TDPOUND)
+ {
+ NextToken();
+ for (USHORT i = 0; i < c; i++)
+ {
+ Align();
+ if (i < (c - 1))
+ {
+ if (CurToken.eType == TPOUND)
+ {
+ NextToken();
+ }
+ else
+ Error(PE_POUND_EXPECTED);
+ }
+ }
+
+ r++;
+ }
+
+ long nRC = r * c;
+
+ ExpressionArray.SetSize(nRC);
+
+ for (USHORT i = 0; i < (nRC); i++)
+ ExpressionArray.Put((nRC) - (i + 1), NodeStack.Pop());
+
+ if (CurToken.eType != TRGROUP)
+ Error(PE_RGROUP_EXPECTED);
+
+ NextToken();
+
+ SmMatrixNode *pMNode = new SmMatrixNode(CurToken);
+ pMNode->SetSubNodes(ExpressionArray);
+ pMNode->SetRowCol(r, c);
+ NodeStack.Push(pMNode);
+ }
+ else
+ Error(PE_LGROUP_EXPECTED);
+}
+
+
+void SmParser::Special()
+{
+ NodeStack.Push(new SmSpecialNode(CurToken));
+ NextToken();
+}
+
+
+void SmParser::GlyphSpecial()
+{
+ NodeStack.Push(new SmGlyphSpecialNode(CurToken));
+ NextToken();
+}
+
+
+void SmParser::Error(SmParseError eError)
+{
+ SmStructureNode *pSNode = new SmExpressionNode(CurToken);
+ SmErrorNode *pErr = new SmErrorNode(eError, CurToken);
+ pSNode->SetSubNodes(pErr, 0);
+
+ //! put a structure node on the stack (instead of the error node itself)
+ //! because sometimes such a node is expected in order to attach some
+ //! subnodes
+ NodeStack.Push(pSNode);
+
+ AddError(eError, pSNode);
+
+ NextToken();
+}
+
+
+// end gramar
+
+
+SmParser::SmParser()
+{
+ switch (GetSystemLineEnd())
+ {
+ case LINEEND_CRLF:
+ case LINEEND_LF: CharLineEnd = '\n'; break;
+ case LINEEND_CR: CharLineEnd = '\r'; break;
+
+ default:
+ CharLineEnd = '\n';
+ break;
+ }
+
+ bConvert40To50 = FALSE;
+}
+
+
+BOOL SmParser::CheckSyntax(const XubString &rBuffer)
+{
+ SmErrDescList OldErrorList;
+
+ BufferString = rBuffer;
+ BufferIndex =
+ nTokenIndex = 0;
+ Row =
+ Column = 1;
+
+ NodeStack.Clear();
+
+ OldErrorList = ErrDescList;
+ ErrDescList.Clear();
+
+ NextToken();
+ Table();
+
+ delete NodeStack.Pop();
+
+ if (ErrDescList.Count() > 0)
+ {
+ for (int i = 0; i < ErrDescList.Count(); i++)
+ delete ErrDescList.Remove(i);
+
+ ErrDescList = OldErrorList;
+
+ return (FALSE);
+ }
+ ErrDescList = OldErrorList;
+
+ return (TRUE);
+}
+
+
+SmNode *SmParser::Parse(const XubString &rBuffer)
+{
+ BufferString = rBuffer;
+ BufferIndex =
+ nTokenIndex = 0;
+ Row =
+ Column = 1;
+ CurError = -1;
+
+ for (int i = 0; i < ErrDescList.Count(); i++)
+ delete ErrDescList.Remove(i);
+
+ ErrDescList.Clear();
+
+ NodeStack.Clear();
+
+ NextToken();
+ Table();
+
+ return NodeStack.Pop();
+}
+
+
+USHORT SmParser::AddError(SmParseError Type, SmNode *pNode)
+{
+ SmErrorDesc *pErrDesc = new SmErrorDesc;
+
+ pErrDesc->Type = Type;
+ pErrDesc->pNode = pNode;
+ pErrDesc->Text = XubString(SmResId(RID_ERR_IDENT));
+
+ USHORT nRID;
+ switch (Type)
+ {
+ case PE_UNEXPECTED_CHAR: nRID = RID_ERR_UNEXPECTEDCHARACTER; break;
+ case PE_LGROUP_EXPECTED: nRID = RID_ERR_LGROUPEXPECTED; break;
+ case PE_RGROUP_EXPECTED: nRID = RID_ERR_RGROUPEXPECTED; break;
+ case PE_LBRACE_EXPECTED: nRID = RID_ERR_LBRACEEXPECTED; break;
+ case PE_RBRACE_EXPECTED: nRID = RID_ERR_RBRACEEXPECTED; break;
+ case PE_FUNC_EXPECTED: nRID = RID_ERR_FUNCEXPECTED; break;
+ case PE_UNOPER_EXPECTED: nRID = RID_ERR_UNOPEREXPECTED; break;
+ case PE_BINOPER_EXPECTED: nRID = RID_ERR_BINOPEREXPECTED; break;
+ case PE_SYMBOL_EXPECTED: nRID = RID_ERR_SYMBOLEXPECTED; break;
+ case PE_IDENTIFIER_EXPECTED: nRID = RID_ERR_IDENTEXPECTED; break;
+ case PE_POUND_EXPECTED: nRID = RID_ERR_POUNDEXPECTED; break;
+ case PE_COLOR_EXPECTED: nRID = RID_ERR_COLOREXPECTED; break;
+ case PE_RIGHT_EXPECTED: nRID = RID_ERR_RIGHTEXPECTED; break;
+
+ default:
+ nRID = RID_ERR_UNKOWN;
+ }
+ pErrDesc->Text += SmResId(nRID);
+
+ ErrDescList.Insert(pErrDesc);
+
+ return ErrDescList.GetPos(pErrDesc);
+}
+
+
+const SmErrorDesc *SmParser::NextError()
+{
+ if (ErrDescList.Count())
+ if (CurError > 0) return ErrDescList.Seek(--CurError);
+ else
+ {
+ CurError = 0;
+ return ErrDescList.Seek(CurError);
+ }
+ else return 0;
+}
+
+
+const SmErrorDesc *SmParser::PrevError()
+{
+ if (ErrDescList.Count())
+ if (CurError < (int) (ErrDescList.Count() - 1)) return ErrDescList.Seek(++CurError);
+ else
+ {
+ CurError = (int) (ErrDescList.Count() - 1);
+ return ErrDescList.Seek(CurError);
+ }
+ else return 0;
+}
+
+
+const SmErrorDesc *SmParser::GetError(USHORT i)
+{
+ return (i >= 0 && i < ErrDescList.Count())
+ ? ErrDescList.Seek(i)
+ : ErrDescList.Seek(CurError);
+}
+
+
diff --git a/starmath/source/rect.cxx b/starmath/source/rect.cxx
new file mode 100644
index 000000000000..12853c07189c
--- /dev/null
+++ b/starmath/source/rect.cxx
@@ -0,0 +1,908 @@
+/*************************************************************************
+ *
+ * $RCSfile: rect.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:57:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX //autogen
+#include <vcl/wrkwin.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX //autogen
+#include <vcl/virdev.hxx>
+#endif
+
+
+#include "rect.hxx"
+#include "types.hxx"
+#include "xchar.hxx"
+#include "utility.hxx"
+#include "smmod.hxx"
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+
+// '\0' terminiertes Array mit Zeichen, die im StarMath Font als Buchstaben
+// betrachtet werden sollen, (um im Gegensatz zu den anderen Operatoren
+// und Symbolen ein "normales"(ungecliptes) SmRect zu erhalten).
+static xub_Unicode __READONLY_DATA aMathAlpha[] =
+{
+ MS_ALEPH, MS_IM, MS_RE, MS_WP,
+ xub_Unicode('\x70'), MS_EMPTYSET, xub_Unicode('\xF0'), xub_Unicode('\xF1'),
+ xub_Unicode('\xF2'), xub_Unicode('\xF3'), xub_Unicode('\xF4'), MS_HBAR,
+ MS_LAMBDABAR, MS_SETN, MS_SETZ, MS_SETQ,
+ MS_SETR, MS_SETC, xub_Unicode('\xB4'), xub_Unicode('\xB5'),
+ xub_Unicode('\xB8'), xub_Unicode('\xB9'), xub_Unicode('\xBA'),
+ xub_Unicode('\0')
+};
+
+BOOL SmIsMathAlpha(const XubString &rText)
+ // ergibt genau dann TRUE, wenn das Zeichen (aus dem StarMath Font) wie ein
+ // Buchstabe behandelt werden soll.
+{
+ if (rText.Len() == 0)
+ return FALSE;
+
+ DBG_ASSERT(rText.Len() == 1, "Sm : String enth鋖t nicht genau ein Zeichen");
+ xub_Unicode cChar = rText.GetChar(0);
+
+ // ist es ein griechisches Zeichen ?
+ if (xub_Unicode('\xC6') <= cChar && cChar <= xub_Unicode('\xEE'))
+ return TRUE;
+ else
+ {
+ // kommt es in 'aMathAlpha' vor ?
+ const xub_Unicode *pChar = aMathAlpha;
+ while (*pChar && *pChar != cChar)
+ pChar++;
+ return *pChar != xub_Unicode('\0');
+ }
+}
+
+
+////////////////////////////////////////
+//
+// SmRect members
+//
+
+
+SmRect::SmRect()
+ // constructs empty rectangle at (0, 0) with width and height 0.
+{
+ DBG_ASSERT(aTopLeft == Point(0, 0), "Sm: ooops...");
+ DBG_ASSERT(aSize == Size(0, 0), "Sm: ooops...");
+
+ bHasBaseline = bHasAlignInfo = FALSE;
+ nBaseline = nAlignT = nAlignM = nAlignB =
+ nGlyphTop = nGlyphBottom =
+ nItalicLeftSpace = nItalicRightSpace =
+ nLoAttrFence = nHiAttrFence = 0;
+}
+
+
+SmRect::SmRect(const SmRect &rRect)
+: aTopLeft(rRect.aTopLeft),
+ aSize(rRect.aSize)
+{
+ bHasBaseline = rRect.bHasBaseline;
+ nBaseline = rRect.nBaseline;
+ nAlignT = rRect.nAlignT;
+ nAlignM = rRect.