Modified: openoffice/branches/l10n40/main/vcl/win/source/gdi/salgdi.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/win/source/gdi/salgdi.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/main/vcl/win/source/gdi/salgdi.cxx (original) +++ openoffice/branches/l10n40/main/vcl/win/source/gdi/salgdi.cxx Fri Sep 27 15:26:24 2013 @@ -26,20 +26,18 @@ #include <stdio.h> #include <string.h> - #include <rtl/strbuf.hxx> - #include <tools/svwin.h> #include <tools/debug.hxx> #include <tools/poly.hxx> - #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> - +#include <basegfx/polygon/b2dpolypolygontools.hxx> #include <win/wincomp.hxx> #include <win/saldata.hxx> #include <win/salgdi.h> #include <win/salframe.h> +#include <basegfx/matrix/b2dhommatrixtools.hxx> using namespace rtl; @@ -853,15 +851,47 @@ void WinSalGraphics::ResetClipRegion() bool WinSalGraphics::setClipRegion( const Region& i_rClip ) { - if ( mhRegion ) - { - DeleteRegion( mhRegion ); - mhRegion = 0; - } - - if( i_rClip.HasPolyPolygonOrB2DPolyPolygon() ) - { - const basegfx::B2DPolyPolygon aPolyPolygon( i_rClip.GetAsB2DPolyPolygon() ); + if ( mhRegion ) + { + DeleteRegion( mhRegion ); + mhRegion = 0; + } + + bool bUsePolygon(i_rClip.HasPolyPolygonOrB2DPolyPolygon()); + static bool bTryToAvoidPolygon(true); + + // #122149# try to avoid usage of PolyPolygon ClipRegions when PolyPolygon is no curve + // and only contains horizontal/vertical edges. In that case, use the fallback + // in GetRegionRectangles which will use Region::GetAsRegionBand() which will do + // the correct polygon-to-RegionBand transformation. + // Background is that when using the same Rectangle as rectangle or as Polygon + // clip region will lead to different results; the polygon-based one will be + // one pixel less to the right and down (see GDI docu for CreatePolygonRgn). This + // again is because of the polygon-nature and it's classic handling when filling. + // This also means that all cases which use a 'true' polygon-based incarnation of + // a Region should know what they do - it may lead to repaint errors. + if(bUsePolygon && bTryToAvoidPolygon) + { + const basegfx::B2DPolyPolygon aPolyPolygon( i_rClip.GetAsB2DPolyPolygon() ); + + if(!aPolyPolygon.areControlPointsUsed()) + { + if(basegfx::tools::containsOnlyHorizontalAndVerticalEdges(aPolyPolygon)) + { + bUsePolygon = false; + } + } + } + + if(bUsePolygon) + { + // #122149# check the comment above to know that this may lead to potentioal repaint + // problems. It may be solved (if needed) by scaling the polygon by one in X + // and Y. Currently the workaround to only use it if really unavoidable will + // solve most cases. When someone is really using polygon-based Regions he + // should know what he is doing. + // Added code to do that scaling to check if it works, testing it. + const basegfx::B2DPolyPolygon aPolyPolygon( i_rClip.GetAsB2DPolyPolygon() ); const sal_uInt32 nCount(aPolyPolygon.count()); if( nCount ) @@ -869,21 +899,38 @@ bool WinSalGraphics::setClipRegion( cons std::vector< POINT > aPolyPoints; aPolyPoints.reserve( 1024 ); std::vector< INT > aPolyCounts( nCount, 0 ); - + basegfx::B2DHomMatrix aExpand; + static bool bExpandByOneInXandY(true); + + if(bExpandByOneInXandY) + { + const basegfx::B2DRange aRangeS(aPolyPolygon.getB2DRange()); + const basegfx::B2DRange aRangeT(aRangeS.getMinimum(), aRangeS.getMaximum() + basegfx::B2DTuple(1.0, 1.0)); + aExpand = basegfx::B2DHomMatrix(basegfx::tools::createSourceRangeTargetRangeTransform(aRangeS, aRangeT)); + } + for(sal_uInt32 a(0); a < nCount; a++) { - basegfx::B2DPolygon aPoly(aPolyPolygon.getB2DPolygon(a)); - - aPoly = basegfx::tools::adaptiveSubdivideByDistance( aPoly, 1 ); - const sal_uInt32 nPoints = aPoly.count(); + const basegfx::B2DPolygon aPoly( + basegfx::tools::adaptiveSubdivideByDistance( + aPolyPolygon.getB2DPolygon(a), + 1)); + const sal_uInt32 nPoints(aPoly.count()); aPolyCounts[a] = nPoints; - + for( sal_uInt32 b = 0; b < nPoints; b++ ) { - basegfx::B2DPoint aPt( aPoly.getB2DPoint( b ) ); + basegfx::B2DPoint aPt(aPoly.getB2DPoint(b)); + + if(bExpandByOneInXandY) + { + aPt = aExpand * aPt; + } + POINT aPOINT; - aPOINT.x = (LONG)aPt.getX(); - aPOINT.y = (LONG)aPt.getY(); + // #122149# do correct rounding + aPOINT.x = basegfx::fround(aPt.getX()); + aPOINT.y = basegfx::fround(aPt.getY()); aPolyPoints.push_back( aPOINT ); } } @@ -969,53 +1016,6 @@ bool WinSalGraphics::setClipRegion( cons } } - //ImplRegionInfo aInfo; - //long nX, nY, nW, nH; - //bool bRegionRect = i_rClip.ImplGetFirstRect(aInfo, nX, nY, nW, nH ); - //while( bRegionRect ) - //{ - // if ( nW && nH ) - // { - // long nRight = nX + nW; - // long nBottom = nY + nH; - // - // if ( bFirstClipRect ) - // { - // pBoundRect->left = nX; - // pBoundRect->top = nY; - // pBoundRect->right = nRight; - // pBoundRect->bottom = nBottom; - // bFirstClipRect = false; - // } - // else - // { - // if ( nX < pBoundRect->left ) - // pBoundRect->left = (int)nX; - // - // if ( nY < pBoundRect->top ) - // pBoundRect->top = (int)nY; - // - // if ( nRight > pBoundRect->right ) - // pBoundRect->right = (int)nRight; - // - // if ( nBottom > pBoundRect->bottom ) - // pBoundRect->bottom = (int)nBottom; - // } - // - // pNextClipRect->left = (int)nX; - // pNextClipRect->top = (int)nY; - // pNextClipRect->right = (int)nRight; - // pNextClipRect->bottom = (int)nBottom; - // pNextClipRect++; - // } - // else - // { - // mpClipRgnData->rdh.nCount--; - // mpClipRgnData->rdh.nRgnSize -= sizeof( RECT ); - // } - // bRegionRect = i_rClip.ImplGetNextRect( aInfo, nX, nY, nW, nH ); - //} - // create clip region from ClipRgnData if ( mpClipRgnData->rdh.nCount == 1 ) { @@ -1054,7 +1054,16 @@ bool WinSalGraphics::setClipRegion( cons } if( mhRegion ) - SelectClipRgn( getHDC(), mhRegion ); + { + SelectClipRgn( getHDC(), mhRegion ); + + // debug code if you weant to check range of the newly applied ClipRegion + //RECT aBound; + //const int aRegionType = GetRgnBox(mhRegion, &aBound); + // + //bool bBla = true; + } + return mhRegion != 0; }
Modified: openoffice/branches/l10n40/main/vcl/win/source/gdi/winlayout.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/vcl/win/source/gdi/winlayout.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/main/vcl/win/source/gdi/winlayout.cxx (original) +++ openoffice/branches/l10n40/main/vcl/win/source/gdi/winlayout.cxx Fri Sep 27 15:26:24 2013 @@ -1845,30 +1845,39 @@ int UniscribeLayout::GetNextGlyphs( int nXOffset += mpJustifications[ nStart ] - mpGlyphAdvances[ nStart ]; } - // create mpGlyphs2Chars[] if it is needed later - if( pCharPosAry && !mpGlyphs2Chars ) - { - // create and reset the new array - mpGlyphs2Chars = new int[ mnGlyphCapacity ]; - for( int i = 0; i < mnGlyphCount; ++i ) - mpGlyphs2Chars[i] = -1; - // calculate the char->glyph mapping - for( nItem = 0; nItem < mnItemCount; ++nItem ) - { - // ignore invisible visual items - const VisualItem& rVI = mpVisualItems[ nItem ]; - if( rVI.IsEmpty() ) - continue; - // calculate the mapping by using mpLogClusters[] - // mpGlyphs2Chars[] should obey the logical order - // => reversing the loop does this by overwriting higher logicals - for( c = rVI.mnEndCharPos; --c >= rVI.mnMinCharPos; ) - { - int i = mpLogClusters[c] + rVI.mnMinGlyphPos; - mpGlyphs2Chars[i] = c; - } - } - } + // create mpGlyphs2Chars[] if it is needed later + if( pCharPosAry && !mpGlyphs2Chars ) + { + // create and reset the new array + mpGlyphs2Chars = new int[ mnGlyphCapacity ]; + static const int CHARPOS_NONE = -1; + for( int i = 0; i < mnGlyphCount; ++i ) + mpGlyphs2Chars[i] = CHARPOS_NONE; + // calculate the char->glyph mapping + for( nItem = 0; nItem < mnItemCount; ++nItem ) + { + // ignore invisible visual items + const VisualItem& rVI = mpVisualItems[ nItem ]; + if( rVI.IsEmpty() ) + continue; + // calculate the mapping by using mpLogClusters[] + // mpGlyphs2Chars[] should obey the logical order + // => reversing the loop does this by overwriting higher logicals + for( c = rVI.mnEndCharPos; --c >= rVI.mnMinCharPos; ) + { + int i = mpLogClusters[c] + rVI.mnMinGlyphPos; + mpGlyphs2Chars[i] = c; + } + // use a heuristic to fill the gaps in the glyphs2chars array + c = !rVI.IsRTL() ? rVI.mnMinCharPos : rVI.mnEndCharPos - 1; + for( int i = rVI.mnMinGlyphPos; i < rVI.mnEndGlyphPos; ++i ) { + if( mpGlyphs2Chars[i] == CHARPOS_NONE ) + mpGlyphs2Chars[i] = c; + else + c = mpGlyphs2Chars[i]; + } + } + } // calculate the absolute position of the first result glyph in pixel units const GOFFSET aGOffset = mpGlyphOffsets[ nStart ]; Modified: openoffice/branches/l10n40/main/xmloff/inc/xmloff/xmlmultiimagehelper.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/xmloff/inc/xmloff/xmlmultiimagehelper.hxx?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/main/xmloff/inc/xmloff/xmlmultiimagehelper.hxx (original) +++ openoffice/branches/l10n40/main/xmloff/inc/xmloff/xmlmultiimagehelper.hxx Fri Sep 27 15:26:24 2013 @@ -40,7 +40,7 @@ protected: public: multiImageImportHelper(); - ~multiImageImportHelper(); + virtual ~multiImageImportHelper(); /// solve multiple imported images. The most valuable one is choosen, /// see imlementation for evtl. changing weights and/or adding filetypes. Modified: openoffice/branches/l10n40/main/xmloff/source/text/XMLTextFrameContext.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/xmloff/source/text/XMLTextFrameContext.cxx?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/main/xmloff/source/text/XMLTextFrameContext.cxx (original) +++ openoffice/branches/l10n40/main/xmloff/source/text/XMLTextFrameContext.cxx Fri Sep 27 15:26:24 2013 @@ -425,6 +425,7 @@ class XMLTextFrameContext_Impl : public sal_Bool bSyncHeight : 1; sal_Bool bCreateFailed : 1; sal_Bool bOwnBase64Stream : 1; + bool mbSetNameForFrame : 1; // #123261# remember if to set the NameForFrame void Create( sal_Bool bHRefOrBase64 ); @@ -435,16 +436,16 @@ public: sal_Bool CreateIfNotThere(); const OUString& GetHRef() const { return sHRef; } - XMLTextFrameContext_Impl( SvXMLImport& rImport, - sal_uInt16 nPrfx, - const ::rtl::OUString& rLName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XAttributeList > & rAttrList, - ::com::sun::star::text::TextContentAnchorType eAnchorType, - sal_uInt16 nType, - const ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XAttributeList > & rFrameAttrList ); - virtual ~XMLTextFrameContext_Impl(); + XMLTextFrameContext_Impl( SvXMLImport& rImport, + sal_uInt16 nPrfx, + const ::rtl::OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & rAttrList, + ::com::sun::star::text::TextContentAnchorType eAnchorType, + sal_uInt16 nType, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & rFrameAttrList, + bool bSetNameForFrame); // #123261# control if to set the NameForFrame + virtual ~XMLTextFrameContext_Impl(); virtual void EndElement(); @@ -468,10 +469,40 @@ public: const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& GetPropSet() const { return xPropSet; } + + // #123261# helper to set the NameForFrame + void SetNameForFrameFromPropSet(); }; TYPEINIT1( XMLTextFrameContext_Impl, SvXMLImportContext ); +void XMLTextFrameContext_Impl::SetNameForFrameFromPropSet() +{ + // set name + UniReference < XMLTextImportHelper > xTextImportHelper = GetImport().GetTextImport(); + Reference < XNamed > xNamed( xPropSet, UNO_QUERY ); + + if( xNamed.is() && xTextImportHelper.is() ) + { + OUString sOrigName( xNamed->getName() ); + if( !sOrigName.getLength() || + (sName.getLength() && sOrigName != sName) ) + { + OUString sOldName( sName ); + sal_Int32 i = 0; + while( xTextImportHelper->HasFrameByName( sName ) ) + { + sName = sOldName; + sName += OUString::valueOf( ++i ); + } + xNamed->setName( sName ); + if( sName != sOldName ) + xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME, + sOldName, sName ); + } + } +} + void XMLTextFrameContext_Impl::Create( sal_Bool /*bHRefOrBase64*/ ) { UniReference < XMLTextImportHelper > xTextImportHelper = @@ -581,27 +612,13 @@ void XMLTextFrameContext_Impl::Create( s Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); - // set name - Reference < XNamed > xNamed( xPropSet, UNO_QUERY ); - if( xNamed.is() ) - { - OUString sOrigName( xNamed->getName() ); - if( !sOrigName.getLength() || - (sName.getLength() && sOrigName != sName) ) - { - OUString sOldName( sName ); - sal_Int32 i = 0; - while( xTextImportHelper->HasFrameByName( sName ) ) - { - sName = sOldName; - sName += OUString::valueOf( ++i ); - } - xNamed->setName( sName ); - if( sName != sOldName ) - xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME, - sOldName, sName ); - } - } + // #123261# set name, but only if wanted, e.g. for MultiImageSupport, it will be set after + // it is decided which image will be used. This is done e.g. to avoid double stuff and effects + // for the target to avoid double names + if(mbSetNameForFrame) + { + SetNameForFrameFromPropSet(); + } // frame style XMLPropStyleContext *pStyle = 0; @@ -805,42 +822,44 @@ sal_Bool XMLTextFrameContext_Impl::Creat } XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( - SvXMLImport& rImport, - sal_uInt16 nPrfx, const OUString& rLName, - const Reference< XAttributeList > & rAttrList, - TextContentAnchorType eATyp, - sal_uInt16 nNewType, - const Reference< XAttributeList > & rFrameAttrList ) -: SvXMLImportContext( rImport, nPrfx, rLName ) + SvXMLImport& rImport, + sal_uInt16 nPrfx, const OUString& rLName, + const Reference< XAttributeList > & rAttrList, + TextContentAnchorType eATyp, + sal_uInt16 nNewType, + const Reference< XAttributeList > & rFrameAttrList, + bool bSetNameForFrame) +: SvXMLImportContext( rImport, nPrfx, rLName ) , mbListContextPushed( false ) -, sWidth(RTL_CONSTASCII_USTRINGPARAM("Width")) -, sWidthType(RTL_CONSTASCII_USTRINGPARAM("WidthType")) -, sRelativeWidth(RTL_CONSTASCII_USTRINGPARAM("RelativeWidth")) -, sHeight(RTL_CONSTASCII_USTRINGPARAM("Height")) -, sRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("RelativeHeight")) -, sSizeType(RTL_CONSTASCII_USTRINGPARAM("SizeType")) -, sIsSyncWidthToHeight(RTL_CONSTASCII_USTRINGPARAM("IsSyncWidthToHeight")) -, sIsSyncHeightToWidth(RTL_CONSTASCII_USTRINGPARAM("IsSyncHeightToWidth")) -, sHoriOrient(RTL_CONSTASCII_USTRINGPARAM("HoriOrient")) -, sHoriOrientPosition(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")) -, sVertOrient(RTL_CONSTASCII_USTRINGPARAM("VertOrient")) -, sVertOrientPosition(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")) -, sChainNextName(RTL_CONSTASCII_USTRINGPARAM("ChainNextName")) -, sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType")) -, sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo")) -, sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL")) -, sGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("GraphicFilter")) +, sWidth(RTL_CONSTASCII_USTRINGPARAM("Width")) +, sWidthType(RTL_CONSTASCII_USTRINGPARAM("WidthType")) +, sRelativeWidth(RTL_CONSTASCII_USTRINGPARAM("RelativeWidth")) +, sHeight(RTL_CONSTASCII_USTRINGPARAM("Height")) +, sRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("RelativeHeight")) +, sSizeType(RTL_CONSTASCII_USTRINGPARAM("SizeType")) +, sIsSyncWidthToHeight(RTL_CONSTASCII_USTRINGPARAM("IsSyncWidthToHeight")) +, sIsSyncHeightToWidth(RTL_CONSTASCII_USTRINGPARAM("IsSyncHeightToWidth")) +, sHoriOrient(RTL_CONSTASCII_USTRINGPARAM("HoriOrient")) +, sHoriOrientPosition(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")) +, sVertOrient(RTL_CONSTASCII_USTRINGPARAM("VertOrient")) +, sVertOrientPosition(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")) +, sChainNextName(RTL_CONSTASCII_USTRINGPARAM("ChainNextName")) +, sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType")) +, sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo")) +, sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL")) +, sGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("GraphicFilter")) // --> OD 2009-07-22 #i73249# //, sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText")) , sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")) , sDescription(RTL_CONSTASCII_USTRINGPARAM("Description")) // <-- -, sFrameStyleName(RTL_CONSTASCII_USTRINGPARAM("FrameStyleName")) -, sGraphicRotation(RTL_CONSTASCII_USTRINGPARAM("GraphicRotation")) -, sTextBoxServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame")) -, sGraphicServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GraphicObject")) -, nType( nNewType ) -, eAnchorType( eATyp ) +, sFrameStyleName(RTL_CONSTASCII_USTRINGPARAM("FrameStyleName")) +, sGraphicRotation(RTL_CONSTASCII_USTRINGPARAM("GraphicRotation")) +, sTextBoxServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame")) +, sGraphicServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GraphicObject")) +, nType( nNewType ) +, eAnchorType( eATyp ) +, mbSetNameForFrame(bSetNameForFrame) { nX = 0; nY = 0; @@ -1441,13 +1460,25 @@ void XMLTextFrameContext::EndElement() { /// solve if multiple image child contexts were imported /// the winner is returned, if something has yet to be done with it - /*const SvXMLImportContext* pWinner =*/ solveMultipleImages(); + const SvXMLImportContext* pWinner = solveMultipleImages(); - SvXMLImportContext *pContext = &m_xImplContext; - XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext ); - if( pImpl ) - { - pImpl->CreateIfNotThere(); + // #123261# see if the winner is a XMLTextFrameContext_Impl + const XMLTextFrameContext_Impl* pImplWinner = dynamic_cast< const XMLTextFrameContext_Impl* >(pWinner); + + if(pImplWinner) + { + // #123261# if yes, set name now, after the winner is identified (setting at each + // candidate may run into problems due to colliding with efforts in the target to + // avoid double names, so only set one name at one image and not at each) + const_cast< XMLTextFrameContext_Impl* >(pImplWinner)->SetNameForFrameFromPropSet(); + } + + SvXMLImportContext *pContext = &m_xImplContext; + XMLTextFrameContext_Impl *pImpl = dynamic_cast< XMLTextFrameContext_Impl* >(pContext); + + if( pImpl ) + { + pImpl->CreateIfNotThere(); // --> OD 2009-07-22 #i73249# // // alternative text @@ -1552,32 +1583,41 @@ SvXMLImportContext *XMLTextFrameContext: setSupportsMultipleContents(IsXMLToken(rLocalName, XML_IMAGE)); } - if( !pContext ) - { - - pContext = new XMLTextFrameContext_Impl( GetImport(), p_nPrefix, - rLocalName, xAttrList, - m_eDefaultAnchorType, - nFrameType, - m_xAttrList ); - } + if( !pContext ) + { + pContext = new XMLTextFrameContext_Impl( + GetImport(), + p_nPrefix, + rLocalName, + xAttrList, + m_eDefaultAnchorType, + nFrameType, + m_xAttrList, + !getSupportsMultipleContents()); + } - m_xImplContext = pContext; + m_xImplContext = pContext; if(getSupportsMultipleContents() && XML_TEXT_FRAME_GRAPHIC == nFrameType) { addContent(*m_xImplContext); } - } - } - } + } + } + } else if(getSupportsMultipleContents() && XML_NAMESPACE_DRAW == p_nPrefix && IsXMLToken(rLocalName, XML_IMAGE)) { // read another image pContext = new XMLTextFrameContext_Impl( - GetImport(), p_nPrefix, rLocalName, xAttrList, - m_eDefaultAnchorType, XML_TEXT_FRAME_GRAPHIC, m_xAttrList); - + GetImport(), + p_nPrefix, + rLocalName, + xAttrList, + m_eDefaultAnchorType, + XML_TEXT_FRAME_GRAPHIC, + m_xAttrList, + false); + m_xImplContext = pContext; addContent(*m_xImplContext); } Propchange: openoffice/branches/l10n40/test/ ------------------------------------------------------------------------------ Merged /openoffice/trunk/test:r1505446-1526887 Propchange: openoffice/branches/l10n40/test/testcommon/source/org/openoffice/test/vcl/ ------------------------------------------------------------------------------ Merged /openoffice/trunk/test/testcommon/source/org/openoffice/test/vcl:r1505446-1526887 Modified: openoffice/branches/l10n40/test/testcommon/source/org/openoffice/test/vcl/Tester.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testcommon/source/org/openoffice/test/vcl/Tester.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testcommon/source/org/openoffice/test/vcl/Tester.java (original) +++ openoffice/branches/l10n40/test/testcommon/source/org/openoffice/test/vcl/Tester.java Fri Sep 27 15:26:24 2013 @@ -102,13 +102,23 @@ public class Tester { robot.mousePress(InputEvent.BUTTON1_MASK); int x = fromX; int y = fromY; + // get the direction int dx = toX > fromX ? 1 : -1; int dy = toY > fromY ? 1 : -1; + // get the step sizes + final int stepTarget = 10; + int sx = (toX - fromX) / stepTarget; + int sy = (toY - fromY) / stepTarget; + if( sx == 0) sx = dx; + if( sy == 0) sy = dy; while (x != toX || y != toY) { - if (x != toX) - x = x + dx; - if (y != toY) - y = y + dy; + x += sx; + y += sy; + // limit drag pos to target pos + if( ((x - toX) * dx) > 0) + x = toX; + if( ((y - toY) * dy) > 0) + y = toY; robot.mouseMove(x, y); } robot.mouseRelease(InputEvent.BUTTON1_MASK); Modified: openoffice/branches/l10n40/test/testgui/source/fvt/gui/sc/validity/ValidityDialogSetting.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testgui/source/fvt/gui/sc/validity/ValidityDialogSetting.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testgui/source/fvt/gui/sc/validity/ValidityDialogSetting.java (original) +++ openoffice/branches/l10n40/test/testgui/source/fvt/gui/sc/validity/ValidityDialogSetting.java Fri Sep 27 15:26:24 2013 @@ -526,7 +526,7 @@ public class ValidityDialogSetting { scInputBarInput.activate(); typeKeys("13"); typeKeys("<enter>"); - assertEquals("Apache OpenOffice Calc", activeMsgBox.getCaption()); + assertEquals("OpenOffice Calc", activeMsgBox.getCaption()); // assertEquals("Invalid value.",ActiveMsgBox.getMessage()); // Can not // verify in multi-language activeMsgBox.ok(); Modified: openoffice/branches/l10n40/test/testgui/source/fvt/gui/sd/shape/ShapeTypes.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testgui/source/fvt/gui/sd/shape/ShapeTypes.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testgui/source/fvt/gui/sd/shape/ShapeTypes.java (original) +++ openoffice/branches/l10n40/test/testgui/source/fvt/gui/sd/shape/ShapeTypes.java Fri Sep 27 15:26:24 2013 @@ -60,11 +60,11 @@ public class ShapeTypes { @After public void tearDown() throws Exception { - sleep(3); //close navigator if (sdNavigatorDlg.exists()) { app.dispatch(".uno:Navigator"); } + AppTool.discard(); app.stop(); } @@ -78,6 +78,7 @@ public class ShapeTypes { impress.focus(); //before insert CallOut Shape sdNavigator.focus(); + sdNavigator.waitForEnabled( 2.0, 0.1); sdNavigatorShapeFilter.click(); typeKeys("<down><down>"); typeKeys("<enter>"); @@ -91,6 +92,7 @@ public class ShapeTypes { impress.focus(); impress.drag(100, 100, 200, 200); sdNavigatorDlg.focus(); + sdNavigator.waitForEnabled( 2.0, 0.1); sdNavigatorShapeFilter.click(); typeKeys("<down><down>"); typeKeys("<enter>"); @@ -99,9 +101,8 @@ public class ShapeTypes { typeKeys("<enter>"); allShapes=sdNavigator.getAllItemsText(); assertEquals(4, allShapes.length); - - } + /** * Insert a new Star shape * @throws Exception @@ -112,6 +113,7 @@ public class ShapeTypes { impress.focus(); //before insert CallOut Shape sdNavigator.focus(); + sdNavigator.waitForEnabled( 2.0, 0.1); sdNavigatorShapeFilter.click(); typeKeys("<down><down>"); typeKeys("<enter>"); @@ -125,6 +127,7 @@ public class ShapeTypes { impress.focus(); impress.drag(100, 100, 200, 200); sdNavigatorDlg.focus(); + sdNavigator.waitForEnabled( 2.0, 0.1); sdNavigatorShapeFilter.click(); typeKeys("<down><down>"); typeKeys("<enter>"); @@ -133,7 +136,6 @@ public class ShapeTypes { typeKeys("<enter>"); allShapes=sdNavigator.getAllItemsText(); assertEquals(4, allShapes.length); - } } Modified: openoffice/branches/l10n40/test/testgui/source/svt/gui/sc/BasicFuncOnCalc.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testgui/source/svt/gui/sc/BasicFuncOnCalc.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testgui/source/svt/gui/sc/BasicFuncOnCalc.java (original) +++ openoffice/branches/l10n40/test/testgui/source/svt/gui/sc/BasicFuncOnCalc.java Fri Sep 27 15:26:24 2013 @@ -64,6 +64,7 @@ import static testlib.gui.UIMap.standard import static testlib.gui.UIMap.startCenterOpenButton; import java.util.HashMap; +import java.util.logging.Level; import org.junit.AfterClass; import org.junit.Before; @@ -496,5 +497,6 @@ public class BasicFuncOnCalc { HashMap<String, Object> perf = aoo.getPerfData(); xmlResult.addRow("Data",testname.getMethodName(), i, (end - start), perf.get("vsz"), perf.get("rss"), perf.get("handles")); + log.log( Level.INFO, "\t"+testname.getMethodName()+"["+i+"] took "+(end-start)+"ms"); } } Modified: openoffice/branches/l10n40/test/testgui/source/svt/gui/sd/BasicFuncOnImpress.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testgui/source/svt/gui/sd/BasicFuncOnImpress.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testgui/source/svt/gui/sd/BasicFuncOnImpress.java (original) +++ openoffice/branches/l10n40/test/testgui/source/svt/gui/sd/BasicFuncOnImpress.java Fri Sep 27 15:26:24 2013 @@ -34,6 +34,7 @@ import static testlib.gui.UIMap.*; import java.io.FileOutputStream; import java.io.PrintStream; import java.util.HashMap; +import java.util.logging.Level; import org.junit.After; import org.junit.AfterClass; @@ -374,5 +375,6 @@ public class BasicFuncOnImpress { HashMap<String, Object> perf = aoo.getPerfData(); xmlResult.addRow("Data",testname.getMethodName(), i, (end - start), perf.get("vsz"), perf.get("rss"), perf.get("handles")); + log.log( Level.INFO, "\t"+testname.getMethodName()+"["+i+"] took "+(end-start)+"ms"); } } Modified: openoffice/branches/l10n40/test/testgui/source/svt/gui/sw/BasicFuncOnWriter.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testgui/source/svt/gui/sw/BasicFuncOnWriter.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testgui/source/svt/gui/sw/BasicFuncOnWriter.java (original) +++ openoffice/branches/l10n40/test/testgui/source/svt/gui/sw/BasicFuncOnWriter.java Fri Sep 27 15:26:24 2013 @@ -34,6 +34,7 @@ import static testlib.gui.UIMap.*; import java.io.FileOutputStream; import java.io.PrintStream; import java.util.HashMap; +import java.util.logging.Level; import org.junit.After; import org.junit.AfterClass; @@ -517,6 +518,7 @@ public class BasicFuncOnWriter { HashMap<String, Object> perf = aoo.getPerfData(); xmlResult.addRow("Data",testname.getMethodName(), i, (end - start), perf.get("vsz"), perf.get("rss"), perf.get("handles")); + log.log( Level.INFO, "\t"+testname.getMethodName()+"["+i+"] took "+(end-start)+"ms"); } } Modified: openoffice/branches/l10n40/test/testgui/source/svt/gui/sw/FileTypeAboutWriter.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testgui/source/svt/gui/sw/FileTypeAboutWriter.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testgui/source/svt/gui/sw/FileTypeAboutWriter.java (original) +++ openoffice/branches/l10n40/test/testgui/source/svt/gui/sw/FileTypeAboutWriter.java Fri Sep 27 15:26:24 2013 @@ -34,6 +34,7 @@ import static testlib.gui.UIMap.*; import java.io.FileOutputStream; import java.io.PrintStream; import java.util.HashMap; +import java.util.logging.Level; import org.junit.After; import org.junit.AfterClass; @@ -125,8 +126,9 @@ public class FileTypeAboutWriter { swInsertLineButtonOnToolbar.click(); writer.focus(); for(int j=0;j<10;j++){ - writer.drag(150+j, 150+j*10, 200+j, 200+j*10); - sleep(2); + // due to snap-to-grid the lines below will not all be parallel! + writer.drag( 150+j, 150+j*10, 200+j, 200+j*10); + sleep( 0.5); } typeKeys("<esc>"); sleep(2); @@ -184,6 +186,7 @@ public class FileTypeAboutWriter { HashMap<String, Object> perf = aoo.getPerfData(); xmlResult.addRow("Data",testname.getMethodName(), i, (end - start), perf.get("vsz"), perf.get("rss"), perf.get("handles")); + log.log( Level.INFO, "\t"+testname.getMethodName()+"["+i+"] took "+(end-start)+"ms"); } Modified: openoffice/branches/l10n40/test/testgui/source/testlib/gui/AppTool.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testgui/source/testlib/gui/AppTool.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testgui/source/testlib/gui/AppTool.java (original) +++ openoffice/branches/l10n40/test/testgui/source/testlib/gui/AppTool.java Fri Sep 27 15:26:24 2013 @@ -97,7 +97,13 @@ public class AppTool extends Tester { submitSaveDlg(getPath(path)); if (alienFormatDlg.exists(3)) alienFormatDlg.ok(); - app.waitSlot(5 * 60); // 10 minutes + if( activeMsgBox.exists(1)) { + String msg = activeMsgBox.getMessage(); + // #i123142# confirm overwriting of test files + if( msg.indexOf( "overwrite changes") >= 0) + activeMsgBox.yes(); + } + app.waitSlot(5 * 60); // 5 minutes } public static void close() { Modified: openoffice/branches/l10n40/test/testuno/source/fvt/mix/MixedTest.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testuno/source/fvt/mix/MixedTest.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testuno/source/fvt/mix/MixedTest.java (original) +++ openoffice/branches/l10n40/test/testuno/source/fvt/mix/MixedTest.java Fri Sep 27 15:26:24 2013 @@ -56,9 +56,7 @@ public class MixedTest { */ @Before public void setUp() throws Exception { - OpenOffice aoo = new OpenOffice(); - aoo.setAutomationPort(OpenOffice.DEFAULT_AUTOMATION_PORT); - aoo.setUnoUrl(OpenOffice.DEFAULT_UNO_URL); + OpenOffice aoo = OpenOffice.getDefault(); unoApp = new UnoApp(aoo); vclApp = new VclApp(aoo); writer = new VclWindow(vclApp, "SW_HID_EDIT_WIN"); @@ -85,11 +83,11 @@ public class MixedTest { writer.drag(10, 10, 300, 400); writer.menuItem("Format->Character...").select(); effectsPage.select(); - colorList.select("Light green"); + colorList.select("Green 3"); effectsPage.ok(); //Verify the result via UNO API XTextCursor xTextCursor = xText.createTextCursor(); XPropertySet xps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); - Assert.assertEquals("Text Color", 0x0000FF00, xps.getPropertyValue("CharColor")); + Assert.assertEquals("Text Color", 0x00CC00, xps.getPropertyValue("CharColor")); } } Modified: openoffice/branches/l10n40/test/testuno/source/fvt/uno/sc/chart/ChartLegend.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testuno/source/fvt/uno/sc/chart/ChartLegend.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testuno/source/fvt/uno/sc/chart/ChartLegend.java (original) +++ openoffice/branches/l10n40/test/testuno/source/fvt/uno/sc/chart/ChartLegend.java Fri Sep 27 15:26:24 2013 @@ -186,9 +186,10 @@ public class ChartLegend { String chartName = "testChart"; String cellRangeName = "A1:D4"; Boolean result = true; - int delta = 4;//Save as .xls file, the legend position may change a little, set acceptable range. + int delta = 1; // tolerate legend position changes from integer rounding if (fileType.equalsIgnoreCase("xls")) { + delta = 4; // increase tolerance for legend position changes in the XLS roundtrip chartName = "Object 1"; } @@ -221,15 +222,8 @@ public class ChartLegend { assertTrue("Chart legend has not been enabled in ." + fileType + " file.", result); - if (fileType.equalsIgnoreCase("xls")) { - assertEquals("Incorrect chart legend position X got in ." + fileType + " file.", aPoint.X, resultPoint.X, delta); - assertEquals("Incorrect chart legend position X got in ." + fileType + " file.", aPoint.Y, resultPoint.Y, delta); - } - else { - assertEquals("Incorrect chart legend position X got in ." + fileType + " file.", aPoint.X, resultPoint.X); - assertEquals("Incorrect chart legend position X got in ." + fileType + " file.", aPoint.Y, resultPoint.Y); - } - + assertEquals("Incorrect chart legend position X got in ." + fileType + " file.", aPoint.X, resultPoint.X, delta); + assertEquals("Incorrect chart legend position Y got in ." + fileType + " file.", aPoint.Y, resultPoint.Y, delta); } -} \ No newline at end of file +} Modified: openoffice/branches/l10n40/test/testuno/source/fvt/uno/sd/graphic/GraphicPro_Border.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testuno/source/fvt/uno/sd/graphic/GraphicPro_Border.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testuno/source/fvt/uno/sd/graphic/GraphicPro_Border.java (original) +++ openoffice/branches/l10n40/test/testuno/source/fvt/uno/sd/graphic/GraphicPro_Border.java Fri Sep 27 15:26:24 2013 @@ -86,7 +86,7 @@ public class GraphicPro_Border { {LineStyle.SOLID,"Continuous", colorList[1], LineStyle.SOLID,"Continuous", colorList[1]}, {LineStyle.DASH,"Ultrafine Dashed", colorList[2], LineStyle.DASH,"Ultrafine Dashed", colorList[2]}, {LineStyle.DASH,"Fine Dashed", colorList[3], LineStyle.DASH,"Fine Dashed", colorList[3]}, - {LineStyle.DASH,"Ultrafine 2 dots 3 dashes", colorList[4], LineStyle.DASH,"Ultrafine 2 Dots 3 Dashes", colorList[4]}, + {LineStyle.DASH,"Ultrafine 2 Dots 3 Dashes", colorList[4], LineStyle.DASH,"Ultrafine 2 Dots 3 Dashes", colorList[4]}, {LineStyle.DASH,"Fine Dotted", colorList[5], LineStyle.DASH,"Fine Dotted", colorList[5]}, {LineStyle.DASH,"Line with Fine Dots", colorList[6], LineStyle.DASH,"Line with Fine Dots", colorList[6]}, {LineStyle.DASH,"Fine Dashed (var)", colorList[7], LineStyle.DASH,"Fine Dashed (var)", colorList[7]}, Modified: openoffice/branches/l10n40/test/testuno/source/fvt/uno/sw/DocumentTest.java URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/test/testuno/source/fvt/uno/sw/DocumentTest.java?rev=1526954&r1=1526953&r2=1526954&view=diff ============================================================================== --- openoffice/branches/l10n40/test/testuno/source/fvt/uno/sw/DocumentTest.java (original) +++ openoffice/branches/l10n40/test/testuno/source/fvt/uno/sw/DocumentTest.java Fri Sep 27 15:26:24 2013 @@ -81,8 +81,11 @@ public class DocumentTest { String title = xTitle.getTitle(); Assert.assertEquals("New Document title start with \"Untitled\"",true, title.startsWith("Untitled")); unoApp.closeDocument(component); - XModel xModel = unoApp.getDesktop().getCurrentFrame().getController().getModel(); - Assert.assertTrue("Document has been closed.",xModel==null); + XDesktop xDesktop = unoApp.getDesktop(); + XFrame xFrame = (xDesktop == null) ? null : xDesktop.getCurrentFrame(); + XController xCtrl = (xFrame == null) ? null : xFrame.getController(); + XModel xModel = (xCtrl == null) ? null : xCtrl.getModel(); + Assert.assertTrue("Document has been closed.",xModel==null); } /** * test new document from template
