summaryrefslogtreecommitdiff
path: root/xmloff/source/text/XMLTextHeaderFooterContext.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-07-05 11:37:26 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-07-05 11:39:51 +0200
commit7ac60704206d229b45dd002ca3b9d70c4c64034e (patch)
tree2400312478b98c0f34f8a41a1a6857d86b77be96 /xmloff/source/text/XMLTextHeaderFooterContext.cxx
parentc3dc9a3ef3cb9bc28051ef11d8b7fa5afaf819ef (diff)
xmloff: implement first page header/footer import/export
Change-Id: I920c236125ae044fe66cf0eacafdfc94ef81a4fd
Diffstat (limited to 'xmloff/source/text/XMLTextHeaderFooterContext.cxx')
-rw-r--r--xmloff/source/text/XMLTextHeaderFooterContext.cxx53
1 files changed, 41 insertions, 12 deletions
diff --git a/xmloff/source/text/XMLTextHeaderFooterContext.cxx b/xmloff/source/text/XMLTextHeaderFooterContext.cxx
index 6c0c7210ea71..c69ff1eb6e7b 100644
--- a/xmloff/source/text/XMLTextHeaderFooterContext.cxx
+++ b/xmloff/source/text/XMLTextHeaderFooterContext.cxx
@@ -52,19 +52,22 @@ XMLTextHeaderFooterContext::XMLTextHeaderFooterContext( SvXMLImport& rImport, sa
const uno::Reference<
xml::sax::XAttributeList > &,
const Reference < XPropertySet > & rPageStylePropSet,
- sal_Bool bFooter, sal_Bool bLft ) :
+ sal_Bool bFooter, sal_Bool bLft, sal_Bool bFrst ) :
SvXMLImportContext( rImport, nPrfx, rLName ),
xPropSet( rPageStylePropSet ),
sOn( bFooter ? OUString(RTL_CONSTASCII_USTRINGPARAM( "FooterIsOn" )) : OUString(RTL_CONSTASCII_USTRINGPARAM( "HeaderIsOn" )) ),
sShareContent( bFooter ? OUString(RTL_CONSTASCII_USTRINGPARAM( "FooterIsShared" ))
: OUString(RTL_CONSTASCII_USTRINGPARAM( "HeaderIsShared" )) ),
+ sShareContentFirst( bFooter ? OUString("FooterIsSharedFirst" ) : OUString( "HeaderIsSharedFirst" ) ),
sText( bFooter ? OUString(RTL_CONSTASCII_USTRINGPARAM( "FooterText" )) : OUString(RTL_CONSTASCII_USTRINGPARAM( "HeaderText" )) ),
+ sTextFirst(bFooter ? OUString("FooterTextFirst") : OUString("HeaderTextFirst")),
sTextLeft( bFooter ? OUString(RTL_CONSTASCII_USTRINGPARAM( "FooterTextLeft" ))
: OUString(RTL_CONSTASCII_USTRINGPARAM( "HeaderTextLeft" )) ),
bInsertContent( sal_True ),
- bLeft( bLft )
+ bLeft( bLft ),
+ bFirst( bFrst )
{
- if( bLeft )
+ if( bLeft || bFirst )
{
Any aAny;
@@ -73,14 +76,29 @@ XMLTextHeaderFooterContext::XMLTextHeaderFooterContext( SvXMLImport& rImport, sa
if( bOn )
{
- aAny = xPropSet->getPropertyValue( sShareContent );
- sal_Bool bShared = *(sal_Bool *)aAny.getValue();
- if( bShared )
+ if (bLeft)
{
- // Don't share headers any longer
- bShared = sal_False;
- aAny.setValue( &bShared, ::getBooleanCppuType() );
- xPropSet->setPropertyValue( sShareContent, aAny );
+ aAny = xPropSet->getPropertyValue( sShareContent );
+ sal_Bool bShared = *(sal_Bool *)aAny.getValue();
+ if( bShared )
+ {
+ // Don't share headers any longer
+ bShared = sal_False;
+ aAny.setValue( &bShared, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sShareContent, aAny );
+ }
+ }
+ if (bFirst)
+ {
+ aAny = xPropSet->getPropertyValue( sShareContentFirst );
+ sal_Bool bSharedFirst = *(sal_Bool *)aAny.getValue();
+ if( bSharedFirst )
+ {
+ // Don't share first/right headers any longer
+ bSharedFirst = sal_False;
+ aAny.setValue( &bSharedFirst, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sShareContentFirst, aAny );
+ }
}
}
else
@@ -108,11 +126,14 @@ SvXMLImportContext *XMLTextHeaderFooterContext::CreateChildContext(
{
sal_Bool bRemoveContent = sal_True;
Any aAny;
- if( bLeft )
+ if( bLeft || bFirst )
{
// Headers and footers are switched on already,
// and they aren't shared.
- aAny = xPropSet->getPropertyValue( sTextLeft );
+ if (bLeft)
+ aAny = xPropSet->getPropertyValue( sTextLeft );
+ else
+ aAny = xPropSet->getPropertyValue( sTextFirst );
}
else
{
@@ -140,6 +161,14 @@ SvXMLImportContext *XMLTextHeaderFooterContext::CreateChildContext(
aAny.setValue( &bShared, ::getBooleanCppuType() );
xPropSet->setPropertyValue( sShareContent, aAny );
}
+ aAny = xPropSet->getPropertyValue( sShareContentFirst );
+ sal_Bool bSharedFirst = *(sal_Bool *)aAny.getValue();
+ if( !bSharedFirst )
+ {
+ bSharedFirst = sal_True;
+ aAny.setValue( &bSharedFirst, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sShareContentFirst, aAny );
+ }
aAny = xPropSet->getPropertyValue( sText );
}