Kaydet (Commit) 416546ee authored tarafından Jan Holesovsky's avatar Jan Holesovsky Kaydeden (comit) Miklos Vajna

Related: fdo#82114 Kill copy'n'paste.

(cherry picked from commit 07338e20)

Conflicts:
	writerfilter/source/dmapper/DomainMapper_Impl.hxx

Change-Id: I3d457efc89873ca92a4458b1ac0a125848c942a8
üst 93caffa2
......@@ -1507,14 +1507,18 @@ uno::Reference< beans::XPropertySet > DomainMapper_Impl::appendTextSectionAfter(
return xRet;
}
void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType)
void DomainMapper_Impl::PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType)
{
const PropertyIds ePropIsOn = bHeader? PROP_HEADER_IS_ON: PROP_FOOTER_IS_ON;
const PropertyIds ePropShared = bHeader? PROP_HEADER_IS_SHARED: PROP_FOOTER_IS_SHARED;
const PropertyIds ePropTextLeft = bHeader? PROP_HEADER_TEXT_LEFT: PROP_FOOTER_TEXT_LEFT;
const PropertyIds ePropText = bHeader? PROP_HEADER_TEXT: PROP_FOOTER_TEXT;
m_bInHeaderFooterImport = true;
//get the section context
PropertyMapPtr pContext = DomainMapper_Impl::GetTopContextOfType(CONTEXT_SECTION);
//ask for the header name of the given type
//ask for the header/footer name of the given type
SectionPropertyMap* pSectionContext = dynamic_cast< SectionPropertyMap* >( pContext.get() );
if(pSectionContext)
{
......@@ -1532,21 +1536,22 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType)
{
PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
//switch on header use
//switch on header/footer use
xPageStyle->setPropertyValue(
rPropNameSupplier.GetName(PROP_HEADER_IS_ON),
uno::makeAny(sal_True) );
rPropNameSupplier.GetName(ePropIsOn),
uno::makeAny(sal_True));
// If the 'Different Even & Odd Pages' flag is turned on - do not ignore it
// Even if the 'Even' header is blank - the flag should be imported (so it would look in LO like in Word)
// Even if the 'Even' header/footer is blank - the flag should be imported (so it would look in LO like in Word)
if (GetSettingsTable()->GetEvenAndOddHeaders())
xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_SHARED), uno::makeAny( false ));
xPageStyle->setPropertyValue(rPropNameSupplier.GetName(ePropShared), uno::makeAny(false));
//set the interface
uno::Reference< text::XText > xHeaderText;
xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_HEADER_TEXT_LEFT : PROP_HEADER_TEXT) ) >>= xHeaderText;
m_aTextAppendStack.push( TextAppendContext(uno::Reference< text::XTextAppend >( xHeaderText, uno::UNO_QUERY_THROW),
m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xHeaderText->getStart())));
uno::Reference< text::XText > xText;
xPageStyle->getPropertyValue(rPropNameSupplier.GetName(bLeft? ePropTextLeft: ePropText)) >>= xText;
m_aTextAppendStack.push(TextAppendContext(uno::Reference< text::XTextAppend >(xText, uno::UNO_QUERY_THROW),
m_bIsNewDoc? uno::Reference<text::XTextCursor>(): m_xBodyText->createTextCursorByRange(xText->getStart())));
}
else
{
......@@ -1559,59 +1564,16 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType)
}
}
void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType)
{
PushPageHeaderFooter(/* bHeader = */ true, eType);
}
void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType)
{
m_bInHeaderFooterImport = true;
//get the section context
PropertyMapPtr pContext = DomainMapper_Impl::GetTopContextOfType(CONTEXT_SECTION);
//ask for the footer name of the given type
SectionPropertyMap* pSectionContext = dynamic_cast< SectionPropertyMap* >( pContext.get() );
if(pSectionContext)
{
uno::Reference< beans::XPropertySet > xPageStyle =
pSectionContext->GetPageStyle(
GetPageStyles(),
m_xTextFactory,
eType == SectionPropertyMap::PAGE_FIRST );
if (!xPageStyle.is())
return;
try
{
bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
if ((!bLeft && !GetSettingsTable()->GetEvenAndOddHeaders()) || (GetSettingsTable()->GetEvenAndOddHeaders()))
{
PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
//switch on footer use
xPageStyle->setPropertyValue(
rPropNameSupplier.GetName(PROP_FOOTER_IS_ON),
uno::makeAny(sal_True) );
// If the 'Different Even & Odd Pages' flag is turned on - do not ignore it
// Even if the 'Even' footer is blank - the flag should be imported (so it would look in LO like in Word)
if (GetSettingsTable()->GetEvenAndOddHeaders())
xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_SHARED), uno::makeAny( false ));
//set the interface
uno::Reference< text::XText > xFooterText;
xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_FOOTER_TEXT_LEFT : PROP_FOOTER_TEXT) ) >>= xFooterText;
m_aTextAppendStack.push(TextAppendContext(uno::Reference< text::XTextAppend >( xFooterText, uno::UNO_QUERY_THROW ),
m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xFooterText->getStart())));
}
else
{
m_bDiscardHeaderFooter = true;
}
}
catch( const uno::Exception& )
{
}
}
PushPageHeaderFooter(/* bHeader = */ false, eType);
}
void DomainMapper_Impl::PopPageHeaderFooter()
{
//header and footer always have an empty paragraph at the end
......
......@@ -774,6 +774,9 @@ public:
/// A sub-grabbag of m_aInteropGrabBag, like 'spacing'.
std::vector<beans::PropertyValue> m_aSubInteropGrabBag;
private:
void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType);
};
} //namespace dmapper
} //namespace writerfilter
......
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