1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
25 #include <rtl/ustring.hxx>
27 #include <cppuhelper/basemutex.hxx>
28 #include <cppuhelper/compbase.hxx>
30 #include "annotationtag.hxx"
32 namespace com
{ namespace sun
{ namespace star
{ namespace drawing
{ class XDrawView
; } } } }
33 namespace com
{ namespace sun
{ namespace star
{ namespace office
{ class XAnnotationAccess
; } } } }
34 namespace com
{ namespace sun
{ namespace star
{ namespace office
{ class XAnnotation
; } } } }
44 typedef std::vector
< rtl::Reference
< AnnotationTag
> > AnnotationTagVector
;
47 class EventMultiplexerEvent
;
50 typedef ::cppu::WeakComponentImplHelper
<
51 css::document::XEventListener
52 > AnnotationManagerImplBase
;
54 class AnnotationManagerImpl
: private ::cppu::BaseMutex
, public AnnotationManagerImplBase
57 explicit AnnotationManagerImpl( ViewShellBase
& rViewShellBase
);
61 // WeakComponentImplHelper
62 virtual void SAL_CALL
disposing () override
;
65 virtual void SAL_CALL
notifyEvent( const css::document::EventObject
& Event
) override
;
66 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
68 void ExecuteAnnotation (SfxRequest
const & rRequest
);
69 void GetAnnotationState (SfxItemSet
& rItemSet
);
71 void ExecuteInsertAnnotation(SfxRequest
const & rReq
);
72 void ExecuteDeleteAnnotation(SfxRequest
const & rReq
);
73 void ExecuteEditAnnotation(SfxRequest
const & rReq
);
74 void ExecuteReplyToAnnotation(SfxRequest
const & rReq
);
76 void SelectNextAnnotation(bool bForeward
);
78 void SelectAnnotation( const css::uno::Reference
< css::office::XAnnotation
>& xAnnotation
, bool bEdit
= false );
79 void GetSelectedAnnotation( css::uno::Reference
< css::office::XAnnotation
>& xAnnotation
);
81 void InsertAnnotation(const OUString
& rText
);
82 void DeleteAnnotation( const css::uno::Reference
< css::office::XAnnotation
>& xAnnotation
);
83 void DeleteAnnotationsByAuthor( const OUString
& sAuthor
);
84 void DeleteAllAnnotations();
86 void ExecuteAnnotationContextMenu( const css::uno::Reference
< css::office::XAnnotation
>& xAnnotation
, vcl::Window
* pParent
, const ::tools::Rectangle
& rContextRect
, bool bButtonMenu
= false );
88 static Color
GetColorDark(sal_uInt16 aAuthorIndex
);
89 static Color
GetColorLight(sal_uInt16 aAuthorIndex
);
90 static Color
GetColor(sal_uInt16 aAuthorIndex
);
93 void onTagSelected( AnnotationTag
const & rTag
);
94 void onTagDeselected( AnnotationTag
const & rTag
);
96 void onSelectionChanged();
99 void removeListener();
101 void invalidateSlots();
103 DECL_LINK(EventMultiplexerListener
, tools::EventMultiplexerEvent
&, void);
104 DECL_LINK(UpdateTagsHdl
, void *, void);
106 void UpdateTags(bool bSynchron
= false);
110 SdPage
* GetNextPage( SdPage
const * pPage
, bool bForeward
);
112 SdPage
* GetCurrentPage();
114 SdDrawDocument
* GetDoc() { return mpDoc
; }
116 void ShowAnnotations(bool bShow
);
118 // tdf#99388 and tdf#99712 flag to transport if the PopupMenu is active
119 bool getPopupMenuActive() const { return mbPopupMenuActive
; }
120 void setPopupMenuActive(bool bNew
) { mbPopupMenuActive
= bNew
; }
123 ViewShellBase
& mrBase
;
124 SdDrawDocument
* mpDoc
;
126 AnnotationTagVector maTagVector
;
128 css::uno::Reference
< css::drawing::XDrawView
> mxView
;
129 css::uno::Reference
< css::office::XAnnotationAccess
> mxCurrentPage
;
130 css::uno::Reference
< css::office::XAnnotation
> mxSelectedAnnotation
;
132 bool mbShowAnnotations
;
133 bool mbPopupMenuActive
;
134 ImplSVEvent
* mnUpdateTagsEvent
;
137 css::uno::Reference
<css::office::XAnnotation
> GetAnnotationById(sal_uInt32 nAnnotationId
);
140 OUString
getAnnotationDateTimeString( const css::uno::Reference
< css::office::XAnnotation
>& xAnnotation
);
142 SfxItemPool
* GetAnnotationPool();
144 css::util::DateTime
getCurrentDateTime();
148 #endif // INCLUDED_SD_SOURCE_UI_ANNOTATIONS_ANNOTATIONMANAGERIMPL_HXX
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */