1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
31 //............................................................................
34 //............................................................................
36 class IPropertyLineListener
;
37 class IPropertyControlObserver
;
39 struct OLineDescriptor
;
40 class OBrowserListBox
;
42 //========================================================================
44 //========================================================================
45 class OPropertyEditor
: public Control
48 typedef ::std::map
< OUString
, sal_uInt16
> MapStringToPageId
;
53 HiddenPage() : nPos( 0 ), pPage( NULL
) { }
54 HiddenPage( sal_uInt16 _nPos
, TabPage
* _pPage
) : nPos( _nPos
), pPage( _pPage
) { }
58 TabControl m_aTabControl
;
59 IPropertyLineListener
* m_pListener
;
60 IPropertyControlObserver
* m_pObserver
;
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
;
75 OPropertyEditor (Window
* pParent
, WinBits nWinStyle
= WB_DIALOGCONTROL
);
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();
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();
121 using Window::SetHelpText
;
122 using Window::Update
;
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* );
143 DECL_LINK(OnPageDeactivate
, void *);
144 DECL_LINK(OnPageActivate
, void *);
147 //............................................................................
149 //............................................................................
151 #endif // _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */