1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _EXTENSIONS_PROPCTRLR_BROWSERLINE_HXX_
25 #define _EXTENSIONS_PROPCTRLR_BROWSERLINE_HXX_
26 
27 /** === begin UNO includes === **/
28 #include <com/sun/star/inspection/XPropertyControl.hpp>
29 /** === end UNO includes === **/
30 #include <vcl/fixed.hxx>
31 #ifndef _SV_BUTTON_HXX
32 #include <vcl/button.hxx>
33 #endif
34 
35 namespace com { namespace sun { namespace star { namespace inspection { namespace PropertyLineElement
36 {
37     const sal_Int16 CompleteLine = 0x4000;
38 } } } } }
39 
40 //............................................................................
41 namespace pcr
42 {
43 //............................................................................
44 
45     class OBrowserLine;
46 
47     //========================================================================
48     class IButtonClickListener
49     {
50     public:
51         virtual void    buttonClicked( OBrowserLine* _pLine, sal_Bool _bPrimary ) = 0;
52     };
53 
54     //========================================================================
55     class OBrowserLine
56     {
57     private:
58         ::rtl::OUString         m_sEntryName;
59         FixedText               m_aFtTitle;
60         Size                    m_aOutputSize;
61         Point                   m_aLinePos;
62         ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
63                                 m_xControl;
64         Window*                 m_pControlWindow;
65         PushButton*             m_pBrowseButton;
66         PushButton*             m_pAdditionalBrowseButton;
67         IButtonClickListener*   m_pClickListener;
68         Window*                 m_pTheParent;
69         sal_uInt16              m_nNameWidth;
70         sal_uInt16              m_nEnableFlags;
71         bool                    m_bIndentTitle;
72         bool                    m_bReadOnly;
73 
74     public:
75                             OBrowserLine( const ::rtl::OUString& _rEntryName, Window* pParent);
76                             ~OBrowserLine();
77 
78         void setControl( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl );
getControl()79         const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& getControl()
80         {
81             return m_xControl;
82         }
getControlWindow() const83         inline Window* getControlWindow() const
84         {
85             return m_pControlWindow;
86         }
87 
88         const ::rtl::OUString&
GetEntryName() const89                             GetEntryName() const { return m_sEntryName; }
90 
91         void                SetComponentHelpIds( const rtl::OString& _rHelpId, const rtl::OString& _sPrimaryButtonId, const rtl::OString& _sSecondaryButtonId );
92 
93         void                SetTitle(const String& rString );
94         void                FullFillTitleString();
95         String              GetTitle() const;
96         void                SetTitleWidth(sal_uInt16);
97 
98         void                SetPosSizePixel(Point aPos,Size aSize);
99         void                Show(sal_Bool bFlag=sal_True);
100         void                Hide();
101         sal_Bool            IsVisible();
102 
103         Window*             GetRefWindow();
104         void                SetTabOrder(Window* pRefWindow, sal_uInt16 nFlags );
105 
106         sal_Bool            GrabFocus();
107         void                ShowBrowseButton( const ::rtl::OUString& _rImageURL, sal_Bool _bPrimary );
108         void                ShowBrowseButton( const Image& _rImage, sal_Bool _bPrimary );
109         void                ShowBrowseButton( sal_Bool _bPrimary );
110         void                HideBrowseButton( sal_Bool _bPrimary );
111 
112         void                EnablePropertyControls( sal_Int16 _nControls, bool _bEnable );
113         void                EnablePropertyLine( bool _bEnable );
114 
115         void                SetReadOnly( bool _bReadOnly );
116 
117         void                SetClickListener( IButtonClickListener* _pListener );
118 
119         void                IndentTitle( bool _bIndent );
120 
121     private:
122         DECL_LINK( OnButtonClicked, PushButton* );
123         DECL_LINK( OnButtonFocus, PushButton* );
124 
125         void    implHideBrowseButton( sal_Bool _bPrimary, bool _bReLayout );
126         void    implUpdateEnabledDisabled();
127 
128         void    impl_layoutComponents();
129 
130         PushButton& impl_ensureButton( bool _bPrimary );
131         void        impl_getImagesFromURL_nothrow( const ::rtl::OUString& _rImageURL, Image& _out_rImage, Image& _out_rHCImage );
132     };
133 
134 //............................................................................
135 } // namespace pcr
136 //............................................................................
137 
138 #endif // _EXTENSIONS_PROPCTRLR_BROWSERLINE_HXX_
139 
140