summaryrefslogtreecommitdiff
path: root/binfilter/bf_starmath/source
diff options
context:
space:
mode:
Diffstat (limited to 'binfilter/bf_starmath/source')
-rw-r--r--binfilter/bf_starmath/source/cfgitem.hxx250
-rw-r--r--binfilter/bf_starmath/source/makefile.mk103
-rw-r--r--binfilter/bf_starmath/source/mathml.hxx427
-rw-r--r--binfilter/bf_starmath/source/mathtype.hxx148
-rw-r--r--binfilter/bf_starmath/source/starmath_cfgitem.cxx996
-rw-r--r--binfilter/bf_starmath/source/starmath_command.cxx81
-rw-r--r--binfilter/bf_starmath/source/starmath_commands.src93
-rw-r--r--binfilter/bf_starmath/source/starmath_config.cxx80
-rw-r--r--binfilter/bf_starmath/source/starmath_document.cxx934
-rw-r--r--binfilter/bf_starmath/source/starmath_format.cxx405
-rw-r--r--binfilter/bf_starmath/source/starmath_mathml.cxx4174
-rw-r--r--binfilter/bf_starmath/source/starmath_node.cxx2468
-rw-r--r--binfilter/bf_starmath/source/starmath_parse.cxx2376
-rw-r--r--binfilter/bf_starmath/source/starmath_rect.cxx743
-rw-r--r--binfilter/bf_starmath/source/starmath_register.cxx280
-rw-r--r--binfilter/bf_starmath/source/starmath_smdll.cxx91
-rw-r--r--binfilter/bf_starmath/source/starmath_smlib.cxx320
-rw-r--r--binfilter/bf_starmath/source/starmath_smmod.cxx263
-rw-r--r--binfilter/bf_starmath/source/starmath_smres.src810
-rw-r--r--binfilter/bf_starmath/source/starmath_symbol.cxx393
-rw-r--r--binfilter/bf_starmath/source/starmath_symbol.src2246
-rw-r--r--binfilter/bf_starmath/source/starmath_typemap.cxx154
-rw-r--r--binfilter/bf_starmath/source/starmath_unodoc.cxx82
-rw-r--r--binfilter/bf_starmath/source/starmath_unomodel.cxx905
-rw-r--r--binfilter/bf_starmath/source/starmath_utility.cxx420
-rw-r--r--binfilter/bf_starmath/source/starmath_xchar.cxx265
26 files changed, 19507 insertions, 0 deletions
diff --git a/binfilter/bf_starmath/source/cfgitem.hxx b/binfilter/bf_starmath/source/cfgitem.hxx
new file mode 100644
index 000000000000..33996009fc4d
--- /dev/null
+++ b/binfilter/bf_starmath/source/cfgitem.hxx
@@ -0,0 +1,250 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#ifndef _MATH_CFGITEM_HXX_
+#define _MATH_CFGITEM_HXX_
+
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <com/sun/star/uno/Any.h>
+
+#include <tools/solar.h>
+
+#include <rtl/ustring.hxx>
+#include <unotools/configitem.hxx>
+#include <bf_svtools/svarray.hxx>
+#include <vcl/timer.hxx>
+
+#include <symbol.hxx>
+#include <types.hxx>
+class Font;
+namespace binfilter {
+
+using namespace ::com::sun::star;
+
+class SmSym;
+class SmFormat;
+
+struct SmCfgOther;
+
+/////////////////////////////////////////////////////////////////
+
+class SmMathConfigItem : public ::utl::ConfigItem
+{
+ // disallow copy-constructor and assignment-operator for now
+ SmMathConfigItem( const SmMathConfigItem & );
+ SmMathConfigItem & operator = ( const SmMathConfigItem & );
+
+public:
+ inline SmMathConfigItem( const ::rtl::OUString &rPath,
+ sal_Int16 nMode = CONFIG_MODE_IMMEDIATE_UPDATE );
+
+ uno::Sequence< ::rtl::OUString > GetFormatPropertyNames();
+ uno::Sequence< ::rtl::OUString > GetOtherPropertyNames();
+
+ uno::Sequence< uno::Any >
+ GetProperties( const uno::Sequence< ::rtl::OUString > &rNames )
+ {
+ return ConfigItem::GetProperties(rNames);
+ }
+
+ sal_Bool
+ PutProperties( const uno::Sequence< ::rtl::OUString > &rNames,
+ const uno::Sequence< uno::Any > &rValues)
+ {
+ return ConfigItem::PutProperties( rNames, rValues);
+ }
+
+ sal_Bool
+ SetSetProperties( const ::rtl::OUString &rNode,
+ uno::Sequence< beans::PropertyValue > rValues )
+ {
+ return ConfigItem::SetSetProperties( rNode, rValues );
+ }
+
+ uno::Sequence< ::rtl::OUString >
+ GetNodeNames( const ::rtl::OUString &rNode )
+ {
+ return ConfigItem::GetNodeNames( rNode );
+ }
+
+ sal_Bool
+ ReplaceSetProperties( const ::rtl::OUString& rNode,
+ uno::Sequence< beans::PropertyValue > rValues )
+ {
+ return ConfigItem::ReplaceSetProperties( rNode, rValues );
+ }
+ void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ void Commit();
+};
+
+
+inline SmMathConfigItem::SmMathConfigItem(
+ const ::rtl::OUString &rPath,
+ sal_Int16 nMode ) :
+ ConfigItem( rPath, nMode )
+{
+}
+
+
+/////////////////////////////////////////////////////////////////
+
+
+struct SmFontFormat
+{
+ String aName;
+ INT16 nCharSet;
+ INT16 nFamily;
+ INT16 nPitch;
+ INT16 nWeight;
+ INT16 nItalic;
+
+ SmFontFormat();
+// SmFontFormat( const Font &rFont );
+
+ const Font GetFont() const;
+};
+
+
+struct SmFntFmtListEntry
+{
+ String aId;
+ SmFontFormat aFntFmt;
+
+ SmFntFmtListEntry( const String &rId, const SmFontFormat &rFntFmt );
+};
+
+
+SV_DECL_OBJARR( SmFntFmtListEntryArr, SmFntFmtListEntry, 8, 8 )//STRIP008 ;
+
+
+class SmFontFormatList
+{
+ SmFntFmtListEntryArr aEntries;
+ BOOL bModified;
+
+ // disallow copy-constructor and assignment-operator for now
+ SmFontFormatList( const SmFontFormatList & );
+ SmFontFormatList & operator = ( const SmFontFormatList & );
+
+public:
+ SmFontFormatList();
+
+ void AddFontFormat( const String &rFntFmtId, const SmFontFormat &rFntFmt );
+
+ const SmFontFormat * GetFontFormat( const String &rFntFmtId ) const;
+// const SmFontFormat * GetFontFormat( USHORT nPos ) const;
+ USHORT GetCount() const { return aEntries.Count(); }
+
+ BOOL IsModified() const { return bModified; }
+ void SetModified( BOOL bVal ) { bModified = bVal; }
+};
+
+
+/////////////////////////////////////////////////////////////////
+
+class SmMathConfig
+{
+ Timer aSaveTimer;
+ SmFormat * pFormat;
+ SmCfgOther * pOther;
+ SmFontFormatList * pFontFormatList;
+ SmSym * pSymbols;
+ USHORT nSymbolCount;
+ BOOL bIsOtherModified;
+ BOOL bIsFormatModified;
+
+ // disallow copy-constructor and assignment-operator for now
+ SmMathConfig( const SmMathConfig & );
+ SmMathConfig & operator = ( const SmMathConfig & );
+
+ void LoadSymbols();
+
+ void LoadOther();
+ void SaveOther();
+ void LoadFormat();
+ void SaveFormat();
+ void LoadFontFormatList();
+ void SaveFontFormatList();
+
+
+
+ void Save();
+
+ SmSym ReadSymbol( SmMathConfigItem &rCfg,
+ const ::rtl::OUString &rSymbolName,
+ const ::rtl::OUString &rBaseNode ) const;
+ SmFontFormat ReadFontFormat( SmMathConfigItem &rCfg,
+ const ::rtl::OUString &rSymbolName,
+ const ::rtl::OUString &rBaseNode ) const;
+
+
+ DECL_LINK( TimeOut, Timer * );
+
+protected:
+ void SetOtherModified( BOOL bVal );
+ inline BOOL IsOtherModified() const { return bIsOtherModified; }
+ void SetFormatModified( BOOL bVal );
+ inline BOOL IsFormatModified() const { return bIsFormatModified; }
+
+ SmFontFormatList & GetFontFormatList();
+ const SmFontFormatList & GetFontFormatList() const
+ {
+ return ((SmMathConfig *) this)->GetFontFormatList();
+ }
+
+public:
+ SmMathConfig();
+ ~SmMathConfig();
+
+ USHORT GetSymbolCount() const;
+ const SmSym * GetSymbol( USHORT nIndex ) const;
+
+ const SmFormat & GetStandardFormat() const;
+
+ BOOL IsPrintTitle() const;
+ BOOL IsPrintFormulaText() const;
+ BOOL IsPrintFrame() const;
+ SmPrintSize GetPrintSize() const;
+ USHORT GetPrintZoomFactor() const;
+
+ BOOL IsIgnoreSpacesRight() const;
+ BOOL IsAutoRedraw() const;
+};
+
+/////////////////////////////////////////////////////////////////
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/makefile.mk b/binfilter/bf_starmath/source/makefile.mk
new file mode 100644
index 000000000000..7ee639158ada
--- /dev/null
+++ b/binfilter/bf_starmath/source/makefile.mk
@@ -0,0 +1,103 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PROJECTPCH4DLL=TRUE
+
+PRJ=..$/..
+BFPRJ=..
+
+PRJNAME=binfilter
+TARGET=bf_starmath
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(BFPRJ)$/util$/makefile.pmk
+INC+= -I$(PRJ)$/inc$/bf_starmath
+# --- Files --------------------------------------------------------
+
+SMDLL=TRUE
+
+SRS2NAME =starmath_smres
+SRC2FILES = starmath_smres.src \
+ starmath_symbol.src \
+ starmath_commands.src
+
+SLOFILES = \
+ $(SLO)$/starmath_register.obj \
+ $(SLO)$/starmath_symbol.obj \
+ $(SLO)$/starmath_cfgitem.obj \
+ $(SLO)$/starmath_config.obj \
+ $(SLO)$/starmath_document.obj \
+ $(SLO)$/starmath_mathml.obj \
+ $(SLO)$/starmath_format.obj \
+ $(SLO)$/starmath_node.obj \
+ $(SLO)$/starmath_parse.obj \
+ $(SLO)$/starmath_utility.obj \
+ $(SLO)$/starmath_smdll.obj \
+ $(SLO)$/starmath_smmod.obj \
+ $(SLO)$/starmath_rect.obj \
+ $(SLO)$/starmath_unomodel.obj \
+ $(SLO)$/starmath_unodoc.obj
+
+EXCEPTIONSFILES = \
+ $(SLO)$/starmath_register.obj \
+ $(SLO)$/starmath_mathml.obj \
+ $(SLO)$/starmath_viewhdl.obj \
+ $(SLO)$/starmath_unomodel.obj \
+ $(SLO)$/starmath_unodoc.obj
+
+
+LIB2TARGET = $(SLB)$/bf_ysm.lib
+LIB2ARCHIV = $(LB)$/libbf_ysm.a
+LIB2OBJFILES = $(SLO)$/starmath_smlib.obj
+
+DEPOBJFILES = $(SLO)$/starmath_smlib.obj
+
+# --- Targets -------------------------------------------------------
+
+.IF "$(GUI)"=="UNX" || "$(GUI)"=="MAC"
+CDEFS+=-DUSE_POLYGON
+.ENDIF
+
+.INCLUDE : target.mk
+
+$(SLO)$/starmath_smlib.obj : $(INCCOM)$/dllname.hxx
+
+$(INCCOM)$/dllname.hxx: makefile.mk
+.IF "$(GUI)"=="UNX"
+ $(RM) $@
+ echo \#define DLL_NAME \"$(DLLPRE)bf_sm$(DLLPOSTFIX)$(DLLPOST)\" >$@
+.ELSE
+ echo $(EMQ)#define DLL_NAME $(EMQ)"$(DLLPRE)bf_sm$(DLLPOSTFIX)$(DLLPOST)$(EMQ)" >$@
+.ENDIF
+
+$(SRS)$/starmath_smres.srs: $(PRJ)$/inc$/bf_svx$/globlmn.hrc
diff --git a/binfilter/bf_starmath/source/mathml.hxx b/binfilter/bf_starmath/source/mathml.hxx
new file mode 100644
index 000000000000..f273a0fef2c9
--- /dev/null
+++ b/binfilter/bf_starmath/source/mathml.hxx
@@ -0,0 +1,427 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef MATHML_HXX
+#define MATHML_HXX
+#include <bf_xmloff/xmlimp.hxx>
+#include <bf_xmloff/xmlexp.hxx>
+#include <bf_xmloff/DocumentSettingsContext.hxx>
+#include <bf_xmloff/xmltoken.hxx>
+
+#include <node.hxx>
+namespace com { namespace sun { namespace star {
+ namespace io {
+ class XInputStream;
+ class XOutputStream; }
+ namespace beans {
+ class XPropertySet; }
+} } }
+namespace binfilter {
+
+class SvStorage;
+class SfxMedium;
+
+//STRIP008 namespace com { namespace sun { namespace star {
+//STRIP008 namespace io {
+//STRIP008 class XInputStream;
+//STRIP008 class XOutputStream; }
+//STRIP008 namespace beans { XPropertySet; }
+//STRIP008 } } }
+
+
+class SmXMLWrapper
+{
+public:
+ SmXMLWrapper(::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> &rRef)
+ : xModel(rRef), bFlat(sal_True) {}
+ ULONG Import(SfxMedium &rMedium);
+ sal_Bool Export(SfxMedium &rMedium);
+ void SetFlat(sal_Bool bIn) {bFlat = bIn;}
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> xModel;
+ sal_Bool bFlat; //set true for export to flat .mml, set false for
+ //export to a .sxm (or whatever) package
+
+ ULONG ReadThroughComponent(
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModelComponent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
+ const sal_Char* pFilterName,
+ sal_Bool bEncrypted );
+
+ ULONG ReadThroughComponent(
+ SvStorage* pStorage,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModelComponent,
+ const sal_Char* pStreamName,
+ const sal_Char* pCompatibilityStreamName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
+ const sal_Char* pFilterName );
+
+ sal_Bool WriteThroughComponent(
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ xOutputStream,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ xComponent,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const sal_Char* pComponentName );
+ sal_Bool WriteThroughComponent(
+ SvStorage* pStorage,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ xComponent,
+ const sal_Char* pStreamName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const sal_Char* pComponentName,
+ sal_Bool bCompress=sal_True );
+};
+
+
+class SmXMLImport : public SvXMLImport
+{
+public:
+ // #110680#
+ SmXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ sal_uInt16 nImportFlags=IMPORT_ALL);
+
+ // XServiceInfo (override parent method)
+ ::rtl::OUString SAL_CALL getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ void SAL_CALL endDocument(void)
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
+ sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId()
+ throw();
+ SvXMLImportContext *CreateContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateMathContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateRowContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateFracContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateNumberContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateTextContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateAnnotationContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateStringContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateIdentifierContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateOperatorContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateSpaceContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateSqrtContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateRootContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateStyleContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreatePaddedContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreatePhantomContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateFencedContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateErrorContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateSubContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateSupContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateSubSupContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateUnderContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateOverContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateUnderOverContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateMultiScriptsContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateNoneContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreatePrescriptsContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateTableContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateTableRowContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateTableCellContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateAlignGroupContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateActionContext(sal_uInt16 nPrefix,
+ const ::rtl::OUString &rLocalName,
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::xml::sax::XAttributeList> &xAttrList);
+// const SvXMLTokenMap &GetMathElemTokenMap();
+ const SvXMLTokenMap &GetPresLayoutElemTokenMap();
+ const SvXMLTokenMap &GetPresLayoutAttrTokenMap();
+ const SvXMLTokenMap &GetFencedAttrTokenMap();
+ const SvXMLTokenMap &GetOperatorAttrTokenMap();
+ const SvXMLTokenMap &GetAnnotationAttrTokenMap();
+ const SvXMLTokenMap &GetPresElemTokenMap();
+ const SvXMLTokenMap &GetPresScriptEmptyElemTokenMap();
+ const SvXMLTokenMap &GetPresTableElemTokenMap();
+ const SvXMLTokenMap &GetColorTokenMap();
+ virtual ~SmXMLImport() throw ();
+ SmNodeStack & GetNodeStack() {return aNodeStack;}
+ SmNode *GetTree() { return aNodeStack.Pop();}
+ sal_Bool GetSuccess() { return bSuccess; }
+ String &GetText() { return aText;}
+
+ virtual void SetViewSettings(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aViewProps);
+ virtual void SetConfigurationSettings(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aViewProps);
+
+private:
+ SvXMLTokenMap *pMathElemTokenMap;
+ SvXMLTokenMap *pPresLayoutElemTokenMap;
+ SvXMLTokenMap *pPresLayoutAttrTokenMap;
+ SvXMLTokenMap *pFencedAttrTokenMap;
+ SvXMLTokenMap *pOperatorAttrTokenMap;
+ SvXMLTokenMap *pAnnotationAttrTokenMap;
+ SvXMLTokenMap *pPresElemTokenMap;
+ SvXMLTokenMap *pPresScriptEmptyElemTokenMap;
+ SvXMLTokenMap *pPresTableElemTokenMap;
+ SvXMLTokenMap *pColorTokenMap;
+
+ SmNodeStack aNodeStack;
+ sal_Bool bSuccess;
+ String aText;
+};
+
+enum SmXMLMathElemTokenMap
+{
+ XML_TOK_MATH
+};
+
+enum SmXMLPresLayoutElemTokenMap
+{
+ XML_TOK_SEMANTICS,
+ XML_TOK_MSTYLE,
+ XML_TOK_MERROR,
+ XML_TOK_MPHANTOM,
+ XML_TOK_MROW,
+ XML_TOK_MFRAC,
+ XML_TOK_MSQRT,
+ XML_TOK_MROOT,
+ XML_TOK_MSUB,
+ XML_TOK_MSUP,
+ XML_TOK_MSUBSUP,
+ XML_TOK_MMULTISCRIPTS,
+ XML_TOK_MUNDER,
+ XML_TOK_MOVER,
+ XML_TOK_MUNDEROVER,
+ XML_TOK_MTABLE,
+ XML_TOK_MACTION,
+ XML_TOK_MFENCED,
+ XML_TOK_MPADDED
+};
+
+enum SmXMLPresLayoutAttrTokenMap
+{
+ XML_TOK_FONTWEIGHT,
+ XML_TOK_FONTSTYLE,
+ XML_TOK_FONTSIZE,
+ XML_TOK_FONTFAMILY,
+ XML_TOK_COLOR
+};
+
+
+enum SmXMLFencedAttrTokenMap
+{
+ XML_TOK_OPEN,
+ XML_TOK_CLOSE
+};
+
+
+enum SmXMLPresTableElemTokenMap
+{
+ XML_TOK_MTR,
+ XML_TOK_MTD
+};
+
+enum SmXMLPresElemTokenMap
+{
+ XML_TOK_ANNOTATION,
+ XML_TOK_MI,
+ XML_TOK_MN,
+ XML_TOK_MO,
+ XML_TOK_MTEXT,
+ XML_TOK_MSPACE,
+ XML_TOK_MS,
+ XML_TOK_MALIGNGROUP
+};
+
+enum SmXMLPresScriptEmptyElemTokenMap
+{
+ XML_TOK_MPRESCRIPTS,
+ XML_TOK_NONE
+};
+
+enum SmXMLOperatorAttrTokenMap
+{
+ XML_TOK_STRETCHY
+};
+
+enum SmXMLAnnotationAttrTokenMap
+{
+ XML_TOK_ENCODING
+};
+
+
+class SmXMLExport : public SvXMLExport
+{
+public:
+ // #110680#
+ SmXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ sal_uInt16 nExportFlags=EXPORT_ALL);
+
+ virtual ~SmXMLExport() {};
+
+ // XServiceInfo (override parent method)
+ ::rtl::OUString SAL_CALL getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ void _ExportAutoStyles() {}
+ void _ExportMasterStyles() {}
+ void _ExportContent();
+ sal_uInt32 exportDoc(enum ::binfilter::xmloff::token::XMLTokenEnum eClass);
+
+ virtual void GetViewSettings(::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aProps);
+ virtual void GetConfigurationSettings(::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aProps);
+
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
+ sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId()
+ throw();
+
+ sal_Bool GetSuccess() {return bSuccess;}
+
+protected:
+ void ExportNodes(const SmNode *pIn,int nLevel);
+ void ExportTable(const SmNode *pIn,int nLevel);
+ void ExportLine(const SmNode *pNode,int nLevel);
+ void ExportExpression(const SmNode *pNode,int nLevel);
+ void ExportText(const SmNode *pNode, int nLevel);
+ void ExportMath(const SmNode *pNode, int nLevel);
+ void ExportPolygon(const SmNode *pNode, int nLevel);
+ void ExportBinaryHorizontal(const SmNode *pNode,int nLevel);
+ void ExportUnaryHorizontal(const SmNode *pNode,int nLevel);
+ void ExportBrace(const SmNode *pNode, int nLevel);
+ void ExportBinaryVertical(const SmNode *pNode,int nLevel);
+ void ExportSubSupScript(const SmNode *pNode,int nLevel);
+ void ExportRoot(const SmNode *pNode, int nLevel);
+ void ExportOperator(const SmNode *pNode, int nLevel);
+ void ExportAttributes(const SmNode *pNode, int nLevel);
+ void ExportFont(const SmNode *pNode, int nLevel);
+ void ExportVerticalBrace(const SmNode *pNode, int nLevel);
+ void ExportMatrix(const SmNode *pNode, int nLevel);
+private:
+ const SmNode *pTree;
+ String aText;
+ sal_Bool bSuccess;
+};
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/mathtype.hxx b/binfilter/bf_starmath/source/mathtype.hxx
new file mode 100644
index 000000000000..e7ff5adf2a9e
--- /dev/null
+++ b/binfilter/bf_starmath/source/mathtype.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef MATHTYPE_HXX
+#define MATHTYPE_HXX
+
+#include "node.hxx"
+
+#include <bf_so3/svstor.hxx>
+
+#include <set>
+namespace binfilter {
+
+#define EQNOLEFILEHDR_SIZE 28
+class EQNOLEFILEHDR
+{
+public:
+ EQNOLEFILEHDR() {}
+ EQNOLEFILEHDR(sal_uInt32 nLenMTEF) : nCBHdr(0x1c),nVersion(0x20000),
+ nCf(0xc1c6),nCBObject(nLenMTEF),nReserved1(0),nReserved2(0x0014F690),
+ nReserved3(0x0014EBB4), nReserved4(0) {}
+ sal_uInt16 nCBHdr; // length of header, sizeof(EQNOLEFILEHDR) = 28
+ sal_uInt32 nVersion; // hiword = 2, loword = 0
+ sal_uInt16 nCf; // clipboard format ("MathType EF")
+ sal_uInt32 nCBObject; // length of MTEF data following this header
+ sal_uInt32 nReserved1; // not used
+ sal_uInt32 nReserved2; // not used
+ sal_uInt32 nReserved3; // not used
+ sal_uInt32 nReserved4; // not used
+
+};
+
+class MathTypeFont
+{
+public:
+ sal_uInt8 nTface;
+ sal_uInt8 nStyle;
+ MathTypeFont() : nTface(0),nStyle(0) {}
+ MathTypeFont(sal_uInt8 nFace) : nTface(nFace),nStyle(0) {}
+};
+
+struct LessMathTypeFont
+{
+ sal_Bool operator() (const MathTypeFont &rValue1,
+ const MathTypeFont &rValue2) const
+ {
+ return rValue1.nTface < rValue2.nTface;
+ }
+};
+
+typedef ::std::set< MathTypeFont, LessMathTypeFont > MathTypeFontSet;
+
+class MathType
+{
+public:
+ MathType(String &rIn) : bSilent(sal_False),nDefaultSize(12),nLSize(0),
+ nDSize(0),nCurSize(0),nLastSize(0),nVAlign(0),nHAlign(0),rRet(rIn)
+ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 Init();
+ }
+ MathType(String &rIn,SmNode *pIn) : bSilent(sal_False),nDefaultSize(12),
+ nLSize(0),nDSize(0),nCurSize(0),nLastSize(0),nVAlign(0),nHAlign(2),
+ pTree(pIn),rRet(rIn),nInsertion(0),nSpec(0)
+ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001Init();
+ }
+private:
+/*Ver 2 Header*/
+ sal_uInt8 nVersion;
+ sal_uInt8 nPlatform;
+ sal_uInt8 nProduct;
+ sal_uInt8 nProdVersion;
+ sal_uInt8 nProdSubVersion;
+
+ SvStorageStream *pS;
+
+
+ int xfLMOVE(sal_uInt8 nTest) {return nTest&0x80;}
+ int xfAUTO(sal_uInt8 nTest) {return nTest&0x10;}
+ int xfEMBELL(sal_uInt8 nTest) {return nTest&0x20;}
+ int xfNULL(sal_uInt8 nTest) {return nTest&0x10;}
+ int xfLSPACE(sal_uInt8 nTest) {return nTest&0x40;}
+ int xfRULER(sal_uInt8 nTest) {return nTest&0x20;}
+
+
+ String &rRet;
+ SmNode *pTree;
+
+ sal_uInt8 nHAlign;
+ sal_uInt8 nVAlign;
+
+ int nPendingAttributes;
+ ULONG nInsertion;
+
+ sal_Int16 aSizeTable[7];
+ sal_Int16 nDefaultSize;
+ sal_Int16 nLSize;
+ sal_Int16 nDSize;
+ sal_Int16 nCurSize;
+ sal_Int16 nLastSize;
+ sal_uInt8 nSpec;
+ sal_Bool bSilent,bReInterpBrace;
+ String sPost;
+ xub_StrLen nPostSup;
+ xub_StrLen nPostlSup;
+ sal_uInt8 nTypeFace;
+ MathTypeFontSet aUserStyles;
+
+ 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
+ };
+public:
+};
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_cfgitem.cxx b/binfilter/bf_starmath/source/starmath_cfgitem.cxx
new file mode 100644
index 000000000000..acd61596b5bf
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_cfgitem.cxx
@@ -0,0 +1,996 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <vcl/svapp.hxx>
+#include <sal/macros.h>
+
+#include "cfgitem.hxx"
+
+#include "starmath.hrc"
+#include "format.hxx"
+namespace binfilter {
+
+using namespace rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+#define A2OU(x) ::rtl::OUString::createFromAscii( x )
+
+static const char* aRootName = "Office.Math";
+
+#define SYMBOL_LIST "SymbolList"
+#define FONT_FORMAT_LIST "FontFormatList"
+
+/*N*/ SV_IMPL_OBJARR( SmFntFmtListEntryArr, SmFntFmtListEntry );
+
+/////////////////////////////////////////////////////////////////
+
+
+/*N*/ static Sequence< OUString > lcl_GetFontPropertyNames()
+/*N*/ {
+/*N*/ static const char * aPropNames[] =
+/*N*/ {
+/*N*/ "Name",
+/*N*/ "CharSet",
+/*N*/ "Family",
+/*N*/ "Pitch",
+/*N*/ "Weight",
+/*N*/ "Italic",
+/*N*/ 0
+/*N*/ };
+/*N*/
+/*N*/ const char** ppPropName = aPropNames;
+/*N*/
+/*N*/ Sequence< OUString > aNames( 6 );
+/*N*/ OUString *pNames = aNames.getArray();
+/*N*/ for( INT32 i = 0; *ppPropName; ++i, ++ppPropName )
+/*N*/ {
+/*N*/ pNames[i] = A2OU( *ppPropName );
+/*N*/ }
+/*N*/ //aNames.realloc( i );
+/*N*/ return aNames;
+/*N*/ }
+
+/////////////////////////////////////////////////////////////////
+
+
+/*N*/ static Sequence< OUString > lcl_GetSymbolPropertyNames()
+/*N*/ {
+/*N*/ static const char * aPropNames[] =
+/*N*/ {
+/*N*/ "Char",
+/*N*/ "Set",
+/*N*/ "Predefined",
+/*N*/ "FontFormatId",
+/*N*/ 0
+/*N*/ };
+/*N*/
+/*N*/ const char** ppPropName = aPropNames;
+/*N*/
+/*N*/ Sequence< OUString > aNames( 4 );
+/*N*/ OUString *pNames = aNames.getArray();
+/*N*/ for( INT32 i = 0; *ppPropName; ++i, ++ppPropName )
+/*N*/ {
+/*N*/ pNames[i] = A2OU( *ppPropName );
+/*N*/ }
+/*N*/ //aNames.realloc( i );
+/*N*/ return aNames;
+/*N*/ }
+
+/////////////////////////////////////////////////////////////////
+
+/*N*/ static const char * aMathPropNames[] =
+/*N*/ {
+/*N*/ "Print/Title",
+/*N*/ "Print/FormulaText",
+/*N*/ "Print/Frame",
+/*N*/ "Print/Size",
+/*N*/ "Print/ZoomFactor",
+/*N*/ //"Misc/NoSymbolsWarning",
+/*N*/ "Misc/IgnoreSpacesRight",
+/*N*/ "View/ToolboxVisible",
+/*N*/ "View/AutoRedraw",
+/*N*/ "View/FormulaCursor"
+/*N*/ };
+
+
+//! Beware of order according to *_BEGIN *_END defines in format.hxx !
+//! see respective load/save routines here
+/*N*/ static const char * aFormatPropNames[] =
+/*N*/ {
+/*N*/ "StandardFormat/Textmode",
+/*N*/ "StandardFormat/ScaleNormalBracket",
+/*N*/ "StandardFormat/HorizontalAlignment",
+/*N*/ "StandardFormat/BaseSize",
+/*N*/ "StandardFormat/TextSize",
+/*N*/ "StandardFormat/IndexSize",
+/*N*/ "StandardFormat/FunctionSize",
+/*N*/ "StandardFormat/OperatorSize",
+/*N*/ "StandardFormat/LimitsSize",
+/*N*/ "StandardFormat/Distance/Horizontal",
+/*N*/ "StandardFormat/Distance/Vertical",
+/*N*/ "StandardFormat/Distance/Root",
+/*N*/ "StandardFormat/Distance/SuperScript",
+/*N*/ "StandardFormat/Distance/SubScript",
+/*N*/ "StandardFormat/Distance/Numerator",
+/*N*/ "StandardFormat/Distance/Denominator",
+/*N*/ "StandardFormat/Distance/Fraction",
+/*N*/ "StandardFormat/Distance/StrokeWidth",
+/*N*/ "StandardFormat/Distance/UpperLimit",
+/*N*/ "StandardFormat/Distance/LowerLimit",
+/*N*/ "StandardFormat/Distance/BracketSize",
+/*N*/ "StandardFormat/Distance/BracketSpace",
+/*N*/ "StandardFormat/Distance/MatrixRow",
+/*N*/ "StandardFormat/Distance/MatrixColumn",
+/*N*/ "StandardFormat/Distance/OrnamentSize",
+/*N*/ "StandardFormat/Distance/OrnamentSpace",
+/*N*/ "StandardFormat/Distance/OperatorSize",
+/*N*/ "StandardFormat/Distance/OperatorSpace",
+/*N*/ "StandardFormat/Distance/LeftSpace",
+/*N*/ "StandardFormat/Distance/RightSpace",
+/*N*/ "StandardFormat/Distance/TopSpace",
+/*N*/ "StandardFormat/Distance/BottomSpace",
+/*N*/ "StandardFormat/Distance/NormalBracketSize",
+/*N*/ "StandardFormat/VariableFont",
+/*N*/ "StandardFormat/FunctionFont",
+/*N*/ "StandardFormat/NumberFont",
+/*N*/ "StandardFormat/TextFont",
+/*N*/ "StandardFormat/SerifFont",
+/*N*/ "StandardFormat/SansFont",
+/*N*/ "StandardFormat/FixedFont"
+/*N*/ };
+
+
+/*N*/ static Sequence< OUString > lcl_GetPropertyNames(
+/*N*/ const char * aPropNames[], USHORT nCount )
+/*N*/ {
+/*N*/
+/*N*/ const char** ppPropName = aPropNames;
+/*N*/
+/*N*/ Sequence< OUString > aNames( nCount );
+/*N*/ OUString *pNames = aNames.getArray();
+/*N*/ for (INT32 i = 0; i < nCount; ++i, ++ppPropName)
+/*N*/ {
+/*N*/ pNames[i] = A2OU( *ppPropName );
+/*N*/ }
+/*N*/ //aNames.realloc( i );
+/*N*/ return aNames;
+/*N*/ }
+
+/////////////////////////////////////////////////////////////////
+
+/*N*/ Sequence< OUString > SmMathConfigItem::GetFormatPropertyNames()
+/*N*/ {
+/*N*/ USHORT nCnt = SAL_N_ELEMENTS(aFormatPropNames);
+/*N*/ return lcl_GetPropertyNames( aFormatPropNames, nCnt );
+/*N*/ }
+
+
+/*N*/ Sequence< OUString > SmMathConfigItem::GetOtherPropertyNames()
+/*N*/ {
+/*N*/ USHORT nCnt = SAL_N_ELEMENTS(aMathPropNames);
+/*N*/ return lcl_GetPropertyNames( aMathPropNames, nCnt );
+/*N*/ }
+
+/////////////////////////////////////////////////////////////////
+
+/*N*/ struct SmCfgOther
+/*N*/ {
+/*N*/ SmPrintSize ePrintSize;
+/*N*/ USHORT nPrintZoomFactor;
+/*N*/ BOOL bPrintTitle;
+/*N*/ BOOL bPrintFormulaText;
+/*N*/ BOOL bPrintFrame;
+/*N*/ BOOL bIgnoreSpacesRight;
+/*N*/ BOOL bToolboxVisible;
+/*N*/ BOOL bAutoRedraw;
+/*N*/ BOOL bFormulaCursor;
+/*N*/ //BOOL bNoSymbolsWarning;
+/*N*/
+/*N*/ SmCfgOther();
+/*N*/ };
+
+
+/*N*/ SmCfgOther::SmCfgOther()
+/*N*/ {
+/*N*/ ePrintSize = PRINT_SIZE_NORMAL;
+/*N*/ nPrintZoomFactor = 100;
+/*N*/ bPrintTitle = bPrintFormulaText =
+/*N*/ bPrintFrame = bIgnoreSpacesRight =
+/*N*/ bToolboxVisible = bAutoRedraw =
+/*N*/ bFormulaCursor = /*bNoSymbolsWarning =*/ TRUE;
+/*N*/ }
+
+/////////////////////////////////////////////////////////////////
+
+
+/*N*/ SmFontFormat::SmFontFormat()
+/*N*/ {
+/*N*/ aName.AssignAscii( FONTNAME_MATH );
+/*N*/ nCharSet = RTL_TEXTENCODING_UNICODE;
+/*N*/ nFamily = FAMILY_DONTKNOW;
+/*N*/ nPitch = PITCH_DONTKNOW;
+/*N*/ nWeight = WEIGHT_DONTKNOW;
+/*N*/ nItalic = ITALIC_NONE;
+/*N*/ }
+
+
+// /*N*/ SmFontFormat::SmFontFormat( const Font &rFont )
+// /*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+// /*N*/ }
+
+
+/*N*/ const Font SmFontFormat::GetFont() const
+/*N*/ {
+/*N*/ Font aRes;
+/*N*/ aRes.SetName( aName );
+/*N*/ aRes.SetCharSet( (rtl_TextEncoding) nCharSet );
+/*N*/ aRes.SetFamily( (FontFamily) nFamily );
+/*N*/ aRes.SetPitch( (FontPitch) nPitch );
+/*N*/ aRes.SetWeight( (FontWeight) nWeight );
+/*N*/ aRes.SetItalic( (FontItalic) nItalic );
+/*N*/ return aRes;
+/*N*/ }
+
+
+
+
+/////////////////////////////////////////////////////////////////
+
+/*N*/ SmFntFmtListEntry::SmFntFmtListEntry( const String &rId, const SmFontFormat &rFntFmt ) :
+/*N*/ aId (rId),
+/*N*/ aFntFmt (rFntFmt)
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SmFontFormatList::SmFontFormatList()
+/*N*/ {
+/*N*/ bModified = FALSE;
+/*N*/ }
+
+
+
+
+/*N*/ void SmFontFormatList::AddFontFormat( const String &rFntFmtId,
+/*N*/ const SmFontFormat &rFntFmt )
+/*N*/ {
+/*N*/ const SmFontFormat *pFntFmt = GetFontFormat( rFntFmtId );
+/*N*/ DBG_ASSERT( !pFntFmt, "FontFormatId already exists" );
+/*N*/ if (!pFntFmt)
+/*N*/ {
+/*N*/ SmFntFmtListEntry aEntry( rFntFmtId, rFntFmt );
+/*N*/ aEntries.Insert( aEntry, aEntries.Count() );
+/*N*/ SetModified( TRUE );
+/*N*/ }
+/*N*/ }
+
+
+
+
+/*N*/ const SmFontFormat * SmFontFormatList::GetFontFormat( const String &rFntFmtId ) const
+/*N*/ {
+/*N*/ SmFontFormat *pRes = 0;
+/*N*/
+/*N*/ USHORT nCnt = aEntries.Count();
+/*N*/ USHORT i;
+/*N*/ for (i = 0; i < nCnt && !pRes; ++i)
+/*N*/ {
+/*N*/ if (aEntries[i].aId == rFntFmtId)
+/*N*/ pRes = &aEntries[i].aFntFmt;
+/*N*/ }
+/*N*/
+/*N*/ return pRes;
+/*N*/ }
+
+
+
+// /*N*/ const SmFontFormat * SmFontFormatList::GetFontFormat( USHORT nPos ) const
+// /*N*/ {
+// /*N*/ SmFontFormat *pRes = 0;
+// /*N*/ if (nPos < aEntries.Count())
+// /*N*/ pRes = &aEntries[ nPos ].aFntFmt;
+// /*N*/ return pRes;
+// /*N*/ }
+
+
+
+
+
+
+
+
+
+/////////////////////////////////////////////////////////////////
+
+/*N*/ SmMathConfig::SmMathConfig()
+/*N*/ {
+/*N*/ pFormat = 0;
+/*N*/ pOther = 0;
+/*N*/ pFontFormatList = 0;
+/*N*/ pSymbols = 0;
+/*N*/ nSymbolCount = 0;
+/*N*/
+/*N*/ bIsOtherModified = bIsFormatModified = FALSE;
+/*N*/
+/*N*/ aSaveTimer.SetTimeout( 3000 );
+/*N*/ aSaveTimer.SetTimeoutHdl( LINK( this, SmMathConfig, TimeOut ) );
+/*N*/ }
+
+
+/*N*/ SmMathConfig::~SmMathConfig()
+/*N*/ {
+/*N*/ Save();
+/*N*/ delete pFormat;
+/*N*/ delete pOther;
+/*N*/ delete pFontFormatList;
+/*N*/ delete [] pSymbols;
+/*N*/ }
+
+
+/*N*/ void SmMathConfig::SetOtherModified( BOOL bVal )
+/*N*/ {
+/*N*/ if ((bIsOtherModified = bVal))
+/*?*/ aSaveTimer.Start();
+/*N*/ }
+
+
+/*N*/ void SmMathConfig::SetFormatModified( BOOL bVal )
+/*N*/ {
+/*N*/ if ((bIsFormatModified = bVal))
+/*?*/ aSaveTimer.Start();
+/*N*/ }
+
+
+/*N*/ SmSym SmMathConfig::ReadSymbol( SmMathConfigItem &rCfg,
+/*N*/ const ::rtl::OUString &rSymbolName,
+/*N*/ const ::rtl::OUString &rBaseNode ) const
+/*N*/ {
+/*N*/ SmSym aRes;
+/*N*/
+/*N*/ Sequence< OUString > aNames = lcl_GetSymbolPropertyNames();
+/*N*/ INT32 nProps = aNames.getLength();
+/*N*/
+/*N*/ OUString aDelim( OUString::valueOf( (sal_Unicode) '/' ) );
+/*N*/ OUString *pName = aNames.getArray();
+/*N*/ for (INT32 i = 0; i < nProps; ++i)
+/*N*/ {
+/*N*/ OUString &rName = pName[i];
+/*N*/ OUString aTmp( rName );
+/*N*/ rName = rBaseNode;
+/*N*/ rName += aDelim;
+/*N*/ rName += rSymbolName;
+/*N*/ rName += aDelim;
+/*N*/ rName += aTmp;
+/*N*/ }
+/*N*/
+/*N*/ const Sequence< Any > aValues = rCfg.GetProperties( aNames );
+/*N*/
+/*N*/ if (nProps && aValues.getLength() == nProps)
+/*N*/ {
+/*N*/ const Any * pValue = aValues.getConstArray();
+/*N*/ Font aFont;
+/*N*/ sal_Unicode cChar;
+/*N*/ String aSet;
+/*N*/ BOOL bPredefined;
+/*N*/
+/*N*/ OUString aTmpStr;
+/*N*/ INT32 nTmp32 = 0;
+/*N*/ INT16 nTmp16 = 0;
+/*N*/ BOOL bTmp = FALSE;
+/*N*/
+/*N*/ BOOL bOK = TRUE;
+/*N*/ if (pValue->hasValue() && (*pValue >>= nTmp32))
+/*N*/ cChar = (sal_Unicode) nTmp32;
+/*N*/ else
+/*N*/ bOK = FALSE;
+/*N*/ ++pValue;
+/*N*/ if (pValue->hasValue() && (*pValue >>= aTmpStr))
+/*N*/ aSet = aTmpStr;
+/*N*/ else
+/*N*/ bOK = FALSE;
+/*N*/ ++pValue;
+/*N*/ if (pValue->hasValue() && (*pValue >>= bTmp))
+/*N*/ bPredefined = bTmp;
+/*N*/ else
+/*N*/ bOK = FALSE;
+/*N*/ ++pValue;
+/*N*/ if (pValue->hasValue() && (*pValue >>= aTmpStr))
+/*N*/ {
+/*N*/ const SmFontFormat *pFntFmt = GetFontFormatList().GetFontFormat( aTmpStr );
+/*N*/ DBG_ASSERT( pFntFmt, "unknown FontFormat" );
+/*N*/ if (pFntFmt)
+/*N*/ aFont = pFntFmt->GetFont();
+/*N*/ }
+/*N*/ else
+/*N*/ bOK = FALSE;
+/*N*/ ++pValue;
+/*N*/
+/*N*/ if (bOK)
+/*N*/ {
+/*N*/ String aUiName( rSymbolName );
+/*N*/ String aUiSetName( aSet );
+/*N*/ if (bPredefined)
+/*N*/ {
+/*N*/ String aTmp;
+/*N*/ aTmp = GetUiSymbolName( rSymbolName );
+/*N*/ DBG_ASSERT( aTmp.Len(), "localized symbol-name not found" );
+/*N*/ if (aTmp.Len())
+/*N*/ aUiName = aTmp;
+/*N*/ aTmp = GetUiSymbolSetName( aSet );
+/*N*/ DBG_ASSERT( aTmp.Len(), "localized symbolset-name not found" );
+/*N*/ if (aTmp.Len())
+/*N*/ aUiSetName = aTmp;
+/*N*/ }
+/*N*/
+/*N*/ aRes = SmSym( aUiName, aFont, cChar, aUiSetName, bPredefined );
+/*N*/ if (aUiName != String(rSymbolName))
+/*?*/ aRes.SetExportName( rSymbolName );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ DBG_ERROR( "symbol read error" );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return aRes;
+/*N*/ }
+
+
+/*N*/ void SmMathConfig::LoadSymbols()
+/*N*/ {
+/*N*/ SmMathConfigItem aCfg( String::CreateFromAscii( aRootName ));
+/*N*/
+/*N*/ Sequence< OUString > aNodes( aCfg.GetNodeNames( A2OU( SYMBOL_LIST ) ) );
+/*N*/ const OUString *pNode = aNodes.getConstArray();
+/*N*/ INT32 nNodes = aNodes.getLength();
+/*N*/
+/*N*/ if (pSymbols)
+/*?*/ delete [] pSymbols;
+/*N*/ pSymbols = nNodes ? new SmSym[ nNodes ] : 0;
+/*N*/ nSymbolCount = (USHORT) nNodes;
+/*N*/
+/*N*/ for (INT32 i = 0; i < nNodes; ++i)
+/*N*/ {
+/*N*/ pSymbols[i] = ReadSymbol( aCfg, pNode[i], A2OU( SYMBOL_LIST ) );
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmMathConfig::Save()
+/*N*/ {
+/*N*/ SaveOther();
+/*N*/ SaveFormat();
+/*N*/ SaveFontFormatList();
+/*N*/ }
+
+
+/*N*/ USHORT SmMathConfig::GetSymbolCount() const
+/*N*/ {
+/*N*/ if (!pSymbols)
+/*N*/ ((SmMathConfig *) this)->LoadSymbols();
+/*N*/ return nSymbolCount;
+/*N*/ }
+
+
+/*N*/ const SmSym * SmMathConfig::GetSymbol( USHORT nIndex ) const
+/*N*/ {
+/*N*/ SmSym *pRes = 0;
+/*N*/ if (!pSymbols)
+/*?*/ ((SmMathConfig *) this)->LoadSymbols();
+/*N*/ if (nIndex < nSymbolCount)
+/*N*/ pRes = &pSymbols[ nIndex ];
+/*N*/ return pRes;
+/*N*/ }
+
+
+
+
+/*N*/ SmFontFormatList & SmMathConfig::GetFontFormatList()
+/*N*/ {
+/*N*/ if (!pFontFormatList)
+/*N*/ {
+/*N*/ LoadFontFormatList();
+/*N*/ }
+/*N*/ return *pFontFormatList;
+/*N*/ }
+
+
+/*N*/ void SmMathConfig::LoadFontFormatList()
+/*N*/ {
+/*N*/ if (!pFontFormatList)
+/*N*/ pFontFormatList = new SmFontFormatList;
+/*N*/ else
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pFontFormatList->Clear();
+/*N*/
+/*N*/ SmMathConfigItem aCfg( String::CreateFromAscii( aRootName ) );
+/*N*/
+/*N*/ Sequence< OUString > aNodes( aCfg.GetNodeNames( A2OU( FONT_FORMAT_LIST ) ) );
+/*N*/ const OUString *pNode = aNodes.getConstArray();
+/*N*/ INT32 nNodes = aNodes.getLength();
+/*N*/
+/*N*/ for (INT32 i = 0; i < nNodes; ++i)
+/*N*/ {
+/*N*/ SmFontFormat aFntFmt( ReadFontFormat( aCfg, pNode[i], A2OU( FONT_FORMAT_LIST ) ) );
+/*N*/ if (!pFontFormatList->GetFontFormat( pNode[i] ))
+/*N*/ {
+/*N*/ DBG_ASSERT( 0 == pFontFormatList->GetFontFormat( pNode[i] ),
+/*N*/ "FontFormat ID already exists" );
+/*N*/ pFontFormatList->AddFontFormat( pNode[i], aFntFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ pFontFormatList->SetModified( FALSE );
+/*N*/ }
+
+
+/*N*/ SmFontFormat SmMathConfig::ReadFontFormat( SmMathConfigItem &rCfg,
+/*N*/ const OUString &rSymbolName, const OUString &rBaseNode ) const
+/*N*/ {
+/*N*/ SmFontFormat aRes;
+/*N*/
+/*N*/ Sequence< OUString > aNames = lcl_GetFontPropertyNames();
+/*N*/ INT32 nProps = aNames.getLength();
+/*N*/
+/*N*/ OUString aDelim( OUString::valueOf( (sal_Unicode) '/' ) );
+/*N*/ OUString *pName = aNames.getArray();
+/*N*/ for (INT32 i = 0; i < nProps; ++i)
+/*N*/ {
+/*N*/ OUString &rName = pName[i];
+/*N*/ OUString aTmp( rName );
+/*N*/ rName = rBaseNode;
+/*N*/ rName += aDelim;
+/*N*/ rName += rSymbolName;
+/*N*/ rName += aDelim;
+/*N*/ rName += aTmp;
+/*N*/ }
+/*N*/
+/*N*/ const Sequence< Any > aValues = rCfg.GetProperties( aNames );
+/*N*/
+/*N*/ if (nProps && aValues.getLength() == nProps)
+/*N*/ {
+/*N*/ const Any * pValue = aValues.getConstArray();
+/*N*/
+/*N*/ OUString aTmpStr;
+/*N*/ INT16 nTmp16 = 0;
+/*N*/
+/*N*/ BOOL bOK = TRUE;
+/*N*/ if (pValue->hasValue() && (*pValue >>= aTmpStr))
+/*N*/ aRes.aName = aTmpStr;
+/*N*/ else
+/*N*/ bOK = FALSE;
+/*N*/ ++pValue;
+/*N*/ if (pValue->hasValue() && (*pValue >>= nTmp16))
+/*N*/ aRes.nCharSet = nTmp16; // 6.0 file-format GetSOLoadTextEncoding not needed
+/*N*/ else
+/*N*/ bOK = FALSE;
+/*N*/ ++pValue;
+/*N*/ if (pValue->hasValue() && (*pValue >>= nTmp16))
+/*N*/ aRes.nFamily = nTmp16;
+/*N*/ else
+/*N*/ bOK = FALSE;
+/*N*/ ++pValue;
+/*N*/ if (pValue->hasValue() && (*pValue >>= nTmp16))
+/*N*/ aRes.nPitch = nTmp16;
+/*N*/ else
+/*N*/ bOK = FALSE;
+/*N*/ ++pValue;
+/*N*/ if (pValue->hasValue() && (*pValue >>= nTmp16))
+/*N*/ aRes.nWeight = nTmp16;
+/*N*/ else
+/*N*/ bOK = FALSE;
+/*N*/ ++pValue;
+/*N*/ if (pValue->hasValue() && (*pValue >>= nTmp16))
+/*N*/ aRes.nItalic = nTmp16;
+/*N*/ else
+/*N*/ bOK = FALSE;
+/*N*/ ++pValue;
+/*N*/
+/*N*/ DBG_ASSERT( bOK, "read FontFormat failed" );
+/*N*/ }
+/*N*/
+/*N*/ return aRes;
+/*N*/ }
+
+
+/*N*/ void SmMathConfig::SaveFontFormatList()
+/*N*/ {
+/*N*/ SmFontFormatList &rFntFmtList = GetFontFormatList();
+/*N*/
+/*N*/ if (!rFntFmtList.IsModified())
+/*N*/ return;
+/*N*/
+/*?*/ SmMathConfigItem aCfg( String::CreateFromAscii( aRootName ) );
+/*?*/
+/*?*/ Sequence< OUString > aNames = lcl_GetFontPropertyNames();
+/*?*/ INT32 nSymbolProps = aNames.getLength();
+/*?*/
+/*?*/ USHORT nCount = rFntFmtList.GetCount();
+/*?*/
+/*?*/ Sequence< PropertyValue > aValues( nCount * nSymbolProps );
+/*?*/ PropertyValue *pValues = aValues.getArray();
+/*?*/
+/*?*/ PropertyValue *pVal = pValues;
+/*?*/ OUString aDelim( OUString::valueOf( (sal_Unicode) '/' ) );
+/*?*/ for (USHORT i = 0; i < nCount; ++i)
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 String aFntFmtId( rFntFmtList.GetFontFormatId( i ) );
+/*?*/ }
+/*?*/ DBG_ASSERT( pVal - pValues == nCount * nSymbolProps, "properties missing" );
+/*?*/ aCfg.ReplaceSetProperties( A2OU( FONT_FORMAT_LIST ) , aValues );
+/*?*/
+/*?*/ rFntFmtList.SetModified( FALSE );
+/*N*/ }
+
+
+
+
+/*N*/ void SmMathConfig::LoadOther()
+/*N*/ {
+/*N*/ if (!pOther)
+/*N*/ pOther = new SmCfgOther;
+/*N*/
+/*N*/ SmMathConfigItem aCfg( String::CreateFromAscii( aRootName ));
+/*N*/
+/*N*/ Sequence< OUString > aNames( aCfg.GetOtherPropertyNames() );
+/*N*/ INT32 nProps = aNames.getLength();
+/*N*/
+/*N*/ Sequence< Any > aValues( aCfg.GetProperties( aNames ) );
+/*N*/ if (nProps && aValues.getLength() == nProps)
+/*N*/ {
+/*N*/ const Any *pValues = aValues.getConstArray();
+/*N*/ const Any *pVal = pValues;
+/*N*/
+/*N*/ INT16 nTmp16;
+/*N*/ BOOL bTmp;
+/*N*/
+/*N*/ // Print/Title
+/*N*/ if (pVal->hasValue() && (*pVal >>= bTmp))
+/*N*/ pOther->bPrintTitle = bTmp;
+/*N*/ ++pVal;
+/*N*/ // Print/FormulaText
+/*N*/ if (pVal->hasValue() && (*pVal >>= bTmp))
+/*N*/ pOther->bPrintFormulaText = bTmp;
+/*N*/ ++pVal;
+/*N*/ // Print/Frame
+/*N*/ if (pVal->hasValue() && (*pVal >>= bTmp))
+/*N*/ pOther->bPrintFrame = bTmp;
+/*N*/ ++pVal;
+/*N*/ // Print/Size
+/*N*/ if (pVal->hasValue() && (*pVal >>= nTmp16))
+/*N*/ pOther->ePrintSize = (SmPrintSize) nTmp16;
+/*N*/ ++pVal;
+/*N*/ // Print/ZoomFactor
+/*N*/ if (pVal->hasValue() && (*pVal >>= nTmp16))
+/*N*/ pOther->nPrintZoomFactor = nTmp16;
+/* ++pVal;
+ // Misc/NoSymbolsWarning
+ if (pVal->hasValue() && (*pVal >>= bTmp))
+ pOther->bNoSymbolsWarning = bTmp;
+*/
+/*N*/ ++pVal;
+/*N*/ // Misc/IgnoreSpacesRight
+/*N*/ if (pVal->hasValue() && (*pVal >>= bTmp))
+/*N*/ pOther->bIgnoreSpacesRight = bTmp;
+/*N*/ ++pVal;
+/*N*/ // View/ToolboxVisible
+/*N*/ if (pVal->hasValue() && (*pVal >>= bTmp))
+/*N*/ pOther->bToolboxVisible = bTmp;
+/*N*/ ++pVal;
+/*N*/ // View/AutoRedraw
+/*N*/ if (pVal->hasValue() && (*pVal >>= bTmp))
+/*N*/ pOther->bAutoRedraw = bTmp;
+/*N*/ ++pVal;
+/*N*/ // View/FormulaCursor
+/*N*/ if (pVal->hasValue() && (*pVal >>= bTmp))
+/*N*/ pOther->bFormulaCursor = bTmp;
+/*N*/ ++pVal;
+/*N*/
+/*N*/ DBG_ASSERT( pVal - pValues == nProps, "property mismatch" );
+/*N*/ SetOtherModified( FALSE );
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmMathConfig::SaveOther()
+/*N*/ {
+/*N*/ if (!pOther || !IsOtherModified())
+/*N*/ return;
+/*N*/
+/*?*/ SmMathConfigItem aCfg( String::CreateFromAscii( aRootName ));
+/*?*/
+/*?*/ const Sequence< OUString > aNames( aCfg.GetOtherPropertyNames() );
+/*?*/ INT32 nProps = aNames.getLength();
+/*?*/
+/*?*/ Sequence< Any > aValues( nProps );
+/*?*/ Any *pValues = aValues.getArray();
+/*?*/ Any *pValue = pValues;
+/*?*/
+/*?*/ // Print/Title
+/*?*/ *pValue++ <<= (BOOL) pOther->bPrintTitle;
+/*?*/ // Print/FormulaText
+/*?*/ *pValue++ <<= (BOOL) pOther->bPrintFormulaText;
+/*?*/ // Print/Frame
+/*?*/ *pValue++ <<= (BOOL) pOther->bPrintFrame;
+/*?*/ // Print/Size
+/*?*/ *pValue++ <<= (INT16) pOther->ePrintSize;
+/*?*/ // Print/ZoomFactor
+/*?*/ *pValue++ <<= (INT16) pOther->nPrintZoomFactor;
+/* // Misc/NoSymbolsWarning
+ *pValue++ <<= (BOOL) pOther->bNoSymbolsWarning;
+*/
+/*?*/ // Misc/IgnoreSpacesRight
+/*?*/ *pValue++ <<= (BOOL) pOther->bIgnoreSpacesRight;
+/*?*/ // View/ToolboxVisible
+/*?*/ *pValue++ <<= (BOOL) pOther->bToolboxVisible;
+/*?*/ // View/AutoRedraw
+/*?*/ *pValue++ <<= (BOOL) pOther->bAutoRedraw;
+/*?*/ // View/FormulaCursor
+/*?*/ *pValue++ <<= (BOOL) pOther->bFormulaCursor;
+/*?*/
+/*?*/ DBG_ASSERT( pValue - pValues == nProps, "property mismatch" );
+/*?*/ aCfg.PutProperties( aNames , aValues );
+/*?*/
+/*?*/ SetOtherModified( FALSE );
+/*N*/ }
+
+/*N*/ void SmMathConfig::LoadFormat()
+/*N*/ {
+/*N*/ if (!pFormat)
+/*N*/ pFormat = new SmFormat;
+/*N*/
+/*N*/ SmMathConfigItem aCfg( String::CreateFromAscii( aRootName ));
+/*N*/
+/*N*/ Sequence< OUString > aNames( aCfg.GetFormatPropertyNames() );
+/*N*/ INT32 nProps = aNames.getLength();
+/*N*/
+/*N*/ Sequence< Any > aValues( aCfg.GetProperties( aNames ) );
+/*N*/ if (nProps && aValues.getLength() == nProps)
+/*N*/ {
+/*N*/ const Any *pValues = aValues.getConstArray();
+/*N*/ const Any *pVal = pValues;
+/*N*/
+/*N*/ OUString aTmpStr;
+/*N*/ INT16 nTmp16;
+/*N*/ BOOL bTmp;
+/*N*/
+/*N*/ // StandardFormat/Textmode
+/*N*/ if (pVal->hasValue() && (*pVal >>= bTmp))
+/*N*/ pFormat->SetTextmode( bTmp );
+/*N*/ ++pVal;
+/*N*/ // StandardFormat/ScaleNormalBracket
+/*N*/ if (pVal->hasValue() && (*pVal >>= bTmp))
+/*N*/ pFormat->SetScaleNormalBrackets( bTmp );
+/*N*/ ++pVal;
+/*N*/ // StandardFormat/HorizontalAlignment
+/*N*/ if (pVal->hasValue() && (*pVal >>= nTmp16))
+/*N*/ pFormat->SetHorAlign( (SmHorAlign) nTmp16 );
+/*N*/ ++pVal;
+/*N*/ // StandardFormat/BaseSize
+/*N*/ if (pVal->hasValue() && (*pVal >>= nTmp16))
+/*N*/ pFormat->SetBaseSize( Size(0, SmPtsTo100th_mm( nTmp16 )) );
+/*N*/ ++pVal;
+/*N*/
+/*N*/ USHORT i;
+/*N*/ for (i = SIZ_BEGIN; i <= SIZ_END; ++i)
+/*N*/ {
+/*N*/ if (pVal->hasValue() && (*pVal >>= nTmp16))
+/*N*/ pFormat->SetRelSize( i, nTmp16 );
+/*N*/ ++pVal;
+/*N*/ }
+/*N*/
+/*N*/ for (i = DIS_BEGIN; i <= DIS_END; ++i)
+/*N*/ {
+/*N*/ if (pVal->hasValue() && (*pVal >>= nTmp16))
+/*N*/ pFormat->SetDistance( i, nTmp16 );
+/*N*/ ++pVal;
+/*N*/ }
+/*N*/
+/*N*/ LanguageType nLang = Application::GetSettings().GetUILanguage();
+/*N*/ for (i = FNT_BEGIN; i < FNT_END; ++i)
+/*N*/ {
+/*N*/ Font aFnt;
+/*N*/ BOOL bUseDefaultFont = TRUE;
+/*N*/ if (pVal->hasValue() && (*pVal >>= aTmpStr))
+/*N*/ {
+/*N*/ bUseDefaultFont = 0 == aTmpStr.getLength();
+/*N*/ if (bUseDefaultFont)
+/*N*/ {
+/*N*/ aFnt = pFormat->GetFont( i );
+/*N*/ aFnt.SetName( GetDefaultFontName( nLang, i ) );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ const SmFontFormat *pFntFmt = GetFontFormatList().GetFontFormat( aTmpStr );
+/*?*/ DBG_ASSERT( pFntFmt, "unknown FontFormat" );
+/*?*/ if (pFntFmt)
+/*?*/ aFnt = pFntFmt->GetFont();
+/*N*/ }
+/*N*/ }
+/*N*/ ++pVal;
+/*N*/
+/*N*/ aFnt.SetSize( pFormat->GetBaseSize() );
+/*N*/ pFormat->SetFont( i, aFnt, bUseDefaultFont );
+/*N*/ }
+/*N*/
+/*N*/ DBG_ASSERT( pVal - pValues == nProps, "property mismatch" );
+/*N*/ SetFormatModified( FALSE );
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmMathConfig::SaveFormat()
+/*N*/ {
+/*N*/ if (!pFormat || !IsFormatModified())
+/*N*/ return;
+/*N*/
+/*?*/ SmMathConfigItem aCfg( String::CreateFromAscii( aRootName ));
+/*?*/
+/*?*/ const Sequence< OUString > aNames( aCfg.GetFormatPropertyNames() );
+/*?*/ INT32 nProps = aNames.getLength();
+/*?*/
+/*?*/ Sequence< Any > aValues( nProps );
+/*?*/ Any *pValues = aValues.getArray();
+/*?*/ Any *pValue = pValues;
+/*?*/
+/*?*/ // StandardFormat/Textmode
+/*?*/ *pValue++ <<= (BOOL) pFormat->IsTextmode();
+/*?*/ // StandardFormat/ScaleNormalBracket
+/*?*/ *pValue++ <<= (BOOL) pFormat->IsScaleNormalBrackets();
+/*?*/ // StandardFormat/HorizontalAlignment
+/*?*/ *pValue++ <<= (INT16) pFormat->GetHorAlign();
+/*?*/ // StandardFormat/BaseSize
+/*?*/ *pValue++ <<= (INT16) SmRoundFraction( Sm100th_mmToPts(
+/*?*/ pFormat->GetBaseSize().Height() ) );
+/*?*/
+/*?*/ USHORT i;
+/*?*/ for (i = SIZ_BEGIN; i <= SIZ_END; ++i)
+/*?*/ *pValue++ <<= (INT16) pFormat->GetRelSize( i );
+/*?*/
+/*?*/ for (i = DIS_BEGIN; i <= DIS_END; ++i)
+/*?*/ *pValue++ <<= (INT16) pFormat->GetDistance( i );
+/*?*/
+/*?*/ for (i = FNT_BEGIN; i < FNT_END; ++i)
+/*?*/ {
+/*?*/ OUString aFntFmtId;
+/*?*/
+/*?*/ if (!pFormat->IsDefaultFont( i ))
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SmFontFormat aFntFmt( pFormat->GetFont( i ) );
+/*?*/ }
+/*?*/
+/*?*/ *pValue++ <<= aFntFmtId;
+/*?*/ }
+/*?*/
+/*?*/ DBG_ASSERT( pValue - pValues == nProps, "property mismatch" );
+/*?*/ aCfg.PutProperties( aNames , aValues );
+/*?*/
+/*?*/ SetFormatModified( FALSE );
+/*N*/ }
+
+
+/*N*/ const SmFormat & SmMathConfig::GetStandardFormat() const
+/*N*/ {
+/*N*/ if (!pFormat)
+/*N*/ ((SmMathConfig *) this)->LoadFormat();
+/*N*/ return *pFormat;
+/*N*/ }
+
+
+
+
+/*N*/ SmPrintSize SmMathConfig::GetPrintSize() const
+/*N*/ {
+/*N*/ if (!pOther)
+/*N*/ ((SmMathConfig *) this)->LoadOther();
+/*N*/ return pOther->ePrintSize;
+/*N*/ }
+
+
+
+
+/*N*/ USHORT SmMathConfig::GetPrintZoomFactor() const
+/*N*/ {
+/*N*/ if (!pOther)
+/*?*/ ((SmMathConfig *) this)->LoadOther();
+/*N*/ return pOther->nPrintZoomFactor;
+/*N*/ }
+
+
+
+
+
+
+/*N*/ BOOL SmMathConfig::IsPrintTitle() const
+/*N*/ {
+/*N*/ if (!pOther)
+/*?*/ ((SmMathConfig *) this)->LoadOther();
+/*N*/ return pOther->bPrintTitle;
+/*N*/ }
+
+
+
+
+/*N*/ BOOL SmMathConfig::IsPrintFormulaText() const
+/*N*/ {
+/*N*/ if (!pOther)
+/*?*/ ((SmMathConfig *) this)->LoadOther();
+/*N*/ return pOther->bPrintFormulaText;
+/*N*/ }
+
+
+
+
+/*N*/ BOOL SmMathConfig::IsPrintFrame() const
+/*N*/ {
+/*N*/ if (!pOther)
+/*?*/ ((SmMathConfig *) this)->LoadOther();
+/*N*/ return pOther->bPrintFrame;
+/*N*/ }
+
+
+
+
+/*N*/ BOOL SmMathConfig::IsIgnoreSpacesRight() const
+/*N*/ {
+/*N*/ if (!pOther)
+/*?*/ ((SmMathConfig *) this)->LoadOther();
+/*N*/ return pOther->bIgnoreSpacesRight;
+/*N*/ }
+
+
+ void SmMathConfigItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ) {}
+ void SmMathConfigItem::Commit() {}
+
+
+
+
+
+
+/*N*/ BOOL SmMathConfig::IsAutoRedraw() const
+/*N*/ {
+/*N*/ if (!pOther)
+/*?*/ ((SmMathConfig *) this)->LoadOther();
+/*N*/ return pOther->bAutoRedraw;
+/*N*/ }
+
+/*N*/ IMPL_LINK( SmMathConfig, TimeOut, Timer *, p )
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 Save();
+/*N*/ return 0;
+/*N*/ }
+
+/////////////////////////////////////////////////////////////////
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_command.cxx b/binfilter/bf_starmath/source/starmath_command.cxx
new file mode 100644
index 000000000000..3a1211d4b458
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_command.cxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <tools/rcid.h>
+
+#include "command.hxx"
+namespace binfilter {
+
+SmCommandDesc::SmCommandDesc(const ResId& rResId) :
+ Resource(rResId)
+{
+ if (IsAvailableRes(ResId(1).SetRT(RSC_STRING)))
+ pSample = new String(ResId(1));
+ else
+ pSample = new String;
+
+ if (IsAvailableRes(ResId(2).SetRT(RSC_STRING)))
+ pCommand = new String(ResId(2));
+ else
+ pCommand = new String;
+
+ if (IsAvailableRes(ResId(3).SetRT(RSC_STRING)))
+ pText = new String(ResId(3));
+ else
+ pText = new String("sorry, no help available");
+
+ if (IsAvailableRes(ResId(4).SetRT(RSC_STRING)))
+ pHelp = new String(ResId(4));
+ else
+ pHelp = new String("sorry, no help available");
+
+ if (IsAvailableRes(ResId(1).SetRT(RSC_BITMAP)))
+ pGraphic = new Bitmap(ResId(1));
+ else
+ pGraphic = new Bitmap();
+
+ FreeResource();
+}
+
+SmCommandDesc::~SmCommandDesc()
+{
+ if (pText) delete pText;
+ if (pHelp) delete pHelp;
+ if (pSample) delete pSample;
+ if (pCommand) delete pCommand;
+ if (pGraphic) delete pGraphic;
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_commands.src b/binfilter/bf_starmath/source/starmath_commands.src
new file mode 100644
index 000000000000..54deb82c0a0f
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_commands.src
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define NO_LOCALIZE_EXPORT
+
+
+#include <bf_sfx2/sfx.hrc>
+#include "starmath.hrc"
+
+
+////////////////////////////////////////////////////////////
+
+
+String RID_XNEQY { Text = "<?> <> <?> " ; };
+String RID_EX { Text = "func e^{<?>} " ; };
+String RID_GRAVEX { Text = "grave <?> " ; };
+String RID_STACK { Text = "stack{<?> # <?> # <?>} " ; };
+String RID_RE { Text = "Re " ; };
+
+
+//////////////////////////////////////////
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binfilter/bf_starmath/source/starmath_config.cxx b/binfilter/bf_starmath/source/starmath_config.cxx
new file mode 100644
index 000000000000..9c567f5259a3
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_config.cxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svtools/itemset.hxx>
+#include <bf_sfx2/sfxsids.hrc>
+#include <bf_svtools/eitem.hxx>
+#include <bf_svtools/itempool.hxx>
+#include <bf_svtools/intitem.hxx>
+
+
+#include "config.hxx"
+#include "starmath.hrc"
+namespace binfilter {
+
+/////////////////////////////////////////////////////////////////
+
+/*N*/ SmConfig::SmConfig()
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SmConfig::~SmConfig()
+/*N*/ {
+/*N*/ }
+
+
+
+
+/*N*/ void SmConfig::ConfigToItemSet(SfxItemSet &rSet) const
+/*N*/ {
+/*N*/ const SfxItemPool *pPool = rSet.GetPool();
+/*N*/
+/*N*/ rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTSIZE),
+/*N*/ (UINT16) GetPrintSize()));
+/*N*/ rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTZOOM),
+/*N*/ (UINT16) GetPrintZoomFactor()));
+/*N*/
+/*N*/ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTITLE), IsPrintTitle()));
+/*N*/ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTEXT), IsPrintFormulaText()));
+/*N*/ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTFRAME), IsPrintFrame()));
+/*N*/ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_AUTOREDRAW), IsAutoRedraw()));
+/*N*/ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_NO_RIGHT_SPACES), IsIgnoreSpacesRight()));
+/*N*/ }
+
+
+/////////////////////////////////////////////////////////////////
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_document.cxx b/binfilter/bf_starmath/source/starmath_document.cxx
new file mode 100644
index 000000000000..1562f4f785aa
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_document.cxx
@@ -0,0 +1,934 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include <sot/formats.hxx>
+
+#include <bf_svtools/lingucfg.hxx>
+#include <comphelper/classids.hxx>
+
+#include <bf_svtools/itemset.hxx>
+#include <bf_svtools/eitem.hxx>
+#include <bf_svtools/whiter.hxx>
+#include <bf_svtools/intitem.hxx>
+#include <bf_svtools/stritem.hxx>
+
+#include <bf_sfx2/app.hxx>
+#include <bf_sfx2/docfile.hxx>
+#include <bf_sfx2/request.hxx>
+#include <bf_svtools/sfxecode.hxx>
+#include <bf_sfx2/printer.hxx>
+
+#include <bf_svtools/itempool.hxx>
+#include <bf_svx/editeng.hxx>
+#include <bf_svx/eeitem.hxx>
+#include <bf_svx/editstat.hxx>
+#include <bf_svx/eeitemid.hxx>
+#include <bf_svx/fontitem.hxx>
+#include <bf_svx/fhgtitem.hxx>
+#include <bf_svtools/slstitm.hxx>
+
+#include <com/sun/star/uno/Any.h>
+#include <starmath.hrc>
+#include <document.hxx>
+#include <unomodel.hxx>
+#include <config.hxx>
+#include <mathml.hxx>
+
+namespace binfilter {
+
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+
+#define A2OU(x) ::rtl::OUString::createFromAscii( x )
+
+namespace binfilter
+{
+#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
+**
+**/
+
+/*N*/ TYPEINIT1( SmDocShell, SfxObjectShell );
+
+/*N*/ SFX_IMPL_OBJECTFACTORY_DLL(SmDocShell, smath, SvGlobalName(BF_SO3_SM_CLASSID), Sm);
+
+/*N*/ SmSymSetManager & SmDocShell::GetSymSetManager()
+/*N*/ {
+/*N*/ if (!pSymSetMgr)
+/*N*/ {
+/*N*/ pSymSetMgr = new SmSymSetManager;
+/*N*/ pSymSetMgr->Load();
+/*N*/ }
+/*N*/ return *pSymSetMgr;
+/*N*/ }
+
+/*N*/ void SmDocShell::SetText(const String& rBuffer)
+/*N*/ {
+/*N*/ if (rBuffer != aText)
+/*N*/ {
+/*N*/ BOOL bIsEnabled = IsEnableSetModified();
+/*N*/ if( bIsEnabled )
+/*N*/ EnableSetModified( FALSE );
+/*N*/
+/*N*/ aText = rBuffer;
+/*N*/ Parse();
+/*N*/ //Resize();
+/*N*/
+/*N*/ if ( bIsEnabled )
+/*N*/ EnableSetModified( bIsEnabled );
+/*N*/ SetModified(TRUE);
+/*N*/
+ // launch accessible event if necessary
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ void SmDocShell::Parse()
+/*N*/ {
+/*N*/ if (pTree)
+/*N*/ delete pTree;
+/*N*/ pTree = aInterpreter.Parse(aText);
+/*N*/ nModifyCount++;
+/*N*/ SetFormulaArranged( FALSE );
+/*N*/ }
+
+
+/*N*/ void SmDocShell::ArrangeFormula()
+/*N*/ {
+/*N*/ //! Nur fuer die Dauer der Existenz dieses Objekts sind am Drucker die
+/*N*/ //! richtigen Einstellungen garantiert.
+/*N*/ SmPrinterAccess aPrtAcc(*this);
+/*N*/ // OutputDevice *pOutDev = aPrtAcc.GetPrinter();
+/*N*/ OutputDevice* pOutDev = aPrtAcc.GetRefDev();
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if (!pOutDev)
+/*N*/ DBG_WARNING("Sm : kein Drucker vorhanden");
+/*N*/ #endif
+/*N*/
+/*N*/ // falls noetig ein anderes OutputDevice holen fuer das formatiert wird
+/*N*/ if (!pOutDev)
+/*N*/ {
+/*N*/ pOutDev = &SM_MOD1()->GetDefaultVirtualDev();
+/*N*/ pOutDev->SetMapMode( MapMode(MAP_100TH_MM) );
+/*N*/ }
+/*N*/ DBG_ASSERT(pOutDev->GetMapMode().GetMapUnit() == MAP_100TH_MM,
+/*N*/ "Sm : falscher MapMode");
+/*N*/
+/*N*/ const SmFormat &rFormat = GetFormat();
+/*N*/ pTree->Prepare(rFormat, *this);
+/*N*/ pTree->Arrange(*pOutDev, rFormat);
+/*N*/
+/*N*/ SetFormulaArranged(TRUE);
+/*N*/
+/*N*/ // invalidate accessible text
+/*N*/ aAccText = String();
+/*N*/ }
+
+/*N*/ Size SmDocShell::GetSize()
+/*N*/ {
+/*N*/ Size aRet;
+/*N*/
+/*N*/ if (!pTree)
+/*N*/ Parse();
+/*N*/
+/*N*/ if (pTree)
+/*N*/ {
+/*N*/ if (!IsFormulaArranged())
+/*N*/ ArrangeFormula();
+/*N*/ aRet = pTree->GetSize();
+/*N*/
+/*N*/ if ( !aRet.Width() )
+/*?*/ aRet.Width() = 2000;
+/*N*/ else
+/*N*/ aRet.Width() += aFormat.GetDistance( DIS_LEFTSPACE ) +
+/*N*/ aFormat.GetDistance( DIS_RIGHTSPACE );
+/*N*/ if ( !aRet.Height() )
+/*?*/ aRet.Height() = 1000;
+/*N*/ else
+/*N*/ aRet.Height() += aFormat.GetDistance( DIS_TOPSPACE ) +
+/*N*/ aFormat.GetDistance( DIS_BOTTOMSPACE );
+/*N*/ }
+/*N*/
+/*N*/ return aRet;
+/*N*/ }
+
+////////////////////////////////////////
+
+/*N*/ SmPrinterAccess::SmPrinterAccess( SmDocShell &rDocShell )
+/*N*/ {
+/*N*/ if ( 0 != (pPrinter = rDocShell.GetPrt()) )
+/*N*/ {
+/*N*/ pPrinter->Push( PUSH_MAPMODE );
+/*N*/ if ( rDocShell.GetProtocol().IsInPlaceActive() ||
+/*N*/ SFX_CREATE_MODE_EMBEDDED == rDocShell.GetCreateMode() )
+/*N*/ {
+/*N*/ // if it is an embedded object (without it's own printer)
+/*N*/ // we change the MapMode temporarily.
+/*N*/ //!If it is a document with it's own printer the MapMode should
+/*N*/ //!be set correct (once) elsewhere(!), in order to avoid numerous
+/*N*/ //!superfluous pushing and poping of the MapMode when using
+/*N*/ //!this class.
+/*N*/
+/*N*/ 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 );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( 0 != (pRefDev = rDocShell.GetRefDev()) && pPrinter != pRefDev )
+/*N*/ {
+/*N*/ pRefDev->Push( PUSH_MAPMODE );
+/*N*/ if ( rDocShell.GetProtocol().IsInPlaceActive() ||
+/*N*/ SFX_CREATE_MODE_EMBEDDED == rDocShell.GetCreateMode() )
+/*N*/ {
+/*N*/ // if it is an embedded object (without it's own printer)
+/*N*/ // we change the MapMode temporarily.
+/*N*/ //!If it is a document with it's own printer the MapMode should
+/*N*/ //!be set correct (once) elsewhere(!), in order to avoid numerous
+/*N*/ //!superfluous pushing and poping of the MapMode when using
+/*N*/ //!this class.
+/*N*/
+/*N*/ const MapUnit eOld = pRefDev->GetMapMode().GetMapUnit();
+/*N*/ if ( MAP_100TH_MM != eOld )
+/*N*/ {
+/*N*/ MapMode aMap( pRefDev->GetMapMode() );
+/*N*/ aMap.SetMapUnit( MAP_100TH_MM );
+/*N*/ Point aTmp( aMap.GetOrigin() );
+/*N*/ aTmp.X() = OutputDevice::LogicToLogic( aTmp.X(), eOld, MAP_100TH_MM );
+/*N*/ aTmp.Y() = OutputDevice::LogicToLogic( aTmp.Y(), eOld, MAP_100TH_MM );
+/*N*/ aMap.SetOrigin( aTmp );
+/*N*/ pRefDev->SetMapMode( aMap );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ SmPrinterAccess::~SmPrinterAccess()
+/*N*/ {
+/*N*/ if ( pPrinter )
+/*N*/ pPrinter->Pop();
+/*N*/ if ( pRefDev && pRefDev != pPrinter )
+/*N*/ pRefDev->Pop();
+/*N*/ }
+
+////////////////////////////////////////
+
+/*N*/ Printer* SmDocShell::GetPrt()
+/*N*/ {
+/*N*/ if ( GetProtocol().IsInPlaceActive() ||
+/*N*/ SFX_CREATE_MODE_EMBEDDED == GetCreateMode() )
+/*N*/ {
+/*N*/ //Normalerweise wird der Printer vom Server besorgt. Wenn dieser aber
+/*N*/ //keinen liefert (weil etwa noch keine connection da ist), kann es
+/*N*/ //dennoch sein, dass wir den Printer kennen, denn dieser wird in
+/*N*/ //OnDocumentPrinterChanged vom Server durchgereicht und dann temporaer
+/*N*/ //festgehalten.
+/*N*/ Printer *pPrt = GetDocumentPrinter();
+/*N*/ if ( !pPrt && pTmpPrinter )
+/*N*/ pPrt = pTmpPrinter;
+/*N*/ return pPrt;
+/*N*/ }
+/*N*/ else if ( !pPrinter )
+/*N*/ {
+/*N*/ SfxItemSet *pOptions =
+/*N*/ new SfxItemSet(GetPool(),
+/*N*/ SID_PRINTSIZE, SID_PRINTSIZE,
+/*N*/ SID_PRINTZOOM, SID_PRINTZOOM,
+/*N*/ SID_PRINTTITLE, SID_PRINTTITLE,
+/*N*/ SID_PRINTTEXT, SID_PRINTTEXT,
+/*N*/ SID_PRINTFRAME, SID_PRINTFRAME,
+/*N*/ SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES,
+/*N*/ 0);
+/*N*/
+/*N*/ SmModule *pp = SM_MOD1();
+/*N*/ pp->GetConfig()->ConfigToItemSet(*pOptions);
+/*N*/ pPrinter = new SfxPrinter(pOptions);
+/*N*/ pPrinter->SetMapMode( MapMode(MAP_100TH_MM) );
+/*N*/ }
+/*N*/ return pPrinter;
+/*N*/ }
+
+/*N*/ OutputDevice* SmDocShell::GetRefDev()
+/*N*/ {
+/*N*/ if ( GetProtocol().IsInPlaceActive() ||
+/*N*/ SFX_CREATE_MODE_EMBEDDED == GetCreateMode() )
+/*N*/ {
+/*N*/ OutputDevice* pOutDev = GetDocumentRefDev();
+/*N*/ if ( pOutDev )
+/*N*/ return pOutDev;
+/*N*/ }
+/*N*/
+/*N*/ return GetPrt();
+/*N*/ }
+
+
+/*N*/ void SmDocShell::SetPrinter( SfxPrinter *pNew )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+/*N*/ void SmDocShell::OnDocumentPrinterChanged( Printer *pPrt )
+/*N*/ {
+/*N*/ pTmpPrinter = pPrt;
+/*N*/ SetFormulaArranged(FALSE);
+/*N*/ SM_MOD1()->GetRectCache()->Reset();
+/*N*/ Size aOldSize = GetVisArea().GetSize();
+/*N*/ Resize();
+/*N*/ if( aOldSize != GetVisArea().GetSize() && aText.Len() )
+/*N*/ SetModified( TRUE );
+/*N*/ pTmpPrinter = 0;
+/*N*/ }
+
+/*N*/ void SmDocShell::Resize()
+/*N*/ {
+/*N*/ Size aVisSize = GetSize();
+/*N*/
+/*N*/ BOOL bIsEnabled = IsEnableSetModified();
+/*N*/ if ( bIsEnabled )
+/*?*/ EnableSetModified( FALSE );
+/*N*/
+/*N*/ SetVisAreaSize( aVisSize );
+/*N*/
+/*N*/ if ( bIsEnabled )
+/*?*/ EnableSetModified( bIsEnabled );
+/*N*/ }
+
+
+/*N*/ SmDocShell::SmDocShell(SfxObjectCreateMode eMode) :
+/*N*/ SfxObjectShell(eMode),
+/*N*/ pSymSetMgr ( 0 ),
+/*N*/ pTree ( 0 ),
+/*N*/ pPrinter ( 0 ),
+/*N*/ pTmpPrinter ( 0 ),
+/*N*/ pEditEngineItemPool ( 0 ),
+/*N*/ pEditEngine ( 0 ),
+/*N*/ nModifyCount ( 0 ),
+/*N*/ bIsFormulaArranged ( FALSE )
+/*N*/ {
+/*N*/ SetPool(&SFX_APP()->GetPool());
+/*N*/
+/*N*/ SmModule *pp = SM_MOD1();
+/*N*/ aFormat = pp->GetConfig()->GetStandardFormat();
+/*N*/
+/*N*/ StartListening(aFormat);
+/*N*/ StartListening(*pp->GetConfig());
+/*N*/
+/*N*/ SetShell(this);
+/*N*/ SetModel( new SmModel(this) ); //! das hier mit new erzeugte Model brauch
+/*N*/ //! im Destruktor nicht explizit geloescht werden.
+/*N*/ //! Dies erledigt das Sfx.
+/*N*/ }
+
+
+
+/*N*/ SmDocShell::~SmDocShell()
+/*N*/ {
+/*N*/ SmModule *pp = SM_MOD1();
+/*N*/
+/*N*/ EndListening(aFormat);
+/*N*/ EndListening(*pp->GetConfig());
+/*N*/
+/*N*/ delete pEditEngine;
+/*N*/ delete pEditEngineItemPool;
+/*N*/ delete pTree;
+/*N*/ delete pPrinter;
+/*N*/ }
+
+
+
+/*N*/ void SmDocShell::ConvertText( String &rText, SmConvert eConv )
+/*N*/ // adapts the text 'rText' that suits one office version to be
+/*N*/ // usable in another office version.
+/*N*/ // Example: "2 over sin x" acts very different in 4.0 and 5.0,
+/*N*/ // and from 5.2 to 6.0 many symbol names were renamed.
+/*N*/ {
+/*N*/ if (pTree)
+/*N*/ delete pTree;
+/*N*/
+/*N*/ SmConvert eTmpConv = aInterpreter.GetConversion();
+/*N*/
+/*N*/ // parse in old style and make changes for new style
+/*N*/ aInterpreter.SetConversion(eConv);
+/*N*/ pTree = aInterpreter.Parse(rText);
+/*N*/ // get to new version converted text
+/*N*/ rText = aInterpreter.GetText();
+/*N*/
+/*N*/ aInterpreter.SetConversion(eTmpConv);
+/*N*/
+/*N*/ // clean up tree parsed in old style
+/*N*/ if (pTree)
+/*N*/ { delete pTree;
+/*N*/ pTree = NULL;
+/*N*/ }
+/*N*/ }
+
+
+
+
+
+
+
+
+/*N*/ BOOL SmDocShell::InitNew(SvStorage * pStor)
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ if (SfxInPlaceObject::InitNew(pStor))
+/*N*/ {
+/*N*/ bRet = TRUE;
+/*N*/ SetVisArea(Rectangle(Point(0, 0), Size(2000, 1000)));
+/*N*/ #if 0
+/*N*/ if (pStor)
+/*N*/ {
+/*N*/ aDocStream = pStor->OpenStream(String::CreateFromAscii(pStarMathDoc));
+/*N*/ aDocStream->SetVersion (pStor->GetVersion ());
+/*N*/ GetPool().SetFileFormatVersion(USHORT(pStor->GetVersion()));
+/*N*/
+/*N*/ if (! aDocStream )
+/*N*/ bRet = FALSE;
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ BOOL SmDocShell::Load(SvStorage *pStor)
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ if( SfxInPlaceObject::Load( pStor ))
+/*N*/ {
+/*N*/ String aTmpStr( C2S( "Equation Native" ));
+/*N*/ if( pStor->IsStream( aTmpStr ))
+/*N*/ {
+/*N*/ // is this a MathType Storage?
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ MathType aEquation(aText);
+/*N*/ }
+/*N*/ else if( pStor->IsStream(C2S("content.xml")) ||
+/*N*/ pStor->IsStream(C2S("Content.xml")) )
+/*N*/ {
+/*?*/ // is this a fabulous math package ?
+/*?*/ Reference< ::com::sun::star::frame::XModel> xModel(GetModel());
+/*?*/ SmXMLWrapper aEquation(xModel);
+/*?*/ SfxMedium aMedium(pStor);
+/*?*/ ULONG nError = aEquation.Import(aMedium);
+/*?*/ bRet = 0 == nError;
+/*?*/ SetError( nError );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bRet = Try3x(pStor, STREAM_READWRITE);
+/*N*/
+/*N*/ if( !bRet )
+/*N*/ {
+/*?*/ pStor->Remove(String::CreateFromAscii(pStarMathDoc));
+/*?*/ bRet = Try2x(pStor, STREAM_READWRITE);
+/*?*/ pStor->Remove(C2S("\1Ole10Native"));
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ long nVersion = pStor->GetVersion();
+/*N*/ if ( nVersion <= SOFFICE_FILEFORMAT_40 )
+/*N*/ ConvertText( aText, CONVERT_40_TO_50 );
+/*N*/ if ( nVersion <= SOFFICE_FILEFORMAT_50 )
+/*N*/ ConvertText( aText, CONVERT_50_TO_60 );
+/*N*/ if (pTree)
+/*?*/ { delete pTree;
+/*?*/ pTree = NULL;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ FinishedLoading( SFX_LOADED_ALL );
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+
+//------------------------------------------------------------------
+
+/*N*/ void SmDocShell::ImplSave( SvStorageStreamRef xStrm )
+/*N*/ {
+/*N*/ String aTmp( aText );
+/*N*/ if (SOFFICE_FILEFORMAT_50 >= xStrm->GetVersion())
+/*N*/ ConvertText( aTmp, CONVERT_60_TO_50 );
+/*N*/ ByteString exString( ExportString( aTmp ) );
+/*N*/
+/*N*/ *xStrm << SM304AIDENT << SM50VERSION
+/*N*/ << 'T';
+/*N*/ xStrm->WriteByteString(exString);
+/*N*/ *xStrm << 'F' << aFormat
+/*N*/ << 'S';
+/*N*/ xStrm->WriteByteString( ExportString(C2S("unknown")) );
+/*N*/ *xStrm << (USHORT) 0
+/*N*/ << '\0';
+/*N*/ }
+
+/*N*/ BOOL SmDocShell::Save()
+/*N*/ {
+/*N*/ //! apply latest changes if necessary
+/*N*/ UpdateText();
+/*N*/
+/*N*/ if ( SfxInPlaceObject::Save() )
+/*N*/ {
+/*N*/ if( !pTree )
+/*N*/ Parse();
+/*N*/ if( pTree && !IsFormulaArranged() )
+/*N*/ ArrangeFormula();
+/*N*/
+/*N*/ SvStorage *pStor = GetStorage();
+/*N*/ if(pStor->GetVersion() >= SOFFICE_FILEFORMAT_60)
+/*N*/ {
+/*N*/ // a math package as a storage
+/*N*/ Reference< ::com::sun::star::frame::XModel> xModel(GetModel());
+/*N*/ SmXMLWrapper aEquation(xModel);
+/*N*/ SfxMedium aMedium(pStor);
+/*N*/ aEquation.SetFlat(sal_False);
+/*N*/ return aEquation.Export(aMedium);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ aDocStream = pStor->OpenStream(String::CreateFromAscii(pStarMathDoc));
+/*?*/ aDocStream->SetVersion (pStor->GetVersion ());
+/*?*/ GetPool().SetFileFormatVersion(USHORT(pStor->GetVersion()));
+/*?*/
+/*?*/ aDocStream->Seek(0);
+/*?*/ ImplSave( aDocStream );
+/*?*/
+/*?*/ aDocStream.Clear();
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ void SmDocShell::UpdateText()
+/*N*/ {
+/*N*/ if (pEditEngine && pEditEngine->IsModified())
+/*N*/ {
+/*N*/ String aEngTxt( pEditEngine->GetText( LINEEND_LF ) );
+/*N*/ if (GetText() != aEngTxt)
+/*N*/ SetText( aEngTxt );
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ BOOL SmDocShell::SaveAs(SvStorage * pNewStor)
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/
+/*N*/ //! apply latest changes if necessary
+/*N*/ UpdateText();
+/*N*/
+/*N*/ if ( SfxInPlaceObject::SaveAs( pNewStor ) )
+/*N*/ {
+/*N*/ if( !pTree )
+/*?*/ Parse();
+/*N*/ if( pTree && !IsFormulaArranged() )
+/*?*/ ArrangeFormula();
+/*N*/
+/*N*/ if (pNewStor->GetVersion() >= SOFFICE_FILEFORMAT_60)
+/*N*/ {
+/*N*/ // a math package as a storage
+/*?*/ Reference< ::com::sun::star::frame::XModel> xModel(GetModel());
+/*?*/ SmXMLWrapper aEquation(xModel);
+/*?*/ SfxMedium aMedium(pNewStor);
+/*?*/ aEquation.SetFlat(sal_False);
+/*?*/ bRet = aEquation.Export(aMedium);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SvStorageStreamRef aStm = pNewStor->OpenStream(
+/*N*/ String::CreateFromAscii(pStarMathDoc));
+/*N*/ aStm->SetVersion( pNewStor->GetVersion() );
+/*N*/ GetPool().SetFileFormatVersion( USHORT( pNewStor->GetVersion() ));
+/*N*/ aStm->SetBufferSize(DOCUMENT_BUFFER_SIZE);
+/*N*/ aStm->SetKey( pNewStor->GetKey() ); // Passwort setzen
+/*N*/
+/*N*/ if ( aStm.Is() )
+/*N*/ {
+/*N*/ ImplSave( aStm );
+/*N*/ bRet = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ BOOL SmDocShell::SaveCompleted(SvStorage * pStor)
+/*N*/ {
+/*N*/ if( SfxInPlaceObject::SaveCompleted( pStor ))
+/*N*/ {
+/*N*/ #if 0
+/*N*/ if (! pStor)
+/*N*/ return TRUE;
+/*N*/
+/*N*/ aDocStream = pStor->OpenStream(String::CreateFromAscii(pStarMathDoc));
+/*N*/ aDocStream->SetVersion (pStor->GetVersion ());
+/*N*/ GetPool().SetFileFormatVersion(USHORT(pStor->GetVersion()));
+/*N*/ aDocStream->SetBufferSize(DOCUMENT_BUFFER_SIZE);
+/*N*/ aDocStream->SetKey( pStor->GetKey() ); // Passwort setzen
+/*N*/ return aDocStream.Is();
+/*N*/ #endif
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+
+
+
+
+/*N*/ void SmDocShell::HandsOff()
+/*N*/ {
+/*N*/ SfxInPlaceObject::HandsOff();
+/*N*/ #if 0
+/*N*/ aDocStream.Clear();
+/*N*/ #endif
+/*N*/ }
+
+
+/*N*/ SfxItemPool& SmDocShell::GetPool()
+/*N*/ {
+/*N*/ return SFX_APP()->GetPool();
+/*N*/ }
+
+/*N*/ void SmDocShell::SetVisArea (const Rectangle & rVisArea)
+/*N*/ {
+/*N*/ Rectangle aNewRect (rVisArea);
+/*N*/
+/*N*/ aNewRect.SetPos(Point ());
+/*N*/
+/*N*/ if (! aNewRect.Right ()) aNewRect.Right () = 2000;
+/*N*/ if (! aNewRect.Bottom ()) aNewRect.Bottom () = 1000;
+/*N*/
+/*N*/ BOOL bIsEnabled = IsEnableSetModified();
+/*N*/ if ( bIsEnabled )
+/*?*/ EnableSetModified( FALSE );
+/*N*/
+/*N*/ // If outplace editing, then dont resize the OutplaceWindow. But the
+/*N*/ // ObjectShell has to resize. Bug 56470
+/*N*/
+/*N*/ SfxInPlaceObject::SetVisArea( aNewRect );
+/*N*/
+/*N*/
+/*N*/ if ( bIsEnabled )
+/*?*/ EnableSetModified( bIsEnabled );
+/*N*/ }
+
+
+/*N*/ BOOL SmDocShell::Try3x (SvStorage *pStor,
+/*N*/ StreamMode eMode)
+/*N*/
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/
+/*N*/ SvStorageStreamRef aTempStream = pStor->OpenStream(
+/*N*/ String::CreateFromAscii(pStarMathDoc), eMode);
+/*N*/ aTempStream->SetVersion (pStor->GetVersion ());
+/*N*/ GetPool().SetFileFormatVersion (USHORT(pStor->GetVersion()));
+/*N*/ aTempStream->SetBufferSize(DOCUMENT_BUFFER_SIZE);
+/*N*/ aTempStream->SetKey( pStor->GetKey() ); // Passwort setzen
+/*N*/
+/*N*/ if (aTempStream->GetError() == 0)
+/*N*/ {
+/*N*/ SvStream* pSvStream = aTempStream;
+/*N*/ char cTag;
+/*N*/ sal_uInt32 lIdent, lVersion;
+/*N*/ long lTime;
+/*N*/ sal_uInt32 lDate;
+/*N*/ String aBuffer;
+/*N*/ ByteString aByteStr;
+/*N*/
+/*N*/ *pSvStream >> lIdent >> lVersion;
+/*N*/
+/*N*/ if ((lIdent == SM30IDENT) || (lIdent == SM30BIDENT) || (lIdent == SM304AIDENT))
+/*N*/ {
+/*N*/ DBG_ASSERT((lVersion == SM30VERSION) ||
+/*N*/ (lVersion == SM50VERSION), "Illegal file version");
+/*N*/
+/*N*/ *pSvStream >> cTag;
+/*N*/ rtl_TextEncoding eEnc = RTL_TEXTENCODING_MS_1252;
+/*N*/ while (cTag && !pSvStream->IsEof())
+/*N*/ {
+/*N*/ switch (cTag)
+/*N*/ {
+/*N*/ case 'T':
+/*N*/ pSvStream->ReadByteString( aByteStr );
+/*N*/ aText = ImportString( aByteStr );
+/*N*/ Parse();
+/*N*/ break;
+/*N*/
+/*N*/ 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;
+/*N*/
+/*N*/ case 'F':
+/*N*/ *pSvStream >> aFormat;
+/*N*/ if (lIdent != SM304AIDENT)
+/*?*/ aFormat.From300To304a ();
+/*N*/ else if ( lVersion == SM30VERSION )
+/*N*/ {
+/*?*/ aFormat.SetDistance(DIS_LEFTSPACE, 100);
+/*?*/ aFormat.SetDistance(DIS_RIGHTSPACE, 100);
+/*?*/ aFormat.SetDistance(DIS_TOPSPACE, 100);
+/*?*/ aFormat.SetDistance(DIS_BOTTOMSPACE, 100);
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case 'S':
+/*N*/ {
+/*N*/ String aTmp;
+/*N*/ USHORT n;
+/*N*/ pSvStream->ReadByteString(aTmp, eEnc);
+/*N*/ *pSvStream >> n;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ default:
+/*N*/ DBG_ASSERT((cTag != 0), "Illegal data tag");
+/*N*/ }
+/*N*/ *pSvStream >> cTag;
+/*N*/ }
+/*N*/
+/*N*/ bRet = TRUE;
+/*N*/ #if 0
+/*N*/ aDocStream = aTempStream;
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if (!bRet)
+/*N*/ {
+/*N*/ // kein Passwort gesetzt --> Datei marode
+/*?*/ if (pStor->GetKey().Len() == 0)
+/*?*/ {
+/*?*/ SetError(ERRCODE_SFX_DOLOADFAILED);
+/*?*/ }
+/*?*/ // Passwort gesetzt --> war wohl falsch
+/*?*/ else
+/*?*/ {
+/*?*/ SetError(ERRCODE_SFX_WRONGPASSWORD);
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+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;
+ sal_uInt32 lIdent, lVersion;
+ long lTime;
+ sal_uInt32 lDate;
+ UINT32 lDataSize;
+ String aBuffer;
+ ByteString aByteStr;
+ SmSymSet *pSymbolSet;
+
+ *pSvStream >> lDataSize >> lIdent >> lVersion;
+
+ if (lIdent == FRMIDENT)
+ {
+ DBG_ASSERT((lVersion == FRMVERSION), "Illegal file version");
+
+ *pSvStream >> cTag;
+ rtl_TextEncoding eEnc = RTL_TEXTENCODING_MS_1252;
+ while (cTag && !pSvStream->IsEof())
+ {
+ switch (cTag)
+ {
+ case 'T':
+ pSvStream->ReadByteString( aByteStr );
+ aText = ImportString( aByteStr );
+ 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':
+ {
+ // not sure about this...
+ /* ??? pSymbolSet = new SmSymSet();
+ ReadSM20SymSet(pSvStream, pSymbolSet);
+ delete pSymbolSet; */
+ String aTmp;
+ USHORT n;
+ pSvStream->ReadByteString(aTmp, eEnc);
+ *pSvStream >> n;
+ break;
+ }
+
+ default:
+ DBG_ASSERT((cTag != 0), "Illegal data tag");
+ }
+ *pSvStream >> cTag;
+ }
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+
+
+
+/*N*/ void SmDocShell::FillClass(SvGlobalName* pClassName,
+/*N*/ ULONG* pFormat,
+/*N*/ String* pAppName,
+/*N*/ String* pFullTypeName,
+/*N*/ String* pShortTypeName,
+/*N*/ long nFileFormat) const
+/*N*/ {
+/*N*/ SfxInPlaceObject::FillClass(pClassName, pFormat, pAppName, pFullTypeName,
+/*N*/ pShortTypeName, nFileFormat);
+/*N*/
+/*N*/ if (nFileFormat == SOFFICE_FILEFORMAT_31)
+/*N*/ {
+/*N*/ *pClassName = SvGlobalName(BF_SO3_SM_CLASSID_30);
+/*N*/ *pFormat = SOT_FORMATSTR_ID_STARMATH;
+/*N*/ pAppName->AssignAscii( RTL_CONSTASCII_STRINGPARAM("Smath 3.1"));
+/*N*/ *pFullTypeName = String(SmResId(STR_MATH_DOCUMENT_FULLTYPE_31));
+/*N*/ *pShortTypeName = String(SmResId(RID_DOCUMENTSTR));
+/*N*/ }
+/*N*/ else if (nFileFormat == SOFFICE_FILEFORMAT_40)
+/*N*/ {
+/*N*/ *pClassName = SvGlobalName(BF_SO3_SM_CLASSID_40);
+/*N*/ *pFormat = SOT_FORMATSTR_ID_STARMATH_40;
+/*N*/ *pFullTypeName = String(SmResId(STR_MATH_DOCUMENT_FULLTYPE_40));
+/*N*/ *pShortTypeName = String(SmResId(RID_DOCUMENTSTR));
+/*N*/ }
+/*N*/ else if (nFileFormat == SOFFICE_FILEFORMAT_50)
+/*N*/ {
+/*N*/ *pClassName = SvGlobalName(BF_SO3_SM_CLASSID_50);
+/*N*/ *pFormat = SOT_FORMATSTR_ID_STARMATH_50;
+/*N*/ *pFullTypeName = String(SmResId(STR_MATH_DOCUMENT_FULLTYPE_50));
+/*N*/ *pShortTypeName = String(SmResId(RID_DOCUMENTSTR));
+/*N*/ }
+/*N*/ else if (nFileFormat == SOFFICE_FILEFORMAT_60 )
+/*N*/ {
+/*N*/ *pFullTypeName = String(SmResId(STR_MATH_DOCUMENT_FULLTYPE_60));
+/*N*/ *pShortTypeName = String(SmResId(RID_DOCUMENTSTR));
+
+ // for binfilter, we need the FormatIDs to be set. Not setting them
+ // has always been an error (!)
+ *pClassName = SvGlobalName(BF_SO3_SM_CLASSID_60);
+ *pFormat = SOT_FORMATSTR_ID_STARMATH_60;
+
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ ULONG SmDocShell::GetMiscStatus() const
+/*N*/ {
+/*N*/ return SfxInPlaceObject::GetMiscStatus() | SVOBJ_MISCSTATUS_NOTRESIZEABLE
+/*N*/ | SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE;
+/*N*/ }
+
+/*N*/ void SmDocShell::SetModified(BOOL bModified)
+/*N*/ {
+/*N*/ if( IsEnableSetModified() )
+/*N*/ SfxObjectShell::SetModified( bModified );
+/*N*/ Broadcast(SfxSimpleHint(SFX_HINT_DOCCHANGED));
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_format.cxx b/binfilter/bf_starmath/source/starmath_format.cxx
new file mode 100644
index 000000000000..e858f32433ec
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_format.cxx
@@ -0,0 +1,405 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <tools/stream.hxx>
+#include <vcl/svapp.hxx>
+#include <bf_svx/scripttypeitem.hxx>
+
+#include "format.hxx"
+namespace binfilter {
+
+/////////////////////////////////////////////////////////////////
+
+// Latin default-fonts
+/*N*/ static const USHORT aLatinDefFnts[FNT_END] =
+/*N*/ {
+/*N*/ DEFAULTFONT_SERIF, // FNT_VARIABLE
+/*N*/ DEFAULTFONT_SERIF, // FNT_FUNCTION
+/*N*/ DEFAULTFONT_SERIF, // FNT_NUMBER
+/*N*/ DEFAULTFONT_SERIF, // FNT_TEXT
+/*N*/ DEFAULTFONT_SERIF, // FNT_SERIF
+/*N*/ DEFAULTFONT_SANS, // FNT_SANS
+/*N*/ DEFAULTFONT_FIXED // FNT_FIXED
+/*N*/ //StarSymbol, // FNT_MATH
+/*N*/ };
+
+// CJK default-fonts
+//! we use non-asian fonts for variables, functions and numbers since they
+//! look better and even in asia only latin letters will be used for those.
+//! At least that's what I was told...
+/*N*/ static const USHORT aCJKDefFnts[FNT_END] =
+/*N*/ {
+/*N*/ DEFAULTFONT_SERIF, // FNT_VARIABLE
+/*N*/ DEFAULTFONT_SERIF, // FNT_FUNCTION
+/*N*/ DEFAULTFONT_SERIF, // FNT_NUMBER
+/*N*/ DEFAULTFONT_CJK_TEXT, // FNT_TEXT
+/*N*/ DEFAULTFONT_CJK_TEXT, // FNT_SERIF
+/*N*/ DEFAULTFONT_CJK_DISPLAY, // FNT_SANS
+/*N*/ DEFAULTFONT_CJK_TEXT // FNT_FIXED
+/*N*/ //StarSymbol, // FNT_MATH
+/*N*/ };
+
+// CTL default-fonts
+/*N*/ static const USHORT aCTLDefFnts[FNT_END] =
+/*N*/ {
+/*N*/ DEFAULTFONT_CTL_TEXT, // FNT_VARIABLE
+/*N*/ DEFAULTFONT_CTL_TEXT, // FNT_FUNCTION
+/*N*/ DEFAULTFONT_CTL_TEXT, // FNT_NUMBER
+/*N*/ DEFAULTFONT_CTL_TEXT, // FNT_TEXT
+/*N*/ DEFAULTFONT_CTL_TEXT, // FNT_SERIF
+/*N*/ DEFAULTFONT_CTL_TEXT, // FNT_SANS
+/*N*/ DEFAULTFONT_CTL_TEXT // FNT_FIXED
+/*N*/ //StarSymbol, // FNT_MATH
+/*N*/ };
+
+
+/*N*/ String GetDefaultFontName( LanguageType nLang, USHORT nIdent )
+/*N*/ {
+/*N*/ DBG_ASSERT( FNT_BEGIN <= nIdent && nIdent <= FNT_END,
+/*N*/ "index out opd range" );
+/*N*/
+/*N*/ if (FNT_MATH == nIdent)
+/*?*/ return String::CreateFromAscii( FNTNAME_MATH );
+/*N*/ else
+/*N*/ {
+/*N*/ const USHORT *pTable;
+/*N*/ switch ( SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ) )
+/*N*/ {
+/*N*/ case SCRIPTTYPE_LATIN : pTable = aLatinDefFnts; break;
+/*?*/ case SCRIPTTYPE_ASIAN : pTable = aCJKDefFnts; break;
+/*?*/ case SCRIPTTYPE_COMPLEX : pTable = aCTLDefFnts; break;
+/*?*/ default :
+/*?*/ pTable = aLatinDefFnts;
+/*?*/ DBG_ERROR( "unknown script-type" );
+/*N*/ }
+/*N*/
+/*N*/ return Application::GetDefaultDevice()->GetDefaultFont(
+/*N*/ pTable[ nIdent ], nLang,
+/*N*/ DEFAULTFONT_FLAGS_ONLYONE ).GetName();
+/*N*/ }
+/*N*/ }
+
+/////////////////////////////////////////////////////////////////
+
+/*N*/ SmFormat::SmFormat()
+/*N*/ : aBaseSize(0, SmPtsTo100th_mm(12))
+/*N*/ {
+/*N*/ nVersion = SM_FMT_VERSION_NOW;
+/*N*/
+/*N*/ eHorAlign = AlignCenter;
+/*N*/ bIsTextmode = bScaleNormalBrackets = FALSE;
+/*N*/
+/*N*/ vSize[SIZ_TEXT] = 100;
+/*N*/ vSize[SIZ_INDEX] = 60;
+/*N*/ vSize[SIZ_FUNCTION] =
+/*N*/ vSize[SIZ_OPERATOR] = 100;
+/*N*/ vSize[SIZ_LIMITS] = 60;
+/*N*/
+/*N*/ vDist[DIS_HORIZONTAL] = 10;
+/*N*/ vDist[DIS_VERTICAL] = 5;
+/*N*/ vDist[DIS_ROOT] = 0;
+/*N*/ vDist[DIS_SUPERSCRIPT] =
+/*N*/ vDist[DIS_SUBSCRIPT] = 20;
+/*N*/ vDist[DIS_NUMERATOR] =
+/*N*/ vDist[DIS_DENOMINATOR] = 0;
+/*N*/ vDist[DIS_FRACTION] = 10;
+/*N*/ vDist[DIS_STROKEWIDTH] = 5;
+/*N*/ vDist[DIS_UPPERLIMIT] =
+/*N*/ vDist[DIS_LOWERLIMIT] = 0;
+/*N*/ vDist[DIS_BRACKETSIZE] =
+/*N*/ vDist[DIS_BRACKETSPACE] = 5;
+/*N*/ vDist[DIS_MATRIXROW] = 3;
+/*N*/ vDist[DIS_MATRIXCOL] = 30;
+/*N*/ vDist[DIS_ORNAMENTSIZE] =
+/*N*/ vDist[DIS_ORNAMENTSPACE] = 0;
+/*N*/ vDist[DIS_OPERATORSIZE] = 50;
+/*N*/ vDist[DIS_OPERATORSPACE] = 20;
+/*N*/ vDist[DIS_LEFTSPACE] =
+/*N*/ vDist[DIS_RIGHTSPACE] = 100;
+/*N*/ vDist[DIS_TOPSPACE] =
+/*N*/ vDist[DIS_BOTTOMSPACE] =
+/*N*/ vDist[DIS_NORMALBRACKETSIZE] = 0;
+/*N*/
+/*N*/ vFont[FNT_VARIABLE] =
+/*N*/ vFont[FNT_FUNCTION] =
+/*N*/ vFont[FNT_NUMBER] =
+/*N*/ vFont[FNT_TEXT] =
+/*N*/ vFont[FNT_SERIF] = SmFace(C2S(FNTNAME_TIMES), aBaseSize);
+/*N*/ vFont[FNT_SANS] = SmFace(C2S(FNTNAME_HELV), aBaseSize);
+/*N*/ vFont[FNT_FIXED] = SmFace(C2S(FNTNAME_COUR), aBaseSize);
+/*N*/ vFont[FNT_MATH] = SmFace(C2S(FNTNAME_MATH), aBaseSize);
+/*N*/
+/*N*/ vFont[FNT_MATH].SetCharSet( RTL_TEXTENCODING_UNICODE );
+/*N*/
+/*N*/ vFont[FNT_VARIABLE].SetItalic(ITALIC_NORMAL);
+/*N*/ vFont[FNT_FUNCTION].SetItalic(ITALIC_NONE);
+/*N*/ vFont[FNT_TEXT].SetItalic(ITALIC_NONE);
+/*N*/
+/*N*/ for ( USHORT i = FNT_BEGIN; i <= FNT_END; i++ )
+/*N*/ {
+/*N*/ SmFace &rFace = vFont[i];
+/*N*/ rFace.SetTransparent( TRUE );
+/*N*/ rFace.SetAlign( ALIGN_BASELINE );
+/*N*/ rFace.SetColor( COL_AUTO );
+/*N*/ bDefaultFont[i] = FALSE;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmFormat::SetFont(USHORT nIdent, const SmFace &rFont, BOOL bDefault )
+/*N*/ {
+/*N*/ vFont[nIdent] = rFont;
+/*N*/ vFont[nIdent].SetTransparent( TRUE );
+/*N*/ vFont[nIdent].SetAlign( ALIGN_BASELINE );
+/*N*/
+/*N*/ bDefaultFont[nIdent] = bDefault;
+/*N*/ }
+
+/*N*/ SmFormat & SmFormat::operator = (const SmFormat &rFormat)
+/*N*/ {
+/*N*/ SetBaseSize(rFormat.GetBaseSize());
+/*N*/ SetVersion (rFormat.GetVersion());
+/*N*/ SetHorAlign(rFormat.GetHorAlign());
+/*N*/ SetTextmode(rFormat.IsTextmode());
+/*N*/ SetScaleNormalBrackets(rFormat.IsScaleNormalBrackets());
+/*N*/
+/*N*/ USHORT i;
+/*N*/ for (i = FNT_BEGIN; i <= FNT_END; i++)
+/*N*/ {
+/*N*/ SetFont(i, rFormat.GetFont(i));
+/*N*/ SetDefaultFont(i, rFormat.IsDefaultFont(i));
+/*N*/ }
+/*N*/ for (i = SIZ_BEGIN; i <= SIZ_END; i++)
+/*N*/ SetRelSize(i, rFormat.GetRelSize(i));
+/*N*/ for (i = DIS_BEGIN; i <= DIS_END; i++)
+/*N*/ SetDistance(i, rFormat.GetDistance(i));
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ BOOL SmFormat::operator == (const SmFormat &rFormat) const
+/*N*/ {
+/*N*/ BOOL bRes = aBaseSize == rFormat.aBaseSize &&
+/*N*/ eHorAlign == rFormat.eHorAlign &&
+/*N*/ bIsTextmode == rFormat.bIsTextmode &&
+/*N*/ bScaleNormalBrackets == rFormat.bScaleNormalBrackets;
+/*N*/
+/*N*/ USHORT i;
+/*N*/ for (i = 0; i <= SIZ_END && bRes; ++i)
+/*N*/ {
+/*N*/ if (vSize[i] != rFormat.vSize[i])
+/*N*/ bRes = FALSE;
+/*N*/ }
+/*N*/ for (i = 0; i <= DIS_END && bRes; ++i)
+/*N*/ {
+/*N*/ if (vDist[i] != rFormat.vDist[i])
+/*N*/ bRes = FALSE;
+/*N*/ }
+/*N*/ for (i = 0; i <= FNT_END && bRes; ++i)
+/*N*/ {
+/*N*/ if (vFont[i] != rFormat.vFont[i] ||
+/*N*/ bDefaultFont[i] != rFormat.bDefaultFont[i])
+/*N*/ bRes = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ return bRes;
+/*N*/ }
+
+
+/*N*/ SvStream & operator << (SvStream &rStream, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ //Da hier keinerlei Kompatibilitaet vorgesehen ist muessen wir leider
+/*N*/ //heftig tricksen. Gluecklicherweise sind offenbar einige Informationen
+/*N*/ //ueberfluessig geworden. In diese quetschen wir jetzt vier neue
+/*N*/ //Einstellungen fuer die Rander.
+/*N*/ //Bei Gelegenheit wird hier ein Im- Und Export gebraucht. Dann muessen
+/*N*/ //die Stream-Operatoren dieser Klassen dringend mit Versionsverwaltung
+/*N*/ //versehen werden!
+/*N*/
+/*N*/ UINT16 n;
+/*N*/
+/*N*/ // convert the heigth (in 100th of mm) to Pt and round the result to the
+/*N*/ // nearest integer
+/*N*/ n = (UINT16) SmRoundFraction(Sm100th_mmToPts(rFormat.aBaseSize.Height()));
+/*N*/ DBG_ASSERT((n & 0xFF00) == 0, "Sm : higher Byte nicht leer");
+/*N*/
+/*N*/ // to be compatible with the old format (size and order) we put the info
+/*N*/ // about textmode in the higher byte (height is already restricted to a
+/*N*/ // maximum of 127!)
+/*N*/ n |= (rFormat.bIsTextmode != 0) << 8
+/*N*/ | (rFormat.bScaleNormalBrackets != 0) << 9;
+/*N*/ rStream << n;
+/*N*/
+/*N*/ rStream << rFormat.vDist[DIS_LEFTSPACE]; //Wir nutzen den Platz
+/*N*/ rStream << rFormat.vDist[DIS_RIGHTSPACE]; //Wir nutzen den Platz
+/*N*/
+/*N*/ for ( n = SIZ_BEGIN; n <= SIZ_END; ++n )
+/*N*/ rStream << rFormat.vSize[n];
+/*N*/
+/*N*/ rStream << rFormat.vDist[DIS_TOPSPACE]; //Wir nutzen den Platz
+/*N*/
+/*N*/ for ( n = 0; n <= FNT_FIXED; ++n )
+/*N*/ rStream << rFormat.vFont[n];
+/*N*/
+/*N*/ // Den zweiten Wert noch im HigherByte unterbringen
+/*N*/ USHORT uTmp = rFormat.vDist[DIS_BRACKETSIZE]
+/*N*/ | rFormat.vDist[DIS_NORMALBRACKETSIZE] << 8;
+/*N*/ // und dann dieses rausstreamen
+/*N*/ for ( n = 0; n <= DIS_OPERATORSPACE; ++n )
+/*N*/ rStream << (USHORT)(n != DIS_BRACKETSIZE ? rFormat.vDist[(USHORT) n] : uTmp);
+/*N*/
+/*N*/ // higher byte is version number, lower byte is horizontal alignment
+/*N*/ n = rFormat.eHorAlign | SM_FMT_VERSION_NOW << 8;
+/*N*/ rStream << n;
+/*N*/
+/*N*/ rStream << rFormat.vDist[DIS_BOTTOMSPACE]; //Wir nutzen den Platz
+/*N*/
+/*N*/ return rStream;
+/*N*/ }
+
+
+/*N*/ SvStream & operator >> (SvStream &rStream, SmFormat &rFormat)
+/*N*/ {
+/*N*/ UINT16 n;
+/*N*/
+/*N*/ rStream >> n;
+/*N*/ long nBaseHeight = n & 0x00FF;
+/*N*/ rFormat.bIsTextmode = ((n >> 8) & 0x01) != 0;
+/*N*/ rFormat.bScaleNormalBrackets = ((n >> 9) & 0x01) != 0;
+/*N*/ rFormat.aBaseSize = Size(0, SmPtsTo100th_mm(nBaseHeight));
+/*N*/
+/*N*/ rStream >> rFormat.vDist[DIS_LEFTSPACE]; //Wir nutzen den Platz
+/*N*/ rStream >> rFormat.vDist[DIS_RIGHTSPACE]; //Wir nutzen den Platz
+/*N*/
+/*N*/ for ( n = SIZ_BEGIN; n <= SIZ_END; ++n )
+/*N*/ rStream >> rFormat.vSize[n];
+/*N*/
+/*N*/ rStream >> rFormat.vDist[DIS_TOPSPACE]; //Wir nutzen den Platz
+/*N*/
+/*N*/ for ( n = 0; n <= FNT_FIXED; ++n )
+/*N*/ rStream >> rFormat.vFont[n];
+/*N*/
+/*N*/ for ( n = 0; n <= DIS_OPERATORSPACE; ++n )
+/*N*/ rStream >> rFormat.vDist[n];
+/*N*/ // den zweiten Wert aus dem HigherByte holen
+/*N*/ rFormat.vDist[DIS_NORMALBRACKETSIZE] = rFormat.vDist[DIS_BRACKETSIZE] >> 8;
+/*N*/ // und dieses dann ausblenden
+/*N*/ rFormat.vDist[DIS_BRACKETSIZE] &= 0x00FF;
+/*N*/
+/*N*/ // higher byte is version number, lower byte is horizontal alignment
+/*N*/ rStream >> n;
+/*N*/ rFormat.nVersion = n >> 8;
+/*N*/ rFormat.eHorAlign = (SmHorAlign) (n & 0x00FF);
+/*N*/
+/*N*/ rStream >> rFormat.vDist[DIS_BOTTOMSPACE]; //Wir nutzen den Platz
+/*N*/
+/*N*/ const Size aTmp( rFormat.GetBaseSize() );
+/*N*/ for ( USHORT i = 0; i <= FNT_FIXED; ++i )
+/*N*/ {
+/*N*/ rFormat.vFont[i].SetSize(aTmp);
+/*N*/ rFormat.vFont[i].SetTransparent(TRUE);
+/*N*/ rFormat.vFont[i].SetAlign(ALIGN_BASELINE);
+/*N*/ }
+/*N*/ rFormat.vFont[FNT_MATH].SetSize(aTmp);
+/*N*/
+/*N*/ // Fuer Version 4.0 (und aelter) sollen auch die normalen Klammern skalierbar
+/*N*/ // sein und wachsen (so wie es der Fall war), in der 5.0 Version jedoch nicht.
+/*N*/ // In spaeteren Versionen (>= 5.1) ist das Verhalten nun durch den Anwender
+/*N*/ // festzulegen (bleibt also wie aus dem Stream gelesen).
+/*N*/ if (rFormat.nVersion < SM_FMT_VERSION_51)
+/*N*/ {
+/*?*/ 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);
+/*N*/ }
+/*N*/
+/*N*/ return rStream;
+/*N*/ }
+
+/*?*/ 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, vFont[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++)
+/*?*/ {
+/*?*/ SmFace &rFace = vFont[i];
+/*?*/ rFace.SetSize(aTmp);
+/*?*/ rFace.SetTransparent(TRUE);
+/*?*/ rFace.SetAlign(ALIGN_BASELINE);
+/*?*/ }
+/*?*/ vFont[FNT_MATH].SetSize(aTmp);
+/*?*/ }
+
+
+/*N*/ void SmFormat::From300To304a()
+/*N*/ {
+/*N*/ long nBaseSize = SmRoundFraction(Sm100th_mmToPts(aBaseSize.Height()))
+/*N*/ * 2540l / 72l;
+/*N*/ for (USHORT i = DIS_BEGIN; i < DIS_OPERATORSPACE; i++)
+/*N*/ SetDistance(i, USHORT(GetDistance(i) * 254000L / 72L / nBaseSize));
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_mathml.cxx b/binfilter/bf_starmath/source/starmath_mathml.cxx
new file mode 100644
index 000000000000..135b5b6530e8
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_mathml.cxx
@@ -0,0 +1,4174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/*
+ Warning: The SvXMLElementExport helper class creates the beginning and
+ closing tags of xml elements in its constructor and destructor, so theres
+ hidden stuff going on, on occasion the ordering of these classes declarations
+ may be significant
+*/
+
+/*todo: Change characters and tcharacters to accumulate the characters together
+into one string, xml parser hands them to us line by line rather than all in
+one go*/
+
+#include <tools/debug.hxx>
+#include <rtl/math.hxx>
+#include <bf_svtools/sfxecode.hxx>
+#include <bf_svtools/saveopt.hxx>
+#include <bf_sfx2/docfile.hxx>
+
+#include <bf_sfx2/appuno.hxx>
+
+#include <unomodel.hxx>
+#include <mathml.hxx>
+#include <document.hxx>
+#include <utility.hxx>
+
+#include <osl/mutex.hxx>
+
+#include <com/sun/star/uno/Any.h>
+
+#include <bf_xmloff/xmlnmspe.hxx>
+#include <bf_xmloff/xmlkywd.hxx>
+#include <bf_xmloff/xmltoken.hxx>
+#include <bf_xmloff/nmspmap.hxx>
+#include <bf_xmloff/attrlist.hxx>
+#include <bf_xmloff/xmluconv.hxx>
+#include <bf_xmloff/xmlmetai.hxx>
+
+#include <unotools/processfactory.hxx>
+#include <unotools/streamwrap.hxx>
+
+#include <com/sun/star/xml/sax/XErrorHandler.hpp>
+#include <com/sun/star/xml/sax/XEntityResolver.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XDTDHandler.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XActiveDataControl.hpp>
+
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <comphelper/genericpropertyset.hxx>
+
+#include <bf_svtools/itemprop.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star;
+using namespace ::binfilter::xmloff::token;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+#include "mathtype.hxx"
+
+#include <starmath.hrc>
+#include <parse.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+namespace binfilter {
+
+#define IMPORT_SVC_NAME RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLImportFilter")
+#define EXPORT_SVC_NAME RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLExportFilter")
+
+#undef WANTEXCEPT
+
+/// read a component (file + filter version)
+ULONG SmXMLWrapper::ReadThroughComponent(
+ Reference<io::XInputStream> xInputStream,
+ Reference<XComponent> xModelComponent,
+ Reference<lang::XMultiServiceFactory> & rFactory,
+ const sal_Char* pFilterName,
+ sal_Bool bEncrypted )
+{
+ ULONG nError = ERRCODE_SFX_DOLOADFAILED;
+ DBG_ASSERT(xInputStream.is(), "input stream missing");
+ DBG_ASSERT(xModelComponent.is(), "document missing");
+ DBG_ASSERT(rFactory.is(), "factory missing");
+ DBG_ASSERT(NULL != pFilterName,"I need a service name for the component!");
+
+ // prepare ParserInputSrouce
+ xml::sax::InputSource aParserInput;
+ aParserInput.aInputStream = xInputStream;
+
+ // get parser
+ Reference< xml::sax::XParser > xParser(
+ rFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.xml.sax.Parser") ),
+ UNO_QUERY );
+ DBG_ASSERT( xParser.is(), "Can't create parser" );
+ if( !xParser.is() )
+ return nError;
+
+ // get filter
+ uno::Sequence < uno::Any > aArgs( 0 );
+ Reference< xml::sax::XDocumentHandler > xFilter(
+ rFactory->createInstanceWithArguments(
+ OUString::createFromAscii(pFilterName), aArgs ),
+ UNO_QUERY );
+ DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." );
+ if( !xFilter.is() )
+ return nError;
+
+ // connect parser and filter
+ xParser->setDocumentHandler( xFilter );
+
+ // connect model and filter
+ Reference < XImporter > xImporter( xFilter, UNO_QUERY );
+ xImporter->setTargetDocument( xModelComponent );
+
+ // finally, parser the stream
+ try
+ {
+ xParser->parseStream( aParserInput );
+
+ uno::Reference<lang::XUnoTunnel> xFilterTunnel;
+ xFilterTunnel = uno::Reference<lang::XUnoTunnel>
+ ( xFilter, uno::UNO_QUERY );
+ SmXMLImport *pFilter = (SmXMLImport *)xFilterTunnel->getSomething(
+ SmXMLImport::getUnoTunnelId() );
+ if( pFilter && pFilter->GetSuccess() )
+ nError = 0;
+ }
+ catch( xml::sax::SAXParseException& )
+ {
+ if( bEncrypted )
+ nError = ERRCODE_SFX_WRONGPASSWORD;
+ }
+ catch( xml::sax::SAXException& )
+ {
+ if( bEncrypted )
+ nError = ERRCODE_SFX_WRONGPASSWORD;
+ }
+ catch( packages::zip::ZipIOException& )
+ {
+ nError = ERRCODE_IO_BROKENPACKAGE;
+ }
+ catch( io::IOException& )
+ {
+ }
+
+ return nError;
+}
+
+ULONG SmXMLWrapper::ReadThroughComponent(
+ SvStorage* pStorage,
+ Reference<XComponent> xModelComponent,
+ const sal_Char* pStreamName,
+ const sal_Char* pCompatibilityStreamName,
+ Reference<lang::XMultiServiceFactory> & rFactory,
+ const sal_Char* pFilterName )
+{
+ DBG_ASSERT(NULL != pStorage, "Need storage!");
+ DBG_ASSERT(NULL != pStreamName, "Please, please, give me a name!");
+
+ // open stream (and set parser input)
+ OUString sStreamName = OUString::createFromAscii(pStreamName);
+ if (! pStorage->IsStream(sStreamName))
+ {
+ // stream name not found! Then try the compatibility name.
+
+ // do we even have an alternative name?
+ if ( NULL == pCompatibilityStreamName )
+ return ERRCODE_SFX_DOLOADFAILED;
+
+ // if so, does the stream exist?
+ sStreamName = OUString::createFromAscii(pCompatibilityStreamName);
+ if (! pStorage->IsStream(sStreamName) )
+ return ERRCODE_SFX_DOLOADFAILED;
+ }
+
+ // get input stream
+ SvStorageStreamRef xEventsStream;
+ xEventsStream = pStorage->OpenStream( sStreamName,
+ STREAM_READ | STREAM_NOCREATE );
+
+ // determine if stream is encrypted or not
+ Any aAny;
+ sal_Bool bEncrypted =
+ xEventsStream->GetProperty(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Encrypted") ), aAny ) &&
+ aAny.getValueType() == ::getBooleanCppuType() &&
+ *(sal_Bool *)aAny.getValue();
+
+ Reference < io::XInputStream > xStream = xEventsStream->GetXInputStream();
+ // read from the stream
+ return ReadThroughComponent(
+ xStream, xModelComponent, rFactory, pFilterName, bEncrypted );
+}
+
+ULONG SmXMLWrapper::Import(SfxMedium &rMedium)
+{
+ ULONG nError = ERRCODE_SFX_DOLOADFAILED;
+
+ uno::Reference<lang::XMultiServiceFactory> xServiceFactory(
+ ::legacy_binfilters::getLegacyProcessServiceFactory());
+ DBG_ASSERT(xServiceFactory.is(), "XMLReader::Read: got no service manager");
+ if( !xServiceFactory.is() )
+ return nError;
+
+ //Make a model component from our SmModel
+ uno::Reference< lang::XComponent > xModelComp( xModel, uno::UNO_QUERY );
+ DBG_ASSERT( xModelComp.is(), "XMLReader::Read: got no model" );
+
+ // try to get an XStatusIndicator from the Medium
+ uno::Reference<task::XStatusIndicator> xStatusIndicator;
+
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if (pModel)
+ {
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+
+ if (pDocShell->GetMedium())
+ {
+ SfxItemSet* pSet = pDocShell->GetMedium()->GetItemSet();
+ if (pSet)
+ {
+ const SfxUnoAnyItem* pItem = static_cast<const SfxUnoAnyItem*>(
+ pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) );
+ if (pItem)
+ pItem->GetValue() >>= xStatusIndicator;
+ }
+ }
+ }
+
+ sal_Int32 nSteps=3;
+ if( !(rMedium.IsStorage()))
+ nSteps = 1;
+
+ sal_Int32 nProgressRange(nSteps);
+ if (xStatusIndicator.is())
+ {
+ xStatusIndicator->start(String(SmResId(STR_STATSTR_READING)),
+ nProgressRange);
+ }
+
+ nSteps=0;
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ if( rMedium.IsStorage())
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ ULONG nWarn = ReadThroughComponent(
+ rMedium.GetStorage(), xModelComp, "meta.xml", "Meta.xml",
+ xServiceFactory, "com.sun.star.comp.Math.XMLMetaImporter" );
+
+ if ( nWarn != ERRCODE_IO_BROKENPACKAGE )
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ nWarn = ReadThroughComponent(
+ rMedium.GetStorage(), xModelComp, "settings.xml", 0,
+ xServiceFactory, "com.sun.star.comp.Math.XMLSettingsImporter" );
+
+ if ( nWarn != ERRCODE_IO_BROKENPACKAGE )
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ nError = ReadThroughComponent(
+ rMedium.GetStorage(), xModelComp, "content.xml", "Content.xml",
+ xServiceFactory, "com.sun.star.comp.Math.XMLImporter" );
+ }
+ else
+ nError = ERRCODE_IO_BROKENPACKAGE;
+ }
+ else
+ nError = ERRCODE_IO_BROKENPACKAGE;
+ }
+ else
+ {
+ Reference<io::XInputStream> xInputStream =
+ new ::utl::OInputStreamWrapper(rMedium.GetInStream());
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ nError = ReadThroughComponent( xInputStream, xModelComp,
+ xServiceFactory, "com.sun.star.comp.Math.XMLImporter", FALSE );
+ }
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+ return nError;
+}
+//#110680 ???
+SmXMLImport::SmXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ sal_uInt16 nImportFlags)
+: SvXMLImport( xServiceFactory, nImportFlags ),
+ pMathElemTokenMap(0),
+ pPresLayoutElemTokenMap(0),
+ pPresElemTokenMap(0),
+ pPresScriptEmptyElemTokenMap(0),
+ pPresTableElemTokenMap(0),
+ pPresLayoutAttrTokenMap(0),
+ pFencedAttrTokenMap(0),
+ pOperatorAttrTokenMap(0),
+ pColorTokenMap(0),
+ pAnnotationAttrTokenMap(0),
+ bSuccess(sal_False)
+{
+}
+
+const uno::Sequence< sal_Int8 > & SmXMLImport::getUnoTunnelId() throw()
+{
+ static uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+// #110680#
+SmXMLExport::SmXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ sal_uInt16 nExportFlags)
+: SvXMLExport( xServiceFactory, MAP_INCH, XML_MATH, nExportFlags ) ,
+ pTree(0) ,
+ bSuccess(sal_False)
+{
+}
+
+const uno::Sequence< sal_Int8 > & SmXMLExport::getUnoTunnelId() throw()
+{
+ static uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+OUString SAL_CALL SmXMLImport_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLImporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLImport_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( IMPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLImport_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLImport(IMPORT_ALL);
+ return (cppu::OWeakObject*)new SmXMLImport(rSMgr, IMPORT_ALL);
+}
+
+OUString SAL_CALL SmXMLExport_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLExporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLExport_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( EXPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLExport_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_ALL );
+ return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_ALL );
+}
+
+OUString SAL_CALL SmXMLImportMeta_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLMetaImporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLImportMeta_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( IMPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLImportMeta_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLImport( IMPORT_META );
+ return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_META );
+}
+
+OUString SAL_CALL SmXMLExportMeta_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLMetaExporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLExportMeta_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( EXPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLExportMeta_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_META );
+ return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_META );
+}
+
+OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLSettingsImporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLImportSettings_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( IMPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLImportSettings_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLImport( IMPORT_SETTINGS );
+ return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_SETTINGS );
+}
+
+OUString SAL_CALL SmXMLExportSettings_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLSettingsExporter" ) );
+}
+
+OUString SAL_CALL SmXMLExportContent_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLContentExporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLExportContent_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( EXPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLExportContent_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_CONTENT );
+ return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_CONTENT );
+}
+
+// XServiceInfo
+// override empty method from parent class
+rtl::OUString SAL_CALL SmXMLExport::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ switch( getExportFlags() )
+ {
+ default:
+ case EXPORT_ALL:
+ return SmXMLExport_getImplementationName();
+ break;
+ case EXPORT_META:
+ return SmXMLExportMeta_getImplementationName();
+ break;
+ case EXPORT_SETTINGS:
+ return SmXMLExportSettings_getImplementationName();
+ break;
+ case EXPORT_CONTENT:
+ return SmXMLExportContent_getImplementationName();
+ break;
+ }
+}
+
+// XServiceInfo
+// override empty method from parent class
+rtl::OUString SAL_CALL SmXMLImport::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ switch( getImportFlags() )
+ {
+ default:
+ case IMPORT_ALL:
+ return SmXMLImport_getImplementationName();
+ break;
+ case IMPORT_META:
+ return SmXMLImportMeta_getImplementationName();
+ break;
+ case IMPORT_SETTINGS:
+ return SmXMLImportSettings_getImplementationName();
+ break;
+ }
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLExportSettings_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( EXPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLExportSettings_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_SETTINGS );
+ return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_SETTINGS );
+}
+
+
+sal_Int64 SAL_CALL SmXMLImport::getSomething( const uno::Sequence< sal_Int8 >&
+ rId ) throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16 &&
+ ! rtl_compareMemory( getUnoTunnelId().getConstArray(),rId.getConstArray(), 16 ) )
+ return (sal_Int64)this;
+
+ return SvXMLImport::getSomething( rId );
+}
+
+sal_Int64 SAL_CALL SmXMLExport::getSomething( const uno::Sequence< sal_Int8 >&
+ rId ) throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16 &&
+ ! rtl_compareMemory( getUnoTunnelId().getConstArray(),rId.getConstArray(), 16 ) )
+ return (sal_Int64)this;
+
+ return SvXMLExport::getSomething( rId );
+}
+
+
+void SmXMLImport::endDocument(void)
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ //Set the result tree into the SmDocShell where it belongs
+ SmNode *pTree;
+ if (pTree = GetTree())
+ {
+ uno::Reference <frame::XModel> xFrmModel = GetModel();
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xFrmModel, uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if (pModel)
+ {
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+ pDocShell->SetFormulaTree(pTree);
+ if (0 == aText.Len()) //If we picked up no annotation text
+ {
+ //Make up some editable text
+ aText = pDocShell->GetText();
+ pTree->CreateTextFromNode(aText);
+ aText.EraseTrailingChars();
+ if((aText.GetChar(0) == '{') &&
+ (aText.GetChar(aText.Len()-1) == '}'))
+ {
+ aText.Erase(0,1);
+ aText.Erase(aText.Len()-1,1);
+ }
+ }
+ pDocShell->SetText( String() );
+
+ // Convert symbol names
+ SmParser &rParser = pDocShell->GetParser();
+ BOOL bVal = rParser.IsImportSymbolNames();
+ rParser.SetImportSymbolNames( TRUE );
+ SmNode *pTmp = rParser.Parse( aText );
+ aText = rParser.GetText();
+ delete pTmp;
+ rParser.SetImportSymbolNames( bVal );
+
+ pDocShell->SetText( aText );
+ }
+ DBG_ASSERT(pModel,"So there *was* a uno problem after all");
+
+ bSuccess = sal_True;
+ }
+
+ SvXMLImport::endDocument();
+}
+
+/// export through an XML exporter component (output stream version)
+sal_Bool SmXMLWrapper::WriteThroughComponent(
+ Reference<io::XOutputStream> xOutputStream,
+ Reference<XComponent> xComponent,
+ Reference<lang::XMultiServiceFactory> & rFactory,
+ Reference<beans::XPropertySet> & rPropSet,
+ const sal_Char* pComponentName
+ )
+{
+ DBG_ASSERT(xOutputStream.is(), "I really need an output stream!");
+ DBG_ASSERT(xComponent.is(), "Need component!");
+ DBG_ASSERT(NULL != pComponentName, "Need component name!");
+
+ // get component
+ Reference< io::XActiveDataSource > xSaxWriter(
+ rFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.xml.sax.Writer") ),
+ UNO_QUERY );
+ DBG_ASSERT( xSaxWriter.is(), "can't instantiate XML writer" );
+ if(!xSaxWriter.is())
+ return sal_False;
+
+ // connect XML writer to output stream
+ xSaxWriter->setOutputStream( xOutputStream );
+
+ // prepare arguments (prepend doc handler to given arguments)
+ Reference<xml::sax::XDocumentHandler> xDocHandler( xSaxWriter,UNO_QUERY);
+
+ Sequence<Any> aArgs( 2 );
+ aArgs[0] <<= xDocHandler;
+ aArgs[1] <<= rPropSet;
+
+ // get filter component
+ Reference< document::XExporter > xExporter(
+ rFactory->createInstanceWithArguments(
+ OUString::createFromAscii(pComponentName), aArgs), UNO_QUERY);
+ DBG_ASSERT( xExporter.is(),
+ "can't instantiate export filter component" );
+ if( !xExporter.is() )
+ return sal_False;
+
+
+ // connect model and filter
+ xExporter->setSourceDocument( xComponent );
+
+ // filter!
+ Reference < XFilter > xFilter( xExporter, UNO_QUERY );
+ uno::Sequence< PropertyValue > aProps(0);
+ xFilter->filter( aProps );
+
+ uno::Reference<lang::XUnoTunnel> xFilterTunnel;
+ xFilterTunnel = uno::Reference<lang::XUnoTunnel>
+ ( xFilter, uno::UNO_QUERY );
+ SmXMLExport *pFilter = (SmXMLExport *)xFilterTunnel->getSomething(
+ SmXMLExport::getUnoTunnelId() );
+ return pFilter ? pFilter->GetSuccess() : sal_True;
+}
+
+/// export through an XML exporter component (storage version)
+sal_Bool SmXMLWrapper::WriteThroughComponent(
+ SvStorage* pStorage,
+ Reference<XComponent> xComponent,
+ const sal_Char* pStreamName,
+ Reference<lang::XMultiServiceFactory> & rFactory,
+ Reference<beans::XPropertySet> & rPropSet,
+ const sal_Char* pComponentName,
+ sal_Bool bCompress
+ )
+{
+ DBG_ASSERT(NULL != pStorage, "Need storage!");
+ DBG_ASSERT(NULL != pStreamName, "Need stream name!");
+
+ Reference< io::XOutputStream > xOutputStream;
+ SvStorageStreamRef xDocStream;
+
+ // open stream
+ OUString sStreamName = OUString::createFromAscii(pStreamName);
+ xDocStream = pStorage->OpenStream( sStreamName,
+ STREAM_WRITE | STREAM_SHARE_DENYWRITE );
+ DBG_ASSERT(xDocStream.Is(), "Can't create output stream in package!");
+ if (! xDocStream.Is())
+ return sal_False;
+
+ xDocStream->SetSize( 0 );
+
+ String aPropName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("MediaType") ) );
+ OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
+ uno::Any aAny;
+ aAny <<= aMime;
+ xDocStream->SetProperty( aPropName, aAny );
+
+ if( !bCompress )
+ {
+ aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Compressed") );
+ sal_Bool bFalse = sal_False;
+ aAny.setValue( &bFalse, ::getBooleanCppuType() );
+ xDocStream->SetProperty( aPropName, aAny );
+ }
+ else
+ {
+ OUString aPropName( RTL_CONSTASCII_USTRINGPARAM("Encrypted") );
+ sal_Bool bTrue = sal_True;
+ aAny.setValue( &bTrue, ::getBooleanCppuType() );
+ xDocStream->SetProperty( aPropName, aAny );
+ }
+
+ // set buffer and create outputstream
+ xDocStream->SetBufferSize( 16*1024 );
+ xOutputStream = new ::utl::OOutputStreamWrapper( *xDocStream );
+
+ // write the stuff
+ sal_Bool bRet = WriteThroughComponent( xOutputStream, xComponent, rFactory,
+ rPropSet, pComponentName );
+
+ // finally, commit stream.
+ if( bRet )
+ xDocStream->Commit();
+
+ return bRet;
+}
+
+sal_Bool SmXMLWrapper::Export(SfxMedium &rMedium)
+{
+ sal_Bool bRet=sal_True;
+ uno::Reference<lang::XMultiServiceFactory>
+ xServiceFactory(::legacy_binfilters::getLegacyProcessServiceFactory());
+ DBG_ASSERT(xServiceFactory.is(),"got no service manager");
+
+ //Get model
+ uno::Reference< lang::XComponent > xModelComp(xModel, uno::UNO_QUERY );
+
+ sal_Bool bEmbedded = sal_False;
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if (pModel)
+ {
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+ if( pDocShell &&
+ SFX_CREATE_MODE_EMBEDDED == pDocShell->GetCreateMode() )
+ bEmbedded = sal_True;
+ }
+
+ uno::Reference<task::XStatusIndicator> xStatusIndicator;
+ if (!bEmbedded)
+ {
+ uno::Reference<frame::XController> xController(
+ xModel->getCurrentController());
+ if( xController.is())
+ {
+ uno::Reference<frame::XFrame> xFrame( xController->getFrame());
+ if( xFrame.is())
+ {
+ uno::Reference<task::XStatusIndicatorFactory> xFactory( xFrame,
+ uno::UNO_QUERY );
+ if( xFactory.is())
+ xStatusIndicator = xFactory->createStatusIndicator();
+ }
+ }
+
+ // set progress range and start status indicator
+ sal_Int32 nSteps=3;
+ if (bFlat)
+ nSteps = 1;
+
+ sal_Int32 nProgressRange(nSteps);
+ if (xStatusIndicator.is())
+ {
+ xStatusIndicator->start(String(SmResId(STR_STATSTR_WRITING)),
+ nProgressRange);
+ }
+ }
+
+
+ // create XPropertySet with three properties for status indicator
+ ::comphelper::PropertyMapEntry aInfoMap[] =
+ {
+ { "UsePrettyPrinting", sizeof("UsePrettyPrinting")-1, 0,
+ &::getBooleanCppuType(),
+ beans::PropertyAttribute::MAYBEVOID, 0},
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+ uno::Reference< beans::XPropertySet > xInfoSet(
+ ::comphelper::GenericPropertySet_CreateInstance(
+ new comphelper::PropertySetInfo( aInfoMap ) ) );
+
+ SvtSaveOptions aSaveOpt;
+ OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
+ sal_Bool bUsePrettyPrinting( bFlat || aSaveOpt.IsPrettyPrinting() );
+ Any aAny;
+ aAny.setValue( &bUsePrettyPrinting, ::getBooleanCppuType() );
+ xInfoSet->setPropertyValue( sUsePrettyPrinting, aAny );
+
+
+ sal_Int32 nSteps=0;
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+ if (!bFlat) //Storage (Package) of Stream
+ {
+ SvStorage *pStg = rMedium.GetOutputStorage(sal_True);
+
+ if( !bEmbedded )
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ bRet = WriteThroughComponent(
+ pStg, xModelComp, "meta.xml", xServiceFactory, xInfoSet,
+ "com.sun.star.comp.Math.XMLMetaExporter",sal_False);
+ }
+ if( bRet )
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ bRet = WriteThroughComponent(
+ pStg, xModelComp, "content.xml", xServiceFactory, xInfoSet,
+ "com.sun.star.comp.Math.XMLContentExporter");
+ }
+
+ if( bRet )
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ bRet = WriteThroughComponent(
+ pStg, xModelComp, "settings.xml", xServiceFactory, xInfoSet,
+ "com.sun.star.comp.Math.XMLSettingsExporter");
+ }
+ }
+ else
+ {
+ SvStream *pStream = rMedium.GetOutStream();
+ uno::Reference<io::XOutputStream> xOut(
+ new ::utl::OOutputStreamWrapper(*pStream) );
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ bRet = WriteThroughComponent(
+ xOut, xModelComp, xServiceFactory, xInfoSet,
+ "com.sun.star.comp.Math.XMLContentExporter");
+ }
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+
+ return bRet;
+}
+
+sal_uInt32 SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
+{
+ if( (getExportFlags() & EXPORT_CONTENT) == 0 )
+ {
+ SvXMLExport::exportDoc( eClass );
+ }
+ else
+ {
+ uno::Reference <frame::XModel> xModel = GetModel();
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if (pModel)
+ {
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+ pTree = pDocShell->GetFormulaTree();
+ aText = pDocShell->GetText();
+ }
+
+ GetDocHandler()->startDocument();
+
+ if( (getExportFlags() & EXPORT_NODOCTYPE) == 0 &&
+ GetExtDocHandler().is() )
+ {
+ OUString aDocType( RTL_CONSTASCII_USTRINGPARAM( "<!DOCTYPE math:math PUBLIC \"-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN\" \"math.dtd\">" ) );
+ GetExtDocHandler()->unknown( aDocType );
+ }
+
+ /*Add xmlns line*/
+ SvXMLAttributeList &rList = GetAttrList();
+ rList.AddAttribute(GetNamespaceMap().GetAttrNameByKey(
+ XML_NAMESPACE_MATH_IDX),GetNamespaceMap().GetNameByKey(
+ XML_NAMESPACE_MATH_IDX));
+
+ //I think we need something like ImplExportEntities();
+ _ExportContent();
+ GetDocHandler()->endDocument();
+ }
+
+ bSuccess=sal_True;
+ return 0;
+}
+
+class SmXMLImportContext: public SvXMLImportContext
+{
+public:
+ SmXMLImportContext( SmXMLImport &rImport, sal_uInt16 nPrfx,
+ const OUString& rLName)
+ : SvXMLImportContext(rImport, nPrfx, rLName) {}
+ const SmXMLImport& GetSmImport() const
+ {
+ return (const SmXMLImport&)GetImport();
+ }
+ SmXMLImport& GetSmImport()
+ {
+ return (SmXMLImport&)GetImport();
+ }
+ virtual void TCharacters(const OUString &rChars) {}
+ virtual void Characters(const OUString &rChars)
+ {
+ /*
+ Whitespace occurring within the content of token elements is "trimmed"
+ from the ends (i.e. all whitespace at the beginning and end of the
+ content is removed), and "collapsed" internally (i.e. each sequence of
+ 1 or more whitespace characters is replaced with one blank character).
+ */
+ //collapsing not done yet!
+ const OUString &rChars2 = rChars.trim();
+ if (rChars2.getLength())
+ TCharacters(rChars2/*.collapse()*/);
+ }
+ virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList) {return 0;}
+};
+
+class SmXMLDocContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLDocContext_Impl( SmXMLImport &rImport, sal_uInt16 nPrfx,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrfx,rLName) {}
+ virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList);
+ void EndElement();
+};
+
+
+/*avert thy gaze from the proginator*/
+class SmXMLRowContext_Impl : public SmXMLDocContext_Impl
+{
+public:
+ SmXMLRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLDocContext_Impl(rImport,nPrefix,rLName)
+ { nElementCount = GetSmImport().GetNodeStack().Count(); }
+ virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList);
+ SvXMLImportContext *StrictCreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList);
+ void EndElement();
+protected:
+ ULONG nElementCount;
+};
+
+class SmXMLFracContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLFracContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+ void EndElement();
+};
+
+class SmXMLSqrtContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLSqrtContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+ void EndElement();
+};
+
+class SmXMLRootContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLRootContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+ void EndElement();
+};
+
+struct SmXMLContext_Helper
+{
+ SmXMLContext_Helper(SmXMLImportContext &rImport) : rContext(rImport),
+ nIsBold(-1), nIsItalic(-1),nFontSize(0.0) {}
+ void RetrieveAttrs(const uno::Reference< xml::sax::XAttributeList > &
+ xAttrList );
+ void ApplyAttrs();
+
+ sal_Int8 nIsBold;
+ sal_Int8 nIsItalic;
+ double nFontSize;
+ sal_Bool bFontNodeNeeded;
+ OUString sFontFamily;
+ OUString sColor;
+
+ SmXMLImportContext rContext;
+};
+
+void SmXMLContext_Helper::RetrieveAttrs(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ sal_Int8 nOldIsBold=nIsBold;
+ sal_Int8 nOldIsItalic=nIsItalic;
+ double nOldFontSize=nFontSize;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ OUString sOldFontFamily = sFontFamily;
+ for (sal_Int16 i=0;i<nAttrCount;i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rContext.GetSmImport().GetNamespaceMap().
+ GetKeyByAttrName(sAttrName,&aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap &rAttrTokenMap =
+ rContext.GetSmImport().GetPresLayoutAttrTokenMap();
+ switch(rAttrTokenMap.Get(nPrefix,aLocalName))
+ {
+ case XML_TOK_FONTWEIGHT:
+ nIsBold = sValue.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ sXML_bold)));
+ break;
+ case XML_TOK_FONTSTYLE:
+ nIsItalic = sValue.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ sXML_italic)));
+ break;
+ case XML_TOK_FONTSIZE:
+ SvXMLUnitConverter::convertDouble(nFontSize,sValue);
+ rContext.GetSmImport().GetMM100UnitConverter().
+ setXMLMeasureUnit(MAP_POINT);
+ if (-1 == sValue.indexOf(OUString(
+ RTL_CONSTASCII_USTRINGPARAM(sXML_unit_pt))))
+ if (-1 == sValue.indexOf('%'))
+ nFontSize=0.0;
+ else
+ {
+ rContext.GetSmImport().GetMM100UnitConverter().
+ setXMLMeasureUnit(MAP_RELATIVE);
+ }
+ break;
+ case XML_TOK_FONTFAMILY:
+ sFontFamily = sValue;
+ break;
+ case XML_TOK_COLOR:
+ sColor = sValue;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if ((nOldIsBold!=nIsBold) || (nOldIsItalic!=nIsItalic) ||
+ (nOldFontSize!=nFontSize) || (sOldFontFamily!=sFontFamily)
+ || sColor.getLength())
+ bFontNodeNeeded=sal_True;
+ else
+ bFontNodeNeeded=sal_False;
+}
+
+void SmXMLContext_Helper::ApplyAttrs()
+{
+ SmNodeStack &rNodeStack = rContext.GetSmImport().GetNodeStack();
+
+ if (bFontNodeNeeded)
+ {
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+
+ if (nIsBold != -1)
+ {
+ if (nIsBold)
+ aToken.eType = TBOLD;
+ else
+ aToken.eType = TNBOLD;
+ SmStructureNode *pFontNode = static_cast<SmStructureNode *>
+ (new SmFontNode(aToken));
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (nIsItalic != -1)
+ {
+ if (nIsItalic)
+ aToken.eType = TITALIC;
+ else
+ aToken.eType = TNITALIC;
+ SmStructureNode *pFontNode = static_cast<SmStructureNode *>
+ (new SmFontNode(aToken));
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (nFontSize != 0.0)
+ {
+ aToken.eType = TSIZE;
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+
+ if (MAP_RELATIVE == rContext.GetSmImport().GetMM100UnitConverter().
+ getXMLMeasureUnit())
+ {
+ if (nFontSize < 100.00)
+ pFontNode->SetSizeParameter(Fraction(100.00/nFontSize),
+ FNTSIZ_DIVIDE);
+ else
+ pFontNode->SetSizeParameter(Fraction(nFontSize/100.00),
+ FNTSIZ_MULTIPLY);
+ }
+ else
+ pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT);
+
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (sFontFamily.getLength())
+ {
+ if (sFontFamily.equalsIgnoreAsciiCase(OUString(
+ RTL_CONSTASCII_USTRINGPARAM(sXML_fixed))))
+ aToken.eType = TFIXED;
+ else if (sFontFamily.equalsIgnoreAsciiCase(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("sans"))))
+ aToken.eType = TSANS;
+ else if (sFontFamily.equalsIgnoreAsciiCase(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("serif"))))
+ aToken.eType = TSERIF;
+ else //Just give up, we need to extend our font mechanism to be
+ //more general
+ return;
+
+ aToken.aText = sFontFamily;
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (sColor.getLength())
+ {
+ //Again we can only handle a small set of colours in
+ //StarMath for now.
+ const SvXMLTokenMap& rTokenMap =
+ rContext.GetSmImport().GetColorTokenMap();
+ aToken.eType = static_cast<SmTokenType>(rTokenMap.Get(
+ XML_NAMESPACE_MATH, sColor));
+ if (aToken.eType != -1)
+ {
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ }
+
+ }
+}
+
+class SmXMLStyleContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ /*Right now the style tag is completely ignored*/
+ SmXMLStyleContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName),
+ aStyleHelper(*this) {}
+ void EndElement();
+ void StartElement(const uno::Reference< xml::sax::XAttributeList > &
+ xAttrList );
+protected:
+ SmXMLContext_Helper aStyleHelper;
+};
+
+void SmXMLStyleContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+#if 1
+ aStyleHelper.RetrieveAttrs(xAttrList);
+#else
+ sal_Int8 nOldIsBold=nIsBold;
+ sal_Int8 nOldIsItalic=nIsItalic;
+ double nOldFontSize=nFontSize;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ OUString sOldFontFamily = sFontFamily;
+ for (sal_Int16 i=0;i<nAttrCount;i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName(sAttrName,&aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap &rAttrTokenMap =
+ GetSmImport().GetPresLayoutAttrTokenMap();
+ switch(rAttrTokenMap.Get(nPrefix,aLocalName))
+ {
+ case XML_TOK_FONTWEIGHT:
+ nIsBold = sValue.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ sXML_bold)));
+ break;
+ case XML_TOK_FONTSTYLE:
+ nIsItalic = sValue.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(
+ sXML_italic)));
+ break;
+ case XML_TOK_FONTSIZE:
+ SvXMLUnitConverter::convertDouble(nFontSize,sValue);
+ GetSmImport().GetMM100UnitConverter().
+ setXMLMeasureUnit(MAP_POINT);
+ if (-1 == sValue.indexOf(OUString(
+ RTL_CONSTASCII_USTRINGPARAM(sXML_unit_pt))))
+ if (-1 == sValue.indexOf('%'))
+ nFontSize=0.0;
+ else
+ {
+ GetSmImport().GetMM100UnitConverter().
+ setXMLMeasureUnit(MAP_RELATIVE);
+ }
+ break;
+ case XML_TOK_FONTFAMILY:
+ sFontFamily = sValue;
+ break;
+ case XML_TOK_COLOR:
+ sColor = sValue;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if ((nOldIsBold!=nIsBold) || (nOldIsItalic!=nIsItalic) ||
+ (nOldFontSize!=nFontSize) || (sOldFontFamily!=sFontFamily)
+ || sColor.getLength())
+ bFontNodeNeeded=sal_True;
+ else
+ bFontNodeNeeded=sal_False;
+#endif
+}
+
+
+void SmXMLStyleContext_Impl::EndElement()
+{
+ /*
+ <mstyle> accepts any number of arguments; if this number is not 1, its
+ contents are treated as a single "inferred <mrow>" containing its
+ arguments
+ */
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ if (rNodeStack.Count() - nElementCount > 1)
+ SmXMLRowContext_Impl::EndElement();
+#if 1
+ aStyleHelper.ApplyAttrs();
+#else
+ if (bFontNodeNeeded)
+ {
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+
+ if (nIsBold != -1)
+ {
+ if (nIsBold)
+ aToken.eType = TBOLD;
+ else
+ aToken.eType = TNBOLD;
+ SmStructureNode *pFontNode = static_cast<SmStructureNode *>
+ (new SmFontNode(aToken));
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (nIsItalic != -1)
+ {
+ if (nIsItalic)
+ aToken.eType = TITALIC;
+ else
+ aToken.eType = TNITALIC;
+ SmStructureNode *pFontNode = static_cast<SmStructureNode *>
+ (new SmFontNode(aToken));
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (nFontSize != 0.0)
+ {
+ aToken.eType = TSIZE;
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+
+ if (MAP_RELATIVE == GetSmImport().GetMM100UnitConverter().
+ getXMLMeasureUnit())
+ {
+ if (nFontSize < 100.00)
+ pFontNode->SetSizeParameter(Fraction(100.00/nFontSize),
+ FNTSIZ_DIVIDE);
+ else
+ pFontNode->SetSizeParameter(Fraction(nFontSize/100.00),
+ FNTSIZ_MULTIPLY);
+ }
+ else
+ pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT);
+
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (sFontFamily.getLength())
+ {
+ if (sFontFamily.equalsIgnoreCase(OUString(
+ RTL_CONSTASCII_USTRINGPARAM(sXML_fixed))))
+ aToken.eType = TFIXED;
+ else if (sFontFamily.equalsIgnoreCase(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("sans"))))
+ aToken.eType = TSANS;
+ else if (sFontFamily.equalsIgnoreCase(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("serif"))))
+ aToken.eType = TSERIF;
+ else //Just give up, we need to extend our font mechanism to be
+ //more general
+ return;
+
+ aToken.aText = sFontFamily;
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (sColor.getLength())
+ {
+ //Again we can only handle a small set of colours in
+ //StarMath for now.
+ const SvXMLTokenMap& rTokenMap =
+ GetSmImport().GetColorTokenMap();
+ aToken.eType = static_cast<SmTokenType>(rTokenMap.Get(
+ XML_NAMESPACE_MATH, sColor));
+ if (aToken.eType != -1)
+ {
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ }
+
+ }
+#endif
+}
+
+class SmXMLPaddedContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ /*Right now the style tag is completely ignored*/
+ SmXMLPaddedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+ void EndElement();
+};
+
+void SmXMLPaddedContext_Impl::EndElement()
+{
+ /*
+ <mpadded> accepts any number of arguments; if this number is not 1, its
+ contents are treated as a single "inferred <mrow>" containing its
+ arguments
+ */
+ if (GetSmImport().GetNodeStack().Count() - nElementCount > 1)
+ SmXMLRowContext_Impl::EndElement();
+}
+
+class SmXMLPhantomContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ /*Right now the style tag is completely ignored*/
+ SmXMLPhantomContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+ void EndElement();
+};
+
+void SmXMLPhantomContext_Impl::EndElement()
+{
+ /*
+ <mphantom> accepts any number of arguments; if this number is not 1, its
+ contents are treated as a single "inferred <mrow>" containing its
+ arguments
+ */
+ if (GetSmImport().GetNodeStack().Count() - nElementCount > 1)
+ SmXMLRowContext_Impl::EndElement();
+
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TPHANTOM;
+
+ SmStructureNode *pPhantom = static_cast<SmStructureNode *>
+ (new SmFontNode(aToken));
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ pPhantom->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pPhantom);
+}
+
+class SmXMLFencedContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLFencedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName),
+ cBegin('('), cEnd(')') {}
+ void StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList );
+ void EndElement();
+protected:
+ sal_Unicode cBegin;
+ sal_Unicode cEnd;
+};
+
+
+void SmXMLFencedContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for (sal_Int16 i=0;i<nAttrCount;i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName(sAttrName,&aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap &rAttrTokenMap =
+ GetSmImport().GetFencedAttrTokenMap();
+ switch(rAttrTokenMap.Get(nPrefix,aLocalName))
+ {
+ //temp, starmath cannot handle multichar brackets (I think)
+ case XML_TOK_OPEN:
+ cBegin = sValue[0];
+ break;
+ case XML_TOK_CLOSE:
+ cEnd = sValue[0];
+ break;
+ default:
+ /*Go to superclass*/
+ break;
+ }
+ }
+}
+
+
+void SmXMLFencedContext_Impl::EndElement()
+{
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.aText = ',';
+ aToken.eType = TLEFT;
+ aToken.nLevel = 5;
+
+ aToken.eType = TLPARENT;
+ aToken.cMathChar = cBegin;
+ SmStructureNode *pSNode = new SmBraceNode(aToken);
+ SmNode *pLeft = new SmMathSymbolNode(aToken);
+
+ aToken.cMathChar = cEnd;
+ aToken.eType = TRPARENT;
+ SmNode *pRight = new SmMathSymbolNode(aToken);
+
+ SmNodeArray aRelationArray;
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+
+ aToken.cMathChar = '\0';
+ aToken.aText = ',';
+ aToken.eType = TIDENT;
+
+ ULONG i=rNodeStack.Count()-nElementCount;
+ if (rNodeStack.Count()-nElementCount > 1)
+ i+=rNodeStack.Count()-1-nElementCount;
+ aRelationArray.SetSize(i);
+ while(rNodeStack.Count() > nElementCount)
+ {
+ aRelationArray.Put(--i,rNodeStack.Pop());
+ if (rNodeStack.Count() > 1)
+ aRelationArray.Put(--i,new SmGlyphSpecialNode(aToken));
+ }
+
+ SmToken aDummy;
+ SmStructureNode *pBody = new SmExpressionNode(aDummy);
+ pBody->SetSubNodes(aRelationArray);
+
+
+ pSNode->SetSubNodes(pLeft,pBody,pRight);
+ pSNode->SetScaleMode(SCALE_HEIGHT);
+ GetSmImport().GetNodeStack().Push(pSNode);
+}
+
+
+class SmXMLErrorContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLErrorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+ void EndElement();
+};
+
+void SmXMLErrorContext_Impl::EndElement()
+{
+ /*Right now the error tag is completely ignored, what
+ can I do with it in starmath, ?, maybe we need a
+ report window ourselves, do a test for validity of
+ the xml input, use merrors, and then generate
+ the markup inside the merror with a big red colour
+ of something. For now just throw them all away.
+ */
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ while(rNodeStack.Count() > nElementCount)
+ {
+ SmNode *pNode = rNodeStack.Pop();
+ delete pNode;
+ }
+}
+
+class SmXMLNumberContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLNumberContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName)
+ {
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TNUMBER;
+ }
+ virtual void TCharacters(const OUString &rChars);
+ void EndElement();
+protected:
+ SmToken aToken;
+};
+
+void SmXMLNumberContext_Impl::TCharacters(const OUString &rChars)
+{
+ aToken.aText = rChars;
+}
+
+void SmXMLNumberContext_Impl::EndElement()
+{
+ GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_NUMBER));
+}
+
+class SmXMLAnnotationContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLAnnotationContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName), bIsStarMath(sal_False) {}
+ virtual void Characters(const OUString &rChars);
+ void StartElement(const uno::Reference<xml::sax::XAttributeList > &
+ xAttrList );
+private:
+ sal_Bool bIsStarMath;
+};
+
+void SmXMLAnnotationContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for (sal_Int16 i=0;i<nAttrCount;i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName(sAttrName,&aLocalName);
+
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap &rAttrTokenMap =
+ GetSmImport().GetAnnotationAttrTokenMap();
+ switch(rAttrTokenMap.Get(nPrefix,aLocalName))
+ {
+ case XML_TOK_ENCODING:
+ bIsStarMath= sValue.equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("StarMath 5.0")));
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void SmXMLAnnotationContext_Impl::Characters(const OUString &rChars)
+{
+ if (bIsStarMath)
+ GetSmImport().GetText().Append(String(rChars));
+}
+
+class SmXMLTextContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLTextContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName)
+ {
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TTEXT;
+ }
+ virtual void TCharacters(const OUString &rChars);
+ void EndElement();
+protected:
+ SmToken aToken;
+};
+
+void SmXMLTextContext_Impl::TCharacters(const OUString &rChars)
+{
+ aToken.aText = rChars;
+}
+
+void SmXMLTextContext_Impl::EndElement()
+{
+ GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_TEXT));
+}
+
+class SmXMLStringContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLStringContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName)
+ {
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TTEXT;
+ }
+ virtual void TCharacters(const OUString &rChars);
+ void EndElement();
+protected:
+ SmToken aToken;
+};
+
+void SmXMLStringContext_Impl::TCharacters(const OUString &rChars)
+{
+ /*
+ The content of <ms> elements should be rendered with visible "escaping" of
+ certain characters in the content, including at least "double quote"
+ itself, and preferably whitespace other than individual blanks. The intent
+ is for the viewer to see that the expression is a string literal, and to
+ see exactly which characters form its content. For example, <ms>double
+ quote is "</ms> might be rendered as "double quote is \"".
+
+ Obviously this isn't fully done here.
+ */
+ aToken.aText.Erase();
+ aToken.aText += '\"';
+ aToken.aText += String(rChars);
+ aToken.aText += '\"';
+}
+
+void SmXMLStringContext_Impl::EndElement()
+{
+ GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_FIXED));
+}
+
+class SmXMLIdentifierContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLIdentifierContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName),aStyleHelper(*this)
+ {
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TIDENT;
+ }
+ void TCharacters(const OUString &rChars);
+ void StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList ) {aStyleHelper.RetrieveAttrs(xAttrList);};
+ void EndElement();
+protected:
+ SmXMLContext_Helper aStyleHelper;
+ SmToken aToken;
+};
+
+void SmXMLIdentifierContext_Impl::EndElement()
+{
+ SmTextNode *pNode = 0;
+ //we will handle identifier italic/normal here instead of with a standalone
+ //font node
+ if (((aStyleHelper.nIsItalic == -1) && (aToken.aText.Len() > 1))
+ || ((aStyleHelper.nIsItalic == 0) && (aToken.aText.Len() == 1)))
+ {
+ pNode = new SmTextNode(aToken,FNT_FUNCTION);
+ pNode->GetFont().SetItalic(ITALIC_NONE);
+ aStyleHelper.nIsItalic = -1;
+ }
+ else
+ pNode = new SmTextNode(aToken,FNT_VARIABLE);
+ if (aStyleHelper.bFontNodeNeeded && aStyleHelper.nIsItalic != -1)
+ {
+ if (aStyleHelper.nIsItalic)
+ pNode->GetFont().SetItalic(ITALIC_NORMAL);
+ else
+ pNode->GetFont().SetItalic(ITALIC_NONE);
+ }
+
+ if ((-1!=aStyleHelper.nIsBold) || (0.0!=aStyleHelper.nFontSize) ||
+ (aStyleHelper.sFontFamily.getLength()) ||
+ aStyleHelper.sColor.getLength())
+ aStyleHelper.bFontNodeNeeded=sal_True;
+ else
+ aStyleHelper.bFontNodeNeeded=sal_False;
+ if (aStyleHelper.bFontNodeNeeded)
+ aStyleHelper.ApplyAttrs();
+ GetSmImport().GetNodeStack().Push(pNode);
+}
+
+void SmXMLIdentifierContext_Impl::TCharacters(const OUString &rChars)
+{
+ aToken.aText = rChars;
+}
+
+class SmXMLOperatorContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLOperatorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName), bIsStretchy(sal_False)
+ {
+ aToken.nGroup = 0;
+ aToken.eType = TSPECIAL;
+ aToken.nLevel = 5;
+ }
+ void TCharacters(const OUString &rChars);
+ void StartElement(const uno::Reference<
+ xml::sax::XAttributeList > &xAttrList );
+ void EndElement();
+protected:
+ SmToken aToken;
+private:
+ sal_Bool bIsStretchy;
+};
+
+void SmXMLOperatorContext_Impl::TCharacters(const OUString &rChars)
+{
+ aToken.cMathChar = rChars[0];
+}
+
+void SmXMLOperatorContext_Impl::EndElement()
+{
+ SmMathSymbolNode *pNode = new SmMathSymbolNode(aToken);
+ //For stretchy scaling the scaling must be retrieved from this node
+ //and applied to the expression itself so as to get the expression
+ //to scale the operator to the height of the expression itself
+ if (bIsStretchy)
+ pNode->SetScaleMode(SCALE_HEIGHT);
+ GetSmImport().GetNodeStack().Push(pNode);
+}
+
+
+
+void SmXMLOperatorContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for (sal_Int16 i=0;i<nAttrCount;i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName(sAttrName,&aLocalName);
+
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap &rAttrTokenMap =
+ GetSmImport().GetOperatorAttrTokenMap();
+ switch(rAttrTokenMap.Get(nPrefix,aLocalName))
+ {
+ case XML_TOK_STRETCHY:
+ bIsStretchy = sValue.equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_true)));
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+
+
+static __FAR_DATA SvXMLTokenMapEntry aMathElemTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_MATH, XML_TOK_MATH },
+ XML_TOKEN_MAP_END
+};
+
+class SmXMLSpaceContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLSpaceContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName) {}
+ void StartElement(const uno::Reference<
+ xml::sax::XAttributeList >& xAttrList );
+};
+
+void SmXMLSpaceContext_Impl::StartElement(
+ const uno::Reference<xml::sax::XAttributeList > &xAttrList )
+{
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.eType = TBLANK;
+ aToken.nLevel = 5;
+ SmBlankNode *pBlank = new SmBlankNode(aToken);
+ pBlank->IncreaseBy(aToken);
+ GetSmImport().GetNodeStack().Push(pBlank);
+}
+
+class SmXMLSubContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLSubContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+ void EndElement() { GenericEndElement(TRSUB,RSUB); }
+protected:
+ void GenericEndElement(SmTokenType eType,SmSubSup aSubSup);
+};
+
+
+void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType,SmSubSup aSubSup)
+{
+ /*The <msub> element requires exactly 2 arguments.*/
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
+ "Sub has not two arguments");
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = eType;
+ SmSubSupNode *pNode = new SmSubSupNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+
+ // initialize subnodes array
+ SmNodeArray aSubNodes;
+ aSubNodes.SetSize(1 + SUBSUP_NUM_ENTRIES);
+ for (ULONG i = 1; i < aSubNodes.GetSize(); i++)
+ aSubNodes.Put(i, NULL);
+
+ aSubNodes.Put(aSubSup+1,rNodeStack.Pop());
+ aSubNodes.Put(0, rNodeStack.Pop());
+ pNode->SetSubNodes(aSubNodes);
+ rNodeStack.Push(pNode);
+}
+
+class SmXMLSupContext_Impl : public SmXMLSubContext_Impl
+{
+public:
+ SmXMLSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLSubContext_Impl(rImport,nPrefix,rLName) {}
+ void EndElement() {GenericEndElement(TRSUP,RSUP);}
+};
+
+class SmXMLSubSupContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLSubSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+ void EndElement() { GenericEndElement(TRSUB,RSUB,RSUP); }
+protected:
+ void GenericEndElement(SmTokenType eType,
+ SmSubSup aSub,SmSubSup aSup);
+
+};
+
+void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType,
+ SmSubSup aSub,SmSubSup aSup)
+{
+ /*The <msub> element requires exactly 3 arguments.*/
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 3,
+ "SubSup has not three arguments");
+
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = eType;
+ SmSubSupNode *pNode = new SmSubSupNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+
+ // initialize subnodes array
+ SmNodeArray aSubNodes;
+ aSubNodes.SetSize(1 + SUBSUP_NUM_ENTRIES);
+ for (ULONG i = 1; i < aSubNodes.GetSize(); i++)
+ aSubNodes.Put(i, NULL);
+
+ aSubNodes.Put(aSup+1,rNodeStack.Pop());
+ aSubNodes.Put(aSub+1,rNodeStack.Pop());
+ aSubNodes.Put(0, rNodeStack.Pop());
+ pNode->SetSubNodes(aSubNodes);
+ rNodeStack.Push(pNode);
+}
+
+class SmXMLUnderContext_Impl : public SmXMLSubContext_Impl
+{
+public:
+ SmXMLUnderContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLSubContext_Impl(rImport,nPrefix,rLName) {}
+ void StartElement(const uno::Reference< xml::sax::XAttributeList > &
+ xAttrList );
+ void EndElement();
+ void HandleAccent();
+protected:
+ sal_Int16 nAttrCount;
+};
+
+void SmXMLUnderContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+}
+
+void SmXMLUnderContext_Impl::HandleAccent()
+{
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
+ "Sub has not two arguments");
+
+ /*Just one special case for the underline thing*/
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ SmNode *pTest = rNodeStack.Pop();
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TUNDERLINE;
+
+
+ SmNodeArray aSubNodes;
+ aSubNodes.SetSize(2);
+
+ SmStructureNode *pNode = new SmAttributNode(aToken);
+ if ((pTest->GetToken().cMathChar & 0x0FFF) == 0x0332)
+ {
+ aSubNodes.Put(0, new SmRectangleNode(aToken));
+ delete pTest;
+ }
+ else
+ aSubNodes.Put(0, pTest);
+
+ aSubNodes.Put(1, rNodeStack.Pop());
+ pNode->SetSubNodes(aSubNodes);
+ pNode->SetScaleMode(SCALE_WIDTH);
+ rNodeStack.Push(pNode);
+}
+
+
+void SmXMLUnderContext_Impl::EndElement()
+{
+ if (!nAttrCount)
+ GenericEndElement(TCSUB,CSUB);
+ else
+ HandleAccent();
+#if 0
+ //UnderBrace trick
+ SmStructureNode *pNode = rNodeStack.Pop();
+ if (pNode->GetSubNode(1)->GetToken().cMathChar == (0x0332|0xf000))
+ if (pNode->GetSubNode(0)->GetToken().cMathChar == (0x0332|0xf000))
+#endif
+}
+
+class SmXMLOverContext_Impl : public SmXMLSubContext_Impl
+{
+public:
+ SmXMLOverContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLSubContext_Impl(rImport,nPrefix,rLName), nAttrCount(0) {}
+ void EndElement();
+ void StartElement(const uno::Reference< xml::sax::XAttributeList > &
+ xAttrList );
+ void HandleAccent();
+protected:
+ sal_Int16 nAttrCount;
+};
+
+
+void SmXMLOverContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+}
+
+
+void SmXMLOverContext_Impl::EndElement()
+{
+ if (!nAttrCount)
+ GenericEndElement(TCSUP,CSUP);
+ else
+ HandleAccent();
+}
+
+
+void SmXMLOverContext_Impl::HandleAccent()
+{
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
+ "Sub has not two arguments");
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TACUTE;
+
+ SmAttributNode *pNode = new SmAttributNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+
+ SmNodeArray aSubNodes;
+ aSubNodes.SetSize(2);
+ aSubNodes.Put(0, rNodeStack.Pop());
+ aSubNodes.Put(1, rNodeStack.Pop());
+ pNode->SetSubNodes(aSubNodes);
+ pNode->SetScaleMode(SCALE_WIDTH);
+ rNodeStack.Push(pNode);
+
+}
+
+class SmXMLUnderOverContext_Impl : public SmXMLSubSupContext_Impl
+{
+public:
+ SmXMLUnderOverContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLSubSupContext_Impl(rImport,nPrefix,rLName) {}
+ void EndElement() { GenericEndElement(TCSUB,CSUB,CSUP); }
+};
+
+class SmXMLMultiScriptsContext_Impl : public SmXMLSubSupContext_Impl
+{
+public:
+ SmXMLMultiScriptsContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLSubSupContext_Impl(rImport,nPrefix,rLName),
+ bHasPrescripts(FALSE) {}
+ void EndElement();
+ void MiddleElement();
+ SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList);
+private:
+ sal_Bool bHasPrescripts;
+};
+
+class SmXMLNoneContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLNoneContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName) {}
+ void EndElement();
+};
+
+
+void SmXMLNoneContext_Impl::EndElement(void)
+{
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.aText.Erase();
+ aToken.nLevel = 5;
+ aToken.eType = TIDENT;
+ GetSmImport().GetNodeStack().Push(
+ new SmTextNode(aToken,FNT_VARIABLE));
+}
+
+class SmXMLPrescriptsContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLPrescriptsContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName) {}
+};
+
+class SmXMLTableRowContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLTableRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLRowContext_Impl(rImport,nPrefix,rLName)
+ {}
+ SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList);
+};
+
+
+class SmXMLTableContext_Impl : public SmXMLTableRowContext_Impl
+{
+public:
+ SmXMLTableContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLTableRowContext_Impl(rImport,nPrefix,rLName)
+ {}
+ void EndElement();
+ SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList);
+};
+
+
+class SmXMLTableCellContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLTableCellContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLRowContext_Impl(rImport,nPrefix,rLName)
+ {}
+};
+
+class SmXMLAlignGroupContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLAlignGroupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLRowContext_Impl(rImport,nPrefix,rLName)
+ {}
+ /*Don't do anything with alignment for now*/
+ void EndElement() {}
+};
+
+class SmXMLActionContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLActionContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLRowContext_Impl(rImport,nPrefix,rLName)
+ {}
+ void EndElement();
+};
+
+class SmXMLOfficeContext_Impl : public SvXMLImportContext
+{
+public:
+ SmXMLOfficeContext_Impl( SmXMLImport &rImport, sal_uInt16 nPrfx,
+ const OUString& rLName)
+ : SvXMLImportContext(rImport,nPrfx,rLName) {}
+ virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList);
+};
+
+SvXMLImportContext *SmXMLOfficeContext_Impl::CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList)
+{
+ SvXMLImportContext *pContext = 0;
+ if( XML_NAMESPACE_OFFICE == nPrefix &&
+ rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sXML_meta) ) )
+ pContext = new SfxXMLMetaContext( GetImport(),
+ XML_NAMESPACE_OFFICE, rLocalName,
+ GetImport().GetModel() );
+ else if( XML_NAMESPACE_OFFICE == nPrefix &&
+ rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sXML_settings) ) )
+ pContext = new XMLDocumentSettingsContext( GetImport(),
+ XML_NAMESPACE_OFFICE, rLocalName,
+ xAttrList );
+ else
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+static __FAR_DATA SvXMLTokenMapEntry aPresLayoutElemTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_SEMANTICS, XML_TOK_SEMANTICS },
+ { XML_NAMESPACE_MATH, XML_MATH, XML_TOK_MATH },
+ { XML_NAMESPACE_MATH, XML_MSTYLE, XML_TOK_MSTYLE },
+ { XML_NAMESPACE_MATH, XML_MERROR, XML_TOK_MERROR },
+ { XML_NAMESPACE_MATH, XML_MPHANTOM, XML_TOK_MPHANTOM },
+ { XML_NAMESPACE_MATH, XML_MROW, XML_TOK_MROW },
+ { XML_NAMESPACE_MATH, XML_MFRAC, XML_TOK_MFRAC },
+ { XML_NAMESPACE_MATH, XML_MSQRT, XML_TOK_MSQRT },
+ { XML_NAMESPACE_MATH, XML_MROOT, XML_TOK_MROOT },
+ { XML_NAMESPACE_MATH, XML_MSUB, XML_TOK_MSUB },
+ { XML_NAMESPACE_MATH, XML_MSUP, XML_TOK_MSUP },
+ { XML_NAMESPACE_MATH, XML_MSUBSUP, XML_TOK_MSUBSUP },
+ { XML_NAMESPACE_MATH, XML_MUNDER, XML_TOK_MUNDER },
+ { XML_NAMESPACE_MATH, XML_MOVER, XML_TOK_MOVER },
+ { XML_NAMESPACE_MATH, XML_MUNDEROVER, XML_TOK_MUNDEROVER },
+ { XML_NAMESPACE_MATH, XML_MMULTISCRIPTS, XML_TOK_MMULTISCRIPTS },
+ { XML_NAMESPACE_MATH, XML_MTABLE, XML_TOK_MTABLE },
+ { XML_NAMESPACE_MATH, XML_MACTION, XML_TOK_MACTION },
+ { XML_NAMESPACE_MATH, XML_MFENCED, XML_TOK_MFENCED },
+ { XML_NAMESPACE_MATH, XML_MPADDED, XML_TOK_MPADDED },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aPresLayoutAttrTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_FONTWEIGHT, XML_TOK_FONTWEIGHT },
+ { XML_NAMESPACE_MATH, XML_FONTSTYLE, XML_TOK_FONTSTYLE },
+ { XML_NAMESPACE_MATH, XML_FONTSIZE, XML_TOK_FONTSIZE },
+ { XML_NAMESPACE_MATH, XML_FONTFAMILY, XML_TOK_FONTFAMILY },
+ { XML_NAMESPACE_MATH, XML_COLOR, XML_TOK_COLOR },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aFencedAttrTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_OPEN, XML_TOK_OPEN },
+ { XML_NAMESPACE_MATH, XML_CLOSE, XML_TOK_CLOSE },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aOperatorAttrTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_STRETCHY, XML_TOK_STRETCHY },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aAnnotationAttrTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_ENCODING, XML_TOK_ENCODING },
+ XML_TOKEN_MAP_END
+};
+
+
+static __FAR_DATA SvXMLTokenMapEntry aPresElemTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_ANNOTATION, XML_TOK_ANNOTATION },
+ { XML_NAMESPACE_MATH, XML_MI, XML_TOK_MI },
+ { XML_NAMESPACE_MATH, XML_MN, XML_TOK_MN },
+ { XML_NAMESPACE_MATH, XML_MO, XML_TOK_MO },
+ { XML_NAMESPACE_MATH, XML_MTEXT, XML_TOK_MTEXT },
+ { XML_NAMESPACE_MATH, XML_MSPACE,XML_TOK_MSPACE },
+ { XML_NAMESPACE_MATH, XML_MS, XML_TOK_MS },
+ { XML_NAMESPACE_MATH, XML_MALIGNGROUP, XML_TOK_MALIGNGROUP },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aPresScriptEmptyElemTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_MPRESCRIPTS, XML_TOK_MPRESCRIPTS },
+ { XML_NAMESPACE_MATH, XML_NONE, XML_TOK_NONE },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aPresTableElemTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_MTR, XML_TOK_MTR },
+ { XML_NAMESPACE_MATH, XML_MTD, XML_TOK_MTD },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aColorTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_BLACK, TBLACK},
+ { XML_NAMESPACE_MATH, XML_WHITE, TWHITE},
+ { XML_NAMESPACE_MATH, XML_RED, TRED},
+ { XML_NAMESPACE_MATH, XML_GREEN, TGREEN},
+ { XML_NAMESPACE_MATH, XML_BLUE, TBLUE},
+ { XML_NAMESPACE_MATH, XML_AQUA, TCYAN},
+ { XML_NAMESPACE_MATH, XML_FUCHSIA, TMAGENTA},
+ { XML_NAMESPACE_MATH, XML_YELLOW, TYELLOW},
+ XML_TOKEN_MAP_END
+};
+
+
+//const SvXMLTokenMap& SmXMLImport::GetMathElemTokenMap()
+//{
+// if(!pMathElemTokenMap)
+// pMathElemTokenMap = new SvXMLTokenMap(aMathElemTokenMap);
+// return *pMathElemTokenMap;
+//}
+
+const SvXMLTokenMap& SmXMLImport::GetPresLayoutElemTokenMap()
+{
+ if(!pPresLayoutElemTokenMap)
+ pPresLayoutElemTokenMap = new SvXMLTokenMap(aPresLayoutElemTokenMap);
+ return *pPresLayoutElemTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetPresLayoutAttrTokenMap()
+{
+ if(!pPresLayoutAttrTokenMap)
+ pPresLayoutAttrTokenMap = new SvXMLTokenMap(aPresLayoutAttrTokenMap);
+ return *pPresLayoutAttrTokenMap;
+}
+
+
+const SvXMLTokenMap& SmXMLImport::GetFencedAttrTokenMap()
+{
+ if(!pFencedAttrTokenMap)
+ pFencedAttrTokenMap = new SvXMLTokenMap(aFencedAttrTokenMap);
+ return *pFencedAttrTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetOperatorAttrTokenMap()
+{
+ if(!pOperatorAttrTokenMap)
+ pOperatorAttrTokenMap = new SvXMLTokenMap(aOperatorAttrTokenMap);
+ return *pOperatorAttrTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetAnnotationAttrTokenMap()
+{
+ if(!pAnnotationAttrTokenMap)
+ pAnnotationAttrTokenMap = new SvXMLTokenMap(aAnnotationAttrTokenMap);
+ return *pAnnotationAttrTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetPresElemTokenMap()
+{
+ if(!pPresElemTokenMap)
+ pPresElemTokenMap = new SvXMLTokenMap(aPresElemTokenMap);
+ return *pPresElemTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetPresScriptEmptyElemTokenMap()
+{
+ if(!pPresScriptEmptyElemTokenMap)
+ pPresScriptEmptyElemTokenMap = new
+ SvXMLTokenMap(aPresScriptEmptyElemTokenMap);
+ return *pPresScriptEmptyElemTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetPresTableElemTokenMap()
+{
+ if(!pPresTableElemTokenMap)
+ pPresTableElemTokenMap = new SvXMLTokenMap(aPresTableElemTokenMap);
+ return *pPresTableElemTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetColorTokenMap()
+{
+ if(!pColorTokenMap)
+ pColorTokenMap = new SvXMLTokenMap(aColorTokenMap);
+ return *pColorTokenMap;
+}
+
+SvXMLImportContext *SmXMLDocContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSmImport().GetPresLayoutElemTokenMap();
+
+ UINT32 nTest = rTokenMap.Get(nPrefix, rLocalName);
+
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ //Consider semantics a dummy except for any starmath annotations
+ case XML_TOK_SEMANTICS:
+ pContext = GetSmImport().CreateRowContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ /*General Layout Schemata*/
+ case XML_TOK_MROW:
+ pContext = GetSmImport().CreateRowContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MFRAC:
+ pContext = GetSmImport().CreateFracContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MSQRT:
+ pContext = GetSmImport().CreateSqrtContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MROOT:
+ pContext = GetSmImport().CreateRootContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MSTYLE:
+ pContext = GetSmImport().CreateStyleContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MERROR:
+ pContext = GetSmImport().CreateErrorContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MPADDED:
+ pContext = GetSmImport().CreatePaddedContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MPHANTOM:
+ pContext = GetSmImport().CreatePhantomContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MFENCED:
+ pContext = GetSmImport().CreateFencedContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ /*Script and Limit Schemata*/
+ case XML_TOK_MSUB:
+ pContext = GetSmImport().CreateSubContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MSUP:
+ pContext = GetSmImport().CreateSupContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MSUBSUP:
+ pContext = GetSmImport().CreateSubSupContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MUNDER:
+ pContext = GetSmImport().CreateUnderContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MOVER:
+ pContext = GetSmImport().CreateOverContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MUNDEROVER:
+ pContext = GetSmImport().CreateUnderOverContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MMULTISCRIPTS:
+ pContext = GetSmImport().CreateMultiScriptsContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ case XML_TOK_MTABLE:
+ pContext = GetSmImport().CreateTableContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ case XML_TOK_MACTION:
+ pContext = GetSmImport().CreateActionContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ default:
+ /*Basically theres an implicit mrow around certain bare
+ *elements, use a RowContext to see if this is one of
+ *those ones*/
+ SmXMLRowContext_Impl aTempContext(GetSmImport(),nPrefix,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_mrow)));
+
+ pContext = aTempContext.StrictCreateChildContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ }
+ return pContext;
+}
+
+void SmXMLDocContext_Impl::EndElement()
+{
+ SmNodeArray ContextArray;
+ ContextArray.SetSize(1);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+
+ for(ULONG i=0;i< 1;i++)
+ ContextArray.Put(i, rNodeStack.Pop());
+
+ SmToken aDummy;
+ SmStructureNode *pSNode = new SmLineNode(aDummy);
+ pSNode->SetSubNodes(ContextArray);
+ rNodeStack.Push(pSNode);
+
+ SmNodeArray LineArray;
+ ULONG n = rNodeStack.Count();
+ LineArray.SetSize(n);
+ for (ULONG j = 0; j < n; j++)
+ LineArray.Put(n - (j + 1), rNodeStack.Pop());
+ SmStructureNode *pSNode2 = new SmTableNode(aDummy);
+ pSNode2->SetSubNodes(LineArray);
+ rNodeStack.Push(pSNode2);
+}
+
+void SmXMLFracContext_Impl::EndElement()
+{
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TOVER;
+ SmStructureNode *pSNode = new SmBinVerNode(aToken);
+ SmNode *pOper = new SmRectangleNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ DBG_ASSERT(rNodeStack.Count() - nElementCount == 2,
+ "Fraction (mfrac) tag is missing component");
+
+ if (rNodeStack.Count() - nElementCount == 2)
+ {
+ SmNode *pSecond = rNodeStack.Pop();
+ SmNode *pFirst = rNodeStack.Pop();
+ pSNode->SetSubNodes(pFirst,pOper,pSecond);
+ rNodeStack.Push(pSNode);
+ }
+}
+
+void SmXMLRootContext_Impl::EndElement()
+{
+ /*The <mroot> element requires exactly 2 arguments.*/
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
+ "Root tag is missing component");
+
+ SmToken aToken;
+ aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TNROOT;
+ SmStructureNode *pSNode = new SmRootNode(aToken);
+ SmNode *pOper = new SmRootSymbolNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ SmNode *pIndex = rNodeStack.Pop();
+ SmNode *pBase = rNodeStack.Pop();
+ pSNode->SetSubNodes(pIndex,pOper,pBase);
+ rNodeStack.Push(pSNode);
+}
+
+void SmXMLSqrtContext_Impl::EndElement()
+{
+ /*
+ <msqrt> accepts any number of arguments; if this number is not 1, its
+ contents are treated as a single "inferred <mrow>" containing its
+ arguments
+ */
+ if (GetSmImport().GetNodeStack().Count() - nElementCount > 1)
+ SmXMLRowContext_Impl::EndElement();
+
+ SmToken aToken;
+ aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TSQRT;
+ SmStructureNode *pSNode = new SmRootNode(aToken);
+ SmNode *pOper = new SmRootSymbolNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ pSNode->SetSubNodes(0,pOper,rNodeStack.Pop());
+ rNodeStack.Push(pSNode);
+}
+
+void SmXMLRowContext_Impl::EndElement()
+{
+ SmNodeArray aRelationArray;
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ ULONG nSize = rNodeStack.Count()-nElementCount;
+
+ if (nSize)
+ {
+ aRelationArray.SetSize(nSize);
+ for(ULONG j=rNodeStack.Count()-nElementCount;j > 0;j--)
+ aRelationArray.Put(j-1,rNodeStack.Pop());
+
+
+ //If the first or last element is an operator with stretchyness
+ //set then we must create a brace node here from those elements,
+ //removing the stretchness from the operators and applying it to
+ //ourselves, and creating the appropiate dummy StarMath none bracket
+ //to balance the arrangement
+ if (((aRelationArray.Get(0)->GetScaleMode() == SCALE_HEIGHT)
+ && (aRelationArray.Get(0)->GetType() == NMATH))
+ || ((aRelationArray.Get(nSize-1)->GetScaleMode() == SCALE_HEIGHT)
+ && (aRelationArray.Get(nSize-1)->GetType() == NMATH)))
+ {
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+
+ int nLeft=0,nRight=0;
+ if ((aRelationArray.Get(0)->GetScaleMode() == SCALE_HEIGHT)
+ && (aRelationArray.Get(0)->GetType() == NMATH))
+ {
+ aToken = aRelationArray.Get(0)->GetToken();
+ nLeft=1;
+ }
+ else
+ aToken.cMathChar = '\0';
+
+ aToken.eType = TLPARENT;
+ SmNode *pLeft = new SmMathSymbolNode(aToken);
+
+ if ((aRelationArray.Get(nSize-1)->GetScaleMode() == SCALE_HEIGHT)
+ && (aRelationArray.Get(nSize-1)->GetType() == NMATH))
+ {
+ aToken = aRelationArray.Get(nSize-1)->GetToken();
+ nRight=1;
+ }
+ else
+ aToken.cMathChar = '\0';
+
+ aToken.eType = TRPARENT;
+ SmNode *pRight = new SmMathSymbolNode(aToken);
+
+ SmNodeArray aRelationArray2;
+
+ //!! nSize-nLeft-nRight may be < 0 !!
+ int nRelArrSize = nSize-nLeft-nRight;
+ if (nRelArrSize > 0)
+ {
+ aRelationArray2.SetSize(nRelArrSize);
+ for(int i=0;i < nRelArrSize;i++)
+ aRelationArray2.Put(i,aRelationArray.Get(i+nLeft));
+ }
+
+ SmToken aDummy;
+ SmStructureNode *pSNode = new SmBraceNode(aToken);
+ SmStructureNode *pBody = new SmExpressionNode(aDummy);
+ pBody->SetSubNodes(aRelationArray2);
+
+ pSNode->SetSubNodes(pLeft,pBody,pRight);
+ pSNode->SetScaleMode(SCALE_HEIGHT);
+ rNodeStack.Push(pSNode);
+ return;
+ }
+ }
+ else //Multiple newlines result in empty row elements
+ {
+ aRelationArray.SetSize(1);
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TNEWLINE;
+ aRelationArray.Put(0,new SmLineNode(aToken));
+ }
+
+ SmToken aDummy;
+ SmStructureNode *pSNode = new SmExpressionNode(aDummy);
+ pSNode->SetSubNodes(aRelationArray);
+ rNodeStack.Push(pSNode);
+}
+
+
+
+
+
+SvXMLImportContext *SmXMLRowContext_Impl::StrictCreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSmImport().GetPresElemTokenMap();
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ /*Note that these should accept malignmark subelements, but do not*/
+ case XML_TOK_MN:
+ pContext = GetSmImport().CreateNumberContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MI:
+ pContext = GetSmImport().CreateIdentifierContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MO:
+ pContext = GetSmImport().CreateOperatorContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MTEXT:
+ pContext = GetSmImport().CreateTextContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MSPACE:
+ pContext = GetSmImport().CreateSpaceContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MS:
+ pContext = GetSmImport().CreateStringContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+
+ /*Note: The maligngroup should only be seen when the row
+ * (or decendants) are in a table*/
+ case XML_TOK_MALIGNGROUP:
+ pContext = GetSmImport().CreateAlignGroupContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+
+ case XML_TOK_ANNOTATION:
+ pContext = GetSmImport().CreateAnnotationContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+
+ default:
+ break;
+ }
+ return pContext;
+}
+
+
+
+SvXMLImportContext *SmXMLRowContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = StrictCreateChildContext(nPrefix,
+ rLocalName, xAttrList);
+
+ if (!pContext)
+ {
+ //Hmm, unrecognized for this level, check to see if its
+ //an element that can have an implicit schema around it
+ pContext = SmXMLDocContext_Impl::CreateChildContext(nPrefix,
+ rLocalName,xAttrList);
+ }
+ return pContext;
+}
+
+
+SvXMLImportContext *SmXMLMultiScriptsContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSmImport().
+ GetPresScriptEmptyElemTokenMap();
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_MPRESCRIPTS:
+ MiddleElement();
+ pContext = GetSmImport().CreatePrescriptsContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ case XML_TOK_NONE:
+ pContext = GetSmImport().CreateNoneContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ default:
+ pContext = SmXMLRowContext_Impl::CreateChildContext(nPrefix,
+ rLocalName,xAttrList);
+ break;
+ }
+ return pContext;
+}
+
+void SmXMLMultiScriptsContext_Impl::MiddleElement()
+{
+ bHasPrescripts=sal_True;
+
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount > 0,
+ "Sub has no arguments");
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ if (rNodeStack.Count()-nElementCount > 1)
+ {
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TRSUB;
+ ULONG nFinalCount = rNodeStack.Count()-nElementCount-1;
+
+ SmNodeStack aReverseStack;
+ while (rNodeStack.Count()-nElementCount)
+ {
+ SmNode *pThing = rNodeStack.Pop();
+ aReverseStack.Push(pThing);
+ }
+
+ for (ULONG nCount=0;nCount < nFinalCount;nCount+=2)
+ {
+ SmSubSupNode *pNode = new SmSubSupNode(aToken);
+
+ // initialize subnodes array
+ SmNodeArray aSubNodes;
+ aSubNodes.SetSize(1 + SUBSUP_NUM_ENTRIES);
+ for (ULONG i = 1; i < aSubNodes.GetSize(); i++)
+ aSubNodes.Put(i, NULL);
+
+ /*On each loop the base and its sub sup pair becomes the
+ base for the next loop to which the next sub sup pair is
+ attached, i.e. wheels within wheels*/
+ //if (nCount == 0)
+ aSubNodes.Put(0, aReverseStack.Pop());
+
+ SmNode *pScriptNode = aReverseStack.Pop();
+
+ if ((pScriptNode->GetToken().eType != TIDENT) ||
+ (pScriptNode->GetToken().aText.Len()))
+ aSubNodes.Put(RSUB+1,pScriptNode);
+ pScriptNode = aReverseStack.Pop();
+ if ((pScriptNode->GetToken().eType != TIDENT) ||
+ (pScriptNode->GetToken().aText.Len()))
+ aSubNodes.Put(RSUP+1,pScriptNode);
+
+ pNode->SetSubNodes(aSubNodes);
+ aReverseStack.Push(pNode);
+ }
+ rNodeStack.Push(aReverseStack.Pop());
+ }
+}
+
+
+void SmXMLTableContext_Impl::EndElement()
+{
+ SmNodeArray aExpressionArray;
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ SmNodeStack aReverseStack;
+ aExpressionArray.SetSize(rNodeStack.Count()-nElementCount);
+
+ ULONG nRows = rNodeStack.Count()-nElementCount;
+ USHORT nCols = 0;
+
+ SmStructureNode *pArray;
+ for(ULONG i=rNodeStack.Count()-nElementCount;i > 0;i--)
+ {
+ pArray = (SmStructureNode *)rNodeStack.Pop();
+ if (pArray->GetNumSubNodes() == 0)
+ {
+ //This is a little tricky, it is possible that there was
+ //be elements that were not inside a <mtd> pair, in which
+ //case they will not be in a row, i.e. they will not have
+ //SubNodes, so we have to wait until here before we can
+ //resolve the situation. Implicitsurrounding tags are
+ //surprisingly difficult to get right within this
+ //architecture
+
+ SmNodeArray aRelationArray;
+ aRelationArray.SetSize(1);
+ aRelationArray.Put(0,pArray);
+ SmToken aDummy;
+ pArray = new SmExpressionNode(aDummy);
+ pArray->SetSubNodes(aRelationArray);
+ }
+
+ if (pArray->GetNumSubNodes() > nCols)
+ nCols = pArray->GetNumSubNodes();
+ aReverseStack.Push(pArray);
+ }
+ aExpressionArray.SetSize(nCols*nRows);
+ ULONG j=0;
+ while (aReverseStack.Count())
+ {
+ pArray = (SmStructureNode *)aReverseStack.Pop();
+ for (USHORT i=0;i<pArray->GetNumSubNodes();i++)
+ aExpressionArray.Put(j++,pArray->GetSubNode(i));
+ }
+
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = TRGROUP;
+ aToken.nLevel = 0;
+ aToken.eType = TMATRIX;
+ SmMatrixNode *pSNode = new SmMatrixNode(aToken);
+ pSNode->SetSubNodes(aExpressionArray);
+ pSNode->SetRowCol(static_cast<USHORT>(nRows),nCols);
+ rNodeStack.Push(pSNode);
+}
+
+SvXMLImportContext *SmXMLTableRowContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSmImport().
+ GetPresTableElemTokenMap();
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_MTD:
+ pContext = GetSmImport().CreateTableCellContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ default:
+ pContext = SmXMLRowContext_Impl::CreateChildContext(nPrefix,
+ rLocalName,xAttrList);
+ break;
+ }
+ return pContext;
+}
+
+SvXMLImportContext *SmXMLTableContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSmImport().
+ GetPresTableElemTokenMap();
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_MTR:
+ pContext = GetSmImport().CreateTableRowContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ default:
+ pContext = SmXMLTableRowContext_Impl::CreateChildContext(nPrefix,
+ rLocalName,xAttrList);
+ break;
+ }
+ return pContext;
+}
+
+void SmXMLMultiScriptsContext_Impl::EndElement()
+{
+ if (!bHasPrescripts)
+ MiddleElement();
+
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ if (rNodeStack.Count()-nElementCount > 1)
+ {
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TLSUB;
+ ULONG nFinalCount = rNodeStack.Count()-nElementCount-1;
+
+ SmNodeStack aReverseStack;
+ while (rNodeStack.Count()-nElementCount)
+ aReverseStack.Push(rNodeStack.Pop());
+ for (ULONG nCount=0;nCount < nFinalCount;nCount+=2)
+ {
+ SmSubSupNode *pNode = new SmSubSupNode(aToken);
+
+ // initialize subnodes array
+ SmNodeArray aSubNodes;
+ aSubNodes.SetSize(1 + SUBSUP_NUM_ENTRIES);
+ for (ULONG i = 1; i < aSubNodes.GetSize(); i++)
+ aSubNodes.Put(i, NULL);
+
+ /*On each loop the base and its sub sup pair becomes the
+ base for the next loop to which the next sub sup pair is
+ attached, i.e. wheels within wheels*/
+ //if (nCount == 0)
+ aSubNodes.Put(0, aReverseStack.Pop());
+
+ SmNode *pScriptNode = aReverseStack.Pop();
+ if (pScriptNode->GetToken().aText.Len())
+ aSubNodes.Put(LSUB+1,pScriptNode);
+ pScriptNode = aReverseStack.Pop();
+ if (pScriptNode->GetToken().aText.Len())
+ aSubNodes.Put(LSUP+1,pScriptNode);
+
+ pNode->SetSubNodes(aSubNodes);
+ aReverseStack.Push(pNode);
+ }
+ rNodeStack.Push(aReverseStack.Pop());
+ }
+
+}
+void SmXMLActionContext_Impl::EndElement()
+{
+ /*For now we will just assume that the
+ selected attribute is one, and then just display
+ that expression alone, i.e. remove all expect the
+ first pushed one*/
+
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ for(ULONG i=rNodeStack.Count()-nElementCount;i > 1;i--)
+ {
+ delete rNodeStack.Pop();
+ }
+}
+
+SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ if( XML_NAMESPACE_OFFICE == nPrefix )
+ return new SmXMLOfficeContext_Impl( *this,nPrefix,rLocalName);
+ else
+ return new SmXMLDocContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateRowContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLRowContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateTextContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLTextContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateAnnotationContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLAnnotationContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateStringContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLStringContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateNumberContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLNumberContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateIdentifierContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLIdentifierContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateOperatorContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLOperatorContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateSpaceContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLSpaceContext_Impl(*this,nPrefix,rLocalName);
+}
+
+
+SvXMLImportContext *SmXMLImport::CreateFracContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLFracContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateSqrtContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLSqrtContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateRootContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLRootContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateStyleContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLStyleContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreatePaddedContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLPaddedContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreatePhantomContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLPhantomContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateFencedContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLFencedContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateErrorContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLErrorContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateSubContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLSubContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateSubSupContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLSubSupContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateSupContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLSupContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateUnderContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLUnderContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateOverContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLOverContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateUnderOverContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLUnderOverContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateMultiScriptsContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLMultiScriptsContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateTableContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLTableContext_Impl(*this,nPrefix,rLocalName);
+}
+SvXMLImportContext *SmXMLImport::CreateTableRowContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLTableRowContext_Impl(*this,nPrefix,rLocalName);
+}
+SvXMLImportContext *SmXMLImport::CreateTableCellContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLTableCellContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateNoneContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLNoneContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreatePrescriptsContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLPrescriptsContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateAlignGroupContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLAlignGroupContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateActionContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> &xAttrList)
+{
+ return new SmXMLActionContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SmXMLImport::~SmXMLImport() throw ()
+{
+ delete pMathElemTokenMap;
+ delete pPresLayoutElemTokenMap;
+ delete pPresElemTokenMap;
+ delete pPresScriptEmptyElemTokenMap;
+ delete pPresTableElemTokenMap;
+ delete pPresLayoutAttrTokenMap;
+ delete pFencedAttrTokenMap;
+ delete pColorTokenMap;
+ delete pOperatorAttrTokenMap;
+ delete pAnnotationAttrTokenMap;
+}
+
+void SmXMLImport::SetViewSettings(const Sequence<PropertyValue>& aViewProps)
+{
+ uno::Reference <frame::XModel> xModel = GetModel();
+ if( !xModel.is() )
+ return;
+
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if( !pModel )
+ return;
+
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+ if( !pDocShell )
+ return;
+
+ Rectangle aRect( pDocShell->GetVisArea() );
+
+ sal_Int32 nCount = aViewProps.getLength();
+ const PropertyValue *pValue = aViewProps.getConstArray();
+
+ long nTmp;
+ sal_Bool bShowDeletes = sal_False, bShowInserts = sal_False, bShowFooter = sal_False, bShowHeader = sal_False;
+
+ for (sal_Int32 i = 0; i < nCount ; i++)
+ {
+ if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaTop" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ aRect.setY( nTmp );
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaLeft" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ aRect.setX( nTmp );
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaWidth" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ Size aSize( aRect.GetSize() );
+ aSize.Width() = nTmp;
+ aRect.SetSize( aSize );
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaHeight" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ Size aSize( aRect.GetSize() );
+ aSize.Height() = nTmp;
+ aRect.SetSize( aSize );
+ }
+ pValue++;
+ }
+
+ pDocShell->SetVisArea ( aRect );
+}
+
+void SmXMLImport::SetConfigurationSettings(const Sequence<PropertyValue>& aConfProps)
+{
+ uno::Reference < XPropertySet > xProps ( GetModel(), UNO_QUERY );
+ if ( xProps.is() )
+ {
+ Reference < XPropertySetInfo > xInfo ( xProps->getPropertySetInfo() );
+ if (xInfo.is() )
+ {
+ sal_Int32 nCount = aConfProps.getLength();
+ const PropertyValue* pValues = aConfProps.getConstArray();
+
+ const OUString sFormula ( RTL_CONSTASCII_USTRINGPARAM ( "Formula" ) );
+ const OUString sBasicLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "BasicLibraries" ) );
+ while( nCount-- )
+ {
+ if (pValues->Name != sFormula &&
+ pValues->Name != sBasicLibraries)
+ {
+ try
+ {
+ if( xInfo->hasPropertyByName( pValues->Name ) )
+ xProps->setPropertyValue( pValues->Name, pValues->Value );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "SmXMLImport::SetConfigurationSettings: Exception!" );
+ }
+ }
+
+ pValues++;
+ }
+ }
+ }
+}
+void SmXMLExport::_ExportContent()
+{
+ SvXMLElementExport aEquation(*this,XML_NAMESPACE_MATH,sXML_math, sal_True,
+ sal_True);
+ SvXMLElementExport *pSemantics=0;
+
+ if (aText.Len())
+ {
+ pSemantics = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,
+ sXML_semantics, sal_True, sal_True);
+ }
+
+ ExportNodes(pTree,0);
+
+ if (aText.Len())
+ {
+ // Convert symbol names
+ uno::Reference <frame::XModel> xModel = GetModel();
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+ SmDocShell *pDocShell = pModel ?
+ static_cast<SmDocShell*>(pModel->GetObjectShell()) : 0;
+ DBG_ASSERT( pDocShell, "doc shell missing" );
+ if (pDocShell)
+ {
+ SmParser &rParser = pDocShell->GetParser();
+ BOOL bVal = rParser.IsExportSymbolNames();
+ rParser.SetExportSymbolNames( TRUE );
+ SmNode *pTree = rParser.Parse( aText );
+ aText = rParser.GetText();
+ delete pTree;
+ rParser.SetExportSymbolNames( bVal );
+ }
+
+ AddAttribute(XML_NAMESPACE_MATH,sXML_encoding,
+ OUString(RTL_CONSTASCII_USTRINGPARAM("StarMath 5.0")));
+ SvXMLElementExport aAnnotation(*this,XML_NAMESPACE_MATH,
+ sXML_annotation,sal_True, sal_False);
+ GetDocHandler()->characters(OUString( aText ));
+ }
+ delete pSemantics;
+}
+
+void SmXMLExport::GetViewSettings( Sequence < PropertyValue >& aProps)
+{
+ uno::Reference <frame::XModel> xModel = GetModel();
+ if( !xModel.is() )
+ return;
+
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if( !pModel )
+ return;
+
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+ if( !pDocShell )
+ return;
+
+ aProps.realloc( 4 );
+ PropertyValue *pValue = aProps.getArray();
+ sal_Int32 nIndex = 0;
+
+ const Rectangle &rRect = pDocShell->GetVisArea();
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaTop") );
+ pValue[nIndex++].Value <<= rRect.Top();
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaLeft") );
+ pValue[nIndex++].Value <<= rRect.Left();
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaWidth") );
+ pValue[nIndex++].Value <<= rRect.GetWidth();
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaHeight") );
+ pValue[nIndex++].Value <<= rRect.GetHeight();
+}
+
+void SmXMLExport::GetConfigurationSettings( Sequence < PropertyValue > & rProps)
+{
+ Reference < XPropertySet > xProps ( GetModel(), UNO_QUERY );
+ if ( xProps.is() )
+ {
+ Reference< XPropertySetInfo > xPropertySetInfo = xProps->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ Sequence< Property > aProps = xPropertySetInfo->getProperties();
+ sal_Int32 nCount(aProps.getLength());
+ if (nCount)
+ {
+ rProps.realloc(nCount);
+ PropertyValue* pProps = rProps.getArray();
+ if (pProps)
+ {
+ const OUString sFormula ( RTL_CONSTASCII_USTRINGPARAM ( "Formula" ) );
+ const OUString sBasicLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "BasicLibraries" ) );
+ for (sal_Int32 i = 0; i < nCount; i++, pProps++)
+ {
+ if (aProps[i].Name != sFormula &&
+ aProps[i].Name != sBasicLibraries)
+ {
+ pProps->Name = aProps[i].Name;
+ pProps->Value = xProps->getPropertyValue(aProps[i].Name);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void SmXMLExport::ExportLine(const SmNode *pNode,int nLevel)
+{
+ ExportExpression(pNode,nLevel);
+}
+
+void SmXMLExport::ExportBinaryHorizontal(const SmNode *pNode,int nLevel)
+{
+ ExportExpression(pNode,nLevel);
+}
+
+void SmXMLExport::ExportUnaryHorizontal(const SmNode *pNode,int nLevel)
+{
+ ExportExpression(pNode,nLevel);
+}
+
+void SmXMLExport::ExportExpression(const SmNode *pNode,int nLevel)
+{
+ SvXMLElementExport *pRow=0;
+ ULONG nSize = pNode->GetNumSubNodes();
+
+ if (nSize > 1)
+ pRow = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_mrow,
+ sal_True, sal_True);
+
+ //if (nSize)
+ //{
+ for (USHORT i = 0; i < nSize; i++)
+ if (const SmNode *pTemp = pNode->GetSubNode(i))
+ ExportNodes(pTemp,nLevel+1);
+ //}
+#if 0
+ else
+ {
+ //This saves us from situations like "a newline" where the
+ //lack of a term following the newline would otherwise create
+ //a incorrect token like <mtr/>
+ SvXMLElementExport aDummy(*this,XML_NAMESPACE_MATH,sXML_mi,
+ sal_True,sal_True);
+ sal_Unicode nArse[2] = {'\n','\0'};
+ GetDocHandler()->characters(nArse);
+ }
+#endif
+
+ delete pRow;
+}
+
+void SmXMLExport::ExportBinaryVertical(const SmNode *pNode,int nLevel)
+{
+ DBG_ASSERT(pNode->GetNumSubNodes()==3,"Bad Fraction");
+ SvXMLElementExport aFraction(*this,XML_NAMESPACE_MATH,sXML_mfrac, sal_True,
+ sal_True);
+ ExportNodes(pNode->GetSubNode(0),nLevel);
+ ExportNodes(pNode->GetSubNode(2),nLevel);
+}
+
+void SmXMLExport::ExportTable(const SmNode *pNode, int nLevel)
+{
+ SvXMLElementExport *pTable=0;
+
+ USHORT nSize = pNode->GetNumSubNodes();
+
+ //If the list ends in newline then the last entry has
+ //no subnodes, the newline is superfulous so we just drop
+ //the last node, inclusion would create a bad MathML
+ //table
+ if (pNode->GetSubNode(nSize-1)->GetNumSubNodes() == 0)
+ nSize--;
+
+ if ( nLevel || (nSize >1))
+ pTable = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_mtable,
+ sal_True, sal_True);
+
+ for (USHORT i = 0; i < nSize; i++)
+ if (const SmNode *pTemp = pNode->GetSubNode(i))
+ {
+ SvXMLElementExport *pRow=0;
+ if (pTable)
+ pRow = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,
+ sXML_mtr, sal_True, sal_True);
+ ExportNodes(pTemp,nLevel+1);
+ delete pRow;
+ }
+
+ delete pTable;
+}
+
+void SmXMLExport::ExportMath(const SmNode *pNode, int nLevel)
+{
+ const SmMathSymbolNode *pTemp = static_cast<const SmMathSymbolNode *>
+ (pNode);
+ SvXMLElementExport aMath(*this,XML_NAMESPACE_MATH,sXML_mo,
+ sal_True,sal_False);
+ sal_Unicode nArse[2];
+ nArse[0] = pTemp->GetText().GetChar(0);
+ DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol");
+ nArse[1] = 0;
+ GetDocHandler()->characters(nArse);
+}
+
+void SmXMLExport::ExportText(const SmNode *pNode, int nLevel)
+{
+ SvXMLElementExport *aText;
+ const SmTextNode *pTemp = static_cast<const SmTextNode *>(pNode);
+ switch (pNode->GetToken().eType)
+ {
+ default:
+ case TIDENT:
+ //Note that we change the fontstyle to italic for strings that
+ //are italic and longer than a single character.
+ if ((pTemp->GetText().Len() > 1) &&
+ (pTemp->GetFont().GetItalic() == ITALIC_NORMAL))
+ AddAttribute(XML_NAMESPACE_MATH,sXML_fontstyle,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_italic)));
+ else if ((pTemp->GetText().Len() == 1) &&
+ (pTemp->GetFont().GetItalic() == ITALIC_NONE))
+ AddAttribute(XML_NAMESPACE_MATH,sXML_fontstyle,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_normal)));
+ aText = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_mi,
+ sal_True,sal_False);
+ break;
+ case TNUMBER:
+ aText = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_mn,
+ sal_True,sal_False);
+ break;
+ case TTEXT:
+ aText = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_mtext,
+ sal_True,sal_False);
+ break;
+ }
+ GetDocHandler()->characters(OUString(pTemp->GetText().GetBuffer()));
+ delete aText;
+}
+
+void SmXMLExport::ExportSubSupScript(const SmNode *pNode,int nLevel)
+{
+ const SmNode *pSub = NULL;
+ const SmNode *pSup = NULL;
+ const SmNode *pCSub = NULL;
+ const SmNode *pCSup = NULL;
+ const SmNode *pLSub = NULL;
+ const SmNode *pLSup = NULL;
+ SvXMLElementExport *pThing=0,*pThing2=0;
+
+ //if we have prescripts at all then we must use the tensor notation
+
+ //This is one of those excellent locations where scope is vital to
+ //arrange the construction and destruction of the element helper
+ //classes correctly
+ pLSub = pNode->GetSubNode(LSUB+1);
+ pLSup = pNode->GetSubNode(LSUP+1);
+ if (pLSub || pLSup)
+ {
+ SvXMLElementExport aMultiScripts(*this,XML_NAMESPACE_MATH,
+ sXML_mmultiscripts, sal_True, sal_True);
+
+
+ if ((pCSub = pNode->GetSubNode(CSUB+1))
+ && (pCSup=pNode->GetSubNode(CSUP+1)))
+ {
+ pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,
+ sXML_munderover, sal_True,sal_True);
+ }
+ else if (pCSub = pNode->GetSubNode(CSUB+1))
+ {
+ pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,
+ sXML_munder, sal_True,sal_True);
+ }
+ else if (pCSup = pNode->GetSubNode(CSUP+1))
+ {
+ pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,
+ sXML_mover, sal_True,sal_True);
+ }
+
+ ExportNodes(pNode->GetSubNode(0), nLevel+1); //Main Term
+
+ if (pCSub)
+ ExportNodes(pCSub, nLevel+1);
+ if (pCSup)
+ ExportNodes(pCSup, nLevel+1);
+ delete pThing2;
+
+ pSub = pNode->GetSubNode(RSUB+1);
+ pSup = pNode->GetSubNode(RSUP+1);
+ if (pSub || pSup)
+ {
+ if (pSub)
+ ExportNodes(pSub, nLevel+1);
+ else
+ {
+ SvXMLElementExport aNone(*this,XML_NAMESPACE_MATH, sXML_none,
+ sal_True,sal_True);
+ }
+ if (pSup)
+ ExportNodes(pSup, nLevel+1);
+ else
+ {
+ SvXMLElementExport aNone(*this,XML_NAMESPACE_MATH, sXML_none,
+ sal_True,sal_True);
+ }
+ }
+
+ //Seperator element between suffix and prefix sub/sup pairs
+ {
+ SvXMLElementExport aPrescripts(*this,XML_NAMESPACE_MATH,
+ sXML_mprescripts, sal_True,sal_True);
+ }
+
+ if (pLSub)
+ ExportNodes(pLSub, nLevel+1);
+ else
+ {
+ SvXMLElementExport aNone(*this,XML_NAMESPACE_MATH, sXML_none,
+ sal_True,sal_True);
+
+ }
+ if (pLSup)
+ ExportNodes(pLSup, nLevel+1);
+ else
+ {
+ SvXMLElementExport aNone(*this,XML_NAMESPACE_MATH, sXML_none,
+ sal_True,sal_True);
+
+ }
+ }
+ else
+ {
+ if ((pSub = pNode->GetSubNode(RSUB+1)) &&
+ (pSup = pNode->GetSubNode(RSUP+1)))
+ {
+ pThing = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,
+ sXML_msubsup, sal_True,sal_True);
+ }
+ else if (pSub = pNode->GetSubNode(RSUB+1))
+ {
+ pThing = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_msub,
+ sal_True,sal_True);
+ }
+ else if (pSup = pNode->GetSubNode(RSUP+1))
+ {
+ pThing = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_msup,
+ sal_True,sal_True);
+ }
+
+ if ((pCSub = pNode->GetSubNode(CSUB+1))
+ && (pCSup=pNode->GetSubNode(CSUP+1)))
+ {
+ pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,
+ sXML_munderover, sal_True,sal_True);
+ }
+ else if (pCSub = pNode->GetSubNode(CSUB+1))
+ {
+ pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,
+ sXML_munder, sal_True,sal_True);
+ }
+ else if (pCSup = pNode->GetSubNode(CSUP+1))
+ {
+ pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,
+ sXML_mover, sal_True,sal_True);
+ }
+ ExportNodes(pNode->GetSubNode(0), nLevel+1); //Main Term
+
+ if (pCSub)
+ ExportNodes(pCSub, nLevel+1);
+ if (pCSup)
+ ExportNodes(pCSup, nLevel+1);
+ delete pThing2;
+
+ if (pSub)
+ ExportNodes(pSub, nLevel+1);
+ if (pSup)
+ ExportNodes(pSup, nLevel+1);
+ delete pThing;
+ }
+}
+
+void SmXMLExport::ExportBrace(const SmNode *pNode, int nLevel)
+{
+ const SmNode *pTemp;
+ const SmNode *pLeft=pNode->GetSubNode(0);
+ const SmNode *pRight=pNode->GetSubNode(2);
+ SvXMLElementExport *pFences=0,*pRow=0;
+ if ( ((pLeft) && (pLeft->GetToken().eType != TNONE)) &&
+ ((pRight) && (pRight->GetToken().eType != TNONE)) &&
+ (pNode->GetScaleMode() == SCALE_HEIGHT))
+ {
+ sal_Unicode nArse[2];
+ nArse[1] = 0;
+ nArse[0] = static_cast<
+ const SmMathSymbolNode* >(pLeft)->GetText().GetChar(0);
+ DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol");
+ AddAttribute(XML_NAMESPACE_MATH,sXML_open,nArse);
+ nArse[0] = static_cast<
+ const SmMathSymbolNode* >(pRight)->GetText().GetChar(0);
+ DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol");
+ AddAttribute(XML_NAMESPACE_MATH,sXML_close,nArse);
+ pFences = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_mfenced,
+ sal_True,sal_True);
+ }
+ else if (pLeft && (pLeft->GetToken().eType != TNONE))
+ {
+ pRow = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_mrow,
+ sal_True, sal_True);
+ if (pNode->GetScaleMode() == SCALE_HEIGHT)
+ AddAttribute(XML_NAMESPACE_MATH,sXML_stretchy,OUString(
+ RTL_CONSTASCII_USTRINGPARAM(sXML_true)));
+ else
+ AddAttribute(XML_NAMESPACE_MATH,sXML_stretchy,OUString(
+ RTL_CONSTASCII_USTRINGPARAM(sXML_false)));
+ ExportNodes(pLeft,nLevel+1);
+ }
+ else
+ pRow = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_mrow,
+ sal_True, sal_True);
+
+ if (pTemp = pNode->GetSubNode(1))
+ ExportNodes(pTemp,nLevel+1);
+ if (pFences)
+ delete pFences;
+ else if (pRight && (pRight->GetToken().eType != TNONE))
+ {
+ if (pNode->GetScaleMode() == SCALE_HEIGHT)
+ AddAttribute(XML_NAMESPACE_MATH,sXML_stretchy,OUString(
+ RTL_CONSTASCII_USTRINGPARAM(sXML_true)));
+ else
+ AddAttribute(XML_NAMESPACE_MATH,sXML_stretchy,OUString(
+ RTL_CONSTASCII_USTRINGPARAM(sXML_false)));
+ ExportNodes(pRight,nLevel+1);
+ }
+ delete pRow;
+}
+
+void SmXMLExport::ExportRoot(const SmNode *pNode, int nLevel)
+{
+ if (pNode->GetSubNode(0))
+ {
+ SvXMLElementExport aRoot(*this,XML_NAMESPACE_MATH,sXML_mroot,sal_True,
+ sal_True);
+ ExportNodes(pNode->GetSubNode(2),nLevel+1);
+ ExportNodes(pNode->GetSubNode(0),nLevel+1);
+ }
+ else
+ {
+ SvXMLElementExport aSqrt(*this,XML_NAMESPACE_MATH,sXML_msqrt,sal_True,
+ sal_True);
+ ExportNodes(pNode->GetSubNode(2),nLevel+1);
+ }
+}
+
+void SmXMLExport::ExportOperator(const SmNode *pNode, int nLevel)
+{
+ /*we need to either use content or font and size attributes
+ *here*/
+#if 0
+ {
+ SvXMLElementExport aMath(*this,XML_NAMESPACE_MATH,sXML_mo,
+ sal_True,sal_False);
+ SmTextNode *pTemp = (SmTextNode *)pNode->GetSubNode(0);
+ GetDocHandler()->characters(pTemp->GetText());
+ }
+#endif
+ SvXMLElementExport aRow(*this,XML_NAMESPACE_MATH,sXML_mrow,
+ sal_True, sal_True);
+ ExportNodes(pNode->GetSubNode(0),nLevel+1);
+ ExportNodes(pNode->GetSubNode(1),nLevel+1);
+}
+
+void SmXMLExport::ExportAttributes(const SmNode *pNode, int nLevel)
+{
+ SvXMLElementExport *pElement=0;
+
+ if (pNode->GetToken().eType == TUNDERLINE)
+ {
+ AddAttribute(XML_NAMESPACE_MATH,sXML_accentunder,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_true)));
+ pElement = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_munder,
+ sal_True,sal_True);
+ }
+ else if (pNode->GetToken().eType != TOVERSTRIKE)
+ {
+ AddAttribute(XML_NAMESPACE_MATH,sXML_accent,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_true)));
+ pElement = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,sXML_mover,
+ sal_True,sal_True);
+ }
+
+ ExportNodes(pNode->GetSubNode(1),nLevel+1);
+ switch (pNode->GetToken().eType)
+ {
+ case TOVERLINE:
+ {
+ //proper entity support required
+ SvXMLElementExport aMath(*this,XML_NAMESPACE_MATH,sXML_mo,
+ sal_True,sal_False);
+#if 0
+ GetDocHandler()->characters(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("&overbar;")));
+#else
+ sal_Unicode nArse[2] = {0xAF,0x00};
+#endif
+ GetDocHandler()->characters(nArse);
+ }
+ break;
+ case TUNDERLINE:
+ {
+ //proper entity support required
+ SvXMLElementExport aMath(*this,XML_NAMESPACE_MATH,sXML_mo,
+ sal_True,sal_False);
+#if 0
+ GetDocHandler()->characters(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("&underbar;")));
+#else
+ sal_Unicode nArse[2] = {0x0332,0x00};
+#endif
+ GetDocHandler()->characters(nArse);
+ }
+ break;
+ case TOVERSTRIKE:
+ break;
+ default:
+ ExportNodes(pNode->GetSubNode(0),nLevel+1);
+ break;
+ }
+ delete pElement;
+}
+
+void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel)
+{
+ SvXMLElementExport *pElement=0;
+ switch (pNode->GetToken().eType)
+ {
+ //wrap a phantom element around everything*/
+ case TPHANTOM:
+ pElement = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,
+ sXML_mphantom, sal_True,sal_True);
+ break;
+ case TBOLD:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_fontweight,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_bold)));
+ break;
+ case TITALIC:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_fontstyle,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_italic)));
+ break;
+ case TNBOLD:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_fontweight,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_weight_normal)));
+ break;
+ case TNITALIC:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_fontstyle,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_weight_normal)));
+ break;
+ case TBLACK:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_color,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_black)));
+ break;
+ case TWHITE:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_color,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_white)));
+ break;
+ case TRED:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_color,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_red)));
+ break;
+ case TGREEN:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_color,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_green)));
+ break;
+ case TBLUE:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_color,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_blue)));
+ break;
+ case TCYAN:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_color,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_aqua)));
+ break;
+ case TMAGENTA:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_color,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_fuchsia)));
+ break;
+ case TYELLOW:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_color,
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_yellow)));
+ break;
+ case TSIZE:
+ {
+ const SmFontNode *pFontNode = static_cast<const SmFontNode *>
+ (pNode);
+ const Fraction &aFrac = pFontNode->GetSizeParameter();
+
+ OUStringBuffer sStrBuf;
+ switch(pFontNode->GetSizeType())
+ {
+ case FNTSIZ_MULTIPLY:
+ SvXMLUnitConverter::convertDouble(sStrBuf,
+ static_cast<double>(aFrac*Fraction(100.00)));
+ sStrBuf.append(static_cast<sal_Unicode>('%'));
+ break;
+ case FNTSIZ_DIVIDE:
+ SvXMLUnitConverter::convertDouble(sStrBuf,
+ static_cast<double>(Fraction(100.00)/aFrac));
+ sStrBuf.append(static_cast<sal_Unicode>('%'));
+ break;
+ case FNTSIZ_ABSOLUT:
+ SvXMLUnitConverter::convertDouble(sStrBuf,
+ static_cast<double>(aFrac));
+ sStrBuf.append(
+ OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_unit_pt)));
+ break;
+ default:
+ {
+ //The problem here is that the wheels fall off because
+ //font size is stored in 100th's of a mm not pts, and
+ //rounding errors take their toll on the original
+ //value specified in points.
+
+ //Must fix StarMath to retain the original pt values
+ Fraction aTemp = Sm100th_mmToPts(pFontNode->GetFont().
+ GetSize().Height());
+
+ if (pFontNode->GetSizeType() == FNTSIZ_MINUS)
+ aTemp-=aFrac;
+ else
+ aTemp+=aFrac;
+
+ double mytest = static_cast<double>(aTemp);
+
+ mytest = ::rtl::math::round(mytest,1);
+ SvXMLUnitConverter::convertDouble(sStrBuf,mytest);
+ sStrBuf.append(OUString(
+ RTL_CONSTASCII_USTRINGPARAM(sXML_unit_pt)));
+ }
+ break;
+ }
+
+ OUString sStr(sStrBuf.makeStringAndClear());
+ AddAttribute(XML_NAMESPACE_MATH,sXML_fontsize,sStr);
+ }
+ break;
+ case TFIXED:
+ case TSANS:
+ case TSERIF:
+ AddAttribute(XML_NAMESPACE_MATH,sXML_fontfamily,
+ OUString(pNode->GetToken().aText.GetBuffer()));
+ break;
+
+ }
+#if 0
+ if (pNode->GetNumSubNodes() > 1) //or in the future is a node that
+ //cannot take the currently supported
+ //properties
+#endif
+ //for now we will just always export with a style and not worry about
+ //anyone else for the moment.
+ {
+ //wrap a style around it
+ SvXMLElementExport aStyle(*this,XML_NAMESPACE_MATH,
+ sXML_mstyle, sal_True,sal_True);
+ ExportExpression(pNode,nLevel);
+ }
+#if 0
+ else
+ ExportNodes(pNode->GetSubNode(0),nLevel+1);
+#endif
+
+ delete pElement;
+}
+
+
+void SmXMLExport::ExportVerticalBrace(const SmNode *pNode, int nLevel)
+{
+ //Place the overbrace value OVER a vertical brace and then place that
+ //expression OVER the overbrace value, If someone can find a
+ //dedicated term in MathML to handle this overbrace/underbrace concept
+ //let me know. C.
+ const sal_Char *pWhich;
+
+ switch (pNode->GetToken().eType)
+ {
+ case TOVERBRACE:
+ default:
+ pWhich = sXML_mover;
+ break;
+ case TUNDERBRACE:
+ pWhich = sXML_munder;
+ break;
+ }
+
+ DBG_ASSERT(pNode->GetNumSubNodes()==3,"Bad Vertical Brace");
+ SvXMLElementExport aOver1(*this,XML_NAMESPACE_MATH,pWhich, sal_True,
+ sal_True);
+ {//Scoping
+ AddAttribute(XML_NAMESPACE_MATH,sXML_accent,OUString(
+ RTL_CONSTASCII_USTRINGPARAM(sXML_true)));
+ SvXMLElementExport aOver2(*this,XML_NAMESPACE_MATH,pWhich, sal_True,
+ sal_True);
+ ExportNodes(pNode->GetSubNode(0),nLevel);
+ ExportNodes(pNode->GetSubNode(1),nLevel);
+ }
+ ExportNodes(pNode->GetSubNode(2),nLevel);
+}
+
+void SmXMLExport::ExportMatrix(const SmNode *pNode, int nLevel)
+{
+ SvXMLElementExport aTable(*this,XML_NAMESPACE_MATH,sXML_mtable,
+ sal_True, sal_True);
+ const SmMatrixNode *pMatrix = static_cast<const SmMatrixNode *>(pNode);
+ USHORT i=0;
+ for (ULONG y = 0; y < pMatrix->GetNumRows(); y++)
+ {
+ SvXMLElementExport aRow(*this,XML_NAMESPACE_MATH,sXML_mtr,
+ sal_True, sal_True);
+ for (ULONG x = 0; x < pMatrix->GetNumCols(); x++)
+ if (const SmNode *pTemp = pNode->GetSubNode(i++))
+ {
+ SvXMLElementExport aCell(*this,XML_NAMESPACE_MATH,
+ sXML_mtd, sal_True, sal_True);
+ ExportNodes(pTemp,nLevel+1);
+ }
+ }
+}
+
+void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel)
+{
+ if (!pNode)
+ return;
+ switch(pNode->GetType())
+ {
+ case NTABLE:
+ ExportTable(pNode,nLevel);
+ break;
+ case NALIGN:
+ case NBRACEBODY:
+ case NEXPRESSION:
+ ExportExpression(pNode,nLevel);
+ break;
+ case NLINE:
+ ExportLine(pNode,nLevel);
+ break;
+ case NTEXT:
+ ExportText(pNode,nLevel);
+ break;
+ case NSPECIAL: //NSPECIAL requires some sort of Entity preservation in
+ //the XML engine.
+ case NMATH:
+ {
+ //To fully handle generic MathML we need to implement the full
+ //operator dictionary, we will generate MathML with explicit
+ //stretchiness for now.
+ sal_Int16 nLength = GetAttrList().getLength();
+ sal_Bool bAddStretch=sal_True;
+ for( sal_Int16 i = 0; i < nLength; i++ )
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetNamespaceMap().GetKeyByAttrName(
+ GetAttrList().getNameByIndex(i), &sLocalName );
+
+ if ( ( XML_NAMESPACE_MATH == nPrefix ) &&
+ IsXMLToken(sLocalName, XML_STRETCHY) )
+ {
+ bAddStretch = sal_False;
+ break;
+ }
+ }
+ if (bAddStretch)
+ {
+ AddAttribute(XML_NAMESPACE_MATH,sXML_stretchy,OUString(
+ RTL_CONSTASCII_USTRINGPARAM(sXML_false)));
+ }
+ ExportMath(pNode,nLevel);
+ }
+ break;
+ case NBINHOR:
+ ExportBinaryHorizontal(pNode,nLevel);
+ break;
+ case NUNHOR:
+ ExportUnaryHorizontal(pNode,nLevel);
+ break;
+ case NBRACE:
+ ExportBrace(pNode,nLevel);
+ break;
+ case NBINVER:
+ ExportBinaryVertical(pNode,nLevel);
+ break;
+ case NSUBSUP:
+ ExportSubSupScript(pNode,nLevel);
+ break;
+ case NROOT:
+ ExportRoot(pNode,nLevel);
+ break;
+ case NOPER:
+ ExportOperator(pNode,nLevel);
+ break;
+ case NATTRIBUT:
+ ExportAttributes(pNode,nLevel);
+ break;
+ case NFONT:
+ ExportFont(pNode,nLevel);
+ break;
+ case NVERTICAL_BRACE:
+ ExportVerticalBrace(pNode,nLevel);
+ break;
+ case NMATRIX:
+ ExportMatrix(pNode,nLevel);
+ break;
+#if 0
+ default:
+ {
+ ULONG nSize = pNode->GetNumSubNodes();
+ for (ULONG i = 0; i < nSize; i++)
+ if (SmNode *pTemp = pNode->GetSubNode(i))
+ ExportNodes(pTemp,nLevel+1);
+ }
+ break;
+#endif
+ }
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_node.cxx b/binfilter/bf_starmath/source/starmath_node.cxx
new file mode 100644
index 000000000000..fcd29193b9f9
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_node.cxx
@@ -0,0 +1,2468 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#define APPEND(str,ascii) str.AppendAscii(RTL_CONSTASCII_STRINGPARAM(ascii))
+
+#include <vcl/lineinfo.hxx>
+
+
+#include "symbol.hxx"
+#include <document.hxx>
+#include "mathtype.hxx"
+
+#include <math.h>
+#include <float.h>
+namespace binfilter {
+
+// define this to draw rectangles for debugging
+//#define SM_RECT_DEBUG
+
+////////////////////////////////////////
+// SmTmpDevice
+// Allows for font and color changes. The original settings will be restored
+// in the destructor.
+// It's main purpose is to allow for the "const" in the 'OutputDevice'
+// argument in the 'Arrange' functions and restore changes made in the 'Draw'
+// functions.
+// Usually a MapMode of 1/100th mm will be used.
+//
+
+/*N*/ class SmTmpDevice
+/*N*/ {
+/*N*/ OutputDevice &rOutDev;
+/*N*/
+/*N*/ // disallow use of copy-constructor and assignment-operator
+/*N*/ SmTmpDevice(const SmTmpDevice &rTmpDev);
+/*N*/ SmTmpDevice & operator = (const SmTmpDevice &rTmpDev);
+/*N*/
+/*N*/ Color Impl_GetColor( const Color& rColor );
+/*N*/
+/*N*/ public:
+/*N*/ SmTmpDevice(OutputDevice &rTheDev, BOOL bUseMap100th_mm);
+/*N*/ ~SmTmpDevice() { rOutDev.Pop(); }
+/*N*/
+/*N*/ void SetFont(const Font &rNewFont);
+/*N*/
+/*N*/ void SetLineColor( const Color& rColor ) { rOutDev.SetLineColor( Impl_GetColor(rColor) ); }
+/*N*/ void SetFillColor( const Color& rColor ) { rOutDev.SetFillColor( Impl_GetColor(rColor) ); }
+/*N*/ void SetTextColor( const Color& rColor ) { rOutDev.SetTextColor( Impl_GetColor(rColor) ); }
+/*N*/
+/*N*/ operator OutputDevice & () { return rOutDev; }
+/*N*/ };
+
+
+/*N*/ SmTmpDevice::SmTmpDevice(OutputDevice &rTheDev, BOOL bUseMap100th_mm) :
+/*N*/ rOutDev(rTheDev)
+/*N*/ {
+/*N*/ rOutDev.Push( PUSH_FONT | PUSH_MAPMODE |
+/*N*/ PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_TEXTCOLOR );
+/*N*/ if (bUseMap100th_mm && MAP_100TH_MM != rOutDev.GetMapMode().GetMapUnit())
+/*N*/ {
+/*?*/ DBG_ERROR( "incorrect MapMode?" );
+/*?*/ rOutDev.SetMapMode( MAP_100TH_MM ); //Immer fuer 100% fomatieren
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ Color SmTmpDevice::Impl_GetColor( const Color& rColor )
+/*N*/ {
+/*N*/ ColorData nNewCol = rColor.GetColor();
+/*N*/ if (COL_AUTO == nNewCol)
+/*N*/ {
+/*N*/ if (OUTDEV_PRINTER == rOutDev.GetOutDevType())
+/*N*/ nNewCol = COL_BLACK;
+/*N*/ else
+/*N*/ {
+/*N*/ Color aBgCol( rOutDev.GetBackground().GetColor() );
+/*N*/ if (OUTDEV_WINDOW == rOutDev.GetOutDevType())
+/*N*/ aBgCol = ((Window &) rOutDev).GetDisplayBackground().GetColor();
+/*N*/
+/*N*/ nNewCol = SM_MOD1()->GetColorConfig().GetColorValue(FONTCOLOR).nColor;
+/*N*/
+/*N*/ Color aTmpColor( nNewCol );
+/*N*/ if (aBgCol.IsDark() && aTmpColor.IsDark())
+/*N*/ nNewCol = COL_WHITE;
+/*N*/ else if (aBgCol.IsBright() && aTmpColor.IsBright())
+/*N*/ nNewCol = COL_BLACK;
+/*N*/ }
+/*N*/ }
+/*N*/ return Color( nNewCol );
+/*N*/ }
+
+
+/*N*/ void SmTmpDevice::SetFont(const Font &rNewFont)
+/*N*/ {
+/*N*/ rOutDev.SetFont( rNewFont );
+/*N*/ rOutDev.SetTextColor( Impl_GetColor( rNewFont.GetColor() ) );
+/*N*/ }
+
+
+///////////////////////////////////////////////////////////////////////////
+
+
+/*N*/ SmNode::SmNode(SmNodeType eNodeType, const SmToken &rNodeToken)
+/*N*/ {
+/*N*/ eType = eNodeType;
+/*N*/ eScaleMode = SCALE_NONE;
+/*N*/ aNodeToken = rNodeToken;
+/*N*/ nAccIndex = -1;
+/*N*/ }
+
+
+/*N*/ SmNode::~SmNode()
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ BOOL SmNode::IsVisible() const
+/*N*/ {
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ USHORT SmNode::GetNumSubNodes() const
+/*N*/ {
+/*N*/ return 0;
+/*N*/ }
+
+
+/*N*/ SmNode * SmNode::GetSubNode(USHORT nIndex)
+/*N*/ {
+/*N*/ return NULL;
+/*N*/ }
+
+
+/*N*/ SmNode * SmNode::GetLeftMost()
+/*N*/ // returns leftmost node of current subtree.
+/*N*/ //! (this assumes the one with index 0 is always the leftmost subnode
+/*N*/ //! for the current node).
+/*N*/ {
+/*N*/ SmNode *pNode = GetNumSubNodes() > 0 ?
+/*N*/ GetSubNode(0) : NULL;
+/*N*/
+/*N*/ return pNode ? pNode->GetLeftMost() : this;
+/*N*/ }
+
+
+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);
+}
+
+
+/*N*/ void SmNode::SetAttribut(USHORT nAttrib)
+/*N*/ {
+/*N*/ if ( nAttrib == ATTR_BOLD && !(Flags() & FLG_BOLD)
+/*N*/ || nAttrib == ATTR_ITALIC && !(Flags() & FLG_ITALIC))
+/*N*/ nAttributes |= nAttrib;
+/*N*/
+/*N*/ SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/ for (USHORT i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ pNode->SetAttribut(nAttrib);
+/*N*/ }
+
+
+/*N*/ void SmNode::ClearAttribut(USHORT nAttrib)
+/*N*/ {
+/*N*/ if ( nAttrib == ATTR_BOLD && !(Flags() & FLG_BOLD)
+/*N*/ || nAttrib == ATTR_ITALIC && !(Flags() & FLG_ITALIC))
+/*N*/ nAttributes &= ~nAttrib;
+/*N*/
+/*N*/ SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/ for (USHORT i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ pNode->ClearAttribut(nAttrib);
+/*N*/ }
+
+
+/*N*/ void SmNode::SetFont(const SmFace &rFace)
+/*N*/ {
+/*N*/ if (!(Flags() & FLG_FONT))
+/*N*/ GetFont() = rFace;
+/*N*/
+/*N*/ SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/ for (USHORT i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ pNode->SetFont(rFace);
+/*N*/ }
+
+
+/*N*/ void SmNode::SetFontSize(const Fraction &rSize, USHORT nType)
+/*N*/ //! 'rSize' is in units of pts
+/*N*/ {
+/*N*/ Size aSize;
+/*N*/
+/*N*/ if (!(Flags() & FLG_SIZE))
+/*N*/ {
+/*N*/ Fraction aVal (SmPtsTo100th_mm(rSize.GetNumerator()),
+/*N*/ rSize.GetDenominator());
+/*N*/ //long nHeight = ::rtl::math::round(aVal);
+/*N*/ long nHeight = (long)aVal;
+/*N*/
+/*N*/ aSize = GetFont().GetSize();
+/*N*/ aSize.Width() = 0;
+/*N*/ switch(nType)
+/*N*/ {
+/*N*/ case FNTSIZ_ABSOLUT:
+/*N*/ aSize.Height() = nHeight;
+/*N*/ break;
+/*N*/
+/*N*/ case FNTSIZ_PLUS:
+/*?*/ aSize.Height() += nHeight;
+/*?*/ break;
+/*N*/
+/*N*/ case FNTSIZ_MINUS:
+/*?*/ aSize.Height() -= nHeight;
+/*?*/ break;
+/*N*/
+/*N*/ case FNTSIZ_MULTIPLY:
+/*N*/ aSize.Height() = (long) (Fraction(aSize.Height()) * rSize);
+/*N*/ break;
+/*N*/
+/*N*/ case FNTSIZ_DIVIDE:
+/*?*/ if (rSize != Fraction(0L))
+/*?*/ aSize.Height() = (long) (Fraction(aSize.Height()) / rSize);
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ // check the requested size against maximum value
+/*N*/ static int __READONLY_DATA nMaxVal = SmPtsTo100th_mm(128);
+/*N*/ if (aSize.Height() > nMaxVal)
+/*?*/ aSize.Height() = nMaxVal;
+/*N*/
+/*N*/ GetFont().SetSize(aSize);
+/*N*/ }
+/*N*/
+/*N*/ SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/ for (USHORT i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ pNode->SetFontSize(rSize, nType);
+/*N*/ }
+
+
+/*N*/ void SmNode::SetSize(const Fraction &rSize)
+/*N*/ {
+/*N*/ GetFont() *= rSize;
+/*N*/
+/*N*/ SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/ for (USHORT i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ pNode->SetSize(rSize);
+/*N*/ }
+
+
+/*N*/ void SmNode::SetRectHorAlign(RectHorAlign eHorAlign, BOOL bApplyToSubTree )
+/*N*/ {
+/*N*/ if (!(Flags() & FLG_HORALIGN))
+/*N*/ eRectHorAlign = eHorAlign;
+/*N*/
+/*N*/ if (bApplyToSubTree)
+/*N*/ {
+/*N*/ SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/ for (USHORT i = 0; i < nSize; i++)
+/*?*/ if (pNode = GetSubNode(i))
+/*?*/ pNode->SetRectHorAlign(eHorAlign);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmNode::PrepareAttributes()
+/*N*/ {
+/*N*/ GetFont().SetWeight((Attributes() & ATTR_BOLD) ? WEIGHT_BOLD : WEIGHT_NORMAL);
+/*N*/ GetFont().SetItalic((Attributes() & ATTR_ITALIC) ? ITALIC_NORMAL : ITALIC_NONE);
+/*N*/ }
+
+
+/*N*/ void SmNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ bIsDebug = TRUE;
+/*N*/ #else
+/*N*/ bIsDebug = FALSE;
+/*N*/ #endif
+/*N*/ bIsPhantom = FALSE;
+/*N*/ nFlags = 0;
+/*N*/ nAttributes = 0;
+/*N*/
+/*N*/ switch (rFormat.GetHorAlign())
+/*N*/ { case AlignLeft: eRectHorAlign = RHA_LEFT; break;
+/*N*/ case AlignCenter: eRectHorAlign = RHA_CENTER; break;
+/*?*/ case AlignRight: eRectHorAlign = RHA_RIGHT; break;
+/*N*/ }
+/*N*/
+/*N*/ GetFont() = rFormat.GetFont(FNT_MATH);
+/*N*/ //GetFont().SetCharSet(RTL_TEXTENCODING_SYMBOL);
+/*N*/ DBG_ASSERT( GetFont().GetCharSet() == RTL_TEXTENCODING_UNICODE,
+/*N*/ "unexpected CharSet" );
+/*N*/ GetFont().SetWeight(WEIGHT_NORMAL);
+/*N*/ GetFont().SetItalic(ITALIC_NONE);
+/*N*/
+/*N*/ SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/ for (USHORT i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ pNode->Prepare(rFormat, rDocShell);
+/*N*/ }
+
+
+
+
+#ifdef MAC
+#pragma segment FrmNode_02
+
+#else
+
+#endif
+
+
+/*N*/ void SmNode::Move(const Point& rPosition)
+/*N*/ {
+/*N*/ if (rPosition.X() == 0 && rPosition.Y() == 0)
+/*N*/ return;
+/*N*/
+/*N*/ SmRect::Move(rPosition);
+/*N*/
+/*N*/ SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/ for (USHORT i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ pNode->Move(rPosition);
+/*N*/ }
+
+
+/*N*/ void SmNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/ for (USHORT i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ pNode->Arrange(rDev, rFormat);
+/*N*/ }
+
+/*N*/ void SmNode::CreateTextFromNode(String &rText)
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+
+/*N*/ void SmNode::AdaptToX(const OutputDevice &rDev, ULONG nWidth)
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ void SmNode::AdaptToY(const OutputDevice &rDev, ULONG nHeight)
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ void SmNode::Draw(OutputDevice &rDev, const Point &rPosition) const
+/*N*/ {
+/*N*/ if (IsPhantom())
+/*N*/ return;
+/*N*/
+/*N*/ const SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/ for (USHORT i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ { Point aOffset (pNode->GetTopLeft() - GetTopLeft());
+/*N*/ pNode->Draw(rDev, rPosition + aOffset);
+/*N*/ }
+/*N*/
+/*N*/ #ifdef SM_RECT_DEBUG
+/*N*/ if (!IsDebug())
+/*N*/ return;
+/*N*/
+/*N*/ int nRFlags = SM_RECT_CORE | SM_RECT_ITALIC | SM_RECT_LINES | SM_RECT_MID;
+/*N*/ SmRect::Draw(rDev, rPosition, nRFlags);
+/*N*/ #endif
+/*N*/ }
+
+/*N*/ const SmNode * SmNode::FindTokenAt(USHORT nRow, USHORT nCol) const
+/*N*/ // returns (first) ** visible ** (sub)node with the tokens text at
+/*N*/ // position 'nRow', 'nCol'.
+/*N*/ //! (there should be exactly one such node if any)
+/*N*/ {
+/*N*/ if ( IsVisible()
+/*N*/ && nRow == GetToken().nRow
+/*N*/ && nCol >= GetToken().nCol && nCol < GetToken().nCol + GetToken().aText.Len())
+/*N*/ return this;
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nNumSubNodes = GetNumSubNodes();
+/*N*/ for (USHORT i = 0; i < nNumSubNodes; i++)
+/*N*/ { const SmNode *pNode = GetSubNode(i);
+/*N*/
+/*N*/ if (!pNode)
+/*N*/ continue;
+/*N*/
+/*N*/ const SmNode *pResult = pNode->FindTokenAt(nRow, nCol);
+/*N*/ if (pResult)
+/*N*/ return pResult;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return 0;
+/*N*/ }
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////
+
+SmStructureNode::SmStructureNode( const SmStructureNode &rNode ) :
+ SmNode( rNode.GetType(), rNode.GetToken() )
+{
+ ULONG i;
+ for (i = 0; i < aSubNodes.GetSize(); i++)
+ delete aSubNodes.Get(i);
+ aSubNodes.Clear();
+
+ ULONG nSize = rNode.aSubNodes.GetSize();
+ aSubNodes.SetSize( nSize );
+ for (i = 0; i < nSize; ++i)
+ {
+ SmNode *pNode = rNode.aSubNodes.Get(i);
+ aSubNodes.Put( i, pNode ? new SmNode( *pNode ) : 0 );
+ }
+}
+
+
+/*N*/ SmStructureNode::~SmStructureNode()
+/*N*/ {
+/*N*/ SmNode *pNode;
+/*N*/
+/*N*/ for (USHORT i = 0; i < GetNumSubNodes(); i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ delete pNode;
+/*N*/ }
+
+
+SmStructureNode & SmStructureNode::operator = ( const SmStructureNode &rNode )
+{
+ SmNode::operator = ( rNode );
+
+ ULONG i;
+ for (i = 0; i < aSubNodes.GetSize(); i++)
+ delete aSubNodes.Get(i);
+ aSubNodes.Clear();
+
+ ULONG nSize = rNode.aSubNodes.GetSize();
+ aSubNodes.SetSize( nSize );
+ for (i = 0; i < nSize; ++i)
+ {
+ SmNode *pNode = rNode.aSubNodes.Get(i);
+ aSubNodes.Put( i, pNode ? new SmNode( *pNode ) : 0 );
+ }
+
+ return *this;
+}
+
+
+/*N*/ void SmStructureNode::SetSubNodes(SmNode *pFirst, SmNode *pSecond, SmNode *pThird)
+/*N*/ {
+/*N*/ if (pFirst)
+/*N*/ aSubNodes.Put(0, pFirst);
+/*N*/ if (pSecond)
+/*N*/ aSubNodes.Put(1, pSecond);
+/*N*/ if (pThird)
+/*N*/ aSubNodes.Put(2, pThird);
+/*N*/ }
+
+
+/*N*/ void SmStructureNode::SetSubNodes(const SmNodeArray &rNodeArray)
+/*N*/ {
+/*N*/ aSubNodes = rNodeArray;
+/*N*/ }
+
+
+/*N*/ BOOL SmStructureNode::IsVisible() const
+/*N*/ {
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ USHORT SmStructureNode::GetNumSubNodes() const
+/*N*/ {
+/*N*/ return (USHORT) aSubNodes.GetSize();
+/*N*/ }
+
+
+/*N*/ SmNode * SmStructureNode::GetSubNode(USHORT nIndex)
+/*N*/ {
+/*N*/ return aSubNodes.Get(nIndex);
+/*N*/ }
+
+
+
+///////////////////////////////////////////////////////////////////////////
+
+
+/*N*/ BOOL SmVisibleNode::IsVisible() const
+/*N*/ {
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/*N*/ USHORT SmVisibleNode::GetNumSubNodes() const
+/*N*/ {
+/*N*/ return 0;
+/*N*/ }
+
+
+SmNode * SmVisibleNode::GetSubNode(USHORT nIndex)
+{
+ return NULL;
+}
+
+
+///////////////////////////////////////////////////////////////////////////
+
+
+///////////////////////////////////////////////////////////////////////////
+
+
+
+
+///////////////////////////////////////////////////////////////////////////
+
+/*N*/ void SmTableNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ // arranges all subnodes in one column
+/*N*/ {
+/*N*/ Point rPosition;
+/*N*/
+/*N*/ USHORT nWidth = 0;
+/*N*/ USHORT nHeight = 0;
+/*N*/ SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/
+/*N*/ // make distance depend on font size
+/*N*/ long nDist = +(rFormat.GetDistance(DIS_VERTICAL)
+/*N*/ * GetFont().GetSize().Height()) / 100L;
+/*N*/
+/*N*/ if (nSize < 1)
+/*N*/ return;
+/*N*/
+/*N*/ // arrange subnodes and get maximum width of them
+/*N*/ long nMaxWidth = 0,
+/*N*/ nTmp;
+/*N*/ USHORT i;
+/*N*/ for (i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ { pNode->Arrange(rDev, rFormat);
+/*N*/ if ((nTmp = pNode->GetItalicWidth()) > nMaxWidth)
+/*N*/ nMaxWidth = nTmp;
+/*N*/ }
+/*N*/
+/*N*/ Point aPos;
+/*N*/ SmRect::operator = (SmRect(nMaxWidth, 0));
+/*N*/ for (i = 0; i < nSize; i++)
+/*N*/ { if (pNode = GetSubNode(i))
+/*N*/ { const SmRect &rNodeRect = pNode->GetRect();
+/*N*/ const SmNode *pCoNode = pNode->GetLeftMost();
+/*N*/ SmTokenType eType = pCoNode->GetToken().eType;
+/*N*/ RectHorAlign eHorAlign = pCoNode->GetRectHorAlign();
+/*N*/
+/*N*/ aPos = rNodeRect.AlignTo(*this, RP_BOTTOM,
+/*N*/ eHorAlign, RVA_BASELINE);
+/*N*/ if (i)
+/*N*/ aPos.Y() += nDist;
+/*N*/ pNode->MoveTo(aPos);
+/*N*/ ExtendBy(rNodeRect, nSize > 1 ? RCP_NONE : RCP_ARG);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+SmNode * SmTableNode::GetLeftMost()
+{
+ return this;
+}
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmLineNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
+/*N*/ {
+/*N*/ SmNode::Prepare(rFormat, rDocShell);
+/*N*/
+/*N*/ //! wir verwenden hier den 'FNT_VARIABLE' Font, da er vom Ascent und Descent
+/*N*/ //! ia besser zum Rest der Formel passt als der 'FNT_MATH' Font.
+/*N*/ GetFont() = rFormat.GetFont(FNT_VARIABLE);
+/*N*/ Flags() |= FLG_FONT;
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ // arranges all subnodes in one row with some extra space between
+/*N*/ {
+/*N*/ SmNode *pNode;
+/*N*/ USHORT nSize = GetNumSubNodes();
+/*N*/ USHORT i;
+/*N*/ for (i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ pNode->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+/*N*/ aTmpDev.SetFont(GetFont());
+/*N*/
+/*N*/ // provide an empty rectangle with alignment parameters for the "current"
+/*N*/ // font (in order to make "a^1 {}_2^3 a_4" work correct, that is, have the
+/*N*/ // same sub-/supscript positions.)
+/*N*/ //! be sure to use a character that has explicitly defined HiAttribut
+/*N*/ //! line in rect.cxx such as 'a' in order to make 'vec a' look same to
+/*N*/ //! 'vec {a}'.
+/*N*/ SmRect::operator = (SmRect(aTmpDev, &rFormat, C2S("a"),
+/*N*/ GetFont().GetBorderWidth()));
+/*N*/ // make sure that the rectangle occupies (almost) no space
+/*N*/ SetWidth(1);
+/*N*/ SetItalicSpaces(0, 0);
+/*N*/
+/*N*/ if (nSize < 1)
+/*N*/ return;
+/*N*/
+/*N*/ // make distance depend on font size
+/*N*/ long nDist = +(rFormat.GetDistance(DIS_HORIZONTAL)
+/*N*/ * GetFont().GetSize().Height()) / 100L;
+/*N*/
+/*N*/ Point aPos;
+/*N*/ for (i = 0; i < nSize; i++)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ {
+/*N*/ aPos = pNode->AlignTo(*this, RP_RIGHT, RHA_CENTER, RVA_BASELINE);
+/*N*/
+/*N*/ // no horizontal space before first node
+/*N*/ if (i)
+/*N*/ aPos.X() += nDist;
+/*N*/
+/*N*/ pNode->MoveTo(aPos);
+/*N*/ ExtendBy( *pNode, RCP_XOR );
+/*N*/ }
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmExpressionNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ // as 'SmLineNode::Arrange' but keeps alignment of leftmost subnode
+/*N*/ {
+/*N*/ DBG_ASSERT(GetNumSubNodes() > 0, "Sm: keine subnodes");
+/*N*/
+/*N*/ SmLineNode::Arrange(rDev, rFormat);
+/*N*/
+/*N*/ // copy alignment of leftmost subnode if any
+/*N*/ SmNode *pNode = GetLeftMost();
+/*N*/ if (pNode)
+/*N*/ SetRectHorAlign(pNode->GetRectHorAlign(), FALSE);
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmUnHorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ BOOL bIsPostfix = GetToken().eType == TFACT;
+/*N*/
+/*N*/ SmNode *pOper = GetSubNode(bIsPostfix ? 1 : 0),
+/*N*/ *pBody = GetSubNode(bIsPostfix ? 0 : 1);
+/*N*/ DBG_ASSERT(pOper, "Sm: NULL pointer");
+/*N*/ DBG_ASSERT(pBody, "Sm: NULL pointer");
+/*N*/
+/*N*/ pOper->SetSize(Fraction (rFormat.GetRelSize(SIZ_OPERATOR), 100));
+/*N*/ pOper->Arrange(rDev, rFormat);
+/*N*/ pBody->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ Point aPos = pOper->AlignTo(*pBody, bIsPostfix ? RP_RIGHT : RP_LEFT,
+/*N*/ RHA_CENTER, RVA_BASELINE);
+/*N*/ // add a bit space between operator and argument
+/*N*/ // (worst case -{1 over 2} where - and over have almost no space inbetween)
+/*N*/ long nDelta = pOper->GetFont().GetSize().Height() / 20;
+/*N*/ if (bIsPostfix)
+/*N*/ aPos.X() += nDelta;
+/*N*/ else
+/*N*/ aPos.X() -= nDelta;
+/*N*/ pOper->MoveTo(aPos);
+/*N*/
+/*N*/ SmRect::operator = (*pBody);
+/*N*/ long nOldBot = GetBottom();
+/*N*/
+/*N*/ ExtendBy(*pOper, RCP_XOR);
+/*N*/
+/*N*/ // workaround for Bug 50865: "a^2 a^+2" have different baselines
+/*N*/ // for exponents (if size of exponent is large enough)
+/*N*/ SetBottom(nOldBot);
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmRootNode::GetHeightVerOffset(const SmRect &rRect,
+/*N*/ long &rHeight, long &rVerOffset) const
+/*N*/ // calculate height and vertical offset of root sign suitable for 'rRect'
+/*N*/ {
+/*N*/ rVerOffset = (rRect.GetBottom() - rRect.GetAlignB()) / 2;
+/*N*/ rHeight = rRect.GetHeight() - rVerOffset;
+/*N*/
+/*N*/ DBG_ASSERT(rHeight >= 0, "Sm : Ooops...");
+/*N*/ DBG_ASSERT(rVerOffset >= 0, "Sm : Ooops...");
+/*N*/ }
+
+
+/*N*/ Point SmRootNode::GetExtraPos(const SmRect &rRootSymbol,
+/*N*/ const SmRect &rExtra) const
+/*N*/ {
+/*N*/ const Size &rSymSize = rRootSymbol.GetSize();
+/*N*/
+/*N*/ Point aPos = rRootSymbol.GetTopLeft()
+/*N*/ + Point((rSymSize.Width() * 70) / 100,
+/*N*/ (rSymSize.Height() * 52) / 100);
+/*N*/
+/*N*/ // from this calculate topleft edge of 'rExtra'
+/*N*/ aPos.X() -= rExtra.GetWidth() + rExtra.GetItalicRightSpace();
+/*N*/ aPos.Y() -= rExtra.GetHeight();
+/*N*/ // if there's enough space move a bit less to the right
+/*N*/ // examples: "nroot i a", "nroot j a"
+/*N*/ // (it looks better if we don't use italic-spaces here)
+/*N*/ long nX = rRootSymbol.GetLeft() + (rSymSize.Width() * 30) / 100;
+/*N*/ if (aPos.X() > nX)
+/*?*/ aPos.X() = nX;
+/*N*/
+/*N*/ return aPos;
+/*N*/ }
+
+
+/*N*/ void SmRootNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ //! pExtra needs to have the smaller index than pRootSym in order to
+/*N*/ //! not to get the root symbol but the pExtra when clicking on it in the
+/*N*/ //! GraphicWindow. (That is because of the simplicity of the algorithm
+/*N*/ //! that finds the node corresponding to a mouseclick in the window.)
+/*N*/ SmNode *pExtra = GetSubNode(0),
+/*N*/ *pRootSym = GetSubNode(1),
+/*N*/ *pBody = GetSubNode(2);
+/*N*/ DBG_ASSERT(pRootSym, "Sm: NULL pointer");
+/*N*/ DBG_ASSERT(pBody, "Sm: NULL pointer");
+/*N*/
+/*N*/ pBody->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ long nHeight,
+/*N*/ nVerOffset;
+/*N*/ GetHeightVerOffset(*pBody, nHeight, nVerOffset);
+/*N*/ nHeight += rFormat.GetDistance(DIS_ROOT)
+/*N*/ * GetFont().GetSize().Height() / 100L;
+/*N*/
+/*N*/ // font specialist advised to change the width first
+/*N*/ pRootSym->AdaptToY(rDev, nHeight);
+/*N*/ pRootSym->AdaptToX(rDev, pBody->GetItalicWidth());
+/*N*/
+/*N*/ pRootSym->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ Point aPos = pRootSym->AlignTo(*pBody, RP_LEFT, RHA_CENTER, RVA_BASELINE);
+/*N*/ //! overrride calulated vertical position
+/*N*/ aPos.Y() = pRootSym->GetTop() + pBody->GetBottom() - pRootSym->GetBottom();
+/*N*/ aPos.Y() -= nVerOffset;
+/*N*/ pRootSym->MoveTo(aPos);
+/*N*/
+/*N*/ if (pExtra)
+/*N*/ { pExtra->SetSize(Fraction(rFormat.GetRelSize(SIZ_INDEX), 100));
+/*N*/ pExtra->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ aPos = GetExtraPos(*pRootSym, *pExtra);
+/*N*/ pExtra->MoveTo(aPos);
+/*N*/ }
+/*N*/
+/*N*/ SmRect::operator = (*pBody);
+/*N*/ ExtendBy(*pRootSym, RCP_THIS);
+/*N*/ if (pExtra)
+/*N*/ ExtendBy(*pExtra, RCP_THIS, (BOOL) TRUE);
+/*N*/ }
+
+
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmBinHorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ SmNode *pLeft = GetSubNode(0),
+/*N*/ *pOper = GetSubNode(1),
+/*N*/ *pRight = GetSubNode(2);
+/*N*/ DBG_ASSERT(pLeft != NULL, "Sm: NULL pointer");
+/*N*/ DBG_ASSERT(pOper != NULL, "Sm: NULL pointer");
+/*N*/ DBG_ASSERT(pRight != NULL, "Sm: NULL pointer");
+/*N*/
+/*N*/ pOper->SetSize(Fraction (rFormat.GetRelSize(SIZ_OPERATOR), 100));
+/*N*/
+/*N*/ pLeft ->Arrange(rDev, rFormat);
+/*N*/ pOper ->Arrange(rDev, rFormat);
+/*N*/ pRight->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ const SmRect &rOpRect = pOper->GetRect();
+/*N*/
+/*N*/ long nDist = (rOpRect.GetWidth() *
+/*N*/ rFormat.GetDistance(DIS_HORIZONTAL)) / 100L;
+/*N*/
+/*N*/ SmRect::operator = (*pLeft);
+/*N*/
+/*N*/ Point aPos;
+/*N*/ aPos = pOper->AlignTo(*this, RP_RIGHT, RHA_CENTER, RVA_BASELINE);
+/*N*/ aPos.X() += nDist;
+/*N*/ pOper->MoveTo(aPos);
+/*N*/ ExtendBy(*pOper, RCP_XOR);
+/*N*/
+/*N*/ aPos = pRight->AlignTo(*this, RP_RIGHT, RHA_CENTER, RVA_BASELINE);
+/*N*/ aPos.X() += nDist;
+/*N*/
+/*N*/ pRight->MoveTo(aPos);
+/*N*/ ExtendBy(*pRight, RCP_XOR);
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmBinVerNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ SmNode *pNum = GetSubNode(0),
+/*N*/ *pLine = GetSubNode(1),
+/*N*/ *pDenom = GetSubNode(2);
+/*N*/ DBG_ASSERT(pNum, "Sm : NULL pointer");
+/*N*/ DBG_ASSERT(pLine, "Sm : NULL pointer");
+/*N*/ DBG_ASSERT(pDenom, "Sm : NULL pointer");
+/*N*/
+/*N*/ BOOL bIsTextmode = rFormat.IsTextmode();
+/*N*/ if (bIsTextmode)
+/*N*/ {
+/*?*/ Fraction aFraction(rFormat.GetRelSize(SIZ_INDEX), 100);
+/*?*/ pNum ->SetSize(aFraction);
+/*?*/ pLine ->SetSize(aFraction);
+/*?*/ pDenom->SetSize(aFraction);
+/*N*/ }
+/*N*/
+/*N*/ pNum ->Arrange(rDev, rFormat);
+/*N*/ pDenom->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ long nFontHeight = GetFont().GetSize().Height(),
+/*N*/ nExtLen = nFontHeight * rFormat.GetDistance(DIS_FRACTION) / 100L,
+/*N*/ nThick = nFontHeight * rFormat.GetDistance(DIS_STROKEWIDTH) / 100L,
+/*N*/ nWidth = Max(pNum->GetItalicWidth(), pDenom->GetItalicWidth()),
+/*N*/ nNumDist = bIsTextmode ? 0 :
+/*N*/ nFontHeight * rFormat.GetDistance(DIS_NUMERATOR) / 100L,
+/*N*/ nDenomDist = bIsTextmode ? 0 :
+/*N*/ nFontHeight * rFormat.GetDistance(DIS_DENOMINATOR) / 100L;
+/*N*/
+ // font specialist advised to change the width first
+/*N*/ pLine->AdaptToY(rDev, nThick);
+/*N*/ pLine->AdaptToX(rDev, nWidth + 2 * nExtLen);
+/*N*/ pLine->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ // get horizontal alignment for numerator
+/*N*/ const SmNode *pLM = pNum->GetLeftMost();
+/*N*/ RectHorAlign eHorAlign = pLM->GetRectHorAlign();
+/*N*/
+/*N*/ // move numerator to its position
+/*N*/ Point aPos = pNum->AlignTo(*pLine, RP_TOP, eHorAlign, RVA_BASELINE);
+/*N*/ aPos.Y() -= nNumDist;
+/*N*/ pNum->MoveTo(aPos);
+/*N*/
+/*N*/ // get horizontal alignment for denominator
+/*N*/ pLM = pDenom->GetLeftMost();
+/*N*/ eHorAlign = pLM->GetRectHorAlign();
+/*N*/
+/*N*/ // move denominator to its position
+/*N*/ aPos = pDenom->AlignTo(*pLine, RP_BOTTOM, eHorAlign, RVA_BASELINE);
+/*N*/ aPos.Y() += nDenomDist;
+/*N*/ pDenom->MoveTo(aPos);
+/*N*/
+/*N*/ SmRect::operator = (*pNum);
+/*N*/ ExtendBy(*pDenom, RCP_NONE).ExtendBy(*pLine, RCP_NONE, pLine->GetCenterY());
+/*N*/ }
+
+
+
+/*N*/ SmNode * SmBinVerNode::GetLeftMost()
+/*N*/ {
+/*N*/ return this;
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+double Det(const Point &rHeading1, const Point &rHeading2)
+ // gibt den Wert der durch die beiden Punkte gebildeten Determinante
+ // zurueck
+{
+ 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 gehoert 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 abhaengig ?
+ 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 wuerde 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() + (long) (fLambda * rHeading1.X()),
+ rPoint1.Y() + (long) (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 Groesse fuer den Diagonalstrich zurueck.
+ // Vor.: das SmRect des Nodes gibt die Begrenzung vor(!), muss 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 ( (long)(100.0 * cos(fAngleRad)),
+ (long)(-100.0 * sin(fAngleRad)) );
+
+ long nLeft, nRight, nTop, nBottom; // Raender des Rechtecks fuer 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 muessen 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, TRUE);
+ 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 Groesse des Diagonalstrich ermitteln
+ Size aSize;
+ GetOperPosSize(aPos, aSize, aLogCenter, IsAscending() ? 60.0 : -60.0);
+
+ // font specialist advised to change the width first
+ pOper->AdaptToY(aTmpDev, aSize.Height());
+ pOper->AdaptToX(aTmpDev, aSize.Width());
+ // und diese wirksam machen
+ pOper->Arrange(aTmpDev, rFormat);
+
+ pOper->MoveTo(aPos);
+
+ ExtendBy(*pOper, RCP_NONE, nBaseline);
+}
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmSubSupNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ DBG_ASSERT(GetNumSubNodes() == 1 + SUBSUP_NUM_ENTRIES,
+/*N*/ "Sm: falsche Anzahl von subnodes");
+/*N*/
+/*N*/ SmNode *pBody = GetBody();
+/*N*/ DBG_ASSERT(pBody, "Sm: NULL pointer");
+/*N*/
+/*N*/ long nOrigHeight = pBody->GetFont().GetSize().Height();
+/*N*/
+/*N*/ pBody->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ const SmRect &rBodyRect = pBody->GetRect();
+/*N*/ SmRect::operator = (rBodyRect);
+/*N*/
+/*N*/ // line that separates sub- and supscript rectangles
+/*N*/ long nDelimLine = SmFromTo(GetAlignB(), GetAlignT(), 0.4);
+/*N*/
+/*N*/ Point aPos;
+/*N*/ long nDelta, nDist;
+/*N*/
+/*N*/ // iterate over all possible sub-/supscripts
+/*N*/ SmRect aTmpRect (rBodyRect);
+/*N*/ for (int i = 0; i < SUBSUP_NUM_ENTRIES; i++)
+/*N*/ { SmSubSup eSubSup = (SmSubSup) i; // cast
+/*N*/ SmNode *pSubSup = GetSubSup(eSubSup);
+/*N*/
+/*N*/ if (!pSubSup)
+/*N*/ continue;
+/*N*/
+/*N*/ // switch position of limits if we are in textmode
+/*N*/ if (rFormat.IsTextmode() && (GetToken().nGroup & TGLIMIT))
+/*N*/ switch (eSubSup)
+/*?*/ { case CSUB: eSubSup = RSUB; break;
+/*?*/ case CSUP: eSubSup = RSUP; break;
+/*N*/ }
+/*N*/
+/*N*/ // prevent sub-/supscripts from diminishing in size
+/*N*/ // (as would be in "a_{1_{2_{3_4}}}")
+/*N*/ if (GetFont().GetSize().Height() > rFormat.GetBaseSize().Height() / 3)
+/*N*/ {
+/*N*/ USHORT nIndex = (eSubSup == CSUB || eSubSup == CSUP) ?
+/*N*/ SIZ_LIMITS : SIZ_INDEX;
+/*N*/ Fraction aFraction ( rFormat.GetRelSize(nIndex), 100 );
+/*N*/ pSubSup->SetSize(aFraction);
+/*N*/ }
+/*N*/
+/*N*/ pSubSup->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ BOOL bIsTextmode = rFormat.IsTextmode();
+/*N*/ nDist = 0;
+/*N*/
+/*N*/ //! be sure that CSUB, CSUP are handled before the other cases!
+/*N*/ switch (eSubSup)
+/*N*/ { case RSUB :
+/*N*/ case LSUB :
+/*N*/ if (!bIsTextmode)
+/*N*/ nDist = nOrigHeight
+/*N*/ * rFormat.GetDistance(DIS_SUBSCRIPT) / 100L;
+/*N*/ aPos = pSubSup->GetRect().AlignTo(aTmpRect,
+/*N*/ eSubSup == LSUB ? RP_LEFT : RP_RIGHT,
+/*N*/ RHA_CENTER, RVA_BOTTOM);
+/*N*/ aPos.Y() += nDist;
+/*N*/ nDelta = nDelimLine - aPos.Y();
+/*N*/ if (nDelta > 0)
+/*N*/ aPos.Y() += nDelta;
+/*N*/ break;
+/*N*/ case RSUP :
+/*N*/ case LSUP :
+/*N*/ if (!bIsTextmode)
+/*N*/ nDist = nOrigHeight
+/*N*/ * rFormat.GetDistance(DIS_SUPERSCRIPT) / 100L;
+/*N*/ aPos = pSubSup->GetRect().AlignTo(aTmpRect,
+/*N*/ eSubSup == LSUP ? RP_LEFT : RP_RIGHT,
+/*N*/ RHA_CENTER, RVA_TOP);
+/*N*/ aPos.Y() -= nDist;
+/*N*/ nDelta = aPos.Y() + pSubSup->GetHeight() - nDelimLine;
+/*N*/ if (nDelta > 0)
+/*?*/ aPos.Y() -= nDelta;
+/*N*/ break;
+/*N*/ case CSUB :
+/*N*/ if (!bIsTextmode)
+/*N*/ nDist = nOrigHeight
+/*N*/ * rFormat.GetDistance(DIS_LOWERLIMIT) / 100L;
+/*N*/ aPos = pSubSup->GetRect().AlignTo(rBodyRect, RP_BOTTOM,
+/*N*/ RHA_CENTER, RVA_BASELINE);
+/*N*/ aPos.Y() += nDist;
+/*N*/ break;
+/*N*/ case CSUP :
+/*N*/ if (!bIsTextmode)
+/*N*/ nDist = nOrigHeight
+/*N*/ * rFormat.GetDistance(DIS_UPPERLIMIT) / 100L;
+/*N*/ aPos = pSubSup->GetRect().AlignTo(rBodyRect, RP_TOP,
+/*N*/ RHA_CENTER, RVA_BASELINE);
+/*N*/ aPos.Y() -= nDist;
+/*N*/ break;
+/*N*/ default :
+/*N*/ DBG_ASSERT(FALSE, "Sm: unbekannter Fall");
+/*N*/ }
+/*N*/
+/*N*/ pSubSup->MoveTo(aPos);
+/*N*/ ExtendBy(*pSubSup, RCP_THIS, (BOOL) TRUE);
+/*N*/
+/*N*/ // update rectangle to which RSUB, RSUP, LSUB, LSUP
+/*N*/ // will be aligned to
+/*N*/ if (eSubSup == CSUB || eSubSup == CSUP)
+/*N*/ aTmpRect = *this;
+/*N*/ }
+/*N*/ }
+
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmBraceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ SmNode *pLeft = GetSubNode(0),
+/*N*/ *pBody = GetSubNode(1),
+/*N*/ *pRight = GetSubNode(2);
+/*N*/ DBG_ASSERT(pLeft, "Sm: NULL pointer");
+/*N*/ DBG_ASSERT(pBody, "Sm: NULL pointer");
+/*N*/ DBG_ASSERT(pRight, "Sm: NULL pointer");
+/*N*/
+/*N*/ pBody->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ BOOL bIsScaleNormal = rFormat.IsScaleNormalBrackets(),
+/*N*/ bScale = pBody->GetHeight() > 0 &&
+/*N*/ (GetScaleMode() == SCALE_HEIGHT || bIsScaleNormal),
+/*N*/ bIsABS = GetToken().eType == TABS;
+/*N*/
+/*N*/ long nFaceHeight = GetFont().GetSize().Height();
+/*N*/
+/*N*/ // Uebergroesse in % ermitteln
+/*N*/ USHORT nPerc = 0;
+/*N*/ if (!bIsABS && bScale)
+/*N*/ { // im Fall von Klammern mit Uebergroesse...
+/*N*/ int nIndex = GetScaleMode() == SCALE_HEIGHT ?
+/*N*/ DIS_BRACKETSIZE : DIS_NORMALBRACKETSIZE;
+/*N*/ nPerc = rFormat.GetDistance(nIndex);
+/*N*/ }
+/*N*/
+/*N*/ // ermitteln der Hoehe fuer die Klammern
+/*N*/ long nBraceHeight;
+/*N*/ if (bScale)
+/*N*/ {
+/*N*/ nBraceHeight = pBody->GetType() == NBRACEBODY ?
+/*N*/ ((SmBracebodyNode *) pBody)->GetBodyHeight()
+/*N*/ : pBody->GetHeight();
+/*N*/ nBraceHeight += 2 * (nBraceHeight * nPerc / 100L);
+/*N*/ }
+/*N*/ else
+/*N*/ nBraceHeight = nFaceHeight;
+/*N*/
+/*N*/ // Abstand zum Argument
+/*N*/ nPerc = bIsABS ? 0 : rFormat.GetDistance(DIS_BRACKETSPACE);
+/*N*/ long nDist = nFaceHeight * nPerc / 100L;
+/*N*/
+/*N*/ // sofern erwuenscht skalieren der Klammern auf die gewuenschte Groesse
+/*N*/ if (bScale)
+/*N*/ {
+/*N*/ Size aSize (pLeft->GetFont().GetSize());
+/*N*/ DBG_ASSERT(pRight->GetFont().GetSize() == aSize,
+/*N*/ "Sm : unterschiedliche Fontgroessen");
+/*N*/ aSize.Width() = Min((long) nBraceHeight * 60L / 100L,
+/*N*/ rFormat.GetBaseSize().Height() * 3L / 2L);
+/*N*/ // correction factor since change from StarMath to StarSymbol font
+/*N*/ // because of the different font width in the FontMetric
+/*N*/ aSize.Width() *= 182;
+/*N*/ aSize.Width() /= 267;
+/*N*/
+/*N*/ xub_Unicode cChar = pLeft->GetToken().cMathChar;
+/*N*/ if (cChar != MS_LINE && cChar != MS_DLINE)
+/*N*/ pLeft ->GetFont().SetSize(aSize);
+/*N*/
+/*N*/ cChar = pRight->GetToken().cMathChar;
+/*N*/ if (cChar != MS_LINE && cChar != MS_DLINE)
+/*N*/ pRight->GetFont().SetSize(aSize);
+/*N*/
+/*N*/ pLeft ->AdaptToY(rDev, nBraceHeight);
+/*N*/ pRight->AdaptToY(rDev, nBraceHeight);
+/*N*/ }
+/*N*/
+/*N*/ pLeft ->Arrange(rDev, rFormat);
+/*N*/ pRight->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ // damit auch "\(a\) - (a) - left ( a right )" vernuenftig aussieht
+/*N*/ RectVerAlign eVerAlign = bScale ? RVA_CENTERY : RVA_BASELINE;
+/*N*/
+/*N*/ Point aPos;
+/*N*/ aPos = pLeft->AlignTo(*pBody, RP_LEFT, RHA_CENTER, eVerAlign);
+/*N*/ aPos.X() -= nDist;
+/*N*/ pLeft->MoveTo(aPos);
+/*N*/
+/*N*/ aPos = pRight->AlignTo(*pBody, RP_RIGHT, RHA_CENTER, eVerAlign);
+/*N*/ aPos.X() += nDist;
+/*N*/ pRight->MoveTo(aPos);
+/*N*/
+/*N*/ SmRect::operator = (*pBody);
+/*N*/ ExtendBy(*pLeft, RCP_THIS).ExtendBy(*pRight, RCP_THIS);
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmBracebodyNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ USHORT nNumSubNodes = GetNumSubNodes();
+/*N*/ if (nNumSubNodes == 0)
+/*N*/ return;
+/*N*/
+/*N*/ // arrange arguments
+/*N*/ USHORT i;
+/*N*/ for (i = 0; i < nNumSubNodes; i += 2)
+/*N*/ GetSubNode(i)->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ // build reference rectangle with necessary info for vertical alignment
+/*N*/ SmRect aRefRect (*GetSubNode(0));
+/*N*/ for (i = 0; i < nNumSubNodes; i += 2)
+/*N*/ {
+/*N*/ SmRect aTmpRect (*GetSubNode(i));
+/*N*/ Point aPos = aTmpRect.AlignTo(aRefRect, RP_RIGHT, RHA_CENTER, RVA_BASELINE);
+/*N*/ aTmpRect.MoveTo(aPos);
+/*N*/ aRefRect.ExtendBy(aTmpRect, RCP_XOR);
+/*N*/ }
+/*N*/
+/*N*/ nBodyHeight = aRefRect.GetHeight();
+/*N*/
+/*N*/ // scale separators to required height and arrange them
+/*N*/ BOOL bScale = GetScaleMode() == SCALE_HEIGHT || rFormat.IsScaleNormalBrackets();
+/*N*/ long nHeight = bScale ? aRefRect.GetHeight() : GetFont().GetSize().Height();
+/*N*/ int nIndex = GetScaleMode() == SCALE_HEIGHT ?
+/*N*/ DIS_BRACKETSIZE : DIS_NORMALBRACKETSIZE;
+/*N*/ USHORT nPerc = rFormat.GetDistance(nIndex);
+/*N*/ if (bScale)
+/*N*/ nHeight += 2 * (nHeight * nPerc / 100L);
+/*N*/ for (i = 1; i < nNumSubNodes; i += 2)
+/*N*/ {
+/*?*/ SmNode *pNode = GetSubNode(i);
+/*?*/ pNode->AdaptToY(rDev, nHeight);
+/*?*/ pNode->Arrange(rDev, rFormat);
+/*N*/ }
+/*N*/
+/*N*/ // horizontal distance between argument and brackets or separators
+/*N*/ long nDist = GetFont().GetSize().Height()
+/*N*/ * rFormat.GetDistance(DIS_BRACKETSPACE) / 100L;
+/*N*/
+/*N*/ SmNode *pLeft = GetSubNode(0);
+/*N*/ SmRect::operator = (*pLeft);
+/*N*/ for (i = 1; i < nNumSubNodes; i++)
+/*N*/ {
+/*?*/ 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;
+/*N*/ }
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+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, TRUE);
+ 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
+
+
+/*N*/ SmNode * SmOperNode::GetSymbol()
+/*N*/ {
+/*N*/ SmNode *pNode = GetSubNode(0);
+/*N*/ DBG_ASSERT(pNode, "Sm: NULL pointer!");
+/*N*/
+/*N*/ if (pNode->GetType() == NSUBSUP)
+/*N*/ pNode = ((SmSubSupNode *) pNode)->GetBody();
+/*N*/
+/*N*/ DBG_ASSERT(pNode, "Sm: NULL pointer!");
+/*N*/ return pNode;
+/*N*/ }
+
+
+/*N*/ long SmOperNode::CalcSymbolHeight(const SmNode &rSymbol,
+/*N*/ const SmFormat &rFormat) const
+/*N*/ // returns the font height to be used for operator-symbol
+/*N*/ {
+/*N*/ long nHeight = GetFont().GetSize().Height();
+/*N*/
+/*N*/ SmTokenType eType = GetToken().eType;
+/*N*/ if (eType == TLIM || eType == TLIMINF || eType == TLIMSUP)
+/*N*/ return nHeight;
+/*N*/
+/*N*/ if (!rFormat.IsTextmode())
+/*N*/ {
+/*N*/ // set minimum size ()
+/*N*/ nHeight += (nHeight * 20L) / 100L;
+/*N*/
+/*N*/ nHeight += nHeight
+/*N*/ * rFormat.GetDistance(DIS_OPERATORSIZE) / 100L;
+/*N*/ nHeight = nHeight * 686L / 845L;
+/*N*/ }
+/*N*/
+/*N*/ // correct user-defined symbols to match height of sum from used font
+/*N*/ if (rSymbol.GetToken().eType == TSPECIAL)
+/*?*/ nHeight = nHeight * 845L / 686L;
+/*N*/
+/*N*/ return nHeight;
+/*N*/ }
+
+
+/*N*/ void SmOperNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ SmNode *pOper = GetSubNode(0);
+/*N*/ SmNode *pBody = GetSubNode(1);
+/*N*/
+/*N*/ DBG_ASSERT(pOper, "Sm: Subnode fehlt");
+/*N*/ DBG_ASSERT(pBody, "Sm: Subnode fehlt");
+/*N*/
+/*N*/ SmNode *pSymbol = GetSymbol();
+/*N*/ pSymbol->SetSize(Fraction(CalcSymbolHeight(*pSymbol, rFormat),
+/*N*/ pSymbol->GetFont().GetSize().Height()));
+/*N*/
+/*N*/ pBody->Arrange(rDev, rFormat);
+/*N*/ pOper->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ long nOrigHeight = GetFont().GetSize().Height(),
+/*N*/ nDist = nOrigHeight
+/*N*/ * rFormat.GetDistance(DIS_OPERATORSPACE) / 100L;
+/*N*/
+/*N*/ Point aPos = pOper->AlignTo(*pBody, RP_LEFT, RHA_CENTER, /*RVA_CENTERY*/RVA_MID);
+/*N*/ aPos.X() -= nDist;
+/*N*/ pOper->MoveTo(aPos);
+/*N*/
+/*N*/ SmRect::operator = (*pBody);
+/*N*/ ExtendBy(*pOper, RCP_THIS);
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+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 = RHA_CENTER;
+ 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());
+}
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmAttributNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ SmNode *pAttr = GetSubNode(0),
+/*N*/ *pBody = GetSubNode(1);
+/*N*/ DBG_ASSERT(pBody, "Sm: Body fehlt");
+/*N*/ DBG_ASSERT(pAttr, "Sm: Attribut fehlt");
+/*N*/
+/*N*/ pBody->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ if (GetScaleMode() == SCALE_WIDTH)
+/*?*/ pAttr->AdaptToX(rDev, pBody->GetItalicWidth());
+/*N*/ pAttr->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ // get relative position of attribut
+/*N*/ RectVerAlign eVerAlign;
+/*N*/ long nDist = 0;
+/*N*/ switch (GetToken().eType)
+/*N*/ { case TUNDERLINE :
+/*?*/ eVerAlign = RVA_ATTRIBUT_LO;
+/*?*/ break;
+/*N*/ case TOVERSTRIKE :
+/*?*/ eVerAlign = RVA_ATTRIBUT_MID;
+/*?*/ break;
+/*N*/ default :
+/*N*/ eVerAlign = RVA_ATTRIBUT_HI;
+/*N*/ if (pBody->GetType() == NATTRIBUT)
+/*?*/ nDist = GetFont().GetSize().Height()
+/*?*/ * rFormat.GetDistance(DIS_ORNAMENTSPACE) / 100L;
+/*N*/ }
+/*N*/ Point aPos = pAttr->AlignTo(*pBody, RP_ATTRIBUT, RHA_CENTER, eVerAlign);
+/*N*/ aPos.Y() -= nDist;
+/*N*/ pAttr->MoveTo(aPos);
+/*N*/
+/*N*/ SmRect::operator = (*pBody);
+/*N*/ ExtendBy(*pAttr, RCP_THIS, (BOOL) TRUE);
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+
+
+
+
+/*N*/ void SmFontNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
+/*N*/ {
+/*N*/ //! prepare subnodes first
+/*N*/ SmNode::Prepare(rFormat, rDocShell);
+/*N*/
+/*N*/ int nFnt = -1;
+/*N*/ switch (GetToken().eType)
+/*N*/ {
+/*?*/ case TFIXED: nFnt = FNT_FIXED; break;
+/*N*/ case TSANS: nFnt = FNT_SANS; break;
+/*?*/ case TSERIF: nFnt = FNT_SERIF; break;
+/*N*/ }
+/*N*/ if (nFnt != -1)
+/*N*/ { GetFont() = rFormat.GetFont(nFnt);
+/*N*/ SetFont(GetFont());
+/*N*/ }
+/*N*/
+/*N*/ //! prevent overwrites of this font by 'Arrange' or 'SetFont' calls of
+/*N*/ //! other font nodes (those with lower depth in the tree)
+/*N*/ Flags() |= FLG_FONT;
+/*N*/ }
+
+
+/*N*/ void SmFontNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ SmNode *pNode = GetSubNode(1);
+/*N*/ DBG_ASSERT(pNode, "Sm: SubNode fehlt");
+/*N*/
+/*N*/ switch (GetToken().eType)
+/*N*/ { case TSIZE :
+/*N*/ pNode->SetFontSize(aFontSize, nSizeType);
+/*N*/ break;
+/*N*/ case TSANS :
+/*N*/ case TSERIF :
+/*N*/ case TFIXED :
+/*N*/ pNode->SetFont(GetFont());
+/*N*/ break;
+/*N*/ case TUNKNOWN : break; // no assertion on "font <?> <?>"
+/*N*/
+/*?*/ case TPHANTOM : SetPhantom(TRUE); break;
+/*N*/ case TBOLD : SetAttribut(ATTR_BOLD); break;
+/*N*/ case TITALIC : SetAttribut(ATTR_ITALIC); break;
+/*?*/ case TNBOLD : ClearAttribut(ATTR_BOLD); break;
+/*N*/ case TNITALIC : ClearAttribut(ATTR_ITALIC); break;
+/*N*/
+/*?*/ 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;
+/*N*/
+/*N*/ default:
+/*?*/ DBG_ASSERT(FALSE, "Sm: unbekannter Fall");
+/*N*/ }
+/*N*/
+/*N*/ pNode->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ SmRect::operator = (pNode->GetRect());
+/*N*/ }
+
+
+/*N*/ void SmFontNode::SetSizeParameter(const Fraction& rValue, USHORT Type)
+/*N*/ {
+/*N*/ nSizeType = Type;
+/*N*/ aFontSize = rValue;
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+/*N*/ SmPolyLineNode::SmPolyLineNode(const SmToken &rNodeToken)
+/*N*/ : SmGraphicNode(NPOLYLINE, rNodeToken)
+/*N*/ {
+/*N*/ aPoly.SetSize(2);
+/*N*/ nWidth = 0;
+/*N*/ }
+
+
+/*N*/ void SmPolyLineNode::AdaptToX(const OutputDevice &rDev, ULONG nWidth)
+/*N*/ {
+/*N*/ aToSize.Width() = nWidth;
+/*N*/ }
+
+
+/*N*/ void SmPolyLineNode::AdaptToY(const OutputDevice &rDev, ULONG nHeight)
+/*N*/ {
+/*N*/ GetFont().FreezeBorderWidth();
+/*N*/ aToSize.Height() = nHeight;
+/*N*/ }
+
+
+/*N*/ void SmPolyLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ //! some routines being called extract some info from the OutputDevice's
+/*N*/ //! font (eg the space to be used for borders OR the font name(!!)).
+/*N*/ //! Thus the font should reflect the needs and has to be set!
+/*N*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+/*N*/ aTmpDev.SetFont(GetFont());
+/*N*/
+/*N*/ long nBorderwidth = GetFont().GetBorderWidth();
+/*N*/
+/*N*/ //
+/*N*/ // Das Polygon mit den beiden Endpunkten bilden
+/*N*/ //
+/*N*/ DBG_ASSERT(aPoly.GetSize() == 2, "Sm : falsche Anzahl von Punkten");
+/*N*/ Point aPointA, aPointB;
+/*N*/ if (GetToken().eType == TWIDESLASH)
+/*N*/ {
+/*N*/ aPointA.X() = nBorderwidth;
+/*N*/ aPointA.Y() = aToSize.Height() - nBorderwidth;
+/*N*/ aPointB.X() = aToSize.Width() - nBorderwidth;
+/*N*/ aPointB.Y() = nBorderwidth;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ DBG_ASSERT(GetToken().eType == TWIDEBACKSLASH, "Sm : unerwartetes Token");
+/*N*/ aPointA.X() =
+/*N*/ aPointA.Y() = nBorderwidth;
+/*N*/ aPointB.X() = aToSize.Width() - nBorderwidth;
+/*N*/ aPointB.Y() = aToSize.Height() - nBorderwidth;
+/*N*/ }
+/*N*/ aPoly.SetPoint(aPointA, 0);
+/*N*/ aPoly.SetPoint(aPointB, 1);
+/*N*/
+/*N*/ long nThick = GetFont().GetSize().Height()
+/*N*/ * rFormat.GetDistance(DIS_STROKEWIDTH) / 100L;
+/*N*/ nWidth = nThick + 2 * nBorderwidth;
+/*N*/
+/*N*/ SmRect::operator = (SmRect(aToSize.Width(), aToSize.Height()));
+/*N*/ }
+
+
+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());
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev, FALSE);
+ aTmpDev.SetLineColor( GetFont().GetColor() );
+
+ rDev.DrawPolyLine(aPoly, aInfo);
+
+ #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
+}
+
+
+/**************************************************************************/
+
+/*N*/ void SmRootSymbolNode::AdaptToX(const OutputDevice &rDev, ULONG nWidth)
+/*N*/ {
+/*N*/ nBodyWidth = nWidth;
+/*N*/ }
+
+
+/*N*/ void SmRootSymbolNode::AdaptToY(const OutputDevice &rDev, ULONG nHeight)
+/*N*/ {
+/*N*/ // etwas extra Laenge damit der horizontale Balken spaeter ueber dem
+/*N*/ // Argument positioniert ist
+/*N*/ SmMathSymbolNode::AdaptToY(rDev, nHeight + nHeight / 10L);
+/*N*/ }
+
+
+void SmRootSymbolNode::Draw(OutputDevice &rDev, const Point &rPosition) const
+{
+ if (IsPhantom())
+ return;
+
+ // draw root-sign itself
+ SmMathSymbolNode::Draw(rDev, rPosition);
+
+ static String aBarStr( (sal_Unicode) MS_BAR );
+ SmTmpDevice aTmpDev( (OutputDevice &) rDev, TRUE );
+ aTmpDev.SetFillColor(GetFont().GetColor());
+ rDev.SetLineColor();
+ aTmpDev.SetFont( GetFont() );
+
+ // since the width is always unscaled it corresponds ot the _original_
+ // _unscaled_ font height to be used, we use that to calculate the
+ // bar height. Thus it is independent of the arguments height.
+ // ( see display of sqrt QQQ versus sqrt stack{Q#Q#Q#Q} )
+ long nBarHeight = GetWidth() * 7L / 100L;
+ long nBarWidth = nBodyWidth + GetBorderWidth();
+ Point aBarOffset( GetWidth(), +GetBorderWidth() );
+ Point aBarPos( rPosition + aBarOffset );
+
+ Rectangle aBar(aBarPos, Size( nBarWidth, nBarHeight) );
+ //! 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 aDrawPos( rDev.PixelToLogic(rDev.LogicToPixel(aBar.TopLeft())) );
+ //aDrawPos.X() = aBar.Left(); //! don't change X position
+ aBar.SetPos( aDrawPos );
+
+ rDev.DrawRect( aBar );
+
+#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
+}
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmRectangleNode::AdaptToX(const OutputDevice &rDev, ULONG nWidth)
+/*N*/ {
+/*N*/ aToSize.Width() = nWidth;
+/*N*/ }
+
+
+/*N*/ void SmRectangleNode::AdaptToY(const OutputDevice &rDev, ULONG nHeight)
+/*N*/ {
+/*N*/ GetFont().FreezeBorderWidth();
+/*N*/ aToSize.Height() = nHeight;
+/*N*/ }
+
+
+/*N*/ void SmRectangleNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ long nFontHeight = GetFont().GetSize().Height();
+/*N*/ long nWidth = aToSize.Width(),
+/*N*/ nHeight = aToSize.Height();
+/*N*/ if (nHeight == 0)
+/*?*/ nHeight = nFontHeight / 30;
+/*N*/ if (nWidth == 0)
+/*?*/ nWidth = nFontHeight / 3;
+/*N*/
+/*N*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+/*N*/ aTmpDev.SetFont(GetFont());
+/*N*/
+/*N*/ // add some borderspace
+/*N*/ ULONG nBorderWidth = GetFont().GetBorderWidth();
+/*N*/ //nWidth += nBorderWidth;
+/*N*/ nHeight += 2 * nBorderWidth;
+/*N*/
+/*N*/ //! use this method in order to have 'SmRect::HasAlignInfo() == TRUE'
+/*N*/ //! and thus having the attribut-fences updated in 'SmRect::ExtendBy'
+/*N*/ SmRect::operator = (SmRect(nWidth, nHeight));
+/*N*/ }
+
+
+void SmRectangleNode::Draw(OutputDevice &rDev, const Point &rPosition) const
+{
+ if (IsPhantom())
+ return;
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev, FALSE);
+ aTmpDev.SetFillColor(GetFont().GetColor());
+ rDev.SetLineColor();
+ aTmpDev.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);
+
+ #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
+}
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmTextNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
+/*N*/ {
+/*N*/ SmNode::Prepare(rFormat, rDocShell);
+/*N*/
+/*N*/ // default setting for horizontal alignment of nodes with TTEXT
+/*N*/ // content is as alignl (cannot be done in Arrange since it would
+/*N*/ // override the settings made by an SmAlignNode before)
+/*N*/ if (TTEXT == GetToken().eType)
+/*N*/ SetRectHorAlign( RHA_LEFT );
+/*N*/
+/*N*/ aText = GetToken().aText;
+/*N*/ GetFont() = rFormat.GetFont(GetFontDesc());
+/*N*/
+/*N*/ if (GetFont().GetItalic() == ITALIC_NORMAL)
+/*N*/ Attributes() |= ATTR_ITALIC;
+/*N*/ if (GetFont().GetWeight() == WEIGHT_BOLD)
+/*?*/ Attributes() |= ATTR_BOLD;
+/*N*/
+/*N*/ };
+
+
+/*N*/ void SmTextNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ PrepareAttributes();
+/*N*/
+/*N*/ USHORT nSizeDesc = GetFontDesc() == FNT_FUNCTION ?
+/*N*/ SIZ_FUNCTION : SIZ_TEXT;
+/*N*/ GetFont() *= Fraction (rFormat.GetRelSize(nSizeDesc), 100);
+/*N*/
+/*N*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+/*N*/ aTmpDev.SetFont(GetFont());
+/*N*/
+/*N*/ SmRect::operator = (SmRect(aTmpDev, &rFormat, aText, GetFont().GetBorderWidth()));
+/*N*/ }
+
+
+/*N*/ void SmTextNode::Draw(OutputDevice &rDev, const Point& rPosition) const
+/*N*/ {
+/*N*/ if (IsPhantom() || aText.Len() == 0 || aText.GetChar(0) == xub_Unicode('\0'))
+/*N*/ return;
+/*N*/
+/*N*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, FALSE);
+/*N*/ aTmpDev.SetFont(GetFont());
+/*N*/
+/*N*/ Point aPos (rPosition);
+/*N*/ aPos.Y() += GetBaselineOffset();
+/*N*/ // auf Pixelkoordinaten runden
+/*N*/ aPos = rDev.PixelToLogic( rDev.LogicToPixel(aPos) );
+/*N*/
+/*N*/ rDev.DrawStretchText(aPos, GetWidth(), aText);
+/*N*/
+/*N*/ #ifdef SM_RECT_DEBUG
+/*N*/ if (!IsDebug())
+/*N*/ return;
+/*N*/
+/*N*/ int nRFlags = SM_RECT_CORE | SM_RECT_ITALIC | SM_RECT_LINES | SM_RECT_MID;
+/*N*/ SmRect::Draw(rDev, rPosition, nRFlags);
+/*N*/ #endif
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+
+/*N*/ void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ Point aPosition,
+/*N*/ aOffset;
+/*N*/ SmNode *pNode;
+/*N*/ int i, j;
+/*N*/
+/*N*/ // initialize array that is to hold the maximum widhts of all
+/*N*/ // elements (subnodes) in that column.
+/*N*/ long *pColWidth = new long[nNumCols];
+/*N*/ for (j = 0; j < nNumCols; j++)
+/*N*/ pColWidth[j] = 0;
+/*N*/
+/*N*/ // arrange subnodes and calculate the aboves arrays contents
+/*N*/ for (i = GetNumSubNodes() - 1; i >= 0; i--)
+/*N*/ if (pNode = GetSubNode(i))
+/*N*/ { pNode->Arrange(rDev, rFormat);
+/*N*/
+/*N*/ int nCol = i % nNumCols;
+/*N*/ pColWidth[nCol]
+/*N*/ = Max(pColWidth[nCol], pNode->GetItalicWidth());
+/*N*/ }
+/*N*/
+/*N*/ // norm distance from which the following two are calcutated
+/*N*/ const int nNormDist = 3 * GetFont().GetSize().Height();
+/*N*/
+/*N*/ // define horizontal and vertical minimal distances that seperate
+/*N*/ // the elements
+/*N*/ long nHorDist = nNormDist * rFormat.GetDistance(DIS_MATRIXCOL) / 100L,
+/*N*/ nVerDist = nNormDist * rFormat.GetDistance(DIS_MATRIXROW) / 100L;
+/*N*/
+/*N*/ // build array that holds the leftmost position for each column
+/*N*/ long *pColLeft = new long[nNumCols];
+/*N*/ long nX = 0;
+/*N*/ for (j = 0; j < nNumCols; j++)
+/*N*/ { pColLeft[j] = nX;
+/*N*/ nX += pColWidth[j] + nHorDist;
+/*N*/ }
+/*N*/
+/*N*/ Point aPos, aDelta;
+/*N*/ SmRect aLineRect;
+/*N*/ SmRect::operator = (SmRect());
+/*N*/ for (i = 0; i < nNumRows; i++)
+/*N*/ { aLineRect = SmRect();
+/*N*/ for (j = 0; j < nNumCols; j++)
+/*N*/ { SmNode *pNode = GetSubNode(i * nNumCols + j);
+/*N*/ DBG_ASSERT(pNode, "Sm: NULL pointer");
+/*N*/
+/*N*/ const SmRect &rNodeRect = pNode->GetRect();
+/*N*/
+/*N*/ // align all baselines in that row if possible
+/*N*/ aPos = rNodeRect.AlignTo(aLineRect, RP_RIGHT, RHA_CENTER, RVA_BASELINE);
+/*N*/ aPos.X() += nHorDist;
+/*N*/
+/*N*/ // get horizontal alignment
+/*N*/ const SmNode *pCoNode = pNode->GetLeftMost();
+/*N*/ SmTokenType eType = pCoNode->GetToken().eType;
+/*N*/ RectHorAlign eHorAlign = pCoNode->GetRectHorAlign();
+/*N*/
+/*N*/ // caculate horizontal position of element depending on column
+/*N*/ // and horizontal alignment
+/*N*/ switch (eHorAlign)
+/*N*/ { case RHA_LEFT:
+/*N*/ aPos.X() = rNodeRect.GetLeft() + pColLeft[j];
+/*N*/ break;
+/*N*/ case RHA_CENTER:
+/*N*/ aPos.X() = rNodeRect.GetLeft() + pColLeft[j]
+/*N*/ + pColWidth[j] / 2
+/*N*/ - rNodeRect.GetItalicCenterX();
+/*N*/ break;
+/*N*/ case RHA_RIGHT:
+/*?*/ aPos.X() = rNodeRect.GetLeft() + pColLeft[j]
+/*?*/ + pColWidth[j] - rNodeRect.GetItalicWidth();
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ pNode->MoveTo(aPos);
+/*N*/ aLineRect.ExtendBy(rNodeRect, RCP_XOR);
+/*N*/ }
+/*N*/
+/*N*/ aPos = aLineRect.AlignTo(*this, RP_BOTTOM, RHA_CENTER, RVA_BASELINE);
+/*N*/ aPos.Y() += nVerDist;
+/*N*/
+/*N*/ // move 'aLineRect' and rectangles in that line to final position
+/*N*/ aDelta.X() = 0; // since horizontal alignment is already done
+/*N*/ aDelta.Y() = aPos.Y() - aLineRect.GetTop();
+/*N*/ aLineRect.Move(aDelta);
+/*N*/ for (j = 0; j < nNumCols; j++)
+/*N*/ if (pNode = GetSubNode(i * nNumCols + j))
+/*N*/ pNode->Move(aDelta);
+/*N*/
+/*N*/ ExtendBy(aLineRect, RCP_NONE);
+/*N*/ }
+/*N*/
+/*N*/ delete [] pColLeft;
+/*N*/ delete [] pColWidth;
+/*N*/ }
+
+
+/*N*/ void SmMatrixNode::SetRowCol(USHORT nMatrixRows, USHORT nMatrixCols)
+/*N*/ {
+/*N*/ nNumRows = nMatrixRows;
+/*N*/ nNumCols = nMatrixCols;
+/*N*/ }
+
+
+/*N*/ SmNode * SmMatrixNode::GetLeftMost()
+/*N*/ {
+/*N*/ return this;
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+/*N*/ SmMathSymbolNode::SmMathSymbolNode(const SmToken &rNodeToken)
+/*N*/ : SmSpecialNode(NMATH, rNodeToken, FNT_MATH)
+/*N*/ {
+/*N*/ xub_Unicode cChar = GetToken().cMathChar;
+/*N*/ if ((xub_Unicode) '\0' != cChar)
+/*N*/ SetText( cChar );
+/*N*/ }
+
+/*?*/ void SmMathSymbolNode::AdaptToX(const OutputDevice &rDev, ULONG nWidth)
+/*?*/ {
+/*?*/ // Since there is no function to do this, we try to approximate it:
+/*?*/ Size aFntSize (GetFont().GetSize());
+/*?*/
+/*?*/ //! however the result is a bit better with 'nWidth' as initial font width
+/*?*/ aFntSize.Width() = nWidth;
+/*?*/ GetFont().SetSize(aFntSize);
+/*?*/
+/*?*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+/*?*/ aTmpDev.SetFont(GetFont());
+/*?*/
+/*?*/ // get denominator of error factor for width
+/*?*/ long nBorderWidth = GetFont().GetBorderWidth();
+/*?*/ long nDenom = SmRect(aTmpDev, NULL, GetText(), nBorderWidth).GetItalicWidth();
+/*?*/
+/*?*/ // scale fontwidth with this error factor
+/*?*/ aFntSize.Width() *= nWidth;
+/*?*/ aFntSize.Width() /= nDenom ? nDenom : 1;
+/*?*/
+/*?*/ GetFont().SetSize(aFntSize);
+/*?*/ }
+
+/*N*/ void SmMathSymbolNode::AdaptToY(const OutputDevice &rDev, ULONG nHeight)
+/*N*/ {
+/*N*/ GetFont().FreezeBorderWidth();
+/*N*/ Size aFntSize (GetFont().GetSize());
+/*N*/
+/*N*/ // da wir nur die Hoehe skalieren wollen muesen wir hier ggf die Fontweite
+/*N*/ // ermitteln um diese beizubehalten.
+/*N*/ if (aFntSize.Width() == 0)
+/*N*/ {
+/*N*/ OutputDevice &rDevNC = (OutputDevice &) rDev;
+/*N*/ rDevNC.Push(PUSH_FONT | PUSH_MAPMODE);
+/*N*/ rDevNC.SetFont(GetFont());
+/*N*/ aFntSize.Width() = rDev.GetFontMetric().GetSize().Width();
+/*N*/ rDevNC.Pop();
+/*N*/ }
+/*N*/ DBG_ASSERT(aFntSize.Width() != 0, "Sm: ");
+/*N*/
+/*N*/ //! however the result is a bit better with 'nHeight' as initial
+/*N*/ //! font height
+/*N*/ aFntSize.Height() = nHeight;
+/*N*/ GetFont().SetSize(aFntSize);
+/*N*/
+/*N*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+/*N*/ aTmpDev.SetFont(GetFont());
+/*N*/
+/*N*/ // get denominator of error factor for height
+/*N*/ long nBorderWidth = GetFont().GetBorderWidth();
+/*N*/ long nDenom = SmRect(aTmpDev, NULL, GetText(), nBorderWidth).GetHeight();
+/*N*/
+/*N*/ // scale fontwidth with this error factor
+/*N*/ aFntSize.Height() *= nHeight;
+/*N*/ aFntSize.Height() /= nDenom ? nDenom : 1;
+/*N*/
+/*N*/ GetFont().SetSize(aFntSize);
+/*N*/ }
+
+
+/*N*/ void SmMathSymbolNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
+/*N*/ {
+/*N*/ SmNode::Prepare(rFormat, rDocShell);
+/*N*/
+/*N*/ DBG_ASSERT(GetFont().GetCharSet() == RTL_TEXTENCODING_SYMBOL ||
+/*N*/ GetFont().GetCharSet() == RTL_TEXTENCODING_UNICODE,
+/*N*/ "incorrect charset for character from StarMath/StarSymbol font");
+/*N*/
+/*N*/ Flags() |= FLG_FONT | FLG_ITALIC;
+/*N*/ };
+
+
+/*N*/ void SmMathSymbolNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ const XubString &rText = GetText();
+/*N*/
+/*N*/ if (rText.Len() == 0 || rText.GetChar(0) == xub_Unicode('\0'))
+/*N*/ { SmRect::operator = (SmRect());
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ PrepareAttributes();
+/*N*/
+/*N*/ GetFont() *= Fraction (rFormat.GetRelSize(SIZ_TEXT), 100);
+/*N*/
+/*N*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+/*N*/ aTmpDev.SetFont(GetFont());
+/*N*/
+/*N*/ SmRect::operator = (SmRect(aTmpDev, &rFormat, rText, GetFont().GetBorderWidth()));
+/*N*/ }
+
+
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmSpecialNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
+/*N*/ {
+/*N*/ SmNode::Prepare(rFormat, rDocShell);
+/*N*/
+/*N*/ const SmSym *pSym;
+/*N*/ SmModule *pp = SM_MOD1();
+/*N*/
+/*N*/ Size aOldSize = GetFont().GetSize();
+/*N*/ if (pSym = rDocShell.GetSymSetManager().GetSymbolByName(GetToken().aText))
+/*N*/ {
+/*N*/ SetText( pSym->GetCharacter() );
+/*N*/ GetFont() = pSym->GetFace();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SetText( GetToken().aText );
+/*N*/ GetFont() = rFormat.GetFont(FNT_VARIABLE);
+/*N*/ }
+/*N*/ GetFont().SetSize(aOldSize);
+/*N*/
+/*N*/ //! eigentlich sollten nur WEIGHT_NORMAL und WEIGHT_BOLD vorkommen...
+/*N*/ //! In der sms-Datei gibt es jedoch zB auch 'WEIGHT_ULTRALIGHT'
+/*N*/ //! daher vergleichen wir hier mit > statt mit != .
+/*N*/ //! (Langfristig sollte die Notwendigkeit fuer 'PrepareAttribut', und damit
+/*N*/ //! fuer dieses hier, mal entfallen.)
+/*N*/ //
+/*N*/ //! see also SmFontStyles::GetStyleName
+/*N*/ if (GetFont().GetWeight() > WEIGHT_NORMAL)
+/*?*/ SetAttribut(ATTR_BOLD);
+/*N*/ if (GetFont().GetItalic() != ITALIC_NONE)
+/*N*/ SetAttribut(ATTR_ITALIC);
+/*N*/
+/*N*/ Flags() |= FLG_FONT;
+/*N*/ };
+
+
+/*N*/ void SmSpecialNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ PrepareAttributes();
+/*N*/
+/*N*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+/*N*/ aTmpDev.SetFont(GetFont());
+/*N*/
+/*N*/ SmRect::operator = (SmRect(aTmpDev, &rFormat, GetText(), GetFont().GetBorderWidth()));
+/*N*/ }
+
+
+/*N*/ void SmSpecialNode::Draw(OutputDevice &rDev, const Point& rPosition) const
+/*N*/ {
+/*N*/ //! since this chars might come from any font, that we may not have
+/*N*/ //! set to ALIGN_BASELINE yet, we do it now.
+/*N*/ ((SmSpecialNode *)this)->GetFont().SetAlign(ALIGN_BASELINE);
+/*N*/
+/*N*/ SmTextNode::Draw(rDev, rPosition);
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+void SmGlyphSpecialNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+{
+ PrepareAttributes();
+
+ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+ aTmpDev.SetFont(GetFont());
+
+ SmRect::operator = (SmRect(aTmpDev, &rFormat, GetText(),
+ GetFont().GetBorderWidth()).AsGlyphRect());
+}
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmPlaceNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
+/*N*/ {
+/*N*/ SmNode::Prepare(rFormat, rDocShell);
+/*N*/
+/*N*/ GetFont().SetColor(COL_GRAY);
+/*N*/ Flags() |= FLG_COLOR | FLG_FONT | FLG_ITALIC;
+/*N*/ };
+
+
+/*N*/ void SmPlaceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ PrepareAttributes();
+/*N*/
+/*N*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+/*N*/ aTmpDev.SetFont(GetFont());
+/*N*/
+/*N*/ SmRect::operator = (SmRect(aTmpDev, &rFormat, GetText(), GetFont().GetBorderWidth()));
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmErrorNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
+/*N*/ {
+/*N*/ SmNode::Prepare(rFormat, rDocShell);
+/*N*/
+/*N*/ GetFont().SetColor(COL_RED);
+/*N*/ Flags() |= FLG_VISIBLE | FLG_BOLD | FLG_ITALIC
+/*N*/ | FLG_COLOR | FLG_FONT | FLG_SIZE;
+/*N*/ }
+
+
+/*N*/ void SmErrorNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ PrepareAttributes();
+/*N*/
+/*N*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+/*N*/ aTmpDev.SetFont(GetFont());
+/*N*/
+/*N*/ const XubString &rText = GetText();
+/*N*/ DBG_ASSERT(rText.Len() == 1 && rText.GetChar(0) == (xub_Unicode) MS_ERROR,
+/*N*/ "Sm : Text ist kein ERROR Symbol");
+/*N*/ SmRect::operator = (SmRect(aTmpDev, &rFormat, rText, GetFont().GetBorderWidth()));
+/*N*/ }
+
+
+/**************************************************************************/
+
+
+/*N*/ void SmBlankNode::IncreaseBy(const SmToken &rToken)
+/*N*/ {
+/*N*/ switch(rToken.eType)
+/*N*/ {
+/*N*/ case TBLANK: nNum += 4; break;
+/*?*/ case TSBLANK: nNum += 1; break;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmBlankNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell)
+/*N*/ {
+/*N*/ SmNode::Prepare(rFormat, rDocShell);
+/*N*/
+/*N*/ //! hier mu?sollte es lediglich nicht der StarMath Font sein,
+/*N*/ //! damit fuer das in Arrange verwendete Zeichen ein "normales"
+/*N*/ //! (ungecliptes) Rechteck erzeugt wird.
+/*N*/ GetFont() = rFormat.GetFont(FNT_VARIABLE);
+/*N*/
+/*N*/ Flags() |= FLG_FONT | FLG_BOLD | FLG_ITALIC;
+/*N*/ }
+
+
+/*N*/ void SmBlankNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
+/*N*/ {
+/*N*/ SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE);
+/*N*/ aTmpDev.SetFont(GetFont());
+/*N*/
+/*N*/ // Abstand von der Fonthoehe abhaengig machen
+/*N*/ // (damit er beim skalieren (zB size *2 {a ~ b}) mitwaechst)
+/*N*/ long nDist = GetFont().GetSize().Height() / 10L,
+/*N*/ nSpace = nNum * nDist;
+/*N*/
+/*N*/ // ein SmRect mit Baseline und allem drum und dran besorgen
+/*N*/ SmRect::operator = (SmRect(aTmpDev, &rFormat, XubString(xub_Unicode(' ')),
+/*N*/ GetFont().GetBorderWidth()));
+/*N*/
+/*N*/ // und dieses auf die gewuenschte Breite bringen
+/*N*/ SetItalicSpaces(0, 0);
+/*N*/ SetWidth(nSpace);
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_parse.cxx b/binfilter/bf_starmath/source/starmath_parse.cxx
new file mode 100644
index 000000000000..6f2bcd447255
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_parse.cxx
@@ -0,0 +1,2376 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <stdio.h>
+
+#define SMDLL 1
+
+#include <com/sun/star/i18n/UnicodeType.hpp>
+
+#include <bf_svtools/syslocale.hxx>
+#include <sal/macros.h>
+
+#include "starmath.hrc"
+#include "config.hxx"
+
+#include "node.hxx"
+namespace binfilter {
+
+using namespace ::com::sun::star::i18n;
+
+///////////////////////////////////////////////////////////////////////////
+
+
+/*N*/ static const sal_Unicode aDelimiterTable[] =
+/*N*/ {
+/*N*/ ' ', '\t', '\n', '\r', '+', '-', '*', '/', '=', '#',
+/*N*/ '%', '\\', '"', '~', '`', '>', '<', '&', '|', '(',
+/*N*/ ')', '{', '}', '[', ']', '^', '_',
+/*N*/ '\0' // end of list symbol
+/*N*/ };
+
+
+
+///////////////////////////////////////////////////////////////////////////
+
+/*N*/ SmToken::SmToken() :
+/*N*/ eType (TUNKNOWN),
+/*N*/ cMathChar ('\0')
+/*N*/ {
+/*N*/ nRow = nCol = nGroup = nLevel = 0;
+/*N*/ }
+
+///////////////////////////////////////////////////////////////////////////
+
+/*?*/ struct SmTokenTableEntry
+/*?*/ {
+/*?*/ const sal_Char* pIdent;
+/*?*/ SmTokenType eType;
+/*?*/ sal_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}
+/*?*/ };
+
+
+/*N*/ static const SmTokenTableEntry * GetTokenTableEntry( const String &rName )
+/*N*/ {
+/*N*/ const SmTokenTableEntry * pRes = 0;
+/*N*/ if (rName.Len())
+/*N*/ {
+/*N*/ INT32 nEntries = SAL_N_ELEMENTS( aTokenTable );
+/*N*/ for (INT32 i = 0; i < nEntries; ++i)
+/*N*/ {
+/*N*/ if (rName.EqualsIgnoreCaseAscii( aTokenTable[i].pIdent ))
+/*N*/ {
+/*N*/ pRes = &aTokenTable[i];
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/
+/*N*/ return pRes;
+/*N*/ }
+
+
+///////////////////////////////////////////////////////////////////////////
+
+#if OSL_DEBUG_LEVEL > 1
+
+/*N*/ BOOL SmParser::IsDelimiter( const String &rTxt, xub_StrLen nPos )
+/*N*/ // returns 'TRUE' iff cChar is '\0' or a delimeter
+/*N*/ {
+/*N*/ DBG_ASSERT( nPos <= rTxt.Len(), "index out of range" );
+/*N*/
+/*N*/ sal_Unicode cChar = rTxt.GetChar( nPos );
+/*N*/ if(!cChar)
+/*N*/ return TRUE;
+/*N*/
+/*N*/ // check if 'cChar' is in the delimeter table
+/*N*/ const sal_Unicode *pDelim = &aDelimiterTable[0];
+/*N*/ for ( ; *pDelim != 0; pDelim++)
+/*N*/ if (*pDelim == cChar)
+/*N*/ break;
+/*N*/
+/*N*/ BOOL bIsDelim = *pDelim != 0;
+/*N*/
+/*N*/ INT16 nTypJp = SM_MOD1()->GetSysLocale().GetCharClass().getType( rTxt, nPos );
+/*N*/ bIsDelim |= nTypJp == ::com::sun::star::i18n::UnicodeType::SPACE_SEPARATOR ||
+/*N*/ nTypJp == ::com::sun::star::i18n::UnicodeType::CONTROL;
+/*N*/
+/*N*/ return bIsDelim;
+/*N*/ }
+
+#endif
+
+
+/*N*/ void SmParser::Insert(const String &rText, USHORT nPos)
+/*N*/ {
+/*N*/ BufferString.Insert(rText, nPos);
+/*N*/
+/*N*/ xub_StrLen nLen = rText.Len();
+/*N*/ BufferIndex += nLen;
+/*N*/ nTokenIndex += nLen;
+/*N*/ }
+
+
+/*N*/ void SmParser::Replace( USHORT nPos, USHORT nLen, const String &rText )
+/*N*/ {
+/*N*/ DBG_ASSERT( nPos + nLen <= BufferString.Len(), "argument mismatch" );
+/*N*/
+/*N*/ BufferString.Replace( nPos, nLen, rText );
+/*N*/ INT16 nChg = rText.Len() - nLen;
+/*N*/ BufferIndex += nChg;
+/*N*/ nTokenIndex += nChg;
+/*N*/ }
+
+
+// First character may be any alphabetic
+/*?*/ const sal_Int32 coStartFlags =
+/*?*/ KParseTokens::ANY_LETTER_OR_NUMBER |
+/*?*/ KParseTokens::IGNORE_LEADING_WS;
+
+// Continuing characters may be any alphanumeric or dot.
+/*?*/ const sal_Int32 coContFlags =
+/*?*/ ( coStartFlags | KParseTokens::ASC_DOT ) & ~KParseTokens::IGNORE_LEADING_WS
+/*?*/ | KParseTokens::TWO_DOUBLE_QUOTES_BREAK_STRING;
+
+// First character for numbers, may be any numeric or dot
+const sal_Int32 coNumStartFlags =
+ KParseTokens::ASC_DIGIT |
+ KParseTokens::ASC_DOT |
+ KParseTokens::IGNORE_LEADING_WS;
+// Continuing characters for numbers, may be any numeric or dot.
+const sal_Int32 coNumContFlags =
+ ( coNumStartFlags | KParseTokens::ASC_DOT ) & ~KParseTokens::IGNORE_LEADING_WS;
+
+/*N*/ void SmParser::NextToken()
+/*N*/ {
+/*N*/ static const String aEmptyStr;
+/*N*/
+/*N*/ xub_StrLen nBufLen = BufferString.Len();
+/*N*/ ParseResult aRes;
+/*N*/ xub_StrLen nRealStart;
+/*N*/ BOOL bCont;
+/*N*/ BOOL bNumStart;
+/*N*/ const CharClass& rCC = SM_MOD1()->GetSysLocale().GetCharClass();
+/*N*/ do
+/*N*/ {
+/*N*/ // skip white spaces
+/*N*/ while (UnicodeType::SPACE_SEPARATOR ==
+/*N*/ rCC.getType( BufferString, BufferIndex ))
+/*N*/ ++BufferIndex;
+/*N*/
+/*N*/ sal_Int32 nStartFlags = coStartFlags;
+/*N*/ sal_Int32 nContFlags = coContFlags;
+/*N*/ sal_Unicode cFirstChar = BufferString.GetChar( BufferIndex );
+/*N*/ bNumStart = cFirstChar == '.' || ('0' <= cFirstChar && cFirstChar <= '9');
+/*N*/ if (bNumStart)
+/*N*/ {
+/*N*/ nStartFlags = coNumStartFlags;
+/*N*/ nContFlags = coNumContFlags;
+/*N*/ }
+/*N*/
+/*N*/ aRes = rCC.parseAnyToken( BufferString, BufferIndex,
+/*N*/ nStartFlags, aEmptyStr,
+/*N*/ nContFlags, aEmptyStr );
+/*N*/
+/*N*/ nRealStart = BufferIndex + (xub_StrLen) aRes.LeadingWhiteSpace;
+/*N*/ BufferIndex = nRealStart;
+/*N*/
+/*N*/ bCont = FALSE;
+/*N*/ if ( aRes.TokenType == 0 &&
+/*N*/ nRealStart < nBufLen &&
+/*N*/ '\n' == BufferString.GetChar( nRealStart ) )
+/*N*/ {
+/*N*/ // keep data needed for tokens row and col entry up to date
+/*N*/ ++Row;
+/*N*/ BufferIndex = ColOff = nRealStart + 1;
+/*N*/ bCont = TRUE;
+/*N*/ }
+/*N*/ else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR)
+/*N*/ {
+/*N*/ String aName( BufferString.Copy( nRealStart, 2 ));
+/*N*/ if ( aName.EqualsAscii( "%%" ))
+/*N*/ {
+/*N*/ //SkipComment
+/*N*/ BufferIndex = nRealStart + 2;
+/*N*/ while (BufferIndex < nBufLen &&
+/*N*/ '\n' != BufferString.GetChar( BufferIndex ))
+/*N*/ ++BufferIndex;
+/*N*/ bCont = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ } while (bCont);
+/*N*/
+/*N*/ // set index of current token
+/*N*/ nTokenIndex = BufferIndex;
+/*N*/
+/*N*/ CurToken.nRow = Row;
+/*N*/ CurToken.nCol = nRealStart - ColOff + 1;
+/*N*/
+/*N*/ BOOL bHandled = TRUE;
+/*N*/ if (nRealStart >= nBufLen)
+/*N*/ {
+/*N*/ CurToken.eType = TEND;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.Erase();
+/*N*/ }
+/*N*/ else if ((aRes.TokenType & (KParseType::ASC_NUMBER | KParseType::UNI_NUMBER))
+/*N*/ || (bNumStart && (aRes.TokenType & KParseType::IDENTNAME)))
+/*N*/ {
+/*N*/ INT32 n = aRes.EndPos - nRealStart;
+/*N*/ DBG_ASSERT( n >= 0, "length < 0" );
+/*N*/ CurToken.eType = TNUMBER;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText = BufferString.Copy( nRealStart, (xub_StrLen) n );
+/*N*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ if (!IsDelimiter( BufferString, aRes.EndPos ))
+/*N*/ DBG_WARNING( "identifier really finished? (compatibility!)" );
+/*N*/ #endif
+/*N*/ }
+/*N*/ else if (aRes.TokenType & KParseType::DOUBLE_QUOTE_STRING)
+/*N*/ {
+/*N*/ CurToken.eType = TTEXT;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText = aRes.DequotedNameOrString;
+/*N*/ CurToken.nRow = Row;
+/*N*/ CurToken.nCol = nRealStart - ColOff + 2;
+/*N*/ }
+/*N*/ else if (aRes.TokenType & KParseType::IDENTNAME)
+/*N*/ {
+/*N*/ INT32 n = aRes.EndPos - nRealStart;
+/*N*/ DBG_ASSERT( n >= 0, "length < 0" );
+/*N*/ String aName( BufferString.Copy( nRealStart, (xub_StrLen) n ) );
+/*N*/ const SmTokenTableEntry *pEntry = GetTokenTableEntry( aName );
+/*N*/
+/*N*/ if (pEntry)
+/*N*/ {
+/*N*/ CurToken.eType = pEntry->eType;
+/*N*/ CurToken.cMathChar = pEntry->cMathChar;
+/*N*/ CurToken.nGroup = pEntry->nGroup;
+/*N*/ CurToken.nLevel = pEntry->nLevel;
+/*N*/ CurToken.aText.AssignAscii( pEntry->pIdent );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ CurToken.eType = TIDENT;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText = aName;
+/*N*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ if (!IsDelimiter( BufferString, aRes.EndPos ))
+/*N*/ DBG_WARNING( "identifier really finished? (compatibility!)" );
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/ else if (aRes.TokenType == 0 && '_' == BufferString.GetChar( nRealStart ))
+/*N*/ {
+/*N*/ CurToken.eType = TRSUB;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = TGPOWER;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "_" );
+/*N*/
+/*N*/ aRes.EndPos = nRealStart + 1;
+/*N*/ }
+/*N*/ else if (aRes.TokenType & KParseType::BOOLEAN)
+/*N*/ {
+/*N*/ sal_Int32 &rnEndPos = aRes.EndPos;
+/*N*/ String aName( BufferString.Copy( nRealStart, rnEndPos - nRealStart ) );
+/*N*/ if (2 >= aName.Len())
+/*N*/ {
+/*N*/ sal_Unicode ch = aName.GetChar( 0 );
+/*N*/ switch (ch)
+/*N*/ {
+/*N*/ case '<':
+/*N*/ {
+/*N*/ if (BufferString.Copy( nRealStart, 2 ).
+/*N*/ EqualsAscii( "<<" ))
+/*N*/ {
+/*N*/ CurToken.eType = TLL;
+/*N*/ CurToken.cMathChar = MS_LL;
+/*N*/ CurToken.nGroup = TGRELATION;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "<<" );
+/*N*/
+/*N*/ rnEndPos = nRealStart + 2;
+/*N*/ }
+/*N*/ else if (BufferString.Copy( nRealStart, 2 ).
+/*N*/ EqualsAscii( "<=" ))
+/*N*/ {
+/*N*/ CurToken.eType = TLE;
+/*N*/ CurToken.cMathChar = MS_LE;
+/*N*/ CurToken.nGroup = TGRELATION;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "<=" );
+/*N*/
+/*N*/ rnEndPos = nRealStart + 2;
+/*N*/ }
+/*N*/ else if (BufferString.Copy( nRealStart, 2 ).
+/*N*/ EqualsAscii( "<>" ))
+/*N*/ {
+/*N*/ CurToken.eType = TNEQ;
+/*N*/ CurToken.cMathChar = MS_NEQ;
+/*N*/ CurToken.nGroup = TGRELATION;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "<>" );
+/*N*/
+/*N*/ rnEndPos = nRealStart + 2;
+/*N*/ }
+/*N*/ else if (BufferString.Copy( nRealStart, 3 ).
+/*N*/ EqualsAscii( "<?>" ))
+/*N*/ {
+/*N*/ CurToken.eType = TPLACE;
+/*N*/ CurToken.cMathChar = MS_PLACE;
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText.AssignAscii( "<?>" );
+/*N*/
+/*N*/ rnEndPos = nRealStart + 3;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ CurToken.eType = TLT;
+/*N*/ CurToken.cMathChar = MS_LT;
+/*N*/ CurToken.nGroup = TGRELATION;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "<" );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case '>':
+/*N*/ {
+/*N*/ if (BufferString.Copy( nRealStart, 2 ).
+/*N*/ EqualsAscii( ">=" ))
+/*N*/ {
+/*N*/ CurToken.eType = TGE;
+/*N*/ CurToken.cMathChar = MS_GE;
+/*N*/ CurToken.nGroup = TGRELATION;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( ">=" );
+/*N*/
+/*N*/ rnEndPos = nRealStart + 2;
+/*N*/ }
+/*N*/ else if (BufferString.Copy( nRealStart, 2 ).
+/*N*/ EqualsAscii( ">>" ))
+/*N*/ {
+/*N*/ CurToken.eType = TGG;
+/*N*/ CurToken.cMathChar = MS_GG;
+/*N*/ CurToken.nGroup = TGRELATION;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( ">>" );
+/*N*/
+/*N*/ rnEndPos = nRealStart + 2;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ CurToken.eType = TGT;
+/*N*/ CurToken.cMathChar = MS_GT;
+/*N*/ CurToken.nGroup = TGRELATION;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( ">" );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*N*/ bHandled = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR)
+/*N*/ {
+/*N*/ sal_Int32 &rnEndPos = aRes.EndPos;
+/*N*/ String aName( BufferString.Copy( nRealStart, rnEndPos - nRealStart ) );
+/*N*/
+/*N*/ if (1 == aName.Len())
+/*N*/ {
+/*N*/ sal_Unicode ch = aName.GetChar( 0 );
+/*N*/ switch (ch)
+/*N*/ {
+/*N*/ case '%':
+/*N*/ {
+/*N*/ //! modifies aRes.EndPos
+/*N*/
+/*N*/ DBG_ASSERT( rnEndPos >= nBufLen ||
+/*N*/ '%' != BufferString.GetChar( rnEndPos ),
+/*N*/ "unexpected comment start" );
+/*N*/
+/*N*/ // get identifier of user-defined character
+/*N*/ ParseResult aTmpRes = rCC.parseAnyToken(
+/*N*/ BufferString, rnEndPos,
+/*N*/ KParseTokens::ANY_LETTER,
+/*N*/ aEmptyStr,
+/*N*/ coContFlags,
+/*N*/ aEmptyStr );
+/*N*/
+/*N*/ xub_StrLen nTmpStart = rnEndPos +
+/*N*/ (xub_StrLen) aTmpRes.LeadingWhiteSpace;
+/*N*/
+/*N*/ // default setting fo the case that no identifier
+/*N*/ // i.e. a valid symbol-name is following the '%'
+/*N*/ // character
+/*N*/ CurToken.eType = TTEXT;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText = String();
+/*N*/ CurToken.nRow = Row;
+/*N*/ CurToken.nCol = nTmpStart - ColOff + 1;
+/*N*/
+/*N*/ if (aTmpRes.TokenType & KParseType::IDENTNAME)
+/*N*/ {
+/*N*/
+/*N*/ INT32 n = aTmpRes.EndPos - nTmpStart;
+/*N*/ CurToken.eType = TSPECIAL;
+/*N*/ CurToken.aText = BufferString.Copy( nTmpStart, n );
+/*N*/
+/*N*/ DBG_ASSERT( aTmpRes.EndPos > rnEndPos,
+/*N*/ "empty identifier" );
+/*N*/ if (aTmpRes.EndPos > rnEndPos)
+/*N*/ rnEndPos = aTmpRes.EndPos;
+/*N*/ else
+/*N*/ ++rnEndPos;
+/*N*/ }
+/*N*/
+/*N*/ // if no symbol-name was found we start-over with
+/*N*/ // finding the next token right afer the '%' sign.
+/*N*/ // I.e. we leave rnEndPos unmodified.
+/*N*/ }
+/*N*/ break;
+/*N*/ case '[':
+/*N*/ {
+/*N*/ CurToken.eType = TLBRACKET;
+/*N*/ CurToken.cMathChar = MS_LBRACKET;
+/*N*/ CurToken.nGroup = TGLBRACES;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText.AssignAscii( "[" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '\\':
+/*N*/ {
+/*N*/ CurToken.eType = TESCAPE;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText.AssignAscii( "\\" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case ']':
+/*N*/ {
+/*N*/ CurToken.eType = TRBRACKET;
+/*N*/ CurToken.cMathChar = MS_RBRACKET;
+/*N*/ CurToken.nGroup = TGRBRACES;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "]" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '^':
+/*N*/ {
+/*N*/ CurToken.eType = TRSUP;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = TGPOWER;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "^" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '`':
+/*N*/ {
+/*N*/ CurToken.eType = TSBLANK;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = TGBLANK;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText.AssignAscii( "`" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '{':
+/*N*/ {
+/*N*/ CurToken.eType = TLGROUP;
+/*N*/ CurToken.cMathChar = MS_LBRACE;
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText.AssignAscii( "{" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '|':
+/*N*/ {
+/*N*/ CurToken.eType = TOR;
+/*N*/ CurToken.cMathChar = MS_OR;
+/*N*/ CurToken.nGroup = TGSUM;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "|" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '}':
+/*N*/ {
+/*N*/ CurToken.eType = TRGROUP;
+/*N*/ CurToken.cMathChar = MS_RBRACE;
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "}" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '~':
+/*N*/ {
+/*N*/ CurToken.eType = TBLANK;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = TGBLANK;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText.AssignAscii( "~" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '#':
+/*N*/ {
+/*N*/ if (BufferString.Copy( nRealStart, 2 ).
+/*N*/ EqualsAscii( "##" ))
+/*N*/ {
+/*N*/ CurToken.eType = TDPOUND;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "##" );
+/*N*/
+/*N*/ rnEndPos = nRealStart + 2;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ CurToken.eType = TPOUND;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "#" );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case '&':
+/*N*/ {
+/*N*/ CurToken.eType = TAND;
+/*N*/ CurToken.cMathChar = MS_AND;
+/*N*/ CurToken.nGroup = TGPRODUCT;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "&" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '(':
+/*N*/ {
+/*N*/ CurToken.eType = TLPARENT;
+/*N*/ CurToken.cMathChar = MS_LPARENT;
+/*N*/ CurToken.nGroup = TGLBRACES;
+/*N*/ CurToken.nLevel = 5; //! 0 to continue expression
+/*N*/ CurToken.aText.AssignAscii( "(" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case ')':
+/*N*/ {
+/*N*/ CurToken.eType = TRPARENT;
+/*N*/ CurToken.cMathChar = MS_RPARENT;
+/*N*/ CurToken.nGroup = TGRBRACES;
+/*N*/ CurToken.nLevel = 0; //! 0 to terminate expression
+/*N*/ CurToken.aText.AssignAscii( ")" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '*':
+/*N*/ {
+/*N*/ CurToken.eType = TMULTIPLY;
+/*N*/ CurToken.cMathChar = MS_MULTIPLY;
+/*N*/ CurToken.nGroup = TGPRODUCT;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "*" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '+':
+/*N*/ {
+/*N*/ if (BufferString.Copy( nRealStart, 2 ).
+/*N*/ EqualsAscii( "+-" ))
+/*N*/ {
+/*N*/ CurToken.eType = TPLUSMINUS;
+/*N*/ CurToken.cMathChar = MS_PLUSMINUS;
+/*N*/ CurToken.nGroup = TGUNOPER | TGSUM;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText.AssignAscii( "+-" );
+/*N*/
+/*N*/ rnEndPos = nRealStart + 2;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ CurToken.eType = TPLUS;
+/*N*/ CurToken.cMathChar = MS_PLUS;
+/*N*/ CurToken.nGroup = TGUNOPER | TGSUM;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText.AssignAscii( "+" );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case '-':
+/*N*/ {
+/*N*/ if (BufferString.Copy( nRealStart, 2 ).
+/*N*/ EqualsAscii( "-+" ))
+/*N*/ {
+/*N*/ CurToken.eType = TMINUSPLUS;
+/*N*/ CurToken.cMathChar = MS_MINUSPLUS;
+/*N*/ CurToken.nGroup = TGUNOPER | TGSUM;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText.AssignAscii( "-+" );
+/*N*/
+/*N*/ rnEndPos = nRealStart + 2;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ CurToken.eType = TMINUS;
+/*N*/ CurToken.cMathChar = MS_MINUS;
+/*N*/ CurToken.nGroup = TGUNOPER | TGSUM;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText.AssignAscii( "-" );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case '.':
+/*N*/ {
+/*N*/ // for compatibility with SO5.2
+/*N*/ // texts like .34 ...56 ... h ...78..90
+/*N*/ // will be treated as numbers
+/*N*/ CurToken.eType = TNUMBER;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 5;
+/*N*/
+/*N*/ xub_StrLen nTxtStart = BufferIndex;
+/*N*/ sal_Unicode cChar;
+/*N*/ do
+/*N*/ {
+/*N*/ cChar = BufferString.GetChar( ++BufferIndex );
+/*N*/ }
+/*N*/ while ( cChar == '.' || ('0' <= cChar && cChar <= '9') );
+/*N*/
+/*N*/ CurToken.aText = BufferString.Copy( nTxtStart, BufferIndex - nTxtStart );
+/*N*/ aRes.EndPos = BufferIndex;
+/*N*/ }
+/*N*/ break;
+/*N*/ case '/':
+/*N*/ {
+/*N*/ CurToken.eType = TDIVIDEBY;
+/*N*/ CurToken.cMathChar = MS_SLASH;
+/*N*/ CurToken.nGroup = TGPRODUCT;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "/" );
+/*N*/ }
+/*N*/ break;
+/*N*/ case '=':
+/*N*/ {
+/*N*/ CurToken.eType = TASSIGN;
+/*N*/ CurToken.cMathChar = MS_ASSIGN;
+/*N*/ CurToken.nGroup = TGRELATION;
+/*N*/ CurToken.nLevel = 0;
+/*N*/ CurToken.aText.AssignAscii( "=" );
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*N*/ bHandled = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ bHandled = FALSE;
+/*N*/
+/*N*/ if (!bHandled)
+/*N*/ {
+/*N*/ CurToken.eType = TCHARACTER;
+/*N*/ CurToken.cMathChar = '\0';
+/*N*/ CurToken.nGroup = 0;
+/*N*/ CurToken.nLevel = 5;
+/*N*/ CurToken.aText = BufferString.Copy( nRealStart, 1 );
+/*N*/
+/*N*/ aRes.EndPos = nRealStart + 1;
+/*N*/ }
+/*N*/
+/*N*/ if (TEND != CurToken.eType)
+/*N*/ BufferIndex = (xub_StrLen)aRes.EndPos;
+/*N*/ }
+/*N*/
+/*N*/
+////////////////////////////////////////
+// grammar
+//
+
+
+/*N*/ void SmParser::Table()
+/*N*/ {
+/*N*/ SmNodeArray LineArray;
+/*N*/
+/*N*/ Line();
+/*N*/ while (CurToken.eType == TNEWLINE)
+/*N*/ {
+/*N*/ NextToken();
+/*N*/ Line();
+/*N*/ }
+/*N*/
+/*N*/ if (CurToken.eType != TEND)
+/*?*/ Error(PE_UNEXPECTED_CHAR);
+/*N*/
+/*N*/ ULONG n = NodeStack.Count();
+/*N*/
+/*N*/ LineArray.SetSize(n);
+/*N*/
+/*N*/ for (ULONG i = 0; i < n; i++)
+/*N*/ LineArray.Put(n - (i + 1), NodeStack.Pop());
+/*N*/
+/*N*/ SmStructureNode *pSNode = new SmTableNode(CurToken);
+/*N*/ pSNode->SetSubNodes(LineArray);
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+
+
+/*N*/ void SmParser::Align()
+/*N*/ // parse alignment info (if any), then go on with rest of expression
+/*N*/ {
+/*N*/ SmStructureNode *pSNode = 0;
+/*N*/ BOOL bNeedGroupClose = FALSE;
+/*N*/
+/*N*/ if (TokenInGroup(TGALIGN))
+/*N*/ {
+/*?*/ if (CONVERT_40_TO_50 == GetConversion())
+/*?*/ // 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 (CONVERT_40_TO_50 != GetConversion() && TokenInGroup(TGALIGN))
+/*?*/ { Error(PE_DOUBLE_ALIGN);
+/*?*/ return;
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/
+/*N*/ Expression();
+/*N*/
+/*N*/ if (bNeedGroupClose)
+/*?*/ Insert('}', GetTokenIndex());
+/*N*/
+/*N*/ if (pSNode)
+/*?*/ { pSNode->SetSubNodes(NodeStack.Pop(), 0);
+/*?*/ NodeStack.Push(pSNode);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmParser::Line()
+/*N*/ {
+/*N*/ USHORT n = 0;
+/*N*/ SmNodeArray ExpressionArray;
+/*N*/
+/*N*/ ExpressionArray.SetSize(n);
+/*N*/
+/*N*/ // start with single expression that may have an alignment statement
+/*N*/ // (and go on with expressions that must not have alignment
+/*N*/ // statements in 'while' loop below. See also 'Expression()'.)
+/*N*/ if (CurToken.eType != TEND && CurToken.eType != TNEWLINE)
+/*N*/ { Align();
+/*N*/ ExpressionArray.SetSize(++n);
+/*N*/ ExpressionArray.Put(n - 1, NodeStack.Pop());
+/*N*/ }
+/*N*/
+/*N*/ while (CurToken.eType != TEND && CurToken.eType != TNEWLINE)
+/*N*/ { if (CONVERT_40_TO_50 != GetConversion())
+/*N*/ Expression();
+/*N*/ else
+/*?*/ Align();
+/*N*/ ExpressionArray.SetSize(++n);
+/*N*/ ExpressionArray.Put(n - 1, NodeStack.Pop());
+/*N*/ }
+/*N*/
+/*N*/ SmStructureNode *pSNode = new SmLineNode(CurToken);
+/*N*/ pSNode->SetSubNodes(ExpressionArray);
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+
+
+/*N*/ void SmParser::Expression()
+/*N*/ {
+/*N*/ USHORT n = 0;
+/*N*/ SmNodeArray RelationArray;
+/*N*/
+/*N*/ RelationArray.SetSize(n);
+/*N*/
+/*N*/ Relation();
+/*N*/ RelationArray.SetSize(++n);
+/*N*/ RelationArray.Put(n - 1, NodeStack.Pop());
+/*N*/
+/*N*/ while (CurToken.nLevel >= 4)
+/*N*/ { Relation();
+/*N*/ RelationArray.SetSize(++n);
+/*N*/ RelationArray.Put(n - 1, NodeStack.Pop());
+/*N*/ }
+/*N*/
+/*N*/ SmStructureNode *pSNode = new SmExpressionNode(CurToken);
+/*N*/ pSNode->SetSubNodes(RelationArray);
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+
+
+/*N*/ void SmParser::Relation()
+/*N*/ {
+/*N*/ Sum();
+/*N*/ while (TokenInGroup(TGRELATION))
+/*N*/ {
+/*N*/ SmStructureNode *pSNode = new SmBinHorNode(CurToken);
+/*N*/ SmNode *pFirst = NodeStack.Pop();
+/*N*/
+/*N*/ OpSubSup();
+/*N*/ SmNode *pSecond = NodeStack.Pop();
+/*N*/
+/*N*/ Sum();
+/*N*/
+/*N*/ pSNode->SetSubNodes(pFirst, pSecond, NodeStack.Pop());
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmParser::Sum()
+/*N*/ {
+/*N*/ Product();
+/*N*/ while (TokenInGroup(TGSUM))
+/*N*/ {
+/*N*/ SmStructureNode *pSNode = new SmBinHorNode(CurToken);
+/*N*/ SmNode *pFirst = NodeStack.Pop();
+/*N*/
+/*N*/ OpSubSup();
+/*N*/ SmNode *pSecond = NodeStack.Pop();
+/*N*/
+/*N*/ Product();
+/*N*/
+/*N*/ pSNode->SetSubNodes(pFirst, pSecond, NodeStack.Pop());
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmParser::Product()
+/*N*/ {
+/*N*/ Power();
+/*N*/
+/*N*/ while (TokenInGroup(TGPRODUCT))
+/*N*/ { SmStructureNode *pSNode;
+/*N*/ SmNode *pFirst = NodeStack.Pop(),
+/*N*/ *pOper;
+/*N*/ BOOL bSwitchArgs = FALSE;
+/*N*/
+/*N*/ SmTokenType eType = CurToken.eType;
+/*N*/ switch (eType)
+/*N*/ {
+/*N*/ case TOVER:
+/*N*/ pSNode = new SmBinVerNode(CurToken);
+/*N*/ pOper = new SmRectangleNode(CurToken);
+/*N*/ NextToken();
+/*N*/ break;
+/*N*/
+/*N*/ case TBOPER:
+/*?*/ pSNode = new SmBinHorNode(CurToken);
+/*?*/
+/*?*/ NextToken();
+/*?*/
+/*?*/ GlyphSpecial();
+/*?*/ pOper = NodeStack.Pop();
+/*?*/ break;
+/*N*/
+/*N*/ case TOVERBRACE :
+/*N*/ case TUNDERBRACE :
+/*?*/ pSNode = new SmVerticalBraceNode(CurToken);
+/*?*/ pOper = new SmMathSymbolNode(CurToken);
+/*?*/ 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;
+/*?*/ }
+/*?*/
+/*N*/ default:
+/*N*/ pSNode = new SmBinHorNode(CurToken);
+/*N*/
+/*N*/ OpSubSup();
+/*N*/ pOper = NodeStack.Pop();
+/*N*/ }
+/*N*/
+/*N*/ Power();
+/*N*/
+/*N*/ if (bSwitchArgs)
+/*N*/ //! vgl siehe SmBinDiagonalNode::Arrange
+/*?*/ pSNode->SetSubNodes(pFirst, NodeStack.Pop(), pOper);
+/*N*/ else
+/*N*/ pSNode->SetSubNodes(pFirst, pOper, NodeStack.Pop());
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmParser::SubSup(ULONG nActiveGroup)
+/*N*/ {
+/*N*/ DBG_ASSERT(nActiveGroup == TGPOWER || nActiveGroup == TGLIMIT,
+/*N*/ "Sm: falsche Tokengruppe");
+/*N*/
+/*N*/ if (!TokenInGroup(nActiveGroup))
+/*N*/ // already finish
+/*N*/ return;
+/*N*/
+/*N*/ SmSubSupNode *pNode = new SmSubSupNode(CurToken);
+/*N*/ //! Of course 'CurToken' ist just the first sub-/supscript token.
+/*N*/ //! It should be of no further interest. The positions of the
+/*N*/ //! sub-/supscripts will be identified by the corresponding subnodes
+/*N*/ //! index in the 'aSubNodes' array (enum value from 'SmSubSup').
+/*N*/
+/*N*/ pNode->SetUseLimits(nActiveGroup == TGLIMIT);
+/*N*/
+/*N*/ // initialize subnodes array
+/*N*/ SmNodeArray aSubNodes;
+/*N*/ aSubNodes.SetSize(1 + SUBSUP_NUM_ENTRIES);
+/*N*/ aSubNodes.Put(0, NodeStack.Pop());
+/*N*/ for (USHORT i = 1; i < aSubNodes.GetSize(); i++)
+/*N*/ aSubNodes.Put(i, NULL);
+/*N*/
+/*N*/ // process all sub-/supscripts
+/*N*/ int nIndex = 0;
+/*N*/ while (TokenInGroup(nActiveGroup))
+/*N*/ { SmTokenType eType (CurToken.eType);
+/*N*/
+/*N*/ // skip sub-/supscript token
+/*N*/ NextToken();
+/*N*/
+/*N*/ // get sub-/supscript node on top of stack
+/*N*/ if (eType == TFROM || eType == TTO)
+/*N*/ {
+/*N*/ // parse limits in old 4.0 and 5.0 style
+/*N*/ Relation();
+/*N*/ }
+/*N*/ else
+/*N*/ Term();
+/*N*/
+/*N*/ switch (eType)
+/*N*/ { case TRSUB : nIndex = (int) RSUB; break;
+/*N*/ case TRSUP : nIndex = (int) RSUP; break;
+/*N*/ case TFROM :
+/*N*/ case TCSUB : nIndex = (int) CSUB; break;
+/*N*/ case TTO :
+/*N*/ case TCSUP : nIndex = (int) CSUP; break;
+/*N*/ case TLSUB : nIndex = (int) LSUB; break;
+/*N*/ case TLSUP : nIndex = (int) LSUP; break;
+/*N*/ default :
+/*N*/ DBG_ASSERT(FALSE, "Sm: unbekannter Fall");
+/*N*/ }
+/*N*/ nIndex++;
+/*N*/ DBG_ASSERT(1 <= nIndex && nIndex <= 1 + SUBSUP_NUM_ENTRIES,
+/*N*/ "SmParser::Power() : sub-/supscript index falsch");
+/*N*/
+/*N*/ // set sub-/supscript if not already done
+/*N*/ if (aSubNodes.Get(nIndex) != NULL)
+/*?*/ Error(PE_DOUBLE_SUBSUPSCRIPT);
+/*N*/ aSubNodes.Put(nIndex, NodeStack.Pop());
+/*N*/ }
+/*N*/
+/*N*/ pNode->SetSubNodes(aSubNodes);
+/*N*/ NodeStack.Push(pNode);
+/*N*/ }
+
+
+/*N*/ void SmParser::OpSubSup()
+/*N*/ {
+/*N*/ // push operator symbol
+/*N*/ NodeStack.Push(new SmMathSymbolNode(CurToken));
+/*N*/ // skip operator token
+/*N*/ NextToken();
+/*N*/ // get sub- supscripts if any
+/*N*/ if (TokenInGroup(TGPOWER))
+/*?*/ SubSup(TGPOWER);
+/*N*/ }
+
+
+/*N*/ void SmParser::Power()
+/*N*/ {
+/*N*/ // get body for sub- supscripts on top of stack
+/*N*/ Term();
+/*N*/
+/*N*/ SubSup(TGPOWER);
+/*N*/ }
+
+
+/*N*/ void SmParser::Blank()
+/*N*/ {
+/*N*/ DBG_ASSERT(TokenInGroup(TGBLANK), "Sm : falsches Token");
+/*N*/ SmBlankNode *pBlankNode = new SmBlankNode(CurToken);
+/*N*/
+/*N*/ while (TokenInGroup(TGBLANK))
+/*N*/ {
+/*N*/ pBlankNode->IncreaseBy(CurToken);
+/*N*/ NextToken();
+/*N*/ }
+/*N*/
+/*N*/ // Blanks am Zeilenende ignorieren wenn die entsprechende Option gesetzt ist
+/*N*/ if (CurToken.eType == TNEWLINE || CurToken.eType == TEND
+/*N*/ && SM_MOD1()->GetConfig()->IsIgnoreSpacesRight())
+/*?*/ pBlankNode->Clear();
+/*N*/
+/*N*/ NodeStack.Push(pBlankNode);
+/*N*/ }
+
+
+/*N*/ void SmParser::Term()
+/*N*/ {
+/*N*/ switch (CurToken.eType)
+/*N*/ { case TESCAPE :
+/*N*/ Escape();
+/*N*/ break;
+/*N*/
+/*N*/ case TLGROUP :
+/*N*/ NextToken();
+/*N*/
+/*N*/ // allow for empty group
+/*N*/ if (CurToken.eType == TRGROUP)
+/*N*/ { SmStructureNode *pSNode = new SmExpressionNode(CurToken);
+/*N*/ pSNode->SetSubNodes(NULL, NULL);
+/*N*/ NodeStack.Push(pSNode);
+/*N*/
+/*N*/ NextToken();
+/*N*/ }
+/*N*/ else // go as usual
+/*N*/ { Align();
+/*N*/ if (CurToken.eType != TRGROUP)
+/*N*/ Error(PE_RGROUP_EXPECTED);
+/*N*/ else
+/*N*/ { NextToken();
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case TLEFT :
+/*N*/ Brace();
+/*N*/ break;
+/*N*/
+/*N*/ case TBLANK :
+/*N*/ case TSBLANK :
+/*N*/ Blank();
+/*N*/ break;
+/*N*/
+/*N*/ case TTEXT :
+/*N*/ NodeStack.Push(new SmTextNode(CurToken, FNT_TEXT));
+/*N*/ NextToken();
+/*N*/ break;
+/*N*/ case TIDENT :
+/*N*/ case TCHARACTER :
+/*N*/ NodeStack.Push(new SmTextNode(CurToken, FNT_VARIABLE));
+/*N*/ NextToken();
+/*N*/ break;
+/*N*/ case TNUMBER :
+/*N*/ NodeStack.Push(new SmTextNode(CurToken, FNT_NUMBER));
+/*N*/ NextToken();
+/*N*/ break;
+/*N*/
+/*N*/ case TLEFTARROW :
+/*N*/ case TRIGHTARROW :
+/*N*/ case TUPARROW :
+/*N*/ case TDOWNARROW :
+/*N*/ case TSETN :
+/*N*/ case TSETZ :
+/*N*/ case TSETQ :
+/*N*/ case TSETR :
+/*N*/ case TSETC :
+/*N*/ case THBAR :
+/*N*/ case TLAMBDABAR :
+/*N*/ case TCIRC :
+/*N*/ case TDRARROW :
+/*N*/ case TDLARROW :
+/*N*/ case TDLRARROW :
+/*N*/ case TBACKEPSILON :
+/*N*/ case TALEPH :
+/*N*/ case TIM :
+/*N*/ case TRE :
+/*N*/ case TWP :
+/*N*/ case TEMPTYSET :
+/*N*/ case TINFINITY :
+/*N*/ case TEXISTS :
+/*N*/ case TFORALL :
+/*N*/ case TPARTIAL :
+/*N*/ case TNABLA :
+/*N*/ case TTOWARD :
+/*N*/ case TDOTSAXIS :
+/*N*/ case TDOTSDIAG :
+/*N*/ case TDOTSDOWN :
+/*N*/ case TDOTSLOW :
+/*N*/ case TDOTSUP :
+/*N*/ case TDOTSVERT :
+/*N*/ NodeStack.Push(new SmMathSymbolNode(CurToken));
+/*N*/ NextToken();
+/*N*/ break;
+/*N*/
+/*N*/ case TPLACE:
+/*N*/ NodeStack.Push(new SmPlaceNode(CurToken));
+/*N*/ NextToken();
+/*N*/ break;
+/*N*/
+/*N*/ case TSPECIAL:
+/*N*/ Special();
+/*N*/ break;
+/*N*/
+/*N*/ case TBINOM:
+/*N*/ Binom(); // matrixfett.smf
+/*N*/ break;
+/*N*/
+/*N*/ case TSTACK:
+/*N*/ Stack(); // matrixfett.smf
+/*?*/ break;
+/*N*/
+/*N*/ case TMATRIX:
+/*N*/ Matrix();
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ if (TokenInGroup(TGLBRACES))
+/*N*/ { Brace();
+/*N*/ }
+/*N*/ else if (TokenInGroup(TGOPER))
+/*N*/ { Operator();
+/*N*/ }
+/*N*/ else if (TokenInGroup(TGUNOPER))
+/*N*/ { UnOper();
+/*N*/ }
+/*N*/ else if ( TokenInGroup(TGATTRIBUT)
+/*N*/ || TokenInGroup(TGFONTATTR))
+/*N*/ { SmStructureNodeArray aArray;
+/*N*/
+/*N*/ BOOL bIsAttr;
+/*N*/ USHORT n = 0;
+/*N*/ while ((bIsAttr = TokenInGroup(TGATTRIBUT))
+/*N*/ || TokenInGroup(TGFONTATTR))
+/*N*/ { aArray.SetSize(n + 1);
+/*N*/
+/*N*/ if (bIsAttr)
+/*N*/ Attribut();
+/*N*/ else
+/*N*/ FontAttribut();
+/*N*/
+/*N*/ // check if casting in following line is ok
+/*N*/ DBG_ASSERT(!NodeStack.Top()->IsVisible(), "Sm : Ooops...");
+/*N*/
+/*N*/ aArray.Put(n, (SmStructureNode *) NodeStack.Pop());
+/*N*/ n++;
+/*N*/ }
+/*N*/
+/*N*/ Power();
+/*N*/
+/*N*/ SmNode *pFirstNode = NodeStack.Pop();
+/*N*/ while (n > 0)
+/*N*/ { aArray.Get(n - 1)->SetSubNodes(0, pFirstNode);
+/*N*/ pFirstNode = aArray.Get(n - 1);
+/*N*/ n--;
+/*N*/ }
+/*N*/ NodeStack.Push(pFirstNode);
+/*N*/ }
+/*N*/ else if (TokenInGroup(TGFUNCTION))
+/*N*/ { if (CONVERT_40_TO_50 != GetConversion())
+/*N*/ { Function();
+/*N*/ }
+/*N*/ else // encapsulate old 4.0 style parsing in braces
+/*N*/ {
+/*N*/ // insert opening brace
+/*N*/ Insert('{', GetTokenIndex());
+/*N*/
+/*N*/ //
+/*N*/ // parse in 4.0 style
+/*N*/ //
+/*N*/ Function();
+/*N*/
+/*N*/ SmNode *pFunc = NodeStack.Pop();
+/*N*/
+/*N*/ if (CurToken.eType == TLPARENT)
+/*?*/ { Term();
+/*N*/ }
+/*N*/ else
+/*N*/ { Align();
+/*N*/ }
+/*N*/
+/*N*/ // insert closing brace
+/*N*/ Insert('}', GetTokenIndex());
+/*N*/
+/*N*/ SmStructureNode *pSNode = new SmExpressionNode(pFunc->GetToken());
+/*N*/ pSNode->SetSubNodes(pFunc, NodeStack.Pop());
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ Error(PE_UNEXPECTED_CHAR);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmParser::Escape()
+/*N*/ {
+/*N*/ NextToken();
+/*N*/
+/*N*/ sal_Unicode cChar;
+/*N*/ switch (CurToken.eType)
+/*N*/ { case TLPARENT : cChar = MS_LPARENT; break;
+/*N*/ case TRPARENT : cChar = MS_RPARENT; break;
+/*N*/ case TLBRACKET : cChar = MS_LBRACKET; break;
+/*N*/ case TRBRACKET : cChar = MS_RBRACKET; break;
+/*N*/ case TLDBRACKET : cChar = MS_LDBRACKET; break;
+/*N*/ case TRDBRACKET : cChar = MS_RDBRACKET; break;
+/*N*/ case TLBRACE :
+/*N*/ case TLGROUP : cChar = MS_LBRACE; break;
+/*N*/ case TRBRACE :
+/*N*/ case TRGROUP : cChar = MS_RBRACE; break;
+/*N*/ case TLANGLE : cChar = MS_LANGLE; break;
+/*N*/ case TRANGLE : cChar = MS_RANGLE; break;
+/*N*/ case TLCEIL : cChar = MS_LCEIL; break;
+/*N*/ case TRCEIL : cChar = MS_RCEIL; break;
+/*N*/ case TLFLOOR : cChar = MS_LFLOOR; break;
+/*N*/ case TRFLOOR : cChar = MS_RFLOOR; break;
+/*N*/ case TLLINE :
+/*N*/ case TRLINE : cChar = MS_LINE; break;
+/*N*/ case TLDLINE :
+/*N*/ case TRDLINE : cChar = MS_DLINE; break;
+/*N*/ default:
+/*N*/ Error(PE_UNEXPECTED_TOKEN);
+/*N*/ }
+/*N*/
+/*N*/ SmNode *pNode = new SmMathSymbolNode(CurToken);
+/*N*/ NodeStack.Push(pNode);
+/*N*/
+/*N*/ NextToken();
+/*N*/ }
+
+
+/*N*/ void SmParser::Operator()
+/*N*/ {
+/*N*/ if (TokenInGroup(TGOPER))
+/*N*/ { SmStructureNode *pSNode = new SmOperNode(CurToken);
+/*N*/
+/*N*/ // put operator on top of stack
+/*N*/ Oper();
+/*N*/
+/*N*/ if (TokenInGroup(TGLIMIT) || TokenInGroup(TGPOWER))
+/*N*/ SubSup(CurToken.nGroup);
+/*N*/ SmNode *pOperator = NodeStack.Pop();
+/*N*/
+/*N*/ // get argument
+/*N*/ Power();
+/*N*/
+/*N*/ pSNode->SetSubNodes(pOperator, NodeStack.Pop());
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmParser::Oper()
+/*N*/ {
+/*N*/ SmTokenType eType (CurToken.eType);
+/*N*/ SmNode *pNode = NULL;
+/*N*/
+/*N*/ switch (eType)
+/*N*/ {
+/*N*/ case TSUM :
+/*N*/ case TPROD :
+/*N*/ case TCOPROD :
+/*N*/ case TINT :
+/*N*/ case TIINT :
+/*N*/ case TIIINT :
+/*N*/ case TLINT :
+/*N*/ case TLLINT :
+/*N*/ case TLLLINT :
+/*N*/ pNode = new SmMathSymbolNode(CurToken);
+/*N*/ break;
+/*N*/
+/*N*/ case TLIM :
+/*N*/ case TLIMSUP :
+/*N*/ case TLIMINF :
+/*N*/ {
+/*N*/ const sal_Char* pLim = 0;
+/*N*/ switch (eType)
+/*N*/ {
+/*N*/ case TLIM : pLim = "lim"; break;
+/*N*/ case TLIMSUP : pLim = "lim sup"; break;
+/*N*/ case TLIMINF : pLim = "lim inf"; break;
+/*N*/ }
+/*N*/ if( pLim )
+/*N*/ CurToken.aText.AssignAscii( pLim );
+/*N*/ pNode = new SmTextNode(CurToken, FNT_TEXT);
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case TOVERBRACE :
+/*N*/ case TUNDERBRACE :
+/*N*/ pNode = new SmMathSymbolNode(CurToken);
+/*N*/ break;
+/*N*/
+/*N*/ case TOPER :
+/*?*/ NextToken();
+/*N*/
+/*?*/ DBG_ASSERT(CurToken.eType == TSPECIAL, "Sm: falsches Token");
+/*?*/ pNode = new SmGlyphSpecialNode(CurToken);
+/*?*/ break;
+/*N*/
+/*N*/ default :
+/*N*/ DBG_ASSERT(0, "Sm: unbekannter Fall");
+/*N*/ }
+/*N*/ NodeStack.Push(pNode);
+/*N*/
+/*N*/ NextToken();
+/*N*/ }
+
+
+/*N*/ void SmParser::UnOper()
+/*N*/ {
+/*N*/ DBG_ASSERT(TokenInGroup(TGUNOPER), "Sm: falsches Token");
+/*N*/
+/*N*/ SmToken aNodeToken = CurToken;
+/*N*/ SmTokenType eType = CurToken.eType;
+/*N*/ BOOL bIsPostfix = eType == TFACT;
+/*N*/
+/*N*/ SmStructureNode *pSNode;
+/*N*/ SmNode *pOper,
+/*N*/ *pExtra = 0,
+/*N*/ *pArg;
+/*N*/
+/*N*/ switch (eType)
+/*N*/ {
+/*N*/ case TABS :
+/*N*/ case TSQRT :
+/*N*/ NextToken();
+/*N*/ break;
+/*N*/
+/*N*/ case TNROOT :
+/*N*/ NextToken();
+/*N*/ Power();
+/*N*/ pExtra = NodeStack.Pop();
+/*N*/ break;
+/*N*/
+/*N*/ case TUOPER :
+/*?*/ NextToken();
+/*?*/ GlyphSpecial();
+/*?*/ pOper = NodeStack.Pop();
+/*?*/ break;
+/*N*/
+/*N*/ case TPLUS :
+/*N*/ case TMINUS :
+/*N*/ case TPLUSMINUS :
+/*N*/ case TMINUSPLUS :
+/*N*/ case TNEG :
+/*N*/ case TFACT :
+/*N*/ OpSubSup();
+/*N*/ pOper = NodeStack.Pop();
+/*N*/ break;
+/*N*/
+/*N*/ default :
+/*N*/ Error(PE_UNOPER_EXPECTED);
+/*N*/ }
+/*N*/
+/*N*/ // get argument
+/*N*/ Power();
+/*N*/ pArg = NodeStack.Pop();
+/*N*/
+/*N*/ if (eType == TABS)
+/*N*/ { pSNode = new SmBraceNode(aNodeToken);
+/*N*/ pSNode->SetScaleMode(SCALE_HEIGHT);
+/*N*/
+/*N*/ // build nodes for left & right lines
+/*N*/ // (text, group, level of the used token are of no interrest here)
+/*N*/ // we'll use row & column of the keyword for abs
+/*N*/ aNodeToken.eType = TABS;
+/*N*/ //
+/*N*/ aNodeToken.cMathChar = MS_LINE;
+/*N*/ SmNode* pLeft = new SmMathSymbolNode(aNodeToken);
+/*N*/ //
+/*N*/ aNodeToken.cMathChar = MS_LINE;
+/*N*/ SmNode* pRight = new SmMathSymbolNode(aNodeToken);
+/*N*/
+/*N*/ pSNode->SetSubNodes(pLeft, pArg, pRight);
+/*N*/ }
+/*N*/ else if (eType == TSQRT || eType == TNROOT)
+/*N*/ { pSNode = new SmRootNode(aNodeToken);
+/*N*/ pOper = new SmRootSymbolNode(aNodeToken);
+/*N*/ pSNode->SetSubNodes(pExtra, pOper, pArg);
+/*N*/ }
+/*N*/ else
+/*N*/ { pSNode = new SmUnHorNode(aNodeToken);
+/*N*/
+/*N*/ if (bIsPostfix)
+/*N*/ pSNode->SetSubNodes(pArg, pOper);
+/*N*/ else
+/*N*/ // prefix operator
+/*N*/ pSNode->SetSubNodes(pOper, pArg);
+/*N*/ }
+/*N*/
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+
+
+/*N*/ void SmParser::Attribut()
+/*N*/ {
+/*N*/ DBG_ASSERT(TokenInGroup(TGATTRIBUT), "Sm: falsche Tokengruppe");
+/*N*/
+/*N*/ SmStructureNode *pSNode = new SmAttributNode(CurToken);
+/*N*/ SmNode *pAttr;
+/*N*/ SmScaleMode eScaleMode = SCALE_NONE;
+/*N*/
+/*N*/ // get appropriate node for the attribut itself
+/*N*/ switch (CurToken.eType)
+/*N*/ { case TUNDERLINE :
+/*N*/ case TOVERLINE :
+/*N*/ case TOVERSTRIKE :
+/*?*/ pAttr = new SmRectangleNode(CurToken);
+/*?*/ eScaleMode = SCALE_WIDTH;
+/*?*/ break;
+/*N*/
+/*N*/ case TWIDEVEC :
+/*N*/ case TWIDEHAT :
+/*N*/ case TWIDETILDE :
+/*N*/ pAttr = new SmMathSymbolNode(CurToken);
+/*N*/ eScaleMode = SCALE_WIDTH;
+/*?*/ break;
+/*N*/
+/*N*/ default :
+/*N*/ pAttr = new SmMathSymbolNode(CurToken);
+/*N*/ }
+/*N*/
+/*N*/ NextToken();
+/*N*/
+/*N*/ pSNode->SetSubNodes(pAttr, 0);
+/*N*/ pSNode->SetScaleMode(eScaleMode);
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+
+
+/*N*/ void SmParser::FontAttribut()
+/*N*/ {
+/*N*/ DBG_ASSERT(TokenInGroup(TGFONTATTR), "Sm: falsche Tokengruppe");
+/*N*/
+/*N*/ switch (CurToken.eType)
+/*N*/ {
+/*N*/ case TITALIC :
+/*N*/ case TNITALIC :
+/*N*/ case TBOLD :
+/*N*/ case TNBOLD :
+/*N*/ case TPHANTOM :
+/*N*/ NodeStack.Push(new SmFontNode(CurToken));
+/*N*/ NextToken();
+/*N*/ break;
+/*N*/
+/*N*/ case TSIZE :
+/*N*/ FontSize();
+/*N*/ break;
+/*N*/
+/*N*/ case TFONT :
+/*N*/ Font();
+/*N*/ break;
+/*N*/
+/*N*/ case TCOLOR :
+/*N*/ Color();
+/*N*/ break;
+/*N*/
+/*N*/ default :
+/*N*/ DBG_ASSERT(0, "Sm: unbekannter Fall");
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmParser::Color()
+/*N*/ {
+/*N*/ DBG_ASSERT(CurToken.eType == TCOLOR, "Sm : Ooops...");
+/*N*/
+/*N*/ // last color rules, get that one
+/*N*/ SmToken aToken;
+/*N*/ do
+/*N*/ { NextToken();
+/*N*/
+/*N*/ if (TokenInGroup(TGCOLOR))
+/*N*/ { aToken = CurToken;
+/*N*/ NextToken();
+/*N*/ }
+/*N*/ else
+/*N*/ Error(PE_COLOR_EXPECTED);
+/*N*/ } while (CurToken.eType == TCOLOR);
+/*N*/
+/*N*/ NodeStack.Push(new SmFontNode(aToken));
+/*N*/ }
+
+
+/*N*/ void SmParser::Font()
+/*N*/ {
+/*N*/ DBG_ASSERT(CurToken.eType == TFONT, "Sm : Ooops...");
+/*N*/
+/*N*/ // last font rules, get that one
+/*N*/ SmToken aToken;
+/*N*/ do
+/*N*/ { NextToken();
+/*N*/
+/*N*/ if (TokenInGroup(TGFONT))
+/*N*/ { aToken = CurToken;
+/*N*/ NextToken();
+/*N*/ }
+/*N*/ else
+/*N*/ Error(PE_FONT_EXPECTED);
+/*N*/ } while (CurToken.eType == TFONT);
+/*N*/
+/*N*/ NodeStack.Push(new SmFontNode(aToken));
+/*N*/ }
+/*N*/ BOOL lcl_IsNumber(const UniString& rText)
+/*N*/ {
+/*N*/ BOOL bPoint = FALSE;
+/*N*/ const sal_Unicode* pBuffer = rText.GetBuffer();
+/*N*/ for(xub_StrLen nPos = 0; nPos < rText.Len(); nPos++, pBuffer++)
+/*N*/ {
+/*N*/ const sal_Unicode cChar = *pBuffer;
+/*N*/ if(cChar == '.')
+/*N*/ {
+/*N*/ if(bPoint)
+/*N*/ return FALSE;
+/*N*/ else
+/*N*/ bPoint = TRUE;
+/*N*/ }
+/*N*/ else if ( (cChar < 48) || (cChar > 57) )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ void SmParser::FontSize()
+/*N*/ {
+/*N*/ DBG_ASSERT(CurToken.eType == TSIZE, "Sm : Ooops...");
+/*N*/
+/*N*/ USHORT Type;
+/*N*/ SmFontNode *pFontNode = new SmFontNode(CurToken);
+/*N*/
+/*N*/ NextToken();
+/*N*/
+/*N*/ switch (CurToken.eType)
+/*N*/ {
+/*N*/ case TNUMBER: Type = FNTSIZ_ABSOLUT; break;
+/*N*/ case TPLUS: Type = FNTSIZ_PLUS; break;
+/*N*/ case TMINUS: Type = FNTSIZ_MINUS; break;
+/*N*/ case TMULTIPLY: Type = FNTSIZ_MULTIPLY; break;
+/*N*/ case TDIVIDEBY: Type = FNTSIZ_DIVIDE; break;
+/*N*/
+/*N*/ default:
+/*?*/ delete pFontNode;
+/*?*/ Error(PE_SIZE_EXPECTED);
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ if (Type != FNTSIZ_ABSOLUT)
+/*N*/ {
+/*N*/ NextToken();
+/*N*/ if (CurToken.eType != TNUMBER)
+/*N*/ {
+/*?*/ delete pFontNode;
+/*?*/ Error(PE_SIZE_EXPECTED);
+/*?*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // get number argument
+/*N*/ double fTmp;
+/*N*/ Fraction aValue;
+/*N*/ if(lcl_IsNumber(CurToken.aText) &&
+/*N*/ sscanf(ByteString(CurToken.aText, RTL_TEXTENCODING_ASCII_US).GetBuffer(), "%lf", &fTmp) == 1)
+/*N*/ aValue = fTmp;
+/*N*/
+/*N*/ NextToken();
+/*N*/
+/*N*/ pFontNode->SetSizeParameter(aValue, Type);
+/*N*/ NodeStack.Push(pFontNode);
+/*N*/ }
+
+
+/*N*/ void SmParser::Brace()
+/*N*/ {
+/*N*/ DBG_ASSERT(CurToken.eType == TLEFT || TokenInGroup(TGLBRACES),
+/*N*/ "Sm: kein Klammer Ausdruck");
+/*N*/
+/*N*/ SmStructureNode *pSNode = new SmBraceNode(CurToken);
+/*N*/ SmNode *pBody = 0,
+/*N*/ *pLeft = 0,
+/*N*/ *pRight = 0;
+/*N*/ SmScaleMode eScaleMode = SCALE_NONE;
+/*N*/ SmParseError eError = PE_NONE;
+/*N*/
+/*N*/ if (CurToken.eType == TLEFT)
+/*N*/ { NextToken();
+/*N*/
+/*N*/ eScaleMode = SCALE_HEIGHT;
+/*N*/
+/*N*/ // check for left bracket
+/*N*/ if (TokenInGroup(TGLBRACES) || TokenInGroup(TGRBRACES))
+/*N*/ {
+/*N*/ pLeft = new SmMathSymbolNode(CurToken);
+/*N*/
+/*N*/ NextToken();
+/*N*/ Bracebody(TRUE);
+/*N*/ pBody = NodeStack.Pop();
+/*N*/
+/*N*/ if (CurToken.eType == TRIGHT)
+/*N*/ { NextToken();
+/*N*/
+/*N*/ // check for right bracket
+/*N*/ if (TokenInGroup(TGLBRACES) || TokenInGroup(TGRBRACES))
+/*N*/ {
+/*N*/ pRight = new SmMathSymbolNode(CurToken);
+/*N*/ NextToken();
+/*N*/ }
+/*N*/ else
+/*N*/ eError = PE_RBRACE_EXPECTED;
+/*N*/ }
+/*N*/ else
+/*N*/ eError = PE_RIGHT_EXPECTED;
+/*N*/ }
+/*N*/ else
+/*N*/ eError = PE_LBRACE_EXPECTED;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if (TokenInGroup(TGLBRACES))
+/*N*/ {
+/*N*/ pLeft = new SmMathSymbolNode(CurToken);
+/*N*/
+/*N*/ NextToken();
+/*N*/ Bracebody(FALSE);
+/*N*/ pBody = NodeStack.Pop();
+/*N*/
+/*N*/ SmTokenType eExpectedType = TUNKNOWN;
+/*N*/ switch (pLeft->GetToken().eType)
+/*N*/ { case TLPARENT : eExpectedType = TRPARENT; break;
+/*N*/ case TLBRACKET : eExpectedType = TRBRACKET; break;
+/*N*/ case TLBRACE : eExpectedType = TRBRACE; break;
+/*N*/ case TLDBRACKET : eExpectedType = TRDBRACKET; break;
+/*N*/ case TLLINE : eExpectedType = TRLINE; break;
+/*N*/ case TLDLINE : eExpectedType = TRDLINE; break;
+/*N*/ case TLANGLE : eExpectedType = TRANGLE; break;
+/*N*/ case TLFLOOR : eExpectedType = TRFLOOR; break;
+/*N*/ case TLCEIL : eExpectedType = TRCEIL; break;
+/*N*/ default :
+/*N*/ DBG_ASSERT(0, "Sm: unbekannter Fall");
+/*N*/ }
+/*N*/
+/*N*/ if (CurToken.eType == eExpectedType)
+/*N*/ {
+/*N*/ pRight = new SmMathSymbolNode(CurToken);
+/*N*/ NextToken();
+/*N*/ }
+/*N*/ else
+/*N*/ eError = PE_PARENT_MISMATCH;
+/*N*/ }
+/*N*/ else
+/*N*/ eError = PE_LBRACE_EXPECTED;
+/*N*/ }
+/*N*/
+/*N*/ if (eError == PE_NONE)
+/*N*/ { DBG_ASSERT(pLeft, "Sm: NULL pointer");
+/*N*/ DBG_ASSERT(pRight, "Sm: NULL pointer");
+/*N*/ pSNode->SetSubNodes(pLeft, pBody, pRight);
+/*N*/ pSNode->SetScaleMode(eScaleMode);
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+/*N*/ else
+/*N*/ { delete pSNode;
+/*N*/ delete pBody;
+/*N*/ delete pLeft;
+/*N*/ delete pRight;
+/*N*/
+/*N*/ Error(eError);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmParser::Bracebody(BOOL bIsLeftRight)
+/*N*/ {
+/*N*/ SmStructureNode *pBody = new SmBracebodyNode(CurToken);
+/*N*/ SmNodeArray aNodes;
+/*N*/ USHORT nNum = 0;
+/*N*/
+/*N*/ // get body if any
+/*N*/ if (bIsLeftRight)
+/*N*/ {
+/*N*/ do
+/*N*/ {
+/*N*/ if (CurToken.eType == TMLINE)
+/*N*/ {
+/*N*/ NodeStack.Push(new SmMathSymbolNode(CurToken));
+/*N*/ NextToken();
+/*N*/ nNum++;
+/*N*/ }
+/*N*/ else if (CurToken.eType != TRIGHT)
+/*N*/ { Align();
+/*N*/ nNum++;
+/*N*/
+/*N*/ if (CurToken.eType != TMLINE && CurToken.eType != TRIGHT)
+/*N*/ Error(PE_RIGHT_EXPECTED);
+/*N*/ }
+/*N*/ } while (CurToken.eType != TEND && CurToken.eType != TRIGHT);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ do
+/*N*/ {
+/*N*/ if (CurToken.eType == TMLINE)
+/*N*/ {
+/*N*/ NodeStack.Push(new SmMathSymbolNode(CurToken));
+/*N*/ NextToken();
+/*N*/ nNum++;
+/*N*/ }
+/*N*/ else if (!TokenInGroup(TGRBRACES))
+/*N*/ { Align();
+/*N*/ nNum++;
+/*N*/
+/*N*/ if (CurToken.eType != TMLINE && !TokenInGroup(TGRBRACES))
+/*N*/ Error(PE_RBRACE_EXPECTED);
+/*N*/ }
+/*N*/ } while (CurToken.eType != TEND && !TokenInGroup(TGRBRACES));
+/*N*/ }
+/*N*/
+/*N*/ // build argument vector in parsing order
+/*N*/ aNodes.SetSize(nNum);
+/*N*/ for (USHORT i = 0; i < nNum; i++)
+/*N*/ aNodes.Put(nNum - 1 - i, NodeStack.Pop());
+/*N*/
+/*N*/ pBody->SetSubNodes(aNodes);
+/*N*/ pBody->SetScaleMode(bIsLeftRight ? SCALE_HEIGHT : SCALE_NONE);
+/*N*/ NodeStack.Push(pBody);
+/*N*/ }
+
+
+/*N*/ void SmParser::Function()
+/*N*/ {
+/*N*/ switch (CurToken.eType)
+/*N*/ {
+/*N*/ case TFUNC:
+/*N*/ NextToken(); // skip "FUNC"-statement
+/*N*/ // fall through
+/*N*/
+/*N*/ case TSIN :
+/*N*/ case TCOS :
+/*N*/ case TTAN :
+/*N*/ case TCOT :
+/*N*/ case TASIN :
+/*N*/ case TACOS :
+/*N*/ case TATAN :
+/*N*/ case TACOT :
+/*N*/ case TSINH :
+/*N*/ case TCOSH :
+/*N*/ case TTANH :
+/*N*/ case TCOTH :
+/*N*/ case TASINH :
+/*N*/ case TACOSH :
+/*N*/ case TATANH :
+/*N*/ case TACOTH :
+/*N*/ case TLN :
+/*N*/ case TLOG :
+/*N*/ case TEXP :
+/*N*/ NodeStack.Push(new SmTextNode(CurToken, FNT_FUNCTION));
+/*N*/ NextToken();
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ Error(PE_FUNC_EXPECTED);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmParser::Binom() // matrixfett.smf
+/*N*/ {
+/*N*/ SmNodeArray ExpressionArray;
+/*N*/ SmStructureNode *pSNode = new SmTableNode(CurToken);
+/*N*/
+/*N*/ NextToken();
+/*N*/
+/*N*/ Sum();
+/*N*/ Sum();
+/*N*/
+/*N*/ ExpressionArray.SetSize(2);
+/*N*/
+/*N*/ for (int i = 0; i < 2; i++)
+/*N*/ ExpressionArray.Put(2 - (i + 1), NodeStack.Pop());
+/*N*/
+/*N*/ pSNode->SetSubNodes(ExpressionArray);
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+
+
+/*N*/ void SmParser::Stack() // matrixfett.smf
+/*N*/ {
+/*N*/ SmNodeArray ExpressionArray;
+/*N*/ NextToken();
+/*N*/ if (CurToken.eType == TLGROUP)
+/*N*/ {
+/*N*/ USHORT n = 0;
+/*N*/
+/*N*/ do
+/*N*/ {
+/*N*/ NextToken();
+/*N*/ Align();
+/*N*/ n++;
+/*N*/ }
+/*N*/ while (CurToken.eType == TPOUND);
+/*N*/
+/*N*/ ExpressionArray.SetSize(n);
+/*N*/
+/*N*/ for (USHORT i = 0; i < n; i++)
+/*N*/ ExpressionArray.Put(n - (i + 1), NodeStack.Pop());
+/*N*/
+/*N*/ if (CurToken.eType != TRGROUP)
+/*N*/ Error(PE_RGROUP_EXPECTED);
+/*N*/
+/*N*/ NextToken();
+/*N*/
+/*N*/ SmStructureNode *pSNode = new SmTableNode(CurToken);
+/*N*/ pSNode->SetSubNodes(ExpressionArray);
+/*N*/ NodeStack.Push(pSNode);
+/*N*/ }
+/*N*/ else
+/*N*/ Error(PE_LGROUP_EXPECTED);
+/*N*/ }
+
+
+/*N*/ void SmParser::Matrix()
+/*N*/ {
+/*N*/ SmNodeArray ExpressionArray;
+/*N*/
+/*N*/ NextToken();
+/*N*/ if (CurToken.eType == TLGROUP)
+/*N*/ {
+/*N*/ USHORT c = 0;
+/*N*/
+/*N*/ do
+/*N*/ {
+/*N*/ NextToken();
+/*N*/ Align();
+/*N*/ c++;
+/*N*/ }
+/*N*/ while (CurToken.eType == TPOUND);
+/*N*/
+/*N*/ USHORT r = 1;
+/*N*/
+/*N*/ while (CurToken.eType == TDPOUND)
+/*N*/ {
+/*N*/ NextToken();
+/*N*/ for (USHORT i = 0; i < c; i++)
+/*N*/ {
+/*N*/ Align();
+/*N*/ if (i < (c - 1))
+/*N*/ {
+/*N*/ if (CurToken.eType == TPOUND)
+/*N*/ {
+/*N*/ NextToken();
+/*N*/ }
+/*N*/ else
+/*N*/ Error(PE_POUND_EXPECTED);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ r++;
+/*N*/ }
+/*N*/
+/*N*/ long nRC = r * c;
+/*N*/
+/*N*/ ExpressionArray.SetSize(nRC);
+/*N*/
+/*N*/ for (USHORT i = 0; i < (nRC); i++)
+/*N*/ ExpressionArray.Put((nRC) - (i + 1), NodeStack.Pop());
+/*N*/
+/*N*/ if (CurToken.eType != TRGROUP)
+/*N*/ Error(PE_RGROUP_EXPECTED);
+/*N*/
+/*N*/ NextToken();
+/*N*/
+/*N*/ SmMatrixNode *pMNode = new SmMatrixNode(CurToken);
+/*N*/ pMNode->SetSubNodes(ExpressionArray);
+/*N*/ pMNode->SetRowCol(r, c);
+/*N*/ NodeStack.Push(pMNode);
+/*N*/ }
+/*N*/ else
+/*N*/ Error(PE_LGROUP_EXPECTED);
+/*N*/ }
+
+
+/*N*/ void SmParser::Special()
+/*M*/ {
+/*M*/ BOOL bReplace = FALSE;
+/*M*/ String &rName = CurToken.aText;
+/*M*/ String aNewName;
+/*M*/
+/*M*/ if (CONVERT_NONE == GetConversion())
+/*M*/ {
+/*M*/ // conversion of symbol names for 6.0 (XML) file format
+/*M*/ // (name change on import / export.
+/*M*/ // UI uses localized names XML file format does not.)
+/*M*/ if (IsImportSymbolNames())
+/*M*/ {
+/*M*/ const SmLocalizedSymbolData &rLSD = SM_MOD1()->GetLocSymbolData();
+/*M*/ aNewName = rLSD.GetUiSymbolName( rName );
+/*M*/ bReplace = TRUE;
+/*M*/ }
+/*M*/ else if (IsExportSymbolNames())
+/*M*/ {
+/*M*/ const SmLocalizedSymbolData &rLSD = SM_MOD1()->GetLocSymbolData();
+/*M*/ aNewName = rLSD.GetExportSymbolName( rName );
+/*M*/ bReplace = TRUE;
+/*M*/ }
+/*M*/ }
+/*M*/ else // 5.0 <-> 6.0 formula text (symbol name) conversion
+/*M*/ {
+/*M*/ LanguageType nLang = GetLanguage();
+/*M*/ SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData();
+/*M*/ const ResStringArray *pFrom = 0;
+/*M*/ const ResStringArray *pTo = 0;
+/*M*/ if (CONVERT_50_TO_60 == GetConversion())
+/*M*/ {
+/*M*/ pFrom = rData.Get50NamesArray( nLang );
+/*M*/ pTo = rData.Get60NamesArray( nLang );
+/*M*/ }
+/*M*/ else if (CONVERT_60_TO_50 == GetConversion())
+/*M*/ {
+/*M*/ pFrom = rData.Get60NamesArray( nLang );
+/*M*/ pTo = rData.Get50NamesArray( nLang );
+/*M*/ }
+/*M*/ if (pFrom && pTo)
+/*M*/ {
+/*M*/ DBG_ASSERT( pFrom->Count() == pTo->Count(),
+/*M*/ "array length mismatch" );
+/*M*/ USHORT nCount = pFrom->Count();
+/*M*/ for (USHORT i = 0; i < nCount; ++i)
+/*M*/ {
+/*M*/ if (pFrom->GetString(i) == rName)
+/*M*/ {
+/*M*/ aNewName = pTo->GetString(i);
+/*M*/ bReplace = TRUE;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ // else:
+/*M*/ // conversion arrays not found or (usually)
+/*M*/ // conversion not necessary
+/*M*/ }
+/*M*/
+/*M*/ if (bReplace && aNewName.Len() && rName != aNewName)
+/*M*/ {
+/*M*/ Replace( GetTokenIndex() + 1, rName.Len(), aNewName );
+/*M*/ rName = aNewName;
+/*M*/ }
+/*M*/
+/*M*/ NodeStack.Push(new SmSpecialNode(CurToken));
+/*M*/ NextToken();
+/*M*/ }
+
+
+/*?*/ void SmParser::GlyphSpecial()
+/*?*/ {
+/*?*/ NodeStack.Push(new SmGlyphSpecialNode(CurToken));
+/*?*/ NextToken();
+/*?*/ }
+
+
+/*N*/ void SmParser::Error(SmParseError eError)
+/*N*/ {
+/*N*/ SmStructureNode *pSNode = new SmExpressionNode(CurToken);
+/*N*/ SmErrorNode *pErr = new SmErrorNode(eError, CurToken);
+/*N*/ pSNode->SetSubNodes(pErr, 0);
+/*N*/
+/*N*/ //! put a structure node on the stack (instead of the error node itself)
+/*N*/ //! because sometimes such a node is expected in order to attach some
+/*N*/ //! subnodes
+/*N*/ NodeStack.Push(pSNode);
+/*N*/
+/*N*/ AddError(eError, pSNode);
+/*N*/
+/*N*/ NextToken();
+/*N*/ }
+
+
+// end gramar
+
+
+/*N*/ SmParser::SmParser()
+/*N*/ {
+/*N*/ eConversion = CONVERT_NONE;
+/*N*/ bImportSymNames = bExportSymNames = FALSE;
+/*N*/ nLang = Application::GetSettings().GetUILanguage();
+/*N*/ }
+
+
+/*N*/ SmNode *SmParser::Parse(const String &rBuffer)
+/*N*/ {
+/*N*/ BufferString = rBuffer;
+/*N*/ BufferString.ConvertLineEnd( LINEEND_LF );
+/*N*/ BufferIndex =
+/*N*/ nTokenIndex = 0;
+/*N*/ Row = 1;
+/*N*/ ColOff = 0;
+/*N*/ CurError = -1;
+/*N*/
+/*N*/ for (USHORT i = 0; i < ErrDescList.Count(); i++)
+/*N*/ delete ErrDescList.Remove(i);
+/*N*/
+/*N*/ ErrDescList.Clear();
+/*N*/
+/*N*/ NodeStack.Clear();
+/*N*/
+/*N*/ SetLanguage( Application::GetSettings().GetUILanguage() );
+/*N*/ NextToken();
+/*N*/ Table();
+/*N*/
+/*N*/ return NodeStack.Pop();
+/*N*/ }
+
+
+/*N*/ USHORT SmParser::AddError(SmParseError Type, SmNode *pNode)
+/*N*/ {
+/*N*/ SmErrorDesc *pErrDesc = new SmErrorDesc;
+/*N*/
+/*N*/ pErrDesc->Type = Type;
+/*N*/ pErrDesc->pNode = pNode;
+/*N*/ pErrDesc->Text = String(SmResId(RID_ERR_IDENT));
+/*N*/
+/*N*/ USHORT nRID;
+/*N*/ switch (Type)
+/*N*/ {
+/*N*/ case PE_UNEXPECTED_CHAR: nRID = RID_ERR_UNEXPECTEDCHARACTER; break;
+/*N*/ case PE_LGROUP_EXPECTED: nRID = RID_ERR_LGROUPEXPECTED; break;
+/*N*/ case PE_RGROUP_EXPECTED: nRID = RID_ERR_RGROUPEXPECTED; break;
+/*N*/ case PE_LBRACE_EXPECTED: nRID = RID_ERR_LBRACEEXPECTED; break;
+/*N*/ case PE_RBRACE_EXPECTED: nRID = RID_ERR_RBRACEEXPECTED; break;
+/*N*/ case PE_FUNC_EXPECTED: nRID = RID_ERR_FUNCEXPECTED; break;
+/*N*/ case PE_UNOPER_EXPECTED: nRID = RID_ERR_UNOPEREXPECTED; break;
+/*N*/ case PE_BINOPER_EXPECTED: nRID = RID_ERR_BINOPEREXPECTED; break;
+/*N*/ case PE_SYMBOL_EXPECTED: nRID = RID_ERR_SYMBOLEXPECTED; break;
+/*N*/ case PE_IDENTIFIER_EXPECTED: nRID = RID_ERR_IDENTEXPECTED; break;
+/*N*/ case PE_POUND_EXPECTED: nRID = RID_ERR_POUNDEXPECTED; break;
+/*N*/ case PE_COLOR_EXPECTED: nRID = RID_ERR_COLOREXPECTED; break;
+/*N*/ case PE_RIGHT_EXPECTED: nRID = RID_ERR_RIGHTEXPECTED; break;
+/*N*/
+/*N*/ default:
+/*N*/ nRID = RID_ERR_UNKOWN;
+/*N*/ }
+/*N*/ pErrDesc->Text += SmResId(nRID);
+/*N*/
+/*N*/ ErrDescList.Insert(pErrDesc);
+/*N*/
+/*N*/ return (USHORT) ErrDescList.GetPos(pErrDesc);
+/*N*/ }
+
+
+
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_rect.cxx b/binfilter/bf_starmath/source/starmath_rect.cxx
new file mode 100644
index 000000000000..3fa937097934
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_rect.cxx
@@ -0,0 +1,743 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <vcl/svapp.hxx>
+#include <vcl/virdev.hxx>
+
+
+#include "rect.hxx"
+#include "smmod.hxx"
+namespace binfilter {
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+
+// '\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(0xE070), MS_EMPTYSET,
+ xub_Unicode(0x2113), xub_Unicode(0xE0D6), xub_Unicode(0x2107),
+ xub_Unicode(0x2127), xub_Unicode(0x210A), MS_HBAR,
+ MS_LAMBDABAR, MS_SETN, MS_SETZ,
+ MS_SETQ, MS_SETR, MS_SETC,
+ xub_Unicode(0x2373), xub_Unicode(0xE0A5), xub_Unicode(0x2112),
+ xub_Unicode(0x2130), xub_Unicode(0x2131),
+ xub_Unicode('\0')
+};
+
+/*N*/ BOOL SmIsMathAlpha(const XubString &rText)
+/*N*/ // ergibt genau dann TRUE, wenn das Zeichen (aus dem StarMath Font) wie ein
+/*N*/ // Buchstabe behandelt werden soll.
+/*N*/ {
+/*N*/ if (rText.Len() == 0)
+/*N*/ return FALSE;
+/*N*/
+/*N*/ DBG_ASSERT(rText.Len() == 1, "Sm : String enthaelt nicht genau ein Zeichen");
+/*N*/ xub_Unicode cChar = rText.GetChar(0);
+/*N*/
+/*N*/ // ist es ein griechisches Zeichen ?
+/*N*/ if (xub_Unicode(0xE0AC) <= cChar && cChar <= xub_Unicode(0xE0D4))
+/*N*/ return TRUE;
+/*N*/ else
+/*N*/ {
+/*N*/ // kommt es in 'aMathAlpha' vor ?
+/*N*/ const xub_Unicode *pChar = aMathAlpha;
+/*N*/ while (*pChar && *pChar != cChar)
+/*N*/ pChar++;
+/*N*/ return *pChar != xub_Unicode('\0');
+/*N*/ }
+/*N*/ }
+
+
+////////////////////////////////////////
+//
+// SmRect members
+//
+
+
+/*N*/ SmRect::SmRect()
+/*N*/ // constructs empty rectangle at (0, 0) with width and height 0.
+/*N*/ {
+/*N*/ DBG_ASSERT(aTopLeft == Point(0, 0), "Sm: ooops...");
+/*N*/ DBG_ASSERT(aSize == Size(0, 0), "Sm: ooops...");
+/*N*/
+/*N*/ bHasBaseline = bHasAlignInfo = FALSE;
+/*N*/ nBaseline = nAlignT = nAlignM = nAlignB =
+/*N*/ nGlyphTop = nGlyphBottom =
+/*N*/ nItalicLeftSpace = nItalicRightSpace =
+/*N*/ nLoAttrFence = nHiAttrFence = 0;
+/*N*/ nBorderWidth = 0;
+/*N*/ }
+
+
+/*N*/ SmRect::SmRect(const SmRect &rRect)
+/*N*/ : aTopLeft(rRect.aTopLeft),
+/*N*/ aSize(rRect.aSize)
+/*N*/ {
+/*N*/ bHasBaseline = rRect.bHasBaseline;
+/*N*/ nBaseline = rRect.nBaseline;
+/*N*/ nAlignT = rRect.nAlignT;
+/*N*/ nAlignM = rRect.nAlignM;
+/*N*/ nAlignB = rRect.nAlignB;
+/*N*/ nGlyphTop = rRect.nGlyphTop;
+/*N*/ nGlyphBottom = rRect.nGlyphBottom;
+/*N*/ nHiAttrFence = rRect.nHiAttrFence;
+/*N*/ nLoAttrFence = rRect.nLoAttrFence;
+/*N*/ bHasAlignInfo = rRect.bHasAlignInfo;
+/*N*/ nItalicLeftSpace = rRect.nItalicLeftSpace;
+/*N*/ nItalicRightSpace = rRect.nItalicRightSpace;
+/*N*/ nBorderWidth = rRect.nBorderWidth;
+/*N*/ }
+
+
+/*N*/ void SmRect::CopyAlignInfo(const SmRect &rRect)
+/*N*/ {
+/*N*/ nBaseline = rRect.nBaseline;
+/*N*/ bHasBaseline = rRect.bHasBaseline;
+/*N*/ nAlignT = rRect.nAlignT;
+/*N*/ nAlignM = rRect.nAlignM;
+/*N*/ nAlignB = rRect.nAlignB;
+/*N*/ bHasAlignInfo = rRect.bHasAlignInfo;
+/*N*/ nLoAttrFence = rRect.nLoAttrFence;
+/*N*/ nHiAttrFence = rRect.nHiAttrFence;
+/*N*/ }
+
+
+/*N*/ void SmRect::BuildRect(const OutputDevice &rDev, const SmFormat *pFormat,
+/*N*/ const XubString &rText, USHORT nBorder)
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if (rDev.GetOutDevType() != OUTDEV_PRINTER)
+/*N*/ DBG_WARNING("Sm : Referenz-Device ist kein Drucker");
+/*N*/ #endif
+/*N*/
+/*N*/ DBG_ASSERT(aTopLeft == Point(0, 0), "Sm: Ooops...");
+/*N*/
+/*N*/ aSize = Size(rDev.GetTextWidth(rText), rDev.GetTextHeight());
+/*N*/
+/*N*/ const FontMetric aFM (rDev.GetFontMetric());
+/*N*/ BOOL bIsMath = aFM.GetName().EqualsIgnoreCaseAscii( FONTNAME_MATH ) ||
+/*N*/ aFM.GetName().EqualsIgnoreCaseAscii( FONTNAME_MATH2 );
+/*N*/ BOOL bAllowSmaller = bIsMath && !SmIsMathAlpha(rText);
+/*N*/ const long nFontHeight = rDev.GetFont().GetSize().Height();
+/*N*/
+/*N*/ nBorderWidth = nBorder;
+/*N*/ bHasAlignInfo = TRUE;
+/*N*/ bHasBaseline = TRUE;
+/*N*/ nBaseline = aFM.GetAscent();
+/*N*/ nAlignT = nBaseline - nFontHeight * 750L / 1000L;
+/*N*/ nAlignM = nBaseline - nFontHeight * 121L / 422L;
+/*N*/ // that's where the horizontal bars of '+', '-', ... are
+/*N*/ // (1/3 of ascent over baseline)
+/*N*/ // (121 = 1/3 of 12pt ascent, 422 = 12pt fontheight)
+/*N*/ nAlignB = nBaseline;
+/*N*/
+/*N*/ // workaround for printer fonts with very small (possible 0 or even
+/*N*/ // negative(!)) leading
+/*N*/ if (aFM.GetIntLeading() < 5 && rDev.GetOutDevType() == OUTDEV_PRINTER)
+/*N*/ {
+/*?*/ OutputDevice *pWindow = Application::GetDefaultDevice();
+/*?*/
+/*?*/ pWindow->Push(PUSH_MAPMODE | PUSH_FONT);
+/*?*/
+/*?*/ pWindow->SetMapMode(rDev.GetMapMode());
+/*?*/ pWindow->SetFont(rDev.GetFontMetric());
+/*?*/
+/*?*/ long nDelta = pWindow->GetFontMetric().GetIntLeading();
+/*?*/ if (nDelta == 0)
+/*?*/ { // dieser Wert entspricht etwa einem Leading von 80 bei einer
+/*?*/ // Fonthoehe von 422 (12pt)
+/*?*/ nDelta = nFontHeight * 8L / 43;
+/*?*/ }
+/*?*/ SetTop(GetTop() - nDelta);
+/*?*/
+/*?*/ pWindow->Pop();
+/*N*/ }
+/*N*/
+/*N*/ // get GlyphBoundRect
+/*N*/ Rectangle aGlyphRect;
+/*N*/ BOOL bSuccess = SmGetGlyphBoundRect(rDev, rText, aGlyphRect);
+/*N*/ DBG_ASSERT(bSuccess, "Sm : Ooops... (fehlt evtl. der Font?)");
+/*N*/
+/*N*/ nItalicLeftSpace = GetLeft() - aGlyphRect.Left() + nBorderWidth;
+/*N*/ nItalicRightSpace = aGlyphRect.Right() - GetRight() + nBorderWidth;
+/*N*/ if (nItalicLeftSpace < 0 && !bAllowSmaller)
+/*N*/ nItalicLeftSpace = 0;
+/*N*/ if (nItalicRightSpace < 0 && !bAllowSmaller)
+/*N*/ nItalicRightSpace = 0;
+/*N*/
+/*N*/ long nDist = 0;
+/*N*/ if (pFormat)
+/*N*/ nDist = (rDev.GetFont().GetSize().Height()
+/*N*/ * pFormat->GetDistance(DIS_ORNAMENTSIZE)) / 100L;
+/*N*/
+/*N*/ nHiAttrFence = aGlyphRect.TopLeft().Y() - 1 - nBorderWidth - nDist;
+/*N*/ nLoAttrFence = SmFromTo(GetAlignB(), GetBottom(), 0.0);
+/*N*/
+/*N*/ nGlyphTop = aGlyphRect.Top() - nBorderWidth;
+/*N*/ nGlyphBottom = aGlyphRect.Bottom() + nBorderWidth;
+/*N*/
+/*N*/ if (bAllowSmaller)
+/*N*/ {
+/*N*/ // fuer Symbole und Operatoren aus dem StarMath Font passen wir den
+/*N*/ // oberen und unteren Rand dem Zeichen an.
+/*N*/ SetTop(nGlyphTop);
+/*N*/ SetBottom(nGlyphBottom);
+/*N*/ }
+/*N*/
+/*N*/ if (nHiAttrFence < GetTop())
+/*N*/ nHiAttrFence = GetTop();
+/*N*/
+/*N*/ if (nLoAttrFence > GetBottom())
+/*N*/ nLoAttrFence = GetBottom();
+/*N*/
+/*N*/ DBG_ASSERT(rText.Len() == 0 || !IsEmpty(),
+/*N*/ "Sm: leeres Rechteck erzeugt");
+/*N*/ }
+
+
+/*N*/ void SmRect::Init(const OutputDevice &rDev, const SmFormat *pFormat,
+/*N*/ const XubString &rText, USHORT nBorderWidth)
+/*N*/ // get rectangle fitting for drawing 'rText' on OutputDevice 'rDev'
+/*N*/ {
+/*N*/ SmRectCache *pRectCache = SM_MOD1()->GetRectCache();
+/*N*/ DBG_ASSERT(pRectCache, "Sm : NULL pointer");
+/*N*/
+/*N*/ // build key for rectangle (to look up in cache for)
+/*N*/ const SmRectCache::Key aKey (rText, rDev.GetFont());
+/*N*/
+/*N*/ const SmRect *pResult = pRectCache->Search(aKey);
+/*N*/ if (pResult)
+/*?*/ *this = *pResult;
+/*N*/ else
+/*N*/ { // build rectangle and put it in cache
+/*N*/ BuildRect(rDev, pFormat, rText, nBorderWidth);
+/*N*/ pResult = pRectCache->Add(aKey, *this);
+/*N*/ }
+/*N*/ DBG_ASSERT(pResult, "Sm : NULL pointer");
+/*N*/ }
+
+
+/*N*/ SmRect::SmRect(const OutputDevice &rDev, const SmFormat *pFormat,
+/*N*/ const XubString &rText, long nBorderWidth)
+/*N*/ {
+/*N*/ DBG_ASSERT( nBorderWidth >= 0, "BorderWidth negativ" );
+/*N*/ if (nBorderWidth < 0)
+/*N*/ nBorderWidth = 0;
+/*N*/ Init(rDev, pFormat, rText, (USHORT) nBorderWidth);
+/*N*/ }
+
+
+/*N*/ SmRect::SmRect(long nWidth, long nHeight)
+/*N*/ // this constructor should never be used for anything textlike because
+/*N*/ // it will not provide useful values for baseline, AlignT and AlignB!
+/*N*/ // It's purpose is to get a 'SmRect' for the horizontal line in fractions
+/*N*/ // as used in 'SmBinVerNode'.
+/*N*/ : aSize(nWidth, nHeight)
+/*N*/ {
+/*N*/ DBG_ASSERT(aTopLeft == Point(0, 0), "Sm: ooops...");
+/*N*/
+/*N*/ bHasBaseline = FALSE;
+/*N*/ bHasAlignInfo = TRUE;
+/*N*/ nBaseline = 0;
+/*N*/ nAlignT = GetTop();
+/*N*/ nAlignB = GetBottom();
+/*N*/ nAlignM = (nAlignT + nAlignB) / 2; // this is the default
+/*N*/ nItalicLeftSpace = nItalicRightSpace = 0;
+/*N*/ nGlyphTop = nHiAttrFence = GetTop();
+/*N*/ nGlyphBottom = nLoAttrFence = GetBottom();
+/*N*/ nBorderWidth = 0;
+/*N*/ }
+
+
+/*N*/ void SmRect::SetLeft(long nLeft)
+/*N*/ {
+/*N*/ if (nLeft <= GetRight())
+/*N*/ { aSize.Width() = GetRight() - nLeft + 1;
+/*N*/ aTopLeft.X() = nLeft;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmRect::SetRight(long nRight)
+/*N*/ {
+/*N*/ if (nRight >= GetLeft())
+/*N*/ aSize.Width() = nRight - GetLeft() + 1;
+/*N*/ }
+
+
+/*N*/ void SmRect::SetBottom(long nBottom)
+/*N*/ {
+/*N*/ if (nBottom >= GetTop())
+/*N*/ aSize.Height() = nBottom - GetTop() + 1;
+/*N*/ }
+
+
+/*N*/ void SmRect::SetTop(long nTop)
+/*N*/ {
+/*N*/ if (nTop <= GetBottom())
+/*N*/ { aSize.Height() = GetBottom() - nTop + 1;
+/*N*/ aTopLeft.Y() = nTop;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmRect::Move(const Point &rPosition)
+/*N*/ // move rectangle by position 'rPosition'.
+/*N*/ {
+/*N*/ aTopLeft += rPosition;
+/*N*/
+/*N*/ long nDelta = rPosition.Y();
+/*N*/ nBaseline += nDelta;
+/*N*/ nAlignT += nDelta;
+/*N*/ nAlignM += nDelta;
+/*N*/ nAlignB += nDelta;
+/*N*/ nGlyphTop += nDelta;
+/*N*/ nGlyphBottom += nDelta;
+/*N*/ nHiAttrFence += nDelta;
+/*N*/ nLoAttrFence += nDelta;
+/*N*/ }
+
+
+/*N*/ const Point SmRect::AlignTo(const SmRect &rRect, RectPos ePos,
+/*N*/ RectHorAlign eHor, RectVerAlign eVer) const
+/*N*/ { Point aPos (GetTopLeft());
+/*N*/ // will become the topleft point of the new rectangle position
+/*N*/
+/*N*/ // set horizontal or vertical new rectangle position depending on
+/*N*/ // 'ePos' is one of 'RP_LEFT', 'RP_RIGHT' or 'RP_TOP', 'RP_BOTTOM'
+/*N*/ switch (ePos)
+/*N*/ { case RP_LEFT :
+/*N*/ aPos.X() = rRect.GetItalicLeft() - GetItalicRightSpace()
+/*N*/ - GetWidth();
+/*N*/ break;
+/*N*/ case RP_RIGHT :
+/*N*/ aPos.X() = rRect.GetItalicRight() + 1 + GetItalicLeftSpace();
+/*N*/ break;
+/*N*/ case RP_TOP :
+/*N*/ aPos.Y() = rRect.GetTop() - GetHeight();
+/*N*/ break;
+/*N*/ case RP_BOTTOM :
+/*N*/ aPos.Y() = rRect.GetBottom() + 1;
+/*N*/ break;
+/*N*/ case RP_ATTRIBUT :
+/*N*/ aPos.X() = rRect.GetItalicCenterX() - GetItalicWidth() / 2
+/*N*/ + GetItalicLeftSpace();
+/*N*/ break;
+/*N*/ default :
+/*N*/ DBG_ASSERT(FALSE, "Sm: unbekannter Fall");
+/*N*/ }
+/*N*/
+/*N*/ // check if horizontal position is already set
+/*N*/ if (ePos == RP_LEFT || ePos == RP_RIGHT || ePos == RP_ATTRIBUT)
+/*N*/ // correct error in current vertical position
+/*N*/ switch (eVer)
+/*N*/ { case RVA_TOP :
+/*N*/ aPos.Y() += rRect.GetAlignT() - GetAlignT();
+/*N*/ break;
+/*N*/ case RVA_MID :
+/*N*/ aPos.Y() += rRect.GetAlignM() - GetAlignM();
+/*N*/ break;
+/*N*/ case RVA_BASELINE :
+/*N*/ // align baselines if possible else align mid's
+/*N*/ if (HasBaseline() && rRect.HasBaseline())
+/*N*/ aPos.Y() += rRect.GetBaseline() - GetBaseline();
+/*N*/ else
+/*N*/ aPos.Y() += rRect.GetAlignM() - GetAlignM();
+/*N*/ break;
+/*N*/ case RVA_BOTTOM :
+/*N*/ aPos.Y() += rRect.GetAlignB() - GetAlignB();
+/*N*/ break;
+/*N*/ case RVA_CENTERY :
+/*N*/ aPos.Y() += rRect.GetCenterY() - GetCenterY();
+/*N*/ break;
+/*N*/ case RVA_ATTRIBUT_HI:
+/*N*/ aPos.Y() += rRect.GetHiAttrFence() - GetBottom();
+/*N*/ break;
+/*N*/ case RVA_ATTRIBUT_MID :
+/*?*/ aPos.Y() += SmFromTo(rRect.GetAlignB(), rRect.GetAlignT(), 0.4)
+/*?*/ - GetCenterY();
+/*?*/ break;
+/*?*/ case RVA_ATTRIBUT_LO :
+/*?*/ aPos.Y() += rRect.GetLoAttrFence() - GetTop();
+/*?*/ break;
+/*?*/ default :
+/*N*/ DBG_ASSERT(FALSE, "Sm: unbekannter Fall");
+/*N*/ }
+/*N*/
+/*N*/ // check if vertical position is already set
+/*N*/ if (ePos == RP_TOP || ePos == RP_BOTTOM)
+/*N*/ // correct error in current horizontal position
+/*N*/ switch (eHor)
+/*N*/ { case RHA_LEFT :
+/*N*/ aPos.X() += rRect.GetItalicLeft() - GetItalicLeft();
+/*N*/ break;
+/*N*/ case RHA_CENTER :
+/*N*/ aPos.X() += rRect.GetItalicCenterX() - GetItalicCenterX();
+/*N*/ break;
+/*N*/ case RHA_RIGHT :
+/*?*/ aPos.X() += rRect.GetItalicRight() - GetItalicRight();
+/*?*/ break;
+/*N*/ default :
+/*N*/ DBG_ASSERT(FALSE, "Sm: unbekannter Fall");
+/*N*/ }
+/*N*/
+/*N*/ return aPos;
+/*N*/ }
+
+
+/*N*/ SmRect & SmRect::Union(const SmRect &rRect)
+/*N*/ // rectangle union of current one with 'rRect'. The result is to be the
+/*N*/ // smallest rectangles that covers the space of both rectangles.
+/*N*/ // (empty rectangles cover no space)
+/*N*/ //! Italic correction is NOT taken into account here!
+/*N*/ {
+/*N*/ if (rRect.IsEmpty())
+/*N*/ return *this;
+/*N*/
+/*N*/ long nL = rRect.GetLeft(),
+/*N*/ nR = rRect.GetRight(),
+/*N*/ nT = rRect.GetTop(),
+/*N*/ nB = rRect.GetBottom(),
+/*N*/ nGT = rRect.nGlyphTop,
+/*N*/ nGB = rRect.nGlyphBottom;
+/*N*/ if (!IsEmpty())
+/*N*/ { long nTmp;
+/*N*/
+/*N*/ if ((nTmp = GetLeft()) < nL)
+/*N*/ nL = nTmp;
+/*N*/ if ((nTmp = GetRight()) > nR)
+/*N*/ nR = nTmp;
+/*N*/ if ((nTmp = GetTop()) < nT)
+/*N*/ nT = nTmp;
+/*N*/ if ((nTmp = GetBottom()) > nB)
+/*N*/ nB = nTmp;
+/*N*/ if ((nTmp = nGlyphTop) < nGT)
+/*N*/ nGT = nTmp;
+/*N*/ if ((nTmp = nGlyphBottom) > nGB)
+/*N*/ nGB = nTmp;
+/*N*/ }
+/*N*/
+/*N*/ SetLeft(nL);
+/*N*/ SetRight(nR);
+/*N*/ SetTop(nT);
+/*N*/ SetBottom(nB);
+/*N*/ nGlyphTop = nGT;
+/*N*/ nGlyphBottom = nGB;
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ SmRect & SmRect::ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode)
+/*N*/ // let current rectangle be the union of itself and 'rRect'
+/*N*/ // (the smallest rectangle surrounding both). Also adapt values for
+/*N*/ // 'AlignT', 'AlignM', 'AlignB', baseline and italic-spaces.
+/*N*/ // The baseline is set according to 'eCopyMode'.
+/*N*/ // If one of the rectangles has no relevant info the other one is copied.
+/*N*/ {
+/*N*/ // get some values used for (italic) spaces adaption
+/*N*/ // ! (need to be done before changing current SmRect) !
+/*N*/ long nL = Min(GetItalicLeft(), rRect.GetItalicLeft()),
+/*N*/ nR = Max(GetItalicRight(), rRect.GetItalicRight());
+/*N*/
+/*N*/ Union(rRect);
+/*N*/
+/*N*/ SetItalicSpaces(GetLeft() - nL, nR - GetRight());
+/*N*/
+/*N*/ if (!HasAlignInfo())
+/*N*/ CopyAlignInfo(rRect);
+/*N*/ else if (rRect.HasAlignInfo())
+/*N*/ { nAlignT = Min(GetAlignT(), rRect.GetAlignT());
+/*N*/ nAlignB = Max(GetAlignB(), rRect.GetAlignB());
+/*N*/ nHiAttrFence = Min(GetHiAttrFence(), rRect.GetHiAttrFence());
+/*N*/ nLoAttrFence = Max(GetLoAttrFence(), rRect.GetLoAttrFence());
+/*N*/ DBG_ASSERT(HasAlignInfo(), "Sm: ooops...");
+/*N*/
+/*N*/ switch (eCopyMode)
+/*N*/ { case RCP_THIS:
+/*N*/ // already done
+/*N*/ break;
+/*N*/ case RCP_ARG:
+/*N*/ CopyMBL(rRect);
+/*N*/ break;
+/*N*/ case RCP_NONE:
+/*N*/ ClearBaseline();
+/*N*/ nAlignM = (nAlignT + nAlignB) / 2;
+/*N*/ break;
+/*N*/ case RCP_XOR:
+/*N*/ if (!HasBaseline())
+/*N*/ CopyMBL(rRect);
+/*N*/ break;
+/*N*/ default :
+/*N*/ DBG_ASSERT(FALSE, "Sm: unbekannter Fall");
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ SmRect & SmRect::ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode,
+/*N*/ long nNewAlignM)
+/*N*/ // as 'ExtendBy' but sets AlignM value to 'nNewAlignM'.
+/*N*/ // (this version will be used in 'SmBinVerNode' to provide means to
+/*N*/ // align eg "{a over b} over c" correctly where AlignM should not
+/*N*/ // be (AlignT + AlignB) / 2)
+/*N*/ {
+/*N*/ DBG_ASSERT(HasAlignInfo(), "Sm: keine Align Info");
+/*N*/
+/*N*/ ExtendBy(rRect, eCopyMode);
+/*N*/ nAlignM = nNewAlignM;
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ SmRect & SmRect::ExtendBy(const SmRect &rRect, RectCopyMBL eCopyMode,
+/*N*/ BOOL bKeepVerAlignParams)
+/*N*/ // as 'ExtendBy' but keeps original values for AlignT, -M and -B and
+/*N*/ // baseline.
+/*N*/ // (this is used in 'SmSupSubNode' where the sub-/supscripts shouldn't
+/*N*/ // be allowed to modify these values.)
+/*N*/ {
+/*N*/ long nOldAlignT = GetAlignT(),
+/*N*/ nOldAlignM = GetAlignM(),
+/*N*/ nOldAlignB = GetAlignB(),
+/*N*/ nOldBaseline = nBaseline; //! depends not on 'HasBaseline'
+/*N*/ BOOL bOldHasAlignInfo = HasAlignInfo();
+/*N*/
+/*N*/ ExtendBy(rRect, eCopyMode);
+/*N*/
+/*N*/ if (bKeepVerAlignParams)
+/*N*/ { nAlignT = nOldAlignT;
+/*N*/ nAlignM = nOldAlignM;
+/*N*/ nAlignB = nOldAlignB;
+/*N*/ nBaseline = nOldBaseline;
+/*N*/ bHasAlignInfo = bOldHasAlignInfo;
+/*N*/ }
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+
+//SmRect & SmRect::ExtendBy(const Point &rPoint)
+// // extend current rectangle to include 'rPoint'.
+// // The effect should be similar to
+// // "ExtendBy(rRect, RCP_THIS, (BOOL) TRUE)"
+// // where 'rRect' is a SmRect of size and width 1 with no italic spaces
+// // (as by "SmRect (1, 1)") and position at 'rPoint'.
+//{
+// // get some values used for italic spaces adaption
+// // ! (need to be done before changing current SmRect) !
+// long nL = Min(GetItalicLeft(), rPoint.X()),
+// nR = Max(GetItalicRight(), rPoint.X());
+//
+// // this is the adaption of rectangle union
+// if (rPoint.X() < GetLeft())
+// SetLeft(rPoint.X());
+// if (rPoint.X() > GetRight())
+// SetRight(rPoint.X());
+// if (rPoint.Y() < GetTop())
+// SetTop(rPoint.Y());
+// if (rPoint.Y() > GetBottom())
+// SetBottom(rPoint.Y());
+//
+// SetItalicSpaces(GetLeft() - nL, nR - GetRight());
+//
+// return *this;
+//}
+
+
+//long SmRect::OrientedDist(const Point &rPoint) const
+// // return oriented distance of rPoint to the current rectangle,
+// // especially the return value is <= 0 iff the point is inside the
+// // rectangle.
+// // For simplicity the maximum-norm is used.
+//{
+// BOOL bIsInside = IsInsideItalicRect(rPoint);
+//
+// // build reference point to define the distance
+// Point aRef;
+// if (bIsInside)
+// { Point aIC (GetItalicCenterX(), GetCenterY());
+//
+// aRef.X() = rPoint.X() >= aIC.X() ? GetItalicRight() : GetItalicLeft();
+// aRef.Y() = rPoint.Y() >= aIC.Y() ? GetBottom() : GetTop();
+// }
+// else
+// {
+// // x-coordinate
+// if (rPoint.X() > GetItalicRight())
+// aRef.X() = GetItalicRight();
+// else if (rPoint.X() < GetItalicLeft())
+// aRef.X() = GetItalicLeft();
+// else
+// aRef.X() = rPoint.X();
+// // y-coordinate
+// if (rPoint.Y() > GetBottom())
+// aRef.Y() = GetBottom();
+// else if (rPoint.Y() < GetTop())
+// aRef.Y() = GetTop();
+// else
+// aRef.Y() = rPoint.Y();
+// }
+//
+// // build distance vector
+// Point aDist (aRef - rPoint);
+//
+// long nAbsX = labs(aDist.X()),
+// nAbsY = labs(aDist.Y());
+//
+// return bIsInside ? - Min(nAbsX, nAbsY) : Max (nAbsX, nAbsY);
+//}
+
+
+//BOOL SmRect::IsInsideRect(const Point &rPoint) const
+//{
+// return rPoint.Y() >= GetTop()
+// && rPoint.Y() <= GetBottom()
+// && rPoint.X() >= GetLeft()
+// && rPoint.X() <= GetRight();
+//}
+
+
+//BOOL SmRect::IsInsideItalicRect(const Point &rPoint) const
+//{
+// return rPoint.Y() >= GetTop()
+// && rPoint.Y() <= GetBottom()
+// && rPoint.X() >= GetItalicLeft()
+// && rPoint.X() <= GetItalicRight();
+//}
+
+SmRect SmRect::AsGlyphRect() const
+{
+ SmRect aRect (*this);
+ aRect.SetTop(nGlyphTop);
+ aRect.SetBottom(nGlyphBottom);
+ return aRect;
+}
+
+
+// forward declaration
+
+
+
+
+////////////////////////////////////////
+// misc functions
+//
+
+
+
+
+/*N*/ BOOL SmGetGlyphBoundRect(const OutputDevice &rDev,
+/*N*/ const XubString &rText, Rectangle &rRect)
+/*N*/ // basically the same as 'GetTextBoundRect' (in class 'OutputDevice')
+/*N*/ // but with a string as argument.
+/*N*/ {
+/*N*/ // handle special case first
+/*N*/ xub_StrLen nLen = rText.Len();
+/*N*/ if (nLen == 0)
+/*N*/ { rRect.SetEmpty();
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/
+/*N*/ // get a device where 'OutputDevice::GetTextBoundRect' will be successful
+/*N*/ OutputDevice *pGlyphDev;
+/*N*/ if (rDev.GetOutDevType() != OUTDEV_PRINTER)
+/*?*/ pGlyphDev = (OutputDevice *) &rDev;
+/*N*/ else
+/*N*/ {
+/*N*/ // since we format for the printer (where GetTextBoundRect will fail)
+/*N*/ // we need a virtual device here.
+/*N*/ pGlyphDev = SM_MOD1()->GetRectCache()->GetVirDev();
+/*N*/ }
+/*N*/
+/*N*/ const FontMetric aDevFM (rDev.GetFontMetric());
+/*N*/
+/*N*/ pGlyphDev->Push(PUSH_FONT | PUSH_MAPMODE);
+/*N*/ Font aFnt(rDev.GetFont());
+/*N*/ aFnt.SetAlign(ALIGN_TOP);
+/*N*/
+/*N*/ // use scale factor when calling GetTextBoundRect to counter
+/*N*/ // negative effects from antialiasing which may otherwise result
+/*N*/ // in significant incorrect bounding rectangles for some charcters.
+/*N*/ long nScaleFactor = 16;
+/*N*/ Size aFntSize = aFnt.GetSize();
+/*N*/ aFnt.SetSize( Size( aFntSize.Width() * nScaleFactor, aFntSize.Height() * nScaleFactor ) );
+/*N*/ pGlyphDev->SetFont(aFnt);
+/*N*/
+/*N*/ long nTextWidth = rDev.GetTextWidth(rText);
+/*N*/ Point aPoint;
+/*N*/ Rectangle aResult (aPoint, Size(nTextWidth, rDev.GetTextHeight())),
+/*N*/ aTmp;
+/*N*/
+/*N*/ BOOL bSuccess = pGlyphDev->GetTextBoundRect(aTmp, rText, 0, 0);
+/*N*/ DBG_ASSERT( bSuccess, "GetTextBoundRect failed" );
+/*N*/
+/*N*/
+/*N*/ if (!aTmp.IsEmpty())
+/*N*/ {
+/*N*/ aResult = Rectangle(aTmp.Left() / nScaleFactor, aTmp.Top() / nScaleFactor,
+/*N*/ aTmp.Right() / nScaleFactor, aTmp.Bottom() / nScaleFactor);
+/*N*/ if (&rDev != pGlyphDev) /* only when rDev is a printer... */
+/*N*/ {
+/*N*/ long nGDTextWidth = pGlyphDev->GetTextWidth(rText);
+/*N*/ if (nGDTextWidth != 0 &&
+/*N*/ nTextWidth != nGDTextWidth)
+/*N*/ {
+/*N*/ aResult.Right() *= nTextWidth;
+/*N*/ aResult.Right() /= nGDTextWidth / nScaleFactor;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // move rectangle to match possibly different baselines
+/*N*/ // (because of different devices)
+/*N*/ long nDelta = aDevFM.GetAscent() - pGlyphDev->GetFontMetric().GetAscent() / nScaleFactor;
+/*N*/ aResult.Move(0, nDelta);
+/*N*/
+/*N*/ pGlyphDev->Pop();
+/*N*/
+/*N*/ rRect = aResult;
+/*N*/ return bSuccess;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_register.cxx b/binfilter/bf_starmath/source/starmath_register.cxx
new file mode 100644
index 000000000000..1875ec3eb363
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_register.cxx
@@ -0,0 +1,280 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ustring.hxx>
+
+#include "smdll.hxx"
+#include "document.hxx"
+
+#include <cppuhelper/factory.hxx>
+
+namespace binfilter {
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+//Math document
+extern Sequence< OUString > SAL_CALL
+ SmDocument_getSupportedServiceNames() throw();
+extern OUString SAL_CALL
+ SmDocument_getImplementationName() throw();
+extern Reference< XInterface >SAL_CALL
+ SmDocument_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
+
+//MathML import
+extern Sequence< OUString > SAL_CALL
+ SmXMLImport_getSupportedServiceNames() throw();
+extern OUString SAL_CALL
+ SmXMLImport_getImplementationName() throw();
+extern Reference< XInterface > SAL_CALL
+ SmXMLImport_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
+extern Sequence< OUString > SAL_CALL
+ SmXMLImportMeta_getSupportedServiceNames() throw();
+extern OUString SAL_CALL
+ SmXMLImportMeta_getImplementationName() throw();
+extern Reference< XInterface > SAL_CALL
+ SmXMLImportMeta_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
+extern Sequence< OUString > SAL_CALL
+ SmXMLImportSettings_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw();
+extern Reference< XInterface > SAL_CALL
+ SmXMLImportSettings_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
+
+//MathML export
+extern Sequence< OUString > SAL_CALL
+ SmXMLExport_getSupportedServiceNames() throw();
+extern OUString SAL_CALL
+ SmXMLExport_getImplementationName() throw();
+extern Reference< XInterface > SAL_CALL
+ SmXMLExport_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
+extern Sequence< OUString > SAL_CALL
+ SmXMLExportMeta_getSupportedServiceNames() throw();
+extern OUString SAL_CALL
+ SmXMLExportMeta_getImplementationName() throw();
+extern Reference< XInterface > SAL_CALL
+ SmXMLExportMeta_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
+extern Sequence< OUString > SAL_CALL
+ SmXMLExportSettings_getSupportedServiceNames() throw();
+extern OUString SAL_CALL
+ SmXMLExportSettings_getImplementationName() throw();
+extern Reference< XInterface > SAL_CALL
+ SmXMLExportSettings_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
+extern Sequence< OUString > SAL_CALL
+ SmXMLExportContent_getSupportedServiceNames() throw();
+extern OUString SAL_CALL
+ SmXMLExportContent_getImplementationName() throw();
+extern Reference< XInterface > SAL_CALL
+ SmXMLExportContent_createInstance(const Reference< XMultiServiceFactory > & rSMgr) throw( Exception );
+
+
+extern "C" {
+
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char** ppEnvironmentTypeName,
+ uno_Environment** ppEnvironment )
+{
+ *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
+}
+
+sal_Bool SAL_CALL component_writeInfo( void* pServiceManager ,
+ void* pRegistryKey )
+{
+ Reference< registry::XRegistryKey >
+ xKey( reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ) ) ;
+
+ OUString aDelimiter( RTL_CONSTASCII_USTRINGPARAM("/") );
+ OUString aUnoServices( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") );
+
+ // Eigentliche Implementierung und ihre Services registrieren
+ sal_Int32 i;
+ Reference< registry::XRegistryKey > xNewKey;
+
+ xNewKey = xKey->createKey( aDelimiter + SmXMLImport_getImplementationName() +
+ aUnoServices );
+
+ Sequence< OUString > aServices = SmXMLImport_getSupportedServiceNames();
+ for(i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i] );
+
+ xNewKey = xKey->createKey( aDelimiter + SmXMLExport_getImplementationName() +
+ aUnoServices );
+
+ aServices = SmXMLExport_getSupportedServiceNames();
+ for(i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i] );
+
+ xNewKey = xKey->createKey( aDelimiter + SmXMLImportMeta_getImplementationName() +
+ aUnoServices );
+
+ aServices = SmXMLImportMeta_getSupportedServiceNames();
+ for(i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i] );
+
+ xNewKey = xKey->createKey( aDelimiter + SmXMLExportMeta_getImplementationName() +
+ aUnoServices );
+
+ aServices = SmXMLExportMeta_getSupportedServiceNames();
+ for(i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i] );
+
+ xNewKey = xKey->createKey( aDelimiter + SmXMLImportSettings_getImplementationName() +
+ aUnoServices );
+
+ aServices = SmXMLImportSettings_getSupportedServiceNames();
+ for(i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i] );
+
+ xNewKey = xKey->createKey( aDelimiter + SmXMLExportSettings_getImplementationName() +
+ aUnoServices );
+
+ aServices = SmXMLExportSettings_getSupportedServiceNames();
+ for(i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i] );
+
+ xNewKey = xKey->createKey( aDelimiter + SmXMLExportContent_getImplementationName() +
+ aUnoServices );
+
+ aServices = SmXMLExportContent_getSupportedServiceNames();
+ for(i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i] );
+
+ xNewKey = xKey->createKey( aDelimiter + SmDocument_getImplementationName() +
+ aUnoServices );
+
+ aServices = SmDocument_getSupportedServiceNames();
+ for(i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i] );
+
+ return sal_True;
+}
+
+void* SAL_CALL component_getFactory( const sal_Char* pImplementationName,
+ void* pServiceManager,
+ void* pRegistryKey )
+{
+ // Set default return value for this operation - if it failed.
+ void* pReturn = NULL ;
+
+ if (
+ ( pImplementationName != NULL ) &&
+ ( pServiceManager != NULL )
+ )
+ {
+ // Define variables which are used in following macros.
+ Reference< XSingleServiceFactory > xFactory ;
+ Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
+
+ if( SmXMLImport_getImplementationName().equalsAsciiL(
+ pImplementationName, strlen(pImplementationName)) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SmXMLImport_getImplementationName(),
+ SmXMLImport_createInstance,
+ SmXMLImport_getSupportedServiceNames() );
+ }
+ else if( SmXMLExport_getImplementationName().equalsAsciiL(
+ pImplementationName, strlen(pImplementationName)) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SmXMLExport_getImplementationName(),
+ SmXMLExport_createInstance,
+ SmXMLExport_getSupportedServiceNames() );
+ }
+ else if( SmXMLImportMeta_getImplementationName().equalsAsciiL(
+ pImplementationName, strlen(pImplementationName)) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SmXMLImportMeta_getImplementationName(),
+ SmXMLImportMeta_createInstance,
+ SmXMLImportMeta_getSupportedServiceNames() );
+ }
+ else if( SmXMLExportMeta_getImplementationName().equalsAsciiL(
+ pImplementationName, strlen(pImplementationName)) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SmXMLExportMeta_getImplementationName(),
+ SmXMLExportMeta_createInstance,
+ SmXMLExportMeta_getSupportedServiceNames() );
+ }
+ else if( SmXMLImportSettings_getImplementationName().equalsAsciiL(
+ pImplementationName, strlen(pImplementationName)) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SmXMLImportSettings_getImplementationName(),
+ SmXMLImportSettings_createInstance,
+ SmXMLImportSettings_getSupportedServiceNames() );
+ }
+ else if( SmXMLExportSettings_getImplementationName().equalsAsciiL(
+ pImplementationName, strlen(pImplementationName)) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SmXMLExportSettings_getImplementationName(),
+ SmXMLExportSettings_createInstance,
+ SmXMLExportSettings_getSupportedServiceNames() );
+ }
+ else if( SmXMLExportContent_getImplementationName().equalsAsciiL(
+ pImplementationName, strlen(pImplementationName)) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SmXMLExportContent_getImplementationName(),
+ SmXMLExportContent_createInstance,
+ SmXMLExportContent_getSupportedServiceNames() );
+ }
+ else if( SmDocument_getImplementationName().equalsAsciiL(
+ pImplementationName, strlen(pImplementationName)) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SmDocument_getImplementationName(),
+ SmDocument_createInstance,
+ SmDocument_getSupportedServiceNames() );
+ }
+
+
+ // Factory is valid - service was found.
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pReturn = xFactory.get();
+ }
+ }
+
+ // Return with result of this operation.
+ return pReturn ;
+}
+} // extern "C"
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_smdll.cxx b/binfilter/bf_starmath/source/starmath_smdll.cxx
new file mode 100644
index 000000000000..9860b215ed5e
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_smdll.cxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svx/svxids.hrc>
+
+#include <document.hxx>
+
+#include <starmath.hrc>
+namespace binfilter {
+
+BOOL SmDLL::bInitialized = FALSE;
+
+/*************************************************************************
+|*
+|* Initialisierung
+|*
+\************************************************************************/
+/*N*/ void SmDLL::Init()
+/*N*/ {
+/*N*/ if ( bInitialized )
+/*N*/ return;
+/*N*/
+/*N*/ bInitialized = TRUE;
+/*N*/
+/*N*/ // called directly after loading the DLL
+/*N*/ // do whatever you want, you may use Sd-DLL too
+/*N*/
+/*N*/ // the SdModule must be created
+/*N*/
+/*N*/ SmModuleDummy** ppShlPtr = (SmModuleDummy**) GetAppData(BF_SHL_SM);
+/*N*/
+/*N*/ SvFactory* pFact = PTR_CAST(SvFactory,(*ppShlPtr)->pSmDocShellFactory);
+/*N*/ delete (*ppShlPtr);
+/*N*/ (*ppShlPtr) = new SmModule(pFact);
+/*N*/ (*ppShlPtr)->pSmDocShellFactory = pFact;
+/*N*/
+/*N*/ String aResDll(C2S("sm"));
+/*N*/
+/*N*/ SfxModule *p = SM_MOD1();
+/*N*/ SmModule *pp = (SmModule *) p;
+/*N*/
+}
+
+/*************************************************************************
+|*
+|* Deinitialisierung
+|*
+\************************************************************************/
+/*N*/ void SmDLL::Exit()
+/*N*/ {
+/*N*/ // the SdModule must be destroyed
+/*N*/ SmModuleDummy** ppShlPtr = (SmModuleDummy**) GetAppData(BF_SHL_SM);
+/*N*/ delete (*ppShlPtr);
+/*N*/ (*ppShlPtr) = NULL;
+/*N*/
+/*N*/ *GetAppData(BF_SHL_SM) = 0;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_smlib.cxx b/binfilter/bf_starmath/source/starmath_smlib.cxx
new file mode 100644
index 000000000000..9fba04cd4ce3
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_smlib.cxx
@@ -0,0 +1,320 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <comphelper/classids.hxx>
+#include <bf_sfx2/docfile.hxx>
+#include <bf_sfx2/app.hxx>
+#include <bf_sfx2/fcontnr.hxx>
+
+
+#include "document.hxx"
+#include "starmath.hrc"
+
+#include "dllname.hxx"
+namespace binfilter {
+
+TYPEINIT1( SmModuleDummy, SfxModule );
+
+
+/*************************************************************************
+|*
+|* ObjectFactory registrieren
+|*
+\************************************************************************/
+
+extern "C" { static void SAL_CALL thisModule() {} }
+
+SFX_IMPL_OBJECTFACTORY_LIB( SmDocShell,
+ SFXOBJECTSHELL_STD_NORMAL,
+ smath,
+ SvGlobalName(BF_SO3_SM_CLASSID), Sm,
+ String::CreateFromAscii(DLL_NAME) )
+{
+ SfxObjectFactory& rFactory = (SfxObjectFactory&)Factory();
+ SfxFactoryFilterContainer *pFltContainer = rFactory.GetFilterContainer( FALSE );
+ rFactory.GetFilterContainer()->SetDetectFilter( &SmDLL::DetectFilter );
+
+ // FG: Sonst gibts keine Hilfe im Math #38447#
+ Factory().SetDocumentServiceName( String::CreateFromAscii("com.sun.star.formula.FormulaProperties") );
+}
+
+
+/*************************************************************************
+|*
+|* Ctor
+|* the ctor is called at the beginning of SfxApplication-subclass::Main()
+|* do whatever you want, but no calls to Sd-DLL-code!
+|*
+\************************************************************************/
+
+SmDLL::SmDLL()
+{
+ (*(SmDLL**)GetAppData(BF_SHL_SM)) = this;
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|* the dtor is called at the end of SfxApplication-subclass::Main()
+|* do whatever you want, but no calls to Sd-DLL-code!
+|*
+\************************************************************************/
+
+SmDLL::~SmDLL()
+{
+ (*(SmDLL**)GetAppData(BF_SHL_SM)) = NULL;
+}
+
+/*************************************************************************
+|*
+|* LibInit
+|* method is called before Application::Execute()
+|* do whatever you want, but no calls to Sd-DLL-code!
+|*
+\************************************************************************/
+
+void SmDLL::LibInit()
+{
+ SmDocShell::RegisterFactory(SDT_SMA_DOCFACTPRIO);
+ SM_MOD() = new SmModuleDummy(NULL, TRUE, &SmDocShell::Factory());
+
+}
+
+/*************************************************************************
+|*
+|* LibExit
+|* this method is called after Application::Execute()
+|* do whatever you want, but no calls to Sd-DLL-code!
+|*
+\************************************************************************/
+
+void SmDLL::LibExit()
+{
+ FreeLibSm();
+
+ // destroy the dummy-module with Object-Factory-Pointer
+ SfxModule *p = SM_MOD();
+ delete p;
+}
+
+/************-*************************************************************
+|*
+|* Unterfenster oeffnen
+|*
+\************************************************************************/
+
+SfxModule *SmModuleDummy::Load ()
+{
+ return LoadLibSm () ? SM_MOD() : 0;
+}
+
+/*************************************************************************
+|*
+|* Bestimme die GUID abh. von der Version
+|*
+\************************************************************************/
+
+const SvGlobalName SmModuleDummy::GetID (USHORT nFileFormat)
+{
+ SvGlobalName aName;
+
+ switch (nFileFormat)
+ {
+ case SOFFICE_FILEFORMAT_60:
+ {
+ aName = SvGlobalName(BF_SO3_SM_CLASSID_60);
+ }
+ break;
+
+ case SOFFICE_FILEFORMAT_50:
+ {
+ aName = SvGlobalName(BF_SO3_SM_CLASSID_50);
+ }
+ break;
+
+ case SOFFICE_FILEFORMAT_40:
+ {
+ aName = SvGlobalName(BF_SO3_SM_CLASSID_40);
+ }
+ break;
+
+ case SOFFICE_FILEFORMAT_31:
+ {
+ aName = SvGlobalName(BF_SO3_SM_CLASSID_30);
+ }
+ break;
+
+ default:
+ {
+ DBG_ASSERT(FALSE, "Unbekanntes Fileformat!");
+ }
+ break;
+ }
+
+ return aName;
+}
+
+/*************************************************************************
+|*
+|* Bestimme die Version aus der GUID
+|*
+\************************************************************************/
+
+USHORT SmModuleDummy::HasID (const SvGlobalName &rName)
+{
+ static const USHORT aIdArr[] = { SOFFICE_FILEFORMAT_31,
+ SOFFICE_FILEFORMAT_40,
+ SOFFICE_FILEFORMAT_50,
+ SOFFICE_FILEFORMAT_60,
+ 0 };
+
+ const USHORT *pArr = aIdArr; for( ; *pArr; ++pArr )
+ if( GetID( *pArr ) == rName )
+ break;
+ return *pArr;
+}
+
+ULONG SmDLL::DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter,
+ SfxFilterFlags nMust, SfxFilterFlags nDont )
+{
+ ULONG nReturn = ERRCODE_ABORT;
+ if( SVSTREAM_OK != rMedium.GetError() )
+ nReturn = rMedium.GetError();
+ else if ( rMedium.IsStorage() )
+ {
+ // Storage
+ SvStorage* pStorage = rMedium.GetStorage();
+
+ if( !pStorage )
+ nReturn = ULONG_MAX;
+ else
+ {
+ // Erkennung ueber contained streams (StarChart 3.0)
+ static const sal_Char sStrmNm_0[] = "StarMathDocument";
+ static const sal_Char sFltrNm_0[] = "StarMath 5.0";
+ static const sal_Char sStrmNm_1[] = "Equation Native";
+ static const sal_Char sFltrNm_1[] = "MathType 3.x";
+ static const sal_Char sStrmNm_2[] = "content.xml";
+ static const sal_Char sFltrNm_2[] = STAROFFICE_XML;
+ static const sal_Char sStrmNm_3[] = "Content.xml";
+ static const sal_Char sFltrNm_3[] = STAROFFICE_XML;
+
+ const sal_uInt16 nCount = 4;
+ const sal_Char *aStrmNms[nCount] =
+ { sStrmNm_0, sStrmNm_1, sStrmNm_2, sStrmNm_3 };
+ const sal_Char *aFltrNms[nCount] =
+ { sFltrNm_0, sFltrNm_1, sFltrNm_2, sFltrNm_3 };
+
+ String aStreamName;
+ String sFilterName;
+ if( *ppFilter )
+ {
+ for( sal_uInt16 i=0; i < nCount; i++ )
+ {
+ if( (*ppFilter)->GetFilterName().EqualsAscii(aFltrNms[i]) )
+ {
+ aStreamName.AssignAscii( aStrmNms[i] );
+ if( pStorage->IsStream( aStreamName ) &&
+ ((*ppFilter)->GetFilterFlags() & nMust) == nMust &&
+ ((*ppFilter)->GetFilterFlags() & nDont) == 0 )
+ nReturn = ERRCODE_NONE;
+
+ break; // The old XML filter (Content.xml) will be
+ // detected in the next loop.
+ }
+ }
+ }
+
+ if( ERRCODE_NONE != nReturn )
+ {
+ for( sal_uInt16 i=0; i < nCount; i++ )
+ {
+ aStreamName.AssignAscii( aStrmNms[i] );
+ if( pStorage->IsStream( aStreamName ))
+ {
+ sFilterName.AssignAscii( aFltrNms[i] );
+ const SfxFilter* pFilt = SFX_APP()->GetFilter(
+ SmDocShell::Factory(), sFilterName );
+
+ if( pFilt &&
+ (pFilt->GetFilterFlags() & nMust) == nMust &&
+ (pFilt->GetFilterFlags() & nDont) == 0)
+ {
+ *ppFilter = pFilt;
+ nReturn = ERRCODE_NONE;
+ }
+
+ break; // There are no two filters with the same strm name
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ //Test to see if this begins with xml and if so run it through
+ //the MathML filter. There are all sorts of things wrong with
+ //this approach, to be fixed at a better level than here
+ SvStream *pStrm = rMedium.GetInStream();
+ if (pStrm && !pStrm->GetError())
+ {
+ const int nSize = 5;
+ sal_Char aBuffer[nSize+1];
+ aBuffer[nSize] = 0;
+ ULONG nBytesRead = pStrm->Read( aBuffer, nSize );
+ pStrm->Seek( STREAM_SEEK_TO_BEGIN );
+ if (nBytesRead == nSize)
+ {
+ if (0 == strncmp( "<?xml",aBuffer,nSize))
+ {
+ static const sal_Char sFltrNm_2[] = MATHML_XML;
+
+ String sFltrNm;
+ sFltrNm.AssignAscii( sFltrNm_2 );
+ const SfxFilter* pFilt = SFX_APP()->GetFilter(
+ SmDocShell::Factory(), sFltrNm );
+ *ppFilter = pFilt;
+
+ nReturn = ERRCODE_NONE;
+ }
+ }
+ }
+ }
+ return nReturn;
+}
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_smmod.cxx b/binfilter/bf_starmath/source/starmath_smmod.cxx
new file mode 100644
index 000000000000..9da2e06e2f25
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_smmod.cxx
@@ -0,0 +1,263 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <bf_sfx2/app.hxx>
+#include <bf_svtools/whiter.hxx>
+#include <bf_sfx2/sfx.hrc>
+#include <bf_svx/svxids.hrc>
+#include <bf_svtools/syslocale.hxx>
+
+#include <vcl/virdev.hxx>
+
+#include <bf_svtools/itemset.hxx>
+
+#include "smmod.hxx"
+#include <bf_so3/factory.hxx>
+
+#include "config.hxx"
+#include "starmath.hrc"
+namespace binfilter {//STRIP009
+/*N*/ TYPEINIT1( SmModuleDummy, SfxModule );
+/*N*/ TYPEINIT1( SmModule, SmModuleDummy );
+
+/*N*/ SmLocalizedSymbolData::SmLocalizedSymbolData() :
+/*N*/ Resource( SmResId(RID_LOCALIZED_NAMES) ),
+/*N*/ aUiSymbolNamesAry ( SmResId(RID_UI_SYMBOL_NAMES) ),
+/*N*/ aExportSymbolNamesAry ( SmResId(RID_EXPORT_SYMBOL_NAMES) ),
+/*N*/ aUiSymbolSetNamesAry ( SmResId(RID_UI_SYMBOLSET_NAMES) ),
+/*N*/ aExportSymbolSetNamesAry( SmResId(RID_EXPORT_SYMBOLSET_NAMES) ),
+/*N*/ p50NamesAry ( 0 ),
+/*N*/ p60NamesAry ( 0 ),
+/*N*/ n50NamesLang ( LANGUAGE_NONE ),
+/*N*/ n60NamesLang ( LANGUAGE_NONE )
+/*N*/ {
+/*N*/ FreeResource();
+/*N*/ }
+
+
+/*N*/ SmLocalizedSymbolData::~SmLocalizedSymbolData()
+/*N*/ {
+/*N*/ delete p50NamesAry;
+/*N*/ delete p60NamesAry;
+/*N*/ }
+
+
+/*N*/ const String SmLocalizedSymbolData::GetUiSymbolName( const String &rExportName ) const
+/*N*/ {
+/*N*/ String aRes;
+/*N*/
+/*N*/ const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData();
+/*N*/ const ResStringArray &rUiNames = rData.GetUiSymbolNamesArray();
+/*N*/ const ResStringArray &rExportNames = rData.GetExportSymbolNamesArray();
+/*N*/ USHORT nCount = rExportNames.Count();
+/*N*/ for (USHORT i = 0; i < nCount && !aRes.Len(); ++i)
+/*N*/ {
+/*N*/ if (rExportName == rExportNames.GetString(i))
+/*N*/ {
+/*N*/ aRes = rUiNames.GetString(i);
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return aRes;
+/*N*/ }
+
+
+/*N*/ const String SmLocalizedSymbolData::GetExportSymbolName( const String &rUiName ) const
+/*N*/ {
+/*N*/ String aRes;
+/*N*/
+/*N*/ const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData();
+/*N*/ const ResStringArray &rUiNames = rData.GetUiSymbolNamesArray();
+/*N*/ const ResStringArray &rExportNames = rData.GetExportSymbolNamesArray();
+/*N*/ USHORT nCount = rUiNames.Count();
+/*N*/ for (USHORT i = 0; i < nCount && !aRes.Len(); ++i)
+/*N*/ {
+/*N*/ if (rUiName == rUiNames.GetString(i))
+/*N*/ {
+/*N*/ aRes = rExportNames.GetString(i);
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return aRes;
+/*N*/ }
+
+
+/*N*/ const String SmLocalizedSymbolData::GetUiSymbolSetName( const String &rExportName ) const
+/*N*/ {
+/*N*/ String aRes;
+/*N*/
+/*N*/ const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData();
+/*N*/ const ResStringArray &rUiNames = rData.GetUiSymbolSetNamesArray();
+/*N*/ const ResStringArray &rExportNames = rData.GetExportSymbolSetNamesArray();
+/*N*/ USHORT nCount = rExportNames.Count();
+/*N*/ for (USHORT i = 0; i < nCount && !aRes.Len(); ++i)
+/*N*/ {
+/*N*/ if (rExportName == rExportNames.GetString(i))
+/*N*/ {
+/*N*/ aRes = rUiNames.GetString(i);
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return aRes;
+/*N*/ }
+
+
+
+
+/*N*/ const ResStringArray* SmLocalizedSymbolData::Get50NamesArray( LanguageType nLang )
+/*N*/ {
+/*N*/ if (nLang != n50NamesLang)
+/*N*/ {
+/*N*/ int nRID;
+/*N*/ switch (nLang)
+/*N*/ {
+/*?*/ case LANGUAGE_FRENCH : nRID = RID_FRENCH_50_NAMES; break;
+/*?*/ case LANGUAGE_ITALIAN : nRID = RID_ITALIAN_50_NAMES; break;
+/*?*/ case LANGUAGE_SWEDISH : nRID = RID_SWEDISH_50_NAMES; break;
+/*?*/ case LANGUAGE_SPANISH : nRID = RID_SPANISH_50_NAMES; break;
+/*N*/ default : nRID = -1; break;
+/*N*/ }
+/*N*/ delete p50NamesAry;
+/*N*/ p50NamesAry = 0;
+/*N*/ n50NamesLang = nLang;
+/*N*/ if (-1 != nRID)
+/*?*/ p50NamesAry = new SmNamesArray( n50NamesLang, nRID );
+/*N*/ }
+/*N*/
+/*N*/ return p50NamesAry ? &p50NamesAry->GetNamesArray() : 0;
+/*N*/ }
+
+
+/*N*/ const ResStringArray* SmLocalizedSymbolData::Get60NamesArray( LanguageType nLang )
+/*N*/ {
+/*N*/ if (nLang != n60NamesLang)
+/*N*/ {
+/*N*/ int nRID;
+/*N*/ switch (nLang)
+/*N*/ {
+/*?*/ case LANGUAGE_FRENCH : nRID = RID_FRENCH_60_NAMES; break;
+/*?*/ case LANGUAGE_ITALIAN : nRID = RID_ITALIAN_60_NAMES; break;
+/*?*/ case LANGUAGE_SWEDISH : nRID = RID_SWEDISH_60_NAMES; break;
+/*?*/ case LANGUAGE_SPANISH : nRID = RID_SPANISH_60_NAMES; break;
+/*N*/ default : nRID = -1; break;
+/*N*/ }
+/*N*/ delete p60NamesAry;
+/*N*/ p60NamesAry = 0;
+/*N*/ n60NamesLang = nLang;
+/*N*/ if (-1 != nRID)
+/*?*/ p60NamesAry = new SmNamesArray( n60NamesLang, nRID );
+/*N*/ }
+/*N*/
+/*N*/ return p60NamesAry ? &p60NamesAry->GetNamesArray() : 0;
+/*N*/ }
+
+/*N*/ SmModule::SmModule(SvFactory* pObjFact) :
+/*N*/ SmModuleDummy(SFX_APP()->CreateResManager("bf_sm"), FALSE, pObjFact), //STRIP005
+/*N*/ pConfig( 0 ),
+/*N*/ pColorConfig( 0 ),
+/*N*/ pLocSymbolData( 0 ),
+/*N*/ pRectCache( new SmRectCache ),
+/*N*/ pSysLocale( 0 ),
+/*N*/ pVirtualDev( 0 )
+/*N*/ {
+/*N*/ SetName( C2S("StarMath" ));
+/*N*/ }
+
+
+/*N*/ SmModule::~SmModule()
+/*N*/ {
+/*N*/ delete pConfig;
+/*N*/ delete pColorConfig;
+/*N*/ delete pLocSymbolData;
+/*N*/ delete pRectCache;
+/*N*/ delete pSysLocale;
+/*N*/ delete pVirtualDev;
+/*N*/ }
+
+/*N*/ void SmModule::_CreateSysLocale() const
+/*N*/ {
+/*N*/ SmModule* pThis = (SmModule*)this;
+/*N*/ pThis->pSysLocale = new SvtSysLocale;
+/*N*/ }
+
+/*N*/ void SmModule::_CreateVirtualDev() const
+/*N*/ {
+/*N*/ SmModule* pThis = (SmModule*)this;
+/*N*/ pThis->pVirtualDev = new VirtualDevice;
+/*N*/ }
+
+/*N*/ void SmModule::ApplyColorConfigValues( const ColorConfig &rColorCfg )
+/*N*/ {
+/*N*/ }
+
+/*N*/ ColorConfig & SmModule::GetColorConfig()
+/*N*/ {
+/*N*/ if(!pColorConfig)
+/*N*/ {
+/*N*/ pColorConfig = new ColorConfig;
+/*N*/ ApplyColorConfigValues( *pColorConfig );
+/*N*/ StartListening( *pColorConfig );
+/*N*/ }
+/*N*/ return *pColorConfig;
+/*N*/ }
+
+/*N*/ void SmModule::Notify( SfxBroadcaster &rBC, const SfxHint &rHint )
+/*N*/ {
+/*N*/ if (rHint.ISA(SfxSimpleHint))
+/*N*/ {
+/*N*/ ULONG nHintId = ((SfxSimpleHint&)rHint).GetId();
+/*N*/ if (SFX_HINT_COLORS_CHANGED == nHintId)
+/*N*/ ApplyColorConfigValues(*pColorConfig);
+/*N*/ }
+/*N*/ }
+
+/*N*/ SmConfig * SmModule::GetConfig()
+/*N*/ {
+/*N*/ if(!pConfig)
+/*N*/ pConfig = new SmConfig;
+/*N*/ return pConfig;
+/*N*/ }
+
+/*N*/ SmLocalizedSymbolData & SmModule::GetLocSymbolData() const
+/*N*/ {
+/*N*/ if (!pLocSymbolData)
+/*N*/ ((SmModule *) this)->pLocSymbolData = new SmLocalizedSymbolData;
+/*N*/ return *pLocSymbolData;
+/*N*/ }
+
+/*N*/ SfxModule *SmModuleDummy::Load()
+/*N*/ {
+/*N*/ return 0;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_smres.src b/binfilter/bf_starmath/source/starmath_smres.src
new file mode 100644
index 000000000000..6d16ab080ccc
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_smres.src
@@ -0,0 +1,810 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define NO_LOCALIZE_EXPORT
+
+#include <bf_sfx2/sfx.hrc>
+#include <bf_svx/globlmn.hrc>
+#include "starmath.hrc"
+
+#define IMAGE_STDBTN_COLOR Color { Red = 0xff00; Green = 0x0000; Blue = 0xff00; }
+#define IMAGE_STDBTN_COLOR_HC IMAGE_STDBTN_COLOR
+
+#define MN_SUB_TOOLBAR 32
+#define WORKARROUND_1 1
+#define WORKARROUND_3 3
+#define WORKARROUND_10 10
+
+
+WarningBox RID_NOMATHTYPEFACEWARNING
+{
+ Message [ de ] = "Der \"StarMath\" Font ist nicht installiert !\nOhne diesen Font kann StarMath nicht korrekt arbeiten...\nInstallieren Sie den Font und starten Sie StarMath erneut." ;
+ Message [ en-US ] = "The \"StarMath\" font has not been installed.\nWithout this font %PRODUCTNAME Math cannot function correctly.\nPlease install this font and restart %PRODUCTNAME Math." ;
+ Message [ x-comment ] = " ";
+ Message[ pt ] = "O tipo de letra \"StarMath\" não está instalado!\nSem este tipo de letra o %PRODUCTNAME Math não operará correctamente.\nInstale o tipo de letra e reinicie a aplicação.";
+ Message[ ru ] = "Ðе уÑтановлен шрифт \"StarMath\".\nБез Ñтого шрифта %PRODUCTNAME Math не может корректно работать...\nУÑтановите шрифт и перезапуÑтите %PRODUCTNAME Math.";
+ Message[ el ] = "Η γÏαμματοσειÏά \"StarMath\" δεν έχει εγκατασταθεί.\nΔεν είναι δυνατή η σωστή λειτουÏγία του %PRODUCTNAME Math χωÏίς τη συγκεκÏιμένη γÏαμματοσειÏά.\nΕγκαταστήστε τη γÏαμματοσειÏά και επανεκκινήστε το %PRODUCTNAME Math.";
+ Message[ nl ] = "Het lettertype 'StarMath' is niet geïnstalleerd!\nZonder dit lettertype werkt %PRODUCTNAME Math niet correct.\nInstalleer dit lettertype en start %PRODUCTNAME Math opnieuw.";
+ Message[ fr ] = "La police \"StarMath\" n'est pas installée !\nSans cette police, %PRODUCTNAME Math ne fonctionne pas correctement...\nInstallez la police et redémarrez %PRODUCTNAME Math.";
+ Message[ es ] = "¡La fuente \"StarMath\" no está instalada!\nSin esta fuente StarMath no funcionará correctamente...\nInstale la fuente y reinicie StarMath.";
+ Message[ fi ] = "Fonttia StarMath ei ole asennettu.\nIlman tätä fonttia %PRODUCTNAME Math ei toimi kunnolla.\nAsenna fontti ja käynnistä %PRODUCTNAME Math uudelleen.";
+ Message[ ca ] = "El tipus de lletra \"StarMath\" no està instal.lat!\nSense aquesta StarMath no funcionarà correctament...\nInstal.leu el tipus de lletra i reinicieu StarMath.";
+ Message[ it ] = "Il carattere \"StarMath\" non è installato.\nSenza questo carattere %PRODUCTNAME Math non funzionerà in modo corretto.\nInstallate questo carattere e riavviate %PRODUCTNAME Math.";
+ Message[ sk ] = "Písmo \"StarMath\" nebolo nainštalované.\nBez tohto písma %PRODUCTNAME Math nedokáže korektne pracovať.\nProsím nainštalujte toto písmo a znovu spustte %PRODUCTNAME Math.";
+ Message[ da ] = "Skrifttypen \"StarMath\" er ikke installeret!\nUden denne skrifttype kan %PRODUCTNAME Math ikke arbejde korrekt...\nInstaller venligst skrifttypen og genstart %PRODUCTNAME Math.";
+ Message[ sv ] = "Teckensnittet \"StarMath\" är inte installerat!\nUtan detta teckensnitt kan %PRODUCTNAME Math inte arbeta korrekt....\nInstallera teckensnittet och starta om %PRODUCTNAME Math.";
+ Message[ pl ] = "Czcionka \"StarMath\" nie jest zainstalowana.\nBez tej czcionki %PRODUCTNAME Math nie może poprawnie pracować.\nZainstaluj tę czcionkę i ponownie uruchom %PRODUCTNAME Math.";
+ Message[ pt-BR ] = "A Fonte '%PRODUCTNAME Math' não está instalada!\nSem esta Fonte o %PRODUCTNAME Math não funciona corretamente...\nPor favor, instale esta fonte e reinicie o %PRODUCTNAME Math.";
+ Message[ th ] = "ยังไม่ได้ติดตั้งตัวอัà¸à¸©à¸£ \"StarMath\" \nไม่มีตัวอัà¸à¸©à¸£à¸„ณิตศาสตร์ %PRODUCTNAME นี้ ไม่สามารถทำหน้าที่ได้ถูà¸à¸•à¹‰à¸­à¸‡.\nà¸à¸£à¸¸à¸“าติดตั้งตัวอัà¸à¸©à¸£à¸™à¸µà¹‰à¹à¸¥à¸°à¹€à¸£à¸´à¹ˆà¸¡à¸„ณิตศาสตร์ %PRODUCTNAME อีà¸à¸„รั้ง";
+ Message[ ja ] = "\"StarMath\" フォントãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•ã‚Œã¦ã„ã¾ã›ã‚“。\nã“ã®ãƒ•ã‚©ãƒ³ãƒˆãªã—ã§ã¯ %PRODUCTNAME Math ãŒã†ã¾ã機能ã—ã¾ã›ã‚“...\nã¾ãšãƒ•ã‚©ãƒ³ãƒˆã‚’インストールã—㦠%PRODUCTNAME Math ã‚’å†èµ·å‹•ã—ã¦ãã ã•ã„。";
+ Message[ ko ] = "\"StarMath\" ê¸€ê¼´ì´ ì„¤ì¹˜ë˜ì–´ 있지 않습니다!\nì´ ê¸€ê¼´ì´ ì—†ìœ¼ë©´%PRODUCTNAME Mathê°€ 제대로 ìž‘ì—…ì„ í•  수 없습니다...\nê¸€ê¼´ì„ ì„¤ì¹˜í•œ 다ìŒ, %PRODUCTNAME Math를 다시 시작하십시오.";
+ Message[ zh-CN ] = "没有安装 StarMath 字体ï¼\n没有这个 StarMath字体程åºä¼šæ— æ³•æ­£å¸¸è¿ä½œã€‚\n请在安装这个字体åŽé‡æ–°å¯åŠ¨ StarMath 。";
+ Message[ zh-TW ] = "æ²’æœ‰å®‰è£ StarMath å­—åž‹\n而無法正常é‹è¡Œï¼\nè«‹å®‰è£ StarMath 字型,然åŽå†é‡æ–°é–‹å•Ÿ StaMath。";
+ Message[ tr ] = "\"StarMath\" yazıtipi yüklenmedi!\nBu yazıtipi olmadan StarMath programı doğru bir biçimde çalışmaz...\nYazıtipini yükleyin ve %PRODUCTNAME Math programını yeniden başlatın.";
+ Message[ hi-IN ] = "StarMath अकà¥à¤·à¤° को पà¥à¤°à¤¤à¤¿à¤·à¥à¤ à¤¾à¤ªà¤¿à¤¤ नहीं किया है ।\nइस अकà¥à¤·à¤° के बिना %PRODUCTNAME गणित ठीक तरह से कारà¥à¤¯ पूरा नहीं कर सकता है ।\nकृपया इस अकà¥à¤·à¤° को पà¥à¤°à¤¤à¤¿à¤·à¥à¤ à¤¾à¤ªà¤¿à¤¤ कीजिठऔर %PRODUCTNAME गणित को पà¥à¤¨à¤ƒ पà¥à¤°à¤¾à¤°à¤‚भ कीजिठ।";
+ Message[ ar ] = "الخط \"StarMath\" غير Ù…Ùثبَّت!\nبدون هذا الخط لا يستطيع %PRODUCTNAME Math العمل بشكل صحيح...\nالرجاء تثبيت هذا الخط، ثم بدء %PRODUCTNAME Math مجدداً.";
+ Message[ he ] = "‮גופן ×” \"StarMath\" ×ינו מותקן.\n×œ×œ× ×’×•×¤×Ÿ ×–×”, %PRODUCTNAME Math ×œ× ×™×¤×¢×œ ב×ופן תקין.\n× × ×œ×”×ª×§×™×Ÿ ×ת הגופן ול×תחל ×ת %PRODUCTNAME Math.‬";
+};
+
+
+
+String RID_APPLICATION
+{
+ Text = "StarMath" ;
+};
+
+String RID_VIEWNAME
+{
+ Text = "StarMath" ;
+};
+
+#define CMDBOXWINDOW_TEXT \
+ Text [ de ] = "Kommandos" ; \
+ Text [ en-US ] = "Commands" ; \
+ Text [ x-comment ] = " "; \
+ Text[ pt ] = "Comandos";\
+ Text[ ru ] = "Команды";\
+ Text[ el ] = "Εντολές";\
+ Text[ nl ] = "Commando´s";\
+ Text[ fr ] = "Commandes";\
+ Text[ es ] = "Órdenes";\
+ Text[ fi ] = "Komennot";\
+ Text[ ca ] = "Commands";\
+ Text[ it ] = "Comandi";\
+ Text[ sk ] = "Príkazy";\
+ Text[ da ] = "Kommandoer";\
+ Text[ sv ] = "Kommandon";\
+ Text[ pl ] = "Polecenia";\
+ Text[ pt-BR ] = "Comandos";\
+ Text[ th ] = "คำสั่ง";\
+ Text[ ja ] = "コマンド";\
+ Text[ ko ] = "명령";\
+ Text[ zh-CN ] = "命令";\
+ Text[ zh-TW ] = "指令";\
+ Text[ tr ] = "Komutlar";\
+ Text[ hi-IN ] = "Commands";\
+ Text[ ar ] = "أوامر";\
+ Text[ he ] = "‮פקודות‬";\
+
+DockingWindow RID_CMDBOXWINDOW\
+{
+ HelpId = HID_SMA_COMMAND_WIN ;
+ Moveable = TRUE ;
+ Closeable = FALSE ;
+ Sizeable = TRUE ;
+ OutputSize = TRUE ;
+ HideWhenDeactivate = FALSE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 292 , 94 ) ;
+ Dockable = TRUE ;
+ CMDBOXWINDOW_TEXT
+};
+
+#define _ID_LIST \
+ IdList =\
+ {\
+ SID_NEXTERR ;\
+ SID_PREVERR ;\
+ SID_VIEW050 ;\
+ SID_VIEW100 ;\
+ SID_VIEW200 ;\
+ SID_ZOOMIN ;\
+ SID_ZOOMOUT ;\
+ SID_ADJUST ;\
+ SID_DRAW ;\
+ SID_TOOLBOX ;\
+ SID_FONT ;\
+ SID_FONTSIZE ;\
+ SID_DISTANCE ;\
+ SID_ALIGN ;\
+ SID_FORMULACURSOR ;\
+ SID_SYMBOLS_CATALOGUE ;\
+ };\
+ IdCount = { 16; };
+
+String RID_DOCUMENTSTR
+{
+ Text [ de ] = "Formel" ;
+ Text [ en-US ] = "Formula" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Fórmula";
+ Text[ ru ] = "Формула";
+ Text[ el ] = "ΤÏπος";
+ Text[ nl ] = "Formule";
+ Text[ fr ] = "Formule";
+ Text[ es ] = "Fórmula";
+ Text[ fi ] = "Kaava";
+ Text[ ca ] = "Fórmula";
+ Text[ it ] = "Formula";
+ Text[ sk ] = "Vzorec";
+ Text[ da ] = "Formel";
+ Text[ sv ] = "Formel";
+ Text[ pl ] = "Formuła";
+ Text[ pt-BR ] = "Fórmula";
+ Text[ th ] = "สูตรคำนวณ";
+ Text[ ja ] = "æ•°å¼";
+ Text[ ko ] = "수ì‹";
+ Text[ zh-CN ] = "å…¬å¼";
+ Text[ zh-TW ] = "å…¬å¼";
+ Text[ tr ] = "Formül";
+ Text[ hi-IN ] = "सूतà¥à¤°";
+ Text[ ar ] = "صيغة";
+ Text[ he ] = "‮נוסחה‬";
+};
+
+String STR_STATSTR_READING
+{
+ Text [ de ] = "Dokument wird geladen..." ;
+ Text [ en-US ] = "Loading document..." ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "A carregar documento...";
+ Text[ ru ] = "Загрузка документа...";
+ Text[ el ] = "Το έγγÏαφο φοÏτώνεται...";
+ Text[ nl ] = "Document wordt geladen...";
+ Text[ fr ] = "Chargement du document...";
+ Text[ es ] = "Cargando el documento...";
+ Text[ fi ] = "Avataan asiakirjaa...";
+ Text[ ca ] = "S'està carregant el document...";
+ Text[ it ] = "Il documento viene caricato...";
+ Text[ sk ] = "NaÄítavam dokument...";
+ Text[ da ] = "Dokumentet indlæses...";
+ Text[ sv ] = "Dokument laddas...";
+ Text[ pl ] = "Åadowanie dokumentu...";
+ Text[ pt-BR ] = "Carregando documento...";
+ Text[ th ] = "à¸à¸³à¸¥à¸±à¸‡à¹‚หลดเอà¸à¸ªà¸²à¸£...";
+ Text[ ja ] = "ドキュメントを読ã¿è¾¼ã‚“ã§ã„ã¾ã™...";
+ Text[ ko ] = "문서를 로드하는 중...";
+ Text[ zh-CN ] = "正在装入文档...";
+ Text[ zh-TW ] = "正在載入文件...";
+ Text[ tr ] = "Döküman yükleniyor...";
+ Text[ hi-IN ] = "लेखपतà¥à¤° लोड हो रहा है...";
+ Text[ ar ] = "جاري تحميل المستند...";
+ Text[ he ] = "‮טעינת המסמך...‬";
+};
+
+String STR_STATSTR_WRITING
+{
+ Text [ de ] = "Dokument wird gespeichert..." ;
+ Text [ en-US ] = "Saving document..." ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "A guardar documento...";
+ Text[ ru ] = "Сохранение документа...";
+ Text[ el ] = "Αποθήκευση εγγÏάφου...";
+ Text[ nl ] = "Document wordt opgeslagen...";
+ Text[ fr ] = "Enregistrement du document...";
+ Text[ es ] = "Guardando el documento...";
+ Text[ fi ] = "Tallennetaan asiakirjaa...";
+ Text[ ca ] = "S'està desant el document...";
+ Text[ it ] = "Il documento viene salvato...";
+ Text[ sk ] = "Ukladanie dokumentu...";
+ Text[ da ] = "Dokumentet gemmes...";
+ Text[ sv ] = "Dokument sparas...";
+ Text[ pl ] = "Zapisywanie dokumentu...";
+ Text[ pt-BR ] = "Salvando documento...";
+ Text[ th ] = "à¸à¸³à¸¥à¸±à¸‡à¸šà¸±à¸™à¸—ึà¸à¹€à¸­à¸à¸ªà¸²à¸£...";
+ Text[ ja ] = "ドキュメントをä¿å­˜ã—ã¦ã„ã¾ã™...";
+ Text[ ko ] = "문서 저장하는 중...";
+ Text[ zh-CN ] = "正在存盘文档...";
+ Text[ zh-TW ] = "正在儲存文件...";
+ Text[ tr ] = "Belgeyi kaydet...";
+ Text[ hi-IN ] = "लेखपतà¥à¤° बचाना...";
+ Text[ ar ] = "جاري Ø­Ùظ المستند...";
+ Text[ he ] = "‮שמירת המסמך...‬";
+};
+
+
+String STR_MATH_DOCUMENT_FULLTYPE_60
+{
+ Text [ de ] = "%PRODUCTNAME %PRODUCTVERSION Formel" ;
+ Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION Formula";
+ Text[ pt ] = "StarOffice 6.0 Fórmula";
+ Text[ ru ] = "Формула в %PRODUCTNAME 6.0";
+ Text[ el ] = "%PRODUCTNAME 6.0 ΤÏπος";
+ Text[ nl ] = "%PRODUCTNAME 6.0 Formule";
+ Text[ fr ] = "%PRODUCTNAME %PRODUCTVERSION Formule";
+ Text[ es ] = "Fórmula %PRODUCTNAME %PRODUCTVERSION ";
+ Text[ fi ] = "%PRODUCTNAME 6.0 -kaava";
+ Text[ ca ] = "%PRODUCTNAME 6.0 Fórmula";
+ Text[ it ] = "%PRODUCTNAME %PRODUCTVERSION Formula";
+ Text[ sk ] = "%PRODUCTNAME %PRODUCTVERSION vzorec";
+ Text[ da ] = "%PRODUCTNAME 6.0-formel";
+ Text[ sv ] = "%PRODUCTNAME %PRODUCTVERSION-formel";
+ Text[ pl ] = "%PRODUCTNAME 6.0 Formula";
+ Text[ pt-BR ] = "Fórmula do %PRODUCTNAME 6.0 ";
+ Text[ th ] = "สูตรคำนวณ %PRODUCTNAME 6.0 ";
+ Text[ ja ] = "%PRODUCTNAME %PRODUCTVERSION æ•°å¼";
+ Text[ ko ] = "%PRODUCTNAME %PRODUCTVERSION 수ì‹";
+ Text[ zh-CN ] = "%PRODUCTNAME %PRODUCTVERSION å…¬å¼";
+ Text[ zh-TW ] = "%PRODUCTNAME %PRODUCTVERSION å…¬å¼";
+ Text[ tr ] = "%PRODUCTNAME 6.0 Formül ";
+ Text[ hi-IN ] = "%PRODUCTNAME 6.0 सूतà¥à¤°";
+ Text[ ar ] = "%PRODUCTNAME 6.0 صيغة";
+ Text[ he ] = "‮נוסחת %PRODUCTNAME 6.0‬";
+};
+String STR_MATH_DOCUMENT_FULLTYPE_50
+{
+ Text [ de ] = "%PRODUCTNAME 5.0 Formel" ;
+ Text [ en-US ] = "%PRODUCTNAME 5.0 Formula" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Fórmula %PRODUCTNAME 5.0";
+ Text[ ru ] = "Формула %PRODUCTNAME 5.0";
+ Text[ el ] = "ΤÏπος (%PRODUCTNAME 5.0)";
+ Text[ nl ] = "%PRODUCTNAME 5.0 Formule";
+ Text[ fr ] = "%PRODUCTNAME 5.0 Formule";
+ Text[ es ] = "%PRODUCTNAME 5.0 - Fórmula";
+ Text[ fi ] = "%PRODUCTNAME 5.0 -kaava";
+ Text[ ca ] = "%PRODUCTNAME 5.0 Fórmula";
+ Text[ it ] = "Formula %PRODUCTNAME 5.0";
+ Text[ sk ] = "%PRODUCTNAME 5.0 Vzorec";
+ Text[ da ] = "%PRODUCTNAME 5.0 formel";
+ Text[ sv ] = "%PRODUCTNAME 5.0 formel";
+ Text[ pl ] = "%PRODUCTNAME 5.0 Formula";
+ Text[ pt-BR ] = "Fórmula do %PRODUCTNAME 5.0 ";
+ Text[ th ] = "สูตรคำนวณ %PRODUCTNAME 5.0 ";
+ Text[ ja ] = "%PRODUCTNAME 5.0 æ•°å¼";
+ Text[ ko ] = "%PRODUCTNAME 5.0 수ì‹";
+ Text[ zh-CN ] = "%PRODUCTNAME 5.0 å…¬å¼";
+ Text[ zh-TW ] = "%PRODUCTNAME 5.0 å…¬å¼";
+ Text[ tr ] = "%PRODUCTNAME 5.0 - Formül";
+ Text[ hi-IN ] = "%PRODUCTNAME 5.0 सूतà¥à¤°";
+ Text[ ar ] = "%PRODUCTNAME 5.0 صيغة";
+ Text[ he ] = "‮נוסחת %PRODUCTNAME 5.0‬";
+};
+
+String STR_MATH_DOCUMENT_FULLTYPE_40
+{
+ Text [ de ] = "%PRODUCTNAME 4.0 Formel" ;
+ Text [ en-US ] = "%PRODUCTNAME 4.0 Formula" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Fórmula %PRODUCTNAME 4.0";
+ Text[ ru ] = "Формула %PRODUCTNAME 4.0";
+ Text[ el ] = "ΤÏπος (%PRODUCTNAME 4.0)";
+ Text[ nl ] = "%PRODUCTNAME 4.0 Formule";
+ Text[ fr ] = "%PRODUCTNAME 4.0 Formule";
+ Text[ es ] = "%PRODUCTNAME 4.0 - Fórmula";
+ Text[ fi ] = "%PRODUCTNAME 4.0 -kaava";
+ Text[ ca ] = "%PRODUCTNAME 4.0 Fórmula";
+ Text[ it ] = "Formula %PRODUCTNAME 4.0";
+ Text[ sk ] = "%PRODUCTNAME 4.0 vzorec";
+ Text[ da ] = "%PRODUCTNAME 4.0 formel";
+ Text[ sv ] = "%PRODUCTNAME 4.0 formel";
+ Text[ pl ] = "%PRODUCTNAME 4.0 Formula";
+ Text[ pt-BR ] = "Fórmula do %PRODUCTNAME 4.0 ";
+ Text[ th ] = "สูตรคำนวณ %PRODUCTNAME 4.0 ";
+ Text[ ja ] = "%PRODUCTNAME 4.0 æ•°å¼";
+ Text[ ko ] = "%PRODUCTNAME 4.0 수ì‹";
+ Text[ zh-CN ] = "%PRODUCTNAME 4.0 å…¬å¼";
+ Text[ zh-TW ] = "%PRODUCTNAME 4.0 å…¬å¼";
+ Text[ tr ] = "%PRODUCTNAME 4.0 - Formül";
+ Text[ hi-IN ] = "%PRODUCTNAME 4.0 सूतà¥à¤°";
+ Text[ ar ] = "%PRODUCTNAME 4.0 صيغة";
+ Text[ he ] = "‮נוסחת %PRODUCTNAME 4.0‬";
+};
+
+String STR_MATH_DOCUMENT_FULLTYPE_31
+{
+ Text [ de ] = "%PRODUCTNAME 3.0 Formel" ;
+ Text [ en-US ] = "%PRODUCTNAME 3.0 Formula" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Fórmula %PRODUCTNAME 3.0";
+ Text[ ru ] = "Формула %PRODUCTNAME 3.0";
+ Text[ el ] = "%PRODUCTNAME 3.0 - ΤÏπος";
+ Text[ nl ] = "%PRODUCTNAME 3.0 Formule";
+ Text[ fr ] = "%PRODUCTNAME 3.0 Formule";
+ Text[ es ] = "%PRODUCTNAME 3.0 - Fórmula";
+ Text[ fi ] = "%PRODUCTNAME 3.0 -kaava";
+ Text[ ca ] = "%PRODUCTNAME 3.0 Fórmula";
+ Text[ it ] = "Formula %PRODUCTNAME 3.0";
+ Text[ sk ] = "%PRODUCTNAME 3.0 vzorec";
+ Text[ da ] = "%PRODUCTNAME 3.0 formel";
+ Text[ sv ] = "%PRODUCTNAME 3.0 formel";
+ Text[ pl ] = "%PRODUCTNAME 3.0 Formula";
+ Text[ pt-BR ] = "Fórmula do %PRODUCTNAME 3.0 ";
+ Text[ th ] = "สูตรคำนวณ %PRODUCTNAME 3.0 ";
+ Text[ ja ] = "%PRODUCTNAME 3.0 æ•°å¼";
+ Text[ ko ] = "%PRODUCTNAME 3.0 수ì‹";
+ Text[ zh-CN ] = "%PRODUCTNAME 3.0 å…¬å¼";
+ Text[ zh-TW ] = "%PRODUCTNAME 3.0 å…¬å¼";
+ Text[ tr ] = "%PRODUCTNAME 3.0 - Formül";
+ Text[ hi-IN ] = "%PRODUCTNAME 3.0 सूतà¥à¤°";
+ Text[ ar ] = "%PRODUCTNAME 3.0 صيغة";
+ Text[ he ] = "‮נוסחת %PRODUCTNAME 3.0‬";
+};
+
+
+
+String RID_ERR_IDENT
+{
+ Text [ de ] = "FEHLER : " ;
+ Text [ en-US ] = "ERROR : " ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "ERRO : ";
+ Text[ ru ] = "ОШИБКР: ";
+ Text[ el ] = "ΣΦΑΛΜΑ : ";
+ Text[ nl ] = "FOUT:";
+ Text[ fr ] = "ERREUR : ";
+ Text[ es ] = "ERROR : ";
+ Text[ fi ] = "VIRHE: ";
+ Text[ ca ] = "ERROR : ";
+ Text[ it ] = "ERRORE: ";
+ Text[ sk ] = "CHYBA : ";
+ Text[ da ] = "FEJL : ";
+ Text[ sv ] = "FEL : ";
+ Text[ pl ] = "BÅÄ„D:";
+ Text[ pt-BR ] = "ERRO : ";
+ Text[ th ] = "ผิดพลาด : ";
+ Text[ ja ] = "ERROR:";
+ Text[ ko ] = "오류: ";
+ Text[ zh-CN ] = "错误: ";
+ Text[ zh-TW ] = "錯誤: ";
+ Text[ tr ] = "HATA : ";
+ Text[ hi-IN ] = "ERROR :";
+ Text[ ar ] = ": خطأ";
+ Text[ he ] = "‮שגי××”: ‬";
+};
+
+String RID_ERR_UNKOWN
+{
+ Text [ de ] = "Ein unbekannter Fehler ist aufgetreten" ;
+ Text [ en-US ] = "Unknown error occurred" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Surgiu um erro desconhecido.";
+ Text[ ru ] = "ÐеизвеÑÑ‚Ð½Ð°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ°";
+ Text[ el ] = "ΠαÏουσιάστηκε άγνωστο σφάλμα";
+ Text[ nl ] = "Er is een onbekende fout opgetreden";
+ Text[ fr ] = "Une erreur inconnue est survenue.";
+ Text[ es ] = "Se ha producido un error desconocido";
+ Text[ fi ] = "Ilmeni tuntematon virhe";
+ Text[ ca ] = "S'ha produït un error desconegut";
+ Text[ it ] = "Si è avuto un errore sconosciuto";
+ Text[ sk ] = "Neznáma chyba";
+ Text[ da ] = "Der er optået en ukendt fejl";
+ Text[ sv ] = "Ett okänt fel har uppstått";
+ Text[ pl ] = "Wystąpił nieznany błąd";
+ Text[ pt-BR ] = "Ocorreu um erro desconhecido";
+ Text[ th ] = "ไม่รู้จัà¸à¸‚้อผิดพลาดที่เà¸à¸´à¸”ขึ้น";
+ Text[ ja ] = "ä¸æ˜Žãªã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿ";
+ Text[ ko ] = "ì•Œ 수 없는 오류가 ë°œìƒí–ˆìŠµë‹ˆë‹¤";
+ Text[ zh-CN ] = "å‘生一个ä¸æ˜Žçš„错误。";
+ Text[ zh-TW ] = "發生一個ä¸æ˜Žçš„錯誤。";
+ Text[ tr ] = "Bilinmeyen bir hata oluÅŸtu";
+ Text[ hi-IN ] = "अजà¥à¤žà¤¾à¤¤ गलती घटित हà¥à¤†";
+ Text[ ar ] = "حدث خطأ غير معروÙ";
+ Text[ he ] = "‮×רעה שגי××” ×œ× ×ž×•×›×¨×ªâ€¬";
+};
+
+String RID_ERR_UNEXPECTEDCHARACTER
+{
+ Text [ de ] = "Unerwartetes Zeichen" ;
+ Text [ en-US ] = "Unexpected character" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Caracter imprevisto";
+ Text[ ru ] = "Ðеожиданный Ñимвол";
+ Text[ el ] = "Μη αναμενόμενος χαÏακτήÏας";
+ Text[ nl ] = "Onverwacht teken";
+ Text[ fr ] = "Caractère imprévu";
+ Text[ es ] = "Carácter no esperado";
+ Text[ fi ] = "Odottamaton merkki";
+ Text[ ca ] = "Caràcter no esperat";
+ Text[ it ] = "Carattere inatteso";
+ Text[ sk ] = "NeoÄakávaný znak";
+ Text[ da ] = "Uventet tegn";
+ Text[ sv ] = "Oväntat tecken";
+ Text[ pl ] = "Nieoczekiwany znak";
+ Text[ pt-BR ] = "Caracter inesperado";
+ Text[ th ] = "ตัวอัà¸à¸‚ระที่ไม่คาดคิด";
+ Text[ ja ] = "ä¸é©å½“ãªæ–‡å­—";
+ Text[ ko ] = "예ìƒì¹˜ ì•Šì€ ë¬¸ìž";
+ Text[ zh-CN ] = "æ„外的字符";
+ Text[ zh-TW ] = "æ„外的字元";
+ Text[ tr ] = "Beklenmeyen karakter";
+ Text[ hi-IN ] = "आकसà¥à¤®à¤¿à¤• अकà¥à¤·à¤°";
+ Text[ ar ] = "حر٠غير متوقع";
+ Text[ he ] = "‮תו ×œ× ×¦×¤×•×™â€¬";
+};
+
+
+String RID_ERR_LGROUPEXPECTED
+{
+ Text [ de ] = "'{' erwartet" ;
+ Text [ en-US ] = "'{' expected" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Necessário '{'";
+ Text[ ru ] = "'{' ожидаетÑÑ";
+ Text[ el ] = "'{' αναμένεται";
+ Text[ nl ] = "'{' verwacht";
+ Text[ fr ] = "'{' requis";
+ Text[ es ] = "Se requiere '{'";
+ Text[ fi ] = "Tähän tarvitaan '{'";
+ Text[ ca ] = "Es necessita '{'";
+ Text[ it ] = "Atteso '{'";
+ Text[ sk ] = "OÄakávaná '{'";
+ Text[ da ] = "'{' forventes";
+ Text[ sv ] = "'{' förväntad";
+ Text[ pl ] = "Oczekiwano znaku '{'";
+ Text[ pt-BR ] = "É necessário '{'";
+ Text[ th ] = "'{' คาดคิด";
+ Text[ ja ] = "'{'ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "'{' 필요함";
+ Text[ zh-CN ] = "期待 '{'";
+ Text[ zh-TW ] = "期待<{>";
+ Text[ tr ] = "'{' gerekli";
+ Text[ hi-IN ] = "'{' की पà¥à¤°à¤¤à¥€à¤•à¥à¤·à¤¾";
+ Text[ ar ] = "مطلوب '{'";
+ Text[ he ] = "‮צפויה '{'‬";
+};
+
+String RID_ERR_RGROUPEXPECTED
+{
+ Text [ de ] = "'}' erwartet" ;
+ Text [ en-US ] = "'}' expected" ;
+ Text[ pt ] = "'}' necessária";
+ Text[ ru ] = "'}' ожидаетÑÑ";
+ Text[ el ] = "'}' αναμένεται";
+ Text[ nl ] = "'}' verwacht";
+ Text[ fr ] = "'}' requis";
+ Text[ es ] = "Se requiere '}'";
+ Text[ fi ] = "Tähän tarvitaan '}'";
+ Text[ ca ] = "Es necessita '}'";
+ Text[ it ] = "'}' atteso";
+ Text[ sk ] = "OÄakávaná '}'";
+ Text[ da ] = "'}' forventes";
+ Text[ sv ] = "'}' förväntad";
+ Text[ pl ] = "Oczekiwano znaku '}'";
+ Text[ pt-BR ] = "É necessário '}'";
+ Text[ th ] = "'}' คาดคิด";
+ Text[ ja ] = "'}'ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "'}' 가 필요함";
+ Text[ zh-CN ] = "期待 '}'";
+ Text[ zh-TW ] = "期待<}>";
+ Text[ tr ] = "'}' gerekli";
+ Text[ ar ] = "متوقع '}'";
+ Text[ he ] = "‮צפויה '}'‬";
+};
+
+String RID_ERR_LBRACEEXPECTED
+{
+ Text [ de ] = "'(' erwartet" ;
+ Text [ en-US ] = "'(' expected" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Necessário '('";
+ Text[ ru ] = "'(' ожидаетÑÑ";
+ Text[ el ] = "'(' αναμένεται";
+ Text[ nl ] = "'(' verwacht";
+ Text[ fr ] = "'(' requis";
+ Text[ es ] = "Se requiere '(' ";
+ Text[ fi ] = "Tähän tarvitaan '('";
+ Text[ ca ] = "Es necessita '(' ";
+ Text[ it ] = "Atteso '('";
+ Text[ sk ] = "OÄakávaná '('";
+ Text[ da ] = "'(' forventes";
+ Text[ sv ] = "'(' förväntad";
+ Text[ pl ] = "Oczekiwano znaku '('";
+ Text[ pt-BR ] = "É necessário \"(\"";
+ Text[ th ] = "'(' คาดคิด";
+ Text[ ja ] = "'('ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "'(' 필요함";
+ Text[ zh-CN ] = "期待 '('";
+ Text[ zh-TW ] = "期待<(>";
+ Text[ tr ] = "'(' gerekli";
+ Text[ hi-IN ] = "'(' की पà¥à¤°à¤¤à¥€à¤•à¥à¤·à¤¾";
+ Text[ ar ] = "مطلوب'('";
+ Text[ he ] = "‮צפויה '('‬";
+};
+
+String RID_ERR_RBRACEEXPECTED
+{
+ Text [ de ] = "')' erwartet" ;
+ Text [ en-US ] = "')' expected" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Necessário ')'";
+ Text[ ru ] = "')' ожидаетÑÑ";
+ Text[ el ] = "')' αναμένεται";
+ Text[ nl ] = "')' verwacht";
+ Text[ fr ] = "')' requis";
+ Text[ es ] = "Se requiere ')'";
+ Text[ fi ] = "Tähän tarvitaan ')'";
+ Text[ ca ] = "Es necessita ')'";
+ Text[ it ] = "Atteso ')'";
+ Text[ sk ] = "OÄakávaná ')'";
+ Text[ da ] = "')' forventes";
+ Text[ sv ] = "')' förväntad";
+ Text[ pl ] = "Oczekiwano znaku ')'";
+ Text[ pt-BR ] = "É necessário \")\"";
+ Text[ th ] = "')' คาดคิด";
+ Text[ ja ] = "')'ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "')' 필요함";
+ Text[ zh-CN ] = "期待 ')'";
+ Text[ zh-TW ] = "期待<)>";
+ Text[ tr ] = "')' gerekli";
+ Text[ hi-IN ] = "')' की पà¥à¤°à¤¤à¥€à¤•à¥à¤·à¤¾";
+ Text[ ar ] = "مطلوب ')'";
+ Text[ he ] = "‮צפויה ')'‬";
+};
+
+String RID_ERR_FUNCEXPECTED
+{
+ Text [ de ] = "Funktion erwartet" ;
+ Text [ en-US ] = "Function expected" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Necessário função";
+ Text[ ru ] = "ОжидаетÑÑ Ñ„ÑƒÐ½ÐºÑ†Ð¸Ñ";
+ Text[ el ] = "Αναμένεται συνάÏτηση";
+ Text[ nl ] = "Functie verwacht";
+ Text[ fr ] = "Fonction requise";
+ Text[ es ] = "Se requiere una función";
+ Text[ fi ] = "Tähän tarvitaan funktio";
+ Text[ ca ] = "Es necessita una funció";
+ Text[ it ] = "Attesa funzione";
+ Text[ sk ] = "OÄakávaná funkcia";
+ Text[ da ] = "Funktion forventes";
+ Text[ sv ] = "Funktion förväntad";
+ Text[ pl ] = "Oczekiwano funkcji";
+ Text[ pt-BR ] = "É esperada uma função";
+ Text[ th ] = "ฟังà¸à¹Œà¸Šà¸±à¹ˆà¸™à¸—ี่คาดคิด";
+ Text[ ja ] = "関数ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "함수 필요함";
+ Text[ zh-CN ] = "期待函数";
+ Text[ zh-TW ] = "期待函數";
+ Text[ tr ] = "Ä°ÅŸlev gerekli";
+ Text[ hi-IN ] = "फंकà¥à¤¶à¤¨à¥ की पà¥à¤°à¤¤à¥€à¤•à¥à¤·à¤¾";
+ Text[ ar ] = "مطلوب دالة";
+ Text[ he ] = "‮צפויה פונקציה‬";
+};
+
+String RID_ERR_UNOPEREXPECTED
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Unärer Operator erwartet : Un§rer Operator erwartet */
+ Text [ de ] = "Unärer Operator erwartet" ;
+ Text [ en-US ] = "Unary operator expected" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Necessário operador unário";
+ Text[ ru ] = "ОжидаетÑÑ ÑƒÐ½Ð°Ñ€Ð½Ñ‹Ð¹ оператор";
+ Text[ el ] = "Αναμένεται εναδικός τελεστής";
+ Text[ nl ] = "Monade verwacht";
+ Text[ fr ] = "Opérateur unaire requis";
+ Text[ es ] = "Se espera un operador unario";
+ Text[ fi ] = "Tähän tarvitaan yksipaikkainen operattori";
+ Text[ ca ] = "S'esperava un operador unari";
+ Text[ it ] = "Atteso operatore unario";
+ Text[ sk ] = "OÄakávaný unárny operátor";
+ Text[ da ] = "Monadisk operator forventes";
+ Text[ sv ] = "Unär operator förväntad";
+ Text[ pl ] = "W tym miejscu oczekiwano operatora jednoargumentowego";
+ Text[ pt-BR ] = "É esperado um operador unário";
+ Text[ th ] = "ตัวปà¸à¸´à¸šà¸±à¸•à¸´à¸à¸²à¸£ Unary ที่คาดคิด";
+ Text[ ja ] = "å˜é …演算å­ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "단항 ì—°ì‚°ìž í•„ìš”í•¨";
+ Text[ zh-CN ] = "期待è¿ç®—符。";
+ Text[ zh-TW ] = "期待é‹ç®—符。";
+ Text[ tr ] = "Birli işleç gerekli";
+ Text[ hi-IN ] = "यूनारि पà¥à¤°à¤µà¤°à¥à¤¤à¤• की पà¥à¤°à¤¤à¥€à¤•à¥à¤·à¤¾";
+ Text[ ar ] = "متوقع عامل تشغيل أحادي";
+ Text[ he ] = "‮צפוי ×ופרטור ×ונרי‬";
+};
+
+String RID_ERR_BINOPEREXPECTED
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Binärer Operator erwartet : Bin§rer Operator erwartet */
+ Text [ de ] = "Binärer Operator erwartet" ;
+ Text [ en-US ] = "Binary operator expected" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Necessário operador binário";
+ Text[ ru ] = "ОжидаетÑÑ Ð±Ð¸Ð½Ð°Ñ€Ð½Ñ‹Ð¹ оператор";
+ Text[ el ] = "Αναμένεται δυαδικός τελεστής";
+ Text[ nl ] = "Binaire operator verwacht";
+ Text[ fr ] = "Opérateur binaire requis";
+ Text[ es ] = "Se espera un operador binario";
+ Text[ fi ] = "Tähän tarvitaan kaksipaikkainen operaattori";
+ Text[ ca ] = "S'esperava un operador binari";
+ Text[ it ] = "Operatore binario atteso";
+ Text[ sk ] = "OÄakávaný binárny operátor";
+ Text[ da ] = "Binær operator forventes";
+ Text[ sv ] = "Binär operator förväntad";
+ Text[ pl ] = "Oczekiwano operatora dwuargumentowego";
+ Text[ pt-BR ] = "É esperado um operador binário";
+ Text[ th ] = "ตัวปà¸à¸´à¸šà¸±à¸•à¸´à¸à¸²à¸£ Binary ที่คาดคิด";
+ Text[ ja ] = "二項演算å­ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "ì´í•­ ì—°ì‚°ìž í•„ìš”í•¨";
+ Text[ zh-CN ] = "期待二元è¿ç®—符";
+ Text[ zh-TW ] = "期待二元é‹ç®—符";
+ Text[ tr ] = "İkili işleç gerekli";
+ Text[ hi-IN ] = "बैनरी पà¥à¤°à¤µà¤°à¥à¤¤à¤• की पà¥à¤°à¤¤à¥€à¤•à¥à¤·à¤¾";
+ Text[ ar ] = "متوقع عامل تشغيل ثنائي";
+ Text[ he ] = "‮צפוי ×ופרטור בינרי‬";
+};
+
+String RID_ERR_SYMBOLEXPECTED
+{
+ Text [ de ] = "Symbol erwartet" ;
+ Text [ en-US ] = "Symbol expected" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Necessário símbolo";
+ Text[ ru ] = "ОжидаетÑÑ Ñимвол";
+ Text[ el ] = "Αναμένεται σÏμβολο";
+ Text[ nl ] = "Symbool verwacht";
+ Text[ fr ] = "Symbole requis";
+ Text[ es ] = "Se necesita un símbolo";
+ Text[ fi ] = "Tähän tarvitaan symboli";
+ Text[ ca ] = "Es necessita un símbol";
+ Text[ it ] = "Atteso simbolo";
+ Text[ sk ] = "OÄakávaný symbol";
+ Text[ da ] = "Symbol forventes";
+ Text[ sv ] = "Symbol förväntad";
+ Text[ pl ] = "Oczekiwano symbolu";
+ Text[ pt-BR ] = "É esperado um símbolo";
+ Text[ th ] = "สัà¸à¸¥à¸±à¸à¸©à¸“์ที่คาดคิด";
+ Text[ ja ] = "記å·ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "기호 필요함";
+ Text[ zh-CN ] = "期待图标";
+ Text[ zh-TW ] = "期待圖示";
+ Text[ tr ] = "Simge gerekli";
+ Text[ hi-IN ] = "संकेत पà¥à¤°à¤¤à¥€à¤•à¥à¤·à¤¾";
+ Text[ ar ] = "مطلوب رمز";
+ Text[ he ] = "‮צפוע סמל‬";
+};
+
+String RID_ERR_IDENTEXPECTED
+{
+ Text [ de ] = "Identifier erwartet" ;
+ Text [ en-US ] = "Identifier expected" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Necessário identificador";
+ Text[ ru ] = "ОжидаетÑÑ Ð¸Ð´ÐµÐ½Ñ‚Ð¸Ñ„Ð¸ÐºÐ°Ñ‚Ð¾Ñ€";
+ Text[ el ] = "Αναμένεται αναγνωÏιστικό";
+ Text[ nl ] = "Identifier verwacht";
+ Text[ fr ] = "Identificateur requis";
+ Text[ es ] = "Se requiere un identificador";
+ Text[ fi ] = "Tähän tarvitaan tunniste";
+ Text[ ca ] = "S'esperava un identificador";
+ Text[ it ] = "Atteso identifier";
+ Text[ sk ] = "OÄakávaný identifikátor";
+ Text[ da ] = "Identifikator forventes";
+ Text[ sv ] = "Identifierare förväntad";
+ Text[ pl ] = "Oczekiwano identyfikatora";
+ Text[ pt-BR ] = "É esperado um identificador";
+ Text[ th ] = "ตัวบ่งชี้ที่คาดคิด";
+ Text[ ja ] = "識別å­ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "확ì¸ìž 필요함";
+ Text[ zh-CN ] = "期待识别符";
+ Text[ zh-TW ] = "期待識別符";
+ Text[ tr ] = "Tanıtıcı bekleniyor";
+ Text[ hi-IN ] = "अइडेनà¥à¤Ÿà¤¿à¤«à¤¯à¤° की पà¥à¤°à¤¤à¥€à¤•à¥à¤·à¤¾";
+ Text[ ar ] = "مطلوب معرّÙ";
+ Text[ he ] = "‮צפוי מזהה‬";
+};
+
+String RID_ERR_POUNDEXPECTED
+{
+ Text [ de ] = "'#' erwartet" ;
+ Text [ en-US ] = "'#' expected" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Necessário '#'";
+ Text[ ru ] = "'#' ожидаетÑÑ";
+ Text[ el ] = "'#' αναμένεται";
+ Text[ nl ] = "'#' verwacht";
+ Text[ fr ] = "'#' requis";
+ Text[ es ] = "Se requiere '#'";
+ Text[ fi ] = "Tähän tarvitaan '#'";
+ Text[ ca ] = "Es necessita '#'";
+ Text[ it ] = "Atteso '#'";
+ Text[ sk ] = "OÄakávaný '#'";
+ Text[ da ] = "'#' forventes";
+ Text[ sv ] = "'#' förväntad";
+ Text[ pl ] = "Oczekiwano znaku '#'";
+ Text[ pt-BR ] = "#";
+ Text[ th ] = "'#'คาดคิด";
+ Text[ ja ] = "'#'ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "'#' 필요함";
+ Text[ zh-CN ] = "期待 '#'";
+ Text[ zh-TW ] = "期待<#>";
+ Text[ tr ] = "'#' gerekli";
+ Text[ hi-IN ] = "'#' की पà¥à¤°à¤¤à¥€à¤•à¥à¤·à¤¾";
+ Text[ ar ] = "مطلوب '#'";
+ Text[ he ] = "‮צפויה '#'‬";
+};
+
+String RID_ERR_COLOREXPECTED
+{
+ Text [ de ] = "Farbe erwartet" ;
+ Text [ en-US ] = "Color required" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Necessário cor";
+ Text[ ru ] = "ТребуетÑÑ Ñ†Ð²ÐµÑ‚";
+ Text[ el ] = "Απαιτείται χÏώμα";
+ Text[ nl ] = "Kleur verwacht";
+ Text[ fr ] = "Couleur requise";
+ Text[ es ] = "Se requiere un color";
+ Text[ fi ] = "Tarvitaan väri";
+ Text[ ca ] = "Es necessita un color";
+ Text[ it ] = "Atteso colore";
+ Text[ sk ] = "Vyžaduje sa farba";
+ Text[ da ] = "Farve forventes";
+ Text[ sv ] = "Färg förväntad";
+ Text[ pl ] = "Wymagany jest kolor";
+ Text[ pt-BR ] = "Cor requerida";
+ Text[ th ] = "สีที่ต้องà¸à¸²à¸£";
+ Text[ ja ] = "色ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "색ìƒì´ 필요합니다.";
+ Text[ zh-CN ] = "期待颜色";
+ Text[ zh-TW ] = "期待é¡è‰²";
+ Text[ tr ] = "Renk gerekli";
+ Text[ hi-IN ] = "रंग की आवशà¥à¤¯à¤•à¤¤à¤¾";
+ Text[ ar ] = "مطلوب لون";
+ Text[ he ] = "‮נדרש צבע‬";
+};
+
+
+
+String RID_ERR_RIGHTEXPECTED
+{
+ Text [ de ] = "'RIGHT' erwartet" ;
+ Text [ en-US ] = "'RIGHT' expected" ;
+ Text [ x-comment ] = " ";
+ Text[ pt ] = "Necessário 'RIGHT'";
+ Text[ ru ] = "ОжидаетÑÑ 'Вправо'";
+ Text[ el ] = "Αναμένεται 'RIGHT'";
+ Text[ nl ] = "'RIGHT' verwacht";
+ Text[ fr ] = "'RIGHT' requis";
+ Text[ es ] = "Se requiere 'RIGHT'";
+ Text[ fi ] = "Tähän tarvitaan 'RIGHT'";
+ Text[ ca ] = "S'esperava 'RIGHT'";
+ Text[ it ] = "Atteso 'RIGHT'";
+ Text[ sk ] = "OÄakávané 'RIGHT'";
+ Text[ da ] = "'RIGHT' forventes";
+ Text[ sv ] = "'RIGHT' förväntat";
+ Text[ pl ] = "Oczekiwano 'RIGHT'";
+ Text[ pt-BR ] = "RIGHT";
+ Text[ th ] = "'RIGHT' ที่คาดคิด";
+ Text[ ja ] = "'RIGHT'ãŒå¿…è¦ã§ã™";
+ Text[ ko ] = "'RIGHT' 필요함";
+ Text[ zh-CN ] = "期待 'RIGHT'";
+ Text[ zh-TW ] = "期待<RIGHT>";
+ Text[ tr ] = "'RIGHT' gerekli";
+ Text[ hi-IN ] = "'RIGHT' की पà¥à¤°à¤¤à¥€à¤•à¥à¤·à¤¾";
+ Text[ ar ] = "'RIGHT' مطلوب";
+ Text[ he ] = "‮צפוי 'RIGHT'‬";
+};
diff --git a/binfilter/bf_starmath/source/starmath_symbol.cxx b/binfilter/bf_starmath/source/starmath_symbol.cxx
new file mode 100644
index 000000000000..f6579d7536eb
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_symbol.cxx
@@ -0,0 +1,393 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+
+#include <bf_sfx2/docfile.hxx>
+
+#include "config.hxx"
+#include "starmath.hrc"
+namespace binfilter {
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::uno;
+using namespace ::rtl;
+
+// Das hier muss auch mal alles "uberarbeitet werden. Insbesondere die nicht
+// funktionierende und bei l"oschen/"andern von Symbolen nicht gepflegte
+// Hash Tabelle!!! Diese aktualisert sich erst im Wertzuweisungsoperator
+// beim Verlassen des 'SmSymDefineDialog's!
+
+/**************************************************************************/
+/*
+**
+** MACRO DEFINTION
+**
+**/
+
+#define SF_SM20IDENT 0x03031963L
+#define SF_IDENT 0x30334D53L
+
+
+
+/**************************************************************************/
+/*
+**
+** DATA DEFINITION
+**
+**/
+
+long SF_Ident = SF_IDENT;
+
+/**************************************************************************/
+/*
+**
+** CLASS IMPLEMENTATION
+**
+**/
+
+/*N*/ SmSym::SmSym() :
+/*N*/ Name(C2S("unknown")),
+/*N*/ Character('\0'),
+/*N*/ pHashNext(0),
+/*N*/ pSymSetManager(0),
+/*N*/ bPredefined(FALSE),
+/*N*/ bDocSymbol(FALSE),
+/*N*/ aSetName(C2S("unknown"))
+/*N*/ {
+/*N*/ aExportName = Name;
+/*N*/ Face.SetTransparent(TRUE);
+/*N*/ Face.SetAlign(ALIGN_BASELINE);
+/*N*/ }
+
+
+/*N*/ SmSym::SmSym(const SmSym& rSymbol)
+/*N*/ {
+/*N*/ pSymSetManager = 0;
+/*N*/ *this = rSymbol;
+/*N*/ }
+
+
+/*N*/ SmSym::SmSym(const String& rName, const Font& rFont, sal_Unicode aChar,
+/*N*/ const String& rSet, BOOL bIsPredefined)
+/*N*/ {
+/*N*/ Name = aExportName = rName;
+/*N*/
+/*N*/ Face = rFont;
+/*N*/ Face.SetTransparent(TRUE);
+/*N*/ Face.SetAlign(ALIGN_BASELINE);
+/*N*/
+/*N*/ Character = aChar;
+/*N*/ if (RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet())
+/*?*/ Character |= 0xF000;
+/*N*/ aSetName = rSet;
+/*N*/ bPredefined = bIsPredefined;
+/*N*/ bDocSymbol = FALSE;
+/*N*/
+/*N*/ pHashNext = 0;
+/*N*/ pSymSetManager = 0;
+/*N*/ }
+
+
+/*N*/ SmSym& SmSym::operator = (const SmSym& rSymbol)
+/*N*/ {
+/*N*/ Name = rSymbol.Name;
+/*N*/ Face = rSymbol.Face;
+/*N*/ Character = rSymbol.Character;
+/*N*/ aSetName = rSymbol.aSetName;
+/*N*/ bPredefined = rSymbol.bPredefined;
+/*N*/ bDocSymbol = rSymbol.bDocSymbol;
+/*N*/ aExportName = rSymbol.aExportName;
+/*N*/
+/*N*/ pHashNext = 0;
+/*N*/
+/*N*/ if (pSymSetManager)
+/*?*/ pSymSetManager->SetModified(TRUE);
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+
+
+
+/**************************************************************************/
+
+
+
+/*N*/ SmSymSet::SmSymSet(const String& rName)
+/*N*/ {
+/*N*/ Name = rName;
+/*N*/ SymbolList.Clear();
+/*N*/
+/*N*/ pSymSetManager = 0;
+/*N*/ }
+
+
+
+
+/*N*/ USHORT SmSymSet::AddSymbol(SmSym* pSymbol)
+/*N*/ {
+/*N*/ DBG_ASSERT(pSymbol, "Kein Symbol");
+/*N*/
+/*N*/ if (pSymbol)
+/*N*/ pSymbol->SetSetName( GetName() );
+/*N*/ SymbolList.Insert(pSymbol, LIST_APPEND);
+/*N*/ DBG_ASSERT(SymbolList.GetPos(pSymbol) == SymbolList.Count() - 1,
+/*N*/ "Sm : ... ergibt falschen return Wert");
+/*N*/
+/*N*/ if (pSymSetManager)
+/*N*/ pSymSetManager->SetModified(TRUE);
+/*N*/
+/*N*/ return (USHORT) SymbolList.Count() - 1;
+/*N*/ }
+
+
+
+
+
+
+
+/**************************************************************************/
+
+/*N*/ SmSymSetManager_Impl::SmSymSetManager_Impl(
+/*N*/ SmSymSetManager &rMgr, USHORT HashTableSize ) :
+/*N*/
+/*N*/ rSymSetMgr (rMgr)
+/*N*/ {
+/*N*/ NoSymbolSets = 0;
+/*N*/ NoHashEntries = HashTableSize;
+/*N*/ HashEntries = new SmSym *[NoHashEntries];
+/*N*/ memset( HashEntries, 0, sizeof(SmSym *) * NoHashEntries );
+/*N*/ Modified = FALSE;
+/*N*/ }
+
+
+
+
+
+/**************************************************************************/
+
+
+
+
+
+/*N*/ UINT32 SmSymSetManager::GetHashIndex(const String& rSymbolName)
+/*N*/ {
+/*N*/ UINT32 x = 1;
+/*N*/ for (xub_StrLen i = 0; i < rSymbolName.Len(); i++)
+/*N*/ x += x * rSymbolName.GetChar(i) + i;
+/*N*/
+/*N*/ return x % pImpl->NoHashEntries;
+/*N*/ }
+
+
+/*N*/ void SmSymSetManager::EnterHashTable(SmSym& rSymbol)
+/*N*/ {
+/*N*/ int j = GetHashIndex( rSymbol.GetName() );
+/*N*/ if (pImpl->HashEntries[j] == 0)
+/*N*/ pImpl->HashEntries[j] = &rSymbol;
+/*N*/ else
+/*N*/ {
+/*N*/ SmSym *p = pImpl->HashEntries[j];
+/*N*/ while (p->pHashNext)
+/*N*/ p = p->pHashNext;
+/*N*/ p->pHashNext = &rSymbol;
+/*N*/ }
+/*N*/ rSymbol.pHashNext = 0;
+/*N*/ }
+
+
+/*N*/ void SmSymSetManager::EnterHashTable(SmSymSet& rSymbolSet)
+/*N*/ {
+/*N*/ for (int i = 0; i < rSymbolSet.GetCount(); i++)
+/*N*/ EnterHashTable( *rSymbolSet.SymbolList.GetObject(i) );
+/*N*/ }
+
+/*N*/ void SmSymSetManager::FillHashTable()
+/*N*/ {
+/*N*/ if (pImpl->HashEntries)
+/*N*/ {
+/*N*/ memset( pImpl->HashEntries, 0, pImpl->NoHashEntries * sizeof(SmSym *) );
+/*N*/
+/*N*/ for (UINT32 i = 0; i < pImpl->NoSymbolSets; i++)
+/*N*/ EnterHashTable( *GetSymbolSet( (USHORT) i ) );
+/*N*/ }
+/*N*/ }
+
+
+
+
+
+/*N*/ SmSymSetManager::SmSymSetManager(USHORT HashTableSize)
+/*N*/ {
+/*N*/ pImpl = new SmSymSetManager_Impl( *this, HashTableSize );
+/*N*/ }
+
+
+
+
+
+
+/*N*/ USHORT SmSymSetManager::AddSymbolSet(SmSymSet* pSymbolSet)
+/*N*/ {
+/*N*/ if (pImpl->NoSymbolSets >= pImpl->SymbolSets.GetSize())
+/*?*/ pImpl->SymbolSets.SetSize(pImpl->NoSymbolSets + 1);
+/*N*/
+/*N*/ pImpl->SymbolSets.Put(pImpl->NoSymbolSets++, pSymbolSet);
+/*N*/
+/*N*/ pSymbolSet->pSymSetManager = this;
+/*N*/
+/*N*/ for (int i = 0; i < pSymbolSet->GetCount(); i++)
+/*?*/ pSymbolSet->SymbolList.GetObject(i)->pSymSetManager = this;
+/*N*/
+/*N*/ FillHashTable();
+/*N*/ pImpl->Modified = TRUE;
+/*N*/
+/*N*/ return (USHORT) (pImpl->NoSymbolSets - 1);
+/*N*/ }
+
+/*N*/ void SmSymSetManager::ChangeSymbolSet(SmSymSet* pSymbolSet)
+/*N*/ {
+/*N*/ if (pSymbolSet)
+/*N*/ {
+/*N*/ FillHashTable();
+/*N*/ pImpl->Modified = TRUE;
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ USHORT SmSymSetManager::GetSymbolSetPos(const String& rSymbolSetName) const
+/*N*/ {
+/*N*/ for (USHORT i = 0; i < pImpl->NoSymbolSets; i++)
+/*N*/ if (pImpl->SymbolSets.Get(i)->GetName() == rSymbolSetName)
+/*N*/ return (i);
+/*N*/
+/*N*/ return SYMBOLSET_NONE;
+/*N*/ }
+
+/*N*/ SmSym *SmSymSetManager::GetSymbolByName(const String& rSymbolName)
+/*N*/ {
+/*N*/ SmSym *pSym = pImpl->HashEntries[GetHashIndex(rSymbolName)];
+/*N*/ while (pSym)
+/*N*/ {
+/*N*/ if (pSym->Name == rSymbolName)
+/*N*/ break;
+/*N*/ pSym = pSym->pHashNext;
+/*N*/ }
+/*N*/
+/*N*/ return pSym;
+/*N*/ }
+
+
+/*N*/ void SmSymSetManager::AddReplaceSymbol( const SmSym &rSymbol )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+
+/*N*/ USHORT SmSymSetManager::GetSymbolCount() const
+/*N*/ {
+/*N*/ USHORT nRes = 0;
+/*N*/ USHORT nSets = GetSymbolSetCount();
+/*N*/ for (USHORT i = 0; i < nSets; ++i)
+/*N*/ nRes += GetSymbolSet(i)->GetCount();
+/*N*/ return nRes;
+/*N*/ }
+
+
+/*N*/ const SmSym * SmSymSetManager::GetSymbolByPos( USHORT nPos ) const
+/*N*/ {
+/*N*/ const SmSym *pRes = 0;
+/*N*/
+/*N*/ INT16 nIdx = 0;
+/*N*/ USHORT nSets = GetSymbolSetCount();
+/*N*/ USHORT i = 0;
+/*N*/ while (i < nSets && !pRes)
+/*N*/ {
+/*N*/ USHORT nEntries = GetSymbolSet(i)->GetCount();
+/*N*/ if (nPos < nIdx + nEntries)
+/*N*/ pRes = &GetSymbolSet(i)->GetSymbol( nPos - nIdx );
+/*N*/ else
+/*N*/ nIdx += nEntries;
+/*N*/ ++i;
+/*N*/ }
+/*N*/
+/*N*/ return pRes;
+/*N*/ }
+
+
+/*N*/ void SmSymSetManager::Load()
+/*N*/ {
+/*N*/ SmMathConfig &rCfg = *SM_MOD1()->GetConfig();
+/*N*/
+/*N*/ USHORT nCount = rCfg.GetSymbolCount();
+/*N*/ USHORT i;
+/*N*/ for (i = 0; i < nCount; ++i)
+/*N*/ {
+/*N*/ const SmSym *pSym = rCfg.GetSymbol(i);
+/*N*/ if (pSym)
+/*N*/ {
+/*N*/ SmSymSet *pSymSet = 0;
+/*N*/ const String &rSetName = pSym->GetSetName();
+/*N*/ USHORT nSetPos = GetSymbolSetPos( rSetName );
+/*N*/ if (SYMBOLSET_NONE != nSetPos)
+/*N*/ pSymSet = GetSymbolSet( nSetPos );
+/*N*/ else
+/*N*/ {
+/*N*/ pSymSet = new SmSymSet( rSetName );
+/*N*/ AddSymbolSet( pSymSet );
+/*N*/ }
+/*N*/
+/*N*/ pSymSet->AddSymbol( new SmSym( *pSym ) );
+/*N*/ }
+/*N*/ }
+/*N*/ // build HashTables
+/*N*/ nCount = GetSymbolSetCount();
+/*N*/ for (i = 0; i < nCount; ++i)
+/*N*/ ChangeSymbolSet( GetSymbolSet( i ) );
+/*N*/
+/*N*/ if (0 == nCount)
+/*N*/ {
+/*N*/ DBG_ERROR( "no symbol set found" );
+/*N*/ pImpl->Modified = FALSE;
+/*N*/ }
+/*N*/ }
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_symbol.src b/binfilter/bf_starmath/source/starmath_symbol.src
new file mode 100644
index 000000000000..035353fa71a8
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_symbol.src
@@ -0,0 +1,2246 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define NO_LOCALIZE_EXPORT
+
+#include <starmath.hrc>
+
+
+/////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////
+
+Resource RID_LOCALIZED_NAMES
+{
+ StringArray RID_FRENCH_50_NAMES
+ {
+ ItemList =
+ {
+ < "BETA" ; > ;
+ < "beta" ; > ;
+ < "ETA" ; > ;
+ < "eta" ; > ;
+ < "JOTA" ; > ;
+ < "jota" ; > ;
+ < "CHI" ; > ;
+ < "chi" ; > ;
+ < "MY" ; > ;
+ < "my" ; > ;
+ < "NY" ; > ;
+ < "ny" ; > ;
+ < "OMIKRON" ; > ;
+ < "omikron" ; > ;
+ < "OMEGA" ; > ;
+ < "omega" ; > ;
+ < "RHO" ; > ;
+ < "rho" ; > ;
+ < "THETA" ; > ;
+ < "theta" ; > ;
+ < "YPSILON" ; > ;
+ < "ypsilon" ; > ;
+ < "ZETA" ; > ;
+ < "zeta" ; > ;
+ < "varrho" ; > ;
+ < "vartheta" ; > ;
+ };
+ };
+ StringArray RID_FRENCH_60_NAMES
+ {
+ ItemList =
+ {
+ < "BÊTA" ; > ;
+ < "bêta" ; > ;
+ < "ÊTA" ; > ;
+ < "êta" ; > ;
+ < "IOTA" ; > ;
+ < "iota" ; > ;
+ < "KHI" ; > ;
+ < "khi" ; > ;
+ < "MU" ; > ;
+ < "mu" ; > ;
+ < "NU" ; > ;
+ < "nu" ; > ;
+ < "OMICRON" ; > ;
+ < "omicron" ; > ;
+ < "OMÉGA" ; > ;
+ < "oméga" ; > ;
+ < "RHÔ" ; > ;
+ < "rhô" ; > ;
+ < "THÊTA" ; > ;
+ < "thêta" ; > ;
+ < "UPSILON" ; > ;
+ < "upsilon" ; > ;
+ < "ZÊTA" ; > ;
+ < "zêta" ; > ;
+ < "varrhô" ; > ;
+ < "varthêta" ; > ;
+ };
+ };
+ StringArray RID_ITALIAN_50_NAMES
+ {
+ ItemList =
+ {
+ < "nu" ; > ;
+ < "Nu" ; > ;
+ < "varrho" ; > ;
+ < "moltomaggioredi" ; > ;
+ < "indentico" ; > ;
+ < "nonelemento" ; > ;
+ < "moltoinferioredi" ; > ;
+ < "o" ; > ;
+ < "permille" ; > ;
+ < "tendentea" ; > ;
+ < "nonuguale" ; > ;
+ < "infinite" ; > ;
+ };
+ };
+ StringArray RID_ITALIAN_60_NAMES
+ {
+ ItemList =
+ {
+ < "ni" ; > ;
+ < "Ni" ; > ;
+ < "varro" ; > ;
+ < "molto.maggiore.di" ; > ;
+ < "identico" ; > ;
+ < "non.elemento" ; > ;
+ < "molto.minore.di" ; > ;
+ < "oppure" ; > ;
+ < "per.mille" ; > ;
+ < "tendente.a" ; > ;
+ < "non.uguale" ; > ;
+ < "infinito" ; > ;
+ };
+ };
+ StringArray RID_SWEDISH_50_NAMES
+ {
+ ItemList =
+ {
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "element" ; > ;
+ };
+ };
+ StringArray RID_SWEDISH_60_NAMES
+ {
+ ItemList =
+ {
+ < "jota" ; > ;
+ < "JOTA" ; > ;
+ < "ksi" ; > ;
+ < "KSI" ; > ;
+ < "ro" ; > ;
+ < "RO" ; > ;
+ < "tillhör" ; > ;
+ };
+ };
+ StringArray RID_SPANISH_50_NAMES
+ {
+ ItemList =
+ {
+ < "distino" ; > ;
+ < "muchomenos" ; > ;
+ < "pertenece" ; > ;
+ < "nopertenece" ; > ;
+ };
+ };
+ StringArray RID_SPANISH_60_NAMES
+ {
+ ItemList =
+ {
+ < "diferente" ; > ;
+ < "muchomenor" ; > ;
+ < "elemento" ; > ;
+ < "sinelemento" ; > ;
+ };
+ };
+ StringArray RID_EXPORT_SYMBOLSET_NAMES
+ {
+ ItemList =
+ {
+ < "Greek" ; > ;
+ < "Special" ; > ;
+ };
+ };
+ StringArray RID_UI_SYMBOLSET_NAMES
+ {
+ ItemList [ de ] =
+ {
+ < "Griechisch" ; > ;
+ < "Spezial" ; > ;
+ };
+ ItemList [ x-comment ] =
+ {
+ < "; Griechisch" ; > ;
+ < "; Spezial" ; > ;
+ };
+ ItemList [ en-US ] =
+ {
+ < "Greek" ; > ;
+ < "Special" ; > ;
+ };
+ ItemList [ pt ] =
+ {
+ < "Grego" ; > ;
+ < "Especial" ; > ;
+ };
+ ItemList [ ru ] =
+ {
+ < "ГречеÑкий" ; > ;
+ < "Специальный" ; > ;
+ };
+ ItemList [ el ] =
+ {
+ < "Ελληνικά" ; > ;
+ < "Ειδικό" ; > ;
+ };
+ ItemList [ nl ] =
+ {
+ < "Grieks" ; > ;
+ < "Speciaal" ; > ;
+ };
+ ItemList [ fr ] =
+ {
+ < "Grec" ; > ;
+ < "Spécial" ; > ;
+ };
+ ItemList [ es ] =
+ {
+ < "Griego" ; > ;
+ < "Especial" ; > ;
+ };
+ ItemList [ fi ] =
+ {
+ < "kreikkalaiset" ; > ;
+ < "erikoismerkit" ; > ;
+ };
+ ItemList [ ca ] =
+ {
+ < "Grec" ; > ;
+ < "Especialitzat" ; > ;
+ };
+ ItemList [ it ] =
+ {
+ < "Greco" ; > ;
+ < "Speciale" ; > ;
+ };
+ ItemList [ sk ] =
+ {
+ < "Grécky" ; > ;
+ < "Špeciálny" ; > ;
+ };
+ ItemList [ da ] =
+ {
+ < "Græsk" ; > ;
+ < "Special" ; > ;
+ };
+ ItemList [ sv ] =
+ {
+ < "grekiska" ; > ;
+ < "special" ; > ;
+ };
+ ItemList [ pl ] =
+ {
+ < "Grecki" ; > ;
+ < "Symbole specjalne" ; > ;
+ };
+ ItemList [ pt-BR ] =
+ {
+ < "Grego" ; > ;
+ < "Especial" ; > ;
+ };
+ ItemList [ th ] =
+ {
+ < "à¸à¸£à¸µà¸" ; > ;
+ < "พิเศษ" ; > ;
+ };
+ ItemList [ ja ] =
+ {
+ < "ギリシャ文字" ; > ;
+ < "数学特殊記å·" ; > ;
+ };
+ ItemList [ ko ] =
+ {
+ < "그리스어" ; > ;
+ < "수학 특수기호" ; > ;
+ };
+ ItemList [ zh-CN ] =
+ {
+ < "希腊文" ; > ;
+ < "特殊字符" ; > ;
+ };
+ ItemList [ zh-TW ] =
+ {
+ < "希臘文" ; > ;
+ < "特殊字元" ; > ;
+ };
+ ItemList [ tr ] =
+ {
+ < "Yunan" ; > ;
+ < "Özel" ; > ;
+ };
+ ItemList [ hi-IN ] =
+ {
+ < "गà¥à¤°à¥€à¤•" ; > ;
+ < "विशेष" ; > ;
+ };
+ ItemList [ ar ] =
+ {
+ < "اليونانية" ; > ;
+ < "Specialized" ; > ;
+ };
+ ItemList [ he ] =
+ {
+ < "‮יוונית‬" ; > ;
+ < "‮מיוחד‬" ; > ;
+ };
+ };
+
+ StringArray RID_EXPORT_SYMBOL_NAMES
+ {
+ ItemList =
+ {
+ < "alpha" ; > ;
+ < "ALPHA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mu" ; > ;
+ < "MU" ; > ;
+ < "nu" ; > ;
+ < "NU" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omicron" ; > ;
+ < "OMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "upsilon" ; > ;
+ < "UPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "element" ; > ;
+ < "noelement" ; > ;
+ < "strictlylessthan" ; > ;
+ < "strictlygreaterthan" ; > ;
+ < "notequal" ; > ;
+ < "identical" ; > ;
+ < "tendto" ; > ;
+ < "infinite" ; > ;
+ < "angle" ; > ;
+ < "perthousand" ; > ;
+ < "and" ; > ;
+ < "or" ; > ;
+ };
+ };
+ StringArray RID_UI_SYMBOL_NAMES
+ {
+ ItemList [ de ] =
+ {
+ < "alpha" ; > ;
+ < "ALPHA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "jota" ; > ;
+ < "JOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "my" ; > ;
+ < "MY" ; > ;
+ < "ny" ; > ;
+ < "NY" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omikron" ; > ;
+ < "OMIKRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "ypsilon" ; > ;
+ < "YPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "element" ; > ;
+ < "keinelement" ; > ;
+ < "kleingegen" ; > ;
+ < "großgegen" ; > ;
+ < "ungleich" ; > ;
+ < "identisch" ; > ;
+ < "strebt" ; > ;
+ < "unendlich" ; > ;
+ < "winkel" ; > ;
+ < "promille" ; > ;
+ < "und" ; > ;
+ < "oder" ; > ;
+ };
+ ItemList [ x-comment ] =
+ {
+ < "; alpha" ; > ;
+ < "; ALPHA" ; > ;
+ < "; beta" ; > ;
+ < "; BETA" ; > ;
+ < "; gamma" ; > ;
+ < "; GAMMA" ; > ;
+ < "; delta" ; > ;
+ < "; DELTA" ; > ;
+ < "; epsilon" ; > ;
+ < "; EPSILON" ; > ;
+ < "; zeta" ; > ;
+ < "; ZETA" ; > ;
+ < "; eta" ; > ;
+ < "; ETA" ; > ;
+ < "; theta" ; > ;
+ < "; THETA" ; > ;
+ < "; jota" ; > ;
+ < "; JOTA" ; > ;
+ < "; kappa" ; > ;
+ < "; KAPPA" ; > ;
+ < "; lambda" ; > ;
+ < "; LAMBDA" ; > ;
+ < "; my" ; > ;
+ < "; MY" ; > ;
+ < "; ny" ; > ;
+ < "; NY" ; > ;
+ < "; xi" ; > ;
+ < "; XI" ; > ;
+ < "; omikron" ; > ;
+ < "; OMIKRON" ; > ;
+ < "; pi" ; > ;
+ < "; PI" ; > ;
+ < "; rho" ; > ;
+ < "; RHO" ; > ;
+ < "; sigma" ; > ;
+ < "; SIGMA" ; > ;
+ < "; tau" ; > ;
+ < "; TAU" ; > ;
+ < "; ypsilon" ; > ;
+ < "; YPSILON" ; > ;
+ < "; phi" ; > ;
+ < "; PHI" ; > ;
+ < "; chi" ; > ;
+ < "; CHI" ; > ;
+ < "; psi" ; > ;
+ < "; PSI" ; > ;
+ < "; omega" ; > ;
+ < "; OMEGA" ; > ;
+ < "; varepsilon" ; > ;
+ < "; vartheta" ; > ;
+ < "; varpi" ; > ;
+ < "; varrho" ; > ;
+ < "; varsigma" ; > ;
+ < "; varphi" ; > ;
+ < "; element" ; > ;
+ < "; keinelement" ; > ;
+ < "; kleingegen" ; > ;
+ < "; großgegen" ; > ;
+ < "; ungleich" ; > ;
+ < "; identisch" ; > ;
+ < "; strebt" ; > ;
+ < "; unendlich" ; > ;
+ < "; winkel" ; > ;
+ < "; promille" ; > ;
+ < "; und" ; > ;
+ < "; oder" ; > ;
+ };
+ ItemList [ en-US ] =
+ {
+ < "alpha" ; > ;
+ < "ALPHA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mu" ; > ;
+ < "MU" ; > ;
+ < "nu" ; > ;
+ < "NU" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omicron" ; > ;
+ < "OMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "upsilon" ; > ;
+ < "UPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "element" ; > ;
+ < "noelement" ; > ;
+ < "strictlylessthan" ; > ;
+ < "strictlygreaterthan" ; > ;
+ < "notequal" ; > ;
+ < "identical" ; > ;
+ < "tendto" ; > ;
+ < "infinite" ; > ;
+ < "angle" ; > ;
+ < "perthousand" ; > ;
+ < "and" ; > ;
+ < "or" ; > ;
+ };
+ ItemList [ pt ] =
+ {
+ < "alfa" ; > ;
+ < "ALFA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gama" ; > ;
+ < "GAMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsílon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "teta" ; > ;
+ < "TETA" ; > ;
+ < "jota" ; > ;
+ < "JOTA" ; > ;
+ < "capa" ; > ;
+ < "CAPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mi" ; > ;
+ < "MI" ; > ;
+ < "ni" ; > ;
+ < "NI" ; > ;
+ < "csi" ; > ;
+ < "CSI" ; > ;
+ < "ómicron" ; > ;
+ < "ÓMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "ró" ; > ;
+ < "RÓ" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "ípsilon" ; > ;
+ < "ÃPSILON" ; > ;
+ < "fi" ; > ;
+ < "FI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "ómega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "elemento" ; > ;
+ < "sem_elemento" ; > ;
+ < "menos_que" ; > ;
+ < "mais_que" ; > ;
+ < "desigual" ; > ;
+ < "idêntico" ; > ;
+ < "tende" ; > ;
+ < "infinito" ; > ;
+ < "Ângulo" ; > ;
+ < "por_mil" ; > ;
+ < "e" ; > ;
+ < "ou" ; > ;
+ };
+ ItemList [ ru ] =
+ {
+ < "альфа" ; > ;
+ < "ÐЛЬФÐ" ; > ;
+ < "бета" ; > ;
+ < "БЕТÐ" ; > ;
+ < "гамма" ; > ;
+ < "ГÐММÐ" ; > ;
+ < "дельта" ; > ;
+ < "ДЕЛЬТÐ" ; > ;
+ < "ÑпÑилон" ; > ;
+ < "ЭПСИЛОÐ" ; > ;
+ < "дзета" ; > ;
+ < "ДЗЕТÐ" ; > ;
+ < "Ñта" ; > ;
+ < "ЭТÐ" ; > ;
+ < "тета" ; > ;
+ < "ТЕТÐ" ; > ;
+ < "йота" ; > ;
+ < "ЙОТÐ" ; > ;
+ < "каппа" ; > ;
+ < "КÐППÐ" ; > ;
+ < "лÑмбда" ; > ;
+ < "ЛЯМБДÐ" ; > ;
+ < "мю" ; > ;
+ < "МЮ" ; > ;
+ < "ню" ; > ;
+ < "ÐЮ" ; > ;
+ < "кÑи" ; > ;
+ < "КСИ" ; > ;
+ < "омикрон" ; > ;
+ < "ОМИКРОÐ" ; > ;
+ < "пи" ; > ;
+ < "ПИ" ; > ;
+ < "ро" ; > ;
+ < "РО" ; > ;
+ < "Ñигма" ; > ;
+ < "СИГМÐ" ; > ;
+ < "тау" ; > ;
+ < "ТÐУ" ; > ;
+ < "ипÑилон" ; > ;
+ < "ИПСИЛОÐ" ; > ;
+ < "фи" ; > ;
+ < "ФИ" ; > ;
+ < "хи" ; > ;
+ < "ХИ" ; > ;
+ < "пÑи" ; > ;
+ < "ПСИ" ; > ;
+ < "омега" ; > ;
+ < "ОМЕГÐ" ; > ;
+ < "альтернат. ÑпÑилон" ; > ;
+ < "альтернат. тета" ; > ;
+ < "альтернат. пи" ; > ;
+ < "альтернат. ро" ; > ;
+ < "альтернат. Ñигма" ; > ;
+ < "альтернат. фи" ; > ;
+ < "принадлежит" ; > ;
+ < "не принадлежит" ; > ;
+ < "меньше чем" ; > ;
+ < "больше чем" ; > ;
+ < "не равно" ; > ;
+ < "идентично" ; > ;
+ < "ÑтремитÑÑ Ðº" ; > ;
+ < "беÑконечноÑÑ‚ÑŒ" ; > ;
+ < "угол" ; > ;
+ < "промилле" ; > ;
+ < "и" ; > ;
+ < "или" ; > ;
+ };
+ ItemList [ el ] =
+ {
+ < "άλφα" ; > ;
+ < "ΑΛΦΑ" ; > ;
+ < "βήτα" ; > ;
+ < "ΒΗΤΑ" ; > ;
+ < "γάμμα" ; > ;
+ < "ΓΑΜΜΑ" ; > ;
+ < "δέλτα" ; > ;
+ < "ΔΕΛΤΑ" ; > ;
+ < "έψιλον" ; > ;
+ < "ΕΨΙΛΟÎ" ; > ;
+ < "ζήτα" ; > ;
+ < "ΖΗΤΑ" ; > ;
+ < "ήτα" ; > ;
+ < "ΗΤΑ" ; > ;
+ < "θήτα" ; > ;
+ < "ΘΗΤΑ" ; > ;
+ < "γιώτα" ; > ;
+ < "ΓΙΩΤΑ" ; > ;
+ < "κάπα" ; > ;
+ < "ΚΑΠΑ" ; > ;
+ < "λάμδα" ; > ;
+ < "ΛΑΜΔΑ" ; > ;
+ < "μι" ; > ;
+ < "ΜΙ" ; > ;
+ < "νι" ; > ;
+ < "ÎΙ" ; > ;
+ < "ξι" ; > ;
+ < "ΞΙ" ; > ;
+ < "όμικÏον" ; > ;
+ < "ΟΜΙΚΡΟÎ" ; > ;
+ < "πι" ; > ;
+ < "ΠΙ" ; > ;
+ < "Ïο" ; > ;
+ < "ΡΟ" ; > ;
+ < "σίγμα" ; > ;
+ < "ΣΙΓΜΑ" ; > ;
+ < "ταυ" ; > ;
+ < "ΤΑΥ" ; > ;
+ < "Ïψιλον" ; > ;
+ < "ΥΨΙΛΟÎ" ; > ;
+ < "φι" ; > ;
+ < "ΦΙ" ; > ;
+ < "χι" ; > ;
+ < "ΧΙ" ; > ;
+ < "ψι" ; > ;
+ < "ΨΙ" ; > ;
+ < "ωμέγα" ; > ;
+ < "ΩΜΕΓΑ" ; > ;
+ < "καλλιγÏαφικό έψιλον" ; > ;
+ < "καλλιγÏαφικό θήτα" ; > ;
+ < "καλλιγÏαφικό πι" ; > ;
+ < "καλλιγÏαφικό Ïο" ; > ;
+ < "τελικό σίγμα" ; > ;
+ < "καλλιγÏαφικό φι" ; > ;
+ < "στοιχείο" ; > ;
+ < "noelement" ; > ;
+ < "strictlylessthan" ; > ;
+ < "strictlygreaterthan" ; > ;
+ < "notequal" ; > ;
+ < "identical" ; > ;
+ < "tendto" ; > ;
+ < "infinite" ; > ;
+ < "angle" ; > ;
+ < "perthousand" ; > ;
+ < "και" ; > ;
+ < "ή" ; > ;
+ };
+ ItemList [ nl ] =
+ {
+ < "alfa" ; > ;
+ < "ALFA" ; > ;
+ < "bèta" ; > ;
+ < "BÈTA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "jota" ; > ;
+ < "JOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "my" ; > ;
+ < "MY" ; > ;
+ < "ny" ; > ;
+ < "NY" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omikron" ; > ;
+ < "OMIKRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "ypsilon" ; > ;
+ < "YPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "element" ; > ;
+ < "geenelement" ; > ;
+ < "kleiner dan" ; > ;
+ < "groter dan" ; > ;
+ < "niet gelijk aan" ; > ;
+ < "gelijk aan" ; > ;
+ < "streeft" ; > ;
+ < "oneindig" ; > ;
+ < "hoek" ; > ;
+ < "promille" ; > ;
+ < "en" ; > ;
+ < "of" ; > ;
+ };
+ ItemList [ fr ] =
+ {
+ < "alpha" ; > ;
+ < "ALPHA" ; > ;
+ < "bêta" ; > ;
+ < "BÊTA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zêta" ; > ;
+ < "ZÊTA" ; > ;
+ < "êta" ; > ;
+ < "ÊTA" ; > ;
+ < "thêta" ; > ;
+ < "THÊTA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mu" ; > ;
+ < "MU" ; > ;
+ < "nu" ; > ;
+ < "NU" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omicron" ; > ;
+ < "OMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rhô" ; > ;
+ < "RHÔ" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "upsilon" ; > ;
+ < "UPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "khi" ; > ;
+ < "KHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "oméga" ; > ;
+ < "OMÉGA" ; > ;
+ < "varepsilon" ; > ;
+ < "varthêta" ; > ;
+ < "varpi" ; > ;
+ < "varrhô" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "élément" ; > ;
+ < "pasélément" ; > ;
+ < "trèsinférieurà" ; > ;
+ < "trèssupérieurà" ; > ;
+ < "différent" ; > ;
+ < "identique" ; > ;
+ < "tend" ; > ;
+ < "infini" ; > ;
+ < "angle" ; > ;
+ < "pourmille" ; > ;
+ < "et" ; > ;
+ < "ou" ; > ;
+ };
+ ItemList [ es ] =
+ {
+ < "alfa" ; > ;
+ < "ALFA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "épsilon" ; > ;
+ < "ÉPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "my" ; > ;
+ < "MY" ; > ;
+ < "ny" ; > ;
+ < "NY" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omicrón" ; > ;
+ < "OMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "ípsilon" ; > ;
+ < "ÃPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "ji" ; > ;
+ < "JI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "elemento" ; > ;
+ < "sinelemento" ; > ;
+ < "muchomenor" ; > ;
+ < "muchomayor" ; > ;
+ < "diferente" ; > ;
+ < "idéntico" ; > ;
+ < "tiende" ; > ;
+ < "infinito" ; > ;
+ < "ángulo" ; > ;
+ < "pormil" ; > ;
+ < "y" ; > ;
+ < "o" ; > ;
+ };
+ ItemList [ fi ] =
+ {
+ < "alfa" ; > ;
+ < "alfa" ; > ;
+ < "beeta" ; > ;
+ < "beeta" ; > ;
+ < "Gamma" ; > ;
+ < "Gamma" ; > ;
+ < "Delta" ; > ;
+ < "Delta" ; > ;
+ < "Epsilon" ; > ;
+ < "Epsilon" ; > ;
+ < "Zeeta" ; > ;
+ < "Zeeta" ; > ;
+ < "Eeta" ; > ;
+ < "Eeta" ; > ;
+ < "Theeta" ; > ;
+ < "Theeta" ; > ;
+ < "Ioota" ; > ;
+ < "Ioota" ; > ;
+ < "Kappa" ; > ;
+ < "Kappa" ; > ;
+ < "Lambda" ; > ;
+ < "Lambda" ; > ;
+ < "Myy" ; > ;
+ < "Myy" ; > ;
+ < "Nyy" ; > ;
+ < "Nyy" ; > ;
+ < "Ksii" ; > ;
+ < "Ksii" ; > ;
+ < "Omikron" ; > ;
+ < "Omikron" ; > ;
+ < "Pii" ; > ;
+ < "Pii" ; > ;
+ < "Rhoo" ; > ;
+ < "Rhoo" ; > ;
+ < "Sigma" ; > ;
+ < "Sigma" ; > ;
+ < "Tau" ; > ;
+ < "Tau" ; > ;
+ < "Ypsilon" ; > ;
+ < "Ypsilon" ; > ;
+ < "Fii" ; > ;
+ < "Fii" ; > ;
+ < "Khii" ; > ;
+ < "Khii" ; > ;
+ < "Psii" ; > ;
+ < "Psii" ; > ;
+ < "Omega" ; > ;
+ < "Omega" ; > ;
+ < "Varepsilon" ; > ;
+ < "Vartheeta" ; > ;
+ < "Varpii" ; > ;
+ < "Varrhoo" ; > ;
+ < "Varsigma" ; > ;
+ < "Varfii" ; > ;
+ < "element" ; > ;
+ < "noelement" ; > ;
+ < "strictlylessthan" ; > ;
+ < "strictlygreaterthan" ; > ;
+ < "notequal" ; > ;
+ < "identical" ; > ;
+ < "tendto" ; > ;
+ < "infinite" ; > ;
+ < "angle" ; > ;
+ < "perthousand" ; > ;
+ < "and" ; > ;
+ < "or" ; > ;
+ };
+ ItemList [ ca ] =
+ {
+ < "alpha" ; > ;
+ < "ALPHA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "jota" ; > ;
+ < "JOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "my" ; > ;
+ < "MY" ; > ;
+ < "ny" ; > ;
+ < "NY" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omikron" ; > ;
+ < "OMIKRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "ypsilon" ; > ;
+ < "YPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "element" ; > ;
+ < "keinelement" ; > ;
+ < "kleingegen" ; > ;
+ < "großgegen" ; > ;
+ < "ungleich" ; > ;
+ < "identisch" ; > ;
+ < "strebt" ; > ;
+ < "unendlich" ; > ;
+ < "winkel" ; > ;
+ < "promille" ; > ;
+ < "AND" ; > ;
+ < "OR" ; > ;
+ };
+ ItemList [ it ] =
+ {
+ < "alfa" ; > ;
+ < "ALFA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "cappa" ; > ;
+ < "CAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mi" ; > ;
+ < "MI" ; > ;
+ < "ni" ; > ;
+ < "NI" ; > ;
+ < "csi" ; > ;
+ < "CSI" ; > ;
+ < "omicron" ; > ;
+ < "OMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "ro" ; > ;
+ < "RO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "ipsilon" ; > ;
+ < "IPSILON" ; > ;
+ < "fi" ; > ;
+ < "FI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varro" ; > ;
+ < "varsigma" ; > ;
+ < "varfi" ; > ;
+ < "elemento" ; > ;
+ < "non.elemento" ; > ;
+ < "molto.minore.di" ; > ;
+ < "molto.maggiore.di" ; > ;
+ < "non.uguale" ; > ;
+ < "identico" ; > ;
+ < "tendente.a" ; > ;
+ < "infinito" ; > ;
+ < "angolo" ; > ;
+ < "per.mille" ; > ;
+ < "e" ; > ;
+ < "oppure" ; > ;
+ };
+ ItemList [ sk ] =
+ {
+ < "alpha" ; > ;
+ < "ALPHA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mu" ; > ;
+ < "MU" ; > ;
+ < "nu" ; > ;
+ < "NU" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omicron" ; > ;
+ < "OMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "upsilon" ; > ;
+ < "UPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "Älen" ; > ;
+ < "nie je Älenom" ; > ;
+ < "úplne menší než" ; > ;
+ < "úplne väÄší než" ; > ;
+ < "nerovná sa" ; > ;
+ < "je totožné s" ; > ;
+ < "blíži sa k" ; > ;
+ < "nekoneÄno" ; > ;
+ < "uhol" ; > ;
+ < "promile" ; > ;
+ < "a" ; > ;
+ < "alebo" ; > ;
+ };
+ ItemList [ da ] =
+ {
+ < "alpha" ; > ;
+ < "ALPHA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "jota" ; > ;
+ < "JOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "my" ; > ;
+ < "MY" ; > ;
+ < "ny" ; > ;
+ < "NY" ; > ;
+ < "xi" ; > ;
+ < "XI " ; > ;
+ < "omikron" ; > ;
+ < "OMIKRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "ypsilon" ; > ;
+ < "YPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "element" ; > ;
+ < "intetelement" ; > ;
+ < "kleingegen" ; > ;
+ < "großgegen" ; > ;
+ < "forskellig fra" ; > ;
+ < "EKSAKT" ; > ;
+ < "gående mod" ; > ;
+ < "uendelig" ; > ;
+ < "Vinkel" ; > ;
+ < "promille" ; > ;
+ < "og" ; > ;
+ < "ELLER" ; > ;
+ };
+ ItemList [ sv ] =
+ {
+ < "alfa" ; > ;
+ < "ALFA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "jota" ; > ;
+ < "JOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "my" ; > ;
+ < "MY" ; > ;
+ < "ny" ; > ;
+ < "NY" ; > ;
+ < "ksi" ; > ;
+ < "KSI" ; > ;
+ < "omikron" ; > ;
+ < "OMIKRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "ro" ; > ;
+ < "RO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "ypsilon" ; > ;
+ < "YPSILON" ; > ;
+ < "fi" ; > ;
+ < "FI" ; > ;
+ < "ki" ; > ;
+ < "KI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varro" ; > ;
+ < "varsigma" ; > ;
+ < "varfi" ; > ;
+ < "tillhör" ; > ;
+ < "tillhörinte" ; > ;
+ < "mycketmindreän" ; > ;
+ < "mycketstörreän" ; > ;
+ < "intelikamed" ; > ;
+ < "identisk" ; > ;
+ < "gårmot" ; > ;
+ < "oändlig" ; > ;
+ < "vinkel" ; > ;
+ < "promille" ; > ;
+ < "och" ; > ;
+ < "eller" ; > ;
+ };
+ ItemList [ pl ] =
+ {
+ < "alfa" ; > ;
+ < "ALFA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "teta" ; > ;
+ < "TETA" ; > ;
+ < "jota" ; > ;
+ < "JOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mi" ; > ;
+ < "MI" ; > ;
+ < "ni" ; > ;
+ < "NI" ; > ;
+ < "ksi" ; > ;
+ < "KSI" ; > ;
+ < "omikron" ; > ;
+ < "OMIKRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "ro" ; > ;
+ < "RO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "ypsilon" ; > ;
+ < "YPSILON" ; > ;
+ < "fi" ; > ;
+ < "FI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "należy" ; > ;
+ < "nienależy" ; > ;
+ < "dużomniejsze" ; > ;
+ < "dużowiększe" ; > ;
+ < "nierówne" ; > ;
+ < "identyczne" ; > ;
+ < "dąży" ; > ;
+ < "nieskończoność" ; > ;
+ < "kÄ…t" ; > ;
+ < "promil" ; > ;
+ < "i" ; > ;
+ < "lub" ; > ;
+ };
+ ItemList [ pt-BR ] =
+ {
+ < "alfa" ; > ;
+ < "ALFA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gama" ; > ;
+ < "GAMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "teta" ; > ;
+ < "TETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kapa" ; > ;
+ < "KAPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mi" ; > ;
+ < "MI" ; > ;
+ < "ni" ; > ;
+ < "NI" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omikron" ; > ;
+ < "OMIKRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "ro" ; > ;
+ < "RO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "ypsilon" ; > ;
+ < "YPSILON" ; > ;
+ < "fi" ; > ;
+ < "FI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "varteta" ; > ;
+ < "varpi" ; > ;
+ < "varro" ; > ;
+ < "varsigma" ; > ;
+ < "varfi" ; > ;
+ < "elemento" ; > ;
+ < "não-elemento" ; > ;
+ < "muito.menor.que" ; > ;
+ < "muito.maior.que" ; > ;
+ < "diferente" ; > ;
+ < "idêntico" ; > ;
+ < "tende.a" ; > ;
+ < "infinito" ; > ;
+ < "ângulo" ; > ;
+ < "pormil" ; > ;
+ < "e" ; > ;
+ < "ou" ; > ;
+ };
+ ItemList [ th ] =
+ {
+ < "อัลฟ่า" ; > ;
+ < "อัลฟ่า" ; > ;
+ < "เบต้า" ; > ;
+ < "เบต้า" ; > ;
+ < "à¹à¸à¸¡à¸¡à¹ˆà¸²" ; > ;
+ < "à¹à¸à¸¡à¸¡à¹ˆà¸²" ; > ;
+ < "เดลต้า" ; > ;
+ < "เดลต้า" ; > ;
+ < "เอพซิลอน" ; > ;
+ < "เอพซิลอน" ; > ;
+ < "ซีต้า" ; > ;
+ < "ซีต้า" ; > ;
+ < "อีต้า" ; > ;
+ < "อีต้า" ; > ;
+ < "ธีต้า" ; > ;
+ < "ธีต้า" ; > ;
+ < "ไอโอต้า" ; > ;
+ < "ไอโอต้า" ; > ;
+ < "à¹à¸„ปป้า" ; > ;
+ < "à¹à¸„ปป้า" ; > ;
+ < "à¹à¸¥à¸¡à¸šà¹Œà¸”้า" ; > ;
+ < "à¹à¸¥à¸¡à¸šà¹Œà¸”้า" ; > ;
+ < "มิว" ; > ;
+ < "มิว" ; > ;
+ < "นิว" ; > ;
+ < "นิว" ; > ;
+ < "ไซ" ; > ;
+ < "ไซ" ; > ;
+ < "โอไมครอน" ; > ;
+ < "โอไมครอน" ; > ;
+ < "ไพ" ; > ;
+ < "ไพ" ; > ;
+ < "โร" ; > ;
+ < "โร" ; > ;
+ < "ซิà¸à¸¡à¹ˆà¸²" ; > ;
+ < "ซิà¸à¸¡à¹ˆà¸²" ; > ;
+ < "ทอ" ; > ;
+ < "ทอ" ; > ;
+ < "อัพซิลอน" ; > ;
+ < "อัพซิลอน" ; > ;
+ < "ไฟ" ; > ;
+ < "ไฟ" ; > ;
+ < "ไค" ; > ;
+ < "ไค" ; > ;
+ < "พไซ" ; > ;
+ < "พไซ" ; > ;
+ < "โอเมà¸à¹‰à¸²" ; > ;
+ < "โอเมà¸à¹‰à¸²" ; > ;
+ < "วาร์เอพซิลอน" ; > ;
+ < "วาร์เธตะ" ; > ;
+ < "วาร์ไพ" ; > ;
+ < "วาร์โร" ; > ;
+ < "วาร์ซิà¸à¸¡à¹ˆà¸²" ; > ;
+ < "วาร์ไฟ" ; > ;
+ < "องค์ประà¸à¸­à¸š" ; > ;
+ < "ไม่มีองค์ประà¸à¸­à¸š" ; > ;
+ < "จำà¸à¸±à¸”น้อยà¸à¸§à¹ˆà¸²" ; > ;
+ < "จำà¸à¸±à¸”มาà¸à¸à¸§à¹ˆà¸²" ; > ;
+ < "ไม่เท่าà¸à¸±à¸š" ; > ;
+ < "เหมือนà¸à¸±à¸™" ; > ;
+ < "โน้มเอียงไปยัง" ; > ;
+ < "อนันต์" ; > ;
+ < "มุม" ; > ;
+ < "ต่อพัน" ; > ;
+ < "à¹à¸¥à¸°" ; > ;
+ < "or" ; > ;
+ };
+ ItemList [ ja ] =
+ {
+ < "alpha" ; > ;
+ < "ALPHA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mu" ; > ;
+ < "MU" ; > ;
+ < "nu" ; > ;
+ < "NU" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omicron" ; > ;
+ < "OMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "upsilon" ; > ;
+ < "UPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "属ã™ã‚‹" ; > ;
+ < "属ã•ãªã„" ; > ;
+ < "éžå¸¸ã«å°ã•ã„" ; > ;
+ < "éžå¸¸ã«å¤§ãã„" ; > ;
+ < "ç­‰å·å¦å®š" ; > ;
+ < "åˆåŒ" ; > ;
+ < "å³å‘矢å°" ; > ;
+ < "ç„¡é™å¤§" ; > ;
+ < "角" ; > ;
+ < "パーミル" ; > ;
+ < "ã‹ã¤" ; > ;
+ < "ã¾ãŸã¯" ; > ;
+ };
+ ItemList [ ko ] =
+ {
+ < "alpha" ; > ;
+ < "ALPHA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mu" ; > ;
+ < "MY" ; > ;
+ < "ny" ; > ;
+ < "NU" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omicron" ; > ;
+ < "OMIKRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "upsilon" ; > ;
+ < "UPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "요소" ; > ;
+ < "요소없ìŒ" ; > ;
+ < "비해작ìŒ" ; > ;
+ < "보다 í¼" ; > ;
+ < "같지않ìŒ" ; > ;
+ < "ì¼ì¹˜" ; > ;
+ < "ì ‘ê·¼" ; > ;
+ < "무한" ; > ;
+ < "ê°ë„" ; > ;
+ < "천분율" ; > ;
+ < "와(과)" ; > ;
+ < "ë˜ëŠ”" ; > ;
+ };
+ ItemList [ zh-CN ] =
+ {
+ < "alpha" ; > ;
+ < "ALPHA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mu" ; > ;
+ < "MU" ; > ;
+ < "nu" ; > ;
+ < "NU" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omicron" ; > ;
+ < "OMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "upsilon" ; > ;
+ < "UPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "元素" ; > ;
+ < "éžå…ƒç´ " ; > ;
+ < "éžå¸¸å°äºŽ" ; > ;
+ < "éžå¸¸å¤§äºŽ" ; > ;
+ < "ä¸ç­‰äºŽ" ; > ;
+ < "ç­‰åŒ" ; > ;
+ < "接近" ; > ;
+ < "无穷大" ; > ;
+ < "角度" ; > ;
+ < "åƒåˆ†çŽ‡" ; > ;
+ < "和" ; > ;
+ < "或" ; > ;
+ };
+ ItemList [ zh-TW ] =
+ {
+ < "alpha" ; > ;
+ < "ALPHA" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gamma" ; > ;
+ < "GAMMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mu" ; > ;
+ < "MU" ; > ;
+ < "nu" ; > ;
+ < "NU" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omicron" ; > ;
+ < "OMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "upsilon" ; > ;
+ < "UPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "元素" ; > ;
+ < "éžå…ƒç´ " ; > ;
+ < "éžå¸¸å°æ–¼" ; > ;
+ < "éžå¸¸å¤§æ–¼" ; > ;
+ < "ä¸ç­‰æ–¼" ; > ;
+ < "ç­‰åŒ" ; > ;
+ < "接近" ; > ;
+ < "ç„¡é™" ; > ;
+ < "角度" ; > ;
+ < "åƒåˆ†çŽ‡" ; > ;
+ < "和" ; > ;
+ < "或" ; > ;
+ };
+ ItemList [ tr ] =
+ {
+ < "Alfa" ; > ;
+ < "Alfa" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "gama" ; > ;
+ < "GAMA" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMDA" ; > ;
+ < "mu" ; > ;
+ < "MRT" ; > ;
+ < "nu" ; > ;
+ < "NU" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omikron" ; > ;
+ < "OMIKRON" ; > ;
+ < "pi" ; > ;
+ < "PÄ°" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SÄ°GMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "upsilon" ; > ;
+ < "UPSÄ°LON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "element" ; > ;
+ < "element deÄŸil" ; > ;
+ < "küçüktür" ; > ;
+ < "büyüktür" ; > ;
+ < "eÅŸit deÄŸil" ; > ;
+ < "aynı" ; > ;
+ < "kadar" ; > ;
+ < "Sonsuz" ; > ;
+ < "Açı" ; > ;
+ < "bindebir" ; > ;
+ < "ve" ; > ;
+ < "VEYA" ; > ;
+ };
+ ItemList [ hi-IN ] =
+ {
+ < "आलà¥à¤«à¤¼à¤¾" ; > ;
+ < "ALPHA" ; > ;
+ < "बीटा" ; > ;
+ < "BETA" ; > ;
+ < "गामा" ; > ;
+ < "GAMMA" ; > ;
+ < "डेलà¥à¤Ÿà¤¾" ; > ;
+ < "DELTA" ; > ;
+ < "à¤à¤ªà¥à¤¸à¤¿à¤²à¥‹à¤¨" ; > ;
+ < "EPSILON" ; > ;
+ < "à¤à¥€à¤Ÿà¤¾" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "तीटा" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "कापà¥à¤ªà¤¾" ; > ;
+ < "KAPPA" ; > ;
+ < "लामà¥à¤¡à¤¾" ; > ;
+ < "LAMBDA" ; > ;
+ < "mu" ; > ;
+ < "MU" ; > ;
+ < "nu" ; > ;
+ < "NU" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "ओमिकà¥à¤°à¥‹à¤¨" ; > ;
+ < "OMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "सिगà¥à¤®à¤¾" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "अपà¥à¤¸à¤¿à¤²à¥‹à¤¨" ; > ;
+ < "UPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "ओमेगा" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "à¤à¤²à¤¿à¤®à¥‡à¤¨à¥à¤Ÿà¥" ; > ;
+ < "कोई à¤à¤²à¤¿à¤®à¥‡à¤¨à¥à¤Ÿ नहीं" ; > ;
+ < "से कम" ; > ;
+ < "से अधिक" ; > ;
+ < "असमान" ; > ;
+ < "सदृश" ; > ;
+ < "tendto" ; > ;
+ < "अनंत" ; > ;
+ < "कोण" ; > ;
+ < "à¤à¤• हज़ार में" ; > ;
+ < "और" ; > ;
+ < "अथवा" ; > ;
+ };
+ ItemList [ ar ] =
+ {
+ < "K" ; > ;
+ < "K" ; > ;
+ < "beta" ; > ;
+ < "BETA" ; > ;
+ < "غاما" ; > ;
+ < "غاما" ; > ;
+ < "delta" ; > ;
+ < "DELTA" ; > ;
+ < "epsilon" ; > ;
+ < "EPSILON" ; > ;
+ < "zeta" ; > ;
+ < "ZETA" ; > ;
+ < "eta" ; > ;
+ < "ETA" ; > ;
+ < "theta" ; > ;
+ < "THETA" ; > ;
+ < "iota" ; > ;
+ < "IOTA" ; > ;
+ < "kappa" ; > ;
+ < "KAPPA" ; > ;
+ < "lambda" ; > ;
+ < "LAMBDA" ; > ;
+ < "mu" ; > ;
+ < "MU" ; > ;
+ < "nu" ; > ;
+ < "NU" ; > ;
+ < "xi" ; > ;
+ < "XI" ; > ;
+ < "omicron" ; > ;
+ < "OMICRON" ; > ;
+ < "pi" ; > ;
+ < "PI" ; > ;
+ < "rho" ; > ;
+ < "RHO" ; > ;
+ < "sigma" ; > ;
+ < "SIGMA" ; > ;
+ < "tau" ; > ;
+ < "TAU" ; > ;
+ < "upsilon" ; > ;
+ < "UPSILON" ; > ;
+ < "phi" ; > ;
+ < "PHI" ; > ;
+ < "chi" ; > ;
+ < "CHI" ; > ;
+ < "psi" ; > ;
+ < "PSI" ; > ;
+ < "omega" ; > ;
+ < "OMEGA" ; > ;
+ < "varepsilon" ; > ;
+ < "vartheta" ; > ;
+ < "varpi" ; > ;
+ < "varrho" ; > ;
+ < "varsigma" ; > ;
+ < "varphi" ; > ;
+ < "element" ; > ;
+ < "noelement" ; > ;
+ < "strictlylessthan" ; > ;
+ < "groÙƒgegen" ; > ;
+ < "لا يساوي" ; > ;
+ < "EXACT" ; > ;
+ < "tendto" ; > ;
+ < "لانهائي" ; > ;
+ < "الزاوية" ; > ;
+ < "perthousand" ; > ;
+ < "Ùˆ" ; > ;
+ < "أو" ; > ;
+ };
+ ItemList [ he ] =
+ {
+ < "‮×לפ×‬" ; > ;
+ < "ALPHA" ; > ;
+ < "‮בט×‬" ; > ;
+ < "BETA" ; > ;
+ < "‮גמ×‬" ; > ;
+ < "GAMMA" ; > ;
+ < "‮דלט×‬" ; > ;
+ < "DELTA" ; > ;
+ < "‮×פסילון‬" ; > ;
+ < "EPSILON" ; > ;
+ < "‮זיט×‬" ; > ;
+ < "ZETA" ; > ;
+ < "‮×יט×‬" ; > ;
+ < "ETA" ; > ;
+ < "‮ת×יט×‬" ; > ;
+ < "THETA" ; > ;
+ < "‮×יוט×‬" ; > ;
+ < "JOTA" ; > ;
+ < "‮קפ×‬" ; > ;
+ < "KAPPA" ; > ;
+ < "‮למבד×‬" ; > ;
+ < "LAMBDA" ; > ;
+ < "‮מיו‬" ; > ;
+ < "MY" ; > ;
+ < "‮ניו‬" ; > ;
+ < "NY" ; > ;
+ < "‮קסיי‬" ; > ;
+ < "XI" ; > ;
+ < "‮×ומיקרון‬" ; > ;
+ < "OMIKRON" ; > ;
+ < "‮פיי‬" ; > ;
+ < "PI" ; > ;
+ < "‮רו‬" ; > ;
+ < "RHO" ; > ;
+ < "‮סיגמ×‬" ; > ;
+ < "SIGMA" ; > ;
+ < "‮ט×ו‬" ; > ;
+ < "TAU" ; > ;
+ < "‮×פסילון‬" ; > ;
+ < "YPSILON" ; > ;
+ < "‮פיי‬" ; > ;
+ < "PHI" ; > ;
+ < "‮צ'יי‬" ; > ;
+ < "CHI" ; > ;
+ < "‮פסיי‬" ; > ;
+ < "PSI" ; > ;
+ < "‮×ומג×‬" ; > ;
+ < "OMEGA" ; > ;
+ < "‮וור ×פסילון‬" ; > ;
+ < "‮וור תט×‬" ; > ;
+ < "‮וור פיי‬" ; > ;
+ < "‮וור רו‬" ; > ;
+ < "‮וור סיגמ×‬" ; > ;
+ < "‮וור פיי‬" ; > ;
+ < "‮רכיב‬" ; > ;
+ < "â€®×œ×œ× ×¨×›×™×‘â€¬" ; > ;
+ < "‮פחות מ ‬" ; > ;
+ < "‮גדול מ ‬" ; > ;
+ < "â€®×œ× ×©×•×•×” ‬" ; > ;
+ < "‮זהה ‬" ; > ;
+ < "‮נוטה ל ‬" ; > ;
+ < "‮×ין סופי ‬" ; > ;
+ < "‮זווית‬" ; > ;
+ < "‮פרומיל‬" ; > ;
+ < "‮ו ‬" ; > ;
+ < "‮×ו ‬" ; > ;
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binfilter/bf_starmath/source/starmath_typemap.cxx b/binfilter/bf_starmath/source/starmath_typemap.cxx
new file mode 100644
index 000000000000..e1a06e66e3e5
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_typemap.cxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_PTR 0
+#define ITEMID_SHADOW 0
+#define ITEMID_PAGE 0
+#define ITEMID_SETITEM 0
+#define ITEMID_HORJUSTIFY 0
+#define ITEMID_VERJUSTIFY 0
+#define ITEMID_ORIENTATION 0
+#define ITEMID_MARGIN 0
+#define ITEMID_AUTHOR 0
+#define ITEMID_DATE 0
+#define ITEMID_TEXT 0
+#define ITEMID_SPELLCHECK 0
+#define ITEMID_HYPHENREGION 0
+#define ITEMID_FONT 0
+#define ITEMID_FONTHEIGHT 0
+#define ITEMID_COLOR 0
+#define ITEMID_BRUSH 0
+#define ITEMID_BRUSH 0
+#define ITEMID_BOX 0
+#define ITEMID_LINE 0
+#define ITEMID_BRUSH 0
+#define ITEMID_SPELLCHECK 0
+#define ITEMID_HYPHENREGION 0
+#define ITEMID_LINESPACING 0
+#define ITEMID_ADJUST 0
+#define ITEMID_WIDOWS 0
+#define ITEMID_ORPHANS 0
+#define ITEMID_HYPHENZONE 0
+#define ITEMID_TABSTOP 0
+#define ITEMID_FMTSPLIT 0
+#define ITEMID_PAGEMODEL 0
+#define ITEMID_FONTLIST 0
+#define ITEMID_FONT 0
+#define ITEMID_POSTURE 0
+#define ITEMID_WEIGHT 0
+#define ITEMID_FONTHEIGHT 0
+#define ITEMID_FONTWIDTH 0
+#define ITEMID_UNDERLINE 0
+#define ITEMID_CROSSEDOUT 0
+#define ITEMID_SHADOWED 0
+#define ITEMID_AUTOKERN 0
+#define ITEMID_WORDLINEMODE 0
+#define ITEMID_CONTOUR 0
+#define ITEMID_PROPSIZE 0
+#define ITEMID_COLOR 0
+#define ITEMID_CHARSETCOLOR 0
+#define ITEMID_KERNING 0
+#define ITEMID_CASEMAP 0
+#define ITEMID_ESCAPEMENT 0
+#define ITEMID_LANGUAGE 0
+#define ITEMID_NOLINEBREAK 0
+#define ITEMID_NOHYPHENHERE 0
+#define ITEMID_COLOR 0
+#define ITEMID_FONT 0
+#define ITEMID_FONTHEIGHT 0
+#define ITEMID_SEARCH 0
+#define ITEMID_COLOR_TABLE 0
+#define ITEMID_GRADIENT_LIST 0
+#define ITEMID_HATCH_LIST 0
+#define ITEMID_BITMAP_LIST 0
+#define ITEMID_DASH_LIST 0
+#define ITEMID_LINEEND_LIST 0
+#define ITEMID_NUMBERINFO 0
+#define ITEMID_CHARTSTYLE 0
+#define ITEMID_CHARTDATADESCR 0
+#define ITEMID_CHARTLEGENDPOS 0
+#define ITEMID_CHARTTEXTORDER 0
+#define ITEMID_CHARTTEXTORIENT 0
+#define ITEMID_DOUBLE 0
+#define ITEMID_TABSTOP 0
+#define ITEMID_PAPERBIN 0
+#define ITEMID_SIZE 0
+#define ITEMID_LRSPACE 0
+#define ITEMID_ULSPACE 0
+#define ITEMID_PRINT 0
+#define ITEMID_OPAQUE 0
+#define ITEMID_PROTECT 0
+#define ITEMID_MACRO 0
+#define ITEMID_BOX 0
+#define ITEMID_BOXINFO 0
+#define ITEMID_FMTBREAK 0
+#define ITEMID_FMTKEEP 0
+#define ITEMID_LINE 0
+#define ITEMID_BRUSH 0
+
+#define CharSetItem SfxVoidItem
+#define FontFamilyItem SfxVoidItem
+#define FontPitchItem SfxVoidItem
+#define FontAlignItem SfxVoidItem
+#define FontWeightItem SfxVoidItem
+#define FontUnderlineItem SfxVoidItem
+#define FontStrikeoutItem SfxVoidItem
+#define FontItalicItem SfxVoidItem
+#define SvxDbTypeItem SfxVoidItem
+#define SvxLineSpaceItem SfxVoidItem
+#define SvxInterLineSpaceItem SfxVoidItem
+#define SvxBreakItem SfxVoidItem
+#define BrushStyleItem SfxVoidItem
+#define SvxNumTypeItem SfxVoidItem
+#define SvxShadowLocationItem SfxVoidItem
+#define SvxLanguage SfxVoidItem
+#define SvxChooseControlEnumItem SfxVoidItem
+#define SvxDrawToolEnumItem SfxVoidItem
+#define SvxChooseControlItem SfxVoidItem
+#define SvxDrawToolItem SfxVoidItem
+#define SvxCellHorJustifyEnumItem SfxVoidItem
+#define SvxCellVerJustifyEnumItem SfxVoidItem
+#define SvxCellOrientationEnumItem SfxVoidItem
+
+#include <bf_sfx2/msg.hxx>
+#include <bf_svtools/stritem.hxx>
+#include <bf_svtools/eitem.hxx>
+#include <bf_svx/zoomitem.hxx>
+#include <bf_svtools/slstitm.hxx>
+
+#define SFX_TYPEMAP
+namespace binfilter {
+#include "smslots.hxx"
+} //namespace binfilter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_unodoc.cxx b/binfilter/bf_starmath/source/starmath_unodoc.cxx
new file mode 100644
index 000000000000..1d0fd630928b
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_unodoc.cxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// System - Includes -----------------------------------------------------
+
+#include <tools/string.hxx>
+#include <bf_sfx2/docfac.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include "smmod.hxx"
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+
+::rtl::OUString SAL_CALL SmDocument_getImplementationName() throw()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.FormulaDocument" ) );
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SmDocument_getSupportedServiceNames() throw()
+{
+ uno::Sequence< ::rtl::OUString > aSeq( 1 );
+ aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.formula.FormulaProperties" ));
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmDocument_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
+{
+ SolarMutexGuard aGuard;
+
+ // to create the service the SW_MOD should be already initialized
+ DBG_ASSERT( SM_MOD(), "No StarMath module!" );
+
+ if ( SM_MOD() )
+ {
+ ::rtl::OUString aFactoryURL( RTL_CONSTASCII_USTRINGPARAM ( "private:factory/smath" ) );
+ const SfxObjectFactory* pFactory = SfxObjectFactory::GetFactory( aFactoryURL );
+ if ( pFactory )
+ {
+ SfxObjectShell* pShell = pFactory->CreateObject();
+ if( pShell )
+ return uno::Reference< uno::XInterface >( pShell->GetModel() );
+ }
+ }
+
+ return uno::Reference< uno::XInterface >();
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_unomodel.cxx b/binfilter/bf_starmath/source/starmath_unomodel.cxx
new file mode 100644
index 000000000000..9551226bc159
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_unomodel.cxx
@@ -0,0 +1,905 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <osl/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <bf_sfx2/printer.hxx>
+#include <vcl/svapp.hxx>
+#include <bf_svtools/ctrltool.hxx>
+#include <bf_svtools/itemprop.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/processfactory.hxx>
+#include <bf_svx/paperinf.hxx>
+#include <vcl/settings.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/formula/SymbolDescriptor.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
+
+#include <bf_xmloff/xmluconv.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <comphelper/propertysetinfo.hxx>
+
+#include <unomodel.hxx>
+#include <document.hxx>
+#include <symbol.hxx>
+#include <starmath.hrc>
+#include <config.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+
+#include <rtl/uuid.h>
+
+namespace binfilter {
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::std;
+using namespace ::comphelper;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::formula;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::script;
+
+#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
+#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
+
+#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar)
+
+////////////////////////////////////////
+//
+// class SmModel
+//
+#define PROPERTY_NONE 0
+enum SmModelPropertyHandles
+{
+ HANDLE_FORMULA,
+ HANDLE_FONT_NAME_VARIABLES,
+ HANDLE_FONT_NAME_FUNCTIONS,
+ HANDLE_FONT_NAME_NUMBERS,
+ HANDLE_FONT_NAME_TEXT,
+ HANDLE_CUSTOM_FONT_NAME_SERIF,
+ HANDLE_CUSTOM_FONT_NAME_SANS,
+ HANDLE_CUSTOM_FONT_NAME_FIXED,
+ HANDLE_CUSTOM_FONT_FIXED_POSTURE,
+ HANDLE_CUSTOM_FONT_FIXED_WEIGHT,
+ HANDLE_CUSTOM_FONT_SANS_POSTURE,
+ HANDLE_CUSTOM_FONT_SANS_WEIGHT,
+ HANDLE_CUSTOM_FONT_SERIF_POSTURE,
+ HANDLE_CUSTOM_FONT_SERIF_WEIGHT,
+ HANDLE_FONT_VARIABLES_POSTURE,
+ HANDLE_FONT_VARIABLES_WEIGHT,
+ HANDLE_FONT_FUNCTIONS_POSTURE,
+ HANDLE_FONT_FUNCTIONS_WEIGHT,
+ HANDLE_FONT_NUMBERS_POSTURE,
+ HANDLE_FONT_NUMBERS_WEIGHT,
+ HANDLE_FONT_TEXT_POSTURE,
+ HANDLE_FONT_TEXT_WEIGHT,
+ HANDLE_BASE_FONT_HEIGHT,
+ HANDLE_RELATIVE_FONT_HEIGHT_TEXT,
+ HANDLE_RELATIVE_FONT_HEIGHT_INDICES,
+ HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS,
+ HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS,
+ HANDLE_RELATIVE_FONT_HEIGHT_LIMITS,
+ HANDLE_IS_TEXT_MODE,
+ HANDLE_ALIGNMENT,
+ HANDLE_RELATIVE_SPACING,
+ HANDLE_RELATIVE_LINE_SPACING,
+ HANDLE_RELATIVE_ROOT_SPACING,
+ HANDLE_RELATIVE_INDEX_SUPERSCRIPT,
+ HANDLE_RELATIVE_INDEX_SUBSCRIPT,
+ HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT,
+ HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH,
+ HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH,
+ HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT,
+ HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE,
+ HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE,
+ HANDLE_RELATIVE_BRACKET_EXCESS_SIZE,
+ HANDLE_RELATIVE_BRACKET_DISTANCE,
+ HANDLE_IS_SCALE_ALL_BRACKETS,
+ HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE,
+ HANDLE_RELATIVE_MATRIX_LINE_SPACING,
+ HANDLE_RELATIVE_MATRIX_COLUMN_SPACING,
+ HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT,
+ HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT,
+ HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE,
+ HANDLE_RELATIVE_OPERATOR_SPACING,
+ HANDLE_LEFT_MARGIN,
+ HANDLE_RIGHT_MARGIN,
+ HANDLE_TOP_MARGIN,
+ HANDLE_BOTTOM_MARGIN,
+ HANDLE_PRINTER_NAME,
+ HANDLE_PRINTER_SETUP,
+ HANDLE_SYMBOLS,
+ HANDLE_BASIC_LIBRARIES /* #93295# */
+};
+
+PropertySetInfo * lcl_createModelPropertyInfo ()
+{
+ static PropertyMapEntry aModelPropertyInfoMap[] =
+ {
+ { RTL_CONSTASCII_STRINGPARAM( "Alignment" ), HANDLE_ALIGNMENT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM( "BaseFontHeight" ), HANDLE_BASE_FONT_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM( "BasicLibraries" ), HANDLE_BASIC_LIBRARIES , &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), PropertyAttribute::READONLY, 0},
+ { RTL_CONSTASCII_STRINGPARAM( "BottomMargin" ), HANDLE_BOTTOM_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BOTTOMSPACE },
+ { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameFixed" ), HANDLE_CUSTOM_FONT_NAME_FIXED , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_FIXED },
+ { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameSans" ), HANDLE_CUSTOM_FONT_NAME_SANS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_SANS },
+ { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameSerif" ), HANDLE_CUSTOM_FONT_NAME_SERIF , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_SERIF },
+ { RTL_CONSTASCII_STRINGPARAM( "FontFixedIsBold"), HANDLE_CUSTOM_FONT_FIXED_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FIXED},
+ { RTL_CONSTASCII_STRINGPARAM( "FontFixedIsItalic"), HANDLE_CUSTOM_FONT_FIXED_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FIXED},
+ { RTL_CONSTASCII_STRINGPARAM( "FontFunctionsIsBold"), HANDLE_FONT_FUNCTIONS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FUNCTION},
+ { RTL_CONSTASCII_STRINGPARAM( "FontFunctionsIsItalic"), HANDLE_FONT_FUNCTIONS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FUNCTION},
+ { RTL_CONSTASCII_STRINGPARAM( "FontNameFunctions" ), HANDLE_FONT_NAME_FUNCTIONS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_FUNCTION },
+ { RTL_CONSTASCII_STRINGPARAM( "FontNameNumbers" ), HANDLE_FONT_NAME_NUMBERS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_NUMBER },
+ { RTL_CONSTASCII_STRINGPARAM( "FontNameText" ), HANDLE_FONT_NAME_TEXT , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_TEXT },
+ { RTL_CONSTASCII_STRINGPARAM( "FontNameVariables" ), HANDLE_FONT_NAME_VARIABLES , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_VARIABLE },
+ { RTL_CONSTASCII_STRINGPARAM( "FontNumbersIsBold"), HANDLE_FONT_NUMBERS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_NUMBER},
+ { RTL_CONSTASCII_STRINGPARAM( "FontNumbersIsItalic"), HANDLE_FONT_NUMBERS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_NUMBER},
+ { RTL_CONSTASCII_STRINGPARAM( "FontSansIsBold"), HANDLE_CUSTOM_FONT_SANS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SANS},
+ { RTL_CONSTASCII_STRINGPARAM( "FontSansIsItalic"), HANDLE_CUSTOM_FONT_SANS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SANS},
+ { RTL_CONSTASCII_STRINGPARAM( "FontSerifIsBold"), HANDLE_CUSTOM_FONT_SERIF_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SERIF},
+ { RTL_CONSTASCII_STRINGPARAM( "FontSerifIsItalic"), HANDLE_CUSTOM_FONT_SERIF_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SERIF},
+ { RTL_CONSTASCII_STRINGPARAM( "FontTextIsBold"), HANDLE_FONT_TEXT_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, },
+ { RTL_CONSTASCII_STRINGPARAM( "FontTextIsItalic"), HANDLE_FONT_TEXT_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, },
+ { RTL_CONSTASCII_STRINGPARAM( "FontVariablesIsBold"), HANDLE_FONT_VARIABLES_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, },
+ { RTL_CONSTASCII_STRINGPARAM( "FontVariablesIsItalic"), HANDLE_FONT_VARIABLES_POSTURE, &::getBooleanCppuType(), PROPERTY_NONE, },
+ { RTL_CONSTASCII_STRINGPARAM( "Formula" ), HANDLE_FORMULA , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM( "IsScaleAllBrackets" ), HANDLE_IS_SCALE_ALL_BRACKETS , &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM( "IsTextMode" ), HANDLE_IS_TEXT_MODE , &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM( "LeftMargin" ), HANDLE_LEFT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_LEFTSPACE },
+ { RTL_CONSTASCII_STRINGPARAM( "PrinterName" ), HANDLE_PRINTER_NAME , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0 },
+ { RTL_CONSTASCII_STRINGPARAM( "PrinterSetup" ), HANDLE_PRINTER_SETUP , &::getCppuType((const Sequence < sal_Int8 >*)0), PROPERTY_NONE, 0 },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeBracketDistance" ), HANDLE_RELATIVE_BRACKET_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BRACKETSPACE },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeBracketExcessSize" ), HANDLE_RELATIVE_BRACKET_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BRACKETSIZE },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightFunctions" ), HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_FUNCTION},
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightIndices" ), HANDLE_RELATIVE_FONT_HEIGHT_INDICES , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_INDEX },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightLimits" ), HANDLE_RELATIVE_FONT_HEIGHT_LIMITS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_LIMITS },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightOperators" ), HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_OPERATOR},
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightText" ), HANDLE_RELATIVE_FONT_HEIGHT_TEXT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_TEXT },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionBarExcessLength"), HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_FRACTION },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionBarLineWeight" ), HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_STROKEWIDTH },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionDenominatorDepth"), HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_DENOMINATOR },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionNumeratorHeight" ), HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_NUMERATOR },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeIndexSubscript" ), HANDLE_RELATIVE_INDEX_SUBSCRIPT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_SUBSCRIPT },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeIndexSuperscript" ), HANDLE_RELATIVE_INDEX_SUPERSCRIPT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_SUPERSCRIPT },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeLineSpacing" ), HANDLE_RELATIVE_LINE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_VERTICAL },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeLowerLimitDistance" ), HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_LOWERLIMIT },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeMatrixColumnSpacing" ), HANDLE_RELATIVE_MATRIX_COLUMN_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_MATRIXCOL},
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeMatrixLineSpacing" ), HANDLE_RELATIVE_MATRIX_LINE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_MATRIXROW},
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeOperatorExcessSize" ), HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_OPERATORSIZE },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeOperatorSpacing" ), HANDLE_RELATIVE_OPERATOR_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_OPERATORSPACE},
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeRootSpacing" ), HANDLE_RELATIVE_ROOT_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ROOT },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeScaleBracketExcessSize" ), HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_NORMALBRACKETSIZE},
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeSpacing" ), HANDLE_RELATIVE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_HORIZONTAL },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeSymbolMinimumHeight" ), HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ORNAMENTSPACE },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeSymbolPrimaryHeight" ), HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ORNAMENTSIZE },
+ { RTL_CONSTASCII_STRINGPARAM( "RelativeUpperLimitDistance" ), HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_UPPERLIMIT },
+ { RTL_CONSTASCII_STRINGPARAM( "RightMargin" ), HANDLE_RIGHT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_RIGHTSPACE },
+ { RTL_CONSTASCII_STRINGPARAM( "Symbols" ), HANDLE_SYMBOLS , &::getCppuType((const Sequence < SymbolDescriptor > *)0), PROPERTY_NONE, 0 },
+ { RTL_CONSTASCII_STRINGPARAM( "TopMargin" ), HANDLE_TOP_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_TOPSPACE },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+ PropertySetInfo *pInfo = new PropertySetInfo ( aModelPropertyInfoMap );
+ return pInfo;
+}
+//-----------------------------------------------------------------------
+SmModel::SmModel( SfxObjectShell *pObjSh )
+: SfxBaseModel(pObjSh)
+, PropertySetHelper ( lcl_createModelPropertyInfo () )
+{
+}
+//-----------------------------------------------------------------------
+SmModel::~SmModel() throw ()
+{
+}
+/*-- 28.03.00 14:18:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL SmModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface ( rType,
+ // OWeakObject interfaces
+ reinterpret_cast< XInterface* > ( this ),
+ static_cast< XWeak* > ( this ),
+ // PropertySetHelper interfaces
+ static_cast< XPropertySet* > ( this ),
+ static_cast< XMultiPropertySet* > ( this ),
+ //static_cast< XPropertyState* > ( this ),
+ // my own interfaces
+ static_cast< XUnoTunnel* > ( this ),
+ static_cast< XServiceInfo* > ( this ),
+ static_cast< XRenderable* > ( this ) );
+ if (!aRet.hasValue())
+ aRet = SfxBaseModel::queryInterface ( rType );
+ return aRet;
+}
+/*-- 28.03.00 14:18:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SmModel::acquire() throw()
+{
+ SolarMutexGuard aGuard;
+ OWeakObject::acquire();
+}
+/*-- 28.03.00 14:18:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SmModel::release() throw()
+{
+ SolarMutexGuard aGuard;
+ OWeakObject::release();
+}
+/*-- 28.03.00 14:18:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SAL_CALL SmModel::getTypes( ) throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes();
+ sal_Int32 nLen = aTypes.getLength();
+ aTypes.realloc(nLen + 5);
+ uno::Type* pTypes = aTypes.getArray();
+ pTypes[nLen++] = ::getCppuType((Reference<XServiceInfo>*)0);
+ pTypes[nLen++] = ::getCppuType((Reference<XUnoTunnel>*)0);
+ pTypes[nLen++] = ::getCppuType((Reference<XPropertySet>*)0);
+ pTypes[nLen++] = ::getCppuType((Reference<XMultiPropertySet>*)0);
+ pTypes[nLen++] = ::getCppuType((Reference<XRenderable>*)0);
+
+ // XPropertyState not supported?? (respective virtual functions from
+ // PropertySetHelper not overloaded)
+ //pTypes[nLen++] = ::getCppuType((Reference<XPropertyState>*)0);
+
+ return aTypes;
+}
+/* -----------------------------28.03.00 14:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId()
+{
+ static osl::Mutex aCreateMutex;
+ osl::Guard<osl::Mutex> aGuard( aCreateMutex );
+
+ static uno::Sequence< sal_Int8 > aSeq;
+ if(!aSeq.getLength())
+ {
+ aSeq.realloc( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ }
+ return aSeq;
+} /* -----------------------------28.03.00 14:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+/*-- 07.01.00 16:32:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+/*-- 07.01.00 16:33:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int16 lcl_AnyToINT16(const uno::Any& rAny)
+{
+ uno::TypeClass eType = rAny.getValueType().getTypeClass();
+
+ sal_Int16 nRet = 0;
+ if( eType == uno::TypeClass_DOUBLE )
+ nRet = (sal_Int16)*(double*)rAny.getValue();
+ else if( eType == uno::TypeClass_FLOAT )
+ nRet = (sal_Int16)*(float*)rAny.getValue();
+ else
+ rAny >>= nRet;
+ return nRet;
+}
+//-----------------------------------------------------------------------------
+
+OUString SmModel::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SmModel");
+}
+/*-- 07.02.00 13:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SmModel::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return (
+ rServiceName == C2U("com.sun.star.document.OfficeDocument" ) ||
+ rServiceName == C2U("com.sun.star.formula.FormulaProperties")
+ );
+
+}
+/*-- 07.02.00 13:24:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SmModel::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+
+ uno::Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.document.OfficeDocument");
+ pArray[1] = C2U("com.sun.star.formula.FormulaProperties");
+ return aRet;
+}
+
+void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* pValues)
+ throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException)
+{
+ SolarMutexGuard aGuard;
+
+ SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell());
+
+ if ( NULL == pDocSh )
+ throw UnknownPropertyException();
+
+ SmFormat & aFormat = pDocSh->GetFormat();
+
+ for (; *ppEntries; ppEntries++, pValues++ )
+ {
+ if ((*ppEntries)->mnAttributes & PropertyAttribute::READONLY)
+ throw PropertyVetoException();
+
+ switch ( (*ppEntries)->mnHandle )
+ {
+ case HANDLE_FORMULA:
+ {
+ OUString aText;
+ *pValues >>= aText;
+ pDocSh->SetText(aText);
+ }
+ break;
+ case HANDLE_FONT_NAME_VARIABLES :
+ case HANDLE_FONT_NAME_FUNCTIONS :
+ case HANDLE_FONT_NAME_NUMBERS :
+ case HANDLE_FONT_NAME_TEXT :
+ case HANDLE_CUSTOM_FONT_NAME_SERIF :
+ case HANDLE_CUSTOM_FONT_NAME_SANS :
+ case HANDLE_CUSTOM_FONT_NAME_FIXED :
+ {
+ OUString aText;
+ *pValues >>= aText;
+ String sFontName = aText;
+ if(!sFontName.Len())
+ throw IllegalArgumentException();
+
+ if(aFormat.GetFont((*ppEntries)->mnMemberId).GetName() != sFontName)
+ {
+ const SmFace rOld = aFormat.GetFont((*ppEntries)->mnMemberId);
+
+ SmFace aSet( sFontName, rOld.GetSize() );
+ aSet.SetBorderWidth( rOld.GetBorderWidth() );
+ aSet.SetAlign( ALIGN_BASELINE );
+ aFormat.SetFont( (*ppEntries)->mnMemberId, aSet );
+ }
+ }
+ break;
+ case HANDLE_CUSTOM_FONT_FIXED_POSTURE:
+ case HANDLE_CUSTOM_FONT_SANS_POSTURE :
+ case HANDLE_CUSTOM_FONT_SERIF_POSTURE:
+ case HANDLE_FONT_VARIABLES_POSTURE :
+ case HANDLE_FONT_FUNCTIONS_POSTURE :
+ case HANDLE_FONT_NUMBERS_POSTURE :
+ case HANDLE_FONT_TEXT_POSTURE :
+ {
+ if((*pValues).getValueType() != ::getBooleanCppuType())
+ throw IllegalArgumentException();
+ BOOL bVal = *(sal_Bool*)(*pValues).getValue();
+ Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId));
+ aNewFont.SetItalic((bVal) ? ITALIC_NORMAL : ITALIC_NONE);
+ aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont);
+ }
+ break;
+ case HANDLE_CUSTOM_FONT_FIXED_WEIGHT :
+ case HANDLE_CUSTOM_FONT_SANS_WEIGHT :
+ case HANDLE_CUSTOM_FONT_SERIF_WEIGHT :
+ case HANDLE_FONT_VARIABLES_WEIGHT :
+ case HANDLE_FONT_FUNCTIONS_WEIGHT :
+ case HANDLE_FONT_NUMBERS_WEIGHT :
+ case HANDLE_FONT_TEXT_WEIGHT :
+ {
+ if((*pValues).getValueType() != ::getBooleanCppuType())
+ throw IllegalArgumentException();
+ BOOL bVal = *(sal_Bool*)(*pValues).getValue();
+ Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId));
+ aNewFont.SetWeight((bVal) ? WEIGHT_BOLD : WEIGHT_NORMAL);
+ aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont);
+ }
+ break;
+ case HANDLE_BASE_FONT_HEIGHT :
+ {
+ // Point!
+ sal_Int16 nVal = lcl_AnyToINT16(*pValues);
+ if(nVal < 1)
+ throw IllegalArgumentException();
+ Size aSize = aFormat.GetBaseSize();
+ nVal *= 20;
+ nVal = static_cast < sal_Int16 > ( TWIP_TO_MM100(nVal) );
+ aSize.Height() = nVal;
+ aFormat.SetBaseSize(aSize);
+
+ // apply base size to fonts
+ const Size aTmp( aFormat.GetBaseSize() );
+ for (USHORT i = FNT_BEGIN; i <= FNT_END; i++)
+ aFormat.SetFontSize(i, aTmp);
+ }
+ break;
+ case HANDLE_RELATIVE_FONT_HEIGHT_TEXT :
+ case HANDLE_RELATIVE_FONT_HEIGHT_INDICES :
+ case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS :
+ case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS :
+ case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS :
+ {
+ sal_Int16 nVal;
+ *pValues >>= nVal;
+ if(nVal < 1)
+ throw IllegalArgumentException();
+ aFormat.SetRelSize((*ppEntries)->mnMemberId, nVal);
+ }
+ break;
+
+ case HANDLE_IS_TEXT_MODE :
+ {
+ aFormat.SetTextmode(*(sal_Bool*)(*pValues).getValue());
+ }
+ break;
+
+ case HANDLE_ALIGNMENT :
+ {
+ // SmHorAlign uses the same values as HorizontalAlignment
+ sal_Int16 nVal;
+ *pValues >>= nVal;
+ if(nVal < 0 || nVal > 2)
+ throw IllegalArgumentException();
+ aFormat.SetHorAlign((SmHorAlign)nVal);
+ }
+ break;
+
+ case HANDLE_RELATIVE_SPACING :
+ case HANDLE_RELATIVE_LINE_SPACING :
+ case HANDLE_RELATIVE_ROOT_SPACING :
+ case HANDLE_RELATIVE_INDEX_SUPERSCRIPT :
+ case HANDLE_RELATIVE_INDEX_SUBSCRIPT :
+ case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT :
+ case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH:
+ case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH:
+ case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT :
+ case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE :
+ case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE :
+ case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE :
+ case HANDLE_RELATIVE_BRACKET_DISTANCE :
+ case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE :
+ case HANDLE_RELATIVE_MATRIX_LINE_SPACING :
+ case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING :
+ case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT :
+ case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT :
+ case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE :
+ case HANDLE_RELATIVE_OPERATOR_SPACING :
+ case HANDLE_LEFT_MARGIN :
+ case HANDLE_RIGHT_MARGIN :
+ case HANDLE_TOP_MARGIN :
+ case HANDLE_BOTTOM_MARGIN :
+ {
+ sal_Int16 nVal;
+ *pValues >>= nVal;
+ if(nVal < 0)
+ throw IllegalArgumentException();
+ aFormat.SetDistance((*ppEntries)->mnMemberId, nVal);
+ }
+ break;
+ case HANDLE_IS_SCALE_ALL_BRACKETS :
+ aFormat.SetScaleNormalBrackets(*(sal_Bool*)(*pValues).getValue());
+ break;
+ case HANDLE_PRINTER_NAME:
+ {
+ SfxPrinter *pPrinter = pDocSh->GetPrinter ( );
+ if (pPrinter)
+ {
+ OUString sPrinterName;
+ if (*pValues >>= sPrinterName )
+ {
+ SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName );
+ if (pNewPrinter->IsKnown())
+ pDocSh->SetPrinter ( pNewPrinter );
+ else
+ delete pNewPrinter;
+ }
+ else
+ throw IllegalArgumentException();
+ }
+ }
+ break;
+ case HANDLE_PRINTER_SETUP:
+ {
+ Sequence < sal_Int8 > aSequence;
+ if ( *pValues >>= aSequence )
+ {
+ sal_uInt32 nSize = aSequence.getLength();
+ SvMemoryStream aStream ( aSequence.getArray(), nSize, STREAM_READ );
+ aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+ static sal_uInt16 __READONLY_DATA nRange[] =
+ {
+ 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
+ };
+ SfxItemSet *pItemSet = new SfxItemSet( pDocSh->GetPool(), nRange );
+ SmModule *pp = SM_MOD1();
+ pp->GetConfig()->ConfigToItemSet(*pItemSet);
+ SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet );
+
+ pDocSh->SetPrinter( pPrinter );
+ }
+ else
+ throw IllegalArgumentException();
+ }
+ break;
+ case HANDLE_SYMBOLS:
+ {
+ // this is set
+ Sequence < SymbolDescriptor > aSequence;
+ if ( *pValues >>= aSequence )
+ {
+ sal_uInt32 nSize = aSequence.getLength();
+ SmSymSetManager &rManager = pDocSh->GetSymSetManager();
+ SymbolDescriptor *pDescriptor = aSequence.getArray();
+ for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++)
+ {
+ Font aFont;
+ aFont.SetName ( pDescriptor->sFontName );
+ aFont.SetCharSet ( static_cast < rtl_TextEncoding > (pDescriptor->nCharSet) );
+ aFont.SetFamily ( static_cast < FontFamily > (pDescriptor->nFamily ) );
+ aFont.SetPitch ( static_cast < FontPitch > (pDescriptor->nPitch ) );
+ aFont.SetWeight ( static_cast < FontWeight > (pDescriptor->nWeight ) );
+ aFont.SetItalic ( static_cast < FontItalic > (pDescriptor->nItalic ) );
+ SmSym aSymbol ( pDescriptor->sName, aFont, static_cast < sal_Unicode > (pDescriptor->nCharacter),
+ pDescriptor->sSymbolSet );
+ aSymbol.SetExportName ( pDescriptor->sExportName );
+ aSymbol.SetDocSymbol( TRUE );
+ rManager.AddReplaceSymbol ( aSymbol );
+ }
+ }
+ else
+ throw IllegalArgumentException();
+ }
+ break;
+ }
+ }
+}
+
+void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValue )
+ throw( UnknownPropertyException, WrappedTargetException )
+{
+ SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell());
+
+ if ( NULL == pDocSh )
+ throw UnknownPropertyException();
+
+ SmFormat & aFormat = pDocSh->GetFormat();
+
+ for (; *ppEntries; ppEntries++, pValue++ )
+ {
+ switch ( (*ppEntries)->mnHandle )
+ {
+ case HANDLE_FORMULA:
+ *pValue <<= OUString(pDocSh->GetText());
+ break;
+ case HANDLE_FONT_NAME_VARIABLES :
+ case HANDLE_FONT_NAME_FUNCTIONS :
+ case HANDLE_FONT_NAME_NUMBERS :
+ case HANDLE_FONT_NAME_TEXT :
+ case HANDLE_CUSTOM_FONT_NAME_SERIF :
+ case HANDLE_CUSTOM_FONT_NAME_SANS :
+ case HANDLE_CUSTOM_FONT_NAME_FIXED :
+ {
+ const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId);
+ *pValue <<= OUString(rFace.GetName());
+ }
+ break;
+ case HANDLE_CUSTOM_FONT_FIXED_POSTURE:
+ case HANDLE_CUSTOM_FONT_SANS_POSTURE :
+ case HANDLE_CUSTOM_FONT_SERIF_POSTURE:
+ case HANDLE_FONT_VARIABLES_POSTURE :
+ case HANDLE_FONT_FUNCTIONS_POSTURE :
+ case HANDLE_FONT_NUMBERS_POSTURE :
+ case HANDLE_FONT_TEXT_POSTURE :
+ {
+ const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId);
+ BOOL bVal = (rFace.GetItalic() != ITALIC_NONE);
+ (*pValue).setValue(&bVal, *(*ppEntries)->mpType);
+ }
+ break;
+ case HANDLE_CUSTOM_FONT_FIXED_WEIGHT :
+ case HANDLE_CUSTOM_FONT_SANS_WEIGHT :
+ case HANDLE_CUSTOM_FONT_SERIF_WEIGHT :
+ case HANDLE_FONT_VARIABLES_WEIGHT :
+ case HANDLE_FONT_FUNCTIONS_WEIGHT :
+ case HANDLE_FONT_NUMBERS_WEIGHT :
+ case HANDLE_FONT_TEXT_WEIGHT :
+ {
+ const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId);
+ BOOL bVal = (rFace.GetWeight() == WEIGHT_BOLD);
+ (*pValue).setValue(&bVal, *(*ppEntries)->mpType);
+ }
+ break;
+ case HANDLE_BASE_FONT_HEIGHT :
+ {
+ // Point!
+ sal_Int16 nVal = static_cast < sal_Int16 > (aFormat.GetBaseSize().Height());
+ nVal = static_cast < sal_Int16 > (MM100_TO_TWIP(nVal));
+ nVal = (nVal + 10) / 20;
+ *pValue <<= nVal;
+ }
+ break;
+ case HANDLE_RELATIVE_FONT_HEIGHT_TEXT :
+ case HANDLE_RELATIVE_FONT_HEIGHT_INDICES :
+ case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS :
+ case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS :
+ case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS :
+ *pValue <<= (sal_Int16) aFormat.GetRelSize((*ppEntries)->mnMemberId);
+ break;
+
+ case HANDLE_IS_TEXT_MODE :
+ {
+ sal_Bool bVal = aFormat.IsTextmode();
+ (*pValue).setValue(&bVal, ::getBooleanCppuType());
+ }
+ break;
+
+ case HANDLE_ALIGNMENT :
+ // SmHorAlign uses the same values as HorizontalAlignment
+ *pValue <<= (sal_Int16)aFormat.GetHorAlign();
+ break;
+
+ case HANDLE_RELATIVE_SPACING :
+ case HANDLE_RELATIVE_LINE_SPACING :
+ case HANDLE_RELATIVE_ROOT_SPACING :
+ case HANDLE_RELATIVE_INDEX_SUPERSCRIPT :
+ case HANDLE_RELATIVE_INDEX_SUBSCRIPT :
+ case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT :
+ case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH:
+ case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH:
+ case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT :
+ case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE :
+ case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE :
+ case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE :
+ case HANDLE_RELATIVE_BRACKET_DISTANCE :
+ case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE :
+ case HANDLE_RELATIVE_MATRIX_LINE_SPACING :
+ case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING :
+ case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT :
+ case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT :
+ case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE :
+ case HANDLE_RELATIVE_OPERATOR_SPACING :
+ case HANDLE_LEFT_MARGIN :
+ case HANDLE_RIGHT_MARGIN :
+ case HANDLE_TOP_MARGIN :
+ case HANDLE_BOTTOM_MARGIN :
+ *pValue <<= (sal_Int16)aFormat.GetDistance((*ppEntries)->mnMemberId);
+ break;
+ case HANDLE_IS_SCALE_ALL_BRACKETS :
+ {
+ sal_Bool bVal = aFormat.IsScaleNormalBrackets();
+ (*pValue).setValue(&bVal, ::getBooleanCppuType());
+ }
+ break;
+ case HANDLE_PRINTER_NAME:
+ {
+ SfxPrinter *pPrinter = pDocSh->GetPrinter ( );
+ *pValue <<= pPrinter ? OUString ( pPrinter->GetName()) : OUString();
+ }
+ break;
+ case HANDLE_PRINTER_SETUP:
+ {
+ SfxPrinter *pPrinter = pDocSh->GetPrinter ();
+ if (pPrinter)
+ {
+ SvMemoryStream aStream;
+ pPrinter->Store( aStream );
+ aStream.Seek ( STREAM_SEEK_TO_END );
+ sal_uInt32 nSize = aStream.Tell();
+ aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+ Sequence < sal_Int8 > aSequence ( nSize );
+ aStream.Read ( aSequence.getArray(), nSize );
+ *pValue <<= aSequence;
+ }
+ }
+ break;
+ case HANDLE_SYMBOLS:
+ {
+ // this is get
+ const SmSymSetManager &rManager = pDocSh->GetSymSetManager();
+ vector < const SmSym * > aVector;
+
+ USHORT nCount = 0;
+ for (USHORT i = 0, nEnd = rManager.GetSymbolCount(); i < nEnd; i++)
+ {
+ const SmSym * pSymbol = rManager.GetSymbolByPos( i );
+ if (pSymbol && !pSymbol->IsPredefined () )
+ {
+ aVector.push_back ( pSymbol );
+ nCount++;
+ }
+ }
+ Sequence < SymbolDescriptor > aSequence ( nCount );
+ SymbolDescriptor * pDescriptor = aSequence.getArray();
+
+ vector <const SmSym * >::const_iterator aIter = aVector.begin(), aEnd = aVector.end();
+ for(; aIter != aEnd; pDescriptor++, aIter++)
+ {
+ pDescriptor->sName = (*aIter)->GetName();
+ pDescriptor->sExportName = (*aIter)->GetExportName();
+ pDescriptor->sSymbolSet = (*aIter)->GetSetName();
+ pDescriptor->nCharacter = static_cast < sal_Int32 > ((*aIter)->GetCharacter());
+
+ Font rFont = (*aIter)->GetFace();
+ pDescriptor->sFontName = rFont.GetName();
+ pDescriptor->nCharSet = rFont.GetCharSet();
+ pDescriptor->nFamily = rFont.GetFamily();
+ pDescriptor->nPitch = rFont.GetPitch();
+ pDescriptor->nWeight = rFont.GetWeight();
+ pDescriptor->nItalic = rFont.GetItalic();
+ }
+ *pValue <<= aSequence;
+ }
+ break;
+ case HANDLE_BASIC_LIBRARIES:
+ *pValue <<= pDocSh->GetBasicContainer();
+ break;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+sal_Int32 SAL_CALL SmModel::getRendererCount(
+ const uno::Any& rSelection,
+ const uno::Sequence< beans::PropertyValue >& xOptions )
+ throw (IllegalArgumentException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ return 1;
+}
+
+
+static Size lcl_GuessPaperSize()
+{
+ Size aRes;
+ Reference< XMultiServiceFactory > xMgr( ::legacy_binfilters::getLegacyProcessServiceFactory() );
+ LocaleDataWrapper aLocWrp( xMgr, AllSettings().GetLocale() );
+ if( MEASURE_METRIC == aLocWrp.getMeasurementSystemEnum() )
+ {
+ // in Twip
+ aRes.Width() = lA4Width;
+ aRes.Height() = lA4Height;
+ }
+ else
+ {
+ // in Twip
+ aRes.Width() = lLetterWidth;
+ aRes.Height() = lLetterHeight;
+ }
+ aRes = OutputDevice::LogicToLogic( aRes, MapMode(MAP_TWIP),
+ MapMode(MAP_100TH_MM) );
+ return aRes;
+}
+
+
+uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer(
+ sal_Int32 nRenderer,
+ const uno::Any& rSelection,
+ const uno::Sequence< beans::PropertyValue >& xOptions )
+ throw (IllegalArgumentException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if (0 != nRenderer)
+ throw IllegalArgumentException();
+
+ SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() );
+ if (!pDocSh)
+ throw RuntimeException();
+
+ SmPrinterAccess aPrinterAccess( *pDocSh );
+ Printer *pPrinter = aPrinterAccess.GetPrinter();
+ //Point aPrtPageOffset( pPrinter->GetPageOffset() );
+ Size aPrtPaperSize ( pPrinter->GetPaperSize() );
+
+ // if paper size is 0 (usually if no 'real' printer is found),
+ // guess the paper size
+ if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0)
+ aPrtPaperSize = lcl_GuessPaperSize();
+ awt::Size aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() );
+
+ uno::Sequence< beans::PropertyValue > aRenderer(1);
+ PropertyValue &rValue = aRenderer.getArray()[0];
+ rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) );
+ rValue.Value <<= aPageSize;
+
+ return aRenderer;
+}
+
+void SAL_CALL SmModel::render(
+ sal_Int32 nRenderer,
+ const uno::Any& rSelection,
+ const uno::Sequence< beans::PropertyValue >& rxOptions )
+ throw (IllegalArgumentException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ if (0 != nRenderer)
+ throw IllegalArgumentException();
+
+ SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() );
+ if (!pDocSh)
+ throw RuntimeException();
+
+ // get device to be rendered in
+ uno::Reference< awt::XDevice > xRenderDevice;
+ for (sal_Int32 i = 0, nCount = rxOptions.getLength(); i < nCount; ++i)
+ {
+ if( rxOptions[i].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) )
+ rxOptions[i].Value >>= xRenderDevice;
+ }
+
+ if (xRenderDevice.is())
+ {
+ VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
+ OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
+
+ if (!pOut)
+ throw RuntimeException();
+
+ pOut->SetMapMode( MAP_100TH_MM );
+
+ uno::Reference< frame::XModel > xModel;
+ rSelection >>= xModel;
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_utility.cxx b/binfilter/bf_starmath/source/starmath_utility.cxx
new file mode 100644
index 000000000000..c793a201bfbf
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_utility.cxx
@@ -0,0 +1,420 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <tools/tenccvt.hxx>
+#include <osl/thread.h>
+
+#include <vcl/virdev.hxx>
+#include <tools/stream.hxx>
+#include "starmath.hrc"
+#include "utility.hxx"
+
+namespace binfilter {
+
+
+////////////////////////////////////////
+
+/*N*/ SvStream& operator << (SvStream& rStream, const SmFace& rFont)
+/*N*/ {
+/*N*/ rStream.WriteByteString(ExportString(rFont.GetName()));
+/*N*/ rStream << (sal_uInt32)rFont.GetFamily();
+/*N*/ rStream << (sal_uInt32)GetSOStoreTextEncoding( rFont.GetCharSet() );
+/*N*/ rStream << (sal_uInt32)rFont.GetWeight();
+/*N*/ rStream << (sal_uInt32)rFont.GetItalic();
+/*N*/
+/*N*/ return rStream;
+/*N*/ }
+
+/*N*/ SvStream& operator >> (SvStream& rStream, SmFace& rFont)
+/*N*/ {
+/*N*/ sal_uInt32 nData;
+/*N*/ ByteString aByteStr;
+/*N*/
+/*N*/ rStream.ReadByteString( aByteStr );
+/*N*/ rFont.SetName( ImportString( aByteStr ) );
+/*N*/ rStream >> nData;
+/*N*/ rFont.SetFamily((FontFamily)nData);
+/*N*/ rStream >> nData;
+/*N*/ rFont.SetCharSet( GetSOLoadTextEncoding( (rtl_TextEncoding) nData ) );
+/*N*/ rStream >> nData;
+/*N*/ rFont.SetWeight((FontWeight)nData);
+/*N*/ rStream >> nData;
+/*N*/ rFont.SetItalic((FontItalic)nData);
+/*N*/
+/*N*/ return rStream;
+/*N*/ }
+
+/*?*/ void ReadSM20Font(SvStream& rStream, Font& rFont)
+/*?*/ {
+/*?*/ BOOL bData;
+/*?*/ sal_uInt32 nData;
+/*?*/ ByteString aByteStr;
+/*?*/
+/*?*/ rStream.ReadByteString( aByteStr );
+/*?*/ rFont.SetName( ImportString( aByteStr ) );
+/*?*/ rStream >> nData;
+/*?*/ rFont.SetFamily((FontFamily)nData);
+/*?*/ rStream >> nData;
+/*?*/ rFont.SetCharSet( GetSOLoadTextEncoding( (rtl_TextEncoding) nData ) );
+/*?*/ rStream >> nData;
+/*?*/ rFont.SetWeight((FontWeight)nData);
+/*?*/ rStream >> bData;
+/*?*/ if (bData)
+/*?*/ rFont.SetItalic(ITALIC_NORMAL);
+/*?*/ else
+/*?*/ rFont.SetItalic(ITALIC_NONE);
+/*?*/ }
+
+
+////////////////////////////////////////////////////////////
+//
+// SmRectCache
+//
+
+
+/*N*/ SmRectCache::Key::Key(const XubString &rText, const Font &rFont)
+/*N*/ {
+/*N*/ }
+
+/*N*/ SmRectCache::SmRectCache()
+/*N*/ {
+/*N*/ pVirDev = 0;
+/*N*/ }
+
+
+/*N*/ SmRectCache::~SmRectCache()
+/*N*/ {
+/*N*/ delete pVirDev;
+/*N*/ }
+
+
+/*N*/ const SmRect * SmRectCache::Search(const Key &rKey) const
+/*N*/ {
+/*N*/ return 0;
+/*N*/ }
+
+
+/*N*/ const SmRect * SmRectCache::Add(const Key &rKey, const SmRect &rRect)
+/*N*/ {
+/*N*/ return (const SmRect *)-1;
+/*N*/ }
+
+
+/*N*/ VirtualDevice * SmRectCache::GetVirDev()
+/*N*/ {
+/*N*/ if (!pVirDev)
+/*N*/ {
+ pVirDev = new VirtualDevice;
+/*N*/ pVirDev->SetMapMode( MapMode(MAP_100TH_MM) );
+/*N*/ }
+/*N*/ DBG_ASSERT(pVirDev->GetMapMode().GetMapUnit() == MAP_100TH_MM,
+/*N*/ "Sm : falscher MapMode");
+/*N*/
+/*N*/ return pVirDev;
+/*N*/ }
+
+
+/*N*/ void SmRectCache::Reset()
+/*N*/ {
+/*N*/ }
+
+
+////////////////////////////////////////////////////////////
+
+#define TE_UCS2 "UCS2"
+#define PRE_TE "<?"
+#define POST_TE ")>"
+
+
+ByteString ConvertUnknownCharacter(sal_Unicode ch)
+{
+ ByteString aString( RTL_CONSTASCII_STRINGPARAM( PRE_TE TE_UCS2 ) );
+ aString.Append( "(" );
+ aString += ByteString::CreateFromInt32(ch);
+ aString += POST_TE;
+ return aString;
+}
+
+
+/*N*/ const ByteString ExportString( const String& rString )
+/*N*/ {
+/*N*/ ByteString aString;
+/*N*/
+/*N*/ rtl_TextEncoding nEnc = RTL_TEXTENCODING_MS_1252;
+/*N*/ for (xub_StrLen i = 0; i < rString.Len(); i++)
+/*N*/ {
+/*N*/ sal_Unicode ch = rString.GetChar(i);
+/*N*/ if ((ch != '\r') && (ch != '\n') && (ch != '\t'))
+/*N*/ {
+/*N*/ sal_Char cChar = ByteString::ConvertFromUnicode( ch, nEnc, FALSE );
+/*N*/ if (cChar == 0)
+/*?*/ aString += ConvertUnknownCharacter(ch);
+/*N*/ else
+/*N*/ aString += cChar;
+/*N*/ }
+/*N*/ else
+/*N*/ aString += (sal_Char) ch;
+/*N*/ }
+/*N*/
+/*N*/ aString.ConvertLineEnd(LINEEND_CRLF);
+/*N*/ return aString;
+/*N*/ }
+
+#define TEXTENCODINGTAB_LEN 12
+
+static const struct
+{
+ const char *pText;
+ rtl_TextEncoding nEnc;
+} aTextEncodingTab[ TEXTENCODINGTAB_LEN ] =
+{
+ { TE_UCS2, RTL_TEXTENCODING_UCS2 }, // is RTL_TEXTENCODING_UNICODE in 6.0
+ { "DONTKNOW", RTL_TEXTENCODING_DONTKNOW },
+ { "ANSI", RTL_TEXTENCODING_MS_1252 },
+ { "MAC", RTL_TEXTENCODING_APPLE_ROMAN },
+ { "PC437", RTL_TEXTENCODING_IBM_437 },
+ { "PC850", RTL_TEXTENCODING_ASCII_US },
+ { "PC860", RTL_TEXTENCODING_IBM_860 },
+ { "PC861", RTL_TEXTENCODING_IBM_861 },
+ { "PC863", RTL_TEXTENCODING_IBM_863 },
+ { "PC865", RTL_TEXTENCODING_IBM_865 },
+ { "SYSTEM", RTL_TEXTENCODING_DONTKNOW },
+ { "SYMBOL", RTL_TEXTENCODING_SYMBOL }
+};
+
+int GetTextEncodingTabIndex( const String &rTxt, xub_StrLen nPos )
+{
+ int nRes = -1;
+ for (int i = 0; i < TEXTENCODINGTAB_LEN && nRes == -1; ++i)
+ {
+ if (nPos == rTxt.SearchAscii( aTextEncodingTab[i].pText , nPos ))
+ nRes = i;
+ }
+ return nRes;
+}
+
+/*N*/ const String ImportString( const ByteString& rByteString )
+/*N*/ {
+/*N*/ String aString( rByteString, RTL_TEXTENCODING_MS_1252 );
+/*N*/
+/*N*/ const xub_StrLen nPreLen = sizeof( PRE_TE ) - 1;
+/*N*/ const xub_StrLen nPostLen = sizeof( POST_TE ) - 1;
+/*N*/
+/*N*/ xub_StrLen nPreStart = 0;
+/*N*/ while( STRING_NOTFOUND != ( nPreStart =
+/*N*/ aString.SearchAscii( PRE_TE, nPreStart )) )
+/*N*/ {
+ if (aString.EqualsAscii( "<?>", nPreStart, 3 ))
+ {
+ nPreStart += 3; // restart look-up after current found position
+ continue;
+ }
+
+/*?*/ //
+/*N*/ // convert 'unknown character' to unicode character
+/*N*/ //
+/*?*/ xub_StrLen nTeStart = nPreStart + nPreLen;
+/*?*/ xub_StrLen nTeLen = 0;
+/*?*/ int nIdx = GetTextEncodingTabIndex( aString, nTeStart );
+/*?*/ DBG_ASSERT( nIdx >= 0, "text-encoding is missing" );
+/*?*/ rtl_TextEncoding nEnc = RTL_TEXTENCODING_DONTKNOW;
+/*?*/ if (nIdx >= 0)
+/*?*/ {
+/*?*/ nEnc = aTextEncodingTab[ nIdx ].nEnc;
+/*?*/ nTeLen = strlen( aTextEncodingTab[ nIdx ].pText );
+/*?*/ }
+/*?*/ if (RTL_TEXTENCODING_DONTKNOW == nEnc)
+/*?*/ nEnc = osl_getThreadTextEncoding();
+/*?*/ //
+/*?*/ xub_StrLen nNumStart = nTeStart + nTeLen + 1, // +1 because of "("
+/*?*/ nReplLen;
+/*?*/ xub_StrLen nPostStart = aString.SearchAscii( POST_TE, nNumStart );
+/*?*/ String sRepl;
+/*?*/ if( STRING_NOTFOUND != nPostStart )
+/*?*/ {
+/*?*/ INT32 nCharVal = aString.Copy( nNumStart, nPostStart - nNumStart ).ToInt32();
+/*?*/ DBG_ASSERT( nCharVal != 0, "String -> Int32 failed ?" );
+/*?*/ if (RTL_TEXTENCODING_UNICODE == nEnc)
+/*?*/ {
+/*?*/ if (nCharVal)
+/*?*/ sRepl = (sal_Unicode) nCharVal;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ DBG_ASSERT( 0 <= nCharVal && nCharVal <= 256,
+/*?*/ "character value out of range" );
+/*?*/ sRepl = ByteString::ConvertToUnicode( nCharVal, nEnc );
+/*?*/ }
+/*?*/ DBG_ASSERT( sRepl.Len() || !nCharVal, "conversion failed" );
+/*?*/ nReplLen = nPostStart + nPostLen - nPreStart;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ DBG_ERROR( "import error: 'unknown character' delimiter missing" );
+/*?*/ sRepl.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "<?>" ) );
+/*?*/ nReplLen = nPreLen;
+/*?*/ }
+/*?*/
+/*?*/ aString.Replace( nPreStart, nReplLen, sRepl );
+/*?*/ nPreStart += sRepl.Len();
+/*N*/ }
+/*N*/
+/*N*/ // in old 2.0 or 3.0 formulas the strings to be imported do have an
+/*N*/ // additional '\0' character at the end that gets removed here.
+/*N*/ if (aString.Len())
+/*N*/ aString.EraseTrailingChars( '\0' );
+/*N*/
+/*N*/ aString.ConvertLineEnd();
+/*N*/ return aString;
+/*N*/ }
+
+////////////////////////////////////////////////////////////
+
+
+/**************************************************************************/
+
+/*N*/ SmPickList::SmPickList(USHORT nInitSize, USHORT nMaxSize) :
+/*N*/ SfxPtrArr((BYTE) nInitSize, 1)
+/*N*/ {
+/*N*/ nSize = nMaxSize;
+/*N*/ }
+
+
+/*N*/ SmPickList::~SmPickList()
+/*N*/ {
+/*N*/ Clear();
+/*N*/ }
+
+
+/*N*/ void SmPickList::Clear()
+/*N*/ {
+/*N*/ USHORT nPos;
+/*N*/
+/*N*/ for (nPos = 0; nPos < Count(); nPos++)
+/*?*/ DestroyItem(GetPtr(nPos));
+/*N*/
+/*N*/ RemovePtr(0, Count());
+/*N*/ }
+
+/**************************************************************************/
+/**************************************************************************/
+
+/*?*/ void * SmFontPickList::CreateItem(const String& rString)
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 return new Font();
+/*?*/ }
+
+/*?*/ void * SmFontPickList::CreateItem(const void *pItem)
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 return new Font(*((Font *) pItem));
+/*?*/ }
+
+/*?*/ void SmFontPickList::DestroyItem(void *pItem)
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 delete (Font *)pItem;
+/*?*/ }
+
+/*?*/ BOOL SmFontPickList::CompareItem(const void *pFirstItem, const void *pSecondItem) const
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 Font *pFirstFont, *pSecondFont;
+/*?*/ }
+
+/*?*/ String SmFontPickList::GetStringItem(void *pItem)
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); String aString; return aString;//STRIP001 Font *pFont;
+/*?*/ }
+
+/*?*/ void SmFontPickList::LoadItem(SvStream& rStream, void *pItem)
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 rStream >> *((Font *)pItem);
+/*?*/ }
+
+/*?*/ void SmFontPickList::SaveItem(SvStream& rStream, const void *pItem) const
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 rStream << *(const Font *) pItem;
+/*?*/ }
+
+////////////////////////////////////////
+
+/*N*/ void SmFace::Impl_Init()
+/*N*/ {
+/*N*/ SetSize( GetSize() );
+/*N*/ SetTransparent( TRUE );
+/*N*/ SetAlign( ALIGN_BASELINE );
+/*N*/ SetColor( COL_AUTO );
+/*N*/ }
+
+/*N*/ void SmFace::SetSize(const Size& rSize)
+/*N*/ {
+/*N*/ Size aSize (rSize);
+/*N*/
+/*N*/ // check the requested size against minimum value
+/*N*/ static int __READONLY_DATA nMinVal = SmPtsTo100th_mm(2);
+/*N*/
+/*N*/ if (aSize.Height() < nMinVal)
+/*N*/ aSize.Height() = nMinVal;
+/*N*/
+/*N*/ //! we don't force a maximum value here because this may prevent eg the
+/*N*/ //! parentheses in "left ( ... right )" from matching up with large
+/*N*/ //! bodies (eg stack{...} with many entries).
+/*N*/ //! Of course this is holds only if characters are used and not polygons.
+/*N*/
+/*N*/ Font::SetSize(aSize);
+/*N*/ }
+
+
+/*N*/ long SmFace::GetBorderWidth() const
+/*N*/ {
+/*N*/ if (nBorderWidth < 0)
+/*N*/ return GetDefaultBorderWidth();
+/*N*/ else
+/*N*/ return nBorderWidth;
+/*N*/ }
+
+/*N*/ SmFace & SmFace::operator = (const SmFace &rFace)
+/*N*/ {
+/*N*/ Font::operator = (rFace);
+/*N*/ nBorderWidth = -1;
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ SmFace & operator *= (SmFace &rFace, const Fraction &rFrac)
+/*N*/ // scales the width and height of 'rFace' by 'rFrac' and returns a
+/*N*/ // reference to 'rFace'.
+/*N*/ // It's main use is to make scaling fonts look easier.
+/*N*/ { const Size &rFaceSize = rFace.GetSize();
+/*N*/
+/*N*/ rFace.SetSize(Size(Fraction(rFaceSize.Width()) *= rFrac,
+/*N*/ Fraction(rFaceSize.Height()) *= rFrac));
+/*N*/ return rFace;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_starmath/source/starmath_xchar.cxx b/binfilter/bf_starmath/source/starmath_xchar.cxx
new file mode 100644
index 000000000000..331130f83c8b
--- /dev/null
+++ b/binfilter/bf_starmath/source/starmath_xchar.cxx
@@ -0,0 +1,265 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <tools/stream.hxx>
+#include <bf_svx/xoutx.hxx>
+
+#include "xchar.hxx"
+#include "types.hxx"
+
+#include "smdll.hxx"
+#include "starmath.hrc"
+namespace binfilter {
+
+
+
+
+
+
+
+
+
+////////////////////////////////////////
+
+
+
+
+
+
+
+////////////////////////////////////////
+
+
+/*?*/ class SmPolygonLoader : public Resource
+/*?*/ {
+/*?*/ public:
+/*?*/ SmPolygonLoader(const SmResId &rId, SmPolygon &rSmPolygon);
+/*?*/ };
+
+
+/*N*/ SmPolygonLoader::SmPolygonLoader(const SmResId& rId, SmPolygon &rSmPolygon)
+/*N*/ : Resource (rId)
+/*N*/ {
+/*N*/ USHORT nBytesLeft; // upper size limit to a single resource is 64 kB!
+/*N*/
+/*N*/ // set cursor to begin of resource
+/*N*/ //GetClassRes(); // it's done automatically!
+/*N*/
+/*N*/ // get number of bytes from actual position to end of resource
+/*N*/ nBytesLeft = GetRemainSizeRes();
+/*N*/
+/*N*/ char *pStr = (char *) GetClassRes();
+/*N*/ SvMemoryStream aStrm(pStr, nBytesLeft, STREAM_READ);
+/*N*/
+/*N*/ aStrm >> rSmPolygon.cChar
+/*N*/ >> rSmPolygon.aFontSize
+/*N*/ >> rSmPolygon.aOrigPos
+/*N*/ >> rSmPolygon.aOrigSize
+/*N*/ >> rSmPolygon.aPoly;
+/*N*/
+/*N*/ //! Warning: don't know why, but it has to be done!
+/*N*/ IncrementRes(nBytesLeft);
+/*N*/ }
+
+
+////////////////////////////////////////
+// SmPolygon
+//
+
+/*N*/ SmPolygon::SmPolygon()
+/*N*/ {
+/*N*/ cChar = sal_Char('\x00'),
+/*N*/ fScaleX = fScaleY =
+/*N*/ fDelayedFactorX = fDelayedFactorY = 1.0;
+/*N*/ bDelayedScale = bDelayedBoundRect = FALSE;
+/*N*/ }
+
+
+/*N*/ SmPolygon::SmPolygon(sal_Unicode cCharP)
+/*N*/ {
+/*N*/ cChar = cCharP;
+/*N*/ fScaleX = fScaleY =
+/*N*/ fDelayedFactorX = fDelayedFactorY = 1.0;
+/*N*/ bDelayedScale = bDelayedBoundRect = FALSE;
+/*N*/
+/*N*/ if (cChar == sal_Char('\0'))
+/*N*/ return;
+/*N*/
+/*N*/ // get appropriate resource id
+/*N*/ int nResId = 0;
+/*N*/ switch (cChar)
+/*N*/ {
+/*N*/ case MS_LINE : nResId = RID_XPP_LINE; break;
+/*N*/ case MS_DLINE : nResId = RID_XPP_DLINE; break;
+/*N*/ case MS_SQRT : nResId = RID_XPP_SQRT; break;
+/*N*/ case MS_SQRT2 : nResId = RID_XPP_SQRT2; break;
+/*N*/ case MS_HAT : nResId = RID_XPP_HAT; break;
+/*N*/ case MS_TILDE : nResId = RID_XPP_TILDE; break;
+/*N*/ case MS_BAR : nResId = RID_XPP_BAR; break;
+/*N*/ case MS_VEC : nResId = RID_XPP_VEC; break;
+/*N*/ case MS_LBRACE : nResId = RID_XPP_LBRACE; break;
+/*N*/ case MS_RBRACE : nResId = RID_XPP_RBRACE; break;
+/*N*/ case MS_LPARENT : nResId = RID_XPP_LPARENT; break;
+/*N*/ case MS_RPARENT : nResId = RID_XPP_RPARENT; break;
+/*N*/ case MS_LANGLE : nResId = RID_XPP_LANGLE; break;
+/*N*/ case MS_RANGLE : nResId = RID_XPP_RANGLE; break;
+/*N*/ case MS_LBRACKET : nResId = RID_XPP_LBRACKET; break;
+/*N*/ case MS_RBRACKET : nResId = RID_XPP_RBRACKET; break;
+/*N*/ case MS_LDBRACKET : nResId = RID_XPP_LDBRACKET; break;
+/*N*/ case MS_RDBRACKET : nResId = RID_XPP_RDBRACKET; break;
+/*N*/ case MS_LCEIL : nResId = RID_XPP_LCEIL; break;
+/*N*/ case MS_RCEIL : nResId = RID_XPP_RCEIL; break;
+/*N*/ case MS_LFLOOR : nResId = RID_XPP_LFLOOR; break;
+/*N*/ case MS_RFLOOR : nResId = RID_XPP_RFLOOR; break;
+/*N*/ case MS_OVERBRACE : nResId = RID_XPP_OVERBRACE; break;
+/*N*/ case MS_UNDERBRACE : nResId = RID_XPP_UNDERBRACE; break;
+/*N*/
+/*N*/ default :
+/*N*/ DBG_ASSERT(0, "Sm: char hat kein Polygon");
+/*N*/ }
+/*N*/
+/*N*/ if (nResId)
+/*N*/ {
+/*N*/ // SmPolygon (XPolyPolygon, ...) aus der Resource laden
+/*N*/ SmResId aSmResId(nResId);
+/*N*/ SmPolygonLoader(aSmResId, *this);
+/*N*/
+/*N*/ // die verbleibenden member Variablen setzen
+/*N*/ aBoundRect = aPoly.GetBoundRect();
+/*N*/ aPos = GetOrigPos();
+/*N*/
+/*N*/ // jetzt nach (0, 0) verschieben verbessert die Chancen, dass in Scale()
+/*N*/ // (welches ia oefter aufgerufen wird) nicht das MoveTo ausgefuehrt
+/*N*/ // werden muss
+/*N*/ MoveTo(Point());
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmPolygon::Scale()
+/*N*/ {
+/*N*/ DBG_ASSERT(bDelayedScale, "Sm: es gibt nichts zu skalieren");
+/*N*/
+/*N*/ Point aOrigin,
+/*N*/ aDelta;
+/*N*/
+/*N*/ if (aPos != aOrigin)
+/*N*/ {
+/*?*/ aDelta = aOrigin - aPos;
+/*?*/ aPoly.Move(aDelta.X(), aDelta.Y());
+/*N*/ }
+/*N*/
+/*N*/ aPoly.Scale(fDelayedFactorX, fDelayedFactorY);
+/*N*/ fScaleX *= fDelayedFactorX;
+/*N*/ fScaleY *= fDelayedFactorY;
+/*N*/
+/*N*/ bDelayedScale = FALSE;
+/*N*/ fDelayedFactorX = fDelayedFactorY = 1.0;
+/*N*/
+/*N*/ // Anm.: aBoundRect stimmt hier immer noch nicht!
+/*N*/ // Das passiert erst wenn es benoetigt wird.
+/*N*/
+/*N*/ // ggf Ausgangsposition wiederherstellen
+/*N*/ if (aPos != aOrigin)
+/*?*/ aPoly.Move(-aDelta.X(), -aDelta.Y());
+/*?*/
+/*N*/ }
+
+
+/*N*/ void SmPolygon::ScaleBy(double fFactorX, double fFactorY)
+/*N*/ {
+/*N*/ if (fFactorX != 1.0 || fFactorY != 1.0)
+/*N*/ {
+/*N*/ fDelayedFactorX *= fFactorX;
+/*N*/ fDelayedFactorY *= fFactorY;
+/*N*/
+/*N*/ bDelayedScale = TRUE;
+/*N*/ bDelayedBoundRect = TRUE;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmPolygon::AdaptToX(const OutputDevice &rDev, ULONG nWidth)
+/*N*/ {
+/*N*/ DBG_ASSERT(aOrigSize.Width() != 0, "Sm: Polygon hat keine Breite");
+/*N*/ if (aOrigSize.Width() != 0)
+/*N*/ {
+/*N*/ double fFactor = 1.0 / GetScaleX() * nWidth / aOrigSize.Width();
+/*N*/ ScaleBy(fFactor, 1.0);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmPolygon::AdaptToY(const OutputDevice &rDev, ULONG nHeight)
+/*N*/ {
+/*N*/ DBG_ASSERT(aOrigSize.Height() != 0, "Sm: Polygon hat keine Hoehe");
+/*N*/ if (aOrigSize.Height() != 0)
+/*N*/ {
+/*N*/ double fFactor = 1.0 / GetScaleY() * nHeight / aOrigSize.Height();
+/*N*/ ScaleBy(1.0, fFactor);
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SmPolygon::Move(const Point &rPoint)
+/*N*/ {
+/*N*/ long nX = rPoint.X(),
+/*N*/ nY = rPoint.Y();
+/*N*/
+/*N*/ aPoly .Move(nX, nY);
+/*N*/ aBoundRect.Move(nX, nY);
+/*N*/ aPos .Move(nX, nY);
+/*N*/ }
+
+
+
+
+/*N*/ const Rectangle & SmPolygon::GetBoundRect(const OutputDevice &rDev) const
+/*N*/ {
+/*N*/ SmPolygon *pNCthis = ((SmPolygon *) this);
+/*N*/
+/*N*/ if (bDelayedScale)
+/*N*/ pNCthis->Scale();
+/*N*/ if (bDelayedBoundRect)
+/*N*/ {
+/*N*/ pNCthis->aBoundRect = aPoly.GetBoundRect((OutputDevice *) &rDev);
+/*N*/ pNCthis->bDelayedBoundRect = FALSE;
+/*N*/ }
+/*N*/ return aBoundRect;
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */