diff options
author | Adam Co <rattles2013@gmail.com> | 2013-07-21 16:27:45 +0300 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-07-22 20:28:30 +0000 |
commit | 2d5978b22b402dea9dee5b468d2044ccc1208a15 (patch) | |
tree | cb0fb438dd3d6823320db7fa1f64d2de5f290504 | |
parent | f4546b72702dbe30505594a8307dd402e81a0303 (diff) |
fdo#66145: fix for FirstIsShared flag
Change-Id: Id8cc3829ccd5806295b0f240a570dc1d66ed0c87
Reviewed-on: https://gerrit.libreoffice.org/5002
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo66145.docx | bin | 0 -> 16245 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/doc/docdesc.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.cxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 5 |
7 files changed, 28 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo66145.docx b/sw/qa/extras/ooxmlexport/data/fdo66145.docx Binary files differnew file mode 100644 index 000000000000..62ffdbe22e98 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo66145.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index ea460588c9b6..afaa0610bb91 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 920853f6b463..67f2d18f5d00 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 1f01d7ba1043..f4a56087b468 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 5cbd552010de..f71ed969ebaa 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 a62ca59e1d7b..64e81feb9297 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 de0e3adca090..3a6668e9dc02 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 ); |