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