1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SD_ANNOTATIONMANAGER_IMPL_HXX
21 #define _SD_ANNOTATIONMANAGER_IMPL_HXX
23 #include <com/sun/star/document/XEventListener.hpp>
24 #include <com/sun/star/office/XAnnotationAccess.hpp>
26 #include <rtl/ustring.hxx>
28 #include <cppuhelper/basemutex.hxx>
29 #include <cppuhelper/compbase1.hxx>
31 #include "ViewShellBase.hxx"
33 #include "annotationtag.hxx"
40 typedef std::vector
< rtl::Reference
< AnnotationTag
> > AnnotationTagVector
;
43 class EventMultiplexerEvent
;
46 typedef ::cppu::WeakComponentImplHelper1
<
47 com::sun::star::document::XEventListener
48 > AnnotationManagerImplBase
;
50 class AnnotationManagerImpl
: private ::cppu::BaseMutex
, public AnnotationManagerImplBase
53 AnnotationManagerImpl( ViewShellBase
& rViewShellBase
);
57 // WeakComponentImplHelper1
58 virtual void SAL_CALL
disposing ();
61 virtual void SAL_CALL
notifyEvent( const ::com::sun::star::document::EventObject
& Event
) throw (::com::sun::star::uno::RuntimeException
);
62 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
);
64 void ExecuteAnnotation (SfxRequest
& rRequest
);
65 void GetAnnotationState (SfxItemSet
& rItemSet
);
67 void ExecuteInsertAnnotation(SfxRequest
& rReq
);
68 void ExecuteDeleteAnnotation(SfxRequest
& rReq
);
69 void ExecuteReplyToAnnotation(SfxRequest
& rReq
);
71 void SelectNextAnnotation(bool bForeward
);
73 void SelectAnnotation( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> xAnnotation
, bool bEdit
= sal_False
);
74 void GetSelectedAnnotation( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
>& xAnnotation
);
76 void InsertAnnotation();
77 void DeleteAnnotation( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> xAnnotation
);
78 void DeleteAnnotationsByAuthor( const OUString
& sAuthor
);
79 void DeleteAllAnnotations();
81 void ExecuteAnnotationContextMenu( ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> xAnnotation
, ::Window
* pParent
, const Rectangle
& rContextRect
, bool bButtonMenu
= false );
83 Color
GetColorDark(sal_uInt16 aAuthorIndex
);
84 Color
GetColorLight(sal_uInt16 aAuthorIndex
);
85 Color
GetColor(sal_uInt16 aAuthorIndex
);
89 void onTagSelected( AnnotationTag
& rTag
);
90 void onTagDeselected( AnnotationTag
& rTag
);
92 void onSelectionChanged();
95 void removeListener();
97 void invalidateSlots();
99 DECL_LINK(EventMultiplexerListener
, tools::EventMultiplexerEvent
*);
100 DECL_LINK(UpdateTagsHdl
, void *);
102 void UpdateTags(bool bSynchron
= false);
106 SdPage
* GetNextPage( SdPage
* pPage
, bool bForeward
);
107 SdPage
* GetFirstPage();
108 SdPage
* GetLastPage();
110 SdPage
* GetCurrentPage();
112 SdDrawDocument
* GetDoc() { return mpDoc
; }
114 void ShowAnnotations(bool bShow
);
117 ViewShellBase
& mrBase
;
118 SdDrawDocument
* mpDoc
;
120 AnnotationTagVector maTagVector
;
122 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawView
> mxView
;
123 ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotationAccess
> mxCurrentPage
;
124 ::com::sun::star::uno::Reference
< ::com::sun::star::office::XAnnotation
> mxSelectedAnnotation
;
126 bool mbShowAnnotations
;
127 sal_uLong mnUpdateTagsEvent
;
133 #endif // _SD_ANNOTATIONMANAGER_IMPL_HXX
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */