[Libreoffice-commits] core.git: 4 commits - svtools/source sw/source
Michael Stahl
mstahl at redhat.com
Thu Feb 20 01:01:15 CET 2014
svtools/source/svhtml/parhtml.cxx | 12 +
sw/source/core/layout/paintfrm.cxx | 257 ++++++++++++++++++-------------------
2 files changed, 137 insertions(+), 132 deletions(-)
New commits:
commit 22b709e84a7b6d38cab2dd37f2f2b28e0fc9d062
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Feb 19 22:01:47 2014 +0100
unindent SwTabFrmPainter::PaintLines a little
Change-Id: I1602bd62bf970092ecffba579d428fadaf8574cc
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 81d7cbc..f9f2d23 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2405,7 +2405,7 @@ void SwTabFrmPainter::HandleFrame( const SwLayoutFrm& rLayoutFrm )
}
}
-void SwTabFrmPainter::PaintLines( OutputDevice& rDev, const SwRect& rRect ) const
+void SwTabFrmPainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) const
{
// #i16816# tagged pdf support
SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, rDev );
@@ -2496,141 +2496,141 @@ void SwTabFrmPainter::PaintLines( OutputDevice& rDev, const SwRect& rRect ) cons
aRepaintRect.Pos().X() -= nRepaintRectSize;
}
- if ( rRect.IsOver( aRepaintRect ) )
+ if (!rRect.IsOver(aRepaintRect))
{
- svx::frame::Style aStyles[ 7 ];
- aStyles[ 0 ] = rEntryStyle;
- FindStylesForLine( aStart, aEnd, aStyles, bHori );
+ continue;
+ }
- // subsidiary lines
- const Color* pTmpColor = 0;
- if ( 0 == aStyles[ 0 ].GetWidth() )
- {
- if ( IS_SUBS_TABLE && pGlobalShell->GetWin() )
- aStyles[ 0 ].Set( rCol, rCol, rCol, false, 1, 0, 0 );
- }
- else
- pTmpColor = pHCColor;
+ svx::frame::Style aStyles[ 7 ];
+ aStyles[ 0 ] = rEntryStyle;
+ FindStylesForLine( aStart, aEnd, aStyles, bHori );
- // The line sizes stored in the line style have to be adjusted as well.
- // This will guarantee that lines with the same twip size will have the
- // same pixel size.
- for ( int i = 0; i < 7; ++i )
- {
- sal_uInt16 nPrim = aStyles[ i ].Prim();
- sal_uInt16 nDist = aStyles[ i ].Dist();
- sal_uInt16 nSecn = aStyles[ i ].Secn();
-
- if ( nPrim > 0 )
- nPrim = (sal_uInt16)( std::max( 1L, nPixelSzH * ( nPrim / nPixelSzH ) ) );
- if ( nDist > 0 )
- nDist = (sal_uInt16)( std::max( 1L, nPixelSzH * ( nDist / nPixelSzH ) ) );
- if ( nSecn > 0 )
- nSecn = (sal_uInt16)( std::max( 1L, nPixelSzH * ( nSecn / nPixelSzH ) ) );
-
- aStyles[ i ].Set( nPrim, nDist, nSecn );
- }
+ // subsidiary lines
+ const Color* pTmpColor = 0;
+ if (0 == aStyles[ 0 ].GetWidth())
+ {
+ if (IS_SUBS_TABLE && pGlobalShell->GetWin())
+ aStyles[ 0 ].Set( rCol, rCol, rCol, false, 1, 0, 0 );
+ }
+ else
+ pTmpColor = pHCColor;
- // The (twip) positions will be adjusted to meet these requirements:
- // 1. The y coordinates are located in the middle of the pixel grid
- // 2. The x coordinated are located at the beginning of the pixel grid
- // This is done, because the horizontal lines are painted "at beginning",
- // whereas the vertical lines are painted "centered". By making the line
- // sizes a multiple of one pixel size, we can assure, that all lines having
- // the same twip size have the same pixel size, independent of their position
- // on the screen.
- Point aPaintStart = rDev.PixelToLogic( rDev.LogicToPixel( aStart ) );
- Point aPaintEnd = rDev.PixelToLogic( rDev.LogicToPixel( aEnd ) );
-
- if( pGlobalShell->GetWin() )
- {
- // The table borders do not use SwAlignRect, but all the other frames do.
- // Therefore we tweak the outer borders a bit to achieve that the outer
- // borders match the subsidiary lines of the upper:
- if ( aStart.X() == aUpper.Left() )
- aPaintStart.X() = aUpperAligned.Left();
- else if ( aStart.X() == aUpper._Right() )
- aPaintStart.X() = aUpperAligned._Right();
- if ( aStart.Y() == aUpper.Top() )
- aPaintStart.Y() = aUpperAligned.Top();
- else if ( aStart.Y() == aUpper._Bottom() )
- aPaintStart.Y() = aUpperAligned._Bottom();
-
- if ( aEnd.X() == aUpper.Left() )
- aPaintEnd.X() = aUpperAligned.Left();
- else if ( aEnd.X() == aUpper._Right() )
- aPaintEnd.X() = aUpperAligned._Right();
- if ( aEnd.Y() == aUpper.Top() )
- aPaintEnd.Y() = aUpperAligned.Top();
- else if ( aEnd.Y() == aUpper._Bottom() )
- aPaintEnd.Y() = aUpperAligned._Bottom();
- }
+ // The line sizes stored in the line style have to be adjusted as
+ // well. This will guarantee that lines with the same twip size
+ // will have the same pixel size.
+ for ( int i = 0; i < 7; ++i )
+ {
+ sal_uInt16 nPrim = aStyles[ i ].Prim();
+ sal_uInt16 nDist = aStyles[ i ].Dist();
+ sal_uInt16 nSecn = aStyles[ i ].Secn();
+
+ if (nPrim > 0)
+ nPrim = (sal_uInt16)( std::max( 1L, nPixelSzH * ( nPrim / nPixelSzH ) ) );
+ if (nDist > 0)
+ nDist = (sal_uInt16)( std::max( 1L, nPixelSzH * ( nDist / nPixelSzH ) ) );
+ if (nSecn > 0)
+ nSecn = (sal_uInt16)( std::max( 1L, nPixelSzH * ( nSecn / nPixelSzH ) ) );
+
+ aStyles[ i ].Set( nPrim, nDist, nSecn );
+ }
- // logically vertical lines are painted centered on the line,
- // logically horizontal lines are painted "below" the line
- bool const isBelow((mrTabFrm.IsVertical()) ? !bHori : bHori);
- double const offsetStart = (isBelow)
- ? aStyles[0].GetWidth() / 2.0
- : std::max<double>(aStyles[1].GetWidth(),
- aStyles[3].GetWidth()) / 2.0;
- double const offsetEnd = (isBelow)
- ? aStyles[0].GetWidth() / 2.0
- : std::max<double>(aStyles[4].GetWidth(),
- aStyles[6].GetWidth()) / 2.0;
- if (mrTabFrm.IsVertical())
- {
- aPaintStart.X() -= static_cast<long>(offsetStart + 0.5);
- aPaintEnd.X() -= static_cast<long>(offsetEnd + 0.5);
- }
- else
- {
- aPaintStart.Y() += static_cast<long>(offsetStart + 0.5);
- aPaintEnd.Y() += static_cast<long>(offsetEnd + 0.5);
- }
+ // The (twip) positions will be adjusted to meet these requirements:
+ // 1. The y coordinates are located in the middle of the pixel grid
+ // 2. The x coordinated are located at the beginning of the pixel grid
+ // This is done, because the horizontal lines are painted "at
+ // beginning", whereas the vertical lines are painted "centered".
+ // By making the line sizes a multiple of one pixel size, we can
+ // assure that all lines having the same twip size have the same
+ // pixel size, independent of their position on the screen.
+ Point aPaintStart = rDev.PixelToLogic( rDev.LogicToPixel(aStart) );
+ Point aPaintEnd = rDev.PixelToLogic( rDev.LogicToPixel(aEnd) );
+
+ if (pGlobalShell->GetWin())
+ {
+ // The table borders do not use SwAlignRect, but all the other frames do.
+ // Therefore we tweak the outer borders a bit to achieve that the outer
+ // borders match the subsidiary lines of the upper:
+ if (aStart.X() == aUpper.Left())
+ aPaintStart.X() = aUpperAligned.Left();
+ else if (aStart.X() == aUpper._Right())
+ aPaintStart.X() = aUpperAligned._Right();
+ if (aStart.Y() == aUpper.Top())
+ aPaintStart.Y() = aUpperAligned.Top();
+ else if (aStart.Y() == aUpper._Bottom())
+ aPaintStart.Y() = aUpperAligned._Bottom();
+
+ if (aEnd.X() == aUpper.Left())
+ aPaintEnd.X() = aUpperAligned.Left();
+ else if (aEnd.X() == aUpper._Right())
+ aPaintEnd.X() = aUpperAligned._Right();
+ if (aEnd.Y() == aUpper.Top())
+ aPaintEnd.Y() = aUpperAligned.Top();
+ else if (aEnd.Y() == aUpper._Bottom())
+ aPaintEnd.Y() = aUpperAligned._Bottom();
+ }
- aPaintStart.X() -= nTwipXCorr; // nHalfPixelSzW - 2 to assure that we do not leave the pixel
- aPaintEnd.X() -= nTwipXCorr;
- aPaintStart.Y() -= nTwipYCorr;
- aPaintEnd.Y() -= nTwipYCorr;
+ // logically vertical lines are painted centered on the line,
+ // logically horizontal lines are painted "below" the line
+ bool const isBelow((mrTabFrm.IsVertical()) ? !bHori : bHori);
+ double const offsetStart = (isBelow)
+ ? aStyles[0].GetWidth() / 2.0
+ : std::max<double>(aStyles[1].GetWidth(),
+ aStyles[3].GetWidth()) / 2.0;
+ double const offsetEnd = (isBelow)
+ ? aStyles[0].GetWidth() / 2.0
+ : std::max<double>(aStyles[4].GetWidth(),
+ aStyles[6].GetWidth()) / 2.0;
+ if (mrTabFrm.IsVertical())
+ {
+ aPaintStart.X() -= static_cast<long>(offsetStart + 0.5);
+ aPaintEnd.X() -= static_cast<long>(offsetEnd + 0.5);
+ }
+ else
+ {
+ aPaintStart.Y() += static_cast<long>(offsetStart + 0.5);
+ aPaintEnd.Y() += static_cast<long>(offsetEnd + 0.5);
+ }
- if (aStyles[0].Prim() <= 0 && aStyles[0].Secn() <= 0)
- {
- continue; // fdo#75118 do not paint zero-width lines
- }
+ aPaintStart.X() -= nTwipXCorr; // nHalfPixelSzW - 2 to assure that we do not leave the pixel
+ aPaintEnd.X() -= nTwipXCorr;
+ aPaintStart.Y() -= nTwipYCorr;
+ aPaintEnd.Y() -= nTwipYCorr;
- // Here comes the painting stuff: Thank you, DR, great job!!!
- if ( bHori )
- {
- mrTabFrm.ProcessPrimitives( svx::frame::CreateBorderPrimitives(
- aPaintStart,
- aPaintEnd,
- aStyles[ 0 ], // current style
- aStyles[ 1 ], // aLFromT
- aStyles[ 2 ], // aLFromL
- aStyles[ 3 ], // aLFromB
- aStyles[ 4 ], // aRFromT
- aStyles[ 5 ], // aRFromR
- aStyles[ 6 ], // aRFromB
- pTmpColor
- )
- );
- }
- else
- {
- mrTabFrm.ProcessPrimitives( svx::frame::CreateBorderPrimitives(
- aPaintEnd,
- aPaintStart,
- aStyles[ 0 ], // current style
- aStyles[ 4 ], // aBFromL
- aStyles[ 5 ], // aBFromB
- aStyles[ 6 ], // aBFromR
- aStyles[ 1 ], // aTFromL
- aStyles[ 2 ], // aTFromT
- aStyles[ 3 ], // aTFromR
- pTmpColor
- )
- );
- }
+ if (aStyles[0].Prim() <= 0 && aStyles[0].Secn() <= 0)
+ {
+ continue; // fdo#75118 do not paint zero-width lines
+ }
+
+ // Here comes the painting stuff: Thank you, DR, great job!!!
+ if (bHori)
+ {
+ mrTabFrm.ProcessPrimitives( svx::frame::CreateBorderPrimitives(
+ aPaintStart,
+ aPaintEnd,
+ aStyles[ 0 ], // current style
+ aStyles[ 1 ], // aLFromT
+ aStyles[ 2 ], // aLFromL
+ aStyles[ 3 ], // aLFromB
+ aStyles[ 4 ], // aRFromT
+ aStyles[ 5 ], // aRFromR
+ aStyles[ 6 ], // aRFromB
+ pTmpColor)
+ );
+ }
+ else
+ {
+ mrTabFrm.ProcessPrimitives( svx::frame::CreateBorderPrimitives(
+ aPaintEnd,
+ aPaintStart,
+ aStyles[ 0 ], // current style
+ aStyles[ 4 ], // aBFromL
+ aStyles[ 5 ], // aBFromB
+ aStyles[ 6 ], // aBFromR
+ aStyles[ 1 ], // aTFromL
+ aStyles[ 2 ], // aTFromT
+ aStyles[ 3 ], // aTFromR
+ pTmpColor)
+ );
}
}
commit 128d3d51c208ec5c37a105ea5c751530bd017d4b
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Feb 19 21:46:11 2014 +0100
fdo#75118: sw: do not paint zero-width lines
Since commit 6a3fb868b2b8af21f7b6140424b6f8377599a786 zero-width
BorderLinePrimitive2D will actually be painted as hairlines by
VclPixelProcessor2D::tryDrawBorderLinePrimitive2DDirect(), so don't
create such pointless primitives.
Change-Id: I4c2404b73f106156b83a6d72efa3c8991e5d659e
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 3d6aa4f..81d7cbc 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2459,8 +2459,8 @@ void SwTabFrmPainter::PaintLines( OutputDevice& rDev, const SwRect& rRect ) cons
break;
const SwLineEntrySet& rEntrySet = (*aIter).second;
- SwLineEntrySetConstIter aSetIter = rEntrySet.begin();
- while ( aSetIter != rEntrySet.end() )
+ for (SwLineEntrySetConstIter aSetIter = rEntrySet.begin();
+ aSetIter != rEntrySet.end(); ++aSetIter)
{
const SwLineEntry& rEntry = *aSetIter;
const svx::frame::Style& rEntryStyle( (*aSetIter).maAttribute );
@@ -2593,6 +2593,11 @@ void SwTabFrmPainter::PaintLines( OutputDevice& rDev, const SwRect& rRect ) cons
aPaintStart.Y() -= nTwipYCorr;
aPaintEnd.Y() -= nTwipYCorr;
+ if (aStyles[0].Prim() <= 0 && aStyles[0].Secn() <= 0)
+ {
+ continue; // fdo#75118 do not paint zero-width lines
+ }
+
// Here comes the painting stuff: Thank you, DR, great job!!!
if ( bHori )
{
@@ -2627,8 +2632,6 @@ void SwTabFrmPainter::PaintLines( OutputDevice& rDev, const SwRect& rRect ) cons
);
}
}
-
- ++aSetIter;
}
++aIter;
commit 3c84fa61570113d1dfb2523ab88f268eeeb46c3c
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Feb 20 00:37:12 2014 +0100
fdo#74584: Revert "fix html tests"
This reverts commit 277922e7a0a4ae8076c10936c4b12df6dcc5ddac.
...since 73e3aafa990168aa532fa7b81fc4de8f455b10e1 was reverted and
sw_htmlexport test fails.
Change-Id: I32a390a3058e43bc3314b678e27c74036b90f200
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 08ec21a..a941a06 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -881,7 +881,7 @@ int HTMLParser::_GetNextRawToken()
}
OUString aTok( sTmpBuffer.toString() );
- aTok = aTok.toAsciiLowerCase();
+ aTok = aTok.toAsciiUpperCase();
bool bDone = false;
if( bReadScript || !aEndToken.isEmpty() )
{
@@ -1126,7 +1126,7 @@ int HTMLParser::_GetNextToken()
// Search token in table:
sSaveToken = aToken;
- aToken = aToken.toAsciiLowerCase();
+ aToken = aToken.toAsciiUpperCase();
if( 0 == (nRet = GetHTMLToken( aToken )) )
// Unknown control
nRet = HTML_UNKNOWNCONTROL_ON;
@@ -1913,7 +1913,7 @@ bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader,
sCmp = pHeader;
}
- sCmp = sCmp.toAsciiLowerCase();
+ sCmp = sCmp.toAsciiUpperCase();
// A HTML document must have a '<' in the first line
sal_Int32 nStart = sCmp.indexOf('<');
commit 96a1f60aeb2a7954533da9b4aa4947efb7a65e70
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Feb 20 00:36:57 2014 +0100
fdo#74584: Revert "html: Options need to be lowercase, too"
This reverts commit 700883b34ebcdb77f398b4423f358bdf4648a853.
...since 73e3aafa990168aa532fa7b81fc4de8f455b10e1 was reverted and
sw_htmlexport test fails.
Change-Id: Ia83705279e792a0c2375619b6a209e46a319fea7
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 6517e5c..08ec21a 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1462,8 +1462,10 @@ const HTMLOptions& HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken )
OUString sName( aToken.copy( nStt, nPos-nStt ) );
- // PlugIns require original token name. Convert to lower case only for searching.
- nToken = GetHTMLOption( sName.toAsciiLowerCase() ); // Name is ready
+ // PlugIns require original token name. Convert to upper case only for searching.
+ OUString sNameUpperCase( sName.toAsciiUpperCase() );
+
+ nToken = GetHTMLOption( sNameUpperCase ); // Name is ready
DBG_ASSERTWARNING( nToken!=HTML_O_UNKNOWN,
"GetOption: unknown HTML option" );
bool bStripCRLF = (nToken < HTML_OPTION_SCRIPT_START ||
More information about the Libreoffice-commits
mailing list