[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/qa writerfilter/source

2018-02-02 Thread Justin Luth
 sw/qa/extras/ooxmlexport/data/section_break_numbering.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx   |   18 +
 writerfilter/source/dmapper/DomainMapper.cxx   |4 ++
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 4b282dc07884f39d31edffb256e608e91eb266b3
Author: Justin Luth 
Date:   Tue Dec 20 13:51:26 2016 +0300

related to tdf#97417: fix unit test's early para numbering

The unit test's first blank page already started the paragraph
numbering. Setting it so that a contentless, single paragraph
section will not display numbering.  In fact, no dummy paragraph
should have numbering, but that would get complicated.

This is in preparation for tdf#104710.

Reviewed-on: https://gerrit.libreoffice.org/32235
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit c829e01e973ac32fb625925ce83f843ad30d94db)
Reviewed-on: https://gerrit.libreoffice.org/32326
Reviewed-by: Justin Luth 

Change-Id: I98c9926cb3cd1e3fe3cd43bf46cab22bfbec7eba
Reviewed-on: https://gerrit.libreoffice.org/49035
Reviewed-by: Justin Luth 
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/sw/qa/extras/ooxmlexport/data/section_break_numbering.docx 
b/sw/qa/extras/ooxmlexport/data/section_break_numbering.docx
new file mode 100755
index ..8b5378a771e5
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/section_break_numbering.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 3d9d749ed458..90968b7a53d0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -842,6 +842,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103982, "tdf103982.docx")
 CPPUNIT_ASSERT(nDistB >= 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf97417, "section_break_numbering.docx")
+{
+uno::Reference xProps(getParagraph(1), 
uno::UNO_QUERY_THROW);
+auto prop = xProps->getPropertyValue("NumberingRules");
+
+CPPUNIT_ASSERT_MESSAGE("1st page: first paragraph erroneous numbering",
+!xProps->getPropertyValue("NumberingRules").hasValue());
+// paragraph with numbering and section break was removed by writerfilter
+// but its numbering was copied to all following paragraphs
+CPPUNIT_ASSERT_MESSAGE("2nd page: first paragraph missing numbering",
+getProperty(getParagraph(2), 
"NumberingRules").is());
+xProps = uno::Reference(getParagraph(3), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_MESSAGE("2nd page: second paragraph erroneous numbering",
+!xProps->getPropertyValue("NumberingRules").hasValue());
+
+CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index eec33d46246f..e364d23f0091 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3277,7 +3277,9 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 // If the paragraph contains only the section properties and it has
 // no runs, we should not create a paragraph for it in Writer, 
unless that would remove the whole section.
 bool bRemove = !m_pImpl->GetParaChanged() && 
m_pImpl->GetParaSectpr() && !bSingleParagraph && 
!m_pImpl->GetIsDummyParaAddedForTableInSection();
-PropertyMapPtr xContext = bRemove ? 
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) : PropertyMapPtr();
+
+const bool bNoNumbering = bRemove || (!m_pImpl->GetParaChanged() 
&& m_pImpl->GetParaSectpr() && bSingleParagraph);
+PropertyMapPtr xContext = bNoNumbering ? 
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) : PropertyMapPtr();
 if (xContext)
 {
 // tdf#97417 delete numbering of the paragraph
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/qa writerfilter/source

2018-01-30 Thread Serge Krot
 sw/qa/extras/uiwriter/data/fdo72942-insert.docx |binary
 sw/qa/extras/uiwriter/data/fdo72942.docx|binary
 sw/qa/extras/uiwriter/uiwriter.cxx  |   36 
 writerfilter/source/dmapper/StyleSheetTable.cxx |   15 ++
 4 files changed, 51 insertions(+)

New commits:
commit 148df9e201ba197819fee34857e5b8d1a7c46058
Author: Serge Krot 
Date:   Mon Jan 29 12:17:06 2018 +0100

tdf#72942 Do not overwrite styles from the inserted doc

During inserting of the text from the external document
we should not change original default styles in
currently opened document.

Added unit test.

Change-Id: Ida754a0da5efaaa043464cd807c0b52cfb0d5670
Reviewed-on: https://gerrit.libreoffice.org/48861
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/sw/qa/extras/uiwriter/data/fdo72942-insert.docx 
b/sw/qa/extras/uiwriter/data/fdo72942-insert.docx
new file mode 100755
index ..fb1f80c4ae09
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/fdo72942-insert.docx 
differ
diff --git a/sw/qa/extras/uiwriter/data/fdo72942.docx 
b/sw/qa/extras/uiwriter/data/fdo72942.docx
new file mode 100755
index ..0906ec464271
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/fdo72942.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 90c13315ad77..e9a9b7918644 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -207,6 +207,7 @@ public:
 void testTdf105417();
 void testTdf112025();
 void testTdf114306();
+void testTdf72942();
 void testTdf113877();
 void testTdf113877NoMerge();
 
@@ -315,6 +316,7 @@ public:
 CPPUNIT_TEST(testTdf105417);
 CPPUNIT_TEST(testTdf112025);
 CPPUNIT_TEST(testTdf114306);
+CPPUNIT_TEST(testTdf72942);
 CPPUNIT_TEST(testTdf113877);
 CPPUNIT_TEST(testTdf113877NoMerge);
 CPPUNIT_TEST_SUITE_END();
@@ -3790,6 +3792,40 @@ void SwUiWriterTest::testTdf112025()
 CPPUNIT_ASSERT_EQUAL(true, getProperty(xStyle, "IsLandscape"));
 }
 
