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