xref: /trunk/main/sc/inc/notesuno.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_NOTESUNO_HXX
29 #define SC_NOTESUNO_HXX
30 
31 #include <com/sun/star/sheet/XSheetAnnotation.hpp>
32 #include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/container/XChild.hpp>
35 #include <com/sun/star/text/XSimpleText.hpp>
36 #include <cppuhelper/implbase5.hxx>
37 #include <svl/lstner.hxx>
38 #include "address.hxx"
39 
40 class ScDocShell;
41 class SvxUnoText;
42 class ScPostIt;
43 
44 
45 class ScAnnotationObj : public cppu::WeakImplHelper5<
46                             com::sun::star::container::XChild,
47                             com::sun::star::text::XSimpleText,
48                             com::sun::star::sheet::XSheetAnnotation,
49                             com::sun::star::sheet::XSheetAnnotationShapeSupplier,
50                             com::sun::star::lang::XServiceInfo >,
51                         public SfxListener
52 {
53 public:
54                             ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos);
55     virtual                 ~ScAnnotationObj();
56 
57     virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
58 
59                             // XChild
60     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
61                             getParent() throw(::com::sun::star::uno::RuntimeException);
62     virtual void SAL_CALL   setParent( const ::com::sun::star::uno::Reference<
63                                         ::com::sun::star::uno::XInterface >& Parent )
64                                     throw(::com::sun::star::lang::NoSupportException,
65                                             ::com::sun::star::uno::RuntimeException);
66 
67                             // XSimpleText
68     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL
69                             createTextCursor() throw(::com::sun::star::uno::RuntimeException);
70     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL
71                             createTextCursorByRange( const ::com::sun::star::uno::Reference<
72                                         ::com::sun::star::text::XTextRange >& aTextPosition )
73                                     throw(::com::sun::star::uno::RuntimeException);
74     virtual void SAL_CALL   insertString( const ::com::sun::star::uno::Reference<
75                                         ::com::sun::star::text::XTextRange >& xRange,
76                                         const ::rtl::OUString& aString, sal_Bool bAbsorb )
77                                     throw(::com::sun::star::uno::RuntimeException);
78     virtual void SAL_CALL   insertControlCharacter( const ::com::sun::star::uno::Reference<
79                                         ::com::sun::star::text::XTextRange >& xRange,
80                                         sal_Int16 nControlCharacter, sal_Bool bAbsorb )
81                                     throw(::com::sun::star::lang::IllegalArgumentException,
82                                         ::com::sun::star::uno::RuntimeException);
83 
84                             // XTextRange
85     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL
86                             getText() throw(::com::sun::star::uno::RuntimeException);
87     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
88                             getStart() throw(::com::sun::star::uno::RuntimeException);
89     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
90                             getEnd() throw(::com::sun::star::uno::RuntimeException);
91     virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
92     virtual void SAL_CALL   setString( const ::rtl::OUString& aString )
93                                     throw(::com::sun::star::uno::RuntimeException);
94 
95                             // XSheetAnnotation
96     virtual ::com::sun::star::table::CellAddress SAL_CALL getPosition()
97                                     throw(::com::sun::star::uno::RuntimeException);
98     virtual ::rtl::OUString SAL_CALL getAuthor() throw(::com::sun::star::uno::RuntimeException);
99     virtual ::rtl::OUString SAL_CALL getDate() throw(::com::sun::star::uno::RuntimeException);
100     virtual sal_Bool SAL_CALL getIsVisible() throw(::com::sun::star::uno::RuntimeException);
101     virtual void SAL_CALL setIsVisible( sal_Bool bIsVisible )
102                                     throw(::com::sun::star::uno::RuntimeException);
103 
104                             // XSheetAnnotationShapeSupplier
105     virtual ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > SAL_CALL
106                             getAnnotationShape()
107                                 throw(::com::sun::star::uno::RuntimeException);
108 
109                             // XServiceInfo
110     virtual ::rtl::OUString SAL_CALL getImplementationName()
111                                 throw(::com::sun::star::uno::RuntimeException);
112     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
113                                 throw(::com::sun::star::uno::RuntimeException);
114     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
115                                 throw(::com::sun::star::uno::RuntimeException);
116 
117 private:
118     SvxUnoText&         GetUnoText();
119 
120     const ScPostIt*     ImplGetNote() const;
121 
122 private:
123     ScDocShell*             pDocShell;
124     ScAddress               aCellPos;
125     SvxUnoText*             pUnoText;
126 };
127 
128 #endif
129