bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / annotations / annotationmanagerimpl.hxx
blobb01b431e09a49b4c642c53b23bf4ded78daa69da
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SD_SOURCE_UI_ANNOTATIONS_ANNOTATIONMANAGERIMPL_HXX
21 #define INCLUDED_SD_SOURCE_UI_ANNOTATIONS_ANNOTATIONMANAGERIMPL_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"
35 class SfxRequest;
37 namespace sd
40 typedef std::vector< rtl::Reference< AnnotationTag > > AnnotationTagVector;
42 namespace tools {
43 class EventMultiplexerEvent;
46 typedef ::cppu::WeakComponentImplHelper1 <
47 com::sun::star::document::XEventListener
48 > AnnotationManagerImplBase;
50 class AnnotationManagerImpl : private ::cppu::BaseMutex, public AnnotationManagerImplBase
52 public:
53 AnnotationManagerImpl( ViewShellBase& rViewShellBase );
55 void init();
57 // WeakComponentImplHelper1
58 virtual void SAL_CALL disposing () SAL_OVERRIDE;
60 // XEventListener
61 virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
62 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
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 = 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, vcl::Window* pParent, const Rectangle& rContextRect, bool bButtonMenu = false );
83 static Color GetColorDark(sal_uInt16 aAuthorIndex);
84 static Color GetColorLight(sal_uInt16 aAuthorIndex);
85 static Color GetColor(sal_uInt16 aAuthorIndex);
87 // callbacks
88 void onTagSelected( AnnotationTag& rTag );
89 void onTagDeselected( AnnotationTag& rTag );
91 void onSelectionChanged();
93 void addListener();
94 void removeListener();
96 void invalidateSlots();
98 DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
99 DECL_LINK(UpdateTagsHdl, void *);
101 void UpdateTags(bool bSynchron = false);
102 void CreateTags();
103 void DisposeTags();
105 SdPage* GetNextPage( SdPage* pPage, bool bForeward );
106 SdPage* GetFirstPage();
107 SdPage* GetLastPage();
109 SdPage* GetCurrentPage();
111 SdDrawDocument* GetDoc() { return mpDoc; }
113 void ShowAnnotations(bool bShow);
115 private:
116 ViewShellBase& mrBase;
117 SdDrawDocument* mpDoc;
119 AnnotationTagVector maTagVector;
121 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
122 ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotationAccess > mxCurrentPage;
123 ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxSelectedAnnotation;
125 bool mbShowAnnotations;
126 ImplSVEvent * mnUpdateTagsEvent;
127 vcl::Font maFont;
130 OUString getAnnotationDateTimeString( const css::uno::Reference< css::office::XAnnotation >& xAnnotation );
132 SfxItemPool* GetAnnotationPool();
134 com::sun::star::util::DateTime getCurrentDateTime();
138 #endif // INCLUDED_SD_SOURCE_UI_ANNOTATIONS_ANNOTATIONMANAGERIMPL_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */