[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - writerfilter/source

2017-05-09 Thread Michael Stahl
 writerfilter/source/dmapper/PropertyMap.cxx |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 8521f4c8fb08aa37912f73a73ba1a34c2ccc97ed
Author: Michael Stahl 
Date:   Fri May 5 22:05:46 2017 +0200

tdf#104407 writerfilter: fix crash with null xRangeProperties

The m_xStartingRange is null at this point for whatever reason,
and the block immediately above this one already checks
xRangeProperties, so let's just do the same here. (Also IsNewDoc(),
where the logic between PageDescName and PageNumberOffset presumably
shouldn't differ?).

(started to crash with abaf6bde4ee91c628bd55a7ec2e876a5d0ecff6e
 as previously that code was unreachable in RTF import)

Change-Id: I20539c3a753ecea357e556ea556c3c26983ce1d1
(cherry picked from commit e4da2e5dfa9e462e0d9c23a1a60caf4b3ef2dc56)
Reviewed-on: https://gerrit.libreoffice.org/37305
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 0e7f0678aed3..ec79cb1ba653 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1416,16 +1416,18 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl& rDM_Impl )
 }
 
 if (xRangeProperties.is() && rDM_Impl.IsNewDoc())
+{
 xRangeProperties->setPropertyValue(
 getPropertyName( PROP_PAGE_DESC_NAME ),
 uno::makeAny( m_bTitlePage ?  m_sFirstPageStyleName
   : m_sFollowPageStyleName ));
 
-if(m_bPageNoRestart || m_nPageNumber >= 0)
-{
-sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< 
sal_Int16 >(m_nPageNumber) : 1;
-xRangeProperties->setPropertyValue(getPropertyName( 
PROP_PAGE_NUMBER_OFFSET ),
-uno::makeAny( nPageNumber ));
+if (m_bPageNoRestart || 0 <= m_nPageNumber)
+{
+sal_Int16 nPageNumber = m_nPageNumber >= 0 ? 
static_cast< sal_Int16 >(m_nPageNumber) : 1;
+
xRangeProperties->setPropertyValue(getPropertyName(PROP_PAGE_NUMBER_OFFSET),
+uno::makeAny(nPageNumber));
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - writerfilter/source

2017-03-31 Thread Michael Stahl
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 7d7d21cfa53c8e80fd4dd0938579d8377da5a840
Author: Michael Stahl 
Date:   Thu Mar 30 23:11:41 2017 +0200

writerfilter: DOCX import: fix handling of w:hideMark vs. w:vMerge

The problem is that Writer's layout can't handle the case where cells
are vertically merged and the last row has a fixed height; the vertically
merged cell will grow up to the height of the other cells in the non-
fixed rows plus the fixed row height, but no larger.

So for now, avoid setting fixed row heights in this case.

(regression from d1278ef4849661b9ae0eb7aaf4d74fbf91ccaf11)

Change-Id: Iac3689e0bb0d5b8a62115ca0fb1f2c553a6e6bbc
(cherry picked from commit c382c998ffdaf80c10a3f078fb4f0a37224d1158)
Reviewed-on: https://gerrit.libreoffice.org/35960
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 81220bdfec2d..36f30a36c39c 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -875,8 +875,12 @@ CellPropertyValuesSeq_t 
DomainMapperTableHandler::endTableGetCellProperties(Tabl
 bool lcl_hideMarks(PropertyMapVector1& rCellProperties)
 {
 for (PropertyMapPtr & p : rCellProperties)
-if (!p->isSet(PROP_CELL_HIDE_MARK))
+{
+// if anything is vertically merged, the row must not be set to fixed
+// as Writer's layout doesn't handle that well
+if (!p->isSet(PROP_CELL_HIDE_MARK) || p->isSet(PROP_VERTICAL_MERGE))
 return false;
+}
 return true;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - writerfilter/source

2017-03-27 Thread Caolán McNamara
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 1255360bffebef0f0521b00c4e5af57e6fe09e6b
Author: Caolán McNamara 
Date:   Fri Mar 24 13:03:50 2017 +

Resolves: tdf#106724 crash when Title property doesn't already exist

because we just write past the end instead of resizing before hand

(cherry picked from commit 4e32e8900e59f9751a60d9fdef80cdf7d500f72f)

Change-Id: I4742980a331b14ca39aff8aa6cfc27db154091ff
Reviewed-on: https://gerrit.libreoffice.org/35651
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1edf7f20d553..bebfaa7f8e02 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4346,31 +4346,31 @@ void DomainMapper_Impl::SetFieldResult(OUString const& 
rResult)
 uno::Sequence aValues ;
 aProperty >>= aValues;
 beans::PropertyValue propertyVal;
-bool bTitleFound = false;
-int i=0;
-for (; i < aValues.getLength(); i++)
+sal_Int32 nTitleFoundIndex = -1;
+for (sal_Int32 i = 0; i < aValues.getLength(); ++i)
 {
 propertyVal = aValues[i];
-if(propertyVal.Name == "Title")
+if (propertyVal.Name == "Title")
 {
-bTitleFound = true;
+nTitleFoundIndex = i;
 break;
 }
 }
-if(bTitleFound)
+if (nTitleFoundIndex != -1)
 {
 OUString titleStr;
 uno::Any aValue(propertyVal.Value);
 aValue >>= titleStr;
 titleStr = titleStr + rResult;
 propertyVal.Value = uno::makeAny(titleStr);
-aValues[i] = propertyVal;
+aValues[nTitleFoundIndex] = propertyVal;
 }
 else
 {
+aValues.realloc(aValues.getLength() + 1);
 propertyVal.Name = "Title";
 propertyVal.Value = uno::makeAny(rResult);
-aValues[i] = propertyVal;
+aValues[aValues.getLength() - 1] = propertyVal;
 }
 xFieldProperties->setPropertyValue("Fields",
 uno::makeAny(aValues));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - writerfilter/source

2017-02-07 Thread Michael Stahl
 writerfilter/source/ooxml/factoryimpl.py |   12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

New commits:
commit 7b4e37468e8d9ed1b528886d579e0ffc5eeb093d
Author: Michael Stahl 
Date:   Thu Feb 2 15:04:36 2017 +0100

writerfilter: remove gperf related declarations

Reportedly gperf 3.1 changes the signature of in_word_set(), where the
len parameter changes from unsigned int to size_t.

It turns out the only forward declaration for this function is currently
unused, so just remove it.

Change-Id: Ifbc582cd31ca37fff9ff95a3706ee902ecfe5223
(cherry picked from commit 19c0eff34a5e1de4f3aff723b7750d4e01d4ba6d)
Reviewed-on: https://gerrit.libreoffice.org/33969
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/writerfilter/source/ooxml/factoryimpl.py 
b/writerfilter/source/ooxml/factoryimpl.py
index 8584e19..dbb391c 100644
--- a/writerfilter/source/ooxml/factoryimpl.py
+++ b/writerfilter/source/ooxml/factoryimpl.py
@@ -105,17 +105,7 @@ def createFastChildContextFromStart(model):
 
 
 def fastTokenToId(model):
-print("""namespace tokenmap {
-struct token { const char* name; Token_t nToken; };
-class Perfect_Hash
-{
-private:
-  static inline unsigned int hash (const char* str, unsigned int len);
-public:
-  static struct token* in_word_set (const char* str, unsigned int len);
-};
-}
-
+print("""
 std::string fastTokenToId(sal_uInt32 nToken)
 {
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - writerfilter/source

2016-12-19 Thread Justin Luth
 writerfilter/source/dmapper/DomainMapper.cxx  |2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   14 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |6 +++---
 3 files changed, 9 insertions(+), 13 deletions(-)

New commits:
commit ce758326191d66520ecba94c8a62a98dcfa3846b
Author: Justin Luth 
Date:   Sat Dec 17 16:55:07 2016 +0300

tdf#104714 bRemove paragraph: ignore frames in Headers/Footers

Empty paragraphs are removed in certain cases. If the previous
paragraph was in a frame, then this one shouldn't be removed
(unless that previous paragraph was in a header/footer).

Most of this patch is renaming the function to clarify that
it refers to the latest paragraph, not the very last one.

As noted in original tdf#75573, there may be other paragraph
containers that should also ignore their framed status - so
I've tried to set this up to make it easier to add those cases
when proof documents are found.

Change-Id: Icd09793f652616622ab266942f4b81eeb39c0ccc
Reviewed-on: https://gerrit.libreoffice.org/32121
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
(cherry picked from commit 223dd0c15e383144bdeea040f86efb7a06f89450)
Reviewed-on: https://gerrit.libreoffice.org/32125
Tested-by: Justin Luth 

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 929671a..8d47e98 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3280,7 +3280,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
&& !bSingleParagraph
&& !( pContext && pContext->isSet(PROP_BREAK_TYPE) )
&& !m_pImpl->GetIsDummyParaAddedForTableInSection()
-   && !m_pImpl->GetIsLastParagraphFramed();
+   && !m_pImpl->GetIsPreviousParagraphFramed();
 PropertyMapPtr xContext = bRemove ? 
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) : PropertyMapPtr();
 if (xContext)
 {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 983b27c..1268634 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -216,7 +216,7 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bIsFirstParaInSection( true ),
 m_bDummyParaAddedForTableInSection( false ),
 m_bTextFrameInserted(false),
-m_bIsLastParagraphFramed( false ),
+m_bIsPreviousParagraphFramed( false ),
 m_bIsLastParaInSection( false ),
 m_bIsLastSectionGroup( false ),
 m_bIsInComments( false ),
@@ -1203,15 +1203,11 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap )
 }
 }
 
-if((pParaContext && pParaContext->IsFrameMode())
-|| (IsInHeaderFooter() && GetIsLastParagraphFramed()) )
-{
-SetIsLastParagraphFramed(true);
-}
+bool bIgnoreFrameState = IsInHeaderFooter();
+if( (!bIgnoreFrameState && pParaContext && pParaContext->IsFrameMode()) || 
(bIgnoreFrameState && GetIsPreviousParagraphFramed()) )
+SetIsPreviousParagraphFramed(true);
 else
-{
-SetIsLastParagraphFramed(false);
-}
+SetIsPreviousParagraphFramed(false);
 
 m_bParaChanged = false;
 if (!pParaContext || !pParaContext->IsFrameMode())
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index c69e114..9e4ca9a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -436,7 +436,7 @@ private:
 boolm_bIsFirstParaInSection;
 boolm_bDummyParaAddedForTableInSection;
 boolm_bTextFrameInserted;
-boolm_bIsLastParagraphFramed;
+boolm_bIsPreviousParagraphFramed;
 boolm_bIsLastParaInSection;
 boolm_bIsLastSectionGroup;
 boolm_bIsInComments;
@@ -525,8 +525,8 @@ public:
 bool GetIsDummyParaAddedForTableInSection() { return 
m_bDummyParaAddedForTableInSection;}
 void SetIsTextFrameInserted( bool bIsInserted );
 bool GetIsTextFrameInserted() { return m_bTextFrameInserted;}
-void SetIsLastParagraphFramed( bool bIsFramed ) { m_bIsLastParagraphFramed 
= bIsFramed; }
-bool GetIsLastParagraphFramed() { return m_bIsLastParagraphFramed; }
+void SetIsPreviousParagraphFramed( bool bIsFramed ) { 
m_bIsPreviousParagraphFramed = bIsFramed; }
+bool GetIsPreviousParagraphFramed() {