1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SC_NOTESUNO_HXX 25 #define SC_NOTESUNO_HXX 26 27 #include <com/sun/star/sheet/XSheetAnnotation.hpp> 28 #include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp> 29 #include <com/sun/star/lang/XServiceInfo.hpp> 30 #include <com/sun/star/container/XChild.hpp> 31 #include <com/sun/star/text/XSimpleText.hpp> 32 #include <cppuhelper/implbase5.hxx> 33 #include <svl/lstner.hxx> 34 #include "address.hxx" 35 36 class ScDocShell; 37 class SvxUnoText; 38 class ScPostIt; 39 40 41 class ScAnnotationObj : public cppu::WeakImplHelper5< 42 com::sun::star::container::XChild, 43 com::sun::star::text::XSimpleText, 44 com::sun::star::sheet::XSheetAnnotation, 45 com::sun::star::sheet::XSheetAnnotationShapeSupplier, 46 com::sun::star::lang::XServiceInfo >, 47 public SfxListener 48 { 49 public: 50 ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos); 51 virtual ~ScAnnotationObj(); 52 53 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 54 55 // XChild 56 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 57 getParent(); 58 virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< 59 ::com::sun::star::uno::XInterface >& Parent ); 60 61 // XSimpleText 62 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL 63 createTextCursor(); 64 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL 65 createTextCursorByRange( const ::com::sun::star::uno::Reference< 66 ::com::sun::star::text::XTextRange >& aTextPosition ); 67 virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< 68 ::com::sun::star::text::XTextRange >& xRange, 69 const ::rtl::OUString& aString, sal_Bool bAbsorb ); 70 virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< 71 ::com::sun::star::text::XTextRange >& xRange, 72 sal_Int16 nControlCharacter, sal_Bool bAbsorb ); 73 74 // XTextRange 75 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL 76 getText(); 77 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 78 getStart(); 79 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL 80 getEnd(); 81 virtual ::rtl::OUString SAL_CALL getString(); 82 virtual void SAL_CALL setString( const ::rtl::OUString& aString ); 83 84 // XSheetAnnotation 85 virtual ::com::sun::star::table::CellAddress SAL_CALL getPosition(); 86 virtual ::rtl::OUString SAL_CALL getAuthor(); 87 virtual ::rtl::OUString SAL_CALL getDate(); 88 virtual sal_Bool SAL_CALL getIsVisible(); 89 virtual void SAL_CALL setIsVisible( sal_Bool bIsVisible ); 90 91 // XSheetAnnotationShapeSupplier 92 virtual ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > SAL_CALL 93 getAnnotationShape(); 94 95 // XServiceInfo 96 virtual ::rtl::OUString SAL_CALL getImplementationName(); 97 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ); 98 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 99 100 private: 101 SvxUnoText& GetUnoText(); 102 103 const ScPostIt* ImplGetNote() const; 104 105 private: 106 ScDocShell* pDocShell; 107 ScAddress aCellPos; 108 SvxUnoText* pUnoText; 109 }; 110 111 #endif 112