void SAL_CALL
SwVbaView::setSeekView( ::sal_Int32 _seekview )
{ // FIXME: save the current cursor position, if the cursor is in the main // document, so we can jump back to this position, if the macro sets // the ViewMode back to wdSeekMainDocument
word::gotoSelectedObjectAnchor( mxModel ); switch( _seekview )
{ case word::WdSeekView::wdSeekFirstPageFooter: case word::WdSeekView::wdSeekFirstPageHeader: case word::WdSeekView::wdSeekCurrentPageFooter: case word::WdSeekView::wdSeekCurrentPageHeader: case word::WdSeekView::wdSeekPrimaryFooter: case word::WdSeekView::wdSeekPrimaryHeader: case word::WdSeekView::wdSeekEvenPagesFooter: case word::WdSeekView::wdSeekEvenPagesHeader:
{ // need to test
mxViewCursor->gotoRange( getHFTextRange( _seekview ), false ); break;
} case word::WdSeekView::wdSeekFootnotes:
{
rtl::Reference< SwXFootnotes > xFootnotes( mxModel->getSwXFootnotes() ); if( xFootnotes->getCount() > 0 )
{
uno::Reference< text::XText > xText( xFootnotes->getByIndex(0), uno::UNO_QUERY_THROW );
mxViewCursor->gotoRange( xText->getStart(), false );
} else
{
DebugHelper::runtimeexception( ERRCODE_BASIC_NO_ACTIVE_OBJECT );
} break;
} case word::WdSeekView::wdSeekEndnotes:
{
rtl::Reference< SwXFootnotes > xEndnotes( mxModel->getSwXEndnotes() ); if( xEndnotes->getCount() > 0 )
{
uno::Reference< text::XText > xText( xEndnotes->getByIndex(0), uno::UNO_QUERY_THROW );
mxViewCursor->gotoRange( xText->getStart(), false );
} else
{
DebugHelper::runtimeexception( ERRCODE_BASIC_NO_ACTIVE_OBJECT );
} break;
} case word::WdSeekView::wdSeekMainDocument:
{
rtl::Reference< SwXBodyText > xText = mxModel->getBodyText();
mxViewCursor->gotoRange( word::getFirstObjectPosition( xText ), false ); break;
}
}
}
rtl::Reference< SwXBaseStyle > xStyle;
uno::Reference< text::XText > xText; switch( nType )
{ case word::WdSeekView::wdSeekPrimaryFooter: case word::WdSeekView::wdSeekPrimaryHeader: case word::WdSeekView::wdSeekEvenPagesFooter: case word::WdSeekView::wdSeekEvenPagesHeader:
{ // The primary header is the first header of the section. // If the header is not shared between odd and even pages // the odd page's header is the primary header. If the // first page's header is different from the rest of the // document, it is NOT the primary header ( the next primary // header would be on page 3 ) // The even pages' header is only available if the header is // not shared and the current style is applied to a page with // an even page number
uno::Reference< beans::XPropertySet > xCursorProps( mxViewCursor, uno::UNO_QUERY_THROW );
OUString aPageStyleName;
xCursorProps->getPropertyValue(u"PageStyleName"_ustr) >>= aPageStyleName; if ( aPageStyleName == "First Page" )
{ // go to the beginning of where the next style is used bool hasNextPage = false;
xStyle = word::getCurrentPageStyle( mxModel ); do
{
hasNextPage = xPageCursor->jumpToNextPage();
} while( hasNextPage && ( xStyle == word::getCurrentPageStyle( mxModel ) ) );
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.