Branch libreoffice-24-8-3
[LibreOffice.git] / sc / inc / editsrc.hxx
blob166a18a289794292a400f236718f1688d274cbd3
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 "address.hxx"
23 #include <editeng/unoedsrc.hxx>
24 #include <svl/lstner.hxx>
26 #include <memory>
28 class ScEditEngineDefaulter;
29 class SvxEditEngineForwarder;
31 class ScDocShell;
32 class ScCellTextData;
33 class ScHeaderFooterTextData;
34 class ScAccessibleTextData;
35 class SdrObject;
37 class ScEditSource : public SvxEditSource
39 public:
40 virtual ScEditEngineDefaulter* GetEditEngine() = 0;
43 /**
44 * ScHeaderFooterTextObj keeps the authoritative copy of
45 * ScHeaderFooterTextData that this class holds reference to. It's a
46 * reference instead of a copy to avoid broadcasting changes to the
47 * authoritative copy.
49 class ScHeaderFooterEditSource final : public ScEditSource
51 private:
52 ScHeaderFooterTextData& mrTextData;
54 public:
55 ScHeaderFooterEditSource(ScHeaderFooterTextData& rData);
56 virtual ~ScHeaderFooterEditSource() override;
58 // GetEditEngine is needed because the forwarder doesn't have field functions
59 virtual ScEditEngineDefaulter* GetEditEngine() override;
61 virtual std::unique_ptr<SvxEditSource> Clone() const override;
62 virtual SvxTextForwarder* GetTextForwarder() override;
63 virtual void UpdateData() override;
66 /**
67 * Data (incl. EditEngine) for cell EditSource is now shared in
68 * ScCellTextData.
70 * ScCellEditSource with local copy of ScCellTextData is used by
71 * ScCellFieldsObj, ScCellFieldObj.
73 class ScCellEditSource final : public ScEditSource
75 private:
76 std::unique_ptr<ScCellTextData> pCellTextData;
78 public:
79 ScCellEditSource(ScDocShell* pDocSh, const ScAddress& rP);
80 virtual ~ScCellEditSource() override;
82 // GetEditEngine is needed because the forwarder doesn't have field functions
83 virtual ScEditEngineDefaulter* GetEditEngine() override;
85 virtual std::unique_ptr<SvxEditSource> Clone() const override;
86 virtual SvxTextForwarder* GetTextForwarder() override;
88 virtual void UpdateData() override;
90 void SetDoUpdateData(bool bValue);
91 bool IsDirty() const;
94 class ScAnnotationEditSource final : public SvxEditSource, public SfxListener
96 private:
97 ScDocShell* pDocShell;
98 ScAddress aCellPos;
99 std::unique_ptr<ScEditEngineDefaulter> pEditEngine;
100 std::unique_ptr<SvxEditEngineForwarder> pForwarder;
101 bool bDataValid;
103 SdrObject* GetCaptionObj();
104 public:
105 ScAnnotationEditSource(ScDocShell* pDocSh, const ScAddress& rP);
106 virtual ~ScAnnotationEditSource() override;
108 virtual std::unique_ptr<SvxEditSource> Clone() const override ;
109 virtual SvxTextForwarder* GetTextForwarder() override;
110 virtual void UpdateData() override;
112 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
115 // EditSource with a shared forwarder for all children of one text object
117 class ScSimpleEditSource final : public SvxEditSource
119 private:
120 SvxTextForwarder* pForwarder;
122 public:
123 ScSimpleEditSource( SvxTextForwarder* pForw );
124 virtual ~ScSimpleEditSource() override;
126 virtual std::unique_ptr<SvxEditSource> Clone() const override ;
127 virtual SvxTextForwarder* GetTextForwarder() override;
128 virtual void UpdateData() override;
132 class ScAccessibilityEditSource final : public SvxEditSource
134 private:
135 ::std::unique_ptr < ScAccessibleTextData > mpAccessibleTextData;
137 public:
138 ScAccessibilityEditSource( ::std::unique_ptr < ScAccessibleTextData > && pAccessibleCellTextData );
139 virtual ~ScAccessibilityEditSource() override;
141 virtual std::unique_ptr<SvxEditSource> Clone() const override;
142 virtual SvxTextForwarder* GetTextForwarder() override;
143 virtual SvxViewForwarder* GetViewForwarder() override;
144 virtual SvxEditViewForwarder* GetEditViewForwarder( bool bCreate = false ) override;
145 virtual void UpdateData() override;
146 virtual SfxBroadcaster& GetBroadcaster() const override;
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */