1*b0724fc6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*b0724fc6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*b0724fc6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*b0724fc6SAndrew Rist * distributed with this work for additional information 6*b0724fc6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*b0724fc6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*b0724fc6SAndrew Rist * "License"); you may not use this file except in compliance 9*b0724fc6SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*b0724fc6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*b0724fc6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*b0724fc6SAndrew Rist * software distributed under the License is distributed on an 15*b0724fc6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b0724fc6SAndrew Rist * KIND, either express or implied. See the License for the 17*b0724fc6SAndrew Rist * specific language governing permissions and limitations 18*b0724fc6SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*b0724fc6SAndrew Rist *************************************************************/ 21*b0724fc6SAndrew Rist 22*b0724fc6SAndrew Rist 23cdf0e10cSrcweir #include "precompiled_toolkit.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir #include <toolkit/awt/vclxtabpagemodel.hxx> 26cdf0e10cSrcweir #include <vcl/tabpage.hxx> 27cdf0e10cSrcweir #include <vcl/tabctrl.hxx> 28cdf0e10cSrcweir #include <toolkit/helper/property.hxx> 29cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 30cdf0e10cSrcweir #include <toolkit/helper/unopropertyarrayhelper.hxx> 31cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 32cdf0e10cSrcweir // ---------------------------------------------------- 33cdf0e10cSrcweir // class VCLXDialog 34cdf0e10cSrcweir // ---------------------------------------------------- 35cdf0e10cSrcweir 36cdf0e10cSrcweir VCLXTabPageModel::VCLXTabPageModel() 37cdf0e10cSrcweir { 38cdf0e10cSrcweir } 39cdf0e10cSrcweir 40cdf0e10cSrcweir VCLXTabPageModel::~VCLXTabPageModel() 41cdf0e10cSrcweir { 42cdf0e10cSrcweir #ifndef __SUNPRO_CC 43cdf0e10cSrcweir OSL_TRACE ("%s", __FUNCTION__); 44cdf0e10cSrcweir #endif 45cdf0e10cSrcweir } 46cdf0e10cSrcweir 47cdf0e10cSrcweir void SAL_CALL VCLXTabPageModel::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException) 48cdf0e10cSrcweir { 49cdf0e10cSrcweir ::osl::MutexGuard aGuard( GetMutex() ); 50cdf0e10cSrcweir Window* pWindow = GetWindow(); 51cdf0e10cSrcweir 52cdf0e10cSrcweir if ( pWindow ) 53cdf0e10cSrcweir { 54cdf0e10cSrcweir OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); 55cdf0e10cSrcweir if ( !pDev ) 56cdf0e10cSrcweir pDev = pWindow->GetParent(); 57cdf0e10cSrcweir 58cdf0e10cSrcweir Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() ); 59cdf0e10cSrcweir Point aPos = pDev->PixelToLogic( Point( nX, nY ) ); 60cdf0e10cSrcweir 61cdf0e10cSrcweir pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS ); 62cdf0e10cSrcweir } 63cdf0e10cSrcweir } 64cdf0e10cSrcweir 65cdf0e10cSrcweir ::com::sun::star::awt::DeviceInfo VCLXTabPageModel::getInfo() throw(::com::sun::star::uno::RuntimeException) 66cdf0e10cSrcweir { 67cdf0e10cSrcweir ::com::sun::star::awt::DeviceInfo aInfo;// = VCLXDevice::getInfo(); 68cdf0e10cSrcweir return aInfo; 69cdf0e10cSrcweir } 70cdf0e10cSrcweir 71cdf0e10cSrcweir 72cdf0e10cSrcweir void SAL_CALL VCLXTabPageModel::setProperty( 73cdf0e10cSrcweir const ::rtl::OUString& /*PropertyName*/, 74cdf0e10cSrcweir const ::com::sun::star::uno::Any& /*Value*/ ) 75cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException) 76cdf0e10cSrcweir { 77cdf0e10cSrcweir ::osl::MutexGuard aGuard( GetMutex() ); 78cdf0e10cSrcweir 79cdf0e10cSrcweir /*TabPage* pTabPage = (TabPage*)GetWindow(); 80cdf0e10cSrcweir if ( pTabPage ) 81cdf0e10cSrcweir { 82cdf0e10cSrcweir VCLXWindow::setProperty( PropertyName, Value ); 83cdf0e10cSrcweir }*/ 84cdf0e10cSrcweir } 85cdf0e10cSrcweir //XTabPageModel 86cdf0e10cSrcweir ::sal_Int16 SAL_CALL VCLXTabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir return 0; 89cdf0e10cSrcweir } 90cdf0e10cSrcweir ::sal_Bool SAL_CALL VCLXTabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException) 91cdf0e10cSrcweir { 92cdf0e10cSrcweir return false; 93cdf0e10cSrcweir } 94cdf0e10cSrcweir void SAL_CALL VCLXTabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir //TabControl* pTabControl = (TabControl*)GetWindow(); 97cdf0e10cSrcweir //if ( pTabControl ) 98cdf0e10cSrcweir // pTabControl->EnablePage(0, true); 99cdf0e10cSrcweir } 100cdf0e10cSrcweir ::rtl::OUString SAL_CALL VCLXTabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException) 101cdf0e10cSrcweir { 102cdf0e10cSrcweir //TabControl* pTabControl = (TabControl*)GetWindow(); 103cdf0e10cSrcweir //if ( pTabControl ) 104cdf0e10cSrcweir // return pTabControl->GetPageText(0); 105cdf0e10cSrcweir //else 106cdf0e10cSrcweir return ::rtl::OUString::createFromAscii(""); 107cdf0e10cSrcweir } 108cdf0e10cSrcweir void SAL_CALL VCLXTabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir //TabControl* pTabControl = (TabControl*)GetWindow(); 111cdf0e10cSrcweir //if ( pTabControl ) 112cdf0e10cSrcweir // pTabControl->SetPageText(0, _title); 113cdf0e10cSrcweir 114cdf0e10cSrcweir } 115cdf0e10cSrcweir ::rtl::OUString SAL_CALL VCLXTabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException) 116cdf0e10cSrcweir { 117cdf0e10cSrcweir return ::rtl::OUString::createFromAscii(""); 118cdf0e10cSrcweir } 119cdf0e10cSrcweir void SAL_CALL VCLXTabPageModel::setImageURL( const ::rtl::OUString& /*_imageurl*/ ) throw (::com::sun::star::uno::RuntimeException) 120cdf0e10cSrcweir { 121cdf0e10cSrcweir //m_sImageURL = _imageurl; 122cdf0e10cSrcweir } 123cdf0e10cSrcweir ::rtl::OUString SAL_CALL VCLXTabPageModel::getToolTip() throw (::com::sun::star::uno::RuntimeException) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir //return m_sTooltip; 126cdf0e10cSrcweir return ::rtl::OUString::createFromAscii(""); 127cdf0e10cSrcweir } 128cdf0e10cSrcweir void SAL_CALL VCLXTabPageModel::setToolTip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException) 129cdf0e10cSrcweir { 130cdf0e10cSrcweir (void)_tooltip; 131cdf0e10cSrcweir } 132cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& VCLXTabPageModel::getInfoHelper() 133cdf0e10cSrcweir { 134cdf0e10cSrcweir static UnoPropertyArrayHelper* pHelper = NULL; 135cdf0e10cSrcweir if ( !pHelper ) 136cdf0e10cSrcweir { 137cdf0e10cSrcweir com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); 138cdf0e10cSrcweir pHelper = new UnoPropertyArrayHelper( aIDs ); 139cdf0e10cSrcweir } 140cdf0e10cSrcweir return *pHelper; 141cdf0e10cSrcweir } 142cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXTabPageModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); 145cdf0e10cSrcweir return xInfo; 146cdf0e10cSrcweir } 147