21#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
22#include <com/sun/star/sheet/XSpreadsheet.hpp>
23#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
24#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
25#include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp>
26#include <com/sun/star/sheet/XSheetCellRange.hpp>
27#include <com/sun/star/sheet/XCellAddressable.hpp>
28#include <com/sun/star/table/CellAddress.hpp>
29#include <com/sun/star/table/XCell.hpp>
30#include <com/sun/star/text/XSimpleText.hpp>
31#include <com/sun/star/text/XTextCursor.hpp>
32#include <com/sun/star/text/XTextRange.hpp>
33#include <com/sun/star/frame/XModel.hpp>
34#include <ooo/vba/office/MsoShapeType.hpp>
44 const uno::Reference< XHelperInterface >& xParent,
45 const uno::Reference< uno::XComponentContext >& xContext,
46 const uno::Reference< frame::XModel >& xModel,
47 const uno::Reference< table::XCellRange >& xRange ) :
53 throw lang::IllegalArgumentException(
"range is not set ", uno::Reference< uno::XInterface >() , 1 );
59uno::Reference< sheet::XSheetAnnotation >
62 uno::Reference< table::XCell > xCell(
mxRange->getCellByPosition(0, 0), uno::UNO_SET_THROW );
63 uno::Reference< sheet::XSheetAnnotationAnchor > xAnnoAnchor( xCell, uno::UNO_QUERY_THROW );
64 return uno::Reference< sheet::XSheetAnnotation > ( xAnnoAnchor->getAnnotation(), uno::UNO_SET_THROW );
67uno::Reference< sheet::XSheetAnnotations >
70 uno::Reference< sheet::XSheetCellRange > xSheetCellRange(
mxRange, ::uno::UNO_QUERY_THROW );
71 uno::Reference< sheet::XSpreadsheet > xSheet = xSheetCellRange->getSpreadsheet();
72 uno::Reference< sheet::XSheetAnnotationsSupplier > xAnnosSupp( xSheet, uno::UNO_QUERY_THROW );
74 return uno::Reference< sheet::XSheetAnnotations > ( xAnnosSupp->getAnnotations(), uno::UNO_SET_THROW );
80 uno::Reference< sheet::XSheetAnnotations > xAnnos =
getAnnotations();
84 sal_Int32 aCount = xAnnos->getCount();
88 uno::Reference< sheet::XSheetAnnotation > xAnno( xAnnos->getByIndex(
aIndex ), uno::UNO_QUERY_THROW );
89 table::CellAddress aAnnoAddress = xAnno->getPosition();
91 if ( aAnnoAddress.Column == aAddress.Column && aAnnoAddress.Row == aAddress.Row && aAnnoAddress.Sheet == aAddress.Sheet )
102uno::Reference< excel::XComment >
105 uno::Reference< container::XIndexAccess > xIndexAccess(
getAnnotations(), uno::UNO_QUERY_THROW );
109 return uno::Reference< excel::XComment > ( xColl->Item(
uno::Any(
Index ),
uno::Any() ), uno::UNO_QUERY_THROW );
126uno::Reference< msforms::XShape > SAL_CALL
129 uno::Reference< sheet::XSheetAnnotationShapeSupplier > xAnnoShapeSupp(
getAnnotation(), uno::UNO_QUERY_THROW );
130 uno::Reference< drawing::XShape > xAnnoShape( xAnnoShapeSupp->getAnnotationShape(), uno::UNO_SET_THROW );
131 uno::Reference< sheet::XSheetCellRange > xCellRange(
mxRange, uno::UNO_QUERY_THROW );
132 uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupp( xCellRange->getSpreadsheet(), uno::UNO_QUERY_THROW );
133 uno::Reference< drawing::XShapes > xShapes( xDrawPageSupp->getDrawPage(), uno::UNO_QUERY_THROW );
155uno::Reference< excel::XComment > SAL_CALL
162uno::Reference< excel::XComment > SAL_CALL
175 uno::Reference< text::XSimpleText > xAnnoText(
getAnnotation(), uno::UNO_QUERY_THROW );
176 OUString sAnnoText = xAnnoText->getString();
180 sal_Int16 nStart = 0;
181 bool bOverwrite =
true;
182 Overwrite >>= bOverwrite;
184 if ( aStart >>= nStart )
186 uno::Reference< text::XTextCursor > xTextCursor( xAnnoText->createTextCursor(), uno::UNO_SET_THROW );
190 xTextCursor->collapseToStart();
191 xTextCursor->gotoStart(
false );
192 xTextCursor->goRight( nStart - 1,
false );
193 xTextCursor->gotoEnd(
true );
197 xTextCursor->collapseToStart();
198 xTextCursor->gotoStart(
false );
199 xTextCursor->goRight( nStart - 1 ,
true );
202 uno::Reference< text::XTextRange > xRange( xTextCursor, uno::UNO_QUERY_THROW );
203 xAnnoText->insertString( xRange, sText, bOverwrite );
204 return xAnnoText->getString();
206 throw uno::RuntimeException(
"ScVbaComment::Text - bad Start value " );
210 uno::Reference< sheet::XCellAddressable > xCellAddr(
mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
211 table::CellAddress aAddress = xCellAddr->getCellAddress();
221 return "ScVbaComment";
224uno::Sequence< OUString >
229 "ooo.vba.excel.ScVbaComment"
css::uno::Reference< css::frame::XModel2 > mxModel
css::uno::Reference< css::uno::XComponentContext > mxContext
virtual css::uno::Reference< ov::XHelperInterface > SAL_CALL getParent() override
std::deque< AttacherIndex_Impl > aIndex
Sequence< OUString > aServiceNames
#define SAL_INFO(area, stream)
Reference< XModel > xModel