+void SwUiWriterTest::testTdf72942()
+{
+load(DATA_DIRECTORY, "fdo72942.docx");
+
+// get a page cursor
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+uno::Reference 
xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+xCursor->jumpToEndOfPage();
+
+OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"fdo72942-insert.docx";
+uno::Sequence 
aPropertyValues(comphelper::InitPropertySequence({{ "Name", 
uno::makeAny(insertFileid) }}));
+lcl_dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+
+// check styles of paragraphs
+const uno::Reference< text::XTextRange > xRun1 = getRun(getParagraph(1), 
1);
+CPPUNIT_ASSERT_EQUAL(OUString("Default English (Liberation serif) text 
with "), xRun1->getString());
+CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), 
getProperty(xRun1, "CharFontName"));
+
+const uno::Reference< text::XTextRange > xRun2 = getRun(getParagraph(2), 
1);
+CPPUNIT_ASSERT_EQUAL(OUString("Header 1 English text (Liberation sans) 
with "), xRun2->getString());
+CPPUNIT_ASSERT_EQUAL(OUString("Liberation Sans"), 
getProperty(xRun2, "CharFontName"));
+
+const uno::Reference< text::XTextRange > xRun3 = getRun(getParagraph(4), 
1);
+CPPUNIT_ASSERT_EQUAL(OUString("Default German text (Calibri) with "), 
xRun3->getString());
+//CPPUNIT_ASSERT_EQUAL(OUString("Calibri"), getProperty(xRun3, 
"CharFontName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), 
getProperty(xRun3, "CharFontName"));
+
+const uno::Reference< text::XTextRange > xRun4 = getRun(getParagraph(5), 
1);
+CPPUNIT_ASSERT_EQUAL(OUString("Header 1 German text (Calibri Light) with 
"), xRun4->getString());
+//CPPUNIT_ASSERT_EQUAL(OUString("Calibri Light"), 
getProperty(xRun4, "CharFontName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Liberation Sans"), 
getProperty(xRun4, "CharFontName"));
+}
+
 void SwUiWriterTest::testTdf114306()
 {
 load(DATA_DIRECTORY, "fdo114306.odt");
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 73348739d36f..10fff35235a5 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -902,6 +902,13 @@ uno::Sequence< OUString > PropValVector::getNames()
 
 void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
 {
+if (!m_pImpl->m_bIsNewDoc)
+{
+// tdf#72942: do not import styles from document being inserted,
+// while they corrupts original styles in master document
+return;
+}
+
 try
 {
 uno::Reference< style::XStyleFamiliesSupplier > 

[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/qa writerfilter/source

2018-01-22 Thread Justin Luth
 sw/qa/extras/ooxmlexport/data/tdf102466.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |   34 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 +-
 3 files changed, 36 insertions(+), 2 deletions(-)

New commits:
commit 686585dffceba87cacabb38ee58295b873bf4751
Author: Justin Luth 
Date:   Tue Dec 20 12:19:43 2016 +0300

related to tdf#97417: fix unit test page count

The unit test should have been showing a blank page before the
content page.

Non-section paragraphs should not remove the first/last status.
Frames were already excluded, now this patch also
excludes header/footer paragraphs.

This is in preparation for tdf#104710.

Change-Id: I686944843302160d6f6bbbcb73f01c836179aa9f
Reviewed-on: https://gerrit.libreoffice.org/32234
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 

tdf#102466 Added unit test: ensure 1st page is not missing

Change-Id: Icbc97d6a69447575aa2980a700a663ece226f781
Reviewed-on: https://gerrit.libreoffice.org/44273
Tested-by: Jenkins 
Reviewed-by: Serge Krot (CIB) 
Reviewed-on: https://gerrit.libreoffice.org/48300
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf102466.docx 
b/sw/qa/extras/ooxmlexport/data/tdf102466.docx
new file mode 100644
index ..68a88799ce66
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf102466.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 0fdfe003e161..a4c8cbdcd511 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1039,6 +1039,40 @@ DECLARE_OOXMLEXPORT_TEST(testTdf92521, "tdf92521.odt")
 assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr", 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf102466, "tdf102466.docx")
+{
+// the problem was: file is truncated: the first page is missing.
+
+// check how much pages we have
+CPPUNIT_ASSERT_EQUAL(10, getPages());
+
+// check content of the first page
+{
+uno::Reference 
xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+uno::Reference 
xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+
+// no border
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(xFrame, 
"LineWidth"));
+}
+
+// Make sure we have 19 tables created
+{
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(19), xTables->getCount( ));
+
+// check the text inside first cell of the first table
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+
+const OUString aMustHaveText = "Requerimientos del  Cliente";
+const OUString aActualText   = xCell->getString();
+
+CPPUNIT_ASSERT(aActualText.indexOf(aMustHaveText) > 0);
+}
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf81345_045Original,"tdf81345.docx")
 {
 //Header wasn't replaced  and columns were missing because no new style 
was created.
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f41e406409dc..a9ea0a2ce59a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1203,8 +1203,8 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap )
 }
 
 m_bParaChanged = false;
-if( !IsInShape() && (!pParaContext || !pParaContext->IsFrameMode()) )
-{ // If the paragraph is in a frame, shape or header/footer, it's not a 
paragraph of the section itself.
+if( !IsInHeaderFooter() && (!pParaContext || !pParaContext->IsFrameMode()) 
)
+{ // If the paragraph is in a frame or header/footer, it's not a paragraph 
of the section itself.
 SetIsFirstParagraphInSection(false);
 SetIsLastParagraphInSection(false);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/qa writerfilter/source

2018-01-08 Thread Caolán McNamara
 sw/qa/core/data/ooxml/pass/ofz4825-1.docx |binary
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b01146c534b8a2edf0b73b528bf1428e45ee8bd1
Author: Caolán McNamara 
Date:   Fri Dec 29 14:40:13 2017 +

ofz#4825 Bad-cast

Change-Id: I57f180c9e28d5f2439efcc1f2726d8fabc108bc9
Reviewed-on: https://gerrit.libreoffice.org/47176
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 752684babf5ebc4ac6dfa4a7ea30f7f7cb4a9e4a)

diff --git a/sw/qa/core/data/ooxml/pass/ofz4825-1.docx 
b/sw/qa/core/data/ooxml/pass/ofz4825-1.docx
new file mode 100644
index ..ce8e6493af45
Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/ofz4825-1.docx differ
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index d3a6a02d3ab6..49d54521fc39 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1847,7 +1847,7 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
 bool bSkipImages = getDocument()->IsSkipImages() && 
oox::getNamespace(Element) == static_cast(NMSP_dml) &&
 !((oox::getBaseToken(Element) == XML_linkedTxbx) || 
(oox::getBaseToken(Element) == XML_txbx));
 
-if ( bInNamespaces && ((!bIsWrap && !bIsSignatureLine) || 
static_cast(mpParent)->isShapeSent()) )
+if ( bInNamespaces && ((!bIsWrap && !bIsSignatureLine) || 
dynamic_cast(*mpParent).isShapeSent()) )
 xResult.set(OOXMLFactory::createFastChildContextFromStart(this, 
Element));
 else if (mxContext.is()  && !bSkipImages)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/qa writerfilter/source

2017-11-09 Thread Vasily Melenchuk
 sw/qa/extras/ooxmlimport/data/tdf43017.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   11 +++
 writerfilter/source/dmapper/DomainMapper.cxx  |8 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   21 +
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |   17 +
 5 files changed, 49 insertions(+), 8 deletions(-)

New commits:
commit d280a38913d37d5b58cd72ff3798ca4a89028197
Author: Vasily Melenchuk 
Date:   Fri Aug 18 22:14:08 2017 +0300

tdf#43017: Support for DOCX hyperlinks character properties

Here goes a bunch of related changes:

1. Create new character style based on current character properties

2. Apply created style to hyperlink object

3. Fixes to predefined style names usage in w:rPr

4. Disable style usage for hyperlinks in TOC: they will receive later
anoter styles

Reviewed-on: https://gerrit.libreoffice.org/41784
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit eaa9cf6a3069fba3d82c046f0041bfb537d9e648)

Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
writerfilter/source/dmapper/DomainMapper_Impl.hxx

Change-Id: I1a228992eb7c1e259a6a811aa7f959debaae4f35

diff --git a/sw/qa/extras/ooxmlimport/data/tdf43017.docx 
b/sw/qa/extras/ooxmlimport/data/tdf43017.docx
new file mode 100644
index ..c3372e11a0c8
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf43017.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index b55b17c05053..a9be7f45cb75 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -3286,6 +3286,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf96218, "tdf96218.docx")
 CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf43017, "tdf43017.docx")
+{
+uno::Reference xParagraph = getParagraph(1);
+uno::Reference xText = getRun(xParagraph, 2, "kick the 
bucket");
+
+// Ensure that hyperlink text color is not blue (0xff), but default 
(-1)
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Hyperlink color should be black!",
+sal_Int32(-1), getProperty(xText, "CharColor"));
+}
+
+// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 46aef6bf81c7..eec33d46246f 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2155,11 +2155,11 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 {
 OUString sConvertedName( 
m_pImpl->GetStyleSheetTable()->ConvertStyleName( sStringValue, true ) );
 // First check if the style exists in the document.
-StyleSheetEntryPtr pEntry = m_pImpl->GetStyleSheetTable( 
)->FindStyleSheetByStyleName( sConvertedName );
+StyleSheetEntryPtr pEntry = m_pImpl->GetStyleSheetTable( 
)->FindStyleSheetByConvertedStyleName( sConvertedName );
 bool bExists = pEntry.get( ) && ( pEntry->nStyleTypeCode == 
STYLE_TYPE_CHAR );
-
-// Add the property if the style exists
-if ( bExists && m_pImpl->GetTopContext() )
+// Add the property if the style exists, but do not add it 
elements in TOC:
+// they will receive later another style references from TOC
+if ( bExists && m_pImpl->GetTopContext() && !m_pImpl->IsInTOC())
 m_pImpl->GetTopContext()->Insert( PROP_CHAR_STYLE_NAME, 
uno::makeAny( sConvertedName ) );
 }
 break;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 19d6f1a82985..c5ca29a02510 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1283,7 +1283,18 @@ void DomainMapper_Impl::appendTextPortion( const 
OUString& rString, const Proper
 }
 }
 else
+{
+if (IsOpenField() && GetTopFieldContext()->GetFieldId() == 
FIELD_HYPERLINK)
+{
+// It is content of hyperlink field. We need to create 
and remember
+// character style for later applying to hyperlink
+PropertyValueVector_t aProps = 
comphelper::sequenceToContainer< PropertyValueVector_t 
>(GetTopContext()->GetPropertyValues());
+OUString sHyperlinkStyleName = 
GetStyleSheetTable()->getOrCreateCharStyle(aProps, /*bAlwaysCreate=*/false);
+

[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/qa writerfilter/source

2017-11-01 Thread Serge Krot
 sw/qa/extras/ooxmlimport/data/tdf87533_bidi.docx |binary
 writerfilter/source/dmapper/StyleSheetTable.cxx  |   42 ++-
 2 files changed, 34 insertions(+), 8 deletions(-)

New commits:
commit 70ff72e0d5f31f0ed06ee3a23acea50e3cfa6eb4
Author: Serge Krot 
Date:   Thu Sep 28 12:53:30 2017 +0200

tdf#87533 Fixed initialization of writing mode for paragraph

During parsing of the docx the paragraph without w:bidi
should take this value from style or from default paragraph properties,

tdf#87533 explicitly set writing mode value based on default properties

Change-Id: Ie33f0d1cd3551c4053a47e6faf7dcac71765db65
3fcf514a901f0630d749ba0ddb6361d6db3ce1b5
Reviewed-on: https://gerrit.libreoffice.org/42895
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
Reviewed-on: https://gerrit.libreoffice.org/44175
Tested-by: Thorsten Behrens 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf87533_bidi.docx 
b/sw/qa/extras/ooxmlimport/data/tdf87533_bidi.docx
new file mode 100644
index ..11e6511cac19
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf87533_bidi.docx 
differ
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index ae00da431bd3..73348739d36f 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1033,10 +1033,33 @@ void StyleSheetTable::ApplyStyleSheets( const 
FontTablePtr& rFontTable )
 pEntry->pProperties->Insert(PROP_PARA_WIDOWS, aTwo, 
false);
 pEntry->pProperties->Insert(PROP_PARA_ORPHANS, aTwo, 
false);
 
-// Left-to-right direction if not already set
-pEntry->pProperties->Insert(PROP_WRITING_MODE, 
uno::makeAny( sal_Int16(text::WritingMode_LR_TB) ), false);
-// Left alignment if not already set
-pEntry->pProperties->Insert(PROP_PARA_ADJUST, 
uno::makeAny( sal_Int16(style::ParagraphAdjust_LEFT) ), false);
+// tdf#87533 explicitly set writing mode value based 
on default paragraph properties
+// specified inside styles.xml: 

+{
+const PropertyMapPtr & propertyMap = 
m_pImpl->m_pDefaultParaProps;
+
+boost::optional writingMode;
+if (propertyMap && (writingMode = 
propertyMap->getProperty(PROP_WRITING_MODE)))
+{
+pEntry->pProperties->Insert(PROP_WRITING_MODE, 
writingMode->second, false);
+}
+else
+{
+// Left-to-right direction if not already set
+pEntry->pProperties->Insert(PROP_WRITING_MODE, 
uno::makeAny(sal_Int16(text::WritingMode_LR_TB)), false);
+}
+
+boost::optional paraAdjust;
+if (propertyMap && (paraAdjust = 
propertyMap->getProperty(PROP_PARA_ADJUST)))
+{
+pEntry->pProperties->Insert(PROP_PARA_ADJUST, 
paraAdjust->second, false);
+}
+else
+{
+// Left alignment if not already set
+pEntry->pProperties->Insert(PROP_PARA_ADJUST, 
uno::makeAny(sal_Int16(style::ParagraphAdjust_LEFT)), false);
+}
+}
 }
 
 auto aPropValues = comphelper::sequenceToContainer< 
std::vector >(pEntry->pProperties->GetPropertyValues());
@@ -1437,6 +1460,8 @@ OUString StyleSheetTable::ConvertStyleName( const 
OUString& rWWName, bool bExten
 ++aIt;
 }
 }
+
+// create a map only once
 if(m_pImpl->m_aStyleNameMap.empty())
 {
 for( sal_uInt32 nPair = 0; nPair < SAL_N_ELEMENTS(aStyleNamePairs)/2; 
++nPair)
@@ -1450,15 +1475,15 @@ OUString StyleSheetTable::ConvertStyleName( const 
OUString& rWWName, bool bExten
 }
 }
 }
