[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source
Adam Co
rattles2013 at gmail.com
Mon Jul 22 13:28:49 PDT 2013
sw/qa/extras/ooxmlexport/data/fdo66145.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 9 +++++++++
sw/source/core/doc/docdesc.cxx | 10 +++++++++-
sw/source/filter/ww8/docxattributeoutput.cxx | 4 +++-
writerfilter/source/dmapper/PropertyIds.cxx | 1 +
writerfilter/source/dmapper/PropertyIds.hxx | 1 +
writerfilter/source/dmapper/PropertyMap.cxx | 5 +++++
7 files changed, 28 insertions(+), 2 deletions(-)
New commits:
commit 2d5978b22b402dea9dee5b468d2044ccc1208a15
Author: Adam Co <rattles2013 at gmail.com>
Date: Sun Jul 21 16:27:45 2013 +0300
fdo#66145: fix for FirstIsShared flag
Change-Id: Id8cc3829ccd5806295b0f240a570dc1d66ed0c87
Reviewed-on: https://gerrit.libreoffice.org/5002
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
diff --git a/sw/qa/extras/ooxmlexport/data/fdo66145.docx b/sw/qa/extras/ooxmlexport/data/fdo66145.docx
new file mode 100644
index 0000000..62ffdbe
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo66145.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ea46058..afaa061 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -96,6 +96,7 @@ public:
void testFdo58577();
void testBnc581614();
void testFdo66929();
+ void testFdo66145();
void testPageBorderSpacingExportCase2();
CPPUNIT_TEST_SUITE(Test);
@@ -162,6 +163,7 @@ void Test::run()
{"fdo43093.docx", &Test::testFdo43093},
{"fdo64238_a.docx", &Test::testFdo64238_a},
{"fdo64238_b.docx", &Test::testFdo64238_b},
+ {"fdo66145.docx", &Test::testFdo66145},
{"fdo56679.docx", &Test::testFdo56679},
{"fdo65400.docx", &Test::testFdo65400},
{"fdo66543.docx", &Test::testFdo66543},
@@ -1003,6 +1005,13 @@ void Test::testPageBorderSpacingExportCase2()
assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgBorders/w:right", "space", "24");
}
+void Test::testFdo66145()
+{
+ // The Writer ignored the 'First Is Shared' flag
+ uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("First Page"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(xPropertySet, "FirstIsShared")));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 920853f..67f2d18 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -189,7 +189,15 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead,
const SwFrmFmt *pRight = rHead.GetHeaderFmt();
const SwFmtCntnt &aRCnt = pRight->GetCntnt();
const SwFmtCntnt &aCnt = rFmtHead.GetHeaderFmt()->GetCntnt();
- if( !aCnt.GetCntntIdx() )
+
+ // In case "PROP_FIRST_IS_SHARED" (writefilter) is set and headerFmt has 'cntnt' node,
+ // Already anchored node is original fmt.
+ // But at this part, change startnode(below create new pSttNd).
+ // Because of this, fdo45183.rtf(sw/qa/extras/rtfimport/data/fdo45183.rtf) cannot draw picture.
+ // Compare module is sw/source/core/layout/frmtool.cxx : AppendObjs() function.
+ // In this function, because selected node index and anchored node index aren't equal, don't draw object.
+ // So, If (aCnt.GetCntntIdx() && !bLeft) - use the original headerFmt.
+ if( !aCnt.GetCntntIdx() || !bLeft )
{
const SwFrmFmt& rChgedFrmFmt = (bLeft ? rChged.GetLeft() : rChged.GetFirst());
rDescFrmFmt.SetFmtAttr( rChgedFrmFmt.GetHeader() );
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1f01d7b..f4a5608 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -422,7 +422,9 @@ void DocxAttributeOutput::StartParagraphProperties( const SwTxtNode& rNode )
if ( aNextIndex.GetNode().IsTxtNode() )
{
const SwTxtNode* pTxtNode = static_cast< SwTxtNode* >( &aNextIndex.GetNode() );
- m_rExport.OutputSectionBreaks( pTxtNode->GetpSwAttrSet(), *pTxtNode );
+ // If next node has no string - it is an empty node, so no need to output the section break
+ if (!pTxtNode->GetTxt().isEmpty())
+ m_rExport.OutputSectionBreaks( pTxtNode->GetpSwAttrSet(), *pTxtNode );
}
else if ( aNextIndex.GetNode().IsTableNode() )
{
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 5cbd552..f71ed96 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -327,6 +327,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_GRAPHIC_BITMAP: sName = "GraphicBitmap"; break;
case PROP_CHAR_SHADING_VALUE: sName = "CharShadingValue"; break;
case PROP_LABEL_CATEGORY: sName = "LabelCategory"; break;
+ case PROP_FIRST_IS_SHARED : sName = "FirstIsShared"; break;
}
::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index a62ca59..64e81fe 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -298,6 +298,7 @@ enum PropertyIds
,PROP_GRAPHIC_URL
,PROP_GRAPHIC_BITMAP
,PROP_CHAR_SHADING_VALUE
+ ,PROP_FIRST_IS_SHARED
};
struct PropertyNameSupplier_Impl;
class PropertyNameSupplier
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index de0e3ad..3a6668e 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1025,6 +1025,11 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
if( xColumns.is() )
xFirstPageStyle->setPropertyValue(
rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns ));
+
+ // If the 'Different First Page' flag is turned on - do not ignore it
+ // If the 'Diffferent First Page' is non-checked, it must be checked - the flag should be imported (so it would look in LO like in Word)
+ xFirstPageStyle->setPropertyValue(rPropNameSupplier.GetName( PROP_FIRST_IS_SHARED ), uno::makeAny( false ));
+ xFollowPageStyle->setPropertyValue(rPropNameSupplier.GetName( PROP_FIRST_IS_SHARED ), uno::makeAny( false ));
}
ApplyBorderToPageStyles( rDM_Impl.GetPageStyles( ), rDM_Impl.GetTextFactory( ), m_nBorderParams );
More information about the Libreoffice-commits
mailing list