Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / inc / notesuno.hxx
blob30bfcaf1c8cbb0c9475082446a8aaa6738a8ea56
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/sheet/XSheetAnnotation.hpp>
23 #include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/container/XChild.hpp>
26 #include <com/sun/star/text/XSimpleText.hpp>
27 #include <cppuhelper/implbase.hxx>
28 #include <svl/lstner.hxx>
29 #include <rtl/ref.hxx>
30 #include "address.hxx"
32 class ScDocShell;
33 class SvxUnoText;
34 class ScPostIt;
36 class ScAnnotationObj final : public cppu::WeakImplHelper<
37 css::container::XChild,
38 css::text::XSimpleText,
39 css::sheet::XSheetAnnotation,
40 css::sheet::XSheetAnnotationShapeSupplier,
41 css::lang::XServiceInfo >,
42 public SfxListener
44 public:
45 ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos);
46 virtual ~ScAnnotationObj() override;
48 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
50 /// XChild
51 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
52 getParent() override;
53 virtual void SAL_CALL setParent( const css::uno::Reference<
54 css::uno::XInterface >& Parent ) override;
56 /// XSimpleText
57 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
58 createTextCursor() override;
59 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
60 createTextCursorByRange( const css::uno::Reference< css::text::XTextRange >& aTextPosition ) override;
61 virtual void SAL_CALL insertString( const css::uno::Reference<
62 css::text::XTextRange >& xRange,
63 const OUString& aString, sal_Bool bAbsorb ) override;
64 virtual void SAL_CALL insertControlCharacter( const css::uno::Reference< css::text::XTextRange >& xRange,
65 sal_Int16 nControlCharacter, sal_Bool bAbsorb ) override;
67 /// XTextRange
68 virtual css::uno::Reference< css::text::XText > SAL_CALL
69 getText() override;
70 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
71 getStart() override;
72 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
73 getEnd() override;
74 virtual OUString SAL_CALL getString() override;
75 virtual void SAL_CALL setString( const OUString& aString ) override;
77 /// XSheetAnnotation
78 virtual css::table::CellAddress SAL_CALL getPosition() override;
79 virtual OUString SAL_CALL getAuthor() override;
80 virtual OUString SAL_CALL getDate() override;
81 virtual sal_Bool SAL_CALL getIsVisible() override;
82 virtual void SAL_CALL setIsVisible( sal_Bool bIsVisible ) override;
84 /// XSheetAnnotationShapeSupplier
85 virtual css::uno::Reference < css::drawing::XShape > SAL_CALL
86 getAnnotationShape() override;
88 /// XServiceInfo
89 virtual OUString SAL_CALL getImplementationName() override;
90 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
91 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
93 private:
94 SvxUnoText& GetUnoText();
96 const ScPostIt* ImplGetNote() const;
98 private:
99 ScDocShell* pDocShell;
100 ScAddress aCellPos;
101 rtl::Reference<SvxUnoText> pUnoText;
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */