LibreOffice Module sd (master) 1
annotationmanagerimpl.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <com/sun/star/document/XEventListener.hpp>
23
24#include <rtl/ustring.hxx>
25
27
28#include "annotationtag.hxx"
29
30namespace com::sun::star::drawing { class XDrawView; }
31namespace com::sun::star::office { class XAnnotationAccess; }
32namespace com::sun::star::office { class XAnnotation; }
33
34class SfxRequest;
35class SdPage;
36class SdDrawDocument;
37struct ImplSVEvent;
38
39namespace sd
40{
41
42class ViewShellBase;
43
44namespace tools {
46}
47
49 css::document::XEventListener
51
53{
54public:
55 explicit AnnotationManagerImpl( ViewShellBase& rViewShellBase );
56
57 void init();
58
59 // WeakComponentImplHelper
60 virtual void disposing (std::unique_lock<std::mutex>&) override;
61
62 // XEventListener
63 virtual void SAL_CALL notifyEvent( const css::document::EventObject& Event ) override;
64 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
65
66 void ExecuteAnnotation (SfxRequest const & rRequest);
67 void GetAnnotationState (SfxItemSet& rItemSet);
68
69 void ExecuteInsertAnnotation(SfxRequest const & rReq);
70 void ExecuteDeleteAnnotation(SfxRequest const & rReq);
71 void ExecuteEditAnnotation(SfxRequest const & rReq);
72 void ExecuteReplyToAnnotation(SfxRequest const & rReq);
73
74 void SelectNextAnnotation(bool bForward);
75
76 void SelectAnnotation( const css::uno::Reference< css::office::XAnnotation >& xAnnotation, bool bEdit = false );
77 void GetSelectedAnnotation( css::uno::Reference< css::office::XAnnotation >& xAnnotation );
78
79 void InsertAnnotation(const OUString& rText);
80 void DeleteAnnotation( const css::uno::Reference< css::office::XAnnotation >& xAnnotation );
81 void DeleteAnnotationsByAuthor( std::u16string_view sAuthor );
83
84 void ExecuteAnnotationTagContextMenu(const css::uno::Reference<css::office::XAnnotation>& xAnnotation, weld::Widget* pParent, const ::tools::Rectangle& rContextRect);
85
86 static Color GetColorDark(sal_uInt16 aAuthorIndex);
87 static Color GetColorLight(sal_uInt16 aAuthorIndex);
88 static Color GetColor(sal_uInt16 aAuthorIndex);
89
90 // callbacks
91 void onTagSelected( AnnotationTag const & rTag );
92 void onTagDeselected( AnnotationTag const & rTag );
93
94 void onSelectionChanged();
95
96 void addListener();
97 void removeListener();
98
99 void invalidateSlots();
100
101 DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent&, void);
102 DECL_LINK(UpdateTagsHdl, void *, void);
103
104 void UpdateTags(bool bSynchron = false);
105 void CreateTags();
106 void DisposeTags();
107
108 SdPage* GetNextPage( SdPage const * pPage, bool bForward );
109
111
113
114 void ShowAnnotations(bool bShow);
115
116private:
119
120 std::vector< rtl::Reference< AnnotationTag > > maTagVector;
121
122 css::uno::Reference< css::drawing::XDrawView > mxView;
123 css::uno::Reference< css::office::XAnnotationAccess > mxCurrentPage;
124 css::uno::Reference< css::office::XAnnotation > mxSelectedAnnotation;
125
129
130 css::uno::Reference<css::office::XAnnotation> GetAnnotationById(sal_uInt32 nAnnotationId);
131};
132
133OUString getAnnotationDateTimeString( const css::uno::Reference< css::office::XAnnotation >& xAnnotation );
134
136
137css::util::DateTime getCurrentDateTime();
138
139}
140
141/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::drawing::XDrawView > mxView
static Color GetColorLight(sal_uInt16 aAuthorIndex)
void onTagSelected(AnnotationTag const &rTag)
DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent &, void)
css::uno::Reference< css::office::XAnnotation > mxSelectedAnnotation
css::uno::Reference< css::office::XAnnotationAccess > mxCurrentPage
void SelectAnnotation(const css::uno::Reference< css::office::XAnnotation > &xAnnotation, bool bEdit=false)
void ExecuteEditAnnotation(SfxRequest const &rReq)
SdPage * GetNextPage(SdPage const *pPage, bool bForward)
css::uno::Reference< css::office::XAnnotation > GetAnnotationById(sal_uInt32 nAnnotationId)
void DeleteAnnotationsByAuthor(std::u16string_view sAuthor)
void SelectNextAnnotation(bool bForward)
AnnotationManagerImpl(ViewShellBase &rViewShellBase)
void onTagDeselected(AnnotationTag const &rTag)
void DeleteAnnotation(const css::uno::Reference< css::office::XAnnotation > &xAnnotation)
void ExecuteDeleteAnnotation(SfxRequest const &rReq)
void GetSelectedAnnotation(css::uno::Reference< css::office::XAnnotation > &xAnnotation)
virtual void disposing(std::unique_lock< std::mutex > &) override
void InsertAnnotation(const OUString &rText)
void ExecuteInsertAnnotation(SfxRequest const &rReq)
static Color GetColorDark(sal_uInt16 aAuthorIndex)
static Color GetColor(sal_uInt16 aAuthorIndex)
void ExecuteAnnotation(SfxRequest const &rRequest)
void ExecuteAnnotationTagContextMenu(const css::uno::Reference< css::office::XAnnotation > &xAnnotation, weld::Widget *pParent, const ::tools::Rectangle &rContextRect)
void UpdateTags(bool bSynchron=false)
DECL_LINK(UpdateTagsHdl, void *, void)
virtual void SAL_CALL notifyEvent(const css::document::EventObject &Event) override
std::vector< rtl::Reference< AnnotationTag > > maTagVector
void GetAnnotationState(SfxItemSet &rItemSet)
void ExecuteReplyToAnnotation(SfxRequest const &rReq)
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
comphelper::WeakComponentImplHelper< css::document::XEventListener > AnnotationManagerImplBase
SfxItemPool * GetAnnotationPool()
css::util::DateTime getCurrentDateTime()
OUString getAnnotationDateTimeString(const Reference< XAnnotation > &xAnnotation)