merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / source / propctrlr / propertyeditor.hxx
blob304b7628b1d51b61ae63e24487be335b54f3516a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
29 #define _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
31 #include "pcrcommon.hxx"
33 /** === begin UNO includes === **/
34 #include <com/sun/star/inspection/XPropertyControl.hpp>
35 /** === end UNO includes === **/
36 #include <vcl/tabctrl.hxx>
37 #include <comphelper/stl_types.hxx>
38 #include <boost/mem_fn.hpp>
39 #include <map>
41 //............................................................................
42 namespace pcr
44 //............................................................................
46 class IPropertyLineListener;
47 class IPropertyControlObserver;
48 class OBrowserPage;
49 struct OLineDescriptor;
50 class OBrowserListBox;
52 //========================================================================
53 //= OPropertyEditor
54 //========================================================================
55 class OPropertyEditor : public Control
57 private:
58 typedef ::std::map< ::rtl::OUString, sal_uInt16 > MapStringToPageId;
59 struct HiddenPage
61 sal_uInt16 nPos;
62 TabPage* pPage;
63 HiddenPage() : nPos( 0 ), pPage( NULL ) { }
64 HiddenPage( sal_uInt16 _nPos, TabPage* _pPage ) : nPos( _nPos ), pPage( _pPage ) { }
67 private:
68 TabControl m_aTabControl;
69 IPropertyLineListener* m_pListener;
70 IPropertyControlObserver* m_pObserver;
71 sal_uInt16 m_nNextId;
72 Link m_aPageActivationHandler;
73 bool m_bHasHelpSection;
74 sal_Int32 m_nMinHelpLines;
75 sal_Int32 m_nMaxHelpLines;
77 MapStringToPageId m_aPropertyPageIds;
78 ::std::map< sal_uInt16, HiddenPage > m_aHiddenPages;
80 protected:
81 void Resize();
82 void GetFocus();
84 public:
85 OPropertyEditor (Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL);
87 ~OPropertyEditor();
89 void EnableUpdate();
90 void DisableUpdate();
92 void SetLineListener( IPropertyLineListener* );
93 void SetControlObserver( IPropertyControlObserver* );
95 void EnableHelpSection( bool _bEnable );
96 bool HasHelpSection() const;
97 void SetHelpText( const ::rtl::OUString& _rHelpText );
98 void SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines );
100 void SetHelpId( sal_uInt32 nHelpId );
101 sal_uInt16 AppendPage( const String& r, const SmartId& _rHelpId );
102 void SetPage( sal_uInt16 );
103 void RemovePage(sal_uInt16 nID);
104 sal_uInt16 GetCurPage();
105 void ClearAll();
107 void SetPropertyValue(const ::rtl::OUString& _rEntryName, const ::com::sun::star::uno::Any& _rValue, bool _bUnknownValue );
108 ::com::sun::star::uno::Any GetPropertyValue(const ::rtl::OUString& rEntryName ) const;
109 sal_uInt16 GetPropertyPos(const ::rtl::OUString& rEntryName ) const;
110 ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
111 GetPropertyControl( const ::rtl::OUString& rEntryName );
112 void EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable );
113 void EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable );
115 void ShowPropertyPage( sal_uInt16 _nPageId, bool _bShow );
117 sal_uInt16 InsertEntry( const OLineDescriptor&, sal_uInt16 _nPageId, sal_uInt16 nPos = EDITOR_LIST_APPEND );
118 void RemoveEntry( const ::rtl::OUString& _rName );
119 void ChangeEntry( const OLineDescriptor& );
121 void setPageActivationHandler(const Link& _rHdl) { m_aPageActivationHandler = _rHdl; }
122 Link getPageActivationHandler() const { return m_aPageActivationHandler; }
124 // #95343# -------------------------------
125 sal_Int32 getMinimumWidth();
126 sal_Int32 getMinimumHeight();
128 void CommitModified();
130 protected:
131 using Window::SetHelpText;
132 using Window::Update;
134 private:
135 OBrowserPage* getPage( sal_uInt16& _rPageId );
136 const OBrowserPage* getPage( sal_uInt16& _rPageId ) const;
138 OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName );
139 const OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName ) const;
141 void Update(const ::std::mem_fun_t<void,OBrowserListBox>& _aUpdateFunction);
143 typedef void (OPropertyEditor::*PageOperation)( OBrowserPage&, const void* );
144 void forEachPage( PageOperation _pOperation, const void* _pArgument = NULL );
146 void setPageLineListener( OBrowserPage& _rPage, const void* );
147 void setPageControlObserver( OBrowserPage& _rPage, const void* );
148 void enableHelpSection( OBrowserPage& _rPage, const void* );
149 void setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString );
150 void setHelpLineLimits( OBrowserPage& _rPage, const void* );
152 protected:
153 DECL_LINK(OnPageDeactivate, TabControl*);
154 DECL_LINK(OnPageActivate, TabControl*);
157 //............................................................................
158 } // namespace pcr
159 //............................................................................
161 #endif // _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_