20#include <com/sun/star/text/XBookmarksSupplier.hpp>
21#include <com/sun/star/text/XTextDocument.hpp>
22#include <com/sun/star/text/XTextContent.hpp>
23#include <com/sun/star/text/XTextRange.hpp>
24#include <com/sun/star/view/XSelectionSupplier.hpp>
31SwVbaBookmark::SwVbaBookmark(
const uno::Reference< ooo::vba::XHelperInterface >& rParent,
const uno::Reference< uno::XComponentContext >& rContext,
32 css::uno::Reference< frame::XModel > xModel, OUString aBookmarkName ) :
35 uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier(
mxModel, uno::UNO_QUERY_THROW );
46 throw uno::RuntimeException(
"The bookmark is not valid" );
52 uno::Reference< text::XTextDocument > xTextDocument(
mxModel, uno::UNO_QUERY_THROW );
53 xTextDocument->getText()->removeTextContent(
mxBookmark );
60 uno::Reference< view::XSelectionSupplier > xSelectSupp(
mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
71 uno::Reference< container::XNamed > xNamed(
mxBookmark, uno::UNO_QUERY_THROW );
72 xNamed->setName( _name );
77 uno::Reference< text::XTextContent > xTextContent(
mxBookmark, uno::UNO_SET_THROW );
78 uno::Reference< text::XTextDocument > xTextDocument(
mxModel, uno::UNO_QUERY_THROW );
79 uno::Reference< text::XTextRange > xTextRange( xTextContent->getAnchor(), uno::UNO_SET_THROW );
80 return uno::Any( uno::Reference< word::XRange>(
new SwVbaRange(
this,
mxContext, xTextDocument, xTextRange->getStart(), xTextRange->getEnd(), xTextRange->getText() ) ) );
86 return "SwVbaBookmark";
89uno::Sequence< OUString >
94 "ooo.vba.word.Bookmark"
css::uno::Reference< css::frame::XModel2 > mxModel
css::uno::Reference< css::uno::XComponentContext > mxContext
virtual void SAL_CALL Select() override
virtual void SAL_CALL setName(const OUString &) override
virtual void SAL_CALL Delete() override
virtual css::uno::Any SAL_CALL Range() override
virtual ~SwVbaBookmark() override
virtual css::uno::Sequence< OUString > getServiceNames() override
css::uno::Reference< css::text::XTextContent > mxBookmark
SwVbaBookmark(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, css::uno::Reference< css::frame::XModel > xModel, OUString aName)
css::uno::Reference< css::frame::XModel > mxModel
virtual OUString getServiceImplName() override
virtual OUString SAL_CALL getName() override
Sequence< OUString > aServiceNames
Reference< XModel > xModel