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: AnnotationPanel.hxx,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 #ifndef _SD_ANNOTATIONMANAGER_IMPL_HXX
32 #define _SD_ANNOTATIONMANAGER_IMPL_HXX
34 #include <com/sun/star/document/XEventListener.hpp>
35 #include <com/sun/star/office/XAnnotationAccess.hpp>
37 #include <rtl/ustring.hxx>
39 #include <cppuhelper/basemutex.hxx>
40 #include <cppuhelper/compbase1.hxx>
42 #include "ViewShellBase.hxx"
44 #include "annotationtag.hxx"
51 typedef std::vector
< rtl::Reference
< AnnotationTag
> > AnnotationTagVector
;
54 class EventMultiplexerEvent
;
57 typedef ::cppu::WeakComponentImplHelper1
<
58 com::sun::star::document::XEventListener
59 > AnnotationManagerImplBase
;
61 class AnnotationManagerImpl
: private ::cppu::BaseMutex
, public AnnotationManagerImplBase
64 AnnotationManagerImpl( ViewShellBase
& rViewShellBase
);
68 // WeakComponentImplHelper1
69 virtual void SAL_CALL
disposing ();
72 virtual void SAL_CALL
notifyEvent( const ::com::sun::star::document::EventObject
& Event
) throw (::com::sun::star::uno::RuntimeException
);
73 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
);
76 void ExecuteAnnotation (SfxRequest
& rRequest
);
77 void GetAnnotationState (SfxItemSet
& rItemSet
);
79 void ExecuteInsertAnnotation(SfxRequest
& rReq
);
80 void ExecuteDeleteAnnotation(SfxRequest
& rReq
);
81 void ExecuteReplyToAnnotation(SfxRequest
& rReq
);
83 void SelectNextAnnotation(bool bForeward
);
85 void SelectAnnotation( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> xAnnotation
, bool bEdit
= FALSE
);
86 void GetSelectedAnnotation( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
);
88 void InsertAnnotation();
89 void DeleteAnnotation( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> xAnnotation
);
90 void DeleteAnnotationsByAuthor( const rtl::OUString
& sAuthor
);
91 void DeleteAllAnnotations();
93 void ExecuteAnnotationContextMenu( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> xAnnotation
, ::Window
* pParent
, const Rectangle
& rContextRect
, bool bButtonMenu
= false );
95 Color
GetColorDark(sal_uInt16 aAuthorIndex
);
96 Color
GetColorLight(sal_uInt16 aAuthorIndex
);
97 Color
GetColor(sal_uInt16 aAuthorIndex
);
101 void onTagSelected( AnnotationTag
& rTag
);
102 void onTagDeselected( AnnotationTag
& rTag
);
104 void onSelectionChanged();
106 rtl::OUString
GetHelpText( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
);
109 void removeListener();
111 void invalidateSlots();
113 DECL_LINK(EventMultiplexerListener
, tools::EventMultiplexerEvent
*);
114 DECL_LINK(UpdateTagsHdl
, void *);
116 void UpdateTags(bool bSynchron
= false);
120 SdPage
* GetNextPage( SdPage
* pPage
, bool bForeward
);
121 SdPage
* GetFirstPage();
122 SdPage
* GetLastPage();
124 SdPage
* GetCurrentPage();
126 SdDrawDocument
* GetDoc() { return mpDoc
; }
128 void ShowAnnotations(bool bShow
);
131 ViewShellBase
& mrBase
;
132 SdDrawDocument
* mpDoc
;
134 AnnotationTagVector maTagVector
;
136 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawView
> mxView
;
137 ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotationAccess
> mxCurrentPage
;
138 ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> mxSelectedAnnotation
;
140 bool mbShowAnnotations
;
141 ULONG mnUpdateTagsEvent
;
147 #endif // _SD_ANNOTATIONMANAGER_IMPL_HXX