xref: /AOO41X/main/sc/inc/notesuno.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
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() throw(::com::sun::star::uno::RuntimeException);
58     virtual void SAL_CALL   setParent( const ::com::sun::star::uno::Reference<
59                                         ::com::sun::star::uno::XInterface >& Parent )
60                                     throw(::com::sun::star::lang::NoSupportException,
61                                             ::com::sun::star::uno::RuntimeException);
62 
63                             // XSimpleText
64     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL
65                             createTextCursor() throw(::com::sun::star::uno::RuntimeException);
66     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL
67                             createTextCursorByRange( const ::com::sun::star::uno::Reference<
68                                         ::com::sun::star::text::XTextRange >& aTextPosition )
69                                     throw(::com::sun::star::uno::RuntimeException);
70     virtual void SAL_CALL   insertString( const ::com::sun::star::uno::Reference<
71                                         ::com::sun::star::text::XTextRange >& xRange,
72                                         const ::rtl::OUString& aString, sal_Bool bAbsorb )
73                                     throw(::com::sun::star::uno::RuntimeException);
74     virtual void SAL_CALL   insertControlCharacter( const ::com::sun::star::uno::Reference<
75                                         ::com::sun::star::text::XTextRange >& xRange,
76                                         sal_Int16 nControlCharacter, sal_Bool bAbsorb )
77                                     throw(::com::sun::star::lang::IllegalArgumentException,
78                                         ::com::sun::star::uno::RuntimeException);
79 
80                             // XTextRange
81     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL
82                             getText() throw(::com::sun::star::uno::RuntimeException);
83     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
84                             getStart() throw(::com::sun::star::uno::RuntimeException);
85     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
86                             getEnd() throw(::com::sun::star::uno::RuntimeException);
87     virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
88     virtual void SAL_CALL   setString( const ::rtl::OUString& aString )
89                                     throw(::com::sun::star::uno::RuntimeException);
90 
91                             // XSheetAnnotation
92     virtual ::com::sun::star::table::CellAddress SAL_CALL getPosition()
93                                     throw(::com::sun::star::uno::RuntimeException);
94     virtual ::rtl::OUString SAL_CALL getAuthor() throw(::com::sun::star::uno::RuntimeException);
95     virtual ::rtl::OUString SAL_CALL getDate() throw(::com::sun::star::uno::RuntimeException);
96     virtual sal_Bool SAL_CALL getIsVisible() throw(::com::sun::star::uno::RuntimeException);
97     virtual void SAL_CALL setIsVisible( sal_Bool bIsVisible )
98                                     throw(::com::sun::star::uno::RuntimeException);
99 
100                             // XSheetAnnotationShapeSupplier
101     virtual ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > SAL_CALL
102                             getAnnotationShape()
103                                 throw(::com::sun::star::uno::RuntimeException);
104 
105                             // XServiceInfo
106     virtual ::rtl::OUString SAL_CALL getImplementationName()
107                                 throw(::com::sun::star::uno::RuntimeException);
108     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
109                                 throw(::com::sun::star::uno::RuntimeException);
110     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
111                                 throw(::com::sun::star::uno::RuntimeException);
112 
113 private:
114     SvxUnoText&         GetUnoText();
115 
116     const ScPostIt*     ImplGetNote() const;
117 
118 private:
119     ScDocShell*             pDocShell;
120     ScAddress               aCellPos;
121     SvxUnoText*             pUnoText;
122 };
123 
124 #endif
125