update credits
[LibreOffice.git] / extensions / source / propctrlr / propertyeditor.hxx
blobd8883231554d0ed82531794fce6ef1dd40641595
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
21 #define _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
23 #include "pcrcommon.hxx"
25 #include <com/sun/star/inspection/XPropertyControl.hpp>
26 #include <vcl/tabctrl.hxx>
27 #include <comphelper/stl_types.hxx>
28 #include <boost/mem_fn.hpp>
29 #include <map>
31 //............................................................................
32 namespace pcr
34 //............................................................................
36 class IPropertyLineListener;
37 class IPropertyControlObserver;
38 class OBrowserPage;
39 struct OLineDescriptor;
40 class OBrowserListBox;
42 //========================================================================
43 //= OPropertyEditor
44 //========================================================================
45 class OPropertyEditor : public Control
47 private:
48 typedef ::std::map< OUString, sal_uInt16 > MapStringToPageId;
49 struct HiddenPage
51 sal_uInt16 nPos;
52 TabPage* pPage;
53 HiddenPage() : nPos( 0 ), pPage( NULL ) { }
54 HiddenPage( sal_uInt16 _nPos, TabPage* _pPage ) : nPos( _nPos ), pPage( _pPage ) { }
57 private:
58 TabControl m_aTabControl;
59 IPropertyLineListener* m_pListener;
60 IPropertyControlObserver* m_pObserver;
61 sal_uInt16 m_nNextId;
62 Link m_aPageActivationHandler;
63 bool m_bHasHelpSection;
64 sal_Int32 m_nMinHelpLines;
65 sal_Int32 m_nMaxHelpLines;
67 MapStringToPageId m_aPropertyPageIds;
68 ::std::map< sal_uInt16, HiddenPage > m_aHiddenPages;
70 protected:
71 void Resize();
72 void GetFocus();
74 public:
75 OPropertyEditor (Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL);
77 ~OPropertyEditor();
79 void EnableUpdate();
80 void DisableUpdate();
82 void SetLineListener( IPropertyLineListener* );
83 void SetControlObserver( IPropertyControlObserver* );
85 void EnableHelpSection( bool _bEnable );
86 bool HasHelpSection() const;
87 void SetHelpText( const OUString& _rHelpText );
88 void SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines );
90 void SetHelpId( const OString& sHelpId );
91 sal_uInt16 AppendPage( const String& r, const OString& _rHelpId );
92 void SetPage( sal_uInt16 );
93 void RemovePage(sal_uInt16 nID);
94 sal_uInt16 GetCurPage();
95 void ClearAll();
97 void SetPropertyValue(const OUString& _rEntryName, const ::com::sun::star::uno::Any& _rValue, bool _bUnknownValue );
98 ::com::sun::star::uno::Any GetPropertyValue(const OUString& rEntryName ) const;
99 sal_uInt16 GetPropertyPos(const OUString& rEntryName ) const;
100 ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
101 GetPropertyControl( const OUString& rEntryName );
102 void EnablePropertyLine( const OUString& _rEntryName, bool _bEnable );
103 void EnablePropertyControls( const OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable );
105 void ShowPropertyPage( sal_uInt16 _nPageId, bool _bShow );
107 sal_uInt16 InsertEntry( const OLineDescriptor&, sal_uInt16 _nPageId, sal_uInt16 nPos = EDITOR_LIST_APPEND );
108 void RemoveEntry( const OUString& _rName );
109 void ChangeEntry( const OLineDescriptor& );
111 void setPageActivationHandler(const Link& _rHdl) { m_aPageActivationHandler = _rHdl; }
112 Link getPageActivationHandler() const { return m_aPageActivationHandler; }
114 // #95343# -------------------------------
115 sal_Int32 getMinimumWidth();
116 sal_Int32 getMinimumHeight();
118 void CommitModified();
120 protected:
121 using Window::SetHelpText;
122 using Window::Update;
124 private:
125 OBrowserPage* getPage( sal_uInt16& _rPageId );
126 const OBrowserPage* getPage( sal_uInt16& _rPageId ) const;
128 OBrowserPage* getPage( const OUString& _rPropertyName );
129 const OBrowserPage* getPage( const OUString& _rPropertyName ) const;
131 void Update(const ::std::mem_fun_t<void,OBrowserListBox>& _aUpdateFunction);
133 typedef void (OPropertyEditor::*PageOperation)( OBrowserPage&, const void* );
134 void forEachPage( PageOperation _pOperation, const void* _pArgument = NULL );
136 void setPageLineListener( OBrowserPage& _rPage, const void* );
137 void setPageControlObserver( OBrowserPage& _rPage, const void* );
138 void enableHelpSection( OBrowserPage& _rPage, const void* );
139 void setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString );
140 void setHelpLineLimits( OBrowserPage& _rPage, const void* );
142 protected:
143 DECL_LINK(OnPageDeactivate, void *);
144 DECL_LINK(OnPageActivate, void *);
147 //............................................................................
148 } // namespace pcr
149 //............................................................................
151 #endif // _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */