1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _EXTENSIONS_PROPCTRLR_BROWSERLINE_HXX_ 29 #define _EXTENSIONS_PROPCTRLR_BROWSERLINE_HXX_ 30 31 /** === begin UNO includes === **/ 32 #include <com/sun/star/inspection/XPropertyControl.hpp> 33 /** === end UNO includes === **/ 34 #include <vcl/fixed.hxx> 35 #ifndef _SV_BUTTON_HXX 36 #include <vcl/button.hxx> 37 #endif 38 39 namespace com { namespace sun { namespace star { namespace inspection { namespace PropertyLineElement 40 { 41 const sal_Int16 CompleteLine = 0x4000; 42 } } } } } 43 44 //............................................................................ 45 namespace pcr 46 { 47 //............................................................................ 48 49 class OBrowserLine; 50 51 //======================================================================== 52 class IButtonClickListener 53 { 54 public: 55 virtual void buttonClicked( OBrowserLine* _pLine, sal_Bool _bPrimary ) = 0; 56 }; 57 58 //======================================================================== 59 class OBrowserLine 60 { 61 private: 62 ::rtl::OUString m_sEntryName; 63 FixedText m_aFtTitle; 64 Size m_aOutputSize; 65 Point m_aLinePos; 66 ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > 67 m_xControl; 68 Window* m_pControlWindow; 69 PushButton* m_pBrowseButton; 70 PushButton* m_pAdditionalBrowseButton; 71 IButtonClickListener* m_pClickListener; 72 Window* m_pTheParent; 73 sal_uInt16 m_nNameWidth; 74 sal_uInt16 m_nEnableFlags; 75 bool m_bIndentTitle; 76 bool m_bReadOnly; 77 78 public: 79 OBrowserLine( const ::rtl::OUString& _rEntryName, Window* pParent); 80 ~OBrowserLine(); 81 82 void setControl( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl ); 83 const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& getControl() 84 { 85 return m_xControl; 86 } 87 inline Window* getControlWindow() const 88 { 89 return m_pControlWindow; 90 } 91 92 const ::rtl::OUString& 93 GetEntryName() const { return m_sEntryName; } 94 95 void SetComponentHelpIds( const rtl::OString& _rHelpId, const rtl::OString& _sPrimaryButtonId, const rtl::OString& _sSecondaryButtonId ); 96 97 void SetTitle(const String& rString ); 98 void FullFillTitleString(); 99 String GetTitle() const; 100 void SetTitleWidth(sal_uInt16); 101 102 void SetPosSizePixel(Point aPos,Size aSize); 103 void Show(sal_Bool bFlag=sal_True); 104 void Hide(); 105 sal_Bool IsVisible(); 106 107 Window* GetRefWindow(); 108 void SetTabOrder(Window* pRefWindow, sal_uInt16 nFlags ); 109 110 sal_Bool GrabFocus(); 111 void ShowBrowseButton( const ::rtl::OUString& _rImageURL, sal_Bool _bPrimary ); 112 void ShowBrowseButton( const Image& _rImage, sal_Bool _bPrimary ); 113 void ShowBrowseButton( sal_Bool _bPrimary ); 114 void HideBrowseButton( sal_Bool _bPrimary ); 115 116 void EnablePropertyControls( sal_Int16 _nControls, bool _bEnable ); 117 void EnablePropertyLine( bool _bEnable ); 118 119 void SetReadOnly( bool _bReadOnly ); 120 121 void SetClickListener( IButtonClickListener* _pListener ); 122 123 void IndentTitle( bool _bIndent ); 124 125 private: 126 DECL_LINK( OnButtonClicked, PushButton* ); 127 DECL_LINK( OnButtonFocus, PushButton* ); 128 129 void implHideBrowseButton( sal_Bool _bPrimary, bool _bReLayout ); 130 void implUpdateEnabledDisabled(); 131 132 void impl_layoutComponents(); 133 134 PushButton& impl_ensureButton( bool _bPrimary ); 135 void impl_getImagesFromURL_nothrow( const ::rtl::OUString& _rImageURL, Image& _out_rImage, Image& _out_rHCImage ); 136 }; 137 138 //............................................................................ 139 } // namespace pcr 140 //............................................................................ 141 142 #endif // _EXTENSIONS_PROPCTRLR_BROWSERLINE_HXX_ 143 144