Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef _BASCTL_DLGEDOBJ_HXX
21 : : #define _BASCTL_DLGEDOBJ_HXX
22 : :
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>
28 : :
29 : : #include <boost/optional.hpp>
30 : :
31 : : typedef ::std::multimap< sal_Int16, ::rtl::OUString, ::std::less< sal_Int16 > > IndexToNameMap;
32 : :
33 : :
34 : : class DlgEdForm;
35 : : class DlgEditor;
36 : :
37 : : //============================================================================
38 : : // DlgEdObj
39 : : //============================================================================
40 : :
41 : 0 : class DlgEdObj: public SdrUnoObj
42 : : {
43 : : friend class DlgEditor;
44 : : friend class DlgEdFactory;
45 : : friend class DlgEdPropListenerImpl;
46 : : friend class DlgEdForm;
47 : :
48 : : private:
49 : : bool bIsListening;
50 : : DlgEdForm* pDlgEdForm;
51 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener> m_xPropertyChangeListener;
52 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener> m_xContainerListener;
53 : :
54 : : private:
55 : : DlgEditor* GetDialogEditor ();
56 : :
57 : : protected:
58 : : DlgEdObj();
59 : : DlgEdObj(const ::rtl::OUString& rModelName,
60 : : const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac);
61 : :
62 : : virtual void NbcMove( const Size& rSize );
63 : : virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
64 : : virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
65 : :
66 : : using SfxListener::StartListening;
67 : : void StartListening();
68 : : using SfxListener::EndListening;
69 : : void EndListening(bool bRemoveListener = true);
70 : 0 : bool isListening() const { return bIsListening; }
71 : :
72 : : virtual bool TransformSdrToControlCoordinates(
73 : : sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn,
74 : : sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut );
75 : : virtual bool TransformSdrToFormCoordinates(
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 : : virtual bool TransformControlToSdrCoordinates(
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 : : virtual bool TransformFormToSdrCoordinates(
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 : :
85 : : public:
86 : : TYPEINFO();
87 : :
88 : : virtual ~DlgEdObj();
89 : : virtual void SetPage(SdrPage* pNewPage);
90 : :
91 : 0 : virtual void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; }
92 : 0 : virtual DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; }
93 : :
94 : : virtual sal_uInt32 GetObjInventor() const;
95 : : virtual sal_uInt16 GetObjIdentifier() const;
96 : :
97 : : virtual DlgEdObj* Clone() const; // not working yet
98 : : virtual void clonedFrom(const DlgEdObj* _pSource); // not working yet
99 : :
100 : : // FullDrag support
101 : : virtual SdrObject* getFullDragClone() const;
102 : :
103 : : virtual sal_Bool supportsService( const sal_Char* _pServiceName ) const;
104 : : virtual ::rtl::OUString GetDefaultName() const;
105 : : virtual ::rtl::OUString GetUniqueName() const;
106 : :
107 : : virtual sal_Int32 GetStep() const;
108 : : virtual void UpdateStep();
109 : :
110 : : virtual void SetDefaults();
111 : : virtual void SetRectFromProps();
112 : : virtual void SetPropsFromRect();
113 : :
114 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > GetControl() const;
115 : :
116 : : virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt );
117 : : virtual void SAL_CALL NameChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException);
118 : : virtual void SAL_CALL TabIndexChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException);
119 : :
120 : : // PropertyChangeListener
121 : : virtual void SAL_CALL _propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException);
122 : :
123 : : // ContainerListener
124 : : virtual void SAL_CALL _elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
125 : : virtual void SAL_CALL _elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
126 : : virtual void SAL_CALL _elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
127 : :
128 : : virtual void SetLayer(SdrLayerID nLayer);
129 : : bool MakeDataAware( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
130 : : };
131 : :
132 : :
133 : : //============================================================================
134 : : // DlgEdForm
135 : : //============================================================================
136 : :
137 : : class DlgEdForm: public DlgEdObj
138 : : {
139 : : friend class DlgEditor;
140 : : friend class DlgEdFactory;
141 : :
142 : : private:
143 : : DlgEditor* pDlgEditor;
144 : : ::std::vector<DlgEdObj*> pChildren;
145 : :
146 : : mutable ::boost::optional< ::com::sun::star::awt::DeviceInfo > mpDeviceInfo;
147 : :
148 : :
149 : : protected:
150 : : DlgEdForm();
151 : :
152 : : virtual void NbcMove( const Size& rSize );
153 : : virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
154 : : virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
155 : :
156 : : public:
157 : : TYPEINFO();
158 : :
159 : : virtual ~DlgEdForm();
160 : :
161 : : virtual void SetDlgEditor( DlgEditor* pEditor );
162 : 0 : virtual DlgEditor* GetDlgEditor() const { return pDlgEditor; }
163 : :
164 : : virtual void AddChild( DlgEdObj* pDlgEdObj );
165 : : virtual void RemoveChild( DlgEdObj* pDlgEdObj );
166 : 0 : virtual ::std::vector<DlgEdObj*> GetChildren() const { return pChildren; }
167 : :
168 : : virtual void UpdateStep();
169 : :
170 : : virtual void SetRectFromProps();
171 : : virtual void SetPropsFromRect();
172 : :
173 : : virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt );
174 : :
175 : : virtual void UpdateTabIndices();
176 : : virtual void UpdateTabOrder();
177 : : virtual void UpdateGroups();
178 : : virtual void UpdateTabOrderAndGroups();
179 : :
180 : : ::com::sun::star::awt::DeviceInfo getDeviceInfo() const;
181 : :
182 : : private:
183 : : void ImplInvalidateDeviceInfo();
184 : : };
185 : :
186 : : #endif // _BASCTL_DLGEDOBJ_HXX
187 : :
188 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|