summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-07-11 14:29:36 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-05-18 16:03:29 +0200
commitcc606aa0a0441ace76c553eb5b61a30fab5f9776 (patch)
tree5d6f68dd13cab67baee4a3efdddcf1581fe886d3 /sw
parentf30585abfe198914511df004ac712f0e066cf0b9 (diff)
tdf#118672 sw layout, TabOverMargin: allow using the area over the tab portion
TabOverMargin in general is about allowing the cursor to jump over a margin if there is an explicit tab stop there. A corner-case is what to do when there is enough content so a line break is necessary for the characters after the tab portion. Allow using the area up to the edge of the whole text frame (i.e. over the tab position), this matches what Word does. (cherry picked from commit 4b345f95ce7cb09011892bf465cfdf3811adaf8e) Conflicts: sw/qa/extras/layout/layout.cxx sw/source/core/text/inftxt.cxx sw/source/core/text/xmldump.cxx [ Just the sw layout xml dump part. ] Change-Id: Ie86edf030d54fba556eee26e7ea563fb8d4fbee4
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/xmldump.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 379a8bc46e3e..f6f88b038798 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -32,6 +32,8 @@ class XmlPortionDumper:public SwPortionHandler
private:
xmlTextWriterPtr writer;
sal_Int32 ofs;
+ const OUString& m_rText;
+ OUString m_aLine;
static const char* getTypeName( sal_uInt16 nType )
{
@@ -105,7 +107,7 @@ class XmlPortionDumper:public SwPortionHandler
public:
- explicit XmlPortionDumper( xmlTextWriterPtr some_writer ):writer( some_writer ), ofs( 0 )
+ explicit XmlPortionDumper( xmlTextWriterPtr some_writer, const OUString& rText ):writer( some_writer ), ofs( 0 ), m_rText(rText)
{
}
@@ -120,7 +122,6 @@ class XmlPortionDumper:public SwPortionHandler
sal_Int32 nHeight,
sal_Int32 nWidth) override
{
- ofs += nLength;
xmlTextWriterStartElement( writer, BAD_CAST( "Text" ) );
xmlTextWriterWriteFormatAttribute( writer,
BAD_CAST( "nLength" ),
@@ -132,8 +133,13 @@ class XmlPortionDumper:public SwPortionHandler
xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("nHeight"), "%i", (int)nHeight);
if (nWidth > 0)
xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("nWidth"), "%i", (int)nWidth);
+ if (nLength > 0)
+ xmlTextWriterWriteAttribute(writer, BAD_CAST("Portion"),
+ BAD_CAST(m_rText.copy(ofs, nLength).toUtf8().getStr()));
xmlTextWriterEndElement( writer );
+ m_aLine += m_rText.copy(ofs, nLength);
+ ofs += nLength;
}
/**
@@ -174,6 +180,7 @@ class XmlPortionDumper:public SwPortionHandler
pFont->dumpAsXml(writer);
xmlTextWriterEndElement( writer );
+ m_aLine += rText;
ofs += nLength;
}
@@ -184,6 +191,12 @@ class XmlPortionDumper:public SwPortionHandler
xmlTextWriterWriteFormatAttribute( writer,
BAD_CAST( "nWidth" ),
"%i", ( int ) nWidth );
+ if (!m_aLine.isEmpty())
+ {
+ xmlTextWriterWriteAttribute(writer, BAD_CAST("Line"),
+ BAD_CAST(m_aLine.toUtf8().getStr()));
+ m_aLine.clear();
+ }
xmlTextWriterEndElement( writer );
}
@@ -348,7 +361,7 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const
RTL_TEXTENCODING_UTF8 );
xmlTextWriterWriteString( writer,
reinterpret_cast<const xmlChar *>(aText8.getStr( )) );
- XmlPortionDumper pdumper( writer );
+ XmlPortionDumper pdumper( writer, aText );
pTextFrame->VisitPortions( pdumper );
}