+
+// find style-name using map
 StringPairMap_t::iterator aIt = m_pImpl->m_aStyleNameMap.find( sRet );
-bool bConverted = false;
+
 if (aIt != m_pImpl->m_aStyleNameMap.end())
 {
-bConverted = true;
 sRet = aIt->second;
 }
-
-if (!bConverted)
+else
 {
 // SwStyleNameMapper doc says: If the UI style name equals a
 // programmatic name, then it must append " (user)" to the end.
@@ -1466,6 +1491,7 @@ OUString StyleSheetTable::ConvertStyleName( const 
OUString& rWWName, bool bExten
 if (aReservedIt != 

[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/qa writerfilter/source

2017-10-11 Thread Vasily Melenchuk
 sw/qa/extras/ooxmlexport/data/tdf90789-2.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx |6 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 
 3 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit b7e5920bb43c2c7e7d98a235a12c5bb2536f8685
Author: Vasily Melenchuk 
Date:   Mon Oct 9 19:10:18 2017 +0300

tdf#90789: DOCX paragraphs in shapes like frames do not belong to section.

Change-Id: I60644bd62e2a2ac97a97f0a492b146dc69456cd6
Reviewed-on: https://gerrit.libreoffice.org/43291
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf90789-2.docx 
b/sw/qa/extras/ooxmlexport/data/tdf90789-2.docx
new file mode 100644
index ..2f831d722ba9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf90789-2.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
index 4f2f878a249c..4283909df1cf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
@@ -1224,6 +1224,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103090, "tdf103090.odt")
 CPPUNIT_ASSERT_EQUAL(expectedFieldName, fieldName);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf90789_2, "tdf90789-2.docx")
+{
+// Section break before frame and shape was ignored
+CPPUNIT_ASSERT_EQUAL( 3, getPages() );
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2274c47ee3a9..bd532b87cc19 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1194,10 +1194,10 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap )
 }
 
 m_bParaChanged = false;
-if (!pParaContext || !pParaContext->IsFrameMode())
-{ // If the paragraph is in a frame, it's not a paragraph of the section 
itself.
-m_bIsFirstParaInSection = false;
-m_bIsLastParaInSection = false;
+if( !IsInShape() && (!pParaContext || !pParaContext->IsFrameMode()) )
+{ // If the paragraph is in a frame, shape or header/footer, it's not a 
paragraph of the section itself.
+SetIsFirstParagraphInSection(false);
+SetIsLastParagraphInSection(false);
 }
 
 if (pParaContext)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits