21#include <com/sun/star/text/XTextRangeCompare.hpp>
22#include <com/sun/star/text/XTextRange.hpp>
23#include <com/sun/star/text/XPageCursor.hpp>
24#include <com/sun/star/lang/XServiceInfo.hpp>
25#include <com/sun/star/lang/IllegalArgumentException.hpp>
40 uno::Reference< lang::XServiceInfo > xServiceInfo( xText, uno::UNO_QUERY_THROW );
41 OUString aImplName = xServiceInfo->getImplementationName();
42 return aImplName ==
"SwXHeadFootText";
51 OUString aPropText =
"HeaderText";
53 uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW );
55 xPageProps->getPropertyValue(
"HeaderIsShared" ) >>= isShared;
59 if( 0 == xPageCursor->getPage() % 2 )
60 aPropText =
"HeaderTextLeft";
62 aPropText =
"HeaderTextRight";
65 uno::Reference< text::XText > xHeaderText( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
66 uno::Reference< text::XTextRangeCompare > xTRC( xHeaderText, uno::UNO_QUERY_THROW );
67 uno::Reference< text::XTextRange > xTR1( xCurrentText, uno::UNO_QUERY_THROW );
68 uno::Reference< text::XTextRange > xTR2( xHeaderText, uno::UNO_QUERY_THROW );
71 if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
74 catch (
const lang::IllegalArgumentException&)
88 sal_Int32 nPage = xPageCursor->getPage();
99 bool isShared =
false;
100 xStyleProps->getPropertyValue(
"HeaderIsShared") >>= isShared;
104 return ( 0 == xPageCursor->getPage() % 2 );
116 OUString aPropText =
"FooterText";
118 uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW );
119 bool isShared =
true;
120 xPageProps->getPropertyValue(
"FooterIsShared" ) >>= isShared;
124 if( 0 == xPageCursor->getPage() % 2 )
125 aPropText =
"FooterTextLeft";
127 aPropText =
"FooterTextRight";
130 uno::Reference< text::XText > xFooterText( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
131 uno::Reference< text::XTextRangeCompare > xTRC( xFooterText, uno::UNO_QUERY_THROW );
132 uno::Reference< text::XTextRange > xTR1( xCurrentText, uno::UNO_QUERY_THROW );
133 uno::Reference< text::XTextRange > xTR2( xFooterText, uno::UNO_QUERY_THROW );
136 if( xTRC->compareRegionStarts( xTR1, xTR2 ) == 0 )
139 catch (
const lang::IllegalArgumentException&)
152 sal_Int32 nPage = xPageCursor->getPage();
163 bool isShared =
false;
164 xStyleProps->getPropertyValue(
"FooterIsShared") >>= isShared;
168 return ( 0 == xPageCursor->getPage() % 2 );
uno::Reference< text::XTextViewCursor > getXTextViewCursor(const uno::Reference< frame::XModel > &xModel)
uno::Reference< text::XText > getCurrentXText(const uno::Reference< frame::XModel > &xModel)
uno::Reference< style::XStyle > getCurrentPageStyle(const uno::Reference< frame::XModel > &xModel)
Reference< XModel > xModel