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 #include "sal/config.h"
23 #include "com/sun/star/uno/XComponentContext.hpp"
24 #include "cppuhelper/implbase1.hxx"
25 #include "com/sun/star/office/XAnnotationAccess.hpp"
26 
27 namespace css = ::com::sun::star;
28 
29 class AnnotationAccess:
30     public ::cppu::WeakImplHelper1<
31         css::office::XAnnotationAccess>
32 {
33 public:
34     explicit AnnotationAccess(css::uno::Reference< css::uno::XComponentContext > const & context);
35 
36     // ::com::sun::star::office::XAnnotationAccess:
37     virtual css::uno::Reference< css::office::XAnnotation > SAL_CALL createAndInsertAnnotation() throw (css::uno::RuntimeException);
38     virtual void SAL_CALL removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException);
39     virtual css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL createAnnotationEnumeration() throw (css::uno::RuntimeException);
40 
41 private:
42     AnnotationAccess(const AnnotationAccess &); // not defined
43     AnnotationAccess& operator=(const AnnotationAccess &); // not defined
44 
45     // destructor is private and will be called indirectly by the release call    virtual ~AnnotationAccess() {}
46 
47     css::uno::Reference< css::uno::XComponentContext > m_xContext;
48 };
49 
50 AnnotationAccess::AnnotationAccess(css::uno::Reference< css::uno::XComponentContext > const & context) :
51     m_xContext(context)
52 {}
53 
54 // ::com::sun::star::office::XAnnotationAccess:
55 css::uno::Reference< css::office::XAnnotation > SAL_CALL AnnotationAccess::createAndInsertAnnotation() throw (css::uno::RuntimeException)
56 {
57     // TODO: Exchange the default return implementation for "createAndInsertAnnotation" !!!
58     // Exchange the default return implementation.
59     // NOTE: Default initialized polymorphic structs can cause problems because of
60     // missing default initialization of primitive types of some C++ compilers or
61     // different Any initialization in Java and C++ polymorphic structs.
62     return css::uno::Reference< css::office::XAnnotation >();
63 }
64 
65 void SAL_CALL AnnotationAccess::removeAnnotation(const css::uno::Reference< css::office::XAnnotation > & annotation) throw (css::uno::RuntimeException, css::lang::IllegalArgumentException)
66 {
67     // TODO: Insert your implementation for "removeAnnotation" here.
68 }
69 
70 css::uno::Reference< css::office::XAnnotationEnumeration > SAL_CALL AnnotationAccess::createAnnotationEnumeration() throw (css::uno::RuntimeException)
71 {
72     // TODO: Exchange the default return implementation for "createAnnotationEnumeration" !!!
73     // Exchange the default return implementation.
74     // NOTE: Default initialized polymorphic structs can cause problems because of
75     // missing default initialization of primitive types of some C++ compilers or
76     // different Any initialization in Java and C++ polymorphic structs.
77     return css::uno::Reference< css::office::XAnnotationEnumeration >();
78 }
79 
80 
81