1 #include "sal/config.h"
2 #include "com/sun/star/uno/XComponentContext.hpp"
3 #include "cppuhelper/implbase1.hxx"
4 #include "com/sun/star/office/XAnnotationAccess.hpp"
5 
6 namespace css = ::com::sun::star;
7 
8 class AnnotationAccess:
9     public ::cppu::WeakImplHelper1<
10         css::office::XAnnotationAccess>
11 {
12 public:
13     explicit AnnotationAccess(css::uno::Reference< css::uno::XComponentContext > const & context);
14 
15     // ::com::sun::star::office::XAnnotationAccess:
16     virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL createAndInsertAnnotation() throw (css::uno::RuntimeException);
17     virtual void SAL_CALL removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
18     virtual css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() throw (css::uno::RuntimeException);
19 
20 private:
21     AnnotationAccess(const AnnotationAccess &); // not defined
22     AnnotationAccess& operator=(const AnnotationAccess &); // not defined
23 
24     // destructor is private and will be called indirectly by the release call    virtual ~AnnotationAccess() {}
25 
26     css::uno::Reference< css::uno::XComponentContext > m_xContext;
27 };
28 
29 AnnotationAccess::AnnotationAccess(css::uno::Reference< css::uno::XComponentContext > const & context) :
30     m_xContext(context)
31 {}
32 
33 // ::com::sun::star::office::XAnnotationAccess:
34 css::uno::Reference< css::office::XAnnotation > SAL_CALL AnnotationAccess::createAndInsertAnnotation() throw (css::uno::RuntimeException)
35 {
36     // TODO: Exchange the default return implementation for "createAndInsertAnnotation" !!!
37     // Exchange the default return implementation.
38     // NOTE: Default initialized polymorphic structs can cause problems because of
39     // missing default initialization of primitive types of some C++ compilers or
40     // different Any initialization in Java and C++ polymorphic structs.
41     return css::uno::Reference< css::office::XAnnotation >();
42 }
43 
44 void SAL_CALL AnnotationAccess::removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException)
45 {
46     // TODO: Insert your implementation for "removeAnnotation" here.
47 }
48 
49 css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL AnnotationAccess::createAnnotationEnumeration() throw (css::uno::RuntimeException)
50 {
51     // TODO: Exchange the default return implementation for "createAnnotationEnumeration" !!!
52     // Exchange the default return implementation.
53     // NOTE: Default initialized polymorphic structs can cause problems because of
54     // missing default initialization of primitive types of some C++ compilers or
55     // different Any initialization in Java and C++ polymorphic structs.
56     return css::uno::Reference< css::office::XAnnotationEnumeration >();
57 }
58 
59 
60