diff options
-rw-r--r-- | sw/qa/extras/layout/data/tdf158658c.rtf | 26 | ||||
-rw-r--r-- | sw/qa/extras/layout/layout3.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/text/portab.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/txttab.cxx | 9 |
4 files changed, 54 insertions, 5 deletions
diff --git a/sw/qa/extras/layout/data/tdf158658c.rtf b/sw/qa/extras/layout/data/tdf158658c.rtf new file mode 100644 index 000000000000..4148eb6d9a51 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf158658c.rtf @@ -0,0 +1,26 @@ +{\rtf1\adeflang1025\ansi\ansicpg1250\uc1\adeff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1038\deflangfe1038\themelang1038\themelangfe0\themelangcs0
+{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2 Times New Roman;}
+{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2 Calibri;}
+{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2 Times New Roman;}
+}
+{\*\defchp \f31506\fs22\lang1038\langfe1033\langfenp1033 }{\*\defpap \ql \li0\ri0\sa160\sl259\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote
+{\stylesheet{\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025
+\ltrch\fcs0 \f31506\fs22\lang1038\langfe1033\cgrid\langnp1038\langfenp1033 \snext0 \sqformat \spriority0 Normal;}
+{\s15\ql \li0\ri0\widctlpar\tqc\tx4513\tqr\tx9026\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1038\langfe1033\cgrid\langnp1038\langfenp1033
+\sbasedon0 \snext15 \slink16 \sunhideused header;}}
+\paperw11906\paperh16838\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\deftab708\widowctrl\ftnbj\aenddoc\hyphhotz425\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0
+\showxmlerrors1\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1
+\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
+\asianbrkrule\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0
+\nofeaturethrottle1\ilfomacatclnup0
+\ltrpar \sectd \ltrsect\linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\headerr \ltrpar \pard\plain \ltrpar\s15\ql \li0\ri0\widctlpar
+\tqc\tx4513\tqr\tx9026\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1038\langfe1033\cgrid\langnp1038\langfenp1033 {\rtlch\fcs1 \af31507 \ltrch\fcs0 Hello
+\tab World\tab Here come some tabs:\tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \tab
+\par }}
+\pard\plain \ltrpar\ql \li0\ri0\sa160\sl259\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1038\langfe1033\cgrid\langnp1038\langfenp1033 {\rtlch\fcs1 \af31507 \ltrch\fcs0 Main body here}{
+\rtlch\fcs1 \af31507 \ltrch\fcs0
+\par }
+}
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index a7358bf45397..916747e6fecd 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -584,6 +584,28 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658b) 0); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658c) +{ + createSwDoc("tdf158658c.rtf"); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + + // Word 2013 puts all tabs into one line, the last 17 of them are off the page + assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout"_ostr, 1); + assertXPath( + pXmlDoc, + "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabCenter']"_ostr, + 1); + // the right tab is exactly at the margin of the paragraph + assertXPath( + pXmlDoc, + "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']"_ostr, + 1); + assertXPath( + pXmlDoc, + "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabLeft']"_ostr, + 20); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf155177) { createSwDoc("tdf155177-1-min.odt"); diff --git a/sw/source/core/text/portab.hxx b/sw/source/core/text/portab.hxx index a37ef06c5d35..a1552afeffc2 100644 --- a/sw/source/core/text/portab.hxx +++ b/sw/source/core/text/portab.hxx @@ -27,7 +27,7 @@ class SwTabPortion : public SwFixPortion const bool m_bAutoTabStop; // Format() branches either into PreFormat() or PostFormat() - bool PreFormat( SwTextFormatInfo &rInf ); + bool PreFormat(SwTextFormatInfo &rInf, SwTabPortion const*); public: SwTabPortion(const SwTwips nTabPos, const sal_Unicode cFill, const bool bAutoTab = true); virtual void Paint( const SwTextPaintInfo &rInf ) const override; diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 81d9e05079b5..19ec92c6425b 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -345,7 +345,7 @@ bool SwTabPortion::Format( SwTextFormatInfo &rInf ) return PostFormat( rInf ); if( pLastTab ) pLastTab->PostFormat( rInf ); - return PreFormat( rInf ); + return PreFormat(rInf, pLastTab); } void SwTabPortion::FormatEOL( SwTextFormatInfo &rInf ) @@ -354,7 +354,7 @@ void SwTabPortion::FormatEOL( SwTextFormatInfo &rInf ) PostFormat( rInf ); } -bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf ) +bool SwTabPortion::PreFormat(SwTextFormatInfo &rInf, SwTabPortion const*const pLastTab) { OSL_ENSURE( rInf.X() <= GetTabPos(), "SwTabPortion::PreFormat: rush hour" ); @@ -396,7 +396,8 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf ) // 1. Minimal width does not fit to line anymore. // 2. An underflow event was called for the tab portion. bool bFull = ( bTabCompat && rInf.IsUnderflow() ) || - ( rInf.Width() <= rInf.X() + PrtWidth() && rInf.X() <= rInf.Width() ) ; + (rInf.Width() <= rInf.X() + PrtWidth() && rInf.X() <= rInf.Width() + && (!bTabOverMargin || !pLastTab)); // #95477# Rotated tab stops get the width of one blank const Degree10 nDir = rInf.GetFont()->GetOrientation( rInf.GetTextFrame()->IsVertical() ); @@ -420,7 +421,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf ) { // handle this case in PostFormat if ((bTabOverMargin || bTabOverSpacing) && GetTabPos() > rInf.Width() - && (!m_bAutoTabStop || rInf.X() > rInf.Width())) + && (!m_bAutoTabStop || rInf.Width() <= rInf.X())) { if (bTabOverMargin || GetTabPos() < nTextFrameWidth) { |