Files
libreoffice/starmath/inc/node.hxx

1266 lines
36 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 16:07:07 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 16:07:07 +00:00
*
* 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.
2000-09-18 16:07:07 +00:00
*
* 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).
2000-09-18 16:07:07 +00:00
*
* 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.
2000-09-18 16:07:07 +00:00
*
************************************************************************/
#ifndef NODE_HXX
#define NODE_HXX
CWS-TOOLING: integrate CWS tl66 2009-05-15 12:28:55 +0200 tl r271932 : #i91812# include fixed 2009-05-07 16:52:41 +0200 tl r271680 : #i97200# one more MathML export problem to fix 2009-05-05 08:33:29 +0200 tl r271494 : #i99401# positiv user-dicts vs negativ user-dicts 2009-05-04 14:14:03 +0200 tl r271452 : #i97200# warning free code; MathML 2.0 export 2009-05-04 13:26:30 +0200 tl r271448 : #i97200# write valid MathML 2.0 on export 2009-04-29 14:21:54 +0200 tl r271371 : #i97200# new MathML token 2009-04-29 11:12:07 +0200 tl r271360 : #i97200# inroducing separate files for import and export 2009-04-28 16:47:42 +0200 tl r271331 : #i97200# better MathML pretty printing 2009-04-28 11:21:57 +0200 tl r271315 : #i97200# MathML attributes and default namespace for MathML 2009-04-28 11:21:24 +0200 tl r271314 : #i97200# MathML attributes and default namespace for MathML 2009-04-23 12:44:18 +0200 tl r271154 : #i97200# math.dtd removed 2009-04-23 12:31:56 +0200 tl r271151 : #i97200# MathML: don't use namespace on attributes 2009-04-22 13:21:11 +0200 tl r271099 : warning-free code 2009-04-22 12:20:13 +0200 tl r271092 : #i100757# loop fixed 2009-04-22 11:29:51 +0200 tl r271086 : #97327# adding mongolian fingerprint for language guessing 2009-04-22 11:25:56 +0200 tl r271083 : #97327# adding mongolian fingerprint for language guessing 2009-04-21 10:39:21 +0200 tl r271025 : #99599# code fix for LRE/RLE embedding 2009-04-20 16:36:33 +0200 tl r270992 : #i99604# HasDigits fixed 2009-04-20 14:44:19 +0200 tl r270985 : #i99604# warning-free code for Windows 2009-04-20 13:48:13 +0200 tl r270980 : #i99604# HasDigits fix for non-ASCII characters 2009-04-20 13:47:50 +0200 tl r270979 : #i99604# HasDigits fix for non-ASCII characters 2009-04-20 12:28:15 +0200 tl r270973 : warning-free code after merging 2009-04-20 10:16:19 +0200 tl r270964 : warning-free code after merging 2009-04-17 14:43:36 +0200 tl r270948 : #i96846# 2009-04-16 13:09:15 +0200 tl r270883 : CWS-TOOLING: rebase CWS tl66 to trunk@270723 (milestone: DEV300:m46) 2009-04-14 14:34:08 +0200 tl r270770 : #101067# warning-free code 2009-04-02 09:07:44 +0200 tl r270368 : #i100757# performance patch for start-up (initialize language guessing on demand only) 2009-03-11 10:37:59 +0100 tl r269301 : #i100083# fixed system dictionary lookup 2009-03-06 13:10:23 +0100 tl r268998 : warning-free code for Windows non-pro 2009-02-23 14:01:23 +0100 tl r268355 : #i99401# winning rules for user-dictionaries changed 2009-02-19 14:05:57 +0100 tl r268281 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 14:05:02 +0100 tl r268280 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 13:58:51 +0100 tl r268279 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 11:38:03 +0100 tl r268266 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-12 11:58:34 +0100 tl r267642 : #i96846# some properties declared as maybevoid 2009-02-06 12:43:55 +0100 tl r267454 : #i98644# provide sugestions from secondary spell checkers if the primary does not provide ones 2009-02-05 13:02:26 +0100 tl r267418 : #i98880# a bit clean-up in the grammar checking framework 2009-02-04 12:15:37 +0100 tl r267363 : #i91812# remove unused/duplicate code 2009-02-04 12:09:34 +0100 tl r267362 : #i91812# remove unused/duplicate code 2009-02-04 11:07:57 +0100 tl r267355 : #i91812# remove unused code 2009-02-04 11:06:48 +0100 tl r267354 : #i91812# remove unused code 2009-02-03 14:52:43 +0100 tl r267331 : #i91812# remove unused code 2009-02-03 14:26:00 +0100 tl r267324 : #i91198# adding fingerprint for luxembourgish 2009-02-03 14:20:58 +0100 tl r267323 : #i91198# adding fingerprint for luxembourgish 2009-02-03 14:18:33 +0100 tl r267322 : #i91198# adding fingerprint for luxembourgish 2009-02-03 13:56:39 +0100 tl r267319 : #i91812# remove unused code 2009-02-03 12:41:50 +0100 tl r267314 : #i48400# auto-spellcheck improvement when deleting wrong chars 2009-02-03 11:48:51 +0100 tl r267310 : #i91812# remove unused code 2009-02-03 11:14:29 +0100 tl r267307 : warning free code 2009-02-03 10:45:21 +0100 tl r267306 : #i91812# remove unused code 2009-02-03 10:37:04 +0100 tl r267304 : #i33387# name change for 'View/Selection' 2009-02-03 10:36:17 +0100 tl r267303 : #i33387# name change for 'View/Selection' 2009-02-03 10:32:12 +0100 tl r267302 : #i30642# spelling error in context menu fixed 2009-02-03 10:27:34 +0100 tl r267301 : #i92210# remove unused code types.cxx cfgitem.*
2009-05-19 09:31:27 +00:00
#include <vector>
#include <fstream>
#include <iostream>
#include <stdio.h>
#define j_assert(cond, msg) DBG_ASSERT(cond, msg)
#if 0
// easier to read assert macro
do{ \
if(!(cond)) \
{ \
std::cerr<<"Failed assertion: "<<msg<<", at line "; \
char* f = (char*)__FILE__; \
f += strlen(f); \
do f--; while(*f != '/'); \
do f--; while(*f != '/'); \
do f--; while(*f != '/'); \
fprintf(stderr, "%d in %s\n", __LINE__, f + 1); \
} \
} while(false)
#endif
// Comment out below to disable dumpasdot
//#define DEBUG_ENABLE_DUMPASDOT
2000-09-18 16:07:07 +00:00
#include "parse.hxx"
#include "types.hxx"
#include "rect.hxx"
#include "format.hxx"
#define ATTR_BOLD 0x0001
#define ATTR_ITALIC 0x0002
2000-09-18 16:07:07 +00:00
#define FNTSIZ_ABSOLUT 1
#define FNTSIZ_PLUS 2
#define FNTSIZ_MINUS 3
#define FNTSIZ_MULTIPLY 4
#define FNTSIZ_DIVIDE 5
// flags to interdict respective status changes
#define FLG_FONT 0x0001
#define FLG_SIZE 0x0002
#define FLG_BOLD 0x0004
#define FLG_ITALIC 0x0008
#define FLG_COLOR 0x0010
#define FLG_VISIBLE 0x0020
#define FLG_HORALIGN 0x0040
extern SmFormat *pActiveFormat;
class SmVisitor;
class SmDocShell;
2000-09-18 16:07:07 +00:00
class SmNode;
CWS-TOOLING: integrate CWS tl66 2009-05-15 12:28:55 +0200 tl r271932 : #i91812# include fixed 2009-05-07 16:52:41 +0200 tl r271680 : #i97200# one more MathML export problem to fix 2009-05-05 08:33:29 +0200 tl r271494 : #i99401# positiv user-dicts vs negativ user-dicts 2009-05-04 14:14:03 +0200 tl r271452 : #i97200# warning free code; MathML 2.0 export 2009-05-04 13:26:30 +0200 tl r271448 : #i97200# write valid MathML 2.0 on export 2009-04-29 14:21:54 +0200 tl r271371 : #i97200# new MathML token 2009-04-29 11:12:07 +0200 tl r271360 : #i97200# inroducing separate files for import and export 2009-04-28 16:47:42 +0200 tl r271331 : #i97200# better MathML pretty printing 2009-04-28 11:21:57 +0200 tl r271315 : #i97200# MathML attributes and default namespace for MathML 2009-04-28 11:21:24 +0200 tl r271314 : #i97200# MathML attributes and default namespace for MathML 2009-04-23 12:44:18 +0200 tl r271154 : #i97200# math.dtd removed 2009-04-23 12:31:56 +0200 tl r271151 : #i97200# MathML: don't use namespace on attributes 2009-04-22 13:21:11 +0200 tl r271099 : warning-free code 2009-04-22 12:20:13 +0200 tl r271092 : #i100757# loop fixed 2009-04-22 11:29:51 +0200 tl r271086 : #97327# adding mongolian fingerprint for language guessing 2009-04-22 11:25:56 +0200 tl r271083 : #97327# adding mongolian fingerprint for language guessing 2009-04-21 10:39:21 +0200 tl r271025 : #99599# code fix for LRE/RLE embedding 2009-04-20 16:36:33 +0200 tl r270992 : #i99604# HasDigits fixed 2009-04-20 14:44:19 +0200 tl r270985 : #i99604# warning-free code for Windows 2009-04-20 13:48:13 +0200 tl r270980 : #i99604# HasDigits fix for non-ASCII characters 2009-04-20 13:47:50 +0200 tl r270979 : #i99604# HasDigits fix for non-ASCII characters 2009-04-20 12:28:15 +0200 tl r270973 : warning-free code after merging 2009-04-20 10:16:19 +0200 tl r270964 : warning-free code after merging 2009-04-17 14:43:36 +0200 tl r270948 : #i96846# 2009-04-16 13:09:15 +0200 tl r270883 : CWS-TOOLING: rebase CWS tl66 to trunk@270723 (milestone: DEV300:m46) 2009-04-14 14:34:08 +0200 tl r270770 : #101067# warning-free code 2009-04-02 09:07:44 +0200 tl r270368 : #i100757# performance patch for start-up (initialize language guessing on demand only) 2009-03-11 10:37:59 +0100 tl r269301 : #i100083# fixed system dictionary lookup 2009-03-06 13:10:23 +0100 tl r268998 : warning-free code for Windows non-pro 2009-02-23 14:01:23 +0100 tl r268355 : #i99401# winning rules for user-dictionaries changed 2009-02-19 14:05:57 +0100 tl r268281 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 14:05:02 +0100 tl r268280 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 13:58:51 +0100 tl r268279 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 11:38:03 +0100 tl r268266 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-12 11:58:34 +0100 tl r267642 : #i96846# some properties declared as maybevoid 2009-02-06 12:43:55 +0100 tl r267454 : #i98644# provide sugestions from secondary spell checkers if the primary does not provide ones 2009-02-05 13:02:26 +0100 tl r267418 : #i98880# a bit clean-up in the grammar checking framework 2009-02-04 12:15:37 +0100 tl r267363 : #i91812# remove unused/duplicate code 2009-02-04 12:09:34 +0100 tl r267362 : #i91812# remove unused/duplicate code 2009-02-04 11:07:57 +0100 tl r267355 : #i91812# remove unused code 2009-02-04 11:06:48 +0100 tl r267354 : #i91812# remove unused code 2009-02-03 14:52:43 +0100 tl r267331 : #i91812# remove unused code 2009-02-03 14:26:00 +0100 tl r267324 : #i91198# adding fingerprint for luxembourgish 2009-02-03 14:20:58 +0100 tl r267323 : #i91198# adding fingerprint for luxembourgish 2009-02-03 14:18:33 +0100 tl r267322 : #i91198# adding fingerprint for luxembourgish 2009-02-03 13:56:39 +0100 tl r267319 : #i91812# remove unused code 2009-02-03 12:41:50 +0100 tl r267314 : #i48400# auto-spellcheck improvement when deleting wrong chars 2009-02-03 11:48:51 +0100 tl r267310 : #i91812# remove unused code 2009-02-03 11:14:29 +0100 tl r267307 : warning free code 2009-02-03 10:45:21 +0100 tl r267306 : #i91812# remove unused code 2009-02-03 10:37:04 +0100 tl r267304 : #i33387# name change for 'View/Selection' 2009-02-03 10:36:17 +0100 tl r267303 : #i33387# name change for 'View/Selection' 2009-02-03 10:32:12 +0100 tl r267302 : #i30642# spelling error in context menu fixed 2009-02-03 10:27:34 +0100 tl r267301 : #i92210# remove unused code types.cxx cfgitem.*
2009-05-19 09:31:27 +00:00
class SmStructureNode;
typedef std::vector< SmNode * > SmNodeArray;
typedef std::vector< SmStructureNode * > SmStructureNodeArray;
2000-09-18 16:07:07 +00:00
////////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
enum SmScaleMode { SCALE_NONE, SCALE_WIDTH, SCALE_HEIGHT };
enum SmNodeType
{
NTABLE, NBRACE, NBRACEBODY, NOPER, NALIGN,
NATTRIBUT, NFONT, NUNHOR, NBINHOR, NBINVER,
NBINDIAGONAL, NSUBSUP, NMATRIX, NPLACE, NTEXT,
NSPECIAL, NGLYPH_SPECIAL, NMATH, NBLANK, NERROR,
2002-11-06 11:40:24 +00:00
NLINE, NEXPRESSION, NPOLYLINE, NROOT, NROOTSYMBOL,
NRECTANGLE, NVERTICAL_BRACE
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
class SmNode : public SmRect
{
2010-10-18 12:55:43 +01:00
SmFace aFace;
2000-09-18 16:07:07 +00:00
2010-10-18 12:55:43 +01:00
SmToken aNodeToken;
2000-09-18 16:07:07 +00:00
SmNodeType eType;
SmScaleMode eScaleMode;
RectHorAlign eRectHorAlign;
2010-10-23 16:29:59 +01:00
USHORT nFlags,
nAttributes;
bool bIsPhantom,
2010-10-23 16:29:59 +01:00
bIsDebug;
bool bIsSelected;
2000-09-18 16:07:07 +00:00
protected:
SmNode(SmNodeType eNodeType, const SmToken &rNodeToken);
2002-05-31 13:23:22 +00:00
// index in accessible text -1 if not (yet) applicable
sal_Int32 nAccIndex;
2000-09-18 16:07:07 +00:00
public:
virtual ~SmNode();
virtual bool IsVisible() const;
2000-09-18 16:07:07 +00:00
virtual USHORT GetNumSubNodes() const;
virtual SmNode * GetSubNode(USHORT nIndex);
2000-09-18 16:07:07 +00:00
const SmNode * GetSubNode(USHORT nIndex) const
{
return ((SmNode *) this)->GetSubNode(nIndex);
}
virtual SmNode * GetLeftMost();
const SmNode * GetLeftMost() const
{
return ((SmNode *) this)->GetLeftMost();
}
USHORT & Flags() { return nFlags; }
USHORT & Attributes() { return nAttributes; }
bool IsDebug() const { return bIsDebug; }
bool IsPhantom() const { return bIsPhantom; }
void SetPhantom(bool bIsPhantom);
2000-09-18 16:07:07 +00:00
void SetColor(const Color &rColor);
void SetAttribut(USHORT nAttrib);
void ClearAttribut(USHORT nAttrib);
const SmFace & GetFont() const { return aFace; };
SmFace & GetFont() { return aFace; };
void SetFont(const SmFace &rFace);
void SetFontSize(const Fraction &rRelSize, USHORT nType);
void SetSize(const Fraction &rScale);
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
2000-09-18 16:07:07 +00:00
virtual void PrepareAttributes();
#if OSL_DEBUG_LEVEL
2000-09-18 16:07:07 +00:00
void ToggleDebug() const;
#endif
2000-09-18 16:07:07 +00:00
void SetRectHorAlign(RectHorAlign eHorAlign, bool bApplyToSubTree = true );
2000-09-18 16:07:07 +00:00
RectHorAlign GetRectHorAlign() const { return eRectHorAlign; }
const SmRect & GetRect() const { return *this; }
SmRect & GetRect() { return *this; }
virtual void Move(const Point &rPosition);
void MoveTo(const Point &rPosition) { Move(rPosition - GetTopLeft()); }
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
virtual void CreateTextFromNode(String &rText);
2000-09-18 16:07:07 +00:00
#ifdef SM_RECT_DEBUG
using SmRect::Draw;
#endif
2000-09-18 16:07:07 +00:00
2002-05-31 13:23:22 +00:00
virtual void GetAccessibleText( String &rText ) const;
sal_Int32 GetAccessibleIndex() const { return nAccIndex; }
const SmNode * FindNodeWithAccessibleIndex(xub_StrLen nAccIndex) const;
2002-05-24 06:48:49 +00:00
2001-05-11 12:01:56 +00:00
USHORT GetRow() const { return (USHORT)aNodeToken.nRow; }
USHORT GetColumn() const { return (USHORT)aNodeToken.nCol; }
2000-09-18 16:07:07 +00:00
SmScaleMode GetScaleMode() const { return eScaleMode; }
void SetScaleMode(SmScaleMode eMode) { eScaleMode = eMode; }
virtual void AdaptToX(const OutputDevice &rDev, ULONG nWidth);
virtual void AdaptToY(const OutputDevice &rDev, ULONG nHeight);
2000-09-18 16:07:07 +00:00
SmNodeType GetType() const { return eType; }
const SmToken & GetToken() const { return aNodeToken; }
const SmNode * FindTokenAt(USHORT nRow, USHORT nCol) const;
const SmNode * FindRectClosestTo(const Point &rPoint) const;
/** Accept a visitor
* Calls the method for this class on the visitor
*/
virtual void Accept(SmVisitor* pVisitor);
/** True if this node is selected */
bool IsSelected() const {return bIsSelected;}
void SetSelected(bool Selected = true) {bIsSelected = Selected;}
#ifdef DEBUG_ENABLE_DUMPASDOT
/** The tree as dot graph for graphviz, usable for debugging
* Convert the output to a image using $ dot graph.gv -Tpng > graph.png
*/
inline void DumpAsDot(std::ostream &out, String* label = NULL) const{
int id = 0;
DumpAsDot(out, label, -1, id, -1);
}
#endif /* DEBUG_ENABLE_DUMPASDOT */
/** Get the parent node of this node */
SmStructureNode* GetParent(){ return aParentNode; }
/** Set the parent node */
void SetParent(SmStructureNode* parent){
aParentNode = parent;
}
/** Get the index of a child node
*
* Returns -1, if pSubNode isn't a subnode of this.
*/
int IndexOfSubNode(SmNode* pSubNode){
USHORT nSize = GetNumSubNodes();
for(USHORT i = 0; i < nSize; i++)
if(pSubNode == GetSubNode(i))
return i;
return -1;
}
/** Set the token for this node */
void SetToken(SmToken& token){
aNodeToken = token;
}
protected:
/** Sets parent on children of this node */
void ClaimPaternity(){
SmNode* pNode;
USHORT nSize = GetNumSubNodes();
for (USHORT i = 0; i < nSize; i++)
if (NULL != (pNode = GetSubNode(i)))
pNode->SetParent((SmStructureNode*)this); //Cast is valid if we have children
}
private:
SmStructureNode* aParentNode;
void DumpAsDot(std::ostream &out, String* label, int number, int& id, int parent) const;
};
2000-09-18 16:07:07 +00:00
////////////////////////////////////////////////////////////////////////////////
/** A simple auxiliary iterator class for SmNode
*
* Example of iteration over children of pMyNode:
* \code
* //Node to iterate over:
* SmNode* pMyNode = 0;// A pointer from somewhere
* //The iterator:
* SmNodeIterator it(pMyNode);
* //The iteration:
* while(it.Next()) {
* it->SetSelected(true);
* }
* \endcode
*/
class SmNodeIterator{
public:
SmNodeIterator(SmNode* node, bool bReverse = false){
pNode = node;
nSize = pNode->GetNumSubNodes();
nIndex = 0;
pChildNode = NULL;
bIsReverse = bReverse;
}
/** Get the subnode or NULL if none */
SmNode* Next(){
while(!bIsReverse && nIndex < nSize){
if(NULL != (pChildNode = pNode->GetSubNode(nIndex++)))
return pChildNode;
}
while(bIsReverse && nSize > 0){
if(NULL != (pChildNode = pNode->GetSubNode((nSize--)-1)))
return pChildNode;
}
pChildNode = NULL;
return NULL;
}
/** Get the current child node, NULL if none */
SmNode* Current(){
return pChildNode;
}
/** Get the current child node, NULL if none */
SmNode* operator->(){
return pChildNode;
}
private:
/** Current child */
SmNode* pChildNode;
/** Node whos children we're iterating over */
SmNode* pNode;
/** Size of the node */
USHORT nSize;
/** Current index in the node */
USHORT nIndex;
/** Move reverse */
bool bIsReverse;
};
////////////////////////////////////////////////////////////////////////////////
2000-09-18 16:07:07 +00:00
/** Abstract baseclass for all composite node
*
* Subclasses of this class can have subnodes. Nodes that doesn't derivate from
* this class does not have subnodes.
*/
2000-09-18 16:07:07 +00:00
class SmStructureNode : public SmNode
{
SmNodeArray aSubNodes;
protected:
SmStructureNode(SmNodeType eNodeType, const SmToken &rNodeToken)
: SmNode(eNodeType, rNodeToken)
{}
public:
SmStructureNode( const SmStructureNode &rNode );
2000-09-18 16:07:07 +00:00
virtual ~SmStructureNode();
virtual bool IsVisible() const;
2000-09-18 16:07:07 +00:00
virtual USHORT GetNumSubNodes() const;
CWS-TOOLING: integrate CWS tl66 2009-05-15 12:28:55 +0200 tl r271932 : #i91812# include fixed 2009-05-07 16:52:41 +0200 tl r271680 : #i97200# one more MathML export problem to fix 2009-05-05 08:33:29 +0200 tl r271494 : #i99401# positiv user-dicts vs negativ user-dicts 2009-05-04 14:14:03 +0200 tl r271452 : #i97200# warning free code; MathML 2.0 export 2009-05-04 13:26:30 +0200 tl r271448 : #i97200# write valid MathML 2.0 on export 2009-04-29 14:21:54 +0200 tl r271371 : #i97200# new MathML token 2009-04-29 11:12:07 +0200 tl r271360 : #i97200# inroducing separate files for import and export 2009-04-28 16:47:42 +0200 tl r271331 : #i97200# better MathML pretty printing 2009-04-28 11:21:57 +0200 tl r271315 : #i97200# MathML attributes and default namespace for MathML 2009-04-28 11:21:24 +0200 tl r271314 : #i97200# MathML attributes and default namespace for MathML 2009-04-23 12:44:18 +0200 tl r271154 : #i97200# math.dtd removed 2009-04-23 12:31:56 +0200 tl r271151 : #i97200# MathML: don't use namespace on attributes 2009-04-22 13:21:11 +0200 tl r271099 : warning-free code 2009-04-22 12:20:13 +0200 tl r271092 : #i100757# loop fixed 2009-04-22 11:29:51 +0200 tl r271086 : #97327# adding mongolian fingerprint for language guessing 2009-04-22 11:25:56 +0200 tl r271083 : #97327# adding mongolian fingerprint for language guessing 2009-04-21 10:39:21 +0200 tl r271025 : #99599# code fix for LRE/RLE embedding 2009-04-20 16:36:33 +0200 tl r270992 : #i99604# HasDigits fixed 2009-04-20 14:44:19 +0200 tl r270985 : #i99604# warning-free code for Windows 2009-04-20 13:48:13 +0200 tl r270980 : #i99604# HasDigits fix for non-ASCII characters 2009-04-20 13:47:50 +0200 tl r270979 : #i99604# HasDigits fix for non-ASCII characters 2009-04-20 12:28:15 +0200 tl r270973 : warning-free code after merging 2009-04-20 10:16:19 +0200 tl r270964 : warning-free code after merging 2009-04-17 14:43:36 +0200 tl r270948 : #i96846# 2009-04-16 13:09:15 +0200 tl r270883 : CWS-TOOLING: rebase CWS tl66 to trunk@270723 (milestone: DEV300:m46) 2009-04-14 14:34:08 +0200 tl r270770 : #101067# warning-free code 2009-04-02 09:07:44 +0200 tl r270368 : #i100757# performance patch for start-up (initialize language guessing on demand only) 2009-03-11 10:37:59 +0100 tl r269301 : #i100083# fixed system dictionary lookup 2009-03-06 13:10:23 +0100 tl r268998 : warning-free code for Windows non-pro 2009-02-23 14:01:23 +0100 tl r268355 : #i99401# winning rules for user-dictionaries changed 2009-02-19 14:05:57 +0100 tl r268281 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 14:05:02 +0100 tl r268280 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 13:58:51 +0100 tl r268279 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 11:38:03 +0100 tl r268266 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-12 11:58:34 +0100 tl r267642 : #i96846# some properties declared as maybevoid 2009-02-06 12:43:55 +0100 tl r267454 : #i98644# provide sugestions from secondary spell checkers if the primary does not provide ones 2009-02-05 13:02:26 +0100 tl r267418 : #i98880# a bit clean-up in the grammar checking framework 2009-02-04 12:15:37 +0100 tl r267363 : #i91812# remove unused/duplicate code 2009-02-04 12:09:34 +0100 tl r267362 : #i91812# remove unused/duplicate code 2009-02-04 11:07:57 +0100 tl r267355 : #i91812# remove unused code 2009-02-04 11:06:48 +0100 tl r267354 : #i91812# remove unused code 2009-02-03 14:52:43 +0100 tl r267331 : #i91812# remove unused code 2009-02-03 14:26:00 +0100 tl r267324 : #i91198# adding fingerprint for luxembourgish 2009-02-03 14:20:58 +0100 tl r267323 : #i91198# adding fingerprint for luxembourgish 2009-02-03 14:18:33 +0100 tl r267322 : #i91198# adding fingerprint for luxembourgish 2009-02-03 13:56:39 +0100 tl r267319 : #i91812# remove unused code 2009-02-03 12:41:50 +0100 tl r267314 : #i48400# auto-spellcheck improvement when deleting wrong chars 2009-02-03 11:48:51 +0100 tl r267310 : #i91812# remove unused code 2009-02-03 11:14:29 +0100 tl r267307 : warning free code 2009-02-03 10:45:21 +0100 tl r267306 : #i91812# remove unused code 2009-02-03 10:37:04 +0100 tl r267304 : #i33387# name change for 'View/Selection' 2009-02-03 10:36:17 +0100 tl r267303 : #i33387# name change for 'View/Selection' 2009-02-03 10:32:12 +0100 tl r267302 : #i30642# spelling error in context menu fixed 2009-02-03 10:27:34 +0100 tl r267301 : #i92210# remove unused code types.cxx cfgitem.*
2009-05-19 09:31:27 +00:00
void SetNumSubNodes(USHORT nSize) { aSubNodes.resize(nSize); }
2000-09-18 16:07:07 +00:00
using SmNode::GetSubNode;
virtual SmNode * GetSubNode(USHORT nIndex);
CWS-TOOLING: integrate CWS tl66 2009-05-15 12:28:55 +0200 tl r271932 : #i91812# include fixed 2009-05-07 16:52:41 +0200 tl r271680 : #i97200# one more MathML export problem to fix 2009-05-05 08:33:29 +0200 tl r271494 : #i99401# positiv user-dicts vs negativ user-dicts 2009-05-04 14:14:03 +0200 tl r271452 : #i97200# warning free code; MathML 2.0 export 2009-05-04 13:26:30 +0200 tl r271448 : #i97200# write valid MathML 2.0 on export 2009-04-29 14:21:54 +0200 tl r271371 : #i97200# new MathML token 2009-04-29 11:12:07 +0200 tl r271360 : #i97200# inroducing separate files for import and export 2009-04-28 16:47:42 +0200 tl r271331 : #i97200# better MathML pretty printing 2009-04-28 11:21:57 +0200 tl r271315 : #i97200# MathML attributes and default namespace for MathML 2009-04-28 11:21:24 +0200 tl r271314 : #i97200# MathML attributes and default namespace for MathML 2009-04-23 12:44:18 +0200 tl r271154 : #i97200# math.dtd removed 2009-04-23 12:31:56 +0200 tl r271151 : #i97200# MathML: don't use namespace on attributes 2009-04-22 13:21:11 +0200 tl r271099 : warning-free code 2009-04-22 12:20:13 +0200 tl r271092 : #i100757# loop fixed 2009-04-22 11:29:51 +0200 tl r271086 : #97327# adding mongolian fingerprint for language guessing 2009-04-22 11:25:56 +0200 tl r271083 : #97327# adding mongolian fingerprint for language guessing 2009-04-21 10:39:21 +0200 tl r271025 : #99599# code fix for LRE/RLE embedding 2009-04-20 16:36:33 +0200 tl r270992 : #i99604# HasDigits fixed 2009-04-20 14:44:19 +0200 tl r270985 : #i99604# warning-free code for Windows 2009-04-20 13:48:13 +0200 tl r270980 : #i99604# HasDigits fix for non-ASCII characters 2009-04-20 13:47:50 +0200 tl r270979 : #i99604# HasDigits fix for non-ASCII characters 2009-04-20 12:28:15 +0200 tl r270973 : warning-free code after merging 2009-04-20 10:16:19 +0200 tl r270964 : warning-free code after merging 2009-04-17 14:43:36 +0200 tl r270948 : #i96846# 2009-04-16 13:09:15 +0200 tl r270883 : CWS-TOOLING: rebase CWS tl66 to trunk@270723 (milestone: DEV300:m46) 2009-04-14 14:34:08 +0200 tl r270770 : #101067# warning-free code 2009-04-02 09:07:44 +0200 tl r270368 : #i100757# performance patch for start-up (initialize language guessing on demand only) 2009-03-11 10:37:59 +0100 tl r269301 : #i100083# fixed system dictionary lookup 2009-03-06 13:10:23 +0100 tl r268998 : warning-free code for Windows non-pro 2009-02-23 14:01:23 +0100 tl r268355 : #i99401# winning rules for user-dictionaries changed 2009-02-19 14:05:57 +0100 tl r268281 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 14:05:02 +0100 tl r268280 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 13:58:51 +0100 tl r268279 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-19 11:38:03 +0100 tl r268266 : #i98644# suggestion improvement when first checker does not know any suggestions 2009-02-12 11:58:34 +0100 tl r267642 : #i96846# some properties declared as maybevoid 2009-02-06 12:43:55 +0100 tl r267454 : #i98644# provide sugestions from secondary spell checkers if the primary does not provide ones 2009-02-05 13:02:26 +0100 tl r267418 : #i98880# a bit clean-up in the grammar checking framework 2009-02-04 12:15:37 +0100 tl r267363 : #i91812# remove unused/duplicate code 2009-02-04 12:09:34 +0100 tl r267362 : #i91812# remove unused/duplicate code 2009-02-04 11:07:57 +0100 tl r267355 : #i91812# remove unused code 2009-02-04 11:06:48 +0100 tl r267354 : #i91812# remove unused code 2009-02-03 14:52:43 +0100 tl r267331 : #i91812# remove unused code 2009-02-03 14:26:00 +0100 tl r267324 : #i91198# adding fingerprint for luxembourgish 2009-02-03 14:20:58 +0100 tl r267323 : #i91198# adding fingerprint for luxembourgish 2009-02-03 14:18:33 +0100 tl r267322 : #i91198# adding fingerprint for luxembourgish 2009-02-03 13:56:39 +0100 tl r267319 : #i91812# remove unused code 2009-02-03 12:41:50 +0100 tl r267314 : #i48400# auto-spellcheck improvement when deleting wrong chars 2009-02-03 11:48:51 +0100 tl r267310 : #i91812# remove unused code 2009-02-03 11:14:29 +0100 tl r267307 : warning free code 2009-02-03 10:45:21 +0100 tl r267306 : #i91812# remove unused code 2009-02-03 10:37:04 +0100 tl r267304 : #i33387# name change for 'View/Selection' 2009-02-03 10:36:17 +0100 tl r267303 : #i33387# name change for 'View/Selection' 2009-02-03 10:32:12 +0100 tl r267302 : #i30642# spelling error in context menu fixed 2009-02-03 10:27:34 +0100 tl r267301 : #i92210# remove unused code types.cxx cfgitem.*
2009-05-19 09:31:27 +00:00
void SetSubNodes(SmNode *pFirst, SmNode *pSecond, SmNode *pThird = NULL);
2000-09-18 16:07:07 +00:00
void SetSubNodes(const SmNodeArray &rNodeArray);
virtual SmStructureNode & operator = ( const SmStructureNode &rNode );
2002-05-24 06:48:49 +00:00
2002-05-31 13:23:22 +00:00
virtual void GetAccessibleText( String &rText ) const;
void SetSubNode(USHORT nIndex, SmNode* pNode){
int size = aSubNodes.size();
if(size <= nIndex){
//Resize subnodes array
aSubNodes.resize(nIndex + 1);
//Set new slots to NULL
for(int i = size; i < nIndex+1; i++)
aSubNodes[i] = NULL;
}
aSubNodes[nIndex] = pNode;
ClaimPaternity();
}
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Abstract base class for all visible node
*
* Nodes that doesn't derivate from this class doesn't draw anything, but their
* children.
*/
2000-09-18 16:07:07 +00:00
class SmVisibleNode : public SmNode
{
protected:
SmVisibleNode(SmNodeType eNodeType, const SmToken &rNodeToken)
: SmNode(eNodeType, rNodeToken)
{}
public:
virtual bool IsVisible() const;
virtual USHORT GetNumSubNodes() const;
using SmNode::GetSubNode;
virtual SmNode * GetSubNode(USHORT nIndex);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
class SmGraphicNode : public SmVisibleNode
{
protected:
SmGraphicNode(SmNodeType eNodeType, const SmToken &rNodeToken)
: SmVisibleNode(eNodeType, rNodeToken)
{}
public:
2002-05-24 06:48:49 +00:00
2002-05-31 13:23:22 +00:00
virtual void GetAccessibleText( String &rText ) const;
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Draws a rectangle
*
* Used for drawing the line in the OVER and OVERSTRIKE commands.
*/
2000-09-18 16:07:07 +00:00
class SmRectangleNode : public SmGraphicNode
{
Size aToSize;
public:
SmRectangleNode(const SmToken &rNodeToken)
: SmGraphicNode(NRECTANGLE, rNodeToken)
{}
virtual void AdaptToX(const OutputDevice &rDev, ULONG nWidth);
virtual void AdaptToY(const OutputDevice &rDev, ULONG nHeight);
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
#ifdef SM_RECT_DEBUG
using SmRect::Draw;
#endif
2001-12-06 13:22:31 +00:00
void CreateTextFromNode(String &rText);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Polygon line node
*
* Used to draw the slash of the WIDESLASH command by SmBinDiagonalNode.
*/
2000-09-18 16:07:07 +00:00
class SmPolyLineNode : public SmGraphicNode
{
Polygon aPoly;
Size aToSize;
long nWidth;
public:
SmPolyLineNode(const SmToken &rNodeToken);
long GetWidth() const { return nWidth; }
Size GetToSize() const { return aToSize; }
Polygon &GetPolygon() { return aPoly; }
2000-09-18 16:07:07 +00:00
virtual void AdaptToX(const OutputDevice &rDev, ULONG nWidth);
virtual void AdaptToY(const OutputDevice &rDev, ULONG nHeight);
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
#ifdef SM_RECT_DEBUG
using SmRect::Draw;
#endif
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Text node
*
* @remarks This class also serves as baseclass for all nodes that contains text.
*/
2000-09-18 16:07:07 +00:00
class SmTextNode : public SmVisibleNode
{
2002-05-31 13:23:22 +00:00
XubString aText;
USHORT nFontDesc;
/** Index within text where the selection starts
* @remarks Only valid if SmNode::IsSelected() is true
*/
xub_StrLen nSelectionStart;
/** Index within text where the selection ends
* @remarks Only valid if SmNode::IsSelected() is true
*/
xub_StrLen nSelectionEnd;
2000-09-18 16:07:07 +00:00
protected:
SmTextNode(SmNodeType eNodeType, const SmToken &rNodeToken, USHORT nFontDescP );
2000-09-18 16:07:07 +00:00
public:
SmTextNode(const SmToken &rNodeToken, USHORT nFontDescP );
2000-09-18 16:07:07 +00:00
USHORT GetFontDesc() const { return nFontDesc; }
void SetText(const XubString &rText) { aText = rText; }
const XubString & GetText() const { return aText; }
/** Change the text of this node, including the underlying token */
void ChangeText(const XubString &rText) {
aText = rText;
SmToken token = GetToken();
token.aText = rText;
SetToken(token); //TODO: Merge this with AdjustFontDesc for better performance
AdjustFontDesc();
}
/** Try to guess the correct FontDesc, used during visual editing */
void AdjustFontDesc();
/** Index within GetText() where the selection starts
* @remarks Only valid of SmNode::IsSelected() is true
*/
xub_StrLen GetSelectionStart() const {return nSelectionStart;}
/** Index within GetText() where the selection end
* @remarks Only valid of SmNode::IsSelected() is true
*/
xub_StrLen GetSelectionEnd() const {return nSelectionEnd;}
/** Set the index within GetText() where the selection starts */
void SetSelectionStart(xub_StrLen index) {nSelectionStart = index;}
/** Set the index within GetText() where the selection end */
void SetSelectionEnd(xub_StrLen index) {nSelectionEnd = index;}
2000-09-18 16:07:07 +00:00
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
virtual void CreateTextFromNode(String &rText);
#ifdef SM_RECT_DEBUG
using SmRect::Draw;
#endif
2002-05-24 06:48:49 +00:00
2002-05-31 13:23:22 +00:00
virtual void GetAccessibleText( String &rText ) const;
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Special node for user defined characters
*
* Node used for pre- and user-defined characters from:
* officecfg/registry/data/org/openoffice/Office/Math.xcu
*
* This is just single characters, I think.
*/
2000-09-18 16:07:07 +00:00
class SmSpecialNode : public SmTextNode
{
bool bIsFromGreekSymbolSet;
2000-09-18 16:07:07 +00:00
protected:
SmSpecialNode(SmNodeType eNodeType, const SmToken &rNodeToken, USHORT _nFontDesc);
2000-09-18 16:07:07 +00:00
public:
SmSpecialNode(const SmToken &rNodeToken);
2000-09-18 16:07:07 +00:00
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
#ifdef SM_RECT_DEBUG
using SmRect::Draw;
#endif
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Glyph node for custom operators
*
* This node is used with commands: oper, uoper and boper.
* E.g. in "A boper op B", "op" will be an instance of SmGlyphSpecialNode.
* "boper" simply inteprets "op", the following token, as an binary operator.
* The command "uoper" interprets the following token as unary operator.
* For these commands an instance of SmGlyphSpecialNode is used for the
* operator token, following the command.
*/
2000-09-18 16:07:07 +00:00
class SmGlyphSpecialNode : public SmSpecialNode
{
public:
SmGlyphSpecialNode(const SmToken &rNodeToken)
: SmSpecialNode(NGLYPH_SPECIAL, rNodeToken, FNT_MATH)
{}
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Math symbol node
*
* Use for math symbols such as plus, minus and integrale in the INT command.
*/
2000-09-18 16:07:07 +00:00
class SmMathSymbolNode : public SmSpecialNode
{
protected:
SmMathSymbolNode(SmNodeType eNodeType, const SmToken &rNodeToken)
: SmSpecialNode(eNodeType, rNodeToken, FNT_MATH)
2002-11-06 11:40:24 +00:00
{
xub_Unicode cChar = GetToken().cMathChar;
if ((xub_Unicode) '\0' != cChar)
SetText( cChar );
}
2000-09-18 16:07:07 +00:00
public:
SmMathSymbolNode(const SmToken &rNodeToken);
virtual void AdaptToX(const OutputDevice &rDev, ULONG nWidth);
virtual void AdaptToY(const OutputDevice &rDev, ULONG nHeight);
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void CreateTextFromNode(String &rText);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Root symbol node
*
* Root symbol node used by SmRootNode to create the root symbol, infront of
* the line with the line above. I don't think this node should be used for
* anything else.
*/
2002-11-06 11:40:24 +00:00
class SmRootSymbolNode : public SmMathSymbolNode
{
ULONG nBodyWidth; // width of body (argument) of root sign
public:
SmRootSymbolNode(const SmToken &rNodeToken)
: SmMathSymbolNode(NROOTSYMBOL, rNodeToken)
{}
ULONG GetBodyWidth() const {return nBodyWidth;};
2002-11-06 11:40:24 +00:00
virtual void AdaptToX(const OutputDevice &rDev, ULONG nWidth);
virtual void AdaptToY(const OutputDevice &rDev, ULONG nHeight);
#ifdef SM_RECT_DEBUG
using SmRect::Draw;
#endif
void Accept(SmVisitor* pVisitor);
2002-11-06 11:40:24 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Place node
*
* Used to create the <?> command, that denotes place where something can be
* written.
* It is drawn as a square with a shadow.
*/
2000-09-18 16:07:07 +00:00
class SmPlaceNode : public SmMathSymbolNode
{
public:
SmPlaceNode(const SmToken &rNodeToken)
: SmMathSymbolNode(NPLACE, rNodeToken)
{
}
SmPlaceNode() : SmMathSymbolNode(NPLACE, SmToken(TPLACE, MS_PLACE, "<?>")) {};
2000-09-18 16:07:07 +00:00
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Error node, for parsing errors
*
* This node is used for parsing errors and draws an questionmark turned upside
* down (inverted question mark).
*/
2000-09-18 16:07:07 +00:00
class SmErrorNode : public SmMathSymbolNode
{
public:
SmErrorNode(SmParseError /*eError*/, const SmToken &rNodeToken)
2000-09-18 16:07:07 +00:00
: SmMathSymbolNode(NERROR, rNodeToken)
{
SetText((xub_Unicode) MS_ERROR);
}
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Table node
*
* This is the root node for the formula tree. This node is also used for the
* STACK and BINOM commands. When used for root node, its
* children are instances of SmLineNode, and in some obscure cases the a child
* can be an instance of SmExpressionNode, mainly when errors occur.
*/
2000-09-18 16:07:07 +00:00
class SmTableNode : public SmStructureNode
{
public:
SmTableNode(const SmToken &rNodeToken)
: SmStructureNode(NTABLE, rNodeToken)
{}
using SmNode::GetLeftMost;
virtual SmNode * GetLeftMost();
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** A line
*
* Used as child of SmTableNode when the SmTableNode is the root node of the
* formula tree.
*/
2000-09-18 16:07:07 +00:00
class SmLineNode : public SmStructureNode
{
bool bUseExtraSpaces;
2000-09-18 16:07:07 +00:00
protected:
SmLineNode(SmNodeType eNodeType, const SmToken &rNodeToken)
: SmStructureNode(eNodeType, rNodeToken)
{
bUseExtraSpaces = true;
}
2000-09-18 16:07:07 +00:00
public:
SmLineNode(const SmToken &rNodeToken)
: SmStructureNode(NLINE, rNodeToken)
{
bUseExtraSpaces = true;
}
void SetUseExtraSpaces(bool bVal) { bUseExtraSpaces = bVal; }
bool IsUseExtraSpaces() const { return bUseExtraSpaces; };
2000-09-18 16:07:07 +00:00
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Expression node
*
* Used whenever you have an expression such as "A OVER {B + C}", here there is
* an expression node that allows "B + C" to be the denominator of the
* SmBinVerNode, that the OVER command creates.
*/
2000-09-18 16:07:07 +00:00
class SmExpressionNode : public SmLineNode
{
public:
SmExpressionNode(const SmToken &rNodeToken)
: SmLineNode(NEXPRESSION, rNodeToken)
{}
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void CreateTextFromNode(String &rText);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Unary horizontical node
*
* The same as SmBinHorNode except this is for unary operators.
*/
2000-09-18 16:07:07 +00:00
class SmUnHorNode : public SmStructureNode
{
public:
SmUnHorNode(const SmToken &rNodeToken)
: SmStructureNode(NUNHOR, rNodeToken)
{
SetNumSubNodes(2);
}
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Root node
*
* Used for create square roots and other roots, example:
* \f$ \sqrt[\mbox{[Argument]}]{\mbox{[Body]}} \f$.
*
* Children:<BR>
* 0: Argument (optional)<BR>
* 1: Symbol (instance of SmRootSymbolNode)<BR>
* 2: Body<BR>
* Where argument is optinal and may be NULL.
*/
2000-09-18 16:07:07 +00:00
class SmRootNode : public SmStructureNode
{
protected:
void GetHeightVerOffset(const SmRect &rRect,
long &rHeight, long &rVerOffset) const;
Point GetExtraPos(const SmRect &rRootSymbol, const SmRect &rExtra) const;
public:
SmRootNode(const SmToken &rNodeToken)
: SmStructureNode(NROOT, rNodeToken)
{
SetNumSubNodes(3);
}
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void CreateTextFromNode(String &rText);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Binary horizontial node
*
* This node is used for binary operators. In a formula such as "A + B".
*
* Children:<BR>
* 0: Left operand<BR>
* 1: Binary operator<BR>
* 2: Right operand<BR>
*
* None of the children may be NULL.
*/
2000-09-18 16:07:07 +00:00
class SmBinHorNode : public SmStructureNode
{
public:
SmBinHorNode(const SmToken &rNodeToken)
: SmStructureNode(NBINHOR, rNodeToken)
{
SetNumSubNodes(3);
}
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Binary horizontical node
*
* This node is used for creating the OVER command, consider the formula:
* "numerator OVER denominator", which looks like
* \f$ \frac{\mbox{numerator}}{\mbox{denominator}} \f$
*
* Children:<BR>
* 0: Numerator<BR>
* 1: Line (instance of SmRectangleNode)<BR>
* 2: Denominator<BR>
* None of the children may be NULL.
*/
2000-09-18 16:07:07 +00:00
class SmBinVerNode : public SmStructureNode
{
public:
SmBinVerNode(const SmToken &rNodeToken)
: SmStructureNode(NBINVER, rNodeToken)
{
SetNumSubNodes(3);
}
using SmNode::GetLeftMost;
virtual SmNode * GetLeftMost();
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void CreateTextFromNode(String &rText);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Binary diagonal node
*
* Used for implementing the WIDESLASH command, example: "A WIDESLASH B".
*
* Children:<BR>
* 0: Left operand<BR>
* 1: right operand<BR>
* 2: Line (instance of SmPolyLineNode).<BR>
* None of the children may be NULL.
*/
2000-09-18 16:07:07 +00:00
class SmBinDiagonalNode : public SmStructureNode
{
bool bAscending;
2000-09-18 16:07:07 +00:00
void GetOperPosSize(Point &rPos, Size &rSize,
const Point &rDiagPoint, double fAngleDeg) const;
public:
SmBinDiagonalNode(const SmToken &rNodeToken);
bool IsAscending() const { return bAscending; }
void SetAscending(bool bVal) { bAscending = bVal; }
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Enum used to index sub-/supscripts in the 'aSubNodes' array
* in 'SmSubSupNode'
*
* See graphic for positions at char:
*
* \code
* CSUP
*
* LSUP H H RSUP
* H H
* HHHH
* H H
* LSUB H H RSUB
*
* CSUB
* \endcode
*/
2000-09-18 16:07:07 +00:00
enum SmSubSup
{ CSUB, CSUP, RSUB, RSUP, LSUB, LSUP
};
/** numbers of entries in the above enum (that is: the number of possible
* sub-/supscripts)
*/
2000-09-18 16:07:07 +00:00
#define SUBSUP_NUM_ENTRIES 6
/** Super- and subscript node
*
* Used for creating super- and subscripts for commands such as:
* "^", "_", "lsup", "lsub", "csup" and "csub".
* Example: "A^2" which looks like: \f$ A^2 \f$
*
* This node is also used for creating limits on SmOperNode, when
* "FROM" and "TO" commands are used with "INT", "SUM" or similar.
*
* Children of this node can be enumerated using the SmSubSup enum.
* Please note that children may be NULL, except for the body.
* It is recommended that you access children using GetBody() and
* GetSubSup().
*/
2000-09-18 16:07:07 +00:00
class SmSubSupNode : public SmStructureNode
{
bool bUseLimits;
2000-09-18 16:07:07 +00:00
public:
SmSubSupNode(const SmToken &rNodeToken)
: SmStructureNode(NSUBSUP, rNodeToken)
{
SetNumSubNodes(1 + SUBSUP_NUM_ENTRIES);
bUseLimits = false;
2000-09-18 16:07:07 +00:00
}
/** Get body (Not NULL) */
2000-09-18 16:07:07 +00:00
SmNode * GetBody() { return GetSubNode(0); }
/** Get body (Not NULL) */
2000-09-18 16:07:07 +00:00
const SmNode * GetBody() const
{
return ((SmSubSupNode *) this)->GetBody();
}
void SetUseLimits(bool bVal) { bUseLimits = bVal; }
bool IsUseLimits() const { return bUseLimits; };
2000-09-18 16:07:07 +00:00
/** Get super- or subscript
* @remarks this method may return NULL.
*/
SmNode * GetSubSup(SmSubSup eSubSup) { return GetSubNode( sal::static_int_cast< USHORT >(1 + eSubSup) ); };
2000-09-18 16:07:07 +00:00
/** Set the body */
void SetBody(SmNode* pBody) { SetSubNode(0, pBody); }
void SetSubSup(SmSubSup eSubSup, SmNode* pScript) { SetSubNode( 1 + eSubSup, pScript); }
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void CreateTextFromNode(String &rText);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Node for brace construction
*
* Used for "lbrace [body] rbrace" and similar constructions.
* Should look like \f$ \{\mbox{[body]}\} \f$
*
* Children:<BR>
* 0: Opening brace<BR>
* 1: Body (usually SmBracebodyNode)<BR>
* 2: Closing brace<BR>
* None of the children can be NULL.
*
* Note that child 1 (Body) is usually SmBracebodyNode, I don't know if it can
* be an SmExpressionNode, haven't seen the case. But didn't quite read parser.cxx
* enought to exclude this possibility.
*/
2000-09-18 16:07:07 +00:00
class SmBraceNode : public SmStructureNode
{
public:
SmBraceNode(const SmToken &rNodeToken)
: SmStructureNode(NBRACE, rNodeToken)
{
SetNumSubNodes(3);
}
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void CreateTextFromNode(String &rText);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Body of an SmBraceNode
*
* This usually only has one child an SmExpressionNode, however, it can also
* have other children.
* Consider the formula "lbrace [body1] mline [body2] rbrace", looks like:
* \f$ \{\mbox{[body1] | [body2]}\} \f$.
* In this case SmBracebodyNode will have three children, "[body1]", "|" and
* [body2].
*/
2000-09-18 16:07:07 +00:00
class SmBracebodyNode : public SmStructureNode
{
long nBodyHeight;
public:
inline SmBracebodyNode(const SmToken &rNodeToken);
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
long GetBodyHeight() const { return nBodyHeight; }
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
inline SmBracebodyNode::SmBracebodyNode(const SmToken &rNodeToken) :
SmStructureNode(NBRACEBODY, rNodeToken)
2000-09-18 16:07:07 +00:00
{
nBodyHeight = 0;
}
////////////////////////////////////////////////////////////////////////////////
/** Node for vertical brace construction
*
* Used to implement commands "[body] underbrace [script]" and
* "[body] overbrace [script]".
* Underbrace should look like this \f$ \underbrace{\mbox{body}}_{\mbox{script}}\f$.
*
* Children:<BR>
* 0: body<BR>
* 1: brace<BR>
* 2: script<BR>
* (None of these children are optional, e.g. they must all be not NULL).
*/
2000-09-18 16:07:07 +00:00
class SmVerticalBraceNode : public SmStructureNode
{
public:
inline SmVerticalBraceNode(const SmToken &rNodeToken);
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
inline SmVerticalBraceNode::SmVerticalBraceNode(const SmToken &rNodeToken) :
SmStructureNode(NVERTICAL_BRACE, rNodeToken)
2000-09-18 16:07:07 +00:00
{
SetNumSubNodes(3);
}
////////////////////////////////////////////////////////////////////////////////
/** Operation Node
*
* Used for commands like SUM, INT and similar.
*
* Children:<BR>
* 0: Operation (instance of SmMathSymbolNode)<BR>
* 1: Body<BR>
* None of the children may be NULL.
*
* If there are boundaries on the operation the body will an instance of
* SmSubSupNode.
*/
2000-09-18 16:07:07 +00:00
class SmOperNode : public SmStructureNode
{
public:
SmOperNode(const SmToken &rNodeToken)
: SmStructureNode(NOPER, rNodeToken)
{
SetNumSubNodes(2);
}
SmNode * GetSymbol();
const SmNode * GetSymbol() const
{
return ((SmOperNode *) this)->GetSymbol();
}
long CalcSymbolHeight(const SmNode &rSymbol, const SmFormat &rFormat) const;
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Node used for alignment
*/
2000-09-18 16:07:07 +00:00
class SmAlignNode : public SmStructureNode
{
public:
SmAlignNode(const SmToken &rNodeToken)
: SmStructureNode(NALIGN, rNodeToken)
{}
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Attribute node
*
* Used to give an attribute to another node. Used for commands such as:
* UNDERLINE, OVERLINE, OVERSTRIKE, WIDEVEC, WIDEHAT and WIDETILDE.
*
* Children:<BR>
* 0: Attribute<BR>
* 1: Body<BR>
* None of these may be NULL.
*/
2000-09-18 16:07:07 +00:00
class SmAttributNode : public SmStructureNode
{
public:
SmAttributNode(const SmToken &rNodeToken)
: SmStructureNode(NATTRIBUT, rNodeToken)
{}
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
2001-12-06 13:22:31 +00:00
void CreateTextFromNode(String &rText);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Font node
*
* Used to change the font of it's children.
*/
2000-09-18 16:07:07 +00:00
class SmFontNode : public SmStructureNode
{
USHORT nSizeType;
Fraction aFontSize;
public:
SmFontNode(const SmToken &rNodeToken)
: SmStructureNode(NFONT, rNodeToken)
{
nSizeType = FNTSIZ_MULTIPLY;
aFontSize = Fraction(1L);
}
void SetSizeParameter(const Fraction &rValue, USHORT nType);
2000-11-21 11:31:18 +00:00
const Fraction & GetSizeParameter() const {return aFontSize;}
const USHORT& GetSizeType() const {return nSizeType;}
2000-09-18 16:07:07 +00:00
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void CreateTextFromNode(String &rText);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Matrix node
*
* Used to implement the MATRIX command, example:
* "matrix{ 1 # 2 ## 3 # 4}".
*/
2000-09-18 16:07:07 +00:00
class SmMatrixNode : public SmStructureNode
{
USHORT nNumRows,
nNumCols;
public:
SmMatrixNode(const SmToken &rNodeToken)
: SmStructureNode(NMATRIX, rNodeToken)
{
nNumRows = nNumCols = 0;
}
2000-11-21 11:31:18 +00:00
USHORT GetNumRows() const {return nNumRows;}
USHORT GetNumCols() const {return nNumCols;}
2000-09-18 16:07:07 +00:00
void SetRowCol(USHORT nMatrixRows, USHORT nMatrixCols);
using SmNode::GetLeftMost;
virtual SmNode * GetLeftMost();
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void CreateTextFromNode(String &rText);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
/** Node for whitespace
*
* Used to implement the "~" command. This node is just a blank space.
*/
2000-09-18 16:07:07 +00:00
class SmBlankNode : public SmGraphicNode
{
USHORT nNum;
public:
SmBlankNode(const SmToken &rNodeToken)
: SmGraphicNode(NBLANK, rNodeToken)
{
nNum = 0;
}
void IncreaseBy(const SmToken &rToken);
void Clear() { nNum = 0; }
USHORT GetBlankNum() const { return nNum; }
void SetBlankNum(USHORT nNumber) { nNum = nNumber; }
2000-09-18 16:07:07 +00:00
virtual void Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell);
2000-09-18 16:07:07 +00:00
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void Accept(SmVisitor* pVisitor);
2000-09-18 16:07:07 +00:00
};
////////////////////////////////////////////////////////////////////////////////
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */