Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / editsrc.hxx
blob71c5f90c488d4dc1da7b6185c5e5f07157dc5292
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_SC_INC_EDITSRC_HXX
21 #define INCLUDED_SC_INC_EDITSRC_HXX
23 #include "address.hxx"
24 #include <editeng/unoedsrc.hxx>
25 #include <svl/lstner.hxx>
27 #include <memory>
29 class ScEditEngineDefaulter;
30 class SvxEditEngineForwarder;
32 class ScDocShell;
33 class ScCellTextData;
34 class ScHeaderFooterTextData;
35 class ScAccessibleTextData;
36 class SdrObject;
38 class ScEditSource : public SvxEditSource
40 public:
41 virtual ScEditEngineDefaulter* GetEditEngine() = 0;
44 /**
45 * ScHeaderFooterTextObj keeps the authoritative copy of
46 * ScHeaderFooterTextData that this class holds reference to. It's a
47 * reference instead of a copy to avoid broadcasting changes to the
48 * authoritative copy.
50 class ScHeaderFooterEditSource : public ScEditSource
52 private:
53 ScHeaderFooterTextData& mrTextData;
55 public:
56 ScHeaderFooterEditSource(ScHeaderFooterTextData& rData);
57 virtual ~ScHeaderFooterEditSource() override;
59 // GetEditEngine is needed because the forwarder doesn't have field functions
60 virtual ScEditEngineDefaulter* GetEditEngine() override;
62 virtual std::unique_ptr<SvxEditSource> Clone() const override;
63 virtual SvxTextForwarder* GetTextForwarder() override;
64 virtual void UpdateData() override;
67 /**
68 * Data (incl. EditEngine) for cell EditSource is now shared in
69 * ScCellTextData.
71 * ScCellEditSource with local copy of ScCellTextData is used by
72 * ScCellFieldsObj, ScCellFieldObj.
74 class ScCellEditSource : public ScEditSource
76 private:
77 std::unique_ptr<ScCellTextData> pCellTextData;
79 public:
80 ScCellEditSource(ScDocShell* pDocSh, const ScAddress& rP);
81 virtual ~ScCellEditSource() override;
83 // GetEditEngine is needed because the forwarder doesn't have field functions
84 virtual ScEditEngineDefaulter* GetEditEngine() override;
86 virtual std::unique_ptr<SvxEditSource> Clone() const override;
87 virtual SvxTextForwarder* GetTextForwarder() override;
89 virtual void UpdateData() override;
91 void SetDoUpdateData(bool bValue);
92 bool IsDirty() const;
95 class ScAnnotationEditSource : public SvxEditSource, public SfxListener
97 private:
98 ScDocShell* pDocShell;
99 ScAddress aCellPos;
100 ScEditEngineDefaulter* pEditEngine;
101 SvxEditEngineForwarder* pForwarder;
102 bool bDataValid;
104 SdrObject* GetCaptionObj();
105 public:
106 ScAnnotationEditSource(ScDocShell* pDocSh, const ScAddress& rP);
107 virtual ~ScAnnotationEditSource() override;
109 virtual std::unique_ptr<SvxEditSource> Clone() const override ;
110 virtual SvxTextForwarder* GetTextForwarder() override;
111 virtual void UpdateData() override;
113 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
116 // EditSource with a shared forwarder for all children of one text object
118 class ScSimpleEditSource : public SvxEditSource
120 private:
121 SvxTextForwarder* pForwarder;
123 public:
124 ScSimpleEditSource( SvxTextForwarder* pForw );
125 virtual ~ScSimpleEditSource() override;
127 virtual std::unique_ptr<SvxEditSource> Clone() const override ;
128 virtual SvxTextForwarder* GetTextForwarder() override;
129 virtual void UpdateData() override;
133 class ScAccessibilityEditSource : public SvxEditSource
135 private:
136 ::std::unique_ptr < ScAccessibleTextData > mpAccessibleTextData;
138 public:
139 ScAccessibilityEditSource( ::std::unique_ptr < ScAccessibleTextData > && pAccessibleCellTextData );
140 virtual ~ScAccessibilityEditSource() override;
142 virtual std::unique_ptr<SvxEditSource> Clone() const override;
143 virtual SvxTextForwarder* GetTextForwarder() override;
144 virtual SvxViewForwarder* GetViewForwarder() override;
145 virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate = false ) override;
146 virtual void UpdateData() override;
147 virtual SfxBroadcaster& GetBroadcaster() const override;
150 #endif
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */