Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SD_ANNOTATIONMANAGER_IMPL_HXX
21 : #define _SD_ANNOTATIONMANAGER_IMPL_HXX
22 :
23 : #include <com/sun/star/document/XEventListener.hpp>
24 : #include <com/sun/star/office/XAnnotationAccess.hpp>
25 :
26 : #include <rtl/ustring.hxx>
27 :
28 : #include <cppuhelper/basemutex.hxx>
29 : #include <cppuhelper/compbase1.hxx>
30 :
31 : #include "ViewShellBase.hxx"
32 :
33 : #include "annotationtag.hxx"
34 :
35 : class SfxRequest;
36 :
37 : namespace sd
38 : {
39 :
40 : typedef std::vector< rtl::Reference< AnnotationTag > > AnnotationTagVector;
41 :
42 : namespace tools {
43 : class EventMultiplexerEvent;
44 : }
45 :
46 : typedef ::cppu::WeakComponentImplHelper1 <
47 : com::sun::star::document::XEventListener
48 : > AnnotationManagerImplBase;
49 :
50 0 : class AnnotationManagerImpl : private ::cppu::BaseMutex, public AnnotationManagerImplBase
51 : {
52 : public:
53 : AnnotationManagerImpl( ViewShellBase& rViewShellBase );
54 :
55 : void init();
56 :
57 : // WeakComponentImplHelper1
58 : virtual void SAL_CALL disposing ();
59 :
60 : // XEventListener
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);
63 :
64 : void ExecuteAnnotation (SfxRequest& rRequest);
65 : void GetAnnotationState (SfxItemSet& rItemSet);
66 :
67 : void ExecuteInsertAnnotation(SfxRequest& rReq);
68 : void ExecuteDeleteAnnotation(SfxRequest& rReq);
69 : void ExecuteReplyToAnnotation(SfxRequest& rReq);
70 :
71 : void SelectNextAnnotation(bool bForeward);
72 :
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 );
75 :
76 : void InsertAnnotation();
77 : void DeleteAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation );
78 : void DeleteAnnotationsByAuthor( const rtl::OUString& sAuthor );
79 : void DeleteAllAnnotations();
80 :
81 : void ExecuteAnnotationContextMenu( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation, ::Window* pParent, const Rectangle& rContextRect, bool bButtonMenu = false );
82 :
83 : Color GetColorDark(sal_uInt16 aAuthorIndex);
84 : Color GetColorLight(sal_uInt16 aAuthorIndex);
85 : Color GetColor(sal_uInt16 aAuthorIndex);
86 :
87 :
88 : // callbacks
89 : void onTagSelected( AnnotationTag& rTag );
90 : void onTagDeselected( AnnotationTag& rTag );
91 :
92 : void onSelectionChanged();
93 :
94 : void addListener();
95 : void removeListener();
96 :
97 : void invalidateSlots();
98 :
99 : DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
100 : DECL_LINK(UpdateTagsHdl, void *);
101 :
102 : void UpdateTags(bool bSynchron = false);
103 : void CreateTags();
104 : void DisposeTags();
105 :
106 : SdPage* GetNextPage( SdPage* pPage, bool bForeward );
107 : SdPage* GetFirstPage();
108 : SdPage* GetLastPage();
109 :
110 : SdPage* GetCurrentPage();
111 :
112 0 : SdDrawDocument* GetDoc() { return mpDoc; }
113 :
114 : void ShowAnnotations(bool bShow);
115 :
116 : private:
117 : ViewShellBase& mrBase;
118 : SdDrawDocument* mpDoc;
119 :
120 : AnnotationTagVector maTagVector;
121 :
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;
125 :
126 : bool mbShowAnnotations;
127 : sal_uLong mnUpdateTagsEvent;
128 : Font maFont;
129 : };
130 :
131 : }
132 :
133 : #endif // _SD_ANNOTATIONMANAGER_IMPL_HXX
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|