tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sd / source / ui / annotations / annotationmanagerimpl.hxx
blob634d2fe3c85e5bd04b5801cd1b7c99730f68e337
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 #pragma once
22 #include <com/sun/star/document/XEventListener.hpp>
24 #include <rtl/ustring.hxx>
26 #include <comphelper/compbase.hxx>
28 namespace com::sun::star::drawing { class XDrawView; }
29 namespace com::sun::star::office { class XAnnotationAccess; }
30 namespace com::sun::star::office { class XAnnotation; }
32 class SfxRequest;
33 class SdrObject;
34 class SdPage;
35 class SdDrawDocument;
36 struct ImplSVEvent;
38 namespace sdr::annotation { class Annotation; }
40 namespace sd
42 class Annotation;
43 class ViewShellBase;
44 class View;
45 class DrawController;
47 namespace tools { class EventMultiplexerEvent; }
49 typedef comphelper::WeakComponentImplHelper <
50 css::document::XEventListener
51 > AnnotationManagerImplBase;
53 class AnnotationManagerImpl : public AnnotationManagerImplBase
55 public:
56 explicit AnnotationManagerImpl( ViewShellBase& rViewShellBase );
58 void init();
60 // WeakComponentImplHelper
61 virtual void disposing (std::unique_lock<std::mutex>&) override;
63 // XEventListener
64 virtual void SAL_CALL notifyEvent( const css::document::EventObject& Event ) override;
65 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
67 void ExecuteAnnotation (SfxRequest const & rRequest);
68 void GetAnnotationState (SfxItemSet& rItemSet);
70 void ExecuteInsertAnnotation(SfxRequest const & rReq);
71 void ExecuteDeleteAnnotation(SfxRequest const & rReq);
72 void ExecuteEditAnnotation(SfxRequest const & rReq);
73 void ExecuteReplyToAnnotation(SfxRequest const & rReq);
75 void SelectNextAnnotation(bool bForward);
77 void SelectAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation, bool bEdit = false);
78 void GetSelectedAnnotation(rtl::Reference<sdr::annotation::Annotation>& xAnnotation);
80 void InsertAnnotation(const OUString& rText);
81 void DeleteAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation);
82 void DeleteAnnotationsByAuthor( std::u16string_view sAuthor );
83 void DeleteAllAnnotations();
85 static Color GetColorDark(sal_uInt16 aAuthorIndex);
86 static Color GetColorLight(sal_uInt16 aAuthorIndex);
87 static Color GetColor(sal_uInt16 aAuthorIndex);
89 void onSelectionChanged();
91 void addListener();
92 void removeListener();
94 void invalidateSlots();
96 DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent&, void);
97 DECL_LINK(UpdateTagsHdl, void *, void);
99 void UpdateTags(bool bSynchron = false);
100 void SyncAnnotationObjects();
102 SdPage* GetNextPage( SdPage const * pPage, bool bForward );
104 SdPage* GetCurrentPage();
106 void ShowAnnotations(bool bShow);
108 private:
109 ViewShellBase& mrBase;
110 SdDrawDocument* mpDoc;
112 rtl::Reference< ::sd::DrawController > mxView;
113 rtl::Reference<SdPage> mxCurrentPage;
114 rtl::Reference<sdr::annotation::Annotation> mxSelectedAnnotation;
116 bool mbShowAnnotations;
117 ImplSVEvent * mnUpdateTagsEvent;
119 rtl::Reference<sdr::annotation::Annotation> GetAnnotationById(sal_uInt32 nAnnotationId);
122 OUString getAnnotationDateTimeString( const css::uno::Reference< css::office::XAnnotation >& xAnnotation );
124 SfxItemPool* GetAnnotationPool();
126 css::util::DateTime getCurrentDateTime();
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */