Bump for 3.6-28
[LibreOffice.git] / extensions / source / propctrlr / propertyeditor.hxx
blob0a43a2f4cd795fe2bcc99274af9169825b7eaa57
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
30 #define _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
32 #include "pcrcommon.hxx"
34 /** === begin UNO includes === **/
35 #include <com/sun/star/inspection/XPropertyControl.hpp>
36 /** === end UNO includes === **/
37 #include <vcl/tabctrl.hxx>
38 #include <comphelper/stl_types.hxx>
39 #include <boost/mem_fn.hpp>
40 #include <map>
42 //............................................................................
43 namespace pcr
45 //............................................................................
47 class IPropertyLineListener;
48 class IPropertyControlObserver;
49 class OBrowserPage;
50 struct OLineDescriptor;
51 class OBrowserListBox;
53 //========================================================================
54 //= OPropertyEditor
55 //========================================================================
56 class OPropertyEditor : public Control
58 private:
59 typedef ::std::map< ::rtl::OUString, sal_uInt16 > MapStringToPageId;
60 struct HiddenPage
62 sal_uInt16 nPos;
63 TabPage* pPage;
64 HiddenPage() : nPos( 0 ), pPage( NULL ) { }
65 HiddenPage( sal_uInt16 _nPos, TabPage* _pPage ) : nPos( _nPos ), pPage( _pPage ) { }
68 private:
69 TabControl m_aTabControl;
70 IPropertyLineListener* m_pListener;
71 IPropertyControlObserver* m_pObserver;
72 sal_uInt16 m_nNextId;
73 Link m_aPageActivationHandler;
74 bool m_bHasHelpSection;
75 sal_Int32 m_nMinHelpLines;
76 sal_Int32 m_nMaxHelpLines;
78 MapStringToPageId m_aPropertyPageIds;
79 ::std::map< sal_uInt16, HiddenPage > m_aHiddenPages;
81 protected:
82 void Resize();
83 void GetFocus();
85 public:
86 OPropertyEditor (Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL);
88 ~OPropertyEditor();
90 void EnableUpdate();
91 void DisableUpdate();
93 void SetLineListener( IPropertyLineListener* );
94 void SetControlObserver( IPropertyControlObserver* );
96 void EnableHelpSection( bool _bEnable );
97 bool HasHelpSection() const;
98 void SetHelpText( const ::rtl::OUString& _rHelpText );
99 void SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines );
101 void SetHelpId( const rtl::OString& sHelpId );
102 sal_uInt16 AppendPage( const String& r, const rtl::OString& _rHelpId );
103 void SetPage( sal_uInt16 );
104 void RemovePage(sal_uInt16 nID);
105 sal_uInt16 GetCurPage();
106 void ClearAll();
108 void SetPropertyValue(const ::rtl::OUString& _rEntryName, const ::com::sun::star::uno::Any& _rValue, bool _bUnknownValue );
109 ::com::sun::star::uno::Any GetPropertyValue(const ::rtl::OUString& rEntryName ) const;
110 sal_uInt16 GetPropertyPos(const ::rtl::OUString& rEntryName ) const;
111 ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
112 GetPropertyControl( const ::rtl::OUString& rEntryName );
113 void EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable );
114 void EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable );
116 void ShowPropertyPage( sal_uInt16 _nPageId, bool _bShow );
118 sal_uInt16 InsertEntry( const OLineDescriptor&, sal_uInt16 _nPageId, sal_uInt16 nPos = EDITOR_LIST_APPEND );
119 void RemoveEntry( const ::rtl::OUString& _rName );
120 void ChangeEntry( const OLineDescriptor& );
122 void setPageActivationHandler(const Link& _rHdl) { m_aPageActivationHandler = _rHdl; }
123 Link getPageActivationHandler() const { return m_aPageActivationHandler; }
125 // #95343# -------------------------------
126 sal_Int32 getMinimumWidth();
127 sal_Int32 getMinimumHeight();
129 void CommitModified();
131 protected:
132 using Window::SetHelpText;
133 using Window::Update;
135 private:
136 OBrowserPage* getPage( sal_uInt16& _rPageId );
137 const OBrowserPage* getPage( sal_uInt16& _rPageId ) const;
139 OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName );
140 const OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName ) const;
142 void Update(const ::std::mem_fun_t<void,OBrowserListBox>& _aUpdateFunction);
144 typedef void (OPropertyEditor::*PageOperation)( OBrowserPage&, const void* );
145 void forEachPage( PageOperation _pOperation, const void* _pArgument = NULL );
147 void setPageLineListener( OBrowserPage& _rPage, const void* );
148 void setPageControlObserver( OBrowserPage& _rPage, const void* );
149 void enableHelpSection( OBrowserPage& _rPage, const void* );
150 void setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString );
151 void setHelpLineLimits( OBrowserPage& _rPage, const void* );
153 protected:
154 DECL_LINK(OnPageDeactivate, void *);
155 DECL_LINK(OnPageActivate, void *);
158 //............................................................................
159 } // namespace pcr
160 //............................................................................
162 #endif // _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */