a11y: Simplify OCommonAccessibleComponent::getAccessibleIndexInParent
[LibreOffice.git] / svx / source / accessibility / AccessibleEmptyEditSource.hxx
blob6cfceeda4645885bbc9241b9560b54f9eeeb9eb1
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_SVX_SOURCE_ACCESSIBILITY_ACCESSIBLEEMPTYEDITSOURCE_HXX
21 #define INCLUDED_SVX_SOURCE_ACCESSIBILITY_ACCESSIBLEEMPTYEDITSOURCE_HXX
23 #include <svl/SfxBroadcaster.hxx>
24 #include <svl/lstner.hxx>
26 #include <memory>
27 #include <editeng/unoedsrc.hxx>
29 class SdrObject;
30 class SdrView;
31 class OutputDevice;
33 namespace accessibility
35 /** Proxy edit source for shapes without text
37 Extracted from old SvxDummyEditSource
39 class AccessibleEmptyEditSource : public SvxEditSource, public SfxListener, public SfxBroadcaster
41 public:
42 /** Create proxy edit source for shapes without text
44 Since the views don't broadcast their dying, make sure that
45 this object gets destroyed if the view becomes invalid
47 The window is necessary, since our views can display on multiple windows
49 Make sure you only create such an object if the shape _really_
50 does not contain text.
52 AccessibleEmptyEditSource( SdrObject& rObj, SdrView& rView, const OutputDevice& rViewWindow );
53 virtual ~AccessibleEmptyEditSource() override;
55 // from the SvxEditSource interface
56 SvxTextForwarder* GetTextForwarder() override;
57 SvxViewForwarder* GetViewForwarder() override;
59 std::unique_ptr<SvxEditSource> Clone() const override;
61 // this method internally switches from empty to proxy mode,
62 // creating an SvxTextEditSource for the functionality.
63 SvxEditViewForwarder* GetEditViewForwarder( bool bCreate = false ) override;
65 void UpdateData() override;
66 SfxBroadcaster& GetBroadcaster() const override;
68 // from the SfxListener interface
69 void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
71 private:
72 void Switch2ProxyEditSource();
74 /** Pointer to edit source implementation. This is switched on
75 a GetEditViewForwarder( true ) call, to actually create a
76 SvxTextEditSource.
78 @dyn
80 std::unique_ptr< SvxEditSource > mpEditSource;
82 SdrObject& mrObj;
83 SdrView& mrView;
84 const OutputDevice& mrViewWindow;
86 bool mbEditSourceEmpty;
89 } // namespace accessibility
91 #endif
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */