xref: /AOO41X/main/extensions/source/propctrlr/standardcontrol.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _EXTENSIONS_PROPCTRLR_STANDARDCONTROL_HXX_
29*cdf0e10cSrcweir #define _EXTENSIONS_PROPCTRLR_STANDARDCONTROL_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "commoncontrol.hxx"
32*cdf0e10cSrcweir #include "pcrcommon.hxx"
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir /** === begin UNO includes === **/
35*cdf0e10cSrcweir #include <com/sun/star/inspection/XNumericControl.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/inspection/XStringListControl.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/inspection/XHyperlinkControl.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
39*cdf0e10cSrcweir /** === end UNO includes === **/
40*cdf0e10cSrcweir #include <vcl/field.hxx>
41*cdf0e10cSrcweir #include <vcl/longcurr.hxx>
42*cdf0e10cSrcweir #include <svtools/ctrlbox.hxx>
43*cdf0e10cSrcweir #include <vcl/lstbox.hxx>
44*cdf0e10cSrcweir #include <vcl/combobox.hxx>
45*cdf0e10cSrcweir #include <svtools/calendar.hxx>
46*cdf0e10cSrcweir #include <svtools/fmtfield.hxx>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #include <set>
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir class PushButton;
51*cdf0e10cSrcweir class MultiLineEdit;
52*cdf0e10cSrcweir //............................................................................
53*cdf0e10cSrcweir namespace pcr
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir //............................................................................
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir     //========================================================================
58*cdf0e10cSrcweir     //= ListLikeControlWithModifyHandler
59*cdf0e10cSrcweir     //========================================================================
60*cdf0e10cSrcweir     /** Very small helper class which adds a SetModifyHdl to a ListBox-derived class,
61*cdf0e10cSrcweir         thus giving this class the same API (as far as the CommonBehaviourControl is concerned)
62*cdf0e10cSrcweir         as all other windows.
63*cdf0e10cSrcweir     */
64*cdf0e10cSrcweir     template< class LISTBOX_WINDOW >
65*cdf0e10cSrcweir     class ListLikeControlWithModifyHandler : public ControlWindow< LISTBOX_WINDOW >
66*cdf0e10cSrcweir     {
67*cdf0e10cSrcweir     protected:
68*cdf0e10cSrcweir         typedef ControlWindow< LISTBOX_WINDOW >  ListBoxType;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir     public:
71*cdf0e10cSrcweir         ListLikeControlWithModifyHandler( Window* _pParent, WinBits _nStyle )
72*cdf0e10cSrcweir             :ListBoxType( _pParent, _nStyle )
73*cdf0e10cSrcweir         {
74*cdf0e10cSrcweir         }
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir         void SetModifyHdl( const Link& _rLink ) { ListBoxType::SetSelectHdl( _rLink ); }
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir     protected:
79*cdf0e10cSrcweir         long    PreNotify( NotifyEvent& _rNEvt );
80*cdf0e10cSrcweir     };
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir     //------------------------------------------------------------------------
83*cdf0e10cSrcweir     template< class LISTBOX_WINDOW >
84*cdf0e10cSrcweir     long ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::PreNotify( NotifyEvent& _rNEvt )
85*cdf0e10cSrcweir     {
86*cdf0e10cSrcweir         if ( _rNEvt.GetType() == EVENT_KEYINPUT )
87*cdf0e10cSrcweir         {
88*cdf0e10cSrcweir             const ::KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent();
89*cdf0e10cSrcweir             if  (   ( pKeyEvent->GetKeyCode().GetModifier() == 0 )
90*cdf0e10cSrcweir                 &&  (   ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP )
91*cdf0e10cSrcweir                     ||  ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN )
92*cdf0e10cSrcweir                     )
93*cdf0e10cSrcweir                 )
94*cdf0e10cSrcweir             {
95*cdf0e10cSrcweir                 if ( !ListBoxType::IsInDropDown() )
96*cdf0e10cSrcweir                 {
97*cdf0e10cSrcweir                     // don't give the base class a chance to consume the event, in the property browser, it is
98*cdf0e10cSrcweir                     // intended to scroll the complete property page
99*cdf0e10cSrcweir                     return ListBoxType::GetParent()->PreNotify( _rNEvt );
100*cdf0e10cSrcweir                 }
101*cdf0e10cSrcweir             }
102*cdf0e10cSrcweir         }
103*cdf0e10cSrcweir         return ListBoxType::PreNotify( _rNEvt );
104*cdf0e10cSrcweir     }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     //========================================================================
107*cdf0e10cSrcweir     //= OTimeControl
108*cdf0e10cSrcweir     //========================================================================
109*cdf0e10cSrcweir     typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< TimeField > > OTimeControl_Base;
110*cdf0e10cSrcweir     class OTimeControl : public OTimeControl_Base
111*cdf0e10cSrcweir     {
112*cdf0e10cSrcweir     public:
113*cdf0e10cSrcweir         OTimeControl( Window* pParent, WinBits nWinStyle );
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir         // XPropertyControl
116*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
117*cdf0e10cSrcweir         virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
118*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
119*cdf0e10cSrcweir     };
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     //========================================================================
122*cdf0e10cSrcweir     //= ODateControl
123*cdf0e10cSrcweir     //========================================================================
124*cdf0e10cSrcweir     typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< CalendarField > > ODateControl_Base;
125*cdf0e10cSrcweir     class ODateControl : public ODateControl_Base
126*cdf0e10cSrcweir     {
127*cdf0e10cSrcweir     public:
128*cdf0e10cSrcweir         ODateControl( Window* pParent, WinBits nWinStyle );
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir         // XPropertyControl
131*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
132*cdf0e10cSrcweir         virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
133*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
134*cdf0e10cSrcweir     };
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir     //========================================================================
137*cdf0e10cSrcweir     //= OEditControl
138*cdf0e10cSrcweir     //========================================================================
139*cdf0e10cSrcweir     typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< Edit > > OEditControl_Base;
140*cdf0e10cSrcweir     class OEditControl : public OEditControl_Base
141*cdf0e10cSrcweir     {
142*cdf0e10cSrcweir     protected:
143*cdf0e10cSrcweir         sal_Bool m_bIsPassword : 1;
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir     public:
146*cdf0e10cSrcweir         OEditControl( Window* _pParent, sal_Bool _bPassWord, WinBits nWinStyle );
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir         // XPropertyControl
149*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
150*cdf0e10cSrcweir         virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
151*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir     protected:
154*cdf0e10cSrcweir         virtual void modified();
155*cdf0e10cSrcweir     };
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir     //========================================================================
158*cdf0e10cSrcweir     //= ODateTimeControl
159*cdf0e10cSrcweir     //========================================================================
160*cdf0e10cSrcweir     typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< FormattedField > > ODateTimeControl_Base;
161*cdf0e10cSrcweir     class ODateTimeControl : public ODateTimeControl_Base
162*cdf0e10cSrcweir     {
163*cdf0e10cSrcweir     public:
164*cdf0e10cSrcweir         ODateTimeControl( Window* pParent,WinBits nWinStyle );
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir         // XPropertyControl
167*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
168*cdf0e10cSrcweir         virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
169*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
170*cdf0e10cSrcweir     };
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir     //========================================================================
173*cdf0e10cSrcweir     //= HyperlinkInput
174*cdf0e10cSrcweir     //========================================================================
175*cdf0e10cSrcweir     class HyperlinkInput : public Edit
176*cdf0e10cSrcweir     {
177*cdf0e10cSrcweir     private:
178*cdf0e10cSrcweir         Point   m_aMouseButtonDownPos;
179*cdf0e10cSrcweir         Link    m_aClickHandler;
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir     public:
182*cdf0e10cSrcweir         HyperlinkInput( Window* _pParent, WinBits _nWinStyle );
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir         /** sets the handler which will (asynchronously, with locked SolarMutex) be called
185*cdf0e10cSrcweir             when the hyperlink has been clicked by the user
186*cdf0e10cSrcweir         */
187*cdf0e10cSrcweir         void        SetClickHdl( const Link& _rHdl ) { m_aClickHandler = _rHdl; }
188*cdf0e10cSrcweir         const Link& GetClickHdl( ) const { return m_aClickHandler; }
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir     protected:
191*cdf0e10cSrcweir         virtual void        MouseMove( const MouseEvent& rMEvt );
192*cdf0e10cSrcweir         virtual void        MouseButtonDown( const MouseEvent& rMEvt );
193*cdf0e10cSrcweir         virtual void        MouseButtonUp( const MouseEvent& rMEvt );
194*cdf0e10cSrcweir         virtual void        Tracking( const TrackingEvent& rTEvt );
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir     private:
197*cdf0e10cSrcweir         void    impl_checkEndClick( const MouseEvent rMEvt );
198*cdf0e10cSrcweir         bool    impl_textHitTest( const Point& _rWindowPos );
199*cdf0e10cSrcweir     };
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir     //========================================================================
202*cdf0e10cSrcweir     //= OHyperlinkControl
203*cdf0e10cSrcweir     //========================================================================
204*cdf0e10cSrcweir     typedef CommonBehaviourControl< ::com::sun::star::inspection::XHyperlinkControl, ControlWindow< HyperlinkInput > > OHyperlinkControl_Base;
205*cdf0e10cSrcweir     class OHyperlinkControl : public OHyperlinkControl_Base
206*cdf0e10cSrcweir     {
207*cdf0e10cSrcweir     private:
208*cdf0e10cSrcweir         ::cppu::OInterfaceContainerHelper   m_aActionListeners;
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir     public:
211*cdf0e10cSrcweir         OHyperlinkControl( Window* _pParent, WinBits _nWinStyle );
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir         // XPropertyControl
214*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
215*cdf0e10cSrcweir         virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
216*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir         // XHyperlinkControl
219*cdf0e10cSrcweir         virtual void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
220*cdf0e10cSrcweir         virtual void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir     protected:
223*cdf0e10cSrcweir         // XComponent
224*cdf0e10cSrcweir         virtual void SAL_CALL disposing();
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir     protected:
227*cdf0e10cSrcweir         DECL_LINK( OnHyperlinkClicked, void* );
228*cdf0e10cSrcweir     };
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir     //========================================================================
231*cdf0e10cSrcweir     //= CustomConvertibleNumericField
232*cdf0e10cSrcweir     //========================================================================
233*cdf0e10cSrcweir     class CustomConvertibleNumericField : public ControlWindow< MetricField >
234*cdf0e10cSrcweir     {
235*cdf0e10cSrcweir         typedef ControlWindow< MetricField > BaseClass;
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir     public:
238*cdf0e10cSrcweir         CustomConvertibleNumericField( Window* _pParent, WinBits _nStyle )
239*cdf0e10cSrcweir             :BaseClass( _pParent, _nStyle )
240*cdf0e10cSrcweir         {
241*cdf0e10cSrcweir         }
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir         sal_Int64 GetLastValue() const { return mnLastValue; }
244*cdf0e10cSrcweir     };
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir     //========================================================================
247*cdf0e10cSrcweir     //= ONumericControl
248*cdf0e10cSrcweir     //========================================================================
249*cdf0e10cSrcweir     typedef CommonBehaviourControl< ::com::sun::star::inspection::XNumericControl, CustomConvertibleNumericField > ONumericControl_Base;
250*cdf0e10cSrcweir     class ONumericControl : public ONumericControl_Base
251*cdf0e10cSrcweir     {
252*cdf0e10cSrcweir     private:
253*cdf0e10cSrcweir         FieldUnit   m_eValueUnit;
254*cdf0e10cSrcweir         sal_Int16   m_nFieldToUNOValueFactor;
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir     public:
257*cdf0e10cSrcweir         ONumericControl( Window* pParent, WinBits nWinStyle );
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir         // XPropertyControl
260*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
261*cdf0e10cSrcweir         virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
262*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir         // XNumericControl
265*cdf0e10cSrcweir         virtual ::sal_Int16 SAL_CALL getDecimalDigits() throw (::com::sun::star::uno::RuntimeException);
266*cdf0e10cSrcweir         virtual void SAL_CALL setDecimalDigits( ::sal_Int16 _decimaldigits ) throw (::com::sun::star::uno::RuntimeException);
267*cdf0e10cSrcweir         virtual ::com::sun::star::beans::Optional< double > SAL_CALL getMinValue() throw (::com::sun::star::uno::RuntimeException);
268*cdf0e10cSrcweir         virtual void SAL_CALL setMinValue( const ::com::sun::star::beans::Optional< double >& _minvalue ) throw (::com::sun::star::uno::RuntimeException);
269*cdf0e10cSrcweir         virtual ::com::sun::star::beans::Optional< double > SAL_CALL getMaxValue() throw (::com::sun::star::uno::RuntimeException);
270*cdf0e10cSrcweir         virtual void SAL_CALL setMaxValue( const ::com::sun::star::beans::Optional< double >& _maxvalue ) throw (::com::sun::star::uno::RuntimeException);
271*cdf0e10cSrcweir         virtual ::sal_Int16 SAL_CALL getDisplayUnit() throw (::com::sun::star::uno::RuntimeException);
272*cdf0e10cSrcweir         virtual void SAL_CALL setDisplayUnit( ::sal_Int16 _displayunit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
273*cdf0e10cSrcweir         virtual ::sal_Int16 SAL_CALL getValueUnit() throw (::com::sun::star::uno::RuntimeException);
274*cdf0e10cSrcweir         virtual void SAL_CALL setValueUnit( ::sal_Int16 _valueunit ) throw (::com::sun::star::uno::RuntimeException);
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir     private:
277*cdf0e10cSrcweir         /** converts an API value (<code>double</code>, as passed into <code>set[Max|Min|]Value) into
278*cdf0e10cSrcweir             a <code>long</code> value which can be passed to our NumericField.
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir             The conversion respects our decimal digits as well as our value factor (<member>m_nFieldToUNOValueFactor</member>).
281*cdf0e10cSrcweir         */
282*cdf0e10cSrcweir         long    impl_apiValueToFieldValue_nothrow( double _nApiValue ) const;
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir         /** converts a control value, as obtained from our Numeric field, into a value which can passed
285*cdf0e10cSrcweir             to outer callers via our UNO API.
286*cdf0e10cSrcweir         */
287*cdf0e10cSrcweir         double  impl_fieldValueToApiValue_nothrow( sal_Int64 _nFieldValue ) const;
288*cdf0e10cSrcweir     };
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir     //========================================================================
291*cdf0e10cSrcweir     //= OColorControl
292*cdf0e10cSrcweir     //========================================================================
293*cdf0e10cSrcweir     typedef CommonBehaviourControl  <   ::com::sun::star::inspection::XStringListControl
294*cdf0e10cSrcweir                                     ,   ListLikeControlWithModifyHandler< ColorListBox >
295*cdf0e10cSrcweir                                     >   OColorControl_Base;
296*cdf0e10cSrcweir     class OColorControl : public OColorControl_Base
297*cdf0e10cSrcweir     {
298*cdf0e10cSrcweir     private:
299*cdf0e10cSrcweir         ::std::set< ::rtl::OUString >   m_aNonColorEntries;
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir     public:
302*cdf0e10cSrcweir         OColorControl( Window* pParent, WinBits nWinStyle );
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir         // XPropertyControl
305*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
306*cdf0e10cSrcweir         virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
307*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir         // XStringListControl
310*cdf0e10cSrcweir         virtual void SAL_CALL clearList(  ) throw (::com::sun::star::uno::RuntimeException);
311*cdf0e10cSrcweir         virtual void SAL_CALL prependListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException);
312*cdf0e10cSrcweir         virtual void SAL_CALL appendListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException);
313*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getListEntries(  ) throw (::com::sun::star::uno::RuntimeException);
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir     protected:
316*cdf0e10cSrcweir         virtual void modified();
317*cdf0e10cSrcweir     };
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir     //========================================================================
320*cdf0e10cSrcweir     //= OListboxControl
321*cdf0e10cSrcweir     //========================================================================
322*cdf0e10cSrcweir     typedef CommonBehaviourControl  <   ::com::sun::star::inspection::XStringListControl
323*cdf0e10cSrcweir                                     ,   ListLikeControlWithModifyHandler< ListBox >
324*cdf0e10cSrcweir                                     >   OListboxControl_Base;
325*cdf0e10cSrcweir     class OListboxControl : public OListboxControl_Base
326*cdf0e10cSrcweir     {
327*cdf0e10cSrcweir     public:
328*cdf0e10cSrcweir         OListboxControl( Window* pParent, WinBits nWinStyle );
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir         // XPropertyControl
331*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
332*cdf0e10cSrcweir         virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
333*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir         // XStringListControl
336*cdf0e10cSrcweir         virtual void SAL_CALL clearList(  ) throw (::com::sun::star::uno::RuntimeException);
337*cdf0e10cSrcweir         virtual void SAL_CALL prependListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException);
338*cdf0e10cSrcweir         virtual void SAL_CALL appendListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException);
339*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getListEntries(  ) throw (::com::sun::star::uno::RuntimeException);
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir     protected:
342*cdf0e10cSrcweir         virtual void modified();
343*cdf0e10cSrcweir     };
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir     //========================================================================
346*cdf0e10cSrcweir     //= OComboboxControl
347*cdf0e10cSrcweir     //========================================================================
348*cdf0e10cSrcweir     typedef CommonBehaviourControl< ::com::sun::star::inspection::XStringListControl, ControlWindow< ComboBox > > OComboboxControl_Base;
349*cdf0e10cSrcweir     class OComboboxControl : public OComboboxControl_Base
350*cdf0e10cSrcweir     {
351*cdf0e10cSrcweir     public:
352*cdf0e10cSrcweir         OComboboxControl( Window* pParent, WinBits nWinStyle );
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir         // XPropertyControl
355*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
356*cdf0e10cSrcweir         virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
357*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir         // XStringListControl
360*cdf0e10cSrcweir         virtual void SAL_CALL clearList(  ) throw (::com::sun::star::uno::RuntimeException);
361*cdf0e10cSrcweir         virtual void SAL_CALL prependListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException);
362*cdf0e10cSrcweir         virtual void SAL_CALL appendListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException);
363*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getListEntries(  ) throw (::com::sun::star::uno::RuntimeException);
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir     protected:
366*cdf0e10cSrcweir         DECL_LINK( OnEntrySelected, void* );
367*cdf0e10cSrcweir     };
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir     //========================================================================
370*cdf0e10cSrcweir     //= DropDownEditControl
371*cdf0e10cSrcweir     //========================================================================
372*cdf0e10cSrcweir     enum MultiLineOperationMode
373*cdf0e10cSrcweir     {
374*cdf0e10cSrcweir         eStringList,
375*cdf0e10cSrcweir         eMultiLineText
376*cdf0e10cSrcweir     };
377*cdf0e10cSrcweir     //========================================================================
378*cdf0e10cSrcweir     //= DropDownEditControl
379*cdf0e10cSrcweir     //========================================================================
380*cdf0e10cSrcweir     class OMultilineFloatingEdit;
381*cdf0e10cSrcweir     typedef ControlWindow< Edit > DropDownEditControl_Base;
382*cdf0e10cSrcweir     /** an Edit field which can be used as ControlWindow, and has a drop-down button
383*cdf0e10cSrcweir     */
384*cdf0e10cSrcweir     class DropDownEditControl : public DropDownEditControl_Base
385*cdf0e10cSrcweir     {
386*cdf0e10cSrcweir     private:
387*cdf0e10cSrcweir         OMultilineFloatingEdit*             m_pFloatingEdit;
388*cdf0e10cSrcweir         MultiLineEdit*                      m_pImplEdit;
389*cdf0e10cSrcweir         PushButton*                         m_pDropdownButton;
390*cdf0e10cSrcweir         MultiLineOperationMode              m_nOperationMode;
391*cdf0e10cSrcweir         sal_Bool                            m_bDropdown : 1;
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir     public:
394*cdf0e10cSrcweir         DropDownEditControl( Window* _pParent, WinBits _nStyle );
395*cdf0e10cSrcweir         ~DropDownEditControl();
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir         void setOperationMode( MultiLineOperationMode _eMode ) { m_nOperationMode = _eMode; }
398*cdf0e10cSrcweir         MultiLineOperationMode getOperationMode() const { return m_nOperationMode; }
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir         void            SetTextValue( const ::rtl::OUString& _rText );
401*cdf0e10cSrcweir         ::rtl::OUString GetTextValue() const;
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir         void            SetStringListValue( const StlSyntaxSequence< ::rtl::OUString >& _rStrings );
404*cdf0e10cSrcweir         StlSyntaxSequence< ::rtl::OUString >
405*cdf0e10cSrcweir                         GetStringListValue() const;
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir         // ControlWindow overridables
408*cdf0e10cSrcweir         virtual void setControlHelper( ControlHelper& _rControlHelper );
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir     protected:
411*cdf0e10cSrcweir         // Window overridables
412*cdf0e10cSrcweir         virtual long    PreNotify( NotifyEvent& rNEvt );
413*cdf0e10cSrcweir         virtual void    Resize();
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir     protected:
416*cdf0e10cSrcweir         long            FindPos(long nSinglePos);
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir     private:
419*cdf0e10cSrcweir         DECL_LINK( ReturnHdl, OMultilineFloatingEdit* );
420*cdf0e10cSrcweir         DECL_LINK( DropDownHdl, PushButton* );
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir         sal_Bool ShowDropDown( sal_Bool bShow );
423*cdf0e10cSrcweir     };
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir     //========================================================================
426*cdf0e10cSrcweir     //= OMultilineEditControl
427*cdf0e10cSrcweir     //========================================================================
428*cdf0e10cSrcweir     typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, DropDownEditControl > OMultilineEditControl_Base;
429*cdf0e10cSrcweir     class OMultilineEditControl : public OMultilineEditControl_Base
430*cdf0e10cSrcweir     {
431*cdf0e10cSrcweir     public:
432*cdf0e10cSrcweir         OMultilineEditControl( Window* pParent, MultiLineOperationMode _eMode, WinBits nWinStyle  );
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir         // XPropertyControl
435*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
436*cdf0e10cSrcweir         virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException);
437*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException);
438*cdf0e10cSrcweir     };
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir //............................................................................
441*cdf0e10cSrcweir } // namespace pcr
442*cdf0e10cSrcweir //............................................................................
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir #endif // _EXTENSIONS_PROPCTRLR_STANDARDCONTROL_HXX_
445*cdf0e10cSrcweir 
446