diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-07-30 11:38:32 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-07-30 11:38:32 +0200 |
commit | 42d125b9f00f764460ace58c3c6352c5fa62994c (patch) | |
tree | 6977f0f6b0564f233d399ea3dfb4a95c59b5fc50 /starmath | |
parent | 4a607556ce44e451bae7292bdb99d7ee9b67fd25 (diff) |
cws tlmath01: #i972# applied first community patch
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/node.hxx | 9 | ||||
-rw-r--r-- | starmath/source/node.cxx | 49 | ||||
-rw-r--r--[-rwxr-xr-x] | starmath/source/unomodel.cxx | 13 |
3 files changed, 56 insertions, 15 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 6ef89ea5ec1b..b1c5e0cc73f9 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -180,6 +180,9 @@ public: const SmNode * FindTokenAt(USHORT nRow, USHORT nCol) const; const SmNode * FindRectClosestTo(const Point &rPoint) const; + // --> 4.7.2010 i#972 + virtual long GetFormulaBaseline() const { return (long)0; } //dummy, used in SmTableNode + // <-- }; @@ -467,6 +470,9 @@ public: class SmTableNode : public SmStructureNode { + // --> 4.7.2010 i#972 + long nFormulaBaseline; + // <-- public: SmTableNode(const SmToken &rNodeToken) : SmStructureNode(NTABLE, rNodeToken) @@ -476,6 +482,9 @@ public: virtual SmNode * GetLeftMost(); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); + // --> + long GetFormulaBaseline() const { return nFormulaBaseline; } + // <-- }; diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 4601b2f84fec..f307aad39c77 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -760,7 +760,7 @@ void SmTableNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) } Point aPos; - SmRect::operator = (SmRect(nMaxWidth, 0)); + SmRect::operator = (SmRect(nMaxWidth, 1)); for (i = 0; i < nSize; i++) { if (NULL != (pNode = GetSubNode(i))) { const SmRect &rNodeRect = pNode->GetRect(); @@ -776,6 +776,22 @@ void SmTableNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) ExtendBy(rNodeRect, nSize > 1 ? RCP_NONE : RCP_ARG); } } + // --> 4.7.2010 i#972 + if (HasBaseline()) + nFormulaBaseline = GetBaseline(); + else + { + SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE); + aTmpDev.SetFont(GetFont()); + + SmRect aRect = (SmRect(aTmpDev, &rFormat, C2S("a"), + GetFont().GetBorderWidth())); + nFormulaBaseline = GetAlignM(); + // move from middle position by constant - distance + // between middle and baseline for single letter + nFormulaBaseline+= aRect.GetBaseline() - aRect.GetAlignM(); + } + // <-- } @@ -815,20 +831,21 @@ void SmLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE); aTmpDev.SetFont(GetFont()); - // provide an empty rectangle with alignment parameters for the "current" - // font (in order to make "a^1 {}_2^3 a_4" work correct, that is, have the - // same sub-/supscript positions.) - //! be sure to use a character that has explicitly defined HiAttribut - //! line in rect.cxx such as 'a' in order to make 'vec a' look same to - //! 'vec {a}'. - SmRect::operator = (SmRect(aTmpDev, &rFormat, C2S("a"), - GetFont().GetBorderWidth())); - // make sure that the rectangle occupies (almost) no space - SetWidth(1); - SetItalicSpaces(0, 0); - if (nSize < 1) + { + // provide an empty rectangle with alignment parameters for the "current" + // font (in order to make "a^1 {}_2^3 a_4" work correct, that is, have the + // same sub-/supscript positions.) + //! be sure to use a character that has explicitly defined HiAttribut + //! line in rect.cxx such as 'a' in order to make 'vec a' look same to + //! 'vec {a}'. + SmRect::operator = (SmRect(aTmpDev, &rFormat, C2S("a"), + GetFont().GetBorderWidth())); + // make sure that the rectangle occupies (almost) no space + SetWidth(1); + SetItalicSpaces(0, 0); return; + } // make distance depend on font size long nDist = (rFormat.GetDistance(DIS_HORIZONTAL) * GetFont().GetSize().Height()) / 100L; @@ -836,7 +853,11 @@ void SmLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) nDist = 0; Point aPos; - for (i = 0; i < nSize; i++) + // copy the first node into LineNode and extend by the others + if (NULL != (pNode = GetSubNode(0))) + SmRect::operator = (pNode->GetRect()); + + for (i = 1; i < nSize; i++) if (NULL != (pNode = GetSubNode(i))) { aPos = pNode->AlignTo(*this, RP_RIGHT, RHA_CENTER, RVA_BASELINE); diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 013831f6e44e..5fb846ddf101 100755..100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -237,7 +237,8 @@ enum SmModelPropertyHandles // --> PB 2004-08-25 #i33095# Security Options HANDLE_LOAD_READONLY, // <-- - HANDLE_DIALOG_LIBRARIES // #i73329# + HANDLE_DIALOG_LIBRARIES, // #i73329# + HANDLE_BASELINE // 3.7.2010 i#972 }; PropertySetInfo * lcl_createModelPropertyInfo () @@ -308,6 +309,9 @@ PropertySetInfo * lcl_createModelPropertyInfo () // --> PB 2004-08-25 #i33095# Security Options { RTL_CONSTASCII_STRINGPARAM( "LoadReadonly" ), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), PROPERTY_NONE, 0 }, // <-- + // --> 3.7.2010 i#972 + { RTL_CONSTASCII_STRINGPARAM( "BaseLine"), HANDLE_BASELINE, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, + // <-- { NULL, 0, 0, NULL, 0, 0 } }; PropertySetInfo *pInfo = new PropertySetInfo ( aModelPropertyInfoMap ); @@ -939,6 +943,13 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu break; } // <-- + // --> 3.7.2010 #i972 + case HANDLE_BASELINE: + { + *pValue <<= (sal_Int16)pDocSh->pTree->GetFormulaBaseline(); + } + break; + // <-- } } } |