Kaydet (Commit) 7193d4ef authored tarafından Miklos Vajna's avatar Miklos Vajna

n#750935 fix docx import of w:evenAndOddHeaders

Change-Id: I172073bac10e8d0449c0f5c0a226dd7ace013376
üst a234804c
...@@ -193,7 +193,20 @@ void Test::testN750935() ...@@ -193,7 +193,20 @@ void Test::testN750935()
uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
xCursor->jumpToLastPage(); xCursor->jumpToLastPage();
// Some page break types were ignores, resulting in less pages.
CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor->getPage()); CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor->getPage());
/*
* The problem was that the header and footer was not shared.
*
* xray ThisComponent.StyleFamilies.PageStyles.Default.FooterIsShared
*/
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY);
sal_Bool bValue = false;
xPropertySet->getPropertyValue("HeaderIsShared") >>= bValue;
CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
xPropertySet->getPropertyValue("FooterIsShared") >>= bValue;
CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
} }
void Test::testN757890() void Test::testN757890()
......
...@@ -1271,7 +1271,7 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType) ...@@ -1271,7 +1271,7 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType)
uno::makeAny(sal_True) ); uno::makeAny(sal_True) );
// if a left header is available then header are not shared // if a left header is available then header are not shared
bool bLeft = eType == SectionPropertyMap::PAGE_LEFT; bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
if( bLeft ) if( bLeft && m_pSettingsTable->GetEvenAndOddHeaders())
xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_SHARED), uno::makeAny( false )); xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_SHARED), uno::makeAny( false ));
//set the interface //set the interface
...@@ -1310,7 +1310,7 @@ void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType) ...@@ -1310,7 +1310,7 @@ void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType)
uno::makeAny(sal_True) ); uno::makeAny(sal_True) );
// if a left header is available then footer is not shared // if a left header is available then footer is not shared
bool bLeft = eType == SectionPropertyMap::PAGE_LEFT; bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
if( bLeft ) if( bLeft && m_pSettingsTable->GetEvenAndOddHeaders())
xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_SHARED), uno::makeAny( false )); xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_SHARED), uno::makeAny( false ));
//set the interface //set the interface
uno::Reference< text::XText > xFooterText; uno::Reference< text::XText > xFooterText;
......
...@@ -76,6 +76,7 @@ struct SettingsTable_Impl ...@@ -76,6 +76,7 @@ struct SettingsTable_Impl
::rtl::OUString m_sSalt; ::rtl::OUString m_sSalt;
bool m_bLinkStyles; bool m_bLinkStyles;
sal_Int16 m_nZoomFactor; sal_Int16 m_nZoomFactor;
bool m_bEvenAndOddHeaders;
SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) : SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) :
m_rDMapper( rDMapper ) m_rDMapper( rDMapper )
...@@ -94,6 +95,7 @@ struct SettingsTable_Impl ...@@ -94,6 +95,7 @@ struct SettingsTable_Impl
, m_nCryptSpinCount(0) , m_nCryptSpinCount(0)
, m_bLinkStyles(false) , m_bLinkStyles(false)
, m_nZoomFactor(0) , m_nZoomFactor(0)
, m_bEvenAndOddHeaders(false)
{} {}
}; };
...@@ -165,6 +167,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) ...@@ -165,6 +167,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
case NS_ooxml::LN_CT_Settings_linkStyles: // 92663; case NS_ooxml::LN_CT_Settings_linkStyles: // 92663;
m_pImpl->m_bLinkStyles = nIntValue; m_pImpl->m_bLinkStyles = nIntValue;
break; break;
case NS_ooxml::LN_CT_Settings_evenAndOddHeaders:
m_pImpl->m_bEvenAndOddHeaders = nIntValue;
break;
case NS_ooxml::LN_CT_Settings_noPunctuationKerning: // 92526; case NS_ooxml::LN_CT_Settings_noPunctuationKerning: // 92526;
m_pImpl->m_bNoPunctuationKerning = nIntValue ? true : false; m_pImpl->m_bNoPunctuationKerning = nIntValue ? true : false;
break; break;
...@@ -230,6 +235,11 @@ sal_Int16 SettingsTable::GetZoomFactor() const ...@@ -230,6 +235,11 @@ sal_Int16 SettingsTable::GetZoomFactor() const
return m_pImpl->m_nZoomFactor; return m_pImpl->m_nZoomFactor;
} }
bool SettingsTable::GetEvenAndOddHeaders() const
{
return m_pImpl->m_bEvenAndOddHeaders;
}
void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc ) void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc )
{ {
uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY ); uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );
......
...@@ -70,6 +70,8 @@ class WRITERFILTER_DLLPRIVATE SettingsTable : public LoggedProperties, public Lo ...@@ -70,6 +70,8 @@ class WRITERFILTER_DLLPRIVATE SettingsTable : public LoggedProperties, public Lo
/// What's the zoom factor set in percents? /// What's the zoom factor set in percents?
sal_Int16 GetZoomFactor() const; sal_Int16 GetZoomFactor() const;
bool GetEvenAndOddHeaders() const;
void ApplyProperties( uno::Reference< text::XTextDocument > xDoc ); void ApplyProperties( uno::Reference< text::XTextDocument > xDoc );
private: private:
......
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