[Libreoffice-commits] core.git: 3 commits - oox/source sw/qa sw/source writerfilter/source
oox/source/export/preset-definitions-to-shape-types.pl |2 - sw/qa/extras/rtfimport/data/tdf92481.rtf |6 sw/qa/extras/rtfimport/rtfimport.cxx |6 sw/source/filter/ww8/docxsdrexport.cxx | 24 writerfilter/source/dmapper/SettingsTable.cxx | 25 +++-- writerfilter/source/ooxml/model.xml|4 ++ writerfilter/source/rtftok/rtfdocumentimpl.cxx |3 ++ 7 files changed, 55 insertions(+), 15 deletions(-) New commits: commit 0afd9dbc08ee2e55e0845dd33ece10ff9375bfa7 Author: Miklos Vajna vmik...@collabora.co.uk Date: Mon Jul 6 09:15:22 2015 +0200 sw: fix newly introduced style inconsistencies in docxsdrexport Change-Id: I9b9f198aa6da2f6734194207b4c4bdec3ee1d4c0 diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index b59de52..8244171 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -1473,14 +1473,14 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo //first, loop through ALL of the chained textboxes to identify a unique ID for each chain, and sequence number for each textbox in that chain. std::mapOUString, MSWordExportBase::LinkedTextboxInfo::iterator linkedTextboxesIter; -if( !m_pImpl-m_rExport.m_bLinkedTextboxesHelperInitialized ) +if (!m_pImpl-m_rExport.m_bLinkedTextboxesHelperInitialized) { sal_Int32 nSeq=0; linkedTextboxesIter = m_pImpl-m_rExport.m_aLinkedTextboxesHelper.begin(); -while ( linkedTextboxesIter != m_pImpl-m_rExport.m_aLinkedTextboxesHelper.end() ) +while (linkedTextboxesIter != m_pImpl-m_rExport.m_aLinkedTextboxesHelper.end()) { //find the start of a textbox chain: has no PREVIOUS link, but does have NEXT link -if ( linkedTextboxesIter-second.sPrevChain.isEmpty() !linkedTextboxesIter-second.sNextChain.isEmpty() ) +if (linkedTextboxesIter-second.sPrevChain.isEmpty() !linkedTextboxesIter-second.sNextChain.isEmpty()) { //assign this chain a unique ID and start a new sequence nSeq = 0; @@ -1492,18 +1492,18 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo //follow the chain and assign the same id, and incremental sequence numbers. std::mapOUString, MSWordExportBase::LinkedTextboxInfo::iterator followChainIter; followChainIter = m_pImpl-m_rExport.m_aLinkedTextboxesHelper.find(linkedTextboxesIter-second.sNextChain); -while ( followChainIter != m_pImpl-m_rExport.m_aLinkedTextboxesHelper.end() ) +while (followChainIter != m_pImpl-m_rExport.m_aLinkedTextboxesHelper.end()) { //verify that the NEXT textbox also points to me as the PREVIOUS. // A broken link indicates a leftover remnant that can be ignored. -if( followChainIter-second.sPrevChain != sCheckForBrokenChains ) +if (followChainIter-second.sPrevChain != sCheckForBrokenChains) break; followChainIter-second.nId = m_pImpl-m_rExport.m_nLinkedTextboxesChainId; followChainIter-second.nSeq = ++nSeq; //empty next chain indicates the end of the linked chain. -if ( followChainIter-second.sNextChain.isEmpty() ) +if (followChainIter-second.sNextChain.isEmpty()) break; sCheckForBrokenChains = followChainIter-first; @@ -1520,19 +1520,19 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo bool isTxbxLinked = false ; OUString sLinkChainName; -if ( xPropSetInfo.is() ) +if (xPropSetInfo.is()) { -if ( xPropSetInfo-hasPropertyByName(LinkDisplayName) ) +if (xPropSetInfo-hasPropertyByName(LinkDisplayName)) xPropertySet-getPropertyValue(LinkDisplayName) = sLinkChainName; -else if ( xPropSetInfo-hasPropertyByName(ChainName) ) +else if (xPropSetInfo-hasPropertyByName(ChainName)) xPropertySet-getPropertyValue(ChainName) = sLinkChainName; } // second, check if THIS textbox is linked and then decide whether to write the tag txbx or linkedTxbx linkedTextboxesIter = m_pImpl-m_rExport.m_aLinkedTextboxesHelper.find(sLinkChainName); -if ( linkedTextboxesIter != m_pImpl-m_rExport.m_aLinkedTextboxesHelper.end() ) +if (linkedTextboxesIter != m_pImpl-m_rExport.m_aLinkedTextboxesHelper.end()) { -if( (linkedTextboxesIter-second.nId !=0) (linkedTextboxesIter-second.nSeq != 0) ) +if ((linkedTextboxesIter-second.nId !=0) (linkedTextboxesIter-second.nSeq != 0)) {
[Libreoffice-commits] core.git: 3 commits - oox/source sw/qa sw/source
oox/source/export/vmlexport.cxx | 14 +++- sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 42 ++--- sw/source/filter/ww8/docxsdrexport.cxx | 47 +--- 3 files changed, 80 insertions(+), 23 deletions(-) New commits: commit e1386e32a85eb5c6b4294a8ca3e4461b92707fc3 Author: Miklos Vajna vmik...@collabora.co.uk Date: Wed Jun 18 01:20:41 2014 +0200 DocxSdrExport::writeDMLAndVMLDrawing: fix handling of inline VML shapes In general Writer supports having objects inside a TextFrame, Word does not. It turns out that Word allows having certain shapes inside other shapes, as long as they are VML-only. So do that for now: if we receive a shape when we're already inside a shape, then just export it as VML, not the usual drawingml+VML pair. Also, blacklist one more VML shape type, where the shape text is already exported inside v:textpath, so no dedicated v:textbox is needed. Change-Id: I5786bd6827eae9756e7c179bb2ef5a5741a91878 diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index ad24db2..490bc7b 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -971,6 +971,18 @@ bool lcl_isTextBox(const SdrObject* pSdrObject) return false; } +bool lcl_hasTextBoxContent(sal_uInt32 nShapeType) +{ +switch (nShapeType) +{ +case ESCHER_ShpInst_TextPlainText: +case ESCHER_ShpInst_TextSlantUp: +return false; +default: +return true; +} +} + OUString lcl_getAnchorIdFromGrabBag(const SdrObject* pSdrObject) { OUString aResult; @@ -1126,7 +1138,7 @@ sal_Int32 VMLExport::StartShape() // now check if we have some editeng text (not associated textbox) and we have a text exporter registered const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, m_pSdrObject); -if (pTxtObj m_pTextExport m_nShapeType != ESCHER_ShpInst_TextPlainText !IsWaterMarkShape(m_pSdrObject-GetName()) !lcl_isTextBox(m_pSdrObject)) +if (pTxtObj m_pTextExport lcl_hasTextBoxContent(m_nShapeType) !IsWaterMarkShape(m_pSdrObject-GetName()) !lcl_isTextBox(m_pSdrObject)) { const OutlinerParaObject* pParaObj = 0; bool bOwnParaObj = false; diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx index 2fbf4a9..0d9e0ea 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx @@ -1685,9 +1685,23 @@ DECLARE_OOXMLEXPORT_TEST(testWordArtWithinDraingtool, testWordArtWithinDraingto xmlDocPtr pXmlDoc = parseExport(word/document.xml); if (!pXmlDoc) return; - assertXPath(pXmlDoc,/w:document[1]/w:body[1]/w:p[1]/w:r[2]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1],1); - assertXPath(pXmlDoc,/w:document[1]/w:body[1]/w:p[1]/w:r[2]/mc:AlternateContent[1]/mc:Fallback[1]/w:pict[1]/v:rect[1]/v:textbox[1]/w:txbxContent[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1],1); - assertXPath(pXmlDoc,/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1],1); +uno::Referencetext::XTextFramesSupplier xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Referencecontainer::XIndexAccess xIndexAccess(xTextFramesSupplier-getTextFrames(), uno::UNO_QUERY); +if (xIndexAccess-getCount()) +{ +// TODO TextBox: remove this when TextBox is enabled by default +// This second run is a bug, should be the first ideally + assertXPath(pXmlDoc,/w:document[1]/w:body[1]/w:p[1]/w:r[2]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1],1); + assertXPath(pXmlDoc,/w:document[1]/w:body[1]/w:p[1]/w:r[2]/mc:AlternateContent[1]/mc:Fallback[1]/w:pict[1]/v:rect[1]/v:textbox[1]/w:txbxContent[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1],1); + assertXPath(pXmlDoc,/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1],1); +} +else +{ + assertXPath(pXmlDoc,/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1],1); +
[Libreoffice-commits] core.git: 3 commits - oox/source sw/qa sw/source
oox/source/drawingml/customshapeproperties.cxx |6 ++-- oox/source/drawingml/shape.cxx | 19 +++-- sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx| 35 +++-- sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 29 sw/source/filter/ww8/docxsdrexport.cxx |8 ++--- 5 files changed, 79 insertions(+), 18 deletions(-) New commits: commit 1393ba60b1eb43b55820f74c393da04308221d97 Author: Jacobo Aragunde Pérez jaragu...@igalia.com Date: Mon Apr 14 18:53:34 2014 +0200 fdo#70838: fix rotation transformation in DML exporter This patch fixes an error in commit c6ff03f37a6898f50a5ca07152168fb4fe911e05. And now that fdo#75722 is fixed, I completed the existing unit test for this bug with absolute position checks. Change-Id: I76b4fa046db9b946fd23194e91686ffa4fcb5362 diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx index 5f5ecf9..674b496 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx @@ -503,16 +503,16 @@ DECLARE_OOXMLEXPORT_TEST(testFdo70838, fdo70838.docx) aYPos[2] = getXPathContent(pXmlDocument, /w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/wp:anchor/wp:positionV/wp:posOffset).toInt32(); aYPos[3] = getXPathContent(pXmlDocument, /w:document/w:body/w:p/w:r/mc:AlternateContent[4]/mc:Choice/w:drawing/wp:anchor/wp:positionV/wp:posOffset).toInt32(); -// TODO: compare values with a reference value extracted from the original document -// depends on fdo#75722 // certain degree of error is tolerated due to rounding in unit conversions -CPPUNIT_ASSERT(abs(aXPos[0] - aXPos[1]) 1000); -CPPUNIT_ASSERT(abs(aXPos[1] - aXPos[2]) 1000); -CPPUNIT_ASSERT(abs(aXPos[2] - aXPos[3]) 1000); +CPPUNIT_ASSERT(abs(1239520 - aXPos[0]) 1000); +CPPUNIT_ASSERT(abs(1239520 - aXPos[1]) 1000); +CPPUNIT_ASSERT(abs(1238250 - aXPos[2]) 1000); +CPPUNIT_ASSERT(abs(1238885 - aXPos[3]) 1000); -CPPUNIT_ASSERT(abs(aYPos[0] - aYPos[1]) 1000); -CPPUNIT_ASSERT(abs(aYPos[1] - aYPos[2]) 1000); -CPPUNIT_ASSERT(abs(aYPos[2] - aYPos[3]) 1000); +CPPUNIT_ASSERT(abs(2095500 - aYPos[0]) 1000); +CPPUNIT_ASSERT(abs(2094865 - aYPos[1]) 1000); +CPPUNIT_ASSERT(abs(2094230 - aYPos[2]) 1000); +CPPUNIT_ASSERT(abs(2094865 - aYPos[3]) 1000); sal_Int32 aHSize[4], aVSize[4]; aHSize[0] = getXPath(pXmlDocument, /w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/wp:extent, cx).toInt32(); @@ -586,6 +586,25 @@ DECLARE_OOXMLEXPORT_TEST(testFdo70838, fdo70838.docx) } while( nextTokenPos != -1 ); } + +// Check shape objects + +awt::Point aPos[4]; +aPos[0] = getShape(1)-getPosition(); +aPos[1] = getShape(2)-getPosition(); +aPos[2] = getShape(3)-getPosition(); +aPos[3] = getShape(4)-getPosition(); + +// certain degree of error is tolerated due to rounding in unit conversions +CPPUNIT_ASSERT(abs(4734 - aPos[0].X) 10); +CPPUNIT_ASSERT(abs(4734 - aPos[1].X) 10); +CPPUNIT_ASSERT(abs(4731 - aPos[2].X) 10); +CPPUNIT_ASSERT(abs(4733 - aPos[3].X) 10); + +CPPUNIT_ASSERT(abs(2845 - aPos[0].Y) 10); +CPPUNIT_ASSERT(abs(2843 - aPos[1].Y) 10); +CPPUNIT_ASSERT(abs(2842 - aPos[2].Y) 10); +CPPUNIT_ASSERT(abs(2843 - aPos[3].Y) 10); } DECLARE_OOXMLEXPORT_TEST(testFdo73215, fdo73215.docx) diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index c80cce0..a2cb109 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -85,7 +85,7 @@ OUString lclGetAnchorIdFromGrabBag(const SdrObject* pObj) return aResult; } -void lclMovePositionWithRotation(awt::Point aPos, sal_Int64 nRotation) +void lclMovePositionWithRotation(awt::Point aPos, const Size rSize, sal_Int64 nRotation) { // code from ImplEESdrWriter::ImplFlipBoundingBox (filter/source/msfilter/eschesdo.cxx) // TODO: refactor @@ -104,8 +104,8 @@ void lclMovePositionWithRotation(awt::Point aPos, sal_Int64 nRotation) double fCos = cos(fVal); double fSin = sin(fVal); -double nWidthHalf = (double) aPos.X / 2; -double nHeightHalf = (double) aPos.Y / 2; +double nWidthHalf = (double) rSize.Width() / 2; +double nHeightHalf = (double) rSize.Height() / 2; double nXDiff = fSin * nHeightHalf + fCos * nWidthHalf - nWidthHalf; double nYDiff = fSin * nWidthHalf + fCos * nHeightHalf - nHeightHalf; @@ -303,7 +303,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size rS // SdrObjects know their layer, consider that instead of the frame format. bOpaque = pObj-GetLayer() != pFrmFmt-GetDoc()-GetHellId() pObj-GetLayer() != pFrmFmt-GetDoc()-GetInvisibleHellId(); -