1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #include "precompiled_toolkit.hxx" 28 29 #include <toolkit/awt/vclxtabpagemodel.hxx> 30 #include <vcl/tabpage.hxx> 31 #include <vcl/tabctrl.hxx> 32 #include <toolkit/helper/property.hxx> 33 #include <toolkit/helper/vclunohelper.hxx> 34 #include <toolkit/helper/unopropertyarrayhelper.hxx> 35 #include <cppuhelper/typeprovider.hxx> 36 // ---------------------------------------------------- 37 // class VCLXDialog 38 // ---------------------------------------------------- 39 40 VCLXTabPageModel::VCLXTabPageModel() 41 { 42 } 43 44 VCLXTabPageModel::~VCLXTabPageModel() 45 { 46 #ifndef __SUNPRO_CC 47 OSL_TRACE ("%s", __FUNCTION__); 48 #endif 49 } 50 51 void SAL_CALL VCLXTabPageModel::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException) 52 { 53 ::osl::MutexGuard aGuard( GetMutex() ); 54 Window* pWindow = GetWindow(); 55 56 if ( pWindow ) 57 { 58 OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); 59 if ( !pDev ) 60 pDev = pWindow->GetParent(); 61 62 Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() ); 63 Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); 64 65 pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS ); 66 } 67 } 68 69 ::com::sun::star::awt::DeviceInfo VCLXTabPageModel::getInfo() throw(::com::sun::star::uno::RuntimeException) 70 { 71 ::com::sun::star::awt::DeviceInfo aInfo;// = VCLXDevice::getInfo(); 72 return aInfo; 73 } 74 75 76 void SAL_CALL VCLXTabPageModel::setProperty( 77 const ::rtl::OUString& /*PropertyName*/, 78 const ::com::sun::star::uno::Any& /*Value*/ ) 79 throw(::com::sun::star::uno::RuntimeException) 80 { 81 ::osl::MutexGuard aGuard( GetMutex() ); 82 83 /*TabPage* pTabPage = (TabPage*)GetWindow(); 84 if ( pTabPage ) 85 { 86 VCLXWindow::setProperty( PropertyName, Value ); 87 }*/ 88 } 89 //XTabPageModel 90 ::sal_Int16 SAL_CALL VCLXTabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException) 91 { 92 return 0; 93 } 94 ::sal_Bool SAL_CALL VCLXTabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException) 95 { 96 return false; 97 } 98 void SAL_CALL VCLXTabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException) 99 { 100 //TabControl* pTabControl = (TabControl*)GetWindow(); 101 //if ( pTabControl ) 102 // pTabControl->EnablePage(0, true); 103 } 104 ::rtl::OUString SAL_CALL VCLXTabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException) 105 { 106 //TabControl* pTabControl = (TabControl*)GetWindow(); 107 //if ( pTabControl ) 108 // return pTabControl->GetPageText(0); 109 //else 110 return ::rtl::OUString::createFromAscii(""); 111 } 112 void SAL_CALL VCLXTabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException) 113 { 114 //TabControl* pTabControl = (TabControl*)GetWindow(); 115 //if ( pTabControl ) 116 // pTabControl->SetPageText(0, _title); 117 118 } 119 ::rtl::OUString SAL_CALL VCLXTabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException) 120 { 121 return ::rtl::OUString::createFromAscii(""); 122 } 123 void SAL_CALL VCLXTabPageModel::setImageURL( const ::rtl::OUString& /*_imageurl*/ ) throw (::com::sun::star::uno::RuntimeException) 124 { 125 //m_sImageURL = _imageurl; 126 } 127 ::rtl::OUString SAL_CALL VCLXTabPageModel::getToolTip() throw (::com::sun::star::uno::RuntimeException) 128 { 129 //return m_sTooltip; 130 return ::rtl::OUString::createFromAscii(""); 131 } 132 void SAL_CALL VCLXTabPageModel::setToolTip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException) 133 { 134 (void)_tooltip; 135 } 136 ::cppu::IPropertyArrayHelper& VCLXTabPageModel::getInfoHelper() 137 { 138 static UnoPropertyArrayHelper* pHelper = NULL; 139 if ( !pHelper ) 140 { 141 com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); 142 pHelper = new UnoPropertyArrayHelper( aIDs ); 143 } 144 return *pHelper; 145 } 146 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXTabPageModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) 147 { 148 static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); 149 return xInfo; 150 } 151