Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
30 : : #define _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
31 : :
32 : : #include "pcrcommon.hxx"
33 : :
34 : : #include <com/sun/star/inspection/XPropertyControl.hpp>
35 : : #include <vcl/tabctrl.hxx>
36 : : #include <comphelper/stl_types.hxx>
37 : : #include <boost/mem_fn.hpp>
38 : : #include <map>
39 : :
40 : : //............................................................................
41 : : namespace pcr
42 : : {
43 : : //............................................................................
44 : :
45 : : class IPropertyLineListener;
46 : : class IPropertyControlObserver;
47 : : class OBrowserPage;
48 : : struct OLineDescriptor;
49 : : class OBrowserListBox;
50 : :
51 : : //========================================================================
52 : : //= OPropertyEditor
53 : : //========================================================================
54 : : class OPropertyEditor : public Control
55 : : {
56 : : private:
57 : : typedef ::std::map< ::rtl::OUString, sal_uInt16 > MapStringToPageId;
58 : : struct HiddenPage
59 : : {
60 : : sal_uInt16 nPos;
61 : : TabPage* pPage;
62 : 0 : HiddenPage() : nPos( 0 ), pPage( NULL ) { }
63 : 0 : HiddenPage( sal_uInt16 _nPos, TabPage* _pPage ) : nPos( _nPos ), pPage( _pPage ) { }
64 : : };
65 : :
66 : : private:
67 : : TabControl m_aTabControl;
68 : : IPropertyLineListener* m_pListener;
69 : : IPropertyControlObserver* m_pObserver;
70 : : sal_uInt16 m_nNextId;
71 : : Link m_aPageActivationHandler;
72 : : bool m_bHasHelpSection;
73 : : sal_Int32 m_nMinHelpLines;
74 : : sal_Int32 m_nMaxHelpLines;
75 : :
76 : : MapStringToPageId m_aPropertyPageIds;
77 : : ::std::map< sal_uInt16, HiddenPage > m_aHiddenPages;
78 : :
79 : : protected:
80 : : void Resize();
81 : : void GetFocus();
82 : :
83 : : public:
84 : : OPropertyEditor (Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL);
85 : :
86 : : ~OPropertyEditor();
87 : :
88 : : void EnableUpdate();
89 : : void DisableUpdate();
90 : :
91 : : void SetLineListener( IPropertyLineListener* );
92 : : void SetControlObserver( IPropertyControlObserver* );
93 : :
94 : : void EnableHelpSection( bool _bEnable );
95 : : bool HasHelpSection() const;
96 : : void SetHelpText( const ::rtl::OUString& _rHelpText );
97 : : void SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines );
98 : :
99 : : void SetHelpId( const rtl::OString& sHelpId );
100 : : sal_uInt16 AppendPage( const String& r, const rtl::OString& _rHelpId );
101 : : void SetPage( sal_uInt16 );
102 : : void RemovePage(sal_uInt16 nID);
103 : : sal_uInt16 GetCurPage();
104 : : void ClearAll();
105 : :
106 : : void SetPropertyValue(const ::rtl::OUString& _rEntryName, const ::com::sun::star::uno::Any& _rValue, bool _bUnknownValue );
107 : : ::com::sun::star::uno::Any GetPropertyValue(const ::rtl::OUString& rEntryName ) const;
108 : : sal_uInt16 GetPropertyPos(const ::rtl::OUString& rEntryName ) const;
109 : : ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
110 : : GetPropertyControl( const ::rtl::OUString& rEntryName );
111 : : void EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable );
112 : : void EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable );
113 : :
114 : : void ShowPropertyPage( sal_uInt16 _nPageId, bool _bShow );
115 : :
116 : : sal_uInt16 InsertEntry( const OLineDescriptor&, sal_uInt16 _nPageId, sal_uInt16 nPos = EDITOR_LIST_APPEND );
117 : : void RemoveEntry( const ::rtl::OUString& _rName );
118 : : void ChangeEntry( const OLineDescriptor& );
119 : :
120 : 0 : void setPageActivationHandler(const Link& _rHdl) { m_aPageActivationHandler = _rHdl; }
121 : : Link getPageActivationHandler() const { return m_aPageActivationHandler; }
122 : :
123 : : // #95343# -------------------------------
124 : : sal_Int32 getMinimumWidth();
125 : : sal_Int32 getMinimumHeight();
126 : :
127 : : void CommitModified();
128 : :
129 : : protected:
130 : : using Window::SetHelpText;
131 : : using Window::Update;
132 : :
133 : : private:
134 : : OBrowserPage* getPage( sal_uInt16& _rPageId );
135 : : const OBrowserPage* getPage( sal_uInt16& _rPageId ) const;
136 : :
137 : : OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName );
138 : : const OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName ) const;
139 : :
140 : : void Update(const ::std::mem_fun_t<void,OBrowserListBox>& _aUpdateFunction);
141 : :
142 : : typedef void (OPropertyEditor::*PageOperation)( OBrowserPage&, const void* );
143 : : void forEachPage( PageOperation _pOperation, const void* _pArgument = NULL );
144 : :
145 : : void setPageLineListener( OBrowserPage& _rPage, const void* );
146 : : void setPageControlObserver( OBrowserPage& _rPage, const void* );
147 : : void enableHelpSection( OBrowserPage& _rPage, const void* );
148 : : void setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString );
149 : : void setHelpLineLimits( OBrowserPage& _rPage, const void* );
150 : :
151 : : protected:
152 : : DECL_LINK(OnPageDeactivate, void *);
153 : : DECL_LINK(OnPageActivate, void *);
154 : : };
155 : :
156 : : //............................................................................
157 : : } // namespace pcr
158 : : //............................................................................
159 : :
160 : : #endif // _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
161 : :
162 : :
163 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|