update credits
[LibreOffice.git] / basctl / source / inc / dlgedobj.hxx
blob0bbd9d5fc7d5a8d7814983ad1d5b921093c92040
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_BASCTL_SOURCE_INC_DLGEDOBJ_HXX
21 #define INCLUDED_BASCTL_SOURCE_INC_DLGEDOBJ_HXX
23 #include <com/sun/star/frame/XModel.hpp>
24 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
25 #include <com/sun/star/container/XContainerListener.hpp>
26 #include <comphelper/processfactory.hxx>
27 #include <svx/svdouno.hxx>
29 #include <boost/optional.hpp>
31 namespace basctl
34 typedef ::std::multimap< sal_Int16, OUString, ::std::less< sal_Int16 > > IndexToNameMap;
37 class DlgEdForm;
38 class DlgEditor;
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 DlgEdForm* pDlgEdForm;
54 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener> m_xPropertyChangeListener;
55 ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener> m_xContainerListener;
57 private:
58 DlgEditor& GetDialogEditor ();
60 protected:
61 DlgEdObj();
62 DlgEdObj(const OUString& rModelName,
63 const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac);
65 virtual void NbcMove( const Size& rSize ) SAL_OVERRIDE;
66 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
67 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
69 using SfxListener::StartListening;
70 void StartListening();
71 using SfxListener::EndListening;
72 void EndListening(bool bRemoveListener = true);
73 bool isListening() const { return bIsListening; }
75 bool TransformSdrToControlCoordinates(
76 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
77 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
78 bool TransformSdrToFormCoordinates(
79 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
80 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
81 bool TransformControlToSdrCoordinates(
82 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
83 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
84 bool TransformFormToSdrCoordinates(
85 sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
86 sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
88 public:
89 TYPEINFO_OVERRIDE();
91 virtual ~DlgEdObj();
92 virtual void SetPage(SdrPage* pNewPage) SAL_OVERRIDE;
94 void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; }
95 DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; }
97 virtual sal_uInt32 GetObjInventor() const SAL_OVERRIDE;
98 virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
100 virtual DlgEdObj* Clone() const SAL_OVERRIDE; // not working yet
101 void clonedFrom(const DlgEdObj* _pSource); // not working yet
103 // FullDrag support
104 virtual SdrObject* getFullDragClone() const SAL_OVERRIDE;
106 bool supportsService( OUString const & serviceName ) const;
107 OUString GetDefaultName() const;
108 OUString GetUniqueName() const;
110 sal_Int32 GetStep() const;
111 virtual void UpdateStep();
113 void SetDefaults();
114 virtual void SetRectFromProps();
115 virtual void SetPropsFromRect();
117 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > GetControl() const;
119 virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt );
120 void SAL_CALL NameChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(css::container::NoSuchElementException, css::uno::RuntimeException);
121 void SAL_CALL TabIndexChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException);
123 // PropertyChangeListener
124 void SAL_CALL _propertyChange(const css::beans::PropertyChangeEvent& evt) throw (css::uno::RuntimeException, std::exception);
126 // ContainerListener
127 void SAL_CALL _elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
128 void SAL_CALL _elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
129 void SAL_CALL _elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
131 virtual void SetLayer(SdrLayerID nLayer) SAL_OVERRIDE;
132 bool MakeDataAware( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
137 // DlgEdForm
140 class DlgEdForm: public DlgEdObj
142 friend class DlgEditor;
143 friend class DlgEdFactory;
145 private:
146 DlgEditor& rDlgEditor;
147 ::std::vector<DlgEdObj*> pChildren;
149 mutable ::boost::optional< ::com::sun::star::awt::DeviceInfo > mpDeviceInfo;
151 private:
152 explicit DlgEdForm (DlgEditor&);
154 protected:
155 virtual void NbcMove( const Size& rSize ) SAL_OVERRIDE;
156 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
157 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
159 public:
160 TYPEINFO_OVERRIDE();
162 virtual ~DlgEdForm();
164 DlgEditor& GetDlgEditor () const { return rDlgEditor; }
166 void AddChild( DlgEdObj* pDlgEdObj );
167 void RemoveChild( DlgEdObj* pDlgEdObj );
168 std::vector<DlgEdObj*> const& GetChildren() const { return pChildren; }
170 virtual void UpdateStep() SAL_OVERRIDE;
172 virtual void SetRectFromProps() SAL_OVERRIDE;
173 virtual void SetPropsFromRect() SAL_OVERRIDE;
175 virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) SAL_OVERRIDE;
177 void UpdateTabIndices();
178 void UpdateTabOrder();
179 void UpdateGroups();
180 void UpdateTabOrderAndGroups();
182 ::com::sun::star::awt::DeviceInfo getDeviceInfo() const;
184 private:
185 void ImplInvalidateDeviceInfo();
188 } // namespace basctl
190 #endif // INCLUDED_BASCTL_SOURCE_INC_DLGEDOBJ_HXX
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */