Kaydet (Commit) 2d5978b2 authored tarafından Adam Co's avatar Adam Co Kaydeden (comit) Fridrich Strba

fdo#66145: fix for FirstIsShared flag

Change-Id: Id8cc3829ccd5806295b0f240a570dc1d66ed0c87
Reviewed-on: https://gerrit.libreoffice.org/5002Reviewed-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
Tested-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
üst f4546b72
......@@ -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();
......
......@@ -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() );
......
......@@ -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() )
{
......
......@@ -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 ));
......
......@@ -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
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment