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 INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYEDITOR_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYEDITOR_HXX
23 #include "pcrcommon.hxx"
25 #include <com/sun/star/inspection/XPropertyControl.hpp>
26 #include <vcl/tabctrl.hxx>
27 #include <vcl/vclptr.hxx>
33 class IPropertyLineListener
;
34 class IPropertyControlObserver
;
36 struct OLineDescriptor
;
37 class OBrowserListBox
;
42 class OPropertyEditor
: public Control
45 typedef std::map
< OUString
, sal_uInt16
> MapStringToPageId
;
49 VclPtr
<TabPage
> pPage
;
50 HiddenPage() : nPos( 0 ), pPage( nullptr ) { }
51 HiddenPage( sal_uInt16 _nPos
, TabPage
* _pPage
) : nPos( _nPos
), pPage( _pPage
) { }
55 VclPtr
<TabControl
> m_aTabControl
;
56 IPropertyLineListener
* m_pListener
;
57 IPropertyControlObserver
* m_pObserver
;
59 Link
<LinkParamNone
*,void> m_aPageActivationHandler
;
60 bool m_bHasHelpSection
;
61 sal_Int32 m_nMinHelpLines
;
62 sal_Int32 m_nMaxHelpLines
;
64 MapStringToPageId m_aPropertyPageIds
;
65 std::map
< sal_uInt16
, HiddenPage
> m_aHiddenPages
;
68 void Resize() override
;
69 void GetFocus() override
;
72 explicit OPropertyEditor (vcl::Window
* pParent
);
74 virtual ~OPropertyEditor() override
;
75 virtual void dispose() override
;
80 void SetLineListener( IPropertyLineListener
* );
81 void SetControlObserver( IPropertyControlObserver
* );
83 void EnableHelpSection( bool _bEnable
);
84 bool HasHelpSection() const { return m_bHasHelpSection
; }
85 void SetHelpText( const OUString
& _rHelpText
);
86 void SetHelpLineLimites( sal_Int32 _nMinLines
, sal_Int32 _nMaxLines
);
88 void SetHelpId( const OString
& sHelpId
);
89 sal_uInt16
AppendPage( const OUString
& r
, const OString
& _rHelpId
);
90 void SetPage( sal_uInt16
);
91 void RemovePage(sal_uInt16 nID
);
92 sal_uInt16
GetCurPage();
95 void SetPropertyValue(const OUString
& _rEntryName
, const css::uno::Any
& _rValue
, bool _bUnknownValue
);
96 sal_uInt16
GetPropertyPos(const OUString
& rEntryName
) const;
97 css::uno::Reference
< css::inspection::XPropertyControl
>
98 GetPropertyControl( const OUString
& rEntryName
);
99 void EnablePropertyLine( const OUString
& _rEntryName
, bool _bEnable
);
100 void EnablePropertyControls( const OUString
& _rEntryName
, sal_Int16 _nControls
, bool _bEnable
);
102 void ShowPropertyPage( sal_uInt16 _nPageId
, bool _bShow
);
104 void InsertEntry( const OLineDescriptor
&, sal_uInt16 _nPageId
, sal_uInt16 nPos
= EDITOR_LIST_APPEND
);
105 void RemoveEntry( const OUString
& _rName
);
106 void ChangeEntry( const OLineDescriptor
& );
108 void setPageActivationHandler(const Link
<LinkParamNone
*,void>& _rHdl
) { m_aPageActivationHandler
= _rHdl
; }
110 sal_Int32
getMinimumWidth();
111 sal_Int32
getMinimumHeight();
113 void CommitModified();
116 using Window::SetHelpText
;
117 using Window::Update
;
120 OBrowserPage
* getPage( sal_uInt16
& _rPageId
);
121 const OBrowserPage
* getPage( sal_uInt16
& _rPageId
) const;
123 OBrowserPage
* getPage( const OUString
& _rPropertyName
);
124 const OBrowserPage
* getPage( const OUString
& _rPropertyName
) const;
126 void Update(const std::mem_fun_t
<void,OBrowserListBox
>& _aUpdateFunction
);
128 typedef void (OPropertyEditor::*PageOperation
)( OBrowserPage
&, const void* );
129 void forEachPage( PageOperation _pOperation
);
131 void setPageLineListener( OBrowserPage
& _rPage
, const void* );
132 void setPageControlObserver( OBrowserPage
& _rPage
, const void* );
133 void enableHelpSection( OBrowserPage
& _rPage
, const void* );
134 static void setHelpSectionText( OBrowserPage
& _rPage
, const void* _pPointerToOUString
);
135 void setHelpLineLimits( OBrowserPage
& _rPage
, const void* );
138 DECL_LINK(OnPageDeactivate
, TabControl
*, bool);
139 DECL_LINK(OnPageActivate
, TabControl
*, void);
146 #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYEDITOR_HXX
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */