merge the formfield patch from ooo-build
[ooovba.git] / extensions / source / propctrlr / propertyeditor.hxx
blob993d4406add89c7339742f6fabc6c07b00d00a03
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: propertyeditor.hxx,v $
10 * $Revision: 1.18 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
32 #define _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
34 #include "pcrcommon.hxx"
36 /** === begin UNO includes === **/
37 #include <com/sun/star/inspection/XPropertyControl.hpp>
38 /** === end UNO includes === **/
39 #include <vcl/tabctrl.hxx>
40 #include <comphelper/stl_types.hxx>
41 #include <boost/mem_fn.hpp>
42 #include <map>
44 //............................................................................
45 namespace pcr
47 //............................................................................
49 class IPropertyLineListener;
50 class IPropertyControlObserver;
51 class OBrowserPage;
52 struct OLineDescriptor;
53 class OBrowserListBox;
55 //========================================================================
56 //= OPropertyEditor
57 //========================================================================
58 class OPropertyEditor : public Control
60 private:
61 typedef ::std::map< ::rtl::OUString, sal_uInt16 > MapStringToPageId;
62 struct HiddenPage
64 sal_uInt16 nPos;
65 TabPage* pPage;
66 HiddenPage() : nPos( 0 ), pPage( NULL ) { }
67 HiddenPage( sal_uInt16 _nPos, TabPage* _pPage ) : nPos( _nPos ), pPage( _pPage ) { }
70 private:
71 TabControl m_aTabControl;
72 IPropertyLineListener* m_pListener;
73 IPropertyControlObserver* m_pObserver;
74 sal_uInt16 m_nNextId;
75 Link m_aPageActivationHandler;
76 bool m_bHasHelpSection;
77 sal_Int32 m_nMinHelpLines;
78 sal_Int32 m_nMaxHelpLines;
80 MapStringToPageId m_aPropertyPageIds;
81 ::std::map< sal_uInt16, HiddenPage > m_aHiddenPages;
83 protected:
84 void Resize();
85 void GetFocus();
87 public:
88 OPropertyEditor (Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL);
90 ~OPropertyEditor();
92 void EnableUpdate();
93 void DisableUpdate();
95 void SetLineListener( IPropertyLineListener* );
96 void SetControlObserver( IPropertyControlObserver* );
98 void EnableHelpSection( bool _bEnable );
99 bool HasHelpSection() const;
100 void SetHelpText( const ::rtl::OUString& _rHelpText );
101 void SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines );
103 void SetHelpId( sal_uInt32 nHelpId );
104 sal_uInt16 AppendPage( const String& r, const SmartId& _rHelpId );
105 void SetPage( sal_uInt16 );
106 void RemovePage(sal_uInt16 nID);
107 sal_uInt16 GetCurPage();
108 void ClearAll();
110 void SetPropertyValue(const ::rtl::OUString& _rEntryName, const ::com::sun::star::uno::Any& _rValue, bool _bUnknownValue );
111 ::com::sun::star::uno::Any GetPropertyValue(const ::rtl::OUString& rEntryName ) const;
112 sal_uInt16 GetPropertyPos(const ::rtl::OUString& rEntryName ) const;
113 ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
114 GetPropertyControl( const ::rtl::OUString& rEntryName );
115 void EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable );
116 void EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable );
118 void ShowPropertyPage( sal_uInt16 _nPageId, bool _bShow );
120 sal_uInt16 InsertEntry( const OLineDescriptor&, sal_uInt16 _nPageId, sal_uInt16 nPos = EDITOR_LIST_APPEND );
121 void RemoveEntry( const ::rtl::OUString& _rName );
122 void ChangeEntry( const OLineDescriptor& );
124 void setPageActivationHandler(const Link& _rHdl) { m_aPageActivationHandler = _rHdl; }
125 Link getPageActivationHandler() const { return m_aPageActivationHandler; }
127 // #95343# -------------------------------
128 sal_Int32 getMinimumWidth();
129 sal_Int32 getMinimumHeight();
131 void CommitModified();
133 protected:
134 using Window::SetHelpText;
135 using Window::Update;
137 private:
138 OBrowserPage* getPage( sal_uInt16& _rPageId );
139 const OBrowserPage* getPage( sal_uInt16& _rPageId ) const;
141 OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName );
142 const OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName ) const;
144 void Update(const ::std::mem_fun_t<void,OBrowserListBox>& _aUpdateFunction);
146 typedef void (OPropertyEditor::*PageOperation)( OBrowserPage&, const void* );
147 void forEachPage( PageOperation _pOperation, const void* _pArgument = NULL );
149 void setPageLineListener( OBrowserPage& _rPage, const void* );
150 void setPageControlObserver( OBrowserPage& _rPage, const void* );
151 void enableHelpSection( OBrowserPage& _rPage, const void* );
152 void setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString );
153 void setHelpLineLimits( OBrowserPage& _rPage, const void* );
155 protected:
156 DECL_LINK(OnPageDeactivate, TabControl*);
157 DECL_LINK(OnPageActivate, TabControl*);
160 //............................................................................
161 } // namespace pcr
162 //............................................................................
164 #endif // _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_