tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / basctl / source / inc / dlgedobj.hxx
blob7e9e396668b7c3d15610b3e98cb9a947791575bc
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/frame/XModel.hpp>
23 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
24 #include <com/sun/star/container/XContainerListener.hpp>
25 #include <svx/svdouno.hxx>
27 #include <optional>
29 #include <map>
31 namespace basctl
34 typedef std::multimap< sal_Int16, OUString > IndexToNameMap;
36 class DlgEdForm;
37 class DlgEditor;
38 class DlgEdEvtContListenerImpl;
39 class DlgEdPropListenerImpl;
41 // DlgEdObj
44 class DlgEdObj: public SdrUnoObj
46 friend class DlgEditor;
47 friend class DlgEdFactory;
48 friend class DlgEdPropListenerImpl;
49 friend class DlgEdForm;
51 private:
52 bool bIsListening;
53 rtl::Reference<DlgEdForm> pDlgEdForm;
54 rtl::Reference<DlgEdPropListenerImpl> m_xPropertyChangeListener;
55 rtl::Reference<DlgEdEvtContListenerImpl> m_xContainerListener;
57 private:
58 DlgEditor& GetDialogEditor ();
60 protected:
61 DlgEdObj(SdrModel& rSdrModel);
62 // copy constructor
63 DlgEdObj(SdrModel& rSdrModel, DlgEdObj const & rSource);
64 DlgEdObj(
65 SdrModel& rSdrModel,
66 const OUString& rModelName,
67 const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac);
69 // protected destructor
70 virtual ~DlgEdObj() override;
72 virtual void NbcMove( const Size& rSize ) override;
73 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
74 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
76 using SfxListener::StartListening;
77 void StartListening();
78 using SfxListener::EndListening;
79 void EndListening(bool bRemoveListener);
80 bool isListening() const { return bIsListening; }
82 bool TransformSdrToControlCoordinates(
83 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
84 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
85 bool TransformSdrToFormCoordinates(
86 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
87 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
88 bool TransformControlToSdrCoordinates(
89 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
90 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
91 bool TransformFormToSdrCoordinates(
92 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
93 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
95 public:
96 void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; }
97 DlgEdForm* GetDlgEdForm() const { return pDlgEdForm.get(); }
99 virtual SdrInventor GetObjInventor() const override;
100 virtual SdrObjKind GetObjIdentifier() const override;
102 virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override; // not working yet
104 // FullDrag support
105 virtual rtl::Reference<SdrObject> getFullDragClone() const override;
107 bool supportsService( OUString const & serviceName ) const;
108 OUString GetDefaultName() const;
109 OUString GetUniqueName() const;
111 sal_Int32 GetStep() const;
112 virtual void UpdateStep();
114 void SetDefaults();
115 virtual void SetRectFromProps();
116 virtual void SetPropsFromRect();
118 css::uno::Reference< css::awt::XControl > GetControl() const;
120 virtual void PositionAndSizeChange( const css::beans::PropertyChangeEvent& evt );
121 /// @throws css::container::NoSuchElementException
122 /// @throws css::uno::RuntimeException
123 void NameChange( const css::beans::PropertyChangeEvent& evt );
124 /// @throws css::uno::RuntimeException
125 void TabIndexChange( const css::beans::PropertyChangeEvent& evt );
127 // PropertyChangeListener
128 /// @throws css::uno::RuntimeException
129 void _propertyChange(const css::beans::PropertyChangeEvent& evt);
131 // ContainerListener
132 /// @throws css::uno::RuntimeException
133 void _elementInserted();
134 /// @throws css::uno::RuntimeException
135 void _elementReplaced();
136 /// @throws css::uno::RuntimeException
137 void _elementRemoved();
139 virtual void SetLayer(SdrLayerID nLayer) override;
140 void MakeDataAware( const css::uno::Reference< css::frame::XModel >& xModel );
144 // DlgEdForm
147 class DlgEdForm: public DlgEdObj
149 friend class DlgEditor;
150 friend class DlgEdFactory;
152 private:
153 DlgEditor& rDlgEditor;
154 std::vector<DlgEdObj*> pChildren;
156 mutable ::std::optional< css::awt::DeviceInfo > mpDeviceInfo;
158 private:
159 explicit DlgEdForm(
160 SdrModel& rSdrModel,
161 DlgEditor&);
163 protected:
164 virtual void NbcMove( const Size& rSize ) override;
165 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
166 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
168 // protected destructor
169 virtual ~DlgEdForm() override;
171 public:
172 DlgEditor& GetDlgEditor () const { return rDlgEditor; }
174 void AddChild( DlgEdObj* pDlgEdObj );
175 void RemoveChild( DlgEdObj* pDlgEdObj );
176 std::vector<DlgEdObj*> const& GetChildren() const { return pChildren; }
178 virtual void UpdateStep() override;
180 virtual void SetRectFromProps() override;
181 virtual void SetPropsFromRect() override;
183 virtual void PositionAndSizeChange( const css::beans::PropertyChangeEvent& evt ) override;
185 void UpdateTabIndices();
186 void UpdateTabOrder();
187 void UpdateGroups();
188 void UpdateTabOrderAndGroups();
190 css::awt::DeviceInfo getDeviceInfo() const;
193 } // namespace basctl
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */