Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SD_ANNOTATIONMANAGER_IMPL_HXX
30 : : #define _SD_ANNOTATIONMANAGER_IMPL_HXX
31 : :
32 : : #include <com/sun/star/document/XEventListener.hpp>
33 : : #include <com/sun/star/office/XAnnotationAccess.hpp>
34 : :
35 : : #include <rtl/ustring.hxx>
36 : :
37 : : #include <cppuhelper/basemutex.hxx>
38 : : #include <cppuhelper/compbase1.hxx>
39 : :
40 : : #include "ViewShellBase.hxx"
41 : :
42 : : #include "annotationtag.hxx"
43 : :
44 : : class SfxRequest;
45 : :
46 : : namespace sd
47 : : {
48 : :
49 : : typedef std::vector< rtl::Reference< AnnotationTag > > AnnotationTagVector;
50 : :
51 : : namespace tools {
52 : : class EventMultiplexerEvent;
53 : : }
54 : :
55 : : typedef ::cppu::WeakComponentImplHelper1 <
56 : : com::sun::star::document::XEventListener
57 : : > AnnotationManagerImplBase;
58 : :
59 [ + - ][ + - ]: 260 : class AnnotationManagerImpl : private ::cppu::BaseMutex, public AnnotationManagerImplBase
[ - + ]
60 : : {
61 : : public:
62 : : AnnotationManagerImpl( ViewShellBase& rViewShellBase );
63 : :
64 : : void init();
65 : :
66 : : // WeakComponentImplHelper1
67 : : virtual void SAL_CALL disposing ();
68 : :
69 : : // XEventListener
70 : : virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
71 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
72 : :
73 : : void ExecuteAnnotation (SfxRequest& rRequest);
74 : : void GetAnnotationState (SfxItemSet& rItemSet);
75 : :
76 : : void ExecuteInsertAnnotation(SfxRequest& rReq);
77 : : void ExecuteDeleteAnnotation(SfxRequest& rReq);
78 : : void ExecuteReplyToAnnotation(SfxRequest& rReq);
79 : :
80 : : void SelectNextAnnotation(bool bForeward);
81 : :
82 : : void SelectAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation, bool bEdit = sal_False );
83 : : void GetSelectedAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
84 : :
85 : : void InsertAnnotation();
86 : : void DeleteAnnotation( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation );
87 : : void DeleteAnnotationsByAuthor( const rtl::OUString& sAuthor );
88 : : void DeleteAllAnnotations();
89 : :
90 : : void ExecuteAnnotationContextMenu( ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > xAnnotation, ::Window* pParent, const Rectangle& rContextRect, bool bButtonMenu = false );
91 : :
92 : : Color GetColorDark(sal_uInt16 aAuthorIndex);
93 : : Color GetColorLight(sal_uInt16 aAuthorIndex);
94 : : Color GetColor(sal_uInt16 aAuthorIndex);
95 : :
96 : :
97 : : // callbacks
98 : : void onTagSelected( AnnotationTag& rTag );
99 : : void onTagDeselected( AnnotationTag& rTag );
100 : :
101 : : void onSelectionChanged();
102 : :
103 : : void addListener();
104 : : void removeListener();
105 : :
106 : : void invalidateSlots();
107 : :
108 : : DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
109 : : DECL_LINK(UpdateTagsHdl, void *);
110 : :
111 : : void UpdateTags(bool bSynchron = false);
112 : : void CreateTags();
113 : : void DisposeTags();
114 : :
115 : : SdPage* GetNextPage( SdPage* pPage, bool bForeward );
116 : : SdPage* GetFirstPage();
117 : : SdPage* GetLastPage();
118 : :
119 : : SdPage* GetCurrentPage();
120 : :
121 : 0 : SdDrawDocument* GetDoc() { return mpDoc; }
122 : :
123 : : void ShowAnnotations(bool bShow);
124 : :
125 : : private:
126 : : ViewShellBase& mrBase;
127 : : SdDrawDocument* mpDoc;
128 : :
129 : : AnnotationTagVector maTagVector;
130 : :
131 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
132 : : ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationAccess > mxCurrentPage;
133 : : ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxSelectedAnnotation;
134 : :
135 : : bool mbShowAnnotations;
136 : : sal_uLong mnUpdateTagsEvent;
137 : : Font maFont;
138 : : };
139 : :
140 : : }
141 : :
142 : : #endif // _SD_ANNOTATIONMANAGER_IMPL_HXX
143 : :
144 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|