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/tabpage.hxx>
33 class IPropertyLineListener
;
34 class IPropertyControlObserver
;
36 struct OLineDescriptor
;
37 class OBrowserListBox
;
42 class OPropertyEditor final
: 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
) { }
54 VclPtr
<TabControl
> m_aTabControl
;
55 IPropertyLineListener
* m_pListener
;
56 IPropertyControlObserver
* m_pObserver
;
58 Link
<LinkParamNone
*,void> m_aPageActivationHandler
;
59 bool m_bHasHelpSection
;
60 sal_Int32 m_nMinHelpLines
;
61 sal_Int32 m_nMaxHelpLines
;
63 MapStringToPageId m_aPropertyPageIds
;
64 std::map
< sal_uInt16
, HiddenPage
> m_aHiddenPages
;
66 void Resize() override
;
67 void GetFocus() override
;
70 explicit OPropertyEditor (vcl::Window
* pParent
);
72 virtual ~OPropertyEditor() override
;
73 virtual void dispose() override
;
78 void SetLineListener( IPropertyLineListener
* );
79 void SetControlObserver( IPropertyControlObserver
* );
81 void EnableHelpSection( bool _bEnable
);
82 bool HasHelpSection() const { return m_bHasHelpSection
; }
83 void SetHelpText( const OUString
& _rHelpText
);
84 void SetHelpLineLimites( sal_Int32 _nMinLines
, sal_Int32 _nMaxLines
);
86 void SetHelpId( const OString
& sHelpId
);
87 sal_uInt16
AppendPage( const OUString
& r
, const OString
& _rHelpId
);
88 void SetPage( sal_uInt16
);
89 void RemovePage(sal_uInt16 nID
);
90 sal_uInt16
GetCurPage() const;
93 void SetPropertyValue(const OUString
& _rEntryName
, const css::uno::Any
& _rValue
, bool _bUnknownValue
);
94 sal_uInt16
GetPropertyPos(const OUString
& rEntryName
) const;
95 css::uno::Reference
< css::inspection::XPropertyControl
>
96 GetPropertyControl( const OUString
& rEntryName
);
97 void EnablePropertyLine( const OUString
& _rEntryName
, bool _bEnable
);
98 void EnablePropertyControls( const OUString
& _rEntryName
, sal_Int16 _nControls
, bool _bEnable
);
100 void ShowPropertyPage( sal_uInt16 _nPageId
, bool _bShow
);
102 void InsertEntry( const OLineDescriptor
&, sal_uInt16 _nPageId
, sal_uInt16 nPos
= EDITOR_LIST_APPEND
);
103 void RemoveEntry( const OUString
& _rName
);
104 void ChangeEntry( const OLineDescriptor
& );
106 void setPageActivationHandler(const Link
<LinkParamNone
*,void>& _rHdl
) { m_aPageActivationHandler
= _rHdl
; }
108 sal_Int32
getMinimumWidth() const;
109 sal_Int32
getMinimumHeight() const;
111 void CommitModified();
114 using Window::SetHelpText
;
115 using Window::Update
;
117 OBrowserPage
* getPage( sal_uInt16 _rPageId
);
118 const OBrowserPage
* getPage( sal_uInt16 _rPageId
) const;
120 OBrowserPage
* getPage( const OUString
& _rPropertyName
);
121 const OBrowserPage
* getPage( const OUString
& _rPropertyName
) const;
123 void Update(const std::function
<void(OBrowserListBox
*)>& _aUpdateFunction
);
125 typedef void (OPropertyEditor::*PageOperation
)( OBrowserPage
&, const void* );
126 void forEachPage( PageOperation _pOperation
);
128 void setPageLineListener( OBrowserPage
& _rPage
, const void* );
129 void setPageControlObserver( OBrowserPage
& _rPage
, const void* );
130 void enableHelpSection( OBrowserPage
& _rPage
, const void* );
131 static void setHelpSectionText( OBrowserPage
& _rPage
, const void* _pPointerToOUString
);
132 void setHelpLineLimits( OBrowserPage
& _rPage
, const void* );
134 DECL_LINK(OnPageDeactivate
, TabControl
*, bool);
135 DECL_LINK(OnPageActivate
, TabControl
*, void);
142 #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYEDITOR_HXX
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */