diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-11-19 19:02:07 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-11-19 19:18:14 +0100 |
commit | 37f613c6eae5ee7e221cecf92ce321622d3cf4a8 (patch) | |
tree | 876a45c875873a4a4bc951a4e16e245a00d72b44 | |
parent | 64ce79ff5eab8fe686c13c0ad676ad7f941a346f (diff) |
sw: include the font of SwNumberPortions in layout dump
Change-Id: I3d015c7a97ace6db548c4ad11ae24b0a7daa35c5
-rw-r--r-- | sw/source/core/access/accportions.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/access/accportions.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/inc/SwPortionHandler.hxx | 7 | ||||
-rw-r--r-- | sw/source/core/inc/swfont.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/text/porfld.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/text/xmldump.cxx | 14 |
6 files changed, 28 insertions, 6 deletions
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx index b5ccaae44ed3..c997d9e4da6a 100644 --- a/sw/source/core/access/accportions.cxx +++ b/sw/source/core/access/accportions.cxx @@ -135,7 +135,7 @@ void SwAccessiblePortionData::SetAttrFieldType( sal_uInt16 nAttrFldType ) } void SwAccessiblePortionData::Special( - sal_Int32 nLength, const OUString& rText, sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/) + sal_Int32 nLength, const OUString& rText, sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/, const SwFont* /*pFont*/) { OSL_ENSURE( nModelPosition >= 0, "illegal position" ); OSL_ENSURE( (nModelPosition + nLength) <= pTxtNode->GetTxt().getLength(), diff --git a/sw/source/core/access/accportions.hxx b/sw/source/core/access/accportions.hxx index 491afee051b7..e99cf8f298cf 100644 --- a/sw/source/core/access/accportions.hxx +++ b/sw/source/core/access/accportions.hxx @@ -98,7 +98,7 @@ public: // SwPortionHandler methods virtual void Text(sal_Int32 nLength, sal_uInt16 nType, sal_Int32 nHeight = 0, sal_Int32 nWidth = 0) SAL_OVERRIDE; - virtual void Special(sal_Int32 nLength, const OUString& rText, sal_uInt16 nType, sal_Int32 nHeight = 0, sal_Int32 nWidth = 0) SAL_OVERRIDE; + virtual void Special(sal_Int32 nLength, const OUString& rText, sal_uInt16 nType, sal_Int32 nHeight = 0, sal_Int32 nWidth = 0, const SwFont* pFont = 0) SAL_OVERRIDE; virtual void LineBreak(sal_Int32 nWidth) SAL_OVERRIDE; virtual void Skip(sal_Int32 nLength) SAL_OVERRIDE; virtual void Finish() SAL_OVERRIDE; diff --git a/sw/source/core/inc/SwPortionHandler.hxx b/sw/source/core/inc/SwPortionHandler.hxx index 8d04b199b764..3b76564a4cdf 100644 --- a/sw/source/core/inc/SwPortionHandler.hxx +++ b/sw/source/core/inc/SwPortionHandler.hxx @@ -22,6 +22,8 @@ #include <swtypes.hxx> +class SwFont; + /** The SwPortionHandler interface implements a visitor for the layout * engine's text portions. This can be used to gather information of * the on-screen representation of a single paragraph. @@ -35,7 +37,7 @@ * held by the corresponding SwTxtNode. * * The SwPortionHandler can be used with the - * SwTextFrame::VisitPortions(...) method. + * SwTxtFrm::VisitPortions(...) method. */ class SwPortionHandler { @@ -68,7 +70,8 @@ public: const OUString& rText, /// text which is painted on-screen sal_uInt16 nType, /// type of this portion sal_Int32 nHeight = 0, /// font height of the painted text - sal_Int32 nWidth = 0 /// width of this portion + sal_Int32 nWidth = 0, /// width of this portion + const SwFont* pFont = 0 /// font of this portion ) = 0; /** line break. This method is called whenever a line break in the diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx index fa1d7180d85c..b01ba5e64b61 100644 --- a/sw/source/core/inc/swfont.hxx +++ b/sw/source/core/inc/swfont.hxx @@ -36,6 +36,7 @@ class SwDrawTextInfo; // _DrawText class SwScriptInfo; // _GetTxtSize class SwViewShell; class IDocumentSettingAccess; +typedef struct _xmlTextWriter *xmlTextWriterPtr; const sal_Unicode CH_BLANK = ' '; // ' ' blank spaces const sal_Unicode CH_BREAK = 0x0A; @@ -449,6 +450,8 @@ public: sal_uInt16 CalcShadowSpace( const sal_uInt16 nShadow, const bool bVertLayout, const bool bSkipLeft, const bool bSkipRight ) const; + + void dumpAsXml( xmlTextWriterPtr writer = NULL ) const; }; inline void SwFont::SetColor( const Color& rColor ) diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 5ee2d1f5c2e8..997d975ab1bd 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -445,9 +445,13 @@ bool SwFldPortion::GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const void SwFldPortion::HandlePortion( SwPortionHandler& rPH ) const { sal_Int32 nH = 0; + sal_Int32 nW = 0; if (pFnt) + { nH = pFnt->GetSize(pFnt->GetActual()).Height(); - rPH.Special( GetLen(), aExpand, GetWhichPor(), nH ); + nW = pFnt->GetSize(pFnt->GetActual()).Width(); + } + rPH.Special( GetLen(), aExpand, GetWhichPor(), nH, nW, pFnt ); if( GetWhichPor() == POR_FLD ) { rPH.SetAttrFieldType(m_nAttrFldType); diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index 4365487d5d62..17ba86b72b58 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -150,7 +150,8 @@ class XmlPortionDumper:public SwPortionHandler const OUString & rText, sal_uInt16 nType, sal_Int32 nHeight, - sal_Int32 nWidth ) SAL_OVERRIDE + sal_Int32 nWidth, + const SwFont* pFont ) SAL_OVERRIDE { xmlTextWriterStartElement( writer, BAD_CAST( "Special" ) ); xmlTextWriterWriteFormatAttribute( writer, @@ -171,6 +172,9 @@ class XmlPortionDumper:public SwPortionHandler if (nWidth > 0) xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("nWidth"), "%i", (int)nWidth); + if (pFont) + pFont->dumpAsXml(writer); + xmlTextWriterEndElement( writer ); ofs += nLength; } @@ -432,6 +436,14 @@ void SwAnchoredObject::dumpAsXml( xmlTextWriterPtr writer ) const lcl_freeWriter( writer ); } +void SwFont::dumpAsXml(xmlTextWriterPtr writer) const +{ + xmlTextWriterStartElement(writer, BAD_CAST("pFont")); + xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("ptr"), "%p", this); + xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("color"), "%s", const_cast<Color&>(GetColor()).AsRGBHexString().toUtf8().getStr()); + xmlTextWriterEndElement(writer); +} + void SwTxtFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer ) const { SwFrm::dumpAsXmlAttributes( writer ); |