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
VCLXTabPageModel()36 VCLXTabPageModel::VCLXTabPageModel()
37 {
38 }
39
~VCLXTabPageModel()40 VCLXTabPageModel::~VCLXTabPageModel()
41 {
42 #ifndef __SUNPRO_CC
43 OSL_TRACE ("%s", __FUNCTION__);
44 #endif
45 }
46
draw(sal_Int32 nX,sal_Int32 nY)47 void SAL_CALL VCLXTabPageModel::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
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
getInfo()65 ::com::sun::star::awt::DeviceInfo VCLXTabPageModel::getInfo() throw(::com::sun::star::uno::RuntimeException)
66 {
67 ::com::sun::star::awt::DeviceInfo aInfo;// = VCLXDevice::getInfo();
68 return aInfo;
69 }
70
71
setProperty(const::rtl::OUString &,const::com::sun::star::uno::Any &)72 void SAL_CALL VCLXTabPageModel::setProperty(
73 const ::rtl::OUString& /*PropertyName*/,
74 const ::com::sun::star::uno::Any& /*Value*/ )
75 throw(::com::sun::star::uno::RuntimeException)
76 {
77 ::osl::MutexGuard aGuard( GetMutex() );
78
79 /*TabPage* pTabPage = (TabPage*)GetWindow();
80 if ( pTabPage )
81 {
82 VCLXWindow::setProperty( PropertyName, Value );
83 }*/
84 }
85 //XTabPageModel
getTabPageID()86 ::sal_Int16 SAL_CALL VCLXTabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
87 {
88 return 0;
89 }
getEnabled()90 ::sal_Bool SAL_CALL VCLXTabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException)
91 {
92 return false;
93 }
setEnabled(::sal_Bool _enabled)94 void SAL_CALL VCLXTabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
95 {
96 //TabControl* pTabControl = (TabControl*)GetWindow();
97 //if ( pTabControl )
98 // pTabControl->EnablePage(0, true);
99 }
getTitle()100 ::rtl::OUString SAL_CALL VCLXTabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException)
101 {
102 //TabControl* pTabControl = (TabControl*)GetWindow();
103 //if ( pTabControl )
104 // return pTabControl->GetPageText(0);
105 //else
106 return ::rtl::OUString::createFromAscii("");
107 }
setTitle(const::rtl::OUString & _title)108 void SAL_CALL VCLXTabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
109 {
110 //TabControl* pTabControl = (TabControl*)GetWindow();
111 //if ( pTabControl )
112 // pTabControl->SetPageText(0, _title);
113
114 }
getImageURL()115 ::rtl::OUString SAL_CALL VCLXTabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException)
116 {
117 return ::rtl::OUString::createFromAscii("");
118 }
setImageURL(const::rtl::OUString &)119 void SAL_CALL VCLXTabPageModel::setImageURL( const ::rtl::OUString& /*_imageurl*/ ) throw (::com::sun::star::uno::RuntimeException)
120 {
121 //m_sImageURL = _imageurl;
122 }
getToolTip()123 ::rtl::OUString SAL_CALL VCLXTabPageModel::getToolTip() throw (::com::sun::star::uno::RuntimeException)
124 {
125 //return m_sTooltip;
126 return ::rtl::OUString::createFromAscii("");
127 }
setToolTip(const::rtl::OUString & _tooltip)128 void SAL_CALL VCLXTabPageModel::setToolTip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
129 {
130 (void)_tooltip;
131 }
getInfoHelper()132 ::cppu::IPropertyArrayHelper& VCLXTabPageModel::getInfoHelper()
133 {
134 static UnoPropertyArrayHelper* pHelper = NULL;
135 if ( !pHelper )
136 {
137 com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
138 pHelper = new UnoPropertyArrayHelper( aIDs );
139 }
140 return *pHelper;
141 }
getPropertySetInfo()142 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXTabPageModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
143 {
144 static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
145 return xInfo;
146 }
147