[Libreoffice-commits] core.git: 3 commits - sc/source sw/qa

2017-05-22 Thread Justin Luth
 sc/source/core/inc/interpre.hxx   |1 
 sc/source/core/tool/interpr5.cxx  |   37 +-
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |2 -
 3 files changed, 33 insertions(+), 7 deletions(-)

New commits:
commit a9118665637dafddd41ca549d0f73948cf1d332c
Author: Justin Luth 
Date:   Mon May 22 14:24:49 2017 +0300

tdf#99227: remove unneeded specificity in unit test

The unit test should only be ensuring that the drawing is in
the footnote, not that it is located in the 5th character portion.

Change-Id: I58040dc3498b2e78000891a26b7188dfac6c72f7
Reviewed-on: https://gerrit.libreoffice.org/37906
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index d38a6ff46364..d2f4aad276aa 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -461,7 +461,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf99227, "tdf99227.docx")
 if (!pXmlDoc)
 return;
 
-assertXPath(pXmlDoc, "//w:footnote[3]/w:p/w:r[5]/w:drawing", 1);
+assertXPath(pXmlDoc, "//w:footnote/w:p/w:r/w:drawing", 1);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf104162, "tdf104162.docx")
commit 6b417ec3daaec72c736fcfe0d980ce205e589633
Author: Eike Rathke 
Date:   Mon May 22 21:13:38 2017 +0200

Handle SUMPRODUCT with svRefList arguments, tdf#58874

Change-Id: I03c2ed1f957db5ad8a67aaab45076373a020e9c1

diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 4e0ee214897c..3d994f4852ea 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1690,28 +1690,30 @@ public:
 
 void ScInterpreter::ScSumProduct()
 {
-sal_uInt8 nParamCount = GetByte();
+short nParamCount = GetByte();
 if ( !MustHaveParamCount( nParamCount, 1, 30 ) )
 return;
 
 ScMatrixRef pMatLast;
 ScMatrixRef pMat;
+size_t nRefInList = 0;
 
-pMatLast = GetMatrix();
+pMatLast = GetMatrix( nParamCount, nRefInList);
 if (!pMatLast)
 {
 PushIllegalParameter();
 return;
 }
+--nParamCount;
 
 SCSIZE nC, nCLast, nR, nRLast;
 pMatLast->GetDimensions(nCLast, nRLast);
 std::vector aResArray;
 pMatLast->GetDoubleArray(aResArray);
 
-for (sal_uInt16 i = 1; i < nParamCount; ++i)
+while (nParamCount--)
 {
-pMat = GetMatrix();
+pMat = GetMatrix( nParamCount, nRefInList);
 if (!pMat)
 {
 PushIllegalParameter();
commit 8b55956d6a07d1d6b62ffdf58277e6752513f4c0
Author: Eike Rathke 
Date:   Mon May 22 20:39:37 2017 +0200

Introduce GetMatrix() from svRefList, tdf#58874

Change-Id: Id3a2500c475835c54fbf02505f852bb33e1403cc

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 29cb26c05220..9e5de664d0dc 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -435,6 +435,7 @@ ScMatrixRef CreateMatrixFromDoubleRef( const 
formula::FormulaToken* pToken,
 inline ScTokenMatrixMap& GetTokenMatrixMap();
 static ScTokenMatrixMap* CreateTokenMatrixMap();
 ScMatrixRef GetMatrix();
+ScMatrixRef GetMatrix( short & rParam, size_t & rInRefList );
 sc::RangeMatrix GetRangeMatrix();
 
 void ScTableOp();   // repeated operations
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 2b8e65bb8752..4e0ee214897c 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -323,7 +323,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const 
FormulaToken* pToken
 }
 
 ScTokenMatrixMap::const_iterator aIter;
-if (pTokenMatrixMap && ((aIter = pTokenMatrixMap->find( pToken)) != 
pTokenMatrixMap->end()))
+if (pToken && pTokenMatrixMap && ((aIter = pTokenMatrixMap->find( pToken)) 
!= pTokenMatrixMap->end()))
 {
 /* XXX casting const away here is ugly; ScMatrixToken (to which the
  * result of this function usually is assigned) should not be forced to
@@ -340,7 +340,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const 
FormulaToken* pToken
 
 pDok->FillMatrix(*pMat, nTab1, nCol1, nRow1, nCol2, nRow2);
 
-if (pTokenMatrixMap)
+if (pToken && pTokenMatrixMap)
 pTokenMatrixMap->insert( ScTokenMatrixMap::value_type( pToken, new 
ScMatrixToken( pMat)));
 
 return pMat;
@@ -463,6 +463,29 @@ ScMatrixRef ScInterpreter::GetMatrix()
 return pMat;
 }
 
+ScMatrixRef ScInterpreter::GetMatrix( short & rParam, size_t & rRefInList )
+{
+switch (GetRawStackType())
+{
+case svRefList:
+{
+ScRange aRange( ScAddress::INITIALIZE_INVALID );
+PopDoubleRef( aRange, rParam, 

[Libreoffice-commits] core.git: 3 commits - sc/source sw/qa sw/source xmloff/source

2014-09-29 Thread Michael Stahl
 sc/source/filter/xml/XMLConsolidationContext.cxx  |4 +-
 sw/qa/extras/odfimport/data/fdo79269.odt  |binary
 sw/qa/extras/odfimport/odfimport.cxx  |   18 +++
 sw/source/core/unocore/unostyle.cxx   |   34 ++
 xmloff/source/text/XMLTextHeaderFooterContext.cxx |8 +++--
 5 files changed, 49 insertions(+), 15 deletions(-)

New commits:
commit 9ea9d4d7c5db4fa85be2e14d29fe631d58b9e60f
Author: Michael Stahl mst...@redhat.com
Date:   Mon Sep 29 23:41:22 2014 +0200

fdo#79269: sw: more cleanup of SwXStyle's FirstIsShared property

Some of the checks for it can never be true given the preceding list of
WhichIds, but there is one other case that needs the special handling.

Change-Id: Iaf396960d064d0c9f2a950c2d02db1654a669d45

diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index 81c14ac..3270a31 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -425,6 +425,23 @@ SwXStyleFamily::~SwXStyleFamily()
 
 }
 
+static bool lcl_GetHeaderFooterItem(
+SfxItemSet const rSet, OUString const rPropName, bool const bFooter,
+SvxSetItem const* o_rpItem)
+{
+SfxItemState eState = rSet.GetItemState(
+(bFooter) ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
+false, reinterpret_castconst SfxPoolItem**(o_rpItem));
+if (SfxItemState::SET != eState 
+rPropName == UNO_NAME_FIRST_IS_SHARED)
+{   // fdo#79269 header may not exist, check footer then
+eState = rSet.GetItemState(
+(!bFooter) ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
+false, reinterpret_castconst SfxPoolItem**(o_rpItem));
+}
+return SfxItemState::SET == eState;
+}
+
 static sal_Int32 lcl_GetCountOrName(const SwDoc rDoc,
 SfxStyleFamily eFamily, OUString *pString, sal_uInt16 nIndex = USHRT_MAX)
 {
@@ -2867,10 +2884,7 @@ uno::Sequence beans::PropertyState  
SwXStyle::getPropertyStates(
 {
 const SvxSetItem* pSetItem;
 
-if(SfxItemState::SET == rSet.GetItemState(
-bFooter ? SID_ATTR_PAGE_FOOTERSET : 
SID_ATTR_PAGE_HEADERSET,
-false,
-(const SfxPoolItem**)pSetItem))
+if (lcl_GetHeaderFooterItem(rSet, sPropName, bFooter, 
pSetItem))
 {
 // retarget the SfxItemSet to the HeaderFooter 
SfxSetItem's SfxItenSet
 pSourceSet = pSetItem-GetItemSet();
@@ -3420,18 +3434,8 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
 {
 // it is a Header/Footer entry, access the SvxSetItem 
containing it's information
 const SvxSetItem* pSetItem = 0;
-
-SfxItemState eState = 
aBaseImpl.GetItemSet().GetItemState(
-(bFooter) ? SID_ATTR_PAGE_FOOTERSET : 
SID_ATTR_PAGE_HEADERSET,
-false, reinterpret_castconst 
SfxPoolItem**(pSetItem));
-if (SfxItemState::SET != eState 
-rPropName == UNO_NAME_FIRST_IS_SHARED)
-{   // fdo#79269 header may not exist, check footer 
then
-eState = aBaseImpl.GetItemSet().GetItemState(
-(!bFooter) ? SID_ATTR_PAGE_FOOTERSET : 
SID_ATTR_PAGE_HEADERSET,
-false, reinterpret_castconst 
SfxPoolItem**(pSetItem));
-}
-if (SfxItemState::SET == eState)
+if (lcl_GetHeaderFooterItem(aBaseImpl.GetItemSet(),
+rPropName, bFooter, pSetItem))
 {
 lcl_putItemToSet(pSetItem, *pPropSet, *pEntry, 
pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily());
 
@@ -3532,7 +3536,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
 const bool bHeader(rPropName.startsWith(Header));
 const bool bFooter(rPropName.startsWith(Footer));
 
-if(bHeader || bFooter || rPropName == 
UNO_NAME_FIRST_IS_SHARED)
+if (bHeader || bFooter)
 {
 const SvxSetItem* pSetItem = 0;
 
@@ -3736,17 +3740,7 @@ uno::Sequence uno::Any  SAL_CALL 
SwXPageStyle::GetPropertyValues_Impl(
 const SfxItemSet rSet = xStyle-GetItemSet();
 const SvxSetItem* pSetItem;
 
-SfxItemState eState = rSet.GetItemState(
-(bFooter) ? SID_ATTR_PAGE_FOOTERSET : 
SID_ATTR_PAGE_HEADERSET,
-false, reinterpret_castconst 
SfxPoolItem**(pSetItem));
-if (SfxItemState::SET != eState 

[Libreoffice-commits] core.git: 3 commits - sc/source sw/qa writerfilter/source

2014-03-12 Thread Luboš Luňák
 sc/source/filter/excel/xestream.cxx  |2 +-
 sc/source/filter/qpro/qpro.cxx   |2 +-
 sw/qa/extras/ooxmlimport/data/large-twips.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |8 
 writerfilter/source/dmapper/ConversionHelper.cxx |7 +--
 5 files changed, 15 insertions(+), 4 deletions(-)

New commits:
commit ff768da1117d63f7c6e8513ab76927e5cc7ec9a6
Author: Luboš Luňák l.lu...@collabora.com
Date:   Wed Mar 12 13:46:26 2014 +0100

test for ignoring large twips values (cp#143)

Change-Id: I366539b83c7a93a81fd72f3f2355b09c59f7ae58

diff --git a/sw/qa/extras/ooxmlimport/data/large-twips.docx 
b/sw/qa/extras/ooxmlimport/data/large-twips.docx
new file mode 100644
index 000..6e9d82d
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/large-twips.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e67796e..bff4e1e 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1963,6 +1963,14 @@ DECLARE_OOXMLIMPORT_TEST(testI124106, i124106.docx)
 CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testLargeTwips, large-twips.docx )
+{
+// cp#143: MSO seems to ignore large twips values, we didn't, which 
resulted in different
+// layout of broken documents (text not visible in this specific document).
+OUString width = parseDump( 
/root/page/body/tab/row[1]/cell[1]/txt/infos/bounds, width );
+CPPUNIT_ASSERT( width.toInt32()  0 );
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 10b4da63e3143108ba75891e9e98fdaa2f7953ab
Author: Luboš Luňák l.lu...@collabora.com
Date:   Wed Mar 12 13:45:36 2014 +0100

ignore large twips values like MSO does (cp#143)

Change-Id: Ib304245b6ae64c15cfb6c999580f73e5e228c440

diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx 
b/writerfilter/source/dmapper/ConversionHelper.cxx
index 7f5e760..cba58b7 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -36,8 +36,6 @@ namespace writerfilter {
 namespace dmapper{
 namespace ConversionHelper{
 
-#define TWIP_TO_MM100(TWIP) ((TWIP) = 0 ? (((TWIP)*127L+36L)/72L) : 
(((TWIP)*127L-36L)/72L))
-
 sal_Int32 MakeBorderLine( sal_Int32 nSprmValue, table::BorderLine2 rToFill )
 {
 //TODO: Lines are always solid
@@ -231,6 +229,11 @@ OUString ConvertMSFormatStringToSO(
 
 sal_Int32 convertTwipToMM100(sal_Int32 _t)
 {
+// It appears that MSO handles large twip values specially, probably 
legacy 16bit handling,
+// anything that's bigger than 32767 appears to be simply ignored.
+if( _t = 0x8000 )
+return 0;
+#define TWIP_TO_MM100(TWIP) ((TWIP) = 0 ? (((TWIP)*127L+36L)/72L) : 
(((TWIP)*127L-36L)/72L))
 return TWIP_TO_MM100( _t );
 }
 
commit da9bd301c6f62e829daadb2af6a6b9633d4f1cb9
Author: Luboš Luňák l.lu...@collabora.com
Date:   Wed Mar 12 13:44:29 2014 +0100

std::strlen requires cstring include to build

Or, even simpler, don't bother with the needless namespacing.

Change-Id: I4bbb115c1c2c89881a0bf88ccd54b0f5cb8b3518

diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 6c3aa3b..289fc62 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -988,7 +988,7 @@ sax_fastparser::FSHelperPtr 
XclExpXmlStream::WriteAttributesInternal( sal_Int32
 rStream-write(   )
 -writeId( nAttribute )
 -write( =\ )
--writeEscaped( OUString(pValue, std::strlen(pValue), 
RTL_TEXTENCODING_UTF8) )
+-writeEscaped( OUString(pValue, strlen(pValue), 
RTL_TEXTENCODING_UTF8) )
 -write( \ );
 }
 
diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index 5767634..2e24dff 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -226,7 +226,7 @@ void ScQProReader::readString( OUString rString, 
sal_uInt16 nLength )
 sal_Char* pText = new sal_Char[ nLength + 1 ];
 nLength = mpStream-Read(pText, nLength);
 pText[ nLength ] = 0;
-rString = OUString( pText, std::strlen(pText), 
mpStream-GetStreamCharSet() );
+rString = OUString( pText, strlen(pText), mpStream-GetStreamCharSet() );
 delete [] pText;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits