1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unopage.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include "sal/config.h"
36 #include "cppuhelper/implbase1.hxx"
38 #include "com/sun/star/uno/XComponentContext.hpp"
39 #include "com/sun/star/office/XAnnotationEnumeration.hpp"
42 namespace css
= ::com::sun::star
;
44 using namespace ::com::sun::star::uno
;
45 using namespace ::com::sun::star::office
;
46 using namespace ::com::sun::star::container
;
47 using namespace ::com::sun::star::lang
;
51 class AnnotationEnumeration
: public ::cppu::WeakImplHelper1
< css::office::XAnnotationEnumeration
>
54 AnnotationEnumeration( const AnnotationVector
& rAnnotations
);
56 // ::com::sun::star::office::XAnnotationEnumeration:
57 virtual ::sal_Bool SAL_CALL
hasMoreElements() throw (css::uno::RuntimeException
);
58 virtual css::uno::Reference
< css::office::XAnnotation
> SAL_CALL
nextElement() throw (css::uno::RuntimeException
, css::container::NoSuchElementException
);
61 AnnotationEnumeration(const AnnotationEnumeration
&); // not defined
62 AnnotationEnumeration
& operator=(const AnnotationEnumeration
&); // not defined
64 // destructor is private and will be called indirectly by the release call virtual ~AnnotationEnumeration() {}
66 AnnotationVector maAnnotations
;
67 AnnotationVector::iterator maIter
;
70 Reference
< XAnnotationEnumeration
> createAnnotationEnumeration( const sd::AnnotationVector
& rAnnotations
)
72 return new AnnotationEnumeration( rAnnotations
);
75 AnnotationEnumeration::AnnotationEnumeration( const AnnotationVector
& rAnnotations
)
76 : maAnnotations(rAnnotations
)
78 maIter
= maAnnotations
.begin();
81 // ::com::sun::star::office::XAnnotationEnumeration:
82 ::sal_Bool SAL_CALL
AnnotationEnumeration::hasMoreElements() throw (css::uno::RuntimeException
)
84 return maIter
!= maAnnotations
.end() ? sal_True
: sal_False
;
87 css::uno::Reference
< css::office::XAnnotation
> SAL_CALL
AnnotationEnumeration::nextElement() throw (css::uno::RuntimeException
, css::container::NoSuchElementException
)
89 if( maIter
== maAnnotations
.end() )
90 throw css::container::NoSuchElementException();