1*46dbaceeSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*46dbaceeSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*46dbaceeSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*46dbaceeSAndrew Rist * distributed with this work for additional information 6*46dbaceeSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*46dbaceeSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*46dbaceeSAndrew Rist * "License"); you may not use this file except in compliance 9*46dbaceeSAndrew Rist * with the License. You may obtain a copy of the License at 10*46dbaceeSAndrew Rist * 11*46dbaceeSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*46dbaceeSAndrew Rist * 13*46dbaceeSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*46dbaceeSAndrew Rist * software distributed under the License is distributed on an 15*46dbaceeSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*46dbaceeSAndrew Rist * KIND, either express or implied. See the License for the 17*46dbaceeSAndrew Rist * specific language governing permissions and limitations 18*46dbaceeSAndrew Rist * under the License. 19*46dbaceeSAndrew Rist * 20*46dbaceeSAndrew Rist *************************************************************/ 21*46dbaceeSAndrew Rist 22*46dbaceeSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_ 25cdf0e10cSrcweir #define _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "pcrcommon.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir /** === begin UNO includes === **/ 30cdf0e10cSrcweir #include <com/sun/star/inspection/XPropertyControl.hpp> 31cdf0e10cSrcweir /** === end UNO includes === **/ 32cdf0e10cSrcweir #include <vcl/tabctrl.hxx> 33cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 34cdf0e10cSrcweir #include <boost/mem_fn.hpp> 35cdf0e10cSrcweir #include <map> 36cdf0e10cSrcweir 37cdf0e10cSrcweir //............................................................................ 38cdf0e10cSrcweir namespace pcr 39cdf0e10cSrcweir { 40cdf0e10cSrcweir //............................................................................ 41cdf0e10cSrcweir 42cdf0e10cSrcweir class IPropertyLineListener; 43cdf0e10cSrcweir class IPropertyControlObserver; 44cdf0e10cSrcweir class OBrowserPage; 45cdf0e10cSrcweir struct OLineDescriptor; 46cdf0e10cSrcweir class OBrowserListBox; 47cdf0e10cSrcweir 48cdf0e10cSrcweir //======================================================================== 49cdf0e10cSrcweir //= OPropertyEditor 50cdf0e10cSrcweir //======================================================================== 51cdf0e10cSrcweir class OPropertyEditor : public Control 52cdf0e10cSrcweir { 53cdf0e10cSrcweir private: 54cdf0e10cSrcweir typedef ::std::map< ::rtl::OUString, sal_uInt16 > MapStringToPageId; 55cdf0e10cSrcweir struct HiddenPage 56cdf0e10cSrcweir { 57cdf0e10cSrcweir sal_uInt16 nPos; 58cdf0e10cSrcweir TabPage* pPage; HiddenPagepcr::OPropertyEditor::HiddenPage59cdf0e10cSrcweir HiddenPage() : nPos( 0 ), pPage( NULL ) { } HiddenPagepcr::OPropertyEditor::HiddenPage60cdf0e10cSrcweir HiddenPage( sal_uInt16 _nPos, TabPage* _pPage ) : nPos( _nPos ), pPage( _pPage ) { } 61cdf0e10cSrcweir }; 62cdf0e10cSrcweir 63cdf0e10cSrcweir private: 64cdf0e10cSrcweir TabControl m_aTabControl; 65cdf0e10cSrcweir IPropertyLineListener* m_pListener; 66cdf0e10cSrcweir IPropertyControlObserver* m_pObserver; 67cdf0e10cSrcweir sal_uInt16 m_nNextId; 68cdf0e10cSrcweir Link m_aPageActivationHandler; 69cdf0e10cSrcweir bool m_bHasHelpSection; 70cdf0e10cSrcweir sal_Int32 m_nMinHelpLines; 71cdf0e10cSrcweir sal_Int32 m_nMaxHelpLines; 72cdf0e10cSrcweir 73cdf0e10cSrcweir MapStringToPageId m_aPropertyPageIds; 74cdf0e10cSrcweir ::std::map< sal_uInt16, HiddenPage > m_aHiddenPages; 75cdf0e10cSrcweir 76cdf0e10cSrcweir protected: 77cdf0e10cSrcweir void Resize(); 78cdf0e10cSrcweir void GetFocus(); 79cdf0e10cSrcweir 80cdf0e10cSrcweir public: 81cdf0e10cSrcweir OPropertyEditor (Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL); 82cdf0e10cSrcweir 83cdf0e10cSrcweir ~OPropertyEditor(); 84cdf0e10cSrcweir 85cdf0e10cSrcweir void EnableUpdate(); 86cdf0e10cSrcweir void DisableUpdate(); 87cdf0e10cSrcweir 88cdf0e10cSrcweir void SetLineListener( IPropertyLineListener* ); 89cdf0e10cSrcweir void SetControlObserver( IPropertyControlObserver* ); 90cdf0e10cSrcweir 91cdf0e10cSrcweir void EnableHelpSection( bool _bEnable ); 92cdf0e10cSrcweir bool HasHelpSection() const; 93cdf0e10cSrcweir void SetHelpText( const ::rtl::OUString& _rHelpText ); 94cdf0e10cSrcweir void SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines ); 95cdf0e10cSrcweir 96cdf0e10cSrcweir void SetHelpId( const rtl::OString& sHelpId ); 97cdf0e10cSrcweir sal_uInt16 AppendPage( const String& r, const rtl::OString& _rHelpId ); 98cdf0e10cSrcweir void SetPage( sal_uInt16 ); 99cdf0e10cSrcweir void RemovePage(sal_uInt16 nID); 100cdf0e10cSrcweir sal_uInt16 GetCurPage(); 101cdf0e10cSrcweir void ClearAll(); 102cdf0e10cSrcweir 103cdf0e10cSrcweir void SetPropertyValue(const ::rtl::OUString& _rEntryName, const ::com::sun::star::uno::Any& _rValue, bool _bUnknownValue ); 104cdf0e10cSrcweir ::com::sun::star::uno::Any GetPropertyValue(const ::rtl::OUString& rEntryName ) const; 105cdf0e10cSrcweir sal_uInt16 GetPropertyPos(const ::rtl::OUString& rEntryName ) const; 106cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > 107cdf0e10cSrcweir GetPropertyControl( const ::rtl::OUString& rEntryName ); 108cdf0e10cSrcweir void EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable ); 109cdf0e10cSrcweir void EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir void ShowPropertyPage( sal_uInt16 _nPageId, bool _bShow ); 112cdf0e10cSrcweir 113cdf0e10cSrcweir sal_uInt16 InsertEntry( const OLineDescriptor&, sal_uInt16 _nPageId, sal_uInt16 nPos = EDITOR_LIST_APPEND ); 114cdf0e10cSrcweir void RemoveEntry( const ::rtl::OUString& _rName ); 115cdf0e10cSrcweir void ChangeEntry( const OLineDescriptor& ); 116cdf0e10cSrcweir setPageActivationHandler(const Link & _rHdl)117cdf0e10cSrcweir void setPageActivationHandler(const Link& _rHdl) { m_aPageActivationHandler = _rHdl; } getPageActivationHandler() const118cdf0e10cSrcweir Link getPageActivationHandler() const { return m_aPageActivationHandler; } 119cdf0e10cSrcweir 120cdf0e10cSrcweir // #95343# ------------------------------- 121cdf0e10cSrcweir sal_Int32 getMinimumWidth(); 122cdf0e10cSrcweir sal_Int32 getMinimumHeight(); 123cdf0e10cSrcweir 124cdf0e10cSrcweir void CommitModified(); 125cdf0e10cSrcweir 126cdf0e10cSrcweir protected: 127cdf0e10cSrcweir using Window::SetHelpText; 128cdf0e10cSrcweir using Window::Update; 129cdf0e10cSrcweir 130cdf0e10cSrcweir private: 131cdf0e10cSrcweir OBrowserPage* getPage( sal_uInt16& _rPageId ); 132cdf0e10cSrcweir const OBrowserPage* getPage( sal_uInt16& _rPageId ) const; 133cdf0e10cSrcweir 134cdf0e10cSrcweir OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName ); 135cdf0e10cSrcweir const OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName ) const; 136cdf0e10cSrcweir 137cdf0e10cSrcweir void Update(const ::std::mem_fun_t<void,OBrowserListBox>& _aUpdateFunction); 138cdf0e10cSrcweir 139cdf0e10cSrcweir typedef void (OPropertyEditor::*PageOperation)( OBrowserPage&, const void* ); 140cdf0e10cSrcweir void forEachPage( PageOperation _pOperation, const void* _pArgument = NULL ); 141cdf0e10cSrcweir 142cdf0e10cSrcweir void setPageLineListener( OBrowserPage& _rPage, const void* ); 143cdf0e10cSrcweir void setPageControlObserver( OBrowserPage& _rPage, const void* ); 144cdf0e10cSrcweir void enableHelpSection( OBrowserPage& _rPage, const void* ); 145cdf0e10cSrcweir void setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString ); 146cdf0e10cSrcweir void setHelpLineLimits( OBrowserPage& _rPage, const void* ); 147cdf0e10cSrcweir 148cdf0e10cSrcweir protected: 149cdf0e10cSrcweir DECL_LINK(OnPageDeactivate, TabControl*); 150cdf0e10cSrcweir DECL_LINK(OnPageActivate, TabControl*); 151cdf0e10cSrcweir }; 152cdf0e10cSrcweir 153cdf0e10cSrcweir //............................................................................ 154cdf0e10cSrcweir } // namespace pcr 155cdf0e10cSrcweir //............................................................................ 156cdf0e10cSrcweir 157cdf0e10cSrcweir #endif // _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_ 158cdf0e10cSrcweir 159cdf0e10cSrcweir